server icon indicating copy to clipboard operation
server copied to clipboard

[Bug]: Cannot update non-string properties via REST API

Open iosb-ina-mr opened this issue 10 months ago • 5 comments

Contact Details

[email protected]

Describe the bug

Non-string properties of submodels cannot be updated via the following Patch call: /shells/{aasIdentifier}/submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/$value The value type of the affected property changes to string but the value does not change.

To reproduce

Create a submodel with any property that is not a string (double, int, etc..) and try to update it with the Swagger UI.

Screenshots

No response

Expected Behaviour

Any property should update if the passed value is of the same type. Otherwise, an error should be returned. Furthermore, the value type should not change.

Version

Commit: 2c90a7a

Operating System

Linux

Relevant log output

No response

iosb-ina-mr avatar Apr 11 '24 13:04 iosb-ina-mr

Will take over and look into this issue

Freezor avatar Apr 12 '24 06:04 Freezor

As far as I can see, we will always go to RequestValueMapper.cs:

private static IClass Transform(PropertyValue valueDTO)
{
    return new Property(DataTypeDefXsd.String, idShort: valueDTO.idShort, value: valueDTO.value);
}

Apparently, we use the Property class from the generated code, which seems to have only a string value. This might also be related to the issue mentioned in #236. However, I can't determine if this behavior is intended or expected. There are no unit tests to verify whether this is the desired behavior. Maybe @juileetikekar or @aorzelskiGH can provide insights or assistance here.

Freezor avatar Apr 15 '24 12:04 Freezor

@iosb-ina-mr as far as I can see it, the change itself runs trough correctly. What I do not understand yet is that I can change the name of the ID as well... But it currently looks like that the issue is not on the side of the change itself but starts much earlies when the AAS file is loaded

Freezor avatar Apr 16 '24 06:04 Freezor

@iosb-ina-mr as far as I can see it, the change itself runs trough correctly. What I do not understand yet is that I can change the name of the ID as well... But it currently looks like that the issue is not on the side of the change itself but starts much earlies when the AAS file is loaded

@Freezor thank you for sharing your findings. That is indeed a strange behavior because the AAS is correctly displayed in the Blazor UI after having been loaded.

iosb-ina-mr avatar Apr 16 '24 07:04 iosb-ina-mr