You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I have a question regarding ChargingProfile struct. In OCPP1.6 spec ChargingProfile.transactionId is an optional field and in the code (https://github.com/lorenzodonini/ocpp-go/blob/master/ocpp1.6/types/types.go#L132) it is marked as omitempty but the field itself is not *int but int. The same applies to ChargingProfile.RecurrencyKind, I think it should be a pointer field too.
I think this is a semantic issue. Even though the field might not be a pointer, it can be treated as optional. Thejson:"omitempty" field tag will not include the fields that have default values (0 for int and "" for string) in the marshaled JSON sent to the charge point.
Maybe it would be better for clarity, but doesnt mean the implementation is entirely wrong.
❔ What is your question?
Hello, I have a question regarding
ChargingProfile
struct. In OCPP1.6 specChargingProfile.transactionId
is an optional field and in the code (https://github.com/lorenzodonini/ocpp-go/blob/master/ocpp1.6/types/types.go#L132) it is marked asomitempty
but the field itself is not*int
butint
. The same applies toChargingProfile.RecurrencyKind
, I think it should be a pointer field too.The same can be said about
ClearChargingProfileRequest
(https://github.com/lorenzodonini/ocpp-go/blob/master/ocpp1.6/smartcharging/clear_charging_profile.go#L36),ClearChargingProfileRequest.ChargingProfilePurpose
is an optional field according to spec but in the code it is not a pointer and at the same time this field hasomitempty
tag.So does it need to be fixed? Or everything is fine as it is?
Which OCPP version referring to?
Are you using any OCPP extensions?
👀 Have you spent some time to check if this question has been asked before?
The text was updated successfully, but these errors were encountered: