protected constructor(version: OCPPVersion, ocppResponseService: OCPPResponseService) {
this.version = version;
this.ajv = new Ajv({
+ keywords: ['javaType'],
multipleOfPrecision: 2,
});
ajvFormats(this.ajv);
return true;
}
const validate = this.ajv.compile(schema);
- this.convertDateToISOString<T>(payload);
+ OCPPServiceUtils.convertDateToISOString<T>(payload);
if (validate(payload)) {
return true;
}
}
}
- private convertDateToISOString<T extends JsonType>(obj: T): void {
- for (const k in obj) {
- if (obj[k] instanceof Date) {
- (obj as JsonObject)[k] = (obj[k] as Date).toISOString();
- } else if (obj[k] !== null && typeof obj[k] === 'object') {
- this.convertDateToISOString<T>(obj[k] as T);
- }
- }
- }
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public abstract requestHandler<ReqType extends JsonType, ResType extends JsonType>(
chargingStation: ChargingStation,