87 87 | "structure",
|
88 88 | 0,
|
89 89 | );
|
90 90 | static COMPLEXSTRUCT_MEMBER_EMPTY_STRUCTURE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
91 91 | ::aws_smithy_schema::ShapeId::from_static(
|
92 92 | "smithy.protocoltests.rpcv2Cbor#ComplexStruct$emptyStructure",
|
93 93 | "smithy.protocoltests.rpcv2Cbor",
|
94 94 | "ComplexStruct",
|
95 95 | ),
|
96 96 | ::aws_smithy_schema::ShapeType::Structure,
|
97 - | "empty_structure",
|
97 + | "emptyStructure",
|
98 98 | 1,
|
99 99 | );
|
100 100 | static COMPLEXSTRUCT_MEMBER_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
101 101 | ::aws_smithy_schema::ShapeId::from_static(
|
102 102 | "smithy.protocoltests.rpcv2Cbor#ComplexStruct$list",
|
103 103 | "smithy.protocoltests.rpcv2Cbor",
|
104 104 | "ComplexStruct",
|
105 105 | ),
|
106 106 | ::aws_smithy_schema::ShapeType::List,
|
107 107 | "list",
|
108 108 | 2,
|
109 109 | );
|
110 110 | static COMPLEXSTRUCT_MEMBER_MAP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
111 111 | ::aws_smithy_schema::ShapeId::from_static(
|
112 112 | "smithy.protocoltests.rpcv2Cbor#ComplexStruct$map",
|
113 113 | "smithy.protocoltests.rpcv2Cbor",
|
114 114 | "ComplexStruct",
|
115 115 | ),
|
116 116 | ::aws_smithy_schema::ShapeType::Map,
|
117 117 | "map",
|
118 118 | 3,
|
119 119 | );
|
120 120 | static COMPLEXSTRUCT_MEMBER_UNION: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
121 121 | ::aws_smithy_schema::ShapeId::from_static(
|
122 122 | "smithy.protocoltests.rpcv2Cbor#ComplexStruct$union",
|
123 123 | "smithy.protocoltests.rpcv2Cbor",
|
124 124 | "ComplexStruct",
|
125 125 | ),
|
126 126 | ::aws_smithy_schema::ShapeType::Union,
|
127 127 | "union",
|
128 128 | 4,
|
129 129 | );
|
130 130 | static COMPLEXSTRUCT_MEMBER_UNIT_UNION: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
131 131 | ::aws_smithy_schema::ShapeId::from_static(
|
132 132 | "smithy.protocoltests.rpcv2Cbor#ComplexStruct$unitUnion",
|
133 133 | "smithy.protocoltests.rpcv2Cbor",
|
134 134 | "ComplexStruct",
|
135 135 | ),
|
136 136 | ::aws_smithy_schema::ShapeType::Union,
|
137 - | "unit_union",
|
137 + | "unitUnion",
|
138 138 | 5,
|
139 139 | );
|
140 140 | static COMPLEXSTRUCT_MEMBER_STRUCTURE_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
141 141 | ::aws_smithy_schema::ShapeId::from_static(
|
142 142 | "smithy.protocoltests.rpcv2Cbor#ComplexStruct$structureList",
|
143 143 | "smithy.protocoltests.rpcv2Cbor",
|
144 144 | "ComplexStruct",
|
145 145 | ),
|
146 146 | ::aws_smithy_schema::ShapeType::List,
|
147 - | "structure_list",
|
147 + | "structureList",
|
148 148 | 6,
|
149 149 | );
|
150 150 | static COMPLEXSTRUCT_MEMBER_COMPLEX_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
151 151 | ::aws_smithy_schema::ShapeId::from_static(
|
152 152 | "smithy.protocoltests.rpcv2Cbor#ComplexStruct$complexList",
|
153 153 | "smithy.protocoltests.rpcv2Cbor",
|
154 154 | "ComplexStruct",
|
155 155 | ),
|
156 156 | ::aws_smithy_schema::ShapeType::List,
|
157 - | "complex_list",
|
157 + | "complexList",
|
158 158 | 7,
|
159 159 | );
|
160 160 | static COMPLEXSTRUCT_MEMBER_COMPLEX_MAP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
161 161 | ::aws_smithy_schema::ShapeId::from_static(
|
162 162 | "smithy.protocoltests.rpcv2Cbor#ComplexStruct$complexMap",
|
163 163 | "smithy.protocoltests.rpcv2Cbor",
|
164 164 | "ComplexStruct",
|
165 165 | ),
|
166 166 | ::aws_smithy_schema::ShapeType::Map,
|
167 - | "complex_map",
|
167 + | "complexMap",
|
168 168 | 8,
|
169 169 | );
|
170 170 | static COMPLEXSTRUCT_MEMBER_COMPLEX_UNION: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
171 171 | ::aws_smithy_schema::ShapeId::from_static(
|
172 172 | "smithy.protocoltests.rpcv2Cbor#ComplexStruct$complexUnion",
|
173 173 | "smithy.protocoltests.rpcv2Cbor",
|
174 174 | "ComplexStruct",
|
175 175 | ),
|
176 176 | ::aws_smithy_schema::ShapeType::Union,
|
177 - | "complex_union",
|
177 + | "complexUnion",
|
178 178 | 9,
|
179 179 | );
|
180 180 | static COMPLEXSTRUCT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
|
181 181 | COMPLEXSTRUCT_SCHEMA_ID,
|
182 182 | ::aws_smithy_schema::ShapeType::Structure,
|
183 183 | &[
|
184 184 | &COMPLEXSTRUCT_MEMBER_STRUCTURE,
|
185 185 | &COMPLEXSTRUCT_MEMBER_EMPTY_STRUCTURE,
|
186 186 | &COMPLEXSTRUCT_MEMBER_LIST,
|
187 187 | &COMPLEXSTRUCT_MEMBER_MAP,
|
188 188 | &COMPLEXSTRUCT_MEMBER_UNION,
|
189 189 | &COMPLEXSTRUCT_MEMBER_UNIT_UNION,
|
190 190 | &COMPLEXSTRUCT_MEMBER_STRUCTURE_LIST,
|
191 191 | &COMPLEXSTRUCT_MEMBER_COMPLEX_LIST,
|
192 192 | &COMPLEXSTRUCT_MEMBER_COMPLEX_MAP,
|
193 193 | &COMPLEXSTRUCT_MEMBER_COMPLEX_UNION,
|
194 194 | ],
|
195 195 | );
|
196 196 | impl ComplexStruct {
|
197 197 | /// The schema for this shape.
|
198 198 | pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &COMPLEXSTRUCT_SCHEMA;
|
199 199 | }
|
200 200 | impl ::aws_smithy_schema::serde::SerializableStruct for ComplexStruct {
|
201 201 | #[allow(unused_variables, clippy::diverging_sub_expression)]
|
202 202 | fn serialize_members(
|
203 203 | &self,
|
204 204 | ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
|
205 205 | ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
|
206 206 | if let Some(ref val) = self.structure {
|
207 207 | ser.write_struct(&COMPLEXSTRUCT_MEMBER_STRUCTURE, val)?;
|
208 208 | }
|
209 209 | if let Some(ref val) = self.empty_structure {
|
210 210 | ser.write_struct(&COMPLEXSTRUCT_MEMBER_EMPTY_STRUCTURE, val)?;
|
211 211 | }
|
212 212 | if let Some(ref val) = self.list {
|
213 213 | ser.write_list(
|
214 214 | &COMPLEXSTRUCT_MEMBER_LIST,
|
215 215 | &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
|
216 216 | for item in val {
|
217 217 | ser.write_string(&aws_smithy_schema::prelude::STRING, item)?;
|
218 218 | }
|
219 219 | Ok(())
|
220 220 | },
|
221 221 | )?;
|
222 222 | }
|
223 223 | if let Some(ref val) = self.map {
|
224 224 | ser.write_map(&COMPLEXSTRUCT_MEMBER_MAP, &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
|
225 225 | for (key, value) in val {
|
226 226 | ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
|
227 227 | ser.write_integer(&::aws_smithy_schema::prelude::INTEGER, *value)?;
|
228 228 | }
|
229 229 | Ok(())
|
230 230 | })?;
|
231 231 | }
|
232 232 | if let Some(ref val) = self.union {
|
233 - | ser.write_null(&COMPLEXSTRUCT_MEMBER_UNION)?;
|
233 + | ser.write_struct(&COMPLEXSTRUCT_MEMBER_UNION, val)?;
|
234 234 | }
|
235 235 | if let Some(ref val) = self.unit_union {
|
236 - | ser.write_null(&COMPLEXSTRUCT_MEMBER_UNIT_UNION)?;
|
236 + | ser.write_struct(&COMPLEXSTRUCT_MEMBER_UNIT_UNION, val)?;
|
237 237 | }
|
238 238 | if let Some(ref val) = self.structure_list {
|
239 239 | ser.write_list(
|
240 240 | &COMPLEXSTRUCT_MEMBER_STRUCTURE_LIST,
|
241 241 | &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
|
242 242 | for item in val {
|
243 243 | ser.write_struct(crate::types::SimpleStruct::SCHEMA, item)?;
|
244 244 | }
|
245 245 | Ok(())
|
246 246 | },
|
247 247 | )?;
|
248 248 | }
|
249 249 | {
|
250 250 | let val = &self.complex_list;
|
251 251 |
|
252 252 | ser.write_list(
|
253 253 | &COMPLEXSTRUCT_MEMBER_COMPLEX_LIST,
|
254 254 | &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
|
255 255 | for item in val {
|
256 - | todo!("schema: unsupported list element type");
|
256 + | ser.write_map(
|
257 + | &::aws_smithy_schema::prelude::DOCUMENT,
|
258 + | &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
|
259 + | for (key, value) in item {
|
260 + | ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
|
261 + | ser.write_struct(crate::types::ComplexUnion::SCHEMA, value)?;
|
262 + | }
|
263 + | Ok(())
|
264 + | },
|
265 + | )?;
|
257 266 | }
|
258 267 | Ok(())
|
259 268 | },
|
260 269 | )?;
|
261 270 | }
|
262 271 | {
|
263 272 | let val = &self.complex_map;
|
264 273 |
|
265 274 | ser.write_map(
|
266 275 | &COMPLEXSTRUCT_MEMBER_COMPLEX_MAP,
|
267 276 | &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
|
268 277 | for (key, value) in val {
|
269 278 | ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
|
270 - | todo!("schema: unsupported map value type");
|
279 + | ser.write_struct(crate::types::ComplexUnion::SCHEMA, value)?;
|
271 280 | }
|
272 281 | Ok(())
|
273 282 | },
|
274 283 | )?;
|
275 284 | }
|
276 285 | {
|
277 286 | let val = &self.complex_union;
|
278 - | ser.write_null(&COMPLEXSTRUCT_MEMBER_COMPLEX_UNION)?;
|
287 + | ser.write_struct(&COMPLEXSTRUCT_MEMBER_COMPLEX_UNION, val)?;
|
279 288 | }
|
280 289 | Ok(())
|
281 290 | }
|
282 291 | }
|
283 292 | impl ComplexStruct {
|
284 293 | /// Deserializes this structure from a [`ShapeDeserializer`].
|
285 - | pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
|
286 - | deserializer: &mut D,
|
294 + | pub fn deserialize(
|
295 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
287 296 | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
288 297 | #[allow(unused_variables, unused_mut)]
|
289 298 | let mut builder = Self::builder();
|
290 299 | #[allow(
|
291 300 | unused_variables,
|
292 301 | unreachable_code,
|
293 302 | clippy::single_match,
|
294 303 | clippy::match_single_binding,
|
295 304 | clippy::diverging_sub_expression
|
296 305 | )]
|
297 - | deserializer.read_struct(&COMPLEXSTRUCT_SCHEMA, (), |_, member, deser| {
|
306 + | deserializer.read_struct(&COMPLEXSTRUCT_SCHEMA, &mut |member, deser| {
|
298 307 | match member.member_index() {
|
299 308 | Some(0) => {
|
300 309 | builder.structure = Some(crate::types::SimpleStruct::deserialize(deser)?);
|
301 310 | }
|
302 311 | Some(1) => {
|
303 312 | builder.empty_structure = Some(crate::types::EmptyStruct::deserialize(deser)?);
|
304 313 | }
|
305 314 | Some(2) => {
|
306 - | builder.list = Some({
|
307 - | let container = if let Some(cap) = deser.container_size() {
|
308 - | Vec::with_capacity(cap)
|
309 - | } else {
|
310 - | Vec::new()
|
311 - | };
|
312 - | deser.read_list(member, container, |mut list, deser| {
|
313 - | list.push(deser.read_string(member)?);
|
314 - | Ok(list)
|
315 - | })?
|
316 - | });
|
315 + | builder.list = Some(deser.read_string_list(member)?);
|
317 316 | }
|
318 317 | Some(3) => {
|
319 318 | builder.map = Some({
|
320 - | let container = if let Some(cap) = deser.container_size() {
|
321 - | std::collections::HashMap::with_capacity(cap)
|
322 - | } else {
|
323 - | std::collections::HashMap::new()
|
324 - | };
|
325 - | deser.read_map(member, container, |mut map, key, deser| {
|
326 - | map.insert(key, deser.read_integer(member)?);
|
327 - | Ok(map)
|
328 - | })?
|
319 + | let mut container = std::collections::HashMap::new();
|
320 + | deser.read_map(member, &mut |key, deser| {
|
321 + | container.insert(key, deser.read_integer(member)?);
|
322 + | Ok(())
|
323 + | })?;
|
324 + | container
|
329 325 | });
|
330 326 | }
|
331 327 | Some(4) => {
|
332 - | builder.union = Some({
|
333 - | let _ = member;
|
334 - | todo!("deserialize aggregate")
|
335 - | });
|
328 + | builder.union = Some(crate::types::SimpleUnion::deserialize(deser)?);
|
336 329 | }
|
337 330 | Some(5) => {
|
338 - | builder.unit_union = Some({
|
339 - | let _ = member;
|
340 - | todo!("deserialize aggregate")
|
341 - | });
|
331 + | builder.unit_union = Some(crate::types::UnitUnion::deserialize(deser)?);
|
342 332 | }
|
343 333 | Some(6) => {
|
344 334 | builder.structure_list = Some({
|
345 - | let container = if let Some(cap) = deser.container_size() {
|
346 - | Vec::with_capacity(cap)
|
347 - | } else {
|
348 - | Vec::new()
|
349 - | };
|
350 - | deser.read_list(member, container, |mut list, deser| {
|
351 - | list.push(crate::types::SimpleStruct::deserialize(deser)?);
|
352 - | Ok(list)
|
353 - | })?
|
335 + | let mut container = Vec::new();
|
336 + | deser.read_list(member, &mut |deser| {
|
337 + | container.push(crate::types::SimpleStruct::deserialize(deser)?);
|
338 + | Ok(())
|
339 + | })?;
|
340 + | container
|
354 341 | });
|
355 342 | }
|
356 343 | Some(7) => {
|
357 344 | builder.complex_list = Some({
|
358 - | let container = if let Some(cap) = deser.container_size() {
|
359 - | Vec::with_capacity(cap)
|
360 - | } else {
|
361 - | Vec::new()
|
362 - | };
|
363 - | deser.read_list(member, container, |mut list, deser| {
|
364 - | list.push(todo!("deserialize nested aggregate"));
|
365 - | Ok(list)
|
366 - | })?
|
345 + | let mut container = Vec::new();
|
346 + | deser.read_list(member, &mut |deser| {
|
347 + | container.push({
|
348 + | let mut map = ::std::collections::HashMap::new();
|
349 + | deser.read_map(member, &mut |key, deser| {
|
350 + | let value = crate::types::ComplexUnion::deserialize(deser)?;
|
351 + | map.insert(key, value);
|
352 + | Ok(())
|
353 + | })?;
|
354 + | map
|
355 + | });
|
356 + | Ok(())
|
357 + | })?;
|
358 + | container
|
367 359 | });
|
368 360 | }
|
369 361 | Some(8) => {
|
370 362 | builder.complex_map = Some({
|
371 - | let container = if let Some(cap) = deser.container_size() {
|
372 - | std::collections::HashMap::with_capacity(cap)
|
373 - | } else {
|
374 - | std::collections::HashMap::new()
|
375 - | };
|
376 - | deser.read_map(member, container, |mut map, key, deser| {
|
377 - | map.insert(key, todo!("deserialize nested aggregate"));
|
378 - | Ok(map)
|
379 - | })?
|
363 + | let mut container = std::collections::HashMap::new();
|
364 + | deser.read_map(member, &mut |key, deser| {
|
365 + | container.insert(key, crate::types::ComplexUnion::deserialize(deser)?);
|
366 + | Ok(())
|
367 + | })?;
|
368 + | container
|
380 369 | });
|
381 370 | }
|
382 371 | Some(9) => {
|
383 - | builder.complex_union = Some(Box::new({
|
384 - | let _ = member;
|
385 - | todo!("deserialize aggregate")
|
386 - | }));
|
372 + | builder.complex_union = Some(Box::new(crate::types::ComplexUnion::deserialize(deser)?));
|
387 373 | }
|
388 374 | _ => {}
|
389 375 | }
|
390 376 | Ok(())
|
391 377 | })?;
|
378 + | builder.complex_list = builder.complex_list.or(Some(Vec::new()));
|
379 + | builder.complex_map = builder.complex_map.or(Some(::std::collections::HashMap::new()));
|
392 380 | builder
|
393 381 | .build()
|
394 382 | .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
|
395 383 | }
|
396 384 | }
|
385 + | impl ComplexStruct {
|
386 + | /// Deserializes this structure from a body deserializer and HTTP response.
|
387 + | pub fn deserialize_with_response(
|
388 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
389 + | _headers: &::aws_smithy_runtime_api::http::Headers,
|
390 + | _status: u16,
|
391 + | _body: &[u8],
|
392 + | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
393 + | Self::deserialize(deserializer)
|
394 + | }
|
395 + | }
|
397 396 | impl ComplexStruct {
|
398 397 | /// Creates a new builder-style object to manufacture [`ComplexStruct`](crate::types::ComplexStruct).
|
399 398 | pub fn builder() -> crate::types::builders::ComplexStructBuilder {
|
400 399 | crate::types::builders::ComplexStructBuilder::default()
|
401 400 | }
|
402 401 | }
|
403 402 |
|
404 403 | /// A builder for [`ComplexStruct`](crate::types::ComplexStruct).
|
405 404 | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
|
406 405 | #[non_exhaustive]
|