Repository navigation
[#495] Remove the Text DataType - #660
Conversation
Text was never distinguishable from String. Both were defined as "String value (UTF-8)", both map to Protocol Buffers string, both ride in ValueArray's string_values, and nothing anywhere in the specification said what made one different from the other. Inductive Automation, whose tag types Sparkplug's are modelled on, deprecated Text in Ignition 8.1.8 and documents no difference between the two either. Ignition also has a String Array and no Text array, which is the same asymmetry eclipse-sparkplug#495 reported here. So this removes Text rather than defining it or adding the TextArray that would complete the set, since a second array type whose elements are indistinguishable from StringArray's would duplicate the ambiguity rather than resolve it. Sparkplug 4 is unreleased, so the type can go now at no cost to anyone. Enum value 14 is left unused, with a comment recording what it was. Renumbering the types above it would churn every implementation already tracking v4 drafts for no benefit. On the TCK side: Text is removed from the four vendored DataType model enums and from the switch arms that folded it in with String, the Basic Types upper bound in SendComplexDataTest becomes DateTime, and the utility Edge Node drops its Text metrics and the Texts column of its DataSet fixture. Nothing referenced those by name. The large-value use Text was informally put to is the subject of eclipse-sparkplug#444, which proposes a type for generic JSON.
Removing Text left 14 unused. Sparkplug 4 is unreleased and no implementation depends on these numbers yet, so the gap is closed rather than documented: every value above it moves down by one, and the enum runs 0 to 34 with nothing missing. UUID becomes 14, DataSet 15, Bytes 16, File 17, Template 18, PropertySet 19, PropertySetList 20, the array types 21 to 33, and Command 34. Shifted in both copies of the enum in the chapter, in the "Sparkplug enum value" line of every affected type's definition, and in the four vendored DataType model enums in the TCK, including the case labels that map an integer back to a type. Verified by executing the regenerated classes rather than by reading the diff: DateTime is still 13, UUID is 14, DataSet 15, Template 18, Int8Array 21, DateTimeArray 33, Command 34, nothing is declared at 35, and the TCK model enums agree with the schema. A cross-check of all 35 documented "Sparkplug enum value" lines against the enum finds no mismatch.
ckienle
left a comment
There was a problem hiding this comment.
Removing Text (074dca1): agreed. It was indistinguishable from String in its definition, its protobuf type and its array field, and Ignition deprecated it in 8.1.8. I checked:
- no
Textreference is left in the specification,tck/srcor the web console; - the chapter's JSON examples use type names, not numbers;
- the TCK generates
SparkplugBProtofrom the chapter itself, so it can't drift from it; - the
case 14mappings, the Basic Types bound inSendComplexDataTestand the utility Edge Node fixtures are all updated.
Renumbering (5ee309e): I'd drop this commit, as you offered. Until now v4's DataType values matched v3's (spBv1.0) exactly, with Command added at 35. An implementation that speaks both spBv1.0 and spPv4.0 (Tahu, and products that support both namespaces) can therefore share one enum. Shifting 14–34 means those values name different types in each namespace, so any code path that misses the translation silently reads a v3 Template (19) as a v4 PropertySet. Leaving the gap costs nothing.
If commit 2 goes, keep the retired value reserved. Add reserved 14; and reserved "Text"; to both copies of the enum, the usual protobuf way to retire a value, so nobody reuses 14 for something else.
I'll approve once the renumbering question is settled. The anchor note inline is minor.
| ** Google Protocol Buffer Type: string | ||
| ** Sparkplug enum value: 14 | ||
|
|
||
| [[payloads_p_datatype_additional]] |
There was a problem hiding this comment.
Removing the Text block also removed the blank line before this anchor, so Asciidoctor treats [[payloads_p_datatype_additional]] as part of the DateTime item's paragraph, and the id doesn't appear in the HTML. I built the HTML: develop has <div id="payloads_p_datatype_additional" class="ulist"> and this branch has no element with that id. Nothing in the spec links to it, but outside deep links would break. Restoring the blank line above it fixes it.
There was a problem hiding this comment.
Fixed in 53db58c. Good catch — and the kind that only shows up if you actually render the document.
Removing the Text block took the blank line that separated it from the anchor with it, so Asciidoctor read [[payloads_p_datatype_additional]] as part of the preceding DateTime paragraph. Confirmed the way you did, by building the HTML: the id is absent before the change and present after, alongside payloads_p_datatype_basic and payloads_p_datatype_array.
I also swept every chapter for an anchor with no blank line above it. One other turned up, in Sparkplug_8_HA.adoc:165, but it is inside a //// comment block and identical on develop, so it is inert and pre-existing.
Worth noting my own anchor check would never have caught this: it verifies that every link:# target resolves to an anchor in the source, which this one still did. The failure was in the rendering, which only a build of the HTML exposes.
ckienle
left a comment
There was a problem hiding this comment.
Approving, renumbering included. Wes and I talked it through, and closing the gap now, while v4 is unreleased, is fine. With it, reserved 14 isn't needed.
The anchor note at Payloads.adoc:1773 still applies: the missing blank line before [[payloads_p_datatype_additional]] drops that id from the HTML. It's minor; fix it here or later.
…Types anchor Removing the Text block took the blank line that separated it from [[payloads_p_datatype_additional]] with it, so Asciidoctor read the anchor as part of the preceding DateTime paragraph and the id did not appear in the rendered HTML at all. Nothing in the specification links to it, but a deep link from outside would have broken. Confirmed by building the HTML: the id is absent before this change and present after, alongside payloads_p_datatype_basic and payloads_p_datatype_array. A sweep of every chapter for an anchor with no blank line above it finds one other, inside a //// comment block in Sparkplug_8_HA.adoc, which is identical on develop and inert.
Addresses #495, by removing the type rather than completing the set.
Why not add TextArray
Textwas never distinguishable fromString. Both were defined as "String value (UTF-8)", both map to Protocol Buffersstring, both ride inValueArray'sstring_values, and nothing anywhere in the specification said what made one different from the other.Inductive Automation's tag data types, which Sparkplug's are modelled on, deprecated
Textin Ignition 8.1.8 and document no difference between the two either. Ignition also has aString Arrayand no Text array — the same asymmetry #495 reports here.So adding
TextArraywould create a second array type whose elements are indistinguishable fromStringArray's: it duplicates the ambiguity rather than resolving it. Sparkplug 4 is unreleased, so the type can go now at no cost to anyone, which is the same reasoning that retired the protobuf extension ranges in #643.The change
Text = 14removed from both copies of theDataTypeenum; its definition block removed;ValueArray'sstring_valuescomment is now// StringTextremoved fromDataSetDataType,PropertyDataType,ParameterDataType,MetricDataType, and from theircase 14:mappings, which now fall toUnknownTextin withStringare gone;SendComplexDataTest's Basic Types upper bound becomesDateTimeTextandMyTextmetrics and theTextscolumn of its DataSet. Nothing referenced those by nameSecond commit: closing the gap
Removing
Textleft 14 unused. Sparkplug 4 is unreleased and no implementation depends on these numbers yet, so the second commit closes the gap rather than documenting it: every value above 14 moves down by one and the enum runs 0–34 with nothing missing.UUIDbecomes 14,DataSet15,Bytes16,File17,Template18,PropertySet19,PropertySetList20, the array types 21–33, andCommand34.Shifted in both copies of the enum, in the "Sparkplug enum value" line of every affected type's definition, and in the TCK's vendored
DataTypemodel enums including the case labels that map an integer back to a type.DataSetDataTypeandParameterDataTypeare untouched because they only carry Basic Types, none of which moved.The two commits are separate so the removal can be reviewed on its merits and the renumbering judged on its own — if the working group would rather keep the numbers stable for implementations already tracking v4 drafts, the second commit can simply be dropped.
What this does not do
The large-value use
Textwas informally put to — JSON documents, XML, long logs — is the subject of #444, which proposes a type for generic JSON. That is the defined successor, and it is tracked separately.The other gaps #495 raised are unaffected:
UUIDhas no array type,Bytes/Filearrays would need a newrepeated bytesfield inValueArray, and arrays of templates are #450.Verification
Build successful, 10/10 unit tests pass. Broken-anchor (11) and tck-id-anomaly (7) baselines unchanged. JSON Schema valid draft 2020-12, 22/22 chapter examples validate.
DataTypevalues run 0–34 with no gaps, all 35 documented "Sparkplug enum value" lines agree with the enum, and the TCK model enums agree with the schema. Renumbering verified by executing the regenerated classes:DateTimestill 13,UUID14,DataSet15,Template18,Int8Array21,DateTimeArray33,Command34, nothing declared at 35. NoTextreference remains in the chapter or intck/src/main/java.git diff --checkclean.