Skip to content

fix(serialization-form): serialize enum members consistently - #799

Merged
Vincent Biret (baywet) merged 3 commits into
microsoft:mainfrom
rksharma-owg:codex/fix-form-enum-serialization
Oct 14, 2026
Merged

Vincent Biret (baywet) merged 3 commits into
microsoft:mainfrom
rksharma-owg:codex/fix-form-enum-serialization

Conversation

@rksharma-owg

@rksharma-owg RKS (rksharma-owg) commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Overview

Serialize form enum members consistently through typed, additional-data, and model paths. Generic dispatch used exact types and sent enum subclasses into object introspection; the typed enum writer also omitted valid zero-valued numeric members through a truthiness check.

Recognize enum instances before primitive/object dispatch and distinguish None from a supplied enum member. Add regression coverage for escaped string enum values, numeric enums/flags with zero and nonzero values, and existing null/key/list behavior.

Related Issue

Fixes #798

Testing Instructions

  • From packages/serialization/form, run pip install -r requirements-dev.txt, then pytest: 118 passed. Regression run on the unchanged implementation: 14 failed / 104 passed, with failures for enum dispatch and omitted zero members.

  • yapf -dr kiota_serialization_form, isort --check-only kiota_serialization_form, pylint kiota_serialization_form --disable=W --rcfile=.pylintrc, and mypy kiota_serialization_form passed locally on Python 3.14.6. Pylint prints the existing suggestion-mode configuration diagnostic while exiting 0.

  • Full fork preflight: the patch and baseline each passed the eight-package Python 3.10–3.14 matrix, five generated-code type checks, and CodeQL (92 matrix cases). Form tests: 118 passed per patch version, 95 per baseline version; no skipped tests. Tested patch: da8bdb7e5874d1bf563eadefa4ec66e5cddf2aee; baseline: 47b8104025a0bf60de004ea1406a32433e8fff38.

  • Main advanced with release-only version/changelog metadata during validation. Current-main merge preflight passed 12 follow-up jobs on merge 9e794343ec93e6a674b5283a69098321a548d58c, combining the patch with main 3ab36ceba467bf2c7cf5b282e34c568fa21d6b70: form on all five Python versions and the other seven packages on Python 3.14. Production/test code, dependencies, and CI commands were unchanged by the release metadata. Every runner verifies its tested commit; personal preflight workflows stay outside this PR.

  • Final merge-commit CodeQL also passed for the published head 9e794343ec93e6a674b5283a69098321a548d58c. The already-tested merge is included so this branch is current with the release baseline.

Copilot AI balanced review requested due to automatic review settings October 14, 2026 18:01
@rksharma-owg
RKS (rksharma-owg) requested a review from a team as a code owner October 14, 2026 18:01

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

The focused fixes address both reported defects with appropriate regression coverage and no identified blocking issues.

0 open findings

What changed in this PR

Fixes #798 by making form enum serialization consistent across typed, additional-data, and model paths.

Changes:

  • Dispatches enum instances before primitive and object handling.
  • Preserves zero-valued enum members.
  • Adds regression coverage for escaping, numeric enums, flags, and existing omission and collection behavior.
File Description
packages/​serialization/​form/​tests/​unit/​test_form_serialization_writer.py Adds enum serialization regression tests.
packages/​serialization/​form/​kiota_serialization_form/​form_serialization_writer.py Fixes enum dispatch and zero-value handling.

🧠 Review effort: Balanced


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

@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!

@github-project-automation github-project-automation Bot moved this to In Progress 🚧 in Kiota Oct 14, 2026
Copilot AI balanced review requested due to automatic review settings October 14, 2026 18:48
@sonarqubecloud

Copy link
Copy Markdown

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

The focused fixes address both reported defects with relevant regression coverage and no identified blocking issues.

0 open findings

🧠 Review effort: Balanced

@baywet
Vincent Biret (baywet) merged commit 88ff81a into microsoft:main Oct 14, 2026
104 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress 🚧 to Done ✔️ in Kiota Oct 14, 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.

Form enum serialization fails in additional data and omits zero-valued members

3 participants