blob: 84111c1682851281307277e9a96c37bf1879e0ab [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;
62}
63
Kevin Clark03d7a472008-06-18 01:09:41 +000064struct Foo {
65 1: i32 simple = 53,
66 2: string words = "words",
67 3: Hello hello = {'greeting' : "hello, world!"},
68 4: list<i32> ints = [1, 2, 2, 3],
69 5: map<i32, map<string, double>> complex,
Kevin Clark5ad6d4a2008-08-26 20:02:07 +000070 6: set<i16> shorts = [5, 17, 239],
71 7: optional string opt_string
Kevin Clark03d7a472008-06-18 01:09:41 +000072}
Kevin Clark1cfd6932008-06-18 01:13:58 +000073
74struct BoolStruct {
75 1: bool yesno = 1
76}
Kevin Clarke0fddde2008-06-18 01:16:02 +000077
Kevin Clark14fe7912008-08-04 18:46:19 +000078struct SimpleList {
79 1: list<bool> bools,
80 2: list<byte> bytes,
81 3: list<i16> i16s,
82 4: list<i32> i32s,
83 5: list<i64> i64s,
84 6: list<double> doubles,
85 7: list<string> strings,
86 8: list<map<i16, i16>> maps,
87 9: list<list<i16>> lists,
88 10: list<set<i16>> sets,
89 11: list<Hello> hellos
90}
91
Kevin Clark031baf72008-11-14 17:11:39 +000092exception Xception {
93 1: string message,
94 2: i32 code = 1
95}
96
Kevin Clarke0fddde2008-06-18 01:16:02 +000097service NonblockingService {
98 Hello greeting(1:bool english)
99 bool block()
David Reisscecbed82009-03-24 20:02:22 +0000100 oneway void unblock(1:i32 n)
101 oneway void shutdown()
Kevin Clarke0fddde2008-06-18 01:16:02 +0000102 void sleep(1:double seconds)
103}
Bryan Duxbury3d03c522010-02-18 17:42:06 +0000104
105union My_union {
106 1: bool im_true,
107 2: byte a_bite,
108 3: i16 integer16,
109 4: i32 integer32,
110 5: i64 integer64,
111 6: double double_precision,
112 7: string some_characters,
113 8: i32 other_i32
114 9: SomeEnum some_enum;
115 10: map<SomeEnum, list<SomeEnum>> my_map;
116}
117
118struct Struct_with_union {
119 1: My_union fun_union
120 2: i32 integer32
121 3: string some_characters
122}
123
124struct StructWithEnumMap {
125 1: map<SomeEnum, list<SomeEnum>> my_map;
126}