mobilityhouse / ocpp

Python implementation of the Open Charge Point Protocol (OCPP).
MIT License
766 stars 298 forks source link

Wrong data type in CostUpdatedPayload.total_cost in respect to json schema #557

Closed AlfredoNaef closed 7 months ago

AlfredoNaef commented 8 months ago

Hello,

There is a mismatch between the data type for CostUpdatedPayload.total_cost in ocpp.ocpp.v201.datatypes and the json schema for CostUpdatedRequest. Specifically, in the first is defined as integer and the json schema a number, tha usually should be a float in python. Nevertheless, this difference yields the failure of the validation of the payload and hence the message is not sent. Though, just changing the type to float in CostUpdatedPayload.total_cost might not solve the problem, because afterwards the payload validation would fails when parsing the floats as metnioned in a previous issue of mine #555.

OrangeTux commented 7 months ago

Thanks for the report. You're right. The specification clearly states it's a decimal. And therefore, the dataclass should model the attribute total_cost as a float.

Jared-Newell-Mobility commented 7 months ago

PR created https://github.com/mobilityhouse/ocpp/pull/596

Jared-Newell-Mobility commented 7 months ago

Merged so will now close