Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate schema compliant game versions from swinfo.json #3969

Merged
merged 1 commit into from
Dec 20, 2023

Conversation

HebaruSan
Copy link
Member

Problem

NetKAN bot: New inflation error for SpaceWarp: Schema validation failed: #/ksp_version_min: PatternMismatch

Cause

The schema supports 0.2.0 but not 0.2.0.0.

CKAN/CKAN.schema

Lines 380 to 384 in 3e8950a

"ksp_version" : {
"description" : "A game version",
"type" : "string",
"pattern" : "^(any|[0-9]+(\\.[0-9]+(\\.[0-9]+)?)?)$"
},

The SpacedockTransformer uses GameVersion.WithoutBuild to remove the 4th piece from the game version the user selects on SpaceDock:

json["ksp_version"] = latestVersion.KSP_version.WithoutBuild.ToString();

But the SpaceWarpInfoTransformer does not do the same for the game versions in swinfo.json:

GameVersion maxVer = null;
if (GameVersion.TryParse(swinfo.ksp2_version.min, out GameVersion minVer)
|| GameVersion.TryParse(swinfo.ksp2_version.max, out maxVer))
{
log.InfoFormat("Found compatibility: {0}–{1}", minVer, maxVer);
ModuleService.ApplyVersions(json, null, minVer, maxVer);
}

Changes

Now game versions from swinfo.json are trimmed to conform to the schema.

@HebaruSan HebaruSan added Bug Something is not working as intended Easy This is easy to fix Netkan Issues affecting the netkan data labels Dec 20, 2023
@HebaruSan HebaruSan merged commit 9addf80 into KSP-CKAN:master Dec 20, 2023
8 checks passed
@HebaruSan HebaruSan deleted the fix/spacewarp-versions branch December 20, 2023 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is not working as intended Easy This is easy to fix Netkan Issues affecting the netkan data
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant