Hi,
I have been trying to create a github workflow for linting rul files and I don't get how some particular details work for the
OpenXcom Ruleset Tools (vscode ruleset yaml validator).
For the purpose of creating said workflow I am using
Spectral which gave the best results so far. Except that it can't deal with the recursive bits in the json files (vscode-ruleset/schemas). As a consequence it will create false positives as described below.
So far I understood that I need to merge the oxc bits into oxce-merge. That works well enough with
the JSON merger.
// merger.js
// put it in vscode-ruleset/schemas/oxce-merge
// run with: node merger.js
const jsonMerger = require("json-merger");
const fs = require("fs");
var result = jsonMerger.mergeFiles(["AlienRace.json", "../oxc/AlienRace.json"]);
fs.writeFileSync("AlienRace.json", JSON.stringify(result, null, 2));
Inside the AlienRace.json there is a setting retaliationMissionWeights
//AlienRace.json > properties > retaliationMissionWeights
"retaliationMissionWeights": {
"$ref": "WeightedOptions.json#/definitions/Map"
and for WeightedOptions.json
{
"$id": "https://openxcom.org/schemas/oxc/WeightedOptions.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": {
"type": "integer"
},
"definitions": {
"Map": {
"patternProperties": {
"^\\d+$": {
"$ref": "#" // <-------------- is this a circular reference to WeightedOptions.json ?????
}
},
"additionalProperties": false,
"type": "object"
}
}
}
When I use bundle or dereference of the node package
@apidevtools/json-schema-ref-parser, the circular reference is either adapted with bundle in such a way that it persists and therefore Spectral ignores it or the dereference deletes the entry for retaliationMissionWeights altogether meaning that Spectral will try to use a standard value (string) to lint retaliationMissionWeights creating a false positive.
Is there something I am missing or do you have different ideas what I could try?