mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Added more info for when enums aren't matched
This commit is contained in:
@@ -367,7 +367,55 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": ["activePath","alive","ammo","category","categoryDisplayName","coalition","contacts","controlled","country","desiredAltitude","desiredAltitudeType","desiredSpeed","desiredSpeedType","emissionsCountermeasures","followRoads","formationOffset","fuel","generalSettings","groupName","hasTask","heading","health","horizontalVelocity","human","ID","isActiveAWACS","isActiveTanker","isLeader","leaderID","name","onOff","operateAs","position","radio","reactionToThreat","ROE","shotsIntensity","shotsScatter","speed","state","TACAN","targetID","targetPosition","task","track","unitName","verticalVelocity"]
|
"required": [
|
||||||
|
"activePath",
|
||||||
|
"alive",
|
||||||
|
"ammo",
|
||||||
|
"category",
|
||||||
|
"categoryDisplayName",
|
||||||
|
"coalition",
|
||||||
|
"contacts",
|
||||||
|
"controlled",
|
||||||
|
"country",
|
||||||
|
"desiredAltitude",
|
||||||
|
"desiredAltitudeType",
|
||||||
|
"desiredSpeed",
|
||||||
|
"desiredSpeedType",
|
||||||
|
"emissionsCountermeasures",
|
||||||
|
"followRoads",
|
||||||
|
"formationOffset",
|
||||||
|
"fuel",
|
||||||
|
"generalSettings",
|
||||||
|
"groupName",
|
||||||
|
"hasTask",
|
||||||
|
"heading",
|
||||||
|
"health",
|
||||||
|
"horizontalVelocity",
|
||||||
|
"human",
|
||||||
|
"ID",
|
||||||
|
"isActiveAWACS",
|
||||||
|
"isActiveTanker",
|
||||||
|
"isLeader",
|
||||||
|
"leaderID",
|
||||||
|
"name",
|
||||||
|
"onOff",
|
||||||
|
"operateAs",
|
||||||
|
"position",
|
||||||
|
"radio",
|
||||||
|
"reactionToThreat",
|
||||||
|
"ROE",
|
||||||
|
"shotsIntensity",
|
||||||
|
"shotsScatter",
|
||||||
|
"speed",
|
||||||
|
"state",
|
||||||
|
"TACAN",
|
||||||
|
"targetID",
|
||||||
|
"targetPosition",
|
||||||
|
"task",
|
||||||
|
"track",
|
||||||
|
"unitName",
|
||||||
|
"verticalVelocity"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"minItems": 1,
|
"minItems": 1,
|
||||||
"type": "array"
|
"type": "array"
|
||||||
|
|||||||
@@ -68,7 +68,13 @@ export class UnitDataFileImport extends UnitDataFile {
|
|||||||
const validator = new ImportFileJSONSchemaValidator();
|
const validator = new ImportFileJSONSchemaValidator();
|
||||||
if (!validator.validate(this.#fileData)) {
|
if (!validator.validate(this.#fileData)) {
|
||||||
const errors = validator.getErrors().reduce((acc:any, error:any) => {
|
const errors = validator.getErrors().reduce((acc:any, error:any) => {
|
||||||
acc.push(error.instancePath + ": " + error.message)
|
let errorString = error.instancePath.substring(1) + ": " + error.message;
|
||||||
|
if (error.params) {
|
||||||
|
const {allowedValues} = error.params;
|
||||||
|
if (allowedValues)
|
||||||
|
errorString += ": " + allowedValues.join(', ');
|
||||||
|
}
|
||||||
|
acc.push(errorString);
|
||||||
return acc;
|
return acc;
|
||||||
}, [] as string[]);
|
}, [] as string[]);
|
||||||
this.#showFileDataErrors(errors);
|
this.#showFileDataErrors(errors);
|
||||||
|
|||||||
Reference in New Issue
Block a user