OxL Справочник OxL
РусскийEnglish

error schema-attr

error Стандарт: [§9.2, §9.5]

Некорректный атрибут сериализации (@tag, @v, @since, @removed, @renamed, @zigzag, @repr, @codec).

What it means#

An attribute of the serialization schema is malformed or used in the wrong place:

  • @tag(n) needs a number in 1..536870911 outside protobuf's reserved range 19000..19999, unique within the type, and not a tag reserved by @removed;
  • @v(n) and @since(n) need a version >= 1;
  • @removed(N, "member") is written on the type (D-2108), names a member that no longer exists, and optionally tag: T;
  • @renamed(from: "old") needs the old name;
  • @zigzag applies to integer fields and types;
  • @repr(W) needs impl Repr<W> for T; @codec(C) / @codec(json: C1, oxl: C2) need codec types with impl Codec<T> for C.

Example#

oxl✓ проверяется в CI
data Order {
  @tag(1) id: i64
  @tag(1) total: i64      // <- schema-attr
}
error
schema-attr

How to fix#

Give every field its own tag or drop the explicit tags and let the compiler assign them (the assignment is recorded in oxl.schema.lock). For a removed field keep the type attribute @removed(2, "total") instead of reusing the number.

See also#

OxL 1.0.0-beta · Версия документации 1.0.0-beta© OxwaldLink · сгенерировано из Стандарта, исходников std и руководства