b155f462d2615a65e83f1580435709bb081d59f7
[e-mobility-charging-stations-simulator.git] / src / charging-station / ocpp / 2.0 / OCPP20ServiceUtils.ts
1 // Partial Copyright Jerome Benoit. 2021-2023. All Rights Reserved.
2
3 import path from 'node:path';
4 import { fileURLToPath } from 'node:url';
5
6 import type { JSONSchemaType } from 'ajv';
7
8 import type { JsonType } from '../../../types/JsonType';
9 import { OCPPVersion } from '../../../types/ocpp/OCPPVersion';
10 import { OCPPServiceUtils } from '../OCPPServiceUtils';
11
12 export class OCPP20ServiceUtils extends OCPPServiceUtils {
13 public static parseJsonSchemaFile<T extends JsonType>(
14 relativePath: string,
15 moduleName?: string,
16 methodName?: string
17 ): JSONSchemaType<T> {
18 return super.parseJsonSchemaFile<T>(
19 path.resolve(path.dirname(fileURLToPath(import.meta.url)), relativePath),
20 OCPPVersion.VERSION_20,
21 moduleName,
22 methodName
23 );
24 }
25 }