-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor!: Use true/false for command parameters to be more consistent #782
Conversation
Codecov Report
@@ Coverage Diff @@
## main #782 +/- ##
=======================================
Coverage 64.70% 64.70%
=======================================
Files 81 81
Lines 3108 3108
=======================================
Hits 2011 2011
Misses 907 907
Partials 190 190
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
clients/interfaces/command.go
Outdated
// dsPushEvent: If set to yes, a successful GET will result in an event being pushed to the EdgeX system. Default value is no. | ||
// dsReturnEvent: If set to no, there will be no Event returned in the http response. Default value is yes. | ||
// dsPushEvent: If set to true, a successful GET will result in an event being pushed to the EdgeX system. Default value is false. | ||
// dsReturnEvent: If set to false, there will be no Event returned in the http response. Default value is true. | ||
IssueGetCommandByName(ctx context.Context, deviceName string, commandName string, dsPushEvent string, dsReturnEvent string) (*responses.EventResponse, errors.EdgeX) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this interface use bool
instead of string
for these options?
IssueGetCommandByName(ctx context.Context, deviceName string, commandName string, dsPushEvent string, dsReturnEvent string) (*responses.EventResponse, errors.EdgeX) | |
IssueGetCommandByName(ctx context.Context, deviceName string, commandName string, dsPushEvent bool, dsReturnEvent bool) (*responses.EventResponse, errors.EdgeX) |
ValueTrue = "true" | ||
ValueFalse = "false" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need these constants for true and
false`??
ValueTrue = "true" | |
ValueFalse = "false" | |
ValueTrue = true | |
ValueFalse = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, we still need them for the query parameter definition to validate the values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they should still be in string data type, because the REST query parameter only allows string value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, can we then parse them to bool so that the IssueGetCommandByName
func can use bool?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, IssueGetCommandByName
client can use bool directly, and ValueTrue
/ValueFalse
will be used in the core-command internal implementation.
Please change commit message to have breaking change all on one line. The Conventional Commit spec what it all one one line 2 blank line???. I think 2 blank line is used when there is a very long description. I missed this on the other PR :-( .
|
BREAKING CHANGE: ds-pushevent and ds-returnevent to use true/false instead of yes/no close edgexfoundry#780 Signed-off-by: Ginny Guan <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…Name BREAKING CHANGE: ds-pushevent and ds-returnevent to use bool true/false instead of yes/no related: edgexfoundry/go-mod-core-contracts#782 Signed-off-by: Ginny Guan <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
BREAKING CHANGE: ds-pushevent and ds-returnevent to use bool true/false instead of yes/no related: edgexfoundry/go-mod-core-contracts#782 Signed-off-by: Ginny Guan <[email protected]>
BREAKING CHANGE: ds-pushevent and ds-returnevent to use bool true/false instead of yes/no related: edgexfoundry/go-mod-core-contracts#782 Signed-off-by: Ginny Guan <[email protected]>
BREAKING CHANGE: ds-pushevent and ds-returnevent to use bool true/false instead of yes/no related: edgexfoundry/go-mod-core-contracts#782 Signed-off-by: Ginny Guan <[email protected]>
BREAKING CHANGE: ds-pushevent and ds-returnevent to use bool true/false instead of yes/no related: edgexfoundry/go-mod-core-contracts#782 Signed-off-by: Ginny Guan <[email protected]>
BREAKING CHANGE: ds-pushevent and ds-returnevent to use bool true/false instead of yes/no related: edgexfoundry/go-mod-core-contracts#782 Signed-off-by: Ginny Guan <[email protected]>
BREAKING CHANGE: ds-pushevent and ds-returnevent to use bool true/false instead of yes/no related: edgexfoundry/go-mod-core-contracts#782 Signed-off-by: Ginny Guan <[email protected]>
BREAKING CHANGE: ds-pushevent and ds-returnevent to use bool true/false instead of yes/no related: edgexfoundry/go-mod-core-contracts#782 Signed-off-by: Ginny Guan <[email protected]>
#4276) * refactor!: Use bool types for command parameters to be more consistent BREAKING CHANGE: ds-pushevent and ds-returnevent to use bool true/false instead of yes/no related: edgexfoundry/go-mod-core-contracts#782 Signed-off-by: Ginny Guan <[email protected]>
BREAKING CHANGE: ds-pushevent and ds-returnevent to use bool true/false instead of yes/no related: edgexfoundry/go-mod-core-contracts#782 Signed-off-by: Ginny Guan <[email protected]>
BREAKING CHANGE:
close #780
Signed-off-by: Ginny Guan [email protected]
If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/go-mod-core-contracts/blob/main/.github/Contributing.md
PR Checklist
Please check if your PR fulfills the following requirements:
BREAKING CHANGE:
describing the break)docs: Update docs to use true/false for ds-pushevent and ds-returnevent in 3.0 edgex-docs#917
Testing Instructions
build core-command and device-virtual docker images based on the changes and run docker-compose.yml
The following commands work as expected:
curl http://localhost:59882/api/v2/device/name/Random-Boolean-Device/Bool\?ds-pushevent\=true
curl http://localhost:59882/api/v2/device/name/Random-Boolean-Device/Bool\?ds-pushevent\=false
curl http://localhost:59882/api/v2/device/name/Random-Boolean-Device/Bool\?ds-return\=true
curl http://localhost:59882/api/v2/device/name/Random-Boolean-Device/Bool\?ds-return\=false
New Dependency Instructions (If applicable)