github.com/gogo/protobuf@v1.3.2/test/theproto3/theproto3.proto (about) 1 // Protocol Buffers for Go with Gadgets 2 // 3 // Copyright (c) 2013, The GoGo Authors. All rights reserved. 4 // http://github.com/gogo/protobuf 5 // 6 // Go support for Protocol Buffers - Google's data interchange format 7 // 8 // Copyright 2014 The Go Authors. All rights reserved. 9 // https://github.com/golang/protobuf 10 // 11 // Redistribution and use in source and binary forms, with or without 12 // modification, are permitted provided that the following conditions are 13 // met: 14 // 15 // * Redistributions of source code must retain the above copyright 16 // notice, this list of conditions and the following disclaimer. 17 // * Redistributions in binary form must reproduce the above 18 // copyright notice, this list of conditions and the following disclaimer 19 // in the documentation and/or other materials provided with the 20 // distribution. 21 // * Neither the name of Google Inc. nor the names of its 22 // contributors may be used to endorse or promote products derived from 23 // this software without specific prior written permission. 24 // 25 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 37 syntax = "proto3"; 38 39 package theproto3; 40 41 import "github.com/gogo/protobuf/gogoproto/gogo.proto"; 42 43 import "github.com/gogo/protobuf/test/combos/both/thetest.proto"; 44 45 option (gogoproto.goproto_stringer_all) = false; 46 option (gogoproto.goproto_enum_prefix_all) = false; 47 option (gogoproto.goproto_getters_all) = false; 48 49 option (gogoproto.equal_all) = true; 50 option (gogoproto.verbose_equal_all) = true; 51 option (gogoproto.stringer_all) = true; 52 option (gogoproto.gostring_all) = true; 53 option (gogoproto.face_all) = true; 54 option (gogoproto.description_all) = true; 55 56 option (gogoproto.testgen_all) = true; 57 option (gogoproto.populate_all) = true; 58 option (gogoproto.benchgen_all) = true; 59 option (gogoproto.unmarshaler_all) = false; 60 option (gogoproto.marshaler_all) = false; 61 option (gogoproto.sizer_all) = true; 62 63 option (gogoproto.goproto_enum_stringer_all) = false; 64 option (gogoproto.enum_stringer_all) = true; 65 66 option (gogoproto.unsafe_marshaler_all) = false; 67 option (gogoproto.unsafe_unmarshaler_all) = false; 68 69 message Message { 70 enum Humour { 71 UNKNOWN = 0; 72 PUNS = 1; 73 SLAPSTICK = 2; 74 BILL_BAILEY = 3; 75 } 76 77 string name = 1; 78 Humour hilarity = 2; 79 uint32 height_in_cm = 3; 80 bytes data = 4; 81 int64 result_count = 7; 82 bool true_scotsman = 8; 83 float score = 9; 84 85 repeated uint64 key = 5; 86 Nested nested = 6; 87 88 map<int64, Nested> terrain = 10; 89 test.NinOptNative proto2_field = 11; 90 map<int64, test.NinOptEnum> proto2_value = 13; 91 } 92 93 message Nested { 94 string bunny = 1; 95 } 96 97 enum MapEnum { 98 MA = 0; 99 MB = 1; 100 MC = 2; 101 } 102 103 message AllMaps { 104 map<string, double> StringToDoubleMap = 1; 105 map<string, float> StringToFloatMap = 2; 106 map<int32, int32> Int32Map = 3; 107 map<int64, int64> Int64Map = 4; 108 map<uint32, uint32> Uint32Map = 5; 109 map<uint64, uint64> Uint64Map = 6; 110 map<sint32, sint32> Sint32Map = 7; 111 map<sint64, sint64> Sint64Map = 8; 112 map<fixed32, fixed32> Fixed32Map = 9; 113 map<sfixed32, sfixed32> Sfixed32Map = 10; 114 map<fixed64, fixed64> Fixed64Map = 11; 115 map<sfixed64, sfixed64> Sfixed64Map = 12; 116 map<bool, bool> BoolMap = 13; 117 map<string, string> StringMap = 14; 118 map<string, bytes> StringToBytesMap = 15; 119 map<string, MapEnum> StringToEnumMap = 16; 120 map<string, FloatingPoint> StringToMsgMap = 17; 121 } 122 123 message AllMapsOrdered { 124 option (gogoproto.stable_marshaler) = true; 125 126 map<string, double> StringToDoubleMap = 1; 127 map<string, float> StringToFloatMap = 2; 128 map<int32, int32> Int32Map = 3; 129 map<int64, int64> Int64Map = 4; 130 map<uint32, uint32> Uint32Map = 5; 131 map<uint64, uint64> Uint64Map = 6; 132 map<sint32, sint32> Sint32Map = 7; 133 map<sint64, sint64> Sint64Map = 8; 134 map<fixed32, fixed32> Fixed32Map = 9; 135 map<sfixed32, sfixed32> Sfixed32Map = 10; 136 map<fixed64, fixed64> Fixed64Map = 11; 137 map<sfixed64, sfixed64> Sfixed64Map = 12; 138 map<bool, bool> BoolMap = 13; 139 map<string, string> StringMap = 14; 140 map<string, bytes> StringToBytesMap = 15; 141 map<string, MapEnum> StringToEnumMap = 16; 142 map<string, FloatingPoint> StringToMsgMap = 17; 143 } 144 145 message MessageWithMap { 146 map<int32, string> name_mapping = 1; 147 map<sint64, FloatingPoint> msg_mapping = 2; 148 map<bool, bytes> byte_mapping = 3; 149 } 150 151 message FloatingPoint { 152 double f = 1; 153 } 154 155 message Uint128Pair { 156 bytes left = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128"]; 157 bytes right = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128"]; 158 } 159 160 message ContainsNestedMap { 161 message NestedMap { 162 map<string, double> NestedMapField = 1; 163 } 164 } 165 166 message NotPacked { 167 repeated uint64 key = 5 [packed=false]; 168 }