Closed frnsys closed 10 months ago
That's a fair point.
Unfortunately, currently it can only be set per enum member.
I have come up with a plan to implement the following features
Provide multiple EnumFormatter
s.
For example,
LowerCamelCaseEnumFormatter
.UpperCamelCaseEnumFormatter
The behavior can be changed globally by specifying them in YamlSerializerOptions.
In addition, a feature to specify a formatter for each type, as shown below, would satisfy the request.
[YamlFormatter(typeof(UpperCamelCaseEnumFormatter))]
enum Foo
{
A,
B,
C
}
That sounds great to me. For now I have a workaround that seems ok. Thanks again.
In #60, serialization format of enum can now be specified.
[YamlObject(NamingConvention.UpperCamelCase)]
enum Foo
{
A,
B,
C
}
Not that it can only be changed for each enum type.
Hi, thanks for this library, it's great.
Is it possible to configure enum deserialization? My input yaml has enum values serialized like
Foo
,Bar
, but it looks like this library requires them to be serialized as camel case (foo
,bar
). Is it possible to have an attribute or something that specifies what casing scheme it should be deserialized with (similar to serde'srename_all
)?Thanks