blob: 3c2f3e0a8757414f8375a758b2cf4a19ceb081de [file] [log] [blame]
David Reissea2cba82009-03-30 21:35:00 +00001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20#
21# Licensed to the Apache Software Foundation (ASF) under one
22# or more contributor license agreements. See the NOTICE file
23# distributed with this work for additional information
24# regarding copyright ownership. The ASF licenses this file
25# to you under the Apache License, Version 2.0 (the
26# "License"); you may not use this file except in compliance
27# with the License. You may obtain a copy of the License at
28#
29# http://www.apache.org/licenses/LICENSE-2.0
30#
31# Unless required by applicable law or agreed to in writing,
32# software distributed under the License is distributed on an
33# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
34# KIND, either express or implied. See the License for the
35# specific language governing permissions and limitations
36# under the License.
37#
38
Kevin Clark03d7a472008-06-18 01:09:41 +000039namespace rb SpecNamespace
40
41struct Hello {
42 1: string greeting = "hello world"
43}
44
Bryan Duxbury33e190c2010-02-16 21:19:01 +000045enum SomeEnum {
46 ONE
47 TWO
48}
49
Bryan Duxbury3d03c522010-02-18 17:42:06 +000050struct StructWithSomeEnum {
51 1: SomeEnum some_enum;
52}
53
Bryan Duxbury33e190c2010-02-16 21:19:01 +000054union TestUnion {
55 /**
56 * A doc string
57 */
58 1: string string_field;
59 2: i32 i32_field;
60 3: i32 other_i32_field;
61 4: SomeEnum enum_field;
Bryan Duxbury39dadd62010-02-18 22:00:45 +000062 5: binary binary_field;
Dmytro Shteflyuke9ac8e32025-11-19 23:33:23 -050063 6: uuid uuid_field;
Bryan Duxbury33e190c2010-02-16 21:19:01 +000064}
65
Kevin Clark03d7a472008-06-18 01:09:41 +000066struct Foo {
67 1: i32 simple = 53,
68 2: string words = "words",
69 3: Hello hello = {'greeting' : "hello, world!"},
70 4: list<i32> ints = [1, 2, 2, 3],
71 5: map<i32, map<string, double>> complex,
Kevin Clark5ad6d4a2008-08-26 20:02:07 +000072 6: set<i16> shorts = [5, 17, 239],
73 7: optional string opt_string
Bryan Duxbury0e4920c2010-02-18 20:28:27 +000074 8: bool my_bool
Dmytro Shteflyuke9ac8e32025-11-19 23:33:23 -050075 9: optional uuid opt_uuid
Kevin Clark03d7a472008-06-18 01:09:41 +000076}
Kevin Clark1cfd6932008-06-18 01:13:58 +000077
Bryan Duxbury39dadd62010-02-18 22:00:45 +000078struct Foo2 {
79 1: binary my_binary
80}
81
Kevin Clark1cfd6932008-06-18 01:13:58 +000082struct BoolStruct {
83 1: bool yesno = 1
84}
Kevin Clarke0fddde2008-06-18 01:16:02 +000085
Kevin Clark14fe7912008-08-04 18:46:19 +000086struct SimpleList {
87 1: list<bool> bools,
88 2: list<byte> bytes,
89 3: list<i16> i16s,
90 4: list<i32> i32s,
91 5: list<i64> i64s,
92 6: list<double> doubles,
93 7: list<string> strings,
94 8: list<map<i16, i16>> maps,
95 9: list<list<i16>> lists,
96 10: list<set<i16>> sets,
Dmytro Shteflyuke9ac8e32025-11-19 23:33:23 -050097 11: list<Hello> hellos,
98 12: list<uuid> uuids
Kevin Clark14fe7912008-08-04 18:46:19 +000099}
100
Kevin Clark031baf72008-11-14 17:11:39 +0000101exception Xception {
102 1: string message,
103 2: i32 code = 1
104}
105
Kevin Clarke0fddde2008-06-18 01:16:02 +0000106service NonblockingService {
107 Hello greeting(1:bool english)
108 bool block()
David Reisscecbed82009-03-24 20:02:22 +0000109 oneway void unblock(1:i32 n)
110 oneway void shutdown()
Kevin Clarke0fddde2008-06-18 01:16:02 +0000111 void sleep(1:double seconds)
112}
Bryan Duxbury3d03c522010-02-18 17:42:06 +0000113
114union My_union {
115 1: bool im_true,
116 2: byte a_bite,
117 3: i16 integer16,
118 4: i32 integer32,
119 5: i64 integer64,
120 6: double double_precision,
121 7: string some_characters,
122 8: i32 other_i32
123 9: SomeEnum some_enum;
124 10: map<SomeEnum, list<SomeEnum>> my_map;
Dmytro Shteflyuke9ac8e32025-11-19 23:33:23 -0500125 11: uuid unique_id;
Bryan Duxbury3d03c522010-02-18 17:42:06 +0000126}
127
128struct Struct_with_union {
129 1: My_union fun_union
130 2: i32 integer32
131 3: string some_characters
132}
133
134struct StructWithEnumMap {
135 1: map<SomeEnum, list<SomeEnum>> my_map;
Ilya Maykova81b0402012-02-29 00:39:38 +0000136}
137
138# Nested lists
139struct NestedListInList {
140 1: list<list<byte>> value
141}
142
143struct NestedListInSet {
144 1: set<list<byte>> value
145}
146
147struct NestedListInMapKey {
148 1: map<list<byte>, byte> value
149}
150
151struct NestedListInMapValue {
152 1: map<byte, list<byte>> value
153}
154
155# Nested sets
156struct NestedSetInList {
157 1: list<set<byte>> value
158}
159
160struct NestedSetInSet {
161 1: set<set<byte>> value
162}
163
164struct NestedSetInMapKey {
165 1: map<set<byte>, byte> value
166}
167
168struct NestedSetInMapValue {
169 1: map<byte, set<byte>> value
170}
171
172# Nested maps
173struct NestedMapInList {
174 1: list<map<byte, byte>> value
175}
176
177struct NestedMapInSet {
178 1: set<map<byte, byte>> value
179}
180
181struct NestedMapInMapKey {
182 2: map<map<byte, byte>, byte> value
183}
184
185struct NestedMapInMapValue {
186 2: map<byte, map<byte, byte>> value
187}