From b0342994636646699094b2d16a767d6d902d2bde Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 5 Jan 2023 22:12:53 +0100 Subject: [PATCH] Migrate all JSON schemas to draft-06 or higher MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- package-lock.json | 19 ------------------- package.json | 1 - .../json-schemas/ocpp/1.6/Authorize.json | 4 ++-- .../ocpp/1.6/AuthorizeResponse.json | 4 ++-- .../ocpp/1.6/BootNotification.json | 4 ++-- .../ocpp/1.6/BootNotificationResponse.json | 4 ++-- .../ocpp/1.6/ChangeAvailability.json | 4 ++-- .../ocpp/1.6/ChangeConfiguration.json | 4 ++-- .../json-schemas/ocpp/1.6/ClearCache.json | 4 ++-- .../ocpp/1.6/ClearChargingProfile.json | 4 ++-- .../json-schemas/ocpp/1.6/DataTransfer.json | 4 ++-- .../ocpp/1.6/DataTransferResponse.json | 4 ++-- .../1.6/DiagnosticsStatusNotification.json | 4 ++-- ...DiagnosticsStatusNotificationResponse.json | 4 ++-- .../ocpp/1.6/GetCompositeSchedule.json | 4 ++-- .../ocpp/1.6/GetConfiguration.json | 4 ++-- .../json-schemas/ocpp/1.6/GetDiagnostics.json | 4 ++-- .../json-schemas/ocpp/1.6/Heartbeat.json | 4 ++-- .../ocpp/1.6/HeartbeatResponse.json | 4 ++-- .../json-schemas/ocpp/1.6/MeterValues.json | 4 ++-- .../ocpp/1.6/MeterValuesResponse.json | 4 ++-- .../ocpp/1.6/RemoteStartTransaction.json | 4 ++-- .../ocpp/1.6/RemoteStopTransaction.json | 4 ++-- src/assets/json-schemas/ocpp/1.6/Reset.json | 4 ++-- .../ocpp/1.6/SetChargingProfile.json | 4 ++-- .../ocpp/1.6/StartTransaction.json | 4 ++-- .../ocpp/1.6/StartTransactionResponse.json | 4 ++-- .../ocpp/1.6/StatusNotification.json | 4 ++-- .../ocpp/1.6/StatusNotificationResponse.json | 4 ++-- .../ocpp/1.6/StopTransaction.json | 4 ++-- .../ocpp/1.6/StopTransactionResponse.json | 4 ++-- .../json-schemas/ocpp/1.6/TriggerMessage.json | 4 ++-- .../ocpp/1.6/UnlockConnector.json | 4 ++-- .../ocpp/OCPPIncomingRequestService.ts | 13 ++----------- .../ocpp/OCPPRequestService.ts | 13 ++----------- .../ocpp/OCPPResponseService.ts | 13 ++----------- 36 files changed, 68 insertions(+), 115 deletions(-) diff --git a/package-lock.json b/package-lock.json index cf87f2db..10eb97f7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,6 @@ "@mikro-orm/reflection": "^5.6.3", "@mikro-orm/sqlite": "^5.6.3", "ajv": "^8.12.0", - "ajv-draft-04": "^1.0.0", "ajv-formats": "^2.1.1", "basic-ftp": "^5.0.2", "chalk": "^4.1.2", @@ -3115,19 +3114,6 @@ "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/ajv-draft-04": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/ajv-draft-04/-/ajv-draft-04-1.0.0.tgz", - "integrity": "sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw==", - "peerDependencies": { - "ajv": "^8.5.0" - }, - "peerDependenciesMeta": { - "ajv": { - "optional": true - } - } - }, "node_modules/ajv-formats": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", @@ -19959,11 +19945,6 @@ "uri-js": "^4.2.2" } }, - "ajv-draft-04": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/ajv-draft-04/-/ajv-draft-04-1.0.0.tgz", - "integrity": "sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw==" - }, "ajv-formats": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", diff --git a/package.json b/package.json index d0851240..89e95c32 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,6 @@ "@mikro-orm/reflection": "^5.6.3", "@mikro-orm/sqlite": "^5.6.3", "ajv": "^8.12.0", - "ajv-draft-04": "^1.0.0", "ajv-formats": "^2.1.1", "basic-ftp": "^5.0.2", "chalk": "^4.1.2", diff --git a/src/assets/json-schemas/ocpp/1.6/Authorize.json b/src/assets/json-schemas/ocpp/1.6/Authorize.json index 13ade1b6..88bbbde8 100644 --- a/src/assets/json-schemas/ocpp/1.6/Authorize.json +++ b/src/assets/json-schemas/ocpp/1.6/Authorize.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:AuthorizeRequest", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:AuthorizeRequest", "title": "AuthorizeRequest", "type": "object", "properties": { diff --git a/src/assets/json-schemas/ocpp/1.6/AuthorizeResponse.json b/src/assets/json-schemas/ocpp/1.6/AuthorizeResponse.json index 1d07daf5..685cb5cd 100644 --- a/src/assets/json-schemas/ocpp/1.6/AuthorizeResponse.json +++ b/src/assets/json-schemas/ocpp/1.6/AuthorizeResponse.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:AuthorizeResponse", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:AuthorizeResponse", "title": "AuthorizeResponse", "type": "object", "properties": { diff --git a/src/assets/json-schemas/ocpp/1.6/BootNotification.json b/src/assets/json-schemas/ocpp/1.6/BootNotification.json index d1106f41..04414aec 100644 --- a/src/assets/json-schemas/ocpp/1.6/BootNotification.json +++ b/src/assets/json-schemas/ocpp/1.6/BootNotification.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:BootNotificationRequest", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:BootNotificationRequest", "title": "BootNotificationRequest", "type": "object", "properties": { diff --git a/src/assets/json-schemas/ocpp/1.6/BootNotificationResponse.json b/src/assets/json-schemas/ocpp/1.6/BootNotificationResponse.json index dae5400f..7374645f 100644 --- a/src/assets/json-schemas/ocpp/1.6/BootNotificationResponse.json +++ b/src/assets/json-schemas/ocpp/1.6/BootNotificationResponse.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:BootNotificationResponse", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:BootNotificationResponse", "title": "BootNotificationResponse", "type": "object", "properties": { diff --git a/src/assets/json-schemas/ocpp/1.6/ChangeAvailability.json b/src/assets/json-schemas/ocpp/1.6/ChangeAvailability.json index 6cd6c456..3133adff 100644 --- a/src/assets/json-schemas/ocpp/1.6/ChangeAvailability.json +++ b/src/assets/json-schemas/ocpp/1.6/ChangeAvailability.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:ChangeAvailabilityRequest", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:ChangeAvailabilityRequest", "title": "ChangeAvailabilityRequest", "type": "object", "properties": { diff --git a/src/assets/json-schemas/ocpp/1.6/ChangeConfiguration.json b/src/assets/json-schemas/ocpp/1.6/ChangeConfiguration.json index 607bae16..b1f3e289 100644 --- a/src/assets/json-schemas/ocpp/1.6/ChangeConfiguration.json +++ b/src/assets/json-schemas/ocpp/1.6/ChangeConfiguration.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:ChangeConfigurationRequest", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:ChangeConfigurationRequest", "title": "ChangeConfigurationRequest", "type": "object", "properties": { diff --git a/src/assets/json-schemas/ocpp/1.6/ClearCache.json b/src/assets/json-schemas/ocpp/1.6/ClearCache.json index 8f3d7821..e721e8ec 100644 --- a/src/assets/json-schemas/ocpp/1.6/ClearCache.json +++ b/src/assets/json-schemas/ocpp/1.6/ClearCache.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:ClearCacheRequest", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:ClearCacheRequest", "title": "ClearCacheRequest", "type": "object", "properties": {}, diff --git a/src/assets/json-schemas/ocpp/1.6/ClearChargingProfile.json b/src/assets/json-schemas/ocpp/1.6/ClearChargingProfile.json index f6b1c01e..0af0bda6 100644 --- a/src/assets/json-schemas/ocpp/1.6/ClearChargingProfile.json +++ b/src/assets/json-schemas/ocpp/1.6/ClearChargingProfile.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:ClearChargingProfileRequest", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:ClearChargingProfileRequest", "title": "ClearChargingProfileRequest", "type": "object", "properties": { diff --git a/src/assets/json-schemas/ocpp/1.6/DataTransfer.json b/src/assets/json-schemas/ocpp/1.6/DataTransfer.json index e91122c6..9d8be33c 100755 --- a/src/assets/json-schemas/ocpp/1.6/DataTransfer.json +++ b/src/assets/json-schemas/ocpp/1.6/DataTransfer.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:DataTransferRequest", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:DataTransferRequest", "title": "DataTransferRequest", "type": "object", "properties": { diff --git a/src/assets/json-schemas/ocpp/1.6/DataTransferResponse.json b/src/assets/json-schemas/ocpp/1.6/DataTransferResponse.json index dec90865..e43e41a8 100755 --- a/src/assets/json-schemas/ocpp/1.6/DataTransferResponse.json +++ b/src/assets/json-schemas/ocpp/1.6/DataTransferResponse.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:DataTransferResponse", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:DataTransferResponse", "title": "DataTransferResponse", "type": "object", "properties": { diff --git a/src/assets/json-schemas/ocpp/1.6/DiagnosticsStatusNotification.json b/src/assets/json-schemas/ocpp/1.6/DiagnosticsStatusNotification.json index 0939f1a5..f45ecba6 100644 --- a/src/assets/json-schemas/ocpp/1.6/DiagnosticsStatusNotification.json +++ b/src/assets/json-schemas/ocpp/1.6/DiagnosticsStatusNotification.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:DiagnosticsStatusNotificationRequest", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:DiagnosticsStatusNotificationRequest", "title": "DiagnosticsStatusNotificationRequest", "type": "object", "properties": { diff --git a/src/assets/json-schemas/ocpp/1.6/DiagnosticsStatusNotificationResponse.json b/src/assets/json-schemas/ocpp/1.6/DiagnosticsStatusNotificationResponse.json index a15b2447..a59c33c5 100644 --- a/src/assets/json-schemas/ocpp/1.6/DiagnosticsStatusNotificationResponse.json +++ b/src/assets/json-schemas/ocpp/1.6/DiagnosticsStatusNotificationResponse.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:DiagnosticsStatusNotificationResponse", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:DiagnosticsStatusNotificationResponse", "title": "DiagnosticsStatusNotificationResponse", "type": "object", "properties": {}, diff --git a/src/assets/json-schemas/ocpp/1.6/GetCompositeSchedule.json b/src/assets/json-schemas/ocpp/1.6/GetCompositeSchedule.json index 8939a61b..d49bcfd3 100644 --- a/src/assets/json-schemas/ocpp/1.6/GetCompositeSchedule.json +++ b/src/assets/json-schemas/ocpp/1.6/GetCompositeSchedule.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:GetCompositeScheduleRequest", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:GetCompositeScheduleRequest", "title": "GetCompositeScheduleRequest", "type": "object", "properties": { diff --git a/src/assets/json-schemas/ocpp/1.6/GetConfiguration.json b/src/assets/json-schemas/ocpp/1.6/GetConfiguration.json index 4134be7d..c692df8c 100644 --- a/src/assets/json-schemas/ocpp/1.6/GetConfiguration.json +++ b/src/assets/json-schemas/ocpp/1.6/GetConfiguration.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:GetConfigurationRequest", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:GetConfigurationRequest", "title": "GetConfigurationRequest", "type": "object", "properties": { diff --git a/src/assets/json-schemas/ocpp/1.6/GetDiagnostics.json b/src/assets/json-schemas/ocpp/1.6/GetDiagnostics.json index 92c6f585..bb02bc56 100644 --- a/src/assets/json-schemas/ocpp/1.6/GetDiagnostics.json +++ b/src/assets/json-schemas/ocpp/1.6/GetDiagnostics.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:GetDiagnosticsRequest", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:GetDiagnosticsRequest", "title": "GetDiagnosticsRequest", "type": "object", "properties": { diff --git a/src/assets/json-schemas/ocpp/1.6/Heartbeat.json b/src/assets/json-schemas/ocpp/1.6/Heartbeat.json index 490a2247..7fc98a29 100644 --- a/src/assets/json-schemas/ocpp/1.6/Heartbeat.json +++ b/src/assets/json-schemas/ocpp/1.6/Heartbeat.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:HeartbeatRequest", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:HeartbeatRequest", "title": "HeartbeatRequest", "type": "object", "properties": {}, diff --git a/src/assets/json-schemas/ocpp/1.6/HeartbeatResponse.json b/src/assets/json-schemas/ocpp/1.6/HeartbeatResponse.json index ac679c63..443fb371 100644 --- a/src/assets/json-schemas/ocpp/1.6/HeartbeatResponse.json +++ b/src/assets/json-schemas/ocpp/1.6/HeartbeatResponse.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:HeartbeatResponse", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:HeartbeatResponse", "title": "HeartbeatResponse", "type": "object", "properties": { diff --git a/src/assets/json-schemas/ocpp/1.6/MeterValues.json b/src/assets/json-schemas/ocpp/1.6/MeterValues.json index 792a76c4..23e22eb6 100644 --- a/src/assets/json-schemas/ocpp/1.6/MeterValues.json +++ b/src/assets/json-schemas/ocpp/1.6/MeterValues.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:MeterValuesRequest", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:MeterValuesRequest", "title": "MeterValuesRequest", "type": "object", "properties": { diff --git a/src/assets/json-schemas/ocpp/1.6/MeterValuesResponse.json b/src/assets/json-schemas/ocpp/1.6/MeterValuesResponse.json index 5780cdd2..5317183d 100644 --- a/src/assets/json-schemas/ocpp/1.6/MeterValuesResponse.json +++ b/src/assets/json-schemas/ocpp/1.6/MeterValuesResponse.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:MeterValuesResponse", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:MeterValuesResponse", "title": "MeterValuesResponse", "type": "object", "properties": {}, diff --git a/src/assets/json-schemas/ocpp/1.6/RemoteStartTransaction.json b/src/assets/json-schemas/ocpp/1.6/RemoteStartTransaction.json index 7789af4b..3b1330a1 100644 --- a/src/assets/json-schemas/ocpp/1.6/RemoteStartTransaction.json +++ b/src/assets/json-schemas/ocpp/1.6/RemoteStartTransaction.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:RemoteStartTransactionRequest", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:RemoteStartTransactionRequest", "title": "RemoteStartTransactionRequest", "type": "object", "properties": { diff --git a/src/assets/json-schemas/ocpp/1.6/RemoteStopTransaction.json b/src/assets/json-schemas/ocpp/1.6/RemoteStopTransaction.json index a02c1186..d6390896 100644 --- a/src/assets/json-schemas/ocpp/1.6/RemoteStopTransaction.json +++ b/src/assets/json-schemas/ocpp/1.6/RemoteStopTransaction.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:RemoteStopTransactionRequest", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:RemoteStopTransactionRequest", "title": "RemoteStopTransactionRequest", "type": "object", "properties": { diff --git a/src/assets/json-schemas/ocpp/1.6/Reset.json b/src/assets/json-schemas/ocpp/1.6/Reset.json index c31cf109..3135c85b 100644 --- a/src/assets/json-schemas/ocpp/1.6/Reset.json +++ b/src/assets/json-schemas/ocpp/1.6/Reset.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:ResetRequest", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:ResetRequest", "title": "ResetRequest", "type": "object", "properties": { diff --git a/src/assets/json-schemas/ocpp/1.6/SetChargingProfile.json b/src/assets/json-schemas/ocpp/1.6/SetChargingProfile.json index 0ba9e853..c60b38a2 100644 --- a/src/assets/json-schemas/ocpp/1.6/SetChargingProfile.json +++ b/src/assets/json-schemas/ocpp/1.6/SetChargingProfile.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:SetChargingProfileRequest", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:SetChargingProfileRequest", "title": "SetChargingProfileRequest", "type": "object", "properties": { diff --git a/src/assets/json-schemas/ocpp/1.6/StartTransaction.json b/src/assets/json-schemas/ocpp/1.6/StartTransaction.json index 74bcfcf0..1bef1fe5 100644 --- a/src/assets/json-schemas/ocpp/1.6/StartTransaction.json +++ b/src/assets/json-schemas/ocpp/1.6/StartTransaction.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:StartTransactionRequest", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:StartTransactionRequest", "title": "StartTransactionRequest", "type": "object", "properties": { diff --git a/src/assets/json-schemas/ocpp/1.6/StartTransactionResponse.json b/src/assets/json-schemas/ocpp/1.6/StartTransactionResponse.json index 0ff1b460..22717ce9 100644 --- a/src/assets/json-schemas/ocpp/1.6/StartTransactionResponse.json +++ b/src/assets/json-schemas/ocpp/1.6/StartTransactionResponse.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:StartTransactionResponse", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:StartTransactionResponse", "title": "StartTransactionResponse", "type": "object", "properties": { diff --git a/src/assets/json-schemas/ocpp/1.6/StatusNotification.json b/src/assets/json-schemas/ocpp/1.6/StatusNotification.json index 4157af52..3bd21007 100644 --- a/src/assets/json-schemas/ocpp/1.6/StatusNotification.json +++ b/src/assets/json-schemas/ocpp/1.6/StatusNotification.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:StatusNotificationRequest", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:StatusNotificationRequest", "title": "StatusNotificationRequest", "type": "object", "properties": { diff --git a/src/assets/json-schemas/ocpp/1.6/StatusNotificationResponse.json b/src/assets/json-schemas/ocpp/1.6/StatusNotificationResponse.json index 72b7dfbf..99b8707d 100644 --- a/src/assets/json-schemas/ocpp/1.6/StatusNotificationResponse.json +++ b/src/assets/json-schemas/ocpp/1.6/StatusNotificationResponse.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:StatusNotificationResponse", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:StatusNotificationResponse", "title": "StatusNotificationResponse", "type": "object", "properties": {}, diff --git a/src/assets/json-schemas/ocpp/1.6/StopTransaction.json b/src/assets/json-schemas/ocpp/1.6/StopTransaction.json index db4de22a..7d5d3407 100644 --- a/src/assets/json-schemas/ocpp/1.6/StopTransaction.json +++ b/src/assets/json-schemas/ocpp/1.6/StopTransaction.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:StopTransactionRequest", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:StopTransactionRequest", "title": "StopTransactionRequest", "type": "object", "properties": { diff --git a/src/assets/json-schemas/ocpp/1.6/StopTransactionResponse.json b/src/assets/json-schemas/ocpp/1.6/StopTransactionResponse.json index fda9ade0..ab8174af 100644 --- a/src/assets/json-schemas/ocpp/1.6/StopTransactionResponse.json +++ b/src/assets/json-schemas/ocpp/1.6/StopTransactionResponse.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:StopTransactionResponse", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:StopTransactionResponse", "title": "StopTransactionResponse", "type": "object", "properties": { diff --git a/src/assets/json-schemas/ocpp/1.6/TriggerMessage.json b/src/assets/json-schemas/ocpp/1.6/TriggerMessage.json index a4ef5399..71e30ece 100644 --- a/src/assets/json-schemas/ocpp/1.6/TriggerMessage.json +++ b/src/assets/json-schemas/ocpp/1.6/TriggerMessage.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:TriggerMessageRequest", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:TriggerMessageRequest", "title": "TriggerMessageRequest", "type": "object", "properties": { diff --git a/src/assets/json-schemas/ocpp/1.6/UnlockConnector.json b/src/assets/json-schemas/ocpp/1.6/UnlockConnector.json index 483c898d..f5256a1d 100644 --- a/src/assets/json-schemas/ocpp/1.6/UnlockConnector.json +++ b/src/assets/json-schemas/ocpp/1.6/UnlockConnector.json @@ -1,6 +1,6 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "id": "urn:OCPP:1.6:2019:12:UnlockConnectorRequest", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "urn:OCPP:1.6:2019:12:UnlockConnectorRequest", "title": "UnlockConnectorRequest", "type": "object", "properties": { diff --git a/src/charging-station/ocpp/OCPPIncomingRequestService.ts b/src/charging-station/ocpp/OCPPIncomingRequestService.ts index ef643508..6015d4d9 100644 --- a/src/charging-station/ocpp/OCPPIncomingRequestService.ts +++ b/src/charging-station/ocpp/OCPPIncomingRequestService.ts @@ -1,13 +1,12 @@ import { AsyncResource } from 'async_hooks'; import Ajv, { type JSONSchemaType } from 'ajv'; -import AjvDraft04 from 'ajv-draft-04'; import ajvFormats from 'ajv-formats'; import OCPPError from '../../exception/OCPPError'; import type { HandleErrorParams } from '../../types/Error'; import type { JsonType } from '../../types/JsonType'; -import { OCPPVersion } from '../../types/ocpp/OCPPVersion'; +import type { OCPPVersion } from '../../types/ocpp/OCPPVersion'; import type { IncomingRequestCommand } from '../../types/ocpp/Requests'; import logger from '../../utils/Logger'; import type ChargingStation from '../ChargingStation'; @@ -23,15 +22,7 @@ export default abstract class OCPPIncomingRequestService { protected constructor(version: OCPPVersion) { this.version = version; - switch (this.version) { - case OCPPVersion.VERSION_16: - this.ajv = new AjvDraft04(); - break; - case OCPPVersion.VERSION_20: - case OCPPVersion.VERSION_201: - this.ajv = new Ajv(); - break; - } + this.ajv = new Ajv(); ajvFormats(this.ajv); this.asyncResource = new AsyncResource(moduleName); this.incomingRequestHandler.bind(this); diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index c9f100d4..c089c86a 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -1,5 +1,4 @@ import Ajv, { type JSONSchemaType } from 'ajv'; -import AjvDraft04 from 'ajv-draft-04'; import ajvFormats from 'ajv-formats'; import OCPPError from '../../exception/OCPPError'; @@ -9,7 +8,7 @@ import type { HandleErrorParams } from '../../types/Error'; import type { JsonObject, JsonType } from '../../types/JsonType'; import { ErrorType } from '../../types/ocpp/ErrorType'; import { MessageType } from '../../types/ocpp/MessageType'; -import { OCPPVersion } from '../../types/ocpp/OCPPVersion'; +import type { OCPPVersion } from '../../types/ocpp/OCPPVersion'; import { type ErrorCallback, type IncomingRequestCommand, @@ -38,15 +37,7 @@ export default abstract class OCPPRequestService { protected constructor(version: OCPPVersion, ocppResponseService: OCPPResponseService) { this.version = version; - switch (this.version) { - case OCPPVersion.VERSION_16: - this.ajv = new AjvDraft04(); - break; - case OCPPVersion.VERSION_20: - case OCPPVersion.VERSION_201: - this.ajv = new Ajv(); - break; - } + this.ajv = new Ajv(); ajvFormats(this.ajv); this.ocppResponseService = ocppResponseService; this.requestHandler.bind(this); diff --git a/src/charging-station/ocpp/OCPPResponseService.ts b/src/charging-station/ocpp/OCPPResponseService.ts index e5767be1..414eb8a8 100644 --- a/src/charging-station/ocpp/OCPPResponseService.ts +++ b/src/charging-station/ocpp/OCPPResponseService.ts @@ -1,10 +1,9 @@ import Ajv, { type JSONSchemaType } from 'ajv'; -import AjvDraft04 from 'ajv-draft-04'; import ajvFormats from 'ajv-formats'; import OCPPError from '../../exception/OCPPError'; import type { JsonType } from '../../types/JsonType'; -import { OCPPVersion } from '../../types/ocpp/OCPPVersion'; +import type { OCPPVersion } from '../../types/ocpp/OCPPVersion'; import type { RequestCommand } from '../../types/ocpp/Requests'; import logger from '../../utils/Logger'; import type ChargingStation from '../ChargingStation'; @@ -19,15 +18,7 @@ export default abstract class OCPPResponseService { protected constructor(version: OCPPVersion) { this.version = version; - switch (this.version) { - case OCPPVersion.VERSION_16: - this.ajv = new AjvDraft04(); - break; - case OCPPVersion.VERSION_20: - case OCPPVersion.VERSION_201: - this.ajv = new Ajv(); - break; - } + this.ajv = new Ajv(); ajvFormats(this.ajv); this.responseHandler.bind(this); this.validateResponsePayload.bind(this); -- 2.34.1