Skip to content

Commit

Permalink
Update upstream proto files on the 1.x branch.
Browse files Browse the repository at this point in the history
Using 4eeaa22312a6e8f99ec5862155a52c55f16e0f5c.

Skipping files moved to Editions already since that isn't supported for generation yet.
  • Loading branch information
thomasvl committed Dec 4, 2023
1 parent 65e8f29 commit 0a2fdf9
Show file tree
Hide file tree
Showing 89 changed files with 18,593 additions and 19,319 deletions.
29 changes: 3 additions & 26 deletions Protos/Conformance/google/protobuf/test_messages_proto2.proto
Original file line number Diff line number Diff line change
@@ -1,32 +1,9 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// 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
//
// Test schema for proto2 messages. This test schema is used by:
//
Expand Down
29 changes: 3 additions & 26 deletions Protos/Conformance/google/protobuf/test_messages_proto3.proto
Original file line number Diff line number Diff line change
@@ -1,32 +1,9 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// 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
//
// Test schema for proto3 messages. This test schema is used by:
//
Expand Down
101 changes: 63 additions & 38 deletions Protos/SwiftProtobuf/google/protobuf/descriptor.proto
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ enum Edition {
// A placeholder for an unknown edition value.
EDITION_UNKNOWN = 0;

// Legacy syntax "editions". These pre-date editions, but behave much like
// distinct editions. These can't be used to specify the edition of proto
// files, but feature definitions must supply proto2/proto3 defaults for
// backwards compatibility.
EDITION_PROTO2 = 998;
EDITION_PROTO3 = 999;

// Editions that have been released. The specific values are arbitrary and
// should not be depended on, but they will always be time-ordered for easy
// comparison.
Expand All @@ -74,6 +81,11 @@ enum Edition {
EDITION_99997_TEST_ONLY = 99997;
EDITION_99998_TEST_ONLY = 99998;
EDITION_99999_TEST_ONLY = 99999;

// Placeholder for specifying unbounded edition support. This should only
// ever be used by plugins that can expect to never require any changes to
// support a new edition.
EDITION_MAX = 0x7FFFFFFF;
}

// Describes a complete .proto file.
Expand Down Expand Up @@ -109,12 +121,8 @@ message FileDescriptorProto {
// If `edition` is present, this value must be "editions".
optional string syntax = 12;

// The edition of the proto file, which is an opaque string.
// TODO(b/297898292) Deprecate and remove this field in favor of enums.
optional string edition = 13;

// The edition of the proto file.
optional Edition edition_enum = 14;
optional Edition edition = 14;
}

// Describes a message type.
Expand Down Expand Up @@ -197,9 +205,10 @@ message ExtensionRangeOptions {
}

// The verification state of the range.
// TODO(b/278783756): flip the default to DECLARATION once all empty ranges
// TODO: flip the default to DECLARATION once all empty ranges
// are marked as UNVERIFIED.
optional VerificationState verification = 3 [default = UNVERIFIED];
optional VerificationState verification = 3
[default = UNVERIFIED, retention = RETENTION_SOURCE];

// Clients can define custom options in extensions of this message. See above.
extensions 1000 to max;
Expand All @@ -224,9 +233,10 @@ message FieldDescriptorProto {
TYPE_BOOL = 8;
TYPE_STRING = 9;
// Tag-delimited aggregate.
// Group type is deprecated and not supported in proto3. However, Proto3
// Group type is deprecated and not supported after google.protobuf. However, Proto3
// implementations should still be able to parse the group wire format and
// treat group fields as unknown fields.
// treat group fields as unknown fields. In Editions, the group wire format
// can be enabled via the `message_encoding` feature.
TYPE_GROUP = 10;
TYPE_MESSAGE = 11; // Length-delimited aggregate.

Expand All @@ -243,8 +253,11 @@ message FieldDescriptorProto {
enum Label {
// 0 is reserved for errors
LABEL_OPTIONAL = 1;
LABEL_REQUIRED = 2;
LABEL_REPEATED = 3;
// The required label is only allowed in google.protobuf. In proto3 and Editions
// it's explicitly prohibited. In Editions, the `field_presence` feature
// can be used to get this behavior.
LABEL_REQUIRED = 2;
}

optional string name = 1;
Expand Down Expand Up @@ -287,12 +300,12 @@ message FieldDescriptorProto {
// If true, this is a proto3 "optional". When a proto3 field is optional, it
// tracks presence regardless of field type.
//
// When proto3_optional is true, this field must be belong to a oneof to
// signal to old proto3 clients that presence is tracked for this field. This
// oneof is known as a "synthetic" oneof, and this field must be its sole
// member (each proto3 optional field gets its own synthetic oneof). Synthetic
// oneofs exist in the descriptor only, and do not generate any API. Synthetic
// oneofs must be ordered after all "real" oneofs.
// When proto3_optional is true, this field must belong to a oneof to signal
// to old proto3 clients that presence is tracked for this field. This oneof
// is known as a "synthetic" oneof, and this field must be its sole member
// (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs
// exist in the descriptor only, and do not generate any API. Synthetic oneofs
// must be ordered after all "real" oneofs.
//
// For message fields, proto3_optional doesn't create any semantic change,
// since non-repeated message fields always track presence. However it still
Expand Down Expand Up @@ -597,7 +610,7 @@ message MessageOptions {
// This should only be used as a temporary measure against broken builds due
// to the change in behavior for JSON field name conflicts.
//
// TODO(b/261750190) This is legacy behavior we plan to remove once downstream
// TODO This is legacy behavior we plan to remove once downstream
// teams have had time to migrate.
optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true];

Expand Down Expand Up @@ -637,7 +650,9 @@ message FieldOptions {
// a more efficient representation on the wire. Rather than repeatedly
// writing the tag and type for each element, the entire array is encoded as
// a single length-delimited blob. In proto3, only explicit setting it to
// false will avoid using packed encoding.
// false will avoid using packed encoding. This option is prohibited in
// Editions, but the `repeated_field_encoding` feature can be used to control
// the behavior.
optional bool packed = 2;

// The jstype option determines the JavaScript type used for values of the
Expand Down Expand Up @@ -744,9 +759,7 @@ message FieldOptions {
repeated OptionTargetType targets = 19;

message EditionDefault {
// TODO(b/297898292) Deprecate and remove this field in favor of enums.
optional string edition = 1;
optional Edition edition_enum = 3;
optional Edition edition = 3;
optional string value = 2; // Textproto value.
}
repeated EditionDefault edition_defaults = 20;
Expand Down Expand Up @@ -793,7 +806,7 @@ message EnumOptions {
// and strips underscored from the fields before comparison in proto3 only.
// The new behavior takes `json_name` into account and applies to proto2 as
// well.
// TODO(b/261750190) Remove this legacy behavior once downstream teams have
// TODO Remove this legacy behavior once downstream teams have
// had time to migrate.
optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true];

Expand Down Expand Up @@ -917,7 +930,7 @@ message UninterpretedOption {
// ===================================================================
// Features

// TODO(b/274655146) Enums in C++ gencode (and potentially other languages) are
// TODO Enums in C++ gencode (and potentially other languages) are
// not well scoped. This means that each of the feature enums below can clash
// with each other. The short names we've chosen maximize call-site
// readability, but leave us very open to this scenario. A future feature will
Expand All @@ -934,7 +947,9 @@ message FeatureSet {
retention = RETENTION_RUNTIME,
targets = TARGET_TYPE_FIELD,
targets = TARGET_TYPE_FILE,
edition_defaults = { edition_enum: EDITION_2023, value: "EXPLICIT" }
edition_defaults = { edition: EDITION_PROTO2, value: "EXPLICIT" },
edition_defaults = { edition: EDITION_PROTO3, value: "IMPLICIT" },
edition_defaults = { edition: EDITION_2023, value: "EXPLICIT" }
];

enum EnumType {
Expand All @@ -946,7 +961,8 @@ message FeatureSet {
retention = RETENTION_RUNTIME,
targets = TARGET_TYPE_ENUM,
targets = TARGET_TYPE_FILE,
edition_defaults = { edition_enum: EDITION_2023, value: "OPEN" }
edition_defaults = { edition: EDITION_PROTO2, value: "CLOSED" },
edition_defaults = { edition: EDITION_PROTO3, value: "OPEN" }
];

enum RepeatedFieldEncoding {
Expand All @@ -958,7 +974,21 @@ message FeatureSet {
retention = RETENTION_RUNTIME,
targets = TARGET_TYPE_FIELD,
targets = TARGET_TYPE_FILE,
edition_defaults = { edition_enum: EDITION_2023, value: "PACKED" }
edition_defaults = { edition: EDITION_PROTO2, value: "EXPANDED" },
edition_defaults = { edition: EDITION_PROTO3, value: "PACKED" }
];

enum Utf8Validation {
UTF8_VALIDATION_UNKNOWN = 0;
VERIFY = 2;
NONE = 3;
}
optional Utf8Validation utf8_validation = 4 [
retention = RETENTION_RUNTIME,
targets = TARGET_TYPE_FIELD,
targets = TARGET_TYPE_FILE,
edition_defaults = { edition: EDITION_PROTO2, value: "NONE" },
edition_defaults = { edition: EDITION_PROTO3, value: "VERIFY" }
];

enum MessageEncoding {
Expand All @@ -970,7 +1000,7 @@ message FeatureSet {
retention = RETENTION_RUNTIME,
targets = TARGET_TYPE_FIELD,
targets = TARGET_TYPE_FILE,
edition_defaults = { edition_enum: EDITION_2023, value: "LENGTH_PREFIXED" }
edition_defaults = { edition: EDITION_PROTO2, value: "LENGTH_PREFIXED" }
];

enum JsonFormat {
Expand All @@ -983,10 +1013,11 @@ message FeatureSet {
targets = TARGET_TYPE_MESSAGE,
targets = TARGET_TYPE_ENUM,
targets = TARGET_TYPE_FILE,
edition_defaults = { edition_enum: EDITION_2023, value: "ALLOW" }
edition_defaults = { edition: EDITION_PROTO2, value: "LEGACY_BEST_EFFORT" },
edition_defaults = { edition: EDITION_PROTO3, value: "ALLOW" }
];

reserved 4, 999;
reserved 999;

extensions 1000; // for Protobuf C++
extensions 1001; // for Protobuf Java
Expand All @@ -1004,24 +1035,18 @@ message FeatureSetDefaults {
// the defaults at the closest matching edition ordered at or before it should
// be used. This field must be in strict ascending order by edition.
message FeatureSetEditionDefault {
// TODO(b/297898292) Deprecate and remove this field in favor of enums.
optional string edition = 1;
optional Edition edition_enum = 3;
optional Edition edition = 3;
optional FeatureSet features = 2;
}
repeated FeatureSetEditionDefault defaults = 1;

// TODO(b/297898292) Deprecate and remove these fields in favor of enums.
optional string minimum_edition = 2;
optional string maximum_edition = 3;

// The minimum supported edition (inclusive) when this was constructed.
// Editions before this will not have defaults.
optional Edition minimum_edition_enum = 4;
optional Edition minimum_edition = 4;

// The maximum known edition (inclusive) when this was constructed. Editions
// after this will not have reliable defaults.
optional Edition maximum_edition_enum = 5;
optional Edition maximum_edition = 5;
}

// ===================================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,18 @@ message CodeGeneratorResponse {
FEATURE_SUPPORTS_EDITIONS = 2;
}

// The minimum edition this plugin supports. This will be treated as an
// Edition enum, but we want to allow unknown values. It should be specified
// according the edition enum value, *not* the edition number. Only takes
// effect for plugins that have FEATURE_SUPPORTS_EDITIONS set.
optional int32 minimum_edition = 3;

// The maximum edition this plugin supports. This will be treated as an
// Edition enum, but we want to allow unknown values. It should be specified
// according the edition enum value, *not* the edition number. Only takes
// effect for plugins that have FEATURE_SUPPORTS_EDITIONS set.
optional int32 maximum_edition = 4;

// Represents a single generated file.
message File {
// The file name, relative to the output directory. The name must not
Expand Down
Loading

0 comments on commit 0a2fdf9

Please sign in to comment.