Skip to content

Problem with [EnumMember] when using JsonStringEnumConverter #645

@JeroenVinke

Description

@JeroenVinke

The JsonStringEnumConverter does not and will not support [EnumMember] attributes. So when you use the JsonStringEnumConverter globally in your project, the enum's in fido2-net-lib's models can not correctly be serialized/deserialized. This is not a problem when using Newtonsoft.Json, but are hitting this issue because we are converting projects from Newtonsoft.Json to only use System.Text.Json.

To support this use case, in .NET 9 Microsoft has introduced the [JsonStringEnumMemberName] attribute.

When fido2-net-lib supports .NET 9 or higher, I would like to propose to add the [JsonStringEnumMemberName] to all properties currently decorated with the [EnumMember] attribute, so that serialization/deserialization with the JsonStringEnumConverter works out of the box.

This problem was also mentioned in #594

Thank you for your efforts in building and maintaining this library. If necessary I can create a PR when the library has been updated to use .NET 9 or higher.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions