Skip to content

Commit 308393e

Browse files
committed
Merge pull request #5 from donmendelson/rc4-schema-extension
Compatibility clarification
2 parents 29458c9 + 90e7e88 commit 308393e

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

v1-0-RC4/doc/05SchemaExtensionMechanism.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ and wire formats 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+
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.
14+
1315
### Constraints
1416

1517
Compatibility is only ensured under these conditions:
@@ -29,11 +31,12 @@ Compatibility is only ensured under these conditions:
2931

3032
- Message header encoding cannot change.
3133

32-
Changes that break those constraints require consumers to update to the
33-
current schema used by publishers. In general, metadata changes such as
34-
name or description corrections do not break compatibility so long as
34+
- In general, metadata changes such as name or description corrections do not break compatibility so long as
3535
wire format does not change.
3636

37+
Changes that break those constraints require consumers to update to the
38+
current schema used by publishers. An message template that has changed in an incompatible way must be assinged a new template "id" attribute.
39+
3740
Message schema features for extension
3841
-------------------------------------
3942

@@ -52,7 +55,7 @@ See section 4.3.1 above for schema attributes.
5255

5356
### Since version
5457

55-
When a new field, group or message is added to a message schema, the
58+
When a new field, enumeration value, group or message is added to a message schema, the
5659
extension may be documented by adding a sinceVersion attribute to the
5760
element. The sinceVersion attribute tells in which schema version the
5861
element was added. This attribute remains the same for that element for
@@ -110,6 +113,20 @@ does not break parsing of earlier fields.
110113
Likewise, block size of a repeating group is conveyed in the NumInGroup
111114
encoding.
112115

116+
Comaptibility strategy
117+
-----------------------
118+
*This suggested strategy is non-normative.*
119+
120+
A message decoder compares the schema version in a received message header to the version that the decoder was built with.
121+
122+
If the *received version is equal to the decoder's version*, then all fields known to the decoder may be parsed, and no further analysis is required.
123+
124+
If the *received version is greater than the decoder's version* (that is, the producer's encoder is newer than the consumer's decoder), then all fields known to the decoder may be parsed but it will be unable to parse added fields.
125+
126+
Also, an old decoder may encounter unexpected enumeration values. The application layer determines whether an unexpected value is a fatal error. Probably so for a required field since the business meaning is unknown, but it may choose to allow an unknown value of an optional field to pass through. For example, if OrdType value J="Market If Touched" is added to a schema, and the consumer does not recognize it, then the application returns an order rejection with reason "order type not supported", even if it does not know what "J" represents. Note that this is not strictly a versioning problem, however. This exception handling is indistinguishable from the case where "J" was never added to the enum but was simply sent in error.
127+
128+
If the *received version is less than the decoder's version* (that is, the producer's encoder is older than the consumer's decoder), then only the fields of the older version may be parsed. This information is available through metadata as "sinceVersion" attribute of a field. If sinceVersion is greater than received schema version, then the field is not available. How a decoder signals an application that a field is unavailable is an implementation detail. One strategy is for an application to provide a default value for unavailable fields.
129+
113130
Message schema extension example
114131
--------------------------------
115132

0 commit comments

Comments
 (0)