diff --git a/wire-schema/src/jvmMain/resources/google/protobuf/descriptor.proto b/wire-schema/src/jvmMain/resources/google/protobuf/descriptor.proto index 17f23b20e3..89c4891fea 100644 --- a/wire-schema/src/jvmMain/resources/google/protobuf/descriptor.proto +++ b/wire-schema/src/jvmMain/resources/google/protobuf/descriptor.proto @@ -1,32 +1,9 @@ // Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// Copyright 2008 Google LLC. All rights reserved. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd // Author: kenton@google.com (Kenton Varda) // Based on original Protocol Buffers design by @@ -85,6 +62,7 @@ enum Edition { // comparison. EDITION_2023 = 1000; EDITION_2024 = 1001; + EDITION_2026 = 1002; // A placeholder edition for developing and testing unscheduled features. EDITION_UNSTABLE = 9999; @@ -189,6 +167,9 @@ message DescriptorProto { } message ExtensionRangeOptions { + // Range reserved for first-class custom options defined by the Protobuf + // team. User custom options must use the 1000+ range instead. + extensions 990 to 998; // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -583,6 +564,14 @@ message FileOptions { // developers should rely on the protoreflect APIs for their client language. optional FeatureSet features = 50; + // Range reserved for first-class custom options defined by the Protobuf + // team. User custom options must use the 1000+ range instead. + extensions 990 to 998 [declaration = { + number: 990, + full_name: ".pb.file.cpp", + type: ".pb.file.CppFileOptions" + }]; + // The parser stores options it doesn't recognize here. // See the documentation for the "Options" section above. repeated UninterpretedOption uninterpreted_option = 999; @@ -672,6 +661,10 @@ message MessageOptions { // developers should rely on the protoreflect APIs for their client language. optional FeatureSet features = 12; + // Range reserved for first-class custom options defined by the Protobuf + // team. User custom options must use the 1000+ range instead. + extensions 990 to 998; + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -842,6 +835,10 @@ message FieldOptions { } optional FeatureSupport feature_support = 22; + // Range reserved for first-class custom options defined by the Protobuf + // team. User custom options must use the 1000+ range instead. + extensions 990 to 998; + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -859,6 +856,10 @@ message OneofOptions { // developers should rely on the protoreflect APIs for their client language. optional FeatureSet features = 1; + // Range reserved for first-class custom options defined by the Protobuf + // team. User custom options must use the 1000+ range instead. + extensions 990 to 998; + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -894,6 +895,10 @@ message EnumOptions { // developers should rely on the protoreflect APIs for their client language. optional FeatureSet features = 7; + // Range reserved for first-class custom options defined by the Protobuf + // team. User custom options must use the 1000+ range instead. + extensions 990 to 998; + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -922,6 +927,14 @@ message EnumValueOptions { // Information about the support window of a feature value. optional FieldOptions.FeatureSupport feature_support = 4; + // Range reserved for first-class extension options defined by the Protobuf + // team. Custom options must use the 1000+ range instead. + extensions 990 to 998 [declaration = { + number: 998, + full_name: ".pb.enumvalue.json", + type: ".pb.enumvalue.JsonEnumValueOptions" + }]; + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -948,6 +961,10 @@ message ServiceOptions { // this is a formalization for deprecating services. optional bool deprecated = 33 [default = false]; + // Range reserved for first-class custom options defined by the Protobuf + // team. User custom options must use the 1000+ range instead. + extensions 990 to 998; + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -985,6 +1002,10 @@ message MethodOptions { // developers should rely on the protoreflect APIs for their client language. optional FeatureSet features = 35; + // Range reserved for first-class custom options defined by the Protobuf + // team. User custom options must use the 1000+ range instead. + extensions 990 to 998; + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -1133,6 +1154,7 @@ message FeatureSet { ENFORCE_NAMING_STYLE_UNKNOWN = 0; STYLE2024 = 1; STYLE_LEGACY = 2; + STYLE2026 = 3; } optional EnforceNamingStyle enforce_naming_style = 7 [ retention = RETENTION_SOURCE, @@ -1149,7 +1171,8 @@ message FeatureSet { edition_introduced: EDITION_2024, }, edition_defaults = { edition: EDITION_LEGACY, value: "STYLE_LEGACY" }, - edition_defaults = { edition: EDITION_2024, value: "STYLE2024" } + edition_defaults = { edition: EDITION_2024, value: "STYLE2024" }, + edition_defaults = { edition: EDITION_2026, value: "STYLE2026" } ]; message VisibilityFeature { @@ -1183,6 +1206,37 @@ message FeatureSet { edition_defaults = { edition: EDITION_2024, value: "EXPORT_TOP_LEVEL" } ]; + message ProtoLimitsFeature { + enum EnforceProtoLimits { + PROTO_LIMITS_UNKNOWN = 0; + + // Default pre-EDITION_2026: there are no limit enforcement at the protoc + // level. Practical limits still exist, but they will tend to fail while + // compiling protoc-generated code, and these limits tend to be language + // or toolchain specific. + LEGACY_NO_EXPLICIT_LIMITS = 1; + + // A set of limits enforced by Edition 2026 by default. For a detailed + // list of all the limits please consult the Edition 2026 documentation. + PROTO_LIMITS2026 = 2; + } + } + optional ProtoLimitsFeature.EnforceProtoLimits enforce_proto_limits = 9 [ + retention = RETENTION_SOURCE, + targets = TARGET_TYPE_ENUM, + targets = TARGET_TYPE_MESSAGE, + targets = TARGET_TYPE_FIELD, + targets = TARGET_TYPE_ONEOF, + feature_support = { + edition_introduced: EDITION_2026, + }, + edition_defaults = { + edition: EDITION_LEGACY, + value: "LEGACY_NO_EXPLICIT_LIMITS" + }, + edition_defaults = { edition: EDITION_2026, value: "PROTO_LIMITS2026" } + ]; + reserved 999; extensions 1000 to 9994 [ diff --git a/wire-schema/src/jvmMain/resources/google/protobuf/struct.proto b/wire-schema/src/jvmMain/resources/google/protobuf/struct.proto index 1bf0c1ad95..a03667da4e 100644 --- a/wire-schema/src/jvmMain/resources/google/protobuf/struct.proto +++ b/wire-schema/src/jvmMain/resources/google/protobuf/struct.proto @@ -40,55 +40,71 @@ option java_multiple_files = true; option objc_class_prefix = "GPB"; option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -// `Struct` represents a structured data value, consisting of fields -// which map to dynamically typed values. In some languages, `Struct` -// might be supported by a native representation. For example, in -// scripting languages like JS a struct is represented as an -// object. The details of that representation are described together -// with the proto support for the language. +// Represents a JSON object. // -// The JSON representation for `Struct` is JSON object. +// An unordered key-value map, intending to perfectly capture the semantics of a +// JSON object. This enables parsing any arbitrary JSON payload as a message +// field in ProtoJSON format. +// +// This follows RFC 8259 guidelines for interoperable JSON: notably this type +// cannot represent large Int64 values or `NaN`/`Infinity` numbers, +// since the JSON format generally does not support those values in its number +// type. +// +// If you do not intend to parse arbitrary JSON into your message, a custom +// typed message should be preferred instead of using this type. message Struct { // Unordered map of dynamically typed values. map fields = 1; } +// Represents a JSON value. +// // `Value` represents a dynamically typed value which can be either // null, a number, a string, a boolean, a recursive struct value, or a // list of values. A producer of value is expected to set one of these -// variants. Absence of any variant indicates an error. -// -// The JSON representation for `Value` is JSON value. +// variants. Absence of any variant is an invalid state. message Value { // The kind of value. oneof kind { - // Represents a null value. + // Represents a JSON `null`. NullValue null_value = 1; - // Represents a double value. + + // Represents a JSON number. Must not be `NaN`, `Infinity` or + // `-Infinity`, since those are not supported in JSON. This also cannot + // represent large Int64 values, since JSON format generally does not + // support them in its number type. double number_value = 2; - // Represents a string value. + + // Represents a JSON string. string string_value = 3; - // Represents a boolean value. + + // Represents a JSON boolean (`true` or `false` literal in JSON). bool bool_value = 4; - // Represents a structured value. + + // Represents a JSON object. Struct struct_value = 5; - // Represents a repeated `Value`. + + // Represents a JSON array. ListValue list_value = 6; } } -// `NullValue` is a singleton enumeration to represent the null value for the -// `Value` type union. +// Represents a JSON `null`. // -// The JSON representation for `NullValue` is JSON `null`. +// `NullValue` is a sentinel, using an enum with only one value to represent +// the null value for the `Value` type union. +// +// A field of type `NullValue` with any value other than `0` is considered +// invalid. Most ProtoJSON serializers will emit a Value with a `null_value` set +// as a JSON `null` regardless of the integer value, and so will round trip to +// a `0` value. enum NullValue { // Null value. NULL_VALUE = 0; } -// `ListValue` is a wrapper around a repeated field of values. -// -// The JSON representation for `ListValue` is JSON array. +// Represents a JSON array. message ListValue { // Repeated field of dynamically typed values. repeated Value values = 1;