Skip to content

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), never el.value.urljpeg.
  • The site documentation (structure.*.md) only describes the nested form under value.
  • 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

  1. Audit all frontend clients (OstErix, ostnoctua, ostesp) to know which ones read the flat form vs. the nested one.
  2. Once impact is known, fix the backend to emit only the intended form (likely nested under value, consistent with other element types).
  3. Update any client relying on the old form before or alongside the backend change.