Skip to content

Commit 571cd2f

Browse files
authored
Merge pull request #57 from donmendelson/v2-0-issue39
V2 0 issues 31 and 39
2 parents 6d2cb65 + 140f5bd commit 571cd2f

File tree

3 files changed

+109
-88
lines changed

3 files changed

+109
-88
lines changed

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ A simple encoding is backed by either a scalar type or an array of
122122
scalars, such as a character array. One or more simple encodings may be
123123
defined, each specified by a `<type>` element.
124124

125+
The `<type>` XML element is also used for a scalar or array member of a composite encoding; see below.
126+
125127
#### `<type>` element content
126128

127129
If the element has a value, it is used to indicate a special value of
@@ -130,7 +132,7 @@ the encoding.
130132
##### Constant value
131133

132134
The element value represents a constant if attribute
133-
`presence="constant"`. In this case, the value is conditionally required.
135+
`presence="constant"`. In this case, the value is required.
134136

135137
#### `<type>` attributes
136138

@@ -143,8 +145,8 @@ The element value represents a constant if attribute
143145
| length | Number of elements of the primitive data type | nonnegativeInteger | default = 1 | Value “0” represents variable length. |
144146
| 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 |
145147
| primitiveType | The primitive data type that backs the encoding | token | required | char int8 int16 int32 int64 uint8 uint16 uint32 uint64 float double |
146-
| 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. |
147-
| 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. |
148+
| sinceVersion | Documents the version of a schema in which a type was added. Not valid on a member of a composite type. | nonnegativeInteger | default = 0 | Must be less than or equal to the version of the message schema. |
149+
| deprecated | Documents the version of a schema in which a type was deprecated. It should no longer be used in new messages. Not valid on a member of a composite type. | nonnegativeInteger | optional | Must be less than or equal to the version of the message schema. |
148150

149151

150152
Simple type examples
@@ -217,8 +219,7 @@ A composite type often has its elements defined in-line within the `<composite>`
217219
| name | Usage of the type in this composite | symbolicName\_t | required | |
218220
| type | Name of referenced encoding | symbolicName\_t | required | Must match a defined type, enum or set or composite name attribute. |
219221
| 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 | |
220-
| 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. |
221-
| 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. |
222+
222223

223224
#### Type reference examples
224225

@@ -584,6 +585,7 @@ Reserved element names
584585
| blockLength | messageHeader and groupSize |
585586
| day | MonthYear |
586587
| exponent | decimal |
588+
| length | variable-length data |
587589
| mantissa | decimal |
588590
| month | MonthYear |
589591
| numInGroup | groupSize |
@@ -592,6 +594,7 @@ Reserved element names
592594
| timezoneHour | TZ time |
593595
| timezoneMinute | TZ time |
594596
| unit | timestamp, TZ time |
597+
| varData | variable-length data |
595598
| version | messageHeader |
596599
| week | MonthYear |
597600
| year | MonthYear |

v2-0-RC1/doc/05SchemaExtensionMechanism.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ Objective
55
---------
66

77
It is not always practical to update all message publishers and
8-
consumers simultaneously. Within certain constraints, message schemas
9-
and wire formats can be extended in a controlled way. Consumers using an
8+
consumers simultaneously. Within certain constraints, messages
9+
and repeating groups can be extended in a controlled way. Consumers using an
1010
older version of a schema should be compatible if interpretation of
1111
added fields or messages is not required for business processing.
1212

13+
Message templates and repeating groups may be extended with new fields. However, the extension mechanism does not support extension of composite types that back existing fields.
14+
1315
This specification only details compatibility at the presentation layer. It does not relieve application developers of any responsibility for carefully planning a migration strategy and for handling exceptions at the application layer.
1416

1517
### Constraints

v2-0-RC1/resources/sbe.xsd

