Should your API use enums?
Enumerated values are a clever validation technique that can be risky for an API
Enumerated values are a great way to use type safety to your advantage. They make otherwise tricky-to-remember numbers or strings easy to use. Unfortunately they can also pose risks for API developers.
I was a big fan of enums when my team designed the AvaTax REST API; but I’d like to share with you the problems that we faced and why our team has generally reduced our usage of enums when we designed the Lockstep Platform API. Let’s break this down.