I add a single new item to an enum in a lib. This ...
# random
r
I add a single new item to an enum in a lib. This effectively is a breaking change for users relying on
when
statements completeness. Would you increment the major, minor, or fixes part of the version for such case? I don’t really like bumping the major for a single line of code that adds an element to what is merely a list
o
If you want to stick to semantic versioning, you are expected to change the major version on a backwards-incompatible API change. Otherwise you'd break the contract your users expect. Alternatives: • Postpone that change until a major release seems warranted. • Try to solve your goal in a backwards-compatible way.
r
Yeah, the whole point of returning an enum (rather than String, Int etc.) is setting a contract of all the things your consumers are expected to handle. If you're going to add new things to that it requires a code change to consumers which is the definition of a breaking change.
Think hard about whether consumers actually need to be able to handle this new result and what are best practices for handling it if their app is currently working fine without it (put this in your migration guide)
No change to public APIs is actually
a single line of code
r
Well in this case it is. This lib is internal, the users is basically me, the added item is just another element in a list, nothing like a new state or something like that. I incremented the minor version. But thanks for your inputs, it makes sense
r
Oh yeah, if it's an internal lib and you're going to use the new version immediately there's not really any need for semantic versioning so do what you like 🧸
2
r
I just changed the versioning of this lib to follow the standard rules more closely, but was wondering if a new major version was really needed. I usually feel like when you only add things, it’s a minor upgrade. It potentially breaking because
when
statements are a thing doesn’t count that much. Obviously with an public lib with at least a few users it’s more binary. “Can it break? Major version”