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 Answers 2

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
    Commented Nov 19, 2019 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. Commented Nov 20, 2019 at 8:44
0
  • Feature flags are preferred when toggle needs to be done for shorter duration (for internal teams this can be a good approach).

  • API versionning is best suitable for long term different features needs to be provided (for external facing apps).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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