Reject empty asset link list in discovery `PostAllAssetLinksById`

オープン 初心者向け
#689 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 6 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
api, backend

調査の方向性

server/app/interfaces/discovery.py の post_all_asset_links_by_id から始め、POST /lookup/shells/{aasIdentifier} に関連するテストを見つけてください。空のリストが 400 を返し、既存のアセットリンクを変更しないことを示すテストを追加してください。この動作が成功するテストでカバーされたら、issue は完了です。

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
Python
スター
106
フォーク
67
平均マージ
3日 18時間
マージ済み PR(30日)
3

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

eclipse-basyx/basyx-python-sdk のほかの issue

eclipse-basyx/basyx-python-sdk の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。