Repository navigation
fix(serialization-form): serialize enum members consistently - #799
Merged
Vincent Biret (baywet) merged 3 commits intoOct 14, 2026
Merged
Vincent Biret (baywet) merged 3 commits into
Vincent Biret (baywet) merged 3 commits into
Conversation
There was a problem hiding this comment.
🟢 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.
Vincent Biret (baywet)
approved these changes
Oct 14, 2026
Vincent Biret (baywet)
left a comment
Member
There was a problem hiding this comment.
Thanks for the contribution!
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



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
Nonefrom 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, runpip install -r requirements-dev.txt, thenpytest: 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, andmypy kiota_serialization_formpassed locally on Python 3.14.6. Pylint prints the existingsuggestion-modeconfiguration 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 main3ab36ceba467bf2c7cf5b282e34c568fa21d6b70: 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.