Skip to content

feat: add keyman-version check to package-version API#353

Open
mcdurdin wants to merge 1 commit into
masterfrom
feat/325-add-keyman-version-check-to-package-version
Open

feat: add keyman-version check to package-version API#353
mcdurdin wants to merge 1 commit into
masterfrom
feat/325-add-keyman-version-check-to-package-version

Conversation

@mcdurdin

@mcdurdin mcdurdin commented Jun 25, 2026

Copy link
Copy Markdown
Member

Add the keyman-version parameter to /package-version API, for example:

http://api.keyman.com/package-version?platform=android&keyboard=sil_euro_latin&model=nrc.en.mtnt&keyman-version=11.0.0

This also makes a small tweak to the results, so that an error response will no longer give a version or kmp field. (Reason: the iOS app sees the presence of those two fields as indication of a success response and never checks for error in that case. Yes, we will address that, but we need to support existing versions of the app anyway.)

And refactor the package-version.inc.php module to make it clearer and simpler.

Older versions of Keyman do not provide their version in the query, and in that scenario, the API will continue to return the latest version of the keyboard or lexical model, even if that means that it will not be installed (which can lead to an annoying update loop, hence this change).

Fixes: #325
Test-bot: skip

Add the `keyman-version` parameter to /package-version API, for example:

  http://api.keyman.com/package-version?platform=android&keyboard=sil_euro_latin&model=nrc.en.mtnt&keyman-version=11.0.0

This also makes a small tweak to the results, so that an error response will
no longer give a `version` or `kmp` field. (Reason: the iOS app sees the
presence of those two fields as indication of a success response and
never checks for error in that case. Yes, we will address that, but we
need to support existing versions of the app anyway.)

And refactor the package-version.inc.php module to make it clearer and
simpler.

Relates-to: #325
Test-bot: skip
@keymanapp-test-bot

Copy link
Copy Markdown

User Test Results

Test specification and instructions

User tests are not required

@keymanapp-test-bot keymanapp-test-bot Bot added this to the A19S32 milestone Jun 25, 2026
@github-actions github-actions Bot added the feat label Jun 25, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Keyman Jun 25, 2026
@mcdurdin mcdurdin marked this pull request as ready for review June 25, 2026 09:10
} else {
$dataKeyboard = $data[0];

if (!empty($platform) && !$dataKeyboard[array_search($platform, PackageVersion::available_platforms()) + 2]) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing new, but the order of the fields in the SELECT statement and in available_patforms() is different (k.platform_android, k.platform_linux, k.platform_macos, k.platform_ios, k.platform_web, k.platform_windows vs 'android', 'ios', 'linux', 'mac', 'web', 'windows'), so the results will be wrong for Linux, Mac and iOS (flagged by devin.ai).

$platform = $params['platform'];
if(!in_array($platform, $available_platforms)) {
fail("Invalid platform $platform");
fail("Invalid platform' $platform'");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fail("Invalid platform' $platform'");
fail("Invalid platform '$platform'");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

feat: ensure that packages that depend on a newer version of Keyman are not offered for iOS, Android

3 participants