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

Create new fields in ResourceOperation #114

Closed
iain-anderson opened this issue Jun 25, 2019 · 2 comments · Fixed by #127
Closed

Create new fields in ResourceOperation #114

iain-anderson opened this issue Jun 25, 2019 · 2 comments · Fixed by #127
Labels
enhancement New feature or request fuji help wanted Extra attention is needed

Comments

@iain-anderson
Copy link
Member

As discussed in Device Services WG 24th Jun
New fields:

  • DeviceCommand (json:"deviceCommand")
  • DeviceResource (json:"deviceResource")

"Object" to be marked as deprecated (replaced by DeviceResource)
"Resource" to be marked as deprecated (replaced by DeviceCommand)
Arrangements to be made in marshaling to duplicate values for compatibility purposes.

@tsconn23
Copy link
Member

Arrangements to be made in marshaling to duplicate values for compatibility purposes.

Just to unpack this a little bit for further clarity -- The ResourceOperation model needs to implement the Validator interface. Validation in this case will handle a check on each of the deprecated properties to see if they have a value. If not, validation should look to the new property and assign its value to the old property.

  • Object (old) --> DeviceResource (new)
  • Resource (old) --> DeviceCommand (new)

The reason for this is that we want to change the Device SDK to use the new properties exclusively. However the core services need to be backward compatible and in a given deployment may still be looking at the old properties. For example if a Fuji device service is calling an Edinburgh core service, the core service won't be aware of these new properties.

As described above, we'll mark the old properties as deprecated and then remove them in the Geneva release.

@cloudxxx8
Copy link
Member

I thought the new properties are higher priority, so the logic in validation should be:
check whether the new property exist, if true, assign the value to the old property, else, read the old property and assign the value to the new property. After validation, the old and new properties contain the same value in either case. Thus, it could work with the Device Services from edinburgh and fuiji.
The edinburgh Device Services use the old properties, and the fuiji ones use the new properties.

@tsconn23 and @iain-anderson , if you agree with the logic process, I could help open the PR in go-core-contract and device-sdk-go both.

tsconn23 pushed a commit that referenced this issue Aug 21, 2019
New fields:
DeviceCommand (json:"deviceCommand")
DeviceResource (json:"deviceResource")
"Object" to be marked as deprecated (replaced by DeviceResource)
"Resource" to be marked as deprecated (replaced by DeviceCommand)
Arrangements to be made in marshaling to duplicate values for compatibility purposes.
Implement Unmarshaler and Validator interface
Add unit test for all of them
fix #114

Signed-off-by: Cloud Tsai <cloudxxx8@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fuji help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants