Damien Neil | ba23aa5 | 2018-12-07 14:38:17 -0800 | [diff] [blame^] | 1 | // Copyright 2018 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | syntax = "proto2"; |
| 6 | |
| 7 | package goproto.proto.test; |
| 8 | |
| 9 | option go_package = "github.com/golang/protobuf/v2/proto/testpb"; |
| 10 | |
| 11 | message TestAllTypes { |
| 12 | message NestedMessage { |
| 13 | optional int32 a = 1; |
| 14 | optional TestAllTypes corecursive = 2; |
| 15 | } |
| 16 | |
| 17 | enum NestedEnum { |
| 18 | FOO = 0; |
| 19 | BAR = 1; |
| 20 | BAZ = 2; |
| 21 | NEG = -1; // Intentionally negative. |
| 22 | } |
| 23 | |
| 24 | optional int32 optional_int32 = 1; |
| 25 | optional int64 optional_int64 = 2; |
| 26 | optional uint32 optional_uint32 = 3; |
| 27 | optional uint64 optional_uint64 = 4; |
| 28 | optional sint32 optional_sint32 = 5; |
| 29 | optional sint64 optional_sint64 = 6; |
| 30 | optional fixed32 optional_fixed32 = 7; |
| 31 | optional fixed64 optional_fixed64 = 8; |
| 32 | optional sfixed32 optional_sfixed32 = 9; |
| 33 | optional sfixed64 optional_sfixed64 = 10; |
| 34 | optional float optional_float = 11; |
| 35 | optional double optional_double = 12; |
| 36 | optional bool optional_bool = 13; |
| 37 | optional string optional_string = 14; |
| 38 | optional bytes optional_bytes = 15; |
| 39 | optional group OptionalGroup = 16 { |
| 40 | optional int32 a = 17; |
| 41 | } |
| 42 | optional NestedMessage optional_nested_message = 18; |
| 43 | optional NestedEnum optional_nested_enum = 21; |
| 44 | |
| 45 | repeated int32 repeated_int32 = 31; |
| 46 | repeated int64 repeated_int64 = 32; |
| 47 | repeated uint32 repeated_uint32 = 33; |
| 48 | repeated uint64 repeated_uint64 = 34; |
| 49 | repeated sint32 repeated_sint32 = 35; |
| 50 | repeated sint64 repeated_sint64 = 36; |
| 51 | repeated fixed32 repeated_fixed32 = 37; |
| 52 | repeated fixed64 repeated_fixed64 = 38; |
| 53 | repeated sfixed32 repeated_sfixed32 = 39; |
| 54 | repeated sfixed64 repeated_sfixed64 = 40; |
| 55 | repeated float repeated_float = 41; |
| 56 | repeated double repeated_double = 42; |
| 57 | repeated bool repeated_bool = 43; |
| 58 | repeated string repeated_string = 44; |
| 59 | repeated bytes repeated_bytes = 45; |
| 60 | repeated group RepeatedGroup = 46 { |
| 61 | optional int32 a = 47; |
| 62 | } |
| 63 | repeated NestedMessage repeated_nested_message = 48; |
| 64 | repeated NestedEnum repeated_nested_enum = 51; |
| 65 | |
| 66 | map < int32, int32> map_int32_int32 = 56; |
| 67 | map < int64, int64> map_int64_int64 = 57; |
| 68 | map < uint32, uint32> map_uint32_uint32 = 58; |
| 69 | map < uint64, uint64> map_uint64_uint64 = 59; |
| 70 | map < sint32, sint32> map_sint32_sint32 = 60; |
| 71 | map < sint64, sint64> map_sint64_sint64 = 61; |
| 72 | map < fixed32, fixed32> map_fixed32_fixed32 = 62; |
| 73 | map < fixed64, fixed64> map_fixed64_fixed64 = 63; |
| 74 | map <sfixed32, sfixed32> map_sfixed32_sfixed32 = 64; |
| 75 | map <sfixed64, sfixed64> map_sfixed64_sfixed64 = 65; |
| 76 | map < int32, float> map_int32_float = 66; |
| 77 | map < int32, double> map_int32_double = 67; |
| 78 | map < bool, bool> map_bool_bool = 68; |
| 79 | map < string, string> map_string_string = 69; |
| 80 | map < string, bytes> map_string_bytes = 70; |
| 81 | map < string, NestedMessage> map_string_nested_message = 71; |
| 82 | map < string, NestedEnum> map_string_nested_enum = 73; |
| 83 | |
| 84 | oneof oneof_field { |
| 85 | uint32 oneof_uint32 = 111; |
| 86 | NestedMessage oneof_nested_message = 112; |
| 87 | string oneof_string = 113; |
| 88 | bytes oneof_bytes = 114; |
| 89 | bool oneof_bool = 115; |
| 90 | uint64 oneof_uint64 = 116; |
| 91 | float oneof_float = 117; |
| 92 | double oneof_double = 118; |
| 93 | NestedEnum oneof_enum = 119; |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | message TestAllExtensions { |
| 98 | extensions 1 to max; |
| 99 | } |
| 100 | |
| 101 | extend TestAllExtensions { |
| 102 | optional int32 optional_int32_extension = 1; |
| 103 | optional int64 optional_int64_extension = 2; |
| 104 | optional uint32 optional_uint32_extension = 3; |
| 105 | optional uint64 optional_uint64_extension = 4; |
| 106 | optional sint32 optional_sint32_extension = 5; |
| 107 | optional sint64 optional_sint64_extension = 6; |
| 108 | optional fixed32 optional_fixed32_extension = 7; |
| 109 | optional fixed64 optional_fixed64_extension = 8; |
| 110 | optional sfixed32 optional_sfixed32_extension = 9; |
| 111 | optional sfixed64 optional_sfixed64_extension = 10; |
| 112 | optional float optional_float_extension = 11; |
| 113 | optional double optional_double_extension = 12; |
| 114 | optional bool optional_bool_extension = 13; |
| 115 | optional string optional_string_extension = 14; |
| 116 | optional bytes optional_bytes_extension = 15; |
| 117 | |
| 118 | optional group OptionalGroup_extension = 16 { |
| 119 | optional int32 a = 17; |
| 120 | } |
| 121 | |
| 122 | optional TestAllTypes.NestedMessage optional_nested_message_extension = 18; |
| 123 | optional TestAllTypes.NestedEnum optional_nested_enum_extension = 21; |
| 124 | |
| 125 | repeated int32 repeated_int32_extension = 31; |
| 126 | repeated int64 repeated_int64_extension = 32; |
| 127 | repeated uint32 repeated_uint32_extension = 33; |
| 128 | repeated uint64 repeated_uint64_extension = 34; |
| 129 | repeated sint32 repeated_sint32_extension = 35; |
| 130 | repeated sint64 repeated_sint64_extension = 36; |
| 131 | repeated fixed32 repeated_fixed32_extension = 37; |
| 132 | repeated fixed64 repeated_fixed64_extension = 38; |
| 133 | repeated sfixed32 repeated_sfixed32_extension = 39; |
| 134 | repeated sfixed64 repeated_sfixed64_extension = 40; |
| 135 | repeated float repeated_float_extension = 41; |
| 136 | repeated double repeated_double_extension = 42; |
| 137 | repeated bool repeated_bool_extension = 43; |
| 138 | repeated string repeated_string_extension = 44; |
| 139 | repeated bytes repeated_bytes_extension = 45; |
| 140 | |
| 141 | repeated group RepeatedGroup_extension = 46 { |
| 142 | optional int32 a = 47; |
| 143 | } |
| 144 | |
| 145 | repeated TestAllTypes.NestedMessage repeated_nested_message_extension = 48; |
| 146 | repeated TestAllTypes.NestedEnum repeated_nested_enum_extension = 51; |
| 147 | } |