labrinth
labrinth copied to clipboard
Ordering of Versions in API results
Is your feature request related to a problem? Please describe. Current it appears as if the version id's returned by the API is in a random order instead of from Old-New or New-Old.
Describe the solution you'd like Maybe add a flag that can be used to sort the results or just order them by default
Describe alternatives you've considered Currently, the solution I have, which I do not use, is to just go over each version and sort them by dates, but, this causes load on the API and would probably hit rate limits at one point or another
In which routes is the ordering random?
/api/v1/mod/{id}
I checked with multiple mods and the data returned is in random order. I saw a comment on your discord that the newest is always the first result, but that doesn't seem to be the case
Another option would be instead of returning a string of versions, return "id" and "date_published" for each version, that way the information you seem to want will be in the actual data, and not depend on the order of the elements, since The JSON syntax does not define any specific meaning to the ordering of the values
Another option would be instead of returning a string of versions, return "id" and "date_published" for each version, that way the information you seem to want will be in the actual data, and not depend on the order of the elements, since
The JSON syntax does not define any specific meaning to the ordering of the values
Not a bad idea. And the ordering isn't done by the JSON, it should be done by code that retrieves the data from the database/data storage
I checked quickly, and the results on /v1/mod/{id}/version
look to be ordered new-old
Appears to be sorted from old to new now on /v2/project/{id}
.