OxL Reference

9.4 Decoding and validation

  • A missing required field → DecodeError.Missing.
  • A value that fails the invariant of a refined type or an invariant → DecodeError.Invalid.
  • Unknown fields are skipped; with @preserve_unknown on the type they are preserved and written back on re-serialisation. @preserve_unknown is allowed only on data (otherwise the compile error schema-attr) and acts only in the OxL binary format: the preserved raw records (tag and value) are written after the known fields in the order they were read; JSON, MessagePack and CBOR neither read nor write unknown fields. Nested messages keep their own unknown fields if they have the attribute. Preserved fields do not take part in ==, the hash and Show (D-8053; DIV-005; D-7610).
  • An unknown variant of an @open enum is mapped to the automatic variant Unknown(tag: u32).
  • In an rpc, a request decoding error is returned to the client as ProtocolError.InvalidArgument; the handler is not called.

See also

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