Updated CS Template
MODIFY
src/assets/charging-station-templates
src/assets/charging-station-templates
-Subproject commit 10c8e8680883b5647500e1d5b975e9d0383e24d9
+Subproject commit 2fcabcd74390e34fe28031c8b34ba8885b083f83

MODIFY
src/assets/server/rest/v1/schemas/chargingstation/chargingstation-template.json
src/assets/server/rest/v1/schemas/chargingstation/chargingstation-template.json
},
"chargePoints": {
"type": "array",
+ "minItems": 1,
"items": [
{
"type": "object",
"required": [
"chargePointID",
"currentType",
- "amperage",
"numberOfConnectedPhase",
"cannotChargeInParallel",
"sharePowerToAllConnectors",
},
"capabilities": {
"type": "array",
+ "minItems": 1,
"items": [
{
"type": "object",
},
"parameters": {
"type": "object",
+ "additionalProperties": false,
"properties": {
"AllowOfflineTxForUnknownId": {
"type": "string"
}
},
"parameters": {
- "type": "object"
+ "type": "object",
+ "patternRequired": [".*"]
}
},
"required": [
"id",
"chargePointVendor",
"technical",
- "capabilities",
- "ocppStandardParameters",
- "ocppVendorParameters"
+ "capabilities"
]
}
\ No newline at end of file

MODIFY
src/server/rest/v1/validator/SchemaValidator.ts
src/server/rest/v1/validator/SchemaValidator.ts
@@ -9,6 +9,7 @@ import addFormats from 'ajv-formats';
import countries from 'i18n-iso-countries';
import fs from 'fs';
import global from '../../../../types/GlobalType';
+import keywords from 'ajv-keywords';
import sanitize from 'mongo-sanitize';
// AJV Format in JSon Schema: https://github.com/ajv-validator/ajv-formats
@@ -39,6 +40,8 @@ export default class SchemaValidator {
}) {
// Create AJV
this.ajv = new Ajv(config);
+ // Add keywords
+ keywords(this.ajv);
// Add MongoDB sanitizer
this.ajv.addKeyword({
keyword: 'sanitize',

MODIFY
src/utils/Utils.ts
src/utils/Utils.ts
@@ -69,8 +69,9 @@ export default class Utils {
// Save
await ChargingStationStorage.saveChargingStationTemplate(chargingStationTemplate);
} catch (error) {
+ error.message = `Charging Station Template ID '${chargingStationTemplate.id}' is not valid: ${error.message as string}`;
await Logging.logActionExceptionMessage(Constants.DEFAULT_TENANT, ServerAction.UPDATE_CHARGING_STATION_TEMPLATES, error);
- Utils.isDevelopmentEnv() && console.error(chalk.red(`Charging Station Template ID '${chargingStationTemplate.id}' is not valid: ${error.message}`));
+ Utils.isDevelopmentEnv() && console.error(chalk.red(error.message));
}
}
}

Updated CS Template