blob: 3a6a458a38fbf03357e3632de496853b246ad38f [file] [log] [blame]
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License
syntax = "proto2";
package tests;
// NOTE: The generated headers for this file have been included
// in the tests folder to simplify the build process (no need to
// have protoc available to compile this file). As a result, if
// there are any changes to this file, the headers must be
// re-generated and committed alongside changes to this file.
// There is a TODO in protobuf_tests.cpp that demonstrates how
// to avoid the need for this file entirely by generating a
// dynamic message at run-time.
enum Enum {
UNKNOWN = 0;
ONE = 1;
TWO = 2;
}
message Nested {
required string str = 1;
optional string optional_str = 2;
repeated string repeated_str = 3;
}
// A simple message for testing Proto->JSON conversion.
message SimpleMessage {
required string id = 1;
repeated int32 numbers = 2;
}
// An elaborate message for testing Proto->JSON conversion.
message Message {
required bool b = 26;
required string str = 1;
required bytes bytes = 2;
optional int32 int32 = 3;
optional int64 int64 = 4;
optional uint32 uint32 = 5;
optional uint64 uint64 = 6;
optional sint32 sint32 = 7;
optional sint64 sint64 = 8;
required float f = 9;
required double d = 10;
required Enum e = 11;
required Nested nested = 12;
repeated bool repeated_bool = 27;
repeated string repeated_string = 13;
repeated bytes repeated_bytes = 14;
repeated int32 repeated_int32 = 15;
repeated int64 repeated_int64 = 16;
repeated uint32 repeated_uint32 = 17;
repeated uint64 repeated_uint64 = 18;
repeated sint32 repeated_sint32 = 19;
repeated sint64 repeated_sint64 = 20;
repeated float repeated_float = 21;
repeated double repeated_double = 22;
repeated Enum repeated_enum = 23;
repeated Nested repeated_nested = 24;
repeated string empty = 25;
optional double optional_default = 28 [default = 42.0];
optional double optional_no_default = 29;
}
// A message for testing Proto->JSON conversion.
message ArrayMessage {
repeated SimpleMessage values = 1;
}
// A message for testing optional enum field.
message EnumMessage {
optional Enum e1 = 1;
optional Enum e2 = 2;
repeated Enum repeated_enum = 3;
}
// A message for testing map.
message MapMessage {
map<string, string> string_to_string = 1;
map<string, bool> string_to_bool = 2;
map<string, bytes> string_to_bytes = 3;
map<string, int32> string_to_int32 = 4;
map<string, int64> string_to_int64 = 5;
map<string, uint32> string_to_uint32 = 6;
map<string, uint64> string_to_uint64 = 7;
map<string, sint32> string_to_sint32 = 8;
map<string, sint64> string_to_sint64 = 9;
map<string, float> string_to_float = 10;
map<string, double> string_to_double = 11;
map<string, Enum> string_to_enum = 12;
map<string, Nested> string_to_nested = 13;
map<bool, string> bool_to_string = 14;
map<int32, string> int32_to_string = 15;
map<int64, string> int64_to_string = 16;
map<uint32,string> uint32_to_string = 17;
map<uint64, string> uint64_to_string = 18;
map<sint32, string> sint32_to_string = 19;
map<sint64, string> sint64_to_string = 20;
}
// A message for testing infinite floating point numbers.
message FloatMessage {
required float f1 = 1;
required float f2 = 2;
required double d1 = 3;
required double d2 = 4;
}