apaleo / announcements

Subscribe to this repo to be notified about changes in the apaleo API
15 stars 1 forks source link

Important note regarding enums #92

Open WinniX opened 2 years ago

WinniX commented 2 years ago

Working with APIs and using built-in HTTP clients looks straightforward, but has some disadvantages. The biggest one is a lack of type safety. For a better developer experience while working with apaleo API we recommend using auto-generated client libraries.

There are many different generators available on the market, but our personal advise is autorest. They all do the job well and generate a similar proxy classes, but there is a small but crucial feature that only autorest has - it generates enums as string values. To understand why this is so important, let's consider a case when a new value was added to an enum. For example, a new status was introduced. By using string values we don't need to worry about possible deserialization issues, while enum will most likely throw an exception when meeting an unknown value.

To learn more about autorest go to their GitHub autorest.