Reject empty asset link list in discovery `PostAllAssetLinksById`

Aperta Adatta ai principianti
#689 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 6 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
api, backend

Direzione di ricerca

Inizia con post_all_asset_links_by_id in server/app/interfaces/discovery.py e trova i test correlati a POST /lookup/shells/{aasIdentifier}. Aggiungi una verifica che dimostri che una lista vuota restituisce 400 e lascia invariati i collegamenti agli asset esistenti. L’issue è completata quando questo comportamento è coperto da un test superato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
Python
Stelle
106
Fork
67
Merge medio
3g 18h
PR unite (30g)
3

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di eclipse-basyx/basyx-python-sdk

Tutte le issue di eclipse-basyx/basyx-python-sdk

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.