initial commit

This commit is contained in:
2025-09-01 22:12:29 +02:00
parent b1873f9c1d
commit 02a54f61c0
5598 changed files with 903558 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
syntax = "proto2";
package protobuf_editions_test.proto2;
enum Proto2Enum {
BAR = 1;
BAZ = 2;
}
message Proto2EnumMessage {
optional Proto2Enum enum_field = 1;
optional Proto2Enum enum_field_default = 2 [default = BAZ];
enum Proto2NestedEnum {
FOO = 1;
BAT = 2;
}
optional Proto2NestedEnum nested_enum_field = 3;
optional Proto2NestedEnum nested_enum_field_default = 4 [default = BAT];
}

View File

@@ -0,0 +1,18 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
syntax = "proto2";
package protobuf_editions_test.proto2;
// LINT: ALLOW_GROUPS
message Proto2Group {
optional group Groupfield = 2 {
optional int32 int32_field = 1;
}
}

View File

@@ -0,0 +1,16 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
syntax = "proto2";
package protobuf_editions_test.proto2;
import "google/protobuf/editions/codegen_tests/proto2_optional.proto";
message Proto2ImportMessage {
optional Proto2Optional sub_message_field = 1;
}

View File

@@ -0,0 +1,33 @@
// This is a detached leading comment
//
// With a forced unwrapped line.
// File detached leading comment
// Syntax leading comment
syntax = "proto2"; // Syntax trailing comment
// Package leading comment
package protobuf_editions_test.proto2; // Package trailing comment
// Leading message comment
message Foo { // Message trailing comment
// Message inner comment
// Field leading comment
optional int32 field1 = 1; // Field trailing comment
optional /* card */ int32 /* type */ field2 /* name */ = 2 /* tag */;
// Message inner trailing comment
} // Message trailing comment
// Leading message comment
enum Bar { // Enum trailing comment
// Enum inner comment
// Enum value leading comment
BAR_UNKNOWN = 0; // Enum value trailing comment
// Enum inner trailing comment
} // Enum trailing comment

View File

@@ -0,0 +1,33 @@
syntax = "proto2";
package protobuf_editions_test.proto2;
/**
Multiline message comment - no asterisk
*/
message Message1 {
/**
Multiline field comment - no asterisk
*/
optional string field = 1;
}
/*
* Multiline message comment - single asterisk
*/
message Message2 {
/*
* Multiline message comment - single asterisk
*/
optional string field = 1;
}
/**
* Exactly one trait must be set. Extension # is vendor_id + 1.
*/
message Message3 {
/**
* Exactly one trait must be set. Extension # is vendor_id + 1.
*/
optional string field = 1;
}

View File

@@ -0,0 +1,65 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
syntax = "proto2";
package protobuf_editions_test.proto2;
message Proto2Optional {
optional int32 int32_field = 17;
optional float float_field = 18;
optional double double_field = 19;
optional int64 int64_field = 20;
optional uint32 uint32_field = 21;
optional uint64 uint64_field = 22;
optional sint32 sint32_field = 23;
optional sint64 sint64_field = 24;
optional fixed32 fixed32_field = 25;
optional fixed64 fixed64_field = 26;
optional sfixed32 sfixed32_field = 27;
optional sfixed64 sfixed64_field = 28;
optional bool bool_field = 29;
optional string string_field = 30;
optional bytes bytes_field = 31;
message SubMessage {
optional int32 int32_field = 17;
optional float float_field = 18;
optional double double_field = 19;
optional int64 int64_field = 20;
optional uint32 uint32_field = 21;
optional uint64 uint64_field = 22;
optional sint32 sint32_field = 23;
optional sint64 sint64_field = 24;
optional fixed32 fixed32_field = 25;
optional fixed64 fixed64_field = 26;
optional sfixed32 sfixed32_field = 27;
optional sfixed64 sfixed64_field = 28;
optional bool bool_field = 29;
optional string string_field = 30;
optional bytes bytes_field = 31;
}
oneof oneof_field {
int32 int32_oneof_field = 152;
float float_oneof_field = 153;
double double_oneof_field = 154;
int64 int64_oneof_field = 155;
uint32 uint32_oneof_field = 156;
uint64 uint64_oneof_field = 157;
sint32 sint32_oneof_field = 158;
sint64 sint64_oneof_field = 159;
fixed32 fixed32_oneof_field = 160;
fixed64 fixed64_oneof_field = 161;
sfixed32 sfixed32_oneof_field = 162;
sfixed64 sfixed64_oneof_field = 163;
bool bool_oneof_field = 164;
string string_oneof_field = 165;
bytes bytes_oneof_field = 166;
}
optional SubMessage sub_message = 2;
}

