- public static getInstance<T extends OCPPResponseService>(
- this: new (chargingStation: ChargingStation) => T,
- chargingStation: ChargingStation
- ): T {
- if (!OCPPResponseService.instances.has(chargingStation.id)) {
- OCPPResponseService.instances.set(chargingStation.id, new this(chargingStation));
+ protected validateResponsePayload<T extends JsonType>(
+ chargingStation: ChargingStation,
+ commandName: RequestCommand,
+ schema: JSONSchemaType<T>,
+ payload: T
+ ): boolean {
+ if (!chargingStation.getPayloadSchemaValidation()) {
+ return true;
+ }
+ const validate = this.ajv.compile(schema);
+ if (validate(payload)) {
+ return true;