| 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, OCPPVersion } from '../../../types'; |
| 9 | import { OCPPServiceUtils } from '../internal'; |
| 10 | |
| 11 | export class OCPP20ServiceUtils extends OCPPServiceUtils { |
| 12 | public static parseJsonSchemaFile<T extends JsonType>( |
| 13 | relativePath: string, |
| 14 | moduleName?: string, |
| 15 | methodName?: string |
| 16 | ): JSONSchemaType<T> { |
| 17 | return super.parseJsonSchemaFile<T>( |
| 18 | path.resolve(path.dirname(fileURLToPath(import.meta.url)), relativePath), |
| 19 | OCPPVersion.VERSION_20, |
| 20 | moduleName, |
| 21 | methodName |
| 22 | ); |
| 23 | } |
| 24 | } |