-
Notifications
You must be signed in to change notification settings - Fork 123
Open
Labels
Description
Describe the bug
When the models are generated using the sdk-automation based on the OpenApi Specifications, the enums fields in C# are assigned their respective integer values based on alphabetical order. This may pose a problem when f.e. developers upgrade the library and have stored it previously as integers.
See also: dotnet/csharplang#2849
The AWS-dotnet SDK, takes a forward compatible approach
When enums are removed, or added, the following happens:
To Reproduce:
- By adding the 'Bizum'-payment method here: https://github.com/Adyen/adyen-dotnet-api-library/pull/1059/files#diff-923be669a9c28428736a92f8f172cb98a48a765df4992204f74b4ecd4443fb2aR256 the enums are all bumped up. We'd like to introduce forward compatibility here as we add enums in the future
Similar enum changes can be found here during the generation process:
- https://github.com/Adyen/adyen-dotnet-api-library/pull/1037/files#diff-654e173618021475129caec200e9fd730e8f1ae2b5ee59966779fec564b28835L64
- https://github.com/Adyen/adyen-dotnet-api-library/pull/1031/files#diff-923be669a9c28428736a92f8f172cb98a48a765df4992204f74b4ecd4443fb2aR226
- https://github.com/Adyen/adyen-dotnet-api-library/pull/1026/files#diff-44bbf43931d61abce260295e53f7988d0b32d407dde99e3c877b39ec56a3036bR192
Considered options
- Leave it-as-is with a README notice (see PR)
- Change all enums to strings (make them forward compatible)
- Con: Developer will have no any idea what string value it should enter unless it's mentioned in a description/summary or documentation
- Change all enums to a class that holds a string enum, See branche with a proof-of-concept
- Con: Classes cannot be parameterized in unittests as constants. If we keep the names the same, we can keep the functionality of the library similar.