4

We are looking at moving to a trunk based development branching strategy rather than gitflow that we currently use. I understand that feature flags are crucial to trunk based development. However, is there still a place for versioning APIs if I am using feature flags to control exposure of new features across UI and APIs?

All of our APIs are are internal to our application and are not exposed directly to a third party. Even in a case like changes in schema for response/requests - those could be treated as a new feature and handled via a feature flag to enable dark deployments etc. So, what would be a good case to still use API versioning if I have feature flags going?

Will appreciate any thoughts from your experience or any good articles you have come across related to this topic.

Thank you - VK

2

The two approaches whilst somewhat overlapping solve two different problems:

  • Feature flags allow you to decouple the action of deployment from the action of release. i.e. you can push a change to an API that adds functionality to support a new feature, then when your product owner wants to release it all they need to do is toggle the feature on.

  • API versioning enables you to make changes to your API without breaking compatibility with older clients.

In both cases, you need to ensure that old feature flags and old API versions are eventually removed from the codebase or it will become very complicated very quickly.

The deciding factor comes down to whether or not you have control over all of your clients if you can guarantee that you can make changes to both your clients and the API in such a way that they will remain compatible, or incompatible clients can be removed from your ecosystem very quickly you probably don't need API Versioning.

2
  • Thanks @richard-slater. In my case all APIs are internal to the same product dev teams and we have complete control and co-ordinate changes between different APIs and UI, so I am struggling to see what benefits API versioning will provide. IMHO, as per tenets of Trunk based development in order to keep feature branches short-lived, we could also use feature flags to hide features that have not been implemented completely. Correct me if I am wrong...
    – VKR
    Nov 19 '19 at 17:51
  • Hiding partial implementations through feature flagging is perfectly acceptable, although it does suggest that perhaps you need to further decompose your features. Nov 20 '19 at 8:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.