cake-build / cake-build/cake

Support converting enums from string values

Open
#1,878 27 comments 0 reactions 0 assignees View on GitHub
Feature
Dominant language
C#
Stars
4.2k
Forks
778
Avg merge
3h 37m
Merged PRs (30d)
21

Description

Currently, when setting an Enum value on say a setting class, it is necessary to be explicit about it, i.e. if setting this: https://cakebuild.net/api/Cake.Common.Tools.SignTool/SignToolSignSettings/BE7882E3 you would need to do:

```
DigestAlgorithm = SignToolDigestAlgorithm.Sha256
```

If might be nice to be able to do something like this:

```
DigestAlgorithm = "sha256"
```

Where Cake would attempt to "find" an enum value that matched the string value, and if it can, set it appropriately.

@cake-build/cake-team what are your thoughts?

Contributor guide

Open the contributing guide

Research direction

Start with the SignToolSignSettings.DigestAlgorithm API entry point and the SignToolDigestAlgorithm enum named in the issue. Clarify how string matching should work and where conversion applies, then verify that a value such as "sha256" can be accepted and mapped appropriately without changing explicit enum assignment.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.