SoftwareAG / cumulocity-digital-twin-manager

The Digital Twin Manager enables you to create and manage assets around your physical connected devices in Cumulocity IoT.
Apache License 2.0
10 stars 4 forks source link

Bug: Create new asset using a complex property without values #40

Closed yhegen closed 5 months ago

yhegen commented 8 months ago

Description

I have defined an asset model "building". The asset has a complex asset property field "c8y_Position" (not required), including the properties lat (Number, no default value) and lng (Number, no default value).

When defining the asset property field, the UI shows the preview of the data model as follows:

{
  "c8y_Position": {
    "lng": "",
    "lat": ""
  }
}

Why are lat and lng defined as text string?

How to reproduce the bug

Once I start to create a new building asset without defining the property c8y_Position, I observed different behaviors:

  1. Leaving the input fields for c8y_Position untouched, the created asset object has the c8y_Position property defined as noticed above with an empty string as value.
  2. When I first enter a value in the input field, remove it again, click on the create button, then the c8y_Position property of the new asset looks like this:
    {
    "c8y_Position": {
    "lng": null,
    "lat": null
    }
    }

Expected behavior

Because the properties lat and lng are defined as type Number, I would expect to not try to cast those as string text field, when the field is empty. I would expect to define the values lat and lng as null. So from my perspective, the correct model should look like this:

{
  "c8y_Position": {
    "lng": null,
    "lat": null
  }
}
dchc01 commented 8 months ago

@yhegen Thank you for bringing up the concern regarding the representation of lat and lng as text strings in the preview of the data model when defining the asset property field. The initial discussion involves showing empty strings for all types if there is no default value. Now we have taken your feedback into consideration, and we are actively working on addressing this. The issue reported regarding the creation of a new building asset without defining the c8y_Position property has been addressed and resolved in the latest build 1019.0.0.202307260546-15290c5.

dchc01 commented 5 months ago

In the 1019.1.2 build, if a number-type value is empty, the data model preview in complex property shows null. Therefore, we are closing this issue.