-
-
Notifications
You must be signed in to change notification settings - Fork 550
Open
Description
Hi,
After the update to NJsonSchema v11.5.1 the conversion of enum values to string is broken.
The reason is that in the Enum.liquid the [System.Runtime.Serialization.EnumMember(Value = @"somevalue")] has been replaced by [System.Text.Json.Serialization.JsonStringEnumMemberName(@"somevalue")], but the method ConvertToString that is used for URL parameters to convert a value to string only checks for the EnumMember attribute.
I see at least 2 possible solutions:
- Keep the both
[System.Runtime.Serialization.EnumMember(Value = @"somevalue")]and[System.Text.Json.Serialization.JsonStringEnumMemberName(@"somevalue")]on each enum value. - Adjust the ConvertToString method to read the JsonStringEnumMemberName attribute instead of the EnumMember attribute (or both)
Personally I would go for option 1 because it will have less backwards compatibility issues. Maybe there are other pieces of code that still use the EnumMember attribute.
Maybe the fix can be added to #1865.
Regards,
Jochen
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels