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

Ditch StringEnum #680

Open
rcollette opened this issue Oct 27, 2023 · 1 comment
Open

Ditch StringEnum #680

rcollette opened this issue Oct 27, 2023 · 1 comment

Comments

@rcollette
Copy link

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

@laura-rodriguez
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants