OxL Reference

9.2 Field numbers and schema

  • Every field of a data and every variant of an enum has 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 file oxl.schema.lock (type name → field name → tag). A new field gets max(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) on data, enum or service (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):

ChangeWhy
removing a field without @removedold readers silently lose data
reusing a tagwrong 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? → Told writers may not send it
removing an enum variant or adding a variant to an enum without @openold readers will not be able to parse it
removing or renaming an rpc, changing its parameters or resultbreaks clients

schema-attr, schema-break

See also

Source: docs/spec/oxl-standard.en.md