diff --git a/go.mod b/go.mod index 5df1281d89..99ad815c13 100644 --- a/go.mod +++ b/go.mod @@ -3,9 +3,9 @@ module github.com/edgexfoundry/edgex-go require ( bitbucket.org/bertimus9/systemstat v0.0.0-20180207000608-0eeff89b0690 github.com/eclipse/paho.mqtt.golang v1.4.2 - github.com/edgexfoundry/go-mod-bootstrap/v3 v3.0.0-dev.8 - github.com/edgexfoundry/go-mod-core-contracts/v3 v3.0.0-dev.2 - github.com/edgexfoundry/go-mod-messaging/v3 v3.0.0-dev.3 + github.com/edgexfoundry/go-mod-bootstrap/v3 v3.0.0-dev.9 + github.com/edgexfoundry/go-mod-core-contracts/v3 v3.0.0-dev.3 + github.com/edgexfoundry/go-mod-messaging/v3 v3.0.0-dev.4 github.com/edgexfoundry/go-mod-secrets/v3 v3.0.0-dev.2 github.com/fxamacker/cbor/v2 v2.4.0 github.com/golang-jwt/jwt/v4 v4.4.3 diff --git a/go.sum b/go.sum index 8b245ff3fc..ad1ca62cf0 100644 --- a/go.sum +++ b/go.sum @@ -28,14 +28,14 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/eclipse/paho.mqtt.golang v1.4.2 h1:66wOzfUHSSI1zamx7jR6yMEI5EuHnT1G6rNA5PM12m4= github.com/eclipse/paho.mqtt.golang v1.4.2/go.mod h1:JGt0RsEwEX+Xa/agj90YJ9d9DH2b7upDZMK9HRbFvCA= -github.com/edgexfoundry/go-mod-bootstrap/v3 v3.0.0-dev.8 h1:BvIM4O8edFi/nhtJmfy4lh+keYG3VbHvfWjyXoyiESU= -github.com/edgexfoundry/go-mod-bootstrap/v3 v3.0.0-dev.8/go.mod h1:2I6w1vDe1Hsq0woNy5L9SqRAho+xjpObhhlv1dI4avY= +github.com/edgexfoundry/go-mod-bootstrap/v3 v3.0.0-dev.9 h1:YQRmArf08iSHOJ1xIXMchxfsbeguUPbG1Q1E0IVAUZA= +github.com/edgexfoundry/go-mod-bootstrap/v3 v3.0.0-dev.9/go.mod h1:lJI+SO9B3dWOn/UfJ90fYQVR4wYddjEkvmAJqt/WdxA= github.com/edgexfoundry/go-mod-configuration/v3 v3.0.0-dev.2 h1:xp5MsP+qf/fuJxy8fT7k1N+c4j4C6w04qMCBXm6id7o= github.com/edgexfoundry/go-mod-configuration/v3 v3.0.0-dev.2/go.mod h1:1Vv4uWAo6r7k6jUlqVJW8JOL6YKVBc6sRL8Al3DrMck= -github.com/edgexfoundry/go-mod-core-contracts/v3 v3.0.0-dev.2 h1:tleTxhbBISfDNn596rU71n+GOy27dMIme+v8Vl0uhpw= -github.com/edgexfoundry/go-mod-core-contracts/v3 v3.0.0-dev.2/go.mod h1:7RwSq896VqelvSU7zYKs2tpZhgELVFECkiGf6XGLKfQ= -github.com/edgexfoundry/go-mod-messaging/v3 v3.0.0-dev.3 h1:+el2HxEt02uFXXBmHK8gWETPklNbPg4wvYln/4/ooHo= -github.com/edgexfoundry/go-mod-messaging/v3 v3.0.0-dev.3/go.mod h1:G0Vxoc8+JXwUqRH5ggyOZ/f/CIVPTswI5Ld7dI5uhIY= +github.com/edgexfoundry/go-mod-core-contracts/v3 v3.0.0-dev.3 h1:Ia/y/w9w3SmXqIqJ+Vjmv6QrP49YJDpTY6262C1Jrzs= +github.com/edgexfoundry/go-mod-core-contracts/v3 v3.0.0-dev.3/go.mod h1:7RwSq896VqelvSU7zYKs2tpZhgELVFECkiGf6XGLKfQ= +github.com/edgexfoundry/go-mod-messaging/v3 v3.0.0-dev.4 h1:swPZOjoQ/IUIWSJpZCmQENtP/plFRx5tgiCEZgnfxFU= +github.com/edgexfoundry/go-mod-messaging/v3 v3.0.0-dev.4/go.mod h1:8pxuYvh2zcq1GuKqmk1MAuH1yuN40iOMmL0g2myIfwk= github.com/edgexfoundry/go-mod-registry/v3 v3.0.0-dev.3 h1:QgZF9f70Cwpvkjw3tP1aiVGHc+yNFJNzW6hO8pDs3fg= github.com/edgexfoundry/go-mod-registry/v3 v3.0.0-dev.3/go.mod h1:2w8v0sv+i21nY+DY6JV4PFxsNTuxpGAjlNFlFMTfZkk= github.com/edgexfoundry/go-mod-secrets/v3 v3.0.0-dev.2 h1:Lu1gJr2fAUTuogE/SwgVgGpxDlMsC4PLE0Y8oXRUvkI= diff --git a/internal/core/command/controller/http/command.go b/internal/core/command/controller/http/command.go index 2a5ba4a470..68ba95cbe4 100644 --- a/internal/core/command/controller/http/command.go +++ b/internal/core/command/controller/http/command.go @@ -79,13 +79,13 @@ func (cc *CommandController) CommandsByDeviceName(w http.ResponseWriter, r *http } func validateGetCommandParameters(r *http.Request) (err errors.EdgeX) { - dsReturnEvent := utils.ParseQueryStringToString(r, common.ReturnEvent, common.ValueYes) - dsPushEvent := utils.ParseQueryStringToString(r, common.PushEvent, common.ValueNo) - if dsReturnEvent != common.ValueYes && dsReturnEvent != common.ValueNo { - return errors.NewCommonEdgeX(errors.KindContractInvalid, fmt.Sprintf("invalid query parameter, %s has to be %s or %s", dsReturnEvent, common.ValueYes, common.ValueNo), nil) + dsReturnEvent := utils.ParseQueryStringToString(r, common.ReturnEvent, common.ValueTrue) + dsPushEvent := utils.ParseQueryStringToString(r, common.PushEvent, common.ValueFalse) + if dsReturnEvent != common.ValueTrue && dsReturnEvent != common.ValueFalse { + return errors.NewCommonEdgeX(errors.KindContractInvalid, fmt.Sprintf("invalid query parameter, %s has to be %s or %s", dsReturnEvent, common.ValueTrue, common.ValueFalse), nil) } - if dsPushEvent != common.ValueYes && dsPushEvent != common.ValueNo { - return errors.NewCommonEdgeX(errors.KindContractInvalid, fmt.Sprintf("invalid query parameter, %s has to be %s or %s", dsPushEvent, common.ValueYes, common.ValueNo), nil) + if dsPushEvent != common.ValueTrue && dsPushEvent != common.ValueFalse { + return errors.NewCommonEdgeX(errors.KindContractInvalid, fmt.Sprintf("invalid query parameter, %s has to be %s or %s", dsPushEvent, common.ValueTrue, common.ValueFalse), nil) } return nil } diff --git a/internal/core/command/controller/http/command_test.go b/internal/core/command/controller/http/command_test.go index 4ae93ff64c..b2411d4048 100644 --- a/internal/core/command/controller/http/command_test.go +++ b/internal/core/command/controller/http/command_test.go @@ -46,7 +46,7 @@ const ( testDeviceServiceName = "testDeviceService" testCommandName = "testCommand" testBaseAddress = "http://localhost:49990" - testQueryStrings = "a=1&b=2&ds-pushevent=no" + testQueryStrings = "a=1&b=2&ds-pushevent=false" ) // NewMockDIC function returns a mock bootstrap di Container diff --git a/internal/core/command/controller/messaging/external_test.go b/internal/core/command/controller/messaging/external_test.go index db2cac55da..e1cc48eb57 100644 --- a/internal/core/command/controller/messaging/external_test.go +++ b/internal/core/command/controller/messaging/external_test.go @@ -392,8 +392,8 @@ func testCommandQueryPayload() types.MessageEnvelope { func testCommandRequestPayload() types.MessageEnvelope { payload := types.NewMessageEnvelopeForRequest(nil, map[string]string{ - "ds-pushevent": "yes", - "ds-returnevent": "yes", + "ds-pushevent": common.ValueTrue, + "ds-returnevent": common.ValueTrue, }) return payload diff --git a/internal/core/command/controller/messaging/utils.go b/internal/core/command/controller/messaging/utils.go index 42717ad888..03fa82da96 100644 --- a/internal/core/command/controller/messaging/utils.go +++ b/internal/core/command/controller/messaging/utils.go @@ -54,13 +54,13 @@ func validateRequestTopic(prefix string, deviceName string, commandName string, // validateGetCommandQueryParameters validates the value is valid for device service's reserved query parameters func validateGetCommandQueryParameters(queryParams map[string]string) error { if dsReturnEvent, ok := queryParams[common.ReturnEvent]; ok { - if dsReturnEvent != common.ValueYes && dsReturnEvent != common.ValueNo { - return fmt.Errorf("invalid query parameter, %s has to be '%s' or '%s'", common.ReturnEvent, common.ValueYes, common.ValueNo) + if dsReturnEvent != common.ValueTrue && dsReturnEvent != common.ValueFalse { + return fmt.Errorf("invalid query parameter, %s has to be '%s' or '%s'", common.ReturnEvent, common.ValueTrue, common.ValueFalse) } } if dsPushEvent, ok := queryParams[common.PushEvent]; ok { - if dsPushEvent != common.ValueYes && dsPushEvent != common.ValueNo { - return fmt.Errorf("invalid query parameter, %s has to be '%s' or '%s'", common.PushEvent, common.ValueYes, common.ValueNo) + if dsPushEvent != common.ValueTrue && dsPushEvent != common.ValueFalse { + return fmt.Errorf("invalid query parameter, %s has to be '%s' or '%s'", common.PushEvent, common.ValueTrue, common.ValueFalse) } } diff --git a/openapi/v2/core-command.yaml b/openapi/v2/core-command.yaml index 2d2de526d7..a49d5e3f38 100644 --- a/openapi/v2/core-command.yaml +++ b/openapi/v2/core-command.yaml @@ -564,21 +564,21 @@ paths: schema: type: string enum: - - yes - - no - default: no - example: yes - description: "If set to yes, a successful GET will result in an event being pushed to the EdgeX system" + - true + - false + default: false + example: true + description: "If set to true, a successful GET will result in an event being pushed to the EdgeX system" - in: query name: ds-returnevent schema: type: string enum: - - yes - - no - default: yes - example: no - description: "If set to no, there will be no Event returned in the http response" + - true + - false + default: true + example: false + description: "If set to false, there will be no Event returned in the http response" responses: '200': description: "OK"