1// Protocol Buffers - Google's data interchange format 2// Copyright 2008 Google Inc. All rights reserved. 3// https://developers.google.com/protocol-buffers/ 4// 5// Redistribution and use in source and binary forms, with or without 6// modification, are permitted provided that the following conditions are 7// met: 8// 9// * Redistributions of source code must retain the above copyright 10// notice, this list of conditions and the following disclaimer. 11// * Redistributions in binary form must reproduce the above 12// copyright notice, this list of conditions and the following disclaimer 13// in the documentation and/or other materials provided with the 14// distribution. 15// * Neither the name of Google Inc. nor the names of its 16// contributors may be used to endorse or promote products derived from 17// this software without specific prior written permission. 18// 19// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 31syntax = "proto3"; 32 33package proto3; 34 35 36import "google/protobuf/duration.proto"; 37import "google/protobuf/timestamp.proto"; 38import "google/protobuf/wrappers.proto"; 39import "google/protobuf/struct.proto"; 40import "google/protobuf/any.proto"; 41import "google/protobuf/field_mask.proto"; 42 43enum EnumType { 44 FOO = 0; 45 BAR = 1; 46} 47 48message MessageType { 49 int32 value = 1; 50} 51 52message TestMessage { 53 bool bool_value = 1; 54 int32 int32_value = 2; 55 int64 int64_value = 3; 56 uint32 uint32_value = 4; 57 uint64 uint64_value = 5; 58 float float_value = 6; 59 double double_value = 7; 60 string string_value = 8; 61 bytes bytes_value = 9; 62 EnumType enum_value = 10; 63 MessageType message_value = 11; 64 65 repeated bool repeated_bool_value = 21; 66 repeated int32 repeated_int32_value = 22; 67 repeated int64 repeated_int64_value = 23; 68 repeated uint32 repeated_uint32_value = 24; 69 repeated uint64 repeated_uint64_value = 25; 70 repeated float repeated_float_value = 26; 71 repeated double repeated_double_value = 27; 72 repeated string repeated_string_value = 28; 73 repeated bytes repeated_bytes_value = 29; 74 repeated EnumType repeated_enum_value = 30; 75 repeated MessageType repeated_message_value = 31; 76} 77 78message TestOneof { 79 // In JSON format oneof fields behave mostly the same as optional 80 // fields except that: 81 // 1. Oneof fields have field presence information and will be 82 // printed if it's set no matter whether it's the default value. 83 // 2. Multiple oneof fields in the same oneof cannot appear at the 84 // same time in the input. 85 oneof oneof_value { 86 int32 oneof_int32_value = 1; 87 string oneof_string_value = 2; 88 bytes oneof_bytes_value = 3; 89 EnumType oneof_enum_value = 4; 90 MessageType oneof_message_value = 5; 91 } 92} 93 94message TestMap { 95 map<bool, int32> bool_map = 1; 96 map<int32, int32> int32_map = 2; 97 map<int64, int32> int64_map = 3; 98 map<uint32, int32> uint32_map = 4; 99 map<uint64, int32> uint64_map = 5; 100 map<string, int32> string_map = 6; 101} 102 103message TestNestedMap { 104 map<bool, int32> bool_map = 1; 105 map<int32, int32> int32_map = 2; 106 map<int64, int32> int64_map = 3; 107 map<uint32, int32> uint32_map = 4; 108 map<uint64, int32> uint64_map = 5; 109 map<string, int32> string_map = 6; 110 map<string, TestNestedMap> map_map = 7; 111} 112 113message TestWrapper { 114 google.protobuf.BoolValue bool_value = 1; 115 google.protobuf.Int32Value int32_value = 2; 116 google.protobuf.Int64Value int64_value = 3; 117 google.protobuf.UInt32Value uint32_value = 4; 118 google.protobuf.UInt64Value uint64_value = 5; 119 google.protobuf.FloatValue float_value = 6; 120 google.protobuf.DoubleValue double_value = 7; 121 google.protobuf.StringValue string_value = 8; 122 google.protobuf.BytesValue bytes_value = 9; 123 124 repeated google.protobuf.BoolValue repeated_bool_value = 11; 125 repeated google.protobuf.Int32Value repeated_int32_value = 12; 126 repeated google.protobuf.Int64Value repeated_int64_value = 13; 127 repeated google.protobuf.UInt32Value repeated_uint32_value = 14; 128 repeated google.protobuf.UInt64Value repeated_uint64_value = 15; 129 repeated google.protobuf.FloatValue repeated_float_value = 16; 130 repeated google.protobuf.DoubleValue repeated_double_value = 17; 131 repeated google.protobuf.StringValue repeated_string_value = 18; 132 repeated google.protobuf.BytesValue repeated_bytes_value = 19; 133} 134 135message TestTimestamp { 136 google.protobuf.Timestamp value = 1; 137 repeated google.protobuf.Timestamp repeated_value = 2; 138} 139 140message TestDuration { 141 google.protobuf.Duration value = 1; 142 repeated google.protobuf.Duration repeated_value = 2; 143} 144 145message TestFieldMask { 146 google.protobuf.FieldMask value = 1; 147} 148 149message TestStruct { 150 google.protobuf.Struct value = 1; 151 repeated google.protobuf.Struct repeated_value = 2; 152} 153 154message TestAny { 155 google.protobuf.Any value = 1; 156 repeated google.protobuf.Any repeated_value = 2; 157} 158 159message TestValue { 160 google.protobuf.Value value = 1; 161 repeated google.protobuf.Value repeated_value = 2; 162} 163 164message TestListValue { 165 google.protobuf.ListValue value = 1; 166 repeated google.protobuf.ListValue repeated_value = 2; 167} 168 169message TestBoolValue { 170 bool bool_value = 1; 171 map<bool, int32> bool_map = 2; 172} 173 174message TestCustomJsonName { 175 int32 value = 1 [json_name = "@value"]; 176} 177