Commit 9fe2ec5d authored by James Cook's avatar James Cook Committed by Commit Bot

mojo: Update docs about MinVersion

Clarify that the value of MinVersion isn't related to particular
ordinal values.

Bug: none
Change-Id: Ie3dcca5e494e51e0adbbf0bc0bbea24d7054515b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2425326Reviewed-by: default avatarKen Rockot <rockot@google.com>
Reviewed-by: default avatarJenny Zhang <jennyz@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809655}
parent 364214ae
......@@ -555,13 +555,14 @@ struct Employee {
};
```
and you would like to add a birthday field. You can do:
and you would like to add birthday and nickname fields. You can do:
``` cpp
struct Employee {
uint64 employee_id;
string name;
[MinVersion=1] Date? birthday;
[MinVersion=1] string? nickname;
};
```
......@@ -570,10 +571,14 @@ struct definition (*i.e*., existing fields must not change **ordinal value**)
with the `MinVersion` attribute set to a number greater than any previous
existing versions.
The value of `MinVersion` is unrelated to ordinals. The choice of a particular
version number is arbitrary. All its usage means is that a field isn't present
before the numbered version.
*** note
**NOTE:** do not change existing fields in versioned structs, as this is
not backwards-compatible. Instead, rename the old field to make its
deprecation clear and add a new field with the new version number.
deprecation clear and add a new field with a new `MinVersion` number.
***
**Ordinal value** refers to the relative positional layout of a struct's fields
......@@ -602,6 +607,7 @@ struct Employee {
uint64 employee_id@0;
[MinVersion=1] Date? birthday@2;
string name@1;
[MinVersion=1] string? nickname@3;
};
```
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment