Element img: fields duplicated flat AND nested under value (unfinished normalization)
Problem
Every img-type element sends its fields twice in the same JSON message: once flattened directly on the element, once again nested under value.
Real example (simplified):
{
"type": "img",
"urljpeg": "Focus/frame.jpeg",
"snr": 42.3,
"value": {
"urljpeg": "Focus/frame.jpeg",
"snr": 42.3
}
}
Root cause
libs/utils/elementjsondumper.cpp, ElementJsonDumper::visit(ElementImg*, ...):
for (auto it = imgdata.constBegin(); it != imgdata.constEnd(); it++)
{
json.insert(it.key(), it.value()); // flat copy
}
json["value"] = imgdata; // + nested copy
Leftover from an attempt to normalize element structures ("value" systematically) that was never finished.
Impact
-
OstErix only reads the flat copy (
image-element.component.ts:el.urljpeg), neverel.value.urljpeg. - The site documentation (
structure.*.md) only describes the nested form undervalue. - Removing the duplication on the backend without checking all clients first would break image display in OstErix (and potentially other clients — to be audited).
Before fixing
- Audit all frontend clients (OstErix, ostnoctua, ostesp) to know which ones read the flat form vs. the nested one.
- Once impact is known, fix the backend to emit only the intended form (likely nested under
value, consistent with other element types). - Update any client relying on the old form before or alongside the backend change.