Skip to content

Adjust discovery status codes to align with specification - #641

Open
JAB1305 wants to merge 3 commits into
eclipse-basyx:developfrom
rwth-iat:fix/discovery-status-codes
Open

JAB1305 wants to merge 3 commits into
eclipse-basyx:developfrom
rwth-iat:fix/discovery-status-codes

Conversation

@JAB1305

@JAB1305 JAB1305 commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Previous status code were not in agreement with the respective specification.

This change adjusts the HTTP status codes.

Fixes #625

@zrgt zrgt linked an issue Sep 24, 2026 that may be closed by this pull request
@s-heppner

Copy link
Copy Markdown
Member

This needs to be adapted when #627 is merged.

@zrgt zrgt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spec defines PostAllAssetLinksById as "Creates or replaces all asset links associated to the Asset Administration Shell" (spec). The endpoint currently merges the posted links into the existing ones, and test_post_is_additive asserts that, see #669.

Since this PR already aligns this endpoint with the spec, could it also replace the links instead of merging them, and flip test_post_is_additive?

@zrgt

zrgt commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Related to the requested change for #669: both handlers in this PR also maintain the reverse index (asset_id_to_aas_ids) themselves, via the private _add_aas_id_to_specific_asset_id() and a loop over the store's dict that leaves empty sets behind. Moving that into add_specific_asset_ids_to_aas() / delete_specific_asset_ids_by_aas_id() would make the replace logic a single place to change, see #669 (comment).

Previous status code were not in agreement with the respective specification.

This adjust HTTP status codes returned to align.
Previously, `post_all_asset_links_by_id` merged the posted asset links into any already stored for the AAS. The spec however defines `PostAllAssetLinksById` as "creates or replaces" all asset links associated, so the current behaviour is incorrect.

Additionally both handlers maintained the reverse index independently.

This change:
- Folds reverse-index into two central methods
- Remves the private helpers
- Implemets replace semantics in post_all_asset_links_by_id by calling delete, then add
- Flips the test previously covering the "wrong" behaviour
@JAB1305
JAB1305 force-pushed the fix/discovery-status-codes branch from 6519444 to b290942 Compare November 2, 2026 23:05
This updates `test_asset_links_roundtrip` to assert 201 and makes tearDown handle 404.
@JAB1305
JAB1305 requested a review from zrgt November 2, 2026 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

server: Discovery endpoints status code mismatch

3 participants