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

WriteDeviceResource should not allow any datatype to be written to a String type field #1198

Open
ajcasagrande opened this issue Jul 21, 2022 · 2 comments
Labels
1-low priority denoting isolated changes bug Something isn't working

Comments

@ajcasagrande
Copy link
Contributor

ajcasagrande commented Jul 21, 2022

Feature request

Affected Services [REQUIRED]

device-sdk-go
device-onvif-camera

Is this a regression?

Not sure

Description and Minimal Reproduction [REQUIRED]

🔥 Exception or Error

Send a json object to a string value type:
image

See the value converted into a string containing the value type of map:
image

See where the problem is coming from. value is of map type, but v was created by fmt.Sprint(value).
image

thus causing validation to pass:
image





🌍 Your Environment

Deployment Environment:

EdgeX Version [REQUIRED]:

Anything else relevant?

@ajcasagrande ajcasagrande added the bug Something isn't working label Jul 21, 2022
@cloudxxx8 cloudxxx8 added question Further information is requested and removed bug Something isn't working labels Jul 22, 2022
@cloudxxx8
Copy link
Member

In this example, it looks like the resource value type is defined in String from the Device Profile, so the service treats it as a pure String field. If it's not string, users can define it as an object value type.
What is your expected behavior?
This can be an enhancement, not a but. Also, this could be validated in the Core Command service to make sure Device Service always receives right data type.

@cloudxxx8 cloudxxx8 added enhancement New feature or request and removed question Further information is requested labels Jul 22, 2022
@ajcasagrande
Copy link
Contributor Author

@cloudxxx8 correct, the resource value type is defined as String in the device profile. The expected behavior is to return a 400 error back to the user, as they passed in a json object.

@cloudxxx8 cloudxxx8 changed the title WriteDeviceResource allows any datatype to be written to a String type field WriteDeviceResource should not allow any datatype to be written to a String type field Jul 22, 2022
@iain-anderson iain-anderson added bug Something isn't working 1-low priority denoting isolated changes and removed enhancement New feature or request labels Aug 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1-low priority denoting isolated changes bug Something isn't working
Projects
Status: Icebox
Development

No branches or pull requests

3 participants