-
-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Labels
enhancementNew feature or requestNew feature or requestquestionFurther information is requestedFurther information is requested
Description
The TOML I want to parse looks like this:
[podcast.example]
on_error = "skip_episode"
I tried to parse it into a model with an enum, like this:
public enum OnError {
SkipPodcast,
SkipEpisode,
Abort,
}
Tomlyn expects to read values as PascalCase
rather than snake_case
, causing an error:
Error: (45,1) : error : Exception while trying to convert System.String to type GrabCastSharp.OnError. Reason: Requested value 'skip_episode' was not found.
(45,1) : error : The property value of type System.String couldn't be converted to System.Nullable`1[GrabCastSharp.OnError] for the property GrabCastSharp.Podcast/on_error
I tried to use DataMember
annotations to rename the enum variants, but it had no effect:
public enum OnError {
[DataMember(Name = "skip_podcast")]
SkipPodcast,
[DataMember(Name = "skip_episode")]
SkipEpisode,
[DataMember(Name = "abort")]
Abort,
}
Is there a way to achieve this?
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestquestionFurther information is requestedFurther information is requested