fix(adminui): the MQTT tag editor writes a meaningless payloadFormat into a Sparkplug tag blob
#513
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
MqttTagConfigEditorwrites apayloadFormatkey into the tag'sTagConfigJSON even when the tag is inSparkplugB mode, where the key has no meaning —
payloadFormat(Json/Raw/Scalar) is a Plain-modeconcept.
Cosmetic only, and confirmed so. The tag factory routes Sparkplug tags on the Sparkplug keys
(
groupId/edgeNodeId/deviceId/metricName) and ignorespayloadFormatentirely, so nothing ismis-bound — the value is noise in the stored blob, not a behaviour.
Why fix it anyway. The blob is operator-visible (it is what the raw-JSON textarea shows and what a config
export contains), and a key that looks like it selects a decode path but does not is a trap for the next
person reading a Sparkplug tag's config — including anyone diagnosing a decode problem.
Fix. Have the editor's
ToJsonomitpayloadFormatwhen mode is SparkplugB. Keep thepreserve-unknown-keys behaviour intact (the editors deliberately round-trip keys they do not own — do not let
this change start dropping foreign keys).
Acceptance. A Sparkplug tag authored through the editor round-trips without a
payloadFormatkey; a Plaintag still carries it; unknown keys are still preserved on both paths.