1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | ::pin_project_lite::pin_project! {
|
3 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
4 + | /// [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput) using modelled bindings.
|
5 + | pub struct ContentTypeParametersInputFuture {
|
6 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::ContentTypeParametersInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
7 + | }
|
8 + | }
|
9 + |
|
10 + | impl std::future::Future for ContentTypeParametersInputFuture {
|
11 + | type Output = Result<
|
12 + | crate::input::ContentTypeParametersInput,
|
13 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
14 + | >;
|
15 + |
|
16 + | fn poll(
|
17 + | self: std::pin::Pin<&mut Self>,
|
18 + | cx: &mut std::task::Context<'_>,
|
19 + | ) -> std::task::Poll<Self::Output> {
|
20 + | let this = self.project();
|
21 + | this.inner.as_mut().poll(cx)
|
22 + | }
|
23 + | }
|
24 + |
|
25 + | impl<B>
|
26 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
27 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
28 + | B,
|
29 + | > for crate::input::ContentTypeParametersInput
|
30 + | where
|
31 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
32 + | B: 'static,
|
33 + |
|
34 + | B::Data: Send,
|
35 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
36 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
37 + | {
|
38 + | type Rejection =
|
39 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
40 + | type Future = ContentTypeParametersInputFuture;
|
41 + |
|
42 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
43 + | let fut = async move {
|
44 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
45 + | request.headers(),
|
46 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
47 + | ) {
|
48 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
49 + | }
|
50 + | crate::protocol_serde::shape_content_type_parameters::de_content_type_parameters_http_request(request)
|
51 + | .await
|
52 + | };
|
53 + | use ::futures_util::future::TryFutureExt;
|
54 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
55 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
56 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
57 + | });
|
58 + | ContentTypeParametersInputFuture {
|
59 + | inner: Box::pin(fut),
|
60 + | }
|
61 + | }
|
62 + | }
|
63 + | impl
|
64 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
65 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
66 + | > for crate::output::ContentTypeParametersOutput
|
67 + | {
|
68 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
69 + | match crate::protocol_serde::shape_content_type_parameters::ser_content_type_parameters_http_response(self) {
|
70 + | Ok(response) => response,
|
71 + | Err(e) => {
|
72 + | ::tracing::error!(error = %e, "failed to serialize response");
|
73 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
74 + | }
|
75 + | }
|
76 + | }
|
77 + | }
|
78 + |
|
79 + | #[allow(unreachable_code, unused_variables)]
|
80 + | #[cfg(test)]
|
81 + | mod content_type_parameters_test {
|
82 + |
|
83 + | /// A server should ignore parameters added to the content type
|
84 + | /// Test ID: AwsJson11MustSupportParametersInContentType
|
85 + | #[::tokio::test]
|
86 + | #[::tracing_test::traced_test]
|
87 + | async fn aws_json11_must_support_parameters_in_content_type_request() {
|
88 + | #[allow(unused_mut)]
|
89 + | let mut http_request = ::http::Request::builder()
|
90 + | .uri("/")
|
91 + | .method("POST")
|
92 + | .header("Content-Type", "application/x-amz-json-1.1; charset=utf-8")
|
93 + | .header("X-Amz-Target", "JsonProtocol.ContentTypeParameters")
|
94 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
95 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
96 + | "{\"value\":5}".as_bytes(),
|
97 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
98 + | )),
|
99 + | ))
|
100 + | .unwrap();
|
101 + | #[allow(unused_mut)]
|
102 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
103 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
104 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
105 + | .content_type_parameters(move |input: crate::input::ContentTypeParametersInput| {
|
106 + | let sender = sender.clone();
|
107 + | async move {
|
108 + | let result = {
|
109 + | let expected = crate::input::ContentTypeParametersInput {
|
110 + | value: ::std::option::Option::Some(5),
|
111 + | };
|
112 + | ::pretty_assertions::assert_eq!(input, expected);
|
113 + | let output = crate::output::ContentTypeParametersOutput {};
|
114 + | output
|
115 + | };
|
116 + | sender.send(()).await.expect("receiver dropped early");
|
117 + | result
|
118 + | }
|
119 + | })
|
120 + | .build_unchecked();
|
121 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
122 + | .await
|
123 + | .expect("unable to make an HTTP request");
|
124 + | assert!(
|
125 + | receiver.recv().await.is_some(),
|
126 + | "we expected operation handler to be invoked but it was not entered"
|
127 + | );
|
128 + | }
|
129 + | }
|
130 + |
|
131 + | ::pin_project_lite::pin_project! {
|
132 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
133 + | /// [`PutWithContentEncodingInput`](crate::input::PutWithContentEncodingInput) using modelled bindings.
|
134 + | pub struct PutWithContentEncodingInputFuture {
|
135 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::PutWithContentEncodingInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
136 + | }
|
137 + | }
|
138 + |
|
139 + | impl std::future::Future for PutWithContentEncodingInputFuture {
|
140 + | type Output = Result<
|
141 + | crate::input::PutWithContentEncodingInput,
|
142 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
143 + | >;
|
144 + |
|
145 + | fn poll(
|
146 + | self: std::pin::Pin<&mut Self>,
|
147 + | cx: &mut std::task::Context<'_>,
|
148 + | ) -> std::task::Poll<Self::Output> {
|
149 + | let this = self.project();
|
150 + | this.inner.as_mut().poll(cx)
|
151 + | }
|
152 + | }
|
153 + |
|
154 + | impl<B>
|
155 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
156 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
157 + | B,
|
158 + | > for crate::input::PutWithContentEncodingInput
|
159 + | where
|
160 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
161 + | B: 'static,
|
162 + |
|
163 + | B::Data: Send,
|
164 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
165 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
166 + | {
|
167 + | type Rejection =
|
168 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
169 + | type Future = PutWithContentEncodingInputFuture;
|
170 + |
|
171 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
172 + | let fut = async move {
|
173 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
174 + | request.headers(),
|
175 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
176 + | ) {
|
177 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
178 + | }
|
179 + | crate::protocol_serde::shape_put_with_content_encoding::de_put_with_content_encoding_http_request(request)
|
180 + | .await
|
181 + | };
|
182 + | use ::futures_util::future::TryFutureExt;
|
183 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
184 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
185 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
186 + | });
|
187 + | PutWithContentEncodingInputFuture {
|
188 + | inner: Box::pin(fut),
|
189 + | }
|
190 + | }
|
191 + | }
|
192 + | impl
|
193 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
194 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
195 + | > for crate::output::PutWithContentEncodingOutput
|
196 + | {
|
197 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
198 + | match crate::protocol_serde::shape_put_with_content_encoding::ser_put_with_content_encoding_http_response(self) {
|
199 + | Ok(response) => response,
|
200 + | Err(e) => {
|
201 + | ::tracing::error!(error = %e, "failed to serialize response");
|
202 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
203 + | }
|
204 + | }
|
205 + | }
|
206 + | }
|
207 + |
|
208 + | ::pin_project_lite::pin_project! {
|
209 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
210 + | /// [`FractionalSecondsInput`](crate::input::FractionalSecondsInput) using modelled bindings.
|
211 + | pub struct FractionalSecondsInputFuture {
|
212 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::FractionalSecondsInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
213 + | }
|
214 + | }
|
215 + |
|
216 + | impl std::future::Future for FractionalSecondsInputFuture {
|
217 + | type Output = Result<
|
218 + | crate::input::FractionalSecondsInput,
|
219 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
220 + | >;
|
221 + |
|
222 + | fn poll(
|
223 + | self: std::pin::Pin<&mut Self>,
|
224 + | cx: &mut std::task::Context<'_>,
|
225 + | ) -> std::task::Poll<Self::Output> {
|
226 + | let this = self.project();
|
227 + | this.inner.as_mut().poll(cx)
|
228 + | }
|
229 + | }
|
230 + |
|
231 + | impl<B>
|
232 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
233 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
234 + | B,
|
235 + | > for crate::input::FractionalSecondsInput
|
236 + | where
|
237 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
238 + | B: 'static,
|
239 + |
|
240 + | B::Data: Send,
|
241 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
242 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
243 + | {
|
244 + | type Rejection =
|
245 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
246 + | type Future = FractionalSecondsInputFuture;
|
247 + |
|
248 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
249 + | let fut = async move {
|
250 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
251 + | request.headers(),
|
252 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
253 + | ) {
|
254 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
255 + | }
|
256 + | crate::protocol_serde::shape_fractional_seconds::de_fractional_seconds_http_request(
|
257 + | request,
|
258 + | )
|
259 + | .await
|
260 + | };
|
261 + | use ::futures_util::future::TryFutureExt;
|
262 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
263 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
264 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
265 + | });
|
266 + | FractionalSecondsInputFuture {
|
267 + | inner: Box::pin(fut),
|
268 + | }
|
269 + | }
|
270 + | }
|
271 + | impl
|
272 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
273 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
274 + | > for crate::output::FractionalSecondsOutput
|
275 + | {
|
276 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
277 + | match crate::protocol_serde::shape_fractional_seconds::ser_fractional_seconds_http_response(
|
278 + | self,
|
279 + | ) {
|
280 + | Ok(response) => response,
|
281 + | Err(e) => {
|
282 + | ::tracing::error!(error = %e, "failed to serialize response");
|
283 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
284 + | }
|
285 + | }
|
286 + | }
|
287 + | }
|
288 + |
|
289 + | ::pin_project_lite::pin_project! {
|
290 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
291 + | /// [`DatetimeOffsetsInput`](crate::input::DatetimeOffsetsInput) using modelled bindings.
|
292 + | pub struct DatetimeOffsetsInputFuture {
|
293 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::DatetimeOffsetsInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
294 + | }
|
295 + | }
|
296 + |
|
297 + | impl std::future::Future for DatetimeOffsetsInputFuture {
|
298 + | type Output = Result<
|
299 + | crate::input::DatetimeOffsetsInput,
|
300 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
301 + | >;
|
302 + |
|
303 + | fn poll(
|
304 + | self: std::pin::Pin<&mut Self>,
|
305 + | cx: &mut std::task::Context<'_>,
|
306 + | ) -> std::task::Poll<Self::Output> {
|
307 + | let this = self.project();
|
308 + | this.inner.as_mut().poll(cx)
|
309 + | }
|
310 + | }
|
311 + |
|
312 + | impl<B>
|
313 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
314 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
315 + | B,
|
316 + | > for crate::input::DatetimeOffsetsInput
|
317 + | where
|
318 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
319 + | B: 'static,
|
320 + |
|
321 + | B::Data: Send,
|
322 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
323 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
324 + | {
|
325 + | type Rejection =
|
326 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
327 + | type Future = DatetimeOffsetsInputFuture;
|
328 + |
|
329 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
330 + | let fut = async move {
|
331 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
332 + | request.headers(),
|
333 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
334 + | ) {
|
335 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
336 + | }
|
337 + | crate::protocol_serde::shape_datetime_offsets::de_datetime_offsets_http_request(request)
|
338 + | .await
|
339 + | };
|
340 + | use ::futures_util::future::TryFutureExt;
|
341 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
342 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
343 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
344 + | });
|
345 + | DatetimeOffsetsInputFuture {
|
346 + | inner: Box::pin(fut),
|
347 + | }
|
348 + | }
|
349 + | }
|
350 + | impl
|
351 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
352 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
353 + | > for crate::output::DatetimeOffsetsOutput
|
354 + | {
|
355 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
356 + | match crate::protocol_serde::shape_datetime_offsets::ser_datetime_offsets_http_response(
|
357 + | self,
|
358 + | ) {
|
359 + | Ok(response) => response,
|
360 + | Err(e) => {
|
361 + | ::tracing::error!(error = %e, "failed to serialize response");
|
362 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
363 + | }
|
364 + | }
|
365 + | }
|
366 + | }
|
367 + |
|
368 + | ::pin_project_lite::pin_project! {
|
369 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
370 + | /// [`HostWithPathOperationInput`](crate::input::HostWithPathOperationInput) using modelled bindings.
|
371 + | pub struct HostWithPathOperationInputFuture {
|
372 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::HostWithPathOperationInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
373 + | }
|
374 + | }
|
375 + |
|
376 + | impl std::future::Future for HostWithPathOperationInputFuture {
|
377 + | type Output = Result<
|
378 + | crate::input::HostWithPathOperationInput,
|
379 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
380 + | >;
|
381 + |
|
382 + | fn poll(
|
383 + | self: std::pin::Pin<&mut Self>,
|
384 + | cx: &mut std::task::Context<'_>,
|
385 + | ) -> std::task::Poll<Self::Output> {
|
386 + | let this = self.project();
|
387 + | this.inner.as_mut().poll(cx)
|
388 + | }
|
389 + | }
|
390 + |
|
391 + | impl<B>
|
392 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
393 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
394 + | B,
|
395 + | > for crate::input::HostWithPathOperationInput
|
396 + | where
|
397 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
398 + | B: 'static,
|
399 + |
|
400 + | B::Data: Send,
|
401 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
402 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
403 + | {
|
404 + | type Rejection =
|
405 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
406 + | type Future = HostWithPathOperationInputFuture;
|
407 + |
|
408 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
409 + | let fut = async move {
|
410 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
411 + | request.headers(),
|
412 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
413 + | ) {
|
414 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
415 + | }
|
416 + | crate::protocol_serde::shape_host_with_path_operation::de_host_with_path_operation_http_request(request)
|
417 + | .await
|
418 + | };
|
419 + | use ::futures_util::future::TryFutureExt;
|
420 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
421 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
422 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
423 + | });
|
424 + | HostWithPathOperationInputFuture {
|
425 + | inner: Box::pin(fut),
|
426 + | }
|
427 + | }
|
428 + | }
|
429 + | impl
|
430 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
431 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
432 + | > for crate::output::HostWithPathOperationOutput
|
433 + | {
|
434 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
435 + | match crate::protocol_serde::shape_host_with_path_operation::ser_host_with_path_operation_http_response(self) {
|
436 + | Ok(response) => response,
|
437 + | Err(e) => {
|
438 + | ::tracing::error!(error = %e, "failed to serialize response");
|
439 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
440 + | }
|
441 + | }
|
442 + | }
|
443 + | }
|
444 + |
|
445 + | ::pin_project_lite::pin_project! {
|
446 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
447 + | /// [`EndpointWithHostLabelOperationInput`](crate::input::EndpointWithHostLabelOperationInput) using modelled bindings.
|
448 + | pub struct EndpointWithHostLabelOperationInputFuture {
|
449 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EndpointWithHostLabelOperationInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
450 + | }
|
451 + | }
|
452 + |
|
453 + | impl std::future::Future for EndpointWithHostLabelOperationInputFuture {
|
454 + | type Output = Result<
|
455 + | crate::input::EndpointWithHostLabelOperationInput,
|
456 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
457 + | >;
|
458 + |
|
459 + | fn poll(
|
460 + | self: std::pin::Pin<&mut Self>,
|
461 + | cx: &mut std::task::Context<'_>,
|
462 + | ) -> std::task::Poll<Self::Output> {
|
463 + | let this = self.project();
|
464 + | this.inner.as_mut().poll(cx)
|
465 + | }
|
466 + | }
|
467 + |
|
468 + | impl<B>
|
469 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
470 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
471 + | B,
|
472 + | > for crate::input::EndpointWithHostLabelOperationInput
|
473 + | where
|
474 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
475 + | B: 'static,
|
476 + |
|
477 + | B::Data: Send,
|
478 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
479 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
480 + | {
|
481 + | type Rejection =
|
482 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
483 + | type Future = EndpointWithHostLabelOperationInputFuture;
|
484 + |
|
485 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
486 + | let fut = async move {
|
487 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
488 + | request.headers(),
|
489 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
490 + | ) {
|
491 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
492 + | }
|
493 + | crate::protocol_serde::shape_endpoint_with_host_label_operation::de_endpoint_with_host_label_operation_http_request(request)
|
494 + | .await
|
495 + | };
|
496 + | use ::futures_util::future::TryFutureExt;
|
497 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
498 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
499 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
500 + | });
|
501 + | EndpointWithHostLabelOperationInputFuture {
|
502 + | inner: Box::pin(fut),
|
503 + | }
|
504 + | }
|
505 + | }
|
506 + | impl
|
507 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
508 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
509 + | > for crate::output::EndpointWithHostLabelOperationOutput
|
510 + | {
|
511 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
512 + | match crate::protocol_serde::shape_endpoint_with_host_label_operation::ser_endpoint_with_host_label_operation_http_response(self) {
|
513 + | Ok(response) => response,
|
514 + | Err(e) => {
|
515 + | ::tracing::error!(error = %e, "failed to serialize response");
|
516 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
517 + | }
|
518 + | }
|
519 + | }
|
520 + | }
|
521 + | impl
|
522 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
523 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
524 + | > for crate::error::EndpointWithHostLabelOperationError
|
525 + | {
|
526 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
527 + | match crate::protocol_serde::shape_endpoint_with_host_label_operation::ser_endpoint_with_host_label_operation_http_error(&self) {
|
528 + | Ok(mut response) => {
|
529 + | response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
530 + | response
|
531 + | },
|
532 + | Err(e) => {
|
533 + | ::tracing::error!(error = %e, "failed to serialize response");
|
534 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
535 + | }
|
536 + | }
|
537 + | }
|
538 + | }
|
539 + |
|
540 + | #[allow(unreachable_code, unused_variables)]
|
541 + | #[cfg(test)]
|
542 + | mod endpoint_with_host_label_operation_test {
|
543 + |
|
544 + | /// Operations can prepend to the given host if they define the
|
545 + | /// endpoint trait, and can use the host label trait to define
|
546 + | /// further customization based on user input.
|
547 + | /// Test ID: AwsJson11EndpointTraitWithHostLabel
|
548 + | #[::tokio::test]
|
549 + | #[::tracing_test::traced_test]
|
550 + | #[should_panic]
|
551 + | async fn aws_json11_endpoint_trait_with_host_label_request() {
|
552 + | #[allow(unused_mut)]
|
553 + | let mut http_request = ::http::Request::builder()
|
554 + | .uri("/")
|
555 + | .method("POST")
|
556 + | .header("Content-Type", "application/x-amz-json-1.1")
|
557 + | .header(
|
558 + | "X-Amz-Target",
|
559 + | "JsonProtocol.EndpointWithHostLabelOperation",
|
560 + | )
|
561 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
562 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
563 + | "{\"label\": \"bar\"}".as_bytes(),
|
564 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
565 + | )),
|
566 + | ))
|
567 + | .unwrap();
|
568 + | todo!("endpoint trait not supported yet");
|
569 + | #[allow(unused_mut)]
|
570 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
571 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
572 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
573 + | .endpoint_with_host_label_operation(
|
574 + | move |input: crate::input::EndpointWithHostLabelOperationInput| {
|
575 + | let sender = sender.clone();
|
576 + | async move {
|
577 + | let result = {
|
578 + | let expected = crate::input::EndpointWithHostLabelOperationInput {
|
579 + | label: "bar".to_owned(),
|
580 + | };
|
581 + | ::pretty_assertions::assert_eq!(input, expected);
|
582 + | let output = crate::output::EndpointWithHostLabelOperationOutput {};
|
583 + | Ok(output)
|
584 + | };
|
585 + | sender.send(()).await.expect("receiver dropped early");
|
586 + | result
|
587 + | }
|
588 + | },
|
589 + | )
|
590 + | .build_unchecked();
|
591 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
592 + | .await
|
593 + | .expect("unable to make an HTTP request");
|
594 + | assert!(
|
595 + | receiver.recv().await.is_some(),
|
596 + | "we expected operation handler to be invoked but it was not entered"
|
597 + | );
|
598 + | }
|
599 + | }
|
600 + |
|
601 + | ::pin_project_lite::pin_project! {
|
602 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
603 + | /// [`EndpointOperationInput`](crate::input::EndpointOperationInput) using modelled bindings.
|
604 + | pub struct EndpointOperationInputFuture {
|
605 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EndpointOperationInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
606 + | }
|
607 + | }
|
608 + |
|
609 + | impl std::future::Future for EndpointOperationInputFuture {
|
610 + | type Output = Result<
|
611 + | crate::input::EndpointOperationInput,
|
612 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
613 + | >;
|
614 + |
|
615 + | fn poll(
|
616 + | self: std::pin::Pin<&mut Self>,
|
617 + | cx: &mut std::task::Context<'_>,
|
618 + | ) -> std::task::Poll<Self::Output> {
|
619 + | let this = self.project();
|
620 + | this.inner.as_mut().poll(cx)
|
621 + | }
|
622 + | }
|
623 + |
|
624 + | impl<B>
|
625 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
626 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
627 + | B,
|
628 + | > for crate::input::EndpointOperationInput
|
629 + | where
|
630 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
631 + | B: 'static,
|
632 + |
|
633 + | B::Data: Send,
|
634 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
635 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
636 + | {
|
637 + | type Rejection =
|
638 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
639 + | type Future = EndpointOperationInputFuture;
|
640 + |
|
641 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
642 + | let fut = async move {
|
643 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
644 + | request.headers(),
|
645 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
646 + | ) {
|
647 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
648 + | }
|
649 + | crate::protocol_serde::shape_endpoint_operation::de_endpoint_operation_http_request(
|
650 + | request,
|
651 + | )
|
652 + | .await
|
653 + | };
|
654 + | use ::futures_util::future::TryFutureExt;
|
655 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
656 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
657 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
658 + | });
|
659 + | EndpointOperationInputFuture {
|
660 + | inner: Box::pin(fut),
|
661 + | }
|
662 + | }
|
663 + | }
|
664 + | impl
|
665 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
666 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
667 + | > for crate::output::EndpointOperationOutput
|
668 + | {
|
669 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
670 + | match crate::protocol_serde::shape_endpoint_operation::ser_endpoint_operation_http_response(
|
671 + | self,
|
672 + | ) {
|
673 + | Ok(response) => response,
|
674 + | Err(e) => {
|
675 + | ::tracing::error!(error = %e, "failed to serialize response");
|
676 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
677 + | }
|
678 + | }
|
679 + | }
|
680 + | }
|
681 + |
|
682 + | #[allow(unreachable_code, unused_variables)]
|
683 + | #[cfg(test)]
|
684 + | mod endpoint_operation_test {
|
685 + |
|
686 + | /// Operations can prepend to the given host if they define the
|
687 + | /// endpoint trait.
|
688 + | /// Test ID: AwsJson11EndpointTrait
|
689 + | #[::tokio::test]
|
690 + | #[::tracing_test::traced_test]
|
691 + | #[should_panic]
|
692 + | async fn aws_json11_endpoint_trait_request() {
|
693 + | #[allow(unused_mut)]
|
694 + | let mut http_request = ::http::Request::builder()
|
695 + | .uri("/")
|
696 + | .method("POST")
|
697 + | .header("Content-Type", "application/x-amz-json-1.1")
|
698 + | .header("X-Amz-Target", "JsonProtocol.EndpointOperation")
|
699 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
700 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
701 + | "{}".as_bytes(),
|
702 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
703 + | )),
|
704 + | ))
|
705 + | .unwrap();
|
706 + | todo!("endpoint trait not supported yet");
|
707 + | #[allow(unused_mut)]
|
708 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
709 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
710 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
711 + | .endpoint_operation(move |input: crate::input::EndpointOperationInput| {
|
712 + | let sender = sender.clone();
|
713 + | async move {
|
714 + | let result = {
|
715 + | let expected = crate::input::EndpointOperationInput {};
|
716 + | ::pretty_assertions::assert_eq!(input, expected);
|
717 + | let output = crate::output::EndpointOperationOutput {};
|
718 + | output
|
719 + | };
|
720 + | sender.send(()).await.expect("receiver dropped early");
|
721 + | result
|
722 + | }
|
723 + | })
|
724 + | .build_unchecked();
|
725 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
726 + | .await
|
727 + | .expect("unable to make an HTTP request");
|
728 + | assert!(
|
729 + | receiver.recv().await.is_some(),
|
730 + | "we expected operation handler to be invoked but it was not entered"
|
731 + | );
|
732 + | }
|
733 + | }
|
734 + |
|
735 + | ::pin_project_lite::pin_project! {
|
736 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
737 + | /// [`JsonUnionsInput`](crate::input::JsonUnionsInput) using modelled bindings.
|
738 + | pub struct JsonUnionsInputFuture {
|
739 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::JsonUnionsInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
740 + | }
|
741 + | }
|
742 + |
|
743 + | impl std::future::Future for JsonUnionsInputFuture {
|
744 + | type Output = Result<
|
745 + | crate::input::JsonUnionsInput,
|
746 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
747 + | >;
|
748 + |
|
749 + | fn poll(
|
750 + | self: std::pin::Pin<&mut Self>,
|
751 + | cx: &mut std::task::Context<'_>,
|
752 + | ) -> std::task::Poll<Self::Output> {
|
753 + | let this = self.project();
|
754 + | this.inner.as_mut().poll(cx)
|
755 + | }
|
756 + | }
|
757 + |
|
758 + | impl<B>
|
759 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
760 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
761 + | B,
|
762 + | > for crate::input::JsonUnionsInput
|
763 + | where
|
764 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
765 + | B: 'static,
|
766 + |
|
767 + | B::Data: Send,
|
768 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
769 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
770 + | {
|
771 + | type Rejection =
|
772 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
773 + | type Future = JsonUnionsInputFuture;
|
774 + |
|
775 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
776 + | let fut = async move {
|
777 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
778 + | request.headers(),
|
779 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
780 + | ) {
|
781 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
782 + | }
|
783 + | crate::protocol_serde::shape_json_unions::de_json_unions_http_request(request).await
|
784 + | };
|
785 + | use ::futures_util::future::TryFutureExt;
|
786 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
787 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
788 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
789 + | });
|
790 + | JsonUnionsInputFuture {
|
791 + | inner: Box::pin(fut),
|
792 + | }
|
793 + | }
|
794 + | }
|
795 + | impl
|
796 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
797 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
798 + | > for crate::output::JsonUnionsOutput
|
799 + | {
|
800 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
801 + | match crate::protocol_serde::shape_json_unions::ser_json_unions_http_response(self) {
|
802 + | Ok(response) => response,
|
803 + | Err(e) => {
|
804 + | ::tracing::error!(error = %e, "failed to serialize response");
|
805 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
806 + | }
|
807 + | }
|
808 + | }
|
809 + | }
|
810 + | impl
|
811 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
812 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
813 + | > for crate::error::JsonUnionsError
|
814 + | {
|
815 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
816 + | match crate::protocol_serde::shape_json_unions::ser_json_unions_http_error(&self) {
|
817 + | Ok(mut response) => {
|
818 + | response.extensions_mut().insert(
|
819 + | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
820 + | self.name(),
|
821 + | ),
|
822 + | );
|
823 + | response
|
824 + | }
|
825 + | Err(e) => {
|
826 + | ::tracing::error!(error = %e, "failed to serialize response");
|
827 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
828 + | }
|
829 + | }
|
830 + | }
|
831 + | }
|
832 + |
|
833 + | #[allow(unreachable_code, unused_variables)]
|
834 + | #[cfg(test)]
|
835 + | mod json_unions_test {
|
836 + |
|
837 + | /// Serializes a string union value
|
838 + | /// Test ID: AwsJson11SerializeStringUnionValue
|
839 + | #[::tokio::test]
|
840 + | #[::tracing_test::traced_test]
|
841 + | async fn aws_json11_serialize_string_union_value_request() {
|
842 + | #[allow(unused_mut)]
|
843 + | let mut http_request = ::http::Request::builder()
|
844 + | .uri("/")
|
845 + | .method("POST")
|
846 + | .header("Content-Type", "application/x-amz-json-1.1")
|
847 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
848 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
849 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
850 + | "{\n \"contents\": {\n \"stringValue\": \"foo\"\n }\n}".as_bytes(),
|
851 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
852 + | )),
|
853 + | ))
|
854 + | .unwrap();
|
855 + | #[allow(unused_mut)]
|
856 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
857 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
858 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
859 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
860 + | let sender = sender.clone();
|
861 + | async move {
|
862 + | let result = {
|
863 + | let expected = crate::input::JsonUnionsInput {
|
864 + | contents: ::std::option::Option::Some(
|
865 + | crate::model::MyUnion::StringValue("foo".to_owned()),
|
866 + | ),
|
867 + | };
|
868 + | ::pretty_assertions::assert_eq!(input, expected);
|
869 + | let output = crate::output::JsonUnionsOutput {
|
870 + | contents: ::std::option::Option::None,
|
871 + | };
|
872 + | Ok(output)
|
873 + | };
|
874 + | sender.send(()).await.expect("receiver dropped early");
|
875 + | result
|
876 + | }
|
877 + | })
|
878 + | .build_unchecked();
|
879 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
880 + | .await
|
881 + | .expect("unable to make an HTTP request");
|
882 + | assert!(
|
883 + | receiver.recv().await.is_some(),
|
884 + | "we expected operation handler to be invoked but it was not entered"
|
885 + | );
|
886 + | }
|
887 + |
|
888 + | /// Serializes a boolean union value
|
889 + | /// Test ID: AwsJson11SerializeBooleanUnionValue
|
890 + | #[::tokio::test]
|
891 + | #[::tracing_test::traced_test]
|
892 + | async fn aws_json11_serialize_boolean_union_value_request() {
|
893 + | #[allow(unused_mut)]
|
894 + | let mut http_request = ::http::Request::builder()
|
895 + | .uri("/")
|
896 + | .method("POST")
|
897 + | .header("Content-Type", "application/x-amz-json-1.1")
|
898 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
899 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
900 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
901 + | "{\n \"contents\": {\n \"booleanValue\": true\n }\n}".as_bytes(),
|
902 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
903 + | )),
|
904 + | ))
|
905 + | .unwrap();
|
906 + | #[allow(unused_mut)]
|
907 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
908 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
909 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
910 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
911 + | let sender = sender.clone();
|
912 + | async move {
|
913 + | let result = {
|
914 + | let expected = crate::input::JsonUnionsInput {
|
915 + | contents: ::std::option::Option::Some(
|
916 + | crate::model::MyUnion::BooleanValue(true),
|
917 + | ),
|
918 + | };
|
919 + | ::pretty_assertions::assert_eq!(input, expected);
|
920 + | let output = crate::output::JsonUnionsOutput {
|
921 + | contents: ::std::option::Option::None,
|
922 + | };
|
923 + | Ok(output)
|
924 + | };
|
925 + | sender.send(()).await.expect("receiver dropped early");
|
926 + | result
|
927 + | }
|
928 + | })
|
929 + | .build_unchecked();
|
930 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
931 + | .await
|
932 + | .expect("unable to make an HTTP request");
|
933 + | assert!(
|
934 + | receiver.recv().await.is_some(),
|
935 + | "we expected operation handler to be invoked but it was not entered"
|
936 + | );
|
937 + | }
|
938 + |
|
939 + | /// Serializes a number union value
|
940 + | /// Test ID: AwsJson11SerializeNumberUnionValue
|
941 + | #[::tokio::test]
|
942 + | #[::tracing_test::traced_test]
|
943 + | async fn aws_json11_serialize_number_union_value_request() {
|
944 + | #[allow(unused_mut)]
|
945 + | let mut http_request = ::http::Request::builder()
|
946 + | .uri("/")
|
947 + | .method("POST")
|
948 + | .header("Content-Type", "application/x-amz-json-1.1")
|
949 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
950 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
951 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
952 + | "{\n \"contents\": {\n \"numberValue\": 1\n }\n}".as_bytes(),
|
953 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
954 + | )),
|
955 + | ))
|
956 + | .unwrap();
|
957 + | #[allow(unused_mut)]
|
958 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
959 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
960 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
961 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
962 + | let sender = sender.clone();
|
963 + | async move {
|
964 + | let result = {
|
965 + | let expected = crate::input::JsonUnionsInput {
|
966 + | contents: ::std::option::Option::Some(
|
967 + | crate::model::MyUnion::NumberValue(1),
|
968 + | ),
|
969 + | };
|
970 + | ::pretty_assertions::assert_eq!(input, expected);
|
971 + | let output = crate::output::JsonUnionsOutput {
|
972 + | contents: ::std::option::Option::None,
|
973 + | };
|
974 + | Ok(output)
|
975 + | };
|
976 + | sender.send(()).await.expect("receiver dropped early");
|
977 + | result
|
978 + | }
|
979 + | })
|
980 + | .build_unchecked();
|
981 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
982 + | .await
|
983 + | .expect("unable to make an HTTP request");
|
984 + | assert!(
|
985 + | receiver.recv().await.is_some(),
|
986 + | "we expected operation handler to be invoked but it was not entered"
|
987 + | );
|
988 + | }
|
989 + |
|
990 + | /// Serializes a blob union value
|
991 + | /// Test ID: AwsJson11SerializeBlobUnionValue
|
992 + | #[::tokio::test]
|
993 + | #[::tracing_test::traced_test]
|
994 + | async fn aws_json11_serialize_blob_union_value_request() {
|
995 + | #[allow(unused_mut)]
|
996 + | let mut http_request = ::http::Request::builder()
|
997 + | .uri("/")
|
998 + | .method("POST")
|
999 + | .header("Content-Type", "application/x-amz-json-1.1")
|
1000 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
1001 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1002 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1003 + | "{\n \"contents\": {\n \"blobValue\": \"Zm9v\"\n }\n}".as_bytes(),
|
1004 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1005 + | )),
|
1006 + | ))
|
1007 + | .unwrap();
|
1008 + | #[allow(unused_mut)]
|
1009 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1010 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
1011 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1012 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1013 + | let sender = sender.clone();
|
1014 + | async move {
|
1015 + | let result = {
|
1016 + | let expected = crate::input::JsonUnionsInput {
|
1017 + | contents: ::std::option::Option::Some(
|
1018 + | crate::model::MyUnion::BlobValue(::aws_smithy_types::Blob::new(
|
1019 + | "foo",
|
1020 + | )),
|
1021 + | ),
|
1022 + | };
|
1023 + | ::pretty_assertions::assert_eq!(input, expected);
|
1024 + | let output = crate::output::JsonUnionsOutput {
|
1025 + | contents: ::std::option::Option::None,
|
1026 + | };
|
1027 + | Ok(output)
|
1028 + | };
|
1029 + | sender.send(()).await.expect("receiver dropped early");
|
1030 + | result
|
1031 + | }
|
1032 + | })
|
1033 + | .build_unchecked();
|
1034 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1035 + | .await
|
1036 + | .expect("unable to make an HTTP request");
|
1037 + | assert!(
|
1038 + | receiver.recv().await.is_some(),
|
1039 + | "we expected operation handler to be invoked but it was not entered"
|
1040 + | );
|
1041 + | }
|
1042 + |
|
1043 + | /// Serializes a timestamp union value
|
1044 + | /// Test ID: AwsJson11SerializeTimestampUnionValue
|
1045 + | #[::tokio::test]
|
1046 + | #[::tracing_test::traced_test]
|
1047 + | async fn aws_json11_serialize_timestamp_union_value_request() {
|
1048 + | #[allow(unused_mut)]
|
1049 + | let mut http_request = ::http::Request::builder()
|
1050 + | .uri("/")
|
1051 + | .method("POST")
|
1052 + | .header("Content-Type", "application/x-amz-json-1.1")
|
1053 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
1054 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1055 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1056 + | "{\n \"contents\": {\n \"timestampValue\": 1398796238\n }\n}"
|
1057 + | .as_bytes(),
|
1058 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1059 + | )),
|
1060 + | ))
|
1061 + | .unwrap();
|
1062 + | #[allow(unused_mut)]
|
1063 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1064 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
1065 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1066 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1067 + | let sender = sender.clone();
|
1068 + | async move {
|
1069 + | let result = {
|
1070 + | let expected = crate::input::JsonUnionsInput {
|
1071 + | contents: ::std::option::Option::Some(
|
1072 + | crate::model::MyUnion::TimestampValue(
|
1073 + | ::aws_smithy_types::DateTime::from_fractional_secs(
|
1074 + | 1398796238, 0_f64,
|
1075 + | ),
|
1076 + | ),
|
1077 + | ),
|
1078 + | };
|
1079 + | ::pretty_assertions::assert_eq!(input, expected);
|
1080 + | let output = crate::output::JsonUnionsOutput {
|
1081 + | contents: ::std::option::Option::None,
|
1082 + | };
|
1083 + | Ok(output)
|
1084 + | };
|
1085 + | sender.send(()).await.expect("receiver dropped early");
|
1086 + | result
|
1087 + | }
|
1088 + | })
|
1089 + | .build_unchecked();
|
1090 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1091 + | .await
|
1092 + | .expect("unable to make an HTTP request");
|
1093 + | assert!(
|
1094 + | receiver.recv().await.is_some(),
|
1095 + | "we expected operation handler to be invoked but it was not entered"
|
1096 + | );
|
1097 + | }
|
1098 + |
|
1099 + | /// Serializes an enum union value
|
1100 + | /// Test ID: AwsJson11SerializeEnumUnionValue
|
1101 + | #[::tokio::test]
|
1102 + | #[::tracing_test::traced_test]
|
1103 + | async fn aws_json11_serialize_enum_union_value_request() {
|
1104 + | #[allow(unused_mut)]
|
1105 + | let mut http_request = ::http::Request::builder()
|
1106 + | .uri("/")
|
1107 + | .method("POST")
|
1108 + | .header("Content-Type", "application/x-amz-json-1.1")
|
1109 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
1110 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1111 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1112 + | "{\n \"contents\": {\n \"enumValue\": \"Foo\"\n }\n}".as_bytes(),
|
1113 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1114 + | )),
|
1115 + | ))
|
1116 + | .unwrap();
|
1117 + | #[allow(unused_mut)]
|
1118 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1119 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
1120 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1121 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1122 + | let sender = sender.clone();
|
1123 + | async move {
|
1124 + | let result = {
|
1125 + | let expected = crate::input::JsonUnionsInput {
|
1126 + | contents: ::std::option::Option::Some(
|
1127 + | crate::model::MyUnion::EnumValue(
|
1128 + | "Foo"
|
1129 + | .parse::<crate::model::FooEnum>()
|
1130 + | .expect("static value validated to member"),
|
1131 + | ),
|
1132 + | ),
|
1133 + | };
|
1134 + | ::pretty_assertions::assert_eq!(input, expected);
|
1135 + | let output = crate::output::JsonUnionsOutput {
|
1136 + | contents: ::std::option::Option::None,
|
1137 + | };
|
1138 + | Ok(output)
|
1139 + | };
|
1140 + | sender.send(()).await.expect("receiver dropped early");
|
1141 + | result
|
1142 + | }
|
1143 + | })
|
1144 + | .build_unchecked();
|
1145 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1146 + | .await
|
1147 + | .expect("unable to make an HTTP request");
|
1148 + | assert!(
|
1149 + | receiver.recv().await.is_some(),
|
1150 + | "we expected operation handler to be invoked but it was not entered"
|
1151 + | );
|
1152 + | }
|
1153 + |
|
1154 + | /// Serializes a list union value
|
1155 + | /// Test ID: AwsJson11SerializeListUnionValue
|
1156 + | #[::tokio::test]
|
1157 + | #[::tracing_test::traced_test]
|
1158 + | async fn aws_json11_serialize_list_union_value_request() {
|
1159 + | #[allow(unused_mut)]
|
1160 + | let mut http_request = ::http::Request::builder()
|
1161 + | .uri("/")
|
1162 + | .method("POST")
|
1163 + | .header("Content-Type", "application/x-amz-json-1.1")
|
1164 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
1165 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1166 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1167 + | "{\n \"contents\": {\n \"listValue\": [\"foo\", \"bar\"]\n }\n}"
|
1168 + | .as_bytes(),
|
1169 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1170 + | )),
|
1171 + | ))
|
1172 + | .unwrap();
|
1173 + | #[allow(unused_mut)]
|
1174 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1175 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
1176 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1177 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1178 + | let sender = sender.clone();
|
1179 + | async move {
|
1180 + | let result = {
|
1181 + | let expected = crate::input::JsonUnionsInput {
|
1182 + | contents: ::std::option::Option::Some(
|
1183 + | crate::model::MyUnion::ListValue(vec![
|
1184 + | "foo".to_owned(),
|
1185 + | "bar".to_owned(),
|
1186 + | ]),
|
1187 + | ),
|
1188 + | };
|
1189 + | ::pretty_assertions::assert_eq!(input, expected);
|
1190 + | let output = crate::output::JsonUnionsOutput {
|
1191 + | contents: ::std::option::Option::None,
|
1192 + | };
|
1193 + | Ok(output)
|
1194 + | };
|
1195 + | sender.send(()).await.expect("receiver dropped early");
|
1196 + | result
|
1197 + | }
|
1198 + | })
|
1199 + | .build_unchecked();
|
1200 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1201 + | .await
|
1202 + | .expect("unable to make an HTTP request");
|
1203 + | assert!(
|
1204 + | receiver.recv().await.is_some(),
|
1205 + | "we expected operation handler to be invoked but it was not entered"
|
1206 + | );
|
1207 + | }
|
1208 + |
|
1209 + | /// Serializes a map union value
|
1210 + | /// Test ID: AwsJson11SerializeMapUnionValue
|
1211 + | #[::tokio::test]
|
1212 + | #[::tracing_test::traced_test]
|
1213 + | async fn aws_json11_serialize_map_union_value_request() {
|
1214 + | #[allow(unused_mut)]
|
1215 + | let mut http_request = ::http::Request::builder()
|
1216 + | .uri("/")
|
1217 + | .method("POST")
|
1218 + | .header("Content-Type", "application/x-amz-json-1.1")
|
1219 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
1220 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1221 + | ::bytes::Bytes::copy_from_slice(
|
1222 + | &::aws_smithy_protocol_test::decode_body_data("{\n \"contents\": {\n \"mapValue\": {\n \"foo\": \"bar\",\n \"spam\": \"eggs\"\n }\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1223 + | )
|
1224 + | )).unwrap();
|
1225 + | #[allow(unused_mut)]
|
1226 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1227 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
1228 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1229 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1230 + | let sender = sender.clone();
|
1231 + | async move {
|
1232 + | let result = {
|
1233 + | let expected = crate::input::JsonUnionsInput {
|
1234 + | contents: ::std::option::Option::Some(crate::model::MyUnion::MapValue(
|
1235 + | {
|
1236 + | let mut ret = ::std::collections::HashMap::new();
|
1237 + | ret.insert("foo".to_owned(), "bar".to_owned());
|
1238 + | ret.insert("spam".to_owned(), "eggs".to_owned());
|
1239 + | ret
|
1240 + | },
|
1241 + | )),
|
1242 + | };
|
1243 + | ::pretty_assertions::assert_eq!(input, expected);
|
1244 + | let output = crate::output::JsonUnionsOutput {
|
1245 + | contents: ::std::option::Option::None,
|
1246 + | };
|
1247 + | Ok(output)
|
1248 + | };
|
1249 + | sender.send(()).await.expect("receiver dropped early");
|
1250 + | result
|
1251 + | }
|
1252 + | })
|
1253 + | .build_unchecked();
|
1254 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1255 + | .await
|
1256 + | .expect("unable to make an HTTP request");
|
1257 + | assert!(
|
1258 + | receiver.recv().await.is_some(),
|
1259 + | "we expected operation handler to be invoked but it was not entered"
|
1260 + | );
|
1261 + | }
|
1262 + |
|
1263 + | /// Serializes a structure union value
|
1264 + | /// Test ID: AwsJson11SerializeStructureUnionValue
|
1265 + | #[::tokio::test]
|
1266 + | #[::tracing_test::traced_test]
|
1267 + | async fn aws_json11_serialize_structure_union_value_request() {
|
1268 + | #[allow(unused_mut)]
|
1269 + | let mut http_request = ::http::Request::builder()
|
1270 + | .uri("/")
|
1271 + | .method("POST")
|
1272 + | .header("Content-Type", "application/x-amz-json-1.1")
|
1273 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
1274 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1275 + | ::bytes::Bytes::copy_from_slice(
|
1276 + | &::aws_smithy_protocol_test::decode_body_data("{\n \"contents\": {\n \"structureValue\": {\n \"hi\": \"hello\"\n }\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1277 + | )
|
1278 + | )).unwrap();
|
1279 + | #[allow(unused_mut)]
|
1280 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1281 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
1282 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1283 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1284 + | let sender = sender.clone();
|
1285 + | async move {
|
1286 + | let result = {
|
1287 + | let expected = crate::input::JsonUnionsInput {
|
1288 + | contents: ::std::option::Option::Some(
|
1289 + | crate::model::MyUnion::StructureValue(
|
1290 + | crate::model::GreetingStruct {
|
1291 + | hi: ::std::option::Option::Some("hello".to_owned()),
|
1292 + | },
|
1293 + | ),
|
1294 + | ),
|
1295 + | };
|
1296 + | ::pretty_assertions::assert_eq!(input, expected);
|
1297 + | let output = crate::output::JsonUnionsOutput {
|
1298 + | contents: ::std::option::Option::None,
|
1299 + | };
|
1300 + | Ok(output)
|
1301 + | };
|
1302 + | sender.send(()).await.expect("receiver dropped early");
|
1303 + | result
|
1304 + | }
|
1305 + | })
|
1306 + | .build_unchecked();
|
1307 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1308 + | .await
|
1309 + | .expect("unable to make an HTTP request");
|
1310 + | assert!(
|
1311 + | receiver.recv().await.is_some(),
|
1312 + | "we expected operation handler to be invoked but it was not entered"
|
1313 + | );
|
1314 + | }
|
1315 + |
|
1316 + | /// Deserializes a string union value
|
1317 + | /// Test ID: AwsJson11DeserializeStringUnionValue
|
1318 + | #[::tokio::test]
|
1319 + | #[::tracing_test::traced_test]
|
1320 + | async fn aws_json11_deserialize_string_union_value_response() {
|
1321 + | let output = crate::output::JsonUnionsOutput {
|
1322 + | contents: ::std::option::Option::Some(crate::model::MyUnion::StringValue(
|
1323 + | "foo".to_owned(),
|
1324 + | )),
|
1325 + | };
|
1326 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1327 + | let http_response = output.into_response();
|
1328 + | ::pretty_assertions::assert_eq!(
|
1329 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1330 + | http_response.status()
|
1331 + | );
|
1332 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1333 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1334 + | http_response.headers(),
|
1335 + | expected_headers,
|
1336 + | ));
|
1337 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1338 + | .await
|
1339 + | .expect("unable to extract body to bytes");
|
1340 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1341 + | &body,
|
1342 + | "{\n \"contents\": {\n \"stringValue\": \"foo\"\n }\n}",
|
1343 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1344 + | ));
|
1345 + | }
|
1346 + |
|
1347 + | /// Deserializes a boolean union value
|
1348 + | /// Test ID: AwsJson11DeserializeBooleanUnionValue
|
1349 + | #[::tokio::test]
|
1350 + | #[::tracing_test::traced_test]
|
1351 + | async fn aws_json11_deserialize_boolean_union_value_response() {
|
1352 + | let output = crate::output::JsonUnionsOutput {
|
1353 + | contents: ::std::option::Option::Some(crate::model::MyUnion::BooleanValue(true)),
|
1354 + | };
|
1355 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1356 + | let http_response = output.into_response();
|
1357 + | ::pretty_assertions::assert_eq!(
|
1358 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1359 + | http_response.status()
|
1360 + | );
|
1361 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1362 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1363 + | http_response.headers(),
|
1364 + | expected_headers,
|
1365 + | ));
|
1366 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1367 + | .await
|
1368 + | .expect("unable to extract body to bytes");
|
1369 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1370 + | &body,
|
1371 + | "{\n \"contents\": {\n \"booleanValue\": true\n }\n}",
|
1372 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1373 + | ));
|
1374 + | }
|
1375 + |
|
1376 + | /// Deserializes a number union value
|
1377 + | /// Test ID: AwsJson11DeserializeNumberUnionValue
|
1378 + | #[::tokio::test]
|
1379 + | #[::tracing_test::traced_test]
|
1380 + | async fn aws_json11_deserialize_number_union_value_response() {
|
1381 + | let output = crate::output::JsonUnionsOutput {
|
1382 + | contents: ::std::option::Option::Some(crate::model::MyUnion::NumberValue(1)),
|
1383 + | };
|
1384 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1385 + | let http_response = output.into_response();
|
1386 + | ::pretty_assertions::assert_eq!(
|
1387 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1388 + | http_response.status()
|
1389 + | );
|
1390 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1391 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1392 + | http_response.headers(),
|
1393 + | expected_headers,
|
1394 + | ));
|
1395 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1396 + | .await
|
1397 + | .expect("unable to extract body to bytes");
|
1398 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1399 + | &body,
|
1400 + | "{\n \"contents\": {\n \"numberValue\": 1\n }\n}",
|
1401 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1402 + | ));
|
1403 + | }
|
1404 + |
|
1405 + | /// Deserializes a blob union value
|
1406 + | /// Test ID: AwsJson11DeserializeBlobUnionValue
|
1407 + | #[::tokio::test]
|
1408 + | #[::tracing_test::traced_test]
|
1409 + | async fn aws_json11_deserialize_blob_union_value_response() {
|
1410 + | let output = crate::output::JsonUnionsOutput {
|
1411 + | contents: ::std::option::Option::Some(crate::model::MyUnion::BlobValue(
|
1412 + | ::aws_smithy_types::Blob::new("foo"),
|
1413 + | )),
|
1414 + | };
|
1415 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1416 + | let http_response = output.into_response();
|
1417 + | ::pretty_assertions::assert_eq!(
|
1418 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1419 + | http_response.status()
|
1420 + | );
|
1421 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1422 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1423 + | http_response.headers(),
|
1424 + | expected_headers,
|
1425 + | ));
|
1426 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1427 + | .await
|
1428 + | .expect("unable to extract body to bytes");
|
1429 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1430 + | &body,
|
1431 + | "{\n \"contents\": {\n \"blobValue\": \"Zm9v\"\n }\n}",
|
1432 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1433 + | ));
|
1434 + | }
|
1435 + |
|
1436 + | /// Deserializes a timestamp union value
|
1437 + | /// Test ID: AwsJson11DeserializeTimestampUnionValue
|
1438 + | #[::tokio::test]
|
1439 + | #[::tracing_test::traced_test]
|
1440 + | async fn aws_json11_deserialize_timestamp_union_value_response() {
|
1441 + | let output = crate::output::JsonUnionsOutput {
|
1442 + | contents: ::std::option::Option::Some(crate::model::MyUnion::TimestampValue(
|
1443 + | ::aws_smithy_types::DateTime::from_fractional_secs(1398796238, 0_f64),
|
1444 + | )),
|
1445 + | };
|
1446 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1447 + | let http_response = output.into_response();
|
1448 + | ::pretty_assertions::assert_eq!(
|
1449 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1450 + | http_response.status()
|
1451 + | );
|
1452 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1453 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1454 + | http_response.headers(),
|
1455 + | expected_headers,
|
1456 + | ));
|
1457 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1458 + | .await
|
1459 + | .expect("unable to extract body to bytes");
|
1460 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1461 + | &body,
|
1462 + | "{\n \"contents\": {\n \"timestampValue\": 1398796238\n }\n}",
|
1463 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1464 + | ));
|
1465 + | }
|
1466 + |
|
1467 + | /// Deserializes an enum union value
|
1468 + | /// Test ID: AwsJson11DeserializeEnumUnionValue
|
1469 + | #[::tokio::test]
|
1470 + | #[::tracing_test::traced_test]
|
1471 + | async fn aws_json11_deserialize_enum_union_value_response() {
|
1472 + | let output = crate::output::JsonUnionsOutput {
|
1473 + | contents: ::std::option::Option::Some(crate::model::MyUnion::EnumValue(
|
1474 + | "Foo"
|
1475 + | .parse::<crate::model::FooEnum>()
|
1476 + | .expect("static value validated to member"),
|
1477 + | )),
|
1478 + | };
|
1479 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1480 + | let http_response = output.into_response();
|
1481 + | ::pretty_assertions::assert_eq!(
|
1482 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1483 + | http_response.status()
|
1484 + | );
|
1485 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1486 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1487 + | http_response.headers(),
|
1488 + | expected_headers,
|
1489 + | ));
|
1490 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1491 + | .await
|
1492 + | .expect("unable to extract body to bytes");
|
1493 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1494 + | &body,
|
1495 + | "{\n \"contents\": {\n \"enumValue\": \"Foo\"\n }\n}",
|
1496 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1497 + | ));
|
1498 + | }
|
1499 + |
|
1500 + | /// Deserializes a list union value
|
1501 + | /// Test ID: AwsJson11DeserializeListUnionValue
|
1502 + | #[::tokio::test]
|
1503 + | #[::tracing_test::traced_test]
|
1504 + | async fn aws_json11_deserialize_list_union_value_response() {
|
1505 + | let output = crate::output::JsonUnionsOutput {
|
1506 + | contents: ::std::option::Option::Some(crate::model::MyUnion::ListValue(vec![
|
1507 + | "foo".to_owned(),
|
1508 + | "bar".to_owned(),
|
1509 + | ])),
|
1510 + | };
|
1511 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1512 + | let http_response = output.into_response();
|
1513 + | ::pretty_assertions::assert_eq!(
|
1514 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1515 + | http_response.status()
|
1516 + | );
|
1517 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1518 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1519 + | http_response.headers(),
|
1520 + | expected_headers,
|
1521 + | ));
|
1522 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1523 + | .await
|
1524 + | .expect("unable to extract body to bytes");
|
1525 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1526 + | &body,
|
1527 + | "{\n \"contents\": {\n \"listValue\": [\"foo\", \"bar\"]\n }\n}",
|
1528 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1529 + | ));
|
1530 + | }
|
1531 + |
|
1532 + | /// Deserializes a map union value
|
1533 + | /// Test ID: AwsJson11DeserializeMapUnionValue
|
1534 + | #[::tokio::test]
|
1535 + | #[::tracing_test::traced_test]
|
1536 + | async fn aws_json11_deserialize_map_union_value_response() {
|
1537 + | let output = crate::output::JsonUnionsOutput {
|
1538 + | contents: ::std::option::Option::Some(crate::model::MyUnion::MapValue({
|
1539 + | let mut ret = ::std::collections::HashMap::new();
|
1540 + | ret.insert("foo".to_owned(), "bar".to_owned());
|
1541 + | ret.insert("spam".to_owned(), "eggs".to_owned());
|
1542 + | ret
|
1543 + | })),
|
1544 + | };
|
1545 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1546 + | let http_response = output.into_response();
|
1547 + | ::pretty_assertions::assert_eq!(
|
1548 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1549 + | http_response.status()
|
1550 + | );
|
1551 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1552 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1553 + | http_response.headers(),
|
1554 + | expected_headers,
|
1555 + | ));
|
1556 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1557 + | .await
|
1558 + | .expect("unable to extract body to bytes");
|
1559 + | ::aws_smithy_protocol_test::assert_ok(
|
1560 + | ::aws_smithy_protocol_test::validate_body(&body, "{\n \"contents\": {\n \"mapValue\": {\n \"foo\": \"bar\",\n \"spam\": \"eggs\"\n }\n }\n}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1561 + | );
|
1562 + | }
|
1563 + |
|
1564 + | /// Deserializes a structure union value
|
1565 + | /// Test ID: AwsJson11DeserializeStructureUnionValue
|
1566 + | #[::tokio::test]
|
1567 + | #[::tracing_test::traced_test]
|
1568 + | async fn aws_json11_deserialize_structure_union_value_response() {
|
1569 + | let output = crate::output::JsonUnionsOutput {
|
1570 + | contents: ::std::option::Option::Some(crate::model::MyUnion::StructureValue(
|
1571 + | crate::model::GreetingStruct {
|
1572 + | hi: ::std::option::Option::Some("hello".to_owned()),
|
1573 + | },
|
1574 + | )),
|
1575 + | };
|
1576 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1577 + | let http_response = output.into_response();
|
1578 + | ::pretty_assertions::assert_eq!(
|
1579 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1580 + | http_response.status()
|
1581 + | );
|
1582 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1583 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1584 + | http_response.headers(),
|
1585 + | expected_headers,
|
1586 + | ));
|
1587 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1588 + | .await
|
1589 + | .expect("unable to extract body to bytes");
|
1590 + | ::aws_smithy_protocol_test::assert_ok(
|
1591 + | ::aws_smithy_protocol_test::validate_body(&body, "{\n \"contents\": {\n \"structureValue\": {\n \"hi\": \"hello\"\n }\n }\n}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1592 + | );
|
1593 + | }
|
1594 + | }
|
1595 + |
|
1596 + | ::pin_project_lite::pin_project! {
|
1597 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
1598 + | /// [`GreetingWithErrorsInput`](crate::input::GreetingWithErrorsInput) using modelled bindings.
|
1599 + | pub struct GreetingWithErrorsInputFuture {
|
1600 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::GreetingWithErrorsInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
1601 + | }
|
1602 + | }
|
1603 + |
|
1604 + | impl std::future::Future for GreetingWithErrorsInputFuture {
|
1605 + | type Output = Result<
|
1606 + | crate::input::GreetingWithErrorsInput,
|
1607 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
1608 + | >;
|
1609 + |
|
1610 + | fn poll(
|
1611 + | self: std::pin::Pin<&mut Self>,
|
1612 + | cx: &mut std::task::Context<'_>,
|
1613 + | ) -> std::task::Poll<Self::Output> {
|
1614 + | let this = self.project();
|
1615 + | this.inner.as_mut().poll(cx)
|
1616 + | }
|
1617 + | }
|
1618 + |
|
1619 + | impl<B>
|
1620 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
1621 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1622 + | B,
|
1623 + | > for crate::input::GreetingWithErrorsInput
|
1624 + | where
|
1625 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
1626 + | B: 'static,
|
1627 + |
|
1628 + | B::Data: Send,
|
1629 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
1630 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
1631 + | {
|
1632 + | type Rejection =
|
1633 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
1634 + | type Future = GreetingWithErrorsInputFuture;
|
1635 + |
|
1636 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
1637 + | let fut = async move {
|
1638 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
1639 + | request.headers(),
|
1640 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
1641 + | ) {
|
1642 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
1643 + | }
|
1644 + | crate::protocol_serde::shape_greeting_with_errors::de_greeting_with_errors_http_request(
|
1645 + | request,
|
1646 + | )
|
1647 + | .await
|
1648 + | };
|
1649 + | use ::futures_util::future::TryFutureExt;
|
1650 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
1651 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
1652 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
1653 + | });
|
1654 + | GreetingWithErrorsInputFuture {
|
1655 + | inner: Box::pin(fut),
|
1656 + | }
|
1657 + | }
|
1658 + | }
|
1659 + | impl
|
1660 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
1661 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1662 + | > for crate::output::GreetingWithErrorsOutput
|
1663 + | {
|
1664 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
1665 + | match crate::protocol_serde::shape_greeting_with_errors::ser_greeting_with_errors_http_response(self) {
|
1666 + | Ok(response) => response,
|
1667 + | Err(e) => {
|
1668 + | ::tracing::error!(error = %e, "failed to serialize response");
|
1669 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
1670 + | }
|
1671 + | }
|
1672 + | }
|
1673 + | }
|
1674 + | impl
|
1675 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
1676 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1677 + | > for crate::error::GreetingWithErrorsError
|
1678 + | {
|
1679 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
1680 + | match crate::protocol_serde::shape_greeting_with_errors::ser_greeting_with_errors_http_error(
|
1681 + | &self,
|
1682 + | ) {
|
1683 + | Ok(mut response) => {
|
1684 + | response.extensions_mut().insert(
|
1685 + | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
1686 + | self.name(),
|
1687 + | ),
|
1688 + | );
|
1689 + | response
|
1690 + | }
|
1691 + | Err(e) => {
|
1692 + | ::tracing::error!(error = %e, "failed to serialize response");
|
1693 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
1694 + | }
|
1695 + | }
|
1696 + | }
|
1697 + | }
|
1698 + |
|
1699 + | #[allow(unreachable_code, unused_variables)]
|
1700 + | #[cfg(test)]
|
1701 + | mod greeting_with_errors_test {
|
1702 + |
|
1703 + | /// Parses simple JSON errors
|
1704 + | /// Test ID: AwsJson11InvalidGreetingError
|
1705 + | #[::tokio::test]
|
1706 + | #[::tracing_test::traced_test]
|
1707 + | async fn aws_json11_invalid_greeting_error_response() {
|
1708 + | let output = crate::error::InvalidGreeting {
|
1709 + | message: ::std::option::Option::Some("Hi".to_owned()),
|
1710 + | };
|
1711 + | let output = crate::error::GreetingWithErrorsError::InvalidGreeting(output);
|
1712 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1713 + | let http_response = output.into_response();
|
1714 + | ::pretty_assertions::assert_eq!(
|
1715 + | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1716 + | http_response.status()
|
1717 + | );
|
1718 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1719 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1720 + | http_response.headers(),
|
1721 + | expected_headers,
|
1722 + | ));
|
1723 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1724 + | .await
|
1725 + | .expect("unable to extract body to bytes");
|
1726 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1727 + | &body,
|
1728 + | "{\n \"__type\": \"InvalidGreeting\",\n \"Message\": \"Hi\"\n}",
|
1729 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1730 + | ));
|
1731 + | }
|
1732 + |
|
1733 + | /// Parses a complex error with no message member
|
1734 + | /// Test ID: AwsJson11ComplexError
|
1735 + | #[::tokio::test]
|
1736 + | #[::tracing_test::traced_test]
|
1737 + | async fn aws_json11_complex_error_response() {
|
1738 + | let output = crate::error::ComplexError {
|
1739 + | top_level: ::std::option::Option::Some("Top level".to_owned()),
|
1740 + | nested: ::std::option::Option::Some(crate::model::ComplexNestedErrorData {
|
1741 + | foo: ::std::option::Option::Some("bar".to_owned()),
|
1742 + | }),
|
1743 + | };
|
1744 + | let output = crate::error::GreetingWithErrorsError::ComplexError(output);
|
1745 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1746 + | let http_response = output.into_response();
|
1747 + | ::pretty_assertions::assert_eq!(
|
1748 + | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1749 + | http_response.status()
|
1750 + | );
|
1751 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1752 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1753 + | http_response.headers(),
|
1754 + | expected_headers,
|
1755 + | ));
|
1756 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1757 + | .await
|
1758 + | .expect("unable to extract body to bytes");
|
1759 + | ::aws_smithy_protocol_test::assert_ok(
|
1760 + | ::aws_smithy_protocol_test::validate_body(&body, "{\n \"__type\": \"ComplexError\",\n \"TopLevel\": \"Top level\",\n \"Nested\": {\n \"Foo\": \"bar\"\n }\n}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1761 + | );
|
1762 + | }
|
1763 + | /// Test ID: AwsJson11EmptyComplexError
|
1764 + | #[::tokio::test]
|
1765 + | #[::tracing_test::traced_test]
|
1766 + | async fn aws_json11_empty_complex_error_response() {
|
1767 + | let output = crate::error::ComplexError {
|
1768 + | top_level: ::std::option::Option::None,
|
1769 + | nested: ::std::option::Option::None,
|
1770 + | };
|
1771 + | let output = crate::error::GreetingWithErrorsError::ComplexError(output);
|
1772 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1773 + | let http_response = output.into_response();
|
1774 + | ::pretty_assertions::assert_eq!(
|
1775 + | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1776 + | http_response.status()
|
1777 + | );
|
1778 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1779 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1780 + | http_response.headers(),
|
1781 + | expected_headers,
|
1782 + | ));
|
1783 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1784 + | .await
|
1785 + | .expect("unable to extract body to bytes");
|
1786 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1787 + | &body,
|
1788 + | "{\n \"__type\": \"ComplexError\"\n}",
|
1789 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1790 + | ));
|
1791 + | }
|
1792 + | }
|
1793 + |
|
1794 + | ::pin_project_lite::pin_project! {
|
1795 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
1796 + | /// [`SparseNullsOperationInput`](crate::input::SparseNullsOperationInput) using modelled bindings.
|
1797 + | pub struct SparseNullsOperationInputFuture {
|
1798 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SparseNullsOperationInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
1799 + | }
|
1800 + | }
|
1801 + |
|
1802 + | impl std::future::Future for SparseNullsOperationInputFuture {
|
1803 + | type Output = Result<
|
1804 + | crate::input::SparseNullsOperationInput,
|
1805 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
1806 + | >;
|
1807 + |
|
1808 + | fn poll(
|
1809 + | self: std::pin::Pin<&mut Self>,
|
1810 + | cx: &mut std::task::Context<'_>,
|
1811 + | ) -> std::task::Poll<Self::Output> {
|
1812 + | let this = self.project();
|
1813 + | this.inner.as_mut().poll(cx)
|
1814 + | }
|
1815 + | }
|
1816 + |
|
1817 + | impl<B>
|
1818 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
1819 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1820 + | B,
|
1821 + | > for crate::input::SparseNullsOperationInput
|
1822 + | where
|
1823 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
1824 + | B: 'static,
|
1825 + |
|
1826 + | B::Data: Send,
|
1827 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
1828 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
1829 + | {
|
1830 + | type Rejection =
|
1831 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
1832 + | type Future = SparseNullsOperationInputFuture;
|
1833 + |
|
1834 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
1835 + | let fut = async move {
|
1836 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
1837 + | request.headers(),
|
1838 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
1839 + | ) {
|
1840 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
1841 + | }
|
1842 + | crate::protocol_serde::shape_sparse_nulls_operation::de_sparse_nulls_operation_http_request(request)
|
1843 + | .await
|
1844 + | };
|
1845 + | use ::futures_util::future::TryFutureExt;
|
1846 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
1847 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
1848 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
1849 + | });
|
1850 + | SparseNullsOperationInputFuture {
|
1851 + | inner: Box::pin(fut),
|
1852 + | }
|
1853 + | }
|
1854 + | }
|
1855 + | impl
|
1856 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
1857 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1858 + | > for crate::output::SparseNullsOperationOutput
|
1859 + | {
|
1860 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
1861 + | match crate::protocol_serde::shape_sparse_nulls_operation::ser_sparse_nulls_operation_http_response(self) {
|
1862 + | Ok(response) => response,
|
1863 + | Err(e) => {
|
1864 + | ::tracing::error!(error = %e, "failed to serialize response");
|
1865 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
1866 + | }
|
1867 + | }
|
1868 + | }
|
1869 + | }
|
1870 + |
|
1871 + | #[allow(unreachable_code, unused_variables)]
|
1872 + | #[cfg(test)]
|
1873 + | mod sparse_nulls_operation_test {
|
1874 + |
|
1875 + | /// Serializes null values in maps
|
1876 + | /// Test ID: AwsJson11SparseMapsSerializeNullValues
|
1877 + | #[::tokio::test]
|
1878 + | #[::tracing_test::traced_test]
|
1879 + | async fn aws_json11_sparse_maps_serialize_null_values_request() {
|
1880 + | #[allow(unused_mut)]
|
1881 + | let mut http_request = ::http::Request::builder()
|
1882 + | .uri("/")
|
1883 + | .method("POST")
|
1884 + | .header("Content-Type", "application/x-amz-json-1.1")
|
1885 + | .header("X-Amz-Target", "JsonProtocol.SparseNullsOperation")
|
1886 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1887 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1888 + | "{\n \"sparseStringMap\": {\n \"foo\": null\n }\n}".as_bytes(),
|
1889 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1890 + | )),
|
1891 + | ))
|
1892 + | .unwrap();
|
1893 + | #[allow(unused_mut)]
|
1894 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1895 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
1896 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1897 + | .sparse_nulls_operation(move |input: crate::input::SparseNullsOperationInput| {
|
1898 + | let sender = sender.clone();
|
1899 + | async move {
|
1900 + | let result = {
|
1901 + | let expected = crate::input::SparseNullsOperationInput {
|
1902 + | sparse_string_map: ::std::option::Option::Some({
|
1903 + | let mut ret = ::std::collections::HashMap::new();
|
1904 + | ret.insert("foo".to_owned(), ::std::option::Option::None);
|
1905 + | ret
|
1906 + | }),
|
1907 + | sparse_string_list: ::std::option::Option::None,
|
1908 + | };
|
1909 + | ::pretty_assertions::assert_eq!(input, expected);
|
1910 + | let output = crate::output::SparseNullsOperationOutput {
|
1911 + | sparse_string_list: ::std::option::Option::None,
|
1912 + | sparse_string_map: ::std::option::Option::None,
|
1913 + | };
|
1914 + | output
|
1915 + | };
|
1916 + | sender.send(()).await.expect("receiver dropped early");
|
1917 + | result
|
1918 + | }
|
1919 + | })
|
1920 + | .build_unchecked();
|
1921 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1922 + | .await
|
1923 + | .expect("unable to make an HTTP request");
|
1924 + | assert!(
|
1925 + | receiver.recv().await.is_some(),
|
1926 + | "we expected operation handler to be invoked but it was not entered"
|
1927 + | );
|
1928 + | }
|
1929 + |
|
1930 + | /// Serializes null values in lists
|
1931 + | /// Test ID: AwsJson11SparseListsSerializeNull
|
1932 + | #[::tokio::test]
|
1933 + | #[::tracing_test::traced_test]
|
1934 + | async fn aws_json11_sparse_lists_serialize_null_request() {
|
1935 + | #[allow(unused_mut)]
|
1936 + | let mut http_request = ::http::Request::builder()
|
1937 + | .uri("/")
|
1938 + | .method("POST")
|
1939 + | .header("Content-Type", "application/x-amz-json-1.1")
|
1940 + | .header("X-Amz-Target", "JsonProtocol.SparseNullsOperation")
|
1941 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1942 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1943 + | "{\n \"sparseStringList\": [\n null\n ]\n}".as_bytes(),
|
1944 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1945 + | )),
|
1946 + | ))
|
1947 + | .unwrap();
|
1948 + | #[allow(unused_mut)]
|
1949 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1950 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
1951 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1952 + | .sparse_nulls_operation(move |input: crate::input::SparseNullsOperationInput| {
|
1953 + | let sender = sender.clone();
|
1954 + | async move {
|
1955 + | let result = {
|
1956 + | let expected = crate::input::SparseNullsOperationInput {
|
1957 + | sparse_string_list: ::std::option::Option::Some(vec![
|
1958 + | ::std::option::Option::None,
|
1959 + | ]),
|
1960 + | sparse_string_map: ::std::option::Option::None,
|
1961 + | };
|
1962 + | ::pretty_assertions::assert_eq!(input, expected);
|
1963 + | let output = crate::output::SparseNullsOperationOutput {
|
1964 + | sparse_string_list: ::std::option::Option::None,
|
1965 + | sparse_string_map: ::std::option::Option::None,
|
1966 + | };
|
1967 + | output
|
1968 + | };
|
1969 + | sender.send(()).await.expect("receiver dropped early");
|
1970 + | result
|
1971 + | }
|
1972 + | })
|
1973 + | .build_unchecked();
|
1974 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1975 + | .await
|
1976 + | .expect("unable to make an HTTP request");
|
1977 + | assert!(
|
1978 + | receiver.recv().await.is_some(),
|
1979 + | "we expected operation handler to be invoked but it was not entered"
|
1980 + | );
|
1981 + | }
|
1982 + |
|
1983 + | /// Deserializes null values in maps
|
1984 + | /// Test ID: AwsJson11SparseMapsDeserializeNullValues
|
1985 + | #[::tokio::test]
|
1986 + | #[::tracing_test::traced_test]
|
1987 + | async fn aws_json11_sparse_maps_deserialize_null_values_response() {
|
1988 + | let output = crate::output::SparseNullsOperationOutput {
|
1989 + | sparse_string_map: ::std::option::Option::Some({
|
1990 + | let mut ret = ::std::collections::HashMap::new();
|
1991 + | ret.insert("foo".to_owned(), ::std::option::Option::None);
|
1992 + | ret
|
1993 + | }),
|
1994 + | sparse_string_list: ::std::option::Option::None,
|
1995 + | };
|
1996 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1997 + | let http_response = output.into_response();
|
1998 + | ::pretty_assertions::assert_eq!(
|
1999 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2000 + | http_response.status()
|
2001 + | );
|
2002 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
2003 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2004 + | http_response.headers(),
|
2005 + | expected_headers,
|
2006 + | ));
|
2007 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2008 + | .await
|
2009 + | .expect("unable to extract body to bytes");
|
2010 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2011 + | &body,
|
2012 + | "{\n \"sparseStringMap\": {\n \"foo\": null\n }\n}",
|
2013 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2014 + | ));
|
2015 + | }
|
2016 + |
|
2017 + | /// Deserializes null values in lists
|
2018 + | /// Test ID: AwsJson11SparseListsDeserializeNull
|
2019 + | #[::tokio::test]
|
2020 + | #[::tracing_test::traced_test]
|
2021 + | async fn aws_json11_sparse_lists_deserialize_null_response() {
|
2022 + | let output = crate::output::SparseNullsOperationOutput {
|
2023 + | sparse_string_list: ::std::option::Option::Some(vec![::std::option::Option::None]),
|
2024 + | sparse_string_map: ::std::option::Option::None,
|
2025 + | };
|
2026 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
2027 + | let http_response = output.into_response();
|
2028 + | ::pretty_assertions::assert_eq!(
|
2029 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2030 + | http_response.status()
|
2031 + | );
|
2032 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
2033 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2034 + | http_response.headers(),
|
2035 + | expected_headers,
|
2036 + | ));
|
2037 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2038 + | .await
|
2039 + | .expect("unable to extract body to bytes");
|
2040 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2041 + | &body,
|
2042 + | "{\n \"sparseStringList\": [\n null\n ]\n}",
|
2043 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2044 + | ));
|
2045 + | }
|
2046 + | }
|
2047 + |
|
2048 + | ::pin_project_lite::pin_project! {
|
2049 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2050 + | /// [`NullOperationInput`](crate::input::NullOperationInput) using modelled bindings.
|
2051 + | pub struct NullOperationInputFuture {
|
2052 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::NullOperationInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
2053 + | }
|
2054 + | }
|
2055 + |
|
2056 + | impl std::future::Future for NullOperationInputFuture {
|
2057 + | type Output = Result<
|
2058 + | crate::input::NullOperationInput,
|
2059 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
2060 + | >;
|
2061 + |
|
2062 + | fn poll(
|
2063 + | self: std::pin::Pin<&mut Self>,
|
2064 + | cx: &mut std::task::Context<'_>,
|
2065 + | ) -> std::task::Poll<Self::Output> {
|
2066 + | let this = self.project();
|
2067 + | this.inner.as_mut().poll(cx)
|
2068 + | }
|
2069 + | }
|
2070 + |
|
2071 + | impl<B>
|
2072 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
2073 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2074 + | B,
|
2075 + | > for crate::input::NullOperationInput
|
2076 + | where
|
2077 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
2078 + | B: 'static,
|
2079 + |
|
2080 + | B::Data: Send,
|
2081 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
2082 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
2083 + | {
|
2084 + | type Rejection =
|
2085 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
2086 + | type Future = NullOperationInputFuture;
|
2087 + |
|
2088 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2089 + | let fut = async move {
|
2090 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
2091 + | request.headers(),
|
2092 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
2093 + | ) {
|
2094 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
2095 + | }
|
2096 + | crate::protocol_serde::shape_null_operation::de_null_operation_http_request(request)
|
2097 + | .await
|
2098 + | };
|
2099 + | use ::futures_util::future::TryFutureExt;
|
2100 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
2101 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2102 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
2103 + | });
|
2104 + | NullOperationInputFuture {
|
2105 + | inner: Box::pin(fut),
|
2106 + | }
|
2107 + | }
|
2108 + | }
|
2109 + | impl
|
2110 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
2111 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2112 + | > for crate::output::NullOperationOutput
|
2113 + | {
|
2114 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
2115 + | match crate::protocol_serde::shape_null_operation::ser_null_operation_http_response(self) {
|
2116 + | Ok(response) => response,
|
2117 + | Err(e) => {
|
2118 + | ::tracing::error!(error = %e, "failed to serialize response");
|
2119 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
2120 + | }
|
2121 + | }
|
2122 + | }
|
2123 + | }
|
2124 + |
|
2125 + | #[allow(unreachable_code, unused_variables)]
|
2126 + | #[cfg(test)]
|
2127 + | mod null_operation_test {
|
2128 + |
|
2129 + | /// Null structure values are dropped
|
2130 + | /// Test ID: AwsJson11ServersDontDeserializeNullStructureValues
|
2131 + | #[::tokio::test]
|
2132 + | #[::tracing_test::traced_test]
|
2133 + | async fn aws_json11_servers_dont_deserialize_null_structure_values_request() {
|
2134 + | #[allow(unused_mut)]
|
2135 + | let mut http_request = ::http::Request::builder()
|
2136 + | .uri("/")
|
2137 + | .method("POST")
|
2138 + | .header("Content-Type", "application/x-amz-json-1.1")
|
2139 + | .header("X-Amz-Target", "JsonProtocol.NullOperation")
|
2140 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2141 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2142 + | "{\n \"string\": null\n}".as_bytes(),
|
2143 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2144 + | )),
|
2145 + | ))
|
2146 + | .unwrap();
|
2147 + | #[allow(unused_mut)]
|
2148 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2149 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
2150 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2151 + | .null_operation(move |input: crate::input::NullOperationInput| {
|
2152 + | let sender = sender.clone();
|
2153 + | async move {
|
2154 + | let result = {
|
2155 + | let expected = crate::input::NullOperationInput {
|
2156 + | string: ::std::option::Option::None,
|
2157 + | };
|
2158 + | ::pretty_assertions::assert_eq!(input, expected);
|
2159 + | let output = crate::output::NullOperationOutput {
|
2160 + | string: ::std::option::Option::None,
|
2161 + | };
|
2162 + | output
|
2163 + | };
|
2164 + | sender.send(()).await.expect("receiver dropped early");
|
2165 + | result
|
2166 + | }
|
2167 + | })
|
2168 + | .build_unchecked();
|
2169 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2170 + | .await
|
2171 + | .expect("unable to make an HTTP request");
|
2172 + | assert!(
|
2173 + | receiver.recv().await.is_some(),
|
2174 + | "we expected operation handler to be invoked but it was not entered"
|
2175 + | );
|
2176 + | }
|
2177 + |
|
2178 + | /// Null structure values are dropped
|
2179 + | /// Test ID: AwsJson11ServersDontSerializeNullStructureValues
|
2180 + | #[::tokio::test]
|
2181 + | #[::tracing_test::traced_test]
|
2182 + | async fn aws_json11_servers_dont_serialize_null_structure_values_response() {
|
2183 + | let output = crate::output::NullOperationOutput {
|
2184 + | string: ::std::option::Option::None,
|
2185 + | };
|
2186 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
2187 + | let http_response = output.into_response();
|
2188 + | ::pretty_assertions::assert_eq!(
|
2189 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2190 + | http_response.status()
|
2191 + | );
|
2192 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
2193 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2194 + | http_response.headers(),
|
2195 + | expected_headers,
|
2196 + | ));
|
2197 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2198 + | .await
|
2199 + | .expect("unable to extract body to bytes");
|
2200 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2201 + | &body,
|
2202 + | "{}",
|
2203 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2204 + | ));
|
2205 + | }
|
2206 + | }
|
2207 + |
|
2208 + | ::pin_project_lite::pin_project! {
|
2209 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2210 + | /// [`JsonIntEnumsInput`](crate::input::JsonIntEnumsInput) using modelled bindings.
|
2211 + | pub struct JsonIntEnumsInputFuture {
|
2212 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::JsonIntEnumsInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
2213 + | }
|
2214 + | }
|
2215 + |
|
2216 + | impl std::future::Future for JsonIntEnumsInputFuture {
|
2217 + | type Output = Result<
|
2218 + | crate::input::JsonIntEnumsInput,
|
2219 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
2220 + | >;
|
2221 + |
|
2222 + | fn poll(
|
2223 + | self: std::pin::Pin<&mut Self>,
|
2224 + | cx: &mut std::task::Context<'_>,
|
2225 + | ) -> std::task::Poll<Self::Output> {
|
2226 + | let this = self.project();
|
2227 + | this.inner.as_mut().poll(cx)
|
2228 + | }
|
2229 + | }
|
2230 + |
|
2231 + | impl<B>
|
2232 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
2233 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2234 + | B,
|
2235 + | > for crate::input::JsonIntEnumsInput
|
2236 + | where
|
2237 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
2238 + | B: 'static,
|
2239 + |
|
2240 + | B::Data: Send,
|
2241 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
2242 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
2243 + | {
|
2244 + | type Rejection =
|
2245 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
2246 + | type Future = JsonIntEnumsInputFuture;
|
2247 + |
|
2248 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2249 + | let fut = async move {
|
2250 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
2251 + | request.headers(),
|
2252 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
2253 + | ) {
|
2254 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
2255 + | }
|
2256 + | crate::protocol_serde::shape_json_int_enums::de_json_int_enums_http_request(request)
|
2257 + | .await
|
2258 + | };
|
2259 + | use ::futures_util::future::TryFutureExt;
|
2260 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
2261 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2262 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
2263 + | });
|
2264 + | JsonIntEnumsInputFuture {
|
2265 + | inner: Box::pin(fut),
|
2266 + | }
|
2267 + | }
|
2268 + | }
|
2269 + | impl
|
2270 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
2271 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2272 + | > for crate::output::JsonIntEnumsOutput
|
2273 + | {
|
2274 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
2275 + | match crate::protocol_serde::shape_json_int_enums::ser_json_int_enums_http_response(self) {
|
2276 + | Ok(response) => response,
|
2277 + | Err(e) => {
|
2278 + | ::tracing::error!(error = %e, "failed to serialize response");
|
2279 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
2280 + | }
|
2281 + | }
|
2282 + | }
|
2283 + | }
|
2284 + | impl
|
2285 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
2286 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2287 + | > for crate::error::JsonIntEnumsError
|
2288 + | {
|
2289 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
2290 + | match crate::protocol_serde::shape_json_int_enums::ser_json_int_enums_http_error(&self) {
|
2291 + | Ok(mut response) => {
|
2292 + | response.extensions_mut().insert(
|
2293 + | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
2294 + | self.name(),
|
2295 + | ),
|
2296 + | );
|
2297 + | response
|
2298 + | }
|
2299 + | Err(e) => {
|
2300 + | ::tracing::error!(error = %e, "failed to serialize response");
|
2301 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
2302 + | }
|
2303 + | }
|
2304 + | }
|
2305 + | }
|
2306 + |
|
2307 + | #[allow(unreachable_code, unused_variables)]
|
2308 + | #[cfg(test)]
|
2309 + | mod json_int_enums_test {
|
2310 + |
|
2311 + | /// Serializes simple scalar properties
|
2312 + | /// Test ID: AwsJson11IntEnums
|
2313 + | #[::tokio::test]
|
2314 + | #[::tracing_test::traced_test]
|
2315 + | async fn aws_json11_int_enums_request() {
|
2316 + | #[allow(unused_mut)]
|
2317 + | let mut http_request = ::http::Request::builder()
|
2318 + | .uri("/")
|
2319 + | .method("POST")
|
2320 + | .header("Content-Type", "application/x-amz-json-1.1")
|
2321 + | .header("X-Amz-Target", "JsonProtocol.JsonIntEnums")
|
2322 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2323 + | ::bytes::Bytes::copy_from_slice(
|
2324 + | &::aws_smithy_protocol_test::decode_body_data("{\n \"intEnum1\": 1,\n \"intEnum2\": 2,\n \"intEnum3\": 3,\n \"intEnumList\": [\n 1,\n 2\n ],\n \"intEnumSet\": [\n 1,\n 2\n ],\n \"intEnumMap\": {\n \"a\": 1,\n \"b\": 2\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2325 + | )
|
2326 + | )).unwrap();
|
2327 + | #[allow(unused_mut)]
|
2328 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2329 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
2330 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2331 + | .json_int_enums(move |input: crate::input::JsonIntEnumsInput| {
|
2332 + | let sender = sender.clone();
|
2333 + | async move {
|
2334 + | let result = {
|
2335 + | let expected = crate::input::JsonIntEnumsInput {
|
2336 + | int_enum1: ::std::option::Option::Some(1),
|
2337 + | int_enum2: ::std::option::Option::Some(2),
|
2338 + | int_enum3: ::std::option::Option::Some(3),
|
2339 + | int_enum_list: ::std::option::Option::Some(vec![1, 2]),
|
2340 + | int_enum_set: ::std::option::Option::Some(
|
2341 + | vec![1, 2].try_into().expect("this is only used in tests"),
|
2342 + | ),
|
2343 + | int_enum_map: ::std::option::Option::Some({
|
2344 + | let mut ret = ::std::collections::HashMap::new();
|
2345 + | ret.insert("a".to_owned(), 1);
|
2346 + | ret.insert("b".to_owned(), 2);
|
2347 + | ret
|
2348 + | }),
|
2349 + | };
|
2350 + | ::pretty_assertions::assert_eq!(input, expected);
|
2351 + | let output = crate::output::JsonIntEnumsOutput {
|
2352 + | int_enum1: ::std::option::Option::None,
|
2353 + | int_enum2: ::std::option::Option::None,
|
2354 + | int_enum3: ::std::option::Option::None,
|
2355 + | int_enum_list: ::std::option::Option::None,
|
2356 + | int_enum_set: ::std::option::Option::None,
|
2357 + | int_enum_map: ::std::option::Option::None,
|
2358 + | };
|
2359 + | Ok(output)
|
2360 + | };
|
2361 + | sender.send(()).await.expect("receiver dropped early");
|
2362 + | result
|
2363 + | }
|
2364 + | })
|
2365 + | .build_unchecked();
|
2366 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2367 + | .await
|
2368 + | .expect("unable to make an HTTP request");
|
2369 + | assert!(
|
2370 + | receiver.recv().await.is_some(),
|
2371 + | "we expected operation handler to be invoked but it was not entered"
|
2372 + | );
|
2373 + | }
|
2374 + |
|
2375 + | /// Serializes simple scalar properties
|
2376 + | /// Test ID: AwsJson11IntEnums
|
2377 + | #[::tokio::test]
|
2378 + | #[::tracing_test::traced_test]
|
2379 + | #[should_panic]
|
2380 + | async fn aws_json11_int_enums_response() {
|
2381 + | let output = crate::output::JsonIntEnumsOutput {
|
2382 + | int_enum1: ::std::option::Option::Some(1),
|
2383 + | int_enum2: ::std::option::Option::Some(2),
|
2384 + | int_enum3: ::std::option::Option::Some(3),
|
2385 + | int_enum_list: ::std::option::Option::Some(vec![1, 2]),
|
2386 + | int_enum_set: ::std::option::Option::Some(
|
2387 + | vec![1, 2].try_into().expect("this is only used in tests"),
|
2388 + | ),
|
2389 + | int_enum_map: ::std::option::Option::Some({
|
2390 + | let mut ret = ::std::collections::HashMap::new();
|
2391 + | ret.insert("a".to_owned(), 1);
|
2392 + | ret.insert("b".to_owned(), 2);
|
2393 + | ret
|
2394 + | }),
|
2395 + | };
|
2396 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
2397 + | let http_response = output.into_response();
|
2398 + | ::pretty_assertions::assert_eq!(
|
2399 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2400 + | http_response.status()
|
2401 + | );
|
2402 + | let expected_headers = [
|
2403 + | ("Content-Type", "application/x-amz-json-1.1"),
|
2404 + | ("X-Amz-Target", "JsonProtocol.JsonIntEnums"),
|
2405 + | ];
|
2406 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2407 + | http_response.headers(),
|
2408 + | expected_headers,
|
2409 + | ));
|
2410 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2411 + | .await
|
2412 + | .expect("unable to extract body to bytes");
|
2413 + | ::aws_smithy_protocol_test::assert_ok(
|
2414 + | ::aws_smithy_protocol_test::validate_body(&body, "{\n \"intEnum1\": 1,\n \"intEnum2\": 2,\n \"intEnum3\": 3,\n \"intEnumList\": [\n 1,\n 2\n ],\n \"intEnumSet\": [\n 1,\n 2\n ],\n \"intEnumMap\": {\n \"a\": 1,\n \"b\": 2\n }\n}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2415 + | );
|
2416 + | }
|
2417 + | }
|
2418 + |
|
2419 + | ::pin_project_lite::pin_project! {
|
2420 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2421 + | /// [`JsonEnumsInput`](crate::input::JsonEnumsInput) using modelled bindings.
|
2422 + | pub struct JsonEnumsInputFuture {
|
2423 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::JsonEnumsInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
2424 + | }
|
2425 + | }
|
2426 + |
|
2427 + | impl std::future::Future for JsonEnumsInputFuture {
|
2428 + | type Output = Result<
|
2429 + | crate::input::JsonEnumsInput,
|
2430 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
2431 + | >;
|
2432 + |
|
2433 + | fn poll(
|
2434 + | self: std::pin::Pin<&mut Self>,
|
2435 + | cx: &mut std::task::Context<'_>,
|
2436 + | ) -> std::task::Poll<Self::Output> {
|
2437 + | let this = self.project();
|
2438 + | this.inner.as_mut().poll(cx)
|
2439 + | }
|
2440 + | }
|
2441 + |
|
2442 + | impl<B>
|
2443 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
2444 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2445 + | B,
|
2446 + | > for crate::input::JsonEnumsInput
|
2447 + | where
|
2448 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
2449 + | B: 'static,
|
2450 + |
|
2451 + | B::Data: Send,
|
2452 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
2453 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
2454 + | {
|
2455 + | type Rejection =
|
2456 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
2457 + | type Future = JsonEnumsInputFuture;
|
2458 + |
|
2459 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2460 + | let fut = async move {
|
2461 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
2462 + | request.headers(),
|
2463 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
2464 + | ) {
|
2465 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
2466 + | }
|
2467 + | crate::protocol_serde::shape_json_enums::de_json_enums_http_request(request).await
|
2468 + | };
|
2469 + | use ::futures_util::future::TryFutureExt;
|
2470 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
2471 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2472 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
2473 + | });
|
2474 + | JsonEnumsInputFuture {
|
2475 + | inner: Box::pin(fut),
|
2476 + | }
|
2477 + | }
|
2478 + | }
|
2479 + | impl
|
2480 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
2481 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2482 + | > for crate::output::JsonEnumsOutput
|
2483 + | {
|
2484 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
2485 + | match crate::protocol_serde::shape_json_enums::ser_json_enums_http_response(self) {
|
2486 + | Ok(response) => response,
|
2487 + | Err(e) => {
|
2488 + | ::tracing::error!(error = %e, "failed to serialize response");
|
2489 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
2490 + | }
|
2491 + | }
|
2492 + | }
|
2493 + | }
|
2494 + | impl
|
2495 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
2496 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2497 + | > for crate::error::JsonEnumsError
|
2498 + | {
|
2499 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
2500 + | match crate::protocol_serde::shape_json_enums::ser_json_enums_http_error(&self) {
|
2501 + | Ok(mut response) => {
|
2502 + | response.extensions_mut().insert(
|
2503 + | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
2504 + | self.name(),
|
2505 + | ),
|
2506 + | );
|
2507 + | response
|
2508 + | }
|
2509 + | Err(e) => {
|
2510 + | ::tracing::error!(error = %e, "failed to serialize response");
|
2511 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
2512 + | }
|
2513 + | }
|
2514 + | }
|
2515 + | }
|
2516 + |
|
2517 + | #[allow(unreachable_code, unused_variables)]
|
2518 + | #[cfg(test)]
|
2519 + | mod json_enums_test {
|
2520 + |
|
2521 + | /// Serializes simple scalar properties
|
2522 + | /// Test ID: AwsJson11Enums
|
2523 + | #[::tokio::test]
|
2524 + | #[::tracing_test::traced_test]
|
2525 + | async fn aws_json11_enums_request() {
|
2526 + | #[allow(unused_mut)]
|
2527 + | let mut http_request = ::http::Request::builder()
|
2528 + | .uri("/")
|
2529 + | .method("POST")
|
2530 + | .header("Content-Type", "application/x-amz-json-1.1")
|
2531 + | .header("X-Amz-Target", "JsonProtocol.JsonEnums")
|
2532 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2533 + | ::bytes::Bytes::copy_from_slice(
|
2534 + | &::aws_smithy_protocol_test::decode_body_data("{\n \"fooEnum1\": \"Foo\",\n \"fooEnum2\": \"0\",\n \"fooEnum3\": \"1\",\n \"fooEnumList\": [\n \"Foo\",\n \"0\"\n ],\n \"fooEnumSet\": [\n \"Foo\",\n \"0\"\n ],\n \"fooEnumMap\": {\n \"hi\": \"Foo\",\n \"zero\": \"0\"\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2535 + | )
|
2536 + | )).unwrap();
|
2537 + | #[allow(unused_mut)]
|
2538 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2539 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
2540 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2541 + | .json_enums(move |input: crate::input::JsonEnumsInput| {
|
2542 + | let sender = sender.clone();
|
2543 + | async move {
|
2544 + | let result = {
|
2545 + | let expected = crate::input::JsonEnumsInput {
|
2546 + | foo_enum1: ::std::option::Option::Some(
|
2547 + | "Foo"
|
2548 + | .parse::<crate::model::FooEnum>()
|
2549 + | .expect("static value validated to member"),
|
2550 + | ),
|
2551 + | foo_enum2: ::std::option::Option::Some(
|
2552 + | "0".parse::<crate::model::FooEnum>()
|
2553 + | .expect("static value validated to member"),
|
2554 + | ),
|
2555 + | foo_enum3: ::std::option::Option::Some(
|
2556 + | "1".parse::<crate::model::FooEnum>()
|
2557 + | .expect("static value validated to member"),
|
2558 + | ),
|
2559 + | foo_enum_list: ::std::option::Option::Some(vec![
|
2560 + | "Foo"
|
2561 + | .parse::<crate::model::FooEnum>()
|
2562 + | .expect("static value validated to member"),
|
2563 + | "0".parse::<crate::model::FooEnum>()
|
2564 + | .expect("static value validated to member"),
|
2565 + | ]),
|
2566 + | foo_enum_set: ::std::option::Option::Some(
|
2567 + | vec![
|
2568 + | "Foo"
|
2569 + | .parse::<crate::model::FooEnum>()
|
2570 + | .expect("static value validated to member"),
|
2571 + | "0".parse::<crate::model::FooEnum>()
|
2572 + | .expect("static value validated to member"),
|
2573 + | ]
|
2574 + | .try_into()
|
2575 + | .expect("this is only used in tests"),
|
2576 + | ),
|
2577 + | foo_enum_map: ::std::option::Option::Some({
|
2578 + | let mut ret = ::std::collections::HashMap::new();
|
2579 + | ret.insert(
|
2580 + | "hi".to_owned(),
|
2581 + | "Foo"
|
2582 + | .parse::<crate::model::FooEnum>()
|
2583 + | .expect("static value validated to member"),
|
2584 + | );
|
2585 + | ret.insert(
|
2586 + | "zero".to_owned(),
|
2587 + | "0".parse::<crate::model::FooEnum>()
|
2588 + | .expect("static value validated to member"),
|
2589 + | );
|
2590 + | ret
|
2591 + | }),
|
2592 + | };
|
2593 + | ::pretty_assertions::assert_eq!(input, expected);
|
2594 + | let output = crate::output::JsonEnumsOutput {
|
2595 + | foo_enum1: ::std::option::Option::None,
|
2596 + | foo_enum2: ::std::option::Option::None,
|
2597 + | foo_enum3: ::std::option::Option::None,
|
2598 + | foo_enum_list: ::std::option::Option::None,
|
2599 + | foo_enum_set: ::std::option::Option::None,
|
2600 + | foo_enum_map: ::std::option::Option::None,
|
2601 + | };
|
2602 + | Ok(output)
|
2603 + | };
|
2604 + | sender.send(()).await.expect("receiver dropped early");
|
2605 + | result
|
2606 + | }
|
2607 + | })
|
2608 + | .build_unchecked();
|
2609 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2610 + | .await
|
2611 + | .expect("unable to make an HTTP request");
|
2612 + | assert!(
|
2613 + | receiver.recv().await.is_some(),
|
2614 + | "we expected operation handler to be invoked but it was not entered"
|
2615 + | );
|
2616 + | }
|
2617 + |
|
2618 + | /// Serializes simple scalar properties
|
2619 + | /// Test ID: AwsJson11Enums
|
2620 + | #[::tokio::test]
|
2621 + | #[::tracing_test::traced_test]
|
2622 + | async fn aws_json11_enums_response() {
|
2623 + | let output = crate::output::JsonEnumsOutput {
|
2624 + | foo_enum1: ::std::option::Option::Some(
|
2625 + | "Foo"
|
2626 + | .parse::<crate::model::FooEnum>()
|
2627 + | .expect("static value validated to member"),
|
2628 + | ),
|
2629 + | foo_enum2: ::std::option::Option::Some(
|
2630 + | "0".parse::<crate::model::FooEnum>()
|
2631 + | .expect("static value validated to member"),
|
2632 + | ),
|
2633 + | foo_enum3: ::std::option::Option::Some(
|
2634 + | "1".parse::<crate::model::FooEnum>()
|
2635 + | .expect("static value validated to member"),
|
2636 + | ),
|
2637 + | foo_enum_list: ::std::option::Option::Some(vec![
|
2638 + | "Foo"
|
2639 + | .parse::<crate::model::FooEnum>()
|
2640 + | .expect("static value validated to member"),
|
2641 + | "0".parse::<crate::model::FooEnum>()
|
2642 + | .expect("static value validated to member"),
|
2643 + | ]),
|
2644 + | foo_enum_set: ::std::option::Option::Some(
|
2645 + | vec![
|
2646 + | "Foo"
|
2647 + | .parse::<crate::model::FooEnum>()
|
2648 + | .expect("static value validated to member"),
|
2649 + | "0".parse::<crate::model::FooEnum>()
|
2650 + | .expect("static value validated to member"),
|
2651 + | ]
|
2652 + | .try_into()
|
2653 + | .expect("this is only used in tests"),
|
2654 + | ),
|
2655 + | foo_enum_map: ::std::option::Option::Some({
|
2656 + | let mut ret = ::std::collections::HashMap::new();
|
2657 + | ret.insert(
|
2658 + | "hi".to_owned(),
|
2659 + | "Foo"
|
2660 + | .parse::<crate::model::FooEnum>()
|
2661 + | .expect("static value validated to member"),
|
2662 + | );
|
2663 + | ret.insert(
|
2664 + | "zero".to_owned(),
|
2665 + | "0".parse::<crate::model::FooEnum>()
|
2666 + | .expect("static value validated to member"),
|
2667 + | );
|
2668 + | ret
|
2669 + | }),
|
2670 + | };
|
2671 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
2672 + | let http_response = output.into_response();
|
2673 + | ::pretty_assertions::assert_eq!(
|
2674 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2675 + | http_response.status()
|
2676 + | );
|
2677 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
2678 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2679 + | http_response.headers(),
|
2680 + | expected_headers,
|
2681 + | ));
|
2682 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2683 + | .await
|
2684 + | .expect("unable to extract body to bytes");
|
2685 + | ::aws_smithy_protocol_test::assert_ok(
|
2686 + | ::aws_smithy_protocol_test::validate_body(&body, "{\n \"fooEnum1\": \"Foo\",\n \"fooEnum2\": \"0\",\n \"fooEnum3\": \"1\",\n \"fooEnumList\": [\n \"Foo\",\n \"0\"\n ],\n \"fooEnumSet\": [\n \"Foo\",\n \"0\"\n ],\n \"fooEnumMap\": {\n \"hi\": \"Foo\",\n \"zero\": \"0\"\n }\n}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2687 + | );
|
2688 + | }
|
2689 + | }
|
2690 + |
|
2691 + | ::pin_project_lite::pin_project! {
|
2692 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2693 + | /// [`PutAndGetInlineDocumentsInput`](crate::input::PutAndGetInlineDocumentsInput) using modelled bindings.
|
2694 + | pub struct PutAndGetInlineDocumentsInputFuture {
|
2695 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::PutAndGetInlineDocumentsInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
2696 + | }
|
2697 + | }
|
2698 + |
|
2699 + | impl std::future::Future for PutAndGetInlineDocumentsInputFuture {
|
2700 + | type Output = Result<
|
2701 + | crate::input::PutAndGetInlineDocumentsInput,
|
2702 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
2703 + | >;
|
2704 + |
|
2705 + | fn poll(
|
2706 + | self: std::pin::Pin<&mut Self>,
|
2707 + | cx: &mut std::task::Context<'_>,
|
2708 + | ) -> std::task::Poll<Self::Output> {
|
2709 + | let this = self.project();
|
2710 + | this.inner.as_mut().poll(cx)
|
2711 + | }
|
2712 + | }
|
2713 + |
|
2714 + | impl<B>
|
2715 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
2716 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2717 + | B,
|
2718 + | > for crate::input::PutAndGetInlineDocumentsInput
|
2719 + | where
|
2720 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
2721 + | B: 'static,
|
2722 + |
|
2723 + | B::Data: Send,
|
2724 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
2725 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
2726 + | {
|
2727 + | type Rejection =
|
2728 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
2729 + | type Future = PutAndGetInlineDocumentsInputFuture;
|
2730 + |
|
2731 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2732 + | let fut = async move {
|
2733 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
2734 + | request.headers(),
|
2735 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
2736 + | ) {
|
2737 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
2738 + | }
|
2739 + | crate::protocol_serde::shape_put_and_get_inline_documents::de_put_and_get_inline_documents_http_request(request)
|
2740 + | .await
|
2741 + | };
|
2742 + | use ::futures_util::future::TryFutureExt;
|
2743 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
2744 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2745 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
2746 + | });
|
2747 + | PutAndGetInlineDocumentsInputFuture {
|
2748 + | inner: Box::pin(fut),
|
2749 + | }
|
2750 + | }
|
2751 + | }
|
2752 + | impl
|
2753 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
2754 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2755 + | > for crate::output::PutAndGetInlineDocumentsOutput
|
2756 + | {
|
2757 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
2758 + | match crate::protocol_serde::shape_put_and_get_inline_documents::ser_put_and_get_inline_documents_http_response(self) {
|
2759 + | Ok(response) => response,
|
2760 + | Err(e) => {
|
2761 + | ::tracing::error!(error = %e, "failed to serialize response");
|
2762 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
2763 + | }
|
2764 + | }
|
2765 + | }
|
2766 + | }
|
2767 + |
|
2768 + | #[allow(unreachable_code, unused_variables)]
|
2769 + | #[cfg(test)]
|
2770 + | mod put_and_get_inline_documents_test {
|
2771 + |
|
2772 + | /// Serializes inline documents in a JSON request.
|
2773 + | /// Test ID: PutAndGetInlineDocumentsInput
|
2774 + | #[::tokio::test]
|
2775 + | #[::tracing_test::traced_test]
|
2776 + | async fn put_and_get_inline_documents_input_request() {
|
2777 + | #[allow(unused_mut)]
|
2778 + | let mut http_request = ::http::Request::builder()
|
2779 + | .uri("/")
|
2780 + | .method("POST")
|
2781 + | .header("Content-Type", "application/x-amz-json-1.1")
|
2782 + | .header("X-Amz-Target", "JsonProtocol.PutAndGetInlineDocuments")
|
2783 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2784 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2785 + | "{\n \"inlineDocument\": {\"foo\": \"bar\"}\n}".as_bytes(),
|
2786 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2787 + | )),
|
2788 + | ))
|
2789 + | .unwrap();
|
2790 + | #[allow(unused_mut)]
|
2791 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2792 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
2793 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2794 + | .put_and_get_inline_documents(
|
2795 + | move |input: crate::input::PutAndGetInlineDocumentsInput| {
|
2796 + | let sender = sender.clone();
|
2797 + | async move {
|
2798 + | let result = {
|
2799 + | let expected = crate::input::PutAndGetInlineDocumentsInput {
|
2800 + | inline_document: ::std::option::Option::Some({
|
2801 + | let json_bytes = br#"{
|
2802 + | "foo": "bar"
|
2803 + | }"#;
|
2804 + | let mut tokens =
|
2805 + | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
2806 + | .peekable();
|
2807 + | ::aws_smithy_json::deserialize::token::expect_document(
|
2808 + | &mut tokens,
|
2809 + | )
|
2810 + | .expect("well formed json")
|
2811 + | }),
|
2812 + | };
|
2813 + | ::pretty_assertions::assert_eq!(input, expected);
|
2814 + | let output = crate::output::PutAndGetInlineDocumentsOutput {
|
2815 + | inline_document: ::std::option::Option::Some({
|
2816 + | let json_bytes = br#"null"#;
|
2817 + | let mut tokens =
|
2818 + | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
2819 + | .peekable();
|
2820 + | ::aws_smithy_json::deserialize::token::expect_document(
|
2821 + | &mut tokens,
|
2822 + | )
|
2823 + | .expect("well formed json")
|
2824 + | }),
|
2825 + | };
|
2826 + | output
|
2827 + | };
|
2828 + | sender.send(()).await.expect("receiver dropped early");
|
2829 + | result
|
2830 + | }
|
2831 + | },
|
2832 + | )
|
2833 + | .build_unchecked();
|
2834 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2835 + | .await
|
2836 + | .expect("unable to make an HTTP request");
|
2837 + | assert!(
|
2838 + | receiver.recv().await.is_some(),
|
2839 + | "we expected operation handler to be invoked but it was not entered"
|
2840 + | );
|
2841 + | }
|
2842 + |
|
2843 + | /// Serializes inline documents in a JSON response.
|
2844 + | /// Test ID: PutAndGetInlineDocumentsInput
|
2845 + | #[::tokio::test]
|
2846 + | #[::tracing_test::traced_test]
|
2847 + | async fn put_and_get_inline_documents_input_response() {
|
2848 + | let output = crate::output::PutAndGetInlineDocumentsOutput {
|
2849 + | inline_document: ::std::option::Option::Some({
|
2850 + | let json_bytes = br#"{
|
2851 + | "foo": "bar"
|
2852 + | }"#;
|
2853 + | let mut tokens =
|
2854 + | ::aws_smithy_json::deserialize::json_token_iter(json_bytes).peekable();
|
2855 + | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
2856 + | .expect("well formed json")
|
2857 + | }),
|
2858 + | };
|
2859 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
2860 + | let http_response = output.into_response();
|
2861 + | ::pretty_assertions::assert_eq!(
|
2862 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2863 + | http_response.status()
|
2864 + | );
|
2865 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
2866 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2867 + | http_response.headers(),
|
2868 + | expected_headers,
|
2869 + | ));
|
2870 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2871 + | .await
|
2872 + | .expect("unable to extract body to bytes");
|
2873 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2874 + | &body,
|
2875 + | "{\n \"inlineDocument\": {\"foo\": \"bar\"}\n}",
|
2876 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2877 + | ));
|
2878 + | }
|
2879 + | }
|
2880 + |
|
2881 + | ::pin_project_lite::pin_project! {
|
2882 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2883 + | /// [`OperationWithOptionalInputOutputInput`](crate::input::OperationWithOptionalInputOutputInput) using modelled bindings.
|
2884 + | pub struct OperationWithOptionalInputOutputInputFuture {
|
2885 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::OperationWithOptionalInputOutputInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
2886 + | }
|
2887 + | }
|
2888 + |
|
2889 + | impl std::future::Future for OperationWithOptionalInputOutputInputFuture {
|
2890 + | type Output = Result<
|
2891 + | crate::input::OperationWithOptionalInputOutputInput,
|
2892 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
2893 + | >;
|
2894 + |
|
2895 + | fn poll(
|
2896 + | self: std::pin::Pin<&mut Self>,
|
2897 + | cx: &mut std::task::Context<'_>,
|
2898 + | ) -> std::task::Poll<Self::Output> {
|
2899 + | let this = self.project();
|
2900 + | this.inner.as_mut().poll(cx)
|
2901 + | }
|
2902 + | }
|
2903 + |
|
2904 + | impl<B>
|
2905 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
2906 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2907 + | B,
|
2908 + | > for crate::input::OperationWithOptionalInputOutputInput
|
2909 + | where
|
2910 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
2911 + | B: 'static,
|
2912 + |
|
2913 + | B::Data: Send,
|
2914 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
2915 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
2916 + | {
|
2917 + | type Rejection =
|
2918 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
2919 + | type Future = OperationWithOptionalInputOutputInputFuture;
|
2920 + |
|
2921 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2922 + | let fut = async move {
|
2923 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
2924 + | request.headers(),
|
2925 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
2926 + | ) {
|
2927 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
2928 + | }
|
2929 + | crate::protocol_serde::shape_operation_with_optional_input_output::de_operation_with_optional_input_output_http_request(request)
|
2930 + | .await
|
2931 + | };
|
2932 + | use ::futures_util::future::TryFutureExt;
|
2933 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
2934 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2935 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
2936 + | });
|
2937 + | OperationWithOptionalInputOutputInputFuture {
|
2938 + | inner: Box::pin(fut),
|
2939 + | }
|
2940 + | }
|
2941 + | }
|
2942 + | impl
|
2943 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
2944 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2945 + | > for crate::output::OperationWithOptionalInputOutputOutput
|
2946 + | {
|
2947 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
2948 + | match crate::protocol_serde::shape_operation_with_optional_input_output::ser_operation_with_optional_input_output_http_response(self) {
|
2949 + | Ok(response) => response,
|
2950 + | Err(e) => {
|
2951 + | ::tracing::error!(error = %e, "failed to serialize response");
|
2952 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
2953 + | }
|
2954 + | }
|
2955 + | }
|
2956 + | }
|
2957 + |
|
2958 + | #[allow(unreachable_code, unused_variables)]
|
2959 + | #[cfg(test)]
|
2960 + | mod operation_with_optional_input_output_test {
|
2961 + |
|
2962 + | /// Can call operations with no input or output
|
2963 + | /// Test ID: can_call_operation_with_no_input_or_output
|
2964 + | #[::tokio::test]
|
2965 + | #[::tracing_test::traced_test]
|
2966 + | async fn can_call_operation_with_no_input_or_output_request() {
|
2967 + | #[allow(unused_mut)]
|
2968 + | let mut http_request = ::http::Request::builder()
|
2969 + | .uri("/")
|
2970 + | .method("POST")
|
2971 + | .header("Content-Type", "application/x-amz-json-1.1")
|
2972 + | .header(
|
2973 + | "X-Amz-Target",
|
2974 + | "JsonProtocol.OperationWithOptionalInputOutput",
|
2975 + | )
|
2976 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2977 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2978 + | "{}".as_bytes(),
|
2979 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2980 + | )),
|
2981 + | ))
|
2982 + | .unwrap();
|
2983 + | #[allow(unused_mut)]
|
2984 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2985 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
2986 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2987 + | .operation_with_optional_input_output(
|
2988 + | move |input: crate::input::OperationWithOptionalInputOutputInput| {
|
2989 + | let sender = sender.clone();
|
2990 + | async move {
|
2991 + | let result = {
|
2992 + | let expected = crate::input::OperationWithOptionalInputOutputInput {
|
2993 + | value: ::std::option::Option::None,
|
2994 + | };
|
2995 + | ::pretty_assertions::assert_eq!(input, expected);
|
2996 + | let output = crate::output::OperationWithOptionalInputOutputOutput {
|
2997 + | value: ::std::option::Option::None,
|
2998 + | };
|
2999 + | output
|
3000 + | };
|
3001 + | sender.send(()).await.expect("receiver dropped early");
|
3002 + | result
|
3003 + | }
|
3004 + | },
|
3005 + | )
|
3006 + | .build_unchecked();
|
3007 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3008 + | .await
|
3009 + | .expect("unable to make an HTTP request");
|
3010 + | assert!(
|
3011 + | receiver.recv().await.is_some(),
|
3012 + | "we expected operation handler to be invoked but it was not entered"
|
3013 + | );
|
3014 + | }
|
3015 + |
|
3016 + | /// Can invoke operations with optional input
|
3017 + | /// Test ID: can_call_operation_with_optional_input
|
3018 + | #[::tokio::test]
|
3019 + | #[::tracing_test::traced_test]
|
3020 + | async fn can_call_operation_with_optional_input_request() {
|
3021 + | #[allow(unused_mut)]
|
3022 + | let mut http_request = ::http::Request::builder()
|
3023 + | .uri("/")
|
3024 + | .method("POST")
|
3025 + | .header("Content-Type", "application/x-amz-json-1.1")
|
3026 + | .header(
|
3027 + | "X-Amz-Target",
|
3028 + | "JsonProtocol.OperationWithOptionalInputOutput",
|
3029 + | )
|
3030 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3031 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3032 + | "{\"Value\":\"Hi\"}".as_bytes(),
|
3033 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3034 + | )),
|
3035 + | ))
|
3036 + | .unwrap();
|
3037 + | #[allow(unused_mut)]
|
3038 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3039 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
3040 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3041 + | .operation_with_optional_input_output(
|
3042 + | move |input: crate::input::OperationWithOptionalInputOutputInput| {
|
3043 + | let sender = sender.clone();
|
3044 + | async move {
|
3045 + | let result = {
|
3046 + | let expected = crate::input::OperationWithOptionalInputOutputInput {
|
3047 + | value: ::std::option::Option::Some("Hi".to_owned()),
|
3048 + | };
|
3049 + | ::pretty_assertions::assert_eq!(input, expected);
|
3050 + | let output = crate::output::OperationWithOptionalInputOutputOutput {
|
3051 + | value: ::std::option::Option::None,
|
3052 + | };
|
3053 + | output
|
3054 + | };
|
3055 + | sender.send(()).await.expect("receiver dropped early");
|
3056 + | result
|
3057 + | }
|
3058 + | },
|
3059 + | )
|
3060 + | .build_unchecked();
|
3061 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3062 + | .await
|
3063 + | .expect("unable to make an HTTP request");
|
3064 + | assert!(
|
3065 + | receiver.recv().await.is_some(),
|
3066 + | "we expected operation handler to be invoked but it was not entered"
|
3067 + | );
|
3068 + | }
|
3069 + | }
|
3070 + |
|
3071 + | ::pin_project_lite::pin_project! {
|
3072 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
3073 + | /// [`SimpleScalarPropertiesInput`](crate::input::SimpleScalarPropertiesInput) using modelled bindings.
|
3074 + | pub struct SimpleScalarPropertiesInputFuture {
|
3075 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SimpleScalarPropertiesInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
3076 + | }
|
3077 + | }
|
3078 + |
|
3079 + | impl std::future::Future for SimpleScalarPropertiesInputFuture {
|
3080 + | type Output = Result<
|
3081 + | crate::input::SimpleScalarPropertiesInput,
|
3082 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
3083 + | >;
|
3084 + |
|
3085 + | fn poll(
|
3086 + | self: std::pin::Pin<&mut Self>,
|
3087 + | cx: &mut std::task::Context<'_>,
|
3088 + | ) -> std::task::Poll<Self::Output> {
|
3089 + | let this = self.project();
|
3090 + | this.inner.as_mut().poll(cx)
|
3091 + | }
|
3092 + | }
|
3093 + |
|
3094 + | impl<B>
|
3095 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
3096 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
3097 + | B,
|
3098 + | > for crate::input::SimpleScalarPropertiesInput
|
3099 + | where
|
3100 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
3101 + | B: 'static,
|
3102 + |
|
3103 + | B::Data: Send,
|
3104 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
3105 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
3106 + | {
|
3107 + | type Rejection =
|
3108 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
3109 + | type Future = SimpleScalarPropertiesInputFuture;
|
3110 + |
|
3111 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
3112 + | let fut = async move {
|
3113 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
3114 + | request.headers(),
|
3115 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
3116 + | ) {
|
3117 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
3118 + | }
|
3119 + | crate::protocol_serde::shape_simple_scalar_properties::de_simple_scalar_properties_http_request(request)
|
3120 + | .await
|
3121 + | };
|
3122 + | use ::futures_util::future::TryFutureExt;
|
3123 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
3124 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
3125 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
3126 + | });
|
3127 + | SimpleScalarPropertiesInputFuture {
|
3128 + | inner: Box::pin(fut),
|
3129 + | }
|
3130 + | }
|
3131 + | }
|
3132 + | impl
|
3133 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
3134 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
3135 + | > for crate::output::SimpleScalarPropertiesOutput
|
3136 + | {
|
3137 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
3138 + | match crate::protocol_serde::shape_simple_scalar_properties::ser_simple_scalar_properties_http_response(self) {
|
3139 + | Ok(response) => response,
|
3140 + | Err(e) => {
|
3141 + | ::tracing::error!(error = %e, "failed to serialize response");
|
3142 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
3143 + | }
|
3144 + | }
|
3145 + | }
|
3146 + | }
|
3147 + |
|
3148 + | #[allow(unreachable_code, unused_variables)]
|
3149 + | #[cfg(test)]
|
3150 + | mod simple_scalar_properties_test {
|
3151 + |
|
3152 + | /// Supports handling NaN float values.
|
3153 + | /// Test ID: AwsJson11SupportsNaNFloatInputs
|
3154 + | #[::tokio::test]
|
3155 + | #[::tracing_test::traced_test]
|
3156 + | async fn aws_json11_supports_na_n_float_inputs_request() {
|
3157 + | #[allow(unused_mut)]
|
3158 + | let mut http_request = ::http::Request::builder()
|
3159 + | .uri("/")
|
3160 + | .method("POST")
|
3161 + | .header("Content-Type", "application/x-amz-json-1.1")
|
3162 + | .header("X-Amz-Target", "JsonProtocol.SimpleScalarProperties")
|
3163 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3164 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3165 + | "{\n \"floatValue\": \"NaN\",\n \"doubleValue\": \"NaN\"\n}".as_bytes(),
|
3166 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3167 + | )),
|
3168 + | ))
|
3169 + | .unwrap();
|
3170 + | #[allow(unused_mut)]
|
3171 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3172 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
3173 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3174 + | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
3175 + | let sender = sender.clone();
|
3176 + | async move {
|
3177 + | let result = { use ::aws_smithy_protocol_test::FloatEquals;
|
3178 + | let expected =
|
3179 + | crate::input::SimpleScalarPropertiesInput {
|
3180 + | float_value:
|
3181 + | ::std::option::Option::Some(
|
3182 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number")
|
3183 + | )
|
3184 + | ,
|
3185 + | double_value:
|
3186 + | ::std::option::Option::Some(
|
3187 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number")
|
3188 + | )
|
3189 + | ,
|
3190 + | }
|
3191 + | ;
|
3192 + | assert!(input.float_value.float_equals(&expected.float_value),
|
3193 + | "Unexpected value for `float_value` {:?} vs. {:?}", expected.float_value, input.float_value);
|
3194 + | assert!(input.double_value.float_equals(&expected.double_value),
|
3195 + | "Unexpected value for `double_value` {:?} vs. {:?}", expected.double_value, input.double_value);
|
3196 + | let output =
|
3197 + | crate::output::SimpleScalarPropertiesOutput {
|
3198 + | float_value:
|
3199 + | ::std::option::Option::None
|
3200 + | ,
|
3201 + | double_value:
|
3202 + | ::std::option::Option::None
|
3203 + | ,
|
3204 + | }
|
3205 + | ;
|
3206 + | output };
|
3207 + | sender.send(()).await.expect("receiver dropped early");
|
3208 + | result
|
3209 + | }
|
3210 + | })
|
3211 + | .build_unchecked();
|
3212 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3213 + | .await
|
3214 + | .expect("unable to make an HTTP request");
|
3215 + | assert!(
|
3216 + | receiver.recv().await.is_some(),
|
3217 + | "we expected operation handler to be invoked but it was not entered"
|
3218 + | );
|
3219 + | }
|
3220 + |
|
3221 + | /// Supports handling Infinity float values.
|
3222 + | /// Test ID: AwsJson11SupportsInfinityFloatInputs
|
3223 + | #[::tokio::test]
|
3224 + | #[::tracing_test::traced_test]
|
3225 + | async fn aws_json11_supports_infinity_float_inputs_request() {
|
3226 + | #[allow(unused_mut)]
|
3227 + | let mut http_request = ::http::Request::builder()
|
3228 + | .uri("/")
|
3229 + | .method("POST")
|
3230 + | .header("Content-Type", "application/x-amz-json-1.1")
|
3231 + | .header("X-Amz-Target", "JsonProtocol.SimpleScalarProperties")
|
3232 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3233 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3234 + | "{\n \"floatValue\": \"Infinity\",\n \"doubleValue\": \"Infinity\"\n}"
|
3235 + | .as_bytes(),
|
3236 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3237 + | )),
|
3238 + | ))
|
3239 + | .unwrap();
|
3240 + | #[allow(unused_mut)]
|
3241 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3242 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
3243 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3244 + | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
3245 + | let sender = sender.clone();
|
3246 + | async move {
|
3247 + | let result = { use ::aws_smithy_protocol_test::FloatEquals;
|
3248 + | let expected =
|
3249 + | crate::input::SimpleScalarPropertiesInput {
|
3250 + | float_value:
|
3251 + | ::std::option::Option::Some(
|
3252 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number")
|
3253 + | )
|
3254 + | ,
|
3255 + | double_value:
|
3256 + | ::std::option::Option::Some(
|
3257 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number")
|
3258 + | )
|
3259 + | ,
|
3260 + | }
|
3261 + | ;
|
3262 + | assert!(input.float_value.float_equals(&expected.float_value),
|
3263 + | "Unexpected value for `float_value` {:?} vs. {:?}", expected.float_value, input.float_value);
|
3264 + | assert!(input.double_value.float_equals(&expected.double_value),
|
3265 + | "Unexpected value for `double_value` {:?} vs. {:?}", expected.double_value, input.double_value);
|
3266 + | let output =
|
3267 + | crate::output::SimpleScalarPropertiesOutput {
|
3268 + | float_value:
|
3269 + | ::std::option::Option::None
|
3270 + | ,
|
3271 + | double_value:
|
3272 + | ::std::option::Option::None
|
3273 + | ,
|
3274 + | }
|
3275 + | ;
|
3276 + | output };
|
3277 + | sender.send(()).await.expect("receiver dropped early");
|
3278 + | result
|
3279 + | }
|
3280 + | })
|
3281 + | .build_unchecked();
|
3282 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3283 + | .await
|
3284 + | .expect("unable to make an HTTP request");
|
3285 + | assert!(
|
3286 + | receiver.recv().await.is_some(),
|
3287 + | "we expected operation handler to be invoked but it was not entered"
|
3288 + | );
|
3289 + | }
|
3290 + |
|
3291 + | /// Supports handling -Infinity float values.
|
3292 + | /// Test ID: AwsJson11SupportsNegativeInfinityFloatInputs
|
3293 + | #[::tokio::test]
|
3294 + | #[::tracing_test::traced_test]
|
3295 + | async fn aws_json11_supports_negative_infinity_float_inputs_request() {
|
3296 + | #[allow(unused_mut)]
|
3297 + | let mut http_request = ::http::Request::builder()
|
3298 + | .uri("/")
|
3299 + | .method("POST")
|
3300 + | .header("Content-Type", "application/x-amz-json-1.1")
|
3301 + | .header("X-Amz-Target", "JsonProtocol.SimpleScalarProperties")
|
3302 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3303 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3304 + | "{\n \"floatValue\": \"-Infinity\",\n \"doubleValue\": \"-Infinity\"\n}"
|
3305 + | .as_bytes(),
|
3306 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3307 + | )),
|
3308 + | ))
|
3309 + | .unwrap();
|
3310 + | #[allow(unused_mut)]
|
3311 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3312 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
3313 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3314 + | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
3315 + | let sender = sender.clone();
|
3316 + | async move {
|
3317 + | let result = { use ::aws_smithy_protocol_test::FloatEquals;
|
3318 + | let expected =
|
3319 + | crate::input::SimpleScalarPropertiesInput {
|
3320 + | float_value:
|
3321 + | ::std::option::Option::Some(
|
3322 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number")
|
3323 + | )
|
3324 + | ,
|
3325 + | double_value:
|
3326 + | ::std::option::Option::Some(
|
3327 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number")
|
3328 + | )
|
3329 + | ,
|
3330 + | }
|
3331 + | ;
|
3332 + | assert!(input.float_value.float_equals(&expected.float_value),
|
3333 + | "Unexpected value for `float_value` {:?} vs. {:?}", expected.float_value, input.float_value);
|
3334 + | assert!(input.double_value.float_equals(&expected.double_value),
|
3335 + | "Unexpected value for `double_value` {:?} vs. {:?}", expected.double_value, input.double_value);
|
3336 + | let output =
|
3337 + | crate::output::SimpleScalarPropertiesOutput {
|
3338 + | float_value:
|
3339 + | ::std::option::Option::None
|
3340 + | ,
|
3341 + | double_value:
|
3342 + | ::std::option::Option::None
|
3343 + | ,
|
3344 + | }
|
3345 + | ;
|
3346 + | output };
|
3347 + | sender.send(()).await.expect("receiver dropped early");
|
3348 + | result
|
3349 + | }
|
3350 + | })
|
3351 + | .build_unchecked();
|
3352 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3353 + | .await
|
3354 + | .expect("unable to make an HTTP request");
|
3355 + | assert!(
|
3356 + | receiver.recv().await.is_some(),
|
3357 + | "we expected operation handler to be invoked but it was not entered"
|
3358 + | );
|
3359 + | }
|
3360 + |
|
3361 + | /// Supports handling NaN float values.
|
3362 + | /// Test ID: AwsJson11SupportsNaNFloatInputs
|
3363 + | #[::tokio::test]
|
3364 + | #[::tracing_test::traced_test]
|
3365 + | async fn aws_json11_supports_na_n_float_inputs_response() {
|
3366 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
3367 + | float_value: ::std::option::Option::Some(
|
3368 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN")
|
3369 + | .expect("invalid string for number"),
|
3370 + | ),
|
3371 + | double_value: ::std::option::Option::Some(
|
3372 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN")
|
3373 + | .expect("invalid string for number"),
|
3374 + | ),
|
3375 + | };
|
3376 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
3377 + | let http_response = output.into_response();
|
3378 + | ::pretty_assertions::assert_eq!(
|
3379 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3380 + | http_response.status()
|
3381 + | );
|
3382 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
3383 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3384 + | http_response.headers(),
|
3385 + | expected_headers,
|
3386 + | ));
|
3387 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3388 + | .await
|
3389 + | .expect("unable to extract body to bytes");
|
3390 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
3391 + | &body,
|
3392 + | "{\n \"floatValue\": \"NaN\",\n \"doubleValue\": \"NaN\"\n}",
|
3393 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3394 + | ));
|
3395 + | }
|
3396 + |
|
3397 + | /// Supports handling Infinity float values.
|
3398 + | /// Test ID: AwsJson11SupportsInfinityFloatInputs
|
3399 + | #[::tokio::test]
|
3400 + | #[::tracing_test::traced_test]
|
3401 + | async fn aws_json11_supports_infinity_float_inputs_response() {
|
3402 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
3403 + | float_value: ::std::option::Option::Some(
|
3404 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity")
|
3405 + | .expect("invalid string for number"),
|
3406 + | ),
|
3407 + | double_value: ::std::option::Option::Some(
|
3408 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity")
|
3409 + | .expect("invalid string for number"),
|
3410 + | ),
|
3411 + | };
|
3412 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
3413 + | let http_response = output.into_response();
|
3414 + | ::pretty_assertions::assert_eq!(
|
3415 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3416 + | http_response.status()
|
3417 + | );
|
3418 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
3419 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3420 + | http_response.headers(),
|
3421 + | expected_headers,
|
3422 + | ));
|
3423 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3424 + | .await
|
3425 + | .expect("unable to extract body to bytes");
|
3426 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
3427 + | &body,
|
3428 + | "{\n \"floatValue\": \"Infinity\",\n \"doubleValue\": \"Infinity\"\n}",
|
3429 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3430 + | ));
|
3431 + | }
|
3432 + |
|
3433 + | /// Supports handling -Infinity float values.
|
3434 + | /// Test ID: AwsJson11SupportsNegativeInfinityFloatInputs
|
3435 + | #[::tokio::test]
|
3436 + | #[::tracing_test::traced_test]
|
3437 + | async fn aws_json11_supports_negative_infinity_float_inputs_response() {
|
3438 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
3439 + | float_value: ::std::option::Option::Some(
|
3440 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity")
|
3441 + | .expect("invalid string for number"),
|
3442 + | ),
|
3443 + | double_value: ::std::option::Option::Some(
|
3444 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity")
|
3445 + | .expect("invalid string for number"),
|
3446 + | ),
|
3447 + | };
|
3448 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
3449 + | let http_response = output.into_response();
|
3450 + | ::pretty_assertions::assert_eq!(
|
3451 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3452 + | http_response.status()
|
3453 + | );
|
3454 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
3455 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3456 + | http_response.headers(),
|
3457 + | expected_headers,
|
3458 + | ));
|
3459 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3460 + | .await
|
3461 + | .expect("unable to extract body to bytes");
|
3462 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
3463 + | &body,
|
3464 + | "{\n \"floatValue\": \"-Infinity\",\n \"doubleValue\": \"-Infinity\"\n}",
|
3465 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3466 + | ));
|
3467 + | }
|
3468 + | }
|
3469 + |
|
3470 + | ::pin_project_lite::pin_project! {
|
3471 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
3472 + | /// [`KitchenSinkOperationInput`](crate::input::KitchenSinkOperationInput) using modelled bindings.
|
3473 + | pub struct KitchenSinkOperationInputFuture {
|
3474 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::KitchenSinkOperationInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
3475 + | }
|
3476 + | }
|
3477 + |
|
3478 + | impl std::future::Future for KitchenSinkOperationInputFuture {
|
3479 + | type Output = Result<
|
3480 + | crate::input::KitchenSinkOperationInput,
|
3481 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
3482 + | >;
|
3483 + |
|
3484 + | fn poll(
|
3485 + | self: std::pin::Pin<&mut Self>,
|
3486 + | cx: &mut std::task::Context<'_>,
|
3487 + | ) -> std::task::Poll<Self::Output> {
|
3488 + | let this = self.project();
|
3489 + | this.inner.as_mut().poll(cx)
|
3490 + | }
|
3491 + | }
|
3492 + |
|
3493 + | impl<B>
|
3494 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
3495 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
3496 + | B,
|
3497 + | > for crate::input::KitchenSinkOperationInput
|
3498 + | where
|
3499 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
3500 + | B: 'static,
|
3501 + |
|
3502 + | B::Data: Send,
|
3503 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
3504 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
3505 + | {
|
3506 + | type Rejection =
|
3507 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
3508 + | type Future = KitchenSinkOperationInputFuture;
|
3509 + |
|
3510 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
3511 + | let fut = async move {
|
3512 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
3513 + | request.headers(),
|
3514 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
3515 + | ) {
|
3516 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
3517 + | }
|
3518 + | crate::protocol_serde::shape_kitchen_sink_operation::de_kitchen_sink_operation_http_request(request)
|
3519 + | .await
|
3520 + | };
|
3521 + | use ::futures_util::future::TryFutureExt;
|
3522 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
3523 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
3524 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
3525 + | });
|
3526 + | KitchenSinkOperationInputFuture {
|
3527 + | inner: Box::pin(fut),
|
3528 + | }
|
3529 + | }
|
3530 + | }
|
3531 + | impl
|
3532 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
3533 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
3534 + | > for crate::output::KitchenSinkOperationOutput
|
3535 + | {
|
3536 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
3537 + | match crate::protocol_serde::shape_kitchen_sink_operation::ser_kitchen_sink_operation_http_response(self) {
|
3538 + | Ok(response) => response,
|
3539 + | Err(e) => {
|
3540 + | ::tracing::error!(error = %e, "failed to serialize response");
|
3541 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
3542 + | }
|
3543 + | }
|
3544 + | }
|
3545 + | }
|
3546 + | impl
|
3547 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
3548 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
3549 + | > for crate::error::KitchenSinkOperationError
|
3550 + | {
|
3551 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
3552 + | match crate::protocol_serde::shape_kitchen_sink_operation::ser_kitchen_sink_operation_http_error(&self) {
|
3553 + | Ok(mut response) => {
|
3554 + | response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
3555 + | response
|
3556 + | },
|
3557 + | Err(e) => {
|
3558 + | ::tracing::error!(error = %e, "failed to serialize response");
|
3559 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
3560 + | }
|
3561 + | }
|
3562 + | }
|
3563 + | }
|
3564 + |
|
3565 + | #[allow(unreachable_code, unused_variables)]
|
3566 + | #[cfg(test)]
|
3567 + | mod kitchen_sink_operation_test {
|
3568 + |
|
3569 + | /// Serializes string shapes
|
3570 + | /// Test ID: serializes_string_shapes
|
3571 + | #[::tokio::test]
|
3572 + | #[::tracing_test::traced_test]
|
3573 + | async fn serializes_string_shapes_request() {
|
3574 + | #[allow(unused_mut)]
|
3575 + | let mut http_request = ::http::Request::builder()
|
3576 + | .uri("/")
|
3577 + | .method("POST")
|
3578 + | .header("Content-Type", "application/x-amz-json-1.1")
|
3579 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
3580 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3581 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3582 + | "{\"String\":\"abc xyz\"}".as_bytes(),
|
3583 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3584 + | )),
|
3585 + | ))
|
3586 + | .unwrap();
|
3587 + | #[allow(unused_mut)]
|
3588 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3589 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
3590 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3591 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
3592 + | let sender = sender.clone();
|
3593 + | async move {
|
3594 + | let result = {
|
3595 + | use ::aws_smithy_protocol_test::FloatEquals;
|
3596 + | let expected = crate::input::KitchenSinkOperationInput {
|
3597 + | string: ::std::option::Option::Some("abc xyz".to_owned()),
|
3598 + | blob: ::std::option::Option::None,
|
3599 + | boolean: ::std::option::Option::None,
|
3600 + | double: ::std::option::Option::None,
|
3601 + | empty_struct: ::std::option::Option::None,
|
3602 + | float: ::std::option::Option::None,
|
3603 + | httpdate_timestamp: ::std::option::Option::None,
|
3604 + | integer: ::std::option::Option::None,
|
3605 + | iso8601_timestamp: ::std::option::Option::None,
|
3606 + | json_value: ::std::option::Option::None,
|
3607 + | list_of_lists: ::std::option::Option::None,
|
3608 + | list_of_maps_of_strings: ::std::option::Option::None,
|
3609 + | list_of_strings: ::std::option::Option::None,
|
3610 + | list_of_structs: ::std::option::Option::None,
|
3611 + | long: ::std::option::Option::None,
|
3612 + | map_of_lists_of_strings: ::std::option::Option::None,
|
3613 + | map_of_maps: ::std::option::Option::None,
|
3614 + | map_of_strings: ::std::option::Option::None,
|
3615 + | map_of_structs: ::std::option::Option::None,
|
3616 + | recursive_list: ::std::option::Option::None,
|
3617 + | recursive_map: ::std::option::Option::None,
|
3618 + | recursive_struct: ::std::option::Option::None,
|
3619 + | simple_struct: ::std::option::Option::None,
|
3620 + | struct_with_json_name: ::std::option::Option::None,
|
3621 + | timestamp: ::std::option::Option::None,
|
3622 + | unix_timestamp: ::std::option::Option::None,
|
3623 + | };
|
3624 + | ::pretty_assertions::assert_eq!(
|
3625 + | input.blob,
|
3626 + | expected.blob,
|
3627 + | "Unexpected value for `blob`"
|
3628 + | );
|
3629 + | ::pretty_assertions::assert_eq!(
|
3630 + | input.boolean,
|
3631 + | expected.boolean,
|
3632 + | "Unexpected value for `boolean`"
|
3633 + | );
|
3634 + | assert!(
|
3635 + | input.double.float_equals(&expected.double),
|
3636 + | "Unexpected value for `double` {:?} vs. {:?}",
|
3637 + | expected.double,
|
3638 + | input.double
|
3639 + | );
|
3640 + | ::pretty_assertions::assert_eq!(
|
3641 + | input.empty_struct,
|
3642 + | expected.empty_struct,
|
3643 + | "Unexpected value for `empty_struct`"
|
3644 + | );
|
3645 + | assert!(
|
3646 + | input.float.float_equals(&expected.float),
|
3647 + | "Unexpected value for `float` {:?} vs. {:?}",
|
3648 + | expected.float,
|
3649 + | input.float
|
3650 + | );
|
3651 + | ::pretty_assertions::assert_eq!(
|
3652 + | input.httpdate_timestamp,
|
3653 + | expected.httpdate_timestamp,
|
3654 + | "Unexpected value for `httpdate_timestamp`"
|
3655 + | );
|
3656 + | ::pretty_assertions::assert_eq!(
|
3657 + | input.integer,
|
3658 + | expected.integer,
|
3659 + | "Unexpected value for `integer`"
|
3660 + | );
|
3661 + | ::pretty_assertions::assert_eq!(
|
3662 + | input.iso8601_timestamp,
|
3663 + | expected.iso8601_timestamp,
|
3664 + | "Unexpected value for `iso8601_timestamp`"
|
3665 + | );
|
3666 + | ::pretty_assertions::assert_eq!(
|
3667 + | input.json_value,
|
3668 + | expected.json_value,
|
3669 + | "Unexpected value for `json_value`"
|
3670 + | );
|
3671 + | ::pretty_assertions::assert_eq!(
|
3672 + | input.list_of_lists,
|
3673 + | expected.list_of_lists,
|
3674 + | "Unexpected value for `list_of_lists`"
|
3675 + | );
|
3676 + | ::pretty_assertions::assert_eq!(
|
3677 + | input.list_of_maps_of_strings,
|
3678 + | expected.list_of_maps_of_strings,
|
3679 + | "Unexpected value for `list_of_maps_of_strings`"
|
3680 + | );
|
3681 + | ::pretty_assertions::assert_eq!(
|
3682 + | input.list_of_strings,
|
3683 + | expected.list_of_strings,
|
3684 + | "Unexpected value for `list_of_strings`"
|
3685 + | );
|
3686 + | ::pretty_assertions::assert_eq!(
|
3687 + | input.list_of_structs,
|
3688 + | expected.list_of_structs,
|
3689 + | "Unexpected value for `list_of_structs`"
|
3690 + | );
|
3691 + | ::pretty_assertions::assert_eq!(
|
3692 + | input.long,
|
3693 + | expected.long,
|
3694 + | "Unexpected value for `long`"
|
3695 + | );
|
3696 + | ::pretty_assertions::assert_eq!(
|
3697 + | input.map_of_lists_of_strings,
|
3698 + | expected.map_of_lists_of_strings,
|
3699 + | "Unexpected value for `map_of_lists_of_strings`"
|
3700 + | );
|
3701 + | ::pretty_assertions::assert_eq!(
|
3702 + | input.map_of_maps,
|
3703 + | expected.map_of_maps,
|
3704 + | "Unexpected value for `map_of_maps`"
|
3705 + | );
|
3706 + | ::pretty_assertions::assert_eq!(
|
3707 + | input.map_of_strings,
|
3708 + | expected.map_of_strings,
|
3709 + | "Unexpected value for `map_of_strings`"
|
3710 + | );
|
3711 + | ::pretty_assertions::assert_eq!(
|
3712 + | input.map_of_structs,
|
3713 + | expected.map_of_structs,
|
3714 + | "Unexpected value for `map_of_structs`"
|
3715 + | );
|
3716 + | ::pretty_assertions::assert_eq!(
|
3717 + | input.recursive_list,
|
3718 + | expected.recursive_list,
|
3719 + | "Unexpected value for `recursive_list`"
|
3720 + | );
|
3721 + | ::pretty_assertions::assert_eq!(
|
3722 + | input.recursive_map,
|
3723 + | expected.recursive_map,
|
3724 + | "Unexpected value for `recursive_map`"
|
3725 + | );
|
3726 + | ::pretty_assertions::assert_eq!(
|
3727 + | input.recursive_struct,
|
3728 + | expected.recursive_struct,
|
3729 + | "Unexpected value for `recursive_struct`"
|
3730 + | );
|
3731 + | ::pretty_assertions::assert_eq!(
|
3732 + | input.simple_struct,
|
3733 + | expected.simple_struct,
|
3734 + | "Unexpected value for `simple_struct`"
|
3735 + | );
|
3736 + | ::pretty_assertions::assert_eq!(
|
3737 + | input.string,
|
3738 + | expected.string,
|
3739 + | "Unexpected value for `string`"
|
3740 + | );
|
3741 + | ::pretty_assertions::assert_eq!(
|
3742 + | input.struct_with_json_name,
|
3743 + | expected.struct_with_json_name,
|
3744 + | "Unexpected value for `struct_with_json_name`"
|
3745 + | );
|
3746 + | ::pretty_assertions::assert_eq!(
|
3747 + | input.timestamp,
|
3748 + | expected.timestamp,
|
3749 + | "Unexpected value for `timestamp`"
|
3750 + | );
|
3751 + | ::pretty_assertions::assert_eq!(
|
3752 + | input.unix_timestamp,
|
3753 + | expected.unix_timestamp,
|
3754 + | "Unexpected value for `unix_timestamp`"
|
3755 + | );
|
3756 + | let output = crate::output::KitchenSinkOperationOutput {
|
3757 + | blob: ::std::option::Option::None,
|
3758 + | boolean: ::std::option::Option::None,
|
3759 + | double: ::std::option::Option::None,
|
3760 + | empty_struct: ::std::option::Option::None,
|
3761 + | float: ::std::option::Option::None,
|
3762 + | httpdate_timestamp: ::std::option::Option::None,
|
3763 + | integer: ::std::option::Option::None,
|
3764 + | iso8601_timestamp: ::std::option::Option::None,
|
3765 + | json_value: ::std::option::Option::None,
|
3766 + | list_of_lists: ::std::option::Option::None,
|
3767 + | list_of_maps_of_strings: ::std::option::Option::None,
|
3768 + | list_of_strings: ::std::option::Option::None,
|
3769 + | list_of_structs: ::std::option::Option::None,
|
3770 + | long: ::std::option::Option::None,
|
3771 + | map_of_lists_of_strings: ::std::option::Option::None,
|
3772 + | map_of_maps: ::std::option::Option::None,
|
3773 + | map_of_strings: ::std::option::Option::None,
|
3774 + | map_of_structs: ::std::option::Option::None,
|
3775 + | recursive_list: ::std::option::Option::None,
|
3776 + | recursive_map: ::std::option::Option::None,
|
3777 + | recursive_struct: ::std::option::Option::None,
|
3778 + | simple_struct: ::std::option::Option::None,
|
3779 + | string: ::std::option::Option::None,
|
3780 + | struct_with_json_name: ::std::option::Option::None,
|
3781 + | timestamp: ::std::option::Option::None,
|
3782 + | unix_timestamp: ::std::option::Option::None,
|
3783 + | };
|
3784 + | Ok(output)
|
3785 + | };
|
3786 + | sender.send(()).await.expect("receiver dropped early");
|
3787 + | result
|
3788 + | }
|
3789 + | })
|
3790 + | .build_unchecked();
|
3791 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3792 + | .await
|
3793 + | .expect("unable to make an HTTP request");
|
3794 + | assert!(
|
3795 + | receiver.recv().await.is_some(),
|
3796 + | "we expected operation handler to be invoked but it was not entered"
|
3797 + | );
|
3798 + | }
|
3799 + |
|
3800 + | /// Serializes string shapes with jsonvalue trait
|
3801 + | /// Test ID: serializes_string_shapes_with_jsonvalue_trait
|
3802 + | #[::tokio::test]
|
3803 + | #[::tracing_test::traced_test]
|
3804 + | async fn serializes_string_shapes_with_jsonvalue_trait_request() {
|
3805 + | #[allow(unused_mut)]
|
3806 + | let mut http_request = ::http::Request::builder()
|
3807 + | .uri("/")
|
3808 + | .method("POST")
|
3809 + | .header("Content-Type", "application/x-amz-json-1.1")
|
3810 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
3811 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3812 + | ::bytes::Bytes::copy_from_slice(
|
3813 + | &::aws_smithy_protocol_test::decode_body_data("{\"JsonValue\":\"{\\\"string\\\":\\\"value\\\",\\\"number\\\":1234.5,\\\"boolTrue\\\":true,\\\"boolFalse\\\":false,\\\"array\\\":[1,2,3,4],\\\"object\\\":{\\\"key\\\":\\\"value\\\"},\\\"null\\\":null}\"}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3814 + | )
|
3815 + | )).unwrap();
|
3816 + | #[allow(unused_mut)]
|
3817 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3818 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
3819 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3820 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
3821 + | let sender = sender.clone();
|
3822 + | async move {
|
3823 + | let result = { use ::aws_smithy_protocol_test::FloatEquals;
|
3824 + | let expected =
|
3825 + | crate::input::KitchenSinkOperationInput {
|
3826 + | json_value:
|
3827 + | ::std::option::Option::Some(
|
3828 + | "{\"string\":\"value\",\"number\":1234.5,\"boolTrue\":true,\"boolFalse\":false,\"array\":[1,2,3,4],\"object\":{\"key\":\"value\"},\"null\":null}".to_owned()
|
3829 + | )
|
3830 + | ,
|
3831 + | blob:
|
3832 + | ::std::option::Option::None
|
3833 + | ,
|
3834 + | boolean:
|
3835 + | ::std::option::Option::None
|
3836 + | ,
|
3837 + | double:
|
3838 + | ::std::option::Option::None
|
3839 + | ,
|
3840 + | empty_struct:
|
3841 + | ::std::option::Option::None
|
3842 + | ,
|
3843 + | float:
|
3844 + | ::std::option::Option::None
|
3845 + | ,
|
3846 + | httpdate_timestamp:
|
3847 + | ::std::option::Option::None
|
3848 + | ,
|
3849 + | integer:
|
3850 + | ::std::option::Option::None
|
3851 + | ,
|
3852 + | iso8601_timestamp:
|
3853 + | ::std::option::Option::None
|
3854 + | ,
|
3855 + | list_of_lists:
|
3856 + | ::std::option::Option::None
|
3857 + | ,
|
3858 + | list_of_maps_of_strings:
|
3859 + | ::std::option::Option::None
|
3860 + | ,
|
3861 + | list_of_strings:
|
3862 + | ::std::option::Option::None
|
3863 + | ,
|
3864 + | list_of_structs:
|
3865 + | ::std::option::Option::None
|
3866 + | ,
|
3867 + | long:
|
3868 + | ::std::option::Option::None
|
3869 + | ,
|
3870 + | map_of_lists_of_strings:
|
3871 + | ::std::option::Option::None
|
3872 + | ,
|
3873 + | map_of_maps:
|
3874 + | ::std::option::Option::None
|
3875 + | ,
|
3876 + | map_of_strings:
|
3877 + | ::std::option::Option::None
|
3878 + | ,
|
3879 + | map_of_structs:
|
3880 + | ::std::option::Option::None
|
3881 + | ,
|
3882 + | recursive_list:
|
3883 + | ::std::option::Option::None
|
3884 + | ,
|
3885 + | recursive_map:
|
3886 + | ::std::option::Option::None
|
3887 + | ,
|
3888 + | recursive_struct:
|
3889 + | ::std::option::Option::None
|
3890 + | ,
|
3891 + | simple_struct:
|
3892 + | ::std::option::Option::None
|
3893 + | ,
|
3894 + | string:
|
3895 + | ::std::option::Option::None
|
3896 + | ,
|
3897 + | struct_with_json_name:
|
3898 + | ::std::option::Option::None
|
3899 + | ,
|
3900 + | timestamp:
|
3901 + | ::std::option::Option::None
|
3902 + | ,
|
3903 + | unix_timestamp:
|
3904 + | ::std::option::Option::None
|
3905 + | ,
|
3906 + | }
|
3907 + | ;
|
3908 + | ::pretty_assertions::assert_eq!(input.blob, expected.blob, "Unexpected value for `blob`");
|
3909 + | ::pretty_assertions::assert_eq!(input.boolean, expected.boolean, "Unexpected value for `boolean`");
|
3910 + | assert!(input.double.float_equals(&expected.double),
|
3911 + | "Unexpected value for `double` {:?} vs. {:?}", expected.double, input.double);
|
3912 + | ::pretty_assertions::assert_eq!(input.empty_struct, expected.empty_struct, "Unexpected value for `empty_struct`");
|
3913 + | assert!(input.float.float_equals(&expected.float),
|
3914 + | "Unexpected value for `float` {:?} vs. {:?}", expected.float, input.float);
|
3915 + | ::pretty_assertions::assert_eq!(input.httpdate_timestamp, expected.httpdate_timestamp, "Unexpected value for `httpdate_timestamp`");
|
3916 + | ::pretty_assertions::assert_eq!(input.integer, expected.integer, "Unexpected value for `integer`");
|
3917 + | ::pretty_assertions::assert_eq!(input.iso8601_timestamp, expected.iso8601_timestamp, "Unexpected value for `iso8601_timestamp`");
|
3918 + | ::pretty_assertions::assert_eq!(input.json_value, expected.json_value, "Unexpected value for `json_value`");
|
3919 + | ::pretty_assertions::assert_eq!(input.list_of_lists, expected.list_of_lists, "Unexpected value for `list_of_lists`");
|
3920 + | ::pretty_assertions::assert_eq!(input.list_of_maps_of_strings, expected.list_of_maps_of_strings, "Unexpected value for `list_of_maps_of_strings`");
|
3921 + | ::pretty_assertions::assert_eq!(input.list_of_strings, expected.list_of_strings, "Unexpected value for `list_of_strings`");
|
3922 + | ::pretty_assertions::assert_eq!(input.list_of_structs, expected.list_of_structs, "Unexpected value for `list_of_structs`");
|
3923 + | ::pretty_assertions::assert_eq!(input.long, expected.long, "Unexpected value for `long`");
|
3924 + | ::pretty_assertions::assert_eq!(input.map_of_lists_of_strings, expected.map_of_lists_of_strings, "Unexpected value for `map_of_lists_of_strings`");
|
3925 + | ::pretty_assertions::assert_eq!(input.map_of_maps, expected.map_of_maps, "Unexpected value for `map_of_maps`");
|
3926 + | ::pretty_assertions::assert_eq!(input.map_of_strings, expected.map_of_strings, "Unexpected value for `map_of_strings`");
|
3927 + | ::pretty_assertions::assert_eq!(input.map_of_structs, expected.map_of_structs, "Unexpected value for `map_of_structs`");
|
3928 + | ::pretty_assertions::assert_eq!(input.recursive_list, expected.recursive_list, "Unexpected value for `recursive_list`");
|
3929 + | ::pretty_assertions::assert_eq!(input.recursive_map, expected.recursive_map, "Unexpected value for `recursive_map`");
|
3930 + | ::pretty_assertions::assert_eq!(input.recursive_struct, expected.recursive_struct, "Unexpected value for `recursive_struct`");
|
3931 + | ::pretty_assertions::assert_eq!(input.simple_struct, expected.simple_struct, "Unexpected value for `simple_struct`");
|
3932 + | ::pretty_assertions::assert_eq!(input.string, expected.string, "Unexpected value for `string`");
|
3933 + | ::pretty_assertions::assert_eq!(input.struct_with_json_name, expected.struct_with_json_name, "Unexpected value for `struct_with_json_name`");
|
3934 + | ::pretty_assertions::assert_eq!(input.timestamp, expected.timestamp, "Unexpected value for `timestamp`");
|
3935 + | ::pretty_assertions::assert_eq!(input.unix_timestamp, expected.unix_timestamp, "Unexpected value for `unix_timestamp`");
|
3936 + | let output =
|
3937 + | crate::output::KitchenSinkOperationOutput {
|
3938 + | blob:
|
3939 + | ::std::option::Option::None
|
3940 + | ,
|
3941 + | boolean:
|
3942 + | ::std::option::Option::None
|
3943 + | ,
|
3944 + | double:
|
3945 + | ::std::option::Option::None
|
3946 + | ,
|
3947 + | empty_struct:
|
3948 + | ::std::option::Option::None
|
3949 + | ,
|
3950 + | float:
|
3951 + | ::std::option::Option::None
|
3952 + | ,
|
3953 + | httpdate_timestamp:
|
3954 + | ::std::option::Option::None
|
3955 + | ,
|
3956 + | integer:
|
3957 + | ::std::option::Option::None
|
3958 + | ,
|
3959 + | iso8601_timestamp:
|
3960 + | ::std::option::Option::None
|
3961 + | ,
|
3962 + | json_value:
|
3963 + | ::std::option::Option::None
|
3964 + | ,
|
3965 + | list_of_lists:
|
3966 + | ::std::option::Option::None
|
3967 + | ,
|
3968 + | list_of_maps_of_strings:
|
3969 + | ::std::option::Option::None
|
3970 + | ,
|
3971 + | list_of_strings:
|
3972 + | ::std::option::Option::None
|
3973 + | ,
|
3974 + | list_of_structs:
|
3975 + | ::std::option::Option::None
|
3976 + | ,
|
3977 + | long:
|
3978 + | ::std::option::Option::None
|
3979 + | ,
|
3980 + | map_of_lists_of_strings:
|
3981 + | ::std::option::Option::None
|
3982 + | ,
|
3983 + | map_of_maps:
|
3984 + | ::std::option::Option::None
|
3985 + | ,
|
3986 + | map_of_strings:
|
3987 + | ::std::option::Option::None
|
3988 + | ,
|
3989 + | map_of_structs:
|
3990 + | ::std::option::Option::None
|
3991 + | ,
|
3992 + | recursive_list:
|
3993 + | ::std::option::Option::None
|
3994 + | ,
|
3995 + | recursive_map:
|
3996 + | ::std::option::Option::None
|
3997 + | ,
|
3998 + | recursive_struct:
|
3999 + | ::std::option::Option::None
|
4000 + | ,
|
4001 + | simple_struct:
|
4002 + | ::std::option::Option::None
|
4003 + | ,
|
4004 + | string:
|
4005 + | ::std::option::Option::None
|
4006 + | ,
|
4007 + | struct_with_json_name:
|
4008 + | ::std::option::Option::None
|
4009 + | ,
|
4010 + | timestamp:
|
4011 + | ::std::option::Option::None
|
4012 + | ,
|
4013 + | unix_timestamp:
|
4014 + | ::std::option::Option::None
|
4015 + | ,
|
4016 + | }
|
4017 + | ;
|
4018 + | Ok(output) };
|
4019 + | sender.send(()).await.expect("receiver dropped early");
|
4020 + | result
|
4021 + | }
|
4022 + | })
|
4023 + | .build_unchecked();
|
4024 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4025 + | .await
|
4026 + | .expect("unable to make an HTTP request");
|
4027 + | assert!(
|
4028 + | receiver.recv().await.is_some(),
|
4029 + | "we expected operation handler to be invoked but it was not entered"
|
4030 + | );
|
4031 + | }
|
4032 + |
|
4033 + | /// Serializes integer shapes
|
4034 + | /// Test ID: serializes_integer_shapes
|
4035 + | #[::tokio::test]
|
4036 + | #[::tracing_test::traced_test]
|
4037 + | async fn serializes_integer_shapes_request() {
|
4038 + | #[allow(unused_mut)]
|
4039 + | let mut http_request = ::http::Request::builder()
|
4040 + | .uri("/")
|
4041 + | .method("POST")
|
4042 + | .header("Content-Type", "application/x-amz-json-1.1")
|
4043 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
4044 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
4045 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4046 + | "{\"Integer\":1234}".as_bytes(),
|
4047 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
4048 + | )),
|
4049 + | ))
|
4050 + | .unwrap();
|
4051 + | #[allow(unused_mut)]
|
4052 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4053 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
4054 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
4055 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
4056 + | let sender = sender.clone();
|
4057 + | async move {
|
4058 + | let result = {
|
4059 + | use ::aws_smithy_protocol_test::FloatEquals;
|
4060 + | let expected = crate::input::KitchenSinkOperationInput {
|
4061 + | integer: ::std::option::Option::Some(1234),
|
4062 + | blob: ::std::option::Option::None,
|
4063 + | boolean: ::std::option::Option::None,
|
4064 + | double: ::std::option::Option::None,
|
4065 + | empty_struct: ::std::option::Option::None,
|
4066 + | float: ::std::option::Option::None,
|
4067 + | httpdate_timestamp: ::std::option::Option::None,
|
4068 + | iso8601_timestamp: ::std::option::Option::None,
|
4069 + | json_value: ::std::option::Option::None,
|
4070 + | list_of_lists: ::std::option::Option::None,
|
4071 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4072 + | list_of_strings: ::std::option::Option::None,
|
4073 + | list_of_structs: ::std::option::Option::None,
|
4074 + | long: ::std::option::Option::None,
|
4075 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4076 + | map_of_maps: ::std::option::Option::None,
|
4077 + | map_of_strings: ::std::option::Option::None,
|
4078 + | map_of_structs: ::std::option::Option::None,
|
4079 + | recursive_list: ::std::option::Option::None,
|
4080 + | recursive_map: ::std::option::Option::None,
|
4081 + | recursive_struct: ::std::option::Option::None,
|
4082 + | simple_struct: ::std::option::Option::None,
|
4083 + | string: ::std::option::Option::None,
|
4084 + | struct_with_json_name: ::std::option::Option::None,
|
4085 + | timestamp: ::std::option::Option::None,
|
4086 + | unix_timestamp: ::std::option::Option::None,
|
4087 + | };
|
4088 + | ::pretty_assertions::assert_eq!(
|
4089 + | input.blob,
|
4090 + | expected.blob,
|
4091 + | "Unexpected value for `blob`"
|
4092 + | );
|
4093 + | ::pretty_assertions::assert_eq!(
|
4094 + | input.boolean,
|
4095 + | expected.boolean,
|
4096 + | "Unexpected value for `boolean`"
|
4097 + | );
|
4098 + | assert!(
|
4099 + | input.double.float_equals(&expected.double),
|
4100 + | "Unexpected value for `double` {:?} vs. {:?}",
|
4101 + | expected.double,
|
4102 + | input.double
|
4103 + | );
|
4104 + | ::pretty_assertions::assert_eq!(
|
4105 + | input.empty_struct,
|
4106 + | expected.empty_struct,
|
4107 + | "Unexpected value for `empty_struct`"
|
4108 + | );
|
4109 + | assert!(
|
4110 + | input.float.float_equals(&expected.float),
|
4111 + | "Unexpected value for `float` {:?} vs. {:?}",
|
4112 + | expected.float,
|
4113 + | input.float
|
4114 + | );
|
4115 + | ::pretty_assertions::assert_eq!(
|
4116 + | input.httpdate_timestamp,
|
4117 + | expected.httpdate_timestamp,
|
4118 + | "Unexpected value for `httpdate_timestamp`"
|
4119 + | );
|
4120 + | ::pretty_assertions::assert_eq!(
|
4121 + | input.integer,
|
4122 + | expected.integer,
|
4123 + | "Unexpected value for `integer`"
|
4124 + | );
|
4125 + | ::pretty_assertions::assert_eq!(
|
4126 + | input.iso8601_timestamp,
|
4127 + | expected.iso8601_timestamp,
|
4128 + | "Unexpected value for `iso8601_timestamp`"
|
4129 + | );
|
4130 + | ::pretty_assertions::assert_eq!(
|
4131 + | input.json_value,
|
4132 + | expected.json_value,
|
4133 + | "Unexpected value for `json_value`"
|
4134 + | );
|
4135 + | ::pretty_assertions::assert_eq!(
|
4136 + | input.list_of_lists,
|
4137 + | expected.list_of_lists,
|
4138 + | "Unexpected value for `list_of_lists`"
|
4139 + | );
|
4140 + | ::pretty_assertions::assert_eq!(
|
4141 + | input.list_of_maps_of_strings,
|
4142 + | expected.list_of_maps_of_strings,
|
4143 + | "Unexpected value for `list_of_maps_of_strings`"
|
4144 + | );
|
4145 + | ::pretty_assertions::assert_eq!(
|
4146 + | input.list_of_strings,
|
4147 + | expected.list_of_strings,
|
4148 + | "Unexpected value for `list_of_strings`"
|
4149 + | );
|
4150 + | ::pretty_assertions::assert_eq!(
|
4151 + | input.list_of_structs,
|
4152 + | expected.list_of_structs,
|
4153 + | "Unexpected value for `list_of_structs`"
|
4154 + | );
|
4155 + | ::pretty_assertions::assert_eq!(
|
4156 + | input.long,
|
4157 + | expected.long,
|
4158 + | "Unexpected value for `long`"
|
4159 + | );
|
4160 + | ::pretty_assertions::assert_eq!(
|
4161 + | input.map_of_lists_of_strings,
|
4162 + | expected.map_of_lists_of_strings,
|
4163 + | "Unexpected value for `map_of_lists_of_strings`"
|
4164 + | );
|
4165 + | ::pretty_assertions::assert_eq!(
|
4166 + | input.map_of_maps,
|
4167 + | expected.map_of_maps,
|
4168 + | "Unexpected value for `map_of_maps`"
|
4169 + | );
|
4170 + | ::pretty_assertions::assert_eq!(
|
4171 + | input.map_of_strings,
|
4172 + | expected.map_of_strings,
|
4173 + | "Unexpected value for `map_of_strings`"
|
4174 + | );
|
4175 + | ::pretty_assertions::assert_eq!(
|
4176 + | input.map_of_structs,
|
4177 + | expected.map_of_structs,
|
4178 + | "Unexpected value for `map_of_structs`"
|
4179 + | );
|
4180 + | ::pretty_assertions::assert_eq!(
|
4181 + | input.recursive_list,
|
4182 + | expected.recursive_list,
|
4183 + | "Unexpected value for `recursive_list`"
|
4184 + | );
|
4185 + | ::pretty_assertions::assert_eq!(
|
4186 + | input.recursive_map,
|
4187 + | expected.recursive_map,
|
4188 + | "Unexpected value for `recursive_map`"
|
4189 + | );
|
4190 + | ::pretty_assertions::assert_eq!(
|
4191 + | input.recursive_struct,
|
4192 + | expected.recursive_struct,
|
4193 + | "Unexpected value for `recursive_struct`"
|
4194 + | );
|
4195 + | ::pretty_assertions::assert_eq!(
|
4196 + | input.simple_struct,
|
4197 + | expected.simple_struct,
|
4198 + | "Unexpected value for `simple_struct`"
|
4199 + | );
|
4200 + | ::pretty_assertions::assert_eq!(
|
4201 + | input.string,
|
4202 + | expected.string,
|
4203 + | "Unexpected value for `string`"
|
4204 + | );
|
4205 + | ::pretty_assertions::assert_eq!(
|
4206 + | input.struct_with_json_name,
|
4207 + | expected.struct_with_json_name,
|
4208 + | "Unexpected value for `struct_with_json_name`"
|
4209 + | );
|
4210 + | ::pretty_assertions::assert_eq!(
|
4211 + | input.timestamp,
|
4212 + | expected.timestamp,
|
4213 + | "Unexpected value for `timestamp`"
|
4214 + | );
|
4215 + | ::pretty_assertions::assert_eq!(
|
4216 + | input.unix_timestamp,
|
4217 + | expected.unix_timestamp,
|
4218 + | "Unexpected value for `unix_timestamp`"
|
4219 + | );
|
4220 + | let output = crate::output::KitchenSinkOperationOutput {
|
4221 + | blob: ::std::option::Option::None,
|
4222 + | boolean: ::std::option::Option::None,
|
4223 + | double: ::std::option::Option::None,
|
4224 + | empty_struct: ::std::option::Option::None,
|
4225 + | float: ::std::option::Option::None,
|
4226 + | httpdate_timestamp: ::std::option::Option::None,
|
4227 + | integer: ::std::option::Option::None,
|
4228 + | iso8601_timestamp: ::std::option::Option::None,
|
4229 + | json_value: ::std::option::Option::None,
|
4230 + | list_of_lists: ::std::option::Option::None,
|
4231 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4232 + | list_of_strings: ::std::option::Option::None,
|
4233 + | list_of_structs: ::std::option::Option::None,
|
4234 + | long: ::std::option::Option::None,
|
4235 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4236 + | map_of_maps: ::std::option::Option::None,
|
4237 + | map_of_strings: ::std::option::Option::None,
|
4238 + | map_of_structs: ::std::option::Option::None,
|
4239 + | recursive_list: ::std::option::Option::None,
|
4240 + | recursive_map: ::std::option::Option::None,
|
4241 + | recursive_struct: ::std::option::Option::None,
|
4242 + | simple_struct: ::std::option::Option::None,
|
4243 + | string: ::std::option::Option::None,
|
4244 + | struct_with_json_name: ::std::option::Option::None,
|
4245 + | timestamp: ::std::option::Option::None,
|
4246 + | unix_timestamp: ::std::option::Option::None,
|
4247 + | };
|
4248 + | Ok(output)
|
4249 + | };
|
4250 + | sender.send(()).await.expect("receiver dropped early");
|
4251 + | result
|
4252 + | }
|
4253 + | })
|
4254 + | .build_unchecked();
|
4255 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4256 + | .await
|
4257 + | .expect("unable to make an HTTP request");
|
4258 + | assert!(
|
4259 + | receiver.recv().await.is_some(),
|
4260 + | "we expected operation handler to be invoked but it was not entered"
|
4261 + | );
|
4262 + | }
|
4263 + |
|
4264 + | /// Serializes long shapes
|
4265 + | /// Test ID: serializes_long_shapes
|
4266 + | #[::tokio::test]
|
4267 + | #[::tracing_test::traced_test]
|
4268 + | async fn serializes_long_shapes_request() {
|
4269 + | #[allow(unused_mut)]
|
4270 + | let mut http_request = ::http::Request::builder()
|
4271 + | .uri("/")
|
4272 + | .method("POST")
|
4273 + | .header("Content-Type", "application/x-amz-json-1.1")
|
4274 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
4275 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
4276 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4277 + | "{\"Long\":999999999999}".as_bytes(),
|
4278 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
4279 + | )),
|
4280 + | ))
|
4281 + | .unwrap();
|
4282 + | #[allow(unused_mut)]
|
4283 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4284 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
4285 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
4286 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
4287 + | let sender = sender.clone();
|
4288 + | async move {
|
4289 + | let result = {
|
4290 + | use ::aws_smithy_protocol_test::FloatEquals;
|
4291 + | let expected = crate::input::KitchenSinkOperationInput {
|
4292 + | long: ::std::option::Option::Some(999999999999),
|
4293 + | blob: ::std::option::Option::None,
|
4294 + | boolean: ::std::option::Option::None,
|
4295 + | double: ::std::option::Option::None,
|
4296 + | empty_struct: ::std::option::Option::None,
|
4297 + | float: ::std::option::Option::None,
|
4298 + | httpdate_timestamp: ::std::option::Option::None,
|
4299 + | integer: ::std::option::Option::None,
|
4300 + | iso8601_timestamp: ::std::option::Option::None,
|
4301 + | json_value: ::std::option::Option::None,
|
4302 + | list_of_lists: ::std::option::Option::None,
|
4303 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4304 + | list_of_strings: ::std::option::Option::None,
|
4305 + | list_of_structs: ::std::option::Option::None,
|
4306 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4307 + | map_of_maps: ::std::option::Option::None,
|
4308 + | map_of_strings: ::std::option::Option::None,
|
4309 + | map_of_structs: ::std::option::Option::None,
|
4310 + | recursive_list: ::std::option::Option::None,
|
4311 + | recursive_map: ::std::option::Option::None,
|
4312 + | recursive_struct: ::std::option::Option::None,
|
4313 + | simple_struct: ::std::option::Option::None,
|
4314 + | string: ::std::option::Option::None,
|
4315 + | struct_with_json_name: ::std::option::Option::None,
|
4316 + | timestamp: ::std::option::Option::None,
|
4317 + | unix_timestamp: ::std::option::Option::None,
|
4318 + | };
|
4319 + | ::pretty_assertions::assert_eq!(
|
4320 + | input.blob,
|
4321 + | expected.blob,
|
4322 + | "Unexpected value for `blob`"
|
4323 + | );
|
4324 + | ::pretty_assertions::assert_eq!(
|
4325 + | input.boolean,
|
4326 + | expected.boolean,
|
4327 + | "Unexpected value for `boolean`"
|
4328 + | );
|
4329 + | assert!(
|
4330 + | input.double.float_equals(&expected.double),
|
4331 + | "Unexpected value for `double` {:?} vs. {:?}",
|
4332 + | expected.double,
|
4333 + | input.double
|
4334 + | );
|
4335 + | ::pretty_assertions::assert_eq!(
|
4336 + | input.empty_struct,
|
4337 + | expected.empty_struct,
|
4338 + | "Unexpected value for `empty_struct`"
|
4339 + | );
|
4340 + | assert!(
|
4341 + | input.float.float_equals(&expected.float),
|
4342 + | "Unexpected value for `float` {:?} vs. {:?}",
|
4343 + | expected.float,
|
4344 + | input.float
|
4345 + | );
|
4346 + | ::pretty_assertions::assert_eq!(
|
4347 + | input.httpdate_timestamp,
|
4348 + | expected.httpdate_timestamp,
|
4349 + | "Unexpected value for `httpdate_timestamp`"
|
4350 + | );
|
4351 + | ::pretty_assertions::assert_eq!(
|
4352 + | input.integer,
|
4353 + | expected.integer,
|
4354 + | "Unexpected value for `integer`"
|
4355 + | );
|
4356 + | ::pretty_assertions::assert_eq!(
|
4357 + | input.iso8601_timestamp,
|
4358 + | expected.iso8601_timestamp,
|
4359 + | "Unexpected value for `iso8601_timestamp`"
|
4360 + | );
|
4361 + | ::pretty_assertions::assert_eq!(
|
4362 + | input.json_value,
|
4363 + | expected.json_value,
|
4364 + | "Unexpected value for `json_value`"
|
4365 + | );
|
4366 + | ::pretty_assertions::assert_eq!(
|
4367 + | input.list_of_lists,
|
4368 + | expected.list_of_lists,
|
4369 + | "Unexpected value for `list_of_lists`"
|
4370 + | );
|
4371 + | ::pretty_assertions::assert_eq!(
|
4372 + | input.list_of_maps_of_strings,
|
4373 + | expected.list_of_maps_of_strings,
|
4374 + | "Unexpected value for `list_of_maps_of_strings`"
|
4375 + | );
|
4376 + | ::pretty_assertions::assert_eq!(
|
4377 + | input.list_of_strings,
|
4378 + | expected.list_of_strings,
|
4379 + | "Unexpected value for `list_of_strings`"
|
4380 + | );
|
4381 + | ::pretty_assertions::assert_eq!(
|
4382 + | input.list_of_structs,
|
4383 + | expected.list_of_structs,
|
4384 + | "Unexpected value for `list_of_structs`"
|
4385 + | );
|
4386 + | ::pretty_assertions::assert_eq!(
|
4387 + | input.long,
|
4388 + | expected.long,
|
4389 + | "Unexpected value for `long`"
|
4390 + | );
|
4391 + | ::pretty_assertions::assert_eq!(
|
4392 + | input.map_of_lists_of_strings,
|
4393 + | expected.map_of_lists_of_strings,
|
4394 + | "Unexpected value for `map_of_lists_of_strings`"
|
4395 + | );
|
4396 + | ::pretty_assertions::assert_eq!(
|
4397 + | input.map_of_maps,
|
4398 + | expected.map_of_maps,
|
4399 + | "Unexpected value for `map_of_maps`"
|
4400 + | );
|
4401 + | ::pretty_assertions::assert_eq!(
|
4402 + | input.map_of_strings,
|
4403 + | expected.map_of_strings,
|
4404 + | "Unexpected value for `map_of_strings`"
|
4405 + | );
|
4406 + | ::pretty_assertions::assert_eq!(
|
4407 + | input.map_of_structs,
|
4408 + | expected.map_of_structs,
|
4409 + | "Unexpected value for `map_of_structs`"
|
4410 + | );
|
4411 + | ::pretty_assertions::assert_eq!(
|
4412 + | input.recursive_list,
|
4413 + | expected.recursive_list,
|
4414 + | "Unexpected value for `recursive_list`"
|
4415 + | );
|
4416 + | ::pretty_assertions::assert_eq!(
|
4417 + | input.recursive_map,
|
4418 + | expected.recursive_map,
|
4419 + | "Unexpected value for `recursive_map`"
|
4420 + | );
|
4421 + | ::pretty_assertions::assert_eq!(
|
4422 + | input.recursive_struct,
|
4423 + | expected.recursive_struct,
|
4424 + | "Unexpected value for `recursive_struct`"
|
4425 + | );
|
4426 + | ::pretty_assertions::assert_eq!(
|
4427 + | input.simple_struct,
|
4428 + | expected.simple_struct,
|
4429 + | "Unexpected value for `simple_struct`"
|
4430 + | );
|
4431 + | ::pretty_assertions::assert_eq!(
|
4432 + | input.string,
|
4433 + | expected.string,
|
4434 + | "Unexpected value for `string`"
|
4435 + | );
|
4436 + | ::pretty_assertions::assert_eq!(
|
4437 + | input.struct_with_json_name,
|
4438 + | expected.struct_with_json_name,
|
4439 + | "Unexpected value for `struct_with_json_name`"
|
4440 + | );
|
4441 + | ::pretty_assertions::assert_eq!(
|
4442 + | input.timestamp,
|
4443 + | expected.timestamp,
|
4444 + | "Unexpected value for `timestamp`"
|
4445 + | );
|
4446 + | ::pretty_assertions::assert_eq!(
|
4447 + | input.unix_timestamp,
|
4448 + | expected.unix_timestamp,
|
4449 + | "Unexpected value for `unix_timestamp`"
|
4450 + | );
|
4451 + | let output = crate::output::KitchenSinkOperationOutput {
|
4452 + | blob: ::std::option::Option::None,
|
4453 + | boolean: ::std::option::Option::None,
|
4454 + | double: ::std::option::Option::None,
|
4455 + | empty_struct: ::std::option::Option::None,
|
4456 + | float: ::std::option::Option::None,
|
4457 + | httpdate_timestamp: ::std::option::Option::None,
|
4458 + | integer: ::std::option::Option::None,
|
4459 + | iso8601_timestamp: ::std::option::Option::None,
|
4460 + | json_value: ::std::option::Option::None,
|
4461 + | list_of_lists: ::std::option::Option::None,
|
4462 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4463 + | list_of_strings: ::std::option::Option::None,
|
4464 + | list_of_structs: ::std::option::Option::None,
|
4465 + | long: ::std::option::Option::None,
|
4466 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4467 + | map_of_maps: ::std::option::Option::None,
|
4468 + | map_of_strings: ::std::option::Option::None,
|
4469 + | map_of_structs: ::std::option::Option::None,
|
4470 + | recursive_list: ::std::option::Option::None,
|
4471 + | recursive_map: ::std::option::Option::None,
|
4472 + | recursive_struct: ::std::option::Option::None,
|
4473 + | simple_struct: ::std::option::Option::None,
|
4474 + | string: ::std::option::Option::None,
|
4475 + | struct_with_json_name: ::std::option::Option::None,
|
4476 + | timestamp: ::std::option::Option::None,
|
4477 + | unix_timestamp: ::std::option::Option::None,
|
4478 + | };
|
4479 + | Ok(output)
|
4480 + | };
|
4481 + | sender.send(()).await.expect("receiver dropped early");
|
4482 + | result
|
4483 + | }
|
4484 + | })
|
4485 + | .build_unchecked();
|
4486 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4487 + | .await
|
4488 + | .expect("unable to make an HTTP request");
|
4489 + | assert!(
|
4490 + | receiver.recv().await.is_some(),
|
4491 + | "we expected operation handler to be invoked but it was not entered"
|
4492 + | );
|
4493 + | }
|
4494 + |
|
4495 + | /// Serializes float shapes
|
4496 + | /// Test ID: serializes_float_shapes
|
4497 + | #[::tokio::test]
|
4498 + | #[::tracing_test::traced_test]
|
4499 + | async fn serializes_float_shapes_request() {
|
4500 + | #[allow(unused_mut)]
|
4501 + | let mut http_request = ::http::Request::builder()
|
4502 + | .uri("/")
|
4503 + | .method("POST")
|
4504 + | .header("Content-Type", "application/x-amz-json-1.1")
|
4505 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
4506 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
4507 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4508 + | "{\"Float\":1234.5}".as_bytes(),
|
4509 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
4510 + | )),
|
4511 + | ))
|
4512 + | .unwrap();
|
4513 + | #[allow(unused_mut)]
|
4514 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4515 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
4516 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
4517 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
4518 + | let sender = sender.clone();
|
4519 + | async move {
|
4520 + | let result = {
|
4521 + | use ::aws_smithy_protocol_test::FloatEquals;
|
4522 + | let expected = crate::input::KitchenSinkOperationInput {
|
4523 + | float: ::std::option::Option::Some(1234.5_f32),
|
4524 + | blob: ::std::option::Option::None,
|
4525 + | boolean: ::std::option::Option::None,
|
4526 + | double: ::std::option::Option::None,
|
4527 + | empty_struct: ::std::option::Option::None,
|
4528 + | httpdate_timestamp: ::std::option::Option::None,
|
4529 + | integer: ::std::option::Option::None,
|
4530 + | iso8601_timestamp: ::std::option::Option::None,
|
4531 + | json_value: ::std::option::Option::None,
|
4532 + | list_of_lists: ::std::option::Option::None,
|
4533 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4534 + | list_of_strings: ::std::option::Option::None,
|
4535 + | list_of_structs: ::std::option::Option::None,
|
4536 + | long: ::std::option::Option::None,
|
4537 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4538 + | map_of_maps: ::std::option::Option::None,
|
4539 + | map_of_strings: ::std::option::Option::None,
|
4540 + | map_of_structs: ::std::option::Option::None,
|
4541 + | recursive_list: ::std::option::Option::None,
|
4542 + | recursive_map: ::std::option::Option::None,
|
4543 + | recursive_struct: ::std::option::Option::None,
|
4544 + | simple_struct: ::std::option::Option::None,
|
4545 + | string: ::std::option::Option::None,
|
4546 + | struct_with_json_name: ::std::option::Option::None,
|
4547 + | timestamp: ::std::option::Option::None,
|
4548 + | unix_timestamp: ::std::option::Option::None,
|
4549 + | };
|
4550 + | ::pretty_assertions::assert_eq!(
|
4551 + | input.blob,
|
4552 + | expected.blob,
|
4553 + | "Unexpected value for `blob`"
|
4554 + | );
|
4555 + | ::pretty_assertions::assert_eq!(
|
4556 + | input.boolean,
|
4557 + | expected.boolean,
|
4558 + | "Unexpected value for `boolean`"
|
4559 + | );
|
4560 + | assert!(
|
4561 + | input.double.float_equals(&expected.double),
|
4562 + | "Unexpected value for `double` {:?} vs. {:?}",
|
4563 + | expected.double,
|
4564 + | input.double
|
4565 + | );
|
4566 + | ::pretty_assertions::assert_eq!(
|
4567 + | input.empty_struct,
|
4568 + | expected.empty_struct,
|
4569 + | "Unexpected value for `empty_struct`"
|
4570 + | );
|
4571 + | assert!(
|
4572 + | input.float.float_equals(&expected.float),
|
4573 + | "Unexpected value for `float` {:?} vs. {:?}",
|
4574 + | expected.float,
|
4575 + | input.float
|
4576 + | );
|
4577 + | ::pretty_assertions::assert_eq!(
|
4578 + | input.httpdate_timestamp,
|
4579 + | expected.httpdate_timestamp,
|
4580 + | "Unexpected value for `httpdate_timestamp`"
|
4581 + | );
|
4582 + | ::pretty_assertions::assert_eq!(
|
4583 + | input.integer,
|
4584 + | expected.integer,
|
4585 + | "Unexpected value for `integer`"
|
4586 + | );
|
4587 + | ::pretty_assertions::assert_eq!(
|
4588 + | input.iso8601_timestamp,
|
4589 + | expected.iso8601_timestamp,
|
4590 + | "Unexpected value for `iso8601_timestamp`"
|
4591 + | );
|
4592 + | ::pretty_assertions::assert_eq!(
|
4593 + | input.json_value,
|
4594 + | expected.json_value,
|
4595 + | "Unexpected value for `json_value`"
|
4596 + | );
|
4597 + | ::pretty_assertions::assert_eq!(
|
4598 + | input.list_of_lists,
|
4599 + | expected.list_of_lists,
|
4600 + | "Unexpected value for `list_of_lists`"
|
4601 + | );
|
4602 + | ::pretty_assertions::assert_eq!(
|
4603 + | input.list_of_maps_of_strings,
|
4604 + | expected.list_of_maps_of_strings,
|
4605 + | "Unexpected value for `list_of_maps_of_strings`"
|
4606 + | );
|
4607 + | ::pretty_assertions::assert_eq!(
|
4608 + | input.list_of_strings,
|
4609 + | expected.list_of_strings,
|
4610 + | "Unexpected value for `list_of_strings`"
|
4611 + | );
|
4612 + | ::pretty_assertions::assert_eq!(
|
4613 + | input.list_of_structs,
|
4614 + | expected.list_of_structs,
|
4615 + | "Unexpected value for `list_of_structs`"
|
4616 + | );
|
4617 + | ::pretty_assertions::assert_eq!(
|
4618 + | input.long,
|
4619 + | expected.long,
|
4620 + | "Unexpected value for `long`"
|
4621 + | );
|
4622 + | ::pretty_assertions::assert_eq!(
|
4623 + | input.map_of_lists_of_strings,
|
4624 + | expected.map_of_lists_of_strings,
|
4625 + | "Unexpected value for `map_of_lists_of_strings`"
|
4626 + | );
|
4627 + | ::pretty_assertions::assert_eq!(
|
4628 + | input.map_of_maps,
|
4629 + | expected.map_of_maps,
|
4630 + | "Unexpected value for `map_of_maps`"
|
4631 + | );
|
4632 + | ::pretty_assertions::assert_eq!(
|
4633 + | input.map_of_strings,
|
4634 + | expected.map_of_strings,
|
4635 + | "Unexpected value for `map_of_strings`"
|
4636 + | );
|
4637 + | ::pretty_assertions::assert_eq!(
|
4638 + | input.map_of_structs,
|
4639 + | expected.map_of_structs,
|
4640 + | "Unexpected value for `map_of_structs`"
|
4641 + | );
|
4642 + | ::pretty_assertions::assert_eq!(
|
4643 + | input.recursive_list,
|
4644 + | expected.recursive_list,
|
4645 + | "Unexpected value for `recursive_list`"
|
4646 + | );
|
4647 + | ::pretty_assertions::assert_eq!(
|
4648 + | input.recursive_map,
|
4649 + | expected.recursive_map,
|
4650 + | "Unexpected value for `recursive_map`"
|
4651 + | );
|
4652 + | ::pretty_assertions::assert_eq!(
|
4653 + | input.recursive_struct,
|
4654 + | expected.recursive_struct,
|
4655 + | "Unexpected value for `recursive_struct`"
|
4656 + | );
|
4657 + | ::pretty_assertions::assert_eq!(
|
4658 + | input.simple_struct,
|
4659 + | expected.simple_struct,
|
4660 + | "Unexpected value for `simple_struct`"
|
4661 + | );
|
4662 + | ::pretty_assertions::assert_eq!(
|
4663 + | input.string,
|
4664 + | expected.string,
|
4665 + | "Unexpected value for `string`"
|
4666 + | );
|
4667 + | ::pretty_assertions::assert_eq!(
|
4668 + | input.struct_with_json_name,
|
4669 + | expected.struct_with_json_name,
|
4670 + | "Unexpected value for `struct_with_json_name`"
|
4671 + | );
|
4672 + | ::pretty_assertions::assert_eq!(
|
4673 + | input.timestamp,
|
4674 + | expected.timestamp,
|
4675 + | "Unexpected value for `timestamp`"
|
4676 + | );
|
4677 + | ::pretty_assertions::assert_eq!(
|
4678 + | input.unix_timestamp,
|
4679 + | expected.unix_timestamp,
|
4680 + | "Unexpected value for `unix_timestamp`"
|
4681 + | );
|
4682 + | let output = crate::output::KitchenSinkOperationOutput {
|
4683 + | blob: ::std::option::Option::None,
|
4684 + | boolean: ::std::option::Option::None,
|
4685 + | double: ::std::option::Option::None,
|
4686 + | empty_struct: ::std::option::Option::None,
|
4687 + | float: ::std::option::Option::None,
|
4688 + | httpdate_timestamp: ::std::option::Option::None,
|
4689 + | integer: ::std::option::Option::None,
|
4690 + | iso8601_timestamp: ::std::option::Option::None,
|
4691 + | json_value: ::std::option::Option::None,
|
4692 + | list_of_lists: ::std::option::Option::None,
|
4693 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4694 + | list_of_strings: ::std::option::Option::None,
|
4695 + | list_of_structs: ::std::option::Option::None,
|
4696 + | long: ::std::option::Option::None,
|
4697 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4698 + | map_of_maps: ::std::option::Option::None,
|
4699 + | map_of_strings: ::std::option::Option::None,
|
4700 + | map_of_structs: ::std::option::Option::None,
|
4701 + | recursive_list: ::std::option::Option::None,
|
4702 + | recursive_map: ::std::option::Option::None,
|
4703 + | recursive_struct: ::std::option::Option::None,
|
4704 + | simple_struct: ::std::option::Option::None,
|
4705 + | string: ::std::option::Option::None,
|
4706 + | struct_with_json_name: ::std::option::Option::None,
|
4707 + | timestamp: ::std::option::Option::None,
|
4708 + | unix_timestamp: ::std::option::Option::None,
|
4709 + | };
|
4710 + | Ok(output)
|
4711 + | };
|
4712 + | sender.send(()).await.expect("receiver dropped early");
|
4713 + | result
|
4714 + | }
|
4715 + | })
|
4716 + | .build_unchecked();
|
4717 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4718 + | .await
|
4719 + | .expect("unable to make an HTTP request");
|
4720 + | assert!(
|
4721 + | receiver.recv().await.is_some(),
|
4722 + | "we expected operation handler to be invoked but it was not entered"
|
4723 + | );
|
4724 + | }
|
4725 + |
|
4726 + | /// Serializes double shapes
|
4727 + | /// Test ID: serializes_double_shapes
|
4728 + | #[::tokio::test]
|
4729 + | #[::tracing_test::traced_test]
|
4730 + | async fn serializes_double_shapes_request() {
|
4731 + | #[allow(unused_mut)]
|
4732 + | let mut http_request = ::http::Request::builder()
|
4733 + | .uri("/")
|
4734 + | .method("POST")
|
4735 + | .header("Content-Type", "application/x-amz-json-1.1")
|
4736 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
4737 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
4738 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4739 + | "{\"Double\":1234.5}".as_bytes(),
|
4740 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
4741 + | )),
|
4742 + | ))
|
4743 + | .unwrap();
|
4744 + | #[allow(unused_mut)]
|
4745 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4746 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
4747 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
4748 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
4749 + | let sender = sender.clone();
|
4750 + | async move {
|
4751 + | let result = {
|
4752 + | use ::aws_smithy_protocol_test::FloatEquals;
|
4753 + | let expected = crate::input::KitchenSinkOperationInput {
|
4754 + | double: ::std::option::Option::Some(1234.5_f64),
|
4755 + | blob: ::std::option::Option::None,
|
4756 + | boolean: ::std::option::Option::None,
|
4757 + | empty_struct: ::std::option::Option::None,
|
4758 + | float: ::std::option::Option::None,
|
4759 + | httpdate_timestamp: ::std::option::Option::None,
|
4760 + | integer: ::std::option::Option::None,
|
4761 + | iso8601_timestamp: ::std::option::Option::None,
|
4762 + | json_value: ::std::option::Option::None,
|
4763 + | list_of_lists: ::std::option::Option::None,
|
4764 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4765 + | list_of_strings: ::std::option::Option::None,
|
4766 + | list_of_structs: ::std::option::Option::None,
|
4767 + | long: ::std::option::Option::None,
|
4768 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4769 + | map_of_maps: ::std::option::Option::None,
|
4770 + | map_of_strings: ::std::option::Option::None,
|
4771 + | map_of_structs: ::std::option::Option::None,
|
4772 + | recursive_list: ::std::option::Option::None,
|
4773 + | recursive_map: ::std::option::Option::None,
|
4774 + | recursive_struct: ::std::option::Option::None,
|
4775 + | simple_struct: ::std::option::Option::None,
|
4776 + | string: ::std::option::Option::None,
|
4777 + | struct_with_json_name: ::std::option::Option::None,
|
4778 + | timestamp: ::std::option::Option::None,
|
4779 + | unix_timestamp: ::std::option::Option::None,
|
4780 + | };
|
4781 + | ::pretty_assertions::assert_eq!(
|
4782 + | input.blob,
|
4783 + | expected.blob,
|
4784 + | "Unexpected value for `blob`"
|
4785 + | );
|
4786 + | ::pretty_assertions::assert_eq!(
|
4787 + | input.boolean,
|
4788 + | expected.boolean,
|
4789 + | "Unexpected value for `boolean`"
|
4790 + | );
|
4791 + | assert!(
|
4792 + | input.double.float_equals(&expected.double),
|
4793 + | "Unexpected value for `double` {:?} vs. {:?}",
|
4794 + | expected.double,
|
4795 + | input.double
|
4796 + | );
|
4797 + | ::pretty_assertions::assert_eq!(
|
4798 + | input.empty_struct,
|
4799 + | expected.empty_struct,
|
4800 + | "Unexpected value for `empty_struct`"
|
4801 + | );
|
4802 + | assert!(
|
4803 + | input.float.float_equals(&expected.float),
|
4804 + | "Unexpected value for `float` {:?} vs. {:?}",
|
4805 + | expected.float,
|
4806 + | input.float
|
4807 + | );
|
4808 + | ::pretty_assertions::assert_eq!(
|
4809 + | input.httpdate_timestamp,
|
4810 + | expected.httpdate_timestamp,
|
4811 + | "Unexpected value for `httpdate_timestamp`"
|
4812 + | );
|
4813 + | ::pretty_assertions::assert_eq!(
|
4814 + | input.integer,
|
4815 + | expected.integer,
|
4816 + | "Unexpected value for `integer`"
|
4817 + | );
|
4818 + | ::pretty_assertions::assert_eq!(
|
4819 + | input.iso8601_timestamp,
|
4820 + | expected.iso8601_timestamp,
|
4821 + | "Unexpected value for `iso8601_timestamp`"
|
4822 + | );
|
4823 + | ::pretty_assertions::assert_eq!(
|
4824 + | input.json_value,
|
4825 + | expected.json_value,
|
4826 + | "Unexpected value for `json_value`"
|
4827 + | );
|
4828 + | ::pretty_assertions::assert_eq!(
|
4829 + | input.list_of_lists,
|
4830 + | expected.list_of_lists,
|
4831 + | "Unexpected value for `list_of_lists`"
|
4832 + | );
|
4833 + | ::pretty_assertions::assert_eq!(
|
4834 + | input.list_of_maps_of_strings,
|
4835 + | expected.list_of_maps_of_strings,
|
4836 + | "Unexpected value for `list_of_maps_of_strings`"
|
4837 + | );
|
4838 + | ::pretty_assertions::assert_eq!(
|
4839 + | input.list_of_strings,
|
4840 + | expected.list_of_strings,
|
4841 + | "Unexpected value for `list_of_strings`"
|
4842 + | );
|
4843 + | ::pretty_assertions::assert_eq!(
|
4844 + | input.list_of_structs,
|
4845 + | expected.list_of_structs,
|
4846 + | "Unexpected value for `list_of_structs`"
|
4847 + | );
|
4848 + | ::pretty_assertions::assert_eq!(
|
4849 + | input.long,
|
4850 + | expected.long,
|
4851 + | "Unexpected value for `long`"
|
4852 + | );
|
4853 + | ::pretty_assertions::assert_eq!(
|
4854 + | input.map_of_lists_of_strings,
|
4855 + | expected.map_of_lists_of_strings,
|
4856 + | "Unexpected value for `map_of_lists_of_strings`"
|
4857 + | );
|
4858 + | ::pretty_assertions::assert_eq!(
|
4859 + | input.map_of_maps,
|
4860 + | expected.map_of_maps,
|
4861 + | "Unexpected value for `map_of_maps`"
|
4862 + | );
|
4863 + | ::pretty_assertions::assert_eq!(
|
4864 + | input.map_of_strings,
|
4865 + | expected.map_of_strings,
|
4866 + | "Unexpected value for `map_of_strings`"
|
4867 + | );
|
4868 + | ::pretty_assertions::assert_eq!(
|
4869 + | input.map_of_structs,
|
4870 + | expected.map_of_structs,
|
4871 + | "Unexpected value for `map_of_structs`"
|
4872 + | );
|
4873 + | ::pretty_assertions::assert_eq!(
|
4874 + | input.recursive_list,
|
4875 + | expected.recursive_list,
|
4876 + | "Unexpected value for `recursive_list`"
|
4877 + | );
|
4878 + | ::pretty_assertions::assert_eq!(
|
4879 + | input.recursive_map,
|
4880 + | expected.recursive_map,
|
4881 + | "Unexpected value for `recursive_map`"
|
4882 + | );
|
4883 + | ::pretty_assertions::assert_eq!(
|
4884 + | input.recursive_struct,
|
4885 + | expected.recursive_struct,
|
4886 + | "Unexpected value for `recursive_struct`"
|
4887 + | );
|
4888 + | ::pretty_assertions::assert_eq!(
|
4889 + | input.simple_struct,
|
4890 + | expected.simple_struct,
|
4891 + | "Unexpected value for `simple_struct`"
|
4892 + | );
|
4893 + | ::pretty_assertions::assert_eq!(
|
4894 + | input.string,
|
4895 + | expected.string,
|
4896 + | "Unexpected value for `string`"
|
4897 + | );
|
4898 + | ::pretty_assertions::assert_eq!(
|
4899 + | input.struct_with_json_name,
|
4900 + | expected.struct_with_json_name,
|
4901 + | "Unexpected value for `struct_with_json_name`"
|
4902 + | );
|
4903 + | ::pretty_assertions::assert_eq!(
|
4904 + | input.timestamp,
|
4905 + | expected.timestamp,
|
4906 + | "Unexpected value for `timestamp`"
|
4907 + | );
|
4908 + | ::pretty_assertions::assert_eq!(
|
4909 + | input.unix_timestamp,
|
4910 + | expected.unix_timestamp,
|
4911 + | "Unexpected value for `unix_timestamp`"
|
4912 + | );
|
4913 + | let output = crate::output::KitchenSinkOperationOutput {
|
4914 + | blob: ::std::option::Option::None,
|
4915 + | boolean: ::std::option::Option::None,
|
4916 + | double: ::std::option::Option::None,
|
4917 + | empty_struct: ::std::option::Option::None,
|
4918 + | float: ::std::option::Option::None,
|
4919 + | httpdate_timestamp: ::std::option::Option::None,
|
4920 + | integer: ::std::option::Option::None,
|
4921 + | iso8601_timestamp: ::std::option::Option::None,
|
4922 + | json_value: ::std::option::Option::None,
|
4923 + | list_of_lists: ::std::option::Option::None,
|
4924 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4925 + | list_of_strings: ::std::option::Option::None,
|
4926 + | list_of_structs: ::std::option::Option::None,
|
4927 + | long: ::std::option::Option::None,
|
4928 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4929 + | map_of_maps: ::std::option::Option::None,
|
4930 + | map_of_strings: ::std::option::Option::None,
|
4931 + | map_of_structs: ::std::option::Option::None,
|
4932 + | recursive_list: ::std::option::Option::None,
|
4933 + | recursive_map: ::std::option::Option::None,
|
4934 + | recursive_struct: ::std::option::Option::None,
|
4935 + | simple_struct: ::std::option::Option::None,
|
4936 + | string: ::std::option::Option::None,
|
4937 + | struct_with_json_name: ::std::option::Option::None,
|
4938 + | timestamp: ::std::option::Option::None,
|
4939 + | unix_timestamp: ::std::option::Option::None,
|
4940 + | };
|
4941 + | Ok(output)
|
4942 + | };
|
4943 + | sender.send(()).await.expect("receiver dropped early");
|
4944 + | result
|
4945 + | }
|
4946 + | })
|
4947 + | .build_unchecked();
|
4948 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4949 + | .await
|
4950 + | .expect("unable to make an HTTP request");
|
4951 + | assert!(
|
4952 + | receiver.recv().await.is_some(),
|
4953 + | "we expected operation handler to be invoked but it was not entered"
|
4954 + | );
|
4955 + | }
|
4956 + |
|
4957 + | /// Serializes blob shapes
|
4958 + | /// Test ID: serializes_blob_shapes
|
4959 + | #[::tokio::test]
|
4960 + | #[::tracing_test::traced_test]
|
4961 + | async fn serializes_blob_shapes_request() {
|
4962 + | #[allow(unused_mut)]
|
4963 + | let mut http_request = ::http::Request::builder()
|
4964 + | .uri("/")
|
4965 + | .method("POST")
|
4966 + | .header("Content-Type", "application/x-amz-json-1.1")
|
4967 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
4968 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
4969 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4970 + | "{\"Blob\":\"YmluYXJ5LXZhbHVl\"}".as_bytes(),
|
4971 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
4972 + | )),
|
4973 + | ))
|
4974 + | .unwrap();
|
4975 + | #[allow(unused_mut)]
|
4976 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4977 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
4978 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
4979 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
4980 + | let sender = sender.clone();
|
4981 + | async move {
|
4982 + | let result = {
|
4983 + | use ::aws_smithy_protocol_test::FloatEquals;
|
4984 + | let expected = crate::input::KitchenSinkOperationInput {
|
4985 + | blob: ::std::option::Option::Some(::aws_smithy_types::Blob::new(
|
4986 + | "binary-value",
|
4987 + | )),
|
4988 + | boolean: ::std::option::Option::None,
|
4989 + | double: ::std::option::Option::None,
|
4990 + | empty_struct: ::std::option::Option::None,
|
4991 + | float: ::std::option::Option::None,
|
4992 + | httpdate_timestamp: ::std::option::Option::None,
|
4993 + | integer: ::std::option::Option::None,
|
4994 + | iso8601_timestamp: ::std::option::Option::None,
|
4995 + | json_value: ::std::option::Option::None,
|
4996 + | list_of_lists: ::std::option::Option::None,
|
4997 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4998 + | list_of_strings: ::std::option::Option::None,
|
4999 + | list_of_structs: ::std::option::Option::None,
|
5000 + | long: ::std::option::Option::None,
|
5001 + | map_of_lists_of_strings: ::std::option::Option::None,
|
5002 + | map_of_maps: ::std::option::Option::None,
|
5003 + | map_of_strings: ::std::option::Option::None,
|
5004 + | map_of_structs: ::std::option::Option::None,
|
5005 + | recursive_list: ::std::option::Option::None,
|
5006 + | recursive_map: ::std::option::Option::None,
|
5007 + | recursive_struct: ::std::option::Option::None,
|
5008 + | simple_struct: ::std::option::Option::None,
|
5009 + | string: ::std::option::Option::None,
|
5010 + | struct_with_json_name: ::std::option::Option::None,
|
5011 + | timestamp: ::std::option::Option::None,
|
5012 + | unix_timestamp: ::std::option::Option::None,
|
5013 + | };
|
5014 + | ::pretty_assertions::assert_eq!(
|
5015 + | input.blob,
|
5016 + | expected.blob,
|
5017 + | "Unexpected value for `blob`"
|
5018 + | );
|
5019 + | ::pretty_assertions::assert_eq!(
|
5020 + | input.boolean,
|
5021 + | expected.boolean,
|
5022 + | "Unexpected value for `boolean`"
|
5023 + | );
|
5024 + | assert!(
|
5025 + | input.double.float_equals(&expected.double),
|
5026 + | "Unexpected value for `double` {:?} vs. {:?}",
|
5027 + | expected.double,
|
5028 + | input.double
|
5029 + | );
|
5030 + | ::pretty_assertions::assert_eq!(
|
5031 + | input.empty_struct,
|
5032 + | expected.empty_struct,
|
5033 + | "Unexpected value for `empty_struct`"
|
5034 + | );
|
5035 + | assert!(
|
5036 + | input.float.float_equals(&expected.float),
|
5037 + | "Unexpected value for `float` {:?} vs. {:?}",
|
5038 + | expected.float,
|
5039 + | input.float
|
5040 + | );
|
5041 + | ::pretty_assertions::assert_eq!(
|
5042 + | input.httpdate_timestamp,
|
5043 + | expected.httpdate_timestamp,
|
5044 + | "Unexpected value for `httpdate_timestamp`"
|
5045 + | );
|
5046 + | ::pretty_assertions::assert_eq!(
|
5047 + | input.integer,
|
5048 + | expected.integer,
|
5049 + | "Unexpected value for `integer`"
|
5050 + | );
|
5051 + | ::pretty_assertions::assert_eq!(
|
5052 + | input.iso8601_timestamp,
|
5053 + | expected.iso8601_timestamp,
|
5054 + | "Unexpected value for `iso8601_timestamp`"
|
5055 + | );
|
5056 + | ::pretty_assertions::assert_eq!(
|
5057 + | input.json_value,
|
5058 + | expected.json_value,
|
5059 + | "Unexpected value for `json_value`"
|
5060 + | );
|
5061 + | ::pretty_assertions::assert_eq!(
|
5062 + | input.list_of_lists,
|
5063 + | expected.list_of_lists,
|
5064 + | "Unexpected value for `list_of_lists`"
|
5065 + | );
|
5066 + | ::pretty_assertions::assert_eq!(
|
5067 + | input.list_of_maps_of_strings,
|
5068 + | expected.list_of_maps_of_strings,
|
5069 + | "Unexpected value for `list_of_maps_of_strings`"
|
5070 + | );
|
5071 + | ::pretty_assertions::assert_eq!(
|
5072 + | input.list_of_strings,
|
5073 + | expected.list_of_strings,
|
5074 + | "Unexpected value for `list_of_strings`"
|
5075 + | );
|
5076 + | ::pretty_assertions::assert_eq!(
|
5077 + | input.list_of_structs,
|
5078 + | expected.list_of_structs,
|
5079 + | "Unexpected value for `list_of_structs`"
|
5080 + | );
|
5081 + | ::pretty_assertions::assert_eq!(
|
5082 + | input.long,
|
5083 + | expected.long,
|
5084 + | "Unexpected value for `long`"
|
5085 + | );
|
5086 + | ::pretty_assertions::assert_eq!(
|
5087 + | input.map_of_lists_of_strings,
|
5088 + | expected.map_of_lists_of_strings,
|
5089 + | "Unexpected value for `map_of_lists_of_strings`"
|
5090 + | );
|
5091 + | ::pretty_assertions::assert_eq!(
|
5092 + | input.map_of_maps,
|
5093 + | expected.map_of_maps,
|
5094 + | "Unexpected value for `map_of_maps`"
|
5095 + | );
|
5096 + | ::pretty_assertions::assert_eq!(
|
5097 + | input.map_of_strings,
|
5098 + | expected.map_of_strings,
|
5099 + | "Unexpected value for `map_of_strings`"
|
5100 + | );
|
5101 + | ::pretty_assertions::assert_eq!(
|
5102 + | input.map_of_structs,
|
5103 + | expected.map_of_structs,
|
5104 + | "Unexpected value for `map_of_structs`"
|
5105 + | );
|
5106 + | ::pretty_assertions::assert_eq!(
|
5107 + | input.recursive_list,
|
5108 + | expected.recursive_list,
|
5109 + | "Unexpected value for `recursive_list`"
|
5110 + | );
|
5111 + | ::pretty_assertions::assert_eq!(
|
5112 + | input.recursive_map,
|
5113 + | expected.recursive_map,
|
5114 + | "Unexpected value for `recursive_map`"
|
5115 + | );
|
5116 + | ::pretty_assertions::assert_eq!(
|
5117 + | input.recursive_struct,
|
5118 + | expected.recursive_struct,
|
5119 + | "Unexpected value for `recursive_struct`"
|
5120 + | );
|
5121 + | ::pretty_assertions::assert_eq!(
|
5122 + | input.simple_struct,
|
5123 + | expected.simple_struct,
|
5124 + | "Unexpected value for `simple_struct`"
|
5125 + | );
|
5126 + | ::pretty_assertions::assert_eq!(
|
5127 + | input.string,
|
5128 + | expected.string,
|
5129 + | "Unexpected value for `string`"
|
5130 + | );
|
5131 + | ::pretty_assertions::assert_eq!(
|
5132 + | input.struct_with_json_name,
|
5133 + | expected.struct_with_json_name,
|
5134 + | "Unexpected value for `struct_with_json_name`"
|
5135 + | );
|
5136 + | ::pretty_assertions::assert_eq!(
|
5137 + | input.timestamp,
|
5138 + | expected.timestamp,
|
5139 + | "Unexpected value for `timestamp`"
|
5140 + | );
|
5141 + | ::pretty_assertions::assert_eq!(
|
5142 + | input.unix_timestamp,
|
5143 + | expected.unix_timestamp,
|
5144 + | "Unexpected value for `unix_timestamp`"
|
5145 + | );
|
5146 + | let output = crate::output::KitchenSinkOperationOutput {
|
5147 + | blob: ::std::option::Option::None,
|
5148 + | boolean: ::std::option::Option::None,
|
5149 + | double: ::std::option::Option::None,
|
5150 + | empty_struct: ::std::option::Option::None,
|
5151 + | float: ::std::option::Option::None,
|
5152 + | httpdate_timestamp: ::std::option::Option::None,
|
5153 + | integer: ::std::option::Option::None,
|
5154 + | iso8601_timestamp: ::std::option::Option::None,
|
5155 + | json_value: ::std::option::Option::None,
|
5156 + | list_of_lists: ::std::option::Option::None,
|
5157 + | list_of_maps_of_strings: ::std::option::Option::None,
|
5158 + | list_of_strings: ::std::option::Option::None,
|
5159 + | list_of_structs: ::std::option::Option::None,
|
5160 + | long: ::std::option::Option::None,
|
5161 + | map_of_lists_of_strings: ::std::option::Option::None,
|
5162 + | map_of_maps: ::std::option::Option::None,
|
5163 + | map_of_strings: ::std::option::Option::None,
|
5164 + | map_of_structs: ::std::option::Option::None,
|
5165 + | recursive_list: ::std::option::Option::None,
|
5166 + | recursive_map: ::std::option::Option::None,
|
5167 + | recursive_struct: ::std::option::Option::None,
|
5168 + | simple_struct: ::std::option::Option::None,
|
5169 + | string: ::std::option::Option::None,
|
5170 + | struct_with_json_name: ::std::option::Option::None,
|
5171 + | timestamp: ::std::option::Option::None,
|
5172 + | unix_timestamp: ::std::option::Option::None,
|
5173 + | };
|
5174 + | Ok(output)
|
5175 + | };
|
5176 + | sender.send(()).await.expect("receiver dropped early");
|
5177 + | result
|
5178 + | }
|
5179 + | })
|
5180 + | .build_unchecked();
|
5181 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5182 + | .await
|
5183 + | .expect("unable to make an HTTP request");
|
5184 + | assert!(
|
5185 + | receiver.recv().await.is_some(),
|
5186 + | "we expected operation handler to be invoked but it was not entered"
|
5187 + | );
|
5188 + | }
|
5189 + |
|
5190 + | /// Serializes boolean shapes (true)
|
5191 + | /// Test ID: serializes_boolean_shapes_true
|
5192 + | #[::tokio::test]
|
5193 + | #[::tracing_test::traced_test]
|
5194 + | async fn serializes_boolean_shapes_true_request() {
|
5195 + | #[allow(unused_mut)]
|
5196 + | let mut http_request = ::http::Request::builder()
|
5197 + | .uri("/")
|
5198 + | .method("POST")
|
5199 + | .header("Content-Type", "application/x-amz-json-1.1")
|
5200 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
5201 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
5202 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5203 + | "{\"Boolean\":true}".as_bytes(),
|
5204 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
5205 + | )),
|
5206 + | ))
|
5207 + | .unwrap();
|
5208 + | #[allow(unused_mut)]
|
5209 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5210 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
5211 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
5212 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
5213 + | let sender = sender.clone();
|
5214 + | async move {
|
5215 + | let result = {
|
5216 + | use ::aws_smithy_protocol_test::FloatEquals;
|
5217 + | let expected = crate::input::KitchenSinkOperationInput {
|
5218 + | boolean: ::std::option::Option::Some(true),
|
5219 + | blob: ::std::option::Option::None,
|
5220 + | double: ::std::option::Option::None,
|
5221 + | empty_struct: ::std::option::Option::None,
|
5222 + | float: ::std::option::Option::None,
|
5223 + | httpdate_timestamp: ::std::option::Option::None,
|
5224 + | integer: ::std::option::Option::None,
|
5225 + | iso8601_timestamp: ::std::option::Option::None,
|
5226 + | json_value: ::std::option::Option::None,
|
5227 + | list_of_lists: ::std::option::Option::None,
|
5228 + | list_of_maps_of_strings: ::std::option::Option::None,
|
5229 + | list_of_strings: ::std::option::Option::None,
|
5230 + | list_of_structs: ::std::option::Option::None,
|
5231 + | long: ::std::option::Option::None,
|
5232 + | map_of_lists_of_strings: ::std::option::Option::None,
|
5233 + | map_of_maps: ::std::option::Option::None,
|
5234 + | map_of_strings: ::std::option::Option::None,
|
5235 + | map_of_structs: ::std::option::Option::None,
|
5236 + | recursive_list: ::std::option::Option::None,
|
5237 + | recursive_map: ::std::option::Option::None,
|
5238 + | recursive_struct: ::std::option::Option::None,
|
5239 + | simple_struct: ::std::option::Option::None,
|
5240 + | string: ::std::option::Option::None,
|
5241 + | struct_with_json_name: ::std::option::Option::None,
|
5242 + | timestamp: ::std::option::Option::None,
|
5243 + | unix_timestamp: ::std::option::Option::None,
|
5244 + | };
|
5245 + | ::pretty_assertions::assert_eq!(
|
5246 + | input.blob,
|
5247 + | expected.blob,
|
5248 + | "Unexpected value for `blob`"
|
5249 + | );
|
5250 + | ::pretty_assertions::assert_eq!(
|
5251 + | input.boolean,
|
5252 + | expected.boolean,
|
5253 + | "Unexpected value for `boolean`"
|
5254 + | );
|
5255 + | assert!(
|
5256 + | input.double.float_equals(&expected.double),
|
5257 + | "Unexpected value for `double` {:?} vs. {:?}",
|
5258 + | expected.double,
|
5259 + | input.double
|
5260 + | );
|
5261 + | ::pretty_assertions::assert_eq!(
|
5262 + | input.empty_struct,
|
5263 + | expected.empty_struct,
|
5264 + | "Unexpected value for `empty_struct`"
|
5265 + | );
|
5266 + | assert!(
|
5267 + | input.float.float_equals(&expected.float),
|
5268 + | "Unexpected value for `float` {:?} vs. {:?}",
|
5269 + | expected.float,
|
5270 + | input.float
|
5271 + | );
|
5272 + | ::pretty_assertions::assert_eq!(
|
5273 + | input.httpdate_timestamp,
|
5274 + | expected.httpdate_timestamp,
|
5275 + | "Unexpected value for `httpdate_timestamp`"
|
5276 + | );
|
5277 + | ::pretty_assertions::assert_eq!(
|
5278 + | input.integer,
|
5279 + | expected.integer,
|
5280 + | "Unexpected value for `integer`"
|
5281 + | );
|
5282 + | ::pretty_assertions::assert_eq!(
|
5283 + | input.iso8601_timestamp,
|
5284 + | expected.iso8601_timestamp,
|
5285 + | "Unexpected value for `iso8601_timestamp`"
|
5286 + | );
|
5287 + | ::pretty_assertions::assert_eq!(
|
5288 + | input.json_value,
|
5289 + | expected.json_value,
|
5290 + | "Unexpected value for `json_value`"
|
5291 + | );
|
5292 + | ::pretty_assertions::assert_eq!(
|
5293 + | input.list_of_lists,
|
5294 + | expected.list_of_lists,
|
5295 + | "Unexpected value for `list_of_lists`"
|
5296 + | );
|
5297 + | ::pretty_assertions::assert_eq!(
|
5298 + | input.list_of_maps_of_strings,
|
5299 + | expected.list_of_maps_of_strings,
|
5300 + | "Unexpected value for `list_of_maps_of_strings`"
|
5301 + | );
|
5302 + | ::pretty_assertions::assert_eq!(
|
5303 + | input.list_of_strings,
|
5304 + | expected.list_of_strings,
|
5305 + | "Unexpected value for `list_of_strings`"
|
5306 + | );
|
5307 + | ::pretty_assertions::assert_eq!(
|
5308 + | input.list_of_structs,
|
5309 + | expected.list_of_structs,
|
5310 + | "Unexpected value for `list_of_structs`"
|
5311 + | );
|
5312 + | ::pretty_assertions::assert_eq!(
|
5313 + | input.long,
|
5314 + | expected.long,
|
5315 + | "Unexpected value for `long`"
|
5316 + | );
|
5317 + | ::pretty_assertions::assert_eq!(
|
5318 + | input.map_of_lists_of_strings,
|
5319 + | expected.map_of_lists_of_strings,
|
5320 + | "Unexpected value for `map_of_lists_of_strings`"
|
5321 + | );
|
5322 + | ::pretty_assertions::assert_eq!(
|
5323 + | input.map_of_maps,
|
5324 + | expected.map_of_maps,
|
5325 + | "Unexpected value for `map_of_maps`"
|
5326 + | );
|
5327 + | ::pretty_assertions::assert_eq!(
|
5328 + | input.map_of_strings,
|
5329 + | expected.map_of_strings,
|
5330 + | "Unexpected value for `map_of_strings`"
|
5331 + | );
|
5332 + | ::pretty_assertions::assert_eq!(
|
5333 + | input.map_of_structs,
|
5334 + | expected.map_of_structs,
|
5335 + | "Unexpected value for `map_of_structs`"
|
5336 + | );
|
5337 + | ::pretty_assertions::assert_eq!(
|
5338 + | input.recursive_list,
|
5339 + | expected.recursive_list,
|
5340 + | "Unexpected value for `recursive_list`"
|
5341 + | );
|
5342 + | ::pretty_assertions::assert_eq!(
|
5343 + | input.recursive_map,
|
5344 + | expected.recursive_map,
|
5345 + | "Unexpected value for `recursive_map`"
|
5346 + | );
|
5347 + | ::pretty_assertions::assert_eq!(
|
5348 + | input.recursive_struct,
|
5349 + | expected.recursive_struct,
|
5350 + | "Unexpected value for `recursive_struct`"
|
5351 + | );
|
5352 + | ::pretty_assertions::assert_eq!(
|
5353 + | input.simple_struct,
|
5354 + | expected.simple_struct,
|
5355 + | "Unexpected value for `simple_struct`"
|
5356 + | );
|
5357 + | ::pretty_assertions::assert_eq!(
|
5358 + | input.string,
|
5359 + | expected.string,
|
5360 + | "Unexpected value for `string`"
|
5361 + | );
|
5362 + | ::pretty_assertions::assert_eq!(
|
5363 + | input.struct_with_json_name,
|
5364 + | expected.struct_with_json_name,
|
5365 + | "Unexpected value for `struct_with_json_name`"
|
5366 + | );
|
5367 + | ::pretty_assertions::assert_eq!(
|
5368 + | input.timestamp,
|
5369 + | expected.timestamp,
|
5370 + | "Unexpected value for `timestamp`"
|
5371 + | );
|
5372 + | ::pretty_assertions::assert_eq!(
|
5373 + | input.unix_timestamp,
|
5374 + | expected.unix_timestamp,
|
5375 + | "Unexpected value for `unix_timestamp`"
|
5376 + | );
|
5377 + | let output = crate::output::KitchenSinkOperationOutput {
|
5378 + | blob: ::std::option::Option::None,
|
5379 + | boolean: ::std::option::Option::None,
|
5380 + | double: ::std::option::Option::None,
|
5381 + | empty_struct: ::std::option::Option::None,
|
5382 + | float: ::std::option::Option::None,
|
5383 + | httpdate_timestamp: ::std::option::Option::None,
|
5384 + | integer: ::std::option::Option::None,
|
5385 + | iso8601_timestamp: ::std::option::Option::None,
|
5386 + | json_value: ::std::option::Option::None,
|
5387 + | list_of_lists: ::std::option::Option::None,
|
5388 + | list_of_maps_of_strings: ::std::option::Option::None,
|
5389 + | list_of_strings: ::std::option::Option::None,
|
5390 + | list_of_structs: ::std::option::Option::None,
|
5391 + | long: ::std::option::Option::None,
|
5392 + | map_of_lists_of_strings: ::std::option::Option::None,
|
5393 + | map_of_maps: ::std::option::Option::None,
|
5394 + | map_of_strings: ::std::option::Option::None,
|
5395 + | map_of_structs: ::std::option::Option::None,
|
5396 + | recursive_list: ::std::option::Option::None,
|
5397 + | recursive_map: ::std::option::Option::None,
|
5398 + | recursive_struct: ::std::option::Option::None,
|
5399 + | simple_struct: ::std::option::Option::None,
|
5400 + | string: ::std::option::Option::None,
|
5401 + | struct_with_json_name: ::std::option::Option::None,
|
5402 + | timestamp: ::std::option::Option::None,
|
5403 + | unix_timestamp: ::std::option::Option::None,
|
5404 + | };
|
5405 + | Ok(output)
|
5406 + | };
|
5407 + | sender.send(()).await.expect("receiver dropped early");
|
5408 + | result
|
5409 + | }
|
5410 + | })
|
5411 + | .build_unchecked();
|
5412 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5413 + | .await
|
5414 + | .expect("unable to make an HTTP request");
|
5415 + | assert!(
|
5416 + | receiver.recv().await.is_some(),
|
5417 + | "we expected operation handler to be invoked but it was not entered"
|
5418 + | );
|
5419 + | }
|
5420 + |
|
5421 + | /// Serializes boolean shapes (false)
|
5422 + | /// Test ID: serializes_boolean_shapes_false
|
5423 + | #[::tokio::test]
|
5424 + | #[::tracing_test::traced_test]
|
5425 + | async fn serializes_boolean_shapes_false_request() {
|
5426 + | #[allow(unused_mut)]
|
5427 + | let mut http_request = ::http::Request::builder()
|
5428 + | .uri("/")
|
5429 + | .method("POST")
|
5430 + | .header("Content-Type", "application/x-amz-json-1.1")
|
5431 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
5432 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
5433 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5434 + | "{\"Boolean\":false}".as_bytes(),
|
5435 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
5436 + | )),
|
5437 + | ))
|
5438 + | .unwrap();
|
5439 + | #[allow(unused_mut)]
|
5440 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5441 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
5442 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
5443 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
5444 + | let sender = sender.clone();
|
5445 + | async move {
|
5446 + | let result = {
|
5447 + | use ::aws_smithy_protocol_test::FloatEquals;
|
5448 + | let expected = crate::input::KitchenSinkOperationInput {
|
5449 + | boolean: ::std::option::Option::Some(false),
|
5450 + | blob: ::std::option::Option::None,
|
5451 + | double: ::std::option::Option::None,
|
5452 + | empty_struct: ::std::option::Option::None,
|
5453 + | float: ::std::option::Option::None,
|
5454 + | httpdate_timestamp: ::std::option::Option::None,
|
5455 + | integer: ::std::option::Option::None,
|
5456 + | iso8601_timestamp: ::std::option::Option::None,
|
5457 + | json_value: ::std::option::Option::None,
|
5458 + | list_of_lists: ::std::option::Option::None,
|
5459 + | list_of_maps_of_strings: ::std::option::Option::None,
|
5460 + | list_of_strings: ::std::option::Option::None,
|
5461 + | list_of_structs: ::std::option::Option::None,
|
5462 + | long: ::std::option::Option::None,
|
5463 + | map_of_lists_of_strings: ::std::option::Option::None,
|
5464 + | map_of_maps: ::std::option::Option::None,
|
5465 + | map_of_strings: ::std::option::Option::None,
|
5466 + | map_of_structs: ::std::option::Option::None,
|
5467 + | recursive_list: ::std::option::Option::None,
|
5468 + | recursive_map: ::std::option::Option::None,
|
5469 + | recursive_struct: ::std::option::Option::None,
|
5470 + | simple_struct: ::std::option::Option::None,
|
5471 + | string: ::std::option::Option::None,
|
5472 + | struct_with_json_name: ::std::option::Option::None,
|
5473 + | timestamp: ::std::option::Option::None,
|
5474 + | unix_timestamp: ::std::option::Option::None,
|
5475 + | };
|
5476 + | ::pretty_assertions::assert_eq!(
|
5477 + | input.blob,
|
5478 + | expected.blob,
|
5479 + | "Unexpected value for `blob`"
|
5480 + | );
|
5481 + | ::pretty_assertions::assert_eq!(
|
5482 + | input.boolean,
|
5483 + | expected.boolean,
|
5484 + | "Unexpected value for `boolean`"
|
5485 + | );
|
5486 + | assert!(
|
5487 + | input.double.float_equals(&expected.double),
|
5488 + | "Unexpected value for `double` {:?} vs. {:?}",
|
5489 + | expected.double,
|
5490 + | input.double
|
5491 + | );
|
5492 + | ::pretty_assertions::assert_eq!(
|
5493 + | input.empty_struct,
|
5494 + | expected.empty_struct,
|
5495 + | "Unexpected value for `empty_struct`"
|
5496 + | );
|
5497 + | assert!(
|
5498 + | input.float.float_equals(&expected.float),
|
5499 + | "Unexpected value for `float` {:?} vs. {:?}",
|
5500 + | expected.float,
|
5501 + | input.float
|
5502 + | );
|
5503 + | ::pretty_assertions::assert_eq!(
|
5504 + | input.httpdate_timestamp,
|
5505 + | expected.httpdate_timestamp,
|
5506 + | "Unexpected value for `httpdate_timestamp`"
|
5507 + | );
|
5508 + | ::pretty_assertions::assert_eq!(
|
5509 + | input.integer,
|
5510 + | expected.integer,
|
5511 + | "Unexpected value for `integer`"
|
5512 + | );
|
5513 + | ::pretty_assertions::assert_eq!(
|
5514 + | input.iso8601_timestamp,
|
5515 + | expected.iso8601_timestamp,
|
5516 + | "Unexpected value for `iso8601_timestamp`"
|
5517 + | );
|
5518 + | ::pretty_assertions::assert_eq!(
|
5519 + | input.json_value,
|
5520 + | expected.json_value,
|
5521 + | "Unexpected value for `json_value`"
|
5522 + | );
|
5523 + | ::pretty_assertions::assert_eq!(
|
5524 + | input.list_of_lists,
|
5525 + | expected.list_of_lists,
|
5526 + | "Unexpected value for `list_of_lists`"
|
5527 + | );
|
5528 + | ::pretty_assertions::assert_eq!(
|
5529 + | input.list_of_maps_of_strings,
|
5530 + | expected.list_of_maps_of_strings,
|
5531 + | "Unexpected value for `list_of_maps_of_strings`"
|
5532 + | );
|
5533 + | ::pretty_assertions::assert_eq!(
|
5534 + | input.list_of_strings,
|
5535 + | expected.list_of_strings,
|
5536 + | "Unexpected value for `list_of_strings`"
|
5537 + | );
|
5538 + | ::pretty_assertions::assert_eq!(
|
5539 + | input.list_of_structs,
|
5540 + | expected.list_of_structs,
|
5541 + | "Unexpected value for `list_of_structs`"
|
5542 + | );
|
5543 + | ::pretty_assertions::assert_eq!(
|
5544 + | input.long,
|
5545 + | expected.long,
|
5546 + | "Unexpected value for `long`"
|
5547 + | );
|
5548 + | ::pretty_assertions::assert_eq!(
|
5549 + | input.map_of_lists_of_strings,
|
5550 + | expected.map_of_lists_of_strings,
|
5551 + | "Unexpected value for `map_of_lists_of_strings`"
|
5552 + | );
|
5553 + | ::pretty_assertions::assert_eq!(
|
5554 + | input.map_of_maps,
|
5555 + | expected.map_of_maps,
|
5556 + | "Unexpected value for `map_of_maps`"
|
5557 + | );
|
5558 + | ::pretty_assertions::assert_eq!(
|
5559 + | input.map_of_strings,
|
5560 + | expected.map_of_strings,
|
5561 + | "Unexpected value for `map_of_strings`"
|
5562 + | );
|
5563 + | ::pretty_assertions::assert_eq!(
|
5564 + | input.map_of_structs,
|
5565 + | expected.map_of_structs,
|
5566 + | "Unexpected value for `map_of_structs`"
|
5567 + | );
|
5568 + | ::pretty_assertions::assert_eq!(
|
5569 + | input.recursive_list,
|
5570 + | expected.recursive_list,
|
5571 + | "Unexpected value for `recursive_list`"
|
5572 + | );
|
5573 + | ::pretty_assertions::assert_eq!(
|
5574 + | input.recursive_map,
|
5575 + | expected.recursive_map,
|
5576 + | "Unexpected value for `recursive_map`"
|
5577 + | );
|
5578 + | ::pretty_assertions::assert_eq!(
|
5579 + | input.recursive_struct,
|
5580 + | expected.recursive_struct,
|
5581 + | "Unexpected value for `recursive_struct`"
|
5582 + | );
|
5583 + | ::pretty_assertions::assert_eq!(
|
5584 + | input.simple_struct,
|
5585 + | expected.simple_struct,
|
5586 + | "Unexpected value for `simple_struct`"
|
5587 + | );
|
5588 + | ::pretty_assertions::assert_eq!(
|
5589 + | input.string,
|
5590 + | expected.string,
|
5591 + | "Unexpected value for `string`"
|
5592 + | );
|
5593 + | ::pretty_assertions::assert_eq!(
|
5594 + | input.struct_with_json_name,
|
5595 + | expected.struct_with_json_name,
|
5596 + | "Unexpected value for `struct_with_json_name`"
|
5597 + | );
|
5598 + | ::pretty_assertions::assert_eq!(
|
5599 + | input.timestamp,
|
5600 + | expected.timestamp,
|
5601 + | "Unexpected value for `timestamp`"
|
5602 + | );
|
5603 + | ::pretty_assertions::assert_eq!(
|
5604 + | input.unix_timestamp,
|
5605 + | expected.unix_timestamp,
|
5606 + | "Unexpected value for `unix_timestamp`"
|
5607 + | );
|
5608 + | let output = crate::output::KitchenSinkOperationOutput {
|
5609 + | blob: ::std::option::Option::None,
|
5610 + | boolean: ::std::option::Option::None,
|
5611 + | double: ::std::option::Option::None,
|
5612 + | empty_struct: ::std::option::Option::None,
|
5613 + | float: ::std::option::Option::None,
|
5614 + | httpdate_timestamp: ::std::option::Option::None,
|
5615 + | integer: ::std::option::Option::None,
|
5616 + | iso8601_timestamp: ::std::option::Option::None,
|
5617 + | json_value: ::std::option::Option::None,
|
5618 + | list_of_lists: ::std::option::Option::None,
|
5619 + | list_of_maps_of_strings: ::std::option::Option::None,
|
5620 + | list_of_strings: ::std::option::Option::None,
|
5621 + | list_of_structs: ::std::option::Option::None,
|
5622 + | long: ::std::option::Option::None,
|
5623 + | map_of_lists_of_strings: ::std::option::Option::None,
|
5624 + | map_of_maps: ::std::option::Option::None,
|
5625 + | map_of_strings: ::std::option::Option::None,
|
5626 + | map_of_structs: ::std::option::Option::None,
|
5627 + | recursive_list: ::std::option::Option::None,
|
5628 + | recursive_map: ::std::option::Option::None,
|
5629 + | recursive_struct: ::std::option::Option::None,
|
5630 + | simple_struct: ::std::option::Option::None,
|
5631 + | string: ::std::option::Option::None,
|
5632 + | struct_with_json_name: ::std::option::Option::None,
|
5633 + | timestamp: ::std::option::Option::None,
|
5634 + | unix_timestamp: ::std::option::Option::None,
|
5635 + | };
|
5636 + | Ok(output)
|
5637 + | };
|
5638 + | sender.send(()).await.expect("receiver dropped early");
|
5639 + | result
|
5640 + | }
|
5641 + | })
|
5642 + | .build_unchecked();
|
5643 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5644 + | .await
|
5645 + | .expect("unable to make an HTTP request");
|
5646 + | assert!(
|
5647 + | receiver.recv().await.is_some(),
|
5648 + | "we expected operation handler to be invoked but it was not entered"
|
5649 + | );
|
5650 + | }
|
5651 + |
|
5652 + | /// Serializes timestamp shapes
|
5653 + | /// Test ID: serializes_timestamp_shapes
|
5654 + | #[::tokio::test]
|
5655 + | #[::tracing_test::traced_test]
|
5656 + | async fn serializes_timestamp_shapes_request() {
|
5657 + | #[allow(unused_mut)]
|
5658 + | let mut http_request = ::http::Request::builder()
|
5659 + | .uri("/")
|
5660 + | .method("POST")
|
5661 + | .header("Content-Type", "application/x-amz-json-1.1")
|
5662 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
5663 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
5664 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5665 + | "{\"Timestamp\":946845296}".as_bytes(),
|
5666 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
5667 + | )),
|
5668 + | ))
|
5669 + | .unwrap();
|
5670 + | #[allow(unused_mut)]
|
5671 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5672 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
5673 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
5674 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
5675 + | let sender = sender.clone();
|
5676 + | async move {
|
5677 + | let result = {
|
5678 + | use ::aws_smithy_protocol_test::FloatEquals;
|
5679 + | let expected = crate::input::KitchenSinkOperationInput {
|
5680 + | timestamp: ::std::option::Option::Some(
|
5681 + | ::aws_smithy_types::DateTime::from_fractional_secs(
|
5682 + | 946845296, 0_f64,
|
5683 + | ),
|
5684 + | ),
|
5685 + | blob: ::std::option::Option::None,
|
5686 + | boolean: ::std::option::Option::None,
|
5687 + | double: ::std::option::Option::None,
|
5688 + | empty_struct: ::std::option::Option::None,
|
5689 + | float: ::std::option::Option::None,
|
5690 + | httpdate_timestamp: ::std::option::Option::None,
|
5691 + | integer: ::std::option::Option::None,
|
5692 + | iso8601_timestamp: ::std::option::Option::None,
|
5693 + | json_value: ::std::option::Option::None,
|
5694 + | list_of_lists: ::std::option::Option::None,
|
5695 + | list_of_maps_of_strings: ::std::option::Option::None,
|
5696 + | list_of_strings: ::std::option::Option::None,
|
5697 + | list_of_structs: ::std::option::Option::None,
|
5698 + | long: ::std::option::Option::None,
|
5699 + | map_of_lists_of_strings: ::std::option::Option::None,
|
5700 + | map_of_maps: ::std::option::Option::None,
|
5701 + | map_of_strings: ::std::option::Option::None,
|
5702 + | map_of_structs: ::std::option::Option::None,
|
5703 + | recursive_list: ::std::option::Option::None,
|
5704 + | recursive_map: ::std::option::Option::None,
|
5705 + | recursive_struct: ::std::option::Option::None,
|
5706 + | simple_struct: ::std::option::Option::None,
|
5707 + | string: ::std::option::Option::None,
|
5708 + | struct_with_json_name: ::std::option::Option::None,
|
5709 + | unix_timestamp: ::std::option::Option::None,
|
5710 + | };
|
5711 + | ::pretty_assertions::assert_eq!(
|
5712 + | input.blob,
|
5713 + | expected.blob,
|
5714 + | "Unexpected value for `blob`"
|
5715 + | );
|
5716 + | ::pretty_assertions::assert_eq!(
|
5717 + | input.boolean,
|
5718 + | expected.boolean,
|
5719 + | "Unexpected value for `boolean`"
|
5720 + | );
|
5721 + | assert!(
|
5722 + | input.double.float_equals(&expected.double),
|
5723 + | "Unexpected value for `double` {:?} vs. {:?}",
|
5724 + | expected.double,
|
5725 + | input.double
|
5726 + | );
|
5727 + | ::pretty_assertions::assert_eq!(
|
5728 + | input.empty_struct,
|
5729 + | expected.empty_struct,
|
5730 + | "Unexpected value for `empty_struct`"
|
5731 + | );
|
5732 + | assert!(
|
5733 + | input.float.float_equals(&expected.float),
|
5734 + | "Unexpected value for `float` {:?} vs. {:?}",
|
5735 + | expected.float,
|
5736 + | input.float
|
5737 + | );
|
5738 + | ::pretty_assertions::assert_eq!(
|
5739 + | input.httpdate_timestamp,
|
5740 + | expected.httpdate_timestamp,
|
5741 + | "Unexpected value for `httpdate_timestamp`"
|
5742 + | );
|
5743 + | ::pretty_assertions::assert_eq!(
|
5744 + | input.integer,
|
5745 + | expected.integer,
|
5746 + | "Unexpected value for `integer`"
|
5747 + | );
|
5748 + | ::pretty_assertions::assert_eq!(
|
5749 + | input.iso8601_timestamp,
|
5750 + | expected.iso8601_timestamp,
|
5751 + | "Unexpected value for `iso8601_timestamp`"
|
5752 + | );
|
5753 + | ::pretty_assertions::assert_eq!(
|
5754 + | input.json_value,
|
5755 + | expected.json_value,
|
5756 + | "Unexpected value for `json_value`"
|
5757 + | );
|
5758 + | ::pretty_assertions::assert_eq!(
|
5759 + | input.list_of_lists,
|
5760 + | expected.list_of_lists,
|
5761 + | "Unexpected value for `list_of_lists`"
|
5762 + | );
|
5763 + | ::pretty_assertions::assert_eq!(
|
5764 + | input.list_of_maps_of_strings,
|
5765 + | expected.list_of_maps_of_strings,
|
5766 + | "Unexpected value for `list_of_maps_of_strings`"
|
5767 + | );
|
5768 + | ::pretty_assertions::assert_eq!(
|
5769 + | input.list_of_strings,
|
5770 + | expected.list_of_strings,
|
5771 + | "Unexpected value for `list_of_strings`"
|
5772 + | );
|
5773 + | ::pretty_assertions::assert_eq!(
|
5774 + | input.list_of_structs,
|
5775 + | expected.list_of_structs,
|
5776 + | "Unexpected value for `list_of_structs`"
|
5777 + | );
|
5778 + | ::pretty_assertions::assert_eq!(
|
5779 + | input.long,
|
5780 + | expected.long,
|
5781 + | "Unexpected value for `long`"
|
5782 + | );
|
5783 + | ::pretty_assertions::assert_eq!(
|
5784 + | input.map_of_lists_of_strings,
|
5785 + | expected.map_of_lists_of_strings,
|
5786 + | "Unexpected value for `map_of_lists_of_strings`"
|
5787 + | );
|
5788 + | ::pretty_assertions::assert_eq!(
|
5789 + | input.map_of_maps,
|
5790 + | expected.map_of_maps,
|
5791 + | "Unexpected value for `map_of_maps`"
|
5792 + | );
|
5793 + | ::pretty_assertions::assert_eq!(
|
5794 + | input.map_of_strings,
|
5795 + | expected.map_of_strings,
|
5796 + | "Unexpected value for `map_of_strings`"
|
5797 + | );
|
5798 + | ::pretty_assertions::assert_eq!(
|
5799 + | input.map_of_structs,
|
5800 + | expected.map_of_structs,
|
5801 + | "Unexpected value for `map_of_structs`"
|
5802 + | );
|
5803 + | ::pretty_assertions::assert_eq!(
|
5804 + | input.recursive_list,
|
5805 + | expected.recursive_list,
|
5806 + | "Unexpected value for `recursive_list`"
|
5807 + | );
|
5808 + | ::pretty_assertions::assert_eq!(
|
5809 + | input.recursive_map,
|
5810 + | expected.recursive_map,
|
5811 + | "Unexpected value for `recursive_map`"
|
5812 + | );
|
5813 + | ::pretty_assertions::assert_eq!(
|
5814 + | input.recursive_struct,
|
5815 + | expected.recursive_struct,
|
5816 + | "Unexpected value for `recursive_struct`"
|
5817 + | );
|
5818 + | ::pretty_assertions::assert_eq!(
|
5819 + | input.simple_struct,
|
5820 + | expected.simple_struct,
|
5821 + | "Unexpected value for `simple_struct`"
|
5822 + | );
|
5823 + | ::pretty_assertions::assert_eq!(
|
5824 + | input.string,
|
5825 + | expected.string,
|
5826 + | "Unexpected value for `string`"
|
5827 + | );
|
5828 + | ::pretty_assertions::assert_eq!(
|
5829 + | input.struct_with_json_name,
|
5830 + | expected.struct_with_json_name,
|
5831 + | "Unexpected value for `struct_with_json_name`"
|
5832 + | );
|
5833 + | ::pretty_assertions::assert_eq!(
|
5834 + | input.timestamp,
|
5835 + | expected.timestamp,
|
5836 + | "Unexpected value for `timestamp`"
|
5837 + | );
|
5838 + | ::pretty_assertions::assert_eq!(
|
5839 + | input.unix_timestamp,
|
5840 + | expected.unix_timestamp,
|
5841 + | "Unexpected value for `unix_timestamp`"
|
5842 + | );
|
5843 + | let output = crate::output::KitchenSinkOperationOutput {
|
5844 + | blob: ::std::option::Option::None,
|
5845 + | boolean: ::std::option::Option::None,
|
5846 + | double: ::std::option::Option::None,
|
5847 + | empty_struct: ::std::option::Option::None,
|
5848 + | float: ::std::option::Option::None,
|
5849 + | httpdate_timestamp: ::std::option::Option::None,
|
5850 + | integer: ::std::option::Option::None,
|
5851 + | iso8601_timestamp: ::std::option::Option::None,
|
5852 + | json_value: ::std::option::Option::None,
|
5853 + | list_of_lists: ::std::option::Option::None,
|
5854 + | list_of_maps_of_strings: ::std::option::Option::None,
|
5855 + | list_of_strings: ::std::option::Option::None,
|
5856 + | list_of_structs: ::std::option::Option::None,
|
5857 + | long: ::std::option::Option::None,
|
5858 + | map_of_lists_of_strings: ::std::option::Option::None,
|
5859 + | map_of_maps: ::std::option::Option::None,
|
5860 + | map_of_strings: ::std::option::Option::None,
|
5861 + | map_of_structs: ::std::option::Option::None,
|
5862 + | recursive_list: ::std::option::Option::None,
|
5863 + | recursive_map: ::std::option::Option::None,
|
5864 + | recursive_struct: ::std::option::Option::None,
|
5865 + | simple_struct: ::std::option::Option::None,
|
5866 + | string: ::std::option::Option::None,
|
5867 + | struct_with_json_name: ::std::option::Option::None,
|
5868 + | timestamp: ::std::option::Option::None,
|
5869 + | unix_timestamp: ::std::option::Option::None,
|
5870 + | };
|
5871 + | Ok(output)
|
5872 + | };
|
5873 + | sender.send(()).await.expect("receiver dropped early");
|
5874 + | result
|
5875 + | }
|
5876 + | })
|
5877 + | .build_unchecked();
|
5878 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5879 + | .await
|
5880 + | .expect("unable to make an HTTP request");
|
5881 + | assert!(
|
5882 + | receiver.recv().await.is_some(),
|
5883 + | "we expected operation handler to be invoked but it was not entered"
|
5884 + | );
|
5885 + | }
|
5886 + |
|
5887 + | /// Serializes timestamp shapes with iso8601 timestampFormat
|
5888 + | /// Test ID: serializes_timestamp_shapes_with_iso8601_timestampformat
|
5889 + | #[::tokio::test]
|
5890 + | #[::tracing_test::traced_test]
|
5891 + | async fn serializes_timestamp_shapes_with_iso8601_timestampformat_request() {
|
5892 + | #[allow(unused_mut)]
|
5893 + | let mut http_request = ::http::Request::builder()
|
5894 + | .uri("/")
|
5895 + | .method("POST")
|
5896 + | .header("Content-Type", "application/x-amz-json-1.1")
|
5897 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
5898 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
5899 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5900 + | "{\"Iso8601Timestamp\":\"2000-01-02T20:34:56Z\"}".as_bytes(),
|
5901 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
5902 + | )),
|
5903 + | ))
|
5904 + | .unwrap();
|
5905 + | #[allow(unused_mut)]
|
5906 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5907 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
5908 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
5909 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
5910 + | let sender = sender.clone();
|
5911 + | async move {
|
5912 + | let result = {
|
5913 + | use ::aws_smithy_protocol_test::FloatEquals;
|
5914 + | let expected = crate::input::KitchenSinkOperationInput {
|
5915 + | iso8601_timestamp: ::std::option::Option::Some(
|
5916 + | ::aws_smithy_types::DateTime::from_fractional_secs(
|
5917 + | 946845296, 0_f64,
|
5918 + | ),
|
5919 + | ),
|
5920 + | blob: ::std::option::Option::None,
|
5921 + | boolean: ::std::option::Option::None,
|
5922 + | double: ::std::option::Option::None,
|
5923 + | empty_struct: ::std::option::Option::None,
|
5924 + | float: ::std::option::Option::None,
|
5925 + | httpdate_timestamp: ::std::option::Option::None,
|
5926 + | integer: ::std::option::Option::None,
|
5927 + | json_value: ::std::option::Option::None,
|
5928 + | list_of_lists: ::std::option::Option::None,
|
5929 + | list_of_maps_of_strings: ::std::option::Option::None,
|
5930 + | list_of_strings: ::std::option::Option::None,
|
5931 + | list_of_structs: ::std::option::Option::None,
|
5932 + | long: ::std::option::Option::None,
|
5933 + | map_of_lists_of_strings: ::std::option::Option::None,
|
5934 + | map_of_maps: ::std::option::Option::None,
|
5935 + | map_of_strings: ::std::option::Option::None,
|
5936 + | map_of_structs: ::std::option::Option::None,
|
5937 + | recursive_list: ::std::option::Option::None,
|
5938 + | recursive_map: ::std::option::Option::None,
|
5939 + | recursive_struct: ::std::option::Option::None,
|
5940 + | simple_struct: ::std::option::Option::None,
|
5941 + | string: ::std::option::Option::None,
|
5942 + | struct_with_json_name: ::std::option::Option::None,
|
5943 + | timestamp: ::std::option::Option::None,
|
5944 + | unix_timestamp: ::std::option::Option::None,
|
5945 + | };
|
5946 + | ::pretty_assertions::assert_eq!(
|
5947 + | input.blob,
|
5948 + | expected.blob,
|
5949 + | "Unexpected value for `blob`"
|
5950 + | );
|
5951 + | ::pretty_assertions::assert_eq!(
|
5952 + | input.boolean,
|
5953 + | expected.boolean,
|
5954 + | "Unexpected value for `boolean`"
|
5955 + | );
|
5956 + | assert!(
|
5957 + | input.double.float_equals(&expected.double),
|
5958 + | "Unexpected value for `double` {:?} vs. {:?}",
|
5959 + | expected.double,
|
5960 + | input.double
|
5961 + | );
|
5962 + | ::pretty_assertions::assert_eq!(
|
5963 + | input.empty_struct,
|
5964 + | expected.empty_struct,
|
5965 + | "Unexpected value for `empty_struct`"
|
5966 + | );
|
5967 + | assert!(
|
5968 + | input.float.float_equals(&expected.float),
|
5969 + | "Unexpected value for `float` {:?} vs. {:?}",
|
5970 + | expected.float,
|
5971 + | input.float
|
5972 + | );
|
5973 + | ::pretty_assertions::assert_eq!(
|
5974 + | input.httpdate_timestamp,
|
5975 + | expected.httpdate_timestamp,
|
5976 + | "Unexpected value for `httpdate_timestamp`"
|
5977 + | );
|
5978 + | ::pretty_assertions::assert_eq!(
|
5979 + | input.integer,
|
5980 + | expected.integer,
|
5981 + | "Unexpected value for `integer`"
|
5982 + | );
|
5983 + | ::pretty_assertions::assert_eq!(
|
5984 + | input.iso8601_timestamp,
|
5985 + | expected.iso8601_timestamp,
|
5986 + | "Unexpected value for `iso8601_timestamp`"
|
5987 + | );
|
5988 + | ::pretty_assertions::assert_eq!(
|
5989 + | input.json_value,
|
5990 + | expected.json_value,
|
5991 + | "Unexpected value for `json_value`"
|
5992 + | );
|
5993 + | ::pretty_assertions::assert_eq!(
|
5994 + | input.list_of_lists,
|
5995 + | expected.list_of_lists,
|
5996 + | "Unexpected value for `list_of_lists`"
|
5997 + | );
|
5998 + | ::pretty_assertions::assert_eq!(
|
5999 + | input.list_of_maps_of_strings,
|
6000 + | expected.list_of_maps_of_strings,
|
6001 + | "Unexpected value for `list_of_maps_of_strings`"
|
6002 + | );
|
6003 + | ::pretty_assertions::assert_eq!(
|
6004 + | input.list_of_strings,
|
6005 + | expected.list_of_strings,
|
6006 + | "Unexpected value for `list_of_strings`"
|
6007 + | );
|
6008 + | ::pretty_assertions::assert_eq!(
|
6009 + | input.list_of_structs,
|
6010 + | expected.list_of_structs,
|
6011 + | "Unexpected value for `list_of_structs`"
|
6012 + | );
|
6013 + | ::pretty_assertions::assert_eq!(
|
6014 + | input.long,
|
6015 + | expected.long,
|
6016 + | "Unexpected value for `long`"
|
6017 + | );
|
6018 + | ::pretty_assertions::assert_eq!(
|
6019 + | input.map_of_lists_of_strings,
|
6020 + | expected.map_of_lists_of_strings,
|
6021 + | "Unexpected value for `map_of_lists_of_strings`"
|
6022 + | );
|
6023 + | ::pretty_assertions::assert_eq!(
|
6024 + | input.map_of_maps,
|
6025 + | expected.map_of_maps,
|
6026 + | "Unexpected value for `map_of_maps`"
|
6027 + | );
|
6028 + | ::pretty_assertions::assert_eq!(
|
6029 + | input.map_of_strings,
|
6030 + | expected.map_of_strings,
|
6031 + | "Unexpected value for `map_of_strings`"
|
6032 + | );
|
6033 + | ::pretty_assertions::assert_eq!(
|
6034 + | input.map_of_structs,
|
6035 + | expected.map_of_structs,
|
6036 + | "Unexpected value for `map_of_structs`"
|
6037 + | );
|
6038 + | ::pretty_assertions::assert_eq!(
|
6039 + | input.recursive_list,
|
6040 + | expected.recursive_list,
|
6041 + | "Unexpected value for `recursive_list`"
|
6042 + | );
|
6043 + | ::pretty_assertions::assert_eq!(
|
6044 + | input.recursive_map,
|
6045 + | expected.recursive_map,
|
6046 + | "Unexpected value for `recursive_map`"
|
6047 + | );
|
6048 + | ::pretty_assertions::assert_eq!(
|
6049 + | input.recursive_struct,
|
6050 + | expected.recursive_struct,
|
6051 + | "Unexpected value for `recursive_struct`"
|
6052 + | );
|
6053 + | ::pretty_assertions::assert_eq!(
|
6054 + | input.simple_struct,
|
6055 + | expected.simple_struct,
|
6056 + | "Unexpected value for `simple_struct`"
|
6057 + | );
|
6058 + | ::pretty_assertions::assert_eq!(
|
6059 + | input.string,
|
6060 + | expected.string,
|
6061 + | "Unexpected value for `string`"
|
6062 + | );
|
6063 + | ::pretty_assertions::assert_eq!(
|
6064 + | input.struct_with_json_name,
|
6065 + | expected.struct_with_json_name,
|
6066 + | "Unexpected value for `struct_with_json_name`"
|
6067 + | );
|
6068 + | ::pretty_assertions::assert_eq!(
|
6069 + | input.timestamp,
|
6070 + | expected.timestamp,
|
6071 + | "Unexpected value for `timestamp`"
|
6072 + | );
|
6073 + | ::pretty_assertions::assert_eq!(
|
6074 + | input.unix_timestamp,
|
6075 + | expected.unix_timestamp,
|
6076 + | "Unexpected value for `unix_timestamp`"
|
6077 + | );
|
6078 + | let output = crate::output::KitchenSinkOperationOutput {
|
6079 + | blob: ::std::option::Option::None,
|
6080 + | boolean: ::std::option::Option::None,
|
6081 + | double: ::std::option::Option::None,
|
6082 + | empty_struct: ::std::option::Option::None,
|
6083 + | float: ::std::option::Option::None,
|
6084 + | httpdate_timestamp: ::std::option::Option::None,
|
6085 + | integer: ::std::option::Option::None,
|
6086 + | iso8601_timestamp: ::std::option::Option::None,
|
6087 + | json_value: ::std::option::Option::None,
|
6088 + | list_of_lists: ::std::option::Option::None,
|
6089 + | list_of_maps_of_strings: ::std::option::Option::None,
|
6090 + | list_of_strings: ::std::option::Option::None,
|
6091 + | list_of_structs: ::std::option::Option::None,
|
6092 + | long: ::std::option::Option::None,
|
6093 + | map_of_lists_of_strings: ::std::option::Option::None,
|
6094 + | map_of_maps: ::std::option::Option::None,
|
6095 + | map_of_strings: ::std::option::Option::None,
|
6096 + | map_of_structs: ::std::option::Option::None,
|
6097 + | recursive_list: ::std::option::Option::None,
|
6098 + | recursive_map: ::std::option::Option::None,
|
6099 + | recursive_struct: ::std::option::Option::None,
|
6100 + | simple_struct: ::std::option::Option::None,
|
6101 + | string: ::std::option::Option::None,
|
6102 + | struct_with_json_name: ::std::option::Option::None,
|
6103 + | timestamp: ::std::option::Option::None,
|
6104 + | unix_timestamp: ::std::option::Option::None,
|
6105 + | };
|
6106 + | Ok(output)
|
6107 + | };
|
6108 + | sender.send(()).await.expect("receiver dropped early");
|
6109 + | result
|
6110 + | }
|
6111 + | })
|
6112 + | .build_unchecked();
|
6113 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6114 + | .await
|
6115 + | .expect("unable to make an HTTP request");
|
6116 + | assert!(
|
6117 + | receiver.recv().await.is_some(),
|
6118 + | "we expected operation handler to be invoked but it was not entered"
|
6119 + | );
|
6120 + | }
|
6121 + |
|
6122 + | /// Serializes timestamp shapes with httpdate timestampFormat
|
6123 + | /// Test ID: serializes_timestamp_shapes_with_httpdate_timestampformat
|
6124 + | #[::tokio::test]
|
6125 + | #[::tracing_test::traced_test]
|
6126 + | async fn serializes_timestamp_shapes_with_httpdate_timestampformat_request() {
|
6127 + | #[allow(unused_mut)]
|
6128 + | let mut http_request = ::http::Request::builder()
|
6129 + | .uri("/")
|
6130 + | .method("POST")
|
6131 + | .header("Content-Type", "application/x-amz-json-1.1")
|
6132 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
6133 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
6134 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6135 + | "{\"HttpdateTimestamp\":\"Sun, 02 Jan 2000 20:34:56 GMT\"}".as_bytes(),
|
6136 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
6137 + | )),
|
6138 + | ))
|
6139 + | .unwrap();
|
6140 + | #[allow(unused_mut)]
|
6141 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6142 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
6143 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
6144 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
6145 + | let sender = sender.clone();
|
6146 + | async move {
|
6147 + | let result = {
|
6148 + | use ::aws_smithy_protocol_test::FloatEquals;
|
6149 + | let expected = crate::input::KitchenSinkOperationInput {
|
6150 + | httpdate_timestamp: ::std::option::Option::Some(
|
6151 + | ::aws_smithy_types::DateTime::from_fractional_secs(
|
6152 + | 946845296, 0_f64,
|
6153 + | ),
|
6154 + | ),
|
6155 + | blob: ::std::option::Option::None,
|
6156 + | boolean: ::std::option::Option::None,
|
6157 + | double: ::std::option::Option::None,
|
6158 + | empty_struct: ::std::option::Option::None,
|
6159 + | float: ::std::option::Option::None,
|
6160 + | integer: ::std::option::Option::None,
|
6161 + | iso8601_timestamp: ::std::option::Option::None,
|
6162 + | json_value: ::std::option::Option::None,
|
6163 + | list_of_lists: ::std::option::Option::None,
|
6164 + | list_of_maps_of_strings: ::std::option::Option::None,
|
6165 + | list_of_strings: ::std::option::Option::None,
|
6166 + | list_of_structs: ::std::option::Option::None,
|
6167 + | long: ::std::option::Option::None,
|
6168 + | map_of_lists_of_strings: ::std::option::Option::None,
|
6169 + | map_of_maps: ::std::option::Option::None,
|
6170 + | map_of_strings: ::std::option::Option::None,
|
6171 + | map_of_structs: ::std::option::Option::None,
|
6172 + | recursive_list: ::std::option::Option::None,
|
6173 + | recursive_map: ::std::option::Option::None,
|
6174 + | recursive_struct: ::std::option::Option::None,
|
6175 + | simple_struct: ::std::option::Option::None,
|
6176 + | string: ::std::option::Option::None,
|
6177 + | struct_with_json_name: ::std::option::Option::None,
|
6178 + | timestamp: ::std::option::Option::None,
|
6179 + | unix_timestamp: ::std::option::Option::None,
|
6180 + | };
|
6181 + | ::pretty_assertions::assert_eq!(
|
6182 + | input.blob,
|
6183 + | expected.blob,
|
6184 + | "Unexpected value for `blob`"
|
6185 + | );
|
6186 + | ::pretty_assertions::assert_eq!(
|
6187 + | input.boolean,
|
6188 + | expected.boolean,
|
6189 + | "Unexpected value for `boolean`"
|
6190 + | );
|
6191 + | assert!(
|
6192 + | input.double.float_equals(&expected.double),
|
6193 + | "Unexpected value for `double` {:?} vs. {:?}",
|
6194 + | expected.double,
|
6195 + | input.double
|
6196 + | );
|
6197 + | ::pretty_assertions::assert_eq!(
|
6198 + | input.empty_struct,
|
6199 + | expected.empty_struct,
|
6200 + | "Unexpected value for `empty_struct`"
|
6201 + | );
|
6202 + | assert!(
|
6203 + | input.float.float_equals(&expected.float),
|
6204 + | "Unexpected value for `float` {:?} vs. {:?}",
|
6205 + | expected.float,
|
6206 + | input.float
|
6207 + | );
|
6208 + | ::pretty_assertions::assert_eq!(
|
6209 + | input.httpdate_timestamp,
|
6210 + | expected.httpdate_timestamp,
|
6211 + | "Unexpected value for `httpdate_timestamp`"
|
6212 + | );
|
6213 + | ::pretty_assertions::assert_eq!(
|
6214 + | input.integer,
|
6215 + | expected.integer,
|
6216 + | "Unexpected value for `integer`"
|
6217 + | );
|
6218 + | ::pretty_assertions::assert_eq!(
|
6219 + | input.iso8601_timestamp,
|
6220 + | expected.iso8601_timestamp,
|
6221 + | "Unexpected value for `iso8601_timestamp`"
|
6222 + | );
|
6223 + | ::pretty_assertions::assert_eq!(
|
6224 + | input.json_value,
|
6225 + | expected.json_value,
|
6226 + | "Unexpected value for `json_value`"
|
6227 + | );
|
6228 + | ::pretty_assertions::assert_eq!(
|
6229 + | input.list_of_lists,
|
6230 + | expected.list_of_lists,
|
6231 + | "Unexpected value for `list_of_lists`"
|
6232 + | );
|
6233 + | ::pretty_assertions::assert_eq!(
|
6234 + | input.list_of_maps_of_strings,
|
6235 + | expected.list_of_maps_of_strings,
|
6236 + | "Unexpected value for `list_of_maps_of_strings`"
|
6237 + | );
|
6238 + | ::pretty_assertions::assert_eq!(
|
6239 + | input.list_of_strings,
|
6240 + | expected.list_of_strings,
|
6241 + | "Unexpected value for `list_of_strings`"
|
6242 + | );
|
6243 + | ::pretty_assertions::assert_eq!(
|
6244 + | input.list_of_structs,
|
6245 + | expected.list_of_structs,
|
6246 + | "Unexpected value for `list_of_structs`"
|
6247 + | );
|
6248 + | ::pretty_assertions::assert_eq!(
|
6249 + | input.long,
|
6250 + | expected.long,
|
6251 + | "Unexpected value for `long`"
|
6252 + | );
|
6253 + | ::pretty_assertions::assert_eq!(
|
6254 + | input.map_of_lists_of_strings,
|
6255 + | expected.map_of_lists_of_strings,
|
6256 + | "Unexpected value for `map_of_lists_of_strings`"
|
6257 + | );
|
6258 + | ::pretty_assertions::assert_eq!(
|
6259 + | input.map_of_maps,
|
6260 + | expected.map_of_maps,
|
6261 + | "Unexpected value for `map_of_maps`"
|
6262 + | );
|
6263 + | ::pretty_assertions::assert_eq!(
|
6264 + | input.map_of_strings,
|
6265 + | expected.map_of_strings,
|
6266 + | "Unexpected value for `map_of_strings`"
|
6267 + | );
|
6268 + | ::pretty_assertions::assert_eq!(
|
6269 + | input.map_of_structs,
|
6270 + | expected.map_of_structs,
|
6271 + | "Unexpected value for `map_of_structs`"
|
6272 + | );
|
6273 + | ::pretty_assertions::assert_eq!(
|
6274 + | input.recursive_list,
|
6275 + | expected.recursive_list,
|
6276 + | "Unexpected value for `recursive_list`"
|
6277 + | );
|
6278 + | ::pretty_assertions::assert_eq!(
|
6279 + | input.recursive_map,
|
6280 + | expected.recursive_map,
|
6281 + | "Unexpected value for `recursive_map`"
|
6282 + | );
|
6283 + | ::pretty_assertions::assert_eq!(
|
6284 + | input.recursive_struct,
|
6285 + | expected.recursive_struct,
|
6286 + | "Unexpected value for `recursive_struct`"
|
6287 + | );
|
6288 + | ::pretty_assertions::assert_eq!(
|
6289 + | input.simple_struct,
|
6290 + | expected.simple_struct,
|
6291 + | "Unexpected value for `simple_struct`"
|
6292 + | );
|
6293 + | ::pretty_assertions::assert_eq!(
|
6294 + | input.string,
|
6295 + | expected.string,
|
6296 + | "Unexpected value for `string`"
|
6297 + | );
|
6298 + | ::pretty_assertions::assert_eq!(
|
6299 + | input.struct_with_json_name,
|
6300 + | expected.struct_with_json_name,
|
6301 + | "Unexpected value for `struct_with_json_name`"
|
6302 + | );
|
6303 + | ::pretty_assertions::assert_eq!(
|
6304 + | input.timestamp,
|
6305 + | expected.timestamp,
|
6306 + | "Unexpected value for `timestamp`"
|
6307 + | );
|
6308 + | ::pretty_assertions::assert_eq!(
|
6309 + | input.unix_timestamp,
|
6310 + | expected.unix_timestamp,
|
6311 + | "Unexpected value for `unix_timestamp`"
|
6312 + | );
|
6313 + | let output = crate::output::KitchenSinkOperationOutput {
|
6314 + | blob: ::std::option::Option::None,
|
6315 + | boolean: ::std::option::Option::None,
|
6316 + | double: ::std::option::Option::None,
|
6317 + | empty_struct: ::std::option::Option::None,
|
6318 + | float: ::std::option::Option::None,
|
6319 + | httpdate_timestamp: ::std::option::Option::None,
|
6320 + | integer: ::std::option::Option::None,
|
6321 + | iso8601_timestamp: ::std::option::Option::None,
|
6322 + | json_value: ::std::option::Option::None,
|
6323 + | list_of_lists: ::std::option::Option::None,
|
6324 + | list_of_maps_of_strings: ::std::option::Option::None,
|
6325 + | list_of_strings: ::std::option::Option::None,
|
6326 + | list_of_structs: ::std::option::Option::None,
|
6327 + | long: ::std::option::Option::None,
|
6328 + | map_of_lists_of_strings: ::std::option::Option::None,
|
6329 + | map_of_maps: ::std::option::Option::None,
|
6330 + | map_of_strings: ::std::option::Option::None,
|
6331 + | map_of_structs: ::std::option::Option::None,
|
6332 + | recursive_list: ::std::option::Option::None,
|
6333 + | recursive_map: ::std::option::Option::None,
|
6334 + | recursive_struct: ::std::option::Option::None,
|
6335 + | simple_struct: ::std::option::Option::None,
|
6336 + | string: ::std::option::Option::None,
|
6337 + | struct_with_json_name: ::std::option::Option::None,
|
6338 + | timestamp: ::std::option::Option::None,
|
6339 + | unix_timestamp: ::std::option::Option::None,
|
6340 + | };
|
6341 + | Ok(output)
|
6342 + | };
|
6343 + | sender.send(()).await.expect("receiver dropped early");
|
6344 + | result
|
6345 + | }
|
6346 + | })
|
6347 + | .build_unchecked();
|
6348 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6349 + | .await
|
6350 + | .expect("unable to make an HTTP request");
|
6351 + | assert!(
|
6352 + | receiver.recv().await.is_some(),
|
6353 + | "we expected operation handler to be invoked but it was not entered"
|
6354 + | );
|
6355 + | }
|
6356 + |
|
6357 + | /// Serializes timestamp shapes with unixTimestamp timestampFormat
|
6358 + | /// Test ID: serializes_timestamp_shapes_with_unixtimestamp_timestampformat
|
6359 + | #[::tokio::test]
|
6360 + | #[::tracing_test::traced_test]
|
6361 + | async fn serializes_timestamp_shapes_with_unixtimestamp_timestampformat_request() {
|
6362 + | #[allow(unused_mut)]
|
6363 + | let mut http_request = ::http::Request::builder()
|
6364 + | .uri("/")
|
6365 + | .method("POST")
|
6366 + | .header("Content-Type", "application/x-amz-json-1.1")
|
6367 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
6368 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
6369 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6370 + | "{\"UnixTimestamp\":946845296}".as_bytes(),
|
6371 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
6372 + | )),
|
6373 + | ))
|
6374 + | .unwrap();
|
6375 + | #[allow(unused_mut)]
|
6376 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6377 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
6378 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
6379 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
6380 + | let sender = sender.clone();
|
6381 + | async move {
|
6382 + | let result = {
|
6383 + | use ::aws_smithy_protocol_test::FloatEquals;
|
6384 + | let expected = crate::input::KitchenSinkOperationInput {
|
6385 + | unix_timestamp: ::std::option::Option::Some(
|
6386 + | ::aws_smithy_types::DateTime::from_fractional_secs(
|
6387 + | 946845296, 0_f64,
|
6388 + | ),
|
6389 + | ),
|
6390 + | blob: ::std::option::Option::None,
|
6391 + | boolean: ::std::option::Option::None,
|
6392 + | double: ::std::option::Option::None,
|
6393 + | empty_struct: ::std::option::Option::None,
|
6394 + | float: ::std::option::Option::None,
|
6395 + | httpdate_timestamp: ::std::option::Option::None,
|
6396 + | integer: ::std::option::Option::None,
|
6397 + | iso8601_timestamp: ::std::option::Option::None,
|
6398 + | json_value: ::std::option::Option::None,
|
6399 + | list_of_lists: ::std::option::Option::None,
|
6400 + | list_of_maps_of_strings: ::std::option::Option::None,
|
6401 + | list_of_strings: ::std::option::Option::None,
|
6402 + | list_of_structs: ::std::option::Option::None,
|
6403 + | long: ::std::option::Option::None,
|
6404 + | map_of_lists_of_strings: ::std::option::Option::None,
|
6405 + | map_of_maps: ::std::option::Option::None,
|
6406 + | map_of_strings: ::std::option::Option::None,
|
6407 + | map_of_structs: ::std::option::Option::None,
|
6408 + | recursive_list: ::std::option::Option::None,
|
6409 + | recursive_map: ::std::option::Option::None,
|
6410 + | recursive_struct: ::std::option::Option::None,
|
6411 + | simple_struct: ::std::option::Option::None,
|
6412 + | string: ::std::option::Option::None,
|
6413 + | struct_with_json_name: ::std::option::Option::None,
|
6414 + | timestamp: ::std::option::Option::None,
|
6415 + | };
|
6416 + | ::pretty_assertions::assert_eq!(
|
6417 + | input.blob,
|
6418 + | expected.blob,
|
6419 + | "Unexpected value for `blob`"
|
6420 + | );
|
6421 + | ::pretty_assertions::assert_eq!(
|
6422 + | input.boolean,
|
6423 + | expected.boolean,
|
6424 + | "Unexpected value for `boolean`"
|
6425 + | );
|
6426 + | assert!(
|
6427 + | input.double.float_equals(&expected.double),
|
6428 + | "Unexpected value for `double` {:?} vs. {:?}",
|
6429 + | expected.double,
|
6430 + | input.double
|
6431 + | );
|
6432 + | ::pretty_assertions::assert_eq!(
|
6433 + | input.empty_struct,
|
6434 + | expected.empty_struct,
|
6435 + | "Unexpected value for `empty_struct`"
|
6436 + | );
|
6437 + | assert!(
|
6438 + | input.float.float_equals(&expected.float),
|
6439 + | "Unexpected value for `float` {:?} vs. {:?}",
|
6440 + | expected.float,
|
6441 + | input.float
|
6442 + | );
|
6443 + | ::pretty_assertions::assert_eq!(
|
6444 + | input.httpdate_timestamp,
|
6445 + | expected.httpdate_timestamp,
|
6446 + | "Unexpected value for `httpdate_timestamp`"
|
6447 + | );
|
6448 + | ::pretty_assertions::assert_eq!(
|
6449 + | input.integer,
|
6450 + | expected.integer,
|
6451 + | "Unexpected value for `integer`"
|
6452 + | );
|
6453 + | ::pretty_assertions::assert_eq!(
|
6454 + | input.iso8601_timestamp,
|
6455 + | expected.iso8601_timestamp,
|
6456 + | "Unexpected value for `iso8601_timestamp`"
|
6457 + | );
|
6458 + | ::pretty_assertions::assert_eq!(
|
6459 + | input.json_value,
|
6460 + | expected.json_value,
|
6461 + | "Unexpected value for `json_value`"
|
6462 + | );
|
6463 + | ::pretty_assertions::assert_eq!(
|
6464 + | input.list_of_lists,
|
6465 + | expected.list_of_lists,
|
6466 + | "Unexpected value for `list_of_lists`"
|
6467 + | );
|
6468 + | ::pretty_assertions::assert_eq!(
|
6469 + | input.list_of_maps_of_strings,
|
6470 + | expected.list_of_maps_of_strings,
|
6471 + | "Unexpected value for `list_of_maps_of_strings`"
|
6472 + | );
|
6473 + | ::pretty_assertions::assert_eq!(
|
6474 + | input.list_of_strings,
|
6475 + | expected.list_of_strings,
|
6476 + | "Unexpected value for `list_of_strings`"
|
6477 + | );
|
6478 + | ::pretty_assertions::assert_eq!(
|
6479 + | input.list_of_structs,
|
6480 + | expected.list_of_structs,
|
6481 + | "Unexpected value for `list_of_structs`"
|
6482 + | );
|
6483 + | ::pretty_assertions::assert_eq!(
|
6484 + | input.long,
|
6485 + | expected.long,
|
6486 + | "Unexpected value for `long`"
|
6487 + | );
|
6488 + | ::pretty_assertions::assert_eq!(
|
6489 + | input.map_of_lists_of_strings,
|
6490 + | expected.map_of_lists_of_strings,
|
6491 + | "Unexpected value for `map_of_lists_of_strings`"
|
6492 + | );
|
6493 + | ::pretty_assertions::assert_eq!(
|
6494 + | input.map_of_maps,
|
6495 + | expected.map_of_maps,
|
6496 + | "Unexpected value for `map_of_maps`"
|
6497 + | );
|
6498 + | ::pretty_assertions::assert_eq!(
|
6499 + | input.map_of_strings,
|
6500 + | expected.map_of_strings,
|
6501 + | "Unexpected value for `map_of_strings`"
|
6502 + | );
|
6503 + | ::pretty_assertions::assert_eq!(
|
6504 + | input.map_of_structs,
|
6505 + | expected.map_of_structs,
|
6506 + | "Unexpected value for `map_of_structs`"
|
6507 + | );
|
6508 + | ::pretty_assertions::assert_eq!(
|
6509 + | input.recursive_list,
|
6510 + | expected.recursive_list,
|
6511 + | "Unexpected value for `recursive_list`"
|
6512 + | );
|
6513 + | ::pretty_assertions::assert_eq!(
|
6514 + | input.recursive_map,
|
6515 + | expected.recursive_map,
|
6516 + | "Unexpected value for `recursive_map`"
|
6517 + | );
|
6518 + | ::pretty_assertions::assert_eq!(
|
6519 + | input.recursive_struct,
|
6520 + | expected.recursive_struct,
|
6521 + | "Unexpected value for `recursive_struct`"
|
6522 + | );
|
6523 + | ::pretty_assertions::assert_eq!(
|
6524 + | input.simple_struct,
|
6525 + | expected.simple_struct,
|
6526 + | "Unexpected value for `simple_struct`"
|
6527 + | );
|
6528 + | ::pretty_assertions::assert_eq!(
|
6529 + | input.string,
|
6530 + | expected.string,
|
6531 + | "Unexpected value for `string`"
|
6532 + | );
|
6533 + | ::pretty_assertions::assert_eq!(
|
6534 + | input.struct_with_json_name,
|
6535 + | expected.struct_with_json_name,
|
6536 + | "Unexpected value for `struct_with_json_name`"
|
6537 + | );
|
6538 + | ::pretty_assertions::assert_eq!(
|
6539 + | input.timestamp,
|
6540 + | expected.timestamp,
|
6541 + | "Unexpected value for `timestamp`"
|
6542 + | );
|
6543 + | ::pretty_assertions::assert_eq!(
|
6544 + | input.unix_timestamp,
|
6545 + | expected.unix_timestamp,
|
6546 + | "Unexpected value for `unix_timestamp`"
|
6547 + | );
|
6548 + | let output = crate::output::KitchenSinkOperationOutput {
|
6549 + | blob: ::std::option::Option::None,
|
6550 + | boolean: ::std::option::Option::None,
|
6551 + | double: ::std::option::Option::None,
|
6552 + | empty_struct: ::std::option::Option::None,
|
6553 + | float: ::std::option::Option::None,
|
6554 + | httpdate_timestamp: ::std::option::Option::None,
|
6555 + | integer: ::std::option::Option::None,
|
6556 + | iso8601_timestamp: ::std::option::Option::None,
|
6557 + | json_value: ::std::option::Option::None,
|
6558 + | list_of_lists: ::std::option::Option::None,
|
6559 + | list_of_maps_of_strings: ::std::option::Option::None,
|
6560 + | list_of_strings: ::std::option::Option::None,
|
6561 + | list_of_structs: ::std::option::Option::None,
|
6562 + | long: ::std::option::Option::None,
|
6563 + | map_of_lists_of_strings: ::std::option::Option::None,
|
6564 + | map_of_maps: ::std::option::Option::None,
|
6565 + | map_of_strings: ::std::option::Option::None,
|
6566 + | map_of_structs: ::std::option::Option::None,
|
6567 + | recursive_list: ::std::option::Option::None,
|
6568 + | recursive_map: ::std::option::Option::None,
|
6569 + | recursive_struct: ::std::option::Option::None,
|
6570 + | simple_struct: ::std::option::Option::None,
|
6571 + | string: ::std::option::Option::None,
|
6572 + | struct_with_json_name: ::std::option::Option::None,
|
6573 + | timestamp: ::std::option::Option::None,
|
6574 + | unix_timestamp: ::std::option::Option::None,
|
6575 + | };
|
6576 + | Ok(output)
|
6577 + | };
|
6578 + | sender.send(()).await.expect("receiver dropped early");
|
6579 + | result
|
6580 + | }
|
6581 + | })
|
6582 + | .build_unchecked();
|
6583 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6584 + | .await
|
6585 + | .expect("unable to make an HTTP request");
|
6586 + | assert!(
|
6587 + | receiver.recv().await.is_some(),
|
6588 + | "we expected operation handler to be invoked but it was not entered"
|
6589 + | );
|
6590 + | }
|
6591 + |
|
6592 + | /// Serializes list shapes
|
6593 + | /// Test ID: serializes_list_shapes
|
6594 + | #[::tokio::test]
|
6595 + | #[::tracing_test::traced_test]
|
6596 + | async fn serializes_list_shapes_request() {
|
6597 + | #[allow(unused_mut)]
|
6598 + | let mut http_request = ::http::Request::builder()
|
6599 + | .uri("/")
|
6600 + | .method("POST")
|
6601 + | .header("Content-Type", "application/x-amz-json-1.1")
|
6602 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
6603 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
6604 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6605 + | "{\"ListOfStrings\":[\"abc\",\"mno\",\"xyz\"]}".as_bytes(),
|
6606 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
6607 + | )),
|
6608 + | ))
|
6609 + | .unwrap();
|
6610 + | #[allow(unused_mut)]
|
6611 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6612 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
6613 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
6614 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
6615 + | let sender = sender.clone();
|
6616 + | async move {
|
6617 + | let result = {
|
6618 + | use ::aws_smithy_protocol_test::FloatEquals;
|
6619 + | let expected = crate::input::KitchenSinkOperationInput {
|
6620 + | list_of_strings: ::std::option::Option::Some(vec![
|
6621 + | "abc".to_owned(),
|
6622 + | "mno".to_owned(),
|
6623 + | "xyz".to_owned(),
|
6624 + | ]),
|
6625 + | blob: ::std::option::Option::None,
|
6626 + | boolean: ::std::option::Option::None,
|
6627 + | double: ::std::option::Option::None,
|
6628 + | empty_struct: ::std::option::Option::None,
|
6629 + | float: ::std::option::Option::None,
|
6630 + | httpdate_timestamp: ::std::option::Option::None,
|
6631 + | integer: ::std::option::Option::None,
|
6632 + | iso8601_timestamp: ::std::option::Option::None,
|
6633 + | json_value: ::std::option::Option::None,
|
6634 + | list_of_lists: ::std::option::Option::None,
|
6635 + | list_of_maps_of_strings: ::std::option::Option::None,
|
6636 + | list_of_structs: ::std::option::Option::None,
|
6637 + | long: ::std::option::Option::None,
|
6638 + | map_of_lists_of_strings: ::std::option::Option::None,
|
6639 + | map_of_maps: ::std::option::Option::None,
|
6640 + | map_of_strings: ::std::option::Option::None,
|
6641 + | map_of_structs: ::std::option::Option::None,
|
6642 + | recursive_list: ::std::option::Option::None,
|
6643 + | recursive_map: ::std::option::Option::None,
|
6644 + | recursive_struct: ::std::option::Option::None,
|
6645 + | simple_struct: ::std::option::Option::None,
|
6646 + | string: ::std::option::Option::None,
|
6647 + | struct_with_json_name: ::std::option::Option::None,
|
6648 + | timestamp: ::std::option::Option::None,
|
6649 + | unix_timestamp: ::std::option::Option::None,
|
6650 + | };
|
6651 + | ::pretty_assertions::assert_eq!(
|
6652 + | input.blob,
|
6653 + | expected.blob,
|
6654 + | "Unexpected value for `blob`"
|
6655 + | );
|
6656 + | ::pretty_assertions::assert_eq!(
|
6657 + | input.boolean,
|
6658 + | expected.boolean,
|
6659 + | "Unexpected value for `boolean`"
|
6660 + | );
|
6661 + | assert!(
|
6662 + | input.double.float_equals(&expected.double),
|
6663 + | "Unexpected value for `double` {:?} vs. {:?}",
|
6664 + | expected.double,
|
6665 + | input.double
|
6666 + | );
|
6667 + | ::pretty_assertions::assert_eq!(
|
6668 + | input.empty_struct,
|
6669 + | expected.empty_struct,
|
6670 + | "Unexpected value for `empty_struct`"
|
6671 + | );
|
6672 + | assert!(
|
6673 + | input.float.float_equals(&expected.float),
|
6674 + | "Unexpected value for `float` {:?} vs. {:?}",
|
6675 + | expected.float,
|
6676 + | input.float
|
6677 + | );
|
6678 + | ::pretty_assertions::assert_eq!(
|
6679 + | input.httpdate_timestamp,
|
6680 + | expected.httpdate_timestamp,
|
6681 + | "Unexpected value for `httpdate_timestamp`"
|
6682 + | );
|
6683 + | ::pretty_assertions::assert_eq!(
|
6684 + | input.integer,
|
6685 + | expected.integer,
|
6686 + | "Unexpected value for `integer`"
|
6687 + | );
|
6688 + | ::pretty_assertions::assert_eq!(
|
6689 + | input.iso8601_timestamp,
|
6690 + | expected.iso8601_timestamp,
|
6691 + | "Unexpected value for `iso8601_timestamp`"
|
6692 + | );
|
6693 + | ::pretty_assertions::assert_eq!(
|
6694 + | input.json_value,
|
6695 + | expected.json_value,
|
6696 + | "Unexpected value for `json_value`"
|
6697 + | );
|
6698 + | ::pretty_assertions::assert_eq!(
|
6699 + | input.list_of_lists,
|
6700 + | expected.list_of_lists,
|
6701 + | "Unexpected value for `list_of_lists`"
|
6702 + | );
|
6703 + | ::pretty_assertions::assert_eq!(
|
6704 + | input.list_of_maps_of_strings,
|
6705 + | expected.list_of_maps_of_strings,
|
6706 + | "Unexpected value for `list_of_maps_of_strings`"
|
6707 + | );
|
6708 + | ::pretty_assertions::assert_eq!(
|
6709 + | input.list_of_strings,
|
6710 + | expected.list_of_strings,
|
6711 + | "Unexpected value for `list_of_strings`"
|
6712 + | );
|
6713 + | ::pretty_assertions::assert_eq!(
|
6714 + | input.list_of_structs,
|
6715 + | expected.list_of_structs,
|
6716 + | "Unexpected value for `list_of_structs`"
|
6717 + | );
|
6718 + | ::pretty_assertions::assert_eq!(
|
6719 + | input.long,
|
6720 + | expected.long,
|
6721 + | "Unexpected value for `long`"
|
6722 + | );
|
6723 + | ::pretty_assertions::assert_eq!(
|
6724 + | input.map_of_lists_of_strings,
|
6725 + | expected.map_of_lists_of_strings,
|
6726 + | "Unexpected value for `map_of_lists_of_strings`"
|
6727 + | );
|
6728 + | ::pretty_assertions::assert_eq!(
|
6729 + | input.map_of_maps,
|
6730 + | expected.map_of_maps,
|
6731 + | "Unexpected value for `map_of_maps`"
|
6732 + | );
|
6733 + | ::pretty_assertions::assert_eq!(
|
6734 + | input.map_of_strings,
|
6735 + | expected.map_of_strings,
|
6736 + | "Unexpected value for `map_of_strings`"
|
6737 + | );
|
6738 + | ::pretty_assertions::assert_eq!(
|
6739 + | input.map_of_structs,
|
6740 + | expected.map_of_structs,
|
6741 + | "Unexpected value for `map_of_structs`"
|
6742 + | );
|
6743 + | ::pretty_assertions::assert_eq!(
|
6744 + | input.recursive_list,
|
6745 + | expected.recursive_list,
|
6746 + | "Unexpected value for `recursive_list`"
|
6747 + | );
|
6748 + | ::pretty_assertions::assert_eq!(
|
6749 + | input.recursive_map,
|
6750 + | expected.recursive_map,
|
6751 + | "Unexpected value for `recursive_map`"
|
6752 + | );
|
6753 + | ::pretty_assertions::assert_eq!(
|
6754 + | input.recursive_struct,
|
6755 + | expected.recursive_struct,
|
6756 + | "Unexpected value for `recursive_struct`"
|
6757 + | );
|
6758 + | ::pretty_assertions::assert_eq!(
|
6759 + | input.simple_struct,
|
6760 + | expected.simple_struct,
|
6761 + | "Unexpected value for `simple_struct`"
|
6762 + | );
|
6763 + | ::pretty_assertions::assert_eq!(
|
6764 + | input.string,
|
6765 + | expected.string,
|
6766 + | "Unexpected value for `string`"
|
6767 + | );
|
6768 + | ::pretty_assertions::assert_eq!(
|
6769 + | input.struct_with_json_name,
|
6770 + | expected.struct_with_json_name,
|
6771 + | "Unexpected value for `struct_with_json_name`"
|
6772 + | );
|
6773 + | ::pretty_assertions::assert_eq!(
|
6774 + | input.timestamp,
|
6775 + | expected.timestamp,
|
6776 + | "Unexpected value for `timestamp`"
|
6777 + | );
|
6778 + | ::pretty_assertions::assert_eq!(
|
6779 + | input.unix_timestamp,
|
6780 + | expected.unix_timestamp,
|
6781 + | "Unexpected value for `unix_timestamp`"
|
6782 + | );
|
6783 + | let output = crate::output::KitchenSinkOperationOutput {
|
6784 + | blob: ::std::option::Option::None,
|
6785 + | boolean: ::std::option::Option::None,
|
6786 + | double: ::std::option::Option::None,
|
6787 + | empty_struct: ::std::option::Option::None,
|
6788 + | float: ::std::option::Option::None,
|
6789 + | httpdate_timestamp: ::std::option::Option::None,
|
6790 + | integer: ::std::option::Option::None,
|
6791 + | iso8601_timestamp: ::std::option::Option::None,
|
6792 + | json_value: ::std::option::Option::None,
|
6793 + | list_of_lists: ::std::option::Option::None,
|
6794 + | list_of_maps_of_strings: ::std::option::Option::None,
|
6795 + | list_of_strings: ::std::option::Option::None,
|
6796 + | list_of_structs: ::std::option::Option::None,
|
6797 + | long: ::std::option::Option::None,
|
6798 + | map_of_lists_of_strings: ::std::option::Option::None,
|
6799 + | map_of_maps: ::std::option::Option::None,
|
6800 + | map_of_strings: ::std::option::Option::None,
|
6801 + | map_of_structs: ::std::option::Option::None,
|
6802 + | recursive_list: ::std::option::Option::None,
|
6803 + | recursive_map: ::std::option::Option::None,
|
6804 + | recursive_struct: ::std::option::Option::None,
|
6805 + | simple_struct: ::std::option::Option::None,
|
6806 + | string: ::std::option::Option::None,
|
6807 + | struct_with_json_name: ::std::option::Option::None,
|
6808 + | timestamp: ::std::option::Option::None,
|
6809 + | unix_timestamp: ::std::option::Option::None,
|
6810 + | };
|
6811 + | Ok(output)
|
6812 + | };
|
6813 + | sender.send(()).await.expect("receiver dropped early");
|
6814 + | result
|
6815 + | }
|
6816 + | })
|
6817 + | .build_unchecked();
|
6818 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6819 + | .await
|
6820 + | .expect("unable to make an HTTP request");
|
6821 + | assert!(
|
6822 + | receiver.recv().await.is_some(),
|
6823 + | "we expected operation handler to be invoked but it was not entered"
|
6824 + | );
|
6825 + | }
|
6826 + |
|
6827 + | /// Serializes empty list shapes
|
6828 + | /// Test ID: serializes_empty_list_shapes
|
6829 + | #[::tokio::test]
|
6830 + | #[::tracing_test::traced_test]
|
6831 + | async fn serializes_empty_list_shapes_request() {
|
6832 + | #[allow(unused_mut)]
|
6833 + | let mut http_request = ::http::Request::builder()
|
6834 + | .uri("/")
|
6835 + | .method("POST")
|
6836 + | .header("Content-Type", "application/x-amz-json-1.1")
|
6837 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
6838 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
6839 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6840 + | "{\"ListOfStrings\":[]}".as_bytes(),
|
6841 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
6842 + | )),
|
6843 + | ))
|
6844 + | .unwrap();
|
6845 + | #[allow(unused_mut)]
|
6846 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6847 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
6848 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
6849 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
6850 + | let sender = sender.clone();
|
6851 + | async move {
|
6852 + | let result = {
|
6853 + | use ::aws_smithy_protocol_test::FloatEquals;
|
6854 + | let expected = crate::input::KitchenSinkOperationInput {
|
6855 + | list_of_strings: ::std::option::Option::Some(vec![]),
|
6856 + | blob: ::std::option::Option::None,
|
6857 + | boolean: ::std::option::Option::None,
|
6858 + | double: ::std::option::Option::None,
|
6859 + | empty_struct: ::std::option::Option::None,
|
6860 + | float: ::std::option::Option::None,
|
6861 + | httpdate_timestamp: ::std::option::Option::None,
|
6862 + | integer: ::std::option::Option::None,
|
6863 + | iso8601_timestamp: ::std::option::Option::None,
|
6864 + | json_value: ::std::option::Option::None,
|
6865 + | list_of_lists: ::std::option::Option::None,
|
6866 + | list_of_maps_of_strings: ::std::option::Option::None,
|
6867 + | list_of_structs: ::std::option::Option::None,
|
6868 + | long: ::std::option::Option::None,
|
6869 + | map_of_lists_of_strings: ::std::option::Option::None,
|
6870 + | map_of_maps: ::std::option::Option::None,
|
6871 + | map_of_strings: ::std::option::Option::None,
|
6872 + | map_of_structs: ::std::option::Option::None,
|
6873 + | recursive_list: ::std::option::Option::None,
|
6874 + | recursive_map: ::std::option::Option::None,
|
6875 + | recursive_struct: ::std::option::Option::None,
|
6876 + | simple_struct: ::std::option::Option::None,
|
6877 + | string: ::std::option::Option::None,
|
6878 + | struct_with_json_name: ::std::option::Option::None,
|
6879 + | timestamp: ::std::option::Option::None,
|
6880 + | unix_timestamp: ::std::option::Option::None,
|
6881 + | };
|
6882 + | ::pretty_assertions::assert_eq!(
|
6883 + | input.blob,
|
6884 + | expected.blob,
|
6885 + | "Unexpected value for `blob`"
|
6886 + | );
|
6887 + | ::pretty_assertions::assert_eq!(
|
6888 + | input.boolean,
|
6889 + | expected.boolean,
|
6890 + | "Unexpected value for `boolean`"
|
6891 + | );
|
6892 + | assert!(
|
6893 + | input.double.float_equals(&expected.double),
|
6894 + | "Unexpected value for `double` {:?} vs. {:?}",
|
6895 + | expected.double,
|
6896 + | input.double
|
6897 + | );
|
6898 + | ::pretty_assertions::assert_eq!(
|
6899 + | input.empty_struct,
|
6900 + | expected.empty_struct,
|
6901 + | "Unexpected value for `empty_struct`"
|
6902 + | );
|
6903 + | assert!(
|
6904 + | input.float.float_equals(&expected.float),
|
6905 + | "Unexpected value for `float` {:?} vs. {:?}",
|
6906 + | expected.float,
|
6907 + | input.float
|
6908 + | );
|
6909 + | ::pretty_assertions::assert_eq!(
|
6910 + | input.httpdate_timestamp,
|
6911 + | expected.httpdate_timestamp,
|
6912 + | "Unexpected value for `httpdate_timestamp`"
|
6913 + | );
|
6914 + | ::pretty_assertions::assert_eq!(
|
6915 + | input.integer,
|
6916 + | expected.integer,
|
6917 + | "Unexpected value for `integer`"
|
6918 + | );
|
6919 + | ::pretty_assertions::assert_eq!(
|
6920 + | input.iso8601_timestamp,
|
6921 + | expected.iso8601_timestamp,
|
6922 + | "Unexpected value for `iso8601_timestamp`"
|
6923 + | );
|
6924 + | ::pretty_assertions::assert_eq!(
|
6925 + | input.json_value,
|
6926 + | expected.json_value,
|
6927 + | "Unexpected value for `json_value`"
|
6928 + | );
|
6929 + | ::pretty_assertions::assert_eq!(
|
6930 + | input.list_of_lists,
|
6931 + | expected.list_of_lists,
|
6932 + | "Unexpected value for `list_of_lists`"
|
6933 + | );
|
6934 + | ::pretty_assertions::assert_eq!(
|
6935 + | input.list_of_maps_of_strings,
|
6936 + | expected.list_of_maps_of_strings,
|
6937 + | "Unexpected value for `list_of_maps_of_strings`"
|
6938 + | );
|
6939 + | ::pretty_assertions::assert_eq!(
|
6940 + | input.list_of_strings,
|
6941 + | expected.list_of_strings,
|
6942 + | "Unexpected value for `list_of_strings`"
|
6943 + | );
|
6944 + | ::pretty_assertions::assert_eq!(
|
6945 + | input.list_of_structs,
|
6946 + | expected.list_of_structs,
|
6947 + | "Unexpected value for `list_of_structs`"
|
6948 + | );
|
6949 + | ::pretty_assertions::assert_eq!(
|
6950 + | input.long,
|
6951 + | expected.long,
|
6952 + | "Unexpected value for `long`"
|
6953 + | );
|
6954 + | ::pretty_assertions::assert_eq!(
|
6955 + | input.map_of_lists_of_strings,
|
6956 + | expected.map_of_lists_of_strings,
|
6957 + | "Unexpected value for `map_of_lists_of_strings`"
|
6958 + | );
|
6959 + | ::pretty_assertions::assert_eq!(
|
6960 + | input.map_of_maps,
|
6961 + | expected.map_of_maps,
|
6962 + | "Unexpected value for `map_of_maps`"
|
6963 + | );
|
6964 + | ::pretty_assertions::assert_eq!(
|
6965 + | input.map_of_strings,
|
6966 + | expected.map_of_strings,
|
6967 + | "Unexpected value for `map_of_strings`"
|
6968 + | );
|
6969 + | ::pretty_assertions::assert_eq!(
|
6970 + | input.map_of_structs,
|
6971 + | expected.map_of_structs,
|
6972 + | "Unexpected value for `map_of_structs`"
|
6973 + | );
|
6974 + | ::pretty_assertions::assert_eq!(
|
6975 + | input.recursive_list,
|
6976 + | expected.recursive_list,
|
6977 + | "Unexpected value for `recursive_list`"
|
6978 + | );
|
6979 + | ::pretty_assertions::assert_eq!(
|
6980 + | input.recursive_map,
|
6981 + | expected.recursive_map,
|
6982 + | "Unexpected value for `recursive_map`"
|
6983 + | );
|
6984 + | ::pretty_assertions::assert_eq!(
|
6985 + | input.recursive_struct,
|
6986 + | expected.recursive_struct,
|
6987 + | "Unexpected value for `recursive_struct`"
|
6988 + | );
|
6989 + | ::pretty_assertions::assert_eq!(
|
6990 + | input.simple_struct,
|
6991 + | expected.simple_struct,
|
6992 + | "Unexpected value for `simple_struct`"
|
6993 + | );
|
6994 + | ::pretty_assertions::assert_eq!(
|
6995 + | input.string,
|
6996 + | expected.string,
|
6997 + | "Unexpected value for `string`"
|
6998 + | );
|
6999 + | ::pretty_assertions::assert_eq!(
|
7000 + | input.struct_with_json_name,
|
7001 + | expected.struct_with_json_name,
|
7002 + | "Unexpected value for `struct_with_json_name`"
|
7003 + | );
|
7004 + | ::pretty_assertions::assert_eq!(
|
7005 + | input.timestamp,
|
7006 + | expected.timestamp,
|
7007 + | "Unexpected value for `timestamp`"
|
7008 + | );
|
7009 + | ::pretty_assertions::assert_eq!(
|
7010 + | input.unix_timestamp,
|
7011 + | expected.unix_timestamp,
|
7012 + | "Unexpected value for `unix_timestamp`"
|
7013 + | );
|
7014 + | let output = crate::output::KitchenSinkOperationOutput {
|
7015 + | blob: ::std::option::Option::None,
|
7016 + | boolean: ::std::option::Option::None,
|
7017 + | double: ::std::option::Option::None,
|
7018 + | empty_struct: ::std::option::Option::None,
|
7019 + | float: ::std::option::Option::None,
|
7020 + | httpdate_timestamp: ::std::option::Option::None,
|
7021 + | integer: ::std::option::Option::None,
|
7022 + | iso8601_timestamp: ::std::option::Option::None,
|
7023 + | json_value: ::std::option::Option::None,
|
7024 + | list_of_lists: ::std::option::Option::None,
|
7025 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7026 + | list_of_strings: ::std::option::Option::None,
|
7027 + | list_of_structs: ::std::option::Option::None,
|
7028 + | long: ::std::option::Option::None,
|
7029 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7030 + | map_of_maps: ::std::option::Option::None,
|
7031 + | map_of_strings: ::std::option::Option::None,
|
7032 + | map_of_structs: ::std::option::Option::None,
|
7033 + | recursive_list: ::std::option::Option::None,
|
7034 + | recursive_map: ::std::option::Option::None,
|
7035 + | recursive_struct: ::std::option::Option::None,
|
7036 + | simple_struct: ::std::option::Option::None,
|
7037 + | string: ::std::option::Option::None,
|
7038 + | struct_with_json_name: ::std::option::Option::None,
|
7039 + | timestamp: ::std::option::Option::None,
|
7040 + | unix_timestamp: ::std::option::Option::None,
|
7041 + | };
|
7042 + | Ok(output)
|
7043 + | };
|
7044 + | sender.send(()).await.expect("receiver dropped early");
|
7045 + | result
|
7046 + | }
|
7047 + | })
|
7048 + | .build_unchecked();
|
7049 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7050 + | .await
|
7051 + | .expect("unable to make an HTTP request");
|
7052 + | assert!(
|
7053 + | receiver.recv().await.is_some(),
|
7054 + | "we expected operation handler to be invoked but it was not entered"
|
7055 + | );
|
7056 + | }
|
7057 + |
|
7058 + | /// Serializes list of map shapes
|
7059 + | /// Test ID: serializes_list_of_map_shapes
|
7060 + | #[::tokio::test]
|
7061 + | #[::tracing_test::traced_test]
|
7062 + | async fn serializes_list_of_map_shapes_request() {
|
7063 + | #[allow(unused_mut)]
|
7064 + | let mut http_request = ::http::Request::builder()
|
7065 + | .uri("/")
|
7066 + | .method("POST")
|
7067 + | .header("Content-Type", "application/x-amz-json-1.1")
|
7068 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
7069 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7070 + | ::bytes::Bytes::copy_from_slice(
|
7071 + | &::aws_smithy_protocol_test::decode_body_data("{\"ListOfMapsOfStrings\":[{\"foo\":\"bar\"},{\"abc\":\"xyz\"},{\"red\":\"blue\"}]}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7072 + | )
|
7073 + | )).unwrap();
|
7074 + | #[allow(unused_mut)]
|
7075 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7076 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
7077 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
7078 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
7079 + | let sender = sender.clone();
|
7080 + | async move {
|
7081 + | let result = {
|
7082 + | use ::aws_smithy_protocol_test::FloatEquals;
|
7083 + | let expected = crate::input::KitchenSinkOperationInput {
|
7084 + | list_of_maps_of_strings: ::std::option::Option::Some(vec![
|
7085 + | {
|
7086 + | let mut ret = ::std::collections::HashMap::new();
|
7087 + | ret.insert("foo".to_owned(), "bar".to_owned());
|
7088 + | ret
|
7089 + | },
|
7090 + | {
|
7091 + | let mut ret = ::std::collections::HashMap::new();
|
7092 + | ret.insert("abc".to_owned(), "xyz".to_owned());
|
7093 + | ret
|
7094 + | },
|
7095 + | {
|
7096 + | let mut ret = ::std::collections::HashMap::new();
|
7097 + | ret.insert("red".to_owned(), "blue".to_owned());
|
7098 + | ret
|
7099 + | },
|
7100 + | ]),
|
7101 + | blob: ::std::option::Option::None,
|
7102 + | boolean: ::std::option::Option::None,
|
7103 + | double: ::std::option::Option::None,
|
7104 + | empty_struct: ::std::option::Option::None,
|
7105 + | float: ::std::option::Option::None,
|
7106 + | httpdate_timestamp: ::std::option::Option::None,
|
7107 + | integer: ::std::option::Option::None,
|
7108 + | iso8601_timestamp: ::std::option::Option::None,
|
7109 + | json_value: ::std::option::Option::None,
|
7110 + | list_of_lists: ::std::option::Option::None,
|
7111 + | list_of_strings: ::std::option::Option::None,
|
7112 + | list_of_structs: ::std::option::Option::None,
|
7113 + | long: ::std::option::Option::None,
|
7114 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7115 + | map_of_maps: ::std::option::Option::None,
|
7116 + | map_of_strings: ::std::option::Option::None,
|
7117 + | map_of_structs: ::std::option::Option::None,
|
7118 + | recursive_list: ::std::option::Option::None,
|
7119 + | recursive_map: ::std::option::Option::None,
|
7120 + | recursive_struct: ::std::option::Option::None,
|
7121 + | simple_struct: ::std::option::Option::None,
|
7122 + | string: ::std::option::Option::None,
|
7123 + | struct_with_json_name: ::std::option::Option::None,
|
7124 + | timestamp: ::std::option::Option::None,
|
7125 + | unix_timestamp: ::std::option::Option::None,
|
7126 + | };
|
7127 + | ::pretty_assertions::assert_eq!(
|
7128 + | input.blob,
|
7129 + | expected.blob,
|
7130 + | "Unexpected value for `blob`"
|
7131 + | );
|
7132 + | ::pretty_assertions::assert_eq!(
|
7133 + | input.boolean,
|
7134 + | expected.boolean,
|
7135 + | "Unexpected value for `boolean`"
|
7136 + | );
|
7137 + | assert!(
|
7138 + | input.double.float_equals(&expected.double),
|
7139 + | "Unexpected value for `double` {:?} vs. {:?}",
|
7140 + | expected.double,
|
7141 + | input.double
|
7142 + | );
|
7143 + | ::pretty_assertions::assert_eq!(
|
7144 + | input.empty_struct,
|
7145 + | expected.empty_struct,
|
7146 + | "Unexpected value for `empty_struct`"
|
7147 + | );
|
7148 + | assert!(
|
7149 + | input.float.float_equals(&expected.float),
|
7150 + | "Unexpected value for `float` {:?} vs. {:?}",
|
7151 + | expected.float,
|
7152 + | input.float
|
7153 + | );
|
7154 + | ::pretty_assertions::assert_eq!(
|
7155 + | input.httpdate_timestamp,
|
7156 + | expected.httpdate_timestamp,
|
7157 + | "Unexpected value for `httpdate_timestamp`"
|
7158 + | );
|
7159 + | ::pretty_assertions::assert_eq!(
|
7160 + | input.integer,
|
7161 + | expected.integer,
|
7162 + | "Unexpected value for `integer`"
|
7163 + | );
|
7164 + | ::pretty_assertions::assert_eq!(
|
7165 + | input.iso8601_timestamp,
|
7166 + | expected.iso8601_timestamp,
|
7167 + | "Unexpected value for `iso8601_timestamp`"
|
7168 + | );
|
7169 + | ::pretty_assertions::assert_eq!(
|
7170 + | input.json_value,
|
7171 + | expected.json_value,
|
7172 + | "Unexpected value for `json_value`"
|
7173 + | );
|
7174 + | ::pretty_assertions::assert_eq!(
|
7175 + | input.list_of_lists,
|
7176 + | expected.list_of_lists,
|
7177 + | "Unexpected value for `list_of_lists`"
|
7178 + | );
|
7179 + | ::pretty_assertions::assert_eq!(
|
7180 + | input.list_of_maps_of_strings,
|
7181 + | expected.list_of_maps_of_strings,
|
7182 + | "Unexpected value for `list_of_maps_of_strings`"
|
7183 + | );
|
7184 + | ::pretty_assertions::assert_eq!(
|
7185 + | input.list_of_strings,
|
7186 + | expected.list_of_strings,
|
7187 + | "Unexpected value for `list_of_strings`"
|
7188 + | );
|
7189 + | ::pretty_assertions::assert_eq!(
|
7190 + | input.list_of_structs,
|
7191 + | expected.list_of_structs,
|
7192 + | "Unexpected value for `list_of_structs`"
|
7193 + | );
|
7194 + | ::pretty_assertions::assert_eq!(
|
7195 + | input.long,
|
7196 + | expected.long,
|
7197 + | "Unexpected value for `long`"
|
7198 + | );
|
7199 + | ::pretty_assertions::assert_eq!(
|
7200 + | input.map_of_lists_of_strings,
|
7201 + | expected.map_of_lists_of_strings,
|
7202 + | "Unexpected value for `map_of_lists_of_strings`"
|
7203 + | );
|
7204 + | ::pretty_assertions::assert_eq!(
|
7205 + | input.map_of_maps,
|
7206 + | expected.map_of_maps,
|
7207 + | "Unexpected value for `map_of_maps`"
|
7208 + | );
|
7209 + | ::pretty_assertions::assert_eq!(
|
7210 + | input.map_of_strings,
|
7211 + | expected.map_of_strings,
|
7212 + | "Unexpected value for `map_of_strings`"
|
7213 + | );
|
7214 + | ::pretty_assertions::assert_eq!(
|
7215 + | input.map_of_structs,
|
7216 + | expected.map_of_structs,
|
7217 + | "Unexpected value for `map_of_structs`"
|
7218 + | );
|
7219 + | ::pretty_assertions::assert_eq!(
|
7220 + | input.recursive_list,
|
7221 + | expected.recursive_list,
|
7222 + | "Unexpected value for `recursive_list`"
|
7223 + | );
|
7224 + | ::pretty_assertions::assert_eq!(
|
7225 + | input.recursive_map,
|
7226 + | expected.recursive_map,
|
7227 + | "Unexpected value for `recursive_map`"
|
7228 + | );
|
7229 + | ::pretty_assertions::assert_eq!(
|
7230 + | input.recursive_struct,
|
7231 + | expected.recursive_struct,
|
7232 + | "Unexpected value for `recursive_struct`"
|
7233 + | );
|
7234 + | ::pretty_assertions::assert_eq!(
|
7235 + | input.simple_struct,
|
7236 + | expected.simple_struct,
|
7237 + | "Unexpected value for `simple_struct`"
|
7238 + | );
|
7239 + | ::pretty_assertions::assert_eq!(
|
7240 + | input.string,
|
7241 + | expected.string,
|
7242 + | "Unexpected value for `string`"
|
7243 + | );
|
7244 + | ::pretty_assertions::assert_eq!(
|
7245 + | input.struct_with_json_name,
|
7246 + | expected.struct_with_json_name,
|
7247 + | "Unexpected value for `struct_with_json_name`"
|
7248 + | );
|
7249 + | ::pretty_assertions::assert_eq!(
|
7250 + | input.timestamp,
|
7251 + | expected.timestamp,
|
7252 + | "Unexpected value for `timestamp`"
|
7253 + | );
|
7254 + | ::pretty_assertions::assert_eq!(
|
7255 + | input.unix_timestamp,
|
7256 + | expected.unix_timestamp,
|
7257 + | "Unexpected value for `unix_timestamp`"
|
7258 + | );
|
7259 + | let output = crate::output::KitchenSinkOperationOutput {
|
7260 + | blob: ::std::option::Option::None,
|
7261 + | boolean: ::std::option::Option::None,
|
7262 + | double: ::std::option::Option::None,
|
7263 + | empty_struct: ::std::option::Option::None,
|
7264 + | float: ::std::option::Option::None,
|
7265 + | httpdate_timestamp: ::std::option::Option::None,
|
7266 + | integer: ::std::option::Option::None,
|
7267 + | iso8601_timestamp: ::std::option::Option::None,
|
7268 + | json_value: ::std::option::Option::None,
|
7269 + | list_of_lists: ::std::option::Option::None,
|
7270 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7271 + | list_of_strings: ::std::option::Option::None,
|
7272 + | list_of_structs: ::std::option::Option::None,
|
7273 + | long: ::std::option::Option::None,
|
7274 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7275 + | map_of_maps: ::std::option::Option::None,
|
7276 + | map_of_strings: ::std::option::Option::None,
|
7277 + | map_of_structs: ::std::option::Option::None,
|
7278 + | recursive_list: ::std::option::Option::None,
|
7279 + | recursive_map: ::std::option::Option::None,
|
7280 + | recursive_struct: ::std::option::Option::None,
|
7281 + | simple_struct: ::std::option::Option::None,
|
7282 + | string: ::std::option::Option::None,
|
7283 + | struct_with_json_name: ::std::option::Option::None,
|
7284 + | timestamp: ::std::option::Option::None,
|
7285 + | unix_timestamp: ::std::option::Option::None,
|
7286 + | };
|
7287 + | Ok(output)
|
7288 + | };
|
7289 + | sender.send(()).await.expect("receiver dropped early");
|
7290 + | result
|
7291 + | }
|
7292 + | })
|
7293 + | .build_unchecked();
|
7294 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7295 + | .await
|
7296 + | .expect("unable to make an HTTP request");
|
7297 + | assert!(
|
7298 + | receiver.recv().await.is_some(),
|
7299 + | "we expected operation handler to be invoked but it was not entered"
|
7300 + | );
|
7301 + | }
|
7302 + |
|
7303 + | /// Serializes list of structure shapes
|
7304 + | /// Test ID: serializes_list_of_structure_shapes
|
7305 + | #[::tokio::test]
|
7306 + | #[::tracing_test::traced_test]
|
7307 + | async fn serializes_list_of_structure_shapes_request() {
|
7308 + | #[allow(unused_mut)]
|
7309 + | let mut http_request = ::http::Request::builder()
|
7310 + | .uri("/")
|
7311 + | .method("POST")
|
7312 + | .header("Content-Type", "application/x-amz-json-1.1")
|
7313 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
7314 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7315 + | ::bytes::Bytes::copy_from_slice(
|
7316 + | &::aws_smithy_protocol_test::decode_body_data("{\"ListOfStructs\":[{\"Value\":\"abc\"},{\"Value\":\"mno\"},{\"Value\":\"xyz\"}]}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7317 + | )
|
7318 + | )).unwrap();
|
7319 + | #[allow(unused_mut)]
|
7320 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7321 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
7322 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
7323 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
7324 + | let sender = sender.clone();
|
7325 + | async move {
|
7326 + | let result = {
|
7327 + | use ::aws_smithy_protocol_test::FloatEquals;
|
7328 + | let expected = crate::input::KitchenSinkOperationInput {
|
7329 + | list_of_structs: ::std::option::Option::Some(vec![
|
7330 + | crate::model::SimpleStruct {
|
7331 + | value: ::std::option::Option::Some("abc".to_owned()),
|
7332 + | },
|
7333 + | crate::model::SimpleStruct {
|
7334 + | value: ::std::option::Option::Some("mno".to_owned()),
|
7335 + | },
|
7336 + | crate::model::SimpleStruct {
|
7337 + | value: ::std::option::Option::Some("xyz".to_owned()),
|
7338 + | },
|
7339 + | ]),
|
7340 + | blob: ::std::option::Option::None,
|
7341 + | boolean: ::std::option::Option::None,
|
7342 + | double: ::std::option::Option::None,
|
7343 + | empty_struct: ::std::option::Option::None,
|
7344 + | float: ::std::option::Option::None,
|
7345 + | httpdate_timestamp: ::std::option::Option::None,
|
7346 + | integer: ::std::option::Option::None,
|
7347 + | iso8601_timestamp: ::std::option::Option::None,
|
7348 + | json_value: ::std::option::Option::None,
|
7349 + | list_of_lists: ::std::option::Option::None,
|
7350 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7351 + | list_of_strings: ::std::option::Option::None,
|
7352 + | long: ::std::option::Option::None,
|
7353 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7354 + | map_of_maps: ::std::option::Option::None,
|
7355 + | map_of_strings: ::std::option::Option::None,
|
7356 + | map_of_structs: ::std::option::Option::None,
|
7357 + | recursive_list: ::std::option::Option::None,
|
7358 + | recursive_map: ::std::option::Option::None,
|
7359 + | recursive_struct: ::std::option::Option::None,
|
7360 + | simple_struct: ::std::option::Option::None,
|
7361 + | string: ::std::option::Option::None,
|
7362 + | struct_with_json_name: ::std::option::Option::None,
|
7363 + | timestamp: ::std::option::Option::None,
|
7364 + | unix_timestamp: ::std::option::Option::None,
|
7365 + | };
|
7366 + | ::pretty_assertions::assert_eq!(
|
7367 + | input.blob,
|
7368 + | expected.blob,
|
7369 + | "Unexpected value for `blob`"
|
7370 + | );
|
7371 + | ::pretty_assertions::assert_eq!(
|
7372 + | input.boolean,
|
7373 + | expected.boolean,
|
7374 + | "Unexpected value for `boolean`"
|
7375 + | );
|
7376 + | assert!(
|
7377 + | input.double.float_equals(&expected.double),
|
7378 + | "Unexpected value for `double` {:?} vs. {:?}",
|
7379 + | expected.double,
|
7380 + | input.double
|
7381 + | );
|
7382 + | ::pretty_assertions::assert_eq!(
|
7383 + | input.empty_struct,
|
7384 + | expected.empty_struct,
|
7385 + | "Unexpected value for `empty_struct`"
|
7386 + | );
|
7387 + | assert!(
|
7388 + | input.float.float_equals(&expected.float),
|
7389 + | "Unexpected value for `float` {:?} vs. {:?}",
|
7390 + | expected.float,
|
7391 + | input.float
|
7392 + | );
|
7393 + | ::pretty_assertions::assert_eq!(
|
7394 + | input.httpdate_timestamp,
|
7395 + | expected.httpdate_timestamp,
|
7396 + | "Unexpected value for `httpdate_timestamp`"
|
7397 + | );
|
7398 + | ::pretty_assertions::assert_eq!(
|
7399 + | input.integer,
|
7400 + | expected.integer,
|
7401 + | "Unexpected value for `integer`"
|
7402 + | );
|
7403 + | ::pretty_assertions::assert_eq!(
|
7404 + | input.iso8601_timestamp,
|
7405 + | expected.iso8601_timestamp,
|
7406 + | "Unexpected value for `iso8601_timestamp`"
|
7407 + | );
|
7408 + | ::pretty_assertions::assert_eq!(
|
7409 + | input.json_value,
|
7410 + | expected.json_value,
|
7411 + | "Unexpected value for `json_value`"
|
7412 + | );
|
7413 + | ::pretty_assertions::assert_eq!(
|
7414 + | input.list_of_lists,
|
7415 + | expected.list_of_lists,
|
7416 + | "Unexpected value for `list_of_lists`"
|
7417 + | );
|
7418 + | ::pretty_assertions::assert_eq!(
|
7419 + | input.list_of_maps_of_strings,
|
7420 + | expected.list_of_maps_of_strings,
|
7421 + | "Unexpected value for `list_of_maps_of_strings`"
|
7422 + | );
|
7423 + | ::pretty_assertions::assert_eq!(
|
7424 + | input.list_of_strings,
|
7425 + | expected.list_of_strings,
|
7426 + | "Unexpected value for `list_of_strings`"
|
7427 + | );
|
7428 + | ::pretty_assertions::assert_eq!(
|
7429 + | input.list_of_structs,
|
7430 + | expected.list_of_structs,
|
7431 + | "Unexpected value for `list_of_structs`"
|
7432 + | );
|
7433 + | ::pretty_assertions::assert_eq!(
|
7434 + | input.long,
|
7435 + | expected.long,
|
7436 + | "Unexpected value for `long`"
|
7437 + | );
|
7438 + | ::pretty_assertions::assert_eq!(
|
7439 + | input.map_of_lists_of_strings,
|
7440 + | expected.map_of_lists_of_strings,
|
7441 + | "Unexpected value for `map_of_lists_of_strings`"
|
7442 + | );
|
7443 + | ::pretty_assertions::assert_eq!(
|
7444 + | input.map_of_maps,
|
7445 + | expected.map_of_maps,
|
7446 + | "Unexpected value for `map_of_maps`"
|
7447 + | );
|
7448 + | ::pretty_assertions::assert_eq!(
|
7449 + | input.map_of_strings,
|
7450 + | expected.map_of_strings,
|
7451 + | "Unexpected value for `map_of_strings`"
|
7452 + | );
|
7453 + | ::pretty_assertions::assert_eq!(
|
7454 + | input.map_of_structs,
|
7455 + | expected.map_of_structs,
|
7456 + | "Unexpected value for `map_of_structs`"
|
7457 + | );
|
7458 + | ::pretty_assertions::assert_eq!(
|
7459 + | input.recursive_list,
|
7460 + | expected.recursive_list,
|
7461 + | "Unexpected value for `recursive_list`"
|
7462 + | );
|
7463 + | ::pretty_assertions::assert_eq!(
|
7464 + | input.recursive_map,
|
7465 + | expected.recursive_map,
|
7466 + | "Unexpected value for `recursive_map`"
|
7467 + | );
|
7468 + | ::pretty_assertions::assert_eq!(
|
7469 + | input.recursive_struct,
|
7470 + | expected.recursive_struct,
|
7471 + | "Unexpected value for `recursive_struct`"
|
7472 + | );
|
7473 + | ::pretty_assertions::assert_eq!(
|
7474 + | input.simple_struct,
|
7475 + | expected.simple_struct,
|
7476 + | "Unexpected value for `simple_struct`"
|
7477 + | );
|
7478 + | ::pretty_assertions::assert_eq!(
|
7479 + | input.string,
|
7480 + | expected.string,
|
7481 + | "Unexpected value for `string`"
|
7482 + | );
|
7483 + | ::pretty_assertions::assert_eq!(
|
7484 + | input.struct_with_json_name,
|
7485 + | expected.struct_with_json_name,
|
7486 + | "Unexpected value for `struct_with_json_name`"
|
7487 + | );
|
7488 + | ::pretty_assertions::assert_eq!(
|
7489 + | input.timestamp,
|
7490 + | expected.timestamp,
|
7491 + | "Unexpected value for `timestamp`"
|
7492 + | );
|
7493 + | ::pretty_assertions::assert_eq!(
|
7494 + | input.unix_timestamp,
|
7495 + | expected.unix_timestamp,
|
7496 + | "Unexpected value for `unix_timestamp`"
|
7497 + | );
|
7498 + | let output = crate::output::KitchenSinkOperationOutput {
|
7499 + | blob: ::std::option::Option::None,
|
7500 + | boolean: ::std::option::Option::None,
|
7501 + | double: ::std::option::Option::None,
|
7502 + | empty_struct: ::std::option::Option::None,
|
7503 + | float: ::std::option::Option::None,
|
7504 + | httpdate_timestamp: ::std::option::Option::None,
|
7505 + | integer: ::std::option::Option::None,
|
7506 + | iso8601_timestamp: ::std::option::Option::None,
|
7507 + | json_value: ::std::option::Option::None,
|
7508 + | list_of_lists: ::std::option::Option::None,
|
7509 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7510 + | list_of_strings: ::std::option::Option::None,
|
7511 + | list_of_structs: ::std::option::Option::None,
|
7512 + | long: ::std::option::Option::None,
|
7513 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7514 + | map_of_maps: ::std::option::Option::None,
|
7515 + | map_of_strings: ::std::option::Option::None,
|
7516 + | map_of_structs: ::std::option::Option::None,
|
7517 + | recursive_list: ::std::option::Option::None,
|
7518 + | recursive_map: ::std::option::Option::None,
|
7519 + | recursive_struct: ::std::option::Option::None,
|
7520 + | simple_struct: ::std::option::Option::None,
|
7521 + | string: ::std::option::Option::None,
|
7522 + | struct_with_json_name: ::std::option::Option::None,
|
7523 + | timestamp: ::std::option::Option::None,
|
7524 + | unix_timestamp: ::std::option::Option::None,
|
7525 + | };
|
7526 + | Ok(output)
|
7527 + | };
|
7528 + | sender.send(()).await.expect("receiver dropped early");
|
7529 + | result
|
7530 + | }
|
7531 + | })
|
7532 + | .build_unchecked();
|
7533 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7534 + | .await
|
7535 + | .expect("unable to make an HTTP request");
|
7536 + | assert!(
|
7537 + | receiver.recv().await.is_some(),
|
7538 + | "we expected operation handler to be invoked but it was not entered"
|
7539 + | );
|
7540 + | }
|
7541 + |
|
7542 + | /// Serializes list of recursive structure shapes
|
7543 + | /// Test ID: serializes_list_of_recursive_structure_shapes
|
7544 + | #[::tokio::test]
|
7545 + | #[::tracing_test::traced_test]
|
7546 + | async fn serializes_list_of_recursive_structure_shapes_request() {
|
7547 + | #[allow(unused_mut)]
|
7548 + | let mut http_request = ::http::Request::builder()
|
7549 + | .uri("/")
|
7550 + | .method("POST")
|
7551 + | .header("Content-Type", "application/x-amz-json-1.1")
|
7552 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
7553 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7554 + | ::bytes::Bytes::copy_from_slice(
|
7555 + | &::aws_smithy_protocol_test::decode_body_data("{\"RecursiveList\":[{\"RecursiveList\":[{\"RecursiveList\":[{\"Integer\":123}]}]}]}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7556 + | )
|
7557 + | )).unwrap();
|
7558 + | #[allow(unused_mut)]
|
7559 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7560 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
7561 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
7562 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
7563 + | let sender = sender.clone();
|
7564 + | async move {
|
7565 + | let result = {
|
7566 + | use ::aws_smithy_protocol_test::FloatEquals;
|
7567 + | let expected = crate::input::KitchenSinkOperationInput {
|
7568 + | recursive_list: ::std::option::Option::Some(vec![
|
7569 + | crate::model::KitchenSink {
|
7570 + | recursive_list: ::std::option::Option::Some(vec![
|
7571 + | crate::model::KitchenSink {
|
7572 + | recursive_list: ::std::option::Option::Some(vec![
|
7573 + | crate::model::KitchenSink {
|
7574 + | integer: ::std::option::Option::Some(123),
|
7575 + | blob: ::std::option::Option::None,
|
7576 + | boolean: ::std::option::Option::None,
|
7577 + | double: ::std::option::Option::None,
|
7578 + | empty_struct: ::std::option::Option::None,
|
7579 + | float: ::std::option::Option::None,
|
7580 + | httpdate_timestamp: ::std::option::Option::None,
|
7581 + | iso8601_timestamp: ::std::option::Option::None,
|
7582 + | json_value: ::std::option::Option::None,
|
7583 + | list_of_lists: ::std::option::Option::None,
|
7584 + | list_of_maps_of_strings:
|
7585 + | ::std::option::Option::None,
|
7586 + | list_of_strings: ::std::option::Option::None,
|
7587 + | list_of_structs: ::std::option::Option::None,
|
7588 + | long: ::std::option::Option::None,
|
7589 + | map_of_lists_of_strings:
|
7590 + | ::std::option::Option::None,
|
7591 + | map_of_maps: ::std::option::Option::None,
|
7592 + | map_of_strings: ::std::option::Option::None,
|
7593 + | map_of_structs: ::std::option::Option::None,
|
7594 + | recursive_list: ::std::option::Option::None,
|
7595 + | recursive_map: ::std::option::Option::None,
|
7596 + | recursive_struct: ::std::option::Option::None,
|
7597 + | simple_struct: ::std::option::Option::None,
|
7598 + | string: ::std::option::Option::None,
|
7599 + | struct_with_json_name:
|
7600 + | ::std::option::Option::None,
|
7601 + | timestamp: ::std::option::Option::None,
|
7602 + | unix_timestamp: ::std::option::Option::None,
|
7603 + | },
|
7604 + | ]),
|
7605 + | blob: ::std::option::Option::None,
|
7606 + | boolean: ::std::option::Option::None,
|
7607 + | double: ::std::option::Option::None,
|
7608 + | empty_struct: ::std::option::Option::None,
|
7609 + | float: ::std::option::Option::None,
|
7610 + | httpdate_timestamp: ::std::option::Option::None,
|
7611 + | integer: ::std::option::Option::None,
|
7612 + | iso8601_timestamp: ::std::option::Option::None,
|
7613 + | json_value: ::std::option::Option::None,
|
7614 + | list_of_lists: ::std::option::Option::None,
|
7615 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7616 + | list_of_strings: ::std::option::Option::None,
|
7617 + | list_of_structs: ::std::option::Option::None,
|
7618 + | long: ::std::option::Option::None,
|
7619 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7620 + | map_of_maps: ::std::option::Option::None,
|
7621 + | map_of_strings: ::std::option::Option::None,
|
7622 + | map_of_structs: ::std::option::Option::None,
|
7623 + | recursive_map: ::std::option::Option::None,
|
7624 + | recursive_struct: ::std::option::Option::None,
|
7625 + | simple_struct: ::std::option::Option::None,
|
7626 + | string: ::std::option::Option::None,
|
7627 + | struct_with_json_name: ::std::option::Option::None,
|
7628 + | timestamp: ::std::option::Option::None,
|
7629 + | unix_timestamp: ::std::option::Option::None,
|
7630 + | },
|
7631 + | ]),
|
7632 + | blob: ::std::option::Option::None,
|
7633 + | boolean: ::std::option::Option::None,
|
7634 + | double: ::std::option::Option::None,
|
7635 + | empty_struct: ::std::option::Option::None,
|
7636 + | float: ::std::option::Option::None,
|
7637 + | httpdate_timestamp: ::std::option::Option::None,
|
7638 + | integer: ::std::option::Option::None,
|
7639 + | iso8601_timestamp: ::std::option::Option::None,
|
7640 + | json_value: ::std::option::Option::None,
|
7641 + | list_of_lists: ::std::option::Option::None,
|
7642 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7643 + | list_of_strings: ::std::option::Option::None,
|
7644 + | list_of_structs: ::std::option::Option::None,
|
7645 + | long: ::std::option::Option::None,
|
7646 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7647 + | map_of_maps: ::std::option::Option::None,
|
7648 + | map_of_strings: ::std::option::Option::None,
|
7649 + | map_of_structs: ::std::option::Option::None,
|
7650 + | recursive_map: ::std::option::Option::None,
|
7651 + | recursive_struct: ::std::option::Option::None,
|
7652 + | simple_struct: ::std::option::Option::None,
|
7653 + | string: ::std::option::Option::None,
|
7654 + | struct_with_json_name: ::std::option::Option::None,
|
7655 + | timestamp: ::std::option::Option::None,
|
7656 + | unix_timestamp: ::std::option::Option::None,
|
7657 + | },
|
7658 + | ]),
|
7659 + | blob: ::std::option::Option::None,
|
7660 + | boolean: ::std::option::Option::None,
|
7661 + | double: ::std::option::Option::None,
|
7662 + | empty_struct: ::std::option::Option::None,
|
7663 + | float: ::std::option::Option::None,
|
7664 + | httpdate_timestamp: ::std::option::Option::None,
|
7665 + | integer: ::std::option::Option::None,
|
7666 + | iso8601_timestamp: ::std::option::Option::None,
|
7667 + | json_value: ::std::option::Option::None,
|
7668 + | list_of_lists: ::std::option::Option::None,
|
7669 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7670 + | list_of_strings: ::std::option::Option::None,
|
7671 + | list_of_structs: ::std::option::Option::None,
|
7672 + | long: ::std::option::Option::None,
|
7673 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7674 + | map_of_maps: ::std::option::Option::None,
|
7675 + | map_of_strings: ::std::option::Option::None,
|
7676 + | map_of_structs: ::std::option::Option::None,
|
7677 + | recursive_map: ::std::option::Option::None,
|
7678 + | recursive_struct: ::std::option::Option::None,
|
7679 + | simple_struct: ::std::option::Option::None,
|
7680 + | string: ::std::option::Option::None,
|
7681 + | struct_with_json_name: ::std::option::Option::None,
|
7682 + | timestamp: ::std::option::Option::None,
|
7683 + | unix_timestamp: ::std::option::Option::None,
|
7684 + | };
|
7685 + | ::pretty_assertions::assert_eq!(
|
7686 + | input.blob,
|
7687 + | expected.blob,
|
7688 + | "Unexpected value for `blob`"
|
7689 + | );
|
7690 + | ::pretty_assertions::assert_eq!(
|
7691 + | input.boolean,
|
7692 + | expected.boolean,
|
7693 + | "Unexpected value for `boolean`"
|
7694 + | );
|
7695 + | assert!(
|
7696 + | input.double.float_equals(&expected.double),
|
7697 + | "Unexpected value for `double` {:?} vs. {:?}",
|
7698 + | expected.double,
|
7699 + | input.double
|
7700 + | );
|
7701 + | ::pretty_assertions::assert_eq!(
|
7702 + | input.empty_struct,
|
7703 + | expected.empty_struct,
|
7704 + | "Unexpected value for `empty_struct`"
|
7705 + | );
|
7706 + | assert!(
|
7707 + | input.float.float_equals(&expected.float),
|
7708 + | "Unexpected value for `float` {:?} vs. {:?}",
|
7709 + | expected.float,
|
7710 + | input.float
|
7711 + | );
|
7712 + | ::pretty_assertions::assert_eq!(
|
7713 + | input.httpdate_timestamp,
|
7714 + | expected.httpdate_timestamp,
|
7715 + | "Unexpected value for `httpdate_timestamp`"
|
7716 + | );
|
7717 + | ::pretty_assertions::assert_eq!(
|
7718 + | input.integer,
|
7719 + | expected.integer,
|
7720 + | "Unexpected value for `integer`"
|
7721 + | );
|
7722 + | ::pretty_assertions::assert_eq!(
|
7723 + | input.iso8601_timestamp,
|
7724 + | expected.iso8601_timestamp,
|
7725 + | "Unexpected value for `iso8601_timestamp`"
|
7726 + | );
|
7727 + | ::pretty_assertions::assert_eq!(
|
7728 + | input.json_value,
|
7729 + | expected.json_value,
|
7730 + | "Unexpected value for `json_value`"
|
7731 + | );
|
7732 + | ::pretty_assertions::assert_eq!(
|
7733 + | input.list_of_lists,
|
7734 + | expected.list_of_lists,
|
7735 + | "Unexpected value for `list_of_lists`"
|
7736 + | );
|
7737 + | ::pretty_assertions::assert_eq!(
|
7738 + | input.list_of_maps_of_strings,
|
7739 + | expected.list_of_maps_of_strings,
|
7740 + | "Unexpected value for `list_of_maps_of_strings`"
|
7741 + | );
|
7742 + | ::pretty_assertions::assert_eq!(
|
7743 + | input.list_of_strings,
|
7744 + | expected.list_of_strings,
|
7745 + | "Unexpected value for `list_of_strings`"
|
7746 + | );
|
7747 + | ::pretty_assertions::assert_eq!(
|
7748 + | input.list_of_structs,
|
7749 + | expected.list_of_structs,
|
7750 + | "Unexpected value for `list_of_structs`"
|
7751 + | );
|
7752 + | ::pretty_assertions::assert_eq!(
|
7753 + | input.long,
|
7754 + | expected.long,
|
7755 + | "Unexpected value for `long`"
|
7756 + | );
|
7757 + | ::pretty_assertions::assert_eq!(
|
7758 + | input.map_of_lists_of_strings,
|
7759 + | expected.map_of_lists_of_strings,
|
7760 + | "Unexpected value for `map_of_lists_of_strings`"
|
7761 + | );
|
7762 + | ::pretty_assertions::assert_eq!(
|
7763 + | input.map_of_maps,
|
7764 + | expected.map_of_maps,
|
7765 + | "Unexpected value for `map_of_maps`"
|
7766 + | );
|
7767 + | ::pretty_assertions::assert_eq!(
|
7768 + | input.map_of_strings,
|
7769 + | expected.map_of_strings,
|
7770 + | "Unexpected value for `map_of_strings`"
|
7771 + | );
|
7772 + | ::pretty_assertions::assert_eq!(
|
7773 + | input.map_of_structs,
|
7774 + | expected.map_of_structs,
|
7775 + | "Unexpected value for `map_of_structs`"
|
7776 + | );
|
7777 + | ::pretty_assertions::assert_eq!(
|
7778 + | input.recursive_list,
|
7779 + | expected.recursive_list,
|
7780 + | "Unexpected value for `recursive_list`"
|
7781 + | );
|
7782 + | ::pretty_assertions::assert_eq!(
|
7783 + | input.recursive_map,
|
7784 + | expected.recursive_map,
|
7785 + | "Unexpected value for `recursive_map`"
|
7786 + | );
|
7787 + | ::pretty_assertions::assert_eq!(
|
7788 + | input.recursive_struct,
|
7789 + | expected.recursive_struct,
|
7790 + | "Unexpected value for `recursive_struct`"
|
7791 + | );
|
7792 + | ::pretty_assertions::assert_eq!(
|
7793 + | input.simple_struct,
|
7794 + | expected.simple_struct,
|
7795 + | "Unexpected value for `simple_struct`"
|
7796 + | );
|
7797 + | ::pretty_assertions::assert_eq!(
|
7798 + | input.string,
|
7799 + | expected.string,
|
7800 + | "Unexpected value for `string`"
|
7801 + | );
|
7802 + | ::pretty_assertions::assert_eq!(
|
7803 + | input.struct_with_json_name,
|
7804 + | expected.struct_with_json_name,
|
7805 + | "Unexpected value for `struct_with_json_name`"
|
7806 + | );
|
7807 + | ::pretty_assertions::assert_eq!(
|
7808 + | input.timestamp,
|
7809 + | expected.timestamp,
|
7810 + | "Unexpected value for `timestamp`"
|
7811 + | );
|
7812 + | ::pretty_assertions::assert_eq!(
|
7813 + | input.unix_timestamp,
|
7814 + | expected.unix_timestamp,
|
7815 + | "Unexpected value for `unix_timestamp`"
|
7816 + | );
|
7817 + | let output = crate::output::KitchenSinkOperationOutput {
|
7818 + | blob: ::std::option::Option::None,
|
7819 + | boolean: ::std::option::Option::None,
|
7820 + | double: ::std::option::Option::None,
|
7821 + | empty_struct: ::std::option::Option::None,
|
7822 + | float: ::std::option::Option::None,
|
7823 + | httpdate_timestamp: ::std::option::Option::None,
|
7824 + | integer: ::std::option::Option::None,
|
7825 + | iso8601_timestamp: ::std::option::Option::None,
|
7826 + | json_value: ::std::option::Option::None,
|
7827 + | list_of_lists: ::std::option::Option::None,
|
7828 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7829 + | list_of_strings: ::std::option::Option::None,
|
7830 + | list_of_structs: ::std::option::Option::None,
|
7831 + | long: ::std::option::Option::None,
|
7832 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7833 + | map_of_maps: ::std::option::Option::None,
|
7834 + | map_of_strings: ::std::option::Option::None,
|
7835 + | map_of_structs: ::std::option::Option::None,
|
7836 + | recursive_list: ::std::option::Option::None,
|
7837 + | recursive_map: ::std::option::Option::None,
|
7838 + | recursive_struct: ::std::option::Option::None,
|
7839 + | simple_struct: ::std::option::Option::None,
|
7840 + | string: ::std::option::Option::None,
|
7841 + | struct_with_json_name: ::std::option::Option::None,
|
7842 + | timestamp: ::std::option::Option::None,
|
7843 + | unix_timestamp: ::std::option::Option::None,
|
7844 + | };
|
7845 + | Ok(output)
|
7846 + | };
|
7847 + | sender.send(()).await.expect("receiver dropped early");
|
7848 + | result
|
7849 + | }
|
7850 + | })
|
7851 + | .build_unchecked();
|
7852 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7853 + | .await
|
7854 + | .expect("unable to make an HTTP request");
|
7855 + | assert!(
|
7856 + | receiver.recv().await.is_some(),
|
7857 + | "we expected operation handler to be invoked but it was not entered"
|
7858 + | );
|
7859 + | }
|
7860 + |
|
7861 + | /// Serializes map shapes
|
7862 + | /// Test ID: serializes_map_shapes
|
7863 + | #[::tokio::test]
|
7864 + | #[::tracing_test::traced_test]
|
7865 + | async fn serializes_map_shapes_request() {
|
7866 + | #[allow(unused_mut)]
|
7867 + | let mut http_request = ::http::Request::builder()
|
7868 + | .uri("/")
|
7869 + | .method("POST")
|
7870 + | .header("Content-Type", "application/x-amz-json-1.1")
|
7871 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
7872 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7873 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
7874 + | "{\"MapOfStrings\":{\"abc\":\"xyz\",\"mno\":\"hjk\"}}".as_bytes(),
|
7875 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
7876 + | )),
|
7877 + | ))
|
7878 + | .unwrap();
|
7879 + | #[allow(unused_mut)]
|
7880 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7881 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
7882 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
7883 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
7884 + | let sender = sender.clone();
|
7885 + | async move {
|
7886 + | let result = {
|
7887 + | use ::aws_smithy_protocol_test::FloatEquals;
|
7888 + | let expected = crate::input::KitchenSinkOperationInput {
|
7889 + | map_of_strings: ::std::option::Option::Some({
|
7890 + | let mut ret = ::std::collections::HashMap::new();
|
7891 + | ret.insert("abc".to_owned(), "xyz".to_owned());
|
7892 + | ret.insert("mno".to_owned(), "hjk".to_owned());
|
7893 + | ret
|
7894 + | }),
|
7895 + | blob: ::std::option::Option::None,
|
7896 + | boolean: ::std::option::Option::None,
|
7897 + | double: ::std::option::Option::None,
|
7898 + | empty_struct: ::std::option::Option::None,
|
7899 + | float: ::std::option::Option::None,
|
7900 + | httpdate_timestamp: ::std::option::Option::None,
|
7901 + | integer: ::std::option::Option::None,
|
7902 + | iso8601_timestamp: ::std::option::Option::None,
|
7903 + | json_value: ::std::option::Option::None,
|
7904 + | list_of_lists: ::std::option::Option::None,
|
7905 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7906 + | list_of_strings: ::std::option::Option::None,
|
7907 + | list_of_structs: ::std::option::Option::None,
|
7908 + | long: ::std::option::Option::None,
|
7909 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7910 + | map_of_maps: ::std::option::Option::None,
|
7911 + | map_of_structs: ::std::option::Option::None,
|
7912 + | recursive_list: ::std::option::Option::None,
|
7913 + | recursive_map: ::std::option::Option::None,
|
7914 + | recursive_struct: ::std::option::Option::None,
|
7915 + | simple_struct: ::std::option::Option::None,
|
7916 + | string: ::std::option::Option::None,
|
7917 + | struct_with_json_name: ::std::option::Option::None,
|
7918 + | timestamp: ::std::option::Option::None,
|
7919 + | unix_timestamp: ::std::option::Option::None,
|
7920 + | };
|
7921 + | ::pretty_assertions::assert_eq!(
|
7922 + | input.blob,
|
7923 + | expected.blob,
|
7924 + | "Unexpected value for `blob`"
|
7925 + | );
|
7926 + | ::pretty_assertions::assert_eq!(
|
7927 + | input.boolean,
|
7928 + | expected.boolean,
|
7929 + | "Unexpected value for `boolean`"
|
7930 + | );
|
7931 + | assert!(
|
7932 + | input.double.float_equals(&expected.double),
|
7933 + | "Unexpected value for `double` {:?} vs. {:?}",
|
7934 + | expected.double,
|
7935 + | input.double
|
7936 + | );
|
7937 + | ::pretty_assertions::assert_eq!(
|
7938 + | input.empty_struct,
|
7939 + | expected.empty_struct,
|
7940 + | "Unexpected value for `empty_struct`"
|
7941 + | );
|
7942 + | assert!(
|
7943 + | input.float.float_equals(&expected.float),
|
7944 + | "Unexpected value for `float` {:?} vs. {:?}",
|
7945 + | expected.float,
|
7946 + | input.float
|
7947 + | );
|
7948 + | ::pretty_assertions::assert_eq!(
|
7949 + | input.httpdate_timestamp,
|
7950 + | expected.httpdate_timestamp,
|
7951 + | "Unexpected value for `httpdate_timestamp`"
|
7952 + | );
|
7953 + | ::pretty_assertions::assert_eq!(
|
7954 + | input.integer,
|
7955 + | expected.integer,
|
7956 + | "Unexpected value for `integer`"
|
7957 + | );
|
7958 + | ::pretty_assertions::assert_eq!(
|
7959 + | input.iso8601_timestamp,
|
7960 + | expected.iso8601_timestamp,
|
7961 + | "Unexpected value for `iso8601_timestamp`"
|
7962 + | );
|
7963 + | ::pretty_assertions::assert_eq!(
|
7964 + | input.json_value,
|
7965 + | expected.json_value,
|
7966 + | "Unexpected value for `json_value`"
|
7967 + | );
|
7968 + | ::pretty_assertions::assert_eq!(
|
7969 + | input.list_of_lists,
|
7970 + | expected.list_of_lists,
|
7971 + | "Unexpected value for `list_of_lists`"
|
7972 + | );
|
7973 + | ::pretty_assertions::assert_eq!(
|
7974 + | input.list_of_maps_of_strings,
|
7975 + | expected.list_of_maps_of_strings,
|
7976 + | "Unexpected value for `list_of_maps_of_strings`"
|
7977 + | );
|
7978 + | ::pretty_assertions::assert_eq!(
|
7979 + | input.list_of_strings,
|
7980 + | expected.list_of_strings,
|
7981 + | "Unexpected value for `list_of_strings`"
|
7982 + | );
|
7983 + | ::pretty_assertions::assert_eq!(
|
7984 + | input.list_of_structs,
|
7985 + | expected.list_of_structs,
|
7986 + | "Unexpected value for `list_of_structs`"
|
7987 + | );
|
7988 + | ::pretty_assertions::assert_eq!(
|
7989 + | input.long,
|
7990 + | expected.long,
|
7991 + | "Unexpected value for `long`"
|
7992 + | );
|
7993 + | ::pretty_assertions::assert_eq!(
|
7994 + | input.map_of_lists_of_strings,
|
7995 + | expected.map_of_lists_of_strings,
|
7996 + | "Unexpected value for `map_of_lists_of_strings`"
|
7997 + | );
|
7998 + | ::pretty_assertions::assert_eq!(
|
7999 + | input.map_of_maps,
|
8000 + | expected.map_of_maps,
|
8001 + | "Unexpected value for `map_of_maps`"
|
8002 + | );
|
8003 + | ::pretty_assertions::assert_eq!(
|
8004 + | input.map_of_strings,
|
8005 + | expected.map_of_strings,
|
8006 + | "Unexpected value for `map_of_strings`"
|
8007 + | );
|
8008 + | ::pretty_assertions::assert_eq!(
|
8009 + | input.map_of_structs,
|
8010 + | expected.map_of_structs,
|
8011 + | "Unexpected value for `map_of_structs`"
|
8012 + | );
|
8013 + | ::pretty_assertions::assert_eq!(
|
8014 + | input.recursive_list,
|
8015 + | expected.recursive_list,
|
8016 + | "Unexpected value for `recursive_list`"
|
8017 + | );
|
8018 + | ::pretty_assertions::assert_eq!(
|
8019 + | input.recursive_map,
|
8020 + | expected.recursive_map,
|
8021 + | "Unexpected value for `recursive_map`"
|
8022 + | );
|
8023 + | ::pretty_assertions::assert_eq!(
|
8024 + | input.recursive_struct,
|
8025 + | expected.recursive_struct,
|
8026 + | "Unexpected value for `recursive_struct`"
|
8027 + | );
|
8028 + | ::pretty_assertions::assert_eq!(
|
8029 + | input.simple_struct,
|
8030 + | expected.simple_struct,
|
8031 + | "Unexpected value for `simple_struct`"
|
8032 + | );
|
8033 + | ::pretty_assertions::assert_eq!(
|
8034 + | input.string,
|
8035 + | expected.string,
|
8036 + | "Unexpected value for `string`"
|
8037 + | );
|
8038 + | ::pretty_assertions::assert_eq!(
|
8039 + | input.struct_with_json_name,
|
8040 + | expected.struct_with_json_name,
|
8041 + | "Unexpected value for `struct_with_json_name`"
|
8042 + | );
|
8043 + | ::pretty_assertions::assert_eq!(
|
8044 + | input.timestamp,
|
8045 + | expected.timestamp,
|
8046 + | "Unexpected value for `timestamp`"
|
8047 + | );
|
8048 + | ::pretty_assertions::assert_eq!(
|
8049 + | input.unix_timestamp,
|
8050 + | expected.unix_timestamp,
|
8051 + | "Unexpected value for `unix_timestamp`"
|
8052 + | );
|
8053 + | let output = crate::output::KitchenSinkOperationOutput {
|
8054 + | blob: ::std::option::Option::None,
|
8055 + | boolean: ::std::option::Option::None,
|
8056 + | double: ::std::option::Option::None,
|
8057 + | empty_struct: ::std::option::Option::None,
|
8058 + | float: ::std::option::Option::None,
|
8059 + | httpdate_timestamp: ::std::option::Option::None,
|
8060 + | integer: ::std::option::Option::None,
|
8061 + | iso8601_timestamp: ::std::option::Option::None,
|
8062 + | json_value: ::std::option::Option::None,
|
8063 + | list_of_lists: ::std::option::Option::None,
|
8064 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8065 + | list_of_strings: ::std::option::Option::None,
|
8066 + | list_of_structs: ::std::option::Option::None,
|
8067 + | long: ::std::option::Option::None,
|
8068 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8069 + | map_of_maps: ::std::option::Option::None,
|
8070 + | map_of_strings: ::std::option::Option::None,
|
8071 + | map_of_structs: ::std::option::Option::None,
|
8072 + | recursive_list: ::std::option::Option::None,
|
8073 + | recursive_map: ::std::option::Option::None,
|
8074 + | recursive_struct: ::std::option::Option::None,
|
8075 + | simple_struct: ::std::option::Option::None,
|
8076 + | string: ::std::option::Option::None,
|
8077 + | struct_with_json_name: ::std::option::Option::None,
|
8078 + | timestamp: ::std::option::Option::None,
|
8079 + | unix_timestamp: ::std::option::Option::None,
|
8080 + | };
|
8081 + | Ok(output)
|
8082 + | };
|
8083 + | sender.send(()).await.expect("receiver dropped early");
|
8084 + | result
|
8085 + | }
|
8086 + | })
|
8087 + | .build_unchecked();
|
8088 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8089 + | .await
|
8090 + | .expect("unable to make an HTTP request");
|
8091 + | assert!(
|
8092 + | receiver.recv().await.is_some(),
|
8093 + | "we expected operation handler to be invoked but it was not entered"
|
8094 + | );
|
8095 + | }
|
8096 + |
|
8097 + | /// Serializes empty map shapes
|
8098 + | /// Test ID: serializes_empty_map_shapes
|
8099 + | #[::tokio::test]
|
8100 + | #[::tracing_test::traced_test]
|
8101 + | async fn serializes_empty_map_shapes_request() {
|
8102 + | #[allow(unused_mut)]
|
8103 + | let mut http_request = ::http::Request::builder()
|
8104 + | .uri("/")
|
8105 + | .method("POST")
|
8106 + | .header("Content-Type", "application/x-amz-json-1.1")
|
8107 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
8108 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
8109 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
8110 + | "{\"MapOfStrings\":{}}".as_bytes(),
|
8111 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8112 + | )),
|
8113 + | ))
|
8114 + | .unwrap();
|
8115 + | #[allow(unused_mut)]
|
8116 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8117 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
8118 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
8119 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
8120 + | let sender = sender.clone();
|
8121 + | async move {
|
8122 + | let result = {
|
8123 + | use ::aws_smithy_protocol_test::FloatEquals;
|
8124 + | let expected = crate::input::KitchenSinkOperationInput {
|
8125 + | map_of_strings: ::std::option::Option::Some(
|
8126 + | ::std::collections::HashMap::new(),
|
8127 + | ),
|
8128 + | blob: ::std::option::Option::None,
|
8129 + | boolean: ::std::option::Option::None,
|
8130 + | double: ::std::option::Option::None,
|
8131 + | empty_struct: ::std::option::Option::None,
|
8132 + | float: ::std::option::Option::None,
|
8133 + | httpdate_timestamp: ::std::option::Option::None,
|
8134 + | integer: ::std::option::Option::None,
|
8135 + | iso8601_timestamp: ::std::option::Option::None,
|
8136 + | json_value: ::std::option::Option::None,
|
8137 + | list_of_lists: ::std::option::Option::None,
|
8138 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8139 + | list_of_strings: ::std::option::Option::None,
|
8140 + | list_of_structs: ::std::option::Option::None,
|
8141 + | long: ::std::option::Option::None,
|
8142 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8143 + | map_of_maps: ::std::option::Option::None,
|
8144 + | map_of_structs: ::std::option::Option::None,
|
8145 + | recursive_list: ::std::option::Option::None,
|
8146 + | recursive_map: ::std::option::Option::None,
|
8147 + | recursive_struct: ::std::option::Option::None,
|
8148 + | simple_struct: ::std::option::Option::None,
|
8149 + | string: ::std::option::Option::None,
|
8150 + | struct_with_json_name: ::std::option::Option::None,
|
8151 + | timestamp: ::std::option::Option::None,
|
8152 + | unix_timestamp: ::std::option::Option::None,
|
8153 + | };
|
8154 + | ::pretty_assertions::assert_eq!(
|
8155 + | input.blob,
|
8156 + | expected.blob,
|
8157 + | "Unexpected value for `blob`"
|
8158 + | );
|
8159 + | ::pretty_assertions::assert_eq!(
|
8160 + | input.boolean,
|
8161 + | expected.boolean,
|
8162 + | "Unexpected value for `boolean`"
|
8163 + | );
|
8164 + | assert!(
|
8165 + | input.double.float_equals(&expected.double),
|
8166 + | "Unexpected value for `double` {:?} vs. {:?}",
|
8167 + | expected.double,
|
8168 + | input.double
|
8169 + | );
|
8170 + | ::pretty_assertions::assert_eq!(
|
8171 + | input.empty_struct,
|
8172 + | expected.empty_struct,
|
8173 + | "Unexpected value for `empty_struct`"
|
8174 + | );
|
8175 + | assert!(
|
8176 + | input.float.float_equals(&expected.float),
|
8177 + | "Unexpected value for `float` {:?} vs. {:?}",
|
8178 + | expected.float,
|
8179 + | input.float
|
8180 + | );
|
8181 + | ::pretty_assertions::assert_eq!(
|
8182 + | input.httpdate_timestamp,
|
8183 + | expected.httpdate_timestamp,
|
8184 + | "Unexpected value for `httpdate_timestamp`"
|
8185 + | );
|
8186 + | ::pretty_assertions::assert_eq!(
|
8187 + | input.integer,
|
8188 + | expected.integer,
|
8189 + | "Unexpected value for `integer`"
|
8190 + | );
|
8191 + | ::pretty_assertions::assert_eq!(
|
8192 + | input.iso8601_timestamp,
|
8193 + | expected.iso8601_timestamp,
|
8194 + | "Unexpected value for `iso8601_timestamp`"
|
8195 + | );
|
8196 + | ::pretty_assertions::assert_eq!(
|
8197 + | input.json_value,
|
8198 + | expected.json_value,
|
8199 + | "Unexpected value for `json_value`"
|
8200 + | );
|
8201 + | ::pretty_assertions::assert_eq!(
|
8202 + | input.list_of_lists,
|
8203 + | expected.list_of_lists,
|
8204 + | "Unexpected value for `list_of_lists`"
|
8205 + | );
|
8206 + | ::pretty_assertions::assert_eq!(
|
8207 + | input.list_of_maps_of_strings,
|
8208 + | expected.list_of_maps_of_strings,
|
8209 + | "Unexpected value for `list_of_maps_of_strings`"
|
8210 + | );
|
8211 + | ::pretty_assertions::assert_eq!(
|
8212 + | input.list_of_strings,
|
8213 + | expected.list_of_strings,
|
8214 + | "Unexpected value for `list_of_strings`"
|
8215 + | );
|
8216 + | ::pretty_assertions::assert_eq!(
|
8217 + | input.list_of_structs,
|
8218 + | expected.list_of_structs,
|
8219 + | "Unexpected value for `list_of_structs`"
|
8220 + | );
|
8221 + | ::pretty_assertions::assert_eq!(
|
8222 + | input.long,
|
8223 + | expected.long,
|
8224 + | "Unexpected value for `long`"
|
8225 + | );
|
8226 + | ::pretty_assertions::assert_eq!(
|
8227 + | input.map_of_lists_of_strings,
|
8228 + | expected.map_of_lists_of_strings,
|
8229 + | "Unexpected value for `map_of_lists_of_strings`"
|
8230 + | );
|
8231 + | ::pretty_assertions::assert_eq!(
|
8232 + | input.map_of_maps,
|
8233 + | expected.map_of_maps,
|
8234 + | "Unexpected value for `map_of_maps`"
|
8235 + | );
|
8236 + | ::pretty_assertions::assert_eq!(
|
8237 + | input.map_of_strings,
|
8238 + | expected.map_of_strings,
|
8239 + | "Unexpected value for `map_of_strings`"
|
8240 + | );
|
8241 + | ::pretty_assertions::assert_eq!(
|
8242 + | input.map_of_structs,
|
8243 + | expected.map_of_structs,
|
8244 + | "Unexpected value for `map_of_structs`"
|
8245 + | );
|
8246 + | ::pretty_assertions::assert_eq!(
|
8247 + | input.recursive_list,
|
8248 + | expected.recursive_list,
|
8249 + | "Unexpected value for `recursive_list`"
|
8250 + | );
|
8251 + | ::pretty_assertions::assert_eq!(
|
8252 + | input.recursive_map,
|
8253 + | expected.recursive_map,
|
8254 + | "Unexpected value for `recursive_map`"
|
8255 + | );
|
8256 + | ::pretty_assertions::assert_eq!(
|
8257 + | input.recursive_struct,
|
8258 + | expected.recursive_struct,
|
8259 + | "Unexpected value for `recursive_struct`"
|
8260 + | );
|
8261 + | ::pretty_assertions::assert_eq!(
|
8262 + | input.simple_struct,
|
8263 + | expected.simple_struct,
|
8264 + | "Unexpected value for `simple_struct`"
|
8265 + | );
|
8266 + | ::pretty_assertions::assert_eq!(
|
8267 + | input.string,
|
8268 + | expected.string,
|
8269 + | "Unexpected value for `string`"
|
8270 + | );
|
8271 + | ::pretty_assertions::assert_eq!(
|
8272 + | input.struct_with_json_name,
|
8273 + | expected.struct_with_json_name,
|
8274 + | "Unexpected value for `struct_with_json_name`"
|
8275 + | );
|
8276 + | ::pretty_assertions::assert_eq!(
|
8277 + | input.timestamp,
|
8278 + | expected.timestamp,
|
8279 + | "Unexpected value for `timestamp`"
|
8280 + | );
|
8281 + | ::pretty_assertions::assert_eq!(
|
8282 + | input.unix_timestamp,
|
8283 + | expected.unix_timestamp,
|
8284 + | "Unexpected value for `unix_timestamp`"
|
8285 + | );
|
8286 + | let output = crate::output::KitchenSinkOperationOutput {
|
8287 + | blob: ::std::option::Option::None,
|
8288 + | boolean: ::std::option::Option::None,
|
8289 + | double: ::std::option::Option::None,
|
8290 + | empty_struct: ::std::option::Option::None,
|
8291 + | float: ::std::option::Option::None,
|
8292 + | httpdate_timestamp: ::std::option::Option::None,
|
8293 + | integer: ::std::option::Option::None,
|
8294 + | iso8601_timestamp: ::std::option::Option::None,
|
8295 + | json_value: ::std::option::Option::None,
|
8296 + | list_of_lists: ::std::option::Option::None,
|
8297 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8298 + | list_of_strings: ::std::option::Option::None,
|
8299 + | list_of_structs: ::std::option::Option::None,
|
8300 + | long: ::std::option::Option::None,
|
8301 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8302 + | map_of_maps: ::std::option::Option::None,
|
8303 + | map_of_strings: ::std::option::Option::None,
|
8304 + | map_of_structs: ::std::option::Option::None,
|
8305 + | recursive_list: ::std::option::Option::None,
|
8306 + | recursive_map: ::std::option::Option::None,
|
8307 + | recursive_struct: ::std::option::Option::None,
|
8308 + | simple_struct: ::std::option::Option::None,
|
8309 + | string: ::std::option::Option::None,
|
8310 + | struct_with_json_name: ::std::option::Option::None,
|
8311 + | timestamp: ::std::option::Option::None,
|
8312 + | unix_timestamp: ::std::option::Option::None,
|
8313 + | };
|
8314 + | Ok(output)
|
8315 + | };
|
8316 + | sender.send(()).await.expect("receiver dropped early");
|
8317 + | result
|
8318 + | }
|
8319 + | })
|
8320 + | .build_unchecked();
|
8321 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8322 + | .await
|
8323 + | .expect("unable to make an HTTP request");
|
8324 + | assert!(
|
8325 + | receiver.recv().await.is_some(),
|
8326 + | "we expected operation handler to be invoked but it was not entered"
|
8327 + | );
|
8328 + | }
|
8329 + |
|
8330 + | /// Serializes map of list shapes
|
8331 + | /// Test ID: serializes_map_of_list_shapes
|
8332 + | #[::tokio::test]
|
8333 + | #[::tracing_test::traced_test]
|
8334 + | async fn serializes_map_of_list_shapes_request() {
|
8335 + | #[allow(unused_mut)]
|
8336 + | let mut http_request = ::http::Request::builder()
|
8337 + | .uri("/")
|
8338 + | .method("POST")
|
8339 + | .header("Content-Type", "application/x-amz-json-1.1")
|
8340 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
8341 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
8342 + | ::bytes::Bytes::copy_from_slice(
|
8343 + | &::aws_smithy_protocol_test::decode_body_data("{\"MapOfListsOfStrings\":{\"abc\":[\"abc\",\"xyz\"],\"mno\":[\"xyz\",\"abc\"]}}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
8344 + | )
|
8345 + | )).unwrap();
|
8346 + | #[allow(unused_mut)]
|
8347 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8348 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
8349 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
8350 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
8351 + | let sender = sender.clone();
|
8352 + | async move {
|
8353 + | let result = {
|
8354 + | use ::aws_smithy_protocol_test::FloatEquals;
|
8355 + | let expected = crate::input::KitchenSinkOperationInput {
|
8356 + | map_of_lists_of_strings: ::std::option::Option::Some({
|
8357 + | let mut ret = ::std::collections::HashMap::new();
|
8358 + | ret.insert(
|
8359 + | "abc".to_owned(),
|
8360 + | vec!["abc".to_owned(), "xyz".to_owned()],
|
8361 + | );
|
8362 + | ret.insert(
|
8363 + | "mno".to_owned(),
|
8364 + | vec!["xyz".to_owned(), "abc".to_owned()],
|
8365 + | );
|
8366 + | ret
|
8367 + | }),
|
8368 + | blob: ::std::option::Option::None,
|
8369 + | boolean: ::std::option::Option::None,
|
8370 + | double: ::std::option::Option::None,
|
8371 + | empty_struct: ::std::option::Option::None,
|
8372 + | float: ::std::option::Option::None,
|
8373 + | httpdate_timestamp: ::std::option::Option::None,
|
8374 + | integer: ::std::option::Option::None,
|
8375 + | iso8601_timestamp: ::std::option::Option::None,
|
8376 + | json_value: ::std::option::Option::None,
|
8377 + | list_of_lists: ::std::option::Option::None,
|
8378 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8379 + | list_of_strings: ::std::option::Option::None,
|
8380 + | list_of_structs: ::std::option::Option::None,
|
8381 + | long: ::std::option::Option::None,
|
8382 + | map_of_maps: ::std::option::Option::None,
|
8383 + | map_of_strings: ::std::option::Option::None,
|
8384 + | map_of_structs: ::std::option::Option::None,
|
8385 + | recursive_list: ::std::option::Option::None,
|
8386 + | recursive_map: ::std::option::Option::None,
|
8387 + | recursive_struct: ::std::option::Option::None,
|
8388 + | simple_struct: ::std::option::Option::None,
|
8389 + | string: ::std::option::Option::None,
|
8390 + | struct_with_json_name: ::std::option::Option::None,
|
8391 + | timestamp: ::std::option::Option::None,
|
8392 + | unix_timestamp: ::std::option::Option::None,
|
8393 + | };
|
8394 + | ::pretty_assertions::assert_eq!(
|
8395 + | input.blob,
|
8396 + | expected.blob,
|
8397 + | "Unexpected value for `blob`"
|
8398 + | );
|
8399 + | ::pretty_assertions::assert_eq!(
|
8400 + | input.boolean,
|
8401 + | expected.boolean,
|
8402 + | "Unexpected value for `boolean`"
|
8403 + | );
|
8404 + | assert!(
|
8405 + | input.double.float_equals(&expected.double),
|
8406 + | "Unexpected value for `double` {:?} vs. {:?}",
|
8407 + | expected.double,
|
8408 + | input.double
|
8409 + | );
|
8410 + | ::pretty_assertions::assert_eq!(
|
8411 + | input.empty_struct,
|
8412 + | expected.empty_struct,
|
8413 + | "Unexpected value for `empty_struct`"
|
8414 + | );
|
8415 + | assert!(
|
8416 + | input.float.float_equals(&expected.float),
|
8417 + | "Unexpected value for `float` {:?} vs. {:?}",
|
8418 + | expected.float,
|
8419 + | input.float
|
8420 + | );
|
8421 + | ::pretty_assertions::assert_eq!(
|
8422 + | input.httpdate_timestamp,
|
8423 + | expected.httpdate_timestamp,
|
8424 + | "Unexpected value for `httpdate_timestamp`"
|
8425 + | );
|
8426 + | ::pretty_assertions::assert_eq!(
|
8427 + | input.integer,
|
8428 + | expected.integer,
|
8429 + | "Unexpected value for `integer`"
|
8430 + | );
|
8431 + | ::pretty_assertions::assert_eq!(
|
8432 + | input.iso8601_timestamp,
|
8433 + | expected.iso8601_timestamp,
|
8434 + | "Unexpected value for `iso8601_timestamp`"
|
8435 + | );
|
8436 + | ::pretty_assertions::assert_eq!(
|
8437 + | input.json_value,
|
8438 + | expected.json_value,
|
8439 + | "Unexpected value for `json_value`"
|
8440 + | );
|
8441 + | ::pretty_assertions::assert_eq!(
|
8442 + | input.list_of_lists,
|
8443 + | expected.list_of_lists,
|
8444 + | "Unexpected value for `list_of_lists`"
|
8445 + | );
|
8446 + | ::pretty_assertions::assert_eq!(
|
8447 + | input.list_of_maps_of_strings,
|
8448 + | expected.list_of_maps_of_strings,
|
8449 + | "Unexpected value for `list_of_maps_of_strings`"
|
8450 + | );
|
8451 + | ::pretty_assertions::assert_eq!(
|
8452 + | input.list_of_strings,
|
8453 + | expected.list_of_strings,
|
8454 + | "Unexpected value for `list_of_strings`"
|
8455 + | );
|
8456 + | ::pretty_assertions::assert_eq!(
|
8457 + | input.list_of_structs,
|
8458 + | expected.list_of_structs,
|
8459 + | "Unexpected value for `list_of_structs`"
|
8460 + | );
|
8461 + | ::pretty_assertions::assert_eq!(
|
8462 + | input.long,
|
8463 + | expected.long,
|
8464 + | "Unexpected value for `long`"
|
8465 + | );
|
8466 + | ::pretty_assertions::assert_eq!(
|
8467 + | input.map_of_lists_of_strings,
|
8468 + | expected.map_of_lists_of_strings,
|
8469 + | "Unexpected value for `map_of_lists_of_strings`"
|
8470 + | );
|
8471 + | ::pretty_assertions::assert_eq!(
|
8472 + | input.map_of_maps,
|
8473 + | expected.map_of_maps,
|
8474 + | "Unexpected value for `map_of_maps`"
|
8475 + | );
|
8476 + | ::pretty_assertions::assert_eq!(
|
8477 + | input.map_of_strings,
|
8478 + | expected.map_of_strings,
|
8479 + | "Unexpected value for `map_of_strings`"
|
8480 + | );
|
8481 + | ::pretty_assertions::assert_eq!(
|
8482 + | input.map_of_structs,
|
8483 + | expected.map_of_structs,
|
8484 + | "Unexpected value for `map_of_structs`"
|
8485 + | );
|
8486 + | ::pretty_assertions::assert_eq!(
|
8487 + | input.recursive_list,
|
8488 + | expected.recursive_list,
|
8489 + | "Unexpected value for `recursive_list`"
|
8490 + | );
|
8491 + | ::pretty_assertions::assert_eq!(
|
8492 + | input.recursive_map,
|
8493 + | expected.recursive_map,
|
8494 + | "Unexpected value for `recursive_map`"
|
8495 + | );
|
8496 + | ::pretty_assertions::assert_eq!(
|
8497 + | input.recursive_struct,
|
8498 + | expected.recursive_struct,
|
8499 + | "Unexpected value for `recursive_struct`"
|
8500 + | );
|
8501 + | ::pretty_assertions::assert_eq!(
|
8502 + | input.simple_struct,
|
8503 + | expected.simple_struct,
|
8504 + | "Unexpected value for `simple_struct`"
|
8505 + | );
|
8506 + | ::pretty_assertions::assert_eq!(
|
8507 + | input.string,
|
8508 + | expected.string,
|
8509 + | "Unexpected value for `string`"
|
8510 + | );
|
8511 + | ::pretty_assertions::assert_eq!(
|
8512 + | input.struct_with_json_name,
|
8513 + | expected.struct_with_json_name,
|
8514 + | "Unexpected value for `struct_with_json_name`"
|
8515 + | );
|
8516 + | ::pretty_assertions::assert_eq!(
|
8517 + | input.timestamp,
|
8518 + | expected.timestamp,
|
8519 + | "Unexpected value for `timestamp`"
|
8520 + | );
|
8521 + | ::pretty_assertions::assert_eq!(
|
8522 + | input.unix_timestamp,
|
8523 + | expected.unix_timestamp,
|
8524 + | "Unexpected value for `unix_timestamp`"
|
8525 + | );
|
8526 + | let output = crate::output::KitchenSinkOperationOutput {
|
8527 + | blob: ::std::option::Option::None,
|
8528 + | boolean: ::std::option::Option::None,
|
8529 + | double: ::std::option::Option::None,
|
8530 + | empty_struct: ::std::option::Option::None,
|
8531 + | float: ::std::option::Option::None,
|
8532 + | httpdate_timestamp: ::std::option::Option::None,
|
8533 + | integer: ::std::option::Option::None,
|
8534 + | iso8601_timestamp: ::std::option::Option::None,
|
8535 + | json_value: ::std::option::Option::None,
|
8536 + | list_of_lists: ::std::option::Option::None,
|
8537 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8538 + | list_of_strings: ::std::option::Option::None,
|
8539 + | list_of_structs: ::std::option::Option::None,
|
8540 + | long: ::std::option::Option::None,
|
8541 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8542 + | map_of_maps: ::std::option::Option::None,
|
8543 + | map_of_strings: ::std::option::Option::None,
|
8544 + | map_of_structs: ::std::option::Option::None,
|
8545 + | recursive_list: ::std::option::Option::None,
|
8546 + | recursive_map: ::std::option::Option::None,
|
8547 + | recursive_struct: ::std::option::Option::None,
|
8548 + | simple_struct: ::std::option::Option::None,
|
8549 + | string: ::std::option::Option::None,
|
8550 + | struct_with_json_name: ::std::option::Option::None,
|
8551 + | timestamp: ::std::option::Option::None,
|
8552 + | unix_timestamp: ::std::option::Option::None,
|
8553 + | };
|
8554 + | Ok(output)
|
8555 + | };
|
8556 + | sender.send(()).await.expect("receiver dropped early");
|
8557 + | result
|
8558 + | }
|
8559 + | })
|
8560 + | .build_unchecked();
|
8561 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8562 + | .await
|
8563 + | .expect("unable to make an HTTP request");
|
8564 + | assert!(
|
8565 + | receiver.recv().await.is_some(),
|
8566 + | "we expected operation handler to be invoked but it was not entered"
|
8567 + | );
|
8568 + | }
|
8569 + |
|
8570 + | /// Serializes map of structure shapes
|
8571 + | /// Test ID: serializes_map_of_structure_shapes
|
8572 + | #[::tokio::test]
|
8573 + | #[::tracing_test::traced_test]
|
8574 + | async fn serializes_map_of_structure_shapes_request() {
|
8575 + | #[allow(unused_mut)]
|
8576 + | let mut http_request = ::http::Request::builder()
|
8577 + | .uri("/")
|
8578 + | .method("POST")
|
8579 + | .header("Content-Type", "application/x-amz-json-1.1")
|
8580 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
8581 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
8582 + | ::bytes::Bytes::copy_from_slice(
|
8583 + | &::aws_smithy_protocol_test::decode_body_data("{\"MapOfStructs\":{\"key1\":{\"Value\":\"value-1\"},\"key2\":{\"Value\":\"value-2\"}}}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
8584 + | )
|
8585 + | )).unwrap();
|
8586 + | #[allow(unused_mut)]
|
8587 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8588 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
8589 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
8590 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
8591 + | let sender = sender.clone();
|
8592 + | async move {
|
8593 + | let result = {
|
8594 + | use ::aws_smithy_protocol_test::FloatEquals;
|
8595 + | let expected = crate::input::KitchenSinkOperationInput {
|
8596 + | map_of_structs: ::std::option::Option::Some({
|
8597 + | let mut ret = ::std::collections::HashMap::new();
|
8598 + | ret.insert(
|
8599 + | "key1".to_owned(),
|
8600 + | crate::model::SimpleStruct {
|
8601 + | value: ::std::option::Option::Some("value-1".to_owned()),
|
8602 + | },
|
8603 + | );
|
8604 + | ret.insert(
|
8605 + | "key2".to_owned(),
|
8606 + | crate::model::SimpleStruct {
|
8607 + | value: ::std::option::Option::Some("value-2".to_owned()),
|
8608 + | },
|
8609 + | );
|
8610 + | ret
|
8611 + | }),
|
8612 + | blob: ::std::option::Option::None,
|
8613 + | boolean: ::std::option::Option::None,
|
8614 + | double: ::std::option::Option::None,
|
8615 + | empty_struct: ::std::option::Option::None,
|
8616 + | float: ::std::option::Option::None,
|
8617 + | httpdate_timestamp: ::std::option::Option::None,
|
8618 + | integer: ::std::option::Option::None,
|
8619 + | iso8601_timestamp: ::std::option::Option::None,
|
8620 + | json_value: ::std::option::Option::None,
|
8621 + | list_of_lists: ::std::option::Option::None,
|
8622 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8623 + | list_of_strings: ::std::option::Option::None,
|
8624 + | list_of_structs: ::std::option::Option::None,
|
8625 + | long: ::std::option::Option::None,
|
8626 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8627 + | map_of_maps: ::std::option::Option::None,
|
8628 + | map_of_strings: ::std::option::Option::None,
|
8629 + | recursive_list: ::std::option::Option::None,
|
8630 + | recursive_map: ::std::option::Option::None,
|
8631 + | recursive_struct: ::std::option::Option::None,
|
8632 + | simple_struct: ::std::option::Option::None,
|
8633 + | string: ::std::option::Option::None,
|
8634 + | struct_with_json_name: ::std::option::Option::None,
|
8635 + | timestamp: ::std::option::Option::None,
|
8636 + | unix_timestamp: ::std::option::Option::None,
|
8637 + | };
|
8638 + | ::pretty_assertions::assert_eq!(
|
8639 + | input.blob,
|
8640 + | expected.blob,
|
8641 + | "Unexpected value for `blob`"
|
8642 + | );
|
8643 + | ::pretty_assertions::assert_eq!(
|
8644 + | input.boolean,
|
8645 + | expected.boolean,
|
8646 + | "Unexpected value for `boolean`"
|
8647 + | );
|
8648 + | assert!(
|
8649 + | input.double.float_equals(&expected.double),
|
8650 + | "Unexpected value for `double` {:?} vs. {:?}",
|
8651 + | expected.double,
|
8652 + | input.double
|
8653 + | );
|
8654 + | ::pretty_assertions::assert_eq!(
|
8655 + | input.empty_struct,
|
8656 + | expected.empty_struct,
|
8657 + | "Unexpected value for `empty_struct`"
|
8658 + | );
|
8659 + | assert!(
|
8660 + | input.float.float_equals(&expected.float),
|
8661 + | "Unexpected value for `float` {:?} vs. {:?}",
|
8662 + | expected.float,
|
8663 + | input.float
|
8664 + | );
|
8665 + | ::pretty_assertions::assert_eq!(
|
8666 + | input.httpdate_timestamp,
|
8667 + | expected.httpdate_timestamp,
|
8668 + | "Unexpected value for `httpdate_timestamp`"
|
8669 + | );
|
8670 + | ::pretty_assertions::assert_eq!(
|
8671 + | input.integer,
|
8672 + | expected.integer,
|
8673 + | "Unexpected value for `integer`"
|
8674 + | );
|
8675 + | ::pretty_assertions::assert_eq!(
|
8676 + | input.iso8601_timestamp,
|
8677 + | expected.iso8601_timestamp,
|
8678 + | "Unexpected value for `iso8601_timestamp`"
|
8679 + | );
|
8680 + | ::pretty_assertions::assert_eq!(
|
8681 + | input.json_value,
|
8682 + | expected.json_value,
|
8683 + | "Unexpected value for `json_value`"
|
8684 + | );
|
8685 + | ::pretty_assertions::assert_eq!(
|
8686 + | input.list_of_lists,
|
8687 + | expected.list_of_lists,
|
8688 + | "Unexpected value for `list_of_lists`"
|
8689 + | );
|
8690 + | ::pretty_assertions::assert_eq!(
|
8691 + | input.list_of_maps_of_strings,
|
8692 + | expected.list_of_maps_of_strings,
|
8693 + | "Unexpected value for `list_of_maps_of_strings`"
|
8694 + | );
|
8695 + | ::pretty_assertions::assert_eq!(
|
8696 + | input.list_of_strings,
|
8697 + | expected.list_of_strings,
|
8698 + | "Unexpected value for `list_of_strings`"
|
8699 + | );
|
8700 + | ::pretty_assertions::assert_eq!(
|
8701 + | input.list_of_structs,
|
8702 + | expected.list_of_structs,
|
8703 + | "Unexpected value for `list_of_structs`"
|
8704 + | );
|
8705 + | ::pretty_assertions::assert_eq!(
|
8706 + | input.long,
|
8707 + | expected.long,
|
8708 + | "Unexpected value for `long`"
|
8709 + | );
|
8710 + | ::pretty_assertions::assert_eq!(
|
8711 + | input.map_of_lists_of_strings,
|
8712 + | expected.map_of_lists_of_strings,
|
8713 + | "Unexpected value for `map_of_lists_of_strings`"
|
8714 + | );
|
8715 + | ::pretty_assertions::assert_eq!(
|
8716 + | input.map_of_maps,
|
8717 + | expected.map_of_maps,
|
8718 + | "Unexpected value for `map_of_maps`"
|
8719 + | );
|
8720 + | ::pretty_assertions::assert_eq!(
|
8721 + | input.map_of_strings,
|
8722 + | expected.map_of_strings,
|
8723 + | "Unexpected value for `map_of_strings`"
|
8724 + | );
|
8725 + | ::pretty_assertions::assert_eq!(
|
8726 + | input.map_of_structs,
|
8727 + | expected.map_of_structs,
|
8728 + | "Unexpected value for `map_of_structs`"
|
8729 + | );
|
8730 + | ::pretty_assertions::assert_eq!(
|
8731 + | input.recursive_list,
|
8732 + | expected.recursive_list,
|
8733 + | "Unexpected value for `recursive_list`"
|
8734 + | );
|
8735 + | ::pretty_assertions::assert_eq!(
|
8736 + | input.recursive_map,
|
8737 + | expected.recursive_map,
|
8738 + | "Unexpected value for `recursive_map`"
|
8739 + | );
|
8740 + | ::pretty_assertions::assert_eq!(
|
8741 + | input.recursive_struct,
|
8742 + | expected.recursive_struct,
|
8743 + | "Unexpected value for `recursive_struct`"
|
8744 + | );
|
8745 + | ::pretty_assertions::assert_eq!(
|
8746 + | input.simple_struct,
|
8747 + | expected.simple_struct,
|
8748 + | "Unexpected value for `simple_struct`"
|
8749 + | );
|
8750 + | ::pretty_assertions::assert_eq!(
|
8751 + | input.string,
|
8752 + | expected.string,
|
8753 + | "Unexpected value for `string`"
|
8754 + | );
|
8755 + | ::pretty_assertions::assert_eq!(
|
8756 + | input.struct_with_json_name,
|
8757 + | expected.struct_with_json_name,
|
8758 + | "Unexpected value for `struct_with_json_name`"
|
8759 + | );
|
8760 + | ::pretty_assertions::assert_eq!(
|
8761 + | input.timestamp,
|
8762 + | expected.timestamp,
|
8763 + | "Unexpected value for `timestamp`"
|
8764 + | );
|
8765 + | ::pretty_assertions::assert_eq!(
|
8766 + | input.unix_timestamp,
|
8767 + | expected.unix_timestamp,
|
8768 + | "Unexpected value for `unix_timestamp`"
|
8769 + | );
|
8770 + | let output = crate::output::KitchenSinkOperationOutput {
|
8771 + | blob: ::std::option::Option::None,
|
8772 + | boolean: ::std::option::Option::None,
|
8773 + | double: ::std::option::Option::None,
|
8774 + | empty_struct: ::std::option::Option::None,
|
8775 + | float: ::std::option::Option::None,
|
8776 + | httpdate_timestamp: ::std::option::Option::None,
|
8777 + | integer: ::std::option::Option::None,
|
8778 + | iso8601_timestamp: ::std::option::Option::None,
|
8779 + | json_value: ::std::option::Option::None,
|
8780 + | list_of_lists: ::std::option::Option::None,
|
8781 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8782 + | list_of_strings: ::std::option::Option::None,
|
8783 + | list_of_structs: ::std::option::Option::None,
|
8784 + | long: ::std::option::Option::None,
|
8785 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8786 + | map_of_maps: ::std::option::Option::None,
|
8787 + | map_of_strings: ::std::option::Option::None,
|
8788 + | map_of_structs: ::std::option::Option::None,
|
8789 + | recursive_list: ::std::option::Option::None,
|
8790 + | recursive_map: ::std::option::Option::None,
|
8791 + | recursive_struct: ::std::option::Option::None,
|
8792 + | simple_struct: ::std::option::Option::None,
|
8793 + | string: ::std::option::Option::None,
|
8794 + | struct_with_json_name: ::std::option::Option::None,
|
8795 + | timestamp: ::std::option::Option::None,
|
8796 + | unix_timestamp: ::std::option::Option::None,
|
8797 + | };
|
8798 + | Ok(output)
|
8799 + | };
|
8800 + | sender.send(()).await.expect("receiver dropped early");
|
8801 + | result
|
8802 + | }
|
8803 + | })
|
8804 + | .build_unchecked();
|
8805 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8806 + | .await
|
8807 + | .expect("unable to make an HTTP request");
|
8808 + | assert!(
|
8809 + | receiver.recv().await.is_some(),
|
8810 + | "we expected operation handler to be invoked but it was not entered"
|
8811 + | );
|
8812 + | }
|
8813 + |
|
8814 + | /// Serializes map of recursive structure shapes
|
8815 + | /// Test ID: serializes_map_of_recursive_structure_shapes
|
8816 + | #[::tokio::test]
|
8817 + | #[::tracing_test::traced_test]
|
8818 + | async fn serializes_map_of_recursive_structure_shapes_request() {
|
8819 + | #[allow(unused_mut)]
|
8820 + | let mut http_request = ::http::Request::builder()
|
8821 + | .uri("/")
|
8822 + | .method("POST")
|
8823 + | .header("Content-Type", "application/x-amz-json-1.1")
|
8824 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
8825 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
8826 + | ::bytes::Bytes::copy_from_slice(
|
8827 + | &::aws_smithy_protocol_test::decode_body_data("{\"RecursiveMap\":{\"key1\":{\"RecursiveMap\":{\"key2\":{\"RecursiveMap\":{\"key3\":{\"Boolean\":false}}}}}}}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
8828 + | )
|
8829 + | )).unwrap();
|
8830 + | #[allow(unused_mut)]
|
8831 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8832 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
8833 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
8834 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
8835 + | let sender = sender.clone();
|
8836 + | async move {
|
8837 + | let result = {
|
8838 + | use ::aws_smithy_protocol_test::FloatEquals;
|
8839 + | let expected = crate::input::KitchenSinkOperationInput {
|
8840 + | recursive_map: ::std::option::Option::Some({
|
8841 + | let mut ret = ::std::collections::HashMap::new();
|
8842 + | ret.insert(
|
8843 + | "key1".to_owned(),
|
8844 + | crate::model::KitchenSink {
|
8845 + | recursive_map: ::std::option::Option::Some({
|
8846 + | let mut ret = ::std::collections::HashMap::new();
|
8847 + | ret.insert(
|
8848 + | "key2".to_owned(),
|
8849 + | crate::model::KitchenSink {
|
8850 + | recursive_map: ::std::option::Option::Some({
|
8851 + | let mut ret =
|
8852 + | ::std::collections::HashMap::new();
|
8853 + | ret.insert(
|
8854 + | "key3".to_owned(),
|
8855 + | crate::model::KitchenSink {
|
8856 + | boolean:
|
8857 + | ::std::option::Option::Some(
|
8858 + | false,
|
8859 + | ),
|
8860 + | blob: ::std::option::Option::None,
|
8861 + | double: ::std::option::Option::None,
|
8862 + | empty_struct:
|
8863 + | ::std::option::Option::None,
|
8864 + | float: ::std::option::Option::None,
|
8865 + | httpdate_timestamp:
|
8866 + | ::std::option::Option::None,
|
8867 + | integer:
|
8868 + | ::std::option::Option::None,
|
8869 + | iso8601_timestamp:
|
8870 + | ::std::option::Option::None,
|
8871 + | json_value:
|
8872 + | ::std::option::Option::None,
|
8873 + | list_of_lists:
|
8874 + | ::std::option::Option::None,
|
8875 + | list_of_maps_of_strings:
|
8876 + | ::std::option::Option::None,
|
8877 + | list_of_strings:
|
8878 + | ::std::option::Option::None,
|
8879 + | list_of_structs:
|
8880 + | ::std::option::Option::None,
|
8881 + | long: ::std::option::Option::None,
|
8882 + | map_of_lists_of_strings:
|
8883 + | ::std::option::Option::None,
|
8884 + | map_of_maps:
|
8885 + | ::std::option::Option::None,
|
8886 + | map_of_strings:
|
8887 + | ::std::option::Option::None,
|
8888 + | map_of_structs:
|
8889 + | ::std::option::Option::None,
|
8890 + | recursive_list:
|
8891 + | ::std::option::Option::None,
|
8892 + | recursive_map:
|
8893 + | ::std::option::Option::None,
|
8894 + | recursive_struct:
|
8895 + | ::std::option::Option::None,
|
8896 + | simple_struct:
|
8897 + | ::std::option::Option::None,
|
8898 + | string: ::std::option::Option::None,
|
8899 + | struct_with_json_name:
|
8900 + | ::std::option::Option::None,
|
8901 + | timestamp:
|
8902 + | ::std::option::Option::None,
|
8903 + | unix_timestamp:
|
8904 + | ::std::option::Option::None,
|
8905 + | },
|
8906 + | );
|
8907 + | ret
|
8908 + | }),
|
8909 + | blob: ::std::option::Option::None,
|
8910 + | boolean: ::std::option::Option::None,
|
8911 + | double: ::std::option::Option::None,
|
8912 + | empty_struct: ::std::option::Option::None,
|
8913 + | float: ::std::option::Option::None,
|
8914 + | httpdate_timestamp: ::std::option::Option::None,
|
8915 + | integer: ::std::option::Option::None,
|
8916 + | iso8601_timestamp: ::std::option::Option::None,
|
8917 + | json_value: ::std::option::Option::None,
|
8918 + | list_of_lists: ::std::option::Option::None,
|
8919 + | list_of_maps_of_strings:
|
8920 + | ::std::option::Option::None,
|
8921 + | list_of_strings: ::std::option::Option::None,
|
8922 + | list_of_structs: ::std::option::Option::None,
|
8923 + | long: ::std::option::Option::None,
|
8924 + | map_of_lists_of_strings:
|
8925 + | ::std::option::Option::None,
|
8926 + | map_of_maps: ::std::option::Option::None,
|
8927 + | map_of_strings: ::std::option::Option::None,
|
8928 + | map_of_structs: ::std::option::Option::None,
|
8929 + | recursive_list: ::std::option::Option::None,
|
8930 + | recursive_struct: ::std::option::Option::None,
|
8931 + | simple_struct: ::std::option::Option::None,
|
8932 + | string: ::std::option::Option::None,
|
8933 + | struct_with_json_name:
|
8934 + | ::std::option::Option::None,
|
8935 + | timestamp: ::std::option::Option::None,
|
8936 + | unix_timestamp: ::std::option::Option::None,
|
8937 + | },
|
8938 + | );
|
8939 + | ret
|
8940 + | }),
|
8941 + | blob: ::std::option::Option::None,
|
8942 + | boolean: ::std::option::Option::None,
|
8943 + | double: ::std::option::Option::None,
|
8944 + | empty_struct: ::std::option::Option::None,
|
8945 + | float: ::std::option::Option::None,
|
8946 + | httpdate_timestamp: ::std::option::Option::None,
|
8947 + | integer: ::std::option::Option::None,
|
8948 + | iso8601_timestamp: ::std::option::Option::None,
|
8949 + | json_value: ::std::option::Option::None,
|
8950 + | list_of_lists: ::std::option::Option::None,
|
8951 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8952 + | list_of_strings: ::std::option::Option::None,
|
8953 + | list_of_structs: ::std::option::Option::None,
|
8954 + | long: ::std::option::Option::None,
|
8955 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8956 + | map_of_maps: ::std::option::Option::None,
|
8957 + | map_of_strings: ::std::option::Option::None,
|
8958 + | map_of_structs: ::std::option::Option::None,
|
8959 + | recursive_list: ::std::option::Option::None,
|
8960 + | recursive_struct: ::std::option::Option::None,
|
8961 + | simple_struct: ::std::option::Option::None,
|
8962 + | string: ::std::option::Option::None,
|
8963 + | struct_with_json_name: ::std::option::Option::None,
|
8964 + | timestamp: ::std::option::Option::None,
|
8965 + | unix_timestamp: ::std::option::Option::None,
|
8966 + | },
|
8967 + | );
|
8968 + | ret
|
8969 + | }),
|
8970 + | blob: ::std::option::Option::None,
|
8971 + | boolean: ::std::option::Option::None,
|
8972 + | double: ::std::option::Option::None,
|
8973 + | empty_struct: ::std::option::Option::None,
|
8974 + | float: ::std::option::Option::None,
|
8975 + | httpdate_timestamp: ::std::option::Option::None,
|
8976 + | integer: ::std::option::Option::None,
|
8977 + | iso8601_timestamp: ::std::option::Option::None,
|
8978 + | json_value: ::std::option::Option::None,
|
8979 + | list_of_lists: ::std::option::Option::None,
|
8980 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8981 + | list_of_strings: ::std::option::Option::None,
|
8982 + | list_of_structs: ::std::option::Option::None,
|
8983 + | long: ::std::option::Option::None,
|
8984 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8985 + | map_of_maps: ::std::option::Option::None,
|
8986 + | map_of_strings: ::std::option::Option::None,
|
8987 + | map_of_structs: ::std::option::Option::None,
|
8988 + | recursive_list: ::std::option::Option::None,
|
8989 + | recursive_struct: ::std::option::Option::None,
|
8990 + | simple_struct: ::std::option::Option::None,
|
8991 + | string: ::std::option::Option::None,
|
8992 + | struct_with_json_name: ::std::option::Option::None,
|
8993 + | timestamp: ::std::option::Option::None,
|
8994 + | unix_timestamp: ::std::option::Option::None,
|
8995 + | };
|
8996 + | ::pretty_assertions::assert_eq!(
|
8997 + | input.blob,
|
8998 + | expected.blob,
|
8999 + | "Unexpected value for `blob`"
|
9000 + | );
|
9001 + | ::pretty_assertions::assert_eq!(
|
9002 + | input.boolean,
|
9003 + | expected.boolean,
|
9004 + | "Unexpected value for `boolean`"
|
9005 + | );
|
9006 + | assert!(
|
9007 + | input.double.float_equals(&expected.double),
|
9008 + | "Unexpected value for `double` {:?} vs. {:?}",
|
9009 + | expected.double,
|
9010 + | input.double
|
9011 + | );
|
9012 + | ::pretty_assertions::assert_eq!(
|
9013 + | input.empty_struct,
|
9014 + | expected.empty_struct,
|
9015 + | "Unexpected value for `empty_struct`"
|
9016 + | );
|
9017 + | assert!(
|
9018 + | input.float.float_equals(&expected.float),
|
9019 + | "Unexpected value for `float` {:?} vs. {:?}",
|
9020 + | expected.float,
|
9021 + | input.float
|
9022 + | );
|
9023 + | ::pretty_assertions::assert_eq!(
|
9024 + | input.httpdate_timestamp,
|
9025 + | expected.httpdate_timestamp,
|
9026 + | "Unexpected value for `httpdate_timestamp`"
|
9027 + | );
|
9028 + | ::pretty_assertions::assert_eq!(
|
9029 + | input.integer,
|
9030 + | expected.integer,
|
9031 + | "Unexpected value for `integer`"
|
9032 + | );
|
9033 + | ::pretty_assertions::assert_eq!(
|
9034 + | input.iso8601_timestamp,
|
9035 + | expected.iso8601_timestamp,
|
9036 + | "Unexpected value for `iso8601_timestamp`"
|
9037 + | );
|
9038 + | ::pretty_assertions::assert_eq!(
|
9039 + | input.json_value,
|
9040 + | expected.json_value,
|
9041 + | "Unexpected value for `json_value`"
|
9042 + | );
|
9043 + | ::pretty_assertions::assert_eq!(
|
9044 + | input.list_of_lists,
|
9045 + | expected.list_of_lists,
|
9046 + | "Unexpected value for `list_of_lists`"
|
9047 + | );
|
9048 + | ::pretty_assertions::assert_eq!(
|
9049 + | input.list_of_maps_of_strings,
|
9050 + | expected.list_of_maps_of_strings,
|
9051 + | "Unexpected value for `list_of_maps_of_strings`"
|
9052 + | );
|
9053 + | ::pretty_assertions::assert_eq!(
|
9054 + | input.list_of_strings,
|
9055 + | expected.list_of_strings,
|
9056 + | "Unexpected value for `list_of_strings`"
|
9057 + | );
|
9058 + | ::pretty_assertions::assert_eq!(
|
9059 + | input.list_of_structs,
|
9060 + | expected.list_of_structs,
|
9061 + | "Unexpected value for `list_of_structs`"
|
9062 + | );
|
9063 + | ::pretty_assertions::assert_eq!(
|
9064 + | input.long,
|
9065 + | expected.long,
|
9066 + | "Unexpected value for `long`"
|
9067 + | );
|
9068 + | ::pretty_assertions::assert_eq!(
|
9069 + | input.map_of_lists_of_strings,
|
9070 + | expected.map_of_lists_of_strings,
|
9071 + | "Unexpected value for `map_of_lists_of_strings`"
|
9072 + | );
|
9073 + | ::pretty_assertions::assert_eq!(
|
9074 + | input.map_of_maps,
|
9075 + | expected.map_of_maps,
|
9076 + | "Unexpected value for `map_of_maps`"
|
9077 + | );
|
9078 + | ::pretty_assertions::assert_eq!(
|
9079 + | input.map_of_strings,
|
9080 + | expected.map_of_strings,
|
9081 + | "Unexpected value for `map_of_strings`"
|
9082 + | );
|
9083 + | ::pretty_assertions::assert_eq!(
|
9084 + | input.map_of_structs,
|
9085 + | expected.map_of_structs,
|
9086 + | "Unexpected value for `map_of_structs`"
|
9087 + | );
|
9088 + | ::pretty_assertions::assert_eq!(
|
9089 + | input.recursive_list,
|
9090 + | expected.recursive_list,
|
9091 + | "Unexpected value for `recursive_list`"
|
9092 + | );
|
9093 + | ::pretty_assertions::assert_eq!(
|
9094 + | input.recursive_map,
|
9095 + | expected.recursive_map,
|
9096 + | "Unexpected value for `recursive_map`"
|
9097 + | );
|
9098 + | ::pretty_assertions::assert_eq!(
|
9099 + | input.recursive_struct,
|
9100 + | expected.recursive_struct,
|
9101 + | "Unexpected value for `recursive_struct`"
|
9102 + | );
|
9103 + | ::pretty_assertions::assert_eq!(
|
9104 + | input.simple_struct,
|
9105 + | expected.simple_struct,
|
9106 + | "Unexpected value for `simple_struct`"
|
9107 + | );
|
9108 + | ::pretty_assertions::assert_eq!(
|
9109 + | input.string,
|
9110 + | expected.string,
|
9111 + | "Unexpected value for `string`"
|
9112 + | );
|
9113 + | ::pretty_assertions::assert_eq!(
|
9114 + | input.struct_with_json_name,
|
9115 + | expected.struct_with_json_name,
|
9116 + | "Unexpected value for `struct_with_json_name`"
|
9117 + | );
|
9118 + | ::pretty_assertions::assert_eq!(
|
9119 + | input.timestamp,
|
9120 + | expected.timestamp,
|
9121 + | "Unexpected value for `timestamp`"
|
9122 + | );
|
9123 + | ::pretty_assertions::assert_eq!(
|
9124 + | input.unix_timestamp,
|
9125 + | expected.unix_timestamp,
|
9126 + | "Unexpected value for `unix_timestamp`"
|
9127 + | );
|
9128 + | let output = crate::output::KitchenSinkOperationOutput {
|
9129 + | blob: ::std::option::Option::None,
|
9130 + | boolean: ::std::option::Option::None,
|
9131 + | double: ::std::option::Option::None,
|
9132 + | empty_struct: ::std::option::Option::None,
|
9133 + | float: ::std::option::Option::None,
|
9134 + | httpdate_timestamp: ::std::option::Option::None,
|
9135 + | integer: ::std::option::Option::None,
|
9136 + | iso8601_timestamp: ::std::option::Option::None,
|
9137 + | json_value: ::std::option::Option::None,
|
9138 + | list_of_lists: ::std::option::Option::None,
|
9139 + | list_of_maps_of_strings: ::std::option::Option::None,
|
9140 + | list_of_strings: ::std::option::Option::None,
|
9141 + | list_of_structs: ::std::option::Option::None,
|
9142 + | long: ::std::option::Option::None,
|
9143 + | map_of_lists_of_strings: ::std::option::Option::None,
|
9144 + | map_of_maps: ::std::option::Option::None,
|
9145 + | map_of_strings: ::std::option::Option::None,
|
9146 + | map_of_structs: ::std::option::Option::None,
|
9147 + | recursive_list: ::std::option::Option::None,
|
9148 + | recursive_map: ::std::option::Option::None,
|
9149 + | recursive_struct: ::std::option::Option::None,
|
9150 + | simple_struct: ::std::option::Option::None,
|
9151 + | string: ::std::option::Option::None,
|
9152 + | struct_with_json_name: ::std::option::Option::None,
|
9153 + | timestamp: ::std::option::Option::None,
|
9154 + | unix_timestamp: ::std::option::Option::None,
|
9155 + | };
|
9156 + | Ok(output)
|
9157 + | };
|
9158 + | sender.send(()).await.expect("receiver dropped early");
|
9159 + | result
|
9160 + | }
|
9161 + | })
|
9162 + | .build_unchecked();
|
9163 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9164 + | .await
|
9165 + | .expect("unable to make an HTTP request");
|
9166 + | assert!(
|
9167 + | receiver.recv().await.is_some(),
|
9168 + | "we expected operation handler to be invoked but it was not entered"
|
9169 + | );
|
9170 + | }
|
9171 + |
|
9172 + | /// Serializes structure shapes
|
9173 + | /// Test ID: serializes_structure_shapes
|
9174 + | #[::tokio::test]
|
9175 + | #[::tracing_test::traced_test]
|
9176 + | async fn serializes_structure_shapes_request() {
|
9177 + | #[allow(unused_mut)]
|
9178 + | let mut http_request = ::http::Request::builder()
|
9179 + | .uri("/")
|
9180 + | .method("POST")
|
9181 + | .header("Content-Type", "application/x-amz-json-1.1")
|
9182 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
9183 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
9184 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
9185 + | "{\"SimpleStruct\":{\"Value\":\"abc\"}}".as_bytes(),
|
9186 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9187 + | )),
|
9188 + | ))
|
9189 + | .unwrap();
|
9190 + | #[allow(unused_mut)]
|
9191 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9192 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
9193 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9194 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
9195 + | let sender = sender.clone();
|
9196 + | async move {
|
9197 + | let result = {
|
9198 + | use ::aws_smithy_protocol_test::FloatEquals;
|
9199 + | let expected = crate::input::KitchenSinkOperationInput {
|
9200 + | simple_struct: ::std::option::Option::Some(
|
9201 + | crate::model::SimpleStruct {
|
9202 + | value: ::std::option::Option::Some("abc".to_owned()),
|
9203 + | },
|
9204 + | ),
|
9205 + | blob: ::std::option::Option::None,
|
9206 + | boolean: ::std::option::Option::None,
|
9207 + | double: ::std::option::Option::None,
|
9208 + | empty_struct: ::std::option::Option::None,
|
9209 + | float: ::std::option::Option::None,
|
9210 + | httpdate_timestamp: ::std::option::Option::None,
|
9211 + | integer: ::std::option::Option::None,
|
9212 + | iso8601_timestamp: ::std::option::Option::None,
|
9213 + | json_value: ::std::option::Option::None,
|
9214 + | list_of_lists: ::std::option::Option::None,
|
9215 + | list_of_maps_of_strings: ::std::option::Option::None,
|
9216 + | list_of_strings: ::std::option::Option::None,
|
9217 + | list_of_structs: ::std::option::Option::None,
|
9218 + | long: ::std::option::Option::None,
|
9219 + | map_of_lists_of_strings: ::std::option::Option::None,
|
9220 + | map_of_maps: ::std::option::Option::None,
|
9221 + | map_of_strings: ::std::option::Option::None,
|
9222 + | map_of_structs: ::std::option::Option::None,
|
9223 + | recursive_list: ::std::option::Option::None,
|
9224 + | recursive_map: ::std::option::Option::None,
|
9225 + | recursive_struct: ::std::option::Option::None,
|
9226 + | string: ::std::option::Option::None,
|
9227 + | struct_with_json_name: ::std::option::Option::None,
|
9228 + | timestamp: ::std::option::Option::None,
|
9229 + | unix_timestamp: ::std::option::Option::None,
|
9230 + | };
|
9231 + | ::pretty_assertions::assert_eq!(
|
9232 + | input.blob,
|
9233 + | expected.blob,
|
9234 + | "Unexpected value for `blob`"
|
9235 + | );
|
9236 + | ::pretty_assertions::assert_eq!(
|
9237 + | input.boolean,
|
9238 + | expected.boolean,
|
9239 + | "Unexpected value for `boolean`"
|
9240 + | );
|
9241 + | assert!(
|
9242 + | input.double.float_equals(&expected.double),
|
9243 + | "Unexpected value for `double` {:?} vs. {:?}",
|
9244 + | expected.double,
|
9245 + | input.double
|
9246 + | );
|
9247 + | ::pretty_assertions::assert_eq!(
|
9248 + | input.empty_struct,
|
9249 + | expected.empty_struct,
|
9250 + | "Unexpected value for `empty_struct`"
|
9251 + | );
|
9252 + | assert!(
|
9253 + | input.float.float_equals(&expected.float),
|
9254 + | "Unexpected value for `float` {:?} vs. {:?}",
|
9255 + | expected.float,
|
9256 + | input.float
|
9257 + | );
|
9258 + | ::pretty_assertions::assert_eq!(
|
9259 + | input.httpdate_timestamp,
|
9260 + | expected.httpdate_timestamp,
|
9261 + | "Unexpected value for `httpdate_timestamp`"
|
9262 + | );
|
9263 + | ::pretty_assertions::assert_eq!(
|
9264 + | input.integer,
|
9265 + | expected.integer,
|
9266 + | "Unexpected value for `integer`"
|
9267 + | );
|
9268 + | ::pretty_assertions::assert_eq!(
|
9269 + | input.iso8601_timestamp,
|
9270 + | expected.iso8601_timestamp,
|
9271 + | "Unexpected value for `iso8601_timestamp`"
|
9272 + | );
|
9273 + | ::pretty_assertions::assert_eq!(
|
9274 + | input.json_value,
|
9275 + | expected.json_value,
|
9276 + | "Unexpected value for `json_value`"
|
9277 + | );
|
9278 + | ::pretty_assertions::assert_eq!(
|
9279 + | input.list_of_lists,
|
9280 + | expected.list_of_lists,
|
9281 + | "Unexpected value for `list_of_lists`"
|
9282 + | );
|
9283 + | ::pretty_assertions::assert_eq!(
|
9284 + | input.list_of_maps_of_strings,
|
9285 + | expected.list_of_maps_of_strings,
|
9286 + | "Unexpected value for `list_of_maps_of_strings`"
|
9287 + | );
|
9288 + | ::pretty_assertions::assert_eq!(
|
9289 + | input.list_of_strings,
|
9290 + | expected.list_of_strings,
|
9291 + | "Unexpected value for `list_of_strings`"
|
9292 + | );
|
9293 + | ::pretty_assertions::assert_eq!(
|
9294 + | input.list_of_structs,
|
9295 + | expected.list_of_structs,
|
9296 + | "Unexpected value for `list_of_structs`"
|
9297 + | );
|
9298 + | ::pretty_assertions::assert_eq!(
|
9299 + | input.long,
|
9300 + | expected.long,
|
9301 + | "Unexpected value for `long`"
|
9302 + | );
|
9303 + | ::pretty_assertions::assert_eq!(
|
9304 + | input.map_of_lists_of_strings,
|
9305 + | expected.map_of_lists_of_strings,
|
9306 + | "Unexpected value for `map_of_lists_of_strings`"
|
9307 + | );
|
9308 + | ::pretty_assertions::assert_eq!(
|
9309 + | input.map_of_maps,
|
9310 + | expected.map_of_maps,
|
9311 + | "Unexpected value for `map_of_maps`"
|
9312 + | );
|
9313 + | ::pretty_assertions::assert_eq!(
|
9314 + | input.map_of_strings,
|
9315 + | expected.map_of_strings,
|
9316 + | "Unexpected value for `map_of_strings`"
|
9317 + | );
|
9318 + | ::pretty_assertions::assert_eq!(
|
9319 + | input.map_of_structs,
|
9320 + | expected.map_of_structs,
|
9321 + | "Unexpected value for `map_of_structs`"
|
9322 + | );
|
9323 + | ::pretty_assertions::assert_eq!(
|
9324 + | input.recursive_list,
|
9325 + | expected.recursive_list,
|
9326 + | "Unexpected value for `recursive_list`"
|
9327 + | );
|
9328 + | ::pretty_assertions::assert_eq!(
|
9329 + | input.recursive_map,
|
9330 + | expected.recursive_map,
|
9331 + | "Unexpected value for `recursive_map`"
|
9332 + | );
|
9333 + | ::pretty_assertions::assert_eq!(
|
9334 + | input.recursive_struct,
|
9335 + | expected.recursive_struct,
|
9336 + | "Unexpected value for `recursive_struct`"
|
9337 + | );
|
9338 + | ::pretty_assertions::assert_eq!(
|
9339 + | input.simple_struct,
|
9340 + | expected.simple_struct,
|
9341 + | "Unexpected value for `simple_struct`"
|
9342 + | );
|
9343 + | ::pretty_assertions::assert_eq!(
|
9344 + | input.string,
|
9345 + | expected.string,
|
9346 + | "Unexpected value for `string`"
|
9347 + | );
|
9348 + | ::pretty_assertions::assert_eq!(
|
9349 + | input.struct_with_json_name,
|
9350 + | expected.struct_with_json_name,
|
9351 + | "Unexpected value for `struct_with_json_name`"
|
9352 + | );
|
9353 + | ::pretty_assertions::assert_eq!(
|
9354 + | input.timestamp,
|
9355 + | expected.timestamp,
|
9356 + | "Unexpected value for `timestamp`"
|
9357 + | );
|
9358 + | ::pretty_assertions::assert_eq!(
|
9359 + | input.unix_timestamp,
|
9360 + | expected.unix_timestamp,
|
9361 + | "Unexpected value for `unix_timestamp`"
|
9362 + | );
|
9363 + | let output = crate::output::KitchenSinkOperationOutput {
|
9364 + | blob: ::std::option::Option::None,
|
9365 + | boolean: ::std::option::Option::None,
|
9366 + | double: ::std::option::Option::None,
|
9367 + | empty_struct: ::std::option::Option::None,
|
9368 + | float: ::std::option::Option::None,
|
9369 + | httpdate_timestamp: ::std::option::Option::None,
|
9370 + | integer: ::std::option::Option::None,
|
9371 + | iso8601_timestamp: ::std::option::Option::None,
|
9372 + | json_value: ::std::option::Option::None,
|
9373 + | list_of_lists: ::std::option::Option::None,
|
9374 + | list_of_maps_of_strings: ::std::option::Option::None,
|
9375 + | list_of_strings: ::std::option::Option::None,
|
9376 + | list_of_structs: ::std::option::Option::None,
|
9377 + | long: ::std::option::Option::None,
|
9378 + | map_of_lists_of_strings: ::std::option::Option::None,
|
9379 + | map_of_maps: ::std::option::Option::None,
|
9380 + | map_of_strings: ::std::option::Option::None,
|
9381 + | map_of_structs: ::std::option::Option::None,
|
9382 + | recursive_list: ::std::option::Option::None,
|
9383 + | recursive_map: ::std::option::Option::None,
|
9384 + | recursive_struct: ::std::option::Option::None,
|
9385 + | simple_struct: ::std::option::Option::None,
|
9386 + | string: ::std::option::Option::None,
|
9387 + | struct_with_json_name: ::std::option::Option::None,
|
9388 + | timestamp: ::std::option::Option::None,
|
9389 + | unix_timestamp: ::std::option::Option::None,
|
9390 + | };
|
9391 + | Ok(output)
|
9392 + | };
|
9393 + | sender.send(()).await.expect("receiver dropped early");
|
9394 + | result
|
9395 + | }
|
9396 + | })
|
9397 + | .build_unchecked();
|
9398 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9399 + | .await
|
9400 + | .expect("unable to make an HTTP request");
|
9401 + | assert!(
|
9402 + | receiver.recv().await.is_some(),
|
9403 + | "we expected operation handler to be invoked but it was not entered"
|
9404 + | );
|
9405 + | }
|
9406 + |
|
9407 + | /// Serializes structure members with locationName traits
|
9408 + | /// Test ID: serializes_structure_members_with_locationname_traits
|
9409 + | #[::tokio::test]
|
9410 + | #[::tracing_test::traced_test]
|
9411 + | async fn serializes_structure_members_with_locationname_traits_request() {
|
9412 + | #[allow(unused_mut)]
|
9413 + | let mut http_request = ::http::Request::builder()
|
9414 + | .uri("/")
|
9415 + | .method("POST")
|
9416 + | .header("Content-Type", "application/x-amz-json-1.1")
|
9417 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
9418 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
9419 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
9420 + | "{\"StructWithJsonName\":{\"Value\":\"some-value\"}}".as_bytes(),
|
9421 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9422 + | )),
|
9423 + | ))
|
9424 + | .unwrap();
|
9425 + | #[allow(unused_mut)]
|
9426 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9427 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
9428 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9429 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
9430 + | let sender = sender.clone();
|
9431 + | async move {
|
9432 + | let result = {
|
9433 + | use ::aws_smithy_protocol_test::FloatEquals;
|
9434 + | let expected = crate::input::KitchenSinkOperationInput {
|
9435 + | struct_with_json_name: ::std::option::Option::Some(
|
9436 + | crate::model::StructWithJsonName {
|
9437 + | value: ::std::option::Option::Some("some-value".to_owned()),
|
9438 + | },
|
9439 + | ),
|
9440 + | blob: ::std::option::Option::None,
|
9441 + | boolean: ::std::option::Option::None,
|
9442 + | double: ::std::option::Option::None,
|
9443 + | empty_struct: ::std::option::Option::None,
|
9444 + | float: ::std::option::Option::None,
|
9445 + | httpdate_timestamp: ::std::option::Option::None,
|
9446 + | integer: ::std::option::Option::None,
|
9447 + | iso8601_timestamp: ::std::option::Option::None,
|
9448 + | json_value: ::std::option::Option::None,
|
9449 + | list_of_lists: ::std::option::Option::None,
|
9450 + | list_of_maps_of_strings: ::std::option::Option::None,
|
9451 + | list_of_strings: ::std::option::Option::None,
|
9452 + | list_of_structs: ::std::option::Option::None,
|
9453 + | long: ::std::option::Option::None,
|
9454 + | map_of_lists_of_strings: ::std::option::Option::None,
|
9455 + | map_of_maps: ::std::option::Option::None,
|
9456 + | map_of_strings: ::std::option::Option::None,
|
9457 + | map_of_structs: ::std::option::Option::None,
|
9458 + | recursive_list: ::std::option::Option::None,
|
9459 + | recursive_map: ::std::option::Option::None,
|
9460 + | recursive_struct: ::std::option::Option::None,
|
9461 + | simple_struct: ::std::option::Option::None,
|
9462 + | string: ::std::option::Option::None,
|
9463 + | timestamp: ::std::option::Option::None,
|
9464 + | unix_timestamp: ::std::option::Option::None,
|
9465 + | };
|
9466 + | ::pretty_assertions::assert_eq!(
|
9467 + | input.blob,
|
9468 + | expected.blob,
|
9469 + | "Unexpected value for `blob`"
|
9470 + | );
|
9471 + | ::pretty_assertions::assert_eq!(
|
9472 + | input.boolean,
|
9473 + | expected.boolean,
|
9474 + | "Unexpected value for `boolean`"
|
9475 + | );
|
9476 + | assert!(
|
9477 + | input.double.float_equals(&expected.double),
|
9478 + | "Unexpected value for `double` {:?} vs. {:?}",
|
9479 + | expected.double,
|
9480 + | input.double
|
9481 + | );
|
9482 + | ::pretty_assertions::assert_eq!(
|
9483 + | input.empty_struct,
|
9484 + | expected.empty_struct,
|
9485 + | "Unexpected value for `empty_struct`"
|
9486 + | );
|
9487 + | assert!(
|
9488 + | input.float.float_equals(&expected.float),
|
9489 + | "Unexpected value for `float` {:?} vs. {:?}",
|
9490 + | expected.float,
|
9491 + | input.float
|
9492 + | );
|
9493 + | ::pretty_assertions::assert_eq!(
|
9494 + | input.httpdate_timestamp,
|
9495 + | expected.httpdate_timestamp,
|
9496 + | "Unexpected value for `httpdate_timestamp`"
|
9497 + | );
|
9498 + | ::pretty_assertions::assert_eq!(
|
9499 + | input.integer,
|
9500 + | expected.integer,
|
9501 + | "Unexpected value for `integer`"
|
9502 + | );
|
9503 + | ::pretty_assertions::assert_eq!(
|
9504 + | input.iso8601_timestamp,
|
9505 + | expected.iso8601_timestamp,
|
9506 + | "Unexpected value for `iso8601_timestamp`"
|
9507 + | );
|
9508 + | ::pretty_assertions::assert_eq!(
|
9509 + | input.json_value,
|
9510 + | expected.json_value,
|
9511 + | "Unexpected value for `json_value`"
|
9512 + | );
|
9513 + | ::pretty_assertions::assert_eq!(
|
9514 + | input.list_of_lists,
|
9515 + | expected.list_of_lists,
|
9516 + | "Unexpected value for `list_of_lists`"
|
9517 + | );
|
9518 + | ::pretty_assertions::assert_eq!(
|
9519 + | input.list_of_maps_of_strings,
|
9520 + | expected.list_of_maps_of_strings,
|
9521 + | "Unexpected value for `list_of_maps_of_strings`"
|
9522 + | );
|
9523 + | ::pretty_assertions::assert_eq!(
|
9524 + | input.list_of_strings,
|
9525 + | expected.list_of_strings,
|
9526 + | "Unexpected value for `list_of_strings`"
|
9527 + | );
|
9528 + | ::pretty_assertions::assert_eq!(
|
9529 + | input.list_of_structs,
|
9530 + | expected.list_of_structs,
|
9531 + | "Unexpected value for `list_of_structs`"
|
9532 + | );
|
9533 + | ::pretty_assertions::assert_eq!(
|
9534 + | input.long,
|
9535 + | expected.long,
|
9536 + | "Unexpected value for `long`"
|
9537 + | );
|
9538 + | ::pretty_assertions::assert_eq!(
|
9539 + | input.map_of_lists_of_strings,
|
9540 + | expected.map_of_lists_of_strings,
|
9541 + | "Unexpected value for `map_of_lists_of_strings`"
|
9542 + | );
|
9543 + | ::pretty_assertions::assert_eq!(
|
9544 + | input.map_of_maps,
|
9545 + | expected.map_of_maps,
|
9546 + | "Unexpected value for `map_of_maps`"
|
9547 + | );
|
9548 + | ::pretty_assertions::assert_eq!(
|
9549 + | input.map_of_strings,
|
9550 + | expected.map_of_strings,
|
9551 + | "Unexpected value for `map_of_strings`"
|
9552 + | );
|
9553 + | ::pretty_assertions::assert_eq!(
|
9554 + | input.map_of_structs,
|
9555 + | expected.map_of_structs,
|
9556 + | "Unexpected value for `map_of_structs`"
|
9557 + | );
|
9558 + | ::pretty_assertions::assert_eq!(
|
9559 + | input.recursive_list,
|
9560 + | expected.recursive_list,
|
9561 + | "Unexpected value for `recursive_list`"
|
9562 + | );
|
9563 + | ::pretty_assertions::assert_eq!(
|
9564 + | input.recursive_map,
|
9565 + | expected.recursive_map,
|
9566 + | "Unexpected value for `recursive_map`"
|
9567 + | );
|
9568 + | ::pretty_assertions::assert_eq!(
|
9569 + | input.recursive_struct,
|
9570 + | expected.recursive_struct,
|
9571 + | "Unexpected value for `recursive_struct`"
|
9572 + | );
|
9573 + | ::pretty_assertions::assert_eq!(
|
9574 + | input.simple_struct,
|
9575 + | expected.simple_struct,
|
9576 + | "Unexpected value for `simple_struct`"
|
9577 + | );
|
9578 + | ::pretty_assertions::assert_eq!(
|
9579 + | input.string,
|
9580 + | expected.string,
|
9581 + | "Unexpected value for `string`"
|
9582 + | );
|
9583 + | ::pretty_assertions::assert_eq!(
|
9584 + | input.struct_with_json_name,
|
9585 + | expected.struct_with_json_name,
|
9586 + | "Unexpected value for `struct_with_json_name`"
|
9587 + | );
|
9588 + | ::pretty_assertions::assert_eq!(
|
9589 + | input.timestamp,
|
9590 + | expected.timestamp,
|
9591 + | "Unexpected value for `timestamp`"
|
9592 + | );
|
9593 + | ::pretty_assertions::assert_eq!(
|
9594 + | input.unix_timestamp,
|
9595 + | expected.unix_timestamp,
|
9596 + | "Unexpected value for `unix_timestamp`"
|
9597 + | );
|
9598 + | let output = crate::output::KitchenSinkOperationOutput {
|
9599 + | blob: ::std::option::Option::None,
|
9600 + | boolean: ::std::option::Option::None,
|
9601 + | double: ::std::option::Option::None,
|
9602 + | empty_struct: ::std::option::Option::None,
|
9603 + | float: ::std::option::Option::None,
|
9604 + | httpdate_timestamp: ::std::option::Option::None,
|
9605 + | integer: ::std::option::Option::None,
|
9606 + | iso8601_timestamp: ::std::option::Option::None,
|
9607 + | json_value: ::std::option::Option::None,
|
9608 + | list_of_lists: ::std::option::Option::None,
|
9609 + | list_of_maps_of_strings: ::std::option::Option::None,
|
9610 + | list_of_strings: ::std::option::Option::None,
|
9611 + | list_of_structs: ::std::option::Option::None,
|
9612 + | long: ::std::option::Option::None,
|
9613 + | map_of_lists_of_strings: ::std::option::Option::None,
|
9614 + | map_of_maps: ::std::option::Option::None,
|
9615 + | map_of_strings: ::std::option::Option::None,
|
9616 + | map_of_structs: ::std::option::Option::None,
|
9617 + | recursive_list: ::std::option::Option::None,
|
9618 + | recursive_map: ::std::option::Option::None,
|
9619 + | recursive_struct: ::std::option::Option::None,
|
9620 + | simple_struct: ::std::option::Option::None,
|
9621 + | string: ::std::option::Option::None,
|
9622 + | struct_with_json_name: ::std::option::Option::None,
|
9623 + | timestamp: ::std::option::Option::None,
|
9624 + | unix_timestamp: ::std::option::Option::None,
|
9625 + | };
|
9626 + | Ok(output)
|
9627 + | };
|
9628 + | sender.send(()).await.expect("receiver dropped early");
|
9629 + | result
|
9630 + | }
|
9631 + | })
|
9632 + | .build_unchecked();
|
9633 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9634 + | .await
|
9635 + | .expect("unable to make an HTTP request");
|
9636 + | assert!(
|
9637 + | receiver.recv().await.is_some(),
|
9638 + | "we expected operation handler to be invoked but it was not entered"
|
9639 + | );
|
9640 + | }
|
9641 + |
|
9642 + | /// Serializes empty structure shapes
|
9643 + | /// Test ID: serializes_empty_structure_shapes
|
9644 + | #[::tokio::test]
|
9645 + | #[::tracing_test::traced_test]
|
9646 + | async fn serializes_empty_structure_shapes_request() {
|
9647 + | #[allow(unused_mut)]
|
9648 + | let mut http_request = ::http::Request::builder()
|
9649 + | .uri("/")
|
9650 + | .method("POST")
|
9651 + | .header("Content-Type", "application/x-amz-json-1.1")
|
9652 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
9653 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
9654 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
9655 + | "{\"SimpleStruct\":{}}".as_bytes(),
|
9656 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9657 + | )),
|
9658 + | ))
|
9659 + | .unwrap();
|
9660 + | #[allow(unused_mut)]
|
9661 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9662 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
9663 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9664 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
9665 + | let sender = sender.clone();
|
9666 + | async move {
|
9667 + | let result = {
|
9668 + | use ::aws_smithy_protocol_test::FloatEquals;
|
9669 + | let expected = crate::input::KitchenSinkOperationInput {
|
9670 + | simple_struct: ::std::option::Option::Some(
|
9671 + | crate::model::SimpleStruct {
|
9672 + | value: ::std::option::Option::None,
|
9673 + | },
|
9674 + | ),
|
9675 + | blob: ::std::option::Option::None,
|
9676 + | boolean: ::std::option::Option::None,
|
9677 + | double: ::std::option::Option::None,
|
9678 + | empty_struct: ::std::option::Option::None,
|
9679 + | float: ::std::option::Option::None,
|
9680 + | httpdate_timestamp: ::std::option::Option::None,
|
9681 + | integer: ::std::option::Option::None,
|
9682 + | iso8601_timestamp: ::std::option::Option::None,
|
9683 + | json_value: ::std::option::Option::None,
|
9684 + | list_of_lists: ::std::option::Option::None,
|
9685 + | list_of_maps_of_strings: ::std::option::Option::None,
|
9686 + | list_of_strings: ::std::option::Option::None,
|
9687 + | list_of_structs: ::std::option::Option::None,
|
9688 + | long: ::std::option::Option::None,
|
9689 + | map_of_lists_of_strings: ::std::option::Option::None,
|
9690 + | map_of_maps: ::std::option::Option::None,
|
9691 + | map_of_strings: ::std::option::Option::None,
|
9692 + | map_of_structs: ::std::option::Option::None,
|
9693 + | recursive_list: ::std::option::Option::None,
|
9694 + | recursive_map: ::std::option::Option::None,
|
9695 + | recursive_struct: ::std::option::Option::None,
|
9696 + | string: ::std::option::Option::None,
|
9697 + | struct_with_json_name: ::std::option::Option::None,
|
9698 + | timestamp: ::std::option::Option::None,
|
9699 + | unix_timestamp: ::std::option::Option::None,
|
9700 + | };
|
9701 + | ::pretty_assertions::assert_eq!(
|
9702 + | input.blob,
|
9703 + | expected.blob,
|
9704 + | "Unexpected value for `blob`"
|
9705 + | );
|
9706 + | ::pretty_assertions::assert_eq!(
|
9707 + | input.boolean,
|
9708 + | expected.boolean,
|
9709 + | "Unexpected value for `boolean`"
|
9710 + | );
|
9711 + | assert!(
|
9712 + | input.double.float_equals(&expected.double),
|
9713 + | "Unexpected value for `double` {:?} vs. {:?}",
|
9714 + | expected.double,
|
9715 + | input.double
|
9716 + | );
|
9717 + | ::pretty_assertions::assert_eq!(
|
9718 + | input.empty_struct,
|
9719 + | expected.empty_struct,
|
9720 + | "Unexpected value for `empty_struct`"
|
9721 + | );
|
9722 + | assert!(
|
9723 + | input.float.float_equals(&expected.float),
|
9724 + | "Unexpected value for `float` {:?} vs. {:?}",
|
9725 + | expected.float,
|
9726 + | input.float
|
9727 + | );
|
9728 + | ::pretty_assertions::assert_eq!(
|
9729 + | input.httpdate_timestamp,
|
9730 + | expected.httpdate_timestamp,
|
9731 + | "Unexpected value for `httpdate_timestamp`"
|
9732 + | );
|
9733 + | ::pretty_assertions::assert_eq!(
|
9734 + | input.integer,
|
9735 + | expected.integer,
|
9736 + | "Unexpected value for `integer`"
|
9737 + | );
|
9738 + | ::pretty_assertions::assert_eq!(
|
9739 + | input.iso8601_timestamp,
|
9740 + | expected.iso8601_timestamp,
|
9741 + | "Unexpected value for `iso8601_timestamp`"
|
9742 + | );
|
9743 + | ::pretty_assertions::assert_eq!(
|
9744 + | input.json_value,
|
9745 + | expected.json_value,
|
9746 + | "Unexpected value for `json_value`"
|
9747 + | );
|
9748 + | ::pretty_assertions::assert_eq!(
|
9749 + | input.list_of_lists,
|
9750 + | expected.list_of_lists,
|
9751 + | "Unexpected value for `list_of_lists`"
|
9752 + | );
|
9753 + | ::pretty_assertions::assert_eq!(
|
9754 + | input.list_of_maps_of_strings,
|
9755 + | expected.list_of_maps_of_strings,
|
9756 + | "Unexpected value for `list_of_maps_of_strings`"
|
9757 + | );
|
9758 + | ::pretty_assertions::assert_eq!(
|
9759 + | input.list_of_strings,
|
9760 + | expected.list_of_strings,
|
9761 + | "Unexpected value for `list_of_strings`"
|
9762 + | );
|
9763 + | ::pretty_assertions::assert_eq!(
|
9764 + | input.list_of_structs,
|
9765 + | expected.list_of_structs,
|
9766 + | "Unexpected value for `list_of_structs`"
|
9767 + | );
|
9768 + | ::pretty_assertions::assert_eq!(
|
9769 + | input.long,
|
9770 + | expected.long,
|
9771 + | "Unexpected value for `long`"
|
9772 + | );
|
9773 + | ::pretty_assertions::assert_eq!(
|
9774 + | input.map_of_lists_of_strings,
|
9775 + | expected.map_of_lists_of_strings,
|
9776 + | "Unexpected value for `map_of_lists_of_strings`"
|
9777 + | );
|
9778 + | ::pretty_assertions::assert_eq!(
|
9779 + | input.map_of_maps,
|
9780 + | expected.map_of_maps,
|
9781 + | "Unexpected value for `map_of_maps`"
|
9782 + | );
|
9783 + | ::pretty_assertions::assert_eq!(
|
9784 + | input.map_of_strings,
|
9785 + | expected.map_of_strings,
|
9786 + | "Unexpected value for `map_of_strings`"
|
9787 + | );
|
9788 + | ::pretty_assertions::assert_eq!(
|
9789 + | input.map_of_structs,
|
9790 + | expected.map_of_structs,
|
9791 + | "Unexpected value for `map_of_structs`"
|
9792 + | );
|
9793 + | ::pretty_assertions::assert_eq!(
|
9794 + | input.recursive_list,
|
9795 + | expected.recursive_list,
|
9796 + | "Unexpected value for `recursive_list`"
|
9797 + | );
|
9798 + | ::pretty_assertions::assert_eq!(
|
9799 + | input.recursive_map,
|
9800 + | expected.recursive_map,
|
9801 + | "Unexpected value for `recursive_map`"
|
9802 + | );
|
9803 + | ::pretty_assertions::assert_eq!(
|
9804 + | input.recursive_struct,
|
9805 + | expected.recursive_struct,
|
9806 + | "Unexpected value for `recursive_struct`"
|
9807 + | );
|
9808 + | ::pretty_assertions::assert_eq!(
|
9809 + | input.simple_struct,
|
9810 + | expected.simple_struct,
|
9811 + | "Unexpected value for `simple_struct`"
|
9812 + | );
|
9813 + | ::pretty_assertions::assert_eq!(
|
9814 + | input.string,
|
9815 + | expected.string,
|
9816 + | "Unexpected value for `string`"
|
9817 + | );
|
9818 + | ::pretty_assertions::assert_eq!(
|
9819 + | input.struct_with_json_name,
|
9820 + | expected.struct_with_json_name,
|
9821 + | "Unexpected value for `struct_with_json_name`"
|
9822 + | );
|
9823 + | ::pretty_assertions::assert_eq!(
|
9824 + | input.timestamp,
|
9825 + | expected.timestamp,
|
9826 + | "Unexpected value for `timestamp`"
|
9827 + | );
|
9828 + | ::pretty_assertions::assert_eq!(
|
9829 + | input.unix_timestamp,
|
9830 + | expected.unix_timestamp,
|
9831 + | "Unexpected value for `unix_timestamp`"
|
9832 + | );
|
9833 + | let output = crate::output::KitchenSinkOperationOutput {
|
9834 + | blob: ::std::option::Option::None,
|
9835 + | boolean: ::std::option::Option::None,
|
9836 + | double: ::std::option::Option::None,
|
9837 + | empty_struct: ::std::option::Option::None,
|
9838 + | float: ::std::option::Option::None,
|
9839 + | httpdate_timestamp: ::std::option::Option::None,
|
9840 + | integer: ::std::option::Option::None,
|
9841 + | iso8601_timestamp: ::std::option::Option::None,
|
9842 + | json_value: ::std::option::Option::None,
|
9843 + | list_of_lists: ::std::option::Option::None,
|
9844 + | list_of_maps_of_strings: ::std::option::Option::None,
|
9845 + | list_of_strings: ::std::option::Option::None,
|
9846 + | list_of_structs: ::std::option::Option::None,
|
9847 + | long: ::std::option::Option::None,
|
9848 + | map_of_lists_of_strings: ::std::option::Option::None,
|
9849 + | map_of_maps: ::std::option::Option::None,
|
9850 + | map_of_strings: ::std::option::Option::None,
|
9851 + | map_of_structs: ::std::option::Option::None,
|
9852 + | recursive_list: ::std::option::Option::None,
|
9853 + | recursive_map: ::std::option::Option::None,
|
9854 + | recursive_struct: ::std::option::Option::None,
|
9855 + | simple_struct: ::std::option::Option::None,
|
9856 + | string: ::std::option::Option::None,
|
9857 + | struct_with_json_name: ::std::option::Option::None,
|
9858 + | timestamp: ::std::option::Option::None,
|
9859 + | unix_timestamp: ::std::option::Option::None,
|
9860 + | };
|
9861 + | Ok(output)
|
9862 + | };
|
9863 + | sender.send(()).await.expect("receiver dropped early");
|
9864 + | result
|
9865 + | }
|
9866 + | })
|
9867 + | .build_unchecked();
|
9868 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9869 + | .await
|
9870 + | .expect("unable to make an HTTP request");
|
9871 + | assert!(
|
9872 + | receiver.recv().await.is_some(),
|
9873 + | "we expected operation handler to be invoked but it was not entered"
|
9874 + | );
|
9875 + | }
|
9876 + |
|
9877 + | /// Serializes structure which have no members
|
9878 + | /// Test ID: serializes_structure_which_have_no_members
|
9879 + | #[::tokio::test]
|
9880 + | #[::tracing_test::traced_test]
|
9881 + | async fn serializes_structure_which_have_no_members_request() {
|
9882 + | #[allow(unused_mut)]
|
9883 + | let mut http_request = ::http::Request::builder()
|
9884 + | .uri("/")
|
9885 + | .method("POST")
|
9886 + | .header("Content-Type", "application/x-amz-json-1.1")
|
9887 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
9888 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
9889 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
9890 + | "{\"EmptyStruct\":{}}".as_bytes(),
|
9891 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9892 + | )),
|
9893 + | ))
|
9894 + | .unwrap();
|
9895 + | #[allow(unused_mut)]
|
9896 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9897 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
9898 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9899 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
9900 + | let sender = sender.clone();
|
9901 + | async move {
|
9902 + | let result = {
|
9903 + | use ::aws_smithy_protocol_test::FloatEquals;
|
9904 + | let expected = crate::input::KitchenSinkOperationInput {
|
9905 + | empty_struct: ::std::option::Option::Some(crate::model::EmptyStruct {}),
|
9906 + | blob: ::std::option::Option::None,
|
9907 + | boolean: ::std::option::Option::None,
|
9908 + | double: ::std::option::Option::None,
|
9909 + | float: ::std::option::Option::None,
|
9910 + | httpdate_timestamp: ::std::option::Option::None,
|
9911 + | integer: ::std::option::Option::None,
|
9912 + | iso8601_timestamp: ::std::option::Option::None,
|
9913 + | json_value: ::std::option::Option::None,
|
9914 + | list_of_lists: ::std::option::Option::None,
|
9915 + | list_of_maps_of_strings: ::std::option::Option::None,
|
9916 + | list_of_strings: ::std::option::Option::None,
|
9917 + | list_of_structs: ::std::option::Option::None,
|
9918 + | long: ::std::option::Option::None,
|
9919 + | map_of_lists_of_strings: ::std::option::Option::None,
|
9920 + | map_of_maps: ::std::option::Option::None,
|
9921 + | map_of_strings: ::std::option::Option::None,
|
9922 + | map_of_structs: ::std::option::Option::None,
|
9923 + | recursive_list: ::std::option::Option::None,
|
9924 + | recursive_map: ::std::option::Option::None,
|
9925 + | recursive_struct: ::std::option::Option::None,
|
9926 + | simple_struct: ::std::option::Option::None,
|
9927 + | string: ::std::option::Option::None,
|
9928 + | struct_with_json_name: ::std::option::Option::None,
|
9929 + | timestamp: ::std::option::Option::None,
|
9930 + | unix_timestamp: ::std::option::Option::None,
|
9931 + | };
|
9932 + | ::pretty_assertions::assert_eq!(
|
9933 + | input.blob,
|
9934 + | expected.blob,
|
9935 + | "Unexpected value for `blob`"
|
9936 + | );
|
9937 + | ::pretty_assertions::assert_eq!(
|
9938 + | input.boolean,
|
9939 + | expected.boolean,
|
9940 + | "Unexpected value for `boolean`"
|
9941 + | );
|
9942 + | assert!(
|
9943 + | input.double.float_equals(&expected.double),
|
9944 + | "Unexpected value for `double` {:?} vs. {:?}",
|
9945 + | expected.double,
|
9946 + | input.double
|
9947 + | );
|
9948 + | ::pretty_assertions::assert_eq!(
|
9949 + | input.empty_struct,
|
9950 + | expected.empty_struct,
|
9951 + | "Unexpected value for `empty_struct`"
|
9952 + | );
|
9953 + | assert!(
|
9954 + | input.float.float_equals(&expected.float),
|
9955 + | "Unexpected value for `float` {:?} vs. {:?}",
|
9956 + | expected.float,
|
9957 + | input.float
|
9958 + | );
|
9959 + | ::pretty_assertions::assert_eq!(
|
9960 + | input.httpdate_timestamp,
|
9961 + | expected.httpdate_timestamp,
|
9962 + | "Unexpected value for `httpdate_timestamp`"
|
9963 + | );
|
9964 + | ::pretty_assertions::assert_eq!(
|
9965 + | input.integer,
|
9966 + | expected.integer,
|
9967 + | "Unexpected value for `integer`"
|
9968 + | );
|
9969 + | ::pretty_assertions::assert_eq!(
|
9970 + | input.iso8601_timestamp,
|
9971 + | expected.iso8601_timestamp,
|
9972 + | "Unexpected value for `iso8601_timestamp`"
|
9973 + | );
|
9974 + | ::pretty_assertions::assert_eq!(
|
9975 + | input.json_value,
|
9976 + | expected.json_value,
|
9977 + | "Unexpected value for `json_value`"
|
9978 + | );
|
9979 + | ::pretty_assertions::assert_eq!(
|
9980 + | input.list_of_lists,
|
9981 + | expected.list_of_lists,
|
9982 + | "Unexpected value for `list_of_lists`"
|
9983 + | );
|
9984 + | ::pretty_assertions::assert_eq!(
|
9985 + | input.list_of_maps_of_strings,
|
9986 + | expected.list_of_maps_of_strings,
|
9987 + | "Unexpected value for `list_of_maps_of_strings`"
|
9988 + | );
|
9989 + | ::pretty_assertions::assert_eq!(
|
9990 + | input.list_of_strings,
|
9991 + | expected.list_of_strings,
|
9992 + | "Unexpected value for `list_of_strings`"
|
9993 + | );
|
9994 + | ::pretty_assertions::assert_eq!(
|
9995 + | input.list_of_structs,
|
9996 + | expected.list_of_structs,
|
9997 + | "Unexpected value for `list_of_structs`"
|
9998 + | );
|
9999 + | ::pretty_assertions::assert_eq!(
|
10000 + | input.long,
|
10001 + | expected.long,
|
10002 + | "Unexpected value for `long`"
|
10003 + | );
|
10004 + | ::pretty_assertions::assert_eq!(
|
10005 + | input.map_of_lists_of_strings,
|
10006 + | expected.map_of_lists_of_strings,
|
10007 + | "Unexpected value for `map_of_lists_of_strings`"
|
10008 + | );
|
10009 + | ::pretty_assertions::assert_eq!(
|
10010 + | input.map_of_maps,
|
10011 + | expected.map_of_maps,
|
10012 + | "Unexpected value for `map_of_maps`"
|
10013 + | );
|
10014 + | ::pretty_assertions::assert_eq!(
|
10015 + | input.map_of_strings,
|
10016 + | expected.map_of_strings,
|
10017 + | "Unexpected value for `map_of_strings`"
|
10018 + | );
|
10019 + | ::pretty_assertions::assert_eq!(
|
10020 + | input.map_of_structs,
|
10021 + | expected.map_of_structs,
|
10022 + | "Unexpected value for `map_of_structs`"
|
10023 + | );
|
10024 + | ::pretty_assertions::assert_eq!(
|
10025 + | input.recursive_list,
|
10026 + | expected.recursive_list,
|
10027 + | "Unexpected value for `recursive_list`"
|
10028 + | );
|
10029 + | ::pretty_assertions::assert_eq!(
|
10030 + | input.recursive_map,
|
10031 + | expected.recursive_map,
|
10032 + | "Unexpected value for `recursive_map`"
|
10033 + | );
|
10034 + | ::pretty_assertions::assert_eq!(
|
10035 + | input.recursive_struct,
|
10036 + | expected.recursive_struct,
|
10037 + | "Unexpected value for `recursive_struct`"
|
10038 + | );
|
10039 + | ::pretty_assertions::assert_eq!(
|
10040 + | input.simple_struct,
|
10041 + | expected.simple_struct,
|
10042 + | "Unexpected value for `simple_struct`"
|
10043 + | );
|
10044 + | ::pretty_assertions::assert_eq!(
|
10045 + | input.string,
|
10046 + | expected.string,
|
10047 + | "Unexpected value for `string`"
|
10048 + | );
|
10049 + | ::pretty_assertions::assert_eq!(
|
10050 + | input.struct_with_json_name,
|
10051 + | expected.struct_with_json_name,
|
10052 + | "Unexpected value for `struct_with_json_name`"
|
10053 + | );
|
10054 + | ::pretty_assertions::assert_eq!(
|
10055 + | input.timestamp,
|
10056 + | expected.timestamp,
|
10057 + | "Unexpected value for `timestamp`"
|
10058 + | );
|
10059 + | ::pretty_assertions::assert_eq!(
|
10060 + | input.unix_timestamp,
|
10061 + | expected.unix_timestamp,
|
10062 + | "Unexpected value for `unix_timestamp`"
|
10063 + | );
|
10064 + | let output = crate::output::KitchenSinkOperationOutput {
|
10065 + | blob: ::std::option::Option::None,
|
10066 + | boolean: ::std::option::Option::None,
|
10067 + | double: ::std::option::Option::None,
|
10068 + | empty_struct: ::std::option::Option::None,
|
10069 + | float: ::std::option::Option::None,
|
10070 + | httpdate_timestamp: ::std::option::Option::None,
|
10071 + | integer: ::std::option::Option::None,
|
10072 + | iso8601_timestamp: ::std::option::Option::None,
|
10073 + | json_value: ::std::option::Option::None,
|
10074 + | list_of_lists: ::std::option::Option::None,
|
10075 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10076 + | list_of_strings: ::std::option::Option::None,
|
10077 + | list_of_structs: ::std::option::Option::None,
|
10078 + | long: ::std::option::Option::None,
|
10079 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10080 + | map_of_maps: ::std::option::Option::None,
|
10081 + | map_of_strings: ::std::option::Option::None,
|
10082 + | map_of_structs: ::std::option::Option::None,
|
10083 + | recursive_list: ::std::option::Option::None,
|
10084 + | recursive_map: ::std::option::Option::None,
|
10085 + | recursive_struct: ::std::option::Option::None,
|
10086 + | simple_struct: ::std::option::Option::None,
|
10087 + | string: ::std::option::Option::None,
|
10088 + | struct_with_json_name: ::std::option::Option::None,
|
10089 + | timestamp: ::std::option::Option::None,
|
10090 + | unix_timestamp: ::std::option::Option::None,
|
10091 + | };
|
10092 + | Ok(output)
|
10093 + | };
|
10094 + | sender.send(()).await.expect("receiver dropped early");
|
10095 + | result
|
10096 + | }
|
10097 + | })
|
10098 + | .build_unchecked();
|
10099 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10100 + | .await
|
10101 + | .expect("unable to make an HTTP request");
|
10102 + | assert!(
|
10103 + | receiver.recv().await.is_some(),
|
10104 + | "we expected operation handler to be invoked but it was not entered"
|
10105 + | );
|
10106 + | }
|
10107 + |
|
10108 + | /// Serializes recursive structure shapes
|
10109 + | /// Test ID: serializes_recursive_structure_shapes
|
10110 + | #[::tokio::test]
|
10111 + | #[::tracing_test::traced_test]
|
10112 + | async fn serializes_recursive_structure_shapes_request() {
|
10113 + | #[allow(unused_mut)]
|
10114 + | let mut http_request = ::http::Request::builder()
|
10115 + | .uri("/")
|
10116 + | .method("POST")
|
10117 + | .header("Content-Type", "application/x-amz-json-1.1")
|
10118 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
10119 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
10120 + | ::bytes::Bytes::copy_from_slice(
|
10121 + | &::aws_smithy_protocol_test::decode_body_data("{\"String\":\"top-value\",\"Boolean\":false,\"RecursiveStruct\":{\"String\":\"nested-value\",\"Boolean\":true,\"RecursiveList\":[{\"String\":\"string-only\"},{\"RecursiveStruct\":{\"MapOfStrings\":{\"color\":\"red\",\"size\":\"large\"}}}]}}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
10122 + | )
|
10123 + | )).unwrap();
|
10124 + | #[allow(unused_mut)]
|
10125 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10126 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
10127 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
10128 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
10129 + | let sender = sender.clone();
|
10130 + | async move {
|
10131 + | let result = {
|
10132 + | use ::aws_smithy_protocol_test::FloatEquals;
|
10133 + | let expected = crate::input::KitchenSinkOperationInput {
|
10134 + | string: ::std::option::Option::Some("top-value".to_owned()),
|
10135 + | boolean: ::std::option::Option::Some(false),
|
10136 + | recursive_struct: ::std::option::Option::Some(::std::boxed::Box::new(
|
10137 + | crate::model::KitchenSink {
|
10138 + | string: ::std::option::Option::Some("nested-value".to_owned()),
|
10139 + | boolean: ::std::option::Option::Some(true),
|
10140 + | recursive_list: ::std::option::Option::Some(vec![
|
10141 + | crate::model::KitchenSink {
|
10142 + | string: ::std::option::Option::Some(
|
10143 + | "string-only".to_owned(),
|
10144 + | ),
|
10145 + | blob: ::std::option::Option::None,
|
10146 + | boolean: ::std::option::Option::None,
|
10147 + | double: ::std::option::Option::None,
|
10148 + | empty_struct: ::std::option::Option::None,
|
10149 + | float: ::std::option::Option::None,
|
10150 + | httpdate_timestamp: ::std::option::Option::None,
|
10151 + | integer: ::std::option::Option::None,
|
10152 + | iso8601_timestamp: ::std::option::Option::None,
|
10153 + | json_value: ::std::option::Option::None,
|
10154 + | list_of_lists: ::std::option::Option::None,
|
10155 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10156 + | list_of_strings: ::std::option::Option::None,
|
10157 + | list_of_structs: ::std::option::Option::None,
|
10158 + | long: ::std::option::Option::None,
|
10159 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10160 + | map_of_maps: ::std::option::Option::None,
|
10161 + | map_of_strings: ::std::option::Option::None,
|
10162 + | map_of_structs: ::std::option::Option::None,
|
10163 + | recursive_list: ::std::option::Option::None,
|
10164 + | recursive_map: ::std::option::Option::None,
|
10165 + | recursive_struct: ::std::option::Option::None,
|
10166 + | simple_struct: ::std::option::Option::None,
|
10167 + | struct_with_json_name: ::std::option::Option::None,
|
10168 + | timestamp: ::std::option::Option::None,
|
10169 + | unix_timestamp: ::std::option::Option::None,
|
10170 + | },
|
10171 + | crate::model::KitchenSink {
|
10172 + | recursive_struct: ::std::option::Option::Some(
|
10173 + | ::std::boxed::Box::new(crate::model::KitchenSink {
|
10174 + | map_of_strings: ::std::option::Option::Some({
|
10175 + | let mut ret =
|
10176 + | ::std::collections::HashMap::new();
|
10177 + | ret.insert(
|
10178 + | "color".to_owned(),
|
10179 + | "red".to_owned(),
|
10180 + | );
|
10181 + | ret.insert(
|
10182 + | "size".to_owned(),
|
10183 + | "large".to_owned(),
|
10184 + | );
|
10185 + | ret
|
10186 + | }),
|
10187 + | blob: ::std::option::Option::None,
|
10188 + | boolean: ::std::option::Option::None,
|
10189 + | double: ::std::option::Option::None,
|
10190 + | empty_struct: ::std::option::Option::None,
|
10191 + | float: ::std::option::Option::None,
|
10192 + | httpdate_timestamp: ::std::option::Option::None,
|
10193 + | integer: ::std::option::Option::None,
|
10194 + | iso8601_timestamp: ::std::option::Option::None,
|
10195 + | json_value: ::std::option::Option::None,
|
10196 + | list_of_lists: ::std::option::Option::None,
|
10197 + | list_of_maps_of_strings:
|
10198 + | ::std::option::Option::None,
|
10199 + | list_of_strings: ::std::option::Option::None,
|
10200 + | list_of_structs: ::std::option::Option::None,
|
10201 + | long: ::std::option::Option::None,
|
10202 + | map_of_lists_of_strings:
|
10203 + | ::std::option::Option::None,
|
10204 + | map_of_maps: ::std::option::Option::None,
|
10205 + | map_of_structs: ::std::option::Option::None,
|
10206 + | recursive_list: ::std::option::Option::None,
|
10207 + | recursive_map: ::std::option::Option::None,
|
10208 + | recursive_struct: ::std::option::Option::None,
|
10209 + | simple_struct: ::std::option::Option::None,
|
10210 + | string: ::std::option::Option::None,
|
10211 + | struct_with_json_name:
|
10212 + | ::std::option::Option::None,
|
10213 + | timestamp: ::std::option::Option::None,
|
10214 + | unix_timestamp: ::std::option::Option::None,
|
10215 + | }),
|
10216 + | ),
|
10217 + | blob: ::std::option::Option::None,
|
10218 + | boolean: ::std::option::Option::None,
|
10219 + | double: ::std::option::Option::None,
|
10220 + | empty_struct: ::std::option::Option::None,
|
10221 + | float: ::std::option::Option::None,
|
10222 + | httpdate_timestamp: ::std::option::Option::None,
|
10223 + | integer: ::std::option::Option::None,
|
10224 + | iso8601_timestamp: ::std::option::Option::None,
|
10225 + | json_value: ::std::option::Option::None,
|
10226 + | list_of_lists: ::std::option::Option::None,
|
10227 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10228 + | list_of_strings: ::std::option::Option::None,
|
10229 + | list_of_structs: ::std::option::Option::None,
|
10230 + | long: ::std::option::Option::None,
|
10231 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10232 + | map_of_maps: ::std::option::Option::None,
|
10233 + | map_of_strings: ::std::option::Option::None,
|
10234 + | map_of_structs: ::std::option::Option::None,
|
10235 + | recursive_list: ::std::option::Option::None,
|
10236 + | recursive_map: ::std::option::Option::None,
|
10237 + | simple_struct: ::std::option::Option::None,
|
10238 + | string: ::std::option::Option::None,
|
10239 + | struct_with_json_name: ::std::option::Option::None,
|
10240 + | timestamp: ::std::option::Option::None,
|
10241 + | unix_timestamp: ::std::option::Option::None,
|
10242 + | },
|
10243 + | ]),
|
10244 + | blob: ::std::option::Option::None,
|
10245 + | double: ::std::option::Option::None,
|
10246 + | empty_struct: ::std::option::Option::None,
|
10247 + | float: ::std::option::Option::None,
|
10248 + | httpdate_timestamp: ::std::option::Option::None,
|
10249 + | integer: ::std::option::Option::None,
|
10250 + | iso8601_timestamp: ::std::option::Option::None,
|
10251 + | json_value: ::std::option::Option::None,
|
10252 + | list_of_lists: ::std::option::Option::None,
|
10253 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10254 + | list_of_strings: ::std::option::Option::None,
|
10255 + | list_of_structs: ::std::option::Option::None,
|
10256 + | long: ::std::option::Option::None,
|
10257 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10258 + | map_of_maps: ::std::option::Option::None,
|
10259 + | map_of_strings: ::std::option::Option::None,
|
10260 + | map_of_structs: ::std::option::Option::None,
|
10261 + | recursive_map: ::std::option::Option::None,
|
10262 + | recursive_struct: ::std::option::Option::None,
|
10263 + | simple_struct: ::std::option::Option::None,
|
10264 + | struct_with_json_name: ::std::option::Option::None,
|
10265 + | timestamp: ::std::option::Option::None,
|
10266 + | unix_timestamp: ::std::option::Option::None,
|
10267 + | },
|
10268 + | )),
|
10269 + | blob: ::std::option::Option::None,
|
10270 + | double: ::std::option::Option::None,
|
10271 + | empty_struct: ::std::option::Option::None,
|
10272 + | float: ::std::option::Option::None,
|
10273 + | httpdate_timestamp: ::std::option::Option::None,
|
10274 + | integer: ::std::option::Option::None,
|
10275 + | iso8601_timestamp: ::std::option::Option::None,
|
10276 + | json_value: ::std::option::Option::None,
|
10277 + | list_of_lists: ::std::option::Option::None,
|
10278 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10279 + | list_of_strings: ::std::option::Option::None,
|
10280 + | list_of_structs: ::std::option::Option::None,
|
10281 + | long: ::std::option::Option::None,
|
10282 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10283 + | map_of_maps: ::std::option::Option::None,
|
10284 + | map_of_strings: ::std::option::Option::None,
|
10285 + | map_of_structs: ::std::option::Option::None,
|
10286 + | recursive_list: ::std::option::Option::None,
|
10287 + | recursive_map: ::std::option::Option::None,
|
10288 + | simple_struct: ::std::option::Option::None,
|
10289 + | struct_with_json_name: ::std::option::Option::None,
|
10290 + | timestamp: ::std::option::Option::None,
|
10291 + | unix_timestamp: ::std::option::Option::None,
|
10292 + | };
|
10293 + | ::pretty_assertions::assert_eq!(
|
10294 + | input.blob,
|
10295 + | expected.blob,
|
10296 + | "Unexpected value for `blob`"
|
10297 + | );
|
10298 + | ::pretty_assertions::assert_eq!(
|
10299 + | input.boolean,
|
10300 + | expected.boolean,
|
10301 + | "Unexpected value for `boolean`"
|
10302 + | );
|
10303 + | assert!(
|
10304 + | input.double.float_equals(&expected.double),
|
10305 + | "Unexpected value for `double` {:?} vs. {:?}",
|
10306 + | expected.double,
|
10307 + | input.double
|
10308 + | );
|
10309 + | ::pretty_assertions::assert_eq!(
|
10310 + | input.empty_struct,
|
10311 + | expected.empty_struct,
|
10312 + | "Unexpected value for `empty_struct`"
|
10313 + | );
|
10314 + | assert!(
|
10315 + | input.float.float_equals(&expected.float),
|
10316 + | "Unexpected value for `float` {:?} vs. {:?}",
|
10317 + | expected.float,
|
10318 + | input.float
|
10319 + | );
|
10320 + | ::pretty_assertions::assert_eq!(
|
10321 + | input.httpdate_timestamp,
|
10322 + | expected.httpdate_timestamp,
|
10323 + | "Unexpected value for `httpdate_timestamp`"
|
10324 + | );
|
10325 + | ::pretty_assertions::assert_eq!(
|
10326 + | input.integer,
|
10327 + | expected.integer,
|
10328 + | "Unexpected value for `integer`"
|
10329 + | );
|
10330 + | ::pretty_assertions::assert_eq!(
|
10331 + | input.iso8601_timestamp,
|
10332 + | expected.iso8601_timestamp,
|
10333 + | "Unexpected value for `iso8601_timestamp`"
|
10334 + | );
|
10335 + | ::pretty_assertions::assert_eq!(
|
10336 + | input.json_value,
|
10337 + | expected.json_value,
|
10338 + | "Unexpected value for `json_value`"
|
10339 + | );
|
10340 + | ::pretty_assertions::assert_eq!(
|
10341 + | input.list_of_lists,
|
10342 + | expected.list_of_lists,
|
10343 + | "Unexpected value for `list_of_lists`"
|
10344 + | );
|
10345 + | ::pretty_assertions::assert_eq!(
|
10346 + | input.list_of_maps_of_strings,
|
10347 + | expected.list_of_maps_of_strings,
|
10348 + | "Unexpected value for `list_of_maps_of_strings`"
|
10349 + | );
|
10350 + | ::pretty_assertions::assert_eq!(
|
10351 + | input.list_of_strings,
|
10352 + | expected.list_of_strings,
|
10353 + | "Unexpected value for `list_of_strings`"
|
10354 + | );
|
10355 + | ::pretty_assertions::assert_eq!(
|
10356 + | input.list_of_structs,
|
10357 + | expected.list_of_structs,
|
10358 + | "Unexpected value for `list_of_structs`"
|
10359 + | );
|
10360 + | ::pretty_assertions::assert_eq!(
|
10361 + | input.long,
|
10362 + | expected.long,
|
10363 + | "Unexpected value for `long`"
|
10364 + | );
|
10365 + | ::pretty_assertions::assert_eq!(
|
10366 + | input.map_of_lists_of_strings,
|
10367 + | expected.map_of_lists_of_strings,
|
10368 + | "Unexpected value for `map_of_lists_of_strings`"
|
10369 + | );
|
10370 + | ::pretty_assertions::assert_eq!(
|
10371 + | input.map_of_maps,
|
10372 + | expected.map_of_maps,
|
10373 + | "Unexpected value for `map_of_maps`"
|
10374 + | );
|
10375 + | ::pretty_assertions::assert_eq!(
|
10376 + | input.map_of_strings,
|
10377 + | expected.map_of_strings,
|
10378 + | "Unexpected value for `map_of_strings`"
|
10379 + | );
|
10380 + | ::pretty_assertions::assert_eq!(
|
10381 + | input.map_of_structs,
|
10382 + | expected.map_of_structs,
|
10383 + | "Unexpected value for `map_of_structs`"
|
10384 + | );
|
10385 + | ::pretty_assertions::assert_eq!(
|
10386 + | input.recursive_list,
|
10387 + | expected.recursive_list,
|
10388 + | "Unexpected value for `recursive_list`"
|
10389 + | );
|
10390 + | ::pretty_assertions::assert_eq!(
|
10391 + | input.recursive_map,
|
10392 + | expected.recursive_map,
|
10393 + | "Unexpected value for `recursive_map`"
|
10394 + | );
|
10395 + | ::pretty_assertions::assert_eq!(
|
10396 + | input.recursive_struct,
|
10397 + | expected.recursive_struct,
|
10398 + | "Unexpected value for `recursive_struct`"
|
10399 + | );
|
10400 + | ::pretty_assertions::assert_eq!(
|
10401 + | input.simple_struct,
|
10402 + | expected.simple_struct,
|
10403 + | "Unexpected value for `simple_struct`"
|
10404 + | );
|
10405 + | ::pretty_assertions::assert_eq!(
|
10406 + | input.string,
|
10407 + | expected.string,
|
10408 + | "Unexpected value for `string`"
|
10409 + | );
|
10410 + | ::pretty_assertions::assert_eq!(
|
10411 + | input.struct_with_json_name,
|
10412 + | expected.struct_with_json_name,
|
10413 + | "Unexpected value for `struct_with_json_name`"
|
10414 + | );
|
10415 + | ::pretty_assertions::assert_eq!(
|
10416 + | input.timestamp,
|
10417 + | expected.timestamp,
|
10418 + | "Unexpected value for `timestamp`"
|
10419 + | );
|
10420 + | ::pretty_assertions::assert_eq!(
|
10421 + | input.unix_timestamp,
|
10422 + | expected.unix_timestamp,
|
10423 + | "Unexpected value for `unix_timestamp`"
|
10424 + | );
|
10425 + | let output = crate::output::KitchenSinkOperationOutput {
|
10426 + | blob: ::std::option::Option::None,
|
10427 + | boolean: ::std::option::Option::None,
|
10428 + | double: ::std::option::Option::None,
|
10429 + | empty_struct: ::std::option::Option::None,
|
10430 + | float: ::std::option::Option::None,
|
10431 + | httpdate_timestamp: ::std::option::Option::None,
|
10432 + | integer: ::std::option::Option::None,
|
10433 + | iso8601_timestamp: ::std::option::Option::None,
|
10434 + | json_value: ::std::option::Option::None,
|
10435 + | list_of_lists: ::std::option::Option::None,
|
10436 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10437 + | list_of_strings: ::std::option::Option::None,
|
10438 + | list_of_structs: ::std::option::Option::None,
|
10439 + | long: ::std::option::Option::None,
|
10440 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10441 + | map_of_maps: ::std::option::Option::None,
|
10442 + | map_of_strings: ::std::option::Option::None,
|
10443 + | map_of_structs: ::std::option::Option::None,
|
10444 + | recursive_list: ::std::option::Option::None,
|
10445 + | recursive_map: ::std::option::Option::None,
|
10446 + | recursive_struct: ::std::option::Option::None,
|
10447 + | simple_struct: ::std::option::Option::None,
|
10448 + | string: ::std::option::Option::None,
|
10449 + | struct_with_json_name: ::std::option::Option::None,
|
10450 + | timestamp: ::std::option::Option::None,
|
10451 + | unix_timestamp: ::std::option::Option::None,
|
10452 + | };
|
10453 + | Ok(output)
|
10454 + | };
|
10455 + | sender.send(()).await.expect("receiver dropped early");
|
10456 + | result
|
10457 + | }
|
10458 + | })
|
10459 + | .build_unchecked();
|
10460 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10461 + | .await
|
10462 + | .expect("unable to make an HTTP request");
|
10463 + | assert!(
|
10464 + | receiver.recv().await.is_some(),
|
10465 + | "we expected operation handler to be invoked but it was not entered"
|
10466 + | );
|
10467 + | }
|
10468 + |
|
10469 + | /// Parses operations with empty JSON bodies
|
10470 + | /// Test ID: parses_operations_with_empty_json_bodies
|
10471 + | #[::tokio::test]
|
10472 + | #[::tracing_test::traced_test]
|
10473 + | async fn parses_operations_with_empty_json_bodies_response() {
|
10474 + | let output = crate::output::KitchenSinkOperationOutput {
|
10475 + | blob: ::std::option::Option::None,
|
10476 + | boolean: ::std::option::Option::None,
|
10477 + | double: ::std::option::Option::None,
|
10478 + | empty_struct: ::std::option::Option::None,
|
10479 + | float: ::std::option::Option::None,
|
10480 + | httpdate_timestamp: ::std::option::Option::None,
|
10481 + | integer: ::std::option::Option::None,
|
10482 + | iso8601_timestamp: ::std::option::Option::None,
|
10483 + | json_value: ::std::option::Option::None,
|
10484 + | list_of_lists: ::std::option::Option::None,
|
10485 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10486 + | list_of_strings: ::std::option::Option::None,
|
10487 + | list_of_structs: ::std::option::Option::None,
|
10488 + | long: ::std::option::Option::None,
|
10489 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10490 + | map_of_maps: ::std::option::Option::None,
|
10491 + | map_of_strings: ::std::option::Option::None,
|
10492 + | map_of_structs: ::std::option::Option::None,
|
10493 + | recursive_list: ::std::option::Option::None,
|
10494 + | recursive_map: ::std::option::Option::None,
|
10495 + | recursive_struct: ::std::option::Option::None,
|
10496 + | simple_struct: ::std::option::Option::None,
|
10497 + | string: ::std::option::Option::None,
|
10498 + | struct_with_json_name: ::std::option::Option::None,
|
10499 + | timestamp: ::std::option::Option::None,
|
10500 + | unix_timestamp: ::std::option::Option::None,
|
10501 + | };
|
10502 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
10503 + | let http_response = output.into_response();
|
10504 + | ::pretty_assertions::assert_eq!(
|
10505 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10506 + | http_response.status()
|
10507 + | );
|
10508 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10509 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10510 + | http_response.headers(),
|
10511 + | expected_headers,
|
10512 + | ));
|
10513 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10514 + | .await
|
10515 + | .expect("unable to extract body to bytes");
|
10516 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10517 + | &body,
|
10518 + | "{}",
|
10519 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10520 + | ));
|
10521 + | }
|
10522 + |
|
10523 + | /// Parses string shapes
|
10524 + | /// Test ID: parses_string_shapes
|
10525 + | #[::tokio::test]
|
10526 + | #[::tracing_test::traced_test]
|
10527 + | async fn parses_string_shapes_response() {
|
10528 + | let output = crate::output::KitchenSinkOperationOutput {
|
10529 + | string: ::std::option::Option::Some("string-value".to_owned()),
|
10530 + | blob: ::std::option::Option::None,
|
10531 + | boolean: ::std::option::Option::None,
|
10532 + | double: ::std::option::Option::None,
|
10533 + | empty_struct: ::std::option::Option::None,
|
10534 + | float: ::std::option::Option::None,
|
10535 + | httpdate_timestamp: ::std::option::Option::None,
|
10536 + | integer: ::std::option::Option::None,
|
10537 + | iso8601_timestamp: ::std::option::Option::None,
|
10538 + | json_value: ::std::option::Option::None,
|
10539 + | list_of_lists: ::std::option::Option::None,
|
10540 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10541 + | list_of_strings: ::std::option::Option::None,
|
10542 + | list_of_structs: ::std::option::Option::None,
|
10543 + | long: ::std::option::Option::None,
|
10544 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10545 + | map_of_maps: ::std::option::Option::None,
|
10546 + | map_of_strings: ::std::option::Option::None,
|
10547 + | map_of_structs: ::std::option::Option::None,
|
10548 + | recursive_list: ::std::option::Option::None,
|
10549 + | recursive_map: ::std::option::Option::None,
|
10550 + | recursive_struct: ::std::option::Option::None,
|
10551 + | simple_struct: ::std::option::Option::None,
|
10552 + | struct_with_json_name: ::std::option::Option::None,
|
10553 + | timestamp: ::std::option::Option::None,
|
10554 + | unix_timestamp: ::std::option::Option::None,
|
10555 + | };
|
10556 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
10557 + | let http_response = output.into_response();
|
10558 + | ::pretty_assertions::assert_eq!(
|
10559 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10560 + | http_response.status()
|
10561 + | );
|
10562 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10563 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10564 + | http_response.headers(),
|
10565 + | expected_headers,
|
10566 + | ));
|
10567 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10568 + | .await
|
10569 + | .expect("unable to extract body to bytes");
|
10570 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10571 + | &body,
|
10572 + | "{\"String\":\"string-value\"}",
|
10573 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10574 + | ));
|
10575 + | }
|
10576 + |
|
10577 + | /// Parses integer shapes
|
10578 + | /// Test ID: parses_integer_shapes
|
10579 + | #[::tokio::test]
|
10580 + | #[::tracing_test::traced_test]
|
10581 + | async fn parses_integer_shapes_response() {
|
10582 + | let output = crate::output::KitchenSinkOperationOutput {
|
10583 + | integer: ::std::option::Option::Some(1234),
|
10584 + | blob: ::std::option::Option::None,
|
10585 + | boolean: ::std::option::Option::None,
|
10586 + | double: ::std::option::Option::None,
|
10587 + | empty_struct: ::std::option::Option::None,
|
10588 + | float: ::std::option::Option::None,
|
10589 + | httpdate_timestamp: ::std::option::Option::None,
|
10590 + | iso8601_timestamp: ::std::option::Option::None,
|
10591 + | json_value: ::std::option::Option::None,
|
10592 + | list_of_lists: ::std::option::Option::None,
|
10593 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10594 + | list_of_strings: ::std::option::Option::None,
|
10595 + | list_of_structs: ::std::option::Option::None,
|
10596 + | long: ::std::option::Option::None,
|
10597 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10598 + | map_of_maps: ::std::option::Option::None,
|
10599 + | map_of_strings: ::std::option::Option::None,
|
10600 + | map_of_structs: ::std::option::Option::None,
|
10601 + | recursive_list: ::std::option::Option::None,
|
10602 + | recursive_map: ::std::option::Option::None,
|
10603 + | recursive_struct: ::std::option::Option::None,
|
10604 + | simple_struct: ::std::option::Option::None,
|
10605 + | string: ::std::option::Option::None,
|
10606 + | struct_with_json_name: ::std::option::Option::None,
|
10607 + | timestamp: ::std::option::Option::None,
|
10608 + | unix_timestamp: ::std::option::Option::None,
|
10609 + | };
|
10610 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
10611 + | let http_response = output.into_response();
|
10612 + | ::pretty_assertions::assert_eq!(
|
10613 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10614 + | http_response.status()
|
10615 + | );
|
10616 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10617 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10618 + | http_response.headers(),
|
10619 + | expected_headers,
|
10620 + | ));
|
10621 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10622 + | .await
|
10623 + | .expect("unable to extract body to bytes");
|
10624 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10625 + | &body,
|
10626 + | "{\"Integer\":1234}",
|
10627 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10628 + | ));
|
10629 + | }
|
10630 + |
|
10631 + | /// Parses long shapes
|
10632 + | /// Test ID: parses_long_shapes
|
10633 + | #[::tokio::test]
|
10634 + | #[::tracing_test::traced_test]
|
10635 + | async fn parses_long_shapes_response() {
|
10636 + | let output = crate::output::KitchenSinkOperationOutput {
|
10637 + | long: ::std::option::Option::Some(1234567890123456789),
|
10638 + | blob: ::std::option::Option::None,
|
10639 + | boolean: ::std::option::Option::None,
|
10640 + | double: ::std::option::Option::None,
|
10641 + | empty_struct: ::std::option::Option::None,
|
10642 + | float: ::std::option::Option::None,
|
10643 + | httpdate_timestamp: ::std::option::Option::None,
|
10644 + | integer: ::std::option::Option::None,
|
10645 + | iso8601_timestamp: ::std::option::Option::None,
|
10646 + | json_value: ::std::option::Option::None,
|
10647 + | list_of_lists: ::std::option::Option::None,
|
10648 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10649 + | list_of_strings: ::std::option::Option::None,
|
10650 + | list_of_structs: ::std::option::Option::None,
|
10651 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10652 + | map_of_maps: ::std::option::Option::None,
|
10653 + | map_of_strings: ::std::option::Option::None,
|
10654 + | map_of_structs: ::std::option::Option::None,
|
10655 + | recursive_list: ::std::option::Option::None,
|
10656 + | recursive_map: ::std::option::Option::None,
|
10657 + | recursive_struct: ::std::option::Option::None,
|
10658 + | simple_struct: ::std::option::Option::None,
|
10659 + | string: ::std::option::Option::None,
|
10660 + | struct_with_json_name: ::std::option::Option::None,
|
10661 + | timestamp: ::std::option::Option::None,
|
10662 + | unix_timestamp: ::std::option::Option::None,
|
10663 + | };
|
10664 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
10665 + | let http_response = output.into_response();
|
10666 + | ::pretty_assertions::assert_eq!(
|
10667 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10668 + | http_response.status()
|
10669 + | );
|
10670 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10671 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10672 + | http_response.headers(),
|
10673 + | expected_headers,
|
10674 + | ));
|
10675 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10676 + | .await
|
10677 + | .expect("unable to extract body to bytes");
|
10678 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10679 + | &body,
|
10680 + | "{\"Long\":1234567890123456789}",
|
10681 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10682 + | ));
|
10683 + | }
|
10684 + |
|
10685 + | /// Parses float shapes
|
10686 + | /// Test ID: parses_float_shapes
|
10687 + | #[::tokio::test]
|
10688 + | #[::tracing_test::traced_test]
|
10689 + | async fn parses_float_shapes_response() {
|
10690 + | let output = crate::output::KitchenSinkOperationOutput {
|
10691 + | float: ::std::option::Option::Some(1234.5_f32),
|
10692 + | blob: ::std::option::Option::None,
|
10693 + | boolean: ::std::option::Option::None,
|
10694 + | double: ::std::option::Option::None,
|
10695 + | empty_struct: ::std::option::Option::None,
|
10696 + | httpdate_timestamp: ::std::option::Option::None,
|
10697 + | integer: ::std::option::Option::None,
|
10698 + | iso8601_timestamp: ::std::option::Option::None,
|
10699 + | json_value: ::std::option::Option::None,
|
10700 + | list_of_lists: ::std::option::Option::None,
|
10701 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10702 + | list_of_strings: ::std::option::Option::None,
|
10703 + | list_of_structs: ::std::option::Option::None,
|
10704 + | long: ::std::option::Option::None,
|
10705 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10706 + | map_of_maps: ::std::option::Option::None,
|
10707 + | map_of_strings: ::std::option::Option::None,
|
10708 + | map_of_structs: ::std::option::Option::None,
|
10709 + | recursive_list: ::std::option::Option::None,
|
10710 + | recursive_map: ::std::option::Option::None,
|
10711 + | recursive_struct: ::std::option::Option::None,
|
10712 + | simple_struct: ::std::option::Option::None,
|
10713 + | string: ::std::option::Option::None,
|
10714 + | struct_with_json_name: ::std::option::Option::None,
|
10715 + | timestamp: ::std::option::Option::None,
|
10716 + | unix_timestamp: ::std::option::Option::None,
|
10717 + | };
|
10718 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
10719 + | let http_response = output.into_response();
|
10720 + | ::pretty_assertions::assert_eq!(
|
10721 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10722 + | http_response.status()
|
10723 + | );
|
10724 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10725 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10726 + | http_response.headers(),
|
10727 + | expected_headers,
|
10728 + | ));
|
10729 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10730 + | .await
|
10731 + | .expect("unable to extract body to bytes");
|
10732 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10733 + | &body,
|
10734 + | "{\"Float\":1234.5}",
|
10735 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10736 + | ));
|
10737 + | }
|
10738 + |
|
10739 + | /// Parses double shapes
|
10740 + | /// Test ID: parses_double_shapes
|
10741 + | #[::tokio::test]
|
10742 + | #[::tracing_test::traced_test]
|
10743 + | async fn parses_double_shapes_response() {
|
10744 + | let output = crate::output::KitchenSinkOperationOutput {
|
10745 + | double: ::std::option::Option::Some(1.2345678912345679E8_f64),
|
10746 + | blob: ::std::option::Option::None,
|
10747 + | boolean: ::std::option::Option::None,
|
10748 + | empty_struct: ::std::option::Option::None,
|
10749 + | float: ::std::option::Option::None,
|
10750 + | httpdate_timestamp: ::std::option::Option::None,
|
10751 + | integer: ::std::option::Option::None,
|
10752 + | iso8601_timestamp: ::std::option::Option::None,
|
10753 + | json_value: ::std::option::Option::None,
|
10754 + | list_of_lists: ::std::option::Option::None,
|
10755 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10756 + | list_of_strings: ::std::option::Option::None,
|
10757 + | list_of_structs: ::std::option::Option::None,
|
10758 + | long: ::std::option::Option::None,
|
10759 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10760 + | map_of_maps: ::std::option::Option::None,
|
10761 + | map_of_strings: ::std::option::Option::None,
|
10762 + | map_of_structs: ::std::option::Option::None,
|
10763 + | recursive_list: ::std::option::Option::None,
|
10764 + | recursive_map: ::std::option::Option::None,
|
10765 + | recursive_struct: ::std::option::Option::None,
|
10766 + | simple_struct: ::std::option::Option::None,
|
10767 + | string: ::std::option::Option::None,
|
10768 + | struct_with_json_name: ::std::option::Option::None,
|
10769 + | timestamp: ::std::option::Option::None,
|
10770 + | unix_timestamp: ::std::option::Option::None,
|
10771 + | };
|
10772 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
10773 + | let http_response = output.into_response();
|
10774 + | ::pretty_assertions::assert_eq!(
|
10775 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10776 + | http_response.status()
|
10777 + | );
|
10778 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10779 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10780 + | http_response.headers(),
|
10781 + | expected_headers,
|
10782 + | ));
|
10783 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10784 + | .await
|
10785 + | .expect("unable to extract body to bytes");
|
10786 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10787 + | &body,
|
10788 + | "{\"Double\":123456789.12345679}",
|
10789 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10790 + | ));
|
10791 + | }
|
10792 + |
|
10793 + | /// Parses boolean shapes (true)
|
10794 + | /// Test ID: parses_boolean_shapes_true
|
10795 + | #[::tokio::test]
|
10796 + | #[::tracing_test::traced_test]
|
10797 + | async fn parses_boolean_shapes_true_response() {
|
10798 + | let output = crate::output::KitchenSinkOperationOutput {
|
10799 + | boolean: ::std::option::Option::Some(true),
|
10800 + | blob: ::std::option::Option::None,
|
10801 + | double: ::std::option::Option::None,
|
10802 + | empty_struct: ::std::option::Option::None,
|
10803 + | float: ::std::option::Option::None,
|
10804 + | httpdate_timestamp: ::std::option::Option::None,
|
10805 + | integer: ::std::option::Option::None,
|
10806 + | iso8601_timestamp: ::std::option::Option::None,
|
10807 + | json_value: ::std::option::Option::None,
|
10808 + | list_of_lists: ::std::option::Option::None,
|
10809 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10810 + | list_of_strings: ::std::option::Option::None,
|
10811 + | list_of_structs: ::std::option::Option::None,
|
10812 + | long: ::std::option::Option::None,
|
10813 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10814 + | map_of_maps: ::std::option::Option::None,
|
10815 + | map_of_strings: ::std::option::Option::None,
|
10816 + | map_of_structs: ::std::option::Option::None,
|
10817 + | recursive_list: ::std::option::Option::None,
|
10818 + | recursive_map: ::std::option::Option::None,
|
10819 + | recursive_struct: ::std::option::Option::None,
|
10820 + | simple_struct: ::std::option::Option::None,
|
10821 + | string: ::std::option::Option::None,
|
10822 + | struct_with_json_name: ::std::option::Option::None,
|
10823 + | timestamp: ::std::option::Option::None,
|
10824 + | unix_timestamp: ::std::option::Option::None,
|
10825 + | };
|
10826 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
10827 + | let http_response = output.into_response();
|
10828 + | ::pretty_assertions::assert_eq!(
|
10829 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10830 + | http_response.status()
|
10831 + | );
|
10832 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10833 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10834 + | http_response.headers(),
|
10835 + | expected_headers,
|
10836 + | ));
|
10837 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10838 + | .await
|
10839 + | .expect("unable to extract body to bytes");
|
10840 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10841 + | &body,
|
10842 + | "{\"Boolean\":true}",
|
10843 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10844 + | ));
|
10845 + | }
|
10846 + |
|
10847 + | /// Parses boolean (false)
|
10848 + | /// Test ID: parses_boolean_false
|
10849 + | #[::tokio::test]
|
10850 + | #[::tracing_test::traced_test]
|
10851 + | async fn parses_boolean_false_response() {
|
10852 + | let output = crate::output::KitchenSinkOperationOutput {
|
10853 + | boolean: ::std::option::Option::Some(false),
|
10854 + | blob: ::std::option::Option::None,
|
10855 + | double: ::std::option::Option::None,
|
10856 + | empty_struct: ::std::option::Option::None,
|
10857 + | float: ::std::option::Option::None,
|
10858 + | httpdate_timestamp: ::std::option::Option::None,
|
10859 + | integer: ::std::option::Option::None,
|
10860 + | iso8601_timestamp: ::std::option::Option::None,
|
10861 + | json_value: ::std::option::Option::None,
|
10862 + | list_of_lists: ::std::option::Option::None,
|
10863 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10864 + | list_of_strings: ::std::option::Option::None,
|
10865 + | list_of_structs: ::std::option::Option::None,
|
10866 + | long: ::std::option::Option::None,
|
10867 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10868 + | map_of_maps: ::std::option::Option::None,
|
10869 + | map_of_strings: ::std::option::Option::None,
|
10870 + | map_of_structs: ::std::option::Option::None,
|
10871 + | recursive_list: ::std::option::Option::None,
|
10872 + | recursive_map: ::std::option::Option::None,
|
10873 + | recursive_struct: ::std::option::Option::None,
|
10874 + | simple_struct: ::std::option::Option::None,
|
10875 + | string: ::std::option::Option::None,
|
10876 + | struct_with_json_name: ::std::option::Option::None,
|
10877 + | timestamp: ::std::option::Option::None,
|
10878 + | unix_timestamp: ::std::option::Option::None,
|
10879 + | };
|
10880 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
10881 + | let http_response = output.into_response();
|
10882 + | ::pretty_assertions::assert_eq!(
|
10883 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10884 + | http_response.status()
|
10885 + | );
|
10886 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10887 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10888 + | http_response.headers(),
|
10889 + | expected_headers,
|
10890 + | ));
|
10891 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10892 + | .await
|
10893 + | .expect("unable to extract body to bytes");
|
10894 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10895 + | &body,
|
10896 + | "{\"Boolean\":false}",
|
10897 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10898 + | ));
|
10899 + | }
|
10900 + |
|
10901 + | /// Parses blob shapes
|
10902 + | /// Test ID: parses_blob_shapes
|
10903 + | #[::tokio::test]
|
10904 + | #[::tracing_test::traced_test]
|
10905 + | async fn parses_blob_shapes_response() {
|
10906 + | let output = crate::output::KitchenSinkOperationOutput {
|
10907 + | blob: ::std::option::Option::Some(::aws_smithy_types::Blob::new("binary-value")),
|
10908 + | boolean: ::std::option::Option::None,
|
10909 + | double: ::std::option::Option::None,
|
10910 + | empty_struct: ::std::option::Option::None,
|
10911 + | float: ::std::option::Option::None,
|
10912 + | httpdate_timestamp: ::std::option::Option::None,
|
10913 + | integer: ::std::option::Option::None,
|
10914 + | iso8601_timestamp: ::std::option::Option::None,
|
10915 + | json_value: ::std::option::Option::None,
|
10916 + | list_of_lists: ::std::option::Option::None,
|
10917 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10918 + | list_of_strings: ::std::option::Option::None,
|
10919 + | list_of_structs: ::std::option::Option::None,
|
10920 + | long: ::std::option::Option::None,
|
10921 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10922 + | map_of_maps: ::std::option::Option::None,
|
10923 + | map_of_strings: ::std::option::Option::None,
|
10924 + | map_of_structs: ::std::option::Option::None,
|
10925 + | recursive_list: ::std::option::Option::None,
|
10926 + | recursive_map: ::std::option::Option::None,
|
10927 + | recursive_struct: ::std::option::Option::None,
|
10928 + | simple_struct: ::std::option::Option::None,
|
10929 + | string: ::std::option::Option::None,
|
10930 + | struct_with_json_name: ::std::option::Option::None,
|
10931 + | timestamp: ::std::option::Option::None,
|
10932 + | unix_timestamp: ::std::option::Option::None,
|
10933 + | };
|
10934 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
10935 + | let http_response = output.into_response();
|
10936 + | ::pretty_assertions::assert_eq!(
|
10937 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10938 + | http_response.status()
|
10939 + | );
|
10940 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10941 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10942 + | http_response.headers(),
|
10943 + | expected_headers,
|
10944 + | ));
|
10945 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10946 + | .await
|
10947 + | .expect("unable to extract body to bytes");
|
10948 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10949 + | &body,
|
10950 + | "{\"Blob\":\"YmluYXJ5LXZhbHVl\"}",
|
10951 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10952 + | ));
|
10953 + | }
|
10954 + |
|
10955 + | /// Parses timestamp shapes
|
10956 + | /// Test ID: parses_timestamp_shapes
|
10957 + | #[::tokio::test]
|
10958 + | #[::tracing_test::traced_test]
|
10959 + | async fn parses_timestamp_shapes_response() {
|
10960 + | let output = crate::output::KitchenSinkOperationOutput {
|
10961 + | timestamp: ::std::option::Option::Some(
|
10962 + | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
10963 + | ),
|
10964 + | blob: ::std::option::Option::None,
|
10965 + | boolean: ::std::option::Option::None,
|
10966 + | double: ::std::option::Option::None,
|
10967 + | empty_struct: ::std::option::Option::None,
|
10968 + | float: ::std::option::Option::None,
|
10969 + | httpdate_timestamp: ::std::option::Option::None,
|
10970 + | integer: ::std::option::Option::None,
|
10971 + | iso8601_timestamp: ::std::option::Option::None,
|
10972 + | json_value: ::std::option::Option::None,
|
10973 + | list_of_lists: ::std::option::Option::None,
|
10974 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10975 + | list_of_strings: ::std::option::Option::None,
|
10976 + | list_of_structs: ::std::option::Option::None,
|
10977 + | long: ::std::option::Option::None,
|
10978 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10979 + | map_of_maps: ::std::option::Option::None,
|
10980 + | map_of_strings: ::std::option::Option::None,
|
10981 + | map_of_structs: ::std::option::Option::None,
|
10982 + | recursive_list: ::std::option::Option::None,
|
10983 + | recursive_map: ::std::option::Option::None,
|
10984 + | recursive_struct: ::std::option::Option::None,
|
10985 + | simple_struct: ::std::option::Option::None,
|
10986 + | string: ::std::option::Option::None,
|
10987 + | struct_with_json_name: ::std::option::Option::None,
|
10988 + | unix_timestamp: ::std::option::Option::None,
|
10989 + | };
|
10990 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
10991 + | let http_response = output.into_response();
|
10992 + | ::pretty_assertions::assert_eq!(
|
10993 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10994 + | http_response.status()
|
10995 + | );
|
10996 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10997 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10998 + | http_response.headers(),
|
10999 + | expected_headers,
|
11000 + | ));
|
11001 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11002 + | .await
|
11003 + | .expect("unable to extract body to bytes");
|
11004 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11005 + | &body,
|
11006 + | "{\"Timestamp\":946845296}",
|
11007 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11008 + | ));
|
11009 + | }
|
11010 + |
|
11011 + | /// Parses iso8601 timestamps
|
11012 + | /// Test ID: parses_iso8601_timestamps
|
11013 + | #[::tokio::test]
|
11014 + | #[::tracing_test::traced_test]
|
11015 + | async fn parses_iso8601_timestamps_response() {
|
11016 + | let output = crate::output::KitchenSinkOperationOutput {
|
11017 + | iso8601_timestamp: ::std::option::Option::Some(
|
11018 + | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
11019 + | ),
|
11020 + | blob: ::std::option::Option::None,
|
11021 + | boolean: ::std::option::Option::None,
|
11022 + | double: ::std::option::Option::None,
|
11023 + | empty_struct: ::std::option::Option::None,
|
11024 + | float: ::std::option::Option::None,
|
11025 + | httpdate_timestamp: ::std::option::Option::None,
|
11026 + | integer: ::std::option::Option::None,
|
11027 + | json_value: ::std::option::Option::None,
|
11028 + | list_of_lists: ::std::option::Option::None,
|
11029 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11030 + | list_of_strings: ::std::option::Option::None,
|
11031 + | list_of_structs: ::std::option::Option::None,
|
11032 + | long: ::std::option::Option::None,
|
11033 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11034 + | map_of_maps: ::std::option::Option::None,
|
11035 + | map_of_strings: ::std::option::Option::None,
|
11036 + | map_of_structs: ::std::option::Option::None,
|
11037 + | recursive_list: ::std::option::Option::None,
|
11038 + | recursive_map: ::std::option::Option::None,
|
11039 + | recursive_struct: ::std::option::Option::None,
|
11040 + | simple_struct: ::std::option::Option::None,
|
11041 + | string: ::std::option::Option::None,
|
11042 + | struct_with_json_name: ::std::option::Option::None,
|
11043 + | timestamp: ::std::option::Option::None,
|
11044 + | unix_timestamp: ::std::option::Option::None,
|
11045 + | };
|
11046 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11047 + | let http_response = output.into_response();
|
11048 + | ::pretty_assertions::assert_eq!(
|
11049 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11050 + | http_response.status()
|
11051 + | );
|
11052 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11053 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11054 + | http_response.headers(),
|
11055 + | expected_headers,
|
11056 + | ));
|
11057 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11058 + | .await
|
11059 + | .expect("unable to extract body to bytes");
|
11060 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11061 + | &body,
|
11062 + | "{\"Iso8601Timestamp\":\"2000-01-02T20:34:56Z\"}",
|
11063 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11064 + | ));
|
11065 + | }
|
11066 + |
|
11067 + | /// Parses httpdate timestamps
|
11068 + | /// Test ID: parses_httpdate_timestamps
|
11069 + | #[::tokio::test]
|
11070 + | #[::tracing_test::traced_test]
|
11071 + | async fn parses_httpdate_timestamps_response() {
|
11072 + | let output = crate::output::KitchenSinkOperationOutput {
|
11073 + | httpdate_timestamp: ::std::option::Option::Some(
|
11074 + | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
11075 + | ),
|
11076 + | blob: ::std::option::Option::None,
|
11077 + | boolean: ::std::option::Option::None,
|
11078 + | double: ::std::option::Option::None,
|
11079 + | empty_struct: ::std::option::Option::None,
|
11080 + | float: ::std::option::Option::None,
|
11081 + | integer: ::std::option::Option::None,
|
11082 + | iso8601_timestamp: ::std::option::Option::None,
|
11083 + | json_value: ::std::option::Option::None,
|
11084 + | list_of_lists: ::std::option::Option::None,
|
11085 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11086 + | list_of_strings: ::std::option::Option::None,
|
11087 + | list_of_structs: ::std::option::Option::None,
|
11088 + | long: ::std::option::Option::None,
|
11089 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11090 + | map_of_maps: ::std::option::Option::None,
|
11091 + | map_of_strings: ::std::option::Option::None,
|
11092 + | map_of_structs: ::std::option::Option::None,
|
11093 + | recursive_list: ::std::option::Option::None,
|
11094 + | recursive_map: ::std::option::Option::None,
|
11095 + | recursive_struct: ::std::option::Option::None,
|
11096 + | simple_struct: ::std::option::Option::None,
|
11097 + | string: ::std::option::Option::None,
|
11098 + | struct_with_json_name: ::std::option::Option::None,
|
11099 + | timestamp: ::std::option::Option::None,
|
11100 + | unix_timestamp: ::std::option::Option::None,
|
11101 + | };
|
11102 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11103 + | let http_response = output.into_response();
|
11104 + | ::pretty_assertions::assert_eq!(
|
11105 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11106 + | http_response.status()
|
11107 + | );
|
11108 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11109 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11110 + | http_response.headers(),
|
11111 + | expected_headers,
|
11112 + | ));
|
11113 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11114 + | .await
|
11115 + | .expect("unable to extract body to bytes");
|
11116 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11117 + | &body,
|
11118 + | "{\"HttpdateTimestamp\":\"Sun, 02 Jan 2000 20:34:56 GMT\"}",
|
11119 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11120 + | ));
|
11121 + | }
|
11122 + |
|
11123 + | /// Parses list shapes
|
11124 + | /// Test ID: parses_list_shapes
|
11125 + | #[::tokio::test]
|
11126 + | #[::tracing_test::traced_test]
|
11127 + | async fn parses_list_shapes_response() {
|
11128 + | let output = crate::output::KitchenSinkOperationOutput {
|
11129 + | list_of_strings: ::std::option::Option::Some(vec![
|
11130 + | "abc".to_owned(),
|
11131 + | "mno".to_owned(),
|
11132 + | "xyz".to_owned(),
|
11133 + | ]),
|
11134 + | blob: ::std::option::Option::None,
|
11135 + | boolean: ::std::option::Option::None,
|
11136 + | double: ::std::option::Option::None,
|
11137 + | empty_struct: ::std::option::Option::None,
|
11138 + | float: ::std::option::Option::None,
|
11139 + | httpdate_timestamp: ::std::option::Option::None,
|
11140 + | integer: ::std::option::Option::None,
|
11141 + | iso8601_timestamp: ::std::option::Option::None,
|
11142 + | json_value: ::std::option::Option::None,
|
11143 + | list_of_lists: ::std::option::Option::None,
|
11144 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11145 + | list_of_structs: ::std::option::Option::None,
|
11146 + | long: ::std::option::Option::None,
|
11147 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11148 + | map_of_maps: ::std::option::Option::None,
|
11149 + | map_of_strings: ::std::option::Option::None,
|
11150 + | map_of_structs: ::std::option::Option::None,
|
11151 + | recursive_list: ::std::option::Option::None,
|
11152 + | recursive_map: ::std::option::Option::None,
|
11153 + | recursive_struct: ::std::option::Option::None,
|
11154 + | simple_struct: ::std::option::Option::None,
|
11155 + | string: ::std::option::Option::None,
|
11156 + | struct_with_json_name: ::std::option::Option::None,
|
11157 + | timestamp: ::std::option::Option::None,
|
11158 + | unix_timestamp: ::std::option::Option::None,
|
11159 + | };
|
11160 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11161 + | let http_response = output.into_response();
|
11162 + | ::pretty_assertions::assert_eq!(
|
11163 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11164 + | http_response.status()
|
11165 + | );
|
11166 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11167 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11168 + | http_response.headers(),
|
11169 + | expected_headers,
|
11170 + | ));
|
11171 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11172 + | .await
|
11173 + | .expect("unable to extract body to bytes");
|
11174 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11175 + | &body,
|
11176 + | "{\"ListOfStrings\":[\"abc\",\"mno\",\"xyz\"]}",
|
11177 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11178 + | ));
|
11179 + | }
|
11180 + |
|
11181 + | /// Parses list of map shapes
|
11182 + | /// Test ID: parses_list_of_map_shapes
|
11183 + | #[::tokio::test]
|
11184 + | #[::tracing_test::traced_test]
|
11185 + | async fn parses_list_of_map_shapes_response() {
|
11186 + | let output = crate::output::KitchenSinkOperationOutput {
|
11187 + | list_of_maps_of_strings: ::std::option::Option::Some(vec![
|
11188 + | {
|
11189 + | let mut ret = ::std::collections::HashMap::new();
|
11190 + | ret.insert("size".to_owned(), "large".to_owned());
|
11191 + | ret
|
11192 + | },
|
11193 + | {
|
11194 + | let mut ret = ::std::collections::HashMap::new();
|
11195 + | ret.insert("color".to_owned(), "red".to_owned());
|
11196 + | ret
|
11197 + | },
|
11198 + | ]),
|
11199 + | blob: ::std::option::Option::None,
|
11200 + | boolean: ::std::option::Option::None,
|
11201 + | double: ::std::option::Option::None,
|
11202 + | empty_struct: ::std::option::Option::None,
|
11203 + | float: ::std::option::Option::None,
|
11204 + | httpdate_timestamp: ::std::option::Option::None,
|
11205 + | integer: ::std::option::Option::None,
|
11206 + | iso8601_timestamp: ::std::option::Option::None,
|
11207 + | json_value: ::std::option::Option::None,
|
11208 + | list_of_lists: ::std::option::Option::None,
|
11209 + | list_of_strings: ::std::option::Option::None,
|
11210 + | list_of_structs: ::std::option::Option::None,
|
11211 + | long: ::std::option::Option::None,
|
11212 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11213 + | map_of_maps: ::std::option::Option::None,
|
11214 + | map_of_strings: ::std::option::Option::None,
|
11215 + | map_of_structs: ::std::option::Option::None,
|
11216 + | recursive_list: ::std::option::Option::None,
|
11217 + | recursive_map: ::std::option::Option::None,
|
11218 + | recursive_struct: ::std::option::Option::None,
|
11219 + | simple_struct: ::std::option::Option::None,
|
11220 + | string: ::std::option::Option::None,
|
11221 + | struct_with_json_name: ::std::option::Option::None,
|
11222 + | timestamp: ::std::option::Option::None,
|
11223 + | unix_timestamp: ::std::option::Option::None,
|
11224 + | };
|
11225 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11226 + | let http_response = output.into_response();
|
11227 + | ::pretty_assertions::assert_eq!(
|
11228 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11229 + | http_response.status()
|
11230 + | );
|
11231 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11232 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11233 + | http_response.headers(),
|
11234 + | expected_headers,
|
11235 + | ));
|
11236 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11237 + | .await
|
11238 + | .expect("unable to extract body to bytes");
|
11239 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11240 + | &body,
|
11241 + | "{\"ListOfMapsOfStrings\":[{\"size\":\"large\"},{\"color\":\"red\"}]}",
|
11242 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11243 + | ));
|
11244 + | }
|
11245 + |
|
11246 + | /// Parses list of list shapes
|
11247 + | /// Test ID: parses_list_of_list_shapes
|
11248 + | #[::tokio::test]
|
11249 + | #[::tracing_test::traced_test]
|
11250 + | async fn parses_list_of_list_shapes_response() {
|
11251 + | let output = crate::output::KitchenSinkOperationOutput {
|
11252 + | list_of_lists: ::std::option::Option::Some(vec![
|
11253 + | vec!["abc".to_owned(), "mno".to_owned(), "xyz".to_owned()],
|
11254 + | vec!["hjk".to_owned(), "qrs".to_owned(), "tuv".to_owned()],
|
11255 + | ]),
|
11256 + | blob: ::std::option::Option::None,
|
11257 + | boolean: ::std::option::Option::None,
|
11258 + | double: ::std::option::Option::None,
|
11259 + | empty_struct: ::std::option::Option::None,
|
11260 + | float: ::std::option::Option::None,
|
11261 + | httpdate_timestamp: ::std::option::Option::None,
|
11262 + | integer: ::std::option::Option::None,
|
11263 + | iso8601_timestamp: ::std::option::Option::None,
|
11264 + | json_value: ::std::option::Option::None,
|
11265 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11266 + | list_of_strings: ::std::option::Option::None,
|
11267 + | list_of_structs: ::std::option::Option::None,
|
11268 + | long: ::std::option::Option::None,
|
11269 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11270 + | map_of_maps: ::std::option::Option::None,
|
11271 + | map_of_strings: ::std::option::Option::None,
|
11272 + | map_of_structs: ::std::option::Option::None,
|
11273 + | recursive_list: ::std::option::Option::None,
|
11274 + | recursive_map: ::std::option::Option::None,
|
11275 + | recursive_struct: ::std::option::Option::None,
|
11276 + | simple_struct: ::std::option::Option::None,
|
11277 + | string: ::std::option::Option::None,
|
11278 + | struct_with_json_name: ::std::option::Option::None,
|
11279 + | timestamp: ::std::option::Option::None,
|
11280 + | unix_timestamp: ::std::option::Option::None,
|
11281 + | };
|
11282 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11283 + | let http_response = output.into_response();
|
11284 + | ::pretty_assertions::assert_eq!(
|
11285 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11286 + | http_response.status()
|
11287 + | );
|
11288 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11289 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11290 + | http_response.headers(),
|
11291 + | expected_headers,
|
11292 + | ));
|
11293 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11294 + | .await
|
11295 + | .expect("unable to extract body to bytes");
|
11296 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11297 + | &body,
|
11298 + | "{\"ListOfLists\":[[\"abc\",\"mno\",\"xyz\"],[\"hjk\",\"qrs\",\"tuv\"]]}",
|
11299 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11300 + | ));
|
11301 + | }
|
11302 + |
|
11303 + | /// Parses list of structure shapes
|
11304 + | /// Test ID: parses_list_of_structure_shapes
|
11305 + | #[::tokio::test]
|
11306 + | #[::tracing_test::traced_test]
|
11307 + | async fn parses_list_of_structure_shapes_response() {
|
11308 + | let output = crate::output::KitchenSinkOperationOutput {
|
11309 + | list_of_structs: ::std::option::Option::Some(vec![
|
11310 + | crate::model::SimpleStruct {
|
11311 + | value: ::std::option::Option::Some("value-1".to_owned()),
|
11312 + | },
|
11313 + | crate::model::SimpleStruct {
|
11314 + | value: ::std::option::Option::Some("value-2".to_owned()),
|
11315 + | },
|
11316 + | ]),
|
11317 + | blob: ::std::option::Option::None,
|
11318 + | boolean: ::std::option::Option::None,
|
11319 + | double: ::std::option::Option::None,
|
11320 + | empty_struct: ::std::option::Option::None,
|
11321 + | float: ::std::option::Option::None,
|
11322 + | httpdate_timestamp: ::std::option::Option::None,
|
11323 + | integer: ::std::option::Option::None,
|
11324 + | iso8601_timestamp: ::std::option::Option::None,
|
11325 + | json_value: ::std::option::Option::None,
|
11326 + | list_of_lists: ::std::option::Option::None,
|
11327 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11328 + | list_of_strings: ::std::option::Option::None,
|
11329 + | long: ::std::option::Option::None,
|
11330 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11331 + | map_of_maps: ::std::option::Option::None,
|
11332 + | map_of_strings: ::std::option::Option::None,
|
11333 + | map_of_structs: ::std::option::Option::None,
|
11334 + | recursive_list: ::std::option::Option::None,
|
11335 + | recursive_map: ::std::option::Option::None,
|
11336 + | recursive_struct: ::std::option::Option::None,
|
11337 + | simple_struct: ::std::option::Option::None,
|
11338 + | string: ::std::option::Option::None,
|
11339 + | struct_with_json_name: ::std::option::Option::None,
|
11340 + | timestamp: ::std::option::Option::None,
|
11341 + | unix_timestamp: ::std::option::Option::None,
|
11342 + | };
|
11343 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11344 + | let http_response = output.into_response();
|
11345 + | ::pretty_assertions::assert_eq!(
|
11346 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11347 + | http_response.status()
|
11348 + | );
|
11349 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11350 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11351 + | http_response.headers(),
|
11352 + | expected_headers,
|
11353 + | ));
|
11354 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11355 + | .await
|
11356 + | .expect("unable to extract body to bytes");
|
11357 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11358 + | &body,
|
11359 + | "{\"ListOfStructs\":[{\"Value\":\"value-1\"},{\"Value\":\"value-2\"}]}",
|
11360 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11361 + | ));
|
11362 + | }
|
11363 + |
|
11364 + | /// Parses list of recursive structure shapes
|
11365 + | /// Test ID: parses_list_of_recursive_structure_shapes
|
11366 + | #[::tokio::test]
|
11367 + | #[::tracing_test::traced_test]
|
11368 + | async fn parses_list_of_recursive_structure_shapes_response() {
|
11369 + | let output = crate::output::KitchenSinkOperationOutput {
|
11370 + | recursive_list: ::std::option::Option::Some(vec![crate::model::KitchenSink {
|
11371 + | recursive_list: ::std::option::Option::Some(vec![crate::model::KitchenSink {
|
11372 + | recursive_list: ::std::option::Option::Some(vec![crate::model::KitchenSink {
|
11373 + | string: ::std::option::Option::Some("value".to_owned()),
|
11374 + | blob: ::std::option::Option::None,
|
11375 + | boolean: ::std::option::Option::None,
|
11376 + | double: ::std::option::Option::None,
|
11377 + | empty_struct: ::std::option::Option::None,
|
11378 + | float: ::std::option::Option::None,
|
11379 + | httpdate_timestamp: ::std::option::Option::None,
|
11380 + | integer: ::std::option::Option::None,
|
11381 + | iso8601_timestamp: ::std::option::Option::None,
|
11382 + | json_value: ::std::option::Option::None,
|
11383 + | list_of_lists: ::std::option::Option::None,
|
11384 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11385 + | list_of_strings: ::std::option::Option::None,
|
11386 + | list_of_structs: ::std::option::Option::None,
|
11387 + | long: ::std::option::Option::None,
|
11388 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11389 + | map_of_maps: ::std::option::Option::None,
|
11390 + | map_of_strings: ::std::option::Option::None,
|
11391 + | map_of_structs: ::std::option::Option::None,
|
11392 + | recursive_list: ::std::option::Option::None,
|
11393 + | recursive_map: ::std::option::Option::None,
|
11394 + | recursive_struct: ::std::option::Option::None,
|
11395 + | simple_struct: ::std::option::Option::None,
|
11396 + | struct_with_json_name: ::std::option::Option::None,
|
11397 + | timestamp: ::std::option::Option::None,
|
11398 + | unix_timestamp: ::std::option::Option::None,
|
11399 + | }]),
|
11400 + | blob: ::std::option::Option::None,
|
11401 + | boolean: ::std::option::Option::None,
|
11402 + | double: ::std::option::Option::None,
|
11403 + | empty_struct: ::std::option::Option::None,
|
11404 + | float: ::std::option::Option::None,
|
11405 + | httpdate_timestamp: ::std::option::Option::None,
|
11406 + | integer: ::std::option::Option::None,
|
11407 + | iso8601_timestamp: ::std::option::Option::None,
|
11408 + | json_value: ::std::option::Option::None,
|
11409 + | list_of_lists: ::std::option::Option::None,
|
11410 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11411 + | list_of_strings: ::std::option::Option::None,
|
11412 + | list_of_structs: ::std::option::Option::None,
|
11413 + | long: ::std::option::Option::None,
|
11414 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11415 + | map_of_maps: ::std::option::Option::None,
|
11416 + | map_of_strings: ::std::option::Option::None,
|
11417 + | map_of_structs: ::std::option::Option::None,
|
11418 + | recursive_map: ::std::option::Option::None,
|
11419 + | recursive_struct: ::std::option::Option::None,
|
11420 + | simple_struct: ::std::option::Option::None,
|
11421 + | string: ::std::option::Option::None,
|
11422 + | struct_with_json_name: ::std::option::Option::None,
|
11423 + | timestamp: ::std::option::Option::None,
|
11424 + | unix_timestamp: ::std::option::Option::None,
|
11425 + | }]),
|
11426 + | blob: ::std::option::Option::None,
|
11427 + | boolean: ::std::option::Option::None,
|
11428 + | double: ::std::option::Option::None,
|
11429 + | empty_struct: ::std::option::Option::None,
|
11430 + | float: ::std::option::Option::None,
|
11431 + | httpdate_timestamp: ::std::option::Option::None,
|
11432 + | integer: ::std::option::Option::None,
|
11433 + | iso8601_timestamp: ::std::option::Option::None,
|
11434 + | json_value: ::std::option::Option::None,
|
11435 + | list_of_lists: ::std::option::Option::None,
|
11436 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11437 + | list_of_strings: ::std::option::Option::None,
|
11438 + | list_of_structs: ::std::option::Option::None,
|
11439 + | long: ::std::option::Option::None,
|
11440 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11441 + | map_of_maps: ::std::option::Option::None,
|
11442 + | map_of_strings: ::std::option::Option::None,
|
11443 + | map_of_structs: ::std::option::Option::None,
|
11444 + | recursive_map: ::std::option::Option::None,
|
11445 + | recursive_struct: ::std::option::Option::None,
|
11446 + | simple_struct: ::std::option::Option::None,
|
11447 + | string: ::std::option::Option::None,
|
11448 + | struct_with_json_name: ::std::option::Option::None,
|
11449 + | timestamp: ::std::option::Option::None,
|
11450 + | unix_timestamp: ::std::option::Option::None,
|
11451 + | }]),
|
11452 + | blob: ::std::option::Option::None,
|
11453 + | boolean: ::std::option::Option::None,
|
11454 + | double: ::std::option::Option::None,
|
11455 + | empty_struct: ::std::option::Option::None,
|
11456 + | float: ::std::option::Option::None,
|
11457 + | httpdate_timestamp: ::std::option::Option::None,
|
11458 + | integer: ::std::option::Option::None,
|
11459 + | iso8601_timestamp: ::std::option::Option::None,
|
11460 + | json_value: ::std::option::Option::None,
|
11461 + | list_of_lists: ::std::option::Option::None,
|
11462 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11463 + | list_of_strings: ::std::option::Option::None,
|
11464 + | list_of_structs: ::std::option::Option::None,
|
11465 + | long: ::std::option::Option::None,
|
11466 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11467 + | map_of_maps: ::std::option::Option::None,
|
11468 + | map_of_strings: ::std::option::Option::None,
|
11469 + | map_of_structs: ::std::option::Option::None,
|
11470 + | recursive_map: ::std::option::Option::None,
|
11471 + | recursive_struct: ::std::option::Option::None,
|
11472 + | simple_struct: ::std::option::Option::None,
|
11473 + | string: ::std::option::Option::None,
|
11474 + | struct_with_json_name: ::std::option::Option::None,
|
11475 + | timestamp: ::std::option::Option::None,
|
11476 + | unix_timestamp: ::std::option::Option::None,
|
11477 + | };
|
11478 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11479 + | let http_response = output.into_response();
|
11480 + | ::pretty_assertions::assert_eq!(
|
11481 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11482 + | http_response.status()
|
11483 + | );
|
11484 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11485 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11486 + | http_response.headers(),
|
11487 + | expected_headers,
|
11488 + | ));
|
11489 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11490 + | .await
|
11491 + | .expect("unable to extract body to bytes");
|
11492 + | ::aws_smithy_protocol_test::assert_ok(
|
11493 + | ::aws_smithy_protocol_test::validate_body(&body, "{\"RecursiveList\":[{\"RecursiveList\":[{\"RecursiveList\":[{\"String\":\"value\"}]}]}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
11494 + | );
|
11495 + | }
|
11496 + |
|
11497 + | /// Parses map shapes
|
11498 + | /// Test ID: parses_map_shapes
|
11499 + | #[::tokio::test]
|
11500 + | #[::tracing_test::traced_test]
|
11501 + | async fn parses_map_shapes_response() {
|
11502 + | let output = crate::output::KitchenSinkOperationOutput {
|
11503 + | map_of_strings: ::std::option::Option::Some({
|
11504 + | let mut ret = ::std::collections::HashMap::new();
|
11505 + | ret.insert("size".to_owned(), "large".to_owned());
|
11506 + | ret.insert("color".to_owned(), "red".to_owned());
|
11507 + | ret
|
11508 + | }),
|
11509 + | blob: ::std::option::Option::None,
|
11510 + | boolean: ::std::option::Option::None,
|
11511 + | double: ::std::option::Option::None,
|
11512 + | empty_struct: ::std::option::Option::None,
|
11513 + | float: ::std::option::Option::None,
|
11514 + | httpdate_timestamp: ::std::option::Option::None,
|
11515 + | integer: ::std::option::Option::None,
|
11516 + | iso8601_timestamp: ::std::option::Option::None,
|
11517 + | json_value: ::std::option::Option::None,
|
11518 + | list_of_lists: ::std::option::Option::None,
|
11519 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11520 + | list_of_strings: ::std::option::Option::None,
|
11521 + | list_of_structs: ::std::option::Option::None,
|
11522 + | long: ::std::option::Option::None,
|
11523 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11524 + | map_of_maps: ::std::option::Option::None,
|
11525 + | map_of_structs: ::std::option::Option::None,
|
11526 + | recursive_list: ::std::option::Option::None,
|
11527 + | recursive_map: ::std::option::Option::None,
|
11528 + | recursive_struct: ::std::option::Option::None,
|
11529 + | simple_struct: ::std::option::Option::None,
|
11530 + | string: ::std::option::Option::None,
|
11531 + | struct_with_json_name: ::std::option::Option::None,
|
11532 + | timestamp: ::std::option::Option::None,
|
11533 + | unix_timestamp: ::std::option::Option::None,
|
11534 + | };
|
11535 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11536 + | let http_response = output.into_response();
|
11537 + | ::pretty_assertions::assert_eq!(
|
11538 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11539 + | http_response.status()
|
11540 + | );
|
11541 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11542 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11543 + | http_response.headers(),
|
11544 + | expected_headers,
|
11545 + | ));
|
11546 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11547 + | .await
|
11548 + | .expect("unable to extract body to bytes");
|
11549 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11550 + | &body,
|
11551 + | "{\"MapOfStrings\":{\"size\":\"large\",\"color\":\"red\"}}",
|
11552 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11553 + | ));
|
11554 + | }
|
11555 + |
|
11556 + | /// Parses map of list shapes
|
11557 + | /// Test ID: parses_map_of_list_shapes
|
11558 + | #[::tokio::test]
|
11559 + | #[::tracing_test::traced_test]
|
11560 + | async fn parses_map_of_list_shapes_response() {
|
11561 + | let output = crate::output::KitchenSinkOperationOutput {
|
11562 + | map_of_lists_of_strings: ::std::option::Option::Some({
|
11563 + | let mut ret = ::std::collections::HashMap::new();
|
11564 + | ret.insert(
|
11565 + | "sizes".to_owned(),
|
11566 + | vec!["large".to_owned(), "small".to_owned()],
|
11567 + | );
|
11568 + | ret.insert(
|
11569 + | "colors".to_owned(),
|
11570 + | vec!["red".to_owned(), "green".to_owned()],
|
11571 + | );
|
11572 + | ret
|
11573 + | }),
|
11574 + | blob: ::std::option::Option::None,
|
11575 + | boolean: ::std::option::Option::None,
|
11576 + | double: ::std::option::Option::None,
|
11577 + | empty_struct: ::std::option::Option::None,
|
11578 + | float: ::std::option::Option::None,
|
11579 + | httpdate_timestamp: ::std::option::Option::None,
|
11580 + | integer: ::std::option::Option::None,
|
11581 + | iso8601_timestamp: ::std::option::Option::None,
|
11582 + | json_value: ::std::option::Option::None,
|
11583 + | list_of_lists: ::std::option::Option::None,
|
11584 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11585 + | list_of_strings: ::std::option::Option::None,
|
11586 + | list_of_structs: ::std::option::Option::None,
|
11587 + | long: ::std::option::Option::None,
|
11588 + | map_of_maps: ::std::option::Option::None,
|
11589 + | map_of_strings: ::std::option::Option::None,
|
11590 + | map_of_structs: ::std::option::Option::None,
|
11591 + | recursive_list: ::std::option::Option::None,
|
11592 + | recursive_map: ::std::option::Option::None,
|
11593 + | recursive_struct: ::std::option::Option::None,
|
11594 + | simple_struct: ::std::option::Option::None,
|
11595 + | string: ::std::option::Option::None,
|
11596 + | struct_with_json_name: ::std::option::Option::None,
|
11597 + | timestamp: ::std::option::Option::None,
|
11598 + | unix_timestamp: ::std::option::Option::None,
|
11599 + | };
|
11600 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11601 + | let http_response = output.into_response();
|
11602 + | ::pretty_assertions::assert_eq!(
|
11603 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11604 + | http_response.status()
|
11605 + | );
|
11606 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11607 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11608 + | http_response.headers(),
|
11609 + | expected_headers,
|
11610 + | ));
|
11611 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11612 + | .await
|
11613 + | .expect("unable to extract body to bytes");
|
11614 + | ::aws_smithy_protocol_test::assert_ok(
|
11615 + | ::aws_smithy_protocol_test::validate_body(&body, "{\"MapOfListsOfStrings\":{\"sizes\":[\"large\",\"small\"],\"colors\":[\"red\",\"green\"]}}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
11616 + | );
|
11617 + | }
|
11618 + |
|
11619 + | /// Parses map of map shapes
|
11620 + | /// Test ID: parses_map_of_map_shapes
|
11621 + | #[::tokio::test]
|
11622 + | #[::tracing_test::traced_test]
|
11623 + | async fn parses_map_of_map_shapes_response() {
|
11624 + | let output = crate::output::KitchenSinkOperationOutput {
|
11625 + | map_of_maps: ::std::option::Option::Some({
|
11626 + | let mut ret = ::std::collections::HashMap::new();
|
11627 + | ret.insert("sizes".to_owned(), {
|
11628 + | let mut ret = ::std::collections::HashMap::new();
|
11629 + | ret.insert("large".to_owned(), "L".to_owned());
|
11630 + | ret.insert("medium".to_owned(), "M".to_owned());
|
11631 + | ret
|
11632 + | });
|
11633 + | ret.insert("colors".to_owned(), {
|
11634 + | let mut ret = ::std::collections::HashMap::new();
|
11635 + | ret.insert("red".to_owned(), "R".to_owned());
|
11636 + | ret.insert("blue".to_owned(), "B".to_owned());
|
11637 + | ret
|
11638 + | });
|
11639 + | ret
|
11640 + | }),
|
11641 + | blob: ::std::option::Option::None,
|
11642 + | boolean: ::std::option::Option::None,
|
11643 + | double: ::std::option::Option::None,
|
11644 + | empty_struct: ::std::option::Option::None,
|
11645 + | float: ::std::option::Option::None,
|
11646 + | httpdate_timestamp: ::std::option::Option::None,
|
11647 + | integer: ::std::option::Option::None,
|
11648 + | iso8601_timestamp: ::std::option::Option::None,
|
11649 + | json_value: ::std::option::Option::None,
|
11650 + | list_of_lists: ::std::option::Option::None,
|
11651 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11652 + | list_of_strings: ::std::option::Option::None,
|
11653 + | list_of_structs: ::std::option::Option::None,
|
11654 + | long: ::std::option::Option::None,
|
11655 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11656 + | map_of_strings: ::std::option::Option::None,
|
11657 + | map_of_structs: ::std::option::Option::None,
|
11658 + | recursive_list: ::std::option::Option::None,
|
11659 + | recursive_map: ::std::option::Option::None,
|
11660 + | recursive_struct: ::std::option::Option::None,
|
11661 + | simple_struct: ::std::option::Option::None,
|
11662 + | string: ::std::option::Option::None,
|
11663 + | struct_with_json_name: ::std::option::Option::None,
|
11664 + | timestamp: ::std::option::Option::None,
|
11665 + | unix_timestamp: ::std::option::Option::None,
|
11666 + | };
|
11667 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11668 + | let http_response = output.into_response();
|
11669 + | ::pretty_assertions::assert_eq!(
|
11670 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11671 + | http_response.status()
|
11672 + | );
|
11673 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11674 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11675 + | http_response.headers(),
|
11676 + | expected_headers,
|
11677 + | ));
|
11678 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11679 + | .await
|
11680 + | .expect("unable to extract body to bytes");
|
11681 + | ::aws_smithy_protocol_test::assert_ok(
|
11682 + | ::aws_smithy_protocol_test::validate_body(&body, "{\"MapOfMaps\":{\"sizes\":{\"large\":\"L\",\"medium\":\"M\"},\"colors\":{\"red\":\"R\",\"blue\":\"B\"}}}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
11683 + | );
|
11684 + | }
|
11685 + |
|
11686 + | /// Parses map of structure shapes
|
11687 + | /// Test ID: parses_map_of_structure_shapes
|
11688 + | #[::tokio::test]
|
11689 + | #[::tracing_test::traced_test]
|
11690 + | async fn parses_map_of_structure_shapes_response() {
|
11691 + | let output = crate::output::KitchenSinkOperationOutput {
|
11692 + | map_of_structs: ::std::option::Option::Some({
|
11693 + | let mut ret = ::std::collections::HashMap::new();
|
11694 + | ret.insert(
|
11695 + | "size".to_owned(),
|
11696 + | crate::model::SimpleStruct {
|
11697 + | value: ::std::option::Option::Some("small".to_owned()),
|
11698 + | },
|
11699 + | );
|
11700 + | ret.insert(
|
11701 + | "color".to_owned(),
|
11702 + | crate::model::SimpleStruct {
|
11703 + | value: ::std::option::Option::Some("red".to_owned()),
|
11704 + | },
|
11705 + | );
|
11706 + | ret
|
11707 + | }),
|
11708 + | blob: ::std::option::Option::None,
|
11709 + | boolean: ::std::option::Option::None,
|
11710 + | double: ::std::option::Option::None,
|
11711 + | empty_struct: ::std::option::Option::None,
|
11712 + | float: ::std::option::Option::None,
|
11713 + | httpdate_timestamp: ::std::option::Option::None,
|
11714 + | integer: ::std::option::Option::None,
|
11715 + | iso8601_timestamp: ::std::option::Option::None,
|
11716 + | json_value: ::std::option::Option::None,
|
11717 + | list_of_lists: ::std::option::Option::None,
|
11718 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11719 + | list_of_strings: ::std::option::Option::None,
|
11720 + | list_of_structs: ::std::option::Option::None,
|
11721 + | long: ::std::option::Option::None,
|
11722 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11723 + | map_of_maps: ::std::option::Option::None,
|
11724 + | map_of_strings: ::std::option::Option::None,
|
11725 + | recursive_list: ::std::option::Option::None,
|
11726 + | recursive_map: ::std::option::Option::None,
|
11727 + | recursive_struct: ::std::option::Option::None,
|
11728 + | simple_struct: ::std::option::Option::None,
|
11729 + | string: ::std::option::Option::None,
|
11730 + | struct_with_json_name: ::std::option::Option::None,
|
11731 + | timestamp: ::std::option::Option::None,
|
11732 + | unix_timestamp: ::std::option::Option::None,
|
11733 + | };
|
11734 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11735 + | let http_response = output.into_response();
|
11736 + | ::pretty_assertions::assert_eq!(
|
11737 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11738 + | http_response.status()
|
11739 + | );
|
11740 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11741 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11742 + | http_response.headers(),
|
11743 + | expected_headers,
|
11744 + | ));
|
11745 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11746 + | .await
|
11747 + | .expect("unable to extract body to bytes");
|
11748 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11749 + | &body,
|
11750 + | "{\"MapOfStructs\":{\"size\":{\"Value\":\"small\"},\"color\":{\"Value\":\"red\"}}}",
|
11751 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11752 + | ));
|
11753 + | }
|
11754 + |
|
11755 + | /// Parses map of recursive structure shapes
|
11756 + | /// Test ID: parses_map_of_recursive_structure_shapes
|
11757 + | #[::tokio::test]
|
11758 + | #[::tracing_test::traced_test]
|
11759 + | async fn parses_map_of_recursive_structure_shapes_response() {
|
11760 + | let output = crate::output::KitchenSinkOperationOutput {
|
11761 + | recursive_map: ::std::option::Option::Some({
|
11762 + | let mut ret = ::std::collections::HashMap::new();
|
11763 + | ret.insert(
|
11764 + | "key-1".to_owned(),
|
11765 + | crate::model::KitchenSink {
|
11766 + | recursive_map: ::std::option::Option::Some({
|
11767 + | let mut ret = ::std::collections::HashMap::new();
|
11768 + | ret.insert(
|
11769 + | "key-2".to_owned(),
|
11770 + | crate::model::KitchenSink {
|
11771 + | recursive_map: ::std::option::Option::Some({
|
11772 + | let mut ret = ::std::collections::HashMap::new();
|
11773 + | ret.insert(
|
11774 + | "key-3".to_owned(),
|
11775 + | crate::model::KitchenSink {
|
11776 + | string: ::std::option::Option::Some(
|
11777 + | "value".to_owned(),
|
11778 + | ),
|
11779 + | blob: ::std::option::Option::None,
|
11780 + | boolean: ::std::option::Option::None,
|
11781 + | double: ::std::option::Option::None,
|
11782 + | empty_struct: ::std::option::Option::None,
|
11783 + | float: ::std::option::Option::None,
|
11784 + | httpdate_timestamp: ::std::option::Option::None,
|
11785 + | integer: ::std::option::Option::None,
|
11786 + | iso8601_timestamp: ::std::option::Option::None,
|
11787 + | json_value: ::std::option::Option::None,
|
11788 + | list_of_lists: ::std::option::Option::None,
|
11789 + | list_of_maps_of_strings:
|
11790 + | ::std::option::Option::None,
|
11791 + | list_of_strings: ::std::option::Option::None,
|
11792 + | list_of_structs: ::std::option::Option::None,
|
11793 + | long: ::std::option::Option::None,
|
11794 + | map_of_lists_of_strings:
|
11795 + | ::std::option::Option::None,
|
11796 + | map_of_maps: ::std::option::Option::None,
|
11797 + | map_of_strings: ::std::option::Option::None,
|
11798 + | map_of_structs: ::std::option::Option::None,
|
11799 + | recursive_list: ::std::option::Option::None,
|
11800 + | recursive_map: ::std::option::Option::None,
|
11801 + | recursive_struct: ::std::option::Option::None,
|
11802 + | simple_struct: ::std::option::Option::None,
|
11803 + | struct_with_json_name: ::std::option::Option::None,
|
11804 + | timestamp: ::std::option::Option::None,
|
11805 + | unix_timestamp: ::std::option::Option::None,
|
11806 + | },
|
11807 + | );
|
11808 + | ret
|
11809 + | }),
|
11810 + | blob: ::std::option::Option::None,
|
11811 + | boolean: ::std::option::Option::None,
|
11812 + | double: ::std::option::Option::None,
|
11813 + | empty_struct: ::std::option::Option::None,
|
11814 + | float: ::std::option::Option::None,
|
11815 + | httpdate_timestamp: ::std::option::Option::None,
|
11816 + | integer: ::std::option::Option::None,
|
11817 + | iso8601_timestamp: ::std::option::Option::None,
|
11818 + | json_value: ::std::option::Option::None,
|
11819 + | list_of_lists: ::std::option::Option::None,
|
11820 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11821 + | list_of_strings: ::std::option::Option::None,
|
11822 + | list_of_structs: ::std::option::Option::None,
|
11823 + | long: ::std::option::Option::None,
|
11824 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11825 + | map_of_maps: ::std::option::Option::None,
|
11826 + | map_of_strings: ::std::option::Option::None,
|
11827 + | map_of_structs: ::std::option::Option::None,
|
11828 + | recursive_list: ::std::option::Option::None,
|
11829 + | recursive_struct: ::std::option::Option::None,
|
11830 + | simple_struct: ::std::option::Option::None,
|
11831 + | string: ::std::option::Option::None,
|
11832 + | struct_with_json_name: ::std::option::Option::None,
|
11833 + | timestamp: ::std::option::Option::None,
|
11834 + | unix_timestamp: ::std::option::Option::None,
|
11835 + | },
|
11836 + | );
|
11837 + | ret
|
11838 + | }),
|
11839 + | blob: ::std::option::Option::None,
|
11840 + | boolean: ::std::option::Option::None,
|
11841 + | double: ::std::option::Option::None,
|
11842 + | empty_struct: ::std::option::Option::None,
|
11843 + | float: ::std::option::Option::None,
|
11844 + | httpdate_timestamp: ::std::option::Option::None,
|
11845 + | integer: ::std::option::Option::None,
|
11846 + | iso8601_timestamp: ::std::option::Option::None,
|
11847 + | json_value: ::std::option::Option::None,
|
11848 + | list_of_lists: ::std::option::Option::None,
|
11849 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11850 + | list_of_strings: ::std::option::Option::None,
|
11851 + | list_of_structs: ::std::option::Option::None,
|
11852 + | long: ::std::option::Option::None,
|
11853 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11854 + | map_of_maps: ::std::option::Option::None,
|
11855 + | map_of_strings: ::std::option::Option::None,
|
11856 + | map_of_structs: ::std::option::Option::None,
|
11857 + | recursive_list: ::std::option::Option::None,
|
11858 + | recursive_struct: ::std::option::Option::None,
|
11859 + | simple_struct: ::std::option::Option::None,
|
11860 + | string: ::std::option::Option::None,
|
11861 + | struct_with_json_name: ::std::option::Option::None,
|
11862 + | timestamp: ::std::option::Option::None,
|
11863 + | unix_timestamp: ::std::option::Option::None,
|
11864 + | },
|
11865 + | );
|
11866 + | ret
|
11867 + | }),
|
11868 + | blob: ::std::option::Option::None,
|
11869 + | boolean: ::std::option::Option::None,
|
11870 + | double: ::std::option::Option::None,
|
11871 + | empty_struct: ::std::option::Option::None,
|
11872 + | float: ::std::option::Option::None,
|
11873 + | httpdate_timestamp: ::std::option::Option::None,
|
11874 + | integer: ::std::option::Option::None,
|
11875 + | iso8601_timestamp: ::std::option::Option::None,
|
11876 + | json_value: ::std::option::Option::None,
|
11877 + | list_of_lists: ::std::option::Option::None,
|
11878 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11879 + | list_of_strings: ::std::option::Option::None,
|
11880 + | list_of_structs: ::std::option::Option::None,
|
11881 + | long: ::std::option::Option::None,
|
11882 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11883 + | map_of_maps: ::std::option::Option::None,
|
11884 + | map_of_strings: ::std::option::Option::None,
|
11885 + | map_of_structs: ::std::option::Option::None,
|
11886 + | recursive_list: ::std::option::Option::None,
|
11887 + | recursive_struct: ::std::option::Option::None,
|
11888 + | simple_struct: ::std::option::Option::None,
|
11889 + | string: ::std::option::Option::None,
|
11890 + | struct_with_json_name: ::std::option::Option::None,
|
11891 + | timestamp: ::std::option::Option::None,
|
11892 + | unix_timestamp: ::std::option::Option::None,
|
11893 + | };
|
11894 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11895 + | let http_response = output.into_response();
|
11896 + | ::pretty_assertions::assert_eq!(
|
11897 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11898 + | http_response.status()
|
11899 + | );
|
11900 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11901 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11902 + | http_response.headers(),
|
11903 + | expected_headers,
|
11904 + | ));
|
11905 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11906 + | .await
|
11907 + | .expect("unable to extract body to bytes");
|
11908 + | ::aws_smithy_protocol_test::assert_ok(
|
11909 + | ::aws_smithy_protocol_test::validate_body(&body, "{\"RecursiveMap\":{\"key-1\":{\"RecursiveMap\":{\"key-2\":{\"RecursiveMap\":{\"key-3\":{\"String\":\"value\"}}}}}}}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
11910 + | );
|
11911 + | }
|
11912 + |
|
11913 + | /// Parses the request id from the response
|
11914 + | /// Test ID: parses_the_request_id_from_the_response
|
11915 + | #[::tokio::test]
|
11916 + | #[::tracing_test::traced_test]
|
11917 + | #[should_panic]
|
11918 + | async fn parses_the_request_id_from_the_response_response() {
|
11919 + | let output = crate::output::KitchenSinkOperationOutput {
|
11920 + | blob: ::std::option::Option::None,
|
11921 + | boolean: ::std::option::Option::None,
|
11922 + | double: ::std::option::Option::None,
|
11923 + | empty_struct: ::std::option::Option::None,
|
11924 + | float: ::std::option::Option::None,
|
11925 + | httpdate_timestamp: ::std::option::Option::None,
|
11926 + | integer: ::std::option::Option::None,
|
11927 + | iso8601_timestamp: ::std::option::Option::None,
|
11928 + | json_value: ::std::option::Option::None,
|
11929 + | list_of_lists: ::std::option::Option::None,
|
11930 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11931 + | list_of_strings: ::std::option::Option::None,
|
11932 + | list_of_structs: ::std::option::Option::None,
|
11933 + | long: ::std::option::Option::None,
|
11934 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11935 + | map_of_maps: ::std::option::Option::None,
|
11936 + | map_of_strings: ::std::option::Option::None,
|
11937 + | map_of_structs: ::std::option::Option::None,
|
11938 + | recursive_list: ::std::option::Option::None,
|
11939 + | recursive_map: ::std::option::Option::None,
|
11940 + | recursive_struct: ::std::option::Option::None,
|
11941 + | simple_struct: ::std::option::Option::None,
|
11942 + | string: ::std::option::Option::None,
|
11943 + | struct_with_json_name: ::std::option::Option::None,
|
11944 + | timestamp: ::std::option::Option::None,
|
11945 + | unix_timestamp: ::std::option::Option::None,
|
11946 + | };
|
11947 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11948 + | let http_response = output.into_response();
|
11949 + | ::pretty_assertions::assert_eq!(
|
11950 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11951 + | http_response.status()
|
11952 + | );
|
11953 + | let expected_headers = [
|
11954 + | ("Content-Type", "application/x-amz-json-1.1"),
|
11955 + | ("X-Amzn-Requestid", "amazon-uniq-request-id"),
|
11956 + | ];
|
11957 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11958 + | http_response.headers(),
|
11959 + | expected_headers,
|
11960 + | ));
|
11961 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11962 + | .await
|
11963 + | .expect("unable to extract body to bytes");
|
11964 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11965 + | &body,
|
11966 + | "{}",
|
11967 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11968 + | ));
|
11969 + | }
|
11970 + | }
|
11971 + |
|
11972 + | ::pin_project_lite::pin_project! {
|
11973 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
11974 + | /// [`EmptyOperationInput`](crate::input::EmptyOperationInput) using modelled bindings.
|
11975 + | pub struct EmptyOperationInputFuture {
|
11976 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EmptyOperationInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
11977 + | }
|
11978 + | }
|
11979 + |
|
11980 + | impl std::future::Future for EmptyOperationInputFuture {
|
11981 + | type Output = Result<
|
11982 + | crate::input::EmptyOperationInput,
|
11983 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
11984 + | >;
|
11985 + |
|
11986 + | fn poll(
|
11987 + | self: std::pin::Pin<&mut Self>,
|
11988 + | cx: &mut std::task::Context<'_>,
|
11989 + | ) -> std::task::Poll<Self::Output> {
|
11990 + | let this = self.project();
|
11991 + | this.inner.as_mut().poll(cx)
|
11992 + | }
|
11993 + | }
|
11994 + |
|
11995 + | impl<B>
|
11996 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
11997 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11998 + | B,
|
11999 + | > for crate::input::EmptyOperationInput
|
12000 + | where
|
12001 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
12002 + | B: 'static,
|
12003 + |
|
12004 + | B::Data: Send,
|
12005 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
12006 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
12007 + | {
|
12008 + | type Rejection =
|
12009 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
12010 + | type Future = EmptyOperationInputFuture;
|
12011 + |
|
12012 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
12013 + | let fut = async move {
|
12014 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
12015 + | request.headers(),
|
12016 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
12017 + | ) {
|
12018 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
12019 + | }
|
12020 + | crate::protocol_serde::shape_empty_operation::de_empty_operation_http_request(request)
|
12021 + | .await
|
12022 + | };
|
12023 + | use ::futures_util::future::TryFutureExt;
|
12024 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
12025 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
12026 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
12027 + | });
|
12028 + | EmptyOperationInputFuture {
|
12029 + | inner: Box::pin(fut),
|
12030 + | }
|
12031 + | }
|
12032 + | }
|
12033 + | impl
|
12034 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
12035 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12036 + | > for crate::output::EmptyOperationOutput
|
12037 + | {
|
12038 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
12039 + | match crate::protocol_serde::shape_empty_operation::ser_empty_operation_http_response(self)
|
12040 + | {
|
12041 + | Ok(response) => response,
|
12042 + | Err(e) => {
|
12043 + | ::tracing::error!(error = %e, "failed to serialize response");
|
12044 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
12045 + | }
|
12046 + | }
|
12047 + | }
|
12048 + | }
|
12049 + |
|
12050 + | #[allow(unreachable_code, unused_variables)]
|
12051 + | #[cfg(test)]
|
12052 + | mod empty_operation_test {
|
12053 + |
|
12054 + | /// Sends requests to /
|
12055 + | /// Test ID: sends_requests_to_slash
|
12056 + | #[::tokio::test]
|
12057 + | #[::tracing_test::traced_test]
|
12058 + | async fn sends_requests_to_slash_request() {
|
12059 + | #[allow(unused_mut)]
|
12060 + | let mut http_request = ::http::Request::builder()
|
12061 + | .uri("/")
|
12062 + | .method("POST")
|
12063 + | .header("Content-Type", "application/x-amz-json-1.1")
|
12064 + | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
12065 + | .body(::aws_smithy_legacy_http_server::body::Body::empty())
|
12066 + | .unwrap();
|
12067 + | #[allow(unused_mut)]
|
12068 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12069 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
12070 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
12071 + | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
12072 + | let sender = sender.clone();
|
12073 + | async move {
|
12074 + | let result = {
|
12075 + | let expected = crate::input::EmptyOperationInput {};
|
12076 + | ::pretty_assertions::assert_eq!(input, expected);
|
12077 + | let output = crate::output::EmptyOperationOutput {};
|
12078 + | output
|
12079 + | };
|
12080 + | sender.send(()).await.expect("receiver dropped early");
|
12081 + | result
|
12082 + | }
|
12083 + | })
|
12084 + | .build_unchecked();
|
12085 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12086 + | .await
|
12087 + | .expect("unable to make an HTTP request");
|
12088 + | assert!(
|
12089 + | receiver.recv().await.is_some(),
|
12090 + | "we expected operation handler to be invoked but it was not entered"
|
12091 + | );
|
12092 + | }
|
12093 + |
|
12094 + | /// Includes X-Amz-Target header and Content-Type
|
12095 + | /// Test ID: includes_x_amz_target_and_content_type
|
12096 + | #[::tokio::test]
|
12097 + | #[::tracing_test::traced_test]
|
12098 + | async fn includes_x_amz_target_and_content_type_request() {
|
12099 + | #[allow(unused_mut)]
|
12100 + | let mut http_request = ::http::Request::builder()
|
12101 + | .uri("/")
|
12102 + | .method("POST")
|
12103 + | .header("Content-Type", "application/x-amz-json-1.1")
|
12104 + | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
12105 + | .body(::aws_smithy_legacy_http_server::body::Body::empty())
|
12106 + | .unwrap();
|
12107 + | #[allow(unused_mut)]
|
12108 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12109 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
12110 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
12111 + | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
12112 + | let sender = sender.clone();
|
12113 + | async move {
|
12114 + | let result = {
|
12115 + | let expected = crate::input::EmptyOperationInput {};
|
12116 + | ::pretty_assertions::assert_eq!(input, expected);
|
12117 + | let output = crate::output::EmptyOperationOutput {};
|
12118 + | output
|
12119 + | };
|
12120 + | sender.send(()).await.expect("receiver dropped early");
|
12121 + | result
|
12122 + | }
|
12123 + | })
|
12124 + | .build_unchecked();
|
12125 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12126 + | .await
|
12127 + | .expect("unable to make an HTTP request");
|
12128 + | assert!(
|
12129 + | receiver.recv().await.is_some(),
|
12130 + | "we expected operation handler to be invoked but it was not entered"
|
12131 + | );
|
12132 + | }
|
12133 + |
|
12134 + | /// Clients must always send an empty JSON object payload for
|
12135 + | /// operations with no input (that is, `{}`). While AWS service
|
12136 + | /// implementations support requests with no payload or requests
|
12137 + | /// that send `{}`, always sending `{}` from the client is
|
12138 + | /// preferred for forward compatibility in case input is ever
|
12139 + | /// added to an operation.
|
12140 + | /// Test ID: json_1_1_client_sends_empty_payload_for_no_input_shape
|
12141 + | #[::tokio::test]
|
12142 + | #[::tracing_test::traced_test]
|
12143 + | async fn json_1_1_client_sends_empty_payload_for_no_input_shape_request() {
|
12144 + | #[allow(unused_mut)]
|
12145 + | let mut http_request = ::http::Request::builder()
|
12146 + | .uri("/")
|
12147 + | .method("POST")
|
12148 + | .header("Content-Type", "application/x-amz-json-1.1")
|
12149 + | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
12150 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
12151 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
12152 + | "{}".as_bytes(),
|
12153 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
12154 + | )),
|
12155 + | ))
|
12156 + | .unwrap();
|
12157 + | #[allow(unused_mut)]
|
12158 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12159 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
12160 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
12161 + | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
12162 + | let sender = sender.clone();
|
12163 + | async move {
|
12164 + | let result = {
|
12165 + | let expected = crate::input::EmptyOperationInput {};
|
12166 + | ::pretty_assertions::assert_eq!(input, expected);
|
12167 + | let output = crate::output::EmptyOperationOutput {};
|
12168 + | output
|
12169 + | };
|
12170 + | sender.send(()).await.expect("receiver dropped early");
|
12171 + | result
|
12172 + | }
|
12173 + | })
|
12174 + | .build_unchecked();
|
12175 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12176 + | .await
|
12177 + | .expect("unable to make an HTTP request");
|
12178 + | assert!(
|
12179 + | receiver.recv().await.is_some(),
|
12180 + | "we expected operation handler to be invoked but it was not entered"
|
12181 + | );
|
12182 + | }
|
12183 + |
|
12184 + | /// Service implementations must support no payload or an empty
|
12185 + | /// object payload for operations that define no input. However,
|
12186 + | /// despite the lack of a payload, a Content-Type header is still
|
12187 + | /// required in order for the service to properly detect the
|
12188 + | /// protocol.
|
12189 + | /// Test ID: json_1_1_service_supports_empty_payload_for_no_input_shape
|
12190 + | #[::tokio::test]
|
12191 + | #[::tracing_test::traced_test]
|
12192 + | async fn json_1_1_service_supports_empty_payload_for_no_input_shape_request() {
|
12193 + | #[allow(unused_mut)]
|
12194 + | let mut http_request = ::http::Request::builder()
|
12195 + | .uri("/")
|
12196 + | .method("POST")
|
12197 + | .header("Content-Type", "application/x-amz-json-1.1")
|
12198 + | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
12199 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
12200 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
12201 + | "".as_bytes(),
|
12202 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
12203 + | )),
|
12204 + | ))
|
12205 + | .unwrap();
|
12206 + | #[allow(unused_mut)]
|
12207 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12208 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
12209 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
12210 + | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
12211 + | let sender = sender.clone();
|
12212 + | async move {
|
12213 + | let result = {
|
12214 + | let expected = crate::input::EmptyOperationInput {};
|
12215 + | ::pretty_assertions::assert_eq!(input, expected);
|
12216 + | let output = crate::output::EmptyOperationOutput {};
|
12217 + | output
|
12218 + | };
|
12219 + | sender.send(()).await.expect("receiver dropped early");
|
12220 + | result
|
12221 + | }
|
12222 + | })
|
12223 + | .build_unchecked();
|
12224 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12225 + | .await
|
12226 + | .expect("unable to make an HTTP request");
|
12227 + | assert!(
|
12228 + | receiver.recv().await.is_some(),
|
12229 + | "we expected operation handler to be invoked but it was not entered"
|
12230 + | );
|
12231 + | }
|
12232 + |
|
12233 + | /// When no output is defined, the service is expected to return
|
12234 + | /// an empty payload. Despite the lack of a payload, the service
|
12235 + | /// is expected to always send a Content-Type header. Clients must
|
12236 + | /// handle cases where a service returns a JSON object and where
|
12237 + | /// a service returns no JSON at all.
|
12238 + | /// Test ID: json_1_1_service_responds_with_no_payload
|
12239 + | #[::tokio::test]
|
12240 + | #[::tracing_test::traced_test]
|
12241 + | async fn json_1_1_service_responds_with_no_payload_response() {
|
12242 + | let output = crate::output::EmptyOperationOutput {};
|
12243 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
12244 + | let http_response = output.into_response();
|
12245 + | ::pretty_assertions::assert_eq!(
|
12246 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
12247 + | http_response.status()
|
12248 + | );
|
12249 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
12250 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12251 + | http_response.headers(),
|
12252 + | expected_headers,
|
12253 + | ));
|
12254 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
12255 + | .await
|
12256 + | .expect("unable to extract body to bytes");
|
12257 + | // No body.
|
12258 + | ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
|
12259 + | }
|
12260 + | }
|