Skip to content

Built-in Annotations

@rename("...") is used to rename the serialized name of a field.

  • Acts on struct / union members.
  • Used as the wire / property name when generating HTTP / JSON mappings.
  • Typically maps to #[serde(rename = "...")] in Rust.

Example:

struct User {
uint32 id;
@rename("new_name")
string name;
};

@rename_all("...") allows renaming all fields within a structure.

@rename_all("snake_case")
struct User {
uint32 id;
string name;
};

Supported parameters:

  • lowercase
  • UPPERCASE
  • PascalCase
  • camelCase
  • snake_case
  • SCREAMING_SNAKE_CASE
  • kebab-case
  • SCREAMING-KEBAB-CASE