1// Protocol Buffers - Google's data interchange format 2// Copyright 2008 Google Inc. All rights reserved. 3// 4// Use of this source code is governed by a BSD-style 5// license that can be found in the LICENSE file or at 6// https://developers.google.com/open-source/licenses/bsd 7 8// Author: kenton@google.com (Kenton Varda) 9// Based on original Protocol Buffers design by 10// Sanjay Ghemawat, Jeff Dean, and others. 11// 12// A proto file we will use for unit testing. 13 14syntax = "proto2"; 15 16package protobuf_unittest; 17 18message TestFlagsAndStrings { 19 required int32 A = 1; 20 repeated group RepeatedGroup = 2 { 21 required string f = 3; 22 } 23} 24 25message TestBase64ByteArrays { 26 required bytes a = 1; 27} 28 29message TestJavaScriptJSON { 30 optional int32 a = 1; 31 optional float final = 2; 32 optional string in = 3; 33 optional string Var = 4; 34} 35 36message TestJavaScriptOrderJSON1 { 37 optional int32 d = 1; 38 optional int32 c = 2; 39 optional bool x = 3; 40 optional int32 b = 4; 41 optional int32 a = 5; 42} 43 44message TestJavaScriptOrderJSON2 { 45 optional int32 d = 1; 46 optional int32 c = 2; 47 optional bool x = 3; 48 optional int32 b = 4; 49 optional int32 a = 5; 50 repeated TestJavaScriptOrderJSON1 z = 6; 51} 52 53message TestLargeInt { 54 required int64 a = 1; 55 required uint64 b = 2; 56} 57 58message TestNumbers { 59 enum MyType { 60 OK = 0; 61 WARNING = 1; 62 ERROR = 2; 63 } 64 optional MyType a = 1; 65 optional int32 b = 2; 66 optional float c = 3; 67 optional bool d = 4; 68 optional double e = 5; 69 optional uint32 f = 6; 70} 71 72message TestCamelCase { 73 optional string normal_field = 1; 74 optional int32 CAPITAL_FIELD = 2; 75 optional int32 CamelCaseField = 3; 76} 77 78message TestBoolMap { 79 map<bool, int32> bool_map = 1; 80} 81 82message TestRecursion { 83 optional int32 value = 1; 84 optional TestRecursion child = 2; 85} 86 87message TestStringMap { 88 map<string, string> string_map = 1; 89} 90 91message TestStringSerializer { 92 optional string scalar_string = 1; 93 repeated string repeated_string = 2; 94 map<string, string> string_map = 3; 95} 96 97message TestMessageWithExtension { 98 extensions 100 to max; 99} 100 101message TestExtension { 102 extend TestMessageWithExtension { 103 optional TestExtension ext = 100; 104 optional EnumValue enum_ext = 101; 105 } 106 optional string value = 1; 107} 108 109enum EnumValue { 110 PROTOCOL = 0; 111 BUFFER = 1; 112 DEFAULT = 2; 113} 114 115message TestDefaultEnumValue { 116 optional EnumValue enum_value = 1 [default = DEFAULT]; 117} 118 119message TestMapOfEnums { 120 map<string, EnumValue> enum_map = 1; 121} 122 123message TestRepeatedEnum { 124 repeated EnumValue repeated_enum = 1; 125} 126