Skip to content

Map enum properties as strings as specified #461

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

yinzara
Copy link

@yinzara yinzara commented May 29, 2025

Fixes #459

NumberHandling = JsonNumberHandling.AllowReadingFromString)]
NumberHandling = JsonNumberHandling.AllowReadingFromString
#if NET9_0_OR_GREATER
,UseStringEnumConverter = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want different behaviors here based on which build is being used.
cc: @eiriktsarpalis

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this doesn't address the issue at hand. UseStringEnumConverter tells the source generator to use the string-based converter for enums that it can see at compile time. It can't apply the same behavior to types introduced by the user since it can't be done in a AOT compatible manner.

@yinzara
Copy link
Author

yinzara commented May 29, 2025 via email

@eiriktsarpalis
Copy link
Contributor

Superseded by #463. I'm going to close this, but thank you for the contribution regardless.

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.

McpJsonUtilities does not function as documented - Enums get serialized to integer, not string
4 participants