diff --git a/client/src/schemas/importdata.schema.json b/client/src/schemas/importdata.schema.json index 7790f3b2..bfb1943a 100644 --- a/client/src/schemas/importdata.schema.json +++ b/client/src/schemas/importdata.schema.json @@ -367,7 +367,55 @@ } }, "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, "type": "array" diff --git a/client/src/unit/importexport/unitdatafileimport.ts b/client/src/unit/importexport/unitdatafileimport.ts index 9907f6f2..6cebeef9 100644 --- a/client/src/unit/importexport/unitdatafileimport.ts +++ b/client/src/unit/importexport/unitdatafileimport.ts @@ -68,7 +68,13 @@ export class UnitDataFileImport extends UnitDataFile { const validator = new ImportFileJSONSchemaValidator(); if (!validator.validate(this.#fileData)) { 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; }, [] as string[]); this.#showFileDataErrors(errors);