Skip to content

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

Merged
mcdurdin merged 2 commits into
masterfrom
feat/325-add-keyman-version-check-to-package-version
Jun 29, 2026
Merged

feat: add keyman-version check to package-version API#353
mcdurdin merged 2 commits 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).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

And I had fixed one of the issues but missed this one, thanks

$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'");

Co-authored-by: Eberhard Beilharz <ermshiperete@users.noreply.github.com>
@mcdurdin mcdurdin enabled auto-merge June 29, 2026 14:49
@mcdurdin mcdurdin merged commit 59bab17 into master Jun 29, 2026
5 checks passed
@mcdurdin mcdurdin deleted the feat/325-add-keyman-version-check-to-package-version branch June 29, 2026 14:53
@github-project-automation github-project-automation Bot moved this from Todo to Done in Keyman Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

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