PJ's Web Ops Blog

Why SemVer doesn't make sense for web APIs

At the office, there is a push to using tools like Cocogitto more so that we can automatically generate the next (correct) semantic version of web services. I would like to share my thoughts on why I don’t think that this makes a lot of sense.

With Semantic Versioning, a software package author can communicate to their users how “safe” an upgrade from one version to another is. From the SemVer website: “Under this scheme, version numbers and the way they change convey meaning about the underlying code and what has been modified from one version to the next.

For software libraries, this makes total sense. For web apps, I argue it doesn’t:

This is the reason why most services/APIs you see “in the wild” have a version number like /api/v1 or /api/v2/ in their paths, but not /api/v1.13.4. It’s always just a major version, because consumers of the API only care about breaking changes. Any non-breaking changes are expected to be added to the service without any work on the client’s part.

But PJ, what about using SemVer as an internal version for the devs? Well, you can set that up, but why would you? There are many version schemes you can use. The easiest one is probably just to use the pipeline number as the version for your software. It auto-increments and should be easily available from the pipelines you use to build and deploy. No extra tooling required. SemVer is about communicating to your service’s clients. You most likely don’t need this kind of communication within your team. At least not through version numbers.

So what about the CHANGELOG that Cocogitto generates? Ok, you got me there. If you want a changelog, using Cocogitto and Conventional Commits can make sense. But ask yourself if you really need this changelog. This file is also used to communicate changes to end users, but in more detail than the version number. Do you really need this kind of communication for a web service? Do you have a lot of anonymous users that are interested in following every last change to your service? Or do your users mostly track the changes they’re interested in through your ticketing system?

If you don’t really need it, just spare yourself the setup and maintenance cost of incorporating an extra tool in your setup. KISS

#Devops #Engineering #Versioning #Semver