Skip to content

Commit ffd65d2

Browse files
committed
Better distinction between encoding type and field #35 #31 #44
1 parent 6212b72 commit ffd65d2

File tree

4 files changed

+122
-160
lines changed

4 files changed

+122
-160
lines changed

v2-0-RC1/doc/02FieldEncoding.md

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,17 @@ and message schema but are introduced here as an overview.
1111

1212
### Semantic data type
1313

14-
The FIX semantic data type of a field tells a data domain in a broad
15-
sense, for example, whether it is numeric or character data, or whether
16-
it represents a time or price. Simple Binary Encoding represents all of
14+
The FIX semantic data type of a field tells a data domain interpreted at the application layer, for example, whether it is numeric or character data, or whether it represents a time or price. Simple Binary Encoding represents all of
1715
the semantic data types that FIX protocol has defined across all
1816
encodings. In message specifications, FIX data type is declared with
1917
attribute semanticType. See the section 2.2 below for a listing of those
2018
FIX types.
2119

2220
### Encoding
2321

24-
Encoding tells how a field of a specific data type is encoded on the
25-
wire. An encoding maps a FIX data type to either a simple, primitive
22+
Encoding tells how a data element is encoded on the wire. Encoding belongs strictly to the presentation layer. It is context-free and carries no business semantics.
23+
24+
An encoding maps a FIX data type to either a simple, primitive
2625
data type, such as a 32 bit signed integer, or to a composite type. A
2726
composite type is composed of two or more simple primitive types. For
2827
example, the FIX data type Price is encoded as a decimal, a composite
@@ -142,17 +141,10 @@ Attributes are optional unless specified otherwise.
142141
| maxValue | The highest valid value of a range (inclusive unless specified otherwise). Applies to scalar data types, but not to String or data types. |
143142
| semanticType | Tells the FIX semantic type of a field or encoding. It may be specified on either a field or its encoding. |
144143

145-
### Inherited attributes
146-
147-
The attributes listed above apply to a field element or its encoding
148-
(wire format). Any attributes specified on an encoding are inherited by
149-
fields that use that encoding.
150-
151144
### Non-FIX types
152145

153146
Encodings may be added to SBE messages that do not correspond to listed
154-
FIX data types. In that case, the encoding and fields that use the
155-
encoding will not have a semanticType attribute.
147+
FIX data types. In that case, the fields that use the encoding will not have a semanticType attribute.
156148

157149
Integer encoding
158150
-------------------------------------------------------------------------------------------------------------------------------------------------------------

v2-0-RC1/doc/04MessageSchema.md

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
XML schema for SBE message schemas
55
---------
6-
See [SimpleBinary1-0.xsd](../resources/SimpleBinary1-0.xsd) for the normative XML Schema Definition (XSD) for SBE.
6+
See [sbe.xsd](../resources/sbe.xsd) for the normative XML Schema Definition (XSD) for SBE.
77

88

99
XML namespace
@@ -12,7 +12,7 @@ XML namespace
1212
The Simple Binary Encoding XML schema is identified by this URL:
1313

1414
```xml
15-
xmlns:sbe=http://fixprotocol.io/sbe/rc4
15+
xmlns:sbe=http://fixprotocol.io/2017/sbe
1616
```
1717

1818
Conventionally, the URI of the XML schema is aliased by the prefix
@@ -139,33 +139,20 @@ The element value represents a constant if attribute
139139
|--------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------|-----------------------------------|----------------------------------------------------------------------------------------|
140140
| name | Name of encoding | symbolicName\_t | required | Must be unique among all encoding types in a schema. |
141141
| description | Documentation of the type | string | optional | |
142-
| presence | Presence of any field encoded with this type | token | | required optional constant |
143-
| nullValue | Override of special value used to indicate null for an optional field | string | Only valid if presence = optional | The XML string must be convertible to the scalar data type specified by primitiveType. |
144-
| minValue | Lowest acceptable value | string | | |
145-
| maxValue | Highest acceptable value | string | | |
142+
| presence | Presence of this element within a composite type | token | | required optional constant |
146143
| length | Number of elements of the primitive data type | nonnegativeInteger | default = 1 | Value “0” represents variable length. |
147144
| offset | If a member of a composite type, tells the offset from the beginning of the composite. By default, the offset is the sum of preceding element sizes, but it may be increased to effect byte alignment. | unsignedInt | optional | See section 4.4.4.3 below |
148145
| primitiveType | The primitive data type that backs the encoding | token | required | char int8 int16 int32 int64 uint8 uint16 uint32 uint64 float double |
149146
| semanticType | Represents a FIX data type | token | optional | Same as field semanticType – see below. |
150147
| sinceVersion | Documents the version of a schema in which a type was added | nonnegativeInteger | default = 0 | Must be less than or equal to the version of the message schema. |
151148
| deprecated | Documents the version of a schema in which a type was deprecated. It should no longer be used in new messages. | nonnegativeInteger | optional | Must be less than or equal to the version of the message schema. |
152149

