X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Focpp%2F1.6%2FOCPP16ServiceUtils.ts;h=de9c8548926477a3c73f8de0bd3c5c0bced4aa7c;hb=7164966d863b4539243b473c5e2e9d22fb9b5fd1;hp=d09a8548d28e0545e949fd7c9913637e7ee0dd69;hpb=130783a74f495abcb198b7f01abe19dab4f7fb47;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts b/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts index d09a8548..de9c8548 100644 --- a/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts +++ b/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts @@ -1,6 +1,5 @@ // Partial Copyright Jerome Benoit. 2021-2023. All Rights Reserved. -import fs from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; @@ -8,7 +7,6 @@ import type { JSONSchemaType } from 'ajv'; import OCPPError from '../../../exception/OCPPError'; import { CurrentType, Voltage } from '../../../types/ChargingStationTemplate'; -import { FileType } from '../../../types/FileType'; import type { JsonType } from '../../../types/JsonType'; import type { MeasurandPerPhaseSampledValueTemplates, @@ -37,7 +35,6 @@ import { ErrorType } from '../../../types/ocpp/ErrorType'; import { OCPPVersion } from '../../../types/ocpp/OCPPVersion'; import Constants from '../../../utils/Constants'; import { ACElectricUtils, DCElectricUtils } from '../../../utils/ElectricUtils'; -import FileUtils from '../../../utils/FileUtils'; import logger from '../../../utils/Logger'; import Utils from '../../../utils/Utils'; import type ChargingStation from '../../ChargingStation'; @@ -790,18 +787,10 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { } public static parseJsonSchemaFile(relativePath: string): JSONSchemaType { - const filePath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), relativePath); - try { - return JSON.parse(fs.readFileSync(filePath, 'utf8')) as JSONSchemaType; - } catch (error) { - FileUtils.handleFileException( - OCPPServiceUtils.logPrefix(OCPPVersion.VERSION_16), - FileType.JsonSchema, - filePath, - error as NodeJS.ErrnoException, - { throwError: false } - ); - } + return super.parseJsonSchemaFile( + path.resolve(path.dirname(fileURLToPath(import.meta.url)), relativePath), + OCPPVersion.VERSION_16 + ); } private static buildSampledValue(