Property `size` missing in `/2.0/repositories/{team}/{repo}/refs/branches` API response

Issue #16993 open
Ronald Rey
created an issue

Hello!

I'm the author and maintainer of the Refined Bitbucket browser extension, which for one of its features it's hitting the endpoint mentioned in the title and relying on the .size property to show a badge with the number of open branches in the sidebar.

sidebar.PNG

About three days ago, the feature broke because the .size property is not being returned anymore. I checked the documentation in the link below and the property is still documented, which leads me to believe that maybe this was a mistake?

https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/refs/branches

Also, as you can see from the picture, the pull-requests API endpoint which has a similarly-shaped response wasn't affected.

Can anyone confirm what happened here? I have about 4,500+ active users in the extension that are seeing this bug at the moment and I would prefer not to have to rollback the feature :(

Reference: https://github.com/refined-bitbucket/refined-bitbucket/issues/240

Comments (8)

  1. Erik van Zijst

    The branches (and tags) endpoint was recently improved to take into account natural sorting of numerical values. Looking at that change, it seems that that had the side effect of removing the size element. This was not intentional and I will look into adding that back.

    As a related note though, not all collection endpoints on Bitbucket include a size element. This is generally for performance reasons, as it doesn't always scale well to commit to computing the total size of a data set. This was the case for refs as well and so in general clients should not expect every endpoint to have that element.

    Having said that, we should not be breaking existing endpoints.

  2. Ronald Rey reporter

    Hello Erik, that's great, thank you for looking into it!

    I agree with everything you said. I can't speak for all clients, but for me personally, I would only use properties that are documented, so as long as those collection endpoints are properly documented I think there will be no issue.

  3. Log in to comment