Moved the charging station profile  in a dedicated schema
ADD
src/assets/schemas/chargingstation/chargingstation-profile.json
+{
+ "$id": "chargingstation-profile",
+ "definitions": {
+ "id": {
+ "type": "string",
+ "sanitize": "mongo",
+ "pattern": "^[a-f0-9]{64}$"
+ },
+ "chargingStationID": {
+ "$ref": "chargingstation#/definitions/id"
+ },
+ "connectorID": {
+ "$ref": "chargingstation#definitions/connector/properties/connectorId"
+ },
+ "chargePointID": {
+ "$ref": "chargingstation#definitions/chargePoint/properties/chargePointID"
+ },
+ "profile": {
+ "type": "object",
+ "properties": {
+ "chargingProfileId": {
+ "type": "number",
+ "sanitize": "mongo"
+ },
+ "transactionId": {
+ "$ref": "transaction#/definitions/id"
+ },
+ "stackLevel": {
+ "type": "number",
+ "sanitize": "mongo"
+ },
+ "chargingProfilePurpose": {
+ "type": "string",
+ "sanitize": "mongo",
+ "enum": [
+ "ChargePointMaxProfile",
+ "TxDefaultProfile",
+ "TxProfile"
+ ]
+ },
+ "chargingProfileKind": {
+ "type": "string",
+ "sanitize": "mongo",
+ "enum": [
+ "Absolute",
+ "Recurring",
+ "Relative"
+ ]
+ },
+ "recurrencyKind": {
+ "type": "string",
+ "sanitize": "mongo",
+ "enum": [
+ "Daily",
+ "Weekly"
+ ]
+ },
+ "validFrom": {
+ "type": "string",
+ "format": "date-time",
+ "customType": "date",
+ "sanitize": "mongo"
+ },
+ "validTo": {
+ "type": "string",
+ "format": "date-time",
+ "customType": "date",
+ "sanitize": "mongo"
+ },
+ "chargingSchedule": {
+ "type": "object",
+ "properties": {
+ "duration": {
+ "type": "number",
+ "sanitize": "mongo"
+ },
+ "startSchedule": {
+ "type": "string",
+ "format": "date-time",
+ "customType": "date",
+ "sanitize": "mongo"
+ },
+ "chargingRateUnit": {
+ "type": "string",
+ "sanitize": "mongo",
+ "enum": [
+ "W",
+ "A"
+ ]
+ },
+ "chargingSchedulePeriod": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "startPeriod": {
+ "type": "number",
+ "sanitize": "mongo"
+ },
+ "limit": {
+ "type": "number",
+ "sanitize": "mongo"
+ },
+ "numberPhases": {
+ "type": "number",
+ "sanitize": "mongo"
+ }
+ },
+ "required": [
+ "startPeriod",
+ "limit"
+ ]
+ }
+ },
+ "minChargeRate": {
+ "type": "number",
+ "sanitize": "mongo"
+ }
+ },
+ "required": [
+ "chargingRateUnit",
+ "chargingSchedulePeriod"
+ ]
+ }
+ },
+ "required": [
+ "chargingProfileId",
+ "stackLevel",
+ "chargingProfilePurpose",
+ "chargingProfileKind",
+ "chargingSchedule"
+ ]
+ }
+ },
+ "required": [
+ "id",
+ "connectorID",
+ "chargePointID",
+ "chargingStationID",
+ "profile"
+ ]
+}

