RFE: Expose latest version
The suggestion is to provide an API endpoint to query the latest version of a project in a few ways:
- newest version (can have major version lower than current highest version)
- highest stable version
- highest version
This seems similar to what /api/v2/versions provide. See https://anitya.readthedocs.io/en/stable/api.html#get--api-v2-versions-
Oh, that's rather divergent from the json-schema: https://github.com/fedora-infra/anitya-messages/blob/7754ca6832fd773e9d8e622024743af0483cec9d/anitya_schema/project_messages.py#L692-L729
Indeed it is similar, but having the distinction between the 3 variants will be helpful because it is unclear if latest version is highest or newest version. Distributions like Spack would be helpful to track all newest version events because they keep the sha for all versions, while distro would rather have latest version.
Anitya doesn't take latest as newest, it depends on the project version scheme. But we can definitely return the latest retrieved.
The json-schema is for Fedora messages, not used by API at all.
The current API doesn't provide a convenient way to retrieve the latest stable version, though. Take something like baobab:
$ curl 'https://release-monitoring.org/api/v2/versions/?project_id=10907' | jq
{
"latest_version": "47.alpha",
"stable_versions": [
"46.0",
"45.0",
"44.0",
"43.0",
"42.0",
"41.0",
"40.0",
"40",
"3.38.0",
"3.38",
"3.37.90",
"3.37",
"3.35.2",
"3.35.1",
"3.35",
"3.34.1",
"3.34.0",
"3.34",
"3.32.0",
"3.32",
"3.31.1",
"3.31",
"3.30.0",
"3.30",
"3.29.1",
"3.29",
"3.28.0",
"3.28",
"3.27.90",
"3.27.2",
"3.27.1",
"3.27",
"3.26.1",
"3.26.0",
"3.26",
"3.25.92",
"3.25",
"3.24.0",
"3.24",
"3.23.91",
"3.23.90",
"3.23",
"3.22.1",
"3.22.0",
"3.22",
"3.21.92",
"3.21.90",
"3.21",
"3.20.1",
"3.20.0",
"3.20",
"3.19.91",
"3.19",
"3.18.1",
"3.18.0",
"3.18",
"3.17.90",
"3.17",
"3.16.1",
"3.16.0",
"3.16",
"3.15.90",
"3.15",
"3.14.1",
"3.14.0",
"3.14",
"3.13.91",
"3.13.2",
"3.13.1",
"3.13",
"3.12.1",
"3.12.0",
"3.12",
"3.11.90",
"3.11.1",
"3.11",
"3.10.1",
"3.10",
"3.9.91",
"3.9.90",
"3.9.3",
"3.9.2",
"3.9.1",
"3.9",
"3.8.2",
"3.8.1",
"3.8.0",
"3.8",
"3.7.92",
"3.7.91",
"3.7.90",
"3.7.4",
"3.7",
"3.6.4",
"3.6.3",
"3.6.2",
"3.6.1",
"3.6.0",
"3.6",
"3.5.92",
"3.5.91",
"3.5.90",
"3.5.5",
"3.5.4",
"3.5.3",
"3.5",
"3.4.1",
"3.4.0",
"3.4",
"3.3.4",
"3.3.3",
"3.3.2",
"3.3.1",
"3.3"
],
"versions": [
"47.alpha",
"46.0",
"45.0",
"45.alpha",
"44.0",
"44.rc",
"44.beta",
"43.0",
"43.rc",
"43.beta",
"43.alpha",
"42.0",
"42.rc",
"42.beta",
"42.alpha",
"41.0",
"40.0",
"40",
"40.beta",
"3.38.0",
"3.38",
"3.37.90",
"3.37",
"3.35.2",
"3.35.1",
"3.35",
"3.34.1",
"3.34.0",
"3.34",
"3.32.0",
"3.32",
"3.31.1",
"3.31",
"3.30.0",
"3.30",
"3.29.1",
"3.29",
"3.28.0",
"3.28",
"3.27.90",
"3.27.2",
"3.27.1",
"3.27",
"3.26.1",
"3.26.0",
"3.26",
"3.25.92",
"3.25",
"3.24.0",
"3.24",
"3.23.91",
"3.23.90",
"3.23",
"3.22.1",
"3.22.0",
"3.22",
"3.21.92",
"3.21.90",
"3.21",
"3.20.1",
"3.20.0",
"3.20",
"3.19.91",
"3.19",
"3.18.1",
"3.18.0",
"3.18",
"3.17.90",
"3.17",
"3.16.1",
"3.16.0",
"3.16",
"3.15.90",
"3.15",
"3.14.1",
"3.14.0",
"3.14",
"3.13.91",
"3.13.2",
"3.13.1",
"3.13",
"3.12.1",
"3.12.0",
"3.12",
"3.11.90",
"3.11.1",
"3.11",
"3.10.1",
"3.10",
"3.9.91",
"3.9.90",
"3.9.3",
"3.9.2",
"3.9.1",
"3.9",
"3.8.2",
"3.8.1",
"3.8.0",
"3.8",
"3.7.92",
"3.7.91",
"3.7.90",
"3.7.4",
"3.7",
"3.6.4",
"3.6.3",
"3.6.2",
"3.6.1",
"3.6.0",
"3.6",
"3.5.92",
"3.5.91",
"3.5.90",
"3.5.5",
"3.5.4",
"3.5.3",
"3.5",
"3.4.1",
"3.4.0",
"3.4",
"3.3.4",
"3.3.3",
"3.3.2",
"3.3.1",
"3.3"
]
}
the latest_version field returns 47.alpha, which is the latest version from the versions field, but if you only want to find the latest version in terms of stable_versions, you have to do additional processing on your side.
A latest_stable_version field would be appreciated.