Skip to content

Reject empty asset link list in discovery PostAllAssetLinksById #689

Open

Description

@s-heppner

Currently, POST /lookup/shells/{aasIdentifier} accepts an empty list [] as request body. post_all_asset_links_by_id then deletes the
existing links and add_specific_asset_ids_to_aas() stores an empty set for the AAS:

https://github.com/eclipse-basyx/basyx-python-sdk/blob/63d48b66/server/app/interfaces/discovery.py#L46-L49

This leads to an inconsistent state:

The specification defines the input parameter assetLinks of PostAllAssetLinksById as mandatory with cardinality 1..*, see
IDTA-01002 v3.1.1, Operation PostAllAssetLinksById. Note that the OpenAPI file (V3.1_SSP-001.yaml) does not enforce this with minItems: 1, so a schema validator would not catch it.

The server should respond with 400 (ClientErrorBadRequest) to an empty list, without changing the stored asset links. A test should
cover this case.

Found during review of #641

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglearn-basyx-pythonserverSomething to do with the `server` package

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions