1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
|
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test Protobuf definitions with proto3 syntax.
syntax = "proto3";
package pb3;
option go_package = "google.golang.org/protobuf/internal/testprotos/textpb3";
// Scalars contains scalar field types.
message Scalars {
bool s_bool = 1;
int32 s_int32 = 2;
int64 s_int64 = 3;
uint32 s_uint32 = 4;
uint64 s_uint64 = 5;
sint32 s_sint32 = 6;
sint64 s_sint64 = 7;
fixed32 s_fixed32 = 8;
fixed64 s_fixed64 = 9;
sfixed32 s_sfixed32 = 10;
sfixed64 s_sfixed64 = 11;
// Textproto marshal outputs fields in the same order as this proto
// definition regardless of field number. Following fields are intended to
// test that assumption.
float s_float = 20;
double s_double = 21;
bytes s_bytes = 14;
string s_string = 13;
}
// Message contains repeated fields.
message Repeats {
repeated bool rpt_bool = 1;
repeated int32 rpt_int32 = 2;
repeated int64 rpt_int64 = 3;
repeated uint32 rpt_uint32 = 4;
repeated uint64 rpt_uint64 = 5;
repeated float rpt_float = 6;
repeated double rpt_double = 7;
repeated string rpt_string = 8;
repeated bytes rpt_bytes = 9;
}
message Proto3Optional {
optional bool opt_bool = 1;
optional int32 opt_int32 = 2;
optional int64 opt_int64 = 3;
optional uint32 opt_uint32 = 4;
optional uint64 opt_uint64 = 5;
optional sint32 opt_sint32 = 12;
optional sint64 opt_sint64 = 13;
optional fixed32 opt_fixed32 = 14;
optional fixed64 opt_fixed64 = 15;
optional sfixed32 opt_sfixed32 = 16;
optional sfixed64 opt_sfixed64 = 17;
// Textproto marshal outputs fields in the same order as this proto
// definition regardless of field number. Following fields are intended to
// test that assumption.
optional float opt_float = 20;
optional double opt_double = 21;
optional bytes opt_bytes = 8;
optional string opt_string = 9;
optional Enum opt_enum = 10;
optional Nested opt_message = 11;
}
message OptionalEnums {
optional Enum opt_enum = 1;
enum NestedEnum {
CERO = 0;
UNO = 1;
DOS = 2;
DIEZ = 10;
}
NestedEnum opt_nested_enum = 3;
}
enum Enum {
ZERO = 0;
ONE = 1;
TWO = 2;
TEN = 10;
}
// Message contains enum fields.
message Enums {
Enum s_enum = 1;
enum NestedEnum {
CERO = 0;
UNO = 1;
DOS = 2;
DIEZ = 10;
}
NestedEnum s_nested_enum = 3;
}
// Message contains nested message field.
message Nests {
Nested s_nested = 2;
}
// Message type used as submessage.
message Nested {
string s_string = 1;
Nested s_nested = 2;
}
// Message contains oneof field.
message Oneofs {
oneof union {
Enum oneof_enum = 1;
string oneof_string = 2;
Nested oneof_nested = 3;
}
}
// Message contains map fields.
message Maps {
map<int32, string> int32_to_str = 1;
map<bool, uint32> bool_to_uint32 = 2;
map<uint64, Enum> uint64_to_enum = 3;
map<string, Nested> str_to_nested = 4;
map<string, Oneofs> str_to_oneofs = 5;
}
// Message for testing json_name option.
message JSONNames {
string s_string = 1 [json_name = "foo_bar"];
}
// Message contains reserved field name.
message ReservedFieldNames {
reserved "reserved_field";
int32 opt_int32 = 1;
}
|