Lines changed: 97 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
License: Creative Commons Attribution-NoDerivatives 4.0 International Public License
1010
</xs:documentation>
1111
</xs:annotation>
12+
<!-- Elements -->
1213
<xs:element name="messageSchema">
1314
<xs:annotation>
1415
<xs:documentation>
@@ -29,7 +30,7 @@
2930
</xs:annotation>
3031
<xs:complexType>
3132
<xs:choice maxOccurs="unbounded">
32-
<xs:element name="type" type="sbe:encodedDataType"/>
33+
<xs:element name="type" type="sbe:simpleDataType"/>
3334
<xs:element name="composite" type="sbe:compositeDataType"/>
3435
<xs:element name="enum" type="sbe:enumType"/>
3536
<xs:element name="set" type="sbe:setType"/>
@@ -86,6 +87,7 @@
8687
</xs:documentation>
8788
</xs:annotation>
8889
</xs:element>
90+
<!-- Complex types -->
8991
<xs:complexType name="blockType">
9092
<xs:annotation>
9193
<xs:documentation>Base type of message and repeating group entry
@@ -133,7 +135,7 @@
133135
</xs:extension>
134136
</xs:complexContent>
135137
</xs:complexType>
136-
<xs:complexType name="encodedDataType" mixed="true">
138+
<xs:complexType name="simpleDataType" mixed="true">
137139
<xs:annotation>
138140
<xs:documentation>
139141
Simple wire encoding consisting of a primitive type
@@ -144,51 +146,35 @@
144146
<xs:extension base="xs:token">
145147
<xs:attribute name="name" type="sbe:symbolicName_t" use="required"/>
146148
<xs:attribute name="description" type="xs:string" use="optional"/>
147-
<xs:attribute name="length" type="xs:nonNegativeInteger" default="1"/>
148-
<xs:attribute name="primitiveType" use="required">
149-
<xs:simpleType>
150-
<xs:restriction base="xs:token">
151-
<xs:enumeration value="char">
152-
<xs:annotation>
153-
<xs:documentation>A value of a single-byte character set</xs:documentation>
154-
</xs:annotation>
155-
</xs:enumeration>
156-
<xs:enumeration value="int8"/>
157-
<xs:enumeration value="int16"/>
158-
<xs:enumeration value="int32"/>
159-
<xs:enumeration value="int64"/>
160-
<xs:enumeration value="uint8"/>
161-
<xs:enumeration value="uint16"/>
162-
<xs:enumeration value="uint32"/>
163-
<xs:enumeration value="uint64"/>
164-
<xs:enumeration value="float"/>
165-
<xs:enumeration value="double"/>
166-
</xs:restriction>
167-
</xs:simpleType>
168-
</xs:attribute>
169-
<xs:attribute name="characterEncoding" type="xs:string" use="optional">
170-
<xs:annotation>
171-
<xs:documentation>Character set or Unicode encoding scheme</xs:documentation>
172-
</xs:annotation>
173-
</xs:attribute>
174-
<xs:attributeGroup ref="sbe:alignmentAttributes"/>
175-
<xs:attributeGroup ref="sbe:presenceAttributes">
176-
<xs:annotation>
177-
<xs:documentation>Presence only applies within a composite type</xs:documentation>
178-
</xs:annotation>
179-
</xs:attributeGroup>
149+
<xs:attributeGroup ref="sbe:primitiveTypeAttributes"/>
180150
<xs:attributeGroup ref="sbe:versionAttributes"/>
181151
</xs:extension>
182152
</xs:simpleContent>
183153
</xs:complexType>
154+
<xs:complexType name="memberDataType" mixed="true">
155+
<xs:annotation>
156+
<xs:documentation>
157+
A simple type used as a member of a composite type
158+
</xs:documentation>
159+
</xs:annotation>
160+
<xs:simpleContent>
161+
<xs:extension base="xs:token">
162+
<xs:attribute name="name" type="sbe:symbolicName_t" use="required"/>
163+
<xs:attribute name="description" type="xs:string" use="optional"/>
164+
<xs:attributeGroup ref="sbe:primitiveTypeAttributes"/>
165+
<xs:attributeGroup ref="sbe:alignmentAttributes"/>
166+
<xs:attributeGroup ref="sbe:presenceAttributes"/>
167+
</xs:extension>
168+
</xs:simpleContent>
169+
</xs:complexType>
184170
<xs:complexType name="compositeDataType" mixed="true">
185171
<xs:annotation>
186172
<xs:documentation>
187173
A wire encoding composed of multiple parts
188174
</xs:documentation>
189175
</xs:annotation>
190176
<xs:choice maxOccurs="unbounded">
191-
<xs:element name="type" type="sbe:encodedDataType"/>
177+
<xs:element name="type" type="sbe:memberDataType"/>
192178
<xs:element name="enum" type="sbe:enumType"/>
193179
<xs:element name="set" type="sbe:setType"/>
194180
<xs:element name="composite" type="sbe:compositeDataType"/>
@@ -238,7 +224,6 @@
238224
<xs:attribute name="name" type="sbe:symbolicName_t" use="required"/>
239225
<xs:attribute name="type" type="sbe:symbolicName_t" use="required"/>
240226
<xs:attributeGroup ref="sbe:alignmentAttributes"/>
241-
<xs:attributeGroup ref="sbe:versionAttributes"/>
242227
</xs:complexType>
243228
<xs:complexType name="setType" mixed="true">
244229
<xs:annotation>
@@ -290,38 +275,20 @@
290275
<xs:attributeGroup ref="sbe:semanticAttributes"/>
291276
<xs:attributeGroup ref="sbe:versionAttributes"/>
292277
</xs:complexType>
293-
<xs:attributeGroup name="semanticAttributes">
294-
<xs:annotation>
295-
<xs:documentation>
296-
Application layer class. Maps a field to a FIX data type or a template to a FIX message.
297-
</xs:documentation>
298-
</xs:annotation>
299-
<xs:attribute name="semanticType" type="xs:token" use="optional"/>
300-
<xs:attribute name="description" type="xs:string" use="optional"/>
301-
</xs:attributeGroup>
302-
<xs:attributeGroup name="versionAttributes">
303-
<xs:annotation>
304-
<xs:documentation>
305-
Schema versioning supports message extension
306-
</xs:documentation>
307-
</xs:annotation>
308-
<xs:attribute name="sinceVersion" type="xs:nonNegativeInteger" default="0">
309-
<xs:annotation>
310-
<xs:documentation>
311-
The schema version in which an element was added
312-
</xs:documentation>
313-
</xs:annotation>
314-
</xs:attribute>
315-
<xs:attribute name="deprecated" type="xs:nonNegativeInteger" use="optional">
316-
<xs:annotation>
317-
<xs:documentation>
318-
The version of the schema in which an element was deprecated. It is retained
319-
for back compatibility but should no longer be used by updated applications.
320-
It may be removed in a later version.
321-
</xs:documentation>
322-
</xs:annotation>
323-
</xs:attribute>
324-
</xs:attributeGroup>
278+
<!-- Simple types -->
279+
<xs:simpleType name="qualifiedName_t">
280+
<xs:restriction base="xs:string">
281+
<xs:pattern value="([A-Z]|[a-z]|_)([0-9]|[A-Z]|[a-z]|_)*\.([A-Z]|[a-z]|_)([0-9]|[A-Z]|[a-z]|_)*"/>
282+
</xs:restriction>
283+
</xs:simpleType>
284+
<xs:simpleType name="symbolicName_t">
285+
<xs:restriction base="xs:string">
286+
<xs:minLength value="1"/>
287+
<xs:maxLength value="64"/>
288+
<xs:pattern value="([A-Z]|[a-z]|_)([0-9]|[A-Z]|[a-z]|_)*"/>
289+
</xs:restriction>
290+
</xs:simpleType>
291+
<!-- Attribute groups -->
325292
<xs:attributeGroup name="alignmentAttributes">
326293
<xs:attribute name="offset" type="xs:unsignedInt" use="optional">
327294
<xs:annotation>
@@ -382,16 +349,65 @@
382349
</xs:annotation>
383350
</xs:attribute>
384351
</xs:attributeGroup>
385-
<xs:simpleType name="symbolicName_t">
386-
<xs:restriction base="xs:string">
387-
<xs:minLength value="1"/>
388-
<xs:maxLength value="64"/>
389-
<xs:pattern value="([A-Z]|[a-z]|_)([0-9]|[A-Z]|[a-z]|_)*"/>
390-
</xs:restriction>
391-
</xs:simpleType>
392-
<xs:simpleType name="qualifiedName_t">
393-
<xs:restriction base="xs:string">
394-
<xs:pattern value="([A-Z]|[a-z]|_)([0-9]|[A-Z]|[a-z]|_)*\.([A-Z]|[a-z]|_)([0-9]|[A-Z]|[a-z]|_)*"/>
395-
</xs:restriction>
396-
</xs:simpleType>
352+
<xs:attributeGroup name="primitiveTypeAttributes">
353+
<xs:attribute name="primitiveType" use="required">
354+
<xs:simpleType>
355+
<xs:restriction base="xs:token">
356+
<xs:enumeration value="char">
357+
<xs:annotation>
358+
<xs:documentation>A value of a single-byte character set</xs:documentation>
359+
</xs:annotation>
360+
</xs:enumeration>
361+
<xs:enumeration value="int8"/>
362+
<xs:enumeration value="int16"/>
363+
<xs:enumeration value="int32"/>
364+
<xs:enumeration value="int64"/>
365+
<xs:enumeration value="uint8"/>
366+
<xs:enumeration value="uint16"/>
367+
<xs:enumeration value="uint32"/>
368+
<xs:enumeration value="uint64"/>
369+
<xs:enumeration value="float"/>
370+
<xs:enumeration value="double"/>
371+
</xs:restriction>
372+
</xs:simpleType>
373+
</xs:attribute>
374+
<xs:attribute name="length" type="xs:nonNegativeInteger" default="1"/>
375+
<xs:attribute name="characterEncoding" type="xs:string" use="optional">
376+
<xs:annotation>
377+
<xs:documentation>Character set or Unicode encoding scheme</xs:documentation>
378+
</xs:annotation>
379+
</xs:attribute>
380+
</xs:attributeGroup>
381+
<xs:attributeGroup name="semanticAttributes">
382+
<xs:annotation>
383+
<xs:documentation>
384+
Application layer class. Maps a field to a FIX data type or a template to a FIX message.
385+
</xs:documentation>
386+
</xs:annotation>
387+
<xs:attribute name="semanticType" type="xs:token" use="optional"/>
388+
<xs:attribute name="description" type="xs:string" use="optional"/>
389+
</xs:attributeGroup>
390+
<xs:attributeGroup name="versionAttributes">
391+
<xs:annotation>
392+
<xs:documentation>
393+
Schema versioning supports message extension
394+
</xs:documentation>
395+
</xs:annotation>
396+
<xs:attribute name="sinceVersion" type="xs:nonNegativeInteger" default="0">
397+
<xs:annotation>
398+
<xs:documentation>
399+
The schema version in which an element was added
400+
</xs:documentation>
401+
</xs:annotation>
402+
</xs:attribute>
403+
<xs:attribute name="deprecated" type="xs:nonNegativeInteger" use="optional">
404+
<xs:annotation>
405+
<xs:documentation>
406+
The version of the schema in which an element was deprecated. It is retained
407+
for back compatibility but should no longer be used by updated applications.
408+
It may be removed in a later version.
409+
</xs:documentation>
410+
</xs:annotation>
411+
</xs:attribute>
412+
</xs:attributeGroup>
397413
</xs:schema>

0 commit comments

Comments
 (0)