Reject empty asset link list in discovery `PostAllAssetLinksById`

Offen Anfängerfreundlich
#689 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 6 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
82/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
python
Bereich
api, backend

Rechercherichtung

Beginne mit post_all_asset_links_by_id in server/app/interfaces/discovery.py und finde die zugehörigen Tests für POST /lookup/shells/{aasIdentifier}. Ergänze Tests, die zeigen, dass eine leere Liste 400 zurückgibt und vorhandene Asset-Links unverändert lässt. Das Issue ist erledigt, wenn dieses Verhalten durch einen bestandenen Test abgedeckt ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

bug learn-basyx-python server

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:

  • A following DELETE /lookup/shells/{aasIdentifier} returns 204, although no asset links exist for the AAS. #625 / #641 changed this
    case to return 404.
  • DiscoveryStore.to_file() persists the empty entry.

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

Vorherrschende Sprache
Python
Sterne
106
Forks
67
Ø Merge
3 T. 18 Std.
Gemergte PRs (30 T.)
3

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus eclipse-basyx/basyx-python-sdk

Alle Issues in eclipse-basyx/basyx-python-sdk

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.