eclipse-aaspe / server

C# based server for AASX packages
Other
72 stars 52 forks source link

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

Open iosb-ina-mr opened 7 months ago

iosb-ina-mr commented 7 months ago

Contact Details

marc.riedlinger@iosb-ina.fraunhofer.de

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

Freezor commented 7 months ago

Will take over and look into this issue

Freezor commented 7 months ago

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 commented 7 months ago

@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

iosb-ina-mr commented 7 months ago

@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 commented 2 months ago

@juileetikekar, are there any news on this issue (along with #236 and #237)? We need an API that works as expected.