Skip to content
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

Merged
merged 1 commit into from
Jan 12, 2023

Conversation

jinlinGuan
Copy link
Contributor

@jinlinGuan jinlinGuan commented Dec 23, 2022

BREAKING CHANGE:

  • ds-pushevent and ds-returnevent to use true/false instead of yes/no

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:

  • I am not introducing a breaking change (if you are, flag in conventional commit message with BREAKING CHANGE: describing the break)
  • I am not introducing a new dependency (add notes below if you are)
  • I have added unit tests for the new feature or bug fix (if not, why?)
  • I have fully tested (add details below) this the new feature or bug fix (if not, why?)
  • I have opened a PR for the related docs change (if not, why?)
    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)

@codecov-commenter
Copy link

codecov-commenter commented Dec 23, 2022

Codecov Report

Merging #782 (a2a49d7) into main (7e0c83d) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #782   +/-   ##
=======================================
  Coverage   64.70%   64.70%           
=======================================
  Files          81       81           
  Lines        3108     3108           
=======================================
  Hits         2011     2011           
  Misses        907      907           
  Partials      190      190           
Impacted Files Coverage Δ
clients/http/command.go 74.46% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

// 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)
Copy link
Member

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?

Suggested change
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)

Comment on lines 193 to 194
ValueTrue = "true"
ValueFalse = "false"
Copy link
Member

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`??

Suggested change
ValueTrue = "true"
ValueFalse = "false"
ValueTrue = true
ValueFalse = false

Copy link
Member

@cloudxxx8 cloudxxx8 Jan 3, 2023

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

Copy link
Member

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

Copy link
Member

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?

Copy link
Member

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.

@lenny-goodell
Copy link
Member

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 :-( .
https://github.com/edgexfoundry/go-mod-core-contracts/blob/main/.github/Contributing.md#footer

BREAKING CHANGE: ds-pushevent and ds-returnevent to use true/false instead of yes/no

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]>
Copy link
Member

@lenny-goodell lenny-goodell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

jinlinGuan added a commit to jinlinGuan/go-mod-messaging that referenced this pull request Jan 12, 2023
…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]>
Copy link
Member

@cloudxxx8 cloudxxx8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cloudxxx8 cloudxxx8 merged commit 8b66e6c into edgexfoundry:main Jan 12, 2023
jinlinGuan added a commit to jinlinGuan/go-mod-messaging that referenced this pull request Jan 12, 2023
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]>
jinlinGuan added a commit to jinlinGuan/go-mod-messaging that referenced this pull request Jan 12, 2023
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]>
jinlinGuan added a commit to jinlinGuan/device-sdk-go that referenced this pull request Jan 12, 2023
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]>
@jinlinGuan jinlinGuan deleted the issue-780 branch January 12, 2023 10:27
jinlinGuan added a commit to jinlinGuan/edgex-go that referenced this pull request Jan 12, 2023
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]>
jinlinGuan added a commit to jinlinGuan/device-sdk-go that referenced this pull request Jan 12, 2023
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]>
jinlinGuan added a commit to jinlinGuan/edgex-go that referenced this pull request Jan 12, 2023
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]>
jinlinGuan added a commit to jinlinGuan/device-sdk-go that referenced this pull request Jan 16, 2023
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]>
lenny-goodell pushed a commit to edgexfoundry/edgex-go that referenced this pull request Jan 17, 2023
#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]>
jinlinGuan added a commit to jinlinGuan/device-sdk-go that referenced this pull request Jan 30, 2023
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[EdgeX 3.0] Use true/false instead of yes/no in query parameters
4 participants