Migrate all JSON schemas to draft-06 or higher
authorJérôme Benoit <jerome.benoit@sap.com>
Thu, 5 Jan 2023 21:12:53 +0000 (22:12 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Thu, 5 Jan 2023 21:12:53 +0000 (22:12 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
36 files changed:
package-lock.json
package.json
src/assets/json-schemas/ocpp/1.6/Authorize.json
src/assets/json-schemas/ocpp/1.6/AuthorizeResponse.json
src/assets/json-schemas/ocpp/1.6/BootNotification.json
src/assets/json-schemas/ocpp/1.6/BootNotificationResponse.json
src/assets/json-schemas/ocpp/1.6/ChangeAvailability.json
src/assets/json-schemas/ocpp/1.6/ChangeConfiguration.json
src/assets/json-schemas/ocpp/1.6/ClearCache.json
src/assets/json-schemas/ocpp/1.6/ClearChargingProfile.json
src/assets/json-schemas/ocpp/1.6/DataTransfer.json
src/assets/json-schemas/ocpp/1.6/DataTransferResponse.json
src/assets/json-schemas/ocpp/1.6/DiagnosticsStatusNotification.json
src/assets/json-schemas/ocpp/1.6/DiagnosticsStatusNotificationResponse.json
src/assets/json-schemas/ocpp/1.6/GetCompositeSchedule.json
src/assets/json-schemas/ocpp/1.6/GetConfiguration.json
src/assets/json-schemas/ocpp/1.6/GetDiagnostics.json
src/assets/json-schemas/ocpp/1.6/Heartbeat.json
src/assets/json-schemas/ocpp/1.6/HeartbeatResponse.json
src/assets/json-schemas/ocpp/1.6/MeterValues.json
src/assets/json-schemas/ocpp/1.6/MeterValuesResponse.json
src/assets/json-schemas/ocpp/1.6/RemoteStartTransaction.json
src/assets/json-schemas/ocpp/1.6/RemoteStopTransaction.json
src/assets/json-schemas/ocpp/1.6/Reset.json
src/assets/json-schemas/ocpp/1.6/SetChargingProfile.json
src/assets/json-schemas/ocpp/1.6/StartTransaction.json
src/assets/json-schemas/ocpp/1.6/StartTransactionResponse.json
src/assets/json-schemas/ocpp/1.6/StatusNotification.json
src/assets/json-schemas/ocpp/1.6/StatusNotificationResponse.json
src/assets/json-schemas/ocpp/1.6/StopTransaction.json
src/assets/json-schemas/ocpp/1.6/StopTransactionResponse.json
src/assets/json-schemas/ocpp/1.6/TriggerMessage.json
src/assets/json-schemas/ocpp/1.6/UnlockConnector.json
src/charging-station/ocpp/OCPPIncomingRequestService.ts
src/charging-station/ocpp/OCPPRequestService.ts
src/charging-station/ocpp/OCPPResponseService.ts

index cf87f2db70d37a860b29107809e46a0633f9c70a..10eb97f7cc862e2db8fdb109039870dbabce8c8e 100644 (file)
@@ -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",
         "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",
         "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",
index d0851240576f46915aabffbb98502a0d4ba1d59a..89e95c32cfe8be93c71dd4e39b4a05bb4fda594d 100644 (file)
@@ -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",
index 13ade1b6d8fece505cb1f26f0824112811653be3..88bbbde81b7001340f984be18aea5a34527c63b4 100644 (file)
@@ -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": {
index 1d07daf5a9422bc6ecb8c7ef4d6c87b42c2ef4b4..685cb5cdb55ea40f25d7e128193b0c832c86efdf 100644 (file)
@@ -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": {
index d1106f417656d65a21f291a7f420c8cb9c38db3a..04414aec73cbf63915f1217c781dec46595c3638 100644 (file)
@@ -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": {
index dae5400f66bb1ee6191ba142247223beb1b7d433..7374645f7aa59e9574fbbc8906d8f70986d9f03e 100644 (file)
@@ -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": {
index 6cd6c456bc797671510dae20f9c78542d21e89cf..3133adff004edd39c7439ac4b88fd737f156da32 100644 (file)
@@ -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": {
index 607bae16249197b1211b42bae68bf0e146cea356..b1f3e2898d80f8889480d2221e293db65f3aa73d 100644 (file)
@@ -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": {
index 8f3d7821fc8c693a56dfab8700711984ffbe73ca..e721e8ecdb65835a53356181a05849c99dc8582c 100644 (file)
@@ -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": {},
index f6b1c01ec57bf7c78a8cfea376ea18d3dc90c7f9..0af0bda68283be4185db7cd3768cebef4562151d 100644 (file)
@@ -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": {
index e91122c64740e6659ddbcfde12316ab092b84cbb..9d8be33c1bbae4e1d44611ee8ca5128aada2864a 100755 (executable)
@@ -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": {
index dec90865d817cb4f8f328a93e53217762c253459..e43e41a82c57fcae00b09747e796fd2f00f0186e 100755 (executable)
@@ -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": {
index 0939f1a505567b31caf7aff8c6d7ac0cca870723..f45ecba6ed0b10d7ef5d5c80c11679434c3ccf55 100644 (file)
@@ -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": {
index a15b244799a600bc18e0b5255625e2a478bcb482..a59c33c50ef40244ecaa541c386ee8d40299ff85 100644 (file)
@@ -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": {},
index 8939a61b3ae5d6dbb708ded8e8fe75c40533382a..d49bcfd3a84ecc44d65479269172c513b608128f 100644 (file)
@@ -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": {
index 4134be7d97fdd6263c459931be69d5f2ce98e589..c692df8c5bd7b44faaf2141b9bcec107a6006bbb 100644 (file)
@@ -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": {
index 92c6f585427711f402bee5df54acc6b38fba4986..bb02bc56a658160adeb9778cc7730bef35e44a38 100644 (file)
@@ -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": {
index 490a2247335d81fe5398e4d1a5478f73fc990769..7fc98a298211d1da29ab37c40d449040c1e4c1e3 100644 (file)
@@ -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": {},
index ac679c63d066ca0d66dce7ec68c6a3aa8ceb5f56..443fb3715a19f182ceb99fdf07092b577de9d5de 100644 (file)
@@ -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": {
index 792a76c42ecdf8e07d736af7ebe4bad18ffa5bfa..23e22eb65f29e391fa008468bf072c8779d93488 100644 (file)
@@ -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": {
index 5780cdd2fbbefe1c94f611f108de555b60b71c22..5317183d31dadf653efe0fb531d56f941d8470b4 100644 (file)
@@ -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": {},
index 7789af4b24bff6271214ad4de29b490656b5dcd0..3b1330a1afaa4e37a46e84973f768e1a01149be6 100644 (file)
@@ -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": {
index a02c1186a711f9b381ba8c34b5d35ecc2eb6df16..d6390896591075911adfc13fa46e526a2b6a9d73 100644 (file)
@@ -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": {
index c31cf109f2da8ca0802e62ada8bf08f9ccd52980..3135c85b4b73f36217c91e5dfe5ab0da1ef1ffb1 100644 (file)
@@ -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": {
index 0ba9e853332bf026ef57a5aa96115e323ec0fa31..c60b38a2d6173152becb9f08e8b9883cbb328f7a 100644 (file)
@@ -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": {
index 74bcfcf098902b857cff36c591d632a795d8583a..1bef1fe595efc73489189c5cfabf2070df86f932 100644 (file)
@@ -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": {
index 0ff1b460d5da99f72295a7cdafb53a756ae3d81f..22717ce95f65641efbdbddad4689e258fbee7ed2 100644 (file)
@@ -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": {
index 4157af52237d4fcc743df498150ebd1e3b960252..3bd21007e521102b380c6b6980eb695e0124f678 100644 (file)
@@ -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": {
index 72b7dfbff0173886fa4551252023ab50c574046f..99b8707d586042eeeabb6e81290e5055f7179b28 100644 (file)
@@ -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": {},
index db4de22a476c03c850f8bd6f3dcf366a9a3f9956..7d5d3407745106ba031e4945ffc14c83104ed27e 100644 (file)
@@ -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": {
index fda9ade025f591688ff518b3e7c9bdad092fba83..ab8174af76a0db2979685d8c82ec9569c585093a 100644 (file)
@@ -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": {
index a4ef5399ece3e6b50d10df6a2439816ad93f6a51..71e30ecea4958770d7a54851119dca479b9fc01a 100644 (file)
@@ -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": {
index 483c898df077e798f57807e62c2a192b59000bcf..f5256a1d753eefe26102d4aa8552657173e197c6 100644 (file)
@@ -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": {
index ef64350812b49f897087a832040d494bf652b8a3..6015d4d9b8037956e1434ae23b934fd4f98bad6e 100644 (file)
@@ -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);
index c9f100d48f2af32a9a4277e4671ea756efb045b3..c089c86a1af4092dd57e1deb281dab48c9d7769a 100644 (file)
@@ -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);
index e5767be194dc23ab2c4fef567b63577bb9127e34..414eb8a8ac6ade9c7c7fafa4d0032b9a2d9ea0f9 100644 (file)
@@ -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);