Repository navigation
fix(serialization-text): parse "none" as the None_ enum member - #803
Merged
Vincent Biret (baywet) merged 2 commits intoOct 15, 2026
Merged
Conversation
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.
Vincent Biret (baywet)
approved these changes
Oct 15, 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
TextParseNode.get_enum_valuecapitalizes the raw text to find the member, so"none"looks up"None", which a Python enum can't have. Generated enums call that memberNone_, andTextSerializationWriterwrites it as"none", so the value doesn't round-trip and parsing raisesInvalid key: None. This maps"none"toNone_the same wayJsonParseNodedoes.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 && pytesttest_get_enum_value_none_memberfails on main withException: Invalid key: None for enum ...and passes with this change.