Skip to content

Comments

When deserializing a Map into an enum, allow for ignored extra keys#22

Merged
rushmorem merged 3 commits intorushmorem:mainfrom
nresare:allow_extra_data_in_enum_maps
Jan 21, 2025
Merged

When deserializing a Map into an enum, allow for ignored extra keys#22
rushmorem merged 3 commits intorushmorem:mainfrom
nresare:allow_extra_data_in_enum_maps

Conversation

@nresare
Copy link
Contributor

@nresare nresare commented Jan 9, 2025

When deserializing an enum the Deserializer currently expects a map with a single key corresponding to the variant of the enum. This breaks deserialization of query results in surrealdb, as an id key is injected into the map in the returned data.

This change modifies the enum deserialization logic to succeed if exactly one of all possible variants exists as a key in the map, regardless of any other data.

@rushmorem rushmorem merged commit 21668cf into rushmorem:main Jan 21, 2025
1 of 2 checks passed
@rushmorem
Copy link
Owner

Thank you!

rushmorem added a commit that referenced this pull request Jan 29, 2025
rushmorem added a commit that referenced this pull request Jan 29, 2025
rushmorem added a commit that referenced this pull request May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants