Skip to content

fix(serialization-text): parse "none" as the None_ enum member - #803

Merged
Vincent Biret (baywet) merged 2 commits into
microsoft:mainfrom
anishmehta24:fix/text-none-enum
Oct 15, 2026
Merged

Vincent Biret (baywet) merged 2 commits into
microsoft:mainfrom
anishmehta24:fix/text-none-enum

Conversation

@anishmehta24

Copy link
Copy Markdown
Contributor

Overview

TextParseNode.get_enum_value capitalizes the raw text to find the member, so "none" looks up "None", which a Python enum can't have. Generated enums call that member None_, and TextSerializationWriter writes it as "none", so the value doesn't round-trip and parsing raises Invalid key: None. This maps "none" to None_ the same way JsonParseNode does.

Related Issue

None, found while comparing the text and JSON parse nodes.

Notes

Only the "none" case changes. Other values are looked up as before.

Testing Instructions

  • cd packages/serialization/text && pytest
  • test_get_enum_value_none_member fails on main with Exception: Invalid key: None for enum ... and passes with this change.

TextParseNode capitalized the raw value to find the enum member, so
"none" looked up "None", which Python enums cannot use. Generated
enums name that member None_, and the text writer writes it as
"none", so it did not round-trip and raised "Invalid key". Map it
the same way JsonParseNode does.
@anishmehta24
Anish Mehta (anishmehta24) requested a review from a team as a code owner October 15, 2026 11:44
Copilot AI balanced review requested due to automatic review settings October 15, 2026 11:44

This comment was marked as off-topic.

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

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 fix includes a regression test and has no identified blocking issues.

0 open findings

🧠 Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 15, 2026 12:27

This comment was marked as off-topic.

@sonarqubecloud

Copy link
Copy Markdown

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

3 participants