Summary
Under the JSON-CPPAGENT-MQTT document format, the MTConnectStreams.Header object does not include a schemaVersion property, even though cppagent's JSON v2 printer emits schemaVersion inside the Header (in addition to at the top level). Consumers reading MTConnectStreams.Header.schemaVersion directly — as the cppagent reference output permits — get undefined from MT.NET payloads.
Environment
MTConnect.NET-Applications-Agents + MTConnect.NET-JSON-cppagent at v6.9.0 (official Docker image trakhound/mtconnect.net-agent:6.9.0, published 2025-10-16 — binary-equivalent to the v6.9.0.2 release as of 2026-04-20).
- Broker:
eclipse-mosquitto:2.0.22.
- Comparison agent:
mtconnect/agent:latest = cppagent v2.7.0.7 (2026-04-09) with JsonVersion = 2, SchemaVersion = 2.7.
- Format ID:
JSON-CPPAGENT-MQTT.
Reproduction
Minimum rig (mqtt-relay module with documentFormat: JSON-CPPAGENT-MQTT pointed at a local Mosquitto; any device model will do):
# applications/MTConnect-Agent/appsettings.yaml (MT.NET side)
modules:
- mqtt-relay:
server: localhost
port: 1883
documentFormat: JSON-CPPAGENT-MQTT
topicPrefix: MTConnect/Document
topicStructure: Document
Run the agent, subscribe to the Current topic, and inspect the Header's keys:
mosquitto_sub -h localhost -t 'MTConnect/Document/Current/<uuid>' -C 1 \
| jq '.MTConnectStreams.Header | keys'
Observed — MT.NET Current Header keys
["instanceId", "version", "sender", "bufferSize",
"firstSequence", "lastSequence", "nextSequence",
"deviceModelChangeTime", "creationTime"]
No schemaVersion key. No testIndicator key (that divergence is the companion issue #131).
Expected — cppagent v2 Current Header keys
Run an identical rig on mtconnect/agent:latest (cppagent) with JsonVersion = 2, Sinks { MqttService { MqttHost = localhost } }, and subscribe to the matching MTConnect/Current/<uuid> topic:
["version", "creationTime", "testIndicator", "instanceId", "sender",
"schemaVersion", "deviceModelChangeTime", "bufferSize",
"nextSequence", "lastSequence", "firstSequence"]
cppagent's Header carries schemaVersion: "2.7" alongside the other agent-provenance fields. MT.NET omits it — schemaVersion lives only at MTConnectStreams.schemaVersion (top-level, sibling of Header) and is further hardcoded to "2.0" (see the companion issue #128).
Evidence files: current.json (MT.NET) + cppagent-current.json (cppagent).
Authority
JSON is not part of the MTConnect normative standard. The authority here is the cppagent JSON v2 printer's output, which JSON-CPPAGENT-MQTT is named to promise compatibility with. cppagent's test_package/json_printer_stream_test.cpp exercises the Header under v2 and the live output includes schemaVersion inside it. See also the XMI / prose standard's treatment of schemaVersion as an envelope-level MTConnect-release declaration — which cppagent surfaces in both the Header and the top-level slot for consumer convenience.
Root cause — library source
libraries/MTConnect.NET-JSON-cppagent/Streams/JsonStreamsHeader.cs does not declare a SchemaVersion property. The Header-equivalent class never carries the field; only the wrapper (JsonMTConnectStreams) does — and even there it's hardcoded (see issue #128).
Impact
Suggested fix
- Add
SchemaVersion as a JSON-serialised property on JsonStreamsHeader (and JsonDevicesHeader, and JsonAssetsHeader) so the Header carries the agent's MTConnect release inside it, matching cppagent's JSON v2 shape.
- Populate from the same
DefaultVersion pathway that draft 02 recommends threading through JsonMTConnectStreams. A single shared accessor is cleanest.
Stability across MTConnect versions
Unchanged — the cppagent JSON v2 convention to emit schemaVersion inside Header has been stable across cppagent's v2 JSON lineage and is not tied to any particular MTConnect release. Fixing it here is a single-location code change that works across v2.x and the forthcoming v2.6 / v2.7 uplift.
Related issues
References
Summary
Under the
JSON-CPPAGENT-MQTTdocument format, theMTConnectStreams.Headerobject does not include aschemaVersionproperty, even though cppagent's JSON v2 printer emitsschemaVersioninside the Header (in addition to at the top level). Consumers readingMTConnectStreams.Header.schemaVersiondirectly — as the cppagent reference output permits — getundefinedfrom MT.NET payloads.Environment
MTConnect.NET-Applications-Agents+MTConnect.NET-JSON-cppagentat v6.9.0 (official Docker imagetrakhound/mtconnect.net-agent:6.9.0, published 2025-10-16 — binary-equivalent to the v6.9.0.2 release as of 2026-04-20).eclipse-mosquitto:2.0.22.mtconnect/agent:latest= cppagent v2.7.0.7 (2026-04-09) withJsonVersion = 2,SchemaVersion = 2.7.JSON-CPPAGENT-MQTT.Reproduction
Minimum rig (
mqtt-relaymodule withdocumentFormat: JSON-CPPAGENT-MQTTpointed at a local Mosquitto; any device model will do):Run the agent, subscribe to the Current topic, and inspect the Header's keys:
Observed — MT.NET Current Header keys
No
schemaVersionkey. NotestIndicatorkey (that divergence is the companion issue #131).Expected — cppagent v2 Current Header keys
Run an identical rig on
mtconnect/agent:latest(cppagent) withJsonVersion = 2,Sinks { MqttService { MqttHost = localhost } }, and subscribe to the matchingMTConnect/Current/<uuid>topic:cppagent's Header carries
schemaVersion: "2.7"alongside the other agent-provenance fields. MT.NET omits it —schemaVersionlives only atMTConnectStreams.schemaVersion(top-level, sibling of Header) and is further hardcoded to"2.0"(see the companion issue #128).Evidence files:
current.json(MT.NET) +cppagent-current.json(cppagent).Authority
JSON is not part of the MTConnect normative standard. The authority here is the cppagent JSON v2 printer's output, which
JSON-CPPAGENT-MQTTis named to promise compatibility with. cppagent'stest_package/json_printer_stream_test.cppexercises the Header under v2 and the live output includesschemaVersioninside it. See also the XMI / prose standard's treatment ofschemaVersionas an envelope-level MTConnect-release declaration — which cppagent surfaces in both the Header and the top-level slot for consumer convenience.Root cause — library source
libraries/MTConnect.NET-JSON-cppagent/Streams/JsonStreamsHeader.csdoes not declare aSchemaVersionproperty. The Header-equivalent class never carries the field; only the wrapper (JsonMTConnectStreams) does — and even there it's hardcoded (see issue #128).Impact
MTConnectStreams.Header.schemaVersion(a natural path, sinceHeader.versionexists as a sibling) getundefinedfrom MT.NET.MTConnectStreams.schemaVersion/MTConnectDevices.schemaVersionhardcoded to"2.0"inJSON-cppagent-mqttformatter #128's hardcoded"2.0"at top-level, there is no way for a consumer to learn the agent's true MTConnect release from the MT.NET JSON envelope.01and02to make version-identification entirely broken.Suggested fix
SchemaVersionas a JSON-serialised property onJsonStreamsHeader(andJsonDevicesHeader, andJsonAssetsHeader) so the Header carries the agent's MTConnect release inside it, matching cppagent's JSON v2 shape.DefaultVersionpathway that draft02recommends threading throughJsonMTConnectStreams. A single shared accessor is cleanest.Stability across MTConnect versions
Unchanged — the cppagent JSON v2 convention to emit
schemaVersioninside Header has been stable across cppagent's v2 JSON lineage and is not tied to any particular MTConnect release. Fixing it here is a single-location code change that works across v2.x and the forthcoming v2.6 / v2.7 uplift.Related issues
MTConnectStreams.schemaVersion/MTConnectDevices.schemaVersionhardcoded to"2.0"inJSON-cppagent-mqttformatter #128 —MTConnectStreams.schemaVersion/MTConnectDevices.schemaVersionhardcoded to"2.0"— same root (no threading ofDefaultVersion); fix should land in one PR.Header.versionreports library assembly version instead of MTConnect release #127 —Header.versionreports library assembly version — adjacent Header defect.JSON-cppagent-mqtt:Header.testIndicatorabsent on MQTT Streams Header #131 —Header.testIndicatorabsent — another missing Header attribute cppagent emits.References
libraries/MTConnect.NET-JSON-cppagent/Streams/JsonStreamsHeader.cstest_package/json_printer_stream_test.cppcurrent.json+cppagent-current.json