Cleanup shared helpers structure
[e-mobility-charging-stations-simulator.git] / src / charging-station / ocpp / OCPPIncomingRequestService.ts
index 0e69fcfcac9ad0d587b8d3656a8cb356416651f5..509eebd57b16bd8beacb924aafba3b5e2c5e8423 100644 (file)
@@ -1,11 +1,11 @@
-import { JSONSchemaType } from 'ajv';
+import type { JSONSchemaType } from 'ajv';
 import Ajv from 'ajv-draft-04';
 import ajvFormats from 'ajv-formats';
 
 import OCPPError from '../../exception/OCPPError';
-import { HandleErrorParams } from '../../types/Error';
-import { JsonType } from '../../types/JsonType';
-import { IncomingRequestCommand } from '../../types/ocpp/Requests';
+import type { HandleErrorParams } from '../../types/Error';
+import type { JsonType } from '../../types/JsonType';
+import type { IncomingRequestCommand } from '../../types/ocpp/Requests';
 import logger from '../../utils/Logger';
 import type ChargingStation from '../ChargingStation';
 import { OCPPServiceUtils } from './OCPPServiceUtils';
@@ -37,8 +37,7 @@ export default abstract class OCPPIncomingRequestService {
     params: HandleErrorParams<T> = { throwError: true }
   ): T {
     logger.error(
-      `${chargingStation.logPrefix()} ${moduleName}.handleIncomingRequestError: Incoming request command %s error:`,
-      commandName,
+      `${chargingStation.logPrefix()} ${moduleName}.handleIncomingRequestError: Incoming request command '${commandName}' error:`,
       error
     );
     if (!params?.throwError && params?.errorResponse) {
@@ -58,7 +57,7 @@ export default abstract class OCPPIncomingRequestService {
     schema: JSONSchemaType<T>,
     payload: T
   ): boolean {
-    if (!chargingStation.getPayloadSchemaValidation()) {
+    if (chargingStation.getPayloadSchemaValidation() === false) {
       return true;
     }
     const validate = this.ajv.compile(schema);