MODIFY
src/assets/schemas/chargingstation/chargingstation.json
src/assets/schemas/chargingstation/chargingstation.json
"id": {
"$ref": "common#/definitions/string-id"
},
- "chargingProfile": {
- "type": "object",
- "properties": {
- "id": {
- "type": "string",
- "sanitize": "mongo",
- "pattern": "^[a-f0-9]{64}$"
- },
- "chargingStationID": {
- "$ref": "#/definitions/id"
- },
- "connectorID": {
- "$ref": "#/definitions/connector/properties/connectorId"
- },
- "chargePointID": {
- "$ref": "#/definitions/chargePoint/properties/chargePointID"
- },
- "profile": {
- "type": "object",
- "properties": {
- "chargingProfileId": {
- "type": "number",
- "sanitize": "mongo"
- },
- "transactionId": {
- "$ref": "transaction#/definitions/id"
- },
- "stackLevel": {
- "type": "number",
- "sanitize": "mongo"
- },
- "chargingProfilePurpose": {
- "type": "string",
- "sanitize": "mongo",
- "enum": [
- "ChargePointMaxProfile",
- "TxDefaultProfile",
- "TxProfile"
- ]
- },
- "chargingProfileKind": {
- "type": "string",
- "sanitize": "mongo",
- "enum": [
- "Absolute",
- "Recurring",
- "Relative"
- ]
- },
- "recurrencyKind": {
- "type": "string",
- "sanitize": "mongo",
- "enum": [
- "Daily",
- "Weekly"
- ]
- },
- "validFrom": {
- "type": "string",
- "format": "date-time",
- "customType": "date",
- "sanitize": "mongo"
- },
- "validTo": {
- "type": "string",
- "format": "date-time",
- "customType": "date",
- "sanitize": "mongo"
- },
- "chargingSchedule": {
- "type": "object",
- "properties": {
- "duration": {
- "type": "number",
- "sanitize": "mongo"
- },
- "startSchedule": {
- "type": "string",
- "format": "date-time",
- "customType": "date",
- "sanitize": "mongo"
- },
- "chargingRateUnit": {
- "type": "string",
- "sanitize": "mongo",
- "enum": [
- "W",
- "A"
- ]
- },
- "chargingSchedulePeriod": {
- "type": "array",
- "items": {
- "type": "object",
- "properties": {
- "startPeriod": {
- "type": "number",
- "sanitize": "mongo"
- },
- "limit": {
- "type": "number",
- "sanitize": "mongo"
- },
- "numberPhases": {
- "type": "number",
- "sanitize": "mongo"
- }
- },
- "required": [
- "startPeriod",
- "limit"
- ]
- }
- },
- "minChargeRate": {
- "type": "number",
- "sanitize": "mongo"
- }
- },
- "required": [
- "chargingRateUnit",
- "chargingSchedulePeriod"
- ]
- }
- },
- "required": [
- "chargingProfileId",
- "stackLevel",
- "chargingProfilePurpose",
- "chargingProfileKind",
- "chargingSchedule"
- ]
- }
- },
- "required": [
- "id",
- "connectorID",
- "chargePointID",
- "chargingStationID",
- "profile"
- ]
- },
"connector": {
"type": "object",
"properties": {

MODIFY
src/assets/server/rest/v1/schemas/chargingstation/chargingprofile-create.json
src/assets/server/rest/v1/schemas/chargingstation/chargingprofile-create.json
"$ref": "chargingstation#/definitions/chargePoint/properties/chargePointID"
},
"profile": {
- "$ref": "chargingstation#/definitions/chargingProfile/properties/profile"
+ "$ref": "chargingstation-profile#/definitions/profile"
}
},
"required": [

MODIFY
src/assets/server/rest/v1/schemas/chargingstation/chargingprofile-delete.json
src/assets/server/rest/v1/schemas/chargingstation/chargingprofile-delete.json
"type": "object",
"properties": {
"ID": {
- "$ref": "chargingstation#/definitions/chargingProfile/properties/id"
+ "$ref": "chargingstation-profile#/definitions/id"
}
},
"required": [

MODIFY
src/assets/server/rest/v1/schemas/chargingstation/chargingprofile-update.json
src/assets/server/rest/v1/schemas/chargingstation/chargingprofile-update.json
{
"$id": "chargingprofile-update",
"title": "Update a Charging Profile",
- "$ref": "chargingstation#/definitions/chargingProfile"
+ "$ref": "chargingstation-profile#"
}

MODIFY
src/assets/server/rest/v1/schemas/chargingstation/chargingstation-action.json
src/assets/server/rest/v1/schemas/chargingstation/chargingstation-action.json
"enum": ["A", "W"]
},
"chargingProfilePurpose": {
- "$ref": "chargingstation#/definitions/chargingProfile/properties/profile/properties/chargingProfilePurpose"
+ "$ref": "chargingstation-profile#/definitions/profile/properties/chargingProfilePurpose"
},
"stackLevel": {
- "$ref": "chargingstation#/definitions/chargingProfile/properties/profile/properties/stackLevel"
+ "$ref": "chargingstation-profile#/definitions/profile/properties/stackLevel"
},
"tagID": {
"type": "string",
"$ref": "transaction#/definitions/id"
},
"csChargingProfile": {
- "$ref": "chargingstation#/definitions/chargingProfile"
+ "$ref": "chargingstation-profile#"
},
"vendorId": {
"type": "string",

MODIFY
src/validator/SchemaValidator.ts
src/validator/SchemaValidator.ts
@@ -23,6 +23,7 @@ export default class SchemaValidator {
private static tenantSchema: Schema = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/schemas/tenant/tenant.json`, 'utf8'));
private static tenantComponentSchema: Schema = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/schemas/tenant/tenant-components.json`, 'utf8'));
private static chargingStationSchema: Schema = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/schemas/chargingstation/chargingstation.json`, 'utf8'));
+ private static chargingStationProfileSchema: Schema = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/schemas/chargingstation/chargingstation-profile.json`, 'utf8'));
private static tagSchema: Schema = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/schemas/tag/tag.json`, 'utf8'));
private static transactionSchema: Schema = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/schemas/transaction/transaction.json`, 'utf8'));
private static userSchema: Schema = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/schemas/user/user.json`, 'utf8'));
@@ -68,6 +69,7 @@ export default class SchemaValidator {
SchemaValidator.tenantSchema,
SchemaValidator.tenantComponentSchema,
SchemaValidator.chargingStationSchema,
+ SchemaValidator.chargingStationProfileSchema,
SchemaValidator.tagSchema,
SchemaValidator.transactionSchema,
SchemaValidator.userSchema,

Moved the charging station profile  in a dedicated schema