SDK you're using (please complete the following information):
3.31.0
Describe the bug
See Xero.NetStandard.OAuth2.Model.Accounting.CurrencyCode
CurrencyCode enum name for Turkish Lira is TRY_LIRA, which breaks expectations when using .ToString()
To Reproduce
Steps to reproduce the behavior:
Call .ToString() on a CurrencyCode value
If that CurrencyCode is Turkish Lira (TRY_LIRA) then the output is TRY_LIRA
Expected behavior
Expect value to be TRY as this is the ISO4217 code.
Additional context
enum.ToString() is commonly used as the most obvious way to get the 3 letter ISO4217 code. Turkish Lira is the only exception to the rule and it is not immediately obvious that this is a potentally invalid operation if a downstream client expects a 3 letter string.
This is also inconsistent with other CurrencyCode types across the codebase. Xero.NetStandard.OAuth2.Model.Bankfeeds.CurrencyCode and Xero.NetStandard.OAuth2.Model.Project.CurrenctCode both use the name TRY.
It is possible to fetch the EnumMember attribute via reflection but this is not immediately intuitive. There is no way to protect against accidental use of ToString, other than via code review.
SDK you're using (please complete the following information):
Describe the bug See Xero.NetStandard.OAuth2.Model.Accounting.CurrencyCode CurrencyCode enum name for Turkish Lira is
TRY_LIRA
, which breaks expectations when using.ToString()
To Reproduce Steps to reproduce the behavior:
.ToString()
on a CurrencyCode valueTRY_LIRA
Expected behavior Expect value to be
TRY
as this is the ISO4217 code.Additional context enum.ToString() is commonly used as the most obvious way to get the 3 letter ISO4217 code. Turkish Lira is the only exception to the rule and it is not immediately obvious that this is a potentally invalid operation if a downstream client expects a 3 letter string.
This is also inconsistent with other CurrencyCode types across the codebase. Xero.NetStandard.OAuth2.Model.Bankfeeds.CurrencyCode and Xero.NetStandard.OAuth2.Model.Project.CurrenctCode both use the name
TRY
.It is possible to fetch the
EnumMember
attribute via reflection but this is not immediately intuitive. There is no way to protect against accidental use of ToString, other than via code review.