Skip to content

protogen(union): use the fixed list index (1-started) as field number of one of message fields for compatibility #363

Description

@wenchy

A sheet named Target in workbook with the sheet mode specified as MODE_UNION_TYPE in metasheet:

Name Alias Field1 Field2 Field3
PVP PVP ID
uint32
damage
int32

Generated:

// --snip--

// Generated from sheet: Target.
message Target {
  option (tableau.union) = {name:"Target"};

  Type type = 9999 [(tableau.field) = { name: "Type" }];
  oneof value {
    option (tableau.oneof) = {field: "Field"};

    PVP pvp = 1; // Bound to enum value: TYPE_PVP.
  }
  enum Type {
    TYPE_INVALID = 0;
    TYPE_PVP = 1 [(tableau.evalue).name = "AliasPVP"];
  }

  message PVP {
    uint32 id = 1 [(tableau.field) = {name:"ID"}]; // field number (tagid) is expected to be 2
    int64 damage = 2 [(tableau.field) = {name:"Damage"}]; // field number (tagid) is expected to be 3
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions