basyx-python-sdk
basyx-python-sdk copied to clipboard
adapter.json: Add opt-in deterministic JSON array order
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.pycovering deterministic ordering whensort_arraysis enabled.
Fixes #573