This is an automated email from the ASF dual-hosted git repository. chaokunyang pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/fory-site.git
commit 76d85ebd4c76c781dbbde219804239eaca2924c8 Author: chaokunyang <[email protected]> AuthorDate: Wed Aug 26 04:33:07 2026 +0000 🔄 synced local 'docs/compiler/' with remote 'docs/compiler/' --- docs/compiler/schema-idl.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/compiler/schema-idl.md b/docs/compiler/schema-idl.md index 4291e9b649e..9c1244fdd90 100644 --- a/docs/compiler/schema-idl.md +++ b/docs/compiler/schema-idl.md @@ -976,6 +976,11 @@ Fields define the properties of a message. field_type field_name = field_number; ``` +`field_number` is the field tag ID. It must be unique within the message and +satisfy `0 <= field_number < 2^29` (`0` through `536870911`). Keep +assigned field numbers stable and reserve removed numbers instead of reusing +them for different fields. + ### With Modifiers ```protobuf @@ -1149,22 +1154,22 @@ Use `ref(thread_safe=false)` in Fory IDL (or ## Field Numbers -Each field must have a unique positive integer identifier: +Each field must have a unique tag ID in the protocol range: ```protobuf message Example { - string first = 1; - string second = 2; - string third = 3; + string first = 0; + string second = 1; + string third = 2; } ``` **Rules and best practices:** - Numbers must be unique within a message. -- Numbers must be positive integers. +- Numbers must satisfy `0 <= field_number < 2^29` (`0` through `536870911`). - Gaps are allowed and are useful when fields are removed. -- Prefer sequential numbering from `1`. +- Prefer sequential numbering. - Never reuse a removed field number for a different field. ## Type System --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