View File

@@ -0,0 +1,14 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
syntax = "proto2";
package protobuf_editions_test.proto2;
message Proto2Packed {
repeated int32 int32_field = 1 [packed = true];
}

View File

@@ -0,0 +1,18 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
syntax = "proto2";
package protobuf_editions_test.proto2;
import "google/protobuf/editions/codegen_tests/proto3_enum.proto";
message Proto2ImportedEnumMessage {
optional protobuf_editions_test.proto3.Proto3Enum enum_field = 1;
optional protobuf_editions_test.proto3.Proto3Enum enum_field_default = 2
[default = BAZ];
}

View File

@@ -0,0 +1,47 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
syntax = "proto2";
package protobuf_editions_test.proto2;
message Proto2Required {
required int32 int32_field = 17;
required float float_field = 18;
required double double_field = 19;
required int64 int64_field = 20;
required uint32 uint32_field = 21;
required uint64 uint64_field = 22;
required sint32 sint32_field = 23;
required sint64 sint64_field = 24;
required fixed32 fixed32_field = 25;
required fixed64 fixed64_field = 26;
required sfixed32 sfixed32_field = 27;
required sfixed64 sfixed64_field = 28;
required bool bool_field = 29;
required string string_field = 30;
required bytes bytes_field = 31;
message SubMessage {
required int32 int32_field = 17;
required float float_field = 18;
required double double_field = 19;
required int64 int64_field = 20;
required uint32 uint32_field = 21;
required uint64 uint64_field = 22;
required sint32 sint32_field = 23;
required sint64 sint64_field = 24;
required fixed32 fixed32_field = 25;
required fixed64 fixed64_field = 26;
required sfixed32 sfixed32_field = 27;
required sfixed64 sfixed64_field = 28;
required bool bool_field = 29;
required string string_field = 30;
required bytes bytes_field = 31;
}
required SubMessage sub_message = 2;
}

View File

@@ -0,0 +1,19 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
syntax = "proto2";
package protobuf_editions_test.proto2;
message Proto2Unpacked {
repeated int32 int32_field = 1;
repeated string string_field = 2;
message SubMessage {
optional int32 int32_field = 1;
}
repeated SubMessage sub_message_field = 3;
}

View File

@@ -0,0 +1,16 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
syntax = "proto2";
package protobuf_editions_test.proto2;
message Proto2Utf8Disabled {
optional string string_field = 1;
map<string, string> map_field = 2;
}

View File

@@ -0,0 +1,17 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
syntax = "proto2";
package protobuf_editions_test.proto2;
option optimize_for = LITE_RUNTIME;
message Proto2Utf8Lite {
optional string string_field = 1;
map<string, string> map_field = 2;
}

View File

@@ -0,0 +1,14 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
syntax = "proto2";
package protobuf_editions_test.proto2;
message Proto2Utf8Verify {
optional string string_field = 1;
}

View File

@@ -0,0 +1,26 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
syntax = "proto3";
package protobuf_editions_test.proto3;
enum Proto3Enum {
UNKNOWN = 0;
BAR = 1;
BAZ = 2;
}
message Proto3EnumMessage {
Proto3Enum enum_field = 1;
enum Proto3NestedEnum {
UNKNOWN = 0;
FOO = 1;
BAT = 2;
}
optional Proto3NestedEnum nested_enum_field = 3;
}

View File

