Skip to content
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

Make the soure generator format enums using their identifiers rather than numeric values. #87557

Merged
merged 2 commits into from
Jun 15, 2023

Conversation

eiriktsarpalis
Copy link
Member

Updates the enum literal value formatter so that they are specified using their names rather than numeric values. For example the source generated code:

NumberHandling = (global::System.Text.Json.Serialization.JsonNumberHandling)3,

is now changed to

NumberHandling = global::System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString | global::System.Text.Json.Serialization.JsonNumberHandling.WriteAsString,

Contributes to #79534.

@ghost
Copy link

ghost commented Jun 14, 2023

Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis
See info in area-owners.md if you want to be subscribed.

Issue Details

Updates the enum literal value formatter so that they are specified using their names rather than numeric values. For example the source generated code:

NumberHandling = (global::System.Text.Json.Serialization.JsonNumberHandling)3,

is now changed to

NumberHandling = global::System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString | global::System.Text.Json.Serialization.JsonNumberHandling.WriteAsString,

Contributes to #79534.

Author: eiriktsarpalis
Assignees: -
Labels:

area-System.Text.Json

Milestone: -

@eiriktsarpalis eiriktsarpalis added this to the 8.0.0 milestone Jun 14, 2023
@eiriktsarpalis eiriktsarpalis merged commit a2f4a94 into dotnet:main Jun 15, 2023
@eiriktsarpalis eiriktsarpalis deleted the improve/enum-formatting branch June 15, 2023 12:32
@ghost ghost locked as resolved and limited conversation to collaborators Jul 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants