Releases API - can't figure out order

Hi, i can’t figure out how releases are sorted in the “releases” API.

As far as i understand it used to sort releases by “published_at” descendent, but now i found that in https://api.github.com/repos/Cockatrice/Cockatrice/releases the first listed release is older than the second release:

  1. version Development-2.5.0-beta.16 is dated: 

    “published_at”: “2018-02-19T08:01:27Z”

 2. Release-2.5.0 is dated: 

"published_at": "2018-03-02T21:51:53Z"

If you look at the “releases” page instead: https://github.com/Cockatrice/Cockatrice/releases , they are correctly sorted by date.

Did i wrongly assume that releases in the API page are sorted or did i stumble upon a strange behavior of he releases api?

Thank you

There isn’t a guarantee of a sort order in the API documentation, so I wouldn’t assume that any particular sort order is guaranteed. It looks like it is still sorted by published_at with the exception that the prerelease: true record is first. So it is possible that it is ordered first by prerelease and then by published_at, but since there is no documented guaranteed sort order it is probably not wise to depend on that behavior.

1 Like