153-
#### FIX data type specification
154-
155-
The attribute `semanticType` must be specified on either a field or on its
156-
corresponding type encoding. It need not be specified in both places,
157-
but if it is, the two values must match.
158150

159151
Simple type examples
160152

161153
```xml
162-
<type name="FLOAT" primitiveType="double"
163-
semanticType="float"/>
164-
<type name="TIMESTAMP" primitiveType="uint64"
165-
semanticType="UTCTimestamp"/>
166-
<type name="GeneralIdentifier" primitiveType="char"
167-
description="Identifies class or source
168-
of the PartyID" presence="constant">C</type>
154+
<type name="FLOAT" primitiveType="double"/>
155+
<type name="idString" length="8" primitiveType="char"/>
169156
```
170157

171158
### Composite encodings
@@ -179,7 +166,6 @@ Composite encoding types are composed of two or more simple types.
179166
| name | Name of encoding | symbolicName\_t | required | Must be unique among all encoding types. |
180167
| offset | The offset from the beginning of the composite. By default, the offset is the sum of preceding element sizes, but it may be increased to effect byte alignment. | unsignedInt | optional | |
181168
| description | Documentation of the type | string | optional | |
182-
| semanticType | Represents a FIX data type | token | optional | Same as field semanticType – see below. |
183169
| sinceVersion | Documents the version of a schema in which a type was added | nonnegativeInteger | default = 0 | Must be less than or equal to the version of the message schema. |
184170
| deprecated | Documents the version of a schema in which a type was deprecated. It should no longer be used in new messages. | nonnegativeInteger | optional | Must be less than or equal to the version of the message schema. |
185171

@@ -197,7 +183,7 @@ In this example, a Price is encoded as 32 bit integer mantissa and a
197183
constant exponent, which is not sent on the wire.
198184

199185
```xml
200-
<composite name="decimal32" semanticType="Price">
186+
<composite name="decimal32">
201187
<type name="mantissa" primitiveType="int32" />
202188
<type name="exponent" primitiveType="int8"
203189
presence="constant">-4</type>
@@ -242,7 +228,7 @@ A composite type often has its elements defined in-line within the `<composite>`
242228
In this example, a futuresPrice is encoded as 64 bit integer mantissa, 8 bit exponent, and a reused enum type.
243229

244230
```xml
245-
<enum name="booleanEnum" encodingType="uint8" semanticType="Boolean">
231+
<enum name="booleanEnum" encodingType="uint8">
246232
<validValue name="false">0</validValue>
247233
<validValue name="true">1</validValue>
248234
</enum>
@@ -266,7 +252,7 @@ In this example, a nested composite is formed by using a reference to another co
266252

267253
<composite name="money">
268254
<type name="currencyCode" primitiveType="char" length="3" semanticType="Currency" />
269-
<ref name="amount" type="price" semanticType="Price" offset="3" />
255+
<ref name="amount" type="price" offset="3" />
270256
</composite>
271257
```
272258

@@ -467,7 +453,7 @@ Example field schemas
467453
Field that uses a composite encoding
468454

469455
```xml
470-
<composite name="intQty32" semanticType="Qty">
456+
<composite name="intQty32">
471457
<type name="mantissa" primitiveType="int32" />
472458
<type name="exponent" primitiveType="int8"
473459
presence="constant">0\</type>

0 commit comments

Comments
 (0)