Chris Fallin | 3f3820d | 2015-01-14 15:44:46 -0800 | [diff] [blame] | 1 | syntax = "proto3"; |
| 2 | |
Josh Haberman | 6d92233 | 2016-07-25 00:29:47 -0700 | [diff] [blame] | 3 | package a.b.c; |
Chris Fallin | 3f3820d | 2015-01-14 15:44:46 -0800 | [diff] [blame] | 4 | |
| 5 | message TestMessage { |
Bo Yang | 5db2173 | 2015-05-21 14:28:59 -0700 | [diff] [blame] | 6 | int32 optional_int32 = 1; |
| 7 | int64 optional_int64 = 2; |
| 8 | uint32 optional_uint32 = 3; |
| 9 | uint64 optional_uint64 = 4; |
| 10 | bool optional_bool = 5; |
| 11 | double optional_double = 6; |
| 12 | float optional_float = 7; |
| 13 | string optional_string = 8; |
| 14 | bytes optional_bytes = 9; |
| 15 | TestEnum optional_enum = 10; |
| 16 | TestMessage optional_msg = 11; |
Chris Fallin | 3f3820d | 2015-01-14 15:44:46 -0800 | [diff] [blame] | 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 | oneof my_oneof { |
| 31 | int32 oneof_int32 = 41; |
| 32 | int64 oneof_int64 = 42; |
| 33 | uint32 oneof_uint32 = 43; |
| 34 | uint64 oneof_uint64 = 44; |
| 35 | bool oneof_bool = 45; |
| 36 | double oneof_double = 46; |
| 37 | float oneof_float = 47; |
| 38 | string oneof_string = 48; |
| 39 | bytes oneof_bytes = 49; |
| 40 | TestEnum oneof_enum = 50; |
| 41 | TestMessage oneof_msg = 51; |
| 42 | } |
| 43 | |
| 44 | map<int32, string> map_int32_string = 61; |
| 45 | map<int64, string> map_int64_string = 62; |
| 46 | map<uint32, string> map_uint32_string = 63; |
| 47 | map<uint64, string> map_uint64_string = 64; |
| 48 | map<bool, string> map_bool_string = 65; |
| 49 | map<string, string> map_string_string = 66; |
| 50 | map<string, TestMessage> map_string_msg = 67; |
| 51 | map<string, TestEnum> map_string_enum = 68; |
| 52 | map<string, int32> map_string_int32 = 69; |
| 53 | map<string, bool> map_string_bool = 70; |
| 54 | |
| 55 | message NestedMessage { |
Bo Yang | 5db2173 | 2015-05-21 14:28:59 -0700 | [diff] [blame] | 56 | int32 foo = 1; |
Chris Fallin | 3f3820d | 2015-01-14 15:44:46 -0800 | [diff] [blame] | 57 | } |
| 58 | |
Bo Yang | 5db2173 | 2015-05-21 14:28:59 -0700 | [diff] [blame] | 59 | NestedMessage nested_message = 80; |
Paul Yang | 0e7b589 | 2017-12-07 14:18:38 -0800 | [diff] [blame] | 60 | |
| 61 | // Reserved for non-existing field test. |
| 62 | // int32 non_exist = 89; |
Chris Fallin | 3f3820d | 2015-01-14 15:44:46 -0800 | [diff] [blame] | 63 | } |
| 64 | |
| 65 | enum TestEnum { |
| 66 | Default = 0; |
| 67 | A = 1; |
| 68 | B = 2; |
| 69 | C = 3; |
tison | 2d08621 | 2022-09-29 04:32:16 +0800 | [diff] [blame] | 70 | |
| 71 | v0 = 4; |
Chris Fallin | 3f3820d | 2015-01-14 15:44:46 -0800 | [diff] [blame] | 72 | } |
Paul Yang | 0e7b589 | 2017-12-07 14:18:38 -0800 | [diff] [blame] | 73 | |
toc007 | dda7ab0 | 2019-01-15 20:01:41 -0800 | [diff] [blame] | 74 | message testLowercaseNested { |
| 75 | message lowercase{} |
| 76 | } |
| 77 | |
| 78 | |
Paul Yang | 0e7b589 | 2017-12-07 14:18:38 -0800 | [diff] [blame] | 79 | message TestUnknown { |
| 80 | TestUnknown optional_unknown = 11; |
| 81 | repeated TestUnknown repeated_unknown = 31; |
| 82 | oneof my_oneof { |
| 83 | TestUnknown oneof_unknown = 51; |
| 84 | } |
| 85 | map<string, TestUnknown> map_unknown = 67; |
| 86 | int32 unknown_field = 89; |
| 87 | } |
Lukas Fittl | 93c703e | 2021-04-03 18:42:54 -0700 | [diff] [blame] | 88 | |
| 89 | message TestJsonName { |
| 90 | int32 value = 1 [json_name = "CustomJsonName"]; |
| 91 | } |