mobilityhouse / ocpp

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

fix: DataTransfer data types #537

Closed mdwcrft closed 11 months ago

mdwcrft commented 11 months ago

In 2.0.1 both DataTransferRequest and DataTransferResponse have a field called data which is defined as AnyType so I believe these should both by of type Any here

malsyned commented 10 months ago

My read on the spec for this is different. The Field Type for data in both DataTransferRequest and DataTransferResponse is indeed listed as anyType. However, in 2.1.3. Primitive Datatypes, AnyType is defined as "Text, data without specified length or format" (emphasis mine). So I think the correct Python data type for this should be str, not Any.

This is a pretty confusing part of the spec, though, I could certainly be wrong. It looks like it has a mistake in it as well, because the capitalization isn't consistent between the Field Types anyType and the Primitive Datatype name AnyType. Maybe this part of the spec needs some TLC in the next revision.

OrangeTux commented 9 months ago

@malsyned Good catch! You're right. I think we should revert this change.

mdwcrft commented 9 months ago

My read on the spec for this is different. The Field Type for data in both DataTransferRequest and DataTransferResponse is indeed listed as anyType. However, in 2.1.3. Primitive Datatypes, AnyType is defined as "Text, data without specified length or format" (emphasis mine). So I think the correct Python data type for this should be str, not Any.

Interesting, I read "Text, data" to mean "Text OR data" - agreed it's not clear though I think @OrangeTux will ask the OCA for a clarification