| David Reiss | ea2cba8 | 2009-03-30 21:35:00 +0000 | [diff] [blame] | 1 | # |
| 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 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 20 | require 'thrift' |
| 21 | |
| 22 | module Fixtures |
| 23 | module Structs |
| 24 | class OneBool |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 25 | include Thrift::Struct, Thrift::Struct_Union |
| 26 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 27 | FIELDS = { |
| 28 | 1 => {:type => Thrift::Types::BOOL, :name => 'bool'} |
| 29 | } |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 30 | |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 31 | def struct_fields; FIELDS; end |
| 32 | |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 33 | def validate |
| 34 | end |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 35 | |
| 36 | Thrift::Struct.generate_accessors self |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 37 | end |
| Dmytro Shteflyuk | f5c80a4 | 2026-03-08 19:09:43 -0400 | [diff] [blame] | 38 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 39 | class OneByte |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 40 | include Thrift::Struct, Thrift::Struct_Union |
| 41 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 42 | FIELDS = { |
| 43 | 1 => {:type => Thrift::Types::BYTE, :name => 'byte'} |
| 44 | } |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 45 | |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 46 | def struct_fields; FIELDS; end |
| 47 | |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 48 | def validate |
| 49 | end |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 50 | |
| 51 | Thrift::Struct.generate_accessors self |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 52 | end |
| Dmytro Shteflyuk | f5c80a4 | 2026-03-08 19:09:43 -0400 | [diff] [blame] | 53 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 54 | class OneI16 |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 55 | include Thrift::Struct, Thrift::Struct_Union |
| 56 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 57 | FIELDS = { |
| 58 | 1 => {:type => Thrift::Types::I16, :name => 'i16'} |
| 59 | } |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 60 | |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 61 | def struct_fields; FIELDS; end |
| 62 | |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 63 | def validate |
| 64 | end |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 65 | |
| 66 | Thrift::Struct.generate_accessors self |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 67 | end |
| Dmytro Shteflyuk | f5c80a4 | 2026-03-08 19:09:43 -0400 | [diff] [blame] | 68 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 69 | class OneI32 |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 70 | include Thrift::Struct, Thrift::Struct_Union |
| 71 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 72 | FIELDS = { |
| 73 | 1 => {:type => Thrift::Types::I32, :name => 'i32'} |
| 74 | } |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 75 | |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 76 | def struct_fields; FIELDS; end |
| 77 | |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 78 | def validate |
| 79 | end |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 80 | |
| 81 | Thrift::Struct.generate_accessors self |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 82 | end |
| Dmytro Shteflyuk | f5c80a4 | 2026-03-08 19:09:43 -0400 | [diff] [blame] | 83 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 84 | class OneI64 |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 85 | include Thrift::Struct, Thrift::Struct_Union |
| 86 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 87 | FIELDS = { |
| 88 | 1 => {:type => Thrift::Types::I64, :name => 'i64'} |
| 89 | } |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 90 | |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 91 | def struct_fields; FIELDS; end |
| 92 | |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 93 | def validate |
| 94 | end |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 95 | |
| 96 | Thrift::Struct.generate_accessors self |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 97 | end |
| Dmytro Shteflyuk | f5c80a4 | 2026-03-08 19:09:43 -0400 | [diff] [blame] | 98 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 99 | class OneDouble |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 100 | include Thrift::Struct, Thrift::Struct_Union |
| 101 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 102 | FIELDS = { |
| 103 | 1 => {:type => Thrift::Types::DOUBLE, :name => 'double'} |
| 104 | } |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 105 | |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 106 | def struct_fields; FIELDS; end |
| 107 | |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 108 | def validate |
| 109 | end |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 110 | |
| 111 | Thrift::Struct.generate_accessors self |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 112 | end |
| Dmytro Shteflyuk | f5c80a4 | 2026-03-08 19:09:43 -0400 | [diff] [blame] | 113 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 114 | class OneString |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 115 | include Thrift::Struct, Thrift::Struct_Union |
| 116 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 117 | FIELDS = { |
| 118 | 1 => {:type => Thrift::Types::STRING, :name => 'string'} |
| 119 | } |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 120 | |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 121 | def struct_fields; FIELDS; end |
| 122 | |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 123 | def validate |
| 124 | end |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 125 | |
| 126 | Thrift::Struct.generate_accessors self |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 127 | end |
| Dmytro Shteflyuk | f5c80a4 | 2026-03-08 19:09:43 -0400 | [diff] [blame] | 128 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 129 | class OneMap |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 130 | include Thrift::Struct, Thrift::Struct_Union |
| 131 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 132 | FIELDS = { |
| 133 | 1 => {:type => Thrift::Types::MAP, :name => 'map', :key => {:type => Thrift::Types::STRING}, :value => {:type => Thrift::Types::STRING}} |
| 134 | } |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 135 | |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 136 | def struct_fields; FIELDS; end |
| 137 | |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 138 | def validate |
| 139 | end |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 140 | |
| 141 | Thrift::Struct.generate_accessors self |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 142 | end |
| Dmytro Shteflyuk | f5c80a4 | 2026-03-08 19:09:43 -0400 | [diff] [blame] | 143 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 144 | class NestedMap |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 145 | include Thrift::Struct, Thrift::Struct_Union |
| 146 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 147 | FIELDS = { |
| 148 | 0 => {:type => Thrift::Types::MAP, :name => 'map', :key => {:type => Thrift::Types::I32}, :value => {:type => Thrift::Types::MAP, :key => {:type => Thrift::Types::I32}, :value => {:type => Thrift::Types::I32}}} |
| 149 | } |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 150 | |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 151 | def struct_fields; FIELDS; end |
| 152 | |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 153 | def validate |
| 154 | end |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 155 | |
| 156 | Thrift::Struct.generate_accessors self |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 157 | end |
| Dmytro Shteflyuk | f5c80a4 | 2026-03-08 19:09:43 -0400 | [diff] [blame] | 158 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 159 | class OneList |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 160 | include Thrift::Struct, Thrift::Struct_Union |
| 161 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 162 | FIELDS = { |
| 163 | 1 => {:type => Thrift::Types::LIST, :name => 'list', :element => {:type => Thrift::Types::STRING}} |
| 164 | } |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 165 | |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 166 | def struct_fields; FIELDS; end |
| 167 | |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 168 | def validate |
| 169 | end |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 170 | |
| 171 | Thrift::Struct.generate_accessors self |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 172 | end |
| Dmytro Shteflyuk | f5c80a4 | 2026-03-08 19:09:43 -0400 | [diff] [blame] | 173 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 174 | class NestedList |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 175 | include Thrift::Struct, Thrift::Struct_Union |
| 176 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 177 | FIELDS = { |
| 178 | 0 => {:type => Thrift::Types::LIST, :name => 'list', :element => {:type => Thrift::Types::LIST, :element => { :type => Thrift::Types::I32 } } } |
| 179 | } |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 180 | |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 181 | def struct_fields; FIELDS; end |
| 182 | |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 183 | def validate |
| 184 | end |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 185 | |
| 186 | Thrift::Struct.generate_accessors self |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 187 | end |
| Dmytro Shteflyuk | f5c80a4 | 2026-03-08 19:09:43 -0400 | [diff] [blame] | 188 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 189 | class OneSet |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 190 | include Thrift::Struct, Thrift::Struct_Union |
| 191 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 192 | FIELDS = { |
| 193 | 1 => {:type => Thrift::Types::SET, :name => 'set', :element => {:type => Thrift::Types::STRING}} |
| 194 | } |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 195 | |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 196 | def struct_fields; FIELDS; end |
| 197 | |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 198 | def validate |
| 199 | end |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 200 | |
| 201 | Thrift::Struct.generate_accessors self |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 202 | end |
| Dmytro Shteflyuk | f5c80a4 | 2026-03-08 19:09:43 -0400 | [diff] [blame] | 203 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 204 | class NestedSet |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 205 | include Thrift::Struct, Thrift::Struct_Union |
| 206 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 207 | FIELDS = { |
| 208 | 1 => {:type => Thrift::Types::SET, :name => 'set', :element => {:type => Thrift::Types::SET, :element => { :type => Thrift::Types::STRING } }} |
| 209 | } |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 210 | |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 211 | def struct_fields; FIELDS; end |
| 212 | |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 213 | def validate |
| 214 | end |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 215 | |
| 216 | Thrift::Struct.generate_accessors self |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 217 | end |
| Dmytro Shteflyuk | f5c80a4 | 2026-03-08 19:09:43 -0400 | [diff] [blame] | 218 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 219 | # struct OneOfEach { |
| 220 | # 1: bool im_true, |
| 221 | # 2: bool im_false, |
| 222 | # 3: byte a_bite, |
| 223 | # 4: i16 integer16, |
| 224 | # 5: i32 integer32, |
| 225 | # 6: i64 integer64, |
| 226 | # 7: double double_precision, |
| 227 | # 8: string some_characters, |
| 228 | # 9: string zomg_unicode, |
| 229 | # 10: bool what_who, |
| 230 | # 11: binary base64, |
| 231 | # } |
| 232 | class OneOfEach |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 233 | include Thrift::Struct, Thrift::Struct_Union |
| 234 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 235 | FIELDS = { |
| 236 | 1 => {:type => Thrift::Types::BOOL, :name => 'im_true'}, |
| 237 | 2 => {:type => Thrift::Types::BOOL, :name => 'im_false'}, |
| 238 | 3 => {:type => Thrift::Types::BYTE, :name => 'a_bite'}, |
| 239 | 4 => {:type => Thrift::Types::I16, :name => 'integer16'}, |
| 240 | 5 => {:type => Thrift::Types::I32, :name => 'integer32'}, |
| 241 | 6 => {:type => Thrift::Types::I64, :name => 'integer64'}, |
| 242 | 7 => {:type => Thrift::Types::DOUBLE, :name => 'double_precision'}, |
| 243 | 8 => {:type => Thrift::Types::STRING, :name => 'some_characters'}, |
| 244 | 9 => {:type => Thrift::Types::STRING, :name => 'zomg_unicode'}, |
| 245 | 10 => {:type => Thrift::Types::BOOL, :name => 'what_who'}, |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 246 | 11 => {:type => Thrift::Types::STRING, :name => 'base64', :binary => true} |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 247 | } |
| 248 | |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 249 | def struct_fields; FIELDS; end |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 250 | |
| 251 | def validate |
| 252 | end |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 253 | |
| 254 | Thrift::Struct.generate_accessors self |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 255 | end |
| 256 | |
| 257 | # struct Nested1 { |
| 258 | # 1: list<OneOfEach> a_list |
| 259 | # 2: map<i32, OneOfEach> i32_map |
| 260 | # 3: map<i64, OneOfEach> i64_map |
| 261 | # 4: map<double, OneOfEach> dbl_map |
| 262 | # 5: map<string, OneOfEach> str_map |
| 263 | # } |
| 264 | class Nested1 |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 265 | include Thrift::Struct, Thrift::Struct_Union |
| 266 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 267 | FIELDS = { |
| 268 | 1 => {:type => Thrift::Types::LIST, :name => 'a_list', :element => {:type => Thrift::Types::STRUCT, :class => OneOfEach}}, |
| 269 | 2 => {:type => Thrift::Types::MAP, :name => 'i32_map', :key => {:type => Thrift::Types::I32}, :value => {:type => Thrift::Types::STRUCT, :class => OneOfEach}}, |
| 270 | 3 => {:type => Thrift::Types::MAP, :name => 'i64_map', :key => {:type => Thrift::Types::I64}, :value => {:type => Thrift::Types::STRUCT, :class => OneOfEach}}, |
| 271 | 4 => {:type => Thrift::Types::MAP, :name => 'dbl_map', :key => {:type => Thrift::Types::DOUBLE}, :value => {:type => Thrift::Types::STRUCT, :class => OneOfEach}}, |
| 272 | 5 => {:type => Thrift::Types::MAP, :name => 'str_map', :key => {:type => Thrift::Types::STRING}, :value => {:type => Thrift::Types::STRUCT, :class => OneOfEach}} |
| 273 | } |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 274 | |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 275 | def struct_fields; FIELDS; end |
| 276 | |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 277 | def validate |
| 278 | end |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 279 | |
| 280 | Thrift::Struct.generate_accessors self |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 281 | end |
| 282 | |
| 283 | # struct Nested2 { |
| 284 | # 1: list<Nested1> a_list |
| 285 | # 2: map<i32, Nested1> i32_map |
| 286 | # 3: map<i64, Nested1> i64_map |
| 287 | # 4: map<double, Nested1> dbl_map |
| 288 | # 5: map<string, Nested1> str_map |
| 289 | # } |
| 290 | class Nested2 |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 291 | include Thrift::Struct, Thrift::Struct_Union |
| 292 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 293 | FIELDS = { |
| 294 | 1 => {:type => Thrift::Types::LIST, :name => 'a_list', :element => {:type => Thrift::Types::STRUCT, :class => Nested1}}, |
| 295 | 2 => {:type => Thrift::Types::MAP, :name => 'i32_map', :key => {:type => Thrift::Types::I32}, :value => {:type => Thrift::Types::STRUCT, :class => Nested1}}, |
| 296 | 3 => {:type => Thrift::Types::MAP, :name => 'i64_map', :key => {:type => Thrift::Types::I64}, :value => {:type => Thrift::Types::STRUCT, :class => Nested1}}, |
| 297 | 4 => {:type => Thrift::Types::MAP, :name => 'dbl_map', :key => {:type => Thrift::Types::DOUBLE}, :value => {:type => Thrift::Types::STRUCT, :class => Nested1}}, |
| 298 | 5 => {:type => Thrift::Types::MAP, :name => 'str_map', :key => {:type => Thrift::Types::STRING}, :value => {:type => Thrift::Types::STRUCT, :class => Nested1}} |
| 299 | } |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 300 | |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 301 | def struct_fields; FIELDS; end |
| 302 | |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 303 | def validate |
| 304 | end |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 305 | |
| 306 | Thrift::Struct.generate_accessors self |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 307 | end |
| 308 | |
| 309 | # struct Nested3 { |
| 310 | # 1: list<Nested2> a_list |
| 311 | # 2: map<i32, Nested2> i32_map |
| 312 | # 3: map<i64, Nested2> i64_map |
| 313 | # 4: map<double, Nested2> dbl_map |
| 314 | # 5: map<string, Nested2> str_map |
| 315 | # } |
| 316 | class Nested3 |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 317 | include Thrift::Struct, Thrift::Struct_Union |
| 318 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 319 | FIELDS = { |
| 320 | 1 => {:type => Thrift::Types::LIST, :name => 'a_list', :element => {:type => Thrift::Types::STRUCT, :class => Nested2}}, |
| 321 | 2 => {:type => Thrift::Types::MAP, :name => 'i32_map', :key => {:type => Thrift::Types::I32}, :value => {:type => Thrift::Types::STRUCT, :class => Nested2}}, |
| 322 | 3 => {:type => Thrift::Types::MAP, :name => 'i64_map', :key => {:type => Thrift::Types::I64}, :value => {:type => Thrift::Types::STRUCT, :class => Nested2}}, |
| 323 | 4 => {:type => Thrift::Types::MAP, :name => 'dbl_map', :key => {:type => Thrift::Types::DOUBLE}, :value => {:type => Thrift::Types::STRUCT, :class => Nested2}}, |
| 324 | 5 => {:type => Thrift::Types::MAP, :name => 'str_map', :key => {:type => Thrift::Types::STRING}, :value => {:type => Thrift::Types::STRUCT, :class => Nested2}} |
| 325 | } |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 326 | |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 327 | def struct_fields; FIELDS; end |
| 328 | |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 329 | def validate |
| 330 | end |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 331 | |
| 332 | Thrift::Struct.generate_accessors self |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 333 | end |
| 334 | |
| 335 | # struct Nested4 { |
| 336 | # 1: list<Nested3> a_list |
| 337 | # 2: map<i32, Nested3> i32_map |
| 338 | # 3: map<i64, Nested3> i64_map |
| 339 | # 4: map<double, Nested3> dbl_map |
| 340 | # 5: map<string, Nested3> str_map |
| 341 | # } |
| 342 | class Nested4 |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 343 | include Thrift::Struct, Thrift::Struct_Union |
| 344 | |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 345 | FIELDS = { |
| 346 | 1 => {:type => Thrift::Types::LIST, :name => 'a_list', :element => {:type => Thrift::Types::STRUCT, :class => Nested3}}, |
| 347 | 2 => {:type => Thrift::Types::MAP, :name => 'i32_map', :key => {:type => Thrift::Types::I32}, :value => {:type => Thrift::Types::STRUCT, :class => Nested3}}, |
| 348 | 3 => {:type => Thrift::Types::MAP, :name => 'i64_map', :key => {:type => Thrift::Types::I64}, :value => {:type => Thrift::Types::STRUCT, :class => Nested3}}, |
| 349 | 4 => {:type => Thrift::Types::MAP, :name => 'dbl_map', :key => {:type => Thrift::Types::DOUBLE}, :value => {:type => Thrift::Types::STRUCT, :class => Nested3}}, |
| 350 | 5 => {:type => Thrift::Types::MAP, :name => 'str_map', :key => {:type => Thrift::Types::STRING}, :value => {:type => Thrift::Types::STRUCT, :class => Nested3}} |
| 351 | } |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 352 | |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 353 | def struct_fields; FIELDS; end |
| 354 | |
| Kevin Clark | c85fd50 | 2009-01-14 23:55:10 +0000 | [diff] [blame] | 355 | def validate |
| 356 | end |
| Dmytro Shteflyuk | 82754d2 | 2026-03-27 12:39:51 -0400 | [diff] [blame^] | 357 | |
| 358 | Thrift::Struct.generate_accessors self |
| Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 359 | end |
| 360 | end |
| 361 | end |