basyx-python-sdk icon indicating copy to clipboard operation
basyx-python-sdk copied to clipboard

adapter.json: Add opt-in deterministic JSON array order

Open thammel opened this issue 5 months ago • 0 comments

JSON arrays that originate from unordered Python sets (the top-level object lists and set-valued attributes like submodel and isCaseOf) are serialized in non-deterministic order, because set iteration order depends on hash randomization. This makes serialized output non-reproducible, which complicates diffing, caching, and snapshot testing.

A new opt-in sort_arrays option restores a stable, deterministic order without changing the default behavior.

Testing

  • Added tests in sdk/test/adapter/json/test_json_serialization.py covering deterministic ordering when sort_arrays is enabled.

Fixes #573

thammel avatar Jun 16 '26 10:06 thammel