Skip to content

Implement path serialization - #649

Open
JAB1305 wants to merge 4 commits into
eclipse-basyx:developfrom
rwth-iat:improve/implement-path-serialization
Open

JAB1305 wants to merge 4 commits into
eclipse-basyx:developfrom
rwth-iat:improve/implement-path-serialization

Conversation

@JAB1305

@JAB1305 JAB1305 commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Previously the $path serialization modifier was not supported.

This introduces a central helper to collect / generate idShortPath lists, allowing either deep or only direct children (following level query param). It also introduces support for the endpoints reported in #643.

Fixes #643.

Additionally restrict to JSON only (followin spec) and add level query paramter
Comment thread server/app/interfaces/base.py Outdated
@hpoeche

hpoeche commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Good job, the implementation seems correct to me. I'd like to throw in two ideas, that would generalize this a bit:

  1. We could wrap this implementation of server/app/adapter/path_serialization.py into a subclass of the Python json.JSONEncoder. This would remove depending on the ResultToJsonEncoder to encode the created list[str] structure correctly.
    Additionally, it allows us to handle serialization of a list of objects directly in this class, instead of aggregating lists afterwards (e.g. for get_submodel_submodel_elements_path()).
    We can move down the choice of the encoder into the JsonResponse class, similar to StrippedResultToJsonEncoder, and thereby separate data fetching from encoding.
    Finally, this allows us to drop the _assert_path_supported() and assert_json_response() methods.
  2. This newly extracted Encoder class could be moved to the sdk package to allow users to use it. This naturally follows our separation of the spec parts, because the Path-Serialization is defined in Part 1: Metamodel, which is implemented in the sdk package.

Feel free to reach out, if I left anything unclear or you would like to discuss this further.

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.

2 participants