CodeX
Published in

CodeX

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.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store