9.2 Field numbers and schema
- Every field of a
dataand every variant of anenumhas a stable tag (the number in the wire format). - The tag is set explicitly by
@tag(n)or assigned by the compiler. The assigned tags are recorded in the package fileoxl.schema.lock(type name → field name → tag). A new field getsmax(tag) + 1. The lock file MUST be kept in version control. Format and reconciliation with the registry — appendix C. - Renaming a field without
@renamed(from: "old")is treated as a deletion and an addition. - Schema version:
@v(N)ondata,enumorservice(1 by default).@since(N)— the field appeared in version N;@removed(N)— the field was removed in version N, its tag is reserved forever.
Breaking changes (the compiler and oxl publish MUST reject them relative to the last published schema):
| Change | Why |
|---|---|
removing a field without @removed | old readers silently lose data |
| reusing a tag | wrong interpretation of data |
changing a field type, except the widenings i32→i64, u32→u64, f32→f64, T→T? | incompatible encoding |
| adding a required field (without a default value and not optional) | old writers do not send it |
T? → T | old writers may not send it |
removing an enum variant or adding a variant to an enum without @open | old readers will not be able to parse it |
| removing or renaming an rpc, changing its parameters or result | breaks clients |
Related diagnostics
See also
Source: docs/spec/oxl-standard.en.md