From b32c51e5ee152747696e22babd6efdc08eee863d Mon Sep 17 00:00:00 2001 From: dwibudut Date: Tue, 12 Sep 2023 10:06:16 +0700 Subject: [PATCH] Fix all overridden validations --- ocpp1.6/core/boot_notification.go | 4 ++-- ocpp1.6/core/clear_cache.go | 4 ++-- ocpp1.6/core/data_transfer.go | 4 ++-- ocpp1.6/core/unlock_connector.go | 4 ++-- ocpp1.6/firmware/firmware_status_notification.go | 4 ++-- ocpp1.6/localauth/send_local_list.go | 4 ++-- ocpp1.6/remotetrigger/trigger_message.go | 8 ++++---- ocpp1.6/reservation/cancel_reservation.go | 4 ++-- ocpp1.6/smartcharging/clear_charging_profile.go | 4 ++-- ocpp1.6/smartcharging/set_charging_profile.go | 4 ++-- ocpp2.0.1/authorization/clear_cache.go | 4 ++-- ocpp2.0.1/data/data_transfer.go | 4 ++-- ocpp2.0.1/firmware/firmware_status_notification.go | 4 ++-- ocpp2.0.1/localauth/send_local_list.go | 4 ++-- ocpp2.0.1/provisioning/boot_notification.go | 4 ++-- ocpp2.0.1/remotecontrol/trigger_message.go | 8 ++++---- ocpp2.0.1/remotecontrol/unlock_connector.go | 6 +++--- ocpp2.0.1/reservation/cancel_reservation.go | 4 ++-- ocpp2.0.1/smartcharging/clear_charging_profile.go | 4 ++-- ocpp2.0.1/smartcharging/set_charging_profile.go | 4 ++-- 20 files changed, 45 insertions(+), 45 deletions(-) diff --git a/ocpp1.6/core/boot_notification.go b/ocpp1.6/core/boot_notification.go index e1b150f0..b3e63b05 100644 --- a/ocpp1.6/core/boot_notification.go +++ b/ocpp1.6/core/boot_notification.go @@ -47,7 +47,7 @@ type BootNotificationRequest struct { type BootNotificationConfirmation struct { CurrentTime *types.DateTime `json:"currentTime" validate:"required"` Interval int `json:"interval" validate:"gte=0"` - Status RegistrationStatus `json:"status" validate:"required,registrationStatus"` + Status RegistrationStatus `json:"status" validate:"required,registrationStatus16"` } // After each (re)boot, a Charge Point SHALL send a request to the Central System with information about its configuration (e.g. version, vendor, etc.). @@ -91,5 +91,5 @@ func NewBootNotificationConfirmation(currentTime *types.DateTime, interval int, } func init() { - _ = types.Validate.RegisterValidation("registrationStatus", isValidRegistrationStatus) + _ = types.Validate.RegisterValidation("registrationStatus16", isValidRegistrationStatus) } diff --git a/ocpp1.6/core/clear_cache.go b/ocpp1.6/core/clear_cache.go index 495741aa..4d6204ad 100644 --- a/ocpp1.6/core/clear_cache.go +++ b/ocpp1.6/core/clear_cache.go @@ -35,7 +35,7 @@ type ClearCacheRequest struct { // This field definition of the ClearCache confirmation payload, sent by the Charge Point to the Central System in response to a ClearCacheRequest. // In case the request was invalid, or couldn't be processed, an error will be sent instead. type ClearCacheConfirmation struct { - Status ClearCacheStatus `json:"status" validate:"required,cacheStatus"` + Status ClearCacheStatus `json:"status" validate:"required,cacheStatus16"` } // Central System can request a Charge Point to clear its Authorization Cache. @@ -75,5 +75,5 @@ func NewClearCacheConfirmation(status ClearCacheStatus) *ClearCacheConfirmation } func init() { - _ = types.Validate.RegisterValidation("cacheStatus", isValidClearCacheStatus) + _ = types.Validate.RegisterValidation("cacheStatus16", isValidClearCacheStatus) } diff --git a/ocpp1.6/core/data_transfer.go b/ocpp1.6/core/data_transfer.go index 8e56e231..bca7358a 100644 --- a/ocpp1.6/core/data_transfer.go +++ b/ocpp1.6/core/data_transfer.go @@ -40,7 +40,7 @@ type DataTransferRequest struct { // This field definition of the DataTransfer confirmation payload, sent by an endpoint in response to a DataTransferRequest, coming from the other endpoint. // In case the request was invalid, or couldn't be processed, an error will be sent instead. type DataTransferConfirmation struct { - Status DataTransferStatus `json:"status" validate:"required,dataTransferStatus"` + Status DataTransferStatus `json:"status" validate:"required,dataTransferStatus16"` Data interface{} `json:"data,omitempty"` } @@ -79,5 +79,5 @@ func NewDataTransferConfirmation(status DataTransferStatus) *DataTransferConfirm } func init() { - _ = types.Validate.RegisterValidation("dataTransferStatus", isValidDataTransferStatus) + _ = types.Validate.RegisterValidation("dataTransferStatus16", isValidDataTransferStatus) } diff --git a/ocpp1.6/core/unlock_connector.go b/ocpp1.6/core/unlock_connector.go index 5d3d764c..165da681 100644 --- a/ocpp1.6/core/unlock_connector.go +++ b/ocpp1.6/core/unlock_connector.go @@ -37,7 +37,7 @@ type UnlockConnectorRequest struct { // This field definition of the UnlockConnector confirmation payload, sent by the Charge Point to the Central System in response to an UnlockConnectorRequest. // In case the request was invalid, or couldn't be processed, an error will be sent instead. type UnlockConnectorConfirmation struct { - Status UnlockStatus `json:"status" validate:"required,unlockStatus"` + Status UnlockStatus `json:"status" validate:"required,unlockStatus16"` } // Central System can request a Charge Point to unlock a connector. To do so, the Central System SHALL send an UnlockConnectorRequest. @@ -81,5 +81,5 @@ func NewUnlockConnectorConfirmation(status UnlockStatus) *UnlockConnectorConfirm } func init() { - _ = types.Validate.RegisterValidation("unlockStatus", isValidUnlockStatus) + _ = types.Validate.RegisterValidation("unlockStatus16", isValidUnlockStatus) } diff --git a/ocpp1.6/firmware/firmware_status_notification.go b/ocpp1.6/firmware/firmware_status_notification.go index d85557b0..06e6b2ed 100644 --- a/ocpp1.6/firmware/firmware_status_notification.go +++ b/ocpp1.6/firmware/firmware_status_notification.go @@ -35,7 +35,7 @@ func isValidFirmwareStatus(fl validator.FieldLevel) bool { // The field definition of the FirmwareStatusNotification request payload sent by the Charge Point to the Central System. type FirmwareStatusNotificationRequest struct { - Status FirmwareStatus `json:"status" validate:"required,firmwareStatus"` + Status FirmwareStatus `json:"status" validate:"required,firmwareStatus16"` } // This field definition of the FirmwareStatusNotification confirmation payload, sent by the Central System to the Charge Point in response to a FirmwareStatusNotificationRequest. @@ -79,5 +79,5 @@ func NewFirmwareStatusNotificationConfirmation() *FirmwareStatusNotificationConf } func init() { - _ = types.Validate.RegisterValidation("firmwareStatus", isValidFirmwareStatus) + _ = types.Validate.RegisterValidation("firmwareStatus16", isValidFirmwareStatus) } diff --git a/ocpp1.6/localauth/send_local_list.go b/ocpp1.6/localauth/send_local_list.go index 8330a331..d1107ebf 100644 --- a/ocpp1.6/localauth/send_local_list.go +++ b/ocpp1.6/localauth/send_local_list.go @@ -55,7 +55,7 @@ type AuthorizationData struct { type SendLocalListRequest struct { ListVersion int `json:"listVersion" validate:"gte=0"` LocalAuthorizationList []AuthorizationData `json:"localAuthorizationList,omitempty" validate:"omitempty,dive"` - UpdateType UpdateType `json:"updateType" validate:"required,updateType"` + UpdateType UpdateType `json:"updateType" validate:"required,updateType16"` } // This field definition of the SendLocalList confirmation payload, sent by the Charge Point to the Central System in response to a SendLocalListRequest. @@ -106,6 +106,6 @@ func NewSendLocalListConfirmation(status UpdateStatus) *SendLocalListConfirmatio func init() { _ = types.Validate.RegisterValidation("updateStatus", isValidUpdateStatus) - _ = types.Validate.RegisterValidation("updateType", isValidUpdateType) + _ = types.Validate.RegisterValidation("updateType16", isValidUpdateType) //TODO: validation for SendLocalListMaxLength } diff --git a/ocpp1.6/remotetrigger/trigger_message.go b/ocpp1.6/remotetrigger/trigger_message.go index 0d66be88..962a0545 100644 --- a/ocpp1.6/remotetrigger/trigger_message.go +++ b/ocpp1.6/remotetrigger/trigger_message.go @@ -46,14 +46,14 @@ func isValidMessageTrigger(fl validator.FieldLevel) bool { // The field definition of the TriggerMessage request payload sent by the Central System to the Charge Point. type TriggerMessageRequest struct { - RequestedMessage MessageTrigger `json:"requestedMessage" validate:"required,messageTrigger"` + RequestedMessage MessageTrigger `json:"requestedMessage" validate:"required,messageTrigger16"` ConnectorId *int `json:"connectorId,omitempty" validate:"omitempty,gt=0"` } // This field definition of the TriggerMessage confirmation payload, sent by the Charge Point to the Central System in response to a TriggerMessageRequest. // In case the request was invalid, or couldn't be processed, an error will be sent instead. type TriggerMessageConfirmation struct { - Status TriggerMessageStatus `json:"status" validate:"required,triggerMessageStatus"` + Status TriggerMessageStatus `json:"status" validate:"required,triggerMessageStatus16"` } // During normal operation, the Charge Point informs the Central System of its state and any relevant occurrences. @@ -110,6 +110,6 @@ func NewTriggerMessageConfirmation(status TriggerMessageStatus) *TriggerMessageC } func init() { - _ = types.Validate.RegisterValidation("triggerMessageStatus", isValidTriggerMessageStatus) - _ = types.Validate.RegisterValidation("messageTrigger", isValidMessageTrigger) + _ = types.Validate.RegisterValidation("triggerMessageStatus16", isValidTriggerMessageStatus) + _ = types.Validate.RegisterValidation("messageTrigger16", isValidMessageTrigger) } diff --git a/ocpp1.6/reservation/cancel_reservation.go b/ocpp1.6/reservation/cancel_reservation.go index bdfa0776..c6f14a8c 100644 --- a/ocpp1.6/reservation/cancel_reservation.go +++ b/ocpp1.6/reservation/cancel_reservation.go @@ -36,7 +36,7 @@ type CancelReservationRequest struct { // This field definition of the CancelReservation confirmation payload, sent by the Charge Point to the Central System in response to a CancelReservationRequest. // In case the request was invalid, or couldn't be processed, an error will be sent instead. type CancelReservationConfirmation struct { - Status CancelReservationStatus `json:"status" validate:"required,cancelReservationStatus"` + Status CancelReservationStatus `json:"status" validate:"required,cancelReservationStatus16"` } // To cancel a reservation the Central System SHALL send an CancelReservationRequest to the Charge Point. @@ -75,5 +75,5 @@ func NewCancelReservationConfirmation(status CancelReservationStatus) *CancelRes } func init() { - _ = types.Validate.RegisterValidation("cancelReservationStatus", isValidCancelReservationStatus) + _ = types.Validate.RegisterValidation("cancelReservationStatus16", isValidCancelReservationStatus) } diff --git a/ocpp1.6/smartcharging/clear_charging_profile.go b/ocpp1.6/smartcharging/clear_charging_profile.go index b280d7fd..7a7a3ef1 100644 --- a/ocpp1.6/smartcharging/clear_charging_profile.go +++ b/ocpp1.6/smartcharging/clear_charging_profile.go @@ -40,7 +40,7 @@ type ClearChargingProfileRequest struct { // This field definition of the ClearChargingProfile confirmation payload, sent by the Charge Point to the Central System in response to a ClearChargingProfileRequest. // In case the request was invalid, or couldn't be processed, an error will be sent instead. type ClearChargingProfileConfirmation struct { - Status ClearChargingProfileStatus `json:"status" validate:"required,clearChargingProfileStatus"` + Status ClearChargingProfileStatus `json:"status" validate:"required,clearChargingProfileStatus16"` } // If the Central System wishes to clear some or all of the charging profiles that were previously sent the Charge Point, @@ -81,5 +81,5 @@ func NewClearChargingProfileConfirmation(status ClearChargingProfileStatus) *Cle } func init() { - _ = types.Validate.RegisterValidation("clearChargingProfileStatus", isValidClearChargingProfileStatus) + _ = types.Validate.RegisterValidation("clearChargingProfileStatus16", isValidClearChargingProfileStatus) } diff --git a/ocpp1.6/smartcharging/set_charging_profile.go b/ocpp1.6/smartcharging/set_charging_profile.go index 9392a82e..4694d32a 100644 --- a/ocpp1.6/smartcharging/set_charging_profile.go +++ b/ocpp1.6/smartcharging/set_charging_profile.go @@ -39,7 +39,7 @@ type SetChargingProfileRequest struct { // This field definition of the SetChargingProfile confirmation payload, sent by the Charge Point to the Central System in response to a SetChargingProfileRequest. // In case the request was invalid, or couldn't be processed, an error will be sent instead. type SetChargingProfileConfirmation struct { - Status ChargingProfileStatus `json:"status" validate:"required,chargingProfileStatus"` + Status ChargingProfileStatus `json:"status" validate:"required,chargingProfileStatus16"` } // The Central System MAY send charging profiles to a Charge Point that are to be used as default charging profiles. @@ -79,5 +79,5 @@ func NewSetChargingProfileConfirmation(status ChargingProfileStatus) *SetChargin } func init() { - _ = types.Validate.RegisterValidation("chargingProfileStatus", isValidChargingProfileStatus) + _ = types.Validate.RegisterValidation("chargingProfileStatus16", isValidChargingProfileStatus) } diff --git a/ocpp2.0.1/authorization/clear_cache.go b/ocpp2.0.1/authorization/clear_cache.go index 6d839520..334d9d2f 100644 --- a/ocpp2.0.1/authorization/clear_cache.go +++ b/ocpp2.0.1/authorization/clear_cache.go @@ -37,7 +37,7 @@ type ClearCacheRequest struct { // This field definition of the ClearCache response payload, sent by the Charging Station to the CSMS in response to a ClearCacheRequest. // In case the request was invalid, or couldn't be processed, an error will be sent instead. type ClearCacheResponse struct { - Status ClearCacheStatus `json:"status" validate:"required,cacheStatus"` + Status ClearCacheStatus `json:"status" validate:"required,cacheStatus201"` StatusInfo *types.StatusInfo `json:"statusInfo,omitempty" validate:"omitempty"` } @@ -78,5 +78,5 @@ func NewClearCacheResponse(status ClearCacheStatus) *ClearCacheResponse { } func init() { - _ = types.Validate.RegisterValidation("cacheStatus", isValidClearCacheStatus) + _ = types.Validate.RegisterValidation("cacheStatus201", isValidClearCacheStatus) } diff --git a/ocpp2.0.1/data/data_transfer.go b/ocpp2.0.1/data/data_transfer.go index 76986371..e82d18ed 100644 --- a/ocpp2.0.1/data/data_transfer.go +++ b/ocpp2.0.1/data/data_transfer.go @@ -42,7 +42,7 @@ type DataTransferRequest struct { // This field definition of the DataTransfer response payload, sent by an endpoint in response to a DataTransferRequest, coming from the other endpoint. // In case the request was invalid, or couldn't be processed, an error will be sent instead. type DataTransferResponse struct { - Status DataTransferStatus `json:"status" validate:"required,dataTransferStatus"` + Status DataTransferStatus `json:"status" validate:"required,dataTransferStatus201"` Data interface{} `json:"data,omitempty"` StatusInfo *types.StatusInfo `json:"statusInfo,omitempty" validate:"omitempty"` } @@ -82,5 +82,5 @@ func NewDataTransferResponse(status DataTransferStatus) *DataTransferResponse { } func init() { - _ = types.Validate.RegisterValidation("dataTransferStatus", isValidDataTransferStatus) + _ = types.Validate.RegisterValidation("dataTransferStatus201", isValidDataTransferStatus) } diff --git a/ocpp2.0.1/firmware/firmware_status_notification.go b/ocpp2.0.1/firmware/firmware_status_notification.go index 319b7d3b..d18d1857 100644 --- a/ocpp2.0.1/firmware/firmware_status_notification.go +++ b/ocpp2.0.1/firmware/firmware_status_notification.go @@ -44,7 +44,7 @@ func isValidFirmwareStatus(fl validator.FieldLevel) bool { // The field definition of the FirmwareStatusNotification request payload sent by the Charging Station to the CSMS. type FirmwareStatusNotificationRequest struct { - Status FirmwareStatus `json:"status" validate:"required,firmwareStatus"` + Status FirmwareStatus `json:"status" validate:"required,firmwareStatus201"` RequestID *int `json:"requestId,omitempty" validate:"omitempty,gte=0"` } @@ -89,5 +89,5 @@ func NewFirmwareStatusNotificationResponse() *FirmwareStatusNotificationResponse } func init() { - _ = types.Validate.RegisterValidation("firmwareStatus", isValidFirmwareStatus) + _ = types.Validate.RegisterValidation("firmwareStatus201", isValidFirmwareStatus) } diff --git a/ocpp2.0.1/localauth/send_local_list.go b/ocpp2.0.1/localauth/send_local_list.go index 353303cb..06550bb8 100644 --- a/ocpp2.0.1/localauth/send_local_list.go +++ b/ocpp2.0.1/localauth/send_local_list.go @@ -57,7 +57,7 @@ type AuthorizationData struct { // The field definition of the SendLocalList request payload sent by the CSMS to the Charging Station. type SendLocalListRequest struct { VersionNumber int `json:"versionNumber" validate:"gte=0"` - UpdateType UpdateType `json:"updateType" validate:"required,updateType"` + UpdateType UpdateType `json:"updateType" validate:"required,updateType201"` LocalAuthorizationList []AuthorizationData `json:"localAuthorizationList,omitempty" validate:"omitempty,dive"` } @@ -110,6 +110,6 @@ func NewSendLocalListResponse(status SendLocalListStatus) *SendLocalListResponse } func init() { - _ = types.Validate.RegisterValidation("updateType", isValidUpdateType) + _ = types.Validate.RegisterValidation("updateType201", isValidUpdateType) _ = types.Validate.RegisterValidation("sendLocalListStatus", isValidSendLocalListStatus) } diff --git a/ocpp2.0.1/provisioning/boot_notification.go b/ocpp2.0.1/provisioning/boot_notification.go index b2d0c3cd..9bdb276d 100644 --- a/ocpp2.0.1/provisioning/boot_notification.go +++ b/ocpp2.0.1/provisioning/boot_notification.go @@ -79,7 +79,7 @@ type BootNotificationRequest struct { type BootNotificationResponse struct { CurrentTime *types.DateTime `json:"currentTime" validate:"required"` Interval int `json:"interval" validate:"gte=0"` - Status RegistrationStatus `json:"status" validate:"required,registrationStatus"` + Status RegistrationStatus `json:"status" validate:"required,registrationStatus201"` StatusInfo *types.StatusInfo `json:"statusInfo,omitempty" validate:"omitempty"` } @@ -127,6 +127,6 @@ func NewBootNotificationResponse(currentTime *types.DateTime, interval int, stat } func init() { - _ = types.Validate.RegisterValidation("registrationStatus", isValidRegistrationStatus) + _ = types.Validate.RegisterValidation("registrationStatus201", isValidRegistrationStatus) _ = types.Validate.RegisterValidation("bootReason", isValidBootReason) } diff --git a/ocpp2.0.1/remotecontrol/trigger_message.go b/ocpp2.0.1/remotecontrol/trigger_message.go index b81bb032..ead9347c 100644 --- a/ocpp2.0.1/remotecontrol/trigger_message.go +++ b/ocpp2.0.1/remotecontrol/trigger_message.go @@ -60,14 +60,14 @@ func isValidTriggerMessageStatus(fl validator.FieldLevel) bool { // The field definition of the TriggerMessage request payload sent by the CSMS to the Charging Station. type TriggerMessageRequest struct { - RequestedMessage MessageTrigger `json:"requestedMessage" validate:"required,messageTrigger"` + RequestedMessage MessageTrigger `json:"requestedMessage" validate:"required,messageTrigger201"` Evse *types.EVSE `json:"evse,omitempty" validate:"omitempty"` } // This field definition of the TriggerMessage response payload, sent by the Charging Station to the CSMS in response to a TriggerMessageRequest. // In case the request was invalid, or couldn't be processed, an error will be sent instead. type TriggerMessageResponse struct { - Status TriggerMessageStatus `json:"status" validate:"required,triggerMessageStatus"` + Status TriggerMessageStatus `json:"status" validate:"required,triggerMessageStatus201"` StatusInfo *types.StatusInfo `json:"statusInfo,omitempty"` } @@ -107,6 +107,6 @@ func NewTriggerMessageResponse(status TriggerMessageStatus) *TriggerMessageRespo } func init() { - _ = types.Validate.RegisterValidation("messageTrigger", isValidMessageTrigger) - _ = types.Validate.RegisterValidation("triggerMessageStatus", isValidTriggerMessageStatus) + _ = types.Validate.RegisterValidation("messageTrigger201", isValidMessageTrigger) + _ = types.Validate.RegisterValidation("triggerMessageStatus201", isValidTriggerMessageStatus) } diff --git a/ocpp2.0.1/remotecontrol/unlock_connector.go b/ocpp2.0.1/remotecontrol/unlock_connector.go index 9cbadc6d..07035285 100644 --- a/ocpp2.0.1/remotecontrol/unlock_connector.go +++ b/ocpp2.0.1/remotecontrol/unlock_connector.go @@ -44,7 +44,7 @@ type UnlockConnectorRequest struct { // This field definition of the UnlockConnector response payload, sent by the Charging Station to the CSMS in response to a UnlockConnectorRequest. // In case the request was invalid, or couldn't be processed, an error will be sent instead. type UnlockConnectorResponse struct { - Status UnlockStatus `json:"status" validate:"required,unlockStatus"` + Status UnlockStatus `json:"status" validate:"required,unlockStatus201"` StatusInfo *types.StatusInfo `json:"statusInfo,omitempty"` } @@ -52,7 +52,7 @@ type UnlockConnectorResponse struct { // This happens most of the time when there is tension on the charging cable. // This means the driver cannot unplug his charging cable from the Charging Station. // To help a driver, the CSO can send a UnlockConnectorRequest to the Charging Station. -//The Charging Station will then try to unlock the connector again and respond with an UnlockConnectorResponse. +// The Charging Station will then try to unlock the connector again and respond with an UnlockConnectorResponse. type UnlockConnectorFeature struct{} func (f UnlockConnectorFeature) GetFeatureName() string { @@ -86,5 +86,5 @@ func NewUnlockConnectorResponse(status UnlockStatus) *UnlockConnectorResponse { } func init() { - _ = types.Validate.RegisterValidation("unlockStatus", isValidUnlockStatus) + _ = types.Validate.RegisterValidation("unlockStatus201", isValidUnlockStatus) } diff --git a/ocpp2.0.1/reservation/cancel_reservation.go b/ocpp2.0.1/reservation/cancel_reservation.go index c559539c..e865ccea 100644 --- a/ocpp2.0.1/reservation/cancel_reservation.go +++ b/ocpp2.0.1/reservation/cancel_reservation.go @@ -38,7 +38,7 @@ type CancelReservationRequest struct { // This field definition of the CancelReservation response payload, sent by the Charging Station to the CSMS in response to a CancelReservationRequest. // In case the request was invalid, or couldn't be processed, an error will be sent instead. type CancelReservationResponse struct { - Status CancelReservationStatus `json:"status" validate:"required,cancelReservationStatus"` + Status CancelReservationStatus `json:"status" validate:"required,cancelReservationStatus201"` StatusInfo *types.StatusInfo `json:"statusInfo,omitempty" validate:"omitempty"` } @@ -78,5 +78,5 @@ func NewCancelReservationResponse(status CancelReservationStatus) *CancelReserva } func init() { - _ = types.Validate.RegisterValidation("cancelReservationStatus", isValidCancelReservationStatus) + _ = types.Validate.RegisterValidation("cancelReservationStatus201", isValidCancelReservationStatus) } diff --git a/ocpp2.0.1/smartcharging/clear_charging_profile.go b/ocpp2.0.1/smartcharging/clear_charging_profile.go index e3ce5941..a366d132 100644 --- a/ocpp2.0.1/smartcharging/clear_charging_profile.go +++ b/ocpp2.0.1/smartcharging/clear_charging_profile.go @@ -45,7 +45,7 @@ type ClearChargingProfileRequest struct { // This field definition of the ClearChargingProfile response payload, sent by the Charging Station to the CSMS in response to a ClearChargingProfileRequest. // In case the request was invalid, or couldn't be processed, an error will be sent instead. type ClearChargingProfileResponse struct { - Status ClearChargingProfileStatus `json:"status" validate:"required,clearChargingProfileStatus"` + Status ClearChargingProfileStatus `json:"status" validate:"required,clearChargingProfileStatus201"` StatusInfo *types.StatusInfo `json:"statusInfo,omitempty" validate:"omitempty"` } @@ -87,5 +87,5 @@ func NewClearChargingProfileResponse(status ClearChargingProfileStatus) *ClearCh } func init() { - _ = types.Validate.RegisterValidation("clearChargingProfileStatus", isValidClearChargingProfileStatus) + _ = types.Validate.RegisterValidation("clearChargingProfileStatus201", isValidClearChargingProfileStatus) } diff --git a/ocpp2.0.1/smartcharging/set_charging_profile.go b/ocpp2.0.1/smartcharging/set_charging_profile.go index 83be9768..c1adcf86 100644 --- a/ocpp2.0.1/smartcharging/set_charging_profile.go +++ b/ocpp2.0.1/smartcharging/set_charging_profile.go @@ -39,7 +39,7 @@ type SetChargingProfileRequest struct { // This field definition of the SetChargingProfile response payload, sent by the Charging Station to the CSMS in response to a SetChargingProfileRequest. // In case the request was invalid, or couldn't be processed, an error will be sent instead. type SetChargingProfileResponse struct { - Status ChargingProfileStatus `json:"status" validate:"required,chargingProfileStatus"` + Status ChargingProfileStatus `json:"status" validate:"required,chargingProfileStatus201"` StatusInfo *types.StatusInfo `json:"statusInfo,omitempty" validate:"omitempty"` } @@ -87,5 +87,5 @@ func NewSetChargingProfileResponse(status ChargingProfileStatus) *SetChargingPro } func init() { - _ = types.Validate.RegisterValidation("chargingProfileStatus", isValidChargingProfileStatus) + _ = types.Validate.RegisterValidation("chargingProfileStatus201", isValidChargingProfileStatus) }