View Issue Details

IDProjectCategoryView StatusLast Update
000982410000-014: PubSubSpecpublic2024-09-26 14:01
ReporterMatthias Damm Assigned ToMatthias Damm  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version1.05.04 RC1 
Target Version1.05.04Fixed in Version1.05.04 
Summary0009824: Changes for different options of JSON encoding
Description

1.05.04 RC review comment from Peter Wehrfritz - Unified Automation

6.3.2.3.1

The RC states:

If this flag is set, the DataSetMessage fields are encoded in the
CompactEncoding JSON encoding. If the flag is not set, the DataSetMessage
fields are encoded in the VerboseEncoding.

If the ReversibleFieldEncoding flag is not set in the DataSetMessageContentMask,
the Variant at the top level of a field is encoded as a JSON value containing
only the value of the Body field. If this Variant contains an ExtensionObject,
the ExtensionObject shall be encoded as a JSON value containing only the value
of the Body field. This also applies to the Variant in a DataValue at the top
level of a field.

My proposal:

If this flag is set, the DataSetMessageContentMask, the DataSetMessage fields
are encoded in the CompactEncoding, otherwise the DataSetMessage fields are
encoded in the VerboseEncoding.

7.2.5.4

The RC states:

If the DataSetFieldContentMask is 0 or the RawData flag is set, the
DataSetMessage fields are encoded as Variant. Otherwise the fields are encoded
as DataValue. If the KeyFrameCount is 0, the DataSetFieldContentMask shall be 0.

If the ReversibleFieldEncoding flag is not set in the DataSetMessageContentMask,
the Variant at the top level of a field is encoded as a JSON value containing
only the value of the Body field. If this Variant contains an ExtensionObject,
the ExtensionObject shall be encoded as a JSON value containing only the value
of the Body field. This also applies to the Variant in a DataValue at the top
level of a field.

Proposal 1:

If the ReversibleFieldEncoding flag is set in the DataSetMessageContentMask,
the DataSetMessage fields are encoded in the CompactEncoding, otherwise the
DataSetMessage fields are encoded in the VerboseEncoding.

If the DataSetFieldContentMask is 0, the DataSetMessage fields are encoded as
Variant. If the KeyFrameCount is 0, the DataSetFieldContentMask shall be 0. If
one of the bits 0 to 4 is set, the fields are encoded as DataValue.
If the RawData flag is set, the DataSet fields are encoded as a JSON
structure fields. Analogous to the variant type, Enumeration values are encoded
as Int32. In the CompactEncoding, null or default field values shall not be
omitted.

The following restrictions apply to the RawData field encoding.

• DataSet fields shall not have an abstract DataType.
• DataSet fields shall not contain a subtype of the DataType.
• DataSet fields shall have a concrete valueRank with values -1 or n > 0.

Proposal 2:

If the ReversibleFieldEncoding flag is set in the DataSetMessageContentMask,
the DataSetMessage fields are encoded in the CompactEncoding, otherwise the
DataSetMessage fields are encoded in the VerboseEncoding.

If the DataSetFieldContentMask is 0, the DataSetMessage fields are encoded as
Variant. If the KeyFrameCount is 0, the DataSetFieldContentMask shall be 0. If
one of the bits 0 to 4 is set, the fields are encoded as DataValue.

If only the RawData flag is set, the DataSet fields are encoded as a JSON
structure fields. If the RawData flag is set and at least one of the bits 0 to 4,
the value is encoded as DataValue. The value field, however, shall contain
the DataSet field encoded as a JSON structure field directly with out the
variant envelop. Enumeration values are encoded as Int32.

In the CompactEncoding, null or default field values shall not be
omitted.

The following restrictions apply to the RawData field encoding.

• DataSet fields shall not have an abstract DataType.
• DataSet fields shall not contain a subtype of the DataType.
• DataSet fields shall have a concrete valueRank with values -1 or n > 0.

Rationale:

RawData in UADP omits the type information of the dataset field. This has the
consequence that the decoder expects always a value and not status code. There
already exist some special rules to handle those cases, i.e., fallback values,
message status etc. If we want to leave out the DataType in JSON encoding
as well, the same mechansim should be used. It is already defined and in
usage. That way you can use CompactEncoding without type information, or
you can use the VerboseEncoding with type information.

