• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Protocol Buffers - Google's data interchange format
2// Copyright 2023 Google Inc.  All rights reserved.
3//
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file or at
6// https://developers.google.com/open-source/licenses/bsd
7
8syntax = "proto2";
9
10import "editions/proto/editions_transform_proto3.proto";
11
12// This file contains various edge cases we've collected from migrating real
13// protos in order to lock down the transformations.
14
15// LINT: ALLOW_GROUPS
16
17package protobuf_editions_test;
18
19option java_api_version = 1;
20option java_multiple_files = true;
21option cc_enable_arenas = true;
22
23message EmptyMessage {}
24message EmptyMessage2 {}
25
26service EmptyService {}
27
28service BasicService {
29  rpc BasicMethod(EmptyMessage) returns (EmptyMessage) {}
30}
31
32// clang-format off
33message UnformattedMessage{
34  optional int32 a=1 ;
35  optional group Foo = 2 { optional int32 a = 1; }
36  optional string string_piece_with_zero = 3 [ctype=STRING_PIECE,
37                                               default="ab\000c"];
38  optional float
39      long_float_name_wrapped = 4;
40
41}
42// clang-format on
43
44message ParentMessage {
45  message ExtendedMessage {
46    extensions 536860000 to 536869999 [declaration = {
47      number: 536860000
48      full_name: ".protobuf_editions_test.extension"
49      type: ".protobuf_editions_test.EmptyMessage"
50    }];
51  }
52}
53
54extend ParentMessage.ExtendedMessage {
55  optional EmptyMessage extension = 536860000;
56}
57
58message TestMessage {
59  optional string string_field = 1;
60
61  map<string, string> string_map_field = 7;
62
63  repeated int32 int_field = 8;
64  repeated int32 int_field_packed = 9 [packed = true];
65  repeated int32 int_field_unpacked = 10 [packed = false];
66
67  repeated int32 options_strip_beginning = 4 [
68    packed = false,
69    /* inline comment*/ debug_redact = true,
70    deprecated = false
71  ];
72  repeated int32 options_strip_middle = 5
73      [debug_redact = true, packed = false, deprecated = false];
74  repeated int32 options_strip_end = 6
75      [debug_redact = true, deprecated = false, packed = false];
76
77  optional group OptionalGroup = 16 {
78    optional int32 a = 17;
79  }
80}
81
82enum TestEnum {
83  FOO = 1;  // Non-zero default
84  BAR = 2;
85  BAZ = 3;
86  NEG = -1;  // Intentionally negative.
87}
88
89message TestOpenEnumMessage {
90  optional TestEnumProto3 open_enum_field = 1;
91  optional TestEnum closed_enum_field = 2;
92}
93