@@ -0,0 +1,65 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
syntax = "proto3";
package protobuf_editions_test.proto3;
message Proto3Implicit {
int32 int32_field = 17;
float float_field = 18;
double double_field = 19;
int64 int64_field = 20;
uint32 uint32_field = 21;
uint64 uint64_field = 22;
sint32 sint32_field = 23;
sint64 sint64_field = 24;
fixed32 fixed32_field = 25;
fixed64 fixed64_field = 26;
sfixed32 sfixed32_field = 27;
sfixed64 sfixed64_field = 28;
bool bool_field = 29;
string string_field = 30;
bytes bytes_field = 31;
message SubMessage {
int32 int32_field = 17;
float float_field = 18;
double double_field = 19;
int64 int64_field = 20;
uint32 uint32_field = 21;
uint64 uint64_field = 22;
sint32 sint32_field = 23;
sint64 sint64_field = 24;
fixed32 fixed32_field = 25;
fixed64 fixed64_field = 26;
sfixed32 sfixed32_field = 27;
sfixed64 sfixed64_field = 28;
bool bool_field = 29;
string string_field = 30;
bytes bytes = 31;
}
oneof oneof_field {
int32 int32_oneof_field = 152;
float float_oneof_field = 153;
double double_oneof_field = 154;
int64 int64_oneof_field = 155;
uint32 uint32_oneof_field = 156;
uint64 uint64_oneof_field = 157;
sint32 sint32_oneof_field = 158;
sint64 sint64_oneof_field = 159;
fixed32 fixed32_oneof_field = 160;
fixed64 fixed64_oneof_field = 161;
sfixed32 sfixed32_oneof_field = 162;
sfixed64 sfixed64_oneof_field = 163;
bool bool_oneof_field = 164;
string string_oneof_field = 165;
bytes bytes_oneof_field = 166;
}
SubMessage sub_message = 2;
}

View File

@@ -0,0 +1,16 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
syntax = "proto3";
package protobuf_editions_test.proto3;
import "google/protobuf/editions/codegen_tests/proto3_implicit.proto";
message Proto3ImportMessage {
Proto3Implicit sub_message_field = 1;
}

View File

@@ -0,0 +1,47 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
syntax = "proto3";
package protobuf_editions_test.proto3;
message Proto3Optional {
optional int32 int32_field = 17;
optional float float_field = 18;
optional double double_field = 19;
optional int64 int64_field = 20;
optional uint32 uint32_field = 21;
optional uint64 uint64_field = 22;
optional sint32 sint32_field = 23;
optional sint64 sint64_field = 24;
optional fixed32 fixed32_field = 25;
optional fixed64 fixed64_field = 26;
optional sfixed32 sfixed32_field = 27;
optional sfixed64 sfixed64_field = 28;
optional bool bool_field = 29;
optional string string_field = 30;
optional bytes bytes_field = 31;
message SubMessage {
optional int32 int32_field = 17;
optional float float_field = 18;
optional double double_field = 19;
optional int64 int64_field = 20;
optional uint32 uint32_field = 21;
optional uint64 uint64_field = 22;
optional sint32 sint32_field = 23;
optional sint64 sint64_field = 24;
optional fixed32 fixed32_field = 25;
optional fixed64 fixed64_field = 26;
optional sfixed32 sfixed32_field = 27;
optional sfixed64 sfixed64_field = 28;
optional bool bool_field = 29;
optional string string_field = 30;
optional bytes bytes_field = 31;
}
optional SubMessage optional_message = 2;
}

View File

@@ -0,0 +1,20 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
syntax = "proto3";
package protobuf_editions_test.proto3;
message Proto3Packed {
repeated int32 int32_field = 1;
repeated string string_field = 2;
message SubMessage {
int32 int32_field = 1;
}
repeated SubMessage sub_message_field = 3;
repeated int32 explicitly_packed = 4 [packed = true];
}

View File

@@ -0,0 +1,19 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
syntax = "proto3";
package protobuf_editions_test.proto3;
message Proto3Unpacked {
repeated int32 int32_field = 1 [packed = false];
repeated string string_field = 2 [packed = false];
message SubMessage {
int32 int32_field = 1;
}
repeated SubMessage sub_message_field = 3 [packed = false];
}

View File

@@ -0,0 +1,15 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
syntax = "proto3";
package protobuf_editions_test.proto3;
message Proto3Utf8Strict {
string string_field = 1;
map<string, string> map_field = 10;
}

