eclipse-aaspe / server

C# based server for AASX packages
Other
69 stars 51 forks source link

[Bug]: POST `shell-descriptors` returns HTTP 201 on duplicates instead of 409 #351

Open arnoweiss opened 1 week ago

arnoweiss commented 1 week ago

Contact Details

No response

Describe the bug

When adding a Shell-Descriptor to the AssetAdministrationShellRegistry API's shell-descriptors endpoint, that should raise a conflict. That's currently not the case, the shell-descriptor is overwritten.

To reproduce

  1. POST /shell-descriptors with payload

    {
    "assetKind": "NotApplicable",
    "endpoints": [
        {
            "interface": "AAS-1.0",
            "protocolInformation": {
                        "href": "https://myorg.com/aas"
            }
        }
    ],
    "globalAssetId": "https://myorg.org/demo/something",
    "idShort": "unpatched",
    "id": "https://myorg.org/demo/something/aasid",
    "specificAssetIds": [
        {
            "name": "assetKind",
            "value": "Instance",
            "externalSubjectId": {
                "type": "ExternalReference",
                "keys": [
                    {
                        "type": "GlobalReference",
                        "value": "assetKind"
                    }
                ]
            }
        }
    ],
    "submodelDescriptors": [
        {
            "endpoints": [
                {
                    "interface": "SUBMODEL-1.0",
                    "protocolInformation": {
                        "href": "https://myorg.org/submodels/submodel3"
                    }
                }
            ],
            "idShort": "ProductCarbonFootprint",
            "id": "https://myorg.org/demo/somesubmodelid",
            "semanticId": {
                "type": "ExternalReference",
                "keys": [
                    {
                        "type": "GlobalReference",
                        "value": "https://zvei.org/demo/ProductCarbonFootprint/1/0"
                    }
                ]
            }
        },
        {
            "endpoints": [
                {
                    "interface": "SUBMODEL-1.0",
                    "protocolInformation": {
                        "href": "https://myorg.org/demo/submodel123"
                    }
                }
            ],
            "idShort": "BillOfMaterial",
            "id": "https://myorg.com/demo/submodelbom",
            "semanticId": {
                "type": "ExternalReference",
                "keys": [
                    {
                        "type": "GlobalReference",
                        "value": "http://example.com/id/type/submodel/BOM/1/1"
                    }
                ]
            }
        },
        {
            "endpoints": [
                {
                    "interface": "SUBMODEL-1.0",
                    "protocolInformation": {
                        "href": "https://myorg.com/demo/submodelbom/submodel"
                    }
                }
            ],
            "idShort": "Nameplate",
            "id": "https://myorg.com/demo/submodelnp",
            "semanticId": {
                "type": "ExternalReference",
                "keys": [
                    {
                        "type": "GlobalReference",
                        "value": "https://admin-shell.io/zvei/nameplate/1/0/Nameplate"
                    }
                ]
            }
        },
        {
            "endpoints": [
                {
                    "interface": "VC-1.0",
                    "protocolInformation": {
                        "href": "https://myorg.com/demo/submodelnp/submodel"
                    }
                }
            ],
            "idShort": "NameplateVC",
            "id": "https://myorg.com/demo/submodelnpvc",
            "semanticId": {
                "type": "ExternalReference",
                "keys": [
                    {
                        "type": "GlobalReference",
                        "value": "https://myorg.com/demo/submodelnpvc/submodel"
                    }
                ]
            }
        },
        {
            "endpoints": [
                {
                    "interface": "SUBMODEL-1.0",
                    "protocolInformation": {
                        "href": "https://myorg.com/demo/submodeltseries/submodel"
                    }
                }
            ],
            "idShort": "TechnicalData",
            "id": "https://myorg.com/demo/submodeltseries",
            "semanticId": {
                "type": "ExternalReference",
                "keys": [
                    {
                        "type": "GlobalReference",
                        "value": "http://admin-shell.io/ZVEI/TechnicalData/Submodel/1/1"
                    }
                ]
            }
        },
        {
            "endpoints": [
                {
                    "interface": "SUBMODEL-1.0",
                    "protocolInformation": {
                        "href": "https://myorg.com/submodel"
                    }
                }
            ],
            "idShort": "TimeSeries",
            "id": "https://zvei.org/demo/sm/0393_4150_3042_5412"
        }
    ]
    }
  2. Execute the exact same request but replace the idShort with "idShort": "overwritten".

Screenshots

![DESCRIPTION](LINK.png)

Expected Behaviour

I'm expecting a conflict here but I simply get the permission to overwrite the data that's already there. 409 Conflict is the specified behavior in the normative openapi files [1].

[1] https://app.swaggerhub.com/apis/Plattform_i40/AssetAdministrationShellRegistryServiceSpecification/V3.0_SSP-001#/Asset%20Administration%20Shell%20Registry%20API/PostAssetAdministrationShellDescriptor

Version

No response

Operating System

No response

Relevant log output

No response

arnoweiss commented 1 week ago

The AAS repository API behaves correctly here.