-
Notifications
You must be signed in to change notification settings - Fork 3
Feature: Custom name on enum fields #28
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
Hiya,
When deserializing to an enum right now its mandatory to have the fields match the string exactly (AFAIK).
This however stops me from adhering to proper C# guidelines concerning naming and so on.
For example:
public enum OrderItemCouponType
{
Bol = 0,
// ReSharper disable InconsistentNaming
percent = 1,
fixed_product = 2,
fixed_cart = 3,
percent_product = 4,
// ReSharper restore InconsistentNaming
Unknown = 5,
Eol = 6
}Should really be:
public enum OrderItemCouponType
{
Bol = 0,
Percent = 1,
FixedProduct = 2,
FixedCart = 3,
PercentProduct = 4,
Unknown = 5,
Eol = 6
}I'd imagine reusing the PhpProperty for this like
public enum OrderItemCouponType
{
Bol = 0,
[PhpProperty("percent")]
Percent = 1,
[PhpProperty("fixes_product")]
FixedProduct = 2,
[PhpProperty("fixed_cart")]
FixedCart = 3,
[PhpProperty("percent_product")]
PercentProduct = 4,
Unknown = 5,
Eol = 6
}Let me know what you think.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request