Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a17e61d

Browse files
authoredMar 30, 2024··
Merge branch 'lorenzodonini:master' into master
2 parents d5400c7 + e5ac6a5 commit a17e61d

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed
 

‎ocpp1.6/remotetrigger/trigger_message.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package remotetrigger
22

33
import (
4+
"reflect"
5+
46
"github.com/lorenzodonini/ocpp-go/ocpp1.6/core"
57
"github.com/lorenzodonini/ocpp-go/ocpp1.6/firmware"
68
"github.com/lorenzodonini/ocpp-go/ocpp1.6/types"
79
"gopkg.in/go-playground/validator.v9"
8-
"reflect"
910
)
1011

1112
// -------------------- Trigger Message (CS -> CP) --------------------
@@ -47,7 +48,7 @@ func isValidMessageTrigger(fl validator.FieldLevel) bool {
4748
// The field definition of the TriggerMessage request payload sent by the Central System to the Charge Point.
4849
type TriggerMessageRequest struct {
4950
RequestedMessage MessageTrigger `json:"requestedMessage" validate:"required,messageTrigger16"`
50-
ConnectorId *int `json:"connectorId,omitempty" validate:"omitempty,gt=0"`
51+
ConnectorId *int `json:"connectorId,omitempty" validate:"omitempty,gte=0"`
5152
}
5253

5354
// This field definition of the TriggerMessage confirmation payload, sent by the Charge Point to the Central System in response to a TriggerMessageRequest.

‎ocpp1.6_test/trigger_message_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ func (suite *OcppV16TestSuite) TestTriggerMessageRequestValidation() {
1717
{remotetrigger.TriggerMessageRequest{RequestedMessage: core.StatusNotificationFeatureName, ConnectorId: newInt(1)}, true},
1818
{remotetrigger.TriggerMessageRequest{RequestedMessage: core.StatusNotificationFeatureName}, true},
1919
{remotetrigger.TriggerMessageRequest{}, false},
20-
{remotetrigger.TriggerMessageRequest{RequestedMessage: core.StatusNotificationFeatureName, ConnectorId: newInt(0)}, false},
20+
{remotetrigger.TriggerMessageRequest{RequestedMessage: core.StatusNotificationFeatureName, ConnectorId: newInt(0)}, true},
21+
{remotetrigger.TriggerMessageRequest{RequestedMessage: core.StatusNotificationFeatureName, ConnectorId: newInt(-1)}, false},
2122
{remotetrigger.TriggerMessageRequest{RequestedMessage: core.StartTransactionFeatureName}, false},
2223
}
2324
ExecuteGenericTestTable(t, requestTable)

0 commit comments

Comments
 (0)
Please sign in to comment.