Skip to content

Commit

Permalink
The serialisation of soc to SoC should not occur in camel case if it …
Browse files Browse the repository at this point in the history
…is existing at the beginning of a field (mobilityhouse#527)
  • Loading branch information
Jared-Newell-Mobility authored Feb 14, 2024
1 parent 6da0402 commit 6f1d615
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Change log

- [#523](https://github.com/mobilityhouse/ocpp/issues/523) The serialisation of soc to SoC should not occur in camel case if it is existing at the beginning of a field
- [#515](https://github.com/mobilityhouse/ocpp/issues/515) Update Readthedocs configuration
- [#602](https://github.com/mobilityhouse/ocpp/issues/602) Correct v2g serialisation/deserialisation
- [#557](https://github.com/mobilityhouse/ocpp/issues/557) OCPP 2.0.1 Wrong data type in CostUpdated total_cost
Expand Down
1 change: 1 addition & 0 deletions ocpp/charge_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def snake_to_camel_case(data):
if isinstance(data, dict):
camel_case_dict = {}
for key, value in data.items():
key = key.replace("soc_limit_reached", "SOCLimitReached")
key = key.replace("soc", "SoC")
key = key.replace("_v2x", "V2X").replace("_v2g", "V2G")
components = key.split("_")
Expand Down
1 change: 1 addition & 0 deletions tests/test_charge_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def test_camel_to_snake_case(test_input, expected):
[
({"transaction_id": "74563478"}, {"transactionId": "74563478"}),
({"full_soc": 100}, {"fullSoC": 100}),
({"soc_limit_reached": 200}, {"SOCLimitReached": 200}),
({"ev_min_v2x_energy_request": 200}, {"evMinV2XEnergyRequest": 200}),
({"v2x_charging_ctrlr": 200}, {"v2xChargingCtrlr": 200}),
({"sign_v2g_certificate": 200}, {"signV2GCertificate": 200}),
Expand Down

0 comments on commit 6f1d615

Please sign in to comment.