eclipse-basyx / basyx-java-server-sdk

MIT License
59 stars 47 forks source link

[BUG] No 409 Conflict Returned On Posting Sub Model Reference Again (AAS REPO) #394

Closed geso02 closed 3 months ago

geso02 commented 3 months ago

Describe the bug

In this method, no 409 conflict is returned (or an exception thrown) when adding a submodel reference if the reference already exists. However, the OpenAPI description specifies this error code. When removing, only the first occurrence of the reference is removed. So if the reference is added multiple times, we should probably remove all references.

Based on the OpenAPI description, I would assume that multiple references are not intended to be allowed, as the status code 409 suggests that duplicate entries should not be permitted.

To Reproduce

Expected behavior

BaSyx (please complete the following information):

Screenshots

Used Asset Administration files (.aasx/.json/.xml)

Shell:

       {
                "modelType": "AssetAdministrationShell",
                "assetInformation": {
                    "assetKind": "Instance",
                    "globalAssetId": "https://acplt.org/Test_Asset"
                },
                "submodels": [
                    {
                        "keys": [
                            {
                                "type": "Submodel",
                                "value": "http://acplt.org/Submodels/Assets/TestAsset/BillOfMaterial"
                            }
                        ],
                        "type": "ExternalReference"
                    }
                ],
                "id": "https://acplt.org/Test_AssetAdministrationShell",
                "idShort": "TestAssetAdministrationShell"
            }

Additional submodel reference (already existing):

                 {
                        "keys": [
                            {
                                "type": "Submodel",
                                "value": "http://acplt.org/Submodels/Assets/TestAsset/BillOfMaterial"
                            }
                        ],
                        "type": "ExternalReference"
                    }

System (please complete the following information):

aaronzi commented 3 months ago

Hi @geso02, thank you for reporting this. Same Bug was already found in #373 and get's fixed with #388.