-
Notifications
You must be signed in to change notification settings - Fork 723
Description
The spec is well defined when it comes to changing the API, take the following paragraph for instance:
Bug fixes not affecting the API increment the patch version, backwards compatible API additions/changes increment the minor version, and backwards incompatible API changes increment the major version.
Pretty straightforward.
But what about substantial behavioral changes? There are times that you make big changes in a code behavior without changing a thing on its API. Is that a patch?
Example 1
Suppose there's a library that sends emails. Let's say that on version 1.0.0
it simply sends emails as plain text, no configuration there.
On its second release the author changes the library to send emails as HTML instead, without changing anything on its API. It does that automatically. What's the version?
For the user that rely on the fact that it sends only plain text emails, that's a major (2.0.0
). For the user that may be interested in sending emails with rich content now and doesn't bother with HTML being automatically assumed, that's a minor (1.1.0
). For the user that expects semver to be solely about the API as the spec mentions it, that's a patch (1.0.1
).
Example 2
Imagine a scheduling library for an object oriented language that accepts custom jobs designed by a user. The user gives the library the type of its job implementation and some cron-like scheduling.
On current version the library instantiates one single job object and calls it (the same object) every time its schedule is fired.
Now someone points out the fact that may be a better design to instantiate a new object for each time the scheduled is fired. The author of the library finds the argument convincing and changes the library, but no API change was needed.
If one uses the library only with stateless jobs that's a patch alright. But what if some of the library users were relying on the fact that it treated the jobs as singletons?