View File

@@ -0,0 +1,129 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
edition = "2023";
// This file contains various edge cases we've collected from migrating real
// protos in order to lock down the transformations.
// LINT: ALLOW_GROUPS
package protobuf_editions_test;
import "net/proto/proto1_features.proto";
import "third_party/java_src/protobuf/current/java/com/google/protobuf/java_features.proto";
import "google/protobuf/cpp_features.proto";
import "google/protobuf/editions/proto/editions_transform_proto3.proto";
option features.repeated_field_encoding = EXPANDED;
option features.utf8_validation = NONE;
option java_multiple_files = true;
message EmptyMessage {
}
message EmptyMessage2 {
}
service EmptyService {
}
service BasicService {
rpc BasicMethod(EmptyMessage) returns (EmptyMessage) {}
}
// clang-format off
message UnformattedMessage {
int32 a = 1;
message Foo {
int32 a = 1;
}
Foo foo = 2 [
features.message_encoding = DELIMITED
];
string string_piece_with_zero = 3 [
ctype = STRING_PIECE,
default = "ab\000c"
];
float long_float_name_wrapped = 4;
}
// clang-format on
message ParentMessage {
message ExtendedMessage {
extensions 536860000 to 536869999 [
declaration = {
number: 536860000
full_name: ".protobuf_editions_test.extension"
type: ".protobuf_editions_test.EmptyMessage"
}
];
}
}
extend ParentMessage.ExtendedMessage {
EmptyMessage extension = 536860000;
}
message TestMessage {
string string_field = 1;
map<string, string> string_map_field = 7;
repeated int32 int_field = 8;
repeated int32 int_field_packed = 9 [
features.repeated_field_encoding = PACKED,
features.(pb.proto1).legacy_packed = true
];
repeated int32 int_field_unpacked = 10;
repeated int32 options_strip_beginning = 4 [
/* inline comment */
debug_redact = true,
deprecated = false
];
repeated int32 options_strip_middle = 5 [
debug_redact = true,
deprecated = false
];
repeated int32 options_strip_end = 6 [
debug_redact = true,
deprecated = false
];
message OptionalGroup {
int32 a = 17;
}
OptionalGroup optionalgroup = 16 [
features.message_encoding = DELIMITED
];
}
enum TestEnum {
option features.enum_type = CLOSED;
FOO = 1; // Non-zero default
BAR = 2;
BAZ = 3;
NEG = -1; // Intentionally negative.
}
message TestOpenEnumMessage {
TestEnumProto3 open_enum_field = 1 [
features.(pb.cpp).legacy_closed_enum = true,
features.(pb.java).legacy_closed_enum = true
];
TestEnum closed_enum_field = 2;
}

View File

@@ -0,0 +1,19 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
edition = "2023";
package protobuf_editions_test;
option features.utf8_validation = NONE;
option optimize_for = LITE_RUNTIME;
message TestMessageLite {
string string_field = 1;
map<string, string> string_map_field = 4;
int32 int_field = 5;
}

View File

@@ -0,0 +1,18 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
edition = "2023";
package protobuf_editions_test;
option features.utf8_validation = NONE;
message TestMessageUtf8Disabled {
string string_field = 1;
map<string, string> string_map_field = 4;
int32 int_field = 5;
}

View File

@@ -0,0 +1,32 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
edition = "2023";
package protobuf_editions_test;
import "net/proto/proto1_features.proto";
option features.field_presence = IMPLICIT;
enum TestEnumProto3 {
TEST_ENUM_PROTO3_UNKNOWN = 0;
TEST_ENUM_PROTO3_VALUE = 1;
}
message TestMessageProto3 {
string string_field = 1;
map<string, string> string_map_field = 4;
repeated int32 int_field = 7;
repeated int32 int_field_packed = 8 [
features.(pb.proto1).legacy_packed = true
];
repeated int32 int_field_unpacked = 9 [
features.repeated_field_encoding = EXPANDED
];
}

View File

@@ -0,0 +1,18 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
edition = "2023";
package protobuf_editions_test;
option features.field_presence = IMPLICIT;
message TestMessageProto3 {
string string_field = 1;
map<string, string> string_map_field = 4;
repeated int32 int_field = 7;
}

