...

Text file src/github.com/google/flatbuffers/tests/prototest/test.proto

Documentation: github.com/google/flatbuffers/tests/prototest

     1// Sample .proto file that we can translate to the corresponding .fbs.
     2
     3option some_option = is_ignored;
     4import "imported.proto";
     5
     6package proto.test;
     7
     8/// Enum doc comment.
     9enum ProtoEnum {
    10  option allow_alias = true;
    11  NUL = 0;
    12  FOO = 1;
    13  /// Enum 2nd value doc comment misaligned.
    14  BAR = 5;
    15  // Aliases
    16  FOO_A1 = 1;
    17  BAR_A1 = 5;
    18  FOO_A2 = 1;
    19}
    20
    21/// 2nd table doc comment with
    22/// many lines.
    23message ProtoMessage {
    24  // Ignored non-doc comment.
    25  // A nested message declaration, will be moved to top level in .fbs
    26  message OtherMessage {
    27    reserved 2, 9 to 11, 15;
    28    optional double a = 26;
    29    /// doc comment for b.
    30    optional float b = 32 [default = 3.14149];
    31
    32    // Nested enum that aliases the outer one.
    33    enum ProtoEnum {
    34      NUL = 0;
    35      FOO = 1;
    36      BAR = 2;
    37      BAZ = 3;
    38    }
    39
    40    optional ProtoEnum foo_bar_baz = 33;
    41  }
    42  optional int32 c = 12 [default = 16];
    43  optional int64 d = 1 [default = 0];
    44  optional uint32 p = 40;
    45  optional uint64 e = 2;
    46  /// doc comment for f.
    47  optional sint32 f = 3 [default = -1];
    48  optional sint64 g = 4;
    49  optional fixed32 h = 5;
    50  optional fixed64 q = 6;
    51  optional sfixed32 i = 7;
    52  optional sfixed64 j = 8;
    53  /// doc comment for k.
    54  optional bool k = 9;
    55  /// doc comment for l on 2
    56  /// lines
    57  required string l = 10;
    58  optional bytes m = 11;
    59  optional OtherMessage n = 41;
    60  repeated string o = 14;
    61  optional ImportedMessage z = 16;
    62  /// doc comment for r.
    63  oneof r {
    64    /// doc comment for s.
    65    ImportedMessage s = 17;
    66    /// doc comment for t on 2
    67    /// lines.
    68    OtherMessage t = 18;
    69  }
    70  optional ProtoEnum outer_enum = 33;
    71  // Tests that `inf` and `+/-inf` can be parsed in proto options.
    72  optional float u = 34 [default = inf];
    73  optional float v = 35 [default = +inf];
    74  optional float w = 36 [default = -inf];
    75
    76  map<string, float> grades = 37;
    77  map<string, OtherMessage> other_message_map = 38;
    78}

View as plain text