eclipse-basyx / basyx-java-server-sdk

MIT License
55 stars 45 forks source link

[BUG] same Submodel Reference can be applied to same AAS again without throwing 409 (already exists) #373

Closed merlinseela closed 1 month ago

merlinseela commented 2 months ago

Describe the bug I am creating a new Submodel Reference using the POST /shells/{aasIdentifier}/submodel-refs endpoint and executing it multiple times, the submodel Reference gets added successfully (201 created) and if i execute again it returns again a 201.

From my perspective it does not make sense to "re-create" an already exisiting Reference. I would expect to get a 409 (already exisits) here.

To Reproduce

  1. Open Postman and create a new POST Request and enter {{aas_environment}}/shells/:aas_id_base64/submodel-refs
    • for aas_environment set the adress of the aas environment e.g. localhost:8081
    • for aas_id_base64 set a base-64 utf-8 encoded aas id
    • enter the request body and replace with a known submodel from your environment
{
     "type": "MODEL_REFERENCE",
     "keys": [
         {
             "value": "<<none_base_64_encoded_submodel_id_to_reference_to>>",
             "type": "Submodel"
         }
     ]
}
  1. Send the request. (This should come back with a 201 (Created) Response)
  2. Wait a bit.
  3. Send the request again.
  4. It should return again a 201.

Expected behavior By already existing Reference / trying to recreate the same reference it should throw a 409 (already exists.)

BaSyx:

Screenshots image image

Used Asset Administration files (.aasx/.json/.xml) I believe this error can be reproduced in any running aas environment with at least 1 submodel and 1 aas, even if the submodel is already referenced to the aas.

BaSyx configuration I do not think this is necessary if needed i will present it.

System (please complete the following information):

Additional context If there are any suggestions for this issue, especially how I presented the content of this issue, feel free to let know.

mdanish98 commented 2 months ago

Hi @merlinseela

Thanks for raising this issue. We will analyze this issue and get back to you soon.

If we need further information, I'll let you know.

aaronzi commented 1 month ago

I will close this issue since this is fixed in code. A new Snapshot release will follow soon including the fix.