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

Fix field mask extraction in device create/update operations #706

Closed
kschiffer opened this issue May 17, 2019 · 0 comments · Fixed by #707
Closed

Fix field mask extraction in device create/update operations #706

kschiffer opened this issue May 17, 2019 · 0 comments · Fixed by #707
Assignees
Labels
c/sdk/js This is related to the JavaScript SDK
Milestone

Comments

@kschiffer
Copy link
Contributor

kschiffer commented May 17, 2019

Summary

The SDK automatically extracts the field masks of a device patch in Set operations. However, the extraction is in its current state simply extracting all possible leaf-paths of a patch without verifying whether they can be used as a valid field mask.
When e.g. trying to patch the locations property of a device, this leads to problems as the SDK tries to set field masks like locations.user.latitude, which is invalid because the location property can only be set as a whole.

Steps to Reproduce

  1. Try to set e.g. the locations property of a device
  2. Retrieve an error for using invalid field masks

What do you see now?

Not possible to set some properties of a device.

What do you want to see instead?

Correct field mask extraction and no errors.

Environment

SDK in node js or browser.

How do you propose to implement this?

The SDK needs to apply only the deepest possible field mask by checking back with the device entity map (sdk/js/generatesd/device-entity-map.json)

Additionally, this will necessitate an update to the device entity map which is set up quite roughly only at the moment.

Can you do this yourself and submit a Pull Request?

Yes.

@kschiffer kschiffer added the c/sdk/js This is related to the JavaScript SDK label May 17, 2019
@kschiffer kschiffer added this to the May 2019 milestone May 17, 2019
@kschiffer kschiffer self-assigned this May 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/sdk/js This is related to the JavaScript SDK
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant