• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Protocol Buffers - Google's data interchange format
2// Copyright 2008 Google Inc.  All rights reserved.
3// https://developers.google.com/protocol-buffers/
4//
5// Redistribution and use in source and binary forms, with or without
6// modification, are permitted provided that the following conditions are
7// met:
8//
9//     * Redistributions of source code must retain the above copyright
10// notice, this list of conditions and the following disclaimer.
11//     * Redistributions in binary form must reproduce the above
12// copyright notice, this list of conditions and the following disclaimer
13// in the documentation and/or other materials provided with the
14// distribution.
15//     * Neither the name of Google Inc. nor the names of its
16// contributors may be used to endorse or promote products derived from
17// this software without specific prior written permission.
18//
19// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31syntax = "proto3";
32
33package proto_util_converter.testing;
34
35import "google/protobuf/any.proto";
36
37// Top-level test cases proto used by MarshallingTest. See description
38// at the top of the class MarshallingTest for details on how to write
39// test cases.
40message MapsTestCases {
41  EmptyMap empty_map = 1;
42  StringtoInt string_to_int = 2;
43  IntToString int_to_string = 3;
44  Mixed1 mixed1 = 4;
45  Mixed2 mixed2 = 5;
46  MapOfObjects map_of_objects = 6;
47
48  // Empty key tests
49  StringtoInt empty_key_string_to_int1 = 7;
50  StringtoInt empty_key_string_to_int2 = 8;
51  StringtoInt empty_key_string_to_int3 = 9;
52  BoolToString empty_key_bool_to_string = 10;
53  IntToString empty_key_int_to_string = 11;
54  Mixed1 empty_key_mixed = 12;
55  MapOfObjects empty_key_map_objects = 13;
56}
57
58message EmptyMap {
59  map<int32, int32> map = 1;
60}
61
62message StringtoInt {
63  map<string, int32> map = 1;
64}
65
66message IntToString {
67  map<int32, string> map = 1;
68}
69
70message BoolToString {
71  map<bool, string> map = 1;
72}
73
74message Mixed1 {
75  string msg = 1;
76  map<string, float> map = 2;
77}
78
79message Mixed2 {
80  enum E {
81    E0 = 0;
82    E1 = 1;
83    E2 = 2;
84    E3 = 3;
85  }
86  map<int32, bool> map = 1;
87  E ee = 2;
88}
89
90message MapOfObjects {
91  message M {
92    string inner_text = 1;
93  }
94  map<string, M> map = 1;
95}
96
97message DummyRequest {}
98
99service MapsTestService {
100  rpc Call(DummyRequest) returns (MapsTestCases);
101}
102
103message MapIn {
104  string other = 1;
105  repeated string things = 2;
106  map<string, string> map_input = 3;
107  map<string, google.protobuf.Any> map_any = 4;
108}
109
110message MapOut {
111  map<string, MapM> map1 = 1;
112  map<string, MapOut> map2 = 2;
113  map<int32, string> map3 = 3;
114  map<bool, string> map4 = 5;
115  string bar = 4;
116}
117
118// A message with exactly the same wire representation as MapOut, but using
119// repeated message fields instead of map fields. We use this message to test
120// the wire-format compatibility of the JSON transcoder (e.g., whether it
121// handles missing keys correctly).
122message MapOutWireFormat {
123  message Map1Entry {
124    string key = 1;
125    MapM value = 2;
126  }
127  repeated Map1Entry map1 = 1;
128  message Map2Entry {
129    string key = 1;
130    MapOut value = 2;
131  }
132  repeated Map2Entry map2 = 2;
133  message Map3Entry {
134    int32 key = 1;
135    string value = 2;
136  }
137  repeated Map3Entry map3 = 3;
138  message Map4Entry {
139    bool key = 1;
140    string value = 2;
141  }
142  repeated Map4Entry map4 = 5;
143  string bar = 4;
144}
145
146message MapM {
147  string foo = 1;
148}
149