View File

@@ -0,0 +1,14 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
syntax = "proto2";
package protobuf_editions_test.golden;
message SimpleProto2 {
optional int32 int32_field = 1;
}

View File

@@ -0,0 +1,16 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
syntax = "proto2";
package protobuf_editions_test.golden;
import "google/protobuf/editions/golden/simple_proto2.proto";
message AnotherMessage {
optional SimpleProto2 field = 1;
}

View File

@@ -0,0 +1,14 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
syntax = "proto3";
package protobuf_editions_test.golden;
message SimpleProto3 {
optional int32 int32_field = 1;
}

View File

@@ -0,0 +1,91 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
syntax = "proto2";
import "google/protobuf/editions/proto/editions_transform_proto3.proto";
// This file contains various edge cases we've collected from migrating real
// protos in order to lock down the transformations.
// LINT: ALLOW_GROUPS
package protobuf_editions_test;
option java_multiple_files = true;
option cc_enable_arenas = true;
message EmptyMessage {}
message EmptyMessage2 {}
service EmptyService {}
service BasicService {
rpc BasicMethod(EmptyMessage) returns (EmptyMessage) {}
}
// clang-format off
message UnformattedMessage{
optional int32 a=1 ;
optional group Foo = 2 { optional int32 a = 1; }
optional string string_piece_with_zero = 3 [ctype=STRING_PIECE,
default="ab\000c"];
optional float
long_float_name_wrapped = 4;
}
// clang-format on
message ParentMessage {
message ExtendedMessage {
extensions 536860000 to 536869999 [declaration = {
number: 536860000
full_name: ".protobuf_editions_test.extension"
type: ".protobuf_editions_test.EmptyMessage"
}];
}
}
extend ParentMessage.ExtendedMessage {
optional EmptyMessage extension = 536860000;
}
message TestMessage {
optional string string_field = 1;
map<string, string> string_map_field = 7;
repeated int32 int_field = 8;
repeated int32 int_field_packed = 9 [packed = true];
repeated int32 int_field_unpacked = 10 [packed = false];
repeated int32 options_strip_beginning = 4 [
packed = false,
/* inline comment*/ debug_redact = true,
deprecated = false
];
repeated int32 options_strip_middle = 5
[debug_redact = true, packed = false, deprecated = false];
repeated int32 options_strip_end = 6
[debug_redact = true, deprecated = false, packed = false];
optional group OptionalGroup = 16 {
optional int32 a = 17;
}
}
enum TestEnum {
FOO = 1; // Non-zero default
BAR = 2;
BAZ = 3;
NEG = -1; // Intentionally negative.
}
message TestOpenEnumMessage {
optional TestEnumProto3 open_enum_field = 1;
optional TestEnum closed_enum_field = 2;
}

View File

@@ -0,0 +1,20 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
syntax = "proto2";
package protobuf_editions_test;
option optimize_for = LITE_RUNTIME;
message TestMessageLite {
optional string string_field = 1;
map<string, string> string_map_field = 4;
optional int32 int_field = 5;
}

View File

@@ -0,0 +1,19 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
syntax = "proto2";
package protobuf_editions_test;
message TestMessageUtf8Disabled {
optional string string_field = 1;
map<string, string> string_map_field = 4;
optional int32 int_field = 5;
}

View File

@@ -0,0 +1,25 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
syntax = "proto3";
package protobuf_editions_test;
enum TestEnumProto3 {
TEST_ENUM_PROTO3_UNKNOWN = 0;
TEST_ENUM_PROTO3_VALUE = 1;
}
message TestMessageProto3 {
string string_field = 1;
map<string, string> string_map_field = 4;
repeated int32 int_field = 7;
repeated int32 int_field_packed = 8 [packed = true];
repeated int32 int_field_unpacked = 9 [packed = false];
}

View File

@@ -0,0 +1,19 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// 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
syntax = "proto3";
package protobuf_editions_test;
message TestMessageProto3 {
string string_field = 1;
map<string, string> string_map_field = 4;
repeated int32 int_field = 7;
}