okta-sdk-dotnet icon indicating copy to clipboard operation
okta-sdk-dotnet copied to clipboard

Ditch StringEnum

Open rcollette opened this issue 2 years ago • 1 comments

Describe the feature request?

Serializers have the the ability to convert Enums to strings. There is no need for StringEnum and in fact it gets in the way of doing what would normally be possible with regular Enums like:

        expected.Status = userStatus switch
        {
            UserStatus.STAGED => UserProfileStatus.STAGED,
            UserStatus.PROVISIONED => UserProfileStatus.PROVISIONED
        };

In the example here I'm unit testing with DTOs that have a different type than what the Okta SDK returns.

The above results in the compile error: A constant value is expected

New or Affected Resource(s)

UserStatus at the least

Provide a documentation link

No response

Additional Information?

No response

rcollette avatar Oct 27 '23 17:10 rcollette

Hi @rcollette ,

Thanks for your feedback. The reason we use StringEnums is to avoid runtime errors if the API adds new values that haven't been impacted into the SDK yet. That being said, we have plans in the future to revisit enums but not in the short term.

laura-rodriguez avatar Nov 08 '23 16:11 laura-rodriguez