blob: dcd88ae906357cc99909feed691f30ae1753b4c3 [file] [log] [blame]
// 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 "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_api_version = 1;
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;
}