The formulation "encoded as a JSON structure fields" instead of
"JSON value containing only the value of the Body field" is intentionally used,
else a multi-dimensional array cannot be encoded, because its dimensions are not
part of the variant body.

The proposal 1 does not cover a DataValue without type information. To make this
possible it is neccessary to lower the general restriction that bit 0-4 of
the DataSetFieldContentMask should be ignored if the RawData flag is set
(see 6.2.4.2). The restriction should than only apply to the UADP encoding.
With that change proposal 2 would also support DataValues without type
information.

Additional Information

Examples:

DataSet

0 Field1 : StatusCode
1 Field2 : Array of Int32
2 Field3 : Matrix of Enumeration
3 Field4 : Structure { X,Y,C : Int16 }

Variant and CompactEncoding

"Payload":
{
"Field1":
{
"Type":19,
"Body":2151546880
},
"Field2":
{
"Type":6,
"Body":[0,4,5]
},
"Field3":
{
"Type":6,
"Body":[1,2,3,1,...],
"Dimensions": [2,4]
},
"Field4":
{
"Type":22,
"Body":
{
"TypeId":"nsu=...;i=23",
"Body":
{
"X":1,
"Y":2
}
}
}
}

Variant and VerboseEncoding

"Payload":
{
"Field1":
{
"Type":19,
"Body":
{
"Code":2151546880,
"Symbol":"BadNotFound"
}
},
"Field2":
{
"Type":6,
"Body":[0,4,5]
},
"Field3":
{
"Type":6,
"Body":[1,2,3,1,...],
"Dimensions": [2,4]
},
"Field4":
{
"Type":22,
"Body":
{
"TypeId":"nsu=...;i=23",
"Body":
{
"X":1,
"Y":2,
"Z":0
}
}
}
}

RawData and CompactEncoding

"Payload":
{
"Field1":2151546880,
"Field2":[0,4,5],
"Field3":
{
"Array":[1,2,3,1,...],
"Dimensions": [2,4]
},
"Field4":
{
"X":1,
"Y":2
}
}

RawData and VerboseEncoding

"Payload":
{
"Field1":
{
"Code":2151546880,
"Symbol":"BadNotFound"
},
"Field2":[0,4,5],
"Field3":
{
"Array":[1,2,3,1,...],
"Dimensions": [2,4]
},
"Field4":
{
"X":1,
"Y":2,
"Z":0
}
}

DataValue+RawData and CompactEncoding

"Payload":
{
"Field1":
{
"Value":2151546880,
"SourceTimestamp":"1990-01-02T00:00:00Z"
},
"Field2":
{
"Value":[0,4,5],
}
"Field3":
{
"Value":
{
"Array":[1,2,3,1,...],
"Dimensions": [2,4]
},
"ServerTimestamp":"1990-01-02T01:12:00Z"
},
"Field4":
{
"Value":
{
"X":1,
"Y":2
}
}
}

TagsNo tags attached.
Commit Version
Fix Due Date

Relationships

related to 0009729 closedMatthias Damm Need a Compact Encoding Bit in JsonDataSetMessageContentMask 

Activities

Matthias Damm

2024-09-22 14:00

developer   ~0021772

Reduce JsonDataSetMessageContentMask flags ReversibleFieldEncoding and OptimizedFieldEncoding to selection of the JSON encoding - no special handling for Variant/DataValue.

For JSON DataSetMessages (7.2.5.4 DataSetMessage):
Use RawData flag in DataSetFieldContentMask to encode Variant in a field or field DataValue as body only.

Add restrictions for RawData

Jim Luth

2024-09-26 14:01

administrator   ~0021819

Agreed to changes in F2F.

Issue History

Date Modified Username Field Change
2024-09-10 08:15 Matthias Damm New Issue
2024-09-10 08:15 Matthias Damm Status new => assigned
2024-09-10 08:15 Matthias Damm Assigned To => Matthias Damm
2024-09-22 12:25 Matthias Damm Relationship added related to 0009729
2024-09-22 14:00 Matthias Damm Status assigned => resolved
2024-09-22 14:00 Matthias Damm Resolution open => fixed
2024-09-22 14:00 Matthias Damm Fixed in Version => 1.05.04
2024-09-22 14:00 Matthias Damm Note Added: 0021772
2024-09-26 14:01 Jim Luth Status resolved => closed
2024-09-26 14:01 Jim Luth Note Added: 0021819