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 google.protobuf; 34 35import "google/protobuf/any.proto"; 36import "google/protobuf/source_context.proto"; 37 38option cc_enable_arenas = true; 39option java_package = "com.google.protobuf"; 40option java_outer_classname = "TypeProto"; 41option java_multiple_files = true; 42option objc_class_prefix = "GPB"; 43option csharp_namespace = "Google.Protobuf.WellKnownTypes"; 44option go_package = "google.golang.org/protobuf/types/known/typepb"; 45 46// A protocol buffer message type. 47message Type { 48 // The fully qualified message name. 49 string name = 1; 50 // The list of fields. 51 repeated Field fields = 2; 52 // The list of types appearing in `oneof` definitions in this type. 53 repeated string oneofs = 3; 54 // The protocol buffer options. 55 repeated Option options = 4; 56 // The source context. 57 SourceContext source_context = 5; 58 // The source syntax. 59 Syntax syntax = 6; 60 // The source edition string, only valid when syntax is SYNTAX_EDITIONS. 61 string edition = 7; 62} 63 64// A single field of a message type. 65message Field { 66 // Basic field types. 67 enum Kind { 68 // Field type unknown. 69 TYPE_UNKNOWN = 0; 70 // Field type double. 71 TYPE_DOUBLE = 1; 72 // Field type float. 73 TYPE_FLOAT = 2; 74 // Field type int64. 75 TYPE_INT64 = 3; 76 // Field type uint64. 77 TYPE_UINT64 = 4; 78 // Field type int32. 79 TYPE_INT32 = 5; 80 // Field type fixed64. 81 TYPE_FIXED64 = 6; 82 // Field type fixed32. 83 TYPE_FIXED32 = 7; 84 // Field type bool. 85 TYPE_BOOL = 8; 86 // Field type string. 87 TYPE_STRING = 9; 88 // Field type group. Proto2 syntax only, and deprecated. 89 TYPE_GROUP = 10; 90 // Field type message. 91 TYPE_MESSAGE = 11; 92 // Field type bytes. 93 TYPE_BYTES = 12; 94 // Field type uint32. 95 TYPE_UINT32 = 13; 96 // Field type enum. 97 TYPE_ENUM = 14; 98 // Field type sfixed32. 99 TYPE_SFIXED32 = 15; 100 // Field type sfixed64. 101 TYPE_SFIXED64 = 16; 102 // Field type sint32. 103 TYPE_SINT32 = 17; 104 // Field type sint64. 105 TYPE_SINT64 = 18; 106 } 107 108 // Whether a field is optional, required, or repeated. 109 enum Cardinality { 110 // For fields with unknown cardinality. 111 CARDINALITY_UNKNOWN = 0; 112 // For optional fields. 113 CARDINALITY_OPTIONAL = 1; 114 // For required fields. Proto2 syntax only. 115 CARDINALITY_REQUIRED = 2; 116 // For repeated fields. 117 CARDINALITY_REPEATED = 3; 118 } 119 120 // The field type. 121 Kind kind = 1; 122 // The field cardinality. 123 Cardinality cardinality = 2; 124 // The field number. 125 int32 number = 3; 126 // The field name. 127 string name = 4; 128 // The field type URL, without the scheme, for message or enumeration 129 // types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`. 130 string type_url = 6; 131 // The index of the field type in `Type.oneofs`, for message or enumeration 132 // types. The first type has index 1; zero means the type is not in the list. 133 int32 oneof_index = 7; 134 // Whether to use alternative packed wire representation. 135 bool packed = 8; 136 // The protocol buffer options. 137 repeated Option options = 9; 138 // The field JSON name. 139 string json_name = 10; 140 // The string value of the default value of this field. Proto2 syntax only. 141 string default_value = 11; 142} 143 144// Enum type definition. 145message Enum { 146 // Enum type name. 147 string name = 1; 148 // Enum value definitions. 149 repeated EnumValue enumvalue = 2; 150 // Protocol buffer options. 151 repeated Option options = 3; 152 // The source context. 153 SourceContext source_context = 4; 154 // The source syntax. 155 Syntax syntax = 5; 156 // The source edition string, only valid when syntax is SYNTAX_EDITIONS. 157 string edition = 6; 158} 159 160// Enum value definition. 161message EnumValue { 162 // Enum value name. 163 string name = 1; 164 // Enum value number. 165 int32 number = 2; 166 // Protocol buffer options. 167 repeated Option options = 3; 168} 169 170// A protocol buffer option, which can be attached to a message, field, 171// enumeration, etc. 172message Option { 173 // The option's name. For protobuf built-in options (options defined in 174 // descriptor.proto), this is the short name. For example, `"map_entry"`. 175 // For custom options, it should be the fully-qualified name. For example, 176 // `"google.api.http"`. 177 string name = 1; 178 // The option's value packed in an Any message. If the value is a primitive, 179 // the corresponding wrapper type defined in google/protobuf/wrappers.proto 180 // should be used. If the value is an enum, it should be stored as an int32 181 // value using the google.protobuf.Int32Value type. 182 Any value = 2; 183} 184 185// The syntax in which a protocol buffer element is defined. 186enum Syntax { 187 // Syntax `proto2`. 188 SYNTAX_PROTO2 = 0; 189 // Syntax `proto3`. 190 SYNTAX_PROTO3 = 1; 191 // Syntax `editions`. 192 SYNTAX_EDITIONS = 2; 193} 194