Harshit Chopra | d0535cc | 2017-08-25 12:11:15 -0700 | [diff] [blame] | 1 | syntax = "proto2"; |
| 2 | |
| 3 | package a.b.proto2; |
| 4 | |
| 5 | message TestMessage { |
| 6 | optional int32 optional_int32 = 1; |
| 7 | optional int64 optional_int64 = 2; |
| 8 | optional uint32 optional_uint32 = 3; |
| 9 | optional uint64 optional_uint64 = 4; |
| 10 | optional bool optional_bool = 5; |
| 11 | optional double optional_double = 6; |
| 12 | optional float optional_float = 7; |
| 13 | optional string optional_string = 8; |
| 14 | optional bytes optional_bytes = 9; |
| 15 | optional TestEnum optional_enum = 10; |
| 16 | optional TestMessage optional_msg = 11; |
| 17 | |
| 18 | repeated int32 repeated_int32 = 21; |
| 19 | repeated int64 repeated_int64 = 22; |
| 20 | repeated uint32 repeated_uint32 = 23; |
| 21 | repeated uint64 repeated_uint64 = 24; |
| 22 | repeated bool repeated_bool = 25; |
| 23 | repeated double repeated_double = 26; |
| 24 | repeated float repeated_float = 27; |
| 25 | repeated string repeated_string = 28; |
| 26 | repeated bytes repeated_bytes = 29; |
| 27 | repeated TestEnum repeated_enum = 30; |
| 28 | repeated TestMessage repeated_msg = 31; |
| 29 | |
| 30 | required int32 required_int32 = 41; |
| 31 | required int64 required_int64 = 42; |
| 32 | required uint32 required_uint32 = 43; |
| 33 | required uint64 required_uint64 = 44; |
| 34 | required bool required_bool = 45; |
| 35 | required double required_double = 46; |
| 36 | required float required_float = 47; |
| 37 | required string required_string = 48; |
| 38 | required bytes required_bytes = 49; |
| 39 | required TestEnum required_enum = 50; |
| 40 | required TestMessage required_msg = 51; |
| 41 | |
| 42 | oneof my_oneof { |
| 43 | int32 oneof_int32 = 61; |
| 44 | int64 oneof_int64 = 62; |
| 45 | uint32 oneof_uint32 = 63; |
| 46 | uint64 oneof_uint64 = 64; |
| 47 | bool oneof_bool = 65; |
| 48 | double oneof_double = 66; |
| 49 | float oneof_float = 67; |
| 50 | string oneof_string = 68; |
| 51 | bytes oneof_bytes = 69; |
| 52 | TestEnum oneof_enum = 70; |
| 53 | TestMessage oneof_msg = 71; |
| 54 | } |
| 55 | |
| 56 | message NestedMessage { |
| 57 | optional int32 foo = 1; |
| 58 | } |
| 59 | |
| 60 | optional NestedMessage nested_message = 80; |
| 61 | |
| 62 | // Reserved for non-existing field test. |
| 63 | // int32 non_exist = 89; |
| 64 | } |
| 65 | |
| 66 | enum TestEnum { |
| 67 | Default = 0; |
| 68 | A = 1; |
| 69 | B = 2; |
| 70 | C = 3; |
| 71 | } |
| 72 | |
| 73 | message TestUnknown { |
| 74 | optional TestUnknown optional_unknown = 11; |
| 75 | repeated TestUnknown repeated_unknown = 31; |
| 76 | oneof my_oneof { |
| 77 | TestUnknown oneof_unknown = 51; |
| 78 | } |
| 79 | optional int32 unknown_field = 89; |
| 80 | } |