1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 2 | ::pin_project_lite::pin_project! {
|
3 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_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
4 + | /// [`EmptyOperationInput`](crate::input::EmptyOperationInput) using modelled bindings.
|
5 + | pub struct EmptyOperationInputFuture {
|
6 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EmptyOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
7 7 | }
|
8 8 | }
|
9 9 |
|
10 - | impl std::future::Future for ContentTypeParametersInputFuture {
|
10 + | impl std::future::Future for EmptyOperationInputFuture {
|
11 11 | type Output = Result<
|
12 - | crate::input::ContentTypeParametersInput,
|
12 + | crate::input::EmptyOperationInput,
|
13 13 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
14 14 | >;
|
15 15 |
|
16 16 | fn poll(
|
17 17 | self: std::pin::Pin<&mut Self>,
|
18 18 | cx: &mut std::task::Context<'_>,
|
19 19 | ) -> std::task::Poll<Self::Output> {
|
20 20 | let this = self.project();
|
21 21 | this.inner.as_mut().poll(cx)
|
22 22 | }
|
23 23 | }
|
24 24 |
|
25 25 | impl<B>
|
26 26 | ::aws_smithy_http_server::request::FromRequest<
|
27 27 | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
28 28 | B,
|
29 - | > for crate::input::ContentTypeParametersInput
|
29 + | > for crate::input::EmptyOperationInput
|
30 30 | where
|
31 31 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
32 32 | B: 'static,
|
33 33 |
|
34 34 | B::Data: Send,
|
35 35 | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
36 36 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
37 37 | {
|
38 38 | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
39 - | type Future = ContentTypeParametersInputFuture;
|
39 + | type Future = EmptyOperationInputFuture;
|
40 40 |
|
41 41 | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
42 42 | let fut = async move {
|
43 43 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
44 44 | request.headers(),
|
45 45 | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
46 46 | ) {
|
47 47 | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
48 48 | }
|
49 - | crate::protocol_serde::shape_content_type_parameters::de_content_type_parameters_http_request(request)
|
50 - | .await
|
49 + | crate::protocol_serde::shape_empty_operation::de_empty_operation_http_request(request)
|
50 + | .await
|
51 51 | };
|
52 52 | use ::futures_util::future::TryFutureExt;
|
53 53 | let fut = fut.map_err(
|
54 54 | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
55 55 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
56 56 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
57 57 | },
|
58 58 | );
|
59 - | ContentTypeParametersInputFuture {
|
59 + | EmptyOperationInputFuture {
|
60 60 | inner: Box::pin(fut),
|
61 61 | }
|
62 62 | }
|
63 63 | }
|
64 64 | impl
|
65 65 | ::aws_smithy_http_server::response::IntoResponse<
|
66 66 | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
67 - | > for crate::output::ContentTypeParametersOutput
|
67 + | > for crate::output::EmptyOperationOutput
|
68 68 | {
|
69 69 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
70 - | match crate::protocol_serde::shape_content_type_parameters::ser_content_type_parameters_http_response(self) {
|
71 - | Ok(response) => response,
|
72 - | Err(e) => {
|
73 - | ::tracing::error!(error = %e, "failed to serialize response");
|
74 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
75 - | }
|
76 - | }
|
70 + | match crate::protocol_serde::shape_empty_operation::ser_empty_operation_http_response(self)
|
71 + | {
|
72 + | Ok(response) => response,
|
73 + | Err(e) => {
|
74 + | ::tracing::error!(error = %e, "failed to serialize response");
|
75 + | ::aws_smithy_http_server::response::IntoResponse::<
|
76 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
77 + | >::into_response(
|
78 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
79 + | e,
|
80 + | ),
|
81 + | )
|
82 + | }
|
83 + | }
|
77 84 | }
|
78 85 | }
|
79 86 |
|
80 87 | #[allow(unreachable_code, unused_variables)]
|
81 88 | #[cfg(test)]
|
82 - | mod content_type_parameters_test {
|
89 + | mod empty_operation_test {
|
83 90 |
|
84 - | /// A server should ignore parameters added to the content type
|
85 - | /// Test ID: AwsJson11MustSupportParametersInContentType
|
91 + | /// Sends requests to /
|
92 + | /// Test ID: sends_requests_to_slash
|
86 93 | #[::tokio::test]
|
87 94 | #[::tracing_test::traced_test]
|
88 - | async fn aws_json11_must_support_parameters_in_content_type_request() {
|
95 + | async fn sends_requests_to_slash_request() {
|
89 96 | #[allow(unused_mut)]
|
90 97 | let mut http_request = ::http_1x::Request::builder()
|
91 98 | .uri("/")
|
92 99 | .method("POST")
|
93 - | .header("Content-Type", "application/x-amz-json-1.1; charset=utf-8")
|
94 - | .header("X-Amz-Target", "JsonProtocol.ContentTypeParameters")
|
100 + | .header("Content-Type", "application/x-amz-json-1.1")
|
101 + | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
102 + | .body(::aws_smithy_http_server::body::boxed(
|
103 + | ::http_body_util::Empty::new(),
|
104 + | ))
|
105 + | .unwrap();
|
106 + | #[allow(unused_mut)]
|
107 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
108 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
109 + | let service = crate::service::JsonProtocol::builder::<
|
110 + | ::aws_smithy_http_server::body::BoxBody,
|
111 + | _,
|
112 + | _,
|
113 + | _,
|
114 + | >(config)
|
115 + | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
116 + | let sender = sender.clone();
|
117 + | async move {
|
118 + | let result = {
|
119 + | let expected = crate::input::EmptyOperationInput {};
|
120 + | ::pretty_assertions::assert_eq!(input, expected);
|
121 + | let output = crate::output::EmptyOperationOutput {};
|
122 + | output
|
123 + | };
|
124 + | sender.send(()).await.expect("receiver dropped early");
|
125 + | result
|
126 + | }
|
127 + | })
|
128 + | .build_unchecked();
|
129 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
130 + | .await
|
131 + | .expect("unable to make an HTTP request");
|
132 + | assert!(
|
133 + | receiver.recv().await.is_some(),
|
134 + | "we expected operation handler to be invoked but it was not entered"
|
135 + | );
|
136 + | }
|
137 + |
|
138 + | /// Includes X-Amz-Target header and Content-Type
|
139 + | /// Test ID: includes_x_amz_target_and_content_type
|
140 + | #[::tokio::test]
|
141 + | #[::tracing_test::traced_test]
|
142 + | async fn includes_x_amz_target_and_content_type_request() {
|
143 + | #[allow(unused_mut)]
|
144 + | let mut http_request = ::http_1x::Request::builder()
|
145 + | .uri("/")
|
146 + | .method("POST")
|
147 + | .header("Content-Type", "application/x-amz-json-1.1")
|
148 + | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
149 + | .body(::aws_smithy_http_server::body::boxed(
|
150 + | ::http_body_util::Empty::new(),
|
151 + | ))
|
152 + | .unwrap();
|
153 + | #[allow(unused_mut)]
|
154 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
155 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
156 + | let service = crate::service::JsonProtocol::builder::<
|
157 + | ::aws_smithy_http_server::body::BoxBody,
|
158 + | _,
|
159 + | _,
|
160 + | _,
|
161 + | >(config)
|
162 + | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
163 + | let sender = sender.clone();
|
164 + | async move {
|
165 + | let result = {
|
166 + | let expected = crate::input::EmptyOperationInput {};
|
167 + | ::pretty_assertions::assert_eq!(input, expected);
|
168 + | let output = crate::output::EmptyOperationOutput {};
|
169 + | output
|
170 + | };
|
171 + | sender.send(()).await.expect("receiver dropped early");
|
172 + | result
|
173 + | }
|
174 + | })
|
175 + | .build_unchecked();
|
176 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
177 + | .await
|
178 + | .expect("unable to make an HTTP request");
|
179 + | assert!(
|
180 + | receiver.recv().await.is_some(),
|
181 + | "we expected operation handler to be invoked but it was not entered"
|
182 + | );
|
183 + | }
|
184 + |
|
185 + | /// Clients must always send an empty JSON object payload for
|
186 + | /// operations with no input (that is, `{}`). While AWS service
|
187 + | /// implementations support requests with no payload or requests
|
188 + | /// that send `{}`, always sending `{}` from the client is
|
189 + | /// preferred for forward compatibility in case input is ever
|
190 + | /// added to an operation.
|
191 + | /// Test ID: json_1_1_client_sends_empty_payload_for_no_input_shape
|
192 + | #[::tokio::test]
|
193 + | #[::tracing_test::traced_test]
|
194 + | async fn json_1_1_client_sends_empty_payload_for_no_input_shape_request() {
|
195 + | #[allow(unused_mut)]
|
196 + | let mut http_request = ::http_1x::Request::builder()
|
197 + | .uri("/")
|
198 + | .method("POST")
|
199 + | .header("Content-Type", "application/x-amz-json-1.1")
|
200 + | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
95 201 | .body(::aws_smithy_http_server::body::boxed(
|
96 202 | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
97 203 | &::aws_smithy_protocol_test::decode_body_data(
|
98 - | "{\"value\":5}".as_bytes(),
|
204 + | "{}".as_bytes(),
|
99 205 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
100 206 | ),
|
101 207 | )),
|
102 208 | ))
|
103 209 | .unwrap();
|
104 210 | #[allow(unused_mut)]
|
105 211 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
106 212 | let config = crate::service::JsonProtocolConfig::builder().build();
|
107 213 | let service = crate::service::JsonProtocol::builder::<
|
108 214 | ::aws_smithy_http_server::body::BoxBody,
|
109 215 | _,
|
110 216 | _,
|
111 217 | _,
|
112 218 | >(config)
|
113 - | .content_type_parameters(move |input: crate::input::ContentTypeParametersInput| {
|
219 + | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
114 220 | let sender = sender.clone();
|
115 221 | async move {
|
116 222 | let result = {
|
117 - | let expected = crate::input::ContentTypeParametersInput {
|
118 - | value: ::std::option::Option::Some(5),
|
119 - | };
|
223 + | let expected = crate::input::EmptyOperationInput {};
|
120 224 | ::pretty_assertions::assert_eq!(input, expected);
|
121 - | let output = crate::output::ContentTypeParametersOutput {};
|
225 + | let output = crate::output::EmptyOperationOutput {};
|
122 226 | output
|
123 227 | };
|
124 228 | sender.send(()).await.expect("receiver dropped early");
|
125 229 | result
|
126 230 | }
|
127 231 | })
|
128 232 | .build_unchecked();
|
129 233 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
130 234 | .await
|
131 235 | .expect("unable to make an HTTP request");
|
132 236 | assert!(
|
133 237 | receiver.recv().await.is_some(),
|
134 238 | "we expected operation handler to be invoked but it was not entered"
|
135 239 | );
|
136 240 | }
|
137 - | }
|
138 241 |
|
139 - | ::pin_project_lite::pin_project! {
|
140 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
141 - | /// [`PutWithContentEncodingInput`](crate::input::PutWithContentEncodingInput) using modelled bindings.
|
142 - | pub struct PutWithContentEncodingInputFuture {
|
143 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::PutWithContentEncodingInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
242 + | /// Service implementations must support no payload or an empty
|
243 + | /// object payload for operations that define no input. However,
|
244 + | /// despite the lack of a payload, a Content-Type header is still
|
245 + | /// required in order for the service to properly detect the
|
246 + | /// protocol.
|
247 + | /// Test ID: json_1_1_service_supports_empty_payload_for_no_input_shape
|
248 + | #[::tokio::test]
|
249 + | #[::tracing_test::traced_test]
|
250 + | async fn json_1_1_service_supports_empty_payload_for_no_input_shape_request() {
|
251 + | #[allow(unused_mut)]
|
252 + | let mut http_request = ::http_1x::Request::builder()
|
253 + | .uri("/")
|
254 + | .method("POST")
|
255 + | .header("Content-Type", "application/x-amz-json-1.1")
|
256 + | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
257 + | .body(::aws_smithy_http_server::body::boxed(
|
258 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
259 + | &::aws_smithy_protocol_test::decode_body_data(
|
260 + | "".as_bytes(),
|
261 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
262 + | ),
|
263 + | )),
|
264 + | ))
|
265 + | .unwrap();
|
266 + | #[allow(unused_mut)]
|
267 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
268 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
269 + | let service = crate::service::JsonProtocol::builder::<
|
270 + | ::aws_smithy_http_server::body::BoxBody,
|
271 + | _,
|
272 + | _,
|
273 + | _,
|
274 + | >(config)
|
275 + | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
276 + | let sender = sender.clone();
|
277 + | async move {
|
278 + | let result = {
|
279 + | let expected = crate::input::EmptyOperationInput {};
|
280 + | ::pretty_assertions::assert_eq!(input, expected);
|
281 + | let output = crate::output::EmptyOperationOutput {};
|
282 + | output
|
283 + | };
|
284 + | sender.send(()).await.expect("receiver dropped early");
|
285 + | result
|
286 + | }
|
287 + | })
|
288 + | .build_unchecked();
|
289 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
290 + | .await
|
291 + | .expect("unable to make an HTTP request");
|
292 + | assert!(
|
293 + | receiver.recv().await.is_some(),
|
294 + | "we expected operation handler to be invoked but it was not entered"
|
295 + | );
|
296 + | }
|
297 + |
|
298 + | /// When no output is defined, the service is expected to return
|
299 + | /// an empty payload. Despite the lack of a payload, the service
|
300 + | /// is expected to always send a Content-Type header. Clients must
|
301 + | /// handle cases where a service returns a JSON object and where
|
302 + | /// a service returns no JSON at all.
|
303 + | /// Test ID: json_1_1_service_responds_with_no_payload
|
304 + | #[::tokio::test]
|
305 + | #[::tracing_test::traced_test]
|
306 + | async fn json_1_1_service_responds_with_no_payload_response() {
|
307 + | let output = crate::output::EmptyOperationOutput {};
|
308 + | use ::aws_smithy_http_server::response::IntoResponse;
|
309 + | let http_response = output.into_response();
|
310 + | ::pretty_assertions::assert_eq!(
|
311 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
312 + | http_response.status()
|
313 + | );
|
314 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
315 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
316 + | http_response.headers(),
|
317 + | expected_headers,
|
318 + | ));
|
319 + | use ::http_body_util::BodyExt;
|
320 + | let body = http_response
|
321 + | .into_body()
|
322 + | .collect()
|
323 + | .await
|
324 + | .expect("unable to collect body")
|
325 + | .to_bytes();
|
326 + | // No body.
|
327 + | ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
|
144 328 | }
|
145 329 | }
|
146 330 |
|
147 - | impl std::future::Future for PutWithContentEncodingInputFuture {
|
331 + | ::pin_project_lite::pin_project! {
|
332 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
333 + | /// [`KitchenSinkOperationInput`](crate::input::KitchenSinkOperationInput) using modelled bindings.
|
334 + | pub struct KitchenSinkOperationInputFuture {
|
335 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::KitchenSinkOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
336 + | }
|
337 + | }
|
338 + |
|
339 + | impl std::future::Future for KitchenSinkOperationInputFuture {
|
148 340 | type Output = Result<
|
149 - | crate::input::PutWithContentEncodingInput,
|
341 + | crate::input::KitchenSinkOperationInput,
|
150 342 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
151 343 | >;
|
152 344 |
|
153 345 | fn poll(
|
154 346 | self: std::pin::Pin<&mut Self>,
|
155 347 | cx: &mut std::task::Context<'_>,
|
156 348 | ) -> std::task::Poll<Self::Output> {
|
157 349 | let this = self.project();
|
158 350 | this.inner.as_mut().poll(cx)
|
159 351 | }
|
160 352 | }
|
161 353 |
|
162 354 | impl<B>
|
163 355 | ::aws_smithy_http_server::request::FromRequest<
|
164 356 | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
165 357 | B,
|
166 - | > for crate::input::PutWithContentEncodingInput
|
358 + | > for crate::input::KitchenSinkOperationInput
|
167 359 | where
|
168 360 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
169 361 | B: 'static,
|
170 362 |
|
171 363 | B::Data: Send,
|
172 364 | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
173 365 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
174 366 | {
|
175 367 | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
176 - | type Future = PutWithContentEncodingInputFuture;
|
368 + | type Future = KitchenSinkOperationInputFuture;
|
177 369 |
|
178 370 | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
179 371 | let fut = async move {
|
180 372 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
181 373 | request.headers(),
|
182 374 | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
183 375 | ) {
|
184 376 | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
185 377 | }
|
186 - | crate::protocol_serde::shape_put_with_content_encoding::de_put_with_content_encoding_http_request(request)
|
378 + | crate::protocol_serde::shape_kitchen_sink_operation::de_kitchen_sink_operation_http_request(request)
|
187 379 | .await
|
188 380 | };
|
189 381 | use ::futures_util::future::TryFutureExt;
|
190 382 | let fut = fut.map_err(
|
191 383 | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
192 384 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
193 385 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
194 386 | },
|
195 387 | );
|
196 - | PutWithContentEncodingInputFuture {
|
388 + | KitchenSinkOperationInputFuture {
|
197 389 | inner: Box::pin(fut),
|
198 390 | }
|
199 391 | }
|
200 392 | }
|
201 393 | impl
|
202 394 | ::aws_smithy_http_server::response::IntoResponse<
|
203 395 | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
204 - | > for crate::output::PutWithContentEncodingOutput
|
396 + | > for crate::output::KitchenSinkOperationOutput
|
205 397 | {
|
206 398 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
207 - | match crate::protocol_serde::shape_put_with_content_encoding::ser_put_with_content_encoding_http_response(self) {
|
399 + | match crate::protocol_serde::shape_kitchen_sink_operation::ser_kitchen_sink_operation_http_response(self) {
|
208 400 | Ok(response) => response,
|
209 401 | Err(e) => {
|
210 402 | ::tracing::error!(error = %e, "failed to serialize response");
|
211 403 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
212 404 | }
|
213 405 | }
|
214 406 | }
|
215 407 | }
|
216 - |
|
217 - | ::pin_project_lite::pin_project! {
|
218 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
219 - | /// [`FractionalSecondsInput`](crate::input::FractionalSecondsInput) using modelled bindings.
|
220 - | pub struct FractionalSecondsInputFuture {
|
221 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::FractionalSecondsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
222 - | }
|
223 - | }
|
224 - |
|
225 - | impl std::future::Future for FractionalSecondsInputFuture {
|
226 - | type Output = Result<
|
227 - | crate::input::FractionalSecondsInput,
|
228 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
229 - | >;
|
230 - |
|
231 - | fn poll(
|
232 - | self: std::pin::Pin<&mut Self>,
|
233 - | cx: &mut std::task::Context<'_>,
|
234 - | ) -> std::task::Poll<Self::Output> {
|
235 - | let this = self.project();
|
236 - | this.inner.as_mut().poll(cx)
|
237 - | }
|
238 - | }
|
239 - |
|
240 - | impl<B>
|
241 - | ::aws_smithy_http_server::request::FromRequest<
|
242 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
243 - | B,
|
244 - | > for crate::input::FractionalSecondsInput
|
245 - | where
|
246 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
247 - | B: 'static,
|
248 - |
|
249 - | B::Data: Send,
|
250 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
251 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
252 - | {
|
253 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
254 - | type Future = FractionalSecondsInputFuture;
|
255 - |
|
256 - | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
257 - | let fut = async move {
|
258 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
259 - | request.headers(),
|
260 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
261 - | ) {
|
262 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
263 - | }
|
264 - | crate::protocol_serde::shape_fractional_seconds::de_fractional_seconds_http_request(
|
265 - | request,
|
266 - | )
|
267 - | .await
|
268 - | };
|
269 - | use ::futures_util::future::TryFutureExt;
|
270 - | let fut = fut.map_err(
|
271 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
272 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
273 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
274 - | },
|
275 - | );
|
276 - | FractionalSecondsInputFuture {
|
277 - | inner: Box::pin(fut),
|
278 - | }
|
279 - | }
|
280 - | }
|
281 408 | impl
|
282 409 | ::aws_smithy_http_server::response::IntoResponse<
|
283 410 | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
284 - | > for crate::output::FractionalSecondsOutput
|
411 + | > for crate::error::KitchenSinkOperationError
|
285 412 | {
|
286 413 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
287 - | match crate::protocol_serde::shape_fractional_seconds::ser_fractional_seconds_http_response(
|
288 - | self,
|
289 - | ) {
|
290 - | Ok(response) => response,
|
291 - | Err(e) => {
|
292 - | ::tracing::error!(error = %e, "failed to serialize response");
|
293 - | ::aws_smithy_http_server::response::IntoResponse::<
|
294 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
295 - | >::into_response(
|
296 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
297 - | e,
|
298 - | ),
|
299 - | )
|
300 - | }
|
301 - | }
|
302 - | }
|
303 - | }
|
304 - |
|
305 - | ::pin_project_lite::pin_project! {
|
306 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
307 - | /// [`DatetimeOffsetsInput`](crate::input::DatetimeOffsetsInput) using modelled bindings.
|
308 - | pub struct DatetimeOffsetsInputFuture {
|
309 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::DatetimeOffsetsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
310 - | }
|
311 - | }
|
312 - |
|
313 - | impl std::future::Future for DatetimeOffsetsInputFuture {
|
314 - | type Output = Result<
|
315 - | crate::input::DatetimeOffsetsInput,
|
316 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
317 - | >;
|
318 - |
|
319 - | fn poll(
|
320 - | self: std::pin::Pin<&mut Self>,
|
321 - | cx: &mut std::task::Context<'_>,
|
322 - | ) -> std::task::Poll<Self::Output> {
|
323 - | let this = self.project();
|
324 - | this.inner.as_mut().poll(cx)
|
325 - | }
|
326 - | }
|
327 - |
|
328 - | impl<B>
|
329 - | ::aws_smithy_http_server::request::FromRequest<
|
330 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
331 - | B,
|
332 - | > for crate::input::DatetimeOffsetsInput
|
333 - | where
|
334 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
335 - | B: 'static,
|
336 - |
|
337 - | B::Data: Send,
|
338 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
339 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
340 - | {
|
341 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
342 - | type Future = DatetimeOffsetsInputFuture;
|
343 - |
|
344 - | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
345 - | let fut = async move {
|
346 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
347 - | request.headers(),
|
348 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
349 - | ) {
|
350 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
351 - | }
|
352 - | crate::protocol_serde::shape_datetime_offsets::de_datetime_offsets_http_request(request)
|
353 - | .await
|
354 - | };
|
355 - | use ::futures_util::future::TryFutureExt;
|
356 - | let fut = fut.map_err(
|
357 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
358 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
359 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
414 + | match crate::protocol_serde::shape_kitchen_sink_operation::ser_kitchen_sink_operation_http_error(&self) {
|
415 + | Ok(mut response) => {
|
416 + | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
417 + | response
|
360 418 | },
|
361 - | );
|
362 - | DatetimeOffsetsInputFuture {
|
363 - | inner: Box::pin(fut),
|
364 - | }
|
365 - | }
|
366 - | }
|
367 - | impl
|
368 - | ::aws_smithy_http_server::response::IntoResponse<
|
369 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
370 - | > for crate::output::DatetimeOffsetsOutput
|
371 - | {
|
372 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
373 - | match crate::protocol_serde::shape_datetime_offsets::ser_datetime_offsets_http_response(
|
374 - | self,
|
375 - | ) {
|
376 - | Ok(response) => response,
|
377 419 | Err(e) => {
|
378 420 | ::tracing::error!(error = %e, "failed to serialize response");
|
379 - | ::aws_smithy_http_server::response::IntoResponse::<
|
380 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
381 - | >::into_response(
|
382 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
383 - | e,
|
384 - | ),
|
385 - | )
|
421 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
386 422 | }
|
387 423 | }
|
388 424 | }
|
389 425 | }
|
390 426 |
|
391 - | ::pin_project_lite::pin_project! {
|
392 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
393 - | /// [`HostWithPathOperationInput`](crate::input::HostWithPathOperationInput) using modelled bindings.
|
394 - | pub struct HostWithPathOperationInputFuture {
|
395 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::HostWithPathOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
396 - | }
|
397 - | }
|
398 - |
|
399 - | impl std::future::Future for HostWithPathOperationInputFuture {
|
400 - | type Output = Result<
|
401 - | crate::input::HostWithPathOperationInput,
|
402 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
403 - | >;
|
404 - |
|
405 - | fn poll(
|
406 - | self: std::pin::Pin<&mut Self>,
|
407 - | cx: &mut std::task::Context<'_>,
|
408 - | ) -> std::task::Poll<Self::Output> {
|
409 - | let this = self.project();
|
410 - | this.inner.as_mut().poll(cx)
|
411 - | }
|
412 - | }
|
413 - |
|
414 - | impl<B>
|
415 - | ::aws_smithy_http_server::request::FromRequest<
|
416 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
417 - | B,
|
418 - | > for crate::input::HostWithPathOperationInput
|
419 - | where
|
420 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
421 - | B: 'static,
|
422 - |
|
423 - | B::Data: Send,
|
424 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
425 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
426 - | {
|
427 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
428 - | type Future = HostWithPathOperationInputFuture;
|
427 + | #[allow(unreachable_code, unused_variables)]
|
428 + | #[cfg(test)]
|
429 + | mod kitchen_sink_operation_test {
|
429 430 |
|
430 - | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
431 - | let fut = async move {
|
432 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
433 - | request.headers(),
|
434 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
435 - | ) {
|
436 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
437 - | }
|
438 - | crate::protocol_serde::shape_host_with_path_operation::de_host_with_path_operation_http_request(request)
|
439 - | .await
|
440 - | };
|
441 - | use ::futures_util::future::TryFutureExt;
|
442 - | let fut = fut.map_err(
|
443 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
444 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
445 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
446 - | },
|
447 - | );
|
448 - | HostWithPathOperationInputFuture {
|
449 - | inner: Box::pin(fut),
|
450 - | }
|
451 - | }
|
452 - | }
|
453 - | impl
|
454 - | ::aws_smithy_http_server::response::IntoResponse<
|
455 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
456 - | > for crate::output::HostWithPathOperationOutput
|
457 - | {
|
458 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
459 - | match crate::protocol_serde::shape_host_with_path_operation::ser_host_with_path_operation_http_response(self) {
|
460 - | Ok(response) => response,
|
461 - | Err(e) => {
|
462 - | ::tracing::error!(error = %e, "failed to serialize response");
|
463 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
464 - | }
|
465 - | }
|
466 - | }
|
467 - | }
|
468 - |
|
469 - | ::pin_project_lite::pin_project! {
|
470 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
471 - | /// [`EndpointWithHostLabelOperationInput`](crate::input::EndpointWithHostLabelOperationInput) using modelled bindings.
|
472 - | pub struct EndpointWithHostLabelOperationInputFuture {
|
473 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EndpointWithHostLabelOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
474 - | }
|
475 - | }
|
476 - |
|
477 - | impl std::future::Future for EndpointWithHostLabelOperationInputFuture {
|
478 - | type Output = Result<
|
479 - | crate::input::EndpointWithHostLabelOperationInput,
|
480 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
481 - | >;
|
482 - |
|
483 - | fn poll(
|
484 - | self: std::pin::Pin<&mut Self>,
|
485 - | cx: &mut std::task::Context<'_>,
|
486 - | ) -> std::task::Poll<Self::Output> {
|
487 - | let this = self.project();
|
488 - | this.inner.as_mut().poll(cx)
|
489 - | }
|
490 - | }
|
491 - |
|
492 - | impl<B>
|
493 - | ::aws_smithy_http_server::request::FromRequest<
|
494 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
495 - | B,
|
496 - | > for crate::input::EndpointWithHostLabelOperationInput
|
497 - | where
|
498 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
499 - | B: 'static,
|
500 - |
|
501 - | B::Data: Send,
|
502 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
503 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
504 - | {
|
505 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
506 - | type Future = EndpointWithHostLabelOperationInputFuture;
|
507 - |
|
508 - | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
509 - | let fut = async move {
|
510 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
511 - | request.headers(),
|
512 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
513 - | ) {
|
514 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
515 - | }
|
516 - | crate::protocol_serde::shape_endpoint_with_host_label_operation::de_endpoint_with_host_label_operation_http_request(request)
|
517 - | .await
|
518 - | };
|
519 - | use ::futures_util::future::TryFutureExt;
|
520 - | let fut = fut.map_err(
|
521 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
522 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
523 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
524 - | },
|
525 - | );
|
526 - | EndpointWithHostLabelOperationInputFuture {
|
527 - | inner: Box::pin(fut),
|
528 - | }
|
529 - | }
|
530 - | }
|
531 - | impl
|
532 - | ::aws_smithy_http_server::response::IntoResponse<
|
533 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
534 - | > for crate::output::EndpointWithHostLabelOperationOutput
|
535 - | {
|
536 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
537 - | match crate::protocol_serde::shape_endpoint_with_host_label_operation::ser_endpoint_with_host_label_operation_http_response(self) {
|
538 - | Ok(response) => response,
|
539 - | Err(e) => {
|
540 - | ::tracing::error!(error = %e, "failed to serialize response");
|
541 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
542 - | }
|
543 - | }
|
544 - | }
|
545 - | }
|
546 - | impl
|
547 - | ::aws_smithy_http_server::response::IntoResponse<
|
548 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
549 - | > for crate::error::EndpointWithHostLabelOperationError
|
550 - | {
|
551 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
552 - | match crate::protocol_serde::shape_endpoint_with_host_label_operation::ser_endpoint_with_host_label_operation_http_error(&self) {
|
553 - | Ok(mut response) => {
|
554 - | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
555 - | response
|
556 - | },
|
557 - | Err(e) => {
|
558 - | ::tracing::error!(error = %e, "failed to serialize response");
|
559 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
560 - | }
|
561 - | }
|
562 - | }
|
563 - | }
|
564 - |
|
565 - | #[allow(unreachable_code, unused_variables)]
|
566 - | #[cfg(test)]
|
567 - | mod endpoint_with_host_label_operation_test {
|
568 - |
|
569 - | /// Operations can prepend to the given host if they define the
|
570 - | /// endpoint trait, and can use the host label trait to define
|
571 - | /// further customization based on user input.
|
572 - | /// Test ID: AwsJson11EndpointTraitWithHostLabel
|
431 + | /// Serializes string shapes
|
432 + | /// Test ID: serializes_string_shapes
|
573 433 | #[::tokio::test]
|
574 434 | #[::tracing_test::traced_test]
|
575 - | #[should_panic]
|
576 - | async fn aws_json11_endpoint_trait_with_host_label_request() {
|
435 + | async fn serializes_string_shapes_request() {
|
577 436 | #[allow(unused_mut)]
|
578 437 | let mut http_request = ::http_1x::Request::builder()
|
579 438 | .uri("/")
|
580 439 | .method("POST")
|
581 440 | .header("Content-Type", "application/x-amz-json-1.1")
|
582 - | .header(
|
583 - | "X-Amz-Target",
|
584 - | "JsonProtocol.EndpointWithHostLabelOperation",
|
585 - | )
|
441 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
586 442 | .body(::aws_smithy_http_server::body::boxed(
|
587 443 | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
588 444 | &::aws_smithy_protocol_test::decode_body_data(
|
589 - | "{\"label\": \"bar\"}".as_bytes(),
|
445 + | "{\"String\":\"abc xyz\"}".as_bytes(),
|
590 446 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
591 447 | ),
|
592 448 | )),
|
593 449 | ))
|
594 450 | .unwrap();
|
595 - | todo!("endpoint trait not supported yet");
|
596 451 | #[allow(unused_mut)]
|
597 452 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
598 453 | let config = crate::service::JsonProtocolConfig::builder().build();
|
599 454 | let service = crate::service::JsonProtocol::builder::<
|
600 455 | ::aws_smithy_http_server::body::BoxBody,
|
601 456 | _,
|
602 457 | _,
|
603 458 | _,
|
604 459 | >(config)
|
605 - | .endpoint_with_host_label_operation(
|
606 - | move |input: crate::input::EndpointWithHostLabelOperationInput| {
|
607 - | let sender = sender.clone();
|
608 - | async move {
|
609 - | let result = {
|
610 - | let expected = crate::input::EndpointWithHostLabelOperationInput {
|
611 - | label: "bar".to_owned(),
|
612 - | };
|
613 - | ::pretty_assertions::assert_eq!(input, expected);
|
614 - | let output = crate::output::EndpointWithHostLabelOperationOutput {};
|
615 - | Ok(output)
|
460 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
461 + | let sender = sender.clone();
|
462 + | async move {
|
463 + | let result = {
|
464 + | use ::aws_smithy_protocol_test::FloatEquals;
|
465 + | let expected = crate::input::KitchenSinkOperationInput {
|
466 + | string: ::std::option::Option::Some("abc xyz".to_owned()),
|
467 + | blob: ::std::option::Option::None,
|
468 + | boolean: ::std::option::Option::None,
|
469 + | double: ::std::option::Option::None,
|
470 + | empty_struct: ::std::option::Option::None,
|
471 + | float: ::std::option::Option::None,
|
472 + | httpdate_timestamp: ::std::option::Option::None,
|
473 + | integer: ::std::option::Option::None,
|
474 + | iso8601_timestamp: ::std::option::Option::None,
|
475 + | json_value: ::std::option::Option::None,
|
476 + | list_of_lists: ::std::option::Option::None,
|
477 + | list_of_maps_of_strings: ::std::option::Option::None,
|
478 + | list_of_strings: ::std::option::Option::None,
|
479 + | list_of_structs: ::std::option::Option::None,
|
480 + | long: ::std::option::Option::None,
|
481 + | map_of_lists_of_strings: ::std::option::Option::None,
|
482 + | map_of_maps: ::std::option::Option::None,
|
483 + | map_of_strings: ::std::option::Option::None,
|
484 + | map_of_structs: ::std::option::Option::None,
|
485 + | recursive_list: ::std::option::Option::None,
|
486 + | recursive_map: ::std::option::Option::None,
|
487 + | recursive_struct: ::std::option::Option::None,
|
488 + | simple_struct: ::std::option::Option::None,
|
489 + | struct_with_json_name: ::std::option::Option::None,
|
490 + | timestamp: ::std::option::Option::None,
|
491 + | unix_timestamp: ::std::option::Option::None,
|
616 492 | };
|
617 - | sender.send(()).await.expect("receiver dropped early");
|
618 - | result
|
619 - | }
|
620 - | },
|
621 - | )
|
622 - | .build_unchecked();
|
623 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
624 - | .await
|
625 - | .expect("unable to make an HTTP request");
|
626 - | assert!(
|
627 - | receiver.recv().await.is_some(),
|
628 - | "we expected operation handler to be invoked but it was not entered"
|
629 - | );
|
630 - | }
|
631 - | }
|
632 - |
|
633 - | ::pin_project_lite::pin_project! {
|
634 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
635 - | /// [`EndpointOperationInput`](crate::input::EndpointOperationInput) using modelled bindings.
|
636 - | pub struct EndpointOperationInputFuture {
|
637 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EndpointOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
638 - | }
|
639 - | }
|
640 - |
|
641 - | impl std::future::Future for EndpointOperationInputFuture {
|
642 - | type Output = Result<
|
643 - | crate::input::EndpointOperationInput,
|
644 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
645 - | >;
|
646 - |
|
647 - | fn poll(
|
648 - | self: std::pin::Pin<&mut Self>,
|
649 - | cx: &mut std::task::Context<'_>,
|
650 - | ) -> std::task::Poll<Self::Output> {
|
651 - | let this = self.project();
|
652 - | this.inner.as_mut().poll(cx)
|
653 - | }
|
654 - | }
|
655 - |
|
656 - | impl<B>
|
657 - | ::aws_smithy_http_server::request::FromRequest<
|
658 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
659 - | B,
|
660 - | > for crate::input::EndpointOperationInput
|
661 - | where
|
662 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
663 - | B: 'static,
|
664 - |
|
665 - | B::Data: Send,
|
666 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
667 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
668 - | {
|
669 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
670 - | type Future = EndpointOperationInputFuture;
|
671 - |
|
672 - | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
673 - | let fut = async move {
|
674 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
675 - | request.headers(),
|
676 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
677 - | ) {
|
678 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
679 - | }
|
680 - | crate::protocol_serde::shape_endpoint_operation::de_endpoint_operation_http_request(
|
681 - | request,
|
682 - | )
|
683 - | .await
|
684 - | };
|
685 - | use ::futures_util::future::TryFutureExt;
|
686 - | let fut = fut.map_err(
|
687 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
688 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
689 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
690 - | },
|
691 - | );
|
692 - | EndpointOperationInputFuture {
|
693 - | inner: Box::pin(fut),
|
694 - | }
|
695 - | }
|
696 - | }
|
697 - | impl
|
698 - | ::aws_smithy_http_server::response::IntoResponse<
|
699 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
700 - | > for crate::output::EndpointOperationOutput
|
701 - | {
|
702 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
703 - | match crate::protocol_serde::shape_endpoint_operation::ser_endpoint_operation_http_response(
|
704 - | self,
|
705 - | ) {
|
706 - | Ok(response) => response,
|
707 - | Err(e) => {
|
708 - | ::tracing::error!(error = %e, "failed to serialize response");
|
709 - | ::aws_smithy_http_server::response::IntoResponse::<
|
710 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
711 - | >::into_response(
|
712 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
713 - | e,
|
714 - | ),
|
715 - | )
|
716 - | }
|
717 - | }
|
718 - | }
|
719 - | }
|
720 - |
|
721 - | #[allow(unreachable_code, unused_variables)]
|
722 - | #[cfg(test)]
|
723 - | mod endpoint_operation_test {
|
724 - |
|
725 - | /// Operations can prepend to the given host if they define the
|
726 - | /// endpoint trait.
|
727 - | /// Test ID: AwsJson11EndpointTrait
|
728 - | #[::tokio::test]
|
729 - | #[::tracing_test::traced_test]
|
730 - | #[should_panic]
|
731 - | async fn aws_json11_endpoint_trait_request() {
|
732 - | #[allow(unused_mut)]
|
733 - | let mut http_request = ::http_1x::Request::builder()
|
734 - | .uri("/")
|
735 - | .method("POST")
|
736 - | .header("Content-Type", "application/x-amz-json-1.1")
|
737 - | .header("X-Amz-Target", "JsonProtocol.EndpointOperation")
|
738 - | .body(::aws_smithy_http_server::body::boxed(
|
739 - | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
740 - | &::aws_smithy_protocol_test::decode_body_data(
|
741 - | "{}".as_bytes(),
|
742 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
743 - | ),
|
744 - | )),
|
745 - | ))
|
746 - | .unwrap();
|
747 - | todo!("endpoint trait not supported yet");
|
748 - | #[allow(unused_mut)]
|
749 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
750 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
751 - | let service = crate::service::JsonProtocol::builder::<
|
752 - | ::aws_smithy_http_server::body::BoxBody,
|
753 - | _,
|
754 - | _,
|
755 - | _,
|
756 - | >(config)
|
757 - | .endpoint_operation(move |input: crate::input::EndpointOperationInput| {
|
758 - | let sender = sender.clone();
|
759 - | async move {
|
760 - | let result = {
|
761 - | let expected = crate::input::EndpointOperationInput {};
|
762 - | ::pretty_assertions::assert_eq!(input, expected);
|
763 - | let output = crate::output::EndpointOperationOutput {};
|
764 - | output
|
493 + | ::pretty_assertions::assert_eq!(
|
494 + | input.blob,
|
495 + | expected.blob,
|
496 + | "Unexpected value for `blob`"
|
497 + | );
|
498 + | ::pretty_assertions::assert_eq!(
|
499 + | input.boolean,
|
500 + | expected.boolean,
|
501 + | "Unexpected value for `boolean`"
|
502 + | );
|
503 + | assert!(
|
504 + | input.double.float_equals(&expected.double),
|
505 + | "Unexpected value for `double` {:?} vs. {:?}",
|
506 + | expected.double,
|
507 + | input.double
|
508 + | );
|
509 + | ::pretty_assertions::assert_eq!(
|
510 + | input.empty_struct,
|
511 + | expected.empty_struct,
|
512 + | "Unexpected value for `empty_struct`"
|
513 + | );
|
514 + | assert!(
|
515 + | input.float.float_equals(&expected.float),
|
516 + | "Unexpected value for `float` {:?} vs. {:?}",
|
517 + | expected.float,
|
518 + | input.float
|
519 + | );
|
520 + | ::pretty_assertions::assert_eq!(
|
521 + | input.httpdate_timestamp,
|
522 + | expected.httpdate_timestamp,
|
523 + | "Unexpected value for `httpdate_timestamp`"
|
524 + | );
|
525 + | ::pretty_assertions::assert_eq!(
|
526 + | input.integer,
|
527 + | expected.integer,
|
528 + | "Unexpected value for `integer`"
|
529 + | );
|
530 + | ::pretty_assertions::assert_eq!(
|
531 + | input.iso8601_timestamp,
|
532 + | expected.iso8601_timestamp,
|
533 + | "Unexpected value for `iso8601_timestamp`"
|
534 + | );
|
535 + | ::pretty_assertions::assert_eq!(
|
536 + | input.json_value,
|
537 + | expected.json_value,
|
538 + | "Unexpected value for `json_value`"
|
539 + | );
|
540 + | ::pretty_assertions::assert_eq!(
|
541 + | input.list_of_lists,
|
542 + | expected.list_of_lists,
|
543 + | "Unexpected value for `list_of_lists`"
|
544 + | );
|
545 + | ::pretty_assertions::assert_eq!(
|
546 + | input.list_of_maps_of_strings,
|
547 + | expected.list_of_maps_of_strings,
|
548 + | "Unexpected value for `list_of_maps_of_strings`"
|
549 + | );
|
550 + | ::pretty_assertions::assert_eq!(
|
551 + | input.list_of_strings,
|
552 + | expected.list_of_strings,
|
553 + | "Unexpected value for `list_of_strings`"
|
554 + | );
|
555 + | ::pretty_assertions::assert_eq!(
|
556 + | input.list_of_structs,
|
557 + | expected.list_of_structs,
|
558 + | "Unexpected value for `list_of_structs`"
|
559 + | );
|
560 + | ::pretty_assertions::assert_eq!(
|
561 + | input.long,
|
562 + | expected.long,
|
563 + | "Unexpected value for `long`"
|
564 + | );
|
565 + | ::pretty_assertions::assert_eq!(
|
566 + | input.map_of_lists_of_strings,
|
567 + | expected.map_of_lists_of_strings,
|
568 + | "Unexpected value for `map_of_lists_of_strings`"
|
569 + | );
|
570 + | ::pretty_assertions::assert_eq!(
|
571 + | input.map_of_maps,
|
572 + | expected.map_of_maps,
|
573 + | "Unexpected value for `map_of_maps`"
|
574 + | );
|
575 + | ::pretty_assertions::assert_eq!(
|
576 + | input.map_of_strings,
|
577 + | expected.map_of_strings,
|
578 + | "Unexpected value for `map_of_strings`"
|
579 + | );
|
580 + | ::pretty_assertions::assert_eq!(
|
581 + | input.map_of_structs,
|
582 + | expected.map_of_structs,
|
583 + | "Unexpected value for `map_of_structs`"
|
584 + | );
|
585 + | ::pretty_assertions::assert_eq!(
|
586 + | input.recursive_list,
|
587 + | expected.recursive_list,
|
588 + | "Unexpected value for `recursive_list`"
|
589 + | );
|
590 + | ::pretty_assertions::assert_eq!(
|
591 + | input.recursive_map,
|
592 + | expected.recursive_map,
|
593 + | "Unexpected value for `recursive_map`"
|
594 + | );
|
595 + | ::pretty_assertions::assert_eq!(
|
596 + | input.recursive_struct,
|
597 + | expected.recursive_struct,
|
598 + | "Unexpected value for `recursive_struct`"
|
599 + | );
|
600 + | ::pretty_assertions::assert_eq!(
|
601 + | input.simple_struct,
|
602 + | expected.simple_struct,
|
603 + | "Unexpected value for `simple_struct`"
|
604 + | );
|
605 + | ::pretty_assertions::assert_eq!(
|
606 + | input.string,
|
607 + | expected.string,
|
608 + | "Unexpected value for `string`"
|
609 + | );
|
610 + | ::pretty_assertions::assert_eq!(
|
611 + | input.struct_with_json_name,
|
612 + | expected.struct_with_json_name,
|
613 + | "Unexpected value for `struct_with_json_name`"
|
614 + | );
|
615 + | ::pretty_assertions::assert_eq!(
|
616 + | input.timestamp,
|
617 + | expected.timestamp,
|
618 + | "Unexpected value for `timestamp`"
|
619 + | );
|
620 + | ::pretty_assertions::assert_eq!(
|
621 + | input.unix_timestamp,
|
622 + | expected.unix_timestamp,
|
623 + | "Unexpected value for `unix_timestamp`"
|
624 + | );
|
625 + | let output = crate::output::KitchenSinkOperationOutput {
|
626 + | blob: ::std::option::Option::None,
|
627 + | boolean: ::std::option::Option::None,
|
628 + | double: ::std::option::Option::None,
|
629 + | empty_struct: ::std::option::Option::None,
|
630 + | float: ::std::option::Option::None,
|
631 + | httpdate_timestamp: ::std::option::Option::None,
|
632 + | integer: ::std::option::Option::None,
|
633 + | iso8601_timestamp: ::std::option::Option::None,
|
634 + | json_value: ::std::option::Option::None,
|
635 + | list_of_lists: ::std::option::Option::None,
|
636 + | list_of_maps_of_strings: ::std::option::Option::None,
|
637 + | list_of_strings: ::std::option::Option::None,
|
638 + | list_of_structs: ::std::option::Option::None,
|
639 + | long: ::std::option::Option::None,
|
640 + | map_of_lists_of_strings: ::std::option::Option::None,
|
641 + | map_of_maps: ::std::option::Option::None,
|
642 + | map_of_strings: ::std::option::Option::None,
|
643 + | map_of_structs: ::std::option::Option::None,
|
644 + | recursive_list: ::std::option::Option::None,
|
645 + | recursive_map: ::std::option::Option::None,
|
646 + | recursive_struct: ::std::option::Option::None,
|
647 + | simple_struct: ::std::option::Option::None,
|
648 + | string: ::std::option::Option::None,
|
649 + | struct_with_json_name: ::std::option::Option::None,
|
650 + | timestamp: ::std::option::Option::None,
|
651 + | unix_timestamp: ::std::option::Option::None,
|
652 + | };
|
653 + | Ok(output)
|
765 654 | };
|
766 655 | sender.send(()).await.expect("receiver dropped early");
|
767 656 | result
|
768 657 | }
|
769 658 | })
|
770 659 | .build_unchecked();
|
771 660 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
772 661 | .await
|
773 662 | .expect("unable to make an HTTP request");
|
774 663 | assert!(
|
775 664 | receiver.recv().await.is_some(),
|
776 665 | "we expected operation handler to be invoked but it was not entered"
|
777 666 | );
|
778 667 | }
|
779 - | }
|
780 - |
|
781 - | ::pin_project_lite::pin_project! {
|
782 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
783 - | /// [`JsonUnionsInput`](crate::input::JsonUnionsInput) using modelled bindings.
|
784 - | pub struct JsonUnionsInputFuture {
|
785 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::JsonUnionsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
786 - | }
|
787 - | }
|
788 - |
|
789 - | impl std::future::Future for JsonUnionsInputFuture {
|
790 - | type Output = Result<
|
791 - | crate::input::JsonUnionsInput,
|
792 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
793 - | >;
|
794 - |
|
795 - | fn poll(
|
796 - | self: std::pin::Pin<&mut Self>,
|
797 - | cx: &mut std::task::Context<'_>,
|
798 - | ) -> std::task::Poll<Self::Output> {
|
799 - | let this = self.project();
|
800 - | this.inner.as_mut().poll(cx)
|
801 - | }
|
802 - | }
|
803 668 |
|
804 - | impl<B>
|
805 - | ::aws_smithy_http_server::request::FromRequest<
|
806 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
807 - | B,
|
808 - | > for crate::input::JsonUnionsInput
|
809 - | where
|
810 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
811 - | B: 'static,
|
812 - |
|
813 - | B::Data: Send,
|
814 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
815 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
816 - | {
|
817 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
818 - | type Future = JsonUnionsInputFuture;
|
819 - |
|
820 - | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
821 - | let fut = async move {
|
822 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
823 - | request.headers(),
|
824 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
825 - | ) {
|
826 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
827 - | }
|
828 - | crate::protocol_serde::shape_json_unions::de_json_unions_http_request(request).await
|
829 - | };
|
830 - | use ::futures_util::future::TryFutureExt;
|
831 - | let fut = fut.map_err(
|
832 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
833 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
834 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
835 - | },
|
836 - | );
|
837 - | JsonUnionsInputFuture {
|
838 - | inner: Box::pin(fut),
|
839 - | }
|
840 - | }
|
841 - | }
|
842 - | impl
|
843 - | ::aws_smithy_http_server::response::IntoResponse<
|
844 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
845 - | > for crate::output::JsonUnionsOutput
|
846 - | {
|
847 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
848 - | match crate::protocol_serde::shape_json_unions::ser_json_unions_http_response(self) {
|
849 - | Ok(response) => response,
|
850 - | Err(e) => {
|
851 - | ::tracing::error!(error = %e, "failed to serialize response");
|
852 - | ::aws_smithy_http_server::response::IntoResponse::<
|
853 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
854 - | >::into_response(
|
855 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
856 - | e,
|
857 - | ),
|
858 - | )
|
859 - | }
|
860 - | }
|
861 - | }
|
862 - | }
|
863 - | impl
|
864 - | ::aws_smithy_http_server::response::IntoResponse<
|
865 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
866 - | > for crate::error::JsonUnionsError
|
867 - | {
|
868 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
869 - | match crate::protocol_serde::shape_json_unions::ser_json_unions_http_error(&self) {
|
870 - | Ok(mut response) => {
|
871 - | response.extensions_mut().insert(
|
872 - | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
873 - | );
|
874 - | response
|
875 - | }
|
876 - | Err(e) => {
|
877 - | ::tracing::error!(error = %e, "failed to serialize response");
|
878 - | ::aws_smithy_http_server::response::IntoResponse::<
|
879 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
880 - | >::into_response(
|
881 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
882 - | e,
|
883 - | ),
|
884 - | )
|
885 - | }
|
886 - | }
|
887 - | }
|
888 - | }
|
889 - |
|
890 - | #[allow(unreachable_code, unused_variables)]
|
891 - | #[cfg(test)]
|
892 - | mod json_unions_test {
|
893 - |
|
894 - | /// Serializes a string union value
|
895 - | /// Test ID: AwsJson11SerializeStringUnionValue
|
669 + | /// Serializes string shapes with jsonvalue trait
|
670 + | /// Test ID: serializes_string_shapes_with_jsonvalue_trait
|
896 671 | #[::tokio::test]
|
897 672 | #[::tracing_test::traced_test]
|
898 - | async fn aws_json11_serialize_string_union_value_request() {
|
673 + | async fn serializes_string_shapes_with_jsonvalue_trait_request() {
|
899 674 | #[allow(unused_mut)]
|
900 - | let mut http_request = ::http_1x::Request::builder()
|
901 - | .uri("/")
|
902 - | .method("POST")
|
903 - | .header("Content-Type", "application/x-amz-json-1.1")
|
904 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
905 - | .body(::aws_smithy_http_server::body::boxed(
|
906 - | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
907 - | &::aws_smithy_protocol_test::decode_body_data(
|
908 - | "{\n \"contents\": {\n \"stringValue\": \"foo\"\n }\n}"
|
909 - | .as_bytes(),
|
910 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
911 - | ),
|
912 - | )),
|
913 - | ))
|
914 - | .unwrap();
|
675 + | let mut http_request = ::http_1x::Request::builder()
|
676 + | .uri("/")
|
677 + | .method("POST")
|
678 + | .header("Content-Type", "application/x-amz-json-1.1")
|
679 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
680 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
681 + | ::bytes::Bytes::copy_from_slice(
|
682 + | &::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"))
|
683 + | )
|
684 + | ))).unwrap();
|
915 685 | #[allow(unused_mut)]
|
916 686 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
917 687 | let config = crate::service::JsonProtocolConfig::builder().build();
|
918 - | let service = crate::service::JsonProtocol::builder::<
|
919 - | ::aws_smithy_http_server::body::BoxBody,
|
920 - | _,
|
921 - | _,
|
922 - | _,
|
923 - | >(config)
|
924 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
925 - | let sender = sender.clone();
|
926 - | async move {
|
927 - | let result = {
|
928 - | let expected = crate::input::JsonUnionsInput {
|
929 - | contents: ::std::option::Option::Some(crate::model::MyUnion::StringValue(
|
930 - | "foo".to_owned(),
|
931 - | )),
|
932 - | };
|
933 - | ::pretty_assertions::assert_eq!(input, expected);
|
934 - | let output = crate::output::JsonUnionsOutput {
|
935 - | contents: ::std::option::Option::None,
|
936 - | };
|
937 - | Ok(output)
|
938 - | };
|
939 - | sender.send(()).await.expect("receiver dropped early");
|
940 - | result
|
688 + | let service = crate::service::JsonProtocol::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
689 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
690 + | let sender = sender.clone();
|
691 + | async move {
|
692 + | let result = { use ::aws_smithy_protocol_test::FloatEquals;
|
693 + | let expected =
|
694 + | crate::input::KitchenSinkOperationInput {
|
695 + | json_value:
|
696 + | ::std::option::Option::Some(
|
697 + | "{\"string\":\"value\",\"number\":1234.5,\"boolTrue\":true,\"boolFalse\":false,\"array\":[1,2,3,4],\"object\":{\"key\":\"value\"},\"null\":null}".to_owned()
|
698 + | )
|
699 + | ,
|
700 + | blob:
|
701 + | ::std::option::Option::None
|
702 + | ,
|
703 + | boolean:
|
704 + | ::std::option::Option::None
|
705 + | ,
|
706 + | double:
|
707 + | ::std::option::Option::None
|
708 + | ,
|
709 + | empty_struct:
|
710 + | ::std::option::Option::None
|
711 + | ,
|
712 + | float:
|
713 + | ::std::option::Option::None
|
714 + | ,
|
715 + | httpdate_timestamp:
|
716 + | ::std::option::Option::None
|
717 + | ,
|
718 + | integer:
|
719 + | ::std::option::Option::None
|
720 + | ,
|
721 + | iso8601_timestamp:
|
722 + | ::std::option::Option::None
|
723 + | ,
|
724 + | list_of_lists:
|
725 + | ::std::option::Option::None
|
726 + | ,
|
727 + | list_of_maps_of_strings:
|
728 + | ::std::option::Option::None
|
729 + | ,
|
730 + | list_of_strings:
|
731 + | ::std::option::Option::None
|
732 + | ,
|
733 + | list_of_structs:
|
734 + | ::std::option::Option::None
|
735 + | ,
|
736 + | long:
|
737 + | ::std::option::Option::None
|
738 + | ,
|
739 + | map_of_lists_of_strings:
|
740 + | ::std::option::Option::None
|
741 + | ,
|
742 + | map_of_maps:
|
743 + | ::std::option::Option::None
|
744 + | ,
|
745 + | map_of_strings:
|
746 + | ::std::option::Option::None
|
747 + | ,
|
748 + | map_of_structs:
|
749 + | ::std::option::Option::None
|
750 + | ,
|
751 + | recursive_list:
|
752 + | ::std::option::Option::None
|
753 + | ,
|
754 + | recursive_map:
|
755 + | ::std::option::Option::None
|
756 + | ,
|
757 + | recursive_struct:
|
758 + | ::std::option::Option::None
|
759 + | ,
|
760 + | simple_struct:
|
761 + | ::std::option::Option::None
|
762 + | ,
|
763 + | string:
|
764 + | ::std::option::Option::None
|
765 + | ,
|
766 + | struct_with_json_name:
|
767 + | ::std::option::Option::None
|
768 + | ,
|
769 + | timestamp:
|
770 + | ::std::option::Option::None
|
771 + | ,
|
772 + | unix_timestamp:
|
773 + | ::std::option::Option::None
|
774 + | ,
|
941 775 | }
|
942 - | })
|
943 - | .build_unchecked();
|
944 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
945 - | .await
|
946 - | .expect("unable to make an HTTP request");
|
947 - | assert!(
|
948 - | receiver.recv().await.is_some(),
|
949 - | "we expected operation handler to be invoked but it was not entered"
|
950 - | );
|
951 - | }
|
952 - |
|
953 - | /// Serializes a boolean union value
|
954 - | /// Test ID: AwsJson11SerializeBooleanUnionValue
|
955 - | #[::tokio::test]
|
956 - | #[::tracing_test::traced_test]
|
957 - | async fn aws_json11_serialize_boolean_union_value_request() {
|
958 - | #[allow(unused_mut)]
|
959 - | let mut http_request = ::http_1x::Request::builder()
|
960 - | .uri("/")
|
961 - | .method("POST")
|
962 - | .header("Content-Type", "application/x-amz-json-1.1")
|
963 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
964 - | .body(::aws_smithy_http_server::body::boxed(
|
965 - | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
966 - | &::aws_smithy_protocol_test::decode_body_data(
|
967 - | "{\n \"contents\": {\n \"booleanValue\": true\n }\n}"
|
968 - | .as_bytes(),
|
969 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
970 - | ),
|
971 - | )),
|
972 - | ))
|
973 - | .unwrap();
|
974 - | #[allow(unused_mut)]
|
975 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
976 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
977 - | let service = crate::service::JsonProtocol::builder::<
|
978 - | ::aws_smithy_http_server::body::BoxBody,
|
979 - | _,
|
980 - | _,
|
981 - | _,
|
982 - | >(config)
|
983 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
984 - | let sender = sender.clone();
|
985 - | async move {
|
986 - | let result = {
|
987 - | let expected = crate::input::JsonUnionsInput {
|
988 - | contents: ::std::option::Option::Some(crate::model::MyUnion::BooleanValue(
|
989 - | true,
|
990 - | )),
|
991 - | };
|
992 - | ::pretty_assertions::assert_eq!(input, expected);
|
993 - | let output = crate::output::JsonUnionsOutput {
|
994 - | contents: ::std::option::Option::None,
|
995 - | };
|
996 - | Ok(output)
|
997 - | };
|
998 - | sender.send(()).await.expect("receiver dropped early");
|
999 - | result
|
1000 - | }
|
1001 - | })
|
1002 - | .build_unchecked();
|
1003 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1004 - | .await
|
1005 - | .expect("unable to make an HTTP request");
|
1006 - | assert!(
|
1007 - | receiver.recv().await.is_some(),
|
1008 - | "we expected operation handler to be invoked but it was not entered"
|
1009 - | );
|
1010 - | }
|
1011 - |
|
1012 - | /// Serializes a number union value
|
1013 - | /// Test ID: AwsJson11SerializeNumberUnionValue
|
1014 - | #[::tokio::test]
|
1015 - | #[::tracing_test::traced_test]
|
1016 - | async fn aws_json11_serialize_number_union_value_request() {
|
1017 - | #[allow(unused_mut)]
|
1018 - | let mut http_request = ::http_1x::Request::builder()
|
1019 - | .uri("/")
|
1020 - | .method("POST")
|
1021 - | .header("Content-Type", "application/x-amz-json-1.1")
|
1022 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
1023 - | .body(::aws_smithy_http_server::body::boxed(
|
1024 - | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1025 - | &::aws_smithy_protocol_test::decode_body_data(
|
1026 - | "{\n \"contents\": {\n \"numberValue\": 1\n }\n}".as_bytes(),
|
1027 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1028 - | ),
|
1029 - | )),
|
1030 - | ))
|
1031 - | .unwrap();
|
1032 - | #[allow(unused_mut)]
|
1033 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1034 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
1035 - | let service = crate::service::JsonProtocol::builder::<
|
1036 - | ::aws_smithy_http_server::body::BoxBody,
|
1037 - | _,
|
1038 - | _,
|
1039 - | _,
|
1040 - | >(config)
|
1041 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1042 - | let sender = sender.clone();
|
1043 - | async move {
|
1044 - | let result = {
|
1045 - | let expected = crate::input::JsonUnionsInput {
|
1046 - | contents: ::std::option::Option::Some(crate::model::MyUnion::NumberValue(
|
1047 - | 1,
|
1048 - | )),
|
1049 - | };
|
1050 - | ::pretty_assertions::assert_eq!(input, expected);
|
1051 - | let output = crate::output::JsonUnionsOutput {
|
1052 - | contents: ::std::option::Option::None,
|
1053 - | };
|
1054 - | Ok(output)
|
1055 - | };
|
1056 - | sender.send(()).await.expect("receiver dropped early");
|
1057 - | result
|
776 + | ;
|
777 + | ::pretty_assertions::assert_eq!(input.blob, expected.blob, "Unexpected value for `blob`");
|
778 + | ::pretty_assertions::assert_eq!(input.boolean, expected.boolean, "Unexpected value for `boolean`");
|
779 + | assert!(input.double.float_equals(&expected.double),
|
780 + | "Unexpected value for `double` {:?} vs. {:?}", expected.double, input.double);
|
781 + | ::pretty_assertions::assert_eq!(input.empty_struct, expected.empty_struct, "Unexpected value for `empty_struct`");
|
782 + | assert!(input.float.float_equals(&expected.float),
|
783 + | "Unexpected value for `float` {:?} vs. {:?}", expected.float, input.float);
|
784 + | ::pretty_assertions::assert_eq!(input.httpdate_timestamp, expected.httpdate_timestamp, "Unexpected value for `httpdate_timestamp`");
|
785 + | ::pretty_assertions::assert_eq!(input.integer, expected.integer, "Unexpected value for `integer`");
|
786 + | ::pretty_assertions::assert_eq!(input.iso8601_timestamp, expected.iso8601_timestamp, "Unexpected value for `iso8601_timestamp`");
|
787 + | ::pretty_assertions::assert_eq!(input.json_value, expected.json_value, "Unexpected value for `json_value`");
|
788 + | ::pretty_assertions::assert_eq!(input.list_of_lists, expected.list_of_lists, "Unexpected value for `list_of_lists`");
|
789 + | ::pretty_assertions::assert_eq!(input.list_of_maps_of_strings, expected.list_of_maps_of_strings, "Unexpected value for `list_of_maps_of_strings`");
|
790 + | ::pretty_assertions::assert_eq!(input.list_of_strings, expected.list_of_strings, "Unexpected value for `list_of_strings`");
|
791 + | ::pretty_assertions::assert_eq!(input.list_of_structs, expected.list_of_structs, "Unexpected value for `list_of_structs`");
|
792 + | ::pretty_assertions::assert_eq!(input.long, expected.long, "Unexpected value for `long`");
|
793 + | ::pretty_assertions::assert_eq!(input.map_of_lists_of_strings, expected.map_of_lists_of_strings, "Unexpected value for `map_of_lists_of_strings`");
|
794 + | ::pretty_assertions::assert_eq!(input.map_of_maps, expected.map_of_maps, "Unexpected value for `map_of_maps`");
|
795 + | ::pretty_assertions::assert_eq!(input.map_of_strings, expected.map_of_strings, "Unexpected value for `map_of_strings`");
|
796 + | ::pretty_assertions::assert_eq!(input.map_of_structs, expected.map_of_structs, "Unexpected value for `map_of_structs`");
|
797 + | ::pretty_assertions::assert_eq!(input.recursive_list, expected.recursive_list, "Unexpected value for `recursive_list`");
|
798 + | ::pretty_assertions::assert_eq!(input.recursive_map, expected.recursive_map, "Unexpected value for `recursive_map`");
|
799 + | ::pretty_assertions::assert_eq!(input.recursive_struct, expected.recursive_struct, "Unexpected value for `recursive_struct`");
|
800 + | ::pretty_assertions::assert_eq!(input.simple_struct, expected.simple_struct, "Unexpected value for `simple_struct`");
|
801 + | ::pretty_assertions::assert_eq!(input.string, expected.string, "Unexpected value for `string`");
|
802 + | ::pretty_assertions::assert_eq!(input.struct_with_json_name, expected.struct_with_json_name, "Unexpected value for `struct_with_json_name`");
|
803 + | ::pretty_assertions::assert_eq!(input.timestamp, expected.timestamp, "Unexpected value for `timestamp`");
|
804 + | ::pretty_assertions::assert_eq!(input.unix_timestamp, expected.unix_timestamp, "Unexpected value for `unix_timestamp`");
|
805 + | let output =
|
806 + | crate::output::KitchenSinkOperationOutput {
|
807 + | blob:
|
808 + | ::std::option::Option::None
|
809 + | ,
|
810 + | boolean:
|
811 + | ::std::option::Option::None
|
812 + | ,
|
813 + | double:
|
814 + | ::std::option::Option::None
|
815 + | ,
|
816 + | empty_struct:
|
817 + | ::std::option::Option::None
|
818 + | ,
|
819 + | float:
|
820 + | ::std::option::Option::None
|
821 + | ,
|
822 + | httpdate_timestamp:
|
823 + | ::std::option::Option::None
|
824 + | ,
|
825 + | integer:
|
826 + | ::std::option::Option::None
|
827 + | ,
|
828 + | iso8601_timestamp:
|
829 + | ::std::option::Option::None
|
830 + | ,
|
831 + | json_value:
|
832 + | ::std::option::Option::None
|
833 + | ,
|
834 + | list_of_lists:
|
835 + | ::std::option::Option::None
|
836 + | ,
|
837 + | list_of_maps_of_strings:
|
838 + | ::std::option::Option::None
|
839 + | ,
|
840 + | list_of_strings:
|
841 + | ::std::option::Option::None
|
842 + | ,
|
843 + | list_of_structs:
|
844 + | ::std::option::Option::None
|
845 + | ,
|
846 + | long:
|
847 + | ::std::option::Option::None
|
848 + | ,
|
849 + | map_of_lists_of_strings:
|
850 + | ::std::option::Option::None
|
851 + | ,
|
852 + | map_of_maps:
|
853 + | ::std::option::Option::None
|
854 + | ,
|
855 + | map_of_strings:
|
856 + | ::std::option::Option::None
|
857 + | ,
|
858 + | map_of_structs:
|
859 + | ::std::option::Option::None
|
860 + | ,
|
861 + | recursive_list:
|
862 + | ::std::option::Option::None
|
863 + | ,
|
864 + | recursive_map:
|
865 + | ::std::option::Option::None
|
866 + | ,
|
867 + | recursive_struct:
|
868 + | ::std::option::Option::None
|
869 + | ,
|
870 + | simple_struct:
|
871 + | ::std::option::Option::None
|
872 + | ,
|
873 + | string:
|
874 + | ::std::option::Option::None
|
875 + | ,
|
876 + | struct_with_json_name:
|
877 + | ::std::option::Option::None
|
878 + | ,
|
879 + | timestamp:
|
880 + | ::std::option::Option::None
|
881 + | ,
|
882 + | unix_timestamp:
|
883 + | ::std::option::Option::None
|
884 + | ,
|
1058 885 | }
|
1059 - | })
|
1060 - | .build_unchecked();
|
886 + | ;
|
887 + | Ok(output) };
|
888 + | sender.send(()).await.expect("receiver dropped early");
|
889 + | result
|
890 + | }
|
891 + | })
|
892 + | .build_unchecked();
|
1061 893 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1062 894 | .await
|
1063 895 | .expect("unable to make an HTTP request");
|
1064 896 | assert!(
|
1065 897 | receiver.recv().await.is_some(),
|
1066 898 | "we expected operation handler to be invoked but it was not entered"
|
1067 899 | );
|
1068 900 | }
|
1069 901 |
|
1070 - | /// Serializes a blob union value
|
1071 - | /// Test ID: AwsJson11SerializeBlobUnionValue
|
902 + | /// Serializes integer shapes
|
903 + | /// Test ID: serializes_integer_shapes
|
1072 904 | #[::tokio::test]
|
1073 905 | #[::tracing_test::traced_test]
|
1074 - | async fn aws_json11_serialize_blob_union_value_request() {
|
906 + | async fn serializes_integer_shapes_request() {
|
1075 907 | #[allow(unused_mut)]
|
1076 908 | let mut http_request = ::http_1x::Request::builder()
|
1077 909 | .uri("/")
|
1078 910 | .method("POST")
|
1079 911 | .header("Content-Type", "application/x-amz-json-1.1")
|
1080 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
912 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
1081 913 | .body(::aws_smithy_http_server::body::boxed(
|
1082 914 | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1083 915 | &::aws_smithy_protocol_test::decode_body_data(
|
1084 - | "{\n \"contents\": {\n \"blobValue\": \"Zm9v\"\n }\n}"
|
1085 - | .as_bytes(),
|
916 + | "{\"Integer\":1234}".as_bytes(),
|
1086 917 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1087 918 | ),
|
1088 919 | )),
|
1089 920 | ))
|
1090 921 | .unwrap();
|
1091 922 | #[allow(unused_mut)]
|
1092 923 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1093 924 | let config = crate::service::JsonProtocolConfig::builder().build();
|
1094 925 | let service = crate::service::JsonProtocol::builder::<
|
1095 926 | ::aws_smithy_http_server::body::BoxBody,
|
1096 927 | _,
|
1097 928 | _,
|
1098 929 | _,
|
1099 930 | >(config)
|
1100 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
931 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
1101 932 | let sender = sender.clone();
|
1102 933 | async move {
|
1103 934 | let result = {
|
1104 - | let expected = crate::input::JsonUnionsInput {
|
1105 - | contents: ::std::option::Option::Some(crate::model::MyUnion::BlobValue(
|
1106 - | ::aws_smithy_types::Blob::new("foo"),
|
1107 - | )),
|
1108 - | };
|
1109 - | ::pretty_assertions::assert_eq!(input, expected);
|
1110 - | let output = crate::output::JsonUnionsOutput {
|
1111 - | contents: ::std::option::Option::None,
|
935 + | use ::aws_smithy_protocol_test::FloatEquals;
|
936 + | let expected = crate::input::KitchenSinkOperationInput {
|
937 + | integer: ::std::option::Option::Some(1234),
|
938 + | blob: ::std::option::Option::None,
|
939 + | boolean: ::std::option::Option::None,
|
940 + | double: ::std::option::Option::None,
|
941 + | empty_struct: ::std::option::Option::None,
|
942 + | float: ::std::option::Option::None,
|
943 + | httpdate_timestamp: ::std::option::Option::None,
|
944 + | iso8601_timestamp: ::std::option::Option::None,
|
945 + | json_value: ::std::option::Option::None,
|
946 + | list_of_lists: ::std::option::Option::None,
|
947 + | list_of_maps_of_strings: ::std::option::Option::None,
|
948 + | list_of_strings: ::std::option::Option::None,
|
949 + | list_of_structs: ::std::option::Option::None,
|
950 + | long: ::std::option::Option::None,
|
951 + | map_of_lists_of_strings: ::std::option::Option::None,
|
952 + | map_of_maps: ::std::option::Option::None,
|
953 + | map_of_strings: ::std::option::Option::None,
|
954 + | map_of_structs: ::std::option::Option::None,
|
955 + | recursive_list: ::std::option::Option::None,
|
956 + | recursive_map: ::std::option::Option::None,
|
957 + | recursive_struct: ::std::option::Option::None,
|
958 + | simple_struct: ::std::option::Option::None,
|
959 + | string: ::std::option::Option::None,
|
960 + | struct_with_json_name: ::std::option::Option::None,
|
961 + | timestamp: ::std::option::Option::None,
|
962 + | unix_timestamp: ::std::option::Option::None,
|
1112 963 | };
|
1113 - | Ok(output)
|
1114 - | };
|
1115 - | sender.send(()).await.expect("receiver dropped early");
|
1116 - | result
|
1117 - | }
|
1118 - | })
|
1119 - | .build_unchecked();
|
1120 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1121 - | .await
|
1122 - | .expect("unable to make an HTTP request");
|
1123 - | assert!(
|
1124 - | receiver.recv().await.is_some(),
|
1125 - | "we expected operation handler to be invoked but it was not entered"
|
1126 - | );
|
1127 - | }
|
1128 - |
|
1129 - | /// Serializes a timestamp union value
|
1130 - | /// Test ID: AwsJson11SerializeTimestampUnionValue
|
1131 - | #[::tokio::test]
|
1132 - | #[::tracing_test::traced_test]
|
1133 - | async fn aws_json11_serialize_timestamp_union_value_request() {
|
1134 - | #[allow(unused_mut)]
|
1135 - | let mut http_request = ::http_1x::Request::builder()
|
1136 - | .uri("/")
|
1137 - | .method("POST")
|
1138 - | .header("Content-Type", "application/x-amz-json-1.1")
|
1139 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
1140 - | .body(::aws_smithy_http_server::body::boxed(
|
1141 - | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1142 - | &::aws_smithy_protocol_test::decode_body_data(
|
1143 - | "{\n \"contents\": {\n \"timestampValue\": 1398796238\n }\n}"
|
1144 - | .as_bytes(),
|
1145 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1146 - | ),
|
1147 - | )),
|
1148 - | ))
|
1149 - | .unwrap();
|
1150 - | #[allow(unused_mut)]
|
1151 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1152 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
1153 - | let service = crate::service::JsonProtocol::builder::<
|
1154 - | ::aws_smithy_http_server::body::BoxBody,
|
1155 - | _,
|
1156 - | _,
|
1157 - | _,
|
1158 - | >(config)
|
1159 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1160 - | let sender = sender.clone();
|
1161 - | async move {
|
1162 - | let result = {
|
1163 - | let expected = crate::input::JsonUnionsInput {
|
1164 - | contents: ::std::option::Option::Some(
|
1165 - | crate::model::MyUnion::TimestampValue(
|
1166 - | ::aws_smithy_types::DateTime::from_fractional_secs(
|
1167 - | 1398796238, 0_f64,
|
1168 - | ),
|
1169 - | ),
|
1170 - | ),
|
1171 - | };
|
1172 - | ::pretty_assertions::assert_eq!(input, expected);
|
1173 - | let output = crate::output::JsonUnionsOutput {
|
1174 - | contents: ::std::option::Option::None,
|
964 + | ::pretty_assertions::assert_eq!(
|
965 + | input.blob,
|
966 + | expected.blob,
|
967 + | "Unexpected value for `blob`"
|
968 + | );
|
969 + | ::pretty_assertions::assert_eq!(
|
970 + | input.boolean,
|
971 + | expected.boolean,
|
972 + | "Unexpected value for `boolean`"
|
973 + | );
|
974 + | assert!(
|
975 + | input.double.float_equals(&expected.double),
|
976 + | "Unexpected value for `double` {:?} vs. {:?}",
|
977 + | expected.double,
|
978 + | input.double
|
979 + | );
|
980 + | ::pretty_assertions::assert_eq!(
|
981 + | input.empty_struct,
|
982 + | expected.empty_struct,
|
983 + | "Unexpected value for `empty_struct`"
|
984 + | );
|
985 + | assert!(
|
986 + | input.float.float_equals(&expected.float),
|
987 + | "Unexpected value for `float` {:?} vs. {:?}",
|
988 + | expected.float,
|
989 + | input.float
|
990 + | );
|
991 + | ::pretty_assertions::assert_eq!(
|
992 + | input.httpdate_timestamp,
|
993 + | expected.httpdate_timestamp,
|
994 + | "Unexpected value for `httpdate_timestamp`"
|
995 + | );
|
996 + | ::pretty_assertions::assert_eq!(
|
997 + | input.integer,
|
998 + | expected.integer,
|
999 + | "Unexpected value for `integer`"
|
1000 + | );
|
1001 + | ::pretty_assertions::assert_eq!(
|
1002 + | input.iso8601_timestamp,
|
1003 + | expected.iso8601_timestamp,
|
1004 + | "Unexpected value for `iso8601_timestamp`"
|
1005 + | );
|
1006 + | ::pretty_assertions::assert_eq!(
|
1007 + | input.json_value,
|
1008 + | expected.json_value,
|
1009 + | "Unexpected value for `json_value`"
|
1010 + | );
|
1011 + | ::pretty_assertions::assert_eq!(
|
1012 + | input.list_of_lists,
|
1013 + | expected.list_of_lists,
|
1014 + | "Unexpected value for `list_of_lists`"
|
1015 + | );
|
1016 + | ::pretty_assertions::assert_eq!(
|
1017 + | input.list_of_maps_of_strings,
|
1018 + | expected.list_of_maps_of_strings,
|
1019 + | "Unexpected value for `list_of_maps_of_strings`"
|
1020 + | );
|
1021 + | ::pretty_assertions::assert_eq!(
|
1022 + | input.list_of_strings,
|
1023 + | expected.list_of_strings,
|
1024 + | "Unexpected value for `list_of_strings`"
|
1025 + | );
|
1026 + | ::pretty_assertions::assert_eq!(
|
1027 + | input.list_of_structs,
|
1028 + | expected.list_of_structs,
|
1029 + | "Unexpected value for `list_of_structs`"
|
1030 + | );
|
1031 + | ::pretty_assertions::assert_eq!(
|
1032 + | input.long,
|
1033 + | expected.long,
|
1034 + | "Unexpected value for `long`"
|
1035 + | );
|
1036 + | ::pretty_assertions::assert_eq!(
|
1037 + | input.map_of_lists_of_strings,
|
1038 + | expected.map_of_lists_of_strings,
|
1039 + | "Unexpected value for `map_of_lists_of_strings`"
|
1040 + | );
|
1041 + | ::pretty_assertions::assert_eq!(
|
1042 + | input.map_of_maps,
|
1043 + | expected.map_of_maps,
|
1044 + | "Unexpected value for `map_of_maps`"
|
1045 + | );
|
1046 + | ::pretty_assertions::assert_eq!(
|
1047 + | input.map_of_strings,
|
1048 + | expected.map_of_strings,
|
1049 + | "Unexpected value for `map_of_strings`"
|
1050 + | );
|
1051 + | ::pretty_assertions::assert_eq!(
|
1052 + | input.map_of_structs,
|
1053 + | expected.map_of_structs,
|
1054 + | "Unexpected value for `map_of_structs`"
|
1055 + | );
|
1056 + | ::pretty_assertions::assert_eq!(
|
1057 + | input.recursive_list,
|
1058 + | expected.recursive_list,
|
1059 + | "Unexpected value for `recursive_list`"
|
1060 + | );
|
1061 + | ::pretty_assertions::assert_eq!(
|
1062 + | input.recursive_map,
|
1063 + | expected.recursive_map,
|
1064 + | "Unexpected value for `recursive_map`"
|
1065 + | );
|
1066 + | ::pretty_assertions::assert_eq!(
|
1067 + | input.recursive_struct,
|
1068 + | expected.recursive_struct,
|
1069 + | "Unexpected value for `recursive_struct`"
|
1070 + | );
|
1071 + | ::pretty_assertions::assert_eq!(
|
1072 + | input.simple_struct,
|
1073 + | expected.simple_struct,
|
1074 + | "Unexpected value for `simple_struct`"
|
1075 + | );
|
1076 + | ::pretty_assertions::assert_eq!(
|
1077 + | input.string,
|
1078 + | expected.string,
|
1079 + | "Unexpected value for `string`"
|
1080 + | );
|
1081 + | ::pretty_assertions::assert_eq!(
|
1082 + | input.struct_with_json_name,
|
1083 + | expected.struct_with_json_name,
|
1084 + | "Unexpected value for `struct_with_json_name`"
|
1085 + | );
|
1086 + | ::pretty_assertions::assert_eq!(
|
1087 + | input.timestamp,
|
1088 + | expected.timestamp,
|
1089 + | "Unexpected value for `timestamp`"
|
1090 + | );
|
1091 + | ::pretty_assertions::assert_eq!(
|
1092 + | input.unix_timestamp,
|
1093 + | expected.unix_timestamp,
|
1094 + | "Unexpected value for `unix_timestamp`"
|
1095 + | );
|
1096 + | let output = crate::output::KitchenSinkOperationOutput {
|
1097 + | blob: ::std::option::Option::None,
|
1098 + | boolean: ::std::option::Option::None,
|
1099 + | double: ::std::option::Option::None,
|
1100 + | empty_struct: ::std::option::Option::None,
|
1101 + | float: ::std::option::Option::None,
|
1102 + | httpdate_timestamp: ::std::option::Option::None,
|
1103 + | integer: ::std::option::Option::None,
|
1104 + | iso8601_timestamp: ::std::option::Option::None,
|
1105 + | json_value: ::std::option::Option::None,
|
1106 + | list_of_lists: ::std::option::Option::None,
|
1107 + | list_of_maps_of_strings: ::std::option::Option::None,
|
1108 + | list_of_strings: ::std::option::Option::None,
|
1109 + | list_of_structs: ::std::option::Option::None,
|
1110 + | long: ::std::option::Option::None,
|
1111 + | map_of_lists_of_strings: ::std::option::Option::None,
|
1112 + | map_of_maps: ::std::option::Option::None,
|
1113 + | map_of_strings: ::std::option::Option::None,
|
1114 + | map_of_structs: ::std::option::Option::None,
|
1115 + | recursive_list: ::std::option::Option::None,
|
1116 + | recursive_map: ::std::option::Option::None,
|
1117 + | recursive_struct: ::std::option::Option::None,
|
1118 + | simple_struct: ::std::option::Option::None,
|
1119 + | string: ::std::option::Option::None,
|
1120 + | struct_with_json_name: ::std::option::Option::None,
|
1121 + | timestamp: ::std::option::Option::None,
|
1122 + | unix_timestamp: ::std::option::Option::None,
|
1175 1123 | };
|
1176 1124 | Ok(output)
|
1177 1125 | };
|
1178 1126 | sender.send(()).await.expect("receiver dropped early");
|
1179 1127 | result
|
1180 1128 | }
|
1181 1129 | })
|
1182 1130 | .build_unchecked();
|
1183 1131 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1184 1132 | .await
|
1185 1133 | .expect("unable to make an HTTP request");
|
1186 1134 | assert!(
|
1187 1135 | receiver.recv().await.is_some(),
|
1188 1136 | "we expected operation handler to be invoked but it was not entered"
|
1189 1137 | );
|
1190 1138 | }
|
1191 1139 |
|
1192 - | /// Serializes an enum union value
|
1193 - | /// Test ID: AwsJson11SerializeEnumUnionValue
|
1140 + | /// Serializes long shapes
|
1141 + | /// Test ID: serializes_long_shapes
|
1194 1142 | #[::tokio::test]
|
1195 1143 | #[::tracing_test::traced_test]
|
1196 - | async fn aws_json11_serialize_enum_union_value_request() {
|
1144 + | async fn serializes_long_shapes_request() {
|
1197 1145 | #[allow(unused_mut)]
|
1198 1146 | let mut http_request = ::http_1x::Request::builder()
|
1199 1147 | .uri("/")
|
1200 1148 | .method("POST")
|
1201 1149 | .header("Content-Type", "application/x-amz-json-1.1")
|
1202 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
1150 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
1203 1151 | .body(::aws_smithy_http_server::body::boxed(
|
1204 1152 | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1205 1153 | &::aws_smithy_protocol_test::decode_body_data(
|
1206 - | "{\n \"contents\": {\n \"enumValue\": \"Foo\"\n }\n}"
|
1207 - | .as_bytes(),
|
1154 + | "{\"Long\":999999999999}".as_bytes(),
|
1208 1155 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1209 1156 | ),
|
1210 1157 | )),
|
1211 1158 | ))
|
1212 1159 | .unwrap();
|
1213 1160 | #[allow(unused_mut)]
|
1214 1161 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1215 1162 | let config = crate::service::JsonProtocolConfig::builder().build();
|
1216 1163 | let service = crate::service::JsonProtocol::builder::<
|
1217 1164 | ::aws_smithy_http_server::body::BoxBody,
|
1218 1165 | _,
|
1219 1166 | _,
|
1220 1167 | _,
|
1221 1168 | >(config)
|
1222 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1169 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
1223 1170 | let sender = sender.clone();
|
1224 1171 | async move {
|
1225 1172 | let result = {
|
1226 - | let expected = crate::input::JsonUnionsInput {
|
1227 - | contents: ::std::option::Option::Some(crate::model::MyUnion::EnumValue(
|
1228 - | "Foo"
|
1229 - | .parse::<crate::model::FooEnum>()
|
1230 - | .expect("static value validated to member"),
|
1231 - | )),
|
1232 - | };
|
1233 - | ::pretty_assertions::assert_eq!(input, expected);
|
1234 - | let output = crate::output::JsonUnionsOutput {
|
1235 - | contents: ::std::option::Option::None,
|
1236 - | };
|
1237 - | Ok(output)
|
1238 - | };
|
1239 - | sender.send(()).await.expect("receiver dropped early");
|
1240 - | result
|
1241 - | }
|
1242 - | })
|
1243 - | .build_unchecked();
|
1244 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1245 - | .await
|
1246 - | .expect("unable to make an HTTP request");
|
1247 - | assert!(
|
1248 - | receiver.recv().await.is_some(),
|
1249 - | "we expected operation handler to be invoked but it was not entered"
|
1250 - | );
|
1251 - | }
|
1252 - |
|
1253 - | /// Serializes a list union value
|
1254 - | /// Test ID: AwsJson11SerializeListUnionValue
|
1255 - | #[::tokio::test]
|
1256 - | #[::tracing_test::traced_test]
|
1257 - | async fn aws_json11_serialize_list_union_value_request() {
|
1258 - | #[allow(unused_mut)]
|
1259 - | let mut http_request = ::http_1x::Request::builder()
|
1260 - | .uri("/")
|
1261 - | .method("POST")
|
1262 - | .header("Content-Type", "application/x-amz-json-1.1")
|
1263 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
1264 - | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
1265 - | ::bytes::Bytes::copy_from_slice(
|
1266 - | &::aws_smithy_protocol_test::decode_body_data("{\n \"contents\": {\n \"listValue\": [\"foo\", \"bar\"]\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1267 - | )
|
1268 - | ))).unwrap();
|
1269 - | #[allow(unused_mut)]
|
1270 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1271 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
1272 - | let service = crate::service::JsonProtocol::builder::<
|
1273 - | ::aws_smithy_http_server::body::BoxBody,
|
1274 - | _,
|
1275 - | _,
|
1276 - | _,
|
1277 - | >(config)
|
1278 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1279 - | let sender = sender.clone();
|
1280 - | async move {
|
1281 - | let result = {
|
1282 - | let expected = crate::input::JsonUnionsInput {
|
1283 - | contents: ::std::option::Option::Some(crate::model::MyUnion::ListValue(
|
1284 - | vec!["foo".to_owned(), "bar".to_owned()],
|
1285 - | )),
|
1173 + | use ::aws_smithy_protocol_test::FloatEquals;
|
1174 + | let expected = crate::input::KitchenSinkOperationInput {
|
1175 + | long: ::std::option::Option::Some(999999999999),
|
1176 + | blob: ::std::option::Option::None,
|
1177 + | boolean: ::std::option::Option::None,
|
1178 + | double: ::std::option::Option::None,
|
1179 + | empty_struct: ::std::option::Option::None,
|
1180 + | float: ::std::option::Option::None,
|
1181 + | httpdate_timestamp: ::std::option::Option::None,
|
1182 + | integer: ::std::option::Option::None,
|
1183 + | iso8601_timestamp: ::std::option::Option::None,
|
1184 + | json_value: ::std::option::Option::None,
|
1185 + | list_of_lists: ::std::option::Option::None,
|
1186 + | list_of_maps_of_strings: ::std::option::Option::None,
|
1187 + | list_of_strings: ::std::option::Option::None,
|
1188 + | list_of_structs: ::std::option::Option::None,
|
1189 + | map_of_lists_of_strings: ::std::option::Option::None,
|
1190 + | map_of_maps: ::std::option::Option::None,
|
1191 + | map_of_strings: ::std::option::Option::None,
|
1192 + | map_of_structs: ::std::option::Option::None,
|
1193 + | recursive_list: ::std::option::Option::None,
|
1194 + | recursive_map: ::std::option::Option::None,
|
1195 + | recursive_struct: ::std::option::Option::None,
|
1196 + | simple_struct: ::std::option::Option::None,
|
1197 + | string: ::std::option::Option::None,
|
1198 + | struct_with_json_name: ::std::option::Option::None,
|
1199 + | timestamp: ::std::option::Option::None,
|
1200 + | unix_timestamp: ::std::option::Option::None,
|
1286 1201 | };
|
1287 - | ::pretty_assertions::assert_eq!(input, expected);
|
1288 - | let output = crate::output::JsonUnionsOutput {
|
1289 - | contents: ::std::option::Option::None,
|
1202 + | ::pretty_assertions::assert_eq!(
|
1203 + | input.blob,
|
1204 + | expected.blob,
|
1205 + | "Unexpected value for `blob`"
|
1206 + | );
|
1207 + | ::pretty_assertions::assert_eq!(
|
1208 + | input.boolean,
|
1209 + | expected.boolean,
|
1210 + | "Unexpected value for `boolean`"
|
1211 + | );
|
1212 + | assert!(
|
1213 + | input.double.float_equals(&expected.double),
|
1214 + | "Unexpected value for `double` {:?} vs. {:?}",
|
1215 + | expected.double,
|
1216 + | input.double
|
1217 + | );
|
1218 + | ::pretty_assertions::assert_eq!(
|
1219 + | input.empty_struct,
|
1220 + | expected.empty_struct,
|
1221 + | "Unexpected value for `empty_struct`"
|
1222 + | );
|
1223 + | assert!(
|
1224 + | input.float.float_equals(&expected.float),
|
1225 + | "Unexpected value for `float` {:?} vs. {:?}",
|
1226 + | expected.float,
|
1227 + | input.float
|
1228 + | );
|
1229 + | ::pretty_assertions::assert_eq!(
|
1230 + | input.httpdate_timestamp,
|
1231 + | expected.httpdate_timestamp,
|
1232 + | "Unexpected value for `httpdate_timestamp`"
|
1233 + | );
|
1234 + | ::pretty_assertions::assert_eq!(
|
1235 + | input.integer,
|
1236 + | expected.integer,
|
1237 + | "Unexpected value for `integer`"
|
1238 + | );
|
1239 + | ::pretty_assertions::assert_eq!(
|
1240 + | input.iso8601_timestamp,
|
1241 + | expected.iso8601_timestamp,
|
1242 + | "Unexpected value for `iso8601_timestamp`"
|
1243 + | );
|
1244 + | ::pretty_assertions::assert_eq!(
|
1245 + | input.json_value,
|
1246 + | expected.json_value,
|
1247 + | "Unexpected value for `json_value`"
|
1248 + | );
|
1249 + | ::pretty_assertions::assert_eq!(
|
1250 + | input.list_of_lists,
|
1251 + | expected.list_of_lists,
|
1252 + | "Unexpected value for `list_of_lists`"
|
1253 + | );
|
1254 + | ::pretty_assertions::assert_eq!(
|
1255 + | input.list_of_maps_of_strings,
|
1256 + | expected.list_of_maps_of_strings,
|
1257 + | "Unexpected value for `list_of_maps_of_strings`"
|
1258 + | );
|
1259 + | ::pretty_assertions::assert_eq!(
|
1260 + | input.list_of_strings,
|
1261 + | expected.list_of_strings,
|
1262 + | "Unexpected value for `list_of_strings`"
|
1263 + | );
|
1264 + | ::pretty_assertions::assert_eq!(
|
1265 + | input.list_of_structs,
|
1266 + | expected.list_of_structs,
|
1267 + | "Unexpected value for `list_of_structs`"
|
1268 + | );
|
1269 + | ::pretty_assertions::assert_eq!(
|
1270 + | input.long,
|
1271 + | expected.long,
|
1272 + | "Unexpected value for `long`"
|
1273 + | );
|
1274 + | ::pretty_assertions::assert_eq!(
|
1275 + | input.map_of_lists_of_strings,
|
1276 + | expected.map_of_lists_of_strings,
|
1277 + | "Unexpected value for `map_of_lists_of_strings`"
|
1278 + | );
|
1279 + | ::pretty_assertions::assert_eq!(
|
1280 + | input.map_of_maps,
|
1281 + | expected.map_of_maps,
|
1282 + | "Unexpected value for `map_of_maps`"
|
1283 + | );
|
1284 + | ::pretty_assertions::assert_eq!(
|
1285 + | input.map_of_strings,
|
1286 + | expected.map_of_strings,
|
1287 + | "Unexpected value for `map_of_strings`"
|
1288 + | );
|
1289 + | ::pretty_assertions::assert_eq!(
|
1290 + | input.map_of_structs,
|
1291 + | expected.map_of_structs,
|
1292 + | "Unexpected value for `map_of_structs`"
|
1293 + | );
|
1294 + | ::pretty_assertions::assert_eq!(
|
1295 + | input.recursive_list,
|
1296 + | expected.recursive_list,
|
1297 + | "Unexpected value for `recursive_list`"
|
1298 + | );
|
1299 + | ::pretty_assertions::assert_eq!(
|
1300 + | input.recursive_map,
|
1301 + | expected.recursive_map,
|
1302 + | "Unexpected value for `recursive_map`"
|
1303 + | );
|
1304 + | ::pretty_assertions::assert_eq!(
|
1305 + | input.recursive_struct,
|
1306 + | expected.recursive_struct,
|
1307 + | "Unexpected value for `recursive_struct`"
|
1308 + | );
|
1309 + | ::pretty_assertions::assert_eq!(
|
1310 + | input.simple_struct,
|
1311 + | expected.simple_struct,
|
1312 + | "Unexpected value for `simple_struct`"
|
1313 + | );
|
1314 + | ::pretty_assertions::assert_eq!(
|
1315 + | input.string,
|
1316 + | expected.string,
|
1317 + | "Unexpected value for `string`"
|
1318 + | );
|
1319 + | ::pretty_assertions::assert_eq!(
|
1320 + | input.struct_with_json_name,
|
1321 + | expected.struct_with_json_name,
|
1322 + | "Unexpected value for `struct_with_json_name`"
|
1323 + | );
|
1324 + | ::pretty_assertions::assert_eq!(
|
1325 + | input.timestamp,
|
1326 + | expected.timestamp,
|
1327 + | "Unexpected value for `timestamp`"
|
1328 + | );
|
1329 + | ::pretty_assertions::assert_eq!(
|
1330 + | input.unix_timestamp,
|
1331 + | expected.unix_timestamp,
|
1332 + | "Unexpected value for `unix_timestamp`"
|
1333 + | );
|
1334 + | let output = crate::output::KitchenSinkOperationOutput {
|
1335 + | blob: ::std::option::Option::None,
|
1336 + | boolean: ::std::option::Option::None,
|
1337 + | double: ::std::option::Option::None,
|
1338 + | empty_struct: ::std::option::Option::None,
|
1339 + | float: ::std::option::Option::None,
|
1340 + | httpdate_timestamp: ::std::option::Option::None,
|
1341 + | integer: ::std::option::Option::None,
|
1342 + | iso8601_timestamp: ::std::option::Option::None,
|
1343 + | json_value: ::std::option::Option::None,
|
1344 + | list_of_lists: ::std::option::Option::None,
|
1345 + | list_of_maps_of_strings: ::std::option::Option::None,
|
1346 + | list_of_strings: ::std::option::Option::None,
|
1347 + | list_of_structs: ::std::option::Option::None,
|
1348 + | long: ::std::option::Option::None,
|
1349 + | map_of_lists_of_strings: ::std::option::Option::None,
|
1350 + | map_of_maps: ::std::option::Option::None,
|
1351 + | map_of_strings: ::std::option::Option::None,
|
1352 + | map_of_structs: ::std::option::Option::None,
|
1353 + | recursive_list: ::std::option::Option::None,
|
1354 + | recursive_map: ::std::option::Option::None,
|
1355 + | recursive_struct: ::std::option::Option::None,
|
1356 + | simple_struct: ::std::option::Option::None,
|
1357 + | string: ::std::option::Option::None,
|
1358 + | struct_with_json_name: ::std::option::Option::None,
|
1359 + | timestamp: ::std::option::Option::None,
|
1360 + | unix_timestamp: ::std::option::Option::None,
|
1290 1361 | };
|
1291 1362 | Ok(output)
|
1292 1363 | };
|
1293 1364 | sender.send(()).await.expect("receiver dropped early");
|
1294 1365 | result
|
1295 1366 | }
|
1296 1367 | })
|
1297 1368 | .build_unchecked();
|
1298 1369 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1299 1370 | .await
|
1300 1371 | .expect("unable to make an HTTP request");
|
1301 1372 | assert!(
|
1302 1373 | receiver.recv().await.is_some(),
|
1303 1374 | "we expected operation handler to be invoked but it was not entered"
|
1304 1375 | );
|
1305 1376 | }
|
1306 1377 |
|
1307 - | /// Serializes a map union value
|
1308 - | /// Test ID: AwsJson11SerializeMapUnionValue
|
1378 + | /// Serializes float shapes
|
1379 + | /// Test ID: serializes_float_shapes
|
1309 1380 | #[::tokio::test]
|
1310 1381 | #[::tracing_test::traced_test]
|
1311 - | async fn aws_json11_serialize_map_union_value_request() {
|
1312 - | #[allow(unused_mut)]
|
1313 - | let mut http_request = ::http_1x::Request::builder()
|
1314 - | .uri("/")
|
1315 - | .method("POST")
|
1316 - | .header("Content-Type", "application/x-amz-json-1.1")
|
1317 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
1318 - | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
1319 - | ::bytes::Bytes::copy_from_slice(
|
1320 - | &::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"))
|
1321 - | )
|
1322 - | ))).unwrap();
|
1382 + | async fn serializes_float_shapes_request() {
|
1323 1383 | #[allow(unused_mut)]
|
1324 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1325 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
1326 - | let service = crate::service::JsonProtocol::builder::<
|
1327 - | ::aws_smithy_http_server::body::BoxBody,
|
1328 - | _,
|
1329 - | _,
|
1330 - | _,
|
1331 - | >(config)
|
1332 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1333 - | let sender = sender.clone();
|
1334 - | async move {
|
1335 - | let result = {
|
1336 - | let expected = crate::input::JsonUnionsInput {
|
1337 - | contents: ::std::option::Option::Some(crate::model::MyUnion::MapValue({
|
1338 - | let mut ret = ::std::collections::HashMap::new();
|
1339 - | ret.insert("foo".to_owned(), "bar".to_owned());
|
1340 - | ret.insert("spam".to_owned(), "eggs".to_owned());
|
1341 - | ret
|
1342 - | })),
|
1384 + | let mut http_request = ::http_1x::Request::builder()
|
1385 + | .uri("/")
|
1386 + | .method("POST")
|
1387 + | .header("Content-Type", "application/x-amz-json-1.1")
|
1388 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
1389 + | .body(::aws_smithy_http_server::body::boxed(
|
1390 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1391 + | &::aws_smithy_protocol_test::decode_body_data(
|
1392 + | "{\"Float\":1234.5}".as_bytes(),
|
1393 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1394 + | ),
|
1395 + | )),
|
1396 + | ))
|
1397 + | .unwrap();
|
1398 + | #[allow(unused_mut)]
|
1399 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1400 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
1401 + | let service = crate::service::JsonProtocol::builder::<
|
1402 + | ::aws_smithy_http_server::body::BoxBody,
|
1403 + | _,
|
1404 + | _,
|
1405 + | _,
|
1406 + | >(config)
|
1407 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
1408 + | let sender = sender.clone();
|
1409 + | async move {
|
1410 + | let result = {
|
1411 + | use ::aws_smithy_protocol_test::FloatEquals;
|
1412 + | let expected = crate::input::KitchenSinkOperationInput {
|
1413 + | float: ::std::option::Option::Some(1234.5_f32),
|
1414 + | blob: ::std::option::Option::None,
|
1415 + | boolean: ::std::option::Option::None,
|
1416 + | double: ::std::option::Option::None,
|
1417 + | empty_struct: ::std::option::Option::None,
|
1418 + | httpdate_timestamp: ::std::option::Option::None,
|
1419 + | integer: ::std::option::Option::None,
|
1420 + | iso8601_timestamp: ::std::option::Option::None,
|
1421 + | json_value: ::std::option::Option::None,
|
1422 + | list_of_lists: ::std::option::Option::None,
|
1423 + | list_of_maps_of_strings: ::std::option::Option::None,
|
1424 + | list_of_strings: ::std::option::Option::None,
|
1425 + | list_of_structs: ::std::option::Option::None,
|
1426 + | long: ::std::option::Option::None,
|
1427 + | map_of_lists_of_strings: ::std::option::Option::None,
|
1428 + | map_of_maps: ::std::option::Option::None,
|
1429 + | map_of_strings: ::std::option::Option::None,
|
1430 + | map_of_structs: ::std::option::Option::None,
|
1431 + | recursive_list: ::std::option::Option::None,
|
1432 + | recursive_map: ::std::option::Option::None,
|
1433 + | recursive_struct: ::std::option::Option::None,
|
1434 + | simple_struct: ::std::option::Option::None,
|
1435 + | string: ::std::option::Option::None,
|
1436 + | struct_with_json_name: ::std::option::Option::None,
|
1437 + | timestamp: ::std::option::Option::None,
|
1438 + | unix_timestamp: ::std::option::Option::None,
|
1343 1439 | };
|
1344 - | ::pretty_assertions::assert_eq!(input, expected);
|
1345 - | let output = crate::output::JsonUnionsOutput {
|
1346 - | contents: ::std::option::Option::None,
|
1440 + | ::pretty_assertions::assert_eq!(
|
1441 + | input.blob,
|
1442 + | expected.blob,
|
1443 + | "Unexpected value for `blob`"
|
1444 + | );
|
1445 + | ::pretty_assertions::assert_eq!(
|
1446 + | input.boolean,
|
1447 + | expected.boolean,
|
1448 + | "Unexpected value for `boolean`"
|
1449 + | );
|
1450 + | assert!(
|
1451 + | input.double.float_equals(&expected.double),
|
1452 + | "Unexpected value for `double` {:?} vs. {:?}",
|
1453 + | expected.double,
|
1454 + | input.double
|
1455 + | );
|
1456 + | ::pretty_assertions::assert_eq!(
|
1457 + | input.empty_struct,
|
1458 + | expected.empty_struct,
|
1459 + | "Unexpected value for `empty_struct`"
|
1460 + | );
|
1461 + | assert!(
|
1462 + | input.float.float_equals(&expected.float),
|
1463 + | "Unexpected value for `float` {:?} vs. {:?}",
|
1464 + | expected.float,
|
1465 + | input.float
|
1466 + | );
|
1467 + | ::pretty_assertions::assert_eq!(
|
1468 + | input.httpdate_timestamp,
|
1469 + | expected.httpdate_timestamp,
|
1470 + | "Unexpected value for `httpdate_timestamp`"
|
1471 + | );
|
1472 + | ::pretty_assertions::assert_eq!(
|
1473 + | input.integer,
|
1474 + | expected.integer,
|
1475 + | "Unexpected value for `integer`"
|
1476 + | );
|
1477 + | ::pretty_assertions::assert_eq!(
|
1478 + | input.iso8601_timestamp,
|
1479 + | expected.iso8601_timestamp,
|
1480 + | "Unexpected value for `iso8601_timestamp`"
|
1481 + | );
|
1482 + | ::pretty_assertions::assert_eq!(
|
1483 + | input.json_value,
|
1484 + | expected.json_value,
|
1485 + | "Unexpected value for `json_value`"
|
1486 + | );
|
1487 + | ::pretty_assertions::assert_eq!(
|
1488 + | input.list_of_lists,
|
1489 + | expected.list_of_lists,
|
1490 + | "Unexpected value for `list_of_lists`"
|
1491 + | );
|
1492 + | ::pretty_assertions::assert_eq!(
|
1493 + | input.list_of_maps_of_strings,
|
1494 + | expected.list_of_maps_of_strings,
|
1495 + | "Unexpected value for `list_of_maps_of_strings`"
|
1496 + | );
|
1497 + | ::pretty_assertions::assert_eq!(
|
1498 + | input.list_of_strings,
|
1499 + | expected.list_of_strings,
|
1500 + | "Unexpected value for `list_of_strings`"
|
1501 + | );
|
1502 + | ::pretty_assertions::assert_eq!(
|
1503 + | input.list_of_structs,
|
1504 + | expected.list_of_structs,
|
1505 + | "Unexpected value for `list_of_structs`"
|
1506 + | );
|
1507 + | ::pretty_assertions::assert_eq!(
|
1508 + | input.long,
|
1509 + | expected.long,
|
1510 + | "Unexpected value for `long`"
|
1511 + | );
|
1512 + | ::pretty_assertions::assert_eq!(
|
1513 + | input.map_of_lists_of_strings,
|
1514 + | expected.map_of_lists_of_strings,
|
1515 + | "Unexpected value for `map_of_lists_of_strings`"
|
1516 + | );
|
1517 + | ::pretty_assertions::assert_eq!(
|
1518 + | input.map_of_maps,
|
1519 + | expected.map_of_maps,
|
1520 + | "Unexpected value for `map_of_maps`"
|
1521 + | );
|
1522 + | ::pretty_assertions::assert_eq!(
|
1523 + | input.map_of_strings,
|
1524 + | expected.map_of_strings,
|
1525 + | "Unexpected value for `map_of_strings`"
|
1526 + | );
|
1527 + | ::pretty_assertions::assert_eq!(
|
1528 + | input.map_of_structs,
|
1529 + | expected.map_of_structs,
|
1530 + | "Unexpected value for `map_of_structs`"
|
1531 + | );
|
1532 + | ::pretty_assertions::assert_eq!(
|
1533 + | input.recursive_list,
|
1534 + | expected.recursive_list,
|
1535 + | "Unexpected value for `recursive_list`"
|
1536 + | );
|
1537 + | ::pretty_assertions::assert_eq!(
|
1538 + | input.recursive_map,
|
1539 + | expected.recursive_map,
|
1540 + | "Unexpected value for `recursive_map`"
|
1541 + | );
|
1542 + | ::pretty_assertions::assert_eq!(
|
1543 + | input.recursive_struct,
|
1544 + | expected.recursive_struct,
|
1545 + | "Unexpected value for `recursive_struct`"
|
1546 + | );
|
1547 + | ::pretty_assertions::assert_eq!(
|
1548 + | input.simple_struct,
|
1549 + | expected.simple_struct,
|
1550 + | "Unexpected value for `simple_struct`"
|
1551 + | );
|
1552 + | ::pretty_assertions::assert_eq!(
|
1553 + | input.string,
|
1554 + | expected.string,
|
1555 + | "Unexpected value for `string`"
|
1556 + | );
|
1557 + | ::pretty_assertions::assert_eq!(
|
1558 + | input.struct_with_json_name,
|
1559 + | expected.struct_with_json_name,
|
1560 + | "Unexpected value for `struct_with_json_name`"
|
1561 + | );
|
1562 + | ::pretty_assertions::assert_eq!(
|
1563 + | input.timestamp,
|
1564 + | expected.timestamp,
|
1565 + | "Unexpected value for `timestamp`"
|
1566 + | );
|
1567 + | ::pretty_assertions::assert_eq!(
|
1568 + | input.unix_timestamp,
|
1569 + | expected.unix_timestamp,
|
1570 + | "Unexpected value for `unix_timestamp`"
|
1571 + | );
|
1572 + | let output = crate::output::KitchenSinkOperationOutput {
|
1573 + | blob: ::std::option::Option::None,
|
1574 + | boolean: ::std::option::Option::None,
|
1575 + | double: ::std::option::Option::None,
|
1576 + | empty_struct: ::std::option::Option::None,
|
1577 + | float: ::std::option::Option::None,
|
1578 + | httpdate_timestamp: ::std::option::Option::None,
|
1579 + | integer: ::std::option::Option::None,
|
1580 + | iso8601_timestamp: ::std::option::Option::None,
|
1581 + | json_value: ::std::option::Option::None,
|
1582 + | list_of_lists: ::std::option::Option::None,
|
1583 + | list_of_maps_of_strings: ::std::option::Option::None,
|
1584 + | list_of_strings: ::std::option::Option::None,
|
1585 + | list_of_structs: ::std::option::Option::None,
|
1586 + | long: ::std::option::Option::None,
|
1587 + | map_of_lists_of_strings: ::std::option::Option::None,
|
1588 + | map_of_maps: ::std::option::Option::None,
|
1589 + | map_of_strings: ::std::option::Option::None,
|
1590 + | map_of_structs: ::std::option::Option::None,
|
1591 + | recursive_list: ::std::option::Option::None,
|
1592 + | recursive_map: ::std::option::Option::None,
|
1593 + | recursive_struct: ::std::option::Option::None,
|
1594 + | simple_struct: ::std::option::Option::None,
|
1595 + | string: ::std::option::Option::None,
|
1596 + | struct_with_json_name: ::std::option::Option::None,
|
1597 + | timestamp: ::std::option::Option::None,
|
1598 + | unix_timestamp: ::std::option::Option::None,
|
1347 1599 | };
|
1348 1600 | Ok(output)
|
1349 1601 | };
|
1350 1602 | sender.send(()).await.expect("receiver dropped early");
|
1351 1603 | result
|
1352 1604 | }
|
1353 1605 | })
|
1354 1606 | .build_unchecked();
|
1355 1607 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1356 1608 | .await
|
1357 1609 | .expect("unable to make an HTTP request");
|
1358 1610 | assert!(
|
1359 1611 | receiver.recv().await.is_some(),
|
1360 1612 | "we expected operation handler to be invoked but it was not entered"
|
1361 1613 | );
|
1362 1614 | }
|
1363 1615 |
|
1364 - | /// Serializes a structure union value
|
1365 - | /// Test ID: AwsJson11SerializeStructureUnionValue
|
1616 + | /// Serializes double shapes
|
1617 + | /// Test ID: serializes_double_shapes
|
1366 1618 | #[::tokio::test]
|
1367 1619 | #[::tracing_test::traced_test]
|
1368 - | async fn aws_json11_serialize_structure_union_value_request() {
|
1620 + | async fn serializes_double_shapes_request() {
|
1369 1621 | #[allow(unused_mut)]
|
1370 - | let mut http_request = ::http_1x::Request::builder()
|
1371 - | .uri("/")
|
1372 - | .method("POST")
|
1373 - | .header("Content-Type", "application/x-amz-json-1.1")
|
1374 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
1375 - | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
1376 - | ::bytes::Bytes::copy_from_slice(
|
1377 - | &::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"))
|
1378 - | )
|
1379 - | ))).unwrap();
|
1622 + | let mut http_request = ::http_1x::Request::builder()
|
1623 + | .uri("/")
|
1624 + | .method("POST")
|
1625 + | .header("Content-Type", "application/x-amz-json-1.1")
|
1626 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
1627 + | .body(::aws_smithy_http_server::body::boxed(
|
1628 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1629 + | &::aws_smithy_protocol_test::decode_body_data(
|
1630 + | "{\"Double\":1234.5}".as_bytes(),
|
1631 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1632 + | ),
|
1633 + | )),
|
1634 + | ))
|
1635 + | .unwrap();
|
1380 1636 | #[allow(unused_mut)]
|
1381 1637 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1382 1638 | let config = crate::service::JsonProtocolConfig::builder().build();
|
1383 1639 | let service = crate::service::JsonProtocol::builder::<
|
1384 1640 | ::aws_smithy_http_server::body::BoxBody,
|
1385 1641 | _,
|
1386 1642 | _,
|
1387 1643 | _,
|
1388 1644 | >(config)
|
1389 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1645 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
1390 1646 | let sender = sender.clone();
|
1391 1647 | async move {
|
1392 1648 | let result = {
|
1393 - | let expected = crate::input::JsonUnionsInput {
|
1394 - | contents: ::std::option::Option::Some(
|
1395 - | crate::model::MyUnion::StructureValue(crate::model::GreetingStruct {
|
1396 - | hi: ::std::option::Option::Some("hello".to_owned()),
|
1397 - | }),
|
1398 - | ),
|
1649 + | use ::aws_smithy_protocol_test::FloatEquals;
|
1650 + | let expected = crate::input::KitchenSinkOperationInput {
|
1651 + | double: ::std::option::Option::Some(1234.5_f64),
|
1652 + | blob: ::std::option::Option::None,
|
1653 + | boolean: ::std::option::Option::None,
|
1654 + | empty_struct: ::std::option::Option::None,
|
1655 + | float: ::std::option::Option::None,
|
1656 + | httpdate_timestamp: ::std::option::Option::None,
|
1657 + | integer: ::std::option::Option::None,
|
1658 + | iso8601_timestamp: ::std::option::Option::None,
|
1659 + | json_value: ::std::option::Option::None,
|
1660 + | list_of_lists: ::std::option::Option::None,
|
1661 + | list_of_maps_of_strings: ::std::option::Option::None,
|
1662 + | list_of_strings: ::std::option::Option::None,
|
1663 + | list_of_structs: ::std::option::Option::None,
|
1664 + | long: ::std::option::Option::None,
|
1665 + | map_of_lists_of_strings: ::std::option::Option::None,
|
1666 + | map_of_maps: ::std::option::Option::None,
|
1667 + | map_of_strings: ::std::option::Option::None,
|
1668 + | map_of_structs: ::std::option::Option::None,
|
1669 + | recursive_list: ::std::option::Option::None,
|
1670 + | recursive_map: ::std::option::Option::None,
|
1671 + | recursive_struct: ::std::option::Option::None,
|
1672 + | simple_struct: ::std::option::Option::None,
|
1673 + | string: ::std::option::Option::None,
|
1674 + | struct_with_json_name: ::std::option::Option::None,
|
1675 + | timestamp: ::std::option::Option::None,
|
1676 + | unix_timestamp: ::std::option::Option::None,
|
1399 1677 | };
|
1400 - | ::pretty_assertions::assert_eq!(input, expected);
|
1401 - | let output = crate::output::JsonUnionsOutput {
|
1402 - | contents: ::std::option::Option::None,
|
1678 + | ::pretty_assertions::assert_eq!(
|
1679 + | input.blob,
|
1680 + | expected.blob,
|
1681 + | "Unexpected value for `blob`"
|
1682 + | );
|
1683 + | ::pretty_assertions::assert_eq!(
|
1684 + | input.boolean,
|
1685 + | expected.boolean,
|
1686 + | "Unexpected value for `boolean`"
|
1687 + | );
|
1688 + | assert!(
|
1689 + | input.double.float_equals(&expected.double),
|
1690 + | "Unexpected value for `double` {:?} vs. {:?}",
|
1691 + | expected.double,
|
1692 + | input.double
|
1693 + | );
|
1694 + | ::pretty_assertions::assert_eq!(
|
1695 + | input.empty_struct,
|
1696 + | expected.empty_struct,
|
1697 + | "Unexpected value for `empty_struct`"
|
1698 + | );
|
1699 + | assert!(
|
1700 + | input.float.float_equals(&expected.float),
|
1701 + | "Unexpected value for `float` {:?} vs. {:?}",
|
1702 + | expected.float,
|
1703 + | input.float
|
1704 + | );
|
1705 + | ::pretty_assertions::assert_eq!(
|
1706 + | input.httpdate_timestamp,
|
1707 + | expected.httpdate_timestamp,
|
1708 + | "Unexpected value for `httpdate_timestamp`"
|
1709 + | );
|
1710 + | ::pretty_assertions::assert_eq!(
|
1711 + | input.integer,
|
1712 + | expected.integer,
|
1713 + | "Unexpected value for `integer`"
|
1714 + | );
|
1715 + | ::pretty_assertions::assert_eq!(
|
1716 + | input.iso8601_timestamp,
|
1717 + | expected.iso8601_timestamp,
|
1718 + | "Unexpected value for `iso8601_timestamp`"
|
1719 + | );
|
1720 + | ::pretty_assertions::assert_eq!(
|
1721 + | input.json_value,
|
1722 + | expected.json_value,
|
1723 + | "Unexpected value for `json_value`"
|
1724 + | );
|
1725 + | ::pretty_assertions::assert_eq!(
|
1726 + | input.list_of_lists,
|
1727 + | expected.list_of_lists,
|
1728 + | "Unexpected value for `list_of_lists`"
|
1729 + | );
|
1730 + | ::pretty_assertions::assert_eq!(
|
1731 + | input.list_of_maps_of_strings,
|
1732 + | expected.list_of_maps_of_strings,
|
1733 + | "Unexpected value for `list_of_maps_of_strings`"
|
1734 + | );
|
1735 + | ::pretty_assertions::assert_eq!(
|
1736 + | input.list_of_strings,
|
1737 + | expected.list_of_strings,
|
1738 + | "Unexpected value for `list_of_strings`"
|
1739 + | );
|
1740 + | ::pretty_assertions::assert_eq!(
|
1741 + | input.list_of_structs,
|
1742 + | expected.list_of_structs,
|
1743 + | "Unexpected value for `list_of_structs`"
|
1744 + | );
|
1745 + | ::pretty_assertions::assert_eq!(
|
1746 + | input.long,
|
1747 + | expected.long,
|
1748 + | "Unexpected value for `long`"
|
1749 + | );
|
1750 + | ::pretty_assertions::assert_eq!(
|
1751 + | input.map_of_lists_of_strings,
|
1752 + | expected.map_of_lists_of_strings,
|
1753 + | "Unexpected value for `map_of_lists_of_strings`"
|
1754 + | );
|
1755 + | ::pretty_assertions::assert_eq!(
|
1756 + | input.map_of_maps,
|
1757 + | expected.map_of_maps,
|
1758 + | "Unexpected value for `map_of_maps`"
|
1759 + | );
|
1760 + | ::pretty_assertions::assert_eq!(
|
1761 + | input.map_of_strings,
|
1762 + | expected.map_of_strings,
|
1763 + | "Unexpected value for `map_of_strings`"
|
1764 + | );
|
1765 + | ::pretty_assertions::assert_eq!(
|
1766 + | input.map_of_structs,
|
1767 + | expected.map_of_structs,
|
1768 + | "Unexpected value for `map_of_structs`"
|
1769 + | );
|
1770 + | ::pretty_assertions::assert_eq!(
|
1771 + | input.recursive_list,
|
1772 + | expected.recursive_list,
|
1773 + | "Unexpected value for `recursive_list`"
|
1774 + | );
|
1775 + | ::pretty_assertions::assert_eq!(
|
1776 + | input.recursive_map,
|
1777 + | expected.recursive_map,
|
1778 + | "Unexpected value for `recursive_map`"
|
1779 + | );
|
1780 + | ::pretty_assertions::assert_eq!(
|
1781 + | input.recursive_struct,
|
1782 + | expected.recursive_struct,
|
1783 + | "Unexpected value for `recursive_struct`"
|
1784 + | );
|
1785 + | ::pretty_assertions::assert_eq!(
|
1786 + | input.simple_struct,
|
1787 + | expected.simple_struct,
|
1788 + | "Unexpected value for `simple_struct`"
|
1789 + | );
|
1790 + | ::pretty_assertions::assert_eq!(
|
1791 + | input.string,
|
1792 + | expected.string,
|
1793 + | "Unexpected value for `string`"
|
1794 + | );
|
1795 + | ::pretty_assertions::assert_eq!(
|
1796 + | input.struct_with_json_name,
|
1797 + | expected.struct_with_json_name,
|
1798 + | "Unexpected value for `struct_with_json_name`"
|
1799 + | );
|
1800 + | ::pretty_assertions::assert_eq!(
|
1801 + | input.timestamp,
|
1802 + | expected.timestamp,
|
1803 + | "Unexpected value for `timestamp`"
|
1804 + | );
|
1805 + | ::pretty_assertions::assert_eq!(
|
1806 + | input.unix_timestamp,
|
1807 + | expected.unix_timestamp,
|
1808 + | "Unexpected value for `unix_timestamp`"
|
1809 + | );
|
1810 + | let output = crate::output::KitchenSinkOperationOutput {
|
1811 + | blob: ::std::option::Option::None,
|
1812 + | boolean: ::std::option::Option::None,
|
1813 + | double: ::std::option::Option::None,
|
1814 + | empty_struct: ::std::option::Option::None,
|
1815 + | float: ::std::option::Option::None,
|
1816 + | httpdate_timestamp: ::std::option::Option::None,
|
1817 + | integer: ::std::option::Option::None,
|
1818 + | iso8601_timestamp: ::std::option::Option::None,
|
1819 + | json_value: ::std::option::Option::None,
|
1820 + | list_of_lists: ::std::option::Option::None,
|
1821 + | list_of_maps_of_strings: ::std::option::Option::None,
|
1822 + | list_of_strings: ::std::option::Option::None,
|
1823 + | list_of_structs: ::std::option::Option::None,
|
1824 + | long: ::std::option::Option::None,
|
1825 + | map_of_lists_of_strings: ::std::option::Option::None,
|
1826 + | map_of_maps: ::std::option::Option::None,
|
1827 + | map_of_strings: ::std::option::Option::None,
|
1828 + | map_of_structs: ::std::option::Option::None,
|
1829 + | recursive_list: ::std::option::Option::None,
|
1830 + | recursive_map: ::std::option::Option::None,
|
1831 + | recursive_struct: ::std::option::Option::None,
|
1832 + | simple_struct: ::std::option::Option::None,
|
1833 + | string: ::std::option::Option::None,
|
1834 + | struct_with_json_name: ::std::option::Option::None,
|
1835 + | timestamp: ::std::option::Option::None,
|
1836 + | unix_timestamp: ::std::option::Option::None,
|
1403 1837 | };
|
1404 1838 | Ok(output)
|
1405 1839 | };
|
1406 1840 | sender.send(()).await.expect("receiver dropped early");
|
1407 1841 | result
|
1408 1842 | }
|
1409 1843 | })
|
1410 1844 | .build_unchecked();
|
1411 1845 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1412 1846 | .await
|
1413 1847 | .expect("unable to make an HTTP request");
|
1414 1848 | assert!(
|
1415 1849 | receiver.recv().await.is_some(),
|
1416 1850 | "we expected operation handler to be invoked but it was not entered"
|
1417 1851 | );
|
1418 1852 | }
|
1419 1853 |
|
1420 - | /// Deserializes a string union value
|
1421 - | /// Test ID: AwsJson11DeserializeStringUnionValue
|
1422 - | #[::tokio::test]
|
1423 - | #[::tracing_test::traced_test]
|
1424 - | async fn aws_json11_deserialize_string_union_value_response() {
|
1425 - | let output = crate::output::JsonUnionsOutput {
|
1426 - | contents: ::std::option::Option::Some(crate::model::MyUnion::StringValue(
|
1427 - | "foo".to_owned(),
|
1428 - | )),
|
1429 - | };
|
1430 - | use ::aws_smithy_http_server::response::IntoResponse;
|
1431 - | let http_response = output.into_response();
|
1432 - | ::pretty_assertions::assert_eq!(
|
1433 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1434 - | http_response.status()
|
1435 - | );
|
1436 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1437 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1438 - | http_response.headers(),
|
1439 - | expected_headers,
|
1440 - | ));
|
1441 - | use ::http_body_util::BodyExt;
|
1442 - | let body = http_response
|
1443 - | .into_body()
|
1444 - | .collect()
|
1445 - | .await
|
1446 - | .expect("unable to collect body")
|
1447 - | .to_bytes();
|
1448 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1449 - | &body,
|
1450 - | "{\n \"contents\": {\n \"stringValue\": \"foo\"\n }\n}",
|
1451 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1452 - | ));
|
1453 - | }
|
1454 - |
|
1455 - | /// Deserializes a boolean union value
|
1456 - | /// Test ID: AwsJson11DeserializeBooleanUnionValue
|
1854 + | /// Serializes blob shapes
|
1855 + | /// Test ID: serializes_blob_shapes
|
1457 1856 | #[::tokio::test]
|
1458 1857 | #[::tracing_test::traced_test]
|
1459 - | async fn aws_json11_deserialize_boolean_union_value_response() {
|
1460 - | let output = crate::output::JsonUnionsOutput {
|
1461 - | contents: ::std::option::Option::Some(crate::model::MyUnion::BooleanValue(true)),
|
1462 - | };
|
1463 - | use ::aws_smithy_http_server::response::IntoResponse;
|
1464 - | let http_response = output.into_response();
|
1465 - | ::pretty_assertions::assert_eq!(
|
1466 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1467 - | http_response.status()
|
1468 - | );
|
1469 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1470 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1471 - | http_response.headers(),
|
1472 - | expected_headers,
|
1473 - | ));
|
1474 - | use ::http_body_util::BodyExt;
|
1475 - | let body = http_response
|
1476 - | .into_body()
|
1477 - | .collect()
|
1478 - | .await
|
1479 - | .expect("unable to collect body")
|
1480 - | .to_bytes();
|
1481 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1482 - | &body,
|
1483 - | "{\n \"contents\": {\n \"booleanValue\": true\n }\n}",
|
1484 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1485 - | ));
|
1858 + | async fn serializes_blob_shapes_request() {
|
1859 + | #[allow(unused_mut)]
|
1860 + | let mut http_request = ::http_1x::Request::builder()
|
1861 + | .uri("/")
|
1862 + | .method("POST")
|
1863 + | .header("Content-Type", "application/x-amz-json-1.1")
|
1864 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
1865 + | .body(::aws_smithy_http_server::body::boxed(
|
1866 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1867 + | &::aws_smithy_protocol_test::decode_body_data(
|
1868 + | "{\"Blob\":\"YmluYXJ5LXZhbHVl\"}".as_bytes(),
|
1869 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1870 + | ),
|
1871 + | )),
|
1872 + | ))
|
1873 + | .unwrap();
|
1874 + | #[allow(unused_mut)]
|
1875 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1876 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
1877 + | let service = crate::service::JsonProtocol::builder::<
|
1878 + | ::aws_smithy_http_server::body::BoxBody,
|
1879 + | _,
|
1880 + | _,
|
1881 + | _,
|
1882 + | >(config)
|
1883 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
1884 + | let sender = sender.clone();
|
1885 + | async move {
|
1886 + | let result = {
|
1887 + | use ::aws_smithy_protocol_test::FloatEquals;
|
1888 + | let expected = crate::input::KitchenSinkOperationInput {
|
1889 + | blob: ::std::option::Option::Some(::aws_smithy_types::Blob::new(
|
1890 + | "binary-value",
|
1891 + | )),
|
1892 + | boolean: ::std::option::Option::None,
|
1893 + | double: ::std::option::Option::None,
|
1894 + | empty_struct: ::std::option::Option::None,
|
1895 + | float: ::std::option::Option::None,
|
1896 + | httpdate_timestamp: ::std::option::Option::None,
|
1897 + | integer: ::std::option::Option::None,
|
1898 + | iso8601_timestamp: ::std::option::Option::None,
|
1899 + | json_value: ::std::option::Option::None,
|
1900 + | list_of_lists: ::std::option::Option::None,
|
1901 + | list_of_maps_of_strings: ::std::option::Option::None,
|
1902 + | list_of_strings: ::std::option::Option::None,
|
1903 + | list_of_structs: ::std::option::Option::None,
|
1904 + | long: ::std::option::Option::None,
|
1905 + | map_of_lists_of_strings: ::std::option::Option::None,
|
1906 + | map_of_maps: ::std::option::Option::None,
|
1907 + | map_of_strings: ::std::option::Option::None,
|
1908 + | map_of_structs: ::std::option::Option::None,
|
1909 + | recursive_list: ::std::option::Option::None,
|
1910 + | recursive_map: ::std::option::Option::None,
|
1911 + | recursive_struct: ::std::option::Option::None,
|
1912 + | simple_struct: ::std::option::Option::None,
|
1913 + | string: ::std::option::Option::None,
|
1914 + | struct_with_json_name: ::std::option::Option::None,
|
1915 + | timestamp: ::std::option::Option::None,
|
1916 + | unix_timestamp: ::std::option::Option::None,
|
1917 + | };
|
1918 + | ::pretty_assertions::assert_eq!(
|
1919 + | input.blob,
|
1920 + | expected.blob,
|
1921 + | "Unexpected value for `blob`"
|
1922 + | );
|
1923 + | ::pretty_assertions::assert_eq!(
|
1924 + | input.boolean,
|
1925 + | expected.boolean,
|
1926 + | "Unexpected value for `boolean`"
|
1927 + | );
|
1928 + | assert!(
|
1929 + | input.double.float_equals(&expected.double),
|
1930 + | "Unexpected value for `double` {:?} vs. {:?}",
|
1931 + | expected.double,
|
1932 + | input.double
|
1933 + | );
|
1934 + | ::pretty_assertions::assert_eq!(
|
1935 + | input.empty_struct,
|
1936 + | expected.empty_struct,
|
1937 + | "Unexpected value for `empty_struct`"
|
1938 + | );
|
1939 + | assert!(
|
1940 + | input.float.float_equals(&expected.float),
|
1941 + | "Unexpected value for `float` {:?} vs. {:?}",
|
1942 + | expected.float,
|
1943 + | input.float
|
1944 + | );
|
1945 + | ::pretty_assertions::assert_eq!(
|
1946 + | input.httpdate_timestamp,
|
1947 + | expected.httpdate_timestamp,
|
1948 + | "Unexpected value for `httpdate_timestamp`"
|
1949 + | );
|
1950 + | ::pretty_assertions::assert_eq!(
|
1951 + | input.integer,
|
1952 + | expected.integer,
|
1953 + | "Unexpected value for `integer`"
|
1954 + | );
|
1955 + | ::pretty_assertions::assert_eq!(
|
1956 + | input.iso8601_timestamp,
|
1957 + | expected.iso8601_timestamp,
|
1958 + | "Unexpected value for `iso8601_timestamp`"
|
1959 + | );
|
1960 + | ::pretty_assertions::assert_eq!(
|
1961 + | input.json_value,
|
1962 + | expected.json_value,
|
1963 + | "Unexpected value for `json_value`"
|
1964 + | );
|
1965 + | ::pretty_assertions::assert_eq!(
|
1966 + | input.list_of_lists,
|
1967 + | expected.list_of_lists,
|
1968 + | "Unexpected value for `list_of_lists`"
|
1969 + | );
|
1970 + | ::pretty_assertions::assert_eq!(
|
1971 + | input.list_of_maps_of_strings,
|
1972 + | expected.list_of_maps_of_strings,
|
1973 + | "Unexpected value for `list_of_maps_of_strings`"
|
1974 + | );
|
1975 + | ::pretty_assertions::assert_eq!(
|
1976 + | input.list_of_strings,
|
1977 + | expected.list_of_strings,
|
1978 + | "Unexpected value for `list_of_strings`"
|
1979 + | );
|
1980 + | ::pretty_assertions::assert_eq!(
|
1981 + | input.list_of_structs,
|
1982 + | expected.list_of_structs,
|
1983 + | "Unexpected value for `list_of_structs`"
|
1984 + | );
|
1985 + | ::pretty_assertions::assert_eq!(
|
1986 + | input.long,
|
1987 + | expected.long,
|
1988 + | "Unexpected value for `long`"
|
1989 + | );
|
1990 + | ::pretty_assertions::assert_eq!(
|
1991 + | input.map_of_lists_of_strings,
|
1992 + | expected.map_of_lists_of_strings,
|
1993 + | "Unexpected value for `map_of_lists_of_strings`"
|
1994 + | );
|
1995 + | ::pretty_assertions::assert_eq!(
|
1996 + | input.map_of_maps,
|
1997 + | expected.map_of_maps,
|
1998 + | "Unexpected value for `map_of_maps`"
|
1999 + | );
|
2000 + | ::pretty_assertions::assert_eq!(
|
2001 + | input.map_of_strings,
|
2002 + | expected.map_of_strings,
|
2003 + | "Unexpected value for `map_of_strings`"
|
2004 + | );
|
2005 + | ::pretty_assertions::assert_eq!(
|
2006 + | input.map_of_structs,
|
2007 + | expected.map_of_structs,
|
2008 + | "Unexpected value for `map_of_structs`"
|
2009 + | );
|
2010 + | ::pretty_assertions::assert_eq!(
|
2011 + | input.recursive_list,
|
2012 + | expected.recursive_list,
|
2013 + | "Unexpected value for `recursive_list`"
|
2014 + | );
|
2015 + | ::pretty_assertions::assert_eq!(
|
2016 + | input.recursive_map,
|
2017 + | expected.recursive_map,
|
2018 + | "Unexpected value for `recursive_map`"
|
2019 + | );
|
2020 + | ::pretty_assertions::assert_eq!(
|
2021 + | input.recursive_struct,
|
2022 + | expected.recursive_struct,
|
2023 + | "Unexpected value for `recursive_struct`"
|
2024 + | );
|
2025 + | ::pretty_assertions::assert_eq!(
|
2026 + | input.simple_struct,
|
2027 + | expected.simple_struct,
|
2028 + | "Unexpected value for `simple_struct`"
|
2029 + | );
|
2030 + | ::pretty_assertions::assert_eq!(
|
2031 + | input.string,
|
2032 + | expected.string,
|
2033 + | "Unexpected value for `string`"
|
2034 + | );
|
2035 + | ::pretty_assertions::assert_eq!(
|
2036 + | input.struct_with_json_name,
|
2037 + | expected.struct_with_json_name,
|
2038 + | "Unexpected value for `struct_with_json_name`"
|
2039 + | );
|
2040 + | ::pretty_assertions::assert_eq!(
|
2041 + | input.timestamp,
|
2042 + | expected.timestamp,
|
2043 + | "Unexpected value for `timestamp`"
|
2044 + | );
|
2045 + | ::pretty_assertions::assert_eq!(
|
2046 + | input.unix_timestamp,
|
2047 + | expected.unix_timestamp,
|
2048 + | "Unexpected value for `unix_timestamp`"
|
2049 + | );
|
2050 + | let output = crate::output::KitchenSinkOperationOutput {
|
2051 + | blob: ::std::option::Option::None,
|
2052 + | boolean: ::std::option::Option::None,
|
2053 + | double: ::std::option::Option::None,
|
2054 + | empty_struct: ::std::option::Option::None,
|
2055 + | float: ::std::option::Option::None,
|
2056 + | httpdate_timestamp: ::std::option::Option::None,
|
2057 + | integer: ::std::option::Option::None,
|
2058 + | iso8601_timestamp: ::std::option::Option::None,
|
2059 + | json_value: ::std::option::Option::None,
|
2060 + | list_of_lists: ::std::option::Option::None,
|
2061 + | list_of_maps_of_strings: ::std::option::Option::None,
|
2062 + | list_of_strings: ::std::option::Option::None,
|
2063 + | list_of_structs: ::std::option::Option::None,
|
2064 + | long: ::std::option::Option::None,
|
2065 + | map_of_lists_of_strings: ::std::option::Option::None,
|
2066 + | map_of_maps: ::std::option::Option::None,
|
2067 + | map_of_strings: ::std::option::Option::None,
|
2068 + | map_of_structs: ::std::option::Option::None,
|
2069 + | recursive_list: ::std::option::Option::None,
|
2070 + | recursive_map: ::std::option::Option::None,
|
2071 + | recursive_struct: ::std::option::Option::None,
|
2072 + | simple_struct: ::std::option::Option::None,
|
2073 + | string: ::std::option::Option::None,
|
2074 + | struct_with_json_name: ::std::option::Option::None,
|
2075 + | timestamp: ::std::option::Option::None,
|
2076 + | unix_timestamp: ::std::option::Option::None,
|
2077 + | };
|
2078 + | Ok(output)
|
2079 + | };
|
2080 + | sender.send(()).await.expect("receiver dropped early");
|
2081 + | result
|
2082 + | }
|
2083 + | })
|
2084 + | .build_unchecked();
|
2085 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2086 + | .await
|
2087 + | .expect("unable to make an HTTP request");
|
2088 + | assert!(
|
2089 + | receiver.recv().await.is_some(),
|
2090 + | "we expected operation handler to be invoked but it was not entered"
|
2091 + | );
|
1486 2092 | }
|
1487 2093 |
|
1488 - | /// Deserializes a number union value
|
1489 - | /// Test ID: AwsJson11DeserializeNumberUnionValue
|
2094 + | /// Serializes boolean shapes (true)
|
2095 + | /// Test ID: serializes_boolean_shapes_true
|
1490 2096 | #[::tokio::test]
|
1491 2097 | #[::tracing_test::traced_test]
|
1492 - | async fn aws_json11_deserialize_number_union_value_response() {
|
1493 - | let output = crate::output::JsonUnionsOutput {
|
1494 - | contents: ::std::option::Option::Some(crate::model::MyUnion::NumberValue(1)),
|
1495 - | };
|
1496 - | use ::aws_smithy_http_server::response::IntoResponse;
|
1497 - | let http_response = output.into_response();
|
1498 - | ::pretty_assertions::assert_eq!(
|
1499 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1500 - | http_response.status()
|
1501 - | );
|
1502 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1503 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1504 - | http_response.headers(),
|
1505 - | expected_headers,
|
1506 - | ));
|
1507 - | use ::http_body_util::BodyExt;
|
1508 - | let body = http_response
|
1509 - | .into_body()
|
1510 - | .collect()
|
2098 + | async fn serializes_boolean_shapes_true_request() {
|
2099 + | #[allow(unused_mut)]
|
2100 + | let mut http_request = ::http_1x::Request::builder()
|
2101 + | .uri("/")
|
2102 + | .method("POST")
|
2103 + | .header("Content-Type", "application/x-amz-json-1.1")
|
2104 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
2105 + | .body(::aws_smithy_http_server::body::boxed(
|
2106 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2107 + | &::aws_smithy_protocol_test::decode_body_data(
|
2108 + | "{\"Boolean\":true}".as_bytes(),
|
2109 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2110 + | ),
|
2111 + | )),
|
2112 + | ))
|
2113 + | .unwrap();
|
2114 + | #[allow(unused_mut)]
|
2115 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2116 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
2117 + | let service = crate::service::JsonProtocol::builder::<
|
2118 + | ::aws_smithy_http_server::body::BoxBody,
|
2119 + | _,
|
2120 + | _,
|
2121 + | _,
|
2122 + | >(config)
|
2123 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
2124 + | let sender = sender.clone();
|
2125 + | async move {
|
2126 + | let result = {
|
2127 + | use ::aws_smithy_protocol_test::FloatEquals;
|
2128 + | let expected = crate::input::KitchenSinkOperationInput {
|
2129 + | boolean: ::std::option::Option::Some(true),
|
2130 + | blob: ::std::option::Option::None,
|
2131 + | double: ::std::option::Option::None,
|
2132 + | empty_struct: ::std::option::Option::None,
|
2133 + | float: ::std::option::Option::None,
|
2134 + | httpdate_timestamp: ::std::option::Option::None,
|
2135 + | integer: ::std::option::Option::None,
|
2136 + | iso8601_timestamp: ::std::option::Option::None,
|
2137 + | json_value: ::std::option::Option::None,
|
2138 + | list_of_lists: ::std::option::Option::None,
|
2139 + | list_of_maps_of_strings: ::std::option::Option::None,
|
2140 + | list_of_strings: ::std::option::Option::None,
|
2141 + | list_of_structs: ::std::option::Option::None,
|
2142 + | long: ::std::option::Option::None,
|
2143 + | map_of_lists_of_strings: ::std::option::Option::None,
|
2144 + | map_of_maps: ::std::option::Option::None,
|
2145 + | map_of_strings: ::std::option::Option::None,
|
2146 + | map_of_structs: ::std::option::Option::None,
|
2147 + | recursive_list: ::std::option::Option::None,
|
2148 + | recursive_map: ::std::option::Option::None,
|
2149 + | recursive_struct: ::std::option::Option::None,
|
2150 + | simple_struct: ::std::option::Option::None,
|
2151 + | string: ::std::option::Option::None,
|
2152 + | struct_with_json_name: ::std::option::Option::None,
|
2153 + | timestamp: ::std::option::Option::None,
|
2154 + | unix_timestamp: ::std::option::Option::None,
|
2155 + | };
|
2156 + | ::pretty_assertions::assert_eq!(
|
2157 + | input.blob,
|
2158 + | expected.blob,
|
2159 + | "Unexpected value for `blob`"
|
2160 + | );
|
2161 + | ::pretty_assertions::assert_eq!(
|
2162 + | input.boolean,
|
2163 + | expected.boolean,
|
2164 + | "Unexpected value for `boolean`"
|
2165 + | );
|
2166 + | assert!(
|
2167 + | input.double.float_equals(&expected.double),
|
2168 + | "Unexpected value for `double` {:?} vs. {:?}",
|
2169 + | expected.double,
|
2170 + | input.double
|
2171 + | );
|
2172 + | ::pretty_assertions::assert_eq!(
|
2173 + | input.empty_struct,
|
2174 + | expected.empty_struct,
|
2175 + | "Unexpected value for `empty_struct`"
|
2176 + | );
|
2177 + | assert!(
|
2178 + | input.float.float_equals(&expected.float),
|
2179 + | "Unexpected value for `float` {:?} vs. {:?}",
|
2180 + | expected.float,
|
2181 + | input.float
|
2182 + | );
|
2183 + | ::pretty_assertions::assert_eq!(
|
2184 + | input.httpdate_timestamp,
|
2185 + | expected.httpdate_timestamp,
|
2186 + | "Unexpected value for `httpdate_timestamp`"
|
2187 + | );
|
2188 + | ::pretty_assertions::assert_eq!(
|
2189 + | input.integer,
|
2190 + | expected.integer,
|
2191 + | "Unexpected value for `integer`"
|
2192 + | );
|
2193 + | ::pretty_assertions::assert_eq!(
|
2194 + | input.iso8601_timestamp,
|
2195 + | expected.iso8601_timestamp,
|
2196 + | "Unexpected value for `iso8601_timestamp`"
|
2197 + | );
|
2198 + | ::pretty_assertions::assert_eq!(
|
2199 + | input.json_value,
|
2200 + | expected.json_value,
|
2201 + | "Unexpected value for `json_value`"
|
2202 + | );
|
2203 + | ::pretty_assertions::assert_eq!(
|
2204 + | input.list_of_lists,
|
2205 + | expected.list_of_lists,
|
2206 + | "Unexpected value for `list_of_lists`"
|
2207 + | );
|
2208 + | ::pretty_assertions::assert_eq!(
|
2209 + | input.list_of_maps_of_strings,
|
2210 + | expected.list_of_maps_of_strings,
|
2211 + | "Unexpected value for `list_of_maps_of_strings`"
|
2212 + | );
|
2213 + | ::pretty_assertions::assert_eq!(
|
2214 + | input.list_of_strings,
|
2215 + | expected.list_of_strings,
|
2216 + | "Unexpected value for `list_of_strings`"
|
2217 + | );
|
2218 + | ::pretty_assertions::assert_eq!(
|
2219 + | input.list_of_structs,
|
2220 + | expected.list_of_structs,
|
2221 + | "Unexpected value for `list_of_structs`"
|
2222 + | );
|
2223 + | ::pretty_assertions::assert_eq!(
|
2224 + | input.long,
|
2225 + | expected.long,
|
2226 + | "Unexpected value for `long`"
|
2227 + | );
|
2228 + | ::pretty_assertions::assert_eq!(
|
2229 + | input.map_of_lists_of_strings,
|
2230 + | expected.map_of_lists_of_strings,
|
2231 + | "Unexpected value for `map_of_lists_of_strings`"
|
2232 + | );
|
2233 + | ::pretty_assertions::assert_eq!(
|
2234 + | input.map_of_maps,
|
2235 + | expected.map_of_maps,
|
2236 + | "Unexpected value for `map_of_maps`"
|
2237 + | );
|
2238 + | ::pretty_assertions::assert_eq!(
|
2239 + | input.map_of_strings,
|
2240 + | expected.map_of_strings,
|
2241 + | "Unexpected value for `map_of_strings`"
|
2242 + | );
|
2243 + | ::pretty_assertions::assert_eq!(
|
2244 + | input.map_of_structs,
|
2245 + | expected.map_of_structs,
|
2246 + | "Unexpected value for `map_of_structs`"
|
2247 + | );
|
2248 + | ::pretty_assertions::assert_eq!(
|
2249 + | input.recursive_list,
|
2250 + | expected.recursive_list,
|
2251 + | "Unexpected value for `recursive_list`"
|
2252 + | );
|
2253 + | ::pretty_assertions::assert_eq!(
|
2254 + | input.recursive_map,
|
2255 + | expected.recursive_map,
|
2256 + | "Unexpected value for `recursive_map`"
|
2257 + | );
|
2258 + | ::pretty_assertions::assert_eq!(
|
2259 + | input.recursive_struct,
|
2260 + | expected.recursive_struct,
|
2261 + | "Unexpected value for `recursive_struct`"
|
2262 + | );
|
2263 + | ::pretty_assertions::assert_eq!(
|
2264 + | input.simple_struct,
|
2265 + | expected.simple_struct,
|
2266 + | "Unexpected value for `simple_struct`"
|
2267 + | );
|
2268 + | ::pretty_assertions::assert_eq!(
|
2269 + | input.string,
|
2270 + | expected.string,
|
2271 + | "Unexpected value for `string`"
|
2272 + | );
|
2273 + | ::pretty_assertions::assert_eq!(
|
2274 + | input.struct_with_json_name,
|
2275 + | expected.struct_with_json_name,
|
2276 + | "Unexpected value for `struct_with_json_name`"
|
2277 + | );
|
2278 + | ::pretty_assertions::assert_eq!(
|
2279 + | input.timestamp,
|
2280 + | expected.timestamp,
|
2281 + | "Unexpected value for `timestamp`"
|
2282 + | );
|
2283 + | ::pretty_assertions::assert_eq!(
|
2284 + | input.unix_timestamp,
|
2285 + | expected.unix_timestamp,
|
2286 + | "Unexpected value for `unix_timestamp`"
|
2287 + | );
|
2288 + | let output = crate::output::KitchenSinkOperationOutput {
|
2289 + | blob: ::std::option::Option::None,
|
2290 + | boolean: ::std::option::Option::None,
|
2291 + | double: ::std::option::Option::None,
|
2292 + | empty_struct: ::std::option::Option::None,
|
2293 + | float: ::std::option::Option::None,
|
2294 + | httpdate_timestamp: ::std::option::Option::None,
|
2295 + | integer: ::std::option::Option::None,
|
2296 + | iso8601_timestamp: ::std::option::Option::None,
|
2297 + | json_value: ::std::option::Option::None,
|
2298 + | list_of_lists: ::std::option::Option::None,
|
2299 + | list_of_maps_of_strings: ::std::option::Option::None,
|
2300 + | list_of_strings: ::std::option::Option::None,
|
2301 + | list_of_structs: ::std::option::Option::None,
|
2302 + | long: ::std::option::Option::None,
|
2303 + | map_of_lists_of_strings: ::std::option::Option::None,
|
2304 + | map_of_maps: ::std::option::Option::None,
|
2305 + | map_of_strings: ::std::option::Option::None,
|
2306 + | map_of_structs: ::std::option::Option::None,
|
2307 + | recursive_list: ::std::option::Option::None,
|
2308 + | recursive_map: ::std::option::Option::None,
|
2309 + | recursive_struct: ::std::option::Option::None,
|
2310 + | simple_struct: ::std::option::Option::None,
|
2311 + | string: ::std::option::Option::None,
|
2312 + | struct_with_json_name: ::std::option::Option::None,
|
2313 + | timestamp: ::std::option::Option::None,
|
2314 + | unix_timestamp: ::std::option::Option::None,
|
2315 + | };
|
2316 + | Ok(output)
|
2317 + | };
|
2318 + | sender.send(()).await.expect("receiver dropped early");
|
2319 + | result
|
2320 + | }
|
2321 + | })
|
2322 + | .build_unchecked();
|
2323 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1511 2324 | .await
|
1512 - | .expect("unable to collect body")
|
1513 - | .to_bytes();
|
1514 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1515 - | &body,
|
1516 - | "{\n \"contents\": {\n \"numberValue\": 1\n }\n}",
|
1517 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1518 - | ));
|
2325 + | .expect("unable to make an HTTP request");
|
2326 + | assert!(
|
2327 + | receiver.recv().await.is_some(),
|
2328 + | "we expected operation handler to be invoked but it was not entered"
|
2329 + | );
|
1519 2330 | }
|
1520 2331 |
|
1521 - | /// Deserializes a blob union value
|
1522 - | /// Test ID: AwsJson11DeserializeBlobUnionValue
|
2332 + | /// Serializes boolean shapes (false)
|
2333 + | /// Test ID: serializes_boolean_shapes_false
|
1523 2334 | #[::tokio::test]
|
1524 2335 | #[::tracing_test::traced_test]
|
1525 - | async fn aws_json11_deserialize_blob_union_value_response() {
|
1526 - | let output = crate::output::JsonUnionsOutput {
|
1527 - | contents: ::std::option::Option::Some(crate::model::MyUnion::BlobValue(
|
1528 - | ::aws_smithy_types::Blob::new("foo"),
|
1529 - | )),
|
1530 - | };
|
1531 - | use ::aws_smithy_http_server::response::IntoResponse;
|
1532 - | let http_response = output.into_response();
|
1533 - | ::pretty_assertions::assert_eq!(
|
1534 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1535 - | http_response.status()
|
1536 - | );
|
1537 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1538 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1539 - | http_response.headers(),
|
1540 - | expected_headers,
|
1541 - | ));
|
1542 - | use ::http_body_util::BodyExt;
|
1543 - | let body = http_response
|
1544 - | .into_body()
|
1545 - | .collect()
|
2336 + | async fn serializes_boolean_shapes_false_request() {
|
2337 + | #[allow(unused_mut)]
|
2338 + | let mut http_request = ::http_1x::Request::builder()
|
2339 + | .uri("/")
|
2340 + | .method("POST")
|
2341 + | .header("Content-Type", "application/x-amz-json-1.1")
|
2342 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
2343 + | .body(::aws_smithy_http_server::body::boxed(
|
2344 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2345 + | &::aws_smithy_protocol_test::decode_body_data(
|
2346 + | "{\"Boolean\":false}".as_bytes(),
|
2347 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2348 + | ),
|
2349 + | )),
|
2350 + | ))
|
2351 + | .unwrap();
|
2352 + | #[allow(unused_mut)]
|
2353 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2354 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
2355 + | let service = crate::service::JsonProtocol::builder::<
|
2356 + | ::aws_smithy_http_server::body::BoxBody,
|
2357 + | _,
|
2358 + | _,
|
2359 + | _,
|
2360 + | >(config)
|
2361 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
2362 + | let sender = sender.clone();
|
2363 + | async move {
|
2364 + | let result = {
|
2365 + | use ::aws_smithy_protocol_test::FloatEquals;
|
2366 + | let expected = crate::input::KitchenSinkOperationInput {
|
2367 + | boolean: ::std::option::Option::Some(false),
|
2368 + | blob: ::std::option::Option::None,
|
2369 + | double: ::std::option::Option::None,
|
2370 + | empty_struct: ::std::option::Option::None,
|
2371 + | float: ::std::option::Option::None,
|
2372 + | httpdate_timestamp: ::std::option::Option::None,
|
2373 + | integer: ::std::option::Option::None,
|
2374 + | iso8601_timestamp: ::std::option::Option::None,
|
2375 + | json_value: ::std::option::Option::None,
|
2376 + | list_of_lists: ::std::option::Option::None,
|
2377 + | list_of_maps_of_strings: ::std::option::Option::None,
|
2378 + | list_of_strings: ::std::option::Option::None,
|
2379 + | list_of_structs: ::std::option::Option::None,
|
2380 + | long: ::std::option::Option::None,
|
2381 + | map_of_lists_of_strings: ::std::option::Option::None,
|
2382 + | map_of_maps: ::std::option::Option::None,
|
2383 + | map_of_strings: ::std::option::Option::None,
|
2384 + | map_of_structs: ::std::option::Option::None,
|
2385 + | recursive_list: ::std::option::Option::None,
|
2386 + | recursive_map: ::std::option::Option::None,
|
2387 + | recursive_struct: ::std::option::Option::None,
|
2388 + | simple_struct: ::std::option::Option::None,
|
2389 + | string: ::std::option::Option::None,
|
2390 + | struct_with_json_name: ::std::option::Option::None,
|
2391 + | timestamp: ::std::option::Option::None,
|
2392 + | unix_timestamp: ::std::option::Option::None,
|
2393 + | };
|
2394 + | ::pretty_assertions::assert_eq!(
|
2395 + | input.blob,
|
2396 + | expected.blob,
|
2397 + | "Unexpected value for `blob`"
|
2398 + | );
|
2399 + | ::pretty_assertions::assert_eq!(
|
2400 + | input.boolean,
|
2401 + | expected.boolean,
|
2402 + | "Unexpected value for `boolean`"
|
2403 + | );
|
2404 + | assert!(
|
2405 + | input.double.float_equals(&expected.double),
|
2406 + | "Unexpected value for `double` {:?} vs. {:?}",
|
2407 + | expected.double,
|
2408 + | input.double
|
2409 + | );
|
2410 + | ::pretty_assertions::assert_eq!(
|
2411 + | input.empty_struct,
|
2412 + | expected.empty_struct,
|
2413 + | "Unexpected value for `empty_struct`"
|
2414 + | );
|
2415 + | assert!(
|
2416 + | input.float.float_equals(&expected.float),
|
2417 + | "Unexpected value for `float` {:?} vs. {:?}",
|
2418 + | expected.float,
|
2419 + | input.float
|
2420 + | );
|
2421 + | ::pretty_assertions::assert_eq!(
|
2422 + | input.httpdate_timestamp,
|
2423 + | expected.httpdate_timestamp,
|
2424 + | "Unexpected value for `httpdate_timestamp`"
|
2425 + | );
|
2426 + | ::pretty_assertions::assert_eq!(
|
2427 + | input.integer,
|
2428 + | expected.integer,
|
2429 + | "Unexpected value for `integer`"
|
2430 + | );
|
2431 + | ::pretty_assertions::assert_eq!(
|
2432 + | input.iso8601_timestamp,
|
2433 + | expected.iso8601_timestamp,
|
2434 + | "Unexpected value for `iso8601_timestamp`"
|
2435 + | );
|
2436 + | ::pretty_assertions::assert_eq!(
|
2437 + | input.json_value,
|
2438 + | expected.json_value,
|
2439 + | "Unexpected value for `json_value`"
|
2440 + | );
|
2441 + | ::pretty_assertions::assert_eq!(
|
2442 + | input.list_of_lists,
|
2443 + | expected.list_of_lists,
|
2444 + | "Unexpected value for `list_of_lists`"
|
2445 + | );
|
2446 + | ::pretty_assertions::assert_eq!(
|
2447 + | input.list_of_maps_of_strings,
|
2448 + | expected.list_of_maps_of_strings,
|
2449 + | "Unexpected value for `list_of_maps_of_strings`"
|
2450 + | );
|
2451 + | ::pretty_assertions::assert_eq!(
|
2452 + | input.list_of_strings,
|
2453 + | expected.list_of_strings,
|
2454 + | "Unexpected value for `list_of_strings`"
|
2455 + | );
|
2456 + | ::pretty_assertions::assert_eq!(
|
2457 + | input.list_of_structs,
|
2458 + | expected.list_of_structs,
|
2459 + | "Unexpected value for `list_of_structs`"
|
2460 + | );
|
2461 + | ::pretty_assertions::assert_eq!(
|
2462 + | input.long,
|
2463 + | expected.long,
|
2464 + | "Unexpected value for `long`"
|
2465 + | );
|
2466 + | ::pretty_assertions::assert_eq!(
|
2467 + | input.map_of_lists_of_strings,
|
2468 + | expected.map_of_lists_of_strings,
|
2469 + | "Unexpected value for `map_of_lists_of_strings`"
|
2470 + | );
|
2471 + | ::pretty_assertions::assert_eq!(
|
2472 + | input.map_of_maps,
|
2473 + | expected.map_of_maps,
|
2474 + | "Unexpected value for `map_of_maps`"
|
2475 + | );
|
2476 + | ::pretty_assertions::assert_eq!(
|
2477 + | input.map_of_strings,
|
2478 + | expected.map_of_strings,
|
2479 + | "Unexpected value for `map_of_strings`"
|
2480 + | );
|
2481 + | ::pretty_assertions::assert_eq!(
|
2482 + | input.map_of_structs,
|
2483 + | expected.map_of_structs,
|
2484 + | "Unexpected value for `map_of_structs`"
|
2485 + | );
|
2486 + | ::pretty_assertions::assert_eq!(
|
2487 + | input.recursive_list,
|
2488 + | expected.recursive_list,
|
2489 + | "Unexpected value for `recursive_list`"
|
2490 + | );
|
2491 + | ::pretty_assertions::assert_eq!(
|
2492 + | input.recursive_map,
|
2493 + | expected.recursive_map,
|
2494 + | "Unexpected value for `recursive_map`"
|
2495 + | );
|
2496 + | ::pretty_assertions::assert_eq!(
|
2497 + | input.recursive_struct,
|
2498 + | expected.recursive_struct,
|
2499 + | "Unexpected value for `recursive_struct`"
|
2500 + | );
|
2501 + | ::pretty_assertions::assert_eq!(
|
2502 + | input.simple_struct,
|
2503 + | expected.simple_struct,
|
2504 + | "Unexpected value for `simple_struct`"
|
2505 + | );
|
2506 + | ::pretty_assertions::assert_eq!(
|
2507 + | input.string,
|
2508 + | expected.string,
|
2509 + | "Unexpected value for `string`"
|
2510 + | );
|
2511 + | ::pretty_assertions::assert_eq!(
|
2512 + | input.struct_with_json_name,
|
2513 + | expected.struct_with_json_name,
|
2514 + | "Unexpected value for `struct_with_json_name`"
|
2515 + | );
|
2516 + | ::pretty_assertions::assert_eq!(
|
2517 + | input.timestamp,
|
2518 + | expected.timestamp,
|
2519 + | "Unexpected value for `timestamp`"
|
2520 + | );
|
2521 + | ::pretty_assertions::assert_eq!(
|
2522 + | input.unix_timestamp,
|
2523 + | expected.unix_timestamp,
|
2524 + | "Unexpected value for `unix_timestamp`"
|
2525 + | );
|
2526 + | let output = crate::output::KitchenSinkOperationOutput {
|
2527 + | blob: ::std::option::Option::None,
|
2528 + | boolean: ::std::option::Option::None,
|
2529 + | double: ::std::option::Option::None,
|
2530 + | empty_struct: ::std::option::Option::None,
|
2531 + | float: ::std::option::Option::None,
|
2532 + | httpdate_timestamp: ::std::option::Option::None,
|
2533 + | integer: ::std::option::Option::None,
|
2534 + | iso8601_timestamp: ::std::option::Option::None,
|
2535 + | json_value: ::std::option::Option::None,
|
2536 + | list_of_lists: ::std::option::Option::None,
|
2537 + | list_of_maps_of_strings: ::std::option::Option::None,
|
2538 + | list_of_strings: ::std::option::Option::None,
|
2539 + | list_of_structs: ::std::option::Option::None,
|
2540 + | long: ::std::option::Option::None,
|
2541 + | map_of_lists_of_strings: ::std::option::Option::None,
|
2542 + | map_of_maps: ::std::option::Option::None,
|
2543 + | map_of_strings: ::std::option::Option::None,
|
2544 + | map_of_structs: ::std::option::Option::None,
|
2545 + | recursive_list: ::std::option::Option::None,
|
2546 + | recursive_map: ::std::option::Option::None,
|
2547 + | recursive_struct: ::std::option::Option::None,
|
2548 + | simple_struct: ::std::option::Option::None,
|
2549 + | string: ::std::option::Option::None,
|
2550 + | struct_with_json_name: ::std::option::Option::None,
|
2551 + | timestamp: ::std::option::Option::None,
|
2552 + | unix_timestamp: ::std::option::Option::None,
|
2553 + | };
|
2554 + | Ok(output)
|
2555 + | };
|
2556 + | sender.send(()).await.expect("receiver dropped early");
|
2557 + | result
|
2558 + | }
|
2559 + | })
|
2560 + | .build_unchecked();
|
2561 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1546 2562 | .await
|
1547 - | .expect("unable to collect body")
|
1548 - | .to_bytes();
|
1549 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1550 - | &body,
|
1551 - | "{\n \"contents\": {\n \"blobValue\": \"Zm9v\"\n }\n}",
|
1552 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1553 - | ));
|
2563 + | .expect("unable to make an HTTP request");
|
2564 + | assert!(
|
2565 + | receiver.recv().await.is_some(),
|
2566 + | "we expected operation handler to be invoked but it was not entered"
|
2567 + | );
|
1554 2568 | }
|
1555 2569 |
|
1556 - | /// Deserializes a timestamp union value
|
1557 - | /// Test ID: AwsJson11DeserializeTimestampUnionValue
|
2570 + | /// Serializes timestamp shapes
|
2571 + | /// Test ID: serializes_timestamp_shapes
|
1558 2572 | #[::tokio::test]
|
1559 2573 | #[::tracing_test::traced_test]
|
1560 - | async fn aws_json11_deserialize_timestamp_union_value_response() {
|
1561 - | let output = crate::output::JsonUnionsOutput {
|
1562 - | contents: ::std::option::Option::Some(crate::model::MyUnion::TimestampValue(
|
1563 - | ::aws_smithy_types::DateTime::from_fractional_secs(1398796238, 0_f64),
|
1564 - | )),
|
1565 - | };
|
1566 - | use ::aws_smithy_http_server::response::IntoResponse;
|
1567 - | let http_response = output.into_response();
|
1568 - | ::pretty_assertions::assert_eq!(
|
1569 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1570 - | http_response.status()
|
1571 - | );
|
1572 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1573 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1574 - | http_response.headers(),
|
1575 - | expected_headers,
|
1576 - | ));
|
1577 - | use ::http_body_util::BodyExt;
|
1578 - | let body = http_response
|
1579 - | .into_body()
|
1580 - | .collect()
|
2574 + | async fn serializes_timestamp_shapes_request() {
|
2575 + | #[allow(unused_mut)]
|
2576 + | let mut http_request = ::http_1x::Request::builder()
|
2577 + | .uri("/")
|
2578 + | .method("POST")
|
2579 + | .header("Content-Type", "application/x-amz-json-1.1")
|
2580 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
2581 + | .body(::aws_smithy_http_server::body::boxed(
|
2582 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2583 + | &::aws_smithy_protocol_test::decode_body_data(
|
2584 + | "{\"Timestamp\":946845296}".as_bytes(),
|
2585 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2586 + | ),
|
2587 + | )),
|
2588 + | ))
|
2589 + | .unwrap();
|
2590 + | #[allow(unused_mut)]
|
2591 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2592 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
2593 + | let service = crate::service::JsonProtocol::builder::<
|
2594 + | ::aws_smithy_http_server::body::BoxBody,
|
2595 + | _,
|
2596 + | _,
|
2597 + | _,
|
2598 + | >(config)
|
2599 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
2600 + | let sender = sender.clone();
|
2601 + | async move {
|
2602 + | let result = {
|
2603 + | use ::aws_smithy_protocol_test::FloatEquals;
|
2604 + | let expected = crate::input::KitchenSinkOperationInput {
|
2605 + | timestamp: ::std::option::Option::Some(
|
2606 + | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
2607 + | ),
|
2608 + | blob: ::std::option::Option::None,
|
2609 + | boolean: ::std::option::Option::None,
|
2610 + | double: ::std::option::Option::None,
|
2611 + | empty_struct: ::std::option::Option::None,
|
2612 + | float: ::std::option::Option::None,
|
2613 + | httpdate_timestamp: ::std::option::Option::None,
|
2614 + | integer: ::std::option::Option::None,
|
2615 + | iso8601_timestamp: ::std::option::Option::None,
|
2616 + | json_value: ::std::option::Option::None,
|
2617 + | list_of_lists: ::std::option::Option::None,
|
2618 + | list_of_maps_of_strings: ::std::option::Option::None,
|
2619 + | list_of_strings: ::std::option::Option::None,
|
2620 + | list_of_structs: ::std::option::Option::None,
|
2621 + | long: ::std::option::Option::None,
|
2622 + | map_of_lists_of_strings: ::std::option::Option::None,
|
2623 + | map_of_maps: ::std::option::Option::None,
|
2624 + | map_of_strings: ::std::option::Option::None,
|
2625 + | map_of_structs: ::std::option::Option::None,
|
2626 + | recursive_list: ::std::option::Option::None,
|
2627 + | recursive_map: ::std::option::Option::None,
|
2628 + | recursive_struct: ::std::option::Option::None,
|
2629 + | simple_struct: ::std::option::Option::None,
|
2630 + | string: ::std::option::Option::None,
|
2631 + | struct_with_json_name: ::std::option::Option::None,
|
2632 + | unix_timestamp: ::std::option::Option::None,
|
2633 + | };
|
2634 + | ::pretty_assertions::assert_eq!(
|
2635 + | input.blob,
|
2636 + | expected.blob,
|
2637 + | "Unexpected value for `blob`"
|
2638 + | );
|
2639 + | ::pretty_assertions::assert_eq!(
|
2640 + | input.boolean,
|
2641 + | expected.boolean,
|
2642 + | "Unexpected value for `boolean`"
|
2643 + | );
|
2644 + | assert!(
|
2645 + | input.double.float_equals(&expected.double),
|
2646 + | "Unexpected value for `double` {:?} vs. {:?}",
|
2647 + | expected.double,
|
2648 + | input.double
|
2649 + | );
|
2650 + | ::pretty_assertions::assert_eq!(
|
2651 + | input.empty_struct,
|
2652 + | expected.empty_struct,
|
2653 + | "Unexpected value for `empty_struct`"
|
2654 + | );
|
2655 + | assert!(
|
2656 + | input.float.float_equals(&expected.float),
|
2657 + | "Unexpected value for `float` {:?} vs. {:?}",
|
2658 + | expected.float,
|
2659 + | input.float
|
2660 + | );
|
2661 + | ::pretty_assertions::assert_eq!(
|
2662 + | input.httpdate_timestamp,
|
2663 + | expected.httpdate_timestamp,
|
2664 + | "Unexpected value for `httpdate_timestamp`"
|
2665 + | );
|
2666 + | ::pretty_assertions::assert_eq!(
|
2667 + | input.integer,
|
2668 + | expected.integer,
|
2669 + | "Unexpected value for `integer`"
|
2670 + | );
|
2671 + | ::pretty_assertions::assert_eq!(
|
2672 + | input.iso8601_timestamp,
|
2673 + | expected.iso8601_timestamp,
|
2674 + | "Unexpected value for `iso8601_timestamp`"
|
2675 + | );
|
2676 + | ::pretty_assertions::assert_eq!(
|
2677 + | input.json_value,
|
2678 + | expected.json_value,
|
2679 + | "Unexpected value for `json_value`"
|
2680 + | );
|
2681 + | ::pretty_assertions::assert_eq!(
|
2682 + | input.list_of_lists,
|
2683 + | expected.list_of_lists,
|
2684 + | "Unexpected value for `list_of_lists`"
|
2685 + | );
|
2686 + | ::pretty_assertions::assert_eq!(
|
2687 + | input.list_of_maps_of_strings,
|
2688 + | expected.list_of_maps_of_strings,
|
2689 + | "Unexpected value for `list_of_maps_of_strings`"
|
2690 + | );
|
2691 + | ::pretty_assertions::assert_eq!(
|
2692 + | input.list_of_strings,
|
2693 + | expected.list_of_strings,
|
2694 + | "Unexpected value for `list_of_strings`"
|
2695 + | );
|
2696 + | ::pretty_assertions::assert_eq!(
|
2697 + | input.list_of_structs,
|
2698 + | expected.list_of_structs,
|
2699 + | "Unexpected value for `list_of_structs`"
|
2700 + | );
|
2701 + | ::pretty_assertions::assert_eq!(
|
2702 + | input.long,
|
2703 + | expected.long,
|
2704 + | "Unexpected value for `long`"
|
2705 + | );
|
2706 + | ::pretty_assertions::assert_eq!(
|
2707 + | input.map_of_lists_of_strings,
|
2708 + | expected.map_of_lists_of_strings,
|
2709 + | "Unexpected value for `map_of_lists_of_strings`"
|
2710 + | );
|
2711 + | ::pretty_assertions::assert_eq!(
|
2712 + | input.map_of_maps,
|
2713 + | expected.map_of_maps,
|
2714 + | "Unexpected value for `map_of_maps`"
|
2715 + | );
|
2716 + | ::pretty_assertions::assert_eq!(
|
2717 + | input.map_of_strings,
|
2718 + | expected.map_of_strings,
|
2719 + | "Unexpected value for `map_of_strings`"
|
2720 + | );
|
2721 + | ::pretty_assertions::assert_eq!(
|
2722 + | input.map_of_structs,
|
2723 + | expected.map_of_structs,
|
2724 + | "Unexpected value for `map_of_structs`"
|
2725 + | );
|
2726 + | ::pretty_assertions::assert_eq!(
|
2727 + | input.recursive_list,
|
2728 + | expected.recursive_list,
|
2729 + | "Unexpected value for `recursive_list`"
|
2730 + | );
|
2731 + | ::pretty_assertions::assert_eq!(
|
2732 + | input.recursive_map,
|
2733 + | expected.recursive_map,
|
2734 + | "Unexpected value for `recursive_map`"
|
2735 + | );
|
2736 + | ::pretty_assertions::assert_eq!(
|
2737 + | input.recursive_struct,
|
2738 + | expected.recursive_struct,
|
2739 + | "Unexpected value for `recursive_struct`"
|
2740 + | );
|
2741 + | ::pretty_assertions::assert_eq!(
|
2742 + | input.simple_struct,
|
2743 + | expected.simple_struct,
|
2744 + | "Unexpected value for `simple_struct`"
|
2745 + | );
|
2746 + | ::pretty_assertions::assert_eq!(
|
2747 + | input.string,
|
2748 + | expected.string,
|
2749 + | "Unexpected value for `string`"
|
2750 + | );
|
2751 + | ::pretty_assertions::assert_eq!(
|
2752 + | input.struct_with_json_name,
|
2753 + | expected.struct_with_json_name,
|
2754 + | "Unexpected value for `struct_with_json_name`"
|
2755 + | );
|
2756 + | ::pretty_assertions::assert_eq!(
|
2757 + | input.timestamp,
|
2758 + | expected.timestamp,
|
2759 + | "Unexpected value for `timestamp`"
|
2760 + | );
|
2761 + | ::pretty_assertions::assert_eq!(
|
2762 + | input.unix_timestamp,
|
2763 + | expected.unix_timestamp,
|
2764 + | "Unexpected value for `unix_timestamp`"
|
2765 + | );
|
2766 + | let output = crate::output::KitchenSinkOperationOutput {
|
2767 + | blob: ::std::option::Option::None,
|
2768 + | boolean: ::std::option::Option::None,
|
2769 + | double: ::std::option::Option::None,
|
2770 + | empty_struct: ::std::option::Option::None,
|
2771 + | float: ::std::option::Option::None,
|
2772 + | httpdate_timestamp: ::std::option::Option::None,
|
2773 + | integer: ::std::option::Option::None,
|
2774 + | iso8601_timestamp: ::std::option::Option::None,
|
2775 + | json_value: ::std::option::Option::None,
|
2776 + | list_of_lists: ::std::option::Option::None,
|
2777 + | list_of_maps_of_strings: ::std::option::Option::None,
|
2778 + | list_of_strings: ::std::option::Option::None,
|
2779 + | list_of_structs: ::std::option::Option::None,
|
2780 + | long: ::std::option::Option::None,
|
2781 + | map_of_lists_of_strings: ::std::option::Option::None,
|
2782 + | map_of_maps: ::std::option::Option::None,
|
2783 + | map_of_strings: ::std::option::Option::None,
|
2784 + | map_of_structs: ::std::option::Option::None,
|
2785 + | recursive_list: ::std::option::Option::None,
|
2786 + | recursive_map: ::std::option::Option::None,
|
2787 + | recursive_struct: ::std::option::Option::None,
|
2788 + | simple_struct: ::std::option::Option::None,
|
2789 + | string: ::std::option::Option::None,
|
2790 + | struct_with_json_name: ::std::option::Option::None,
|
2791 + | timestamp: ::std::option::Option::None,
|
2792 + | unix_timestamp: ::std::option::Option::None,
|
2793 + | };
|
2794 + | Ok(output)
|
2795 + | };
|
2796 + | sender.send(()).await.expect("receiver dropped early");
|
2797 + | result
|
2798 + | }
|
2799 + | })
|
2800 + | .build_unchecked();
|
2801 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1581 2802 | .await
|
1582 - | .expect("unable to collect body")
|
1583 - | .to_bytes();
|
1584 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1585 - | &body,
|
1586 - | "{\n \"contents\": {\n \"timestampValue\": 1398796238\n }\n}",
|
1587 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1588 - | ));
|
1589 - | }
|
1590 - |
|
1591 - | /// Deserializes an enum union value
|
1592 - | /// Test ID: AwsJson11DeserializeEnumUnionValue
|
1593 - | #[::tokio::test]
|
1594 - | #[::tracing_test::traced_test]
|
1595 - | async fn aws_json11_deserialize_enum_union_value_response() {
|
1596 - | let output = crate::output::JsonUnionsOutput {
|
1597 - | contents: ::std::option::Option::Some(crate::model::MyUnion::EnumValue(
|
1598 - | "Foo"
|
1599 - | .parse::<crate::model::FooEnum>()
|
1600 - | .expect("static value validated to member"),
|
1601 - | )),
|
1602 - | };
|
1603 - | use ::aws_smithy_http_server::response::IntoResponse;
|
1604 - | let http_response = output.into_response();
|
1605 - | ::pretty_assertions::assert_eq!(
|
1606 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1607 - | http_response.status()
|
1608 - | );
|
1609 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1610 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1611 - | http_response.headers(),
|
1612 - | expected_headers,
|
1613 - | ));
|
1614 - | use ::http_body_util::BodyExt;
|
1615 - | let body = http_response
|
1616 - | .into_body()
|
1617 - | .collect()
|
1618 - | .await
|
1619 - | .expect("unable to collect body")
|
1620 - | .to_bytes();
|
1621 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1622 - | &body,
|
1623 - | "{\n \"contents\": {\n \"enumValue\": \"Foo\"\n }\n}",
|
1624 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1625 - | ));
|
1626 - | }
|
1627 - |
|
1628 - | /// Deserializes a list union value
|
1629 - | /// Test ID: AwsJson11DeserializeListUnionValue
|
1630 - | #[::tokio::test]
|
1631 - | #[::tracing_test::traced_test]
|
1632 - | async fn aws_json11_deserialize_list_union_value_response() {
|
1633 - | let output = crate::output::JsonUnionsOutput {
|
1634 - | contents: ::std::option::Option::Some(crate::model::MyUnion::ListValue(vec![
|
1635 - | "foo".to_owned(),
|
1636 - | "bar".to_owned(),
|
1637 - | ])),
|
1638 - | };
|
1639 - | use ::aws_smithy_http_server::response::IntoResponse;
|
1640 - | let http_response = output.into_response();
|
1641 - | ::pretty_assertions::assert_eq!(
|
1642 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1643 - | http_response.status()
|
1644 - | );
|
1645 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1646 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1647 - | http_response.headers(),
|
1648 - | expected_headers,
|
1649 - | ));
|
1650 - | use ::http_body_util::BodyExt;
|
1651 - | let body = http_response
|
1652 - | .into_body()
|
1653 - | .collect()
|
1654 - | .await
|
1655 - | .expect("unable to collect body")
|
1656 - | .to_bytes();
|
1657 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1658 - | &body,
|
1659 - | "{\n \"contents\": {\n \"listValue\": [\"foo\", \"bar\"]\n }\n}",
|
1660 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1661 - | ));
|
1662 - | }
|
1663 - |
|
1664 - | /// Deserializes a map union value
|
1665 - | /// Test ID: AwsJson11DeserializeMapUnionValue
|
1666 - | #[::tokio::test]
|
1667 - | #[::tracing_test::traced_test]
|
1668 - | async fn aws_json11_deserialize_map_union_value_response() {
|
1669 - | let output = crate::output::JsonUnionsOutput {
|
1670 - | contents: ::std::option::Option::Some(crate::model::MyUnion::MapValue({
|
1671 - | let mut ret = ::std::collections::HashMap::new();
|
1672 - | ret.insert("foo".to_owned(), "bar".to_owned());
|
1673 - | ret.insert("spam".to_owned(), "eggs".to_owned());
|
1674 - | ret
|
1675 - | })),
|
1676 - | };
|
1677 - | use ::aws_smithy_http_server::response::IntoResponse;
|
1678 - | let http_response = output.into_response();
|
1679 - | ::pretty_assertions::assert_eq!(
|
1680 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1681 - | http_response.status()
|
1682 - | );
|
1683 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1684 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1685 - | http_response.headers(),
|
1686 - | expected_headers,
|
1687 - | ));
|
1688 - | use ::http_body_util::BodyExt;
|
1689 - | let body = http_response
|
1690 - | .into_body()
|
1691 - | .collect()
|
1692 - | .await
|
1693 - | .expect("unable to collect body")
|
1694 - | .to_bytes();
|
1695 - | ::aws_smithy_protocol_test::assert_ok(
|
1696 - | ::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"))
|
2803 + | .expect("unable to make an HTTP request");
|
2804 + | assert!(
|
2805 + | receiver.recv().await.is_some(),
|
2806 + | "we expected operation handler to be invoked but it was not entered"
|
1697 2807 | );
|
1698 2808 | }
|
1699 2809 |
|
1700 - | /// Deserializes a structure union value
|
1701 - | /// Test ID: AwsJson11DeserializeStructureUnionValue
|
2810 + | /// Serializes timestamp shapes with iso8601 timestampFormat
|
2811 + | /// Test ID: serializes_timestamp_shapes_with_iso8601_timestampformat
|
1702 2812 | #[::tokio::test]
|
1703 2813 | #[::tracing_test::traced_test]
|
1704 - | async fn aws_json11_deserialize_structure_union_value_response() {
|
1705 - | let output = crate::output::JsonUnionsOutput {
|
1706 - | contents: ::std::option::Option::Some(crate::model::MyUnion::StructureValue(
|
1707 - | crate::model::GreetingStruct {
|
1708 - | hi: ::std::option::Option::Some("hello".to_owned()),
|
1709 - | },
|
1710 - | )),
|
1711 - | };
|
1712 - | use ::aws_smithy_http_server::response::IntoResponse;
|
1713 - | let http_response = output.into_response();
|
1714 - | ::pretty_assertions::assert_eq!(
|
1715 - | ::http_1x::StatusCode::from_u16(200).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 - | use ::http_body_util::BodyExt;
|
1724 - | let body = http_response
|
1725 - | .into_body()
|
1726 - | .collect()
|
1727 - | .await
|
1728 - | .expect("unable to collect body")
|
1729 - | .to_bytes();
|
1730 - | ::aws_smithy_protocol_test::assert_ok(
|
1731 - | ::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"))
|
1732 - | );
|
1733 - | }
|
1734 - | }
|
1735 - |
|
1736 - | ::pin_project_lite::pin_project! {
|
1737 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
1738 - | /// [`GreetingWithErrorsInput`](crate::input::GreetingWithErrorsInput) using modelled bindings.
|
1739 - | pub struct GreetingWithErrorsInputFuture {
|
1740 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::GreetingWithErrorsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
1741 - | }
|
1742 - | }
|
1743 - |
|
1744 - | impl std::future::Future for GreetingWithErrorsInputFuture {
|
1745 - | type Output = Result<
|
1746 - | crate::input::GreetingWithErrorsInput,
|
1747 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
1748 - | >;
|
1749 - |
|
1750 - | fn poll(
|
1751 - | self: std::pin::Pin<&mut Self>,
|
1752 - | cx: &mut std::task::Context<'_>,
|
1753 - | ) -> std::task::Poll<Self::Output> {
|
1754 - | let this = self.project();
|
1755 - | this.inner.as_mut().poll(cx)
|
1756 - | }
|
1757 - | }
|
1758 - |
|
1759 - | impl<B>
|
1760 - | ::aws_smithy_http_server::request::FromRequest<
|
1761 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1762 - | B,
|
1763 - | > for crate::input::GreetingWithErrorsInput
|
1764 - | where
|
1765 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
1766 - | B: 'static,
|
1767 - |
|
1768 - | B::Data: Send,
|
1769 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
1770 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
1771 - | {
|
1772 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
1773 - | type Future = GreetingWithErrorsInputFuture;
|
1774 - |
|
1775 - | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
1776 - | let fut = async move {
|
1777 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
1778 - | request.headers(),
|
1779 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
1780 - | ) {
|
1781 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
1782 - | }
|
1783 - | crate::protocol_serde::shape_greeting_with_errors::de_greeting_with_errors_http_request(
|
1784 - | request,
|
1785 - | )
|
1786 - | .await
|
1787 - | };
|
1788 - | use ::futures_util::future::TryFutureExt;
|
1789 - | let fut = fut.map_err(
|
1790 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
1791 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
1792 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
1793 - | },
|
1794 - | );
|
1795 - | GreetingWithErrorsInputFuture {
|
1796 - | inner: Box::pin(fut),
|
1797 - | }
|
1798 - | }
|
1799 - | }
|
1800 - | impl
|
1801 - | ::aws_smithy_http_server::response::IntoResponse<
|
1802 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1803 - | > for crate::output::GreetingWithErrorsOutput
|
1804 - | {
|
1805 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
1806 - | match crate::protocol_serde::shape_greeting_with_errors::ser_greeting_with_errors_http_response(self) {
|
1807 - | Ok(response) => response,
|
1808 - | Err(e) => {
|
1809 - | ::tracing::error!(error = %e, "failed to serialize response");
|
1810 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
1811 - | }
|
1812 - | }
|
1813 - | }
|
1814 - | }
|
1815 - | impl
|
1816 - | ::aws_smithy_http_server::response::IntoResponse<
|
1817 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1818 - | > for crate::error::GreetingWithErrorsError
|
1819 - | {
|
1820 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
1821 - | match crate::protocol_serde::shape_greeting_with_errors::ser_greeting_with_errors_http_error(
|
1822 - | &self,
|
1823 - | ) {
|
1824 - | Ok(mut response) => {
|
1825 - | response.extensions_mut().insert(
|
1826 - | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
1827 - | );
|
1828 - | response
|
1829 - | }
|
1830 - | Err(e) => {
|
1831 - | ::tracing::error!(error = %e, "failed to serialize response");
|
1832 - | ::aws_smithy_http_server::response::IntoResponse::<
|
1833 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1834 - | >::into_response(
|
1835 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
1836 - | e,
|
1837 - | ),
|
1838 - | )
|
1839 - | }
|
1840 - | }
|
1841 - | }
|
1842 - | }
|
1843 - |
|
1844 - | #[allow(unreachable_code, unused_variables)]
|
1845 - | #[cfg(test)]
|
1846 - | mod greeting_with_errors_test {
|
1847 - |
|
1848 - | /// Parses simple JSON errors
|
1849 - | /// Test ID: AwsJson11InvalidGreetingError
|
1850 - | #[::tokio::test]
|
1851 - | #[::tracing_test::traced_test]
|
1852 - | async fn aws_json11_invalid_greeting_error_response() {
|
1853 - | let output = crate::error::InvalidGreeting {
|
1854 - | message: ::std::option::Option::Some("Hi".to_owned()),
|
1855 - | };
|
1856 - | let output = crate::error::GreetingWithErrorsError::InvalidGreeting(output);
|
1857 - | use ::aws_smithy_http_server::response::IntoResponse;
|
1858 - | let http_response = output.into_response();
|
1859 - | ::pretty_assertions::assert_eq!(
|
1860 - | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1861 - | http_response.status()
|
1862 - | );
|
1863 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1864 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1865 - | http_response.headers(),
|
1866 - | expected_headers,
|
1867 - | ));
|
1868 - | use ::http_body_util::BodyExt;
|
1869 - | let body = http_response
|
1870 - | .into_body()
|
1871 - | .collect()
|
1872 - | .await
|
1873 - | .expect("unable to collect body")
|
1874 - | .to_bytes();
|
1875 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1876 - | &body,
|
1877 - | "{\n \"__type\": \"InvalidGreeting\",\n \"Message\": \"Hi\"\n}",
|
1878 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1879 - | ));
|
1880 - | }
|
1881 - |
|
1882 - | /// Parses a complex error with no message member
|
1883 - | /// Test ID: AwsJson11ComplexError
|
1884 - | #[::tokio::test]
|
1885 - | #[::tracing_test::traced_test]
|
1886 - | async fn aws_json11_complex_error_response() {
|
1887 - | let output = crate::error::ComplexError {
|
1888 - | top_level: ::std::option::Option::Some("Top level".to_owned()),
|
1889 - | nested: ::std::option::Option::Some(crate::model::ComplexNestedErrorData {
|
1890 - | foo: ::std::option::Option::Some("bar".to_owned()),
|
1891 - | }),
|
1892 - | };
|
1893 - | let output = crate::error::GreetingWithErrorsError::ComplexError(output);
|
1894 - | use ::aws_smithy_http_server::response::IntoResponse;
|
1895 - | let http_response = output.into_response();
|
1896 - | ::pretty_assertions::assert_eq!(
|
1897 - | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1898 - | http_response.status()
|
1899 - | );
|
1900 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1901 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1902 - | http_response.headers(),
|
1903 - | expected_headers,
|
1904 - | ));
|
1905 - | use ::http_body_util::BodyExt;
|
1906 - | let body = http_response
|
1907 - | .into_body()
|
1908 - | .collect()
|
1909 - | .await
|
1910 - | .expect("unable to collect body")
|
1911 - | .to_bytes();
|
1912 - | ::aws_smithy_protocol_test::assert_ok(
|
1913 - | ::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"))
|
1914 - | );
|
1915 - | }
|
1916 - | /// Test ID: AwsJson11EmptyComplexError
|
1917 - | #[::tokio::test]
|
1918 - | #[::tracing_test::traced_test]
|
1919 - | async fn aws_json11_empty_complex_error_response() {
|
1920 - | let output = crate::error::ComplexError {
|
1921 - | top_level: ::std::option::Option::None,
|
1922 - | nested: ::std::option::Option::None,
|
1923 - | };
|
1924 - | let output = crate::error::GreetingWithErrorsError::ComplexError(output);
|
1925 - | use ::aws_smithy_http_server::response::IntoResponse;
|
1926 - | let http_response = output.into_response();
|
1927 - | ::pretty_assertions::assert_eq!(
|
1928 - | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1929 - | http_response.status()
|
1930 - | );
|
1931 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1932 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1933 - | http_response.headers(),
|
1934 - | expected_headers,
|
1935 - | ));
|
1936 - | use ::http_body_util::BodyExt;
|
1937 - | let body = http_response
|
1938 - | .into_body()
|
1939 - | .collect()
|
1940 - | .await
|
1941 - | .expect("unable to collect body")
|
1942 - | .to_bytes();
|
1943 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1944 - | &body,
|
1945 - | "{\n \"__type\": \"ComplexError\"\n}",
|
1946 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1947 - | ));
|
1948 - | }
|
1949 - | }
|
1950 - |
|
1951 - | ::pin_project_lite::pin_project! {
|
1952 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
1953 - | /// [`SparseNullsOperationInput`](crate::input::SparseNullsOperationInput) using modelled bindings.
|
1954 - | pub struct SparseNullsOperationInputFuture {
|
1955 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SparseNullsOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
1956 - | }
|
1957 - | }
|
1958 - |
|
1959 - | impl std::future::Future for SparseNullsOperationInputFuture {
|
1960 - | type Output = Result<
|
1961 - | crate::input::SparseNullsOperationInput,
|
1962 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
1963 - | >;
|
1964 - |
|
1965 - | fn poll(
|
1966 - | self: std::pin::Pin<&mut Self>,
|
1967 - | cx: &mut std::task::Context<'_>,
|
1968 - | ) -> std::task::Poll<Self::Output> {
|
1969 - | let this = self.project();
|
1970 - | this.inner.as_mut().poll(cx)
|
1971 - | }
|
1972 - | }
|
1973 - |
|
1974 - | impl<B>
|
1975 - | ::aws_smithy_http_server::request::FromRequest<
|
1976 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1977 - | B,
|
1978 - | > for crate::input::SparseNullsOperationInput
|
1979 - | where
|
1980 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
1981 - | B: 'static,
|
1982 - |
|
1983 - | B::Data: Send,
|
1984 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
1985 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
1986 - | {
|
1987 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
1988 - | type Future = SparseNullsOperationInputFuture;
|
1989 - |
|
1990 - | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
1991 - | let fut = async move {
|
1992 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
1993 - | request.headers(),
|
1994 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
1995 - | ) {
|
1996 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
1997 - | }
|
1998 - | crate::protocol_serde::shape_sparse_nulls_operation::de_sparse_nulls_operation_http_request(request)
|
1999 - | .await
|
2000 - | };
|
2001 - | use ::futures_util::future::TryFutureExt;
|
2002 - | let fut = fut.map_err(
|
2003 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
2004 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2005 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
2006 - | },
|
2007 - | );
|
2008 - | SparseNullsOperationInputFuture {
|
2009 - | inner: Box::pin(fut),
|
2010 - | }
|
2011 - | }
|
2012 - | }
|
2013 - | impl
|
2014 - | ::aws_smithy_http_server::response::IntoResponse<
|
2015 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2016 - | > for crate::output::SparseNullsOperationOutput
|
2017 - | {
|
2018 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
2019 - | match crate::protocol_serde::shape_sparse_nulls_operation::ser_sparse_nulls_operation_http_response(self) {
|
2020 - | Ok(response) => response,
|
2021 - | Err(e) => {
|
2022 - | ::tracing::error!(error = %e, "failed to serialize response");
|
2023 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
2024 - | }
|
2025 - | }
|
2026 - | }
|
2027 - | }
|
2028 - |
|
2029 - | #[allow(unreachable_code, unused_variables)]
|
2030 - | #[cfg(test)]
|
2031 - | mod sparse_nulls_operation_test {
|
2032 - |
|
2033 - | /// Serializes null values in maps
|
2034 - | /// Test ID: AwsJson11SparseMapsSerializeNullValues
|
2035 - | #[::tokio::test]
|
2036 - | #[::tracing_test::traced_test]
|
2037 - | async fn aws_json11_sparse_maps_serialize_null_values_request() {
|
2814 + | async fn serializes_timestamp_shapes_with_iso8601_timestampformat_request() {
|
2038 2815 | #[allow(unused_mut)]
|
2039 2816 | let mut http_request = ::http_1x::Request::builder()
|
2040 2817 | .uri("/")
|
2041 2818 | .method("POST")
|
2042 2819 | .header("Content-Type", "application/x-amz-json-1.1")
|
2043 - | .header("X-Amz-Target", "JsonProtocol.SparseNullsOperation")
|
2820 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
2044 2821 | .body(::aws_smithy_http_server::body::boxed(
|
2045 2822 | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2046 2823 | &::aws_smithy_protocol_test::decode_body_data(
|
2047 - | "{\n \"sparseStringMap\": {\n \"foo\": null\n }\n}".as_bytes(),
|
2824 + | "{\"Iso8601Timestamp\":\"2000-01-02T20:34:56Z\"}".as_bytes(),
|
2048 2825 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2049 2826 | ),
|
2050 2827 | )),
|
2051 2828 | ))
|
2052 2829 | .unwrap();
|
2053 2830 | #[allow(unused_mut)]
|
2054 2831 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2055 2832 | let config = crate::service::JsonProtocolConfig::builder().build();
|
2056 2833 | let service = crate::service::JsonProtocol::builder::<
|
2057 2834 | ::aws_smithy_http_server::body::BoxBody,
|
2058 2835 | _,
|
2059 2836 | _,
|
2060 2837 | _,
|
2061 2838 | >(config)
|
2062 - | .sparse_nulls_operation(move |input: crate::input::SparseNullsOperationInput| {
|
2839 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
2063 2840 | let sender = sender.clone();
|
2064 2841 | async move {
|
2065 2842 | let result = {
|
2066 - | let expected = crate::input::SparseNullsOperationInput {
|
2067 - | sparse_string_map: ::std::option::Option::Some({
|
2068 - | let mut ret = ::std::collections::HashMap::new();
|
2069 - | ret.insert("foo".to_owned(), ::std::option::Option::None);
|
2070 - | ret
|
2071 - | }),
|
2072 - | sparse_string_list: ::std::option::Option::None,
|
2073 - | };
|
2074 - | ::pretty_assertions::assert_eq!(input, expected);
|
2075 - | let output = crate::output::SparseNullsOperationOutput {
|
2076 - | sparse_string_list: ::std::option::Option::None,
|
2077 - | sparse_string_map: ::std::option::Option::None,
|
2843 + | use ::aws_smithy_protocol_test::FloatEquals;
|
2844 + | let expected = crate::input::KitchenSinkOperationInput {
|
2845 + | iso8601_timestamp: ::std::option::Option::Some(
|
2846 + | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
2847 + | ),
|
2848 + | blob: ::std::option::Option::None,
|
2849 + | boolean: ::std::option::Option::None,
|
2850 + | double: ::std::option::Option::None,
|
2851 + | empty_struct: ::std::option::Option::None,
|
2852 + | float: ::std::option::Option::None,
|
2853 + | httpdate_timestamp: ::std::option::Option::None,
|
2854 + | integer: ::std::option::Option::None,
|
2855 + | json_value: ::std::option::Option::None,
|
2856 + | list_of_lists: ::std::option::Option::None,
|
2857 + | list_of_maps_of_strings: ::std::option::Option::None,
|
2858 + | list_of_strings: ::std::option::Option::None,
|
2859 + | list_of_structs: ::std::option::Option::None,
|
2860 + | long: ::std::option::Option::None,
|
2861 + | map_of_lists_of_strings: ::std::option::Option::None,
|
2862 + | map_of_maps: ::std::option::Option::None,
|
2863 + | map_of_strings: ::std::option::Option::None,
|
2864 + | map_of_structs: ::std::option::Option::None,
|
2865 + | recursive_list: ::std::option::Option::None,
|
2866 + | recursive_map: ::std::option::Option::None,
|
2867 + | recursive_struct: ::std::option::Option::None,
|
2868 + | simple_struct: ::std::option::Option::None,
|
2869 + | string: ::std::option::Option::None,
|
2870 + | struct_with_json_name: ::std::option::Option::None,
|
2871 + | timestamp: ::std::option::Option::None,
|
2872 + | unix_timestamp: ::std::option::Option::None,
|
2078 2873 | };
|
2079 - | output
|
2080 - | };
|
2081 - | sender.send(()).await.expect("receiver dropped early");
|
2082 - | result
|
2083 - | }
|
2084 - | })
|
2085 - | .build_unchecked();
|
2086 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2087 - | .await
|
2088 - | .expect("unable to make an HTTP request");
|
2089 - | assert!(
|
2090 - | receiver.recv().await.is_some(),
|
2091 - | "we expected operation handler to be invoked but it was not entered"
|
2874 + | ::pretty_assertions::assert_eq!(
|
2875 + | input.blob,
|
2876 + | expected.blob,
|
2877 + | "Unexpected value for `blob`"
|
2878 + | );
|
2879 + | ::pretty_assertions::assert_eq!(
|
2880 + | input.boolean,
|
2881 + | expected.boolean,
|
2882 + | "Unexpected value for `boolean`"
|
2883 + | );
|
2884 + | assert!(
|
2885 + | input.double.float_equals(&expected.double),
|
2886 + | "Unexpected value for `double` {:?} vs. {:?}",
|
2887 + | expected.double,
|
2888 + | input.double
|
2889 + | );
|
2890 + | ::pretty_assertions::assert_eq!(
|
2891 + | input.empty_struct,
|
2892 + | expected.empty_struct,
|
2893 + | "Unexpected value for `empty_struct`"
|
2894 + | );
|
2895 + | assert!(
|
2896 + | input.float.float_equals(&expected.float),
|
2897 + | "Unexpected value for `float` {:?} vs. {:?}",
|
2898 + | expected.float,
|
2899 + | input.float
|
2900 + | );
|
2901 + | ::pretty_assertions::assert_eq!(
|
2902 + | input.httpdate_timestamp,
|
2903 + | expected.httpdate_timestamp,
|
2904 + | "Unexpected value for `httpdate_timestamp`"
|
2905 + | );
|
2906 + | ::pretty_assertions::assert_eq!(
|
2907 + | input.integer,
|
2908 + | expected.integer,
|
2909 + | "Unexpected value for `integer`"
|
2910 + | );
|
2911 + | ::pretty_assertions::assert_eq!(
|
2912 + | input.iso8601_timestamp,
|
2913 + | expected.iso8601_timestamp,
|
2914 + | "Unexpected value for `iso8601_timestamp`"
|
2915 + | );
|
2916 + | ::pretty_assertions::assert_eq!(
|
2917 + | input.json_value,
|
2918 + | expected.json_value,
|
2919 + | "Unexpected value for `json_value`"
|
2920 + | );
|
2921 + | ::pretty_assertions::assert_eq!(
|
2922 + | input.list_of_lists,
|
2923 + | expected.list_of_lists,
|
2924 + | "Unexpected value for `list_of_lists`"
|
2925 + | );
|
2926 + | ::pretty_assertions::assert_eq!(
|
2927 + | input.list_of_maps_of_strings,
|
2928 + | expected.list_of_maps_of_strings,
|
2929 + | "Unexpected value for `list_of_maps_of_strings`"
|
2930 + | );
|
2931 + | ::pretty_assertions::assert_eq!(
|
2932 + | input.list_of_strings,
|
2933 + | expected.list_of_strings,
|
2934 + | "Unexpected value for `list_of_strings`"
|
2935 + | );
|
2936 + | ::pretty_assertions::assert_eq!(
|
2937 + | input.list_of_structs,
|
2938 + | expected.list_of_structs,
|
2939 + | "Unexpected value for `list_of_structs`"
|
2940 + | );
|
2941 + | ::pretty_assertions::assert_eq!(
|
2942 + | input.long,
|
2943 + | expected.long,
|
2944 + | "Unexpected value for `long`"
|
2945 + | );
|
2946 + | ::pretty_assertions::assert_eq!(
|
2947 + | input.map_of_lists_of_strings,
|
2948 + | expected.map_of_lists_of_strings,
|
2949 + | "Unexpected value for `map_of_lists_of_strings`"
|
2950 + | );
|
2951 + | ::pretty_assertions::assert_eq!(
|
2952 + | input.map_of_maps,
|
2953 + | expected.map_of_maps,
|
2954 + | "Unexpected value for `map_of_maps`"
|
2955 + | );
|
2956 + | ::pretty_assertions::assert_eq!(
|
2957 + | input.map_of_strings,
|
2958 + | expected.map_of_strings,
|
2959 + | "Unexpected value for `map_of_strings`"
|
2960 + | );
|
2961 + | ::pretty_assertions::assert_eq!(
|
2962 + | input.map_of_structs,
|
2963 + | expected.map_of_structs,
|
2964 + | "Unexpected value for `map_of_structs`"
|
2965 + | );
|
2966 + | ::pretty_assertions::assert_eq!(
|
2967 + | input.recursive_list,
|
2968 + | expected.recursive_list,
|
2969 + | "Unexpected value for `recursive_list`"
|
2970 + | );
|
2971 + | ::pretty_assertions::assert_eq!(
|
2972 + | input.recursive_map,
|
2973 + | expected.recursive_map,
|
2974 + | "Unexpected value for `recursive_map`"
|
2975 + | );
|
2976 + | ::pretty_assertions::assert_eq!(
|
2977 + | input.recursive_struct,
|
2978 + | expected.recursive_struct,
|
2979 + | "Unexpected value for `recursive_struct`"
|
2980 + | );
|
2981 + | ::pretty_assertions::assert_eq!(
|
2982 + | input.simple_struct,
|
2983 + | expected.simple_struct,
|
2984 + | "Unexpected value for `simple_struct`"
|
2985 + | );
|
2986 + | ::pretty_assertions::assert_eq!(
|
2987 + | input.string,
|
2988 + | expected.string,
|
2989 + | "Unexpected value for `string`"
|
2990 + | );
|
2991 + | ::pretty_assertions::assert_eq!(
|
2992 + | input.struct_with_json_name,
|
2993 + | expected.struct_with_json_name,
|
2994 + | "Unexpected value for `struct_with_json_name`"
|
2995 + | );
|
2996 + | ::pretty_assertions::assert_eq!(
|
2997 + | input.timestamp,
|
2998 + | expected.timestamp,
|
2999 + | "Unexpected value for `timestamp`"
|
3000 + | );
|
3001 + | ::pretty_assertions::assert_eq!(
|
3002 + | input.unix_timestamp,
|
3003 + | expected.unix_timestamp,
|
3004 + | "Unexpected value for `unix_timestamp`"
|
3005 + | );
|
3006 + | let output = crate::output::KitchenSinkOperationOutput {
|
3007 + | blob: ::std::option::Option::None,
|
3008 + | boolean: ::std::option::Option::None,
|
3009 + | double: ::std::option::Option::None,
|
3010 + | empty_struct: ::std::option::Option::None,
|
3011 + | float: ::std::option::Option::None,
|
3012 + | httpdate_timestamp: ::std::option::Option::None,
|
3013 + | integer: ::std::option::Option::None,
|
3014 + | iso8601_timestamp: ::std::option::Option::None,
|
3015 + | json_value: ::std::option::Option::None,
|
3016 + | list_of_lists: ::std::option::Option::None,
|
3017 + | list_of_maps_of_strings: ::std::option::Option::None,
|
3018 + | list_of_strings: ::std::option::Option::None,
|
3019 + | list_of_structs: ::std::option::Option::None,
|
3020 + | long: ::std::option::Option::None,
|
3021 + | map_of_lists_of_strings: ::std::option::Option::None,
|
3022 + | map_of_maps: ::std::option::Option::None,
|
3023 + | map_of_strings: ::std::option::Option::None,
|
3024 + | map_of_structs: ::std::option::Option::None,
|
3025 + | recursive_list: ::std::option::Option::None,
|
3026 + | recursive_map: ::std::option::Option::None,
|
3027 + | recursive_struct: ::std::option::Option::None,
|
3028 + | simple_struct: ::std::option::Option::None,
|
3029 + | string: ::std::option::Option::None,
|
3030 + | struct_with_json_name: ::std::option::Option::None,
|
3031 + | timestamp: ::std::option::Option::None,
|
3032 + | unix_timestamp: ::std::option::Option::None,
|
3033 + | };
|
3034 + | Ok(output)
|
3035 + | };
|
3036 + | sender.send(()).await.expect("receiver dropped early");
|
3037 + | result
|
3038 + | }
|
3039 + | })
|
3040 + | .build_unchecked();
|
3041 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3042 + | .await
|
3043 + | .expect("unable to make an HTTP request");
|
3044 + | assert!(
|
3045 + | receiver.recv().await.is_some(),
|
3046 + | "we expected operation handler to be invoked but it was not entered"
|
2092 3047 | );
|
2093 3048 | }
|
2094 3049 |
|
2095 - | /// Serializes null values in lists
|
2096 - | /// Test ID: AwsJson11SparseListsSerializeNull
|
3050 + | /// Serializes timestamp shapes with httpdate timestampFormat
|
3051 + | /// Test ID: serializes_timestamp_shapes_with_httpdate_timestampformat
|
2097 3052 | #[::tokio::test]
|
2098 3053 | #[::tracing_test::traced_test]
|
2099 - | async fn aws_json11_sparse_lists_serialize_null_request() {
|
3054 + | async fn serializes_timestamp_shapes_with_httpdate_timestampformat_request() {
|
2100 3055 | #[allow(unused_mut)]
|
2101 3056 | let mut http_request = ::http_1x::Request::builder()
|
2102 3057 | .uri("/")
|
2103 3058 | .method("POST")
|
2104 3059 | .header("Content-Type", "application/x-amz-json-1.1")
|
2105 - | .header("X-Amz-Target", "JsonProtocol.SparseNullsOperation")
|
3060 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
2106 3061 | .body(::aws_smithy_http_server::body::boxed(
|
2107 3062 | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2108 3063 | &::aws_smithy_protocol_test::decode_body_data(
|
2109 - | "{\n \"sparseStringList\": [\n null\n ]\n}".as_bytes(),
|
3064 + | "{\"HttpdateTimestamp\":\"Sun, 02 Jan 2000 20:34:56 GMT\"}".as_bytes(),
|
2110 3065 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2111 3066 | ),
|
2112 3067 | )),
|
2113 3068 | ))
|
2114 3069 | .unwrap();
|
2115 3070 | #[allow(unused_mut)]
|
2116 3071 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2117 3072 | let config = crate::service::JsonProtocolConfig::builder().build();
|
2118 3073 | let service = crate::service::JsonProtocol::builder::<
|
2119 3074 | ::aws_smithy_http_server::body::BoxBody,
|
2120 3075 | _,
|
2121 3076 | _,
|
2122 3077 | _,
|
2123 3078 | >(config)
|
2124 - | .sparse_nulls_operation(move |input: crate::input::SparseNullsOperationInput| {
|
3079 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
2125 3080 | let sender = sender.clone();
|
2126 3081 | async move {
|
2127 3082 | let result = {
|
2128 - | let expected = crate::input::SparseNullsOperationInput {
|
2129 - | sparse_string_list: ::std::option::Option::Some(vec![
|
2130 - | ::std::option::Option::None,
|
2131 - | ]),
|
2132 - | sparse_string_map: ::std::option::Option::None,
|
2133 - | };
|
2134 - | ::pretty_assertions::assert_eq!(input, expected);
|
2135 - | let output = crate::output::SparseNullsOperationOutput {
|
2136 - | sparse_string_list: ::std::option::Option::None,
|
2137 - | sparse_string_map: ::std::option::Option::None,
|
3083 + | use ::aws_smithy_protocol_test::FloatEquals;
|
3084 + | let expected = crate::input::KitchenSinkOperationInput {
|
3085 + | httpdate_timestamp: ::std::option::Option::Some(
|
3086 + | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
3087 + | ),
|
3088 + | blob: ::std::option::Option::None,
|
3089 + | boolean: ::std::option::Option::None,
|
3090 + | double: ::std::option::Option::None,
|
3091 + | empty_struct: ::std::option::Option::None,
|
3092 + | float: ::std::option::Option::None,
|
3093 + | integer: ::std::option::Option::None,
|
3094 + | iso8601_timestamp: ::std::option::Option::None,
|
3095 + | json_value: ::std::option::Option::None,
|
3096 + | list_of_lists: ::std::option::Option::None,
|
3097 + | list_of_maps_of_strings: ::std::option::Option::None,
|
3098 + | list_of_strings: ::std::option::Option::None,
|
3099 + | list_of_structs: ::std::option::Option::None,
|
3100 + | long: ::std::option::Option::None,
|
3101 + | map_of_lists_of_strings: ::std::option::Option::None,
|
3102 + | map_of_maps: ::std::option::Option::None,
|
3103 + | map_of_strings: ::std::option::Option::None,
|
3104 + | map_of_structs: ::std::option::Option::None,
|
3105 + | recursive_list: ::std::option::Option::None,
|
3106 + | recursive_map: ::std::option::Option::None,
|
3107 + | recursive_struct: ::std::option::Option::None,
|
3108 + | simple_struct: ::std::option::Option::None,
|
3109 + | string: ::std::option::Option::None,
|
3110 + | struct_with_json_name: ::std::option::Option::None,
|
3111 + | timestamp: ::std::option::Option::None,
|
3112 + | unix_timestamp: ::std::option::Option::None,
|
2138 3113 | };
|
2139 - | output
|
2140 - | };
|
2141 - | sender.send(()).await.expect("receiver dropped early");
|
2142 - | result
|
2143 - | }
|
2144 - | })
|
2145 - | .build_unchecked();
|
2146 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2147 - | .await
|
2148 - | .expect("unable to make an HTTP request");
|
2149 - | assert!(
|
2150 - | receiver.recv().await.is_some(),
|
2151 - | "we expected operation handler to be invoked but it was not entered"
|
2152 - | );
|
2153 - | }
|
2154 - |
|
2155 - | /// Deserializes null values in maps
|
2156 - | /// Test ID: AwsJson11SparseMapsDeserializeNullValues
|
2157 - | #[::tokio::test]
|
2158 - | #[::tracing_test::traced_test]
|
2159 - | async fn aws_json11_sparse_maps_deserialize_null_values_response() {
|
2160 - | let output = crate::output::SparseNullsOperationOutput {
|
2161 - | sparse_string_map: ::std::option::Option::Some({
|
2162 - | let mut ret = ::std::collections::HashMap::new();
|
2163 - | ret.insert("foo".to_owned(), ::std::option::Option::None);
|
2164 - | ret
|
2165 - | }),
|
2166 - | sparse_string_list: ::std::option::Option::None,
|
2167 - | };
|
2168 - | use ::aws_smithy_http_server::response::IntoResponse;
|
2169 - | let http_response = output.into_response();
|
2170 - | ::pretty_assertions::assert_eq!(
|
2171 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2172 - | http_response.status()
|
2173 - | );
|
2174 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
2175 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2176 - | http_response.headers(),
|
2177 - | expected_headers,
|
2178 - | ));
|
2179 - | use ::http_body_util::BodyExt;
|
2180 - | let body = http_response
|
2181 - | .into_body()
|
2182 - | .collect()
|
3114 + | ::pretty_assertions::assert_eq!(
|
3115 + | input.blob,
|
3116 + | expected.blob,
|
3117 + | "Unexpected value for `blob`"
|
3118 + | );
|
3119 + | ::pretty_assertions::assert_eq!(
|
3120 + | input.boolean,
|
3121 + | expected.boolean,
|
3122 + | "Unexpected value for `boolean`"
|
3123 + | );
|
3124 + | assert!(
|
3125 + | input.double.float_equals(&expected.double),
|
3126 + | "Unexpected value for `double` {:?} vs. {:?}",
|
3127 + | expected.double,
|
3128 + | input.double
|
3129 + | );
|
3130 + | ::pretty_assertions::assert_eq!(
|
3131 + | input.empty_struct,
|
3132 + | expected.empty_struct,
|
3133 + | "Unexpected value for `empty_struct`"
|
3134 + | );
|
3135 + | assert!(
|
3136 + | input.float.float_equals(&expected.float),
|
3137 + | "Unexpected value for `float` {:?} vs. {:?}",
|
3138 + | expected.float,
|
3139 + | input.float
|
3140 + | );
|
3141 + | ::pretty_assertions::assert_eq!(
|
3142 + | input.httpdate_timestamp,
|
3143 + | expected.httpdate_timestamp,
|
3144 + | "Unexpected value for `httpdate_timestamp`"
|
3145 + | );
|
3146 + | ::pretty_assertions::assert_eq!(
|
3147 + | input.integer,
|
3148 + | expected.integer,
|
3149 + | "Unexpected value for `integer`"
|
3150 + | );
|
3151 + | ::pretty_assertions::assert_eq!(
|
3152 + | input.iso8601_timestamp,
|
3153 + | expected.iso8601_timestamp,
|
3154 + | "Unexpected value for `iso8601_timestamp`"
|
3155 + | );
|
3156 + | ::pretty_assertions::assert_eq!(
|
3157 + | input.json_value,
|
3158 + | expected.json_value,
|
3159 + | "Unexpected value for `json_value`"
|
3160 + | );
|
3161 + | ::pretty_assertions::assert_eq!(
|
3162 + | input.list_of_lists,
|
3163 + | expected.list_of_lists,
|
3164 + | "Unexpected value for `list_of_lists`"
|
3165 + | );
|
3166 + | ::pretty_assertions::assert_eq!(
|
3167 + | input.list_of_maps_of_strings,
|
3168 + | expected.list_of_maps_of_strings,
|
3169 + | "Unexpected value for `list_of_maps_of_strings`"
|
3170 + | );
|
3171 + | ::pretty_assertions::assert_eq!(
|
3172 + | input.list_of_strings,
|
3173 + | expected.list_of_strings,
|
3174 + | "Unexpected value for `list_of_strings`"
|
3175 + | );
|
3176 + | ::pretty_assertions::assert_eq!(
|
3177 + | input.list_of_structs,
|
3178 + | expected.list_of_structs,
|
3179 + | "Unexpected value for `list_of_structs`"
|
3180 + | );
|
3181 + | ::pretty_assertions::assert_eq!(
|
3182 + | input.long,
|
3183 + | expected.long,
|
3184 + | "Unexpected value for `long`"
|
3185 + | );
|
3186 + | ::pretty_assertions::assert_eq!(
|
3187 + | input.map_of_lists_of_strings,
|
3188 + | expected.map_of_lists_of_strings,
|
3189 + | "Unexpected value for `map_of_lists_of_strings`"
|
3190 + | );
|
3191 + | ::pretty_assertions::assert_eq!(
|
3192 + | input.map_of_maps,
|
3193 + | expected.map_of_maps,
|
3194 + | "Unexpected value for `map_of_maps`"
|
3195 + | );
|
3196 + | ::pretty_assertions::assert_eq!(
|
3197 + | input.map_of_strings,
|
3198 + | expected.map_of_strings,
|
3199 + | "Unexpected value for `map_of_strings`"
|
3200 + | );
|
3201 + | ::pretty_assertions::assert_eq!(
|
3202 + | input.map_of_structs,
|
3203 + | expected.map_of_structs,
|
3204 + | "Unexpected value for `map_of_structs`"
|
3205 + | );
|
3206 + | ::pretty_assertions::assert_eq!(
|
3207 + | input.recursive_list,
|
3208 + | expected.recursive_list,
|
3209 + | "Unexpected value for `recursive_list`"
|
3210 + | );
|
3211 + | ::pretty_assertions::assert_eq!(
|
3212 + | input.recursive_map,
|
3213 + | expected.recursive_map,
|
3214 + | "Unexpected value for `recursive_map`"
|
3215 + | );
|
3216 + | ::pretty_assertions::assert_eq!(
|
3217 + | input.recursive_struct,
|
3218 + | expected.recursive_struct,
|
3219 + | "Unexpected value for `recursive_struct`"
|
3220 + | );
|
3221 + | ::pretty_assertions::assert_eq!(
|
3222 + | input.simple_struct,
|
3223 + | expected.simple_struct,
|
3224 + | "Unexpected value for `simple_struct`"
|
3225 + | );
|
3226 + | ::pretty_assertions::assert_eq!(
|
3227 + | input.string,
|
3228 + | expected.string,
|
3229 + | "Unexpected value for `string`"
|
3230 + | );
|
3231 + | ::pretty_assertions::assert_eq!(
|
3232 + | input.struct_with_json_name,
|
3233 + | expected.struct_with_json_name,
|
3234 + | "Unexpected value for `struct_with_json_name`"
|
3235 + | );
|
3236 + | ::pretty_assertions::assert_eq!(
|
3237 + | input.timestamp,
|
3238 + | expected.timestamp,
|
3239 + | "Unexpected value for `timestamp`"
|
3240 + | );
|
3241 + | ::pretty_assertions::assert_eq!(
|
3242 + | input.unix_timestamp,
|
3243 + | expected.unix_timestamp,
|
3244 + | "Unexpected value for `unix_timestamp`"
|
3245 + | );
|
3246 + | let output = crate::output::KitchenSinkOperationOutput {
|
3247 + | blob: ::std::option::Option::None,
|
3248 + | boolean: ::std::option::Option::None,
|
3249 + | double: ::std::option::Option::None,
|
3250 + | empty_struct: ::std::option::Option::None,
|
3251 + | float: ::std::option::Option::None,
|
3252 + | httpdate_timestamp: ::std::option::Option::None,
|
3253 + | integer: ::std::option::Option::None,
|
3254 + | iso8601_timestamp: ::std::option::Option::None,
|
3255 + | json_value: ::std::option::Option::None,
|
3256 + | list_of_lists: ::std::option::Option::None,
|
3257 + | list_of_maps_of_strings: ::std::option::Option::None,
|
3258 + | list_of_strings: ::std::option::Option::None,
|
3259 + | list_of_structs: ::std::option::Option::None,
|
3260 + | long: ::std::option::Option::None,
|
3261 + | map_of_lists_of_strings: ::std::option::Option::None,
|
3262 + | map_of_maps: ::std::option::Option::None,
|
3263 + | map_of_strings: ::std::option::Option::None,
|
3264 + | map_of_structs: ::std::option::Option::None,
|
3265 + | recursive_list: ::std::option::Option::None,
|
3266 + | recursive_map: ::std::option::Option::None,
|
3267 + | recursive_struct: ::std::option::Option::None,
|
3268 + | simple_struct: ::std::option::Option::None,
|
3269 + | string: ::std::option::Option::None,
|
3270 + | struct_with_json_name: ::std::option::Option::None,
|
3271 + | timestamp: ::std::option::Option::None,
|
3272 + | unix_timestamp: ::std::option::Option::None,
|
3273 + | };
|
3274 + | Ok(output)
|
3275 + | };
|
3276 + | sender.send(()).await.expect("receiver dropped early");
|
3277 + | result
|
3278 + | }
|
3279 + | })
|
3280 + | .build_unchecked();
|
3281 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2183 3282 | .await
|
2184 - | .expect("unable to collect body")
|
2185 - | .to_bytes();
|
2186 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2187 - | &body,
|
2188 - | "{\n \"sparseStringMap\": {\n \"foo\": null\n }\n}",
|
2189 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2190 - | ));
|
3283 + | .expect("unable to make an HTTP request");
|
3284 + | assert!(
|
3285 + | receiver.recv().await.is_some(),
|
3286 + | "we expected operation handler to be invoked but it was not entered"
|
3287 + | );
|
2191 3288 | }
|
2192 3289 |
|
2193 - | /// Deserializes null values in lists
|
2194 - | /// Test ID: AwsJson11SparseListsDeserializeNull
|
3290 + | /// Serializes timestamp shapes with unixTimestamp timestampFormat
|
3291 + | /// Test ID: serializes_timestamp_shapes_with_unixtimestamp_timestampformat
|
2195 3292 | #[::tokio::test]
|
2196 3293 | #[::tracing_test::traced_test]
|
2197 - | async fn aws_json11_sparse_lists_deserialize_null_response() {
|
2198 - | let output = crate::output::SparseNullsOperationOutput {
|
2199 - | sparse_string_list: ::std::option::Option::Some(vec![::std::option::Option::None]),
|
2200 - | sparse_string_map: ::std::option::Option::None,
|
2201 - | };
|
2202 - | use ::aws_smithy_http_server::response::IntoResponse;
|
2203 - | let http_response = output.into_response();
|
2204 - | ::pretty_assertions::assert_eq!(
|
2205 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2206 - | http_response.status()
|
2207 - | );
|
2208 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
2209 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2210 - | http_response.headers(),
|
2211 - | expected_headers,
|
2212 - | ));
|
2213 - | use ::http_body_util::BodyExt;
|
2214 - | let body = http_response
|
2215 - | .into_body()
|
2216 - | .collect()
|
2217 - | .await
|
2218 - | .expect("unable to collect body")
|
2219 - | .to_bytes();
|
2220 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2221 - | &body,
|
2222 - | "{\n \"sparseStringList\": [\n null\n ]\n}",
|
2223 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2224 - | ));
|
2225 - | }
|
2226 - | }
|
2227 - |
|
2228 - | ::pin_project_lite::pin_project! {
|
2229 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2230 - | /// [`NullOperationInput`](crate::input::NullOperationInput) using modelled bindings.
|
2231 - | pub struct NullOperationInputFuture {
|
2232 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::NullOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
2233 - | }
|
2234 - | }
|
2235 - |
|
2236 - | impl std::future::Future for NullOperationInputFuture {
|
2237 - | type Output = Result<
|
2238 - | crate::input::NullOperationInput,
|
2239 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
2240 - | >;
|
2241 - |
|
2242 - | fn poll(
|
2243 - | self: std::pin::Pin<&mut Self>,
|
2244 - | cx: &mut std::task::Context<'_>,
|
2245 - | ) -> std::task::Poll<Self::Output> {
|
2246 - | let this = self.project();
|
2247 - | this.inner.as_mut().poll(cx)
|
2248 - | }
|
2249 - | }
|
2250 - |
|
2251 - | impl<B>
|
2252 - | ::aws_smithy_http_server::request::FromRequest<
|
2253 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2254 - | B,
|
2255 - | > for crate::input::NullOperationInput
|
2256 - | where
|
2257 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
2258 - | B: 'static,
|
2259 - |
|
2260 - | B::Data: Send,
|
2261 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
2262 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
2263 - | {
|
2264 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
2265 - | type Future = NullOperationInputFuture;
|
2266 - |
|
2267 - | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
2268 - | let fut = async move {
|
2269 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
2270 - | request.headers(),
|
2271 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
2272 - | ) {
|
2273 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
2274 - | }
|
2275 - | crate::protocol_serde::shape_null_operation::de_null_operation_http_request(request)
|
2276 - | .await
|
2277 - | };
|
2278 - | use ::futures_util::future::TryFutureExt;
|
2279 - | let fut = fut.map_err(
|
2280 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
2281 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2282 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
2283 - | },
|
2284 - | );
|
2285 - | NullOperationInputFuture {
|
2286 - | inner: Box::pin(fut),
|
2287 - | }
|
2288 - | }
|
2289 - | }
|
2290 - | impl
|
2291 - | ::aws_smithy_http_server::response::IntoResponse<
|
2292 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2293 - | > for crate::output::NullOperationOutput
|
2294 - | {
|
2295 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
2296 - | match crate::protocol_serde::shape_null_operation::ser_null_operation_http_response(self) {
|
2297 - | Ok(response) => response,
|
2298 - | Err(e) => {
|
2299 - | ::tracing::error!(error = %e, "failed to serialize response");
|
2300 - | ::aws_smithy_http_server::response::IntoResponse::<
|
2301 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2302 - | >::into_response(
|
2303 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
2304 - | e,
|
2305 - | ),
|
2306 - | )
|
2307 - | }
|
2308 - | }
|
2309 - | }
|
2310 - | }
|
2311 - |
|
2312 - | #[allow(unreachable_code, unused_variables)]
|
2313 - | #[cfg(test)]
|
2314 - | mod null_operation_test {
|
2315 - |
|
2316 - | /// Null structure values are dropped
|
2317 - | /// Test ID: AwsJson11ServersDontDeserializeNullStructureValues
|
2318 - | #[::tokio::test]
|
2319 - | #[::tracing_test::traced_test]
|
2320 - | async fn aws_json11_servers_dont_deserialize_null_structure_values_request() {
|
3294 + | async fn serializes_timestamp_shapes_with_unixtimestamp_timestampformat_request() {
|
2321 3295 | #[allow(unused_mut)]
|
2322 3296 | let mut http_request = ::http_1x::Request::builder()
|
2323 3297 | .uri("/")
|
2324 3298 | .method("POST")
|
2325 3299 | .header("Content-Type", "application/x-amz-json-1.1")
|
2326 - | .header("X-Amz-Target", "JsonProtocol.NullOperation")
|
3300 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
2327 3301 | .body(::aws_smithy_http_server::body::boxed(
|
2328 3302 | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2329 3303 | &::aws_smithy_protocol_test::decode_body_data(
|
2330 - | "{\n \"string\": null\n}".as_bytes(),
|
3304 + | "{\"UnixTimestamp\":946845296}".as_bytes(),
|
2331 3305 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2332 3306 | ),
|
2333 3307 | )),
|
2334 3308 | ))
|
2335 3309 | .unwrap();
|
2336 3310 | #[allow(unused_mut)]
|
2337 3311 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2338 3312 | let config = crate::service::JsonProtocolConfig::builder().build();
|
2339 3313 | let service = crate::service::JsonProtocol::builder::<
|
2340 3314 | ::aws_smithy_http_server::body::BoxBody,
|
2341 3315 | _,
|
2342 3316 | _,
|
2343 3317 | _,
|
2344 3318 | >(config)
|
2345 - | .null_operation(move |input: crate::input::NullOperationInput| {
|
3319 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
2346 3320 | let sender = sender.clone();
|
2347 3321 | async move {
|
2348 3322 | let result = {
|
2349 - | let expected = crate::input::NullOperationInput {
|
2350 - | string: ::std::option::Option::None,
|
2351 - | };
|
2352 - | ::pretty_assertions::assert_eq!(input, expected);
|
2353 - | let output = crate::output::NullOperationOutput {
|
3323 + | use ::aws_smithy_protocol_test::FloatEquals;
|
3324 + | let expected = crate::input::KitchenSinkOperationInput {
|
3325 + | unix_timestamp: ::std::option::Option::Some(
|
3326 + | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
3327 + | ),
|
3328 + | blob: ::std::option::Option::None,
|
3329 + | boolean: ::std::option::Option::None,
|
3330 + | double: ::std::option::Option::None,
|
3331 + | empty_struct: ::std::option::Option::None,
|
3332 + | float: ::std::option::Option::None,
|
3333 + | httpdate_timestamp: ::std::option::Option::None,
|
3334 + | integer: ::std::option::Option::None,
|
3335 + | iso8601_timestamp: ::std::option::Option::None,
|
3336 + | json_value: ::std::option::Option::None,
|
3337 + | list_of_lists: ::std::option::Option::None,
|
3338 + | list_of_maps_of_strings: ::std::option::Option::None,
|
3339 + | list_of_strings: ::std::option::Option::None,
|
3340 + | list_of_structs: ::std::option::Option::None,
|
3341 + | long: ::std::option::Option::None,
|
3342 + | map_of_lists_of_strings: ::std::option::Option::None,
|
3343 + | map_of_maps: ::std::option::Option::None,
|
3344 + | map_of_strings: ::std::option::Option::None,
|
3345 + | map_of_structs: ::std::option::Option::None,
|
3346 + | recursive_list: ::std::option::Option::None,
|
3347 + | recursive_map: ::std::option::Option::None,
|
3348 + | recursive_struct: ::std::option::Option::None,
|
3349 + | simple_struct: ::std::option::Option::None,
|
2354 3350 | string: ::std::option::Option::None,
|
3351 + | struct_with_json_name: ::std::option::Option::None,
|
3352 + | timestamp: ::std::option::Option::None,
|
2355 3353 | };
|
2356 - | output
|
2357 - | };
|
2358 - | sender.send(()).await.expect("receiver dropped early");
|
2359 - | result
|
2360 - | }
|
2361 - | })
|
2362 - | .build_unchecked();
|
2363 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2364 - | .await
|
2365 - | .expect("unable to make an HTTP request");
|
2366 - | assert!(
|
2367 - | receiver.recv().await.is_some(),
|
2368 - | "we expected operation handler to be invoked but it was not entered"
|
2369 - | );
|
2370 - | }
|
2371 - |
|
2372 - | /// Null structure values are dropped
|
2373 - | /// Test ID: AwsJson11ServersDontSerializeNullStructureValues
|
2374 - | #[::tokio::test]
|
2375 - | #[::tracing_test::traced_test]
|
2376 - | async fn aws_json11_servers_dont_serialize_null_structure_values_response() {
|
2377 - | let output = crate::output::NullOperationOutput {
|
2378 - | string: ::std::option::Option::None,
|
2379 - | };
|
2380 - | use ::aws_smithy_http_server::response::IntoResponse;
|
2381 - | let http_response = output.into_response();
|
2382 - | ::pretty_assertions::assert_eq!(
|
2383 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2384 - | http_response.status()
|
2385 - | );
|
2386 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
2387 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2388 - | http_response.headers(),
|
2389 - | expected_headers,
|
2390 - | ));
|
2391 - | use ::http_body_util::BodyExt;
|
2392 - | let body = http_response
|
2393 - | .into_body()
|
2394 - | .collect()
|
2395 - | .await
|
2396 - | .expect("unable to collect body")
|
2397 - | .to_bytes();
|
2398 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2399 - | &body,
|
2400 - | "{}",
|
2401 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2402 - | ));
|
2403 - | }
|
2404 - | }
|
2405 - |
|
2406 - | ::pin_project_lite::pin_project! {
|
2407 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2408 - | /// [`JsonIntEnumsInput`](crate::input::JsonIntEnumsInput) using modelled bindings.
|
2409 - | pub struct JsonIntEnumsInputFuture {
|
2410 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::JsonIntEnumsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
2411 - | }
|
2412 - | }
|
2413 - |
|
2414 - | impl std::future::Future for JsonIntEnumsInputFuture {
|
2415 - | type Output = Result<
|
2416 - | crate::input::JsonIntEnumsInput,
|
2417 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
2418 - | >;
|
2419 - |
|
2420 - | fn poll(
|
2421 - | self: std::pin::Pin<&mut Self>,
|
2422 - | cx: &mut std::task::Context<'_>,
|
2423 - | ) -> std::task::Poll<Self::Output> {
|
2424 - | let this = self.project();
|
2425 - | this.inner.as_mut().poll(cx)
|
2426 - | }
|
2427 - | }
|
2428 - |
|
2429 - | impl<B>
|
2430 - | ::aws_smithy_http_server::request::FromRequest<
|
2431 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2432 - | B,
|
2433 - | > for crate::input::JsonIntEnumsInput
|
2434 - | where
|
2435 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
2436 - | B: 'static,
|
2437 - |
|
2438 - | B::Data: Send,
|
2439 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
2440 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
2441 - | {
|
2442 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
2443 - | type Future = JsonIntEnumsInputFuture;
|
2444 - |
|
2445 - | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
2446 - | let fut = async move {
|
2447 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
2448 - | request.headers(),
|
2449 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
2450 - | ) {
|
2451 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
2452 - | }
|
2453 - | crate::protocol_serde::shape_json_int_enums::de_json_int_enums_http_request(request)
|
2454 - | .await
|
2455 - | };
|
2456 - | use ::futures_util::future::TryFutureExt;
|
2457 - | let fut = fut.map_err(
|
2458 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
2459 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2460 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
2461 - | },
|
2462 - | );
|
2463 - | JsonIntEnumsInputFuture {
|
2464 - | inner: Box::pin(fut),
|
2465 - | }
|
2466 - | }
|
2467 - | }
|
2468 - | impl
|
2469 - | ::aws_smithy_http_server::response::IntoResponse<
|
2470 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2471 - | > for crate::output::JsonIntEnumsOutput
|
2472 - | {
|
2473 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
2474 - | match crate::protocol_serde::shape_json_int_enums::ser_json_int_enums_http_response(self) {
|
2475 - | Ok(response) => response,
|
2476 - | Err(e) => {
|
2477 - | ::tracing::error!(error = %e, "failed to serialize response");
|
2478 - | ::aws_smithy_http_server::response::IntoResponse::<
|
2479 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2480 - | >::into_response(
|
2481 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
2482 - | e,
|
2483 - | ),
|
2484 - | )
|
2485 - | }
|
2486 - | }
|
2487 - | }
|
2488 - | }
|
2489 - | impl
|
2490 - | ::aws_smithy_http_server::response::IntoResponse<
|
2491 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2492 - | > for crate::error::JsonIntEnumsError
|
2493 - | {
|
2494 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
2495 - | match crate::protocol_serde::shape_json_int_enums::ser_json_int_enums_http_error(&self) {
|
2496 - | Ok(mut response) => {
|
2497 - | response.extensions_mut().insert(
|
2498 - | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
2499 - | );
|
2500 - | response
|
2501 - | }
|
2502 - | Err(e) => {
|
2503 - | ::tracing::error!(error = %e, "failed to serialize response");
|
2504 - | ::aws_smithy_http_server::response::IntoResponse::<
|
2505 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2506 - | >::into_response(
|
2507 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
2508 - | e,
|
2509 - | ),
|
2510 - | )
|
2511 - | }
|
2512 - | }
|
2513 - | }
|
2514 - | }
|
2515 - |
|
2516 - | #[allow(unreachable_code, unused_variables)]
|
2517 - | #[cfg(test)]
|
2518 - | mod json_int_enums_test {
|
2519 - |
|
2520 - | /// Serializes simple scalar properties
|
2521 - | /// Test ID: AwsJson11IntEnums
|
2522 - | #[::tokio::test]
|
2523 - | #[::tracing_test::traced_test]
|
2524 - | async fn aws_json11_int_enums_request() {
|
2525 - | #[allow(unused_mut)]
|
2526 - | let mut http_request = ::http_1x::Request::builder()
|
2527 - | .uri("/")
|
2528 - | .method("POST")
|
2529 - | .header("Content-Type", "application/x-amz-json-1.1")
|
2530 - | .header("X-Amz-Target", "JsonProtocol.JsonIntEnums")
|
2531 - | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
2532 - | ::bytes::Bytes::copy_from_slice(
|
2533 - | &::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"))
|
2534 - | )
|
2535 - | ))).unwrap();
|
2536 - | #[allow(unused_mut)]
|
2537 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2538 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
2539 - | let service = crate::service::JsonProtocol::builder::<
|
2540 - | ::aws_smithy_http_server::body::BoxBody,
|
2541 - | _,
|
2542 - | _,
|
2543 - | _,
|
2544 - | >(config)
|
2545 - | .json_int_enums(move |input: crate::input::JsonIntEnumsInput| {
|
2546 - | let sender = sender.clone();
|
2547 - | async move {
|
2548 - | let result = {
|
2549 - | let expected = crate::input::JsonIntEnumsInput {
|
2550 - | int_enum1: ::std::option::Option::Some(1),
|
2551 - | int_enum2: ::std::option::Option::Some(2),
|
2552 - | int_enum3: ::std::option::Option::Some(3),
|
2553 - | int_enum_list: ::std::option::Option::Some(vec![1, 2]),
|
2554 - | int_enum_set: ::std::option::Option::Some(
|
2555 - | vec![1, 2].try_into().expect("this is only used in tests"),
|
2556 - | ),
|
2557 - | int_enum_map: ::std::option::Option::Some({
|
2558 - | let mut ret = ::std::collections::HashMap::new();
|
2559 - | ret.insert("a".to_owned(), 1);
|
2560 - | ret.insert("b".to_owned(), 2);
|
2561 - | ret
|
2562 - | }),
|
2563 - | };
|
2564 - | ::pretty_assertions::assert_eq!(input, expected);
|
2565 - | let output = crate::output::JsonIntEnumsOutput {
|
2566 - | int_enum1: ::std::option::Option::None,
|
2567 - | int_enum2: ::std::option::Option::None,
|
2568 - | int_enum3: ::std::option::Option::None,
|
2569 - | int_enum_list: ::std::option::Option::None,
|
2570 - | int_enum_set: ::std::option::Option::None,
|
2571 - | int_enum_map: ::std::option::Option::None,
|
3354 + | ::pretty_assertions::assert_eq!(
|
3355 + | input.blob,
|
3356 + | expected.blob,
|
3357 + | "Unexpected value for `blob`"
|
3358 + | );
|
3359 + | ::pretty_assertions::assert_eq!(
|
3360 + | input.boolean,
|
3361 + | expected.boolean,
|
3362 + | "Unexpected value for `boolean`"
|
3363 + | );
|
3364 + | assert!(
|
3365 + | input.double.float_equals(&expected.double),
|
3366 + | "Unexpected value for `double` {:?} vs. {:?}",
|
3367 + | expected.double,
|
3368 + | input.double
|
3369 + | );
|
3370 + | ::pretty_assertions::assert_eq!(
|
3371 + | input.empty_struct,
|
3372 + | expected.empty_struct,
|
3373 + | "Unexpected value for `empty_struct`"
|
3374 + | );
|
3375 + | assert!(
|
3376 + | input.float.float_equals(&expected.float),
|
3377 + | "Unexpected value for `float` {:?} vs. {:?}",
|
3378 + | expected.float,
|
3379 + | input.float
|
3380 + | );
|
3381 + | ::pretty_assertions::assert_eq!(
|
3382 + | input.httpdate_timestamp,
|
3383 + | expected.httpdate_timestamp,
|
3384 + | "Unexpected value for `httpdate_timestamp`"
|
3385 + | );
|
3386 + | ::pretty_assertions::assert_eq!(
|
3387 + | input.integer,
|
3388 + | expected.integer,
|
3389 + | "Unexpected value for `integer`"
|
3390 + | );
|
3391 + | ::pretty_assertions::assert_eq!(
|
3392 + | input.iso8601_timestamp,
|
3393 + | expected.iso8601_timestamp,
|
3394 + | "Unexpected value for `iso8601_timestamp`"
|
3395 + | );
|
3396 + | ::pretty_assertions::assert_eq!(
|
3397 + | input.json_value,
|
3398 + | expected.json_value,
|
3399 + | "Unexpected value for `json_value`"
|
3400 + | );
|
3401 + | ::pretty_assertions::assert_eq!(
|
3402 + | input.list_of_lists,
|
3403 + | expected.list_of_lists,
|
3404 + | "Unexpected value for `list_of_lists`"
|
3405 + | );
|
3406 + | ::pretty_assertions::assert_eq!(
|
3407 + | input.list_of_maps_of_strings,
|
3408 + | expected.list_of_maps_of_strings,
|
3409 + | "Unexpected value for `list_of_maps_of_strings`"
|
3410 + | );
|
3411 + | ::pretty_assertions::assert_eq!(
|
3412 + | input.list_of_strings,
|
3413 + | expected.list_of_strings,
|
3414 + | "Unexpected value for `list_of_strings`"
|
3415 + | );
|
3416 + | ::pretty_assertions::assert_eq!(
|
3417 + | input.list_of_structs,
|
3418 + | expected.list_of_structs,
|
3419 + | "Unexpected value for `list_of_structs`"
|
3420 + | );
|
3421 + | ::pretty_assertions::assert_eq!(
|
3422 + | input.long,
|
3423 + | expected.long,
|
3424 + | "Unexpected value for `long`"
|
3425 + | );
|
3426 + | ::pretty_assertions::assert_eq!(
|
3427 + | input.map_of_lists_of_strings,
|
3428 + | expected.map_of_lists_of_strings,
|
3429 + | "Unexpected value for `map_of_lists_of_strings`"
|
3430 + | );
|
3431 + | ::pretty_assertions::assert_eq!(
|
3432 + | input.map_of_maps,
|
3433 + | expected.map_of_maps,
|
3434 + | "Unexpected value for `map_of_maps`"
|
3435 + | );
|
3436 + | ::pretty_assertions::assert_eq!(
|
3437 + | input.map_of_strings,
|
3438 + | expected.map_of_strings,
|
3439 + | "Unexpected value for `map_of_strings`"
|
3440 + | );
|
3441 + | ::pretty_assertions::assert_eq!(
|
3442 + | input.map_of_structs,
|
3443 + | expected.map_of_structs,
|
3444 + | "Unexpected value for `map_of_structs`"
|
3445 + | );
|
3446 + | ::pretty_assertions::assert_eq!(
|
3447 + | input.recursive_list,
|
3448 + | expected.recursive_list,
|
3449 + | "Unexpected value for `recursive_list`"
|
3450 + | );
|
3451 + | ::pretty_assertions::assert_eq!(
|
3452 + | input.recursive_map,
|
3453 + | expected.recursive_map,
|
3454 + | "Unexpected value for `recursive_map`"
|
3455 + | );
|
3456 + | ::pretty_assertions::assert_eq!(
|
3457 + | input.recursive_struct,
|
3458 + | expected.recursive_struct,
|
3459 + | "Unexpected value for `recursive_struct`"
|
3460 + | );
|
3461 + | ::pretty_assertions::assert_eq!(
|
3462 + | input.simple_struct,
|
3463 + | expected.simple_struct,
|
3464 + | "Unexpected value for `simple_struct`"
|
3465 + | );
|
3466 + | ::pretty_assertions::assert_eq!(
|
3467 + | input.string,
|
3468 + | expected.string,
|
3469 + | "Unexpected value for `string`"
|
3470 + | );
|
3471 + | ::pretty_assertions::assert_eq!(
|
3472 + | input.struct_with_json_name,
|
3473 + | expected.struct_with_json_name,
|
3474 + | "Unexpected value for `struct_with_json_name`"
|
3475 + | );
|
3476 + | ::pretty_assertions::assert_eq!(
|
3477 + | input.timestamp,
|
3478 + | expected.timestamp,
|
3479 + | "Unexpected value for `timestamp`"
|
3480 + | );
|
3481 + | ::pretty_assertions::assert_eq!(
|
3482 + | input.unix_timestamp,
|
3483 + | expected.unix_timestamp,
|
3484 + | "Unexpected value for `unix_timestamp`"
|
3485 + | );
|
3486 + | let output = crate::output::KitchenSinkOperationOutput {
|
3487 + | blob: ::std::option::Option::None,
|
3488 + | boolean: ::std::option::Option::None,
|
3489 + | double: ::std::option::Option::None,
|
3490 + | empty_struct: ::std::option::Option::None,
|
3491 + | float: ::std::option::Option::None,
|
3492 + | httpdate_timestamp: ::std::option::Option::None,
|
3493 + | integer: ::std::option::Option::None,
|
3494 + | iso8601_timestamp: ::std::option::Option::None,
|
3495 + | json_value: ::std::option::Option::None,
|
3496 + | list_of_lists: ::std::option::Option::None,
|
3497 + | list_of_maps_of_strings: ::std::option::Option::None,
|
3498 + | list_of_strings: ::std::option::Option::None,
|
3499 + | list_of_structs: ::std::option::Option::None,
|
3500 + | long: ::std::option::Option::None,
|
3501 + | map_of_lists_of_strings: ::std::option::Option::None,
|
3502 + | map_of_maps: ::std::option::Option::None,
|
3503 + | map_of_strings: ::std::option::Option::None,
|
3504 + | map_of_structs: ::std::option::Option::None,
|
3505 + | recursive_list: ::std::option::Option::None,
|
3506 + | recursive_map: ::std::option::Option::None,
|
3507 + | recursive_struct: ::std::option::Option::None,
|
3508 + | simple_struct: ::std::option::Option::None,
|
3509 + | string: ::std::option::Option::None,
|
3510 + | struct_with_json_name: ::std::option::Option::None,
|
3511 + | timestamp: ::std::option::Option::None,
|
3512 + | unix_timestamp: ::std::option::Option::None,
|
2572 3513 | };
|
2573 3514 | Ok(output)
|
2574 3515 | };
|
2575 3516 | sender.send(()).await.expect("receiver dropped early");
|
2576 3517 | result
|
2577 3518 | }
|
2578 3519 | })
|
2579 3520 | .build_unchecked();
|
2580 3521 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2581 3522 | .await
|
2582 3523 | .expect("unable to make an HTTP request");
|
2583 3524 | assert!(
|
2584 3525 | receiver.recv().await.is_some(),
|
2585 3526 | "we expected operation handler to be invoked but it was not entered"
|
2586 3527 | );
|
2587 3528 | }
|
2588 3529 |
|
2589 - | /// Serializes simple scalar properties
|
2590 - | /// Test ID: AwsJson11IntEnums
|
3530 + | /// Serializes list shapes
|
3531 + | /// Test ID: serializes_list_shapes
|
2591 3532 | #[::tokio::test]
|
2592 3533 | #[::tracing_test::traced_test]
|
2593 - | #[should_panic]
|
2594 - | async fn aws_json11_int_enums_response() {
|
2595 - | let output = crate::output::JsonIntEnumsOutput {
|
2596 - | int_enum1: ::std::option::Option::Some(1),
|
2597 - | int_enum2: ::std::option::Option::Some(2),
|
2598 - | int_enum3: ::std::option::Option::Some(3),
|
2599 - | int_enum_list: ::std::option::Option::Some(vec![1, 2]),
|
2600 - | int_enum_set: ::std::option::Option::Some(
|
2601 - | vec![1, 2].try_into().expect("this is only used in tests"),
|
2602 - | ),
|
2603 - | int_enum_map: ::std::option::Option::Some({
|
2604 - | let mut ret = ::std::collections::HashMap::new();
|
2605 - | ret.insert("a".to_owned(), 1);
|
2606 - | ret.insert("b".to_owned(), 2);
|
2607 - | ret
|
2608 - | }),
|
2609 - | };
|
2610 - | use ::aws_smithy_http_server::response::IntoResponse;
|
2611 - | let http_response = output.into_response();
|
2612 - | ::pretty_assertions::assert_eq!(
|
2613 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2614 - | http_response.status()
|
2615 - | );
|
2616 - | let expected_headers = [
|
2617 - | ("Content-Type", "application/x-amz-json-1.1"),
|
2618 - | ("X-Amz-Target", "JsonProtocol.JsonIntEnums"),
|
2619 - | ];
|
2620 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2621 - | http_response.headers(),
|
2622 - | expected_headers,
|
2623 - | ));
|
2624 - | use ::http_body_util::BodyExt;
|
2625 - | let body = http_response
|
2626 - | .into_body()
|
2627 - | .collect()
|
2628 - | .await
|
2629 - | .expect("unable to collect body")
|
2630 - | .to_bytes();
|
2631 - | ::aws_smithy_protocol_test::assert_ok(
|
2632 - | ::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"))
|
2633 - | );
|
2634 - | }
|
2635 - | }
|
2636 - |
|
2637 - | ::pin_project_lite::pin_project! {
|
2638 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2639 - | /// [`JsonEnumsInput`](crate::input::JsonEnumsInput) using modelled bindings.
|
2640 - | pub struct JsonEnumsInputFuture {
|
2641 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::JsonEnumsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
2642 - | }
|
2643 - | }
|
2644 - |
|
2645 - | impl std::future::Future for JsonEnumsInputFuture {
|
2646 - | type Output = Result<
|
2647 - | crate::input::JsonEnumsInput,
|
2648 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
2649 - | >;
|
2650 - |
|
2651 - | fn poll(
|
2652 - | self: std::pin::Pin<&mut Self>,
|
2653 - | cx: &mut std::task::Context<'_>,
|
2654 - | ) -> std::task::Poll<Self::Output> {
|
2655 - | let this = self.project();
|
2656 - | this.inner.as_mut().poll(cx)
|
2657 - | }
|
2658 - | }
|
2659 - |
|
2660 - | impl<B>
|
2661 - | ::aws_smithy_http_server::request::FromRequest<
|
2662 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2663 - | B,
|
2664 - | > for crate::input::JsonEnumsInput
|
2665 - | where
|
2666 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
2667 - | B: 'static,
|
2668 - |
|
2669 - | B::Data: Send,
|
2670 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
2671 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
2672 - | {
|
2673 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
2674 - | type Future = JsonEnumsInputFuture;
|
2675 - |
|
2676 - | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
2677 - | let fut = async move {
|
2678 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
2679 - | request.headers(),
|
2680 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
2681 - | ) {
|
2682 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
2683 - | }
|
2684 - | crate::protocol_serde::shape_json_enums::de_json_enums_http_request(request).await
|
2685 - | };
|
2686 - | use ::futures_util::future::TryFutureExt;
|
2687 - | let fut = fut.map_err(
|
2688 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
2689 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2690 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
2691 - | },
|
2692 - | );
|
2693 - | JsonEnumsInputFuture {
|
2694 - | inner: Box::pin(fut),
|
2695 - | }
|
2696 - | }
|
2697 - | }
|
2698 - | impl
|
2699 - | ::aws_smithy_http_server::response::IntoResponse<
|
2700 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2701 - | > for crate::output::JsonEnumsOutput
|
2702 - | {
|
2703 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
2704 - | match crate::protocol_serde::shape_json_enums::ser_json_enums_http_response(self) {
|
2705 - | Ok(response) => response,
|
2706 - | Err(e) => {
|
2707 - | ::tracing::error!(error = %e, "failed to serialize response");
|
2708 - | ::aws_smithy_http_server::response::IntoResponse::<
|
2709 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2710 - | >::into_response(
|
2711 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
2712 - | e,
|
2713 - | ),
|
2714 - | )
|
2715 - | }
|
2716 - | }
|
2717 - | }
|
2718 - | }
|
2719 - | impl
|
2720 - | ::aws_smithy_http_server::response::IntoResponse<
|
2721 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2722 - | > for crate::error::JsonEnumsError
|
2723 - | {
|
2724 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
2725 - | match crate::protocol_serde::shape_json_enums::ser_json_enums_http_error(&self) {
|
2726 - | Ok(mut response) => {
|
2727 - | response.extensions_mut().insert(
|
2728 - | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
2729 - | );
|
2730 - | response
|
2731 - | }
|
2732 - | Err(e) => {
|
2733 - | ::tracing::error!(error = %e, "failed to serialize response");
|
2734 - | ::aws_smithy_http_server::response::IntoResponse::<
|
2735 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2736 - | >::into_response(
|
2737 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
2738 - | e,
|
2739 - | ),
|
2740 - | )
|
2741 - | }
|
2742 - | }
|
2743 - | }
|
2744 - | }
|
2745 - |
|
2746 - | #[allow(unreachable_code, unused_variables)]
|
2747 - | #[cfg(test)]
|
2748 - | mod json_enums_test {
|
2749 - |
|
2750 - | /// Serializes simple scalar properties
|
2751 - | /// Test ID: AwsJson11Enums
|
2752 - | #[::tokio::test]
|
2753 - | #[::tracing_test::traced_test]
|
2754 - | async fn aws_json11_enums_request() {
|
3534 + | async fn serializes_list_shapes_request() {
|
2755 3535 | #[allow(unused_mut)]
|
2756 - | let mut http_request = ::http_1x::Request::builder()
|
2757 - | .uri("/")
|
2758 - | .method("POST")
|
2759 - | .header("Content-Type", "application/x-amz-json-1.1")
|
2760 - | .header("X-Amz-Target", "JsonProtocol.JsonEnums")
|
2761 - | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
2762 - | ::bytes::Bytes::copy_from_slice(
|
2763 - | &::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"))
|
2764 - | )
|
2765 - | ))).unwrap();
|
3536 + | let mut http_request = ::http_1x::Request::builder()
|
3537 + | .uri("/")
|
3538 + | .method("POST")
|
3539 + | .header("Content-Type", "application/x-amz-json-1.1")
|
3540 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
3541 + | .body(::aws_smithy_http_server::body::boxed(
|
3542 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3543 + | &::aws_smithy_protocol_test::decode_body_data(
|
3544 + | "{\"ListOfStrings\":[\"abc\",\"mno\",\"xyz\"]}".as_bytes(),
|
3545 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3546 + | ),
|
3547 + | )),
|
3548 + | ))
|
3549 + | .unwrap();
|
2766 3550 | #[allow(unused_mut)]
|
2767 3551 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2768 3552 | let config = crate::service::JsonProtocolConfig::builder().build();
|
2769 3553 | let service = crate::service::JsonProtocol::builder::<
|
2770 3554 | ::aws_smithy_http_server::body::BoxBody,
|
2771 3555 | _,
|
2772 3556 | _,
|
2773 3557 | _,
|
2774 3558 | >(config)
|
2775 - | .json_enums(move |input: crate::input::JsonEnumsInput| {
|
3559 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
2776 3560 | let sender = sender.clone();
|
2777 3561 | async move {
|
2778 3562 | let result = {
|
2779 - | let expected = crate::input::JsonEnumsInput {
|
2780 - | foo_enum1: ::std::option::Option::Some(
|
2781 - | "Foo"
|
2782 - | .parse::<crate::model::FooEnum>()
|
2783 - | .expect("static value validated to member"),
|
2784 - | ),
|
2785 - | foo_enum2: ::std::option::Option::Some(
|
2786 - | "0".parse::<crate::model::FooEnum>()
|
2787 - | .expect("static value validated to member"),
|
2788 - | ),
|
2789 - | foo_enum3: ::std::option::Option::Some(
|
2790 - | "1".parse::<crate::model::FooEnum>()
|
2791 - | .expect("static value validated to member"),
|
2792 - | ),
|
2793 - | foo_enum_list: ::std::option::Option::Some(vec![
|
2794 - | "Foo"
|
2795 - | .parse::<crate::model::FooEnum>()
|
2796 - | .expect("static value validated to member"),
|
2797 - | "0".parse::<crate::model::FooEnum>()
|
2798 - | .expect("static value validated to member"),
|
3563 + | use ::aws_smithy_protocol_test::FloatEquals;
|
3564 + | let expected = crate::input::KitchenSinkOperationInput {
|
3565 + | list_of_strings: ::std::option::Option::Some(vec![
|
3566 + | "abc".to_owned(),
|
3567 + | "mno".to_owned(),
|
3568 + | "xyz".to_owned(),
|
2799 3569 | ]),
|
2800 - | foo_enum_set: ::std::option::Option::Some(
|
2801 - | vec![
|
2802 - | "Foo"
|
2803 - | .parse::<crate::model::FooEnum>()
|
2804 - | .expect("static value validated to member"),
|
2805 - | "0".parse::<crate::model::FooEnum>()
|
2806 - | .expect("static value validated to member"),
|
2807 - | ]
|
2808 - | .try_into()
|
2809 - | .expect("this is only used in tests"),
|
2810 - | ),
|
2811 - | foo_enum_map: ::std::option::Option::Some({
|
2812 - | let mut ret = ::std::collections::HashMap::new();
|
2813 - | ret.insert(
|
2814 - | "hi".to_owned(),
|
2815 - | "Foo"
|
2816 - | .parse::<crate::model::FooEnum>()
|
2817 - | .expect("static value validated to member"),
|
2818 - | );
|
2819 - | ret.insert(
|
2820 - | "zero".to_owned(),
|
2821 - | "0".parse::<crate::model::FooEnum>()
|
2822 - | .expect("static value validated to member"),
|
2823 - | );
|
2824 - | ret
|
2825 - | }),
|
2826 - | };
|
2827 - | ::pretty_assertions::assert_eq!(input, expected);
|
2828 - | let output = crate::output::JsonEnumsOutput {
|
2829 - | foo_enum1: ::std::option::Option::None,
|
2830 - | foo_enum2: ::std::option::Option::None,
|
2831 - | foo_enum3: ::std::option::Option::None,
|
2832 - | foo_enum_list: ::std::option::Option::None,
|
2833 - | foo_enum_set: ::std::option::Option::None,
|
2834 - | foo_enum_map: ::std::option::Option::None,
|
3570 + | blob: ::std::option::Option::None,
|
3571 + | boolean: ::std::option::Option::None,
|
3572 + | double: ::std::option::Option::None,
|
3573 + | empty_struct: ::std::option::Option::None,
|
3574 + | float: ::std::option::Option::None,
|
3575 + | httpdate_timestamp: ::std::option::Option::None,
|
3576 + | integer: ::std::option::Option::None,
|
3577 + | iso8601_timestamp: ::std::option::Option::None,
|
3578 + | json_value: ::std::option::Option::None,
|
3579 + | list_of_lists: ::std::option::Option::None,
|
3580 + | list_of_maps_of_strings: ::std::option::Option::None,
|
3581 + | list_of_structs: ::std::option::Option::None,
|
3582 + | long: ::std::option::Option::None,
|
3583 + | map_of_lists_of_strings: ::std::option::Option::None,
|
3584 + | map_of_maps: ::std::option::Option::None,
|
3585 + | map_of_strings: ::std::option::Option::None,
|
3586 + | map_of_structs: ::std::option::Option::None,
|
3587 + | recursive_list: ::std::option::Option::None,
|
3588 + | recursive_map: ::std::option::Option::None,
|
3589 + | recursive_struct: ::std::option::Option::None,
|
3590 + | simple_struct: ::std::option::Option::None,
|
3591 + | string: ::std::option::Option::None,
|
3592 + | struct_with_json_name: ::std::option::Option::None,
|
3593 + | timestamp: ::std::option::Option::None,
|
3594 + | unix_timestamp: ::std::option::Option::None,
|
2835 3595 | };
|
2836 - | Ok(output)
|
2837 - | };
|
2838 - | sender.send(()).await.expect("receiver dropped early");
|
2839 - | result
|
2840 - | }
|
2841 - | })
|
2842 - | .build_unchecked();
|
2843 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3596 + | ::pretty_assertions::assert_eq!(
|
3597 + | input.blob,
|
3598 + | expected.blob,
|
3599 + | "Unexpected value for `blob`"
|
3600 + | );
|
3601 + | ::pretty_assertions::assert_eq!(
|
3602 + | input.boolean,
|
3603 + | expected.boolean,
|
3604 + | "Unexpected value for `boolean`"
|
3605 + | );
|
3606 + | assert!(
|
3607 + | input.double.float_equals(&expected.double),
|
3608 + | "Unexpected value for `double` {:?} vs. {:?}",
|
3609 + | expected.double,
|
3610 + | input.double
|
3611 + | );
|
3612 + | ::pretty_assertions::assert_eq!(
|
3613 + | input.empty_struct,
|
3614 + | expected.empty_struct,
|
3615 + | "Unexpected value for `empty_struct`"
|
3616 + | );
|
3617 + | assert!(
|
3618 + | input.float.float_equals(&expected.float),
|
3619 + | "Unexpected value for `float` {:?} vs. {:?}",
|
3620 + | expected.float,
|
3621 + | input.float
|
3622 + | );
|
3623 + | ::pretty_assertions::assert_eq!(
|
3624 + | input.httpdate_timestamp,
|
3625 + | expected.httpdate_timestamp,
|
3626 + | "Unexpected value for `httpdate_timestamp`"
|
3627 + | );
|
3628 + | ::pretty_assertions::assert_eq!(
|
3629 + | input.integer,
|
3630 + | expected.integer,
|
3631 + | "Unexpected value for `integer`"
|
3632 + | );
|
3633 + | ::pretty_assertions::assert_eq!(
|
3634 + | input.iso8601_timestamp,
|
3635 + | expected.iso8601_timestamp,
|
3636 + | "Unexpected value for `iso8601_timestamp`"
|
3637 + | );
|
3638 + | ::pretty_assertions::assert_eq!(
|
3639 + | input.json_value,
|
3640 + | expected.json_value,
|
3641 + | "Unexpected value for `json_value`"
|
3642 + | );
|
3643 + | ::pretty_assertions::assert_eq!(
|
3644 + | input.list_of_lists,
|
3645 + | expected.list_of_lists,
|
3646 + | "Unexpected value for `list_of_lists`"
|
3647 + | );
|
3648 + | ::pretty_assertions::assert_eq!(
|
3649 + | input.list_of_maps_of_strings,
|
3650 + | expected.list_of_maps_of_strings,
|
3651 + | "Unexpected value for `list_of_maps_of_strings`"
|
3652 + | );
|
3653 + | ::pretty_assertions::assert_eq!(
|
3654 + | input.list_of_strings,
|
3655 + | expected.list_of_strings,
|
3656 + | "Unexpected value for `list_of_strings`"
|
3657 + | );
|
3658 + | ::pretty_assertions::assert_eq!(
|
3659 + | input.list_of_structs,
|
3660 + | expected.list_of_structs,
|
3661 + | "Unexpected value for `list_of_structs`"
|
3662 + | );
|
3663 + | ::pretty_assertions::assert_eq!(
|
3664 + | input.long,
|
3665 + | expected.long,
|
3666 + | "Unexpected value for `long`"
|
3667 + | );
|
3668 + | ::pretty_assertions::assert_eq!(
|
3669 + | input.map_of_lists_of_strings,
|
3670 + | expected.map_of_lists_of_strings,
|
3671 + | "Unexpected value for `map_of_lists_of_strings`"
|
3672 + | );
|
3673 + | ::pretty_assertions::assert_eq!(
|
3674 + | input.map_of_maps,
|
3675 + | expected.map_of_maps,
|
3676 + | "Unexpected value for `map_of_maps`"
|
3677 + | );
|
3678 + | ::pretty_assertions::assert_eq!(
|
3679 + | input.map_of_strings,
|
3680 + | expected.map_of_strings,
|
3681 + | "Unexpected value for `map_of_strings`"
|
3682 + | );
|
3683 + | ::pretty_assertions::assert_eq!(
|
3684 + | input.map_of_structs,
|
3685 + | expected.map_of_structs,
|
3686 + | "Unexpected value for `map_of_structs`"
|
3687 + | );
|
3688 + | ::pretty_assertions::assert_eq!(
|
3689 + | input.recursive_list,
|
3690 + | expected.recursive_list,
|
3691 + | "Unexpected value for `recursive_list`"
|
3692 + | );
|
3693 + | ::pretty_assertions::assert_eq!(
|
3694 + | input.recursive_map,
|
3695 + | expected.recursive_map,
|
3696 + | "Unexpected value for `recursive_map`"
|
3697 + | );
|
3698 + | ::pretty_assertions::assert_eq!(
|
3699 + | input.recursive_struct,
|
3700 + | expected.recursive_struct,
|
3701 + | "Unexpected value for `recursive_struct`"
|
3702 + | );
|
3703 + | ::pretty_assertions::assert_eq!(
|
3704 + | input.simple_struct,
|
3705 + | expected.simple_struct,
|
3706 + | "Unexpected value for `simple_struct`"
|
3707 + | );
|
3708 + | ::pretty_assertions::assert_eq!(
|
3709 + | input.string,
|
3710 + | expected.string,
|
3711 + | "Unexpected value for `string`"
|
3712 + | );
|
3713 + | ::pretty_assertions::assert_eq!(
|
3714 + | input.struct_with_json_name,
|
3715 + | expected.struct_with_json_name,
|
3716 + | "Unexpected value for `struct_with_json_name`"
|
3717 + | );
|
3718 + | ::pretty_assertions::assert_eq!(
|
3719 + | input.timestamp,
|
3720 + | expected.timestamp,
|
3721 + | "Unexpected value for `timestamp`"
|
3722 + | );
|
3723 + | ::pretty_assertions::assert_eq!(
|
3724 + | input.unix_timestamp,
|
3725 + | expected.unix_timestamp,
|
3726 + | "Unexpected value for `unix_timestamp`"
|
3727 + | );
|
3728 + | let output = crate::output::KitchenSinkOperationOutput {
|
3729 + | blob: ::std::option::Option::None,
|
3730 + | boolean: ::std::option::Option::None,
|
3731 + | double: ::std::option::Option::None,
|
3732 + | empty_struct: ::std::option::Option::None,
|
3733 + | float: ::std::option::Option::None,
|
3734 + | httpdate_timestamp: ::std::option::Option::None,
|
3735 + | integer: ::std::option::Option::None,
|
3736 + | iso8601_timestamp: ::std::option::Option::None,
|
3737 + | json_value: ::std::option::Option::None,
|
3738 + | list_of_lists: ::std::option::Option::None,
|
3739 + | list_of_maps_of_strings: ::std::option::Option::None,
|
3740 + | list_of_strings: ::std::option::Option::None,
|
3741 + | list_of_structs: ::std::option::Option::None,
|
3742 + | long: ::std::option::Option::None,
|
3743 + | map_of_lists_of_strings: ::std::option::Option::None,
|
3744 + | map_of_maps: ::std::option::Option::None,
|
3745 + | map_of_strings: ::std::option::Option::None,
|
3746 + | map_of_structs: ::std::option::Option::None,
|
3747 + | recursive_list: ::std::option::Option::None,
|
3748 + | recursive_map: ::std::option::Option::None,
|
3749 + | recursive_struct: ::std::option::Option::None,
|
3750 + | simple_struct: ::std::option::Option::None,
|
3751 + | string: ::std::option::Option::None,
|
3752 + | struct_with_json_name: ::std::option::Option::None,
|
3753 + | timestamp: ::std::option::Option::None,
|
3754 + | unix_timestamp: ::std::option::Option::None,
|
3755 + | };
|
3756 + | Ok(output)
|
3757 + | };
|
3758 + | sender.send(()).await.expect("receiver dropped early");
|
3759 + | result
|
3760 + | }
|
3761 + | })
|
3762 + | .build_unchecked();
|
3763 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2844 3764 | .await
|
2845 3765 | .expect("unable to make an HTTP request");
|
2846 3766 | assert!(
|
2847 3767 | receiver.recv().await.is_some(),
|
2848 3768 | "we expected operation handler to be invoked but it was not entered"
|
2849 3769 | );
|
2850 3770 | }
|
2851 3771 |
|
2852 - | /// Serializes simple scalar properties
|
2853 - | /// Test ID: AwsJson11Enums
|
3772 + | /// Serializes empty list shapes
|
3773 + | /// Test ID: serializes_empty_list_shapes
|
2854 3774 | #[::tokio::test]
|
2855 3775 | #[::tracing_test::traced_test]
|
2856 - | async fn aws_json11_enums_response() {
|
2857 - | let output = crate::output::JsonEnumsOutput {
|
2858 - | foo_enum1: ::std::option::Option::Some(
|
2859 - | "Foo"
|
2860 - | .parse::<crate::model::FooEnum>()
|
2861 - | .expect("static value validated to member"),
|
2862 - | ),
|
2863 - | foo_enum2: ::std::option::Option::Some(
|
2864 - | "0".parse::<crate::model::FooEnum>()
|
2865 - | .expect("static value validated to member"),
|
2866 - | ),
|
2867 - | foo_enum3: ::std::option::Option::Some(
|
2868 - | "1".parse::<crate::model::FooEnum>()
|
2869 - | .expect("static value validated to member"),
|
2870 - | ),
|
2871 - | foo_enum_list: ::std::option::Option::Some(vec![
|
2872 - | "Foo"
|
2873 - | .parse::<crate::model::FooEnum>()
|
2874 - | .expect("static value validated to member"),
|
2875 - | "0".parse::<crate::model::FooEnum>()
|
2876 - | .expect("static value validated to member"),
|
2877 - | ]),
|
2878 - | foo_enum_set: ::std::option::Option::Some(
|
2879 - | vec![
|
2880 - | "Foo"
|
2881 - | .parse::<crate::model::FooEnum>()
|
2882 - | .expect("static value validated to member"),
|
2883 - | "0".parse::<crate::model::FooEnum>()
|
2884 - | .expect("static value validated to member"),
|
2885 - | ]
|
2886 - | .try_into()
|
2887 - | .expect("this is only used in tests"),
|
2888 - | ),
|
2889 - | foo_enum_map: ::std::option::Option::Some({
|
2890 - | let mut ret = ::std::collections::HashMap::new();
|
2891 - | ret.insert(
|
2892 - | "hi".to_owned(),
|
2893 - | "Foo"
|
2894 - | .parse::<crate::model::FooEnum>()
|
2895 - | .expect("static value validated to member"),
|
2896 - | );
|
2897 - | ret.insert(
|
2898 - | "zero".to_owned(),
|
2899 - | "0".parse::<crate::model::FooEnum>()
|
2900 - | .expect("static value validated to member"),
|
2901 - | );
|
2902 - | ret
|
2903 - | }),
|
2904 - | };
|
2905 - | use ::aws_smithy_http_server::response::IntoResponse;
|
2906 - | let http_response = output.into_response();
|
2907 - | ::pretty_assertions::assert_eq!(
|
2908 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2909 - | http_response.status()
|
2910 - | );
|
2911 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
2912 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2913 - | http_response.headers(),
|
2914 - | expected_headers,
|
2915 - | ));
|
2916 - | use ::http_body_util::BodyExt;
|
2917 - | let body = http_response
|
2918 - | .into_body()
|
2919 - | .collect()
|
2920 - | .await
|
2921 - | .expect("unable to collect body")
|
2922 - | .to_bytes();
|
2923 - | ::aws_smithy_protocol_test::assert_ok(
|
2924 - | ::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"))
|
2925 - | );
|
2926 - | }
|
2927 - | }
|
2928 - |
|
2929 - | ::pin_project_lite::pin_project! {
|
2930 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2931 - | /// [`PutAndGetInlineDocumentsInput`](crate::input::PutAndGetInlineDocumentsInput) using modelled bindings.
|
2932 - | pub struct PutAndGetInlineDocumentsInputFuture {
|
2933 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::PutAndGetInlineDocumentsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
2934 - | }
|
2935 - | }
|
2936 - |
|
2937 - | impl std::future::Future for PutAndGetInlineDocumentsInputFuture {
|
2938 - | type Output = Result<
|
2939 - | crate::input::PutAndGetInlineDocumentsInput,
|
2940 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
2941 - | >;
|
2942 - |
|
2943 - | fn poll(
|
2944 - | self: std::pin::Pin<&mut Self>,
|
2945 - | cx: &mut std::task::Context<'_>,
|
2946 - | ) -> std::task::Poll<Self::Output> {
|
2947 - | let this = self.project();
|
2948 - | this.inner.as_mut().poll(cx)
|
2949 - | }
|
2950 - | }
|
2951 - |
|
2952 - | impl<B>
|
2953 - | ::aws_smithy_http_server::request::FromRequest<
|
2954 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2955 - | B,
|
2956 - | > for crate::input::PutAndGetInlineDocumentsInput
|
2957 - | where
|
2958 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
2959 - | B: 'static,
|
2960 - |
|
2961 - | B::Data: Send,
|
2962 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
2963 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
2964 - | {
|
2965 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
2966 - | type Future = PutAndGetInlineDocumentsInputFuture;
|
2967 - |
|
2968 - | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
2969 - | let fut = async move {
|
2970 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
2971 - | request.headers(),
|
2972 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
2973 - | ) {
|
2974 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
2975 - | }
|
2976 - | crate::protocol_serde::shape_put_and_get_inline_documents::de_put_and_get_inline_documents_http_request(request)
|
2977 - | .await
|
2978 - | };
|
2979 - | use ::futures_util::future::TryFutureExt;
|
2980 - | let fut = fut.map_err(
|
2981 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
2982 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2983 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
2984 - | },
|
2985 - | );
|
2986 - | PutAndGetInlineDocumentsInputFuture {
|
2987 - | inner: Box::pin(fut),
|
2988 - | }
|
2989 - | }
|
2990 - | }
|
2991 - | impl
|
2992 - | ::aws_smithy_http_server::response::IntoResponse<
|
2993 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2994 - | > for crate::output::PutAndGetInlineDocumentsOutput
|
2995 - | {
|
2996 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
2997 - | match crate::protocol_serde::shape_put_and_get_inline_documents::ser_put_and_get_inline_documents_http_response(self) {
|
2998 - | Ok(response) => response,
|
2999 - | Err(e) => {
|
3000 - | ::tracing::error!(error = %e, "failed to serialize response");
|
3001 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
3002 - | }
|
3003 - | }
|
3004 - | }
|
3005 - | }
|
3006 - |
|
3007 - | #[allow(unreachable_code, unused_variables)]
|
3008 - | #[cfg(test)]
|
3009 - | mod put_and_get_inline_documents_test {
|
3010 - |
|
3011 - | /// Serializes inline documents in a JSON request.
|
3012 - | /// Test ID: PutAndGetInlineDocumentsInput
|
3013 - | #[::tokio::test]
|
3014 - | #[::tracing_test::traced_test]
|
3015 - | async fn put_and_get_inline_documents_input_request() {
|
3776 + | async fn serializes_empty_list_shapes_request() {
|
3016 3777 | #[allow(unused_mut)]
|
3017 3778 | let mut http_request = ::http_1x::Request::builder()
|
3018 3779 | .uri("/")
|
3019 3780 | .method("POST")
|
3020 3781 | .header("Content-Type", "application/x-amz-json-1.1")
|
3021 - | .header("X-Amz-Target", "JsonProtocol.PutAndGetInlineDocuments")
|
3782 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
3022 3783 | .body(::aws_smithy_http_server::body::boxed(
|
3023 3784 | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3024 3785 | &::aws_smithy_protocol_test::decode_body_data(
|
3025 - | "{\n \"inlineDocument\": {\"foo\": \"bar\"}\n}".as_bytes(),
|
3786 + | "{\"ListOfStrings\":[]}".as_bytes(),
|
3026 3787 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3027 3788 | ),
|
3028 3789 | )),
|
3029 3790 | ))
|
3030 3791 | .unwrap();
|
3031 3792 | #[allow(unused_mut)]
|
3032 3793 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3033 3794 | let config = crate::service::JsonProtocolConfig::builder().build();
|
3034 3795 | let service = crate::service::JsonProtocol::builder::<
|
3035 3796 | ::aws_smithy_http_server::body::BoxBody,
|
3036 3797 | _,
|
3037 3798 | _,
|
3038 3799 | _,
|
3039 3800 | >(config)
|
3040 - | .put_and_get_inline_documents(move |input: crate::input::PutAndGetInlineDocumentsInput| {
|
3801 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
3041 3802 | let sender = sender.clone();
|
3042 3803 | async move {
|
3043 3804 | let result = {
|
3044 - | let expected = crate::input::PutAndGetInlineDocumentsInput {
|
3045 - | inline_document: ::std::option::Option::Some({
|
3046 - | let json_bytes = br#"{
|
3047 - | "foo": "bar"
|
3048 - | }"#;
|
3049 - | let mut tokens =
|
3050 - | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
3051 - | .peekable();
|
3052 - | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
3053 - | .expect("well formed json")
|
3054 - | }),
|
3055 - | };
|
3056 - | ::pretty_assertions::assert_eq!(input, expected);
|
3057 - | let output = crate::output::PutAndGetInlineDocumentsOutput {
|
3058 - | inline_document: ::std::option::Option::Some({
|
3059 - | let json_bytes = br#"null"#;
|
3060 - | let mut tokens =
|
3061 - | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
3062 - | .peekable();
|
3063 - | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
3064 - | .expect("well formed json")
|
3065 - | }),
|
3805 + | use ::aws_smithy_protocol_test::FloatEquals;
|
3806 + | let expected = crate::input::KitchenSinkOperationInput {
|
3807 + | list_of_strings: ::std::option::Option::Some(vec![]),
|
3808 + | blob: ::std::option::Option::None,
|
3809 + | boolean: ::std::option::Option::None,
|
3810 + | double: ::std::option::Option::None,
|
3811 + | empty_struct: ::std::option::Option::None,
|
3812 + | float: ::std::option::Option::None,
|
3813 + | httpdate_timestamp: ::std::option::Option::None,
|
3814 + | integer: ::std::option::Option::None,
|
3815 + | iso8601_timestamp: ::std::option::Option::None,
|
3816 + | json_value: ::std::option::Option::None,
|
3817 + | list_of_lists: ::std::option::Option::None,
|
3818 + | list_of_maps_of_strings: ::std::option::Option::None,
|
3819 + | list_of_structs: ::std::option::Option::None,
|
3820 + | long: ::std::option::Option::None,
|
3821 + | map_of_lists_of_strings: ::std::option::Option::None,
|
3822 + | map_of_maps: ::std::option::Option::None,
|
3823 + | map_of_strings: ::std::option::Option::None,
|
3824 + | map_of_structs: ::std::option::Option::None,
|
3825 + | recursive_list: ::std::option::Option::None,
|
3826 + | recursive_map: ::std::option::Option::None,
|
3827 + | recursive_struct: ::std::option::Option::None,
|
3828 + | simple_struct: ::std::option::Option::None,
|
3829 + | string: ::std::option::Option::None,
|
3830 + | struct_with_json_name: ::std::option::Option::None,
|
3831 + | timestamp: ::std::option::Option::None,
|
3832 + | unix_timestamp: ::std::option::Option::None,
|
3066 3833 | };
|
3067 - | output
|
3068 - | };
|
3069 - | sender.send(()).await.expect("receiver dropped early");
|
3070 - | result
|
3071 - | }
|
3072 - | })
|
3073 - | .build_unchecked();
|
3074 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3075 - | .await
|
3076 - | .expect("unable to make an HTTP request");
|
3077 - | assert!(
|
3078 - | receiver.recv().await.is_some(),
|
3079 - | "we expected operation handler to be invoked but it was not entered"
|
3080 - | );
|
3081 - | }
|
3082 - |
|
3083 - | /// Serializes inline documents in a JSON response.
|
3084 - | /// Test ID: PutAndGetInlineDocumentsInput
|
3085 - | #[::tokio::test]
|
3086 - | #[::tracing_test::traced_test]
|
3087 - | async fn put_and_get_inline_documents_input_response() {
|
3088 - | let output = crate::output::PutAndGetInlineDocumentsOutput {
|
3089 - | inline_document: ::std::option::Option::Some({
|
3090 - | let json_bytes = br#"{
|
3091 - | "foo": "bar"
|
3092 - | }"#;
|
3093 - | let mut tokens =
|
3094 - | ::aws_smithy_json::deserialize::json_token_iter(json_bytes).peekable();
|
3095 - | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
3096 - | .expect("well formed json")
|
3097 - | }),
|
3098 - | };
|
3099 - | use ::aws_smithy_http_server::response::IntoResponse;
|
3100 - | let http_response = output.into_response();
|
3101 - | ::pretty_assertions::assert_eq!(
|
3102 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3103 - | http_response.status()
|
3104 - | );
|
3105 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
3106 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3107 - | http_response.headers(),
|
3108 - | expected_headers,
|
3109 - | ));
|
3110 - | use ::http_body_util::BodyExt;
|
3111 - | let body = http_response
|
3112 - | .into_body()
|
3113 - | .collect()
|
3114 - | .await
|
3115 - | .expect("unable to collect body")
|
3116 - | .to_bytes();
|
3117 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
3118 - | &body,
|
3119 - | "{\n \"inlineDocument\": {\"foo\": \"bar\"}\n}",
|
3120 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3121 - | ));
|
3122 - | }
|
3123 - | }
|
3124 - |
|
3125 - | ::pin_project_lite::pin_project! {
|
3126 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
3127 - | /// [`OperationWithOptionalInputOutputInput`](crate::input::OperationWithOptionalInputOutputInput) using modelled bindings.
|
3128 - | pub struct OperationWithOptionalInputOutputInputFuture {
|
3129 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::OperationWithOptionalInputOutputInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
3130 - | }
|
3131 - | }
|
3132 - |
|
3133 - | impl std::future::Future for OperationWithOptionalInputOutputInputFuture {
|
3134 - | type Output = Result<
|
3135 - | crate::input::OperationWithOptionalInputOutputInput,
|
3136 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
3137 - | >;
|
3138 - |
|
3139 - | fn poll(
|
3140 - | self: std::pin::Pin<&mut Self>,
|
3141 - | cx: &mut std::task::Context<'_>,
|
3142 - | ) -> std::task::Poll<Self::Output> {
|
3143 - | let this = self.project();
|
3144 - | this.inner.as_mut().poll(cx)
|
3145 - | }
|
3146 - | }
|
3147 - |
|
3148 - | impl<B>
|
3149 - | ::aws_smithy_http_server::request::FromRequest<
|
3150 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
3151 - | B,
|
3152 - | > for crate::input::OperationWithOptionalInputOutputInput
|
3153 - | where
|
3154 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
3155 - | B: 'static,
|
3156 - |
|
3157 - | B::Data: Send,
|
3158 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
3159 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
3160 - | {
|
3161 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
3162 - | type Future = OperationWithOptionalInputOutputInputFuture;
|
3163 - |
|
3164 - | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
3165 - | let fut = async move {
|
3166 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
3167 - | request.headers(),
|
3168 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
3169 - | ) {
|
3170 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
3171 - | }
|
3172 - | crate::protocol_serde::shape_operation_with_optional_input_output::de_operation_with_optional_input_output_http_request(request)
|
3173 - | .await
|
3174 - | };
|
3175 - | use ::futures_util::future::TryFutureExt;
|
3176 - | let fut = fut.map_err(
|
3177 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
3178 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
3179 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
3180 - | },
|
3181 - | );
|
3182 - | OperationWithOptionalInputOutputInputFuture {
|
3183 - | inner: Box::pin(fut),
|
3184 - | }
|
3185 - | }
|
3186 - | }
|
3187 - | impl
|
3188 - | ::aws_smithy_http_server::response::IntoResponse<
|
3189 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
3190 - | > for crate::output::OperationWithOptionalInputOutputOutput
|
3191 - | {
|
3192 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
3193 - | match crate::protocol_serde::shape_operation_with_optional_input_output::ser_operation_with_optional_input_output_http_response(self) {
|
3194 - | Ok(response) => response,
|
3195 - | Err(e) => {
|
3196 - | ::tracing::error!(error = %e, "failed to serialize response");
|
3197 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
3198 - | }
|
3199 - | }
|
3200 - | }
|
3201 - | }
|
3202 - |
|
3203 - | #[allow(unreachable_code, unused_variables)]
|
3204 - | #[cfg(test)]
|
3205 - | mod operation_with_optional_input_output_test {
|
3206 - |
|
3207 - | /// Can call operations with no input or output
|
3208 - | /// Test ID: can_call_operation_with_no_input_or_output
|
3209 - | #[::tokio::test]
|
3210 - | #[::tracing_test::traced_test]
|
3211 - | async fn can_call_operation_with_no_input_or_output_request() {
|
3212 - | #[allow(unused_mut)]
|
3213 - | let mut http_request = ::http_1x::Request::builder()
|
3214 - | .uri("/")
|
3215 - | .method("POST")
|
3216 - | .header("Content-Type", "application/x-amz-json-1.1")
|
3217 - | .header(
|
3218 - | "X-Amz-Target",
|
3219 - | "JsonProtocol.OperationWithOptionalInputOutput",
|
3220 - | )
|
3221 - | .body(::aws_smithy_http_server::body::boxed(
|
3222 - | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3223 - | &::aws_smithy_protocol_test::decode_body_data(
|
3224 - | "{}".as_bytes(),
|
3225 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3226 - | ),
|
3227 - | )),
|
3228 - | ))
|
3229 - | .unwrap();
|
3230 - | #[allow(unused_mut)]
|
3231 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3232 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
3233 - | let service = crate::service::JsonProtocol::builder::<
|
3234 - | ::aws_smithy_http_server::body::BoxBody,
|
3235 - | _,
|
3236 - | _,
|
3237 - | _,
|
3238 - | >(config)
|
3239 - | .operation_with_optional_input_output(
|
3240 - | move |input: crate::input::OperationWithOptionalInputOutputInput| {
|
3241 - | let sender = sender.clone();
|
3242 - | async move {
|
3243 - | let result = {
|
3244 - | let expected = crate::input::OperationWithOptionalInputOutputInput {
|
3245 - | value: ::std::option::Option::None,
|
3246 - | };
|
3247 - | ::pretty_assertions::assert_eq!(input, expected);
|
3248 - | let output = crate::output::OperationWithOptionalInputOutputOutput {
|
3249 - | value: ::std::option::Option::None,
|
3250 - | };
|
3251 - | output
|
3834 + | ::pretty_assertions::assert_eq!(
|
3835 + | input.blob,
|
3836 + | expected.blob,
|
3837 + | "Unexpected value for `blob`"
|
3838 + | );
|
3839 + | ::pretty_assertions::assert_eq!(
|
3840 + | input.boolean,
|
3841 + | expected.boolean,
|
3842 + | "Unexpected value for `boolean`"
|
3843 + | );
|
3844 + | assert!(
|
3845 + | input.double.float_equals(&expected.double),
|
3846 + | "Unexpected value for `double` {:?} vs. {:?}",
|
3847 + | expected.double,
|
3848 + | input.double
|
3849 + | );
|
3850 + | ::pretty_assertions::assert_eq!(
|
3851 + | input.empty_struct,
|
3852 + | expected.empty_struct,
|
3853 + | "Unexpected value for `empty_struct`"
|
3854 + | );
|
3855 + | assert!(
|
3856 + | input.float.float_equals(&expected.float),
|
3857 + | "Unexpected value for `float` {:?} vs. {:?}",
|
3858 + | expected.float,
|
3859 + | input.float
|
3860 + | );
|
3861 + | ::pretty_assertions::assert_eq!(
|
3862 + | input.httpdate_timestamp,
|
3863 + | expected.httpdate_timestamp,
|
3864 + | "Unexpected value for `httpdate_timestamp`"
|
3865 + | );
|
3866 + | ::pretty_assertions::assert_eq!(
|
3867 + | input.integer,
|
3868 + | expected.integer,
|
3869 + | "Unexpected value for `integer`"
|
3870 + | );
|
3871 + | ::pretty_assertions::assert_eq!(
|
3872 + | input.iso8601_timestamp,
|
3873 + | expected.iso8601_timestamp,
|
3874 + | "Unexpected value for `iso8601_timestamp`"
|
3875 + | );
|
3876 + | ::pretty_assertions::assert_eq!(
|
3877 + | input.json_value,
|
3878 + | expected.json_value,
|
3879 + | "Unexpected value for `json_value`"
|
3880 + | );
|
3881 + | ::pretty_assertions::assert_eq!(
|
3882 + | input.list_of_lists,
|
3883 + | expected.list_of_lists,
|
3884 + | "Unexpected value for `list_of_lists`"
|
3885 + | );
|
3886 + | ::pretty_assertions::assert_eq!(
|
3887 + | input.list_of_maps_of_strings,
|
3888 + | expected.list_of_maps_of_strings,
|
3889 + | "Unexpected value for `list_of_maps_of_strings`"
|
3890 + | );
|
3891 + | ::pretty_assertions::assert_eq!(
|
3892 + | input.list_of_strings,
|
3893 + | expected.list_of_strings,
|
3894 + | "Unexpected value for `list_of_strings`"
|
3895 + | );
|
3896 + | ::pretty_assertions::assert_eq!(
|
3897 + | input.list_of_structs,
|
3898 + | expected.list_of_structs,
|
3899 + | "Unexpected value for `list_of_structs`"
|
3900 + | );
|
3901 + | ::pretty_assertions::assert_eq!(
|
3902 + | input.long,
|
3903 + | expected.long,
|
3904 + | "Unexpected value for `long`"
|
3905 + | );
|
3906 + | ::pretty_assertions::assert_eq!(
|
3907 + | input.map_of_lists_of_strings,
|
3908 + | expected.map_of_lists_of_strings,
|
3909 + | "Unexpected value for `map_of_lists_of_strings`"
|
3910 + | );
|
3911 + | ::pretty_assertions::assert_eq!(
|
3912 + | input.map_of_maps,
|
3913 + | expected.map_of_maps,
|
3914 + | "Unexpected value for `map_of_maps`"
|
3915 + | );
|
3916 + | ::pretty_assertions::assert_eq!(
|
3917 + | input.map_of_strings,
|
3918 + | expected.map_of_strings,
|
3919 + | "Unexpected value for `map_of_strings`"
|
3920 + | );
|
3921 + | ::pretty_assertions::assert_eq!(
|
3922 + | input.map_of_structs,
|
3923 + | expected.map_of_structs,
|
3924 + | "Unexpected value for `map_of_structs`"
|
3925 + | );
|
3926 + | ::pretty_assertions::assert_eq!(
|
3927 + | input.recursive_list,
|
3928 + | expected.recursive_list,
|
3929 + | "Unexpected value for `recursive_list`"
|
3930 + | );
|
3931 + | ::pretty_assertions::assert_eq!(
|
3932 + | input.recursive_map,
|
3933 + | expected.recursive_map,
|
3934 + | "Unexpected value for `recursive_map`"
|
3935 + | );
|
3936 + | ::pretty_assertions::assert_eq!(
|
3937 + | input.recursive_struct,
|
3938 + | expected.recursive_struct,
|
3939 + | "Unexpected value for `recursive_struct`"
|
3940 + | );
|
3941 + | ::pretty_assertions::assert_eq!(
|
3942 + | input.simple_struct,
|
3943 + | expected.simple_struct,
|
3944 + | "Unexpected value for `simple_struct`"
|
3945 + | );
|
3946 + | ::pretty_assertions::assert_eq!(
|
3947 + | input.string,
|
3948 + | expected.string,
|
3949 + | "Unexpected value for `string`"
|
3950 + | );
|
3951 + | ::pretty_assertions::assert_eq!(
|
3952 + | input.struct_with_json_name,
|
3953 + | expected.struct_with_json_name,
|
3954 + | "Unexpected value for `struct_with_json_name`"
|
3955 + | );
|
3956 + | ::pretty_assertions::assert_eq!(
|
3957 + | input.timestamp,
|
3958 + | expected.timestamp,
|
3959 + | "Unexpected value for `timestamp`"
|
3960 + | );
|
3961 + | ::pretty_assertions::assert_eq!(
|
3962 + | input.unix_timestamp,
|
3963 + | expected.unix_timestamp,
|
3964 + | "Unexpected value for `unix_timestamp`"
|
3965 + | );
|
3966 + | let output = crate::output::KitchenSinkOperationOutput {
|
3967 + | blob: ::std::option::Option::None,
|
3968 + | boolean: ::std::option::Option::None,
|
3969 + | double: ::std::option::Option::None,
|
3970 + | empty_struct: ::std::option::Option::None,
|
3971 + | float: ::std::option::Option::None,
|
3972 + | httpdate_timestamp: ::std::option::Option::None,
|
3973 + | integer: ::std::option::Option::None,
|
3974 + | iso8601_timestamp: ::std::option::Option::None,
|
3975 + | json_value: ::std::option::Option::None,
|
3976 + | list_of_lists: ::std::option::Option::None,
|
3977 + | list_of_maps_of_strings: ::std::option::Option::None,
|
3978 + | list_of_strings: ::std::option::Option::None,
|
3979 + | list_of_structs: ::std::option::Option::None,
|
3980 + | long: ::std::option::Option::None,
|
3981 + | map_of_lists_of_strings: ::std::option::Option::None,
|
3982 + | map_of_maps: ::std::option::Option::None,
|
3983 + | map_of_strings: ::std::option::Option::None,
|
3984 + | map_of_structs: ::std::option::Option::None,
|
3985 + | recursive_list: ::std::option::Option::None,
|
3986 + | recursive_map: ::std::option::Option::None,
|
3987 + | recursive_struct: ::std::option::Option::None,
|
3988 + | simple_struct: ::std::option::Option::None,
|
3989 + | string: ::std::option::Option::None,
|
3990 + | struct_with_json_name: ::std::option::Option::None,
|
3991 + | timestamp: ::std::option::Option::None,
|
3992 + | unix_timestamp: ::std::option::Option::None,
|
3252 3993 | };
|
3253 - | sender.send(()).await.expect("receiver dropped early");
|
3254 - | result
|
3255 - | }
|
3256 - | },
|
3257 - | )
|
3994 + | Ok(output)
|
3995 + | };
|
3996 + | sender.send(()).await.expect("receiver dropped early");
|
3997 + | result
|
3998 + | }
|
3999 + | })
|
3258 4000 | .build_unchecked();
|
3259 4001 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3260 4002 | .await
|
3261 4003 | .expect("unable to make an HTTP request");
|
3262 4004 | assert!(
|
3263 4005 | receiver.recv().await.is_some(),
|
3264 4006 | "we expected operation handler to be invoked but it was not entered"
|
3265 4007 | );
|
3266 4008 | }
|
3267 4009 |
|
3268 - | /// Can invoke operations with optional input
|
3269 - | /// Test ID: can_call_operation_with_optional_input
|
4010 + | /// Serializes list of map shapes
|
4011 + | /// Test ID: serializes_list_of_map_shapes
|
3270 4012 | #[::tokio::test]
|
3271 4013 | #[::tracing_test::traced_test]
|
3272 - | async fn can_call_operation_with_optional_input_request() {
|
3273 - | #[allow(unused_mut)]
|
3274 - | let mut http_request = ::http_1x::Request::builder()
|
3275 - | .uri("/")
|
3276 - | .method("POST")
|
3277 - | .header("Content-Type", "application/x-amz-json-1.1")
|
3278 - | .header(
|
3279 - | "X-Amz-Target",
|
3280 - | "JsonProtocol.OperationWithOptionalInputOutput",
|
3281 - | )
|
3282 - | .body(::aws_smithy_http_server::body::boxed(
|
3283 - | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3284 - | &::aws_smithy_protocol_test::decode_body_data(
|
3285 - | "{\"Value\":\"Hi\"}".as_bytes(),
|
3286 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3287 - | ),
|
3288 - | )),
|
3289 - | ))
|
3290 - | .unwrap();
|
3291 - | #[allow(unused_mut)]
|
3292 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3293 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
3294 - | let service = crate::service::JsonProtocol::builder::<
|
3295 - | ::aws_smithy_http_server::body::BoxBody,
|
3296 - | _,
|
3297 - | _,
|
3298 - | _,
|
3299 - | >(config)
|
3300 - | .operation_with_optional_input_output(
|
3301 - | move |input: crate::input::OperationWithOptionalInputOutputInput| {
|
3302 - | let sender = sender.clone();
|
3303 - | async move {
|
3304 - | let result = {
|
3305 - | let expected = crate::input::OperationWithOptionalInputOutputInput {
|
3306 - | value: ::std::option::Option::Some("Hi".to_owned()),
|
3307 - | };
|
3308 - | ::pretty_assertions::assert_eq!(input, expected);
|
3309 - | let output = crate::output::OperationWithOptionalInputOutputOutput {
|
3310 - | value: ::std::option::Option::None,
|
3311 - | };
|
3312 - | output
|
3313 - | };
|
3314 - | sender.send(()).await.expect("receiver dropped early");
|
3315 - | result
|
3316 - | }
|
3317 - | },
|
3318 - | )
|
3319 - | .build_unchecked();
|
3320 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3321 - | .await
|
3322 - | .expect("unable to make an HTTP request");
|
3323 - | assert!(
|
3324 - | receiver.recv().await.is_some(),
|
3325 - | "we expected operation handler to be invoked but it was not entered"
|
3326 - | );
|
3327 - | }
|
3328 - | }
|
3329 - |
|
3330 - | ::pin_project_lite::pin_project! {
|
3331 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
3332 - | /// [`SimpleScalarPropertiesInput`](crate::input::SimpleScalarPropertiesInput) using modelled bindings.
|
3333 - | pub struct SimpleScalarPropertiesInputFuture {
|
3334 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SimpleScalarPropertiesInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
3335 - | }
|
3336 - | }
|
3337 - |
|
3338 - | impl std::future::Future for SimpleScalarPropertiesInputFuture {
|
3339 - | type Output = Result<
|
3340 - | crate::input::SimpleScalarPropertiesInput,
|
3341 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
3342 - | >;
|
3343 - |
|
3344 - | fn poll(
|
3345 - | self: std::pin::Pin<&mut Self>,
|
3346 - | cx: &mut std::task::Context<'_>,
|
3347 - | ) -> std::task::Poll<Self::Output> {
|
3348 - | let this = self.project();
|
3349 - | this.inner.as_mut().poll(cx)
|
3350 - | }
|
3351 - | }
|
3352 - |
|
3353 - | impl<B>
|
3354 - | ::aws_smithy_http_server::request::FromRequest<
|
3355 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
3356 - | B,
|
3357 - | > for crate::input::SimpleScalarPropertiesInput
|
3358 - | where
|
3359 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
3360 - | B: 'static,
|
3361 - |
|
3362 - | B::Data: Send,
|
3363 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
3364 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
3365 - | {
|
3366 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
3367 - | type Future = SimpleScalarPropertiesInputFuture;
|
3368 - |
|
3369 - | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
3370 - | let fut = async move {
|
3371 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
3372 - | request.headers(),
|
3373 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
3374 - | ) {
|
3375 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
3376 - | }
|
3377 - | crate::protocol_serde::shape_simple_scalar_properties::de_simple_scalar_properties_http_request(request)
|
3378 - | .await
|
3379 - | };
|
3380 - | use ::futures_util::future::TryFutureExt;
|
3381 - | let fut = fut.map_err(
|
3382 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
3383 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
3384 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
3385 - | },
|
3386 - | );
|
3387 - | SimpleScalarPropertiesInputFuture {
|
3388 - | inner: Box::pin(fut),
|
3389 - | }
|
3390 - | }
|
3391 - | }
|
3392 - | impl
|
3393 - | ::aws_smithy_http_server::response::IntoResponse<
|
3394 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
3395 - | > for crate::output::SimpleScalarPropertiesOutput
|
3396 - | {
|
3397 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
3398 - | match crate::protocol_serde::shape_simple_scalar_properties::ser_simple_scalar_properties_http_response(self) {
|
3399 - | Ok(response) => response,
|
3400 - | Err(e) => {
|
3401 - | ::tracing::error!(error = %e, "failed to serialize response");
|
3402 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
3403 - | }
|
3404 - | }
|
3405 - | }
|
3406 - | }
|
3407 - |
|
3408 - | #[allow(unreachable_code, unused_variables)]
|
3409 - | #[cfg(test)]
|
3410 - | mod simple_scalar_properties_test {
|
3411 - |
|
3412 - | /// Supports handling NaN float values.
|
3413 - | /// Test ID: AwsJson11SupportsNaNFloatInputs
|
3414 - | #[::tokio::test]
|
3415 - | #[::tracing_test::traced_test]
|
3416 - | async fn aws_json11_supports_na_n_float_inputs_request() {
|
3417 - | #[allow(unused_mut)]
|
3418 - | let mut http_request = ::http_1x::Request::builder()
|
3419 - | .uri("/")
|
3420 - | .method("POST")
|
3421 - | .header("Content-Type", "application/x-amz-json-1.1")
|
3422 - | .header("X-Amz-Target", "JsonProtocol.SimpleScalarProperties")
|
3423 - | .body(::aws_smithy_http_server::body::boxed(
|
3424 - | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3425 - | &::aws_smithy_protocol_test::decode_body_data(
|
3426 - | "{\n \"floatValue\": \"NaN\",\n \"doubleValue\": \"NaN\"\n}"
|
3427 - | .as_bytes(),
|
3428 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3429 - | ),
|
3430 - | )),
|
3431 - | ))
|
3432 - | .unwrap();
|
3433 - | #[allow(unused_mut)]
|
3434 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3435 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
3436 - | let service = crate::service::JsonProtocol::builder::<
|
3437 - | ::aws_smithy_http_server::body::BoxBody,
|
3438 - | _,
|
3439 - | _,
|
3440 - | _,
|
3441 - | >(config)
|
3442 - | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
3443 - | let sender = sender.clone();
|
3444 - | async move {
|
3445 - | let result = {
|
3446 - | use ::aws_smithy_protocol_test::FloatEquals;
|
3447 - | let expected = crate::input::SimpleScalarPropertiesInput {
|
3448 - | float_value: ::std::option::Option::Some(
|
3449 - | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
3450 - | "NaN",
|
3451 - | )
|
3452 - | .expect("invalid string for number"),
|
3453 - | ),
|
3454 - | double_value: ::std::option::Option::Some(
|
3455 - | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
3456 - | "NaN",
|
3457 - | )
|
3458 - | .expect("invalid string for number"),
|
3459 - | ),
|
3460 - | };
|
3461 - | assert!(
|
3462 - | input.float_value.float_equals(&expected.float_value),
|
3463 - | "Unexpected value for `float_value` {:?} vs. {:?}",
|
3464 - | expected.float_value,
|
3465 - | input.float_value
|
3466 - | );
|
3467 - | assert!(
|
3468 - | input.double_value.float_equals(&expected.double_value),
|
3469 - | "Unexpected value for `double_value` {:?} vs. {:?}",
|
3470 - | expected.double_value,
|
3471 - | input.double_value
|
3472 - | );
|
3473 - | let output = crate::output::SimpleScalarPropertiesOutput {
|
3474 - | float_value: ::std::option::Option::None,
|
3475 - | double_value: ::std::option::Option::None,
|
3476 - | };
|
3477 - | output
|
3478 - | };
|
3479 - | sender.send(()).await.expect("receiver dropped early");
|
3480 - | result
|
3481 - | }
|
3482 - | })
|
3483 - | .build_unchecked();
|
3484 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3485 - | .await
|
3486 - | .expect("unable to make an HTTP request");
|
3487 - | assert!(
|
3488 - | receiver.recv().await.is_some(),
|
3489 - | "we expected operation handler to be invoked but it was not entered"
|
3490 - | );
|
3491 - | }
|
3492 - |
|
3493 - | /// Supports handling Infinity float values.
|
3494 - | /// Test ID: AwsJson11SupportsInfinityFloatInputs
|
3495 - | #[::tokio::test]
|
3496 - | #[::tracing_test::traced_test]
|
3497 - | async fn aws_json11_supports_infinity_float_inputs_request() {
|
4014 + | async fn serializes_list_of_map_shapes_request() {
|
3498 4015 | #[allow(unused_mut)]
|
3499 4016 | let mut http_request = ::http_1x::Request::builder()
|
3500 4017 | .uri("/")
|
3501 4018 | .method("POST")
|
3502 4019 | .header("Content-Type", "application/x-amz-json-1.1")
|
3503 - | .header("X-Amz-Target", "JsonProtocol.SimpleScalarProperties")
|
4020 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
3504 4021 | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
3505 4022 | ::bytes::Bytes::copy_from_slice(
|
3506 - | &::aws_smithy_protocol_test::decode_body_data("{\n \"floatValue\": \"Infinity\",\n \"doubleValue\": \"Infinity\"\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4023 + | &::aws_smithy_protocol_test::decode_body_data("{\"ListOfMapsOfStrings\":[{\"foo\":\"bar\"},{\"abc\":\"xyz\"},{\"red\":\"blue\"}]}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3507 4024 | )
|
3508 4025 | ))).unwrap();
|
3509 4026 | #[allow(unused_mut)]
|
3510 4027 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3511 4028 | let config = crate::service::JsonProtocolConfig::builder().build();
|
3512 4029 | let service = crate::service::JsonProtocol::builder::<
|
3513 4030 | ::aws_smithy_http_server::body::BoxBody,
|
3514 4031 | _,
|
3515 4032 | _,
|
3516 4033 | _,
|
3517 4034 | >(config)
|
3518 - | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
4035 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
3519 4036 | let sender = sender.clone();
|
3520 4037 | async move {
|
3521 4038 | let result = {
|
3522 4039 | use ::aws_smithy_protocol_test::FloatEquals;
|
3523 - | let expected = crate::input::SimpleScalarPropertiesInput {
|
3524 - | float_value: ::std::option::Option::Some(
|
3525 - | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
3526 - | "Infinity",
|
3527 - | )
|
3528 - | .expect("invalid string for number"),
|
3529 - | ),
|
3530 - | double_value: ::std::option::Option::Some(
|
3531 - | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
3532 - | "Infinity",
|
3533 - | )
|
3534 - | .expect("invalid string for number"),
|
3535 - | ),
|
3536 - | };
|
3537 - | assert!(
|
3538 - | input.float_value.float_equals(&expected.float_value),
|
3539 - | "Unexpected value for `float_value` {:?} vs. {:?}",
|
3540 - | expected.float_value,
|
3541 - | input.float_value
|
3542 - | );
|
3543 - | assert!(
|
3544 - | input.double_value.float_equals(&expected.double_value),
|
3545 - | "Unexpected value for `double_value` {:?} vs. {:?}",
|
3546 - | expected.double_value,
|
3547 - | input.double_value
|
3548 - | );
|
3549 - | let output = crate::output::SimpleScalarPropertiesOutput {
|
3550 - | float_value: ::std::option::Option::None,
|
3551 - | double_value: ::std::option::Option::None,
|
3552 - | };
|
3553 - | output
|
3554 - | };
|
3555 - | sender.send(()).await.expect("receiver dropped early");
|
3556 - | result
|
3557 - | }
|
3558 - | })
|
3559 - | .build_unchecked();
|
3560 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3561 - | .await
|
3562 - | .expect("unable to make an HTTP request");
|
3563 - | assert!(
|
3564 - | receiver.recv().await.is_some(),
|
3565 - | "we expected operation handler to be invoked but it was not entered"
|
4040 + | let expected = crate::input::KitchenSinkOperationInput {
|
4041 + | list_of_maps_of_strings: ::std::option::Option::Some(vec![
|
4042 + | {
|
4043 + | let mut ret = ::std::collections::HashMap::new();
|
4044 + | ret.insert("foo".to_owned(), "bar".to_owned());
|
4045 + | ret
|
4046 + | },
|
4047 + | {
|
4048 + | let mut ret = ::std::collections::HashMap::new();
|
4049 + | ret.insert("abc".to_owned(), "xyz".to_owned());
|
4050 + | ret
|
4051 + | },
|
4052 + | {
|
4053 + | let mut ret = ::std::collections::HashMap::new();
|
4054 + | ret.insert("red".to_owned(), "blue".to_owned());
|
4055 + | ret
|
4056 + | },
|
4057 + | ]),
|
4058 + | blob: ::std::option::Option::None,
|
4059 + | boolean: ::std::option::Option::None,
|
4060 + | double: ::std::option::Option::None,
|
4061 + | empty_struct: ::std::option::Option::None,
|
4062 + | float: ::std::option::Option::None,
|
4063 + | httpdate_timestamp: ::std::option::Option::None,
|
4064 + | integer: ::std::option::Option::None,
|
4065 + | iso8601_timestamp: ::std::option::Option::None,
|
4066 + | json_value: ::std::option::Option::None,
|
4067 + | list_of_lists: ::std::option::Option::None,
|
4068 + | list_of_strings: ::std::option::Option::None,
|
4069 + | list_of_structs: ::std::option::Option::None,
|
4070 + | long: ::std::option::Option::None,
|
4071 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4072 + | map_of_maps: ::std::option::Option::None,
|
4073 + | map_of_strings: ::std::option::Option::None,
|
4074 + | map_of_structs: ::std::option::Option::None,
|
4075 + | recursive_list: ::std::option::Option::None,
|
4076 + | recursive_map: ::std::option::Option::None,
|
4077 + | recursive_struct: ::std::option::Option::None,
|
4078 + | simple_struct: ::std::option::Option::None,
|
4079 + | string: ::std::option::Option::None,
|
4080 + | struct_with_json_name: ::std::option::Option::None,
|
4081 + | timestamp: ::std::option::Option::None,
|
4082 + | unix_timestamp: ::std::option::Option::None,
|
4083 + | };
|
4084 + | ::pretty_assertions::assert_eq!(
|
4085 + | input.blob,
|
4086 + | expected.blob,
|
4087 + | "Unexpected value for `blob`"
|
4088 + | );
|
4089 + | ::pretty_assertions::assert_eq!(
|
4090 + | input.boolean,
|
4091 + | expected.boolean,
|
4092 + | "Unexpected value for `boolean`"
|
4093 + | );
|
4094 + | assert!(
|
4095 + | input.double.float_equals(&expected.double),
|
4096 + | "Unexpected value for `double` {:?} vs. {:?}",
|
4097 + | expected.double,
|
4098 + | input.double
|
4099 + | );
|
4100 + | ::pretty_assertions::assert_eq!(
|
4101 + | input.empty_struct,
|
4102 + | expected.empty_struct,
|
4103 + | "Unexpected value for `empty_struct`"
|
4104 + | );
|
4105 + | assert!(
|
4106 + | input.float.float_equals(&expected.float),
|
4107 + | "Unexpected value for `float` {:?} vs. {:?}",
|
4108 + | expected.float,
|
4109 + | input.float
|
4110 + | );
|
4111 + | ::pretty_assertions::assert_eq!(
|
4112 + | input.httpdate_timestamp,
|
4113 + | expected.httpdate_timestamp,
|
4114 + | "Unexpected value for `httpdate_timestamp`"
|
4115 + | );
|
4116 + | ::pretty_assertions::assert_eq!(
|
4117 + | input.integer,
|
4118 + | expected.integer,
|
4119 + | "Unexpected value for `integer`"
|
4120 + | );
|
4121 + | ::pretty_assertions::assert_eq!(
|
4122 + | input.iso8601_timestamp,
|
4123 + | expected.iso8601_timestamp,
|
4124 + | "Unexpected value for `iso8601_timestamp`"
|
4125 + | );
|
4126 + | ::pretty_assertions::assert_eq!(
|
4127 + | input.json_value,
|
4128 + | expected.json_value,
|
4129 + | "Unexpected value for `json_value`"
|
4130 + | );
|
4131 + | ::pretty_assertions::assert_eq!(
|
4132 + | input.list_of_lists,
|
4133 + | expected.list_of_lists,
|
4134 + | "Unexpected value for `list_of_lists`"
|
4135 + | );
|
4136 + | ::pretty_assertions::assert_eq!(
|
4137 + | input.list_of_maps_of_strings,
|
4138 + | expected.list_of_maps_of_strings,
|
4139 + | "Unexpected value for `list_of_maps_of_strings`"
|
4140 + | );
|
4141 + | ::pretty_assertions::assert_eq!(
|
4142 + | input.list_of_strings,
|
4143 + | expected.list_of_strings,
|
4144 + | "Unexpected value for `list_of_strings`"
|
4145 + | );
|
4146 + | ::pretty_assertions::assert_eq!(
|
4147 + | input.list_of_structs,
|
4148 + | expected.list_of_structs,
|
4149 + | "Unexpected value for `list_of_structs`"
|
4150 + | );
|
4151 + | ::pretty_assertions::assert_eq!(
|
4152 + | input.long,
|
4153 + | expected.long,
|
4154 + | "Unexpected value for `long`"
|
4155 + | );
|
4156 + | ::pretty_assertions::assert_eq!(
|
4157 + | input.map_of_lists_of_strings,
|
4158 + | expected.map_of_lists_of_strings,
|
4159 + | "Unexpected value for `map_of_lists_of_strings`"
|
4160 + | );
|
4161 + | ::pretty_assertions::assert_eq!(
|
4162 + | input.map_of_maps,
|
4163 + | expected.map_of_maps,
|
4164 + | "Unexpected value for `map_of_maps`"
|
4165 + | );
|
4166 + | ::pretty_assertions::assert_eq!(
|
4167 + | input.map_of_strings,
|
4168 + | expected.map_of_strings,
|
4169 + | "Unexpected value for `map_of_strings`"
|
4170 + | );
|
4171 + | ::pretty_assertions::assert_eq!(
|
4172 + | input.map_of_structs,
|
4173 + | expected.map_of_structs,
|
4174 + | "Unexpected value for `map_of_structs`"
|
4175 + | );
|
4176 + | ::pretty_assertions::assert_eq!(
|
4177 + | input.recursive_list,
|
4178 + | expected.recursive_list,
|
4179 + | "Unexpected value for `recursive_list`"
|
4180 + | );
|
4181 + | ::pretty_assertions::assert_eq!(
|
4182 + | input.recursive_map,
|
4183 + | expected.recursive_map,
|
4184 + | "Unexpected value for `recursive_map`"
|
4185 + | );
|
4186 + | ::pretty_assertions::assert_eq!(
|
4187 + | input.recursive_struct,
|
4188 + | expected.recursive_struct,
|
4189 + | "Unexpected value for `recursive_struct`"
|
4190 + | );
|
4191 + | ::pretty_assertions::assert_eq!(
|
4192 + | input.simple_struct,
|
4193 + | expected.simple_struct,
|
4194 + | "Unexpected value for `simple_struct`"
|
4195 + | );
|
4196 + | ::pretty_assertions::assert_eq!(
|
4197 + | input.string,
|
4198 + | expected.string,
|
4199 + | "Unexpected value for `string`"
|
4200 + | );
|
4201 + | ::pretty_assertions::assert_eq!(
|
4202 + | input.struct_with_json_name,
|
4203 + | expected.struct_with_json_name,
|
4204 + | "Unexpected value for `struct_with_json_name`"
|
4205 + | );
|
4206 + | ::pretty_assertions::assert_eq!(
|
4207 + | input.timestamp,
|
4208 + | expected.timestamp,
|
4209 + | "Unexpected value for `timestamp`"
|
4210 + | );
|
4211 + | ::pretty_assertions::assert_eq!(
|
4212 + | input.unix_timestamp,
|
4213 + | expected.unix_timestamp,
|
4214 + | "Unexpected value for `unix_timestamp`"
|
4215 + | );
|
4216 + | let output = crate::output::KitchenSinkOperationOutput {
|
4217 + | blob: ::std::option::Option::None,
|
4218 + | boolean: ::std::option::Option::None,
|
4219 + | double: ::std::option::Option::None,
|
4220 + | empty_struct: ::std::option::Option::None,
|
4221 + | float: ::std::option::Option::None,
|
4222 + | httpdate_timestamp: ::std::option::Option::None,
|
4223 + | integer: ::std::option::Option::None,
|
4224 + | iso8601_timestamp: ::std::option::Option::None,
|
4225 + | json_value: ::std::option::Option::None,
|
4226 + | list_of_lists: ::std::option::Option::None,
|
4227 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4228 + | list_of_strings: ::std::option::Option::None,
|
4229 + | list_of_structs: ::std::option::Option::None,
|
4230 + | long: ::std::option::Option::None,
|
4231 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4232 + | map_of_maps: ::std::option::Option::None,
|
4233 + | map_of_strings: ::std::option::Option::None,
|
4234 + | map_of_structs: ::std::option::Option::None,
|
4235 + | recursive_list: ::std::option::Option::None,
|
4236 + | recursive_map: ::std::option::Option::None,
|
4237 + | recursive_struct: ::std::option::Option::None,
|
4238 + | simple_struct: ::std::option::Option::None,
|
4239 + | string: ::std::option::Option::None,
|
4240 + | struct_with_json_name: ::std::option::Option::None,
|
4241 + | timestamp: ::std::option::Option::None,
|
4242 + | unix_timestamp: ::std::option::Option::None,
|
4243 + | };
|
4244 + | Ok(output)
|
4245 + | };
|
4246 + | sender.send(()).await.expect("receiver dropped early");
|
4247 + | result
|
4248 + | }
|
4249 + | })
|
4250 + | .build_unchecked();
|
4251 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4252 + | .await
|
4253 + | .expect("unable to make an HTTP request");
|
4254 + | assert!(
|
4255 + | receiver.recv().await.is_some(),
|
4256 + | "we expected operation handler to be invoked but it was not entered"
|
3566 4257 | );
|
3567 4258 | }
|
3568 4259 |
|
3569 - | /// Supports handling -Infinity float values.
|
3570 - | /// Test ID: AwsJson11SupportsNegativeInfinityFloatInputs
|
4260 + | /// Serializes list of structure shapes
|
4261 + | /// Test ID: serializes_list_of_structure_shapes
|
3571 4262 | #[::tokio::test]
|
3572 4263 | #[::tracing_test::traced_test]
|
3573 - | async fn aws_json11_supports_negative_infinity_float_inputs_request() {
|
4264 + | async fn serializes_list_of_structure_shapes_request() {
|
3574 4265 | #[allow(unused_mut)]
|
3575 4266 | let mut http_request = ::http_1x::Request::builder()
|
3576 4267 | .uri("/")
|
3577 4268 | .method("POST")
|
3578 4269 | .header("Content-Type", "application/x-amz-json-1.1")
|
3579 - | .header("X-Amz-Target", "JsonProtocol.SimpleScalarProperties")
|
4270 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
3580 4271 | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
3581 4272 | ::bytes::Bytes::copy_from_slice(
|
3582 - | &::aws_smithy_protocol_test::decode_body_data("{\n \"floatValue\": \"-Infinity\",\n \"doubleValue\": \"-Infinity\"\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4273 + | &::aws_smithy_protocol_test::decode_body_data("{\"ListOfStructs\":[{\"Value\":\"abc\"},{\"Value\":\"mno\"},{\"Value\":\"xyz\"}]}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3583 4274 | )
|
3584 4275 | ))).unwrap();
|
3585 4276 | #[allow(unused_mut)]
|
3586 4277 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3587 4278 | let config = crate::service::JsonProtocolConfig::builder().build();
|
3588 4279 | let service = crate::service::JsonProtocol::builder::<
|
3589 4280 | ::aws_smithy_http_server::body::BoxBody,
|
3590 4281 | _,
|
3591 4282 | _,
|
3592 4283 | _,
|
3593 4284 | >(config)
|
3594 - | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
4285 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
3595 4286 | let sender = sender.clone();
|
3596 4287 | async move {
|
3597 4288 | let result = {
|
3598 4289 | use ::aws_smithy_protocol_test::FloatEquals;
|
3599 - | let expected = crate::input::SimpleScalarPropertiesInput {
|
3600 - | float_value: ::std::option::Option::Some(
|
3601 - | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
3602 - | "-Infinity",
|
3603 - | )
|
3604 - | .expect("invalid string for number"),
|
3605 - | ),
|
3606 - | double_value: ::std::option::Option::Some(
|
3607 - | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
3608 - | "-Infinity",
|
3609 - | )
|
3610 - | .expect("invalid string for number"),
|
3611 - | ),
|
3612 - | };
|
3613 - | assert!(
|
3614 - | input.float_value.float_equals(&expected.float_value),
|
3615 - | "Unexpected value for `float_value` {:?} vs. {:?}",
|
3616 - | expected.float_value,
|
3617 - | input.float_value
|
3618 - | );
|
3619 - | assert!(
|
3620 - | input.double_value.float_equals(&expected.double_value),
|
3621 - | "Unexpected value for `double_value` {:?} vs. {:?}",
|
3622 - | expected.double_value,
|
3623 - | input.double_value
|
3624 - | );
|
3625 - | let output = crate::output::SimpleScalarPropertiesOutput {
|
3626 - | float_value: ::std::option::Option::None,
|
3627 - | double_value: ::std::option::Option::None,
|
4290 + | let expected = crate::input::KitchenSinkOperationInput {
|
4291 + | list_of_structs: ::std::option::Option::Some(vec![
|
4292 + | crate::model::SimpleStruct {
|
4293 + | value: ::std::option::Option::Some("abc".to_owned()),
|
4294 + | },
|
4295 + | crate::model::SimpleStruct {
|
4296 + | value: ::std::option::Option::Some("mno".to_owned()),
|
4297 + | },
|
4298 + | crate::model::SimpleStruct {
|
4299 + | value: ::std::option::Option::Some("xyz".to_owned()),
|
4300 + | },
|
4301 + | ]),
|
4302 + | blob: ::std::option::Option::None,
|
4303 + | boolean: ::std::option::Option::None,
|
4304 + | double: ::std::option::Option::None,
|
4305 + | empty_struct: ::std::option::Option::None,
|
4306 + | float: ::std::option::Option::None,
|
4307 + | httpdate_timestamp: ::std::option::Option::None,
|
4308 + | integer: ::std::option::Option::None,
|
4309 + | iso8601_timestamp: ::std::option::Option::None,
|
4310 + | json_value: ::std::option::Option::None,
|
4311 + | list_of_lists: ::std::option::Option::None,
|
4312 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4313 + | list_of_strings: ::std::option::Option::None,
|
4314 + | long: ::std::option::Option::None,
|
4315 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4316 + | map_of_maps: ::std::option::Option::None,
|
4317 + | map_of_strings: ::std::option::Option::None,
|
4318 + | map_of_structs: ::std::option::Option::None,
|
4319 + | recursive_list: ::std::option::Option::None,
|
4320 + | recursive_map: ::std::option::Option::None,
|
4321 + | recursive_struct: ::std::option::Option::None,
|
4322 + | simple_struct: ::std::option::Option::None,
|
4323 + | string: ::std::option::Option::None,
|
4324 + | struct_with_json_name: ::std::option::Option::None,
|
4325 + | timestamp: ::std::option::Option::None,
|
4326 + | unix_timestamp: ::std::option::Option::None,
|
3628 4327 | };
|
3629 - | output
|
4328 + | ::pretty_assertions::assert_eq!(
|
4329 + | input.blob,
|
4330 + | expected.blob,
|
4331 + | "Unexpected value for `blob`"
|
4332 + | );
|
4333 + | ::pretty_assertions::assert_eq!(
|
4334 + | input.boolean,
|
4335 + | expected.boolean,
|
4336 + | "Unexpected value for `boolean`"
|
4337 + | );
|
4338 + | assert!(
|
4339 + | input.double.float_equals(&expected.double),
|
4340 + | "Unexpected value for `double` {:?} vs. {:?}",
|
4341 + | expected.double,
|
4342 + | input.double
|
4343 + | );
|
4344 + | ::pretty_assertions::assert_eq!(
|
4345 + | input.empty_struct,
|
4346 + | expected.empty_struct,
|
4347 + | "Unexpected value for `empty_struct`"
|
4348 + | );
|
4349 + | assert!(
|
4350 + | input.float.float_equals(&expected.float),
|
4351 + | "Unexpected value for `float` {:?} vs. {:?}",
|
4352 + | expected.float,
|
4353 + | input.float
|
4354 + | );
|
4355 + | ::pretty_assertions::assert_eq!(
|
4356 + | input.httpdate_timestamp,
|
4357 + | expected.httpdate_timestamp,
|
4358 + | "Unexpected value for `httpdate_timestamp`"
|
4359 + | );
|
4360 + | ::pretty_assertions::assert_eq!(
|
4361 + | input.integer,
|
4362 + | expected.integer,
|
4363 + | "Unexpected value for `integer`"
|
4364 + | );
|
4365 + | ::pretty_assertions::assert_eq!(
|
4366 + | input.iso8601_timestamp,
|
4367 + | expected.iso8601_timestamp,
|
4368 + | "Unexpected value for `iso8601_timestamp`"
|
4369 + | );
|
4370 + | ::pretty_assertions::assert_eq!(
|
4371 + | input.json_value,
|
4372 + | expected.json_value,
|
4373 + | "Unexpected value for `json_value`"
|
4374 + | );
|
4375 + | ::pretty_assertions::assert_eq!(
|
4376 + | input.list_of_lists,
|
4377 + | expected.list_of_lists,
|
4378 + | "Unexpected value for `list_of_lists`"
|
4379 + | );
|
4380 + | ::pretty_assertions::assert_eq!(
|
4381 + | input.list_of_maps_of_strings,
|
4382 + | expected.list_of_maps_of_strings,
|
4383 + | "Unexpected value for `list_of_maps_of_strings`"
|
4384 + | );
|
4385 + | ::pretty_assertions::assert_eq!(
|
4386 + | input.list_of_strings,
|
4387 + | expected.list_of_strings,
|
4388 + | "Unexpected value for `list_of_strings`"
|
4389 + | );
|
4390 + | ::pretty_assertions::assert_eq!(
|
4391 + | input.list_of_structs,
|
4392 + | expected.list_of_structs,
|
4393 + | "Unexpected value for `list_of_structs`"
|
4394 + | );
|
4395 + | ::pretty_assertions::assert_eq!(
|
4396 + | input.long,
|
4397 + | expected.long,
|
4398 + | "Unexpected value for `long`"
|
4399 + | );
|
4400 + | ::pretty_assertions::assert_eq!(
|
4401 + | input.map_of_lists_of_strings,
|
4402 + | expected.map_of_lists_of_strings,
|
4403 + | "Unexpected value for `map_of_lists_of_strings`"
|
4404 + | );
|
4405 + | ::pretty_assertions::assert_eq!(
|
4406 + | input.map_of_maps,
|
4407 + | expected.map_of_maps,
|
4408 + | "Unexpected value for `map_of_maps`"
|
4409 + | );
|
4410 + | ::pretty_assertions::assert_eq!(
|
4411 + | input.map_of_strings,
|
4412 + | expected.map_of_strings,
|
4413 + | "Unexpected value for `map_of_strings`"
|
4414 + | );
|
4415 + | ::pretty_assertions::assert_eq!(
|
4416 + | input.map_of_structs,
|
4417 + | expected.map_of_structs,
|
4418 + | "Unexpected value for `map_of_structs`"
|
4419 + | );
|
4420 + | ::pretty_assertions::assert_eq!(
|
4421 + | input.recursive_list,
|
4422 + | expected.recursive_list,
|
4423 + | "Unexpected value for `recursive_list`"
|
4424 + | );
|
4425 + | ::pretty_assertions::assert_eq!(
|
4426 + | input.recursive_map,
|
4427 + | expected.recursive_map,
|
4428 + | "Unexpected value for `recursive_map`"
|
4429 + | );
|
4430 + | ::pretty_assertions::assert_eq!(
|
4431 + | input.recursive_struct,
|
4432 + | expected.recursive_struct,
|
4433 + | "Unexpected value for `recursive_struct`"
|
4434 + | );
|
4435 + | ::pretty_assertions::assert_eq!(
|
4436 + | input.simple_struct,
|
4437 + | expected.simple_struct,
|
4438 + | "Unexpected value for `simple_struct`"
|
4439 + | );
|
4440 + | ::pretty_assertions::assert_eq!(
|
4441 + | input.string,
|
4442 + | expected.string,
|
4443 + | "Unexpected value for `string`"
|
4444 + | );
|
4445 + | ::pretty_assertions::assert_eq!(
|
4446 + | input.struct_with_json_name,
|
4447 + | expected.struct_with_json_name,
|
4448 + | "Unexpected value for `struct_with_json_name`"
|
4449 + | );
|
4450 + | ::pretty_assertions::assert_eq!(
|
4451 + | input.timestamp,
|
4452 + | expected.timestamp,
|
4453 + | "Unexpected value for `timestamp`"
|
4454 + | );
|
4455 + | ::pretty_assertions::assert_eq!(
|
4456 + | input.unix_timestamp,
|
4457 + | expected.unix_timestamp,
|
4458 + | "Unexpected value for `unix_timestamp`"
|
4459 + | );
|
4460 + | let output = crate::output::KitchenSinkOperationOutput {
|
4461 + | blob: ::std::option::Option::None,
|
4462 + | boolean: ::std::option::Option::None,
|
4463 + | double: ::std::option::Option::None,
|
4464 + | empty_struct: ::std::option::Option::None,
|
4465 + | float: ::std::option::Option::None,
|
4466 + | httpdate_timestamp: ::std::option::Option::None,
|
4467 + | integer: ::std::option::Option::None,
|
4468 + | iso8601_timestamp: ::std::option::Option::None,
|
4469 + | json_value: ::std::option::Option::None,
|
4470 + | list_of_lists: ::std::option::Option::None,
|
4471 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4472 + | list_of_strings: ::std::option::Option::None,
|
4473 + | list_of_structs: ::std::option::Option::None,
|
4474 + | long: ::std::option::Option::None,
|
4475 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4476 + | map_of_maps: ::std::option::Option::None,
|
4477 + | map_of_strings: ::std::option::Option::None,
|
4478 + | map_of_structs: ::std::option::Option::None,
|
4479 + | recursive_list: ::std::option::Option::None,
|
4480 + | recursive_map: ::std::option::Option::None,
|
4481 + | recursive_struct: ::std::option::Option::None,
|
4482 + | simple_struct: ::std::option::Option::None,
|
4483 + | string: ::std::option::Option::None,
|
4484 + | struct_with_json_name: ::std::option::Option::None,
|
4485 + | timestamp: ::std::option::Option::None,
|
4486 + | unix_timestamp: ::std::option::Option::None,
|
4487 + | };
|
4488 + | Ok(output)
|
3630 4489 | };
|
3631 4490 | sender.send(()).await.expect("receiver dropped early");
|
3632 4491 | result
|
3633 4492 | }
|
3634 4493 | })
|
3635 4494 | .build_unchecked();
|
3636 4495 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3637 4496 | .await
|
3638 4497 | .expect("unable to make an HTTP request");
|
3639 4498 | assert!(
|
3640 4499 | receiver.recv().await.is_some(),
|
3641 4500 | "we expected operation handler to be invoked but it was not entered"
|
3642 4501 | );
|
3643 4502 | }
|
3644 4503 |
|
3645 - | /// Supports handling NaN float values.
|
3646 - | /// Test ID: AwsJson11SupportsNaNFloatInputs
|
3647 - | #[::tokio::test]
|
3648 - | #[::tracing_test::traced_test]
|
3649 - | async fn aws_json11_supports_na_n_float_inputs_response() {
|
3650 - | let output = crate::output::SimpleScalarPropertiesOutput {
|
3651 - | float_value: ::std::option::Option::Some(
|
3652 - | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN")
|
3653 - | .expect("invalid string for number"),
|
3654 - | ),
|
3655 - | double_value: ::std::option::Option::Some(
|
3656 - | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN")
|
3657 - | .expect("invalid string for number"),
|
3658 - | ),
|
3659 - | };
|
3660 - | use ::aws_smithy_http_server::response::IntoResponse;
|
3661 - | let http_response = output.into_response();
|
3662 - | ::pretty_assertions::assert_eq!(
|
3663 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3664 - | http_response.status()
|
3665 - | );
|
3666 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
3667 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3668 - | http_response.headers(),
|
3669 - | expected_headers,
|
3670 - | ));
|
3671 - | use ::http_body_util::BodyExt;
|
3672 - | let body = http_response
|
3673 - | .into_body()
|
3674 - | .collect()
|
3675 - | .await
|
3676 - | .expect("unable to collect body")
|
3677 - | .to_bytes();
|
3678 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
3679 - | &body,
|
3680 - | "{\n \"floatValue\": \"NaN\",\n \"doubleValue\": \"NaN\"\n}",
|
3681 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3682 - | ));
|
3683 - | }
|
3684 - |
|
3685 - | /// Supports handling Infinity float values.
|
3686 - | /// Test ID: AwsJson11SupportsInfinityFloatInputs
|
4504 + | /// Serializes list of recursive structure shapes
|
4505 + | /// Test ID: serializes_list_of_recursive_structure_shapes
|
3687 4506 | #[::tokio::test]
|
3688 4507 | #[::tracing_test::traced_test]
|
3689 - | async fn aws_json11_supports_infinity_float_inputs_response() {
|
3690 - | let output = crate::output::SimpleScalarPropertiesOutput {
|
3691 - | float_value: ::std::option::Option::Some(
|
3692 - | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity")
|
3693 - | .expect("invalid string for number"),
|
3694 - | ),
|
3695 - | double_value: ::std::option::Option::Some(
|
3696 - | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity")
|
3697 - | .expect("invalid string for number"),
|
3698 - | ),
|
3699 - | };
|
3700 - | use ::aws_smithy_http_server::response::IntoResponse;
|
3701 - | let http_response = output.into_response();
|
3702 - | ::pretty_assertions::assert_eq!(
|
3703 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3704 - | http_response.status()
|
3705 - | );
|
3706 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
3707 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3708 - | http_response.headers(),
|
3709 - | expected_headers,
|
3710 - | ));
|
3711 - | use ::http_body_util::BodyExt;
|
3712 - | let body = http_response
|
3713 - | .into_body()
|
3714 - | .collect()
|
3715 - | .await
|
3716 - | .expect("unable to collect body")
|
3717 - | .to_bytes();
|
3718 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
3719 - | &body,
|
3720 - | "{\n \"floatValue\": \"Infinity\",\n \"doubleValue\": \"Infinity\"\n}",
|
3721 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3722 - | ));
|
3723 - | }
|
3724 - |
|
3725 - | /// Supports handling -Infinity float values.
|
3726 - | /// Test ID: AwsJson11SupportsNegativeInfinityFloatInputs
|
3727 - | #[::tokio::test]
|
3728 - | #[::tracing_test::traced_test]
|
3729 - | async fn aws_json11_supports_negative_infinity_float_inputs_response() {
|
3730 - | let output = crate::output::SimpleScalarPropertiesOutput {
|
3731 - | float_value: ::std::option::Option::Some(
|
3732 - | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity")
|
3733 - | .expect("invalid string for number"),
|
3734 - | ),
|
3735 - | double_value: ::std::option::Option::Some(
|
3736 - | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity")
|
3737 - | .expect("invalid string for number"),
|
3738 - | ),
|
3739 - | };
|
3740 - | use ::aws_smithy_http_server::response::IntoResponse;
|
3741 - | let http_response = output.into_response();
|
3742 - | ::pretty_assertions::assert_eq!(
|
3743 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3744 - | http_response.status()
|
3745 - | );
|
3746 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
3747 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3748 - | http_response.headers(),
|
3749 - | expected_headers,
|
3750 - | ));
|
3751 - | use ::http_body_util::BodyExt;
|
3752 - | let body = http_response
|
3753 - | .into_body()
|
3754 - | .collect()
|
3755 - | .await
|
3756 - | .expect("unable to collect body")
|
3757 - | .to_bytes();
|
3758 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
3759 - | &body,
|
3760 - | "{\n \"floatValue\": \"-Infinity\",\n \"doubleValue\": \"-Infinity\"\n}",
|
3761 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3762 - | ));
|
3763 - | }
|
3764 - | }
|
3765 - |
|
3766 - | ::pin_project_lite::pin_project! {
|
3767 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
3768 - | /// [`KitchenSinkOperationInput`](crate::input::KitchenSinkOperationInput) using modelled bindings.
|
3769 - | pub struct KitchenSinkOperationInputFuture {
|
3770 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::KitchenSinkOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
3771 - | }
|
3772 - | }
|
3773 - |
|
3774 - | impl std::future::Future for KitchenSinkOperationInputFuture {
|
3775 - | type Output = Result<
|
3776 - | crate::input::KitchenSinkOperationInput,
|
3777 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
3778 - | >;
|
3779 - |
|
3780 - | fn poll(
|
3781 - | self: std::pin::Pin<&mut Self>,
|
3782 - | cx: &mut std::task::Context<'_>,
|
3783 - | ) -> std::task::Poll<Self::Output> {
|
3784 - | let this = self.project();
|
3785 - | this.inner.as_mut().poll(cx)
|
3786 - | }
|
3787 - | }
|
3788 - |
|
3789 - | impl<B>
|
3790 - | ::aws_smithy_http_server::request::FromRequest<
|
3791 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
3792 - | B,
|
3793 - | > for crate::input::KitchenSinkOperationInput
|
3794 - | where
|
3795 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
3796 - | B: 'static,
|
3797 - |
|
3798 - | B::Data: Send,
|
3799 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
3800 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
3801 - | {
|
3802 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
3803 - | type Future = KitchenSinkOperationInputFuture;
|
3804 - |
|
3805 - | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
3806 - | let fut = async move {
|
3807 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
3808 - | request.headers(),
|
3809 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
3810 - | ) {
|
3811 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
3812 - | }
|
3813 - | crate::protocol_serde::shape_kitchen_sink_operation::de_kitchen_sink_operation_http_request(request)
|
3814 - | .await
|
3815 - | };
|
3816 - | use ::futures_util::future::TryFutureExt;
|
3817 - | let fut = fut.map_err(
|
3818 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
3819 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
3820 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
3821 - | },
|
3822 - | );
|
3823 - | KitchenSinkOperationInputFuture {
|
3824 - | inner: Box::pin(fut),
|
3825 - | }
|
3826 - | }
|
3827 - | }
|
3828 - | impl
|
3829 - | ::aws_smithy_http_server::response::IntoResponse<
|
3830 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
3831 - | > for crate::output::KitchenSinkOperationOutput
|
3832 - | {
|
3833 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
3834 - | match crate::protocol_serde::shape_kitchen_sink_operation::ser_kitchen_sink_operation_http_response(self) {
|
3835 - | Ok(response) => response,
|
3836 - | Err(e) => {
|
3837 - | ::tracing::error!(error = %e, "failed to serialize response");
|
3838 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
3839 - | }
|
3840 - | }
|
3841 - | }
|
3842 - | }
|
3843 - | impl
|
3844 - | ::aws_smithy_http_server::response::IntoResponse<
|
3845 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
3846 - | > for crate::error::KitchenSinkOperationError
|
3847 - | {
|
3848 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
3849 - | match crate::protocol_serde::shape_kitchen_sink_operation::ser_kitchen_sink_operation_http_error(&self) {
|
3850 - | Ok(mut response) => {
|
3851 - | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
3852 - | response
|
3853 - | },
|
3854 - | Err(e) => {
|
3855 - | ::tracing::error!(error = %e, "failed to serialize response");
|
3856 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
3857 - | }
|
3858 - | }
|
3859 - | }
|
3860 - | }
|
3861 - |
|
3862 - | #[allow(unreachable_code, unused_variables)]
|
3863 - | #[cfg(test)]
|
3864 - | mod kitchen_sink_operation_test {
|
3865 - |
|
3866 - | /// Serializes string shapes
|
3867 - | /// Test ID: serializes_string_shapes
|
3868 - | #[::tokio::test]
|
3869 - | #[::tracing_test::traced_test]
|
3870 - | async fn serializes_string_shapes_request() {
|
4508 + | async fn serializes_list_of_recursive_structure_shapes_request() {
|
3871 4509 | #[allow(unused_mut)]
|
3872 - | let mut http_request = ::http_1x::Request::builder()
|
3873 - | .uri("/")
|
3874 - | .method("POST")
|
3875 - | .header("Content-Type", "application/x-amz-json-1.1")
|
3876 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
3877 - | .body(::aws_smithy_http_server::body::boxed(
|
3878 - | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3879 - | &::aws_smithy_protocol_test::decode_body_data(
|
3880 - | "{\"String\":\"abc xyz\"}".as_bytes(),
|
3881 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3882 - | ),
|
3883 - | )),
|
3884 - | ))
|
3885 - | .unwrap();
|
4510 + | let mut http_request = ::http_1x::Request::builder()
|
4511 + | .uri("/")
|
4512 + | .method("POST")
|
4513 + | .header("Content-Type", "application/x-amz-json-1.1")
|
4514 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
4515 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
4516 + | ::bytes::Bytes::copy_from_slice(
|
4517 + | &::aws_smithy_protocol_test::decode_body_data("{\"RecursiveList\":[{\"RecursiveList\":[{\"RecursiveList\":[{\"Integer\":123}]}]}]}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4518 + | )
|
4519 + | ))).unwrap();
|
3886 4520 | #[allow(unused_mut)]
|
3887 4521 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3888 4522 | let config = crate::service::JsonProtocolConfig::builder().build();
|
3889 4523 | let service = crate::service::JsonProtocol::builder::<
|
3890 4524 | ::aws_smithy_http_server::body::BoxBody,
|
3891 4525 | _,
|
3892 4526 | _,
|
3893 4527 | _,
|
3894 4528 | >(config)
|
3895 4529 | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
3896 4530 | let sender = sender.clone();
|
3897 4531 | async move {
|
3898 4532 | let result = {
|
3899 4533 | use ::aws_smithy_protocol_test::FloatEquals;
|
3900 4534 | let expected = crate::input::KitchenSinkOperationInput {
|
3901 - | string: ::std::option::Option::Some("abc xyz".to_owned()),
|
3902 - | blob: ::std::option::Option::None,
|
3903 - | boolean: ::std::option::Option::None,
|
3904 - | double: ::std::option::Option::None,
|
3905 - | empty_struct: ::std::option::Option::None,
|
3906 - | float: ::std::option::Option::None,
|
3907 - | httpdate_timestamp: ::std::option::Option::None,
|
3908 - | integer: ::std::option::Option::None,
|
3909 - | iso8601_timestamp: ::std::option::Option::None,
|
3910 - | json_value: ::std::option::Option::None,
|
3911 - | list_of_lists: ::std::option::Option::None,
|
3912 - | list_of_maps_of_strings: ::std::option::Option::None,
|
3913 - | list_of_strings: ::std::option::Option::None,
|
3914 - | list_of_structs: ::std::option::Option::None,
|
3915 - | long: ::std::option::Option::None,
|
3916 - | map_of_lists_of_strings: ::std::option::Option::None,
|
3917 - | map_of_maps: ::std::option::Option::None,
|
3918 - | map_of_strings: ::std::option::Option::None,
|
3919 - | map_of_structs: ::std::option::Option::None,
|
3920 - | recursive_list: ::std::option::Option::None,
|
3921 - | recursive_map: ::std::option::Option::None,
|
3922 - | recursive_struct: ::std::option::Option::None,
|
3923 - | simple_struct: ::std::option::Option::None,
|
3924 - | struct_with_json_name: ::std::option::Option::None,
|
3925 - | timestamp: ::std::option::Option::None,
|
3926 - | unix_timestamp: ::std::option::Option::None,
|
3927 - | };
|
3928 - | ::pretty_assertions::assert_eq!(
|
3929 - | input.blob,
|
3930 - | expected.blob,
|
3931 - | "Unexpected value for `blob`"
|
3932 - | );
|
3933 - | ::pretty_assertions::assert_eq!(
|
3934 - | input.boolean,
|
3935 - | expected.boolean,
|
3936 - | "Unexpected value for `boolean`"
|
3937 - | );
|
3938 - | assert!(
|
3939 - | input.double.float_equals(&expected.double),
|
3940 - | "Unexpected value for `double` {:?} vs. {:?}",
|
3941 - | expected.double,
|
3942 - | input.double
|
3943 - | );
|
3944 - | ::pretty_assertions::assert_eq!(
|
3945 - | input.empty_struct,
|
3946 - | expected.empty_struct,
|
3947 - | "Unexpected value for `empty_struct`"
|
3948 - | );
|
3949 - | assert!(
|
3950 - | input.float.float_equals(&expected.float),
|
3951 - | "Unexpected value for `float` {:?} vs. {:?}",
|
3952 - | expected.float,
|
3953 - | input.float
|
3954 - | );
|
3955 - | ::pretty_assertions::assert_eq!(
|
3956 - | input.httpdate_timestamp,
|
3957 - | expected.httpdate_timestamp,
|
3958 - | "Unexpected value for `httpdate_timestamp`"
|
3959 - | );
|
3960 - | ::pretty_assertions::assert_eq!(
|
4535 + | recursive_list: ::std::option::Option::Some(vec![
|
4536 + | crate::model::KitchenSink {
|
4537 + | recursive_list: ::std::option::Option::Some(vec![
|
4538 + | crate::model::KitchenSink {
|
4539 + | recursive_list: ::std::option::Option::Some(vec![
|
4540 + | crate::model::KitchenSink {
|
4541 + | integer: ::std::option::Option::Some(123),
|
4542 + | blob: ::std::option::Option::None,
|
4543 + | boolean: ::std::option::Option::None,
|
4544 + | double: ::std::option::Option::None,
|
4545 + | empty_struct: ::std::option::Option::None,
|
4546 + | float: ::std::option::Option::None,
|
4547 + | httpdate_timestamp: ::std::option::Option::None,
|
4548 + | iso8601_timestamp: ::std::option::Option::None,
|
4549 + | json_value: ::std::option::Option::None,
|
4550 + | list_of_lists: ::std::option::Option::None,
|
4551 + | list_of_maps_of_strings:
|
4552 + | ::std::option::Option::None,
|
4553 + | list_of_strings: ::std::option::Option::None,
|
4554 + | list_of_structs: ::std::option::Option::None,
|
4555 + | long: ::std::option::Option::None,
|
4556 + | map_of_lists_of_strings:
|
4557 + | ::std::option::Option::None,
|
4558 + | map_of_maps: ::std::option::Option::None,
|
4559 + | map_of_strings: ::std::option::Option::None,
|
4560 + | map_of_structs: ::std::option::Option::None,
|
4561 + | recursive_list: ::std::option::Option::None,
|
4562 + | recursive_map: ::std::option::Option::None,
|
4563 + | recursive_struct: ::std::option::Option::None,
|
4564 + | simple_struct: ::std::option::Option::None,
|
4565 + | string: ::std::option::Option::None,
|
4566 + | struct_with_json_name: ::std::option::Option::None,
|
4567 + | timestamp: ::std::option::Option::None,
|
4568 + | unix_timestamp: ::std::option::Option::None,
|
4569 + | },
|
4570 + | ]),
|
4571 + | blob: ::std::option::Option::None,
|
4572 + | boolean: ::std::option::Option::None,
|
4573 + | double: ::std::option::Option::None,
|
4574 + | empty_struct: ::std::option::Option::None,
|
4575 + | float: ::std::option::Option::None,
|
4576 + | httpdate_timestamp: ::std::option::Option::None,
|
4577 + | integer: ::std::option::Option::None,
|
4578 + | iso8601_timestamp: ::std::option::Option::None,
|
4579 + | json_value: ::std::option::Option::None,
|
4580 + | list_of_lists: ::std::option::Option::None,
|
4581 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4582 + | list_of_strings: ::std::option::Option::None,
|
4583 + | list_of_structs: ::std::option::Option::None,
|
4584 + | long: ::std::option::Option::None,
|
4585 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4586 + | map_of_maps: ::std::option::Option::None,
|
4587 + | map_of_strings: ::std::option::Option::None,
|
4588 + | map_of_structs: ::std::option::Option::None,
|
4589 + | recursive_map: ::std::option::Option::None,
|
4590 + | recursive_struct: ::std::option::Option::None,
|
4591 + | simple_struct: ::std::option::Option::None,
|
4592 + | string: ::std::option::Option::None,
|
4593 + | struct_with_json_name: ::std::option::Option::None,
|
4594 + | timestamp: ::std::option::Option::None,
|
4595 + | unix_timestamp: ::std::option::Option::None,
|
4596 + | },
|
4597 + | ]),
|
4598 + | blob: ::std::option::Option::None,
|
4599 + | boolean: ::std::option::Option::None,
|
4600 + | double: ::std::option::Option::None,
|
4601 + | empty_struct: ::std::option::Option::None,
|
4602 + | float: ::std::option::Option::None,
|
4603 + | httpdate_timestamp: ::std::option::Option::None,
|
4604 + | integer: ::std::option::Option::None,
|
4605 + | iso8601_timestamp: ::std::option::Option::None,
|
4606 + | json_value: ::std::option::Option::None,
|
4607 + | list_of_lists: ::std::option::Option::None,
|
4608 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4609 + | list_of_strings: ::std::option::Option::None,
|
4610 + | list_of_structs: ::std::option::Option::None,
|
4611 + | long: ::std::option::Option::None,
|
4612 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4613 + | map_of_maps: ::std::option::Option::None,
|
4614 + | map_of_strings: ::std::option::Option::None,
|
4615 + | map_of_structs: ::std::option::Option::None,
|
4616 + | recursive_map: ::std::option::Option::None,
|
4617 + | recursive_struct: ::std::option::Option::None,
|
4618 + | simple_struct: ::std::option::Option::None,
|
4619 + | string: ::std::option::Option::None,
|
4620 + | struct_with_json_name: ::std::option::Option::None,
|
4621 + | timestamp: ::std::option::Option::None,
|
4622 + | unix_timestamp: ::std::option::Option::None,
|
4623 + | },
|
4624 + | ]),
|
4625 + | blob: ::std::option::Option::None,
|
4626 + | boolean: ::std::option::Option::None,
|
4627 + | double: ::std::option::Option::None,
|
4628 + | empty_struct: ::std::option::Option::None,
|
4629 + | float: ::std::option::Option::None,
|
4630 + | httpdate_timestamp: ::std::option::Option::None,
|
4631 + | integer: ::std::option::Option::None,
|
4632 + | iso8601_timestamp: ::std::option::Option::None,
|
4633 + | json_value: ::std::option::Option::None,
|
4634 + | list_of_lists: ::std::option::Option::None,
|
4635 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4636 + | list_of_strings: ::std::option::Option::None,
|
4637 + | list_of_structs: ::std::option::Option::None,
|
4638 + | long: ::std::option::Option::None,
|
4639 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4640 + | map_of_maps: ::std::option::Option::None,
|
4641 + | map_of_strings: ::std::option::Option::None,
|
4642 + | map_of_structs: ::std::option::Option::None,
|
4643 + | recursive_map: ::std::option::Option::None,
|
4644 + | recursive_struct: ::std::option::Option::None,
|
4645 + | simple_struct: ::std::option::Option::None,
|
4646 + | string: ::std::option::Option::None,
|
4647 + | struct_with_json_name: ::std::option::Option::None,
|
4648 + | timestamp: ::std::option::Option::None,
|
4649 + | unix_timestamp: ::std::option::Option::None,
|
4650 + | };
|
4651 + | ::pretty_assertions::assert_eq!(
|
4652 + | input.blob,
|
4653 + | expected.blob,
|
4654 + | "Unexpected value for `blob`"
|
4655 + | );
|
4656 + | ::pretty_assertions::assert_eq!(
|
4657 + | input.boolean,
|
4658 + | expected.boolean,
|
4659 + | "Unexpected value for `boolean`"
|
4660 + | );
|
4661 + | assert!(
|
4662 + | input.double.float_equals(&expected.double),
|
4663 + | "Unexpected value for `double` {:?} vs. {:?}",
|
4664 + | expected.double,
|
4665 + | input.double
|
4666 + | );
|
4667 + | ::pretty_assertions::assert_eq!(
|
4668 + | input.empty_struct,
|
4669 + | expected.empty_struct,
|
4670 + | "Unexpected value for `empty_struct`"
|
4671 + | );
|
4672 + | assert!(
|
4673 + | input.float.float_equals(&expected.float),
|
4674 + | "Unexpected value for `float` {:?} vs. {:?}",
|
4675 + | expected.float,
|
4676 + | input.float
|
4677 + | );
|
4678 + | ::pretty_assertions::assert_eq!(
|
4679 + | input.httpdate_timestamp,
|
4680 + | expected.httpdate_timestamp,
|
4681 + | "Unexpected value for `httpdate_timestamp`"
|
4682 + | );
|
4683 + | ::pretty_assertions::assert_eq!(
|
3961 4684 | input.integer,
|
3962 4685 | expected.integer,
|
3963 4686 | "Unexpected value for `integer`"
|
3964 4687 | );
|
3965 4688 | ::pretty_assertions::assert_eq!(
|
3966 4689 | input.iso8601_timestamp,
|
3967 4690 | expected.iso8601_timestamp,
|
3968 4691 | "Unexpected value for `iso8601_timestamp`"
|
3969 4692 | );
|
3970 4693 | ::pretty_assertions::assert_eq!(
|
6715 7471 | .build_unchecked();
|
6716 7472 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6717 7473 | .await
|
6718 7474 | .expect("unable to make an HTTP request");
|
6719 7475 | assert!(
|
6720 7476 | receiver.recv().await.is_some(),
|
6721 7477 | "we expected operation handler to be invoked but it was not entered"
|
6722 7478 | );
|
6723 7479 | }
|
6724 7480 |
|
6725 - | /// Serializes timestamp shapes with unixTimestamp timestampFormat
|
6726 - | /// Test ID: serializes_timestamp_shapes_with_unixtimestamp_timestampformat
|
7481 + | /// Parses operations with empty JSON bodies
|
7482 + | /// Test ID: parses_operations_with_empty_json_bodies
|
6727 7483 | #[::tokio::test]
|
6728 7484 | #[::tracing_test::traced_test]
|
6729 - | async fn serializes_timestamp_shapes_with_unixtimestamp_timestampformat_request() {
|
6730 - | #[allow(unused_mut)]
|
6731 - | let mut http_request = ::http_1x::Request::builder()
|
6732 - | .uri("/")
|
6733 - | .method("POST")
|
6734 - | .header("Content-Type", "application/x-amz-json-1.1")
|
6735 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
6736 - | .body(::aws_smithy_http_server::body::boxed(
|
6737 - | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
6738 - | &::aws_smithy_protocol_test::decode_body_data(
|
6739 - | "{\"UnixTimestamp\":946845296}".as_bytes(),
|
6740 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
6741 - | ),
|
6742 - | )),
|
6743 - | ))
|
6744 - | .unwrap();
|
6745 - | #[allow(unused_mut)]
|
6746 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6747 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
6748 - | let service = crate::service::JsonProtocol::builder::<
|
6749 - | ::aws_smithy_http_server::body::BoxBody,
|
6750 - | _,
|
6751 - | _,
|
6752 - | _,
|
6753 - | >(config)
|
6754 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
6755 - | let sender = sender.clone();
|
6756 - | async move {
|
6757 - | let result = {
|
6758 - | use ::aws_smithy_protocol_test::FloatEquals;
|
6759 - | let expected = crate::input::KitchenSinkOperationInput {
|
6760 - | unix_timestamp: ::std::option::Option::Some(
|
6761 - | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
6762 - | ),
|
6763 - | blob: ::std::option::Option::None,
|
6764 - | boolean: ::std::option::Option::None,
|
6765 - | double: ::std::option::Option::None,
|
6766 - | empty_struct: ::std::option::Option::None,
|
6767 - | float: ::std::option::Option::None,
|
6768 - | httpdate_timestamp: ::std::option::Option::None,
|
6769 - | integer: ::std::option::Option::None,
|
6770 - | iso8601_timestamp: ::std::option::Option::None,
|
6771 - | json_value: ::std::option::Option::None,
|
6772 - | list_of_lists: ::std::option::Option::None,
|
6773 - | list_of_maps_of_strings: ::std::option::Option::None,
|
6774 - | list_of_strings: ::std::option::Option::None,
|
6775 - | list_of_structs: ::std::option::Option::None,
|
6776 - | long: ::std::option::Option::None,
|
6777 - | map_of_lists_of_strings: ::std::option::Option::None,
|
6778 - | map_of_maps: ::std::option::Option::None,
|
6779 - | map_of_strings: ::std::option::Option::None,
|
6780 - | map_of_structs: ::std::option::Option::None,
|
6781 - | recursive_list: ::std::option::Option::None,
|
6782 - | recursive_map: ::std::option::Option::None,
|
6783 - | recursive_struct: ::std::option::Option::None,
|
6784 - | simple_struct: ::std::option::Option::None,
|
6785 - | string: ::std::option::Option::None,
|
6786 - | struct_with_json_name: ::std::option::Option::None,
|
6787 - | timestamp: ::std::option::Option::None,
|
6788 - | };
|
6789 - | ::pretty_assertions::assert_eq!(
|
6790 - | input.blob,
|
6791 - | expected.blob,
|
6792 - | "Unexpected value for `blob`"
|
6793 - | );
|
6794 - | ::pretty_assertions::assert_eq!(
|
6795 - | input.boolean,
|
6796 - | expected.boolean,
|
6797 - | "Unexpected value for `boolean`"
|
6798 - | );
|
6799 - | assert!(
|
6800 - | input.double.float_equals(&expected.double),
|
6801 - | "Unexpected value for `double` {:?} vs. {:?}",
|
6802 - | expected.double,
|
6803 - | input.double
|
6804 - | );
|
6805 - | ::pretty_assertions::assert_eq!(
|
6806 - | input.empty_struct,
|
6807 - | expected.empty_struct,
|
6808 - | "Unexpected value for `empty_struct`"
|
6809 - | );
|
6810 - | assert!(
|
6811 - | input.float.float_equals(&expected.float),
|
6812 - | "Unexpected value for `float` {:?} vs. {:?}",
|
6813 - | expected.float,
|
6814 - | input.float
|
6815 - | );
|
6816 - | ::pretty_assertions::assert_eq!(
|
6817 - | input.httpdate_timestamp,
|
6818 - | expected.httpdate_timestamp,
|
6819 - | "Unexpected value for `httpdate_timestamp`"
|
6820 - | );
|
6821 - | ::pretty_assertions::assert_eq!(
|
6822 - | input.integer,
|
6823 - | expected.integer,
|
6824 - | "Unexpected value for `integer`"
|
6825 - | );
|
6826 - | ::pretty_assertions::assert_eq!(
|
6827 - | input.iso8601_timestamp,
|
6828 - | expected.iso8601_timestamp,
|
6829 - | "Unexpected value for `iso8601_timestamp`"
|
6830 - | );
|
6831 - | ::pretty_assertions::assert_eq!(
|
6832 - | input.json_value,
|
6833 - | expected.json_value,
|
6834 - | "Unexpected value for `json_value`"
|
6835 - | );
|
6836 - | ::pretty_assertions::assert_eq!(
|
6837 - | input.list_of_lists,
|
6838 - | expected.list_of_lists,
|
6839 - | "Unexpected value for `list_of_lists`"
|
6840 - | );
|
6841 - | ::pretty_assertions::assert_eq!(
|
6842 - | input.list_of_maps_of_strings,
|
6843 - | expected.list_of_maps_of_strings,
|
6844 - | "Unexpected value for `list_of_maps_of_strings`"
|
6845 - | );
|
6846 - | ::pretty_assertions::assert_eq!(
|
6847 - | input.list_of_strings,
|
6848 - | expected.list_of_strings,
|
6849 - | "Unexpected value for `list_of_strings`"
|
6850 - | );
|
6851 - | ::pretty_assertions::assert_eq!(
|
6852 - | input.list_of_structs,
|
6853 - | expected.list_of_structs,
|
6854 - | "Unexpected value for `list_of_structs`"
|
6855 - | );
|
6856 - | ::pretty_assertions::assert_eq!(
|
6857 - | input.long,
|
6858 - | expected.long,
|
6859 - | "Unexpected value for `long`"
|
6860 - | );
|
6861 - | ::pretty_assertions::assert_eq!(
|
6862 - | input.map_of_lists_of_strings,
|
6863 - | expected.map_of_lists_of_strings,
|
6864 - | "Unexpected value for `map_of_lists_of_strings`"
|
6865 - | );
|
6866 - | ::pretty_assertions::assert_eq!(
|
6867 - | input.map_of_maps,
|
6868 - | expected.map_of_maps,
|
6869 - | "Unexpected value for `map_of_maps`"
|
6870 - | );
|
6871 - | ::pretty_assertions::assert_eq!(
|
6872 - | input.map_of_strings,
|
6873 - | expected.map_of_strings,
|
6874 - | "Unexpected value for `map_of_strings`"
|
6875 - | );
|
6876 - | ::pretty_assertions::assert_eq!(
|
6877 - | input.map_of_structs,
|
6878 - | expected.map_of_structs,
|
6879 - | "Unexpected value for `map_of_structs`"
|
6880 - | );
|
6881 - | ::pretty_assertions::assert_eq!(
|
6882 - | input.recursive_list,
|
6883 - | expected.recursive_list,
|
6884 - | "Unexpected value for `recursive_list`"
|
6885 - | );
|
6886 - | ::pretty_assertions::assert_eq!(
|
6887 - | input.recursive_map,
|
6888 - | expected.recursive_map,
|
6889 - | "Unexpected value for `recursive_map`"
|
6890 - | );
|
6891 - | ::pretty_assertions::assert_eq!(
|
6892 - | input.recursive_struct,
|
6893 - | expected.recursive_struct,
|
6894 - | "Unexpected value for `recursive_struct`"
|
6895 - | );
|
6896 - | ::pretty_assertions::assert_eq!(
|
6897 - | input.simple_struct,
|
6898 - | expected.simple_struct,
|
6899 - | "Unexpected value for `simple_struct`"
|
6900 - | );
|
6901 - | ::pretty_assertions::assert_eq!(
|
6902 - | input.string,
|
6903 - | expected.string,
|
6904 - | "Unexpected value for `string`"
|
6905 - | );
|
6906 - | ::pretty_assertions::assert_eq!(
|
6907 - | input.struct_with_json_name,
|
6908 - | expected.struct_with_json_name,
|
6909 - | "Unexpected value for `struct_with_json_name`"
|
6910 - | );
|
6911 - | ::pretty_assertions::assert_eq!(
|
6912 - | input.timestamp,
|
6913 - | expected.timestamp,
|
6914 - | "Unexpected value for `timestamp`"
|
6915 - | );
|
6916 - | ::pretty_assertions::assert_eq!(
|
6917 - | input.unix_timestamp,
|
6918 - | expected.unix_timestamp,
|
6919 - | "Unexpected value for `unix_timestamp`"
|
6920 - | );
|
6921 - | let output = crate::output::KitchenSinkOperationOutput {
|
6922 - | blob: ::std::option::Option::None,
|
6923 - | boolean: ::std::option::Option::None,
|
6924 - | double: ::std::option::Option::None,
|
6925 - | empty_struct: ::std::option::Option::None,
|
6926 - | float: ::std::option::Option::None,
|
6927 - | httpdate_timestamp: ::std::option::Option::None,
|
6928 - | integer: ::std::option::Option::None,
|
6929 - | iso8601_timestamp: ::std::option::Option::None,
|
6930 - | json_value: ::std::option::Option::None,
|
6931 - | list_of_lists: ::std::option::Option::None,
|
6932 - | list_of_maps_of_strings: ::std::option::Option::None,
|
6933 - | list_of_strings: ::std::option::Option::None,
|
6934 - | list_of_structs: ::std::option::Option::None,
|
6935 - | long: ::std::option::Option::None,
|
6936 - | map_of_lists_of_strings: ::std::option::Option::None,
|
6937 - | map_of_maps: ::std::option::Option::None,
|
6938 - | map_of_strings: ::std::option::Option::None,
|
6939 - | map_of_structs: ::std::option::Option::None,
|
6940 - | recursive_list: ::std::option::Option::None,
|
6941 - | recursive_map: ::std::option::Option::None,
|
6942 - | recursive_struct: ::std::option::Option::None,
|
6943 - | simple_struct: ::std::option::Option::None,
|
6944 - | string: ::std::option::Option::None,
|
6945 - | struct_with_json_name: ::std::option::Option::None,
|
6946 - | timestamp: ::std::option::Option::None,
|
6947 - | unix_timestamp: ::std::option::Option::None,
|
6948 - | };
|
6949 - | Ok(output)
|
6950 - | };
|
6951 - | sender.send(()).await.expect("receiver dropped early");
|
6952 - | result
|
6953 - | }
|
6954 - | })
|
6955 - | .build_unchecked();
|
6956 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7485 + | async fn parses_operations_with_empty_json_bodies_response() {
|
7486 + | let output = crate::output::KitchenSinkOperationOutput {
|
7487 + | blob: ::std::option::Option::None,
|
7488 + | boolean: ::std::option::Option::None,
|
7489 + | double: ::std::option::Option::None,
|
7490 + | empty_struct: ::std::option::Option::None,
|
7491 + | float: ::std::option::Option::None,
|
7492 + | httpdate_timestamp: ::std::option::Option::None,
|
7493 + | integer: ::std::option::Option::None,
|
7494 + | iso8601_timestamp: ::std::option::Option::None,
|
7495 + | json_value: ::std::option::Option::None,
|
7496 + | list_of_lists: ::std::option::Option::None,
|
7497 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7498 + | list_of_strings: ::std::option::Option::None,
|
7499 + | list_of_structs: ::std::option::Option::None,
|
7500 + | long: ::std::option::Option::None,
|
7501 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7502 + | map_of_maps: ::std::option::Option::None,
|
7503 + | map_of_strings: ::std::option::Option::None,
|
7504 + | map_of_structs: ::std::option::Option::None,
|
7505 + | recursive_list: ::std::option::Option::None,
|
7506 + | recursive_map: ::std::option::Option::None,
|
7507 + | recursive_struct: ::std::option::Option::None,
|
7508 + | simple_struct: ::std::option::Option::None,
|
7509 + | string: ::std::option::Option::None,
|
7510 + | struct_with_json_name: ::std::option::Option::None,
|
7511 + | timestamp: ::std::option::Option::None,
|
7512 + | unix_timestamp: ::std::option::Option::None,
|
7513 + | };
|
7514 + | use ::aws_smithy_http_server::response::IntoResponse;
|
7515 + | let http_response = output.into_response();
|
7516 + | ::pretty_assertions::assert_eq!(
|
7517 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
7518 + | http_response.status()
|
7519 + | );
|
7520 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
7521 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7522 + | http_response.headers(),
|
7523 + | expected_headers,
|
7524 + | ));
|
7525 + | use ::http_body_util::BodyExt;
|
7526 + | let body = http_response
|
7527 + | .into_body()
|
7528 + | .collect()
|
6957 7529 | .await
|
6958 - | .expect("unable to make an HTTP request");
|
6959 - | assert!(
|
6960 - | receiver.recv().await.is_some(),
|
6961 - | "we expected operation handler to be invoked but it was not entered"
|
7530 + | .expect("unable to collect body")
|
7531 + | .to_bytes();
|
7532 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
7533 + | &body,
|
7534 + | "{}",
|
7535 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
7536 + | ));
|
7537 + | }
|
7538 + |
|
7539 + | /// Parses string shapes
|
7540 + | /// Test ID: parses_string_shapes
|
7541 + | #[::tokio::test]
|
7542 + | #[::tracing_test::traced_test]
|
7543 + | async fn parses_string_shapes_response() {
|
7544 + | let output = crate::output::KitchenSinkOperationOutput {
|
7545 + | string: ::std::option::Option::Some("string-value".to_owned()),
|
7546 + | blob: ::std::option::Option::None,
|
7547 + | boolean: ::std::option::Option::None,
|
7548 + | double: ::std::option::Option::None,
|
7549 + | empty_struct: ::std::option::Option::None,
|
7550 + | float: ::std::option::Option::None,
|
7551 + | httpdate_timestamp: ::std::option::Option::None,
|
7552 + | integer: ::std::option::Option::None,
|
7553 + | iso8601_timestamp: ::std::option::Option::None,
|
7554 + | json_value: ::std::option::Option::None,
|
7555 + | list_of_lists: ::std::option::Option::None,
|
7556 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7557 + | list_of_strings: ::std::option::Option::None,
|
7558 + | list_of_structs: ::std::option::Option::None,
|
7559 + | long: ::std::option::Option::None,
|
7560 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7561 + | map_of_maps: ::std::option::Option::None,
|
7562 + | map_of_strings: ::std::option::Option::None,
|
7563 + | map_of_structs: ::std::option::Option::None,
|
7564 + | recursive_list: ::std::option::Option::None,
|
7565 + | recursive_map: ::std::option::Option::None,
|
7566 + | recursive_struct: ::std::option::Option::None,
|
7567 + | simple_struct: ::std::option::Option::None,
|
7568 + | struct_with_json_name: ::std::option::Option::None,
|
7569 + | timestamp: ::std::option::Option::None,
|
7570 + | unix_timestamp: ::std::option::Option::None,
|
7571 + | };
|
7572 + | use ::aws_smithy_http_server::response::IntoResponse;
|
7573 + | let http_response = output.into_response();
|
7574 + | ::pretty_assertions::assert_eq!(
|
7575 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
7576 + | http_response.status()
|
6962 7577 | );
|
7578 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
7579 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7580 + | http_response.headers(),
|
7581 + | expected_headers,
|
7582 + | ));
|
7583 + | use ::http_body_util::BodyExt;
|
7584 + | let body = http_response
|
7585 + | .into_body()
|
7586 + | .collect()
|
7587 + | .await
|
7588 + | .expect("unable to collect body")
|
7589 + | .to_bytes();
|
7590 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
7591 + | &body,
|
7592 + | "{\"String\":\"string-value\"}",
|
7593 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
7594 + | ));
|
6963 7595 | }
|
6964 7596 |
|
6965 - | /// Serializes list shapes
|
6966 - | /// Test ID: serializes_list_shapes
|
7597 + | /// Parses integer shapes
|
7598 + | /// Test ID: parses_integer_shapes
|
6967 7599 | #[::tokio::test]
|
6968 7600 | #[::tracing_test::traced_test]
|
6969 - | async fn serializes_list_shapes_request() {
|
6970 - | #[allow(unused_mut)]
|
6971 - | let mut http_request = ::http_1x::Request::builder()
|
6972 - | .uri("/")
|
6973 - | .method("POST")
|
6974 - | .header("Content-Type", "application/x-amz-json-1.1")
|
6975 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
6976 - | .body(::aws_smithy_http_server::body::boxed(
|
6977 - | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
6978 - | &::aws_smithy_protocol_test::decode_body_data(
|
6979 - | "{\"ListOfStrings\":[\"abc\",\"mno\",\"xyz\"]}".as_bytes(),
|
6980 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
6981 - | ),
|
6982 - | )),
|
6983 - | ))
|
6984 - | .unwrap();
|
6985 - | #[allow(unused_mut)]
|
6986 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6987 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
6988 - | let service = crate::service::JsonProtocol::builder::<
|
6989 - | ::aws_smithy_http_server::body::BoxBody,
|
6990 - | _,
|
6991 - | _,
|
6992 - | _,
|
6993 - | >(config)
|
6994 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
6995 - | let sender = sender.clone();
|
6996 - | async move {
|
6997 - | let result = {
|
6998 - | use ::aws_smithy_protocol_test::FloatEquals;
|
6999 - | let expected = crate::input::KitchenSinkOperationInput {
|
7000 - | list_of_strings: ::std::option::Option::Some(vec![
|
7001 - | "abc".to_owned(),
|
7002 - | "mno".to_owned(),
|
7003 - | "xyz".to_owned(),
|
7004 - | ]),
|
7005 - | blob: ::std::option::Option::None,
|
7006 - | boolean: ::std::option::Option::None,
|
7007 - | double: ::std::option::Option::None,
|
7008 - | empty_struct: ::std::option::Option::None,
|
7009 - | float: ::std::option::Option::None,
|
7010 - | httpdate_timestamp: ::std::option::Option::None,
|
7011 - | integer: ::std::option::Option::None,
|
7012 - | iso8601_timestamp: ::std::option::Option::None,
|
7013 - | json_value: ::std::option::Option::None,
|
7014 - | list_of_lists: ::std::option::Option::None,
|
7015 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7016 - | list_of_structs: ::std::option::Option::None,
|
7017 - | long: ::std::option::Option::None,
|
7018 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7019 - | map_of_maps: ::std::option::Option::None,
|
7020 - | map_of_strings: ::std::option::Option::None,
|
7021 - | map_of_structs: ::std::option::Option::None,
|
7022 - | recursive_list: ::std::option::Option::None,
|
7023 - | recursive_map: ::std::option::Option::None,
|
7024 - | recursive_struct: ::std::option::Option::None,
|
7025 - | simple_struct: ::std::option::Option::None,
|
7026 - | string: ::std::option::Option::None,
|
7027 - | struct_with_json_name: ::std::option::Option::None,
|
7028 - | timestamp: ::std::option::Option::None,
|
7029 - | unix_timestamp: ::std::option::Option::None,
|
7030 - | };
|
7031 - | ::pretty_assertions::assert_eq!(
|
7032 - | input.blob,
|
7033 - | expected.blob,
|
7034 - | "Unexpected value for `blob`"
|
7035 - | );
|
7036 - | ::pretty_assertions::assert_eq!(
|
7037 - | input.boolean,
|
7038 - | expected.boolean,
|
7039 - | "Unexpected value for `boolean`"
|
7040 - | );
|
7041 - | assert!(
|
7042 - | input.double.float_equals(&expected.double),
|
7043 - | "Unexpected value for `double` {:?} vs. {:?}",
|
7044 - | expected.double,
|
7045 - | input.double
|
7046 - | );
|
7047 - | ::pretty_assertions::assert_eq!(
|
7048 - | input.empty_struct,
|
7049 - | expected.empty_struct,
|
7050 - | "Unexpected value for `empty_struct`"
|
7051 - | );
|
7052 - | assert!(
|
7053 - | input.float.float_equals(&expected.float),
|
7054 - | "Unexpected value for `float` {:?} vs. {:?}",
|
7055 - | expected.float,
|
7056 - | input.float
|
7057 - | );
|
7058 - | ::pretty_assertions::assert_eq!(
|
7059 - | input.httpdate_timestamp,
|
7060 - | expected.httpdate_timestamp,
|
7061 - | "Unexpected value for `httpdate_timestamp`"
|
7062 - | );
|
7063 - | ::pretty_assertions::assert_eq!(
|
7064 - | input.integer,
|
7065 - | expected.integer,
|
7066 - | "Unexpected value for `integer`"
|
7067 - | );
|
7068 - | ::pretty_assertions::assert_eq!(
|
7069 - | input.iso8601_timestamp,
|
7070 - | expected.iso8601_timestamp,
|
7071 - | "Unexpected value for `iso8601_timestamp`"
|
7072 - | );
|
7073 - | ::pretty_assertions::assert_eq!(
|
7074 - | input.json_value,
|
7075 - | expected.json_value,
|
7076 - | "Unexpected value for `json_value`"
|
7077 - | );
|
7078 - | ::pretty_assertions::assert_eq!(
|
7079 - | input.list_of_lists,
|
7080 - | expected.list_of_lists,
|
7081 - | "Unexpected value for `list_of_lists`"
|
7082 - | );
|
7083 - | ::pretty_assertions::assert_eq!(
|
7084 - | input.list_of_maps_of_strings,
|
7085 - | expected.list_of_maps_of_strings,
|
7086 - | "Unexpected value for `list_of_maps_of_strings`"
|
7087 - | );
|
7088 - | ::pretty_assertions::assert_eq!(
|
7089 - | input.list_of_strings,
|
7090 - | expected.list_of_strings,
|
7091 - | "Unexpected value for `list_of_strings`"
|
7092 - | );
|
7093 - | ::pretty_assertions::assert_eq!(
|
7094 - | input.list_of_structs,
|
7095 - | expected.list_of_structs,
|
7096 - | "Unexpected value for `list_of_structs`"
|
7097 - | );
|
7098 - | ::pretty_assertions::assert_eq!(
|
7099 - | input.long,
|
7100 - | expected.long,
|
7101 - | "Unexpected value for `long`"
|
7102 - | );
|
7103 - | ::pretty_assertions::assert_eq!(
|
7104 - | input.map_of_lists_of_strings,
|
7105 - | expected.map_of_lists_of_strings,
|
7106 - | "Unexpected value for `map_of_lists_of_strings`"
|
7107 - | );
|
7108 - | ::pretty_assertions::assert_eq!(
|
7109 - | input.map_of_maps,
|
7110 - | expected.map_of_maps,
|
7111 - | "Unexpected value for `map_of_maps`"
|
7112 - | );
|
7113 - | ::pretty_assertions::assert_eq!(
|
7114 - | input.map_of_strings,
|
7115 - | expected.map_of_strings,
|
7116 - | "Unexpected value for `map_of_strings`"
|
7117 - | );
|
7118 - | ::pretty_assertions::assert_eq!(
|
7119 - | input.map_of_structs,
|
7120 - | expected.map_of_structs,
|
7121 - | "Unexpected value for `map_of_structs`"
|
7122 - | );
|
7123 - | ::pretty_assertions::assert_eq!(
|
7124 - | input.recursive_list,
|
7125 - | expected.recursive_list,
|
7126 - | "Unexpected value for `recursive_list`"
|
7127 - | );
|
7128 - | ::pretty_assertions::assert_eq!(
|
7129 - | input.recursive_map,
|
7130 - | expected.recursive_map,
|
7131 - | "Unexpected value for `recursive_map`"
|
7132 - | );
|
7133 - | ::pretty_assertions::assert_eq!(
|
7134 - | input.recursive_struct,
|
7135 - | expected.recursive_struct,
|
7136 - | "Unexpected value for `recursive_struct`"
|
7137 - | );
|
7138 - | ::pretty_assertions::assert_eq!(
|
7139 - | input.simple_struct,
|
7140 - | expected.simple_struct,
|
7141 - | "Unexpected value for `simple_struct`"
|
7142 - | );
|
7143 - | ::pretty_assertions::assert_eq!(
|
7144 - | input.string,
|
7145 - | expected.string,
|
7146 - | "Unexpected value for `string`"
|
7147 - | );
|
7148 - | ::pretty_assertions::assert_eq!(
|
7149 - | input.struct_with_json_name,
|
7150 - | expected.struct_with_json_name,
|
7151 - | "Unexpected value for `struct_with_json_name`"
|
7152 - | );
|
7153 - | ::pretty_assertions::assert_eq!(
|
7154 - | input.timestamp,
|
7155 - | expected.timestamp,
|
7156 - | "Unexpected value for `timestamp`"
|
7157 - | );
|
7158 - | ::pretty_assertions::assert_eq!(
|
7159 - | input.unix_timestamp,
|
7160 - | expected.unix_timestamp,
|
7161 - | "Unexpected value for `unix_timestamp`"
|
7162 - | );
|
7163 - | let output = crate::output::KitchenSinkOperationOutput {
|
7164 - | blob: ::std::option::Option::None,
|
7165 - | boolean: ::std::option::Option::None,
|
7166 - | double: ::std::option::Option::None,
|
7167 - | empty_struct: ::std::option::Option::None,
|
7168 - | float: ::std::option::Option::None,
|
7169 - | httpdate_timestamp: ::std::option::Option::None,
|
7170 - | integer: ::std::option::Option::None,
|
7171 - | iso8601_timestamp: ::std::option::Option::None,
|
7172 - | json_value: ::std::option::Option::None,
|
7173 - | list_of_lists: ::std::option::Option::None,
|
7174 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7175 - | list_of_strings: ::std::option::Option::None,
|
7176 - | list_of_structs: ::std::option::Option::None,
|
7177 - | long: ::std::option::Option::None,
|
7178 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7179 - | map_of_maps: ::std::option::Option::None,
|
7180 - | map_of_strings: ::std::option::Option::None,
|
7181 - | map_of_structs: ::std::option::Option::None,
|
7182 - | recursive_list: ::std::option::Option::None,
|
7183 - | recursive_map: ::std::option::Option::None,
|
7184 - | recursive_struct: ::std::option::Option::None,
|
7185 - | simple_struct: ::std::option::Option::None,
|
7186 - | string: ::std::option::Option::None,
|
7187 - | struct_with_json_name: ::std::option::Option::None,
|
7188 - | timestamp: ::std::option::Option::None,
|
7189 - | unix_timestamp: ::std::option::Option::None,
|
7190 - | };
|
7191 - | Ok(output)
|
7192 - | };
|
7193 - | sender.send(()).await.expect("receiver dropped early");
|
7194 - | result
|
7195 - | }
|
7196 - | })
|
7197 - | .build_unchecked();
|
7198 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7199 - | .await
|
7200 - | .expect("unable to make an HTTP request");
|
7201 - | assert!(
|
7202 - | receiver.recv().await.is_some(),
|
7203 - | "we expected operation handler to be invoked but it was not entered"
|
7204 - | );
|
7205 - | }
|
7206 - |
|
7207 - | /// Serializes empty list shapes
|
7208 - | /// Test ID: serializes_empty_list_shapes
|
7209 - | #[::tokio::test]
|
7210 - | #[::tracing_test::traced_test]
|
7211 - | async fn serializes_empty_list_shapes_request() {
|
7212 - | #[allow(unused_mut)]
|
7213 - | let mut http_request = ::http_1x::Request::builder()
|
7214 - | .uri("/")
|
7215 - | .method("POST")
|
7216 - | .header("Content-Type", "application/x-amz-json-1.1")
|
7217 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
7218 - | .body(::aws_smithy_http_server::body::boxed(
|
7219 - | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
7220 - | &::aws_smithy_protocol_test::decode_body_data(
|
7221 - | "{\"ListOfStrings\":[]}".as_bytes(),
|
7222 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
7223 - | ),
|
7224 - | )),
|
7225 - | ))
|
7226 - | .unwrap();
|
7227 - | #[allow(unused_mut)]
|
7228 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7229 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
7230 - | let service = crate::service::JsonProtocol::builder::<
|
7231 - | ::aws_smithy_http_server::body::BoxBody,
|
7232 - | _,
|
7233 - | _,
|
7234 - | _,
|
7235 - | >(config)
|
7236 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
7237 - | let sender = sender.clone();
|
7238 - | async move {
|
7239 - | let result = {
|
7240 - | use ::aws_smithy_protocol_test::FloatEquals;
|
7241 - | let expected = crate::input::KitchenSinkOperationInput {
|
7242 - | list_of_strings: ::std::option::Option::Some(vec![]),
|
7243 - | blob: ::std::option::Option::None,
|
7244 - | boolean: ::std::option::Option::None,
|
7245 - | double: ::std::option::Option::None,
|
7246 - | empty_struct: ::std::option::Option::None,
|
7247 - | float: ::std::option::Option::None,
|
7248 - | httpdate_timestamp: ::std::option::Option::None,
|
7249 - | integer: ::std::option::Option::None,
|
7250 - | iso8601_timestamp: ::std::option::Option::None,
|
7251 - | json_value: ::std::option::Option::None,
|
7252 - | list_of_lists: ::std::option::Option::None,
|
7253 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7254 - | list_of_structs: ::std::option::Option::None,
|
7255 - | long: ::std::option::Option::None,
|
7256 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7257 - | map_of_maps: ::std::option::Option::None,
|
7258 - | map_of_strings: ::std::option::Option::None,
|
7259 - | map_of_structs: ::std::option::Option::None,
|
7260 - | recursive_list: ::std::option::Option::None,
|
7261 - | recursive_map: ::std::option::Option::None,
|
7262 - | recursive_struct: ::std::option::Option::None,
|
7263 - | simple_struct: ::std::option::Option::None,
|
7264 - | string: ::std::option::Option::None,
|
7265 - | struct_with_json_name: ::std::option::Option::None,
|
7266 - | timestamp: ::std::option::Option::None,
|
7267 - | unix_timestamp: ::std::option::Option::None,
|
7268 - | };
|
7269 - | ::pretty_assertions::assert_eq!(
|
7270 - | input.blob,
|
7271 - | expected.blob,
|
7272 - | "Unexpected value for `blob`"
|
7273 - | );
|
7274 - | ::pretty_assertions::assert_eq!(
|
7275 - | input.boolean,
|
7276 - | expected.boolean,
|
7277 - | "Unexpected value for `boolean`"
|
7278 - | );
|
7279 - | assert!(
|
7280 - | input.double.float_equals(&expected.double),
|
7281 - | "Unexpected value for `double` {:?} vs. {:?}",
|
7282 - | expected.double,
|
7283 - | input.double
|
7284 - | );
|
7285 - | ::pretty_assertions::assert_eq!(
|
7286 - | input.empty_struct,
|
7287 - | expected.empty_struct,
|
7288 - | "Unexpected value for `empty_struct`"
|
7289 - | );
|
7290 - | assert!(
|
7291 - | input.float.float_equals(&expected.float),
|
7292 - | "Unexpected value for `float` {:?} vs. {:?}",
|
7293 - | expected.float,
|
7294 - | input.float
|
7295 - | );
|
7296 - | ::pretty_assertions::assert_eq!(
|
7297 - | input.httpdate_timestamp,
|
7298 - | expected.httpdate_timestamp,
|
7299 - | "Unexpected value for `httpdate_timestamp`"
|
7300 - | );
|
7301 - | ::pretty_assertions::assert_eq!(
|
7302 - | input.integer,
|
7303 - | expected.integer,
|
7304 - | "Unexpected value for `integer`"
|
7305 - | );
|
7306 - | ::pretty_assertions::assert_eq!(
|
7307 - | input.iso8601_timestamp,
|
7308 - | expected.iso8601_timestamp,
|
7309 - | "Unexpected value for `iso8601_timestamp`"
|
7310 - | );
|
7311 - | ::pretty_assertions::assert_eq!(
|
7312 - | input.json_value,
|
7313 - | expected.json_value,
|
7314 - | "Unexpected value for `json_value`"
|
7315 - | );
|
7316 - | ::pretty_assertions::assert_eq!(
|
7317 - | input.list_of_lists,
|
7318 - | expected.list_of_lists,
|
7319 - | "Unexpected value for `list_of_lists`"
|
7320 - | );
|
7321 - | ::pretty_assertions::assert_eq!(
|
7322 - | input.list_of_maps_of_strings,
|
7323 - | expected.list_of_maps_of_strings,
|
7324 - | "Unexpected value for `list_of_maps_of_strings`"
|
7325 - | );
|
7326 - | ::pretty_assertions::assert_eq!(
|
7327 - | input.list_of_strings,
|
7328 - | expected.list_of_strings,
|
7329 - | "Unexpected value for `list_of_strings`"
|
7330 - | );
|
7331 - | ::pretty_assertions::assert_eq!(
|
7332 - | input.list_of_structs,
|
7333 - | expected.list_of_structs,
|
7334 - | "Unexpected value for `list_of_structs`"
|
7335 - | );
|
7336 - | ::pretty_assertions::assert_eq!(
|
7337 - | input.long,
|
7338 - | expected.long,
|
7339 - | "Unexpected value for `long`"
|
7340 - | );
|
7341 - | ::pretty_assertions::assert_eq!(
|
7342 - | input.map_of_lists_of_strings,
|
7343 - | expected.map_of_lists_of_strings,
|
7344 - | "Unexpected value for `map_of_lists_of_strings`"
|
7345 - | );
|
7346 - | ::pretty_assertions::assert_eq!(
|
7347 - | input.map_of_maps,
|
7348 - | expected.map_of_maps,
|
7349 - | "Unexpected value for `map_of_maps`"
|
7350 - | );
|
7351 - | ::pretty_assertions::assert_eq!(
|
7352 - | input.map_of_strings,
|
7353 - | expected.map_of_strings,
|
7354 - | "Unexpected value for `map_of_strings`"
|
7355 - | );
|
7356 - | ::pretty_assertions::assert_eq!(
|
7357 - | input.map_of_structs,
|
7358 - | expected.map_of_structs,
|
7359 - | "Unexpected value for `map_of_structs`"
|
7360 - | );
|
7361 - | ::pretty_assertions::assert_eq!(
|
7362 - | input.recursive_list,
|
7363 - | expected.recursive_list,
|
7364 - | "Unexpected value for `recursive_list`"
|
7365 - | );
|
7366 - | ::pretty_assertions::assert_eq!(
|
7367 - | input.recursive_map,
|
7368 - | expected.recursive_map,
|
7369 - | "Unexpected value for `recursive_map`"
|
7370 - | );
|
7371 - | ::pretty_assertions::assert_eq!(
|
7372 - | input.recursive_struct,
|
7373 - | expected.recursive_struct,
|
7374 - | "Unexpected value for `recursive_struct`"
|
7375 - | );
|
7376 - | ::pretty_assertions::assert_eq!(
|
7377 - | input.simple_struct,
|
7378 - | expected.simple_struct,
|
7379 - | "Unexpected value for `simple_struct`"
|
7380 - | );
|
7381 - | ::pretty_assertions::assert_eq!(
|
7382 - | input.string,
|
7383 - | expected.string,
|
7384 - | "Unexpected value for `string`"
|
7385 - | );
|
7386 - | ::pretty_assertions::assert_eq!(
|
7387 - | input.struct_with_json_name,
|
7388 - | expected.struct_with_json_name,
|
7389 - | "Unexpected value for `struct_with_json_name`"
|
7390 - | );
|
7391 - | ::pretty_assertions::assert_eq!(
|
7392 - | input.timestamp,
|
7393 - | expected.timestamp,
|
7394 - | "Unexpected value for `timestamp`"
|
7395 - | );
|
7396 - | ::pretty_assertions::assert_eq!(
|
7397 - | input.unix_timestamp,
|
7398 - | expected.unix_timestamp,
|
7399 - | "Unexpected value for `unix_timestamp`"
|
7400 - | );
|
7401 - | let output = crate::output::KitchenSinkOperationOutput {
|
7402 - | blob: ::std::option::Option::None,
|
7403 - | boolean: ::std::option::Option::None,
|
7404 - | double: ::std::option::Option::None,
|
7405 - | empty_struct: ::std::option::Option::None,
|
7406 - | float: ::std::option::Option::None,
|
7407 - | httpdate_timestamp: ::std::option::Option::None,
|
7408 - | integer: ::std::option::Option::None,
|
7409 - | iso8601_timestamp: ::std::option::Option::None,
|
7410 - | json_value: ::std::option::Option::None,
|
7411 - | list_of_lists: ::std::option::Option::None,
|
7412 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7413 - | list_of_strings: ::std::option::Option::None,
|
7414 - | list_of_structs: ::std::option::Option::None,
|
7415 - | long: ::std::option::Option::None,
|
7416 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7417 - | map_of_maps: ::std::option::Option::None,
|
7418 - | map_of_strings: ::std::option::Option::None,
|
7419 - | map_of_structs: ::std::option::Option::None,
|
7420 - | recursive_list: ::std::option::Option::None,
|
7421 - | recursive_map: ::std::option::Option::None,
|
7422 - | recursive_struct: ::std::option::Option::None,
|
7423 - | simple_struct: ::std::option::Option::None,
|
7424 - | string: ::std::option::Option::None,
|
7425 - | struct_with_json_name: ::std::option::Option::None,
|
7426 - | timestamp: ::std::option::Option::None,
|
7427 - | unix_timestamp: ::std::option::Option::None,
|
7428 - | };
|
7429 - | Ok(output)
|
7430 - | };
|
7431 - | sender.send(()).await.expect("receiver dropped early");
|
7432 - | result
|
7433 - | }
|
7434 - | })
|
7435 - | .build_unchecked();
|
7436 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7437 - | .await
|
7438 - | .expect("unable to make an HTTP request");
|
7439 - | assert!(
|
7440 - | receiver.recv().await.is_some(),
|
7441 - | "we expected operation handler to be invoked but it was not entered"
|
7442 - | );
|
7443 - | }
|
7444 - |
|
7445 - | /// Serializes list of map shapes
|
7446 - | /// Test ID: serializes_list_of_map_shapes
|
7447 - | #[::tokio::test]
|
7448 - | #[::tracing_test::traced_test]
|
7449 - | async fn serializes_list_of_map_shapes_request() {
|
7450 - | #[allow(unused_mut)]
|
7451 - | let mut http_request = ::http_1x::Request::builder()
|
7452 - | .uri("/")
|
7453 - | .method("POST")
|
7454 - | .header("Content-Type", "application/x-amz-json-1.1")
|
7455 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
7456 - | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
7457 - | ::bytes::Bytes::copy_from_slice(
|
7458 - | &::aws_smithy_protocol_test::decode_body_data("{\"ListOfMapsOfStrings\":[{\"foo\":\"bar\"},{\"abc\":\"xyz\"},{\"red\":\"blue\"}]}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7459 - | )
|
7460 - | ))).unwrap();
|
7461 - | #[allow(unused_mut)]
|
7462 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7463 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
7464 - | let service = crate::service::JsonProtocol::builder::<
|
7465 - | ::aws_smithy_http_server::body::BoxBody,
|
7466 - | _,
|
7467 - | _,
|
7468 - | _,
|
7469 - | >(config)
|
7470 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
7471 - | let sender = sender.clone();
|
7472 - | async move {
|
7473 - | let result = {
|
7474 - | use ::aws_smithy_protocol_test::FloatEquals;
|
7475 - | let expected = crate::input::KitchenSinkOperationInput {
|
7476 - | list_of_maps_of_strings: ::std::option::Option::Some(vec![
|
7477 - | {
|
7478 - | let mut ret = ::std::collections::HashMap::new();
|
7479 - | ret.insert("foo".to_owned(), "bar".to_owned());
|
7480 - | ret
|
7481 - | },
|
7482 - | {
|
7483 - | let mut ret = ::std::collections::HashMap::new();
|
7484 - | ret.insert("abc".to_owned(), "xyz".to_owned());
|
7485 - | ret
|
7486 - | },
|
7487 - | {
|
7488 - | let mut ret = ::std::collections::HashMap::new();
|
7489 - | ret.insert("red".to_owned(), "blue".to_owned());
|
7490 - | ret
|
7491 - | },
|
7492 - | ]),
|
7493 - | blob: ::std::option::Option::None,
|
7494 - | boolean: ::std::option::Option::None,
|
7495 - | double: ::std::option::Option::None,
|
7496 - | empty_struct: ::std::option::Option::None,
|
7497 - | float: ::std::option::Option::None,
|
7498 - | httpdate_timestamp: ::std::option::Option::None,
|
7499 - | integer: ::std::option::Option::None,
|
7500 - | iso8601_timestamp: ::std::option::Option::None,
|
7501 - | json_value: ::std::option::Option::None,
|
7502 - | list_of_lists: ::std::option::Option::None,
|
7503 - | list_of_strings: ::std::option::Option::None,
|
7504 - | list_of_structs: ::std::option::Option::None,
|
7505 - | long: ::std::option::Option::None,
|
7506 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7507 - | map_of_maps: ::std::option::Option::None,
|
7508 - | map_of_strings: ::std::option::Option::None,
|
7509 - | map_of_structs: ::std::option::Option::None,
|
7510 - | recursive_list: ::std::option::Option::None,
|
7511 - | recursive_map: ::std::option::Option::None,
|
7512 - | recursive_struct: ::std::option::Option::None,
|
7513 - | simple_struct: ::std::option::Option::None,
|
7514 - | string: ::std::option::Option::None,
|
7515 - | struct_with_json_name: ::std::option::Option::None,
|
7516 - | timestamp: ::std::option::Option::None,
|
7517 - | unix_timestamp: ::std::option::Option::None,
|
7518 - | };
|
7519 - | ::pretty_assertions::assert_eq!(
|
7520 - | input.blob,
|
7521 - | expected.blob,
|
7522 - | "Unexpected value for `blob`"
|
7523 - | );
|
7524 - | ::pretty_assertions::assert_eq!(
|
7525 - | input.boolean,
|
7526 - | expected.boolean,
|
7527 - | "Unexpected value for `boolean`"
|
7528 - | );
|
7529 - | assert!(
|
7530 - | input.double.float_equals(&expected.double),
|
7531 - | "Unexpected value for `double` {:?} vs. {:?}",
|
7532 - | expected.double,
|
7533 - | input.double
|
7534 - | );
|
7535 - | ::pretty_assertions::assert_eq!(
|
7536 - | input.empty_struct,
|
7537 - | expected.empty_struct,
|
7538 - | "Unexpected value for `empty_struct`"
|
7539 - | );
|
7540 - | assert!(
|
7541 - | input.float.float_equals(&expected.float),
|
7542 - | "Unexpected value for `float` {:?} vs. {:?}",
|
7543 - | expected.float,
|
7544 - | input.float
|
7545 - | );
|
7546 - | ::pretty_assertions::assert_eq!(
|
7547 - | input.httpdate_timestamp,
|
7548 - | expected.httpdate_timestamp,
|
7549 - | "Unexpected value for `httpdate_timestamp`"
|
7550 - | );
|
7551 - | ::pretty_assertions::assert_eq!(
|
7552 - | input.integer,
|
7553 - | expected.integer,
|
7554 - | "Unexpected value for `integer`"
|
7555 - | );
|
7556 - | ::pretty_assertions::assert_eq!(
|
7557 - | input.iso8601_timestamp,
|
7558 - | expected.iso8601_timestamp,
|
7559 - | "Unexpected value for `iso8601_timestamp`"
|
7560 - | );
|
7561 - | ::pretty_assertions::assert_eq!(
|
7562 - | input.json_value,
|
7563 - | expected.json_value,
|
7564 - | "Unexpected value for `json_value`"
|
7565 - | );
|
7566 - | ::pretty_assertions::assert_eq!(
|
7567 - | input.list_of_lists,
|
7568 - | expected.list_of_lists,
|
7569 - | "Unexpected value for `list_of_lists`"
|
7570 - | );
|
7571 - | ::pretty_assertions::assert_eq!(
|
7572 - | input.list_of_maps_of_strings,
|
7573 - | expected.list_of_maps_of_strings,
|
7574 - | "Unexpected value for `list_of_maps_of_strings`"
|
7575 - | );
|
7576 - | ::pretty_assertions::assert_eq!(
|
7577 - | input.list_of_strings,
|
7578 - | expected.list_of_strings,
|
7579 - | "Unexpected value for `list_of_strings`"
|
7580 - | );
|
7581 - | ::pretty_assertions::assert_eq!(
|
7582 - | input.list_of_structs,
|
7583 - | expected.list_of_structs,
|
7584 - | "Unexpected value for `list_of_structs`"
|
7585 - | );
|
7586 - | ::pretty_assertions::assert_eq!(
|
7587 - | input.long,
|
7588 - | expected.long,
|
7589 - | "Unexpected value for `long`"
|
7590 - | );
|
7591 - | ::pretty_assertions::assert_eq!(
|
7592 - | input.map_of_lists_of_strings,
|
7593 - | expected.map_of_lists_of_strings,
|
7594 - | "Unexpected value for `map_of_lists_of_strings`"
|
7595 - | );
|
7596 - | ::pretty_assertions::assert_eq!(
|
7597 - | input.map_of_maps,
|
7598 - | expected.map_of_maps,
|
7599 - | "Unexpected value for `map_of_maps`"
|
7600 - | );
|
7601 - | ::pretty_assertions::assert_eq!(
|
7602 - | input.map_of_strings,
|
7603 - | expected.map_of_strings,
|
7604 - | "Unexpected value for `map_of_strings`"
|
7605 - | );
|
7606 - | ::pretty_assertions::assert_eq!(
|
7607 - | input.map_of_structs,
|
7608 - | expected.map_of_structs,
|
7609 - | "Unexpected value for `map_of_structs`"
|
7610 - | );
|
7611 - | ::pretty_assertions::assert_eq!(
|
7612 - | input.recursive_list,
|
7613 - | expected.recursive_list,
|
7614 - | "Unexpected value for `recursive_list`"
|
7615 - | );
|
7616 - | ::pretty_assertions::assert_eq!(
|
7617 - | input.recursive_map,
|
7618 - | expected.recursive_map,
|
7619 - | "Unexpected value for `recursive_map`"
|
7620 - | );
|
7621 - | ::pretty_assertions::assert_eq!(
|
7622 - | input.recursive_struct,
|
7623 - | expected.recursive_struct,
|
7624 - | "Unexpected value for `recursive_struct`"
|
7625 - | );
|
7626 - | ::pretty_assertions::assert_eq!(
|
7627 - | input.simple_struct,
|
7628 - | expected.simple_struct,
|
7629 - | "Unexpected value for `simple_struct`"
|
7630 - | );
|
7631 - | ::pretty_assertions::assert_eq!(
|
7632 - | input.string,
|
7633 - | expected.string,
|
7634 - | "Unexpected value for `string`"
|
7635 - | );
|
7636 - | ::pretty_assertions::assert_eq!(
|
7637 - | input.struct_with_json_name,
|
7638 - | expected.struct_with_json_name,
|
7639 - | "Unexpected value for `struct_with_json_name`"
|
7640 - | );
|
7641 - | ::pretty_assertions::assert_eq!(
|
7642 - | input.timestamp,
|
7643 - | expected.timestamp,
|
7644 - | "Unexpected value for `timestamp`"
|
7645 - | );
|
7646 - | ::pretty_assertions::assert_eq!(
|
7647 - | input.unix_timestamp,
|
7648 - | expected.unix_timestamp,
|
7649 - | "Unexpected value for `unix_timestamp`"
|
7650 - | );
|
7651 - | let output = crate::output::KitchenSinkOperationOutput {
|
7652 - | blob: ::std::option::Option::None,
|
7653 - | boolean: ::std::option::Option::None,
|
7654 - | double: ::std::option::Option::None,
|
7655 - | empty_struct: ::std::option::Option::None,
|
7656 - | float: ::std::option::Option::None,
|
7657 - | httpdate_timestamp: ::std::option::Option::None,
|
7658 - | integer: ::std::option::Option::None,
|
7659 - | iso8601_timestamp: ::std::option::Option::None,
|
7660 - | json_value: ::std::option::Option::None,
|
7661 - | list_of_lists: ::std::option::Option::None,
|
7662 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7663 - | list_of_strings: ::std::option::Option::None,
|
7664 - | list_of_structs: ::std::option::Option::None,
|
7665 - | long: ::std::option::Option::None,
|
7666 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7667 - | map_of_maps: ::std::option::Option::None,
|
7668 - | map_of_strings: ::std::option::Option::None,
|
7669 - | map_of_structs: ::std::option::Option::None,
|
7670 - | recursive_list: ::std::option::Option::None,
|
7671 - | recursive_map: ::std::option::Option::None,
|
7672 - | recursive_struct: ::std::option::Option::None,
|
7673 - | simple_struct: ::std::option::Option::None,
|
7674 - | string: ::std::option::Option::None,
|
7675 - | struct_with_json_name: ::std::option::Option::None,
|
7676 - | timestamp: ::std::option::Option::None,
|
7677 - | unix_timestamp: ::std::option::Option::None,
|
7678 - | };
|
7679 - | Ok(output)
|
7680 - | };
|
7681 - | sender.send(()).await.expect("receiver dropped early");
|
7682 - | result
|
7683 - | }
|
7684 - | })
|
7685 - | .build_unchecked();
|
7686 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7687 - | .await
|
7688 - | .expect("unable to make an HTTP request");
|
7689 - | assert!(
|
7690 - | receiver.recv().await.is_some(),
|
7691 - | "we expected operation handler to be invoked but it was not entered"
|
7692 - | );
|
7693 - | }
|
7694 - |
|
7695 - | /// Serializes list of structure shapes
|
7696 - | /// Test ID: serializes_list_of_structure_shapes
|
7697 - | #[::tokio::test]
|
7698 - | #[::tracing_test::traced_test]
|
7699 - | async fn serializes_list_of_structure_shapes_request() {
|
7700 - | #[allow(unused_mut)]
|
7701 - | let mut http_request = ::http_1x::Request::builder()
|
7702 - | .uri("/")
|
7703 - | .method("POST")
|
7704 - | .header("Content-Type", "application/x-amz-json-1.1")
|
7705 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
7706 - | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
7707 - | ::bytes::Bytes::copy_from_slice(
|
7708 - | &::aws_smithy_protocol_test::decode_body_data("{\"ListOfStructs\":[{\"Value\":\"abc\"},{\"Value\":\"mno\"},{\"Value\":\"xyz\"}]}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7709 - | )
|
7710 - | ))).unwrap();
|
7711 - | #[allow(unused_mut)]
|
7712 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7713 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
7714 - | let service = crate::service::JsonProtocol::builder::<
|
7715 - | ::aws_smithy_http_server::body::BoxBody,
|
7716 - | _,
|
7717 - | _,
|
7718 - | _,
|
7719 - | >(config)
|
7720 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
7721 - | let sender = sender.clone();
|
7722 - | async move {
|
7723 - | let result = {
|
7724 - | use ::aws_smithy_protocol_test::FloatEquals;
|
7725 - | let expected = crate::input::KitchenSinkOperationInput {
|
7726 - | list_of_structs: ::std::option::Option::Some(vec![
|
7727 - | crate::model::SimpleStruct {
|
7728 - | value: ::std::option::Option::Some("abc".to_owned()),
|
7729 - | },
|
7730 - | crate::model::SimpleStruct {
|
7731 - | value: ::std::option::Option::Some("mno".to_owned()),
|
7732 - | },
|
7733 - | crate::model::SimpleStruct {
|
7734 - | value: ::std::option::Option::Some("xyz".to_owned()),
|
7735 - | },
|
7736 - | ]),
|
7737 - | blob: ::std::option::Option::None,
|
7738 - | boolean: ::std::option::Option::None,
|
7739 - | double: ::std::option::Option::None,
|
7740 - | empty_struct: ::std::option::Option::None,
|
7741 - | float: ::std::option::Option::None,
|
7742 - | httpdate_timestamp: ::std::option::Option::None,
|
7743 - | integer: ::std::option::Option::None,
|
7744 - | iso8601_timestamp: ::std::option::Option::None,
|
7745 - | json_value: ::std::option::Option::None,
|
7746 - | list_of_lists: ::std::option::Option::None,
|
7747 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7748 - | list_of_strings: ::std::option::Option::None,
|
7749 - | long: ::std::option::Option::None,
|
7750 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7751 - | map_of_maps: ::std::option::Option::None,
|
7752 - | map_of_strings: ::std::option::Option::None,
|
7753 - | map_of_structs: ::std::option::Option::None,
|
7754 - | recursive_list: ::std::option::Option::None,
|
7755 - | recursive_map: ::std::option::Option::None,
|
7756 - | recursive_struct: ::std::option::Option::None,
|
7757 - | simple_struct: ::std::option::Option::None,
|
7758 - | string: ::std::option::Option::None,
|
7759 - | struct_with_json_name: ::std::option::Option::None,
|
7760 - | timestamp: ::std::option::Option::None,
|
7761 - | unix_timestamp: ::std::option::Option::None,
|
7762 - | };
|
7763 - | ::pretty_assertions::assert_eq!(
|
7764 - | input.blob,
|
7765 - | expected.blob,
|
7766 - | "Unexpected value for `blob`"
|
7767 - | );
|
7768 - | ::pretty_assertions::assert_eq!(
|
7769 - | input.boolean,
|
7770 - | expected.boolean,
|
7771 - | "Unexpected value for `boolean`"
|
7772 - | );
|
7773 - | assert!(
|
7774 - | input.double.float_equals(&expected.double),
|
7775 - | "Unexpected value for `double` {:?} vs. {:?}",
|
7776 - | expected.double,
|
7777 - | input.double
|
7778 - | );
|
7779 - | ::pretty_assertions::assert_eq!(
|
7780 - | input.empty_struct,
|
7781 - | expected.empty_struct,
|
7782 - | "Unexpected value for `empty_struct`"
|
7783 - | );
|
7784 - | assert!(
|
7785 - | input.float.float_equals(&expected.float),
|
7786 - | "Unexpected value for `float` {:?} vs. {:?}",
|
7787 - | expected.float,
|
7788 - | input.float
|
7789 - | );
|
7790 - | ::pretty_assertions::assert_eq!(
|
7791 - | input.httpdate_timestamp,
|
7792 - | expected.httpdate_timestamp,
|
7793 - | "Unexpected value for `httpdate_timestamp`"
|
7794 - | );
|
7795 - | ::pretty_assertions::assert_eq!(
|
7796 - | input.integer,
|
7797 - | expected.integer,
|
7798 - | "Unexpected value for `integer`"
|
7799 - | );
|
7800 - | ::pretty_assertions::assert_eq!(
|
7801 - | input.iso8601_timestamp,
|
7802 - | expected.iso8601_timestamp,
|
7803 - | "Unexpected value for `iso8601_timestamp`"
|
7804 - | );
|
7805 - | ::pretty_assertions::assert_eq!(
|
7806 - | input.json_value,
|
7807 - | expected.json_value,
|
7808 - | "Unexpected value for `json_value`"
|
7809 - | );
|
7810 - | ::pretty_assertions::assert_eq!(
|
7811 - | input.list_of_lists,
|
7812 - | expected.list_of_lists,
|
7813 - | "Unexpected value for `list_of_lists`"
|
7814 - | );
|
7815 - | ::pretty_assertions::assert_eq!(
|
7816 - | input.list_of_maps_of_strings,
|
7817 - | expected.list_of_maps_of_strings,
|
7818 - | "Unexpected value for `list_of_maps_of_strings`"
|
7819 - | );
|
7820 - | ::pretty_assertions::assert_eq!(
|
7821 - | input.list_of_strings,
|
7822 - | expected.list_of_strings,
|
7823 - | "Unexpected value for `list_of_strings`"
|
7824 - | );
|
7825 - | ::pretty_assertions::assert_eq!(
|
7826 - | input.list_of_structs,
|
7827 - | expected.list_of_structs,
|
7828 - | "Unexpected value for `list_of_structs`"
|
7829 - | );
|
7830 - | ::pretty_assertions::assert_eq!(
|
7831 - | input.long,
|
7832 - | expected.long,
|
7833 - | "Unexpected value for `long`"
|
7834 - | );
|
7835 - | ::pretty_assertions::assert_eq!(
|
7836 - | input.map_of_lists_of_strings,
|
7837 - | expected.map_of_lists_of_strings,
|
7838 - | "Unexpected value for `map_of_lists_of_strings`"
|
7839 - | );
|
7840 - | ::pretty_assertions::assert_eq!(
|
7841 - | input.map_of_maps,
|
7842 - | expected.map_of_maps,
|
7843 - | "Unexpected value for `map_of_maps`"
|
7844 - | );
|
7845 - | ::pretty_assertions::assert_eq!(
|
7846 - | input.map_of_strings,
|
7847 - | expected.map_of_strings,
|
7848 - | "Unexpected value for `map_of_strings`"
|
7849 - | );
|
7850 - | ::pretty_assertions::assert_eq!(
|
7851 - | input.map_of_structs,
|
7852 - | expected.map_of_structs,
|
7853 - | "Unexpected value for `map_of_structs`"
|
7854 - | );
|
7855 - | ::pretty_assertions::assert_eq!(
|
7856 - | input.recursive_list,
|
7857 - | expected.recursive_list,
|
7858 - | "Unexpected value for `recursive_list`"
|
7859 - | );
|
7860 - | ::pretty_assertions::assert_eq!(
|
7861 - | input.recursive_map,
|
7862 - | expected.recursive_map,
|
7863 - | "Unexpected value for `recursive_map`"
|
7864 - | );
|
7865 - | ::pretty_assertions::assert_eq!(
|
7866 - | input.recursive_struct,
|
7867 - | expected.recursive_struct,
|
7868 - | "Unexpected value for `recursive_struct`"
|
7869 - | );
|
7870 - | ::pretty_assertions::assert_eq!(
|
7871 - | input.simple_struct,
|
7872 - | expected.simple_struct,
|
7873 - | "Unexpected value for `simple_struct`"
|
7874 - | );
|
7875 - | ::pretty_assertions::assert_eq!(
|
7876 - | input.string,
|
7877 - | expected.string,
|
7878 - | "Unexpected value for `string`"
|
7879 - | );
|
7880 - | ::pretty_assertions::assert_eq!(
|
7881 - | input.struct_with_json_name,
|
7882 - | expected.struct_with_json_name,
|
7883 - | "Unexpected value for `struct_with_json_name`"
|
7884 - | );
|
7885 - | ::pretty_assertions::assert_eq!(
|
7886 - | input.timestamp,
|
7887 - | expected.timestamp,
|
7888 - | "Unexpected value for `timestamp`"
|
7889 - | );
|
7890 - | ::pretty_assertions::assert_eq!(
|
7891 - | input.unix_timestamp,
|
7892 - | expected.unix_timestamp,
|
7893 - | "Unexpected value for `unix_timestamp`"
|
7894 - | );
|
7895 - | let output = crate::output::KitchenSinkOperationOutput {
|
7896 - | blob: ::std::option::Option::None,
|
7897 - | boolean: ::std::option::Option::None,
|
7898 - | double: ::std::option::Option::None,
|
7899 - | empty_struct: ::std::option::Option::None,
|
7900 - | float: ::std::option::Option::None,
|
7901 - | httpdate_timestamp: ::std::option::Option::None,
|
7902 - | integer: ::std::option::Option::None,
|
7903 - | iso8601_timestamp: ::std::option::Option::None,
|
7904 - | json_value: ::std::option::Option::None,
|
7905 - | list_of_lists: ::std::option::Option::None,
|
7906 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7907 - | list_of_strings: ::std::option::Option::None,
|
7908 - | list_of_structs: ::std::option::Option::None,
|
7909 - | long: ::std::option::Option::None,
|
7910 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7911 - | map_of_maps: ::std::option::Option::None,
|
7912 - | map_of_strings: ::std::option::Option::None,
|
7913 - | map_of_structs: ::std::option::Option::None,
|
7914 - | recursive_list: ::std::option::Option::None,
|
7915 - | recursive_map: ::std::option::Option::None,
|
7916 - | recursive_struct: ::std::option::Option::None,
|
7917 - | simple_struct: ::std::option::Option::None,
|
7918 - | string: ::std::option::Option::None,
|
7919 - | struct_with_json_name: ::std::option::Option::None,
|
7920 - | timestamp: ::std::option::Option::None,
|
7921 - | unix_timestamp: ::std::option::Option::None,
|
7922 - | };
|
7923 - | Ok(output)
|
7924 - | };
|
7925 - | sender.send(()).await.expect("receiver dropped early");
|
7926 - | result
|
7927 - | }
|
7928 - | })
|
7929 - | .build_unchecked();
|
7930 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7931 - | .await
|
7932 - | .expect("unable to make an HTTP request");
|
7933 - | assert!(
|
7934 - | receiver.recv().await.is_some(),
|
7935 - | "we expected operation handler to be invoked but it was not entered"
|
7936 - | );
|
7937 - | }
|
7938 - |
|
7939 - | /// Serializes list of recursive structure shapes
|
7940 - | /// Test ID: serializes_list_of_recursive_structure_shapes
|
7941 - | #[::tokio::test]
|
7942 - | #[::tracing_test::traced_test]
|
7943 - | async fn serializes_list_of_recursive_structure_shapes_request() {
|
7944 - | #[allow(unused_mut)]
|
7945 - | let mut http_request = ::http_1x::Request::builder()
|
7946 - | .uri("/")
|
7947 - | .method("POST")
|
7948 - | .header("Content-Type", "application/x-amz-json-1.1")
|
7949 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
7950 - | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
7951 - | ::bytes::Bytes::copy_from_slice(
|
7952 - | &::aws_smithy_protocol_test::decode_body_data("{\"RecursiveList\":[{\"RecursiveList\":[{\"RecursiveList\":[{\"Integer\":123}]}]}]}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7953 - | )
|
7954 - | ))).unwrap();
|
7955 - | #[allow(unused_mut)]
|
7956 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7957 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
7958 - | let service = crate::service::JsonProtocol::builder::<
|
7959 - | ::aws_smithy_http_server::body::BoxBody,
|
7960 - | _,
|
7961 - | _,
|
7962 - | _,
|
7963 - | >(config)
|
7964 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
7965 - | let sender = sender.clone();
|
7966 - | async move {
|
7967 - | let result = {
|
7968 - | use ::aws_smithy_protocol_test::FloatEquals;
|
7969 - | let expected = crate::input::KitchenSinkOperationInput {
|
7970 - | recursive_list: ::std::option::Option::Some(vec![
|
7971 - | crate::model::KitchenSink {
|
7972 - | recursive_list: ::std::option::Option::Some(vec![
|
7973 - | crate::model::KitchenSink {
|
7974 - | recursive_list: ::std::option::Option::Some(vec![
|
7975 - | crate::model::KitchenSink {
|
7976 - | integer: ::std::option::Option::Some(123),
|
7977 - | blob: ::std::option::Option::None,
|
7978 - | boolean: ::std::option::Option::None,
|
7979 - | double: ::std::option::Option::None,
|
7980 - | empty_struct: ::std::option::Option::None,
|
7981 - | float: ::std::option::Option::None,
|
7982 - | httpdate_timestamp: ::std::option::Option::None,
|
7983 - | iso8601_timestamp: ::std::option::Option::None,
|
7984 - | json_value: ::std::option::Option::None,
|
7985 - | list_of_lists: ::std::option::Option::None,
|
7986 - | list_of_maps_of_strings:
|
7987 - | ::std::option::Option::None,
|
7988 - | list_of_strings: ::std::option::Option::None,
|
7989 - | list_of_structs: ::std::option::Option::None,
|
7990 - | long: ::std::option::Option::None,
|
7991 - | map_of_lists_of_strings:
|
7992 - | ::std::option::Option::None,
|
7993 - | map_of_maps: ::std::option::Option::None,
|
7994 - | map_of_strings: ::std::option::Option::None,
|
7995 - | map_of_structs: ::std::option::Option::None,
|
7996 - | recursive_list: ::std::option::Option::None,
|
7997 - | recursive_map: ::std::option::Option::None,
|
7998 - | recursive_struct: ::std::option::Option::None,
|
7999 - | simple_struct: ::std::option::Option::None,
|
8000 - | string: ::std::option::Option::None,
|
8001 - | struct_with_json_name: ::std::option::Option::None,
|
8002 - | timestamp: ::std::option::Option::None,
|
8003 - | unix_timestamp: ::std::option::Option::None,
|
8004 - | },
|
8005 - | ]),
|
8006 - | blob: ::std::option::Option::None,
|
8007 - | boolean: ::std::option::Option::None,
|
8008 - | double: ::std::option::Option::None,
|
8009 - | empty_struct: ::std::option::Option::None,
|
8010 - | float: ::std::option::Option::None,
|
8011 - | httpdate_timestamp: ::std::option::Option::None,
|
8012 - | integer: ::std::option::Option::None,
|
8013 - | iso8601_timestamp: ::std::option::Option::None,
|
8014 - | json_value: ::std::option::Option::None,
|
8015 - | list_of_lists: ::std::option::Option::None,
|
8016 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8017 - | list_of_strings: ::std::option::Option::None,
|
8018 - | list_of_structs: ::std::option::Option::None,
|
8019 - | long: ::std::option::Option::None,
|
8020 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8021 - | map_of_maps: ::std::option::Option::None,
|
8022 - | map_of_strings: ::std::option::Option::None,
|
8023 - | map_of_structs: ::std::option::Option::None,
|
8024 - | recursive_map: ::std::option::Option::None,
|
8025 - | recursive_struct: ::std::option::Option::None,
|
8026 - | simple_struct: ::std::option::Option::None,
|
8027 - | string: ::std::option::Option::None,
|
8028 - | struct_with_json_name: ::std::option::Option::None,
|
8029 - | timestamp: ::std::option::Option::None,
|
8030 - | unix_timestamp: ::std::option::Option::None,
|
8031 - | },
|
8032 - | ]),
|
8033 - | blob: ::std::option::Option::None,
|
8034 - | boolean: ::std::option::Option::None,
|
8035 - | double: ::std::option::Option::None,
|
8036 - | empty_struct: ::std::option::Option::None,
|
8037 - | float: ::std::option::Option::None,
|
8038 - | httpdate_timestamp: ::std::option::Option::None,
|
8039 - | integer: ::std::option::Option::None,
|
8040 - | iso8601_timestamp: ::std::option::Option::None,
|
8041 - | json_value: ::std::option::Option::None,
|
8042 - | list_of_lists: ::std::option::Option::None,
|
8043 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8044 - | list_of_strings: ::std::option::Option::None,
|
8045 - | list_of_structs: ::std::option::Option::None,
|
8046 - | long: ::std::option::Option::None,
|
8047 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8048 - | map_of_maps: ::std::option::Option::None,
|
8049 - | map_of_strings: ::std::option::Option::None,
|
8050 - | map_of_structs: ::std::option::Option::None,
|
8051 - | recursive_map: ::std::option::Option::None,
|
8052 - | recursive_struct: ::std::option::Option::None,
|
8053 - | simple_struct: ::std::option::Option::None,
|
8054 - | string: ::std::option::Option::None,
|
8055 - | struct_with_json_name: ::std::option::Option::None,
|
8056 - | timestamp: ::std::option::Option::None,
|
8057 - | unix_timestamp: ::std::option::Option::None,
|
8058 - | },
|
8059 - | ]),
|
8060 - | blob: ::std::option::Option::None,
|
8061 - | boolean: ::std::option::Option::None,
|
8062 - | double: ::std::option::Option::None,
|
8063 - | empty_struct: ::std::option::Option::None,
|
8064 - | float: ::std::option::Option::None,
|
8065 - | httpdate_timestamp: ::std::option::Option::None,
|
8066 - | integer: ::std::option::Option::None,
|
8067 - | iso8601_timestamp: ::std::option::Option::None,
|
8068 - | json_value: ::std::option::Option::None,
|
8069 - | list_of_lists: ::std::option::Option::None,
|
8070 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8071 - | list_of_strings: ::std::option::Option::None,
|
8072 - | list_of_structs: ::std::option::Option::None,
|
8073 - | long: ::std::option::Option::None,
|
8074 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8075 - | map_of_maps: ::std::option::Option::None,
|
8076 - | map_of_strings: ::std::option::Option::None,
|
8077 - | map_of_structs: ::std::option::Option::None,
|
8078 - | recursive_map: ::std::option::Option::None,
|
8079 - | recursive_struct: ::std::option::Option::None,
|
8080 - | simple_struct: ::std::option::Option::None,
|
8081 - | string: ::std::option::Option::None,
|
8082 - | struct_with_json_name: ::std::option::Option::None,
|
8083 - | timestamp: ::std::option::Option::None,
|
8084 - | unix_timestamp: ::std::option::Option::None,
|
8085 - | };
|
8086 - | ::pretty_assertions::assert_eq!(
|
8087 - | input.blob,
|
8088 - | expected.blob,
|
8089 - | "Unexpected value for `blob`"
|
8090 - | );
|
8091 - | ::pretty_assertions::assert_eq!(
|
8092 - | input.boolean,
|
8093 - | expected.boolean,
|
8094 - | "Unexpected value for `boolean`"
|
8095 - | );
|
8096 - | assert!(
|
8097 - | input.double.float_equals(&expected.double),
|
8098 - | "Unexpected value for `double` {:?} vs. {:?}",
|
8099 - | expected.double,
|
8100 - | input.double
|
8101 - | );
|
8102 - | ::pretty_assertions::assert_eq!(
|
8103 - | input.empty_struct,
|
8104 - | expected.empty_struct,
|
8105 - | "Unexpected value for `empty_struct`"
|
8106 - | );
|
8107 - | assert!(
|
8108 - | input.float.float_equals(&expected.float),
|
8109 - | "Unexpected value for `float` {:?} vs. {:?}",
|
8110 - | expected.float,
|
8111 - | input.float
|
8112 - | );
|
8113 - | ::pretty_assertions::assert_eq!(
|
8114 - | input.httpdate_timestamp,
|
8115 - | expected.httpdate_timestamp,
|
8116 - | "Unexpected value for `httpdate_timestamp`"
|
8117 - | );
|
8118 - | ::pretty_assertions::assert_eq!(
|
8119 - | input.integer,
|
8120 - | expected.integer,
|
8121 - | "Unexpected value for `integer`"
|
8122 - | );
|
8123 - | ::pretty_assertions::assert_eq!(
|
8124 - | input.iso8601_timestamp,
|
8125 - | expected.iso8601_timestamp,
|
8126 - | "Unexpected value for `iso8601_timestamp`"
|
8127 - | );
|
8128 - | ::pretty_assertions::assert_eq!(
|
8129 - | input.json_value,
|
8130 - | expected.json_value,
|
8131 - | "Unexpected value for `json_value`"
|
8132 - | );
|
8133 - | ::pretty_assertions::assert_eq!(
|
8134 - | input.list_of_lists,
|
8135 - | expected.list_of_lists,
|
8136 - | "Unexpected value for `list_of_lists`"
|
8137 - | );
|
8138 - | ::pretty_assertions::assert_eq!(
|
8139 - | input.list_of_maps_of_strings,
|
8140 - | expected.list_of_maps_of_strings,
|
8141 - | "Unexpected value for `list_of_maps_of_strings`"
|
8142 - | );
|
8143 - | ::pretty_assertions::assert_eq!(
|
8144 - | input.list_of_strings,
|
8145 - | expected.list_of_strings,
|
8146 - | "Unexpected value for `list_of_strings`"
|
8147 - | );
|
8148 - | ::pretty_assertions::assert_eq!(
|
8149 - | input.list_of_structs,
|
8150 - | expected.list_of_structs,
|
8151 - | "Unexpected value for `list_of_structs`"
|
8152 - | );
|
8153 - | ::pretty_assertions::assert_eq!(
|
8154 - | input.long,
|
8155 - | expected.long,
|
8156 - | "Unexpected value for `long`"
|
8157 - | );
|
8158 - | ::pretty_assertions::assert_eq!(
|
8159 - | input.map_of_lists_of_strings,
|
8160 - | expected.map_of_lists_of_strings,
|
8161 - | "Unexpected value for `map_of_lists_of_strings`"
|
8162 - | );
|
8163 - | ::pretty_assertions::assert_eq!(
|
8164 - | input.map_of_maps,
|
8165 - | expected.map_of_maps,
|
8166 - | "Unexpected value for `map_of_maps`"
|
8167 - | );
|
8168 - | ::pretty_assertions::assert_eq!(
|
8169 - | input.map_of_strings,
|
8170 - | expected.map_of_strings,
|
8171 - | "Unexpected value for `map_of_strings`"
|
8172 - | );
|
8173 - | ::pretty_assertions::assert_eq!(
|
8174 - | input.map_of_structs,
|
8175 - | expected.map_of_structs,
|
8176 - | "Unexpected value for `map_of_structs`"
|
8177 - | );
|
8178 - | ::pretty_assertions::assert_eq!(
|
8179 - | input.recursive_list,
|
8180 - | expected.recursive_list,
|
8181 - | "Unexpected value for `recursive_list`"
|
8182 - | );
|
8183 - | ::pretty_assertions::assert_eq!(
|
8184 - | input.recursive_map,
|
8185 - | expected.recursive_map,
|
8186 - | "Unexpected value for `recursive_map`"
|
8187 - | );
|
8188 - | ::pretty_assertions::assert_eq!(
|
8189 - | input.recursive_struct,
|
8190 - | expected.recursive_struct,
|
8191 - | "Unexpected value for `recursive_struct`"
|
8192 - | );
|
8193 - | ::pretty_assertions::assert_eq!(
|
8194 - | input.simple_struct,
|
8195 - | expected.simple_struct,
|
8196 - | "Unexpected value for `simple_struct`"
|
8197 - | );
|
8198 - | ::pretty_assertions::assert_eq!(
|
8199 - | input.string,
|
8200 - | expected.string,
|
8201 - | "Unexpected value for `string`"
|
8202 - | );
|
8203 - | ::pretty_assertions::assert_eq!(
|
8204 - | input.struct_with_json_name,
|
8205 - | expected.struct_with_json_name,
|
8206 - | "Unexpected value for `struct_with_json_name`"
|
8207 - | );
|
8208 - | ::pretty_assertions::assert_eq!(
|
8209 - | input.timestamp,
|
8210 - | expected.timestamp,
|
8211 - | "Unexpected value for `timestamp`"
|
8212 - | );
|
8213 - | ::pretty_assertions::assert_eq!(
|
8214 - | input.unix_timestamp,
|
8215 - | expected.unix_timestamp,
|
8216 - | "Unexpected value for `unix_timestamp`"
|
8217 - | );
|
8218 - | let output = crate::output::KitchenSinkOperationOutput {
|
8219 - | blob: ::std::option::Option::None,
|
8220 - | boolean: ::std::option::Option::None,
|
8221 - | double: ::std::option::Option::None,
|
8222 - | empty_struct: ::std::option::Option::None,
|
8223 - | float: ::std::option::Option::None,
|
8224 - | httpdate_timestamp: ::std::option::Option::None,
|
8225 - | integer: ::std::option::Option::None,
|
8226 - | iso8601_timestamp: ::std::option::Option::None,
|
8227 - | json_value: ::std::option::Option::None,
|
8228 - | list_of_lists: ::std::option::Option::None,
|
8229 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8230 - | list_of_strings: ::std::option::Option::None,
|
8231 - | list_of_structs: ::std::option::Option::None,
|
8232 - | long: ::std::option::Option::None,
|
8233 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8234 - | map_of_maps: ::std::option::Option::None,
|
8235 - | map_of_strings: ::std::option::Option::None,
|
8236 - | map_of_structs: ::std::option::Option::None,
|
8237 - | recursive_list: ::std::option::Option::None,
|
8238 - | recursive_map: ::std::option::Option::None,
|
8239 - | recursive_struct: ::std::option::Option::None,
|
8240 - | simple_struct: ::std::option::Option::None,
|
8241 - | string: ::std::option::Option::None,
|
8242 - | struct_with_json_name: ::std::option::Option::None,
|
8243 - | timestamp: ::std::option::Option::None,
|
8244 - | unix_timestamp: ::std::option::Option::None,
|
8245 - | };
|
8246 - | Ok(output)
|
8247 - | };
|
8248 - | sender.send(()).await.expect("receiver dropped early");
|
8249 - | result
|
8250 - | }
|
8251 - | })
|
8252 - | .build_unchecked();
|
8253 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8254 - | .await
|
8255 - | .expect("unable to make an HTTP request");
|
8256 - | assert!(
|
8257 - | receiver.recv().await.is_some(),
|
8258 - | "we expected operation handler to be invoked but it was not entered"
|
8259 - | );
|
8260 - | }
|
8261 - |
|
8262 - | /// Serializes map shapes
|
8263 - | /// Test ID: serializes_map_shapes
|
8264 - | #[::tokio::test]
|
8265 - | #[::tracing_test::traced_test]
|
8266 - | async fn serializes_map_shapes_request() {
|
8267 - | #[allow(unused_mut)]
|
8268 - | let mut http_request = ::http_1x::Request::builder()
|
8269 - | .uri("/")
|
8270 - | .method("POST")
|
8271 - | .header("Content-Type", "application/x-amz-json-1.1")
|
8272 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
8273 - | .body(::aws_smithy_http_server::body::boxed(
|
8274 - | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
8275 - | &::aws_smithy_protocol_test::decode_body_data(
|
8276 - | "{\"MapOfStrings\":{\"abc\":\"xyz\",\"mno\":\"hjk\"}}".as_bytes(),
|
8277 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8278 - | ),
|
8279 - | )),
|
8280 - | ))
|
8281 - | .unwrap();
|
8282 - | #[allow(unused_mut)]
|
8283 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8284 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
8285 - | let service = crate::service::JsonProtocol::builder::<
|
8286 - | ::aws_smithy_http_server::body::BoxBody,
|
8287 - | _,
|
8288 - | _,
|
8289 - | _,
|
8290 - | >(config)
|
8291 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
8292 - | let sender = sender.clone();
|
8293 - | async move {
|
8294 - | let result = {
|
8295 - | use ::aws_smithy_protocol_test::FloatEquals;
|
8296 - | let expected = crate::input::KitchenSinkOperationInput {
|
8297 - | map_of_strings: ::std::option::Option::Some({
|
8298 - | let mut ret = ::std::collections::HashMap::new();
|
8299 - | ret.insert("abc".to_owned(), "xyz".to_owned());
|
8300 - | ret.insert("mno".to_owned(), "hjk".to_owned());
|
8301 - | ret
|
8302 - | }),
|
8303 - | blob: ::std::option::Option::None,
|
8304 - | boolean: ::std::option::Option::None,
|
8305 - | double: ::std::option::Option::None,
|
8306 - | empty_struct: ::std::option::Option::None,
|
8307 - | float: ::std::option::Option::None,
|
8308 - | httpdate_timestamp: ::std::option::Option::None,
|
8309 - | integer: ::std::option::Option::None,
|
8310 - | iso8601_timestamp: ::std::option::Option::None,
|
8311 - | json_value: ::std::option::Option::None,
|
8312 - | list_of_lists: ::std::option::Option::None,
|
8313 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8314 - | list_of_strings: ::std::option::Option::None,
|
8315 - | list_of_structs: ::std::option::Option::None,
|
8316 - | long: ::std::option::Option::None,
|
8317 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8318 - | map_of_maps: ::std::option::Option::None,
|
8319 - | map_of_structs: ::std::option::Option::None,
|
8320 - | recursive_list: ::std::option::Option::None,
|
8321 - | recursive_map: ::std::option::Option::None,
|
8322 - | recursive_struct: ::std::option::Option::None,
|
8323 - | simple_struct: ::std::option::Option::None,
|
8324 - | string: ::std::option::Option::None,
|
8325 - | struct_with_json_name: ::std::option::Option::None,
|
8326 - | timestamp: ::std::option::Option::None,
|
8327 - | unix_timestamp: ::std::option::Option::None,
|
8328 - | };
|
8329 - | ::pretty_assertions::assert_eq!(
|
8330 - | input.blob,
|
8331 - | expected.blob,
|
8332 - | "Unexpected value for `blob`"
|
8333 - | );
|
8334 - | ::pretty_assertions::assert_eq!(
|
8335 - | input.boolean,
|
8336 - | expected.boolean,
|
8337 - | "Unexpected value for `boolean`"
|
8338 - | );
|
8339 - | assert!(
|
8340 - | input.double.float_equals(&expected.double),
|
8341 - | "Unexpected value for `double` {:?} vs. {:?}",
|
8342 - | expected.double,
|
8343 - | input.double
|
8344 - | );
|
8345 - | ::pretty_assertions::assert_eq!(
|
8346 - | input.empty_struct,
|
8347 - | expected.empty_struct,
|
8348 - | "Unexpected value for `empty_struct`"
|
8349 - | );
|
8350 - | assert!(
|
8351 - | input.float.float_equals(&expected.float),
|
8352 - | "Unexpected value for `float` {:?} vs. {:?}",
|
8353 - | expected.float,
|
8354 - | input.float
|
8355 - | );
|
8356 - | ::pretty_assertions::assert_eq!(
|
8357 - | input.httpdate_timestamp,
|
8358 - | expected.httpdate_timestamp,
|
8359 - | "Unexpected value for `httpdate_timestamp`"
|
8360 - | );
|
8361 - | ::pretty_assertions::assert_eq!(
|
8362 - | input.integer,
|
8363 - | expected.integer,
|
8364 - | "Unexpected value for `integer`"
|
8365 - | );
|
8366 - | ::pretty_assertions::assert_eq!(
|
8367 - | input.iso8601_timestamp,
|
8368 - | expected.iso8601_timestamp,
|
8369 - | "Unexpected value for `iso8601_timestamp`"
|
8370 - | );
|
8371 - | ::pretty_assertions::assert_eq!(
|
8372 - | input.json_value,
|
8373 - | expected.json_value,
|
8374 - | "Unexpected value for `json_value`"
|
8375 - | );
|
8376 - | ::pretty_assertions::assert_eq!(
|
8377 - | input.list_of_lists,
|
8378 - | expected.list_of_lists,
|
8379 - | "Unexpected value for `list_of_lists`"
|
8380 - | );
|
8381 - | ::pretty_assertions::assert_eq!(
|
8382 - | input.list_of_maps_of_strings,
|
8383 - | expected.list_of_maps_of_strings,
|
8384 - | "Unexpected value for `list_of_maps_of_strings`"
|
8385 - | );
|
8386 - | ::pretty_assertions::assert_eq!(
|
8387 - | input.list_of_strings,
|
8388 - | expected.list_of_strings,
|
8389 - | "Unexpected value for `list_of_strings`"
|
8390 - | );
|
8391 - | ::pretty_assertions::assert_eq!(
|
8392 - | input.list_of_structs,
|
8393 - | expected.list_of_structs,
|
8394 - | "Unexpected value for `list_of_structs`"
|
8395 - | );
|
8396 - | ::pretty_assertions::assert_eq!(
|
8397 - | input.long,
|
8398 - | expected.long,
|
8399 - | "Unexpected value for `long`"
|
8400 - | );
|
8401 - | ::pretty_assertions::assert_eq!(
|
8402 - | input.map_of_lists_of_strings,
|
8403 - | expected.map_of_lists_of_strings,
|
8404 - | "Unexpected value for `map_of_lists_of_strings`"
|
8405 - | );
|
8406 - | ::pretty_assertions::assert_eq!(
|
8407 - | input.map_of_maps,
|
8408 - | expected.map_of_maps,
|
8409 - | "Unexpected value for `map_of_maps`"
|
8410 - | );
|
8411 - | ::pretty_assertions::assert_eq!(
|
8412 - | input.map_of_strings,
|
8413 - | expected.map_of_strings,
|
8414 - | "Unexpected value for `map_of_strings`"
|
8415 - | );
|
8416 - | ::pretty_assertions::assert_eq!(
|
8417 - | input.map_of_structs,
|
8418 - | expected.map_of_structs,
|
8419 - | "Unexpected value for `map_of_structs`"
|
8420 - | );
|
8421 - | ::pretty_assertions::assert_eq!(
|
8422 - | input.recursive_list,
|
8423 - | expected.recursive_list,
|
8424 - | "Unexpected value for `recursive_list`"
|
8425 - | );
|
8426 - | ::pretty_assertions::assert_eq!(
|
8427 - | input.recursive_map,
|
8428 - | expected.recursive_map,
|
8429 - | "Unexpected value for `recursive_map`"
|
8430 - | );
|
8431 - | ::pretty_assertions::assert_eq!(
|
8432 - | input.recursive_struct,
|
8433 - | expected.recursive_struct,
|
8434 - | "Unexpected value for `recursive_struct`"
|
8435 - | );
|
8436 - | ::pretty_assertions::assert_eq!(
|
8437 - | input.simple_struct,
|
8438 - | expected.simple_struct,
|
8439 - | "Unexpected value for `simple_struct`"
|
8440 - | );
|
8441 - | ::pretty_assertions::assert_eq!(
|
8442 - | input.string,
|
8443 - | expected.string,
|
8444 - | "Unexpected value for `string`"
|
8445 - | );
|
8446 - | ::pretty_assertions::assert_eq!(
|
8447 - | input.struct_with_json_name,
|
8448 - | expected.struct_with_json_name,
|
8449 - | "Unexpected value for `struct_with_json_name`"
|
8450 - | );
|
8451 - | ::pretty_assertions::assert_eq!(
|
8452 - | input.timestamp,
|
8453 - | expected.timestamp,
|
8454 - | "Unexpected value for `timestamp`"
|
8455 - | );
|
8456 - | ::pretty_assertions::assert_eq!(
|
8457 - | input.unix_timestamp,
|
8458 - | expected.unix_timestamp,
|
8459 - | "Unexpected value for `unix_timestamp`"
|
8460 - | );
|
8461 - | let output = crate::output::KitchenSinkOperationOutput {
|
8462 - | blob: ::std::option::Option::None,
|
8463 - | boolean: ::std::option::Option::None,
|
8464 - | double: ::std::option::Option::None,
|
8465 - | empty_struct: ::std::option::Option::None,
|
8466 - | float: ::std::option::Option::None,
|
8467 - | httpdate_timestamp: ::std::option::Option::None,
|
8468 - | integer: ::std::option::Option::None,
|
8469 - | iso8601_timestamp: ::std::option::Option::None,
|
8470 - | json_value: ::std::option::Option::None,
|
8471 - | list_of_lists: ::std::option::Option::None,
|
8472 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8473 - | list_of_strings: ::std::option::Option::None,
|
8474 - | list_of_structs: ::std::option::Option::None,
|
8475 - | long: ::std::option::Option::None,
|
8476 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8477 - | map_of_maps: ::std::option::Option::None,
|
8478 - | map_of_strings: ::std::option::Option::None,
|
8479 - | map_of_structs: ::std::option::Option::None,
|
8480 - | recursive_list: ::std::option::Option::None,
|
8481 - | recursive_map: ::std::option::Option::None,
|
8482 - | recursive_struct: ::std::option::Option::None,
|
8483 - | simple_struct: ::std::option::Option::None,
|
8484 - | string: ::std::option::Option::None,
|
8485 - | struct_with_json_name: ::std::option::Option::None,
|
8486 - | timestamp: ::std::option::Option::None,
|
8487 - | unix_timestamp: ::std::option::Option::None,
|
8488 - | };
|
8489 - | Ok(output)
|
8490 - | };
|
8491 - | sender.send(()).await.expect("receiver dropped early");
|
8492 - | result
|
8493 - | }
|
8494 - | })
|
8495 - | .build_unchecked();
|
8496 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8497 - | .await
|
8498 - | .expect("unable to make an HTTP request");
|
8499 - | assert!(
|
8500 - | receiver.recv().await.is_some(),
|
8501 - | "we expected operation handler to be invoked but it was not entered"
|
8502 - | );
|
8503 - | }
|
8504 - |
|
8505 - | /// Serializes empty map shapes
|
8506 - | /// Test ID: serializes_empty_map_shapes
|
8507 - | #[::tokio::test]
|
8508 - | #[::tracing_test::traced_test]
|
8509 - | async fn serializes_empty_map_shapes_request() {
|
8510 - | #[allow(unused_mut)]
|
8511 - | let mut http_request = ::http_1x::Request::builder()
|
8512 - | .uri("/")
|
8513 - | .method("POST")
|
8514 - | .header("Content-Type", "application/x-amz-json-1.1")
|
8515 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
8516 - | .body(::aws_smithy_http_server::body::boxed(
|
8517 - | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
8518 - | &::aws_smithy_protocol_test::decode_body_data(
|
8519 - | "{\"MapOfStrings\":{}}".as_bytes(),
|
8520 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8521 - | ),
|
8522 - | )),
|
8523 - | ))
|
8524 - | .unwrap();
|
8525 - | #[allow(unused_mut)]
|
8526 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8527 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
8528 - | let service = crate::service::JsonProtocol::builder::<
|
8529 - | ::aws_smithy_http_server::body::BoxBody,
|
8530 - | _,
|
8531 - | _,
|
8532 - | _,
|
8533 - | >(config)
|
8534 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
8535 - | let sender = sender.clone();
|
8536 - | async move {
|
8537 - | let result = {
|
8538 - | use ::aws_smithy_protocol_test::FloatEquals;
|
8539 - | let expected = crate::input::KitchenSinkOperationInput {
|
8540 - | map_of_strings: ::std::option::Option::Some(
|
8541 - | ::std::collections::HashMap::new(),
|
8542 - | ),
|
8543 - | blob: ::std::option::Option::None,
|
8544 - | boolean: ::std::option::Option::None,
|
8545 - | double: ::std::option::Option::None,
|
8546 - | empty_struct: ::std::option::Option::None,
|
8547 - | float: ::std::option::Option::None,
|
8548 - | httpdate_timestamp: ::std::option::Option::None,
|
8549 - | integer: ::std::option::Option::None,
|
8550 - | iso8601_timestamp: ::std::option::Option::None,
|
8551 - | json_value: ::std::option::Option::None,
|
8552 - | list_of_lists: ::std::option::Option::None,
|
8553 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8554 - | list_of_strings: ::std::option::Option::None,
|
8555 - | list_of_structs: ::std::option::Option::None,
|
8556 - | long: ::std::option::Option::None,
|
8557 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8558 - | map_of_maps: ::std::option::Option::None,
|
8559 - | map_of_structs: ::std::option::Option::None,
|
8560 - | recursive_list: ::std::option::Option::None,
|
8561 - | recursive_map: ::std::option::Option::None,
|
8562 - | recursive_struct: ::std::option::Option::None,
|
8563 - | simple_struct: ::std::option::Option::None,
|
8564 - | string: ::std::option::Option::None,
|
8565 - | struct_with_json_name: ::std::option::Option::None,
|
8566 - | timestamp: ::std::option::Option::None,
|
8567 - | unix_timestamp: ::std::option::Option::None,
|
8568 - | };
|
8569 - | ::pretty_assertions::assert_eq!(
|
8570 - | input.blob,
|
8571 - | expected.blob,
|
8572 - | "Unexpected value for `blob`"
|
8573 - | );
|
8574 - | ::pretty_assertions::assert_eq!(
|
8575 - | input.boolean,
|
8576 - | expected.boolean,
|
8577 - | "Unexpected value for `boolean`"
|
8578 - | );
|
8579 - | assert!(
|
8580 - | input.double.float_equals(&expected.double),
|
8581 - | "Unexpected value for `double` {:?} vs. {:?}",
|
8582 - | expected.double,
|
8583 - | input.double
|
8584 - | );
|
8585 - | ::pretty_assertions::assert_eq!(
|
8586 - | input.empty_struct,
|
8587 - | expected.empty_struct,
|
8588 - | "Unexpected value for `empty_struct`"
|
8589 - | );
|
8590 - | assert!(
|
8591 - | input.float.float_equals(&expected.float),
|
8592 - | "Unexpected value for `float` {:?} vs. {:?}",
|
8593 - | expected.float,
|
8594 - | input.float
|
8595 - | );
|
8596 - | ::pretty_assertions::assert_eq!(
|
8597 - | input.httpdate_timestamp,
|
8598 - | expected.httpdate_timestamp,
|
8599 - | "Unexpected value for `httpdate_timestamp`"
|
8600 - | );
|
8601 - | ::pretty_assertions::assert_eq!(
|
8602 - | input.integer,
|
8603 - | expected.integer,
|
8604 - | "Unexpected value for `integer`"
|
8605 - | );
|
8606 - | ::pretty_assertions::assert_eq!(
|
8607 - | input.iso8601_timestamp,
|
8608 - | expected.iso8601_timestamp,
|
8609 - | "Unexpected value for `iso8601_timestamp`"
|
8610 - | );
|
8611 - | ::pretty_assertions::assert_eq!(
|
8612 - | input.json_value,
|
8613 - | expected.json_value,
|
8614 - | "Unexpected value for `json_value`"
|
8615 - | );
|
8616 - | ::pretty_assertions::assert_eq!(
|
8617 - | input.list_of_lists,
|
8618 - | expected.list_of_lists,
|
8619 - | "Unexpected value for `list_of_lists`"
|
8620 - | );
|
8621 - | ::pretty_assertions::assert_eq!(
|
8622 - | input.list_of_maps_of_strings,
|
8623 - | expected.list_of_maps_of_strings,
|
8624 - | "Unexpected value for `list_of_maps_of_strings`"
|
8625 - | );
|
8626 - | ::pretty_assertions::assert_eq!(
|
8627 - | input.list_of_strings,
|
8628 - | expected.list_of_strings,
|
8629 - | "Unexpected value for `list_of_strings`"
|
8630 - | );
|
8631 - | ::pretty_assertions::assert_eq!(
|
8632 - | input.list_of_structs,
|
8633 - | expected.list_of_structs,
|
8634 - | "Unexpected value for `list_of_structs`"
|
8635 - | );
|
8636 - | ::pretty_assertions::assert_eq!(
|
8637 - | input.long,
|
8638 - | expected.long,
|
8639 - | "Unexpected value for `long`"
|
8640 - | );
|
8641 - | ::pretty_assertions::assert_eq!(
|
8642 - | input.map_of_lists_of_strings,
|
8643 - | expected.map_of_lists_of_strings,
|
8644 - | "Unexpected value for `map_of_lists_of_strings`"
|
8645 - | );
|
8646 - | ::pretty_assertions::assert_eq!(
|
8647 - | input.map_of_maps,
|
8648 - | expected.map_of_maps,
|
8649 - | "Unexpected value for `map_of_maps`"
|
8650 - | );
|
8651 - | ::pretty_assertions::assert_eq!(
|
8652 - | input.map_of_strings,
|
8653 - | expected.map_of_strings,
|
8654 - | "Unexpected value for `map_of_strings`"
|
8655 - | );
|
8656 - | ::pretty_assertions::assert_eq!(
|
8657 - | input.map_of_structs,
|
8658 - | expected.map_of_structs,
|
8659 - | "Unexpected value for `map_of_structs`"
|
8660 - | );
|
8661 - | ::pretty_assertions::assert_eq!(
|
8662 - | input.recursive_list,
|
8663 - | expected.recursive_list,
|
8664 - | "Unexpected value for `recursive_list`"
|
8665 - | );
|
8666 - | ::pretty_assertions::assert_eq!(
|
8667 - | input.recursive_map,
|
8668 - | expected.recursive_map,
|
8669 - | "Unexpected value for `recursive_map`"
|
8670 - | );
|
8671 - | ::pretty_assertions::assert_eq!(
|
8672 - | input.recursive_struct,
|
8673 - | expected.recursive_struct,
|
8674 - | "Unexpected value for `recursive_struct`"
|
8675 - | );
|
8676 - | ::pretty_assertions::assert_eq!(
|
8677 - | input.simple_struct,
|
8678 - | expected.simple_struct,
|
8679 - | "Unexpected value for `simple_struct`"
|
8680 - | );
|
8681 - | ::pretty_assertions::assert_eq!(
|
8682 - | input.string,
|
8683 - | expected.string,
|
8684 - | "Unexpected value for `string`"
|
8685 - | );
|
8686 - | ::pretty_assertions::assert_eq!(
|
8687 - | input.struct_with_json_name,
|
8688 - | expected.struct_with_json_name,
|
8689 - | "Unexpected value for `struct_with_json_name`"
|
8690 - | );
|
8691 - | ::pretty_assertions::assert_eq!(
|
8692 - | input.timestamp,
|
8693 - | expected.timestamp,
|
8694 - | "Unexpected value for `timestamp`"
|
8695 - | );
|
8696 - | ::pretty_assertions::assert_eq!(
|
8697 - | input.unix_timestamp,
|
8698 - | expected.unix_timestamp,
|
8699 - | "Unexpected value for `unix_timestamp`"
|
8700 - | );
|
8701 - | let output = crate::output::KitchenSinkOperationOutput {
|
8702 - | blob: ::std::option::Option::None,
|
8703 - | boolean: ::std::option::Option::None,
|
8704 - | double: ::std::option::Option::None,
|
8705 - | empty_struct: ::std::option::Option::None,
|
8706 - | float: ::std::option::Option::None,
|
8707 - | httpdate_timestamp: ::std::option::Option::None,
|
8708 - | integer: ::std::option::Option::None,
|
8709 - | iso8601_timestamp: ::std::option::Option::None,
|
8710 - | json_value: ::std::option::Option::None,
|
8711 - | list_of_lists: ::std::option::Option::None,
|
8712 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8713 - | list_of_strings: ::std::option::Option::None,
|
8714 - | list_of_structs: ::std::option::Option::None,
|
8715 - | long: ::std::option::Option::None,
|
8716 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8717 - | map_of_maps: ::std::option::Option::None,
|
8718 - | map_of_strings: ::std::option::Option::None,
|
8719 - | map_of_structs: ::std::option::Option::None,
|
8720 - | recursive_list: ::std::option::Option::None,
|
8721 - | recursive_map: ::std::option::Option::None,
|
8722 - | recursive_struct: ::std::option::Option::None,
|
8723 - | simple_struct: ::std::option::Option::None,
|
8724 - | string: ::std::option::Option::None,
|
8725 - | struct_with_json_name: ::std::option::Option::None,
|
8726 - | timestamp: ::std::option::Option::None,
|
8727 - | unix_timestamp: ::std::option::Option::None,
|
8728 - | };
|
8729 - | Ok(output)
|
8730 - | };
|
8731 - | sender.send(()).await.expect("receiver dropped early");
|
8732 - | result
|
8733 - | }
|
8734 - | })
|
8735 - | .build_unchecked();
|
8736 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8737 - | .await
|
8738 - | .expect("unable to make an HTTP request");
|
8739 - | assert!(
|
8740 - | receiver.recv().await.is_some(),
|
8741 - | "we expected operation handler to be invoked but it was not entered"
|
8742 - | );
|
8743 - | }
|
8744 - |
|
8745 - | /// Serializes map of list shapes
|
8746 - | /// Test ID: serializes_map_of_list_shapes
|
8747 - | #[::tokio::test]
|
8748 - | #[::tracing_test::traced_test]
|
8749 - | async fn serializes_map_of_list_shapes_request() {
|
8750 - | #[allow(unused_mut)]
|
8751 - | let mut http_request = ::http_1x::Request::builder()
|
8752 - | .uri("/")
|
8753 - | .method("POST")
|
8754 - | .header("Content-Type", "application/x-amz-json-1.1")
|
8755 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
8756 - | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
8757 - | ::bytes::Bytes::copy_from_slice(
|
8758 - | &::aws_smithy_protocol_test::decode_body_data("{\"MapOfListsOfStrings\":{\"abc\":[\"abc\",\"xyz\"],\"mno\":[\"xyz\",\"abc\"]}}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
8759 - | )
|
8760 - | ))).unwrap();
|
8761 - | #[allow(unused_mut)]
|
8762 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8763 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
8764 - | let service = crate::service::JsonProtocol::builder::<
|
8765 - | ::aws_smithy_http_server::body::BoxBody,
|
8766 - | _,
|
8767 - | _,
|
8768 - | _,
|
8769 - | >(config)
|
8770 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
8771 - | let sender = sender.clone();
|
8772 - | async move {
|
8773 - | let result = {
|
8774 - | use ::aws_smithy_protocol_test::FloatEquals;
|
8775 - | let expected = crate::input::KitchenSinkOperationInput {
|
8776 - | map_of_lists_of_strings: ::std::option::Option::Some({
|
8777 - | let mut ret = ::std::collections::HashMap::new();
|
8778 - | ret.insert("abc".to_owned(), vec!["abc".to_owned(), "xyz".to_owned()]);
|
8779 - | ret.insert("mno".to_owned(), vec!["xyz".to_owned(), "abc".to_owned()]);
|
8780 - | ret
|
8781 - | }),
|
8782 - | blob: ::std::option::Option::None,
|
8783 - | boolean: ::std::option::Option::None,
|
8784 - | double: ::std::option::Option::None,
|
8785 - | empty_struct: ::std::option::Option::None,
|
8786 - | float: ::std::option::Option::None,
|
8787 - | httpdate_timestamp: ::std::option::Option::None,
|
8788 - | integer: ::std::option::Option::None,
|
8789 - | iso8601_timestamp: ::std::option::Option::None,
|
8790 - | json_value: ::std::option::Option::None,
|
8791 - | list_of_lists: ::std::option::Option::None,
|
8792 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8793 - | list_of_strings: ::std::option::Option::None,
|
8794 - | list_of_structs: ::std::option::Option::None,
|
8795 - | long: ::std::option::Option::None,
|
8796 - | map_of_maps: ::std::option::Option::None,
|
8797 - | map_of_strings: ::std::option::Option::None,
|
8798 - | map_of_structs: ::std::option::Option::None,
|
8799 - | recursive_list: ::std::option::Option::None,
|
8800 - | recursive_map: ::std::option::Option::None,
|
8801 - | recursive_struct: ::std::option::Option::None,
|
8802 - | simple_struct: ::std::option::Option::None,
|
8803 - | string: ::std::option::Option::None,
|
8804 - | struct_with_json_name: ::std::option::Option::None,
|
8805 - | timestamp: ::std::option::Option::None,
|
8806 - | unix_timestamp: ::std::option::Option::None,
|
8807 - | };
|
8808 - | ::pretty_assertions::assert_eq!(
|
8809 - | input.blob,
|
8810 - | expected.blob,
|
8811 - | "Unexpected value for `blob`"
|
8812 - | );
|
8813 - | ::pretty_assertions::assert_eq!(
|
8814 - | input.boolean,
|
8815 - | expected.boolean,
|
8816 - | "Unexpected value for `boolean`"
|
8817 - | );
|
8818 - | assert!(
|
8819 - | input.double.float_equals(&expected.double),
|
8820 - | "Unexpected value for `double` {:?} vs. {:?}",
|
8821 - | expected.double,
|
8822 - | input.double
|
8823 - | );
|
8824 - | ::pretty_assertions::assert_eq!(
|
8825 - | input.empty_struct,
|
8826 - | expected.empty_struct,
|
8827 - | "Unexpected value for `empty_struct`"
|
8828 - | );
|
8829 - | assert!(
|
8830 - | input.float.float_equals(&expected.float),
|
8831 - | "Unexpected value for `float` {:?} vs. {:?}",
|
8832 - | expected.float,
|
8833 - | input.float
|
8834 - | );
|
8835 - | ::pretty_assertions::assert_eq!(
|
8836 - | input.httpdate_timestamp,
|
8837 - | expected.httpdate_timestamp,
|
8838 - | "Unexpected value for `httpdate_timestamp`"
|
8839 - | );
|
8840 - | ::pretty_assertions::assert_eq!(
|
8841 - | input.integer,
|
8842 - | expected.integer,
|
8843 - | "Unexpected value for `integer`"
|
8844 - | );
|
8845 - | ::pretty_assertions::assert_eq!(
|
8846 - | input.iso8601_timestamp,
|
8847 - | expected.iso8601_timestamp,
|
8848 - | "Unexpected value for `iso8601_timestamp`"
|
8849 - | );
|
8850 - | ::pretty_assertions::assert_eq!(
|
8851 - | input.json_value,
|
8852 - | expected.json_value,
|
8853 - | "Unexpected value for `json_value`"
|
8854 - | );
|
8855 - | ::pretty_assertions::assert_eq!(
|
8856 - | input.list_of_lists,
|
8857 - | expected.list_of_lists,
|
8858 - | "Unexpected value for `list_of_lists`"
|
8859 - | );
|
8860 - | ::pretty_assertions::assert_eq!(
|
8861 - | input.list_of_maps_of_strings,
|
8862 - | expected.list_of_maps_of_strings,
|
8863 - | "Unexpected value for `list_of_maps_of_strings`"
|
8864 - | );
|
8865 - | ::pretty_assertions::assert_eq!(
|
8866 - | input.list_of_strings,
|
8867 - | expected.list_of_strings,
|
8868 - | "Unexpected value for `list_of_strings`"
|
8869 - | );
|
8870 - | ::pretty_assertions::assert_eq!(
|
8871 - | input.list_of_structs,
|
8872 - | expected.list_of_structs,
|
8873 - | "Unexpected value for `list_of_structs`"
|
8874 - | );
|
8875 - | ::pretty_assertions::assert_eq!(
|
8876 - | input.long,
|
8877 - | expected.long,
|
8878 - | "Unexpected value for `long`"
|
8879 - | );
|
8880 - | ::pretty_assertions::assert_eq!(
|
8881 - | input.map_of_lists_of_strings,
|
8882 - | expected.map_of_lists_of_strings,
|
8883 - | "Unexpected value for `map_of_lists_of_strings`"
|
8884 - | );
|
8885 - | ::pretty_assertions::assert_eq!(
|
8886 - | input.map_of_maps,
|
8887 - | expected.map_of_maps,
|
8888 - | "Unexpected value for `map_of_maps`"
|
8889 - | );
|
8890 - | ::pretty_assertions::assert_eq!(
|
8891 - | input.map_of_strings,
|
8892 - | expected.map_of_strings,
|
8893 - | "Unexpected value for `map_of_strings`"
|
8894 - | );
|
8895 - | ::pretty_assertions::assert_eq!(
|
8896 - | input.map_of_structs,
|
8897 - | expected.map_of_structs,
|
8898 - | "Unexpected value for `map_of_structs`"
|
8899 - | );
|
8900 - | ::pretty_assertions::assert_eq!(
|
8901 - | input.recursive_list,
|
8902 - | expected.recursive_list,
|
8903 - | "Unexpected value for `recursive_list`"
|
8904 - | );
|
8905 - | ::pretty_assertions::assert_eq!(
|
8906 - | input.recursive_map,
|
8907 - | expected.recursive_map,
|
8908 - | "Unexpected value for `recursive_map`"
|
8909 - | );
|
8910 - | ::pretty_assertions::assert_eq!(
|
8911 - | input.recursive_struct,
|
8912 - | expected.recursive_struct,
|
8913 - | "Unexpected value for `recursive_struct`"
|
8914 - | );
|
8915 - | ::pretty_assertions::assert_eq!(
|
8916 - | input.simple_struct,
|
8917 - | expected.simple_struct,
|
8918 - | "Unexpected value for `simple_struct`"
|
8919 - | );
|
8920 - | ::pretty_assertions::assert_eq!(
|
8921 - | input.string,
|
8922 - | expected.string,
|
8923 - | "Unexpected value for `string`"
|
8924 - | );
|
8925 - | ::pretty_assertions::assert_eq!(
|
8926 - | input.struct_with_json_name,
|
8927 - | expected.struct_with_json_name,
|
8928 - | "Unexpected value for `struct_with_json_name`"
|
8929 - | );
|
8930 - | ::pretty_assertions::assert_eq!(
|
8931 - | input.timestamp,
|
8932 - | expected.timestamp,
|
8933 - | "Unexpected value for `timestamp`"
|
8934 - | );
|
8935 - | ::pretty_assertions::assert_eq!(
|
8936 - | input.unix_timestamp,
|
8937 - | expected.unix_timestamp,
|
8938 - | "Unexpected value for `unix_timestamp`"
|
8939 - | );
|
8940 - | let output = crate::output::KitchenSinkOperationOutput {
|
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_map: ::std::option::Option::None,
|
8961 - | recursive_struct: ::std::option::Option::None,
|
8962 - | simple_struct: ::std::option::Option::None,
|
8963 - | string: ::std::option::Option::None,
|
8964 - | struct_with_json_name: ::std::option::Option::None,
|
8965 - | timestamp: ::std::option::Option::None,
|
8966 - | unix_timestamp: ::std::option::Option::None,
|
8967 - | };
|
8968 - | Ok(output)
|
8969 - | };
|
8970 - | sender.send(()).await.expect("receiver dropped early");
|
8971 - | result
|
8972 - | }
|
8973 - | })
|
8974 - | .build_unchecked();
|
8975 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8976 - | .await
|
8977 - | .expect("unable to make an HTTP request");
|
8978 - | assert!(
|
8979 - | receiver.recv().await.is_some(),
|
8980 - | "we expected operation handler to be invoked but it was not entered"
|
8981 - | );
|
8982 - | }
|
8983 - |
|
8984 - | /// Serializes map of structure shapes
|
8985 - | /// Test ID: serializes_map_of_structure_shapes
|
8986 - | #[::tokio::test]
|
8987 - | #[::tracing_test::traced_test]
|
8988 - | async fn serializes_map_of_structure_shapes_request() {
|
8989 - | #[allow(unused_mut)]
|
8990 - | let mut http_request = ::http_1x::Request::builder()
|
8991 - | .uri("/")
|
8992 - | .method("POST")
|
8993 - | .header("Content-Type", "application/x-amz-json-1.1")
|
8994 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
8995 - | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
8996 - | ::bytes::Bytes::copy_from_slice(
|
8997 - | &::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"))
|
8998 - | )
|
8999 - | ))).unwrap();
|
9000 - | #[allow(unused_mut)]
|
9001 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9002 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
9003 - | let service = crate::service::JsonProtocol::builder::<
|
9004 - | ::aws_smithy_http_server::body::BoxBody,
|
9005 - | _,
|
9006 - | _,
|
9007 - | _,
|
9008 - | >(config)
|
9009 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
9010 - | let sender = sender.clone();
|
9011 - | async move {
|
9012 - | let result = {
|
9013 - | use ::aws_smithy_protocol_test::FloatEquals;
|
9014 - | let expected = crate::input::KitchenSinkOperationInput {
|
9015 - | map_of_structs: ::std::option::Option::Some({
|
9016 - | let mut ret = ::std::collections::HashMap::new();
|
9017 - | ret.insert(
|
9018 - | "key1".to_owned(),
|
9019 - | crate::model::SimpleStruct {
|
9020 - | value: ::std::option::Option::Some("value-1".to_owned()),
|
9021 - | },
|
9022 - | );
|
9023 - | ret.insert(
|
9024 - | "key2".to_owned(),
|
9025 - | crate::model::SimpleStruct {
|
9026 - | value: ::std::option::Option::Some("value-2".to_owned()),
|
9027 - | },
|
9028 - | );
|
9029 - | ret
|
9030 - | }),
|
9031 - | blob: ::std::option::Option::None,
|
9032 - | boolean: ::std::option::Option::None,
|
9033 - | double: ::std::option::Option::None,
|
9034 - | empty_struct: ::std::option::Option::None,
|
9035 - | float: ::std::option::Option::None,
|
9036 - | httpdate_timestamp: ::std::option::Option::None,
|
9037 - | integer: ::std::option::Option::None,
|
9038 - | iso8601_timestamp: ::std::option::Option::None,
|
9039 - | json_value: ::std::option::Option::None,
|
9040 - | list_of_lists: ::std::option::Option::None,
|
9041 - | list_of_maps_of_strings: ::std::option::Option::None,
|
9042 - | list_of_strings: ::std::option::Option::None,
|
9043 - | list_of_structs: ::std::option::Option::None,
|
9044 - | long: ::std::option::Option::None,
|
9045 - | map_of_lists_of_strings: ::std::option::Option::None,
|
9046 - | map_of_maps: ::std::option::Option::None,
|
9047 - | map_of_strings: ::std::option::Option::None,
|
9048 - | recursive_list: ::std::option::Option::None,
|
9049 - | recursive_map: ::std::option::Option::None,
|
9050 - | recursive_struct: ::std::option::Option::None,
|
9051 - | simple_struct: ::std::option::Option::None,
|
9052 - | string: ::std::option::Option::None,
|
9053 - | struct_with_json_name: ::std::option::Option::None,
|
9054 - | timestamp: ::std::option::Option::None,
|
9055 - | unix_timestamp: ::std::option::Option::None,
|
9056 - | };
|
9057 - | ::pretty_assertions::assert_eq!(
|
9058 - | input.blob,
|
9059 - | expected.blob,
|
9060 - | "Unexpected value for `blob`"
|
9061 - | );
|
9062 - | ::pretty_assertions::assert_eq!(
|
9063 - | input.boolean,
|
9064 - | expected.boolean,
|
9065 - | "Unexpected value for `boolean`"
|
9066 - | );
|
9067 - | assert!(
|
9068 - | input.double.float_equals(&expected.double),
|
9069 - | "Unexpected value for `double` {:?} vs. {:?}",
|
9070 - | expected.double,
|
9071 - | input.double
|
9072 - | );
|
9073 - | ::pretty_assertions::assert_eq!(
|
9074 - | input.empty_struct,
|
9075 - | expected.empty_struct,
|
9076 - | "Unexpected value for `empty_struct`"
|
9077 - | );
|
9078 - | assert!(
|
9079 - | input.float.float_equals(&expected.float),
|
9080 - | "Unexpected value for `float` {:?} vs. {:?}",
|
9081 - | expected.float,
|
9082 - | input.float
|
9083 - | );
|
9084 - | ::pretty_assertions::assert_eq!(
|
9085 - | input.httpdate_timestamp,
|
9086 - | expected.httpdate_timestamp,
|
9087 - | "Unexpected value for `httpdate_timestamp`"
|
9088 - | );
|
9089 - | ::pretty_assertions::assert_eq!(
|
9090 - | input.integer,
|
9091 - | expected.integer,
|
9092 - | "Unexpected value for `integer`"
|
9093 - | );
|
9094 - | ::pretty_assertions::assert_eq!(
|
9095 - | input.iso8601_timestamp,
|
9096 - | expected.iso8601_timestamp,
|
9097 - | "Unexpected value for `iso8601_timestamp`"
|
9098 - | );
|
9099 - | ::pretty_assertions::assert_eq!(
|
9100 - | input.json_value,
|
9101 - | expected.json_value,
|
9102 - | "Unexpected value for `json_value`"
|
9103 - | );
|
9104 - | ::pretty_assertions::assert_eq!(
|
9105 - | input.list_of_lists,
|
9106 - | expected.list_of_lists,
|
9107 - | "Unexpected value for `list_of_lists`"
|
9108 - | );
|
9109 - | ::pretty_assertions::assert_eq!(
|
9110 - | input.list_of_maps_of_strings,
|
9111 - | expected.list_of_maps_of_strings,
|
9112 - | "Unexpected value for `list_of_maps_of_strings`"
|
9113 - | );
|
9114 - | ::pretty_assertions::assert_eq!(
|
9115 - | input.list_of_strings,
|
9116 - | expected.list_of_strings,
|
9117 - | "Unexpected value for `list_of_strings`"
|
9118 - | );
|
9119 - | ::pretty_assertions::assert_eq!(
|
9120 - | input.list_of_structs,
|
9121 - | expected.list_of_structs,
|
9122 - | "Unexpected value for `list_of_structs`"
|
9123 - | );
|
9124 - | ::pretty_assertions::assert_eq!(
|
9125 - | input.long,
|
9126 - | expected.long,
|
9127 - | "Unexpected value for `long`"
|
9128 - | );
|
9129 - | ::pretty_assertions::assert_eq!(
|
9130 - | input.map_of_lists_of_strings,
|
9131 - | expected.map_of_lists_of_strings,
|
9132 - | "Unexpected value for `map_of_lists_of_strings`"
|
9133 - | );
|
9134 - | ::pretty_assertions::assert_eq!(
|
9135 - | input.map_of_maps,
|
9136 - | expected.map_of_maps,
|
9137 - | "Unexpected value for `map_of_maps`"
|
9138 - | );
|
9139 - | ::pretty_assertions::assert_eq!(
|
9140 - | input.map_of_strings,
|
9141 - | expected.map_of_strings,
|
9142 - | "Unexpected value for `map_of_strings`"
|
9143 - | );
|
9144 - | ::pretty_assertions::assert_eq!(
|
9145 - | input.map_of_structs,
|
9146 - | expected.map_of_structs,
|
9147 - | "Unexpected value for `map_of_structs`"
|
9148 - | );
|
9149 - | ::pretty_assertions::assert_eq!(
|
9150 - | input.recursive_list,
|
9151 - | expected.recursive_list,
|
9152 - | "Unexpected value for `recursive_list`"
|
9153 - | );
|
9154 - | ::pretty_assertions::assert_eq!(
|
9155 - | input.recursive_map,
|
9156 - | expected.recursive_map,
|
9157 - | "Unexpected value for `recursive_map`"
|
9158 - | );
|
9159 - | ::pretty_assertions::assert_eq!(
|
9160 - | input.recursive_struct,
|
9161 - | expected.recursive_struct,
|
9162 - | "Unexpected value for `recursive_struct`"
|
9163 - | );
|
9164 - | ::pretty_assertions::assert_eq!(
|
9165 - | input.simple_struct,
|
9166 - | expected.simple_struct,
|
9167 - | "Unexpected value for `simple_struct`"
|
9168 - | );
|
9169 - | ::pretty_assertions::assert_eq!(
|
9170 - | input.string,
|
9171 - | expected.string,
|
9172 - | "Unexpected value for `string`"
|
9173 - | );
|
9174 - | ::pretty_assertions::assert_eq!(
|
9175 - | input.struct_with_json_name,
|
9176 - | expected.struct_with_json_name,
|
9177 - | "Unexpected value for `struct_with_json_name`"
|
9178 - | );
|
9179 - | ::pretty_assertions::assert_eq!(
|
9180 - | input.timestamp,
|
9181 - | expected.timestamp,
|
9182 - | "Unexpected value for `timestamp`"
|
9183 - | );
|
9184 - | ::pretty_assertions::assert_eq!(
|
9185 - | input.unix_timestamp,
|
9186 - | expected.unix_timestamp,
|
9187 - | "Unexpected value for `unix_timestamp`"
|
9188 - | );
|
9189 - | let output = crate::output::KitchenSinkOperationOutput {
|
9190 - | blob: ::std::option::Option::None,
|
9191 - | boolean: ::std::option::Option::None,
|
9192 - | double: ::std::option::Option::None,
|
9193 - | empty_struct: ::std::option::Option::None,
|
9194 - | float: ::std::option::Option::None,
|
9195 - | httpdate_timestamp: ::std::option::Option::None,
|
9196 - | integer: ::std::option::Option::None,
|
9197 - | iso8601_timestamp: ::std::option::Option::None,
|
9198 - | json_value: ::std::option::Option::None,
|
9199 - | list_of_lists: ::std::option::Option::None,
|
9200 - | list_of_maps_of_strings: ::std::option::Option::None,
|
9201 - | list_of_strings: ::std::option::Option::None,
|
9202 - | list_of_structs: ::std::option::Option::None,
|
9203 - | long: ::std::option::Option::None,
|
9204 - | map_of_lists_of_strings: ::std::option::Option::None,
|
9205 - | map_of_maps: ::std::option::Option::None,
|
9206 - | map_of_strings: ::std::option::Option::None,
|
9207 - | map_of_structs: ::std::option::Option::None,
|
9208 - | recursive_list: ::std::option::Option::None,
|
9209 - | recursive_map: ::std::option::Option::None,
|
9210 - | recursive_struct: ::std::option::Option::None,
|
9211 - | simple_struct: ::std::option::Option::None,
|
9212 - | string: ::std::option::Option::None,
|
9213 - | struct_with_json_name: ::std::option::Option::None,
|
9214 - | timestamp: ::std::option::Option::None,
|
9215 - | unix_timestamp: ::std::option::Option::None,
|
9216 - | };
|
9217 - | Ok(output)
|
9218 - | };
|
9219 - | sender.send(()).await.expect("receiver dropped early");
|
9220 - | result
|
9221 - | }
|
9222 - | })
|
9223 - | .build_unchecked();
|
9224 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9225 - | .await
|
9226 - | .expect("unable to make an HTTP request");
|
9227 - | assert!(
|
9228 - | receiver.recv().await.is_some(),
|
9229 - | "we expected operation handler to be invoked but it was not entered"
|
9230 - | );
|
9231 - | }
|
9232 - |
|
9233 - | /// Serializes map of recursive structure shapes
|
9234 - | /// Test ID: serializes_map_of_recursive_structure_shapes
|
9235 - | #[::tokio::test]
|
9236 - | #[::tracing_test::traced_test]
|
9237 - | async fn serializes_map_of_recursive_structure_shapes_request() {
|
9238 - | #[allow(unused_mut)]
|
9239 - | let mut http_request = ::http_1x::Request::builder()
|
9240 - | .uri("/")
|
9241 - | .method("POST")
|
9242 - | .header("Content-Type", "application/x-amz-json-1.1")
|
9243 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
9244 - | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
9245 - | ::bytes::Bytes::copy_from_slice(
|
9246 - | &::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"))
|
9247 - | )
|
9248 - | ))).unwrap();
|
9249 - | #[allow(unused_mut)]
|
9250 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9251 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
9252 - | let service = crate::service::JsonProtocol::builder::<
|
9253 - | ::aws_smithy_http_server::body::BoxBody,
|
9254 - | _,
|
9255 - | _,
|
9256 - | _,
|
9257 - | >(config)
|
9258 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
9259 - | let sender = sender.clone();
|
9260 - | async move {
|
9261 - | let result = {
|
9262 - | use ::aws_smithy_protocol_test::FloatEquals;
|
9263 - | let expected = crate::input::KitchenSinkOperationInput {
|
9264 - | recursive_map: ::std::option::Option::Some({
|
9265 - | let mut ret = ::std::collections::HashMap::new();
|
9266 - | ret.insert(
|
9267 - | "key1".to_owned(),
|
9268 - | crate::model::KitchenSink {
|
9269 - | recursive_map: ::std::option::Option::Some({
|
9270 - | let mut ret = ::std::collections::HashMap::new();
|
9271 - | ret.insert(
|
9272 - | "key2".to_owned(),
|
9273 - | crate::model::KitchenSink {
|
9274 - | recursive_map: ::std::option::Option::Some({
|
9275 - | let mut ret =
|
9276 - | ::std::collections::HashMap::new();
|
9277 - | ret.insert(
|
9278 - | "key3".to_owned(),
|
9279 - | crate::model::KitchenSink {
|
9280 - | boolean: ::std::option::Option::Some(
|
9281 - | false,
|
9282 - | ),
|
9283 - | blob: ::std::option::Option::None,
|
9284 - | double: ::std::option::Option::None,
|
9285 - | empty_struct:
|
9286 - | ::std::option::Option::None,
|
9287 - | float: ::std::option::Option::None,
|
9288 - | httpdate_timestamp:
|
9289 - | ::std::option::Option::None,
|
9290 - | integer: ::std::option::Option::None,
|
9291 - | iso8601_timestamp:
|
9292 - | ::std::option::Option::None,
|
9293 - | json_value: ::std::option::Option::None,
|
9294 - | list_of_lists:
|
9295 - | ::std::option::Option::None,
|
9296 - | list_of_maps_of_strings:
|
9297 - | ::std::option::Option::None,
|
9298 - | list_of_strings:
|
9299 - | ::std::option::Option::None,
|
9300 - | list_of_structs:
|
9301 - | ::std::option::Option::None,
|
9302 - | long: ::std::option::Option::None,
|
9303 - | map_of_lists_of_strings:
|
9304 - | ::std::option::Option::None,
|
9305 - | map_of_maps:
|
9306 - | ::std::option::Option::None,
|
9307 - | map_of_strings:
|
9308 - | ::std::option::Option::None,
|
9309 - | map_of_structs:
|
9310 - | ::std::option::Option::None,
|
9311 - | recursive_list:
|
9312 - | ::std::option::Option::None,
|
9313 - | recursive_map:
|
9314 - | ::std::option::Option::None,
|
9315 - | recursive_struct:
|
9316 - | ::std::option::Option::None,
|
9317 - | simple_struct:
|
9318 - | ::std::option::Option::None,
|
9319 - | string: ::std::option::Option::None,
|
9320 - | struct_with_json_name:
|
9321 - | ::std::option::Option::None,
|
9322 - | timestamp: ::std::option::Option::None,
|
9323 - | unix_timestamp:
|
9324 - | ::std::option::Option::None,
|
9325 - | },
|
9326 - | );
|
9327 - | ret
|
9328 - | }),
|
9329 - | blob: ::std::option::Option::None,
|
9330 - | boolean: ::std::option::Option::None,
|
9331 - | double: ::std::option::Option::None,
|
9332 - | empty_struct: ::std::option::Option::None,
|
9333 - | float: ::std::option::Option::None,
|
9334 - | httpdate_timestamp: ::std::option::Option::None,
|
9335 - | integer: ::std::option::Option::None,
|
9336 - | iso8601_timestamp: ::std::option::Option::None,
|
9337 - | json_value: ::std::option::Option::None,
|
9338 - | list_of_lists: ::std::option::Option::None,
|
9339 - | list_of_maps_of_strings:
|
9340 - | ::std::option::Option::None,
|
9341 - | list_of_strings: ::std::option::Option::None,
|
9342 - | list_of_structs: ::std::option::Option::None,
|
9343 - | long: ::std::option::Option::None,
|
9344 - | map_of_lists_of_strings:
|
9345 - | ::std::option::Option::None,
|
9346 - | map_of_maps: ::std::option::Option::None,
|
9347 - | map_of_strings: ::std::option::Option::None,
|
9348 - | map_of_structs: ::std::option::Option::None,
|
9349 - | recursive_list: ::std::option::Option::None,
|
9350 - | recursive_struct: ::std::option::Option::None,
|
9351 - | simple_struct: ::std::option::Option::None,
|
9352 - | string: ::std::option::Option::None,
|
9353 - | struct_with_json_name: ::std::option::Option::None,
|
9354 - | timestamp: ::std::option::Option::None,
|
9355 - | unix_timestamp: ::std::option::Option::None,
|
9356 - | },
|
9357 - | );
|
9358 - | ret
|
9359 - | }),
|
9360 - | blob: ::std::option::Option::None,
|
9361 - | boolean: ::std::option::Option::None,
|
9362 - | double: ::std::option::Option::None,
|
9363 - | empty_struct: ::std::option::Option::None,
|
9364 - | float: ::std::option::Option::None,
|
9365 - | httpdate_timestamp: ::std::option::Option::None,
|
9366 - | integer: ::std::option::Option::None,
|
9367 - | iso8601_timestamp: ::std::option::Option::None,
|
9368 - | json_value: ::std::option::Option::None,
|
9369 - | list_of_lists: ::std::option::Option::None,
|
9370 - | list_of_maps_of_strings: ::std::option::Option::None,
|
9371 - | list_of_strings: ::std::option::Option::None,
|
9372 - | list_of_structs: ::std::option::Option::None,
|
9373 - | long: ::std::option::Option::None,
|
9374 - | map_of_lists_of_strings: ::std::option::Option::None,
|
9375 - | map_of_maps: ::std::option::Option::None,
|
9376 - | map_of_strings: ::std::option::Option::None,
|
9377 - | map_of_structs: ::std::option::Option::None,
|
9378 - | recursive_list: ::std::option::Option::None,
|
9379 - | recursive_struct: ::std::option::Option::None,
|
9380 - | simple_struct: ::std::option::Option::None,
|
9381 - | string: ::std::option::Option::None,
|
9382 - | struct_with_json_name: ::std::option::Option::None,
|
9383 - | timestamp: ::std::option::Option::None,
|
9384 - | unix_timestamp: ::std::option::Option::None,
|
9385 - | },
|
9386 - | );
|
9387 - | ret
|
9388 - | }),
|
9389 - | blob: ::std::option::Option::None,
|
9390 - | boolean: ::std::option::Option::None,
|
9391 - | double: ::std::option::Option::None,
|
9392 - | empty_struct: ::std::option::Option::None,
|
9393 - | float: ::std::option::Option::None,
|
9394 - | httpdate_timestamp: ::std::option::Option::None,
|
9395 - | integer: ::std::option::Option::None,
|
9396 - | iso8601_timestamp: ::std::option::Option::None,
|
9397 - | json_value: ::std::option::Option::None,
|
9398 - | list_of_lists: ::std::option::Option::None,
|
9399 - | list_of_maps_of_strings: ::std::option::Option::None,
|
9400 - | list_of_strings: ::std::option::Option::None,
|
9401 - | list_of_structs: ::std::option::Option::None,
|
9402 - | long: ::std::option::Option::None,
|
9403 - | map_of_lists_of_strings: ::std::option::Option::None,
|
9404 - | map_of_maps: ::std::option::Option::None,
|
9405 - | map_of_strings: ::std::option::Option::None,
|
9406 - | map_of_structs: ::std::option::Option::None,
|
9407 - | recursive_list: ::std::option::Option::None,
|
9408 - | recursive_struct: ::std::option::Option::None,
|
9409 - | simple_struct: ::std::option::Option::None,
|
9410 - | string: ::std::option::Option::None,
|
9411 - | struct_with_json_name: ::std::option::Option::None,
|
9412 - | timestamp: ::std::option::Option::None,
|
9413 - | unix_timestamp: ::std::option::Option::None,
|
9414 - | };
|
9415 - | ::pretty_assertions::assert_eq!(
|
9416 - | input.blob,
|
9417 - | expected.blob,
|
9418 - | "Unexpected value for `blob`"
|
9419 - | );
|
9420 - | ::pretty_assertions::assert_eq!(
|
9421 - | input.boolean,
|
9422 - | expected.boolean,
|
9423 - | "Unexpected value for `boolean`"
|
9424 - | );
|
9425 - | assert!(
|
9426 - | input.double.float_equals(&expected.double),
|
9427 - | "Unexpected value for `double` {:?} vs. {:?}",
|
9428 - | expected.double,
|
9429 - | input.double
|
9430 - | );
|
9431 - | ::pretty_assertions::assert_eq!(
|
9432 - | input.empty_struct,
|
9433 - | expected.empty_struct,
|
9434 - | "Unexpected value for `empty_struct`"
|
9435 - | );
|
9436 - | assert!(
|
9437 - | input.float.float_equals(&expected.float),
|
9438 - | "Unexpected value for `float` {:?} vs. {:?}",
|
9439 - | expected.float,
|
9440 - | input.float
|
9441 - | );
|
9442 - | ::pretty_assertions::assert_eq!(
|
9443 - | input.httpdate_timestamp,
|
9444 - | expected.httpdate_timestamp,
|
9445 - | "Unexpected value for `httpdate_timestamp`"
|
9446 - | );
|
9447 - | ::pretty_assertions::assert_eq!(
|
9448 - | input.integer,
|
9449 - | expected.integer,
|
9450 - | "Unexpected value for `integer`"
|
9451 - | );
|
9452 - | ::pretty_assertions::assert_eq!(
|
9453 - | input.iso8601_timestamp,
|
9454 - | expected.iso8601_timestamp,
|
9455 - | "Unexpected value for `iso8601_timestamp`"
|
9456 - | );
|
9457 - | ::pretty_assertions::assert_eq!(
|
9458 - | input.json_value,
|
9459 - | expected.json_value,
|
9460 - | "Unexpected value for `json_value`"
|
9461 - | );
|
9462 - | ::pretty_assertions::assert_eq!(
|
9463 - | input.list_of_lists,
|
9464 - | expected.list_of_lists,
|
9465 - | "Unexpected value for `list_of_lists`"
|
9466 - | );
|
9467 - | ::pretty_assertions::assert_eq!(
|
9468 - | input.list_of_maps_of_strings,
|
9469 - | expected.list_of_maps_of_strings,
|
9470 - | "Unexpected value for `list_of_maps_of_strings`"
|
9471 - | );
|
9472 - | ::pretty_assertions::assert_eq!(
|
9473 - | input.list_of_strings,
|
9474 - | expected.list_of_strings,
|
9475 - | "Unexpected value for `list_of_strings`"
|
9476 - | );
|
9477 - | ::pretty_assertions::assert_eq!(
|
9478 - | input.list_of_structs,
|
9479 - | expected.list_of_structs,
|
9480 - | "Unexpected value for `list_of_structs`"
|
9481 - | );
|
9482 - | ::pretty_assertions::assert_eq!(
|
9483 - | input.long,
|
9484 - | expected.long,
|
9485 - | "Unexpected value for `long`"
|
9486 - | );
|
9487 - | ::pretty_assertions::assert_eq!(
|
9488 - | input.map_of_lists_of_strings,
|
9489 - | expected.map_of_lists_of_strings,
|
9490 - | "Unexpected value for `map_of_lists_of_strings`"
|
9491 - | );
|
9492 - | ::pretty_assertions::assert_eq!(
|
9493 - | input.map_of_maps,
|
9494 - | expected.map_of_maps,
|
9495 - | "Unexpected value for `map_of_maps`"
|
9496 - | );
|
9497 - | ::pretty_assertions::assert_eq!(
|
9498 - | input.map_of_strings,
|
9499 - | expected.map_of_strings,
|
9500 - | "Unexpected value for `map_of_strings`"
|
9501 - | );
|
9502 - | ::pretty_assertions::assert_eq!(
|
9503 - | input.map_of_structs,
|
9504 - | expected.map_of_structs,
|
9505 - | "Unexpected value for `map_of_structs`"
|
9506 - | );
|
9507 - | ::pretty_assertions::assert_eq!(
|
9508 - | input.recursive_list,
|
9509 - | expected.recursive_list,
|
9510 - | "Unexpected value for `recursive_list`"
|
9511 - | );
|
9512 - | ::pretty_assertions::assert_eq!(
|
9513 - | input.recursive_map,
|
9514 - | expected.recursive_map,
|
9515 - | "Unexpected value for `recursive_map`"
|
9516 - | );
|
9517 - | ::pretty_assertions::assert_eq!(
|
9518 - | input.recursive_struct,
|
9519 - | expected.recursive_struct,
|
9520 - | "Unexpected value for `recursive_struct`"
|
9521 - | );
|
9522 - | ::pretty_assertions::assert_eq!(
|
9523 - | input.simple_struct,
|
9524 - | expected.simple_struct,
|
9525 - | "Unexpected value for `simple_struct`"
|
9526 - | );
|
9527 - | ::pretty_assertions::assert_eq!(
|
9528 - | input.string,
|
9529 - | expected.string,
|
9530 - | "Unexpected value for `string`"
|
9531 - | );
|
9532 - | ::pretty_assertions::assert_eq!(
|
9533 - | input.struct_with_json_name,
|
9534 - | expected.struct_with_json_name,
|
9535 - | "Unexpected value for `struct_with_json_name`"
|
9536 - | );
|
9537 - | ::pretty_assertions::assert_eq!(
|
9538 - | input.timestamp,
|
9539 - | expected.timestamp,
|
9540 - | "Unexpected value for `timestamp`"
|
9541 - | );
|
9542 - | ::pretty_assertions::assert_eq!(
|
9543 - | input.unix_timestamp,
|
9544 - | expected.unix_timestamp,
|
9545 - | "Unexpected value for `unix_timestamp`"
|
9546 - | );
|
9547 - | let output = crate::output::KitchenSinkOperationOutput {
|
9548 - | blob: ::std::option::Option::None,
|
9549 - | boolean: ::std::option::Option::None,
|
9550 - | double: ::std::option::Option::None,
|
9551 - | empty_struct: ::std::option::Option::None,
|
9552 - | float: ::std::option::Option::None,
|
9553 - | httpdate_timestamp: ::std::option::Option::None,
|
9554 - | integer: ::std::option::Option::None,
|
9555 - | iso8601_timestamp: ::std::option::Option::None,
|
9556 - | json_value: ::std::option::Option::None,
|
9557 - | list_of_lists: ::std::option::Option::None,
|
9558 - | list_of_maps_of_strings: ::std::option::Option::None,
|
9559 - | list_of_strings: ::std::option::Option::None,
|
9560 - | list_of_structs: ::std::option::Option::None,
|
9561 - | long: ::std::option::Option::None,
|
9562 - | map_of_lists_of_strings: ::std::option::Option::None,
|
9563 - | map_of_maps: ::std::option::Option::None,
|
9564 - | map_of_strings: ::std::option::Option::None,
|
9565 - | map_of_structs: ::std::option::Option::None,
|
9566 - | recursive_list: ::std::option::Option::None,
|
9567 - | recursive_map: ::std::option::Option::None,
|
9568 - | recursive_struct: ::std::option::Option::None,
|
9569 - | simple_struct: ::std::option::Option::None,
|
9570 - | string: ::std::option::Option::None,
|
9571 - | struct_with_json_name: ::std::option::Option::None,
|
9572 - | timestamp: ::std::option::Option::None,
|
9573 - | unix_timestamp: ::std::option::Option::None,
|
9574 - | };
|
9575 - | Ok(output)
|
9576 - | };
|
9577 - | sender.send(()).await.expect("receiver dropped early");
|
9578 - | result
|
9579 - | }
|
9580 - | })
|
9581 - | .build_unchecked();
|
9582 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7601 + | async fn parses_integer_shapes_response() {
|
7602 + | let output = crate::output::KitchenSinkOperationOutput {
|
7603 + | integer: ::std::option::Option::Some(1234),
|
7604 + | blob: ::std::option::Option::None,
|
7605 + | boolean: ::std::option::Option::None,
|
7606 + | double: ::std::option::Option::None,
|
7607 + | empty_struct: ::std::option::Option::None,
|
7608 + | float: ::std::option::Option::None,
|
7609 + | httpdate_timestamp: ::std::option::Option::None,
|
7610 + | iso8601_timestamp: ::std::option::Option::None,
|
7611 + | json_value: ::std::option::Option::None,
|
7612 + | list_of_lists: ::std::option::Option::None,
|
7613 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7614 + | list_of_strings: ::std::option::Option::None,
|
7615 + | list_of_structs: ::std::option::Option::None,
|
7616 + | long: ::std::option::Option::None,
|
7617 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7618 + | map_of_maps: ::std::option::Option::None,
|
7619 + | map_of_strings: ::std::option::Option::None,
|
7620 + | map_of_structs: ::std::option::Option::None,
|
7621 + | recursive_list: ::std::option::Option::None,
|
7622 + | recursive_map: ::std::option::Option::None,
|
7623 + | recursive_struct: ::std::option::Option::None,
|
7624 + | simple_struct: ::std::option::Option::None,
|
7625 + | string: ::std::option::Option::None,
|
7626 + | struct_with_json_name: ::std::option::Option::None,
|
7627 + | timestamp: ::std::option::Option::None,
|
7628 + | unix_timestamp: ::std::option::Option::None,
|
7629 + | };
|
7630 + | use ::aws_smithy_http_server::response::IntoResponse;
|
7631 + | let http_response = output.into_response();
|
7632 + | ::pretty_assertions::assert_eq!(
|
7633 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
7634 + | http_response.status()
|
7635 + | );
|
7636 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
7637 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7638 + | http_response.headers(),
|
7639 + | expected_headers,
|
7640 + | ));
|
7641 + | use ::http_body_util::BodyExt;
|
7642 + | let body = http_response
|
7643 + | .into_body()
|
7644 + | .collect()
|
7645 + | .await
|
7646 + | .expect("unable to collect body")
|
7647 + | .to_bytes();
|
7648 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
7649 + | &body,
|
7650 + | "{\"Integer\":1234}",
|
7651 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
7652 + | ));
|
7653 + | }
|
7654 + |
|
7655 + | /// Parses long shapes
|
7656 + | /// Test ID: parses_long_shapes
|
7657 + | #[::tokio::test]
|
7658 + | #[::tracing_test::traced_test]
|
7659 + | async fn parses_long_shapes_response() {
|
7660 + | let output = crate::output::KitchenSinkOperationOutput {
|
7661 + | long: ::std::option::Option::Some(1234567890123456789),
|
7662 + | blob: ::std::option::Option::None,
|
7663 + | boolean: ::std::option::Option::None,
|
7664 + | double: ::std::option::Option::None,
|
7665 + | empty_struct: ::std::option::Option::None,
|
7666 + | float: ::std::option::Option::None,
|
7667 + | httpdate_timestamp: ::std::option::Option::None,
|
7668 + | integer: ::std::option::Option::None,
|
7669 + | iso8601_timestamp: ::std::option::Option::None,
|
7670 + | json_value: ::std::option::Option::None,
|
7671 + | list_of_lists: ::std::option::Option::None,
|
7672 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7673 + | list_of_strings: ::std::option::Option::None,
|
7674 + | list_of_structs: ::std::option::Option::None,
|
7675 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7676 + | map_of_maps: ::std::option::Option::None,
|
7677 + | map_of_strings: ::std::option::Option::None,
|
7678 + | map_of_structs: ::std::option::Option::None,
|
7679 + | recursive_list: ::std::option::Option::None,
|
7680 + | recursive_map: ::std::option::Option::None,
|
7681 + | recursive_struct: ::std::option::Option::None,
|
7682 + | simple_struct: ::std::option::Option::None,
|
7683 + | string: ::std::option::Option::None,
|
7684 + | struct_with_json_name: ::std::option::Option::None,
|
7685 + | timestamp: ::std::option::Option::None,
|
7686 + | unix_timestamp: ::std::option::Option::None,
|
7687 + | };
|
7688 + | use ::aws_smithy_http_server::response::IntoResponse;
|
7689 + | let http_response = output.into_response();
|
7690 + | ::pretty_assertions::assert_eq!(
|
7691 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
7692 + | http_response.status()
|
7693 + | );
|
7694 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
7695 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7696 + | http_response.headers(),
|
7697 + | expected_headers,
|
7698 + | ));
|
7699 + | use ::http_body_util::BodyExt;
|
7700 + | let body = http_response
|
7701 + | .into_body()
|
7702 + | .collect()
|
7703 + | .await
|
7704 + | .expect("unable to collect body")
|
7705 + | .to_bytes();
|
7706 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
7707 + | &body,
|
7708 + | "{\"Long\":1234567890123456789}",
|
7709 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
7710 + | ));
|
7711 + | }
|
7712 + |
|
7713 + | /// Parses float shapes
|
7714 + | /// Test ID: parses_float_shapes
|
7715 + | #[::tokio::test]
|
7716 + | #[::tracing_test::traced_test]
|
7717 + | async fn parses_float_shapes_response() {
|
7718 + | let output = crate::output::KitchenSinkOperationOutput {
|
7719 + | float: ::std::option::Option::Some(1234.5_f32),
|
7720 + | blob: ::std::option::Option::None,
|
7721 + | boolean: ::std::option::Option::None,
|
7722 + | double: ::std::option::Option::None,
|
7723 + | empty_struct: ::std::option::Option::None,
|
7724 + | httpdate_timestamp: ::std::option::Option::None,
|
7725 + | integer: ::std::option::Option::None,
|
7726 + | iso8601_timestamp: ::std::option::Option::None,
|
7727 + | json_value: ::std::option::Option::None,
|
7728 + | list_of_lists: ::std::option::Option::None,
|
7729 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7730 + | list_of_strings: ::std::option::Option::None,
|
7731 + | list_of_structs: ::std::option::Option::None,
|
7732 + | long: ::std::option::Option::None,
|
7733 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7734 + | map_of_maps: ::std::option::Option::None,
|
7735 + | map_of_strings: ::std::option::Option::None,
|
7736 + | map_of_structs: ::std::option::Option::None,
|
7737 + | recursive_list: ::std::option::Option::None,
|
7738 + | recursive_map: ::std::option::Option::None,
|
7739 + | recursive_struct: ::std::option::Option::None,
|
7740 + | simple_struct: ::std::option::Option::None,
|
7741 + | string: ::std::option::Option::None,
|
7742 + | struct_with_json_name: ::std::option::Option::None,
|
7743 + | timestamp: ::std::option::Option::None,
|
7744 + | unix_timestamp: ::std::option::Option::None,
|
7745 + | };
|
7746 + | use ::aws_smithy_http_server::response::IntoResponse;
|
7747 + | let http_response = output.into_response();
|
7748 + | ::pretty_assertions::assert_eq!(
|
7749 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
7750 + | http_response.status()
|
7751 + | );
|
7752 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
7753 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7754 + | http_response.headers(),
|
7755 + | expected_headers,
|
7756 + | ));
|
7757 + | use ::http_body_util::BodyExt;
|
7758 + | let body = http_response
|
7759 + | .into_body()
|
7760 + | .collect()
|
7761 + | .await
|
7762 + | .expect("unable to collect body")
|
7763 + | .to_bytes();
|
7764 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
7765 + | &body,
|
7766 + | "{\"Float\":1234.5}",
|
7767 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
7768 + | ));
|
7769 + | }
|
7770 + |
|
7771 + | /// Parses double shapes
|
7772 + | /// Test ID: parses_double_shapes
|
7773 + | #[::tokio::test]
|
7774 + | #[::tracing_test::traced_test]
|
7775 + | async fn parses_double_shapes_response() {
|
7776 + | let output = crate::output::KitchenSinkOperationOutput {
|
7777 + | double: ::std::option::Option::Some(1.2345678912345679E8_f64),
|
7778 + | blob: ::std::option::Option::None,
|
7779 + | boolean: ::std::option::Option::None,
|
7780 + | empty_struct: ::std::option::Option::None,
|
7781 + | float: ::std::option::Option::None,
|
7782 + | httpdate_timestamp: ::std::option::Option::None,
|
7783 + | integer: ::std::option::Option::None,
|
7784 + | iso8601_timestamp: ::std::option::Option::None,
|
7785 + | json_value: ::std::option::Option::None,
|
7786 + | list_of_lists: ::std::option::Option::None,
|
7787 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7788 + | list_of_strings: ::std::option::Option::None,
|
7789 + | list_of_structs: ::std::option::Option::None,
|
7790 + | long: ::std::option::Option::None,
|
7791 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7792 + | map_of_maps: ::std::option::Option::None,
|
7793 + | map_of_strings: ::std::option::Option::None,
|
7794 + | map_of_structs: ::std::option::Option::None,
|
7795 + | recursive_list: ::std::option::Option::None,
|
7796 + | recursive_map: ::std::option::Option::None,
|
7797 + | recursive_struct: ::std::option::Option::None,
|
7798 + | simple_struct: ::std::option::Option::None,
|
7799 + | string: ::std::option::Option::None,
|
7800 + | struct_with_json_name: ::std::option::Option::None,
|
7801 + | timestamp: ::std::option::Option::None,
|
7802 + | unix_timestamp: ::std::option::Option::None,
|
7803 + | };
|
7804 + | use ::aws_smithy_http_server::response::IntoResponse;
|
7805 + | let http_response = output.into_response();
|
7806 + | ::pretty_assertions::assert_eq!(
|
7807 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
7808 + | http_response.status()
|
7809 + | );
|
7810 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
7811 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7812 + | http_response.headers(),
|
7813 + | expected_headers,
|
7814 + | ));
|
7815 + | use ::http_body_util::BodyExt;
|
7816 + | let body = http_response
|
7817 + | .into_body()
|
7818 + | .collect()
|
7819 + | .await
|
7820 + | .expect("unable to collect body")
|
7821 + | .to_bytes();
|
7822 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
7823 + | &body,
|
7824 + | "{\"Double\":123456789.12345679}",
|
7825 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
7826 + | ));
|
7827 + | }
|
7828 + |
|
7829 + | /// Parses boolean shapes (true)
|
7830 + | /// Test ID: parses_boolean_shapes_true
|
7831 + | #[::tokio::test]
|
7832 + | #[::tracing_test::traced_test]
|
7833 + | async fn parses_boolean_shapes_true_response() {
|
7834 + | let output = crate::output::KitchenSinkOperationOutput {
|
7835 + | boolean: ::std::option::Option::Some(true),
|
7836 + | blob: ::std::option::Option::None,
|
7837 + | double: ::std::option::Option::None,
|
7838 + | empty_struct: ::std::option::Option::None,
|
7839 + | float: ::std::option::Option::None,
|
7840 + | httpdate_timestamp: ::std::option::Option::None,
|
7841 + | integer: ::std::option::Option::None,
|
7842 + | iso8601_timestamp: ::std::option::Option::None,
|
7843 + | json_value: ::std::option::Option::None,
|
7844 + | list_of_lists: ::std::option::Option::None,
|
7845 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7846 + | list_of_strings: ::std::option::Option::None,
|
7847 + | list_of_structs: ::std::option::Option::None,
|
7848 + | long: ::std::option::Option::None,
|
7849 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7850 + | map_of_maps: ::std::option::Option::None,
|
7851 + | map_of_strings: ::std::option::Option::None,
|
7852 + | map_of_structs: ::std::option::Option::None,
|
7853 + | recursive_list: ::std::option::Option::None,
|
7854 + | recursive_map: ::std::option::Option::None,
|
7855 + | recursive_struct: ::std::option::Option::None,
|
7856 + | simple_struct: ::std::option::Option::None,
|
7857 + | string: ::std::option::Option::None,
|
7858 + | struct_with_json_name: ::std::option::Option::None,
|
7859 + | timestamp: ::std::option::Option::None,
|
7860 + | unix_timestamp: ::std::option::Option::None,
|
7861 + | };
|
7862 + | use ::aws_smithy_http_server::response::IntoResponse;
|
7863 + | let http_response = output.into_response();
|
7864 + | ::pretty_assertions::assert_eq!(
|
7865 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
7866 + | http_response.status()
|
7867 + | );
|
7868 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
7869 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7870 + | http_response.headers(),
|
7871 + | expected_headers,
|
7872 + | ));
|
7873 + | use ::http_body_util::BodyExt;
|
7874 + | let body = http_response
|
7875 + | .into_body()
|
7876 + | .collect()
|
9583 7877 | .await
|
9584 - | .expect("unable to make an HTTP request");
|
9585 - | assert!(
|
9586 - | receiver.recv().await.is_some(),
|
9587 - | "we expected operation handler to be invoked but it was not entered"
|
7878 + | .expect("unable to collect body")
|
7879 + | .to_bytes();
|
7880 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
7881 + | &body,
|
7882 + | "{\"Boolean\":true}",
|
7883 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
7884 + | ));
|
7885 + | }
|
7886 + |
|
7887 + | /// Parses boolean (false)
|
7888 + | /// Test ID: parses_boolean_false
|
7889 + | #[::tokio::test]
|
7890 + | #[::tracing_test::traced_test]
|
7891 + | async fn parses_boolean_false_response() {
|
7892 + | let output = crate::output::KitchenSinkOperationOutput {
|
7893 + | boolean: ::std::option::Option::Some(false),
|
7894 + | blob: ::std::option::Option::None,
|
7895 + | double: ::std::option::Option::None,
|
7896 + | empty_struct: ::std::option::Option::None,
|
7897 + | float: ::std::option::Option::None,
|
7898 + | httpdate_timestamp: ::std::option::Option::None,
|
7899 + | integer: ::std::option::Option::None,
|
7900 + | iso8601_timestamp: ::std::option::Option::None,
|
7901 + | json_value: ::std::option::Option::None,
|
7902 + | list_of_lists: ::std::option::Option::None,
|
7903 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7904 + | list_of_strings: ::std::option::Option::None,
|
7905 + | list_of_structs: ::std::option::Option::None,
|
7906 + | long: ::std::option::Option::None,
|
7907 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7908 + | map_of_maps: ::std::option::Option::None,
|
7909 + | map_of_strings: ::std::option::Option::None,
|
7910 + | map_of_structs: ::std::option::Option::None,
|
7911 + | recursive_list: ::std::option::Option::None,
|
7912 + | recursive_map: ::std::option::Option::None,
|
7913 + | recursive_struct: ::std::option::Option::None,
|
7914 + | simple_struct: ::std::option::Option::None,
|
7915 + | string: ::std::option::Option::None,
|
7916 + | struct_with_json_name: ::std::option::Option::None,
|
7917 + | timestamp: ::std::option::Option::None,
|
7918 + | unix_timestamp: ::std::option::Option::None,
|
7919 + | };
|
7920 + | use ::aws_smithy_http_server::response::IntoResponse;
|
7921 + | let http_response = output.into_response();
|
7922 + | ::pretty_assertions::assert_eq!(
|
7923 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
7924 + | http_response.status()
|
7925 + | );
|
7926 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
7927 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7928 + | http_response.headers(),
|
7929 + | expected_headers,
|
7930 + | ));
|
7931 + | use ::http_body_util::BodyExt;
|
7932 + | let body = http_response
|
7933 + | .into_body()
|
7934 + | .collect()
|
7935 + | .await
|
7936 + | .expect("unable to collect body")
|
7937 + | .to_bytes();
|
7938 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
7939 + | &body,
|
7940 + | "{\"Boolean\":false}",
|
7941 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
7942 + | ));
|
7943 + | }
|
7944 + |
|
7945 + | /// Parses blob shapes
|
7946 + | /// Test ID: parses_blob_shapes
|
7947 + | #[::tokio::test]
|
7948 + | #[::tracing_test::traced_test]
|
7949 + | async fn parses_blob_shapes_response() {
|
7950 + | let output = crate::output::KitchenSinkOperationOutput {
|
7951 + | blob: ::std::option::Option::Some(::aws_smithy_types::Blob::new("binary-value")),
|
7952 + | boolean: ::std::option::Option::None,
|
7953 + | double: ::std::option::Option::None,
|
7954 + | empty_struct: ::std::option::Option::None,
|
7955 + | float: ::std::option::Option::None,
|
7956 + | httpdate_timestamp: ::std::option::Option::None,
|
7957 + | integer: ::std::option::Option::None,
|
7958 + | iso8601_timestamp: ::std::option::Option::None,
|
7959 + | json_value: ::std::option::Option::None,
|
7960 + | list_of_lists: ::std::option::Option::None,
|
7961 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7962 + | list_of_strings: ::std::option::Option::None,
|
7963 + | list_of_structs: ::std::option::Option::None,
|
7964 + | long: ::std::option::Option::None,
|
7965 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7966 + | map_of_maps: ::std::option::Option::None,
|
7967 + | map_of_strings: ::std::option::Option::None,
|
7968 + | map_of_structs: ::std::option::Option::None,
|
7969 + | recursive_list: ::std::option::Option::None,
|
7970 + | recursive_map: ::std::option::Option::None,
|
7971 + | recursive_struct: ::std::option::Option::None,
|
7972 + | simple_struct: ::std::option::Option::None,
|
7973 + | string: ::std::option::Option::None,
|
7974 + | struct_with_json_name: ::std::option::Option::None,
|
7975 + | timestamp: ::std::option::Option::None,
|
7976 + | unix_timestamp: ::std::option::Option::None,
|
7977 + | };
|
7978 + | use ::aws_smithy_http_server::response::IntoResponse;
|
7979 + | let http_response = output.into_response();
|
7980 + | ::pretty_assertions::assert_eq!(
|
7981 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
7982 + | http_response.status()
|
7983 + | );
|
7984 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
7985 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7986 + | http_response.headers(),
|
7987 + | expected_headers,
|
7988 + | ));
|
7989 + | use ::http_body_util::BodyExt;
|
7990 + | let body = http_response
|
7991 + | .into_body()
|
7992 + | .collect()
|
7993 + | .await
|
7994 + | .expect("unable to collect body")
|
7995 + | .to_bytes();
|
7996 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
7997 + | &body,
|
7998 + | "{\"Blob\":\"YmluYXJ5LXZhbHVl\"}",
|
7999 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8000 + | ));
|
8001 + | }
|
8002 + |
|
8003 + | /// Parses timestamp shapes
|
8004 + | /// Test ID: parses_timestamp_shapes
|
8005 + | #[::tokio::test]
|
8006 + | #[::tracing_test::traced_test]
|
8007 + | async fn parses_timestamp_shapes_response() {
|
8008 + | let output = crate::output::KitchenSinkOperationOutput {
|
8009 + | timestamp: ::std::option::Option::Some(
|
8010 + | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
8011 + | ),
|
8012 + | blob: ::std::option::Option::None,
|
8013 + | boolean: ::std::option::Option::None,
|
8014 + | double: ::std::option::Option::None,
|
8015 + | empty_struct: ::std::option::Option::None,
|
8016 + | float: ::std::option::Option::None,
|
8017 + | httpdate_timestamp: ::std::option::Option::None,
|
8018 + | integer: ::std::option::Option::None,
|
8019 + | iso8601_timestamp: ::std::option::Option::None,
|
8020 + | json_value: ::std::option::Option::None,
|
8021 + | list_of_lists: ::std::option::Option::None,
|
8022 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8023 + | list_of_strings: ::std::option::Option::None,
|
8024 + | list_of_structs: ::std::option::Option::None,
|
8025 + | long: ::std::option::Option::None,
|
8026 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8027 + | map_of_maps: ::std::option::Option::None,
|
8028 + | map_of_strings: ::std::option::Option::None,
|
8029 + | map_of_structs: ::std::option::Option::None,
|
8030 + | recursive_list: ::std::option::Option::None,
|
8031 + | recursive_map: ::std::option::Option::None,
|
8032 + | recursive_struct: ::std::option::Option::None,
|
8033 + | simple_struct: ::std::option::Option::None,
|
8034 + | string: ::std::option::Option::None,
|
8035 + | struct_with_json_name: ::std::option::Option::None,
|
8036 + | unix_timestamp: ::std::option::Option::None,
|
8037 + | };
|
8038 + | use ::aws_smithy_http_server::response::IntoResponse;
|
8039 + | let http_response = output.into_response();
|
8040 + | ::pretty_assertions::assert_eq!(
|
8041 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8042 + | http_response.status()
|
8043 + | );
|
8044 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8045 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8046 + | http_response.headers(),
|
8047 + | expected_headers,
|
8048 + | ));
|
8049 + | use ::http_body_util::BodyExt;
|
8050 + | let body = http_response
|
8051 + | .into_body()
|
8052 + | .collect()
|
8053 + | .await
|
8054 + | .expect("unable to collect body")
|
8055 + | .to_bytes();
|
8056 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8057 + | &body,
|
8058 + | "{\"Timestamp\":946845296}",
|
8059 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8060 + | ));
|
8061 + | }
|
8062 + |
|
8063 + | /// Parses iso8601 timestamps
|
8064 + | /// Test ID: parses_iso8601_timestamps
|
8065 + | #[::tokio::test]
|
8066 + | #[::tracing_test::traced_test]
|
8067 + | async fn parses_iso8601_timestamps_response() {
|
8068 + | let output = crate::output::KitchenSinkOperationOutput {
|
8069 + | iso8601_timestamp: ::std::option::Option::Some(
|
8070 + | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
8071 + | ),
|
8072 + | blob: ::std::option::Option::None,
|
8073 + | boolean: ::std::option::Option::None,
|
8074 + | double: ::std::option::Option::None,
|
8075 + | empty_struct: ::std::option::Option::None,
|
8076 + | float: ::std::option::Option::None,
|
8077 + | httpdate_timestamp: ::std::option::Option::None,
|
8078 + | integer: ::std::option::Option::None,
|
8079 + | json_value: ::std::option::Option::None,
|
8080 + | list_of_lists: ::std::option::Option::None,
|
8081 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8082 + | list_of_strings: ::std::option::Option::None,
|
8083 + | list_of_structs: ::std::option::Option::None,
|
8084 + | long: ::std::option::Option::None,
|
8085 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8086 + | map_of_maps: ::std::option::Option::None,
|
8087 + | map_of_strings: ::std::option::Option::None,
|
8088 + | map_of_structs: ::std::option::Option::None,
|
8089 + | recursive_list: ::std::option::Option::None,
|
8090 + | recursive_map: ::std::option::Option::None,
|
8091 + | recursive_struct: ::std::option::Option::None,
|
8092 + | simple_struct: ::std::option::Option::None,
|
8093 + | string: ::std::option::Option::None,
|
8094 + | struct_with_json_name: ::std::option::Option::None,
|
8095 + | timestamp: ::std::option::Option::None,
|
8096 + | unix_timestamp: ::std::option::Option::None,
|
8097 + | };
|
8098 + | use ::aws_smithy_http_server::response::IntoResponse;
|
8099 + | let http_response = output.into_response();
|
8100 + | ::pretty_assertions::assert_eq!(
|
8101 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8102 + | http_response.status()
|
9588 8103 | );
|
8104 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8105 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8106 + | http_response.headers(),
|
8107 + | expected_headers,
|
8108 + | ));
|
8109 + | use ::http_body_util::BodyExt;
|
8110 + | let body = http_response
|
8111 + | .into_body()
|
8112 + | .collect()
|
8113 + | .await
|
8114 + | .expect("unable to collect body")
|
8115 + | .to_bytes();
|
8116 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8117 + | &body,
|
8118 + | "{\"Iso8601Timestamp\":\"2000-01-02T20:34:56Z\"}",
|
8119 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8120 + | ));
|
9589 8121 | }
|
9590 8122 |
|
9591 - | /// Serializes structure shapes
|
9592 - | /// Test ID: serializes_structure_shapes
|
8123 + | /// Parses httpdate timestamps
|
8124 + | /// Test ID: parses_httpdate_timestamps
|
9593 8125 | #[::tokio::test]
|
9594 8126 | #[::tracing_test::traced_test]
|
9595 - | async fn serializes_structure_shapes_request() {
|
9596 - | #[allow(unused_mut)]
|
9597 - | let mut http_request = ::http_1x::Request::builder()
|
9598 - | .uri("/")
|
9599 - | .method("POST")
|
9600 - | .header("Content-Type", "application/x-amz-json-1.1")
|
9601 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
9602 - | .body(::aws_smithy_http_server::body::boxed(
|
9603 - | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
9604 - | &::aws_smithy_protocol_test::decode_body_data(
|
9605 - | "{\"SimpleStruct\":{\"Value\":\"abc\"}}".as_bytes(),
|
9606 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9607 - | ),
|
9608 - | )),
|
9609 - | ))
|
9610 - | .unwrap();
|
9611 - | #[allow(unused_mut)]
|
9612 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9613 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
9614 - | let service = crate::service::JsonProtocol::builder::<
|
9615 - | ::aws_smithy_http_server::body::BoxBody,
|
9616 - | _,
|
9617 - | _,
|
9618 - | _,
|
9619 - | >(config)
|
9620 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
9621 - | let sender = sender.clone();
|
9622 - | async move {
|
9623 - | let result = {
|
9624 - | use ::aws_smithy_protocol_test::FloatEquals;
|
9625 - | let expected = crate::input::KitchenSinkOperationInput {
|
9626 - | simple_struct: ::std::option::Option::Some(crate::model::SimpleStruct {
|
9627 - | value: ::std::option::Option::Some("abc".to_owned()),
|
9628 - | }),
|
9629 - | blob: ::std::option::Option::None,
|
9630 - | boolean: ::std::option::Option::None,
|
9631 - | double: ::std::option::Option::None,
|
9632 - | empty_struct: ::std::option::Option::None,
|
9633 - | float: ::std::option::Option::None,
|
9634 - | httpdate_timestamp: ::std::option::Option::None,
|
9635 - | integer: ::std::option::Option::None,
|
9636 - | iso8601_timestamp: ::std::option::Option::None,
|
9637 - | json_value: ::std::option::Option::None,
|
9638 - | list_of_lists: ::std::option::Option::None,
|
9639 - | list_of_maps_of_strings: ::std::option::Option::None,
|
9640 - | list_of_strings: ::std::option::Option::None,
|
9641 - | list_of_structs: ::std::option::Option::None,
|
9642 - | long: ::std::option::Option::None,
|
9643 - | map_of_lists_of_strings: ::std::option::Option::None,
|
9644 - | map_of_maps: ::std::option::Option::None,
|
9645 - | map_of_strings: ::std::option::Option::None,
|
9646 - | map_of_structs: ::std::option::Option::None,
|
9647 - | recursive_list: ::std::option::Option::None,
|
9648 - | recursive_map: ::std::option::Option::None,
|
9649 - | recursive_struct: ::std::option::Option::None,
|
9650 - | string: ::std::option::Option::None,
|
9651 - | struct_with_json_name: ::std::option::Option::None,
|
9652 - | timestamp: ::std::option::Option::None,
|
9653 - | unix_timestamp: ::std::option::Option::None,
|
9654 - | };
|
9655 - | ::pretty_assertions::assert_eq!(
|
9656 - | input.blob,
|
9657 - | expected.blob,
|
9658 - | "Unexpected value for `blob`"
|
9659 - | );
|
9660 - | ::pretty_assertions::assert_eq!(
|
9661 - | input.boolean,
|
9662 - | expected.boolean,
|
9663 - | "Unexpected value for `boolean`"
|
9664 - | );
|
9665 - | assert!(
|
9666 - | input.double.float_equals(&expected.double),
|
9667 - | "Unexpected value for `double` {:?} vs. {:?}",
|
9668 - | expected.double,
|
9669 - | input.double
|
9670 - | );
|
9671 - | ::pretty_assertions::assert_eq!(
|
9672 - | input.empty_struct,
|
9673 - | expected.empty_struct,
|
9674 - | "Unexpected value for `empty_struct`"
|
9675 - | );
|
9676 - | assert!(
|
9677 - | input.float.float_equals(&expected.float),
|
9678 - | "Unexpected value for `float` {:?} vs. {:?}",
|
9679 - | expected.float,
|
9680 - | input.float
|
9681 - | );
|
9682 - | ::pretty_assertions::assert_eq!(
|
9683 - | input.httpdate_timestamp,
|
9684 - | expected.httpdate_timestamp,
|
9685 - | "Unexpected value for `httpdate_timestamp`"
|
9686 - | );
|
9687 - | ::pretty_assertions::assert_eq!(
|
9688 - | input.integer,
|
9689 - | expected.integer,
|
9690 - | "Unexpected value for `integer`"
|
9691 - | );
|
9692 - | ::pretty_assertions::assert_eq!(
|
9693 - | input.iso8601_timestamp,
|
9694 - | expected.iso8601_timestamp,
|
9695 - | "Unexpected value for `iso8601_timestamp`"
|
9696 - | );
|
9697 - | ::pretty_assertions::assert_eq!(
|
9698 - | input.json_value,
|
9699 - | expected.json_value,
|
9700 - | "Unexpected value for `json_value`"
|
9701 - | );
|
9702 - | ::pretty_assertions::assert_eq!(
|
9703 - | input.list_of_lists,
|
9704 - | expected.list_of_lists,
|
9705 - | "Unexpected value for `list_of_lists`"
|
9706 - | );
|
9707 - | ::pretty_assertions::assert_eq!(
|
9708 - | input.list_of_maps_of_strings,
|
9709 - | expected.list_of_maps_of_strings,
|
9710 - | "Unexpected value for `list_of_maps_of_strings`"
|
9711 - | );
|
9712 - | ::pretty_assertions::assert_eq!(
|
9713 - | input.list_of_strings,
|
9714 - | expected.list_of_strings,
|
9715 - | "Unexpected value for `list_of_strings`"
|
9716 - | );
|
9717 - | ::pretty_assertions::assert_eq!(
|
9718 - | input.list_of_structs,
|
9719 - | expected.list_of_structs,
|
9720 - | "Unexpected value for `list_of_structs`"
|
9721 - | );
|
9722 - | ::pretty_assertions::assert_eq!(
|
9723 - | input.long,
|
9724 - | expected.long,
|
9725 - | "Unexpected value for `long`"
|
9726 - | );
|
9727 - | ::pretty_assertions::assert_eq!(
|
9728 - | input.map_of_lists_of_strings,
|
9729 - | expected.map_of_lists_of_strings,
|
9730 - | "Unexpected value for `map_of_lists_of_strings`"
|
9731 - | );
|
9732 - | ::pretty_assertions::assert_eq!(
|
9733 - | input.map_of_maps,
|
9734 - | expected.map_of_maps,
|
9735 - | "Unexpected value for `map_of_maps`"
|
9736 - | );
|
9737 - | ::pretty_assertions::assert_eq!(
|
9738 - | input.map_of_strings,
|
9739 - | expected.map_of_strings,
|
9740 - | "Unexpected value for `map_of_strings`"
|
9741 - | );
|
9742 - | ::pretty_assertions::assert_eq!(
|
9743 - | input.map_of_structs,
|
9744 - | expected.map_of_structs,
|
9745 - | "Unexpected value for `map_of_structs`"
|
9746 - | );
|
9747 - | ::pretty_assertions::assert_eq!(
|
9748 - | input.recursive_list,
|
9749 - | expected.recursive_list,
|
9750 - | "Unexpected value for `recursive_list`"
|
9751 - | );
|
9752 - | ::pretty_assertions::assert_eq!(
|
9753 - | input.recursive_map,
|
9754 - | expected.recursive_map,
|
9755 - | "Unexpected value for `recursive_map`"
|
9756 - | );
|
9757 - | ::pretty_assertions::assert_eq!(
|
9758 - | input.recursive_struct,
|
9759 - | expected.recursive_struct,
|
9760 - | "Unexpected value for `recursive_struct`"
|
9761 - | );
|
9762 - | ::pretty_assertions::assert_eq!(
|
9763 - | input.simple_struct,
|
9764 - | expected.simple_struct,
|
9765 - | "Unexpected value for `simple_struct`"
|
9766 - | );
|
9767 - | ::pretty_assertions::assert_eq!(
|
9768 - | input.string,
|
9769 - | expected.string,
|
9770 - | "Unexpected value for `string`"
|
9771 - | );
|
9772 - | ::pretty_assertions::assert_eq!(
|
9773 - | input.struct_with_json_name,
|
9774 - | expected.struct_with_json_name,
|
9775 - | "Unexpected value for `struct_with_json_name`"
|
9776 - | );
|
9777 - | ::pretty_assertions::assert_eq!(
|
9778 - | input.timestamp,
|
9779 - | expected.timestamp,
|
9780 - | "Unexpected value for `timestamp`"
|
9781 - | );
|
9782 - | ::pretty_assertions::assert_eq!(
|
9783 - | input.unix_timestamp,
|
9784 - | expected.unix_timestamp,
|
9785 - | "Unexpected value for `unix_timestamp`"
|
9786 - | );
|
9787 - | let output = crate::output::KitchenSinkOperationOutput {
|
9788 - | blob: ::std::option::Option::None,
|
9789 - | boolean: ::std::option::Option::None,
|
9790 - | double: ::std::option::Option::None,
|
9791 - | empty_struct: ::std::option::Option::None,
|
9792 - | float: ::std::option::Option::None,
|
9793 - | httpdate_timestamp: ::std::option::Option::None,
|
9794 - | integer: ::std::option::Option::None,
|
9795 - | iso8601_timestamp: ::std::option::Option::None,
|
9796 - | json_value: ::std::option::Option::None,
|
9797 - | list_of_lists: ::std::option::Option::None,
|
9798 - | list_of_maps_of_strings: ::std::option::Option::None,
|
9799 - | list_of_strings: ::std::option::Option::None,
|
9800 - | list_of_structs: ::std::option::Option::None,
|
9801 - | long: ::std::option::Option::None,
|
9802 - | map_of_lists_of_strings: ::std::option::Option::None,
|
9803 - | map_of_maps: ::std::option::Option::None,
|
9804 - | map_of_strings: ::std::option::Option::None,
|
9805 - | map_of_structs: ::std::option::Option::None,
|
9806 - | recursive_list: ::std::option::Option::None,
|
9807 - | recursive_map: ::std::option::Option::None,
|
9808 - | recursive_struct: ::std::option::Option::None,
|
9809 - | simple_struct: ::std::option::Option::None,
|
9810 - | string: ::std::option::Option::None,
|
9811 - | struct_with_json_name: ::std::option::Option::None,
|
9812 - | timestamp: ::std::option::Option::None,
|
9813 - | unix_timestamp: ::std::option::Option::None,
|
9814 - | };
|
9815 - | Ok(output)
|
9816 - | };
|
9817 - | sender.send(()).await.expect("receiver dropped early");
|
9818 - | result
|
9819 - | }
|
9820 - | })
|
9821 - | .build_unchecked();
|
9822 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9823 - | .await
|
9824 - | .expect("unable to make an HTTP request");
|
9825 - | assert!(
|
9826 - | receiver.recv().await.is_some(),
|
9827 - | "we expected operation handler to be invoked but it was not entered"
|
8127 + | async fn parses_httpdate_timestamps_response() {
|
8128 + | let output = crate::output::KitchenSinkOperationOutput {
|
8129 + | httpdate_timestamp: ::std::option::Option::Some(
|
8130 + | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
8131 + | ),
|
8132 + | blob: ::std::option::Option::None,
|
8133 + | boolean: ::std::option::Option::None,
|
8134 + | double: ::std::option::Option::None,
|
8135 + | empty_struct: ::std::option::Option::None,
|
8136 + | float: ::std::option::Option::None,
|
8137 + | integer: ::std::option::Option::None,
|
8138 + | iso8601_timestamp: ::std::option::Option::None,
|
8139 + | json_value: ::std::option::Option::None,
|
8140 + | list_of_lists: ::std::option::Option::None,
|
8141 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8142 + | list_of_strings: ::std::option::Option::None,
|
8143 + | list_of_structs: ::std::option::Option::None,
|
8144 + | long: ::std::option::Option::None,
|
8145 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8146 + | map_of_maps: ::std::option::Option::None,
|
8147 + | map_of_strings: ::std::option::Option::None,
|
8148 + | map_of_structs: ::std::option::Option::None,
|
8149 + | recursive_list: ::std::option::Option::None,
|
8150 + | recursive_map: ::std::option::Option::None,
|
8151 + | recursive_struct: ::std::option::Option::None,
|
8152 + | simple_struct: ::std::option::Option::None,
|
8153 + | string: ::std::option::Option::None,
|
8154 + | struct_with_json_name: ::std::option::Option::None,
|
8155 + | timestamp: ::std::option::Option::None,
|
8156 + | unix_timestamp: ::std::option::Option::None,
|
8157 + | };
|
8158 + | use ::aws_smithy_http_server::response::IntoResponse;
|
8159 + | let http_response = output.into_response();
|
8160 + | ::pretty_assertions::assert_eq!(
|
8161 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8162 + | http_response.status()
|
9828 8163 | );
|
9829 - | }
|
9830 - |
|
9831 - | /// Serializes structure members with locationName traits
|
9832 - | /// Test ID: serializes_structure_members_with_locationname_traits
|
9833 - | #[::tokio::test]
|
9834 - | #[::tracing_test::traced_test]
|
9835 - | async fn serializes_structure_members_with_locationname_traits_request() {
|
9836 - | #[allow(unused_mut)]
|
9837 - | let mut http_request = ::http_1x::Request::builder()
|
9838 - | .uri("/")
|
9839 - | .method("POST")
|
9840 - | .header("Content-Type", "application/x-amz-json-1.1")
|
9841 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
9842 - | .body(::aws_smithy_http_server::body::boxed(
|
9843 - | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
9844 - | &::aws_smithy_protocol_test::decode_body_data(
|
9845 - | "{\"StructWithJsonName\":{\"Value\":\"some-value\"}}".as_bytes(),
|
9846 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9847 - | ),
|
9848 - | )),
|
9849 - | ))
|
9850 - | .unwrap();
|
9851 - | #[allow(unused_mut)]
|
9852 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9853 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
9854 - | let service = crate::service::JsonProtocol::builder::<
|
9855 - | ::aws_smithy_http_server::body::BoxBody,
|
9856 - | _,
|
9857 - | _,
|
9858 - | _,
|
9859 - | >(config)
|
9860 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
9861 - | let sender = sender.clone();
|
9862 - | async move {
|
9863 - | let result = {
|
9864 - | use ::aws_smithy_protocol_test::FloatEquals;
|
9865 - | let expected = crate::input::KitchenSinkOperationInput {
|
9866 - | struct_with_json_name: ::std::option::Option::Some(
|
9867 - | crate::model::StructWithJsonName {
|
9868 - | value: ::std::option::Option::Some("some-value".to_owned()),
|
9869 - | },
|
9870 - | ),
|
9871 - | blob: ::std::option::Option::None,
|
9872 - | boolean: ::std::option::Option::None,
|
9873 - | double: ::std::option::Option::None,
|
9874 - | empty_struct: ::std::option::Option::None,
|
9875 - | float: ::std::option::Option::None,
|
9876 - | httpdate_timestamp: ::std::option::Option::None,
|
9877 - | integer: ::std::option::Option::None,
|
9878 - | iso8601_timestamp: ::std::option::Option::None,
|
9879 - | json_value: ::std::option::Option::None,
|
9880 - | list_of_lists: ::std::option::Option::None,
|
9881 - | list_of_maps_of_strings: ::std::option::Option::None,
|
9882 - | list_of_strings: ::std::option::Option::None,
|
9883 - | list_of_structs: ::std::option::Option::None,
|
9884 - | long: ::std::option::Option::None,
|
9885 - | map_of_lists_of_strings: ::std::option::Option::None,
|
9886 - | map_of_maps: ::std::option::Option::None,
|
9887 - | map_of_strings: ::std::option::Option::None,
|
9888 - | map_of_structs: ::std::option::Option::None,
|
9889 - | recursive_list: ::std::option::Option::None,
|
9890 - | recursive_map: ::std::option::Option::None,
|
9891 - | recursive_struct: ::std::option::Option::None,
|
9892 - | simple_struct: ::std::option::Option::None,
|
9893 - | string: ::std::option::Option::None,
|
9894 - | timestamp: ::std::option::Option::None,
|
9895 - | unix_timestamp: ::std::option::Option::None,
|
9896 - | };
|
9897 - | ::pretty_assertions::assert_eq!(
|
9898 - | input.blob,
|
9899 - | expected.blob,
|
9900 - | "Unexpected value for `blob`"
|
9901 - | );
|
9902 - | ::pretty_assertions::assert_eq!(
|
9903 - | input.boolean,
|
9904 - | expected.boolean,
|
9905 - | "Unexpected value for `boolean`"
|
9906 - | );
|
9907 - | assert!(
|
9908 - | input.double.float_equals(&expected.double),
|
9909 - | "Unexpected value for `double` {:?} vs. {:?}",
|
9910 - | expected.double,
|
9911 - | input.double
|
9912 - | );
|
9913 - | ::pretty_assertions::assert_eq!(
|
9914 - | input.empty_struct,
|
9915 - | expected.empty_struct,
|
9916 - | "Unexpected value for `empty_struct`"
|
9917 - | );
|
9918 - | assert!(
|
9919 - | input.float.float_equals(&expected.float),
|
9920 - | "Unexpected value for `float` {:?} vs. {:?}",
|
9921 - | expected.float,
|
9922 - | input.float
|
9923 - | );
|
9924 - | ::pretty_assertions::assert_eq!(
|
9925 - | input.httpdate_timestamp,
|
9926 - | expected.httpdate_timestamp,
|
9927 - | "Unexpected value for `httpdate_timestamp`"
|
9928 - | );
|
9929 - | ::pretty_assertions::assert_eq!(
|
9930 - | input.integer,
|
9931 - | expected.integer,
|
9932 - | "Unexpected value for `integer`"
|
9933 - | );
|
9934 - | ::pretty_assertions::assert_eq!(
|
9935 - | input.iso8601_timestamp,
|
9936 - | expected.iso8601_timestamp,
|
9937 - | "Unexpected value for `iso8601_timestamp`"
|
9938 - | );
|
9939 - | ::pretty_assertions::assert_eq!(
|
9940 - | input.json_value,
|
9941 - | expected.json_value,
|
9942 - | "Unexpected value for `json_value`"
|
9943 - | );
|
9944 - | ::pretty_assertions::assert_eq!(
|
9945 - | input.list_of_lists,
|
9946 - | expected.list_of_lists,
|
9947 - | "Unexpected value for `list_of_lists`"
|
9948 - | );
|
9949 - | ::pretty_assertions::assert_eq!(
|
9950 - | input.list_of_maps_of_strings,
|
9951 - | expected.list_of_maps_of_strings,
|
9952 - | "Unexpected value for `list_of_maps_of_strings`"
|
9953 - | );
|
9954 - | ::pretty_assertions::assert_eq!(
|
9955 - | input.list_of_strings,
|
9956 - | expected.list_of_strings,
|
9957 - | "Unexpected value for `list_of_strings`"
|
9958 - | );
|
9959 - | ::pretty_assertions::assert_eq!(
|
9960 - | input.list_of_structs,
|
9961 - | expected.list_of_structs,
|
9962 - | "Unexpected value for `list_of_structs`"
|
9963 - | );
|
9964 - | ::pretty_assertions::assert_eq!(
|
9965 - | input.long,
|
9966 - | expected.long,
|
9967 - | "Unexpected value for `long`"
|
9968 - | );
|
9969 - | ::pretty_assertions::assert_eq!(
|
9970 - | input.map_of_lists_of_strings,
|
9971 - | expected.map_of_lists_of_strings,
|
9972 - | "Unexpected value for `map_of_lists_of_strings`"
|
9973 - | );
|
9974 - | ::pretty_assertions::assert_eq!(
|
9975 - | input.map_of_maps,
|
9976 - | expected.map_of_maps,
|
9977 - | "Unexpected value for `map_of_maps`"
|
9978 - | );
|
9979 - | ::pretty_assertions::assert_eq!(
|
9980 - | input.map_of_strings,
|
9981 - | expected.map_of_strings,
|
9982 - | "Unexpected value for `map_of_strings`"
|
9983 - | );
|
9984 - | ::pretty_assertions::assert_eq!(
|
9985 - | input.map_of_structs,
|
9986 - | expected.map_of_structs,
|
9987 - | "Unexpected value for `map_of_structs`"
|
9988 - | );
|
9989 - | ::pretty_assertions::assert_eq!(
|
9990 - | input.recursive_list,
|
9991 - | expected.recursive_list,
|
9992 - | "Unexpected value for `recursive_list`"
|
9993 - | );
|
9994 - | ::pretty_assertions::assert_eq!(
|
9995 - | input.recursive_map,
|
9996 - | expected.recursive_map,
|
9997 - | "Unexpected value for `recursive_map`"
|
9998 - | );
|
9999 - | ::pretty_assertions::assert_eq!(
|
10000 - | input.recursive_struct,
|
10001 - | expected.recursive_struct,
|
10002 - | "Unexpected value for `recursive_struct`"
|
10003 - | );
|
10004 - | ::pretty_assertions::assert_eq!(
|
10005 - | input.simple_struct,
|
10006 - | expected.simple_struct,
|
10007 - | "Unexpected value for `simple_struct`"
|
10008 - | );
|
10009 - | ::pretty_assertions::assert_eq!(
|
10010 - | input.string,
|
10011 - | expected.string,
|
10012 - | "Unexpected value for `string`"
|
10013 - | );
|
10014 - | ::pretty_assertions::assert_eq!(
|
10015 - | input.struct_with_json_name,
|
10016 - | expected.struct_with_json_name,
|
10017 - | "Unexpected value for `struct_with_json_name`"
|
10018 - | );
|
10019 - | ::pretty_assertions::assert_eq!(
|
10020 - | input.timestamp,
|
10021 - | expected.timestamp,
|
10022 - | "Unexpected value for `timestamp`"
|
10023 - | );
|
10024 - | ::pretty_assertions::assert_eq!(
|
10025 - | input.unix_timestamp,
|
10026 - | expected.unix_timestamp,
|
10027 - | "Unexpected value for `unix_timestamp`"
|
10028 - | );
|
10029 - | let output = crate::output::KitchenSinkOperationOutput {
|
10030 - | blob: ::std::option::Option::None,
|
10031 - | boolean: ::std::option::Option::None,
|
10032 - | double: ::std::option::Option::None,
|
10033 - | empty_struct: ::std::option::Option::None,
|
10034 - | float: ::std::option::Option::None,
|
10035 - | httpdate_timestamp: ::std::option::Option::None,
|
10036 - | integer: ::std::option::Option::None,
|
10037 - | iso8601_timestamp: ::std::option::Option::None,
|
10038 - | json_value: ::std::option::Option::None,
|
10039 - | list_of_lists: ::std::option::Option::None,
|
10040 - | list_of_maps_of_strings: ::std::option::Option::None,
|
10041 - | list_of_strings: ::std::option::Option::None,
|
10042 - | list_of_structs: ::std::option::Option::None,
|
10043 - | long: ::std::option::Option::None,
|
10044 - | map_of_lists_of_strings: ::std::option::Option::None,
|
10045 - | map_of_maps: ::std::option::Option::None,
|
10046 - | map_of_strings: ::std::option::Option::None,
|
10047 - | map_of_structs: ::std::option::Option::None,
|
10048 - | recursive_list: ::std::option::Option::None,
|
10049 - | recursive_map: ::std::option::Option::None,
|
10050 - | recursive_struct: ::std::option::Option::None,
|
10051 - | simple_struct: ::std::option::Option::None,
|
10052 - | string: ::std::option::Option::None,
|
10053 - | struct_with_json_name: ::std::option::Option::None,
|
10054 - | timestamp: ::std::option::Option::None,
|
10055 - | unix_timestamp: ::std::option::Option::None,
|
10056 - | };
|
10057 - | Ok(output)
|
10058 - | };
|
10059 - | sender.send(()).await.expect("receiver dropped early");
|
10060 - | result
|
10061 - | }
|
10062 - | })
|
10063 - | .build_unchecked();
|
10064 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8164 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8165 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8166 + | http_response.headers(),
|
8167 + | expected_headers,
|
8168 + | ));
|
8169 + | use ::http_body_util::BodyExt;
|
8170 + | let body = http_response
|
8171 + | .into_body()
|
8172 + | .collect()
|
10065 8173 | .await
|
10066 - | .expect("unable to make an HTTP request");
|
10067 - | assert!(
|
10068 - | receiver.recv().await.is_some(),
|
10069 - | "we expected operation handler to be invoked but it was not entered"
|
8174 + | .expect("unable to collect body")
|
8175 + | .to_bytes();
|
8176 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8177 + | &body,
|
8178 + | "{\"HttpdateTimestamp\":\"Sun, 02 Jan 2000 20:34:56 GMT\"}",
|
8179 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8180 + | ));
|
8181 + | }
|
8182 + |
|
8183 + | /// Parses list shapes
|
8184 + | /// Test ID: parses_list_shapes
|
8185 + | #[::tokio::test]
|
8186 + | #[::tracing_test::traced_test]
|
8187 + | async fn parses_list_shapes_response() {
|
8188 + | let output = crate::output::KitchenSinkOperationOutput {
|
8189 + | list_of_strings: ::std::option::Option::Some(vec![
|
8190 + | "abc".to_owned(),
|
8191 + | "mno".to_owned(),
|
8192 + | "xyz".to_owned(),
|
8193 + | ]),
|
8194 + | blob: ::std::option::Option::None,
|
8195 + | boolean: ::std::option::Option::None,
|
8196 + | double: ::std::option::Option::None,
|
8197 + | empty_struct: ::std::option::Option::None,
|
8198 + | float: ::std::option::Option::None,
|
8199 + | httpdate_timestamp: ::std::option::Option::None,
|
8200 + | integer: ::std::option::Option::None,
|
8201 + | iso8601_timestamp: ::std::option::Option::None,
|
8202 + | json_value: ::std::option::Option::None,
|
8203 + | list_of_lists: ::std::option::Option::None,
|
8204 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8205 + | list_of_structs: ::std::option::Option::None,
|
8206 + | long: ::std::option::Option::None,
|
8207 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8208 + | map_of_maps: ::std::option::Option::None,
|
8209 + | map_of_strings: ::std::option::Option::None,
|
8210 + | map_of_structs: ::std::option::Option::None,
|
8211 + | recursive_list: ::std::option::Option::None,
|
8212 + | recursive_map: ::std::option::Option::None,
|
8213 + | recursive_struct: ::std::option::Option::None,
|
8214 + | simple_struct: ::std::option::Option::None,
|
8215 + | string: ::std::option::Option::None,
|
8216 + | struct_with_json_name: ::std::option::Option::None,
|
8217 + | timestamp: ::std::option::Option::None,
|
8218 + | unix_timestamp: ::std::option::Option::None,
|
8219 + | };
|
8220 + | use ::aws_smithy_http_server::response::IntoResponse;
|
8221 + | let http_response = output.into_response();
|
8222 + | ::pretty_assertions::assert_eq!(
|
8223 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8224 + | http_response.status()
|
8225 + | );
|
8226 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8227 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8228 + | http_response.headers(),
|
8229 + | expected_headers,
|
8230 + | ));
|
8231 + | use ::http_body_util::BodyExt;
|
8232 + | let body = http_response
|
8233 + | .into_body()
|
8234 + | .collect()
|
8235 + | .await
|
8236 + | .expect("unable to collect body")
|
8237 + | .to_bytes();
|
8238 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8239 + | &body,
|
8240 + | "{\"ListOfStrings\":[\"abc\",\"mno\",\"xyz\"]}",
|
8241 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8242 + | ));
|
8243 + | }
|
8244 + |
|
8245 + | /// Parses list of map shapes
|
8246 + | /// Test ID: parses_list_of_map_shapes
|
8247 + | #[::tokio::test]
|
8248 + | #[::tracing_test::traced_test]
|
8249 + | async fn parses_list_of_map_shapes_response() {
|
8250 + | let output = crate::output::KitchenSinkOperationOutput {
|
8251 + | list_of_maps_of_strings: ::std::option::Option::Some(vec![
|
8252 + | {
|
8253 + | let mut ret = ::std::collections::HashMap::new();
|
8254 + | ret.insert("size".to_owned(), "large".to_owned());
|
8255 + | ret
|
8256 + | },
|
8257 + | {
|
8258 + | let mut ret = ::std::collections::HashMap::new();
|
8259 + | ret.insert("color".to_owned(), "red".to_owned());
|
8260 + | ret
|
8261 + | },
|
8262 + | ]),
|
8263 + | blob: ::std::option::Option::None,
|
8264 + | boolean: ::std::option::Option::None,
|
8265 + | double: ::std::option::Option::None,
|
8266 + | empty_struct: ::std::option::Option::None,
|
8267 + | float: ::std::option::Option::None,
|
8268 + | httpdate_timestamp: ::std::option::Option::None,
|
8269 + | integer: ::std::option::Option::None,
|
8270 + | iso8601_timestamp: ::std::option::Option::None,
|
8271 + | json_value: ::std::option::Option::None,
|
8272 + | list_of_lists: ::std::option::Option::None,
|
8273 + | list_of_strings: ::std::option::Option::None,
|
8274 + | list_of_structs: ::std::option::Option::None,
|
8275 + | long: ::std::option::Option::None,
|
8276 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8277 + | map_of_maps: ::std::option::Option::None,
|
8278 + | map_of_strings: ::std::option::Option::None,
|
8279 + | map_of_structs: ::std::option::Option::None,
|
8280 + | recursive_list: ::std::option::Option::None,
|
8281 + | recursive_map: ::std::option::Option::None,
|
8282 + | recursive_struct: ::std::option::Option::None,
|
8283 + | simple_struct: ::std::option::Option::None,
|
8284 + | string: ::std::option::Option::None,
|
8285 + | struct_with_json_name: ::std::option::Option::None,
|
8286 + | timestamp: ::std::option::Option::None,
|
8287 + | unix_timestamp: ::std::option::Option::None,
|
8288 + | };
|
8289 + | use ::aws_smithy_http_server::response::IntoResponse;
|
8290 + | let http_response = output.into_response();
|
8291 + | ::pretty_assertions::assert_eq!(
|
8292 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8293 + | http_response.status()
|
8294 + | );
|
8295 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8296 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8297 + | http_response.headers(),
|
8298 + | expected_headers,
|
8299 + | ));
|
8300 + | use ::http_body_util::BodyExt;
|
8301 + | let body = http_response
|
8302 + | .into_body()
|
8303 + | .collect()
|
8304 + | .await
|
8305 + | .expect("unable to collect body")
|
8306 + | .to_bytes();
|
8307 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8308 + | &body,
|
8309 + | "{\"ListOfMapsOfStrings\":[{\"size\":\"large\"},{\"color\":\"red\"}]}",
|
8310 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8311 + | ));
|
8312 + | }
|
8313 + |
|
8314 + | /// Parses list of list shapes
|
8315 + | /// Test ID: parses_list_of_list_shapes
|
8316 + | #[::tokio::test]
|
8317 + | #[::tracing_test::traced_test]
|
8318 + | async fn parses_list_of_list_shapes_response() {
|
8319 + | let output = crate::output::KitchenSinkOperationOutput {
|
8320 + | list_of_lists: ::std::option::Option::Some(vec![
|
8321 + | vec!["abc".to_owned(), "mno".to_owned(), "xyz".to_owned()],
|
8322 + | vec!["hjk".to_owned(), "qrs".to_owned(), "tuv".to_owned()],
|
8323 + | ]),
|
8324 + | blob: ::std::option::Option::None,
|
8325 + | boolean: ::std::option::Option::None,
|
8326 + | double: ::std::option::Option::None,
|
8327 + | empty_struct: ::std::option::Option::None,
|
8328 + | float: ::std::option::Option::None,
|
8329 + | httpdate_timestamp: ::std::option::Option::None,
|
8330 + | integer: ::std::option::Option::None,
|
8331 + | iso8601_timestamp: ::std::option::Option::None,
|
8332 + | json_value: ::std::option::Option::None,
|
8333 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8334 + | list_of_strings: ::std::option::Option::None,
|
8335 + | list_of_structs: ::std::option::Option::None,
|
8336 + | long: ::std::option::Option::None,
|
8337 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8338 + | map_of_maps: ::std::option::Option::None,
|
8339 + | map_of_strings: ::std::option::Option::None,
|
8340 + | map_of_structs: ::std::option::Option::None,
|
8341 + | recursive_list: ::std::option::Option::None,
|
8342 + | recursive_map: ::std::option::Option::None,
|
8343 + | recursive_struct: ::std::option::Option::None,
|
8344 + | simple_struct: ::std::option::Option::None,
|
8345 + | string: ::std::option::Option::None,
|
8346 + | struct_with_json_name: ::std::option::Option::None,
|
8347 + | timestamp: ::std::option::Option::None,
|
8348 + | unix_timestamp: ::std::option::Option::None,
|
8349 + | };
|
8350 + | use ::aws_smithy_http_server::response::IntoResponse;
|
8351 + | let http_response = output.into_response();
|
8352 + | ::pretty_assertions::assert_eq!(
|
8353 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8354 + | http_response.status()
|
8355 + | );
|
8356 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8357 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8358 + | http_response.headers(),
|
8359 + | expected_headers,
|
8360 + | ));
|
8361 + | use ::http_body_util::BodyExt;
|
8362 + | let body = http_response
|
8363 + | .into_body()
|
8364 + | .collect()
|
8365 + | .await
|
8366 + | .expect("unable to collect body")
|
8367 + | .to_bytes();
|
8368 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8369 + | &body,
|
8370 + | "{\"ListOfLists\":[[\"abc\",\"mno\",\"xyz\"],[\"hjk\",\"qrs\",\"tuv\"]]}",
|
8371 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8372 + | ));
|
8373 + | }
|
8374 + |
|
8375 + | /// Parses list of structure shapes
|
8376 + | /// Test ID: parses_list_of_structure_shapes
|
8377 + | #[::tokio::test]
|
8378 + | #[::tracing_test::traced_test]
|
8379 + | async fn parses_list_of_structure_shapes_response() {
|
8380 + | let output = crate::output::KitchenSinkOperationOutput {
|
8381 + | list_of_structs: ::std::option::Option::Some(vec![
|
8382 + | crate::model::SimpleStruct {
|
8383 + | value: ::std::option::Option::Some("value-1".to_owned()),
|
8384 + | },
|
8385 + | crate::model::SimpleStruct {
|
8386 + | value: ::std::option::Option::Some("value-2".to_owned()),
|
8387 + | },
|
8388 + | ]),
|
8389 + | blob: ::std::option::Option::None,
|
8390 + | boolean: ::std::option::Option::None,
|
8391 + | double: ::std::option::Option::None,
|
8392 + | empty_struct: ::std::option::Option::None,
|
8393 + | float: ::std::option::Option::None,
|
8394 + | httpdate_timestamp: ::std::option::Option::None,
|
8395 + | integer: ::std::option::Option::None,
|
8396 + | iso8601_timestamp: ::std::option::Option::None,
|
8397 + | json_value: ::std::option::Option::None,
|
8398 + | list_of_lists: ::std::option::Option::None,
|
8399 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8400 + | list_of_strings: ::std::option::Option::None,
|
8401 + | long: ::std::option::Option::None,
|
8402 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8403 + | map_of_maps: ::std::option::Option::None,
|
8404 + | map_of_strings: ::std::option::Option::None,
|
8405 + | map_of_structs: ::std::option::Option::None,
|
8406 + | recursive_list: ::std::option::Option::None,
|
8407 + | recursive_map: ::std::option::Option::None,
|
8408 + | recursive_struct: ::std::option::Option::None,
|
8409 + | simple_struct: ::std::option::Option::None,
|
8410 + | string: ::std::option::Option::None,
|
8411 + | struct_with_json_name: ::std::option::Option::None,
|
8412 + | timestamp: ::std::option::Option::None,
|
8413 + | unix_timestamp: ::std::option::Option::None,
|
8414 + | };
|
8415 + | use ::aws_smithy_http_server::response::IntoResponse;
|
8416 + | let http_response = output.into_response();
|
8417 + | ::pretty_assertions::assert_eq!(
|
8418 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8419 + | http_response.status()
|
10070 8420 | );
|
8421 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8422 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8423 + | http_response.headers(),
|
8424 + | expected_headers,
|
8425 + | ));
|
8426 + | use ::http_body_util::BodyExt;
|
8427 + | let body = http_response
|
8428 + | .into_body()
|
8429 + | .collect()
|
8430 + | .await
|
8431 + | .expect("unable to collect body")
|
8432 + | .to_bytes();
|
8433 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8434 + | &body,
|
8435 + | "{\"ListOfStructs\":[{\"Value\":\"value-1\"},{\"Value\":\"value-2\"}]}",
|
8436 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8437 + | ));
|
10071 8438 | }
|
10072 8439 |
|
10073 - | /// Serializes empty structure shapes
|
10074 - | /// Test ID: serializes_empty_structure_shapes
|
8440 + | /// Parses list of recursive structure shapes
|
8441 + | /// Test ID: parses_list_of_recursive_structure_shapes
|
10075 8442 | #[::tokio::test]
|
10076 8443 | #[::tracing_test::traced_test]
|
10077 - | async fn serializes_empty_structure_shapes_request() {
|
10078 - | #[allow(unused_mut)]
|
10079 - | let mut http_request = ::http_1x::Request::builder()
|
10080 - | .uri("/")
|
10081 - | .method("POST")
|
10082 - | .header("Content-Type", "application/x-amz-json-1.1")
|
10083 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
10084 - | .body(::aws_smithy_http_server::body::boxed(
|
10085 - | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
10086 - | &::aws_smithy_protocol_test::decode_body_data(
|
10087 - | "{\"SimpleStruct\":{}}".as_bytes(),
|
10088 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10089 - | ),
|
10090 - | )),
|
10091 - | ))
|
10092 - | .unwrap();
|
10093 - | #[allow(unused_mut)]
|
10094 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10095 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
10096 - | let service = crate::service::JsonProtocol::builder::<
|
10097 - | ::aws_smithy_http_server::body::BoxBody,
|
10098 - | _,
|
10099 - | _,
|
10100 - | _,
|
10101 - | >(config)
|
10102 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
10103 - | let sender = sender.clone();
|
10104 - | async move {
|
10105 - | let result = {
|
10106 - | use ::aws_smithy_protocol_test::FloatEquals;
|
10107 - | let expected = crate::input::KitchenSinkOperationInput {
|
10108 - | simple_struct: ::std::option::Option::Some(crate::model::SimpleStruct {
|
10109 - | value: ::std::option::Option::None,
|
10110 - | }),
|
10111 - | blob: ::std::option::Option::None,
|
10112 - | boolean: ::std::option::Option::None,
|
10113 - | double: ::std::option::Option::None,
|
10114 - | empty_struct: ::std::option::Option::None,
|
10115 - | float: ::std::option::Option::None,
|
10116 - | httpdate_timestamp: ::std::option::Option::None,
|
10117 - | integer: ::std::option::Option::None,
|
10118 - | iso8601_timestamp: ::std::option::Option::None,
|
10119 - | json_value: ::std::option::Option::None,
|
10120 - | list_of_lists: ::std::option::Option::None,
|
10121 - | list_of_maps_of_strings: ::std::option::Option::None,
|
10122 - | list_of_strings: ::std::option::Option::None,
|
10123 - | list_of_structs: ::std::option::Option::None,
|
10124 - | long: ::std::option::Option::None,
|
10125 - | map_of_lists_of_strings: ::std::option::Option::None,
|
10126 - | map_of_maps: ::std::option::Option::None,
|
10127 - | map_of_strings: ::std::option::Option::None,
|
10128 - | map_of_structs: ::std::option::Option::None,
|
10129 - | recursive_list: ::std::option::Option::None,
|
10130 - | recursive_map: ::std::option::Option::None,
|
10131 - | recursive_struct: ::std::option::Option::None,
|
10132 - | string: ::std::option::Option::None,
|
10133 - | struct_with_json_name: ::std::option::Option::None,
|
10134 - | timestamp: ::std::option::Option::None,
|
10135 - | unix_timestamp: ::std::option::Option::None,
|
10136 - | };
|
10137 - | ::pretty_assertions::assert_eq!(
|
10138 - | input.blob,
|
10139 - | expected.blob,
|
10140 - | "Unexpected value for `blob`"
|
10141 - | );
|
10142 - | ::pretty_assertions::assert_eq!(
|
10143 - | input.boolean,
|
10144 - | expected.boolean,
|
10145 - | "Unexpected value for `boolean`"
|
10146 - | );
|
10147 - | assert!(
|
10148 - | input.double.float_equals(&expected.double),
|
10149 - | "Unexpected value for `double` {:?} vs. {:?}",
|
10150 - | expected.double,
|
10151 - | input.double
|
10152 - | );
|
10153 - | ::pretty_assertions::assert_eq!(
|
10154 - | input.empty_struct,
|
10155 - | expected.empty_struct,
|
10156 - | "Unexpected value for `empty_struct`"
|
10157 - | );
|
10158 - | assert!(
|
10159 - | input.float.float_equals(&expected.float),
|
10160 - | "Unexpected value for `float` {:?} vs. {:?}",
|
10161 - | expected.float,
|
10162 - | input.float
|
10163 - | );
|
10164 - | ::pretty_assertions::assert_eq!(
|
10165 - | input.httpdate_timestamp,
|
10166 - | expected.httpdate_timestamp,
|
10167 - | "Unexpected value for `httpdate_timestamp`"
|
10168 - | );
|
10169 - | ::pretty_assertions::assert_eq!(
|
10170 - | input.integer,
|
10171 - | expected.integer,
|
10172 - | "Unexpected value for `integer`"
|
10173 - | );
|
10174 - | ::pretty_assertions::assert_eq!(
|
10175 - | input.iso8601_timestamp,
|
10176 - | expected.iso8601_timestamp,
|
10177 - | "Unexpected value for `iso8601_timestamp`"
|
10178 - | );
|
10179 - | ::pretty_assertions::assert_eq!(
|
10180 - | input.json_value,
|
10181 - | expected.json_value,
|
10182 - | "Unexpected value for `json_value`"
|
10183 - | );
|
10184 - | ::pretty_assertions::assert_eq!(
|
10185 - | input.list_of_lists,
|
10186 - | expected.list_of_lists,
|
10187 - | "Unexpected value for `list_of_lists`"
|
10188 - | );
|
10189 - | ::pretty_assertions::assert_eq!(
|
10190 - | input.list_of_maps_of_strings,
|
10191 - | expected.list_of_maps_of_strings,
|
10192 - | "Unexpected value for `list_of_maps_of_strings`"
|
10193 - | );
|
10194 - | ::pretty_assertions::assert_eq!(
|
10195 - | input.list_of_strings,
|
10196 - | expected.list_of_strings,
|
10197 - | "Unexpected value for `list_of_strings`"
|
10198 - | );
|
10199 - | ::pretty_assertions::assert_eq!(
|
10200 - | input.list_of_structs,
|
10201 - | expected.list_of_structs,
|
10202 - | "Unexpected value for `list_of_structs`"
|
10203 - | );
|
10204 - | ::pretty_assertions::assert_eq!(
|
10205 - | input.long,
|
10206 - | expected.long,
|
10207 - | "Unexpected value for `long`"
|
10208 - | );
|
10209 - | ::pretty_assertions::assert_eq!(
|
10210 - | input.map_of_lists_of_strings,
|
10211 - | expected.map_of_lists_of_strings,
|
10212 - | "Unexpected value for `map_of_lists_of_strings`"
|
10213 - | );
|
10214 - | ::pretty_assertions::assert_eq!(
|
10215 - | input.map_of_maps,
|
10216 - | expected.map_of_maps,
|
10217 - | "Unexpected value for `map_of_maps`"
|
10218 - | );
|
10219 - | ::pretty_assertions::assert_eq!(
|
10220 - | input.map_of_strings,
|
10221 - | expected.map_of_strings,
|
10222 - | "Unexpected value for `map_of_strings`"
|
10223 - | );
|
10224 - | ::pretty_assertions::assert_eq!(
|
10225 - | input.map_of_structs,
|
10226 - | expected.map_of_structs,
|
10227 - | "Unexpected value for `map_of_structs`"
|
10228 - | );
|
10229 - | ::pretty_assertions::assert_eq!(
|
10230 - | input.recursive_list,
|
10231 - | expected.recursive_list,
|
10232 - | "Unexpected value for `recursive_list`"
|
10233 - | );
|
10234 - | ::pretty_assertions::assert_eq!(
|
10235 - | input.recursive_map,
|
10236 - | expected.recursive_map,
|
10237 - | "Unexpected value for `recursive_map`"
|
10238 - | );
|
10239 - | ::pretty_assertions::assert_eq!(
|
10240 - | input.recursive_struct,
|
10241 - | expected.recursive_struct,
|
10242 - | "Unexpected value for `recursive_struct`"
|
10243 - | );
|
10244 - | ::pretty_assertions::assert_eq!(
|
10245 - | input.simple_struct,
|
10246 - | expected.simple_struct,
|
10247 - | "Unexpected value for `simple_struct`"
|
10248 - | );
|
10249 - | ::pretty_assertions::assert_eq!(
|
10250 - | input.string,
|
10251 - | expected.string,
|
10252 - | "Unexpected value for `string`"
|
10253 - | );
|
10254 - | ::pretty_assertions::assert_eq!(
|
10255 - | input.struct_with_json_name,
|
10256 - | expected.struct_with_json_name,
|
10257 - | "Unexpected value for `struct_with_json_name`"
|
10258 - | );
|
10259 - | ::pretty_assertions::assert_eq!(
|
10260 - | input.timestamp,
|
10261 - | expected.timestamp,
|
10262 - | "Unexpected value for `timestamp`"
|
10263 - | );
|
10264 - | ::pretty_assertions::assert_eq!(
|
10265 - | input.unix_timestamp,
|
10266 - | expected.unix_timestamp,
|
10267 - | "Unexpected value for `unix_timestamp`"
|
10268 - | );
|
10269 - | let output = crate::output::KitchenSinkOperationOutput {
|
8444 + | async fn parses_list_of_recursive_structure_shapes_response() {
|
8445 + | let output = crate::output::KitchenSinkOperationOutput {
|
8446 + | recursive_list: ::std::option::Option::Some(vec![crate::model::KitchenSink {
|
8447 + | recursive_list: ::std::option::Option::Some(vec![crate::model::KitchenSink {
|
8448 + | recursive_list: ::std::option::Option::Some(vec![crate::model::KitchenSink {
|
8449 + | string: ::std::option::Option::Some("value".to_owned()),
|
10270 8450 | blob: ::std::option::Option::None,
|
10271 8451 | boolean: ::std::option::Option::None,
|
10272 8452 | double: ::std::option::Option::None,
|
10273 8453 | empty_struct: ::std::option::Option::None,
|
10274 8454 | float: ::std::option::Option::None,
|
10275 8455 | httpdate_timestamp: ::std::option::Option::None,
|
10276 8456 | integer: ::std::option::Option::None,
|
10277 8457 | iso8601_timestamp: ::std::option::Option::None,
|
10278 8458 | json_value: ::std::option::Option::None,
|
10279 8459 | list_of_lists: ::std::option::Option::None,
|
10280 8460 | list_of_maps_of_strings: ::std::option::Option::None,
|
10281 8461 | list_of_strings: ::std::option::Option::None,
|
10282 8462 | list_of_structs: ::std::option::Option::None,
|
10283 8463 | long: ::std::option::Option::None,
|
10284 8464 | map_of_lists_of_strings: ::std::option::Option::None,
|
10285 8465 | map_of_maps: ::std::option::Option::None,
|
10286 8466 | map_of_strings: ::std::option::Option::None,
|
10287 8467 | map_of_structs: ::std::option::Option::None,
|
10288 8468 | recursive_list: ::std::option::Option::None,
|
10289 8469 | recursive_map: ::std::option::Option::None,
|
10290 8470 | recursive_struct: ::std::option::Option::None,
|
10291 8471 | simple_struct: ::std::option::Option::None,
|
10292 - | string: ::std::option::Option::None,
|
10293 8472 | struct_with_json_name: ::std::option::Option::None,
|
10294 8473 | timestamp: ::std::option::Option::None,
|
10295 8474 | unix_timestamp: ::std::option::Option::None,
|
10296 - | };
|
10297 - | Ok(output)
|
10298 - | };
|
10299 - | sender.send(()).await.expect("receiver dropped early");
|
10300 - | result
|
10301 - | }
|
10302 - | })
|
10303 - | .build_unchecked();
|
10304 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8475 + | }]),
|
8476 + | blob: ::std::option::Option::None,
|
8477 + | boolean: ::std::option::Option::None,
|
8478 + | double: ::std::option::Option::None,
|
8479 + | empty_struct: ::std::option::Option::None,
|
8480 + | float: ::std::option::Option::None,
|
8481 + | httpdate_timestamp: ::std::option::Option::None,
|
8482 + | integer: ::std::option::Option::None,
|
8483 + | iso8601_timestamp: ::std::option::Option::None,
|
8484 + | json_value: ::std::option::Option::None,
|
8485 + | list_of_lists: ::std::option::Option::None,
|
8486 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8487 + | list_of_strings: ::std::option::Option::None,
|
8488 + | list_of_structs: ::std::option::Option::None,
|
8489 + | long: ::std::option::Option::None,
|
8490 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8491 + | map_of_maps: ::std::option::Option::None,
|
8492 + | map_of_strings: ::std::option::Option::None,
|
8493 + | map_of_structs: ::std::option::Option::None,
|
8494 + | recursive_map: ::std::option::Option::None,
|
8495 + | recursive_struct: ::std::option::Option::None,
|
8496 + | simple_struct: ::std::option::Option::None,
|
8497 + | string: ::std::option::Option::None,
|
8498 + | struct_with_json_name: ::std::option::Option::None,
|
8499 + | timestamp: ::std::option::Option::None,
|
8500 + | unix_timestamp: ::std::option::Option::None,
|
8501 + | }]),
|
8502 + | blob: ::std::option::Option::None,
|
8503 + | boolean: ::std::option::Option::None,
|
8504 + | double: ::std::option::Option::None,
|
8505 + | empty_struct: ::std::option::Option::None,
|
8506 + | float: ::std::option::Option::None,
|
8507 + | httpdate_timestamp: ::std::option::Option::None,
|
8508 + | integer: ::std::option::Option::None,
|
8509 + | iso8601_timestamp: ::std::option::Option::None,
|
8510 + | json_value: ::std::option::Option::None,
|
8511 + | list_of_lists: ::std::option::Option::None,
|
8512 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8513 + | list_of_strings: ::std::option::Option::None,
|
8514 + | list_of_structs: ::std::option::Option::None,
|
8515 + | long: ::std::option::Option::None,
|
8516 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8517 + | map_of_maps: ::std::option::Option::None,
|
8518 + | map_of_strings: ::std::option::Option::None,
|
8519 + | map_of_structs: ::std::option::Option::None,
|
8520 + | recursive_map: ::std::option::Option::None,
|
8521 + | recursive_struct: ::std::option::Option::None,
|
8522 + | simple_struct: ::std::option::Option::None,
|
8523 + | string: ::std::option::Option::None,
|
8524 + | struct_with_json_name: ::std::option::Option::None,
|
8525 + | timestamp: ::std::option::Option::None,
|
8526 + | unix_timestamp: ::std::option::Option::None,
|
8527 + | }]),
|
8528 + | blob: ::std::option::Option::None,
|
8529 + | boolean: ::std::option::Option::None,
|
8530 + | double: ::std::option::Option::None,
|
8531 + | empty_struct: ::std::option::Option::None,
|
8532 + | float: ::std::option::Option::None,
|
8533 + | httpdate_timestamp: ::std::option::Option::None,
|
8534 + | integer: ::std::option::Option::None,
|
8535 + | iso8601_timestamp: ::std::option::Option::None,
|
8536 + | json_value: ::std::option::Option::None,
|
8537 + | list_of_lists: ::std::option::Option::None,
|
8538 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8539 + | list_of_strings: ::std::option::Option::None,
|
8540 + | list_of_structs: ::std::option::Option::None,
|
8541 + | long: ::std::option::Option::None,
|
8542 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8543 + | map_of_maps: ::std::option::Option::None,
|
8544 + | map_of_strings: ::std::option::Option::None,
|
8545 + | map_of_structs: ::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 + | use ::aws_smithy_http_server::response::IntoResponse;
|
8555 + | let http_response = output.into_response();
|
8556 + | ::pretty_assertions::assert_eq!(
|
8557 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8558 + | http_response.status()
|
8559 + | );
|
8560 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8561 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8562 + | http_response.headers(),
|
8563 + | expected_headers,
|
8564 + | ));
|
8565 + | use ::http_body_util::BodyExt;
|
8566 + | let body = http_response
|
8567 + | .into_body()
|
8568 + | .collect()
|
8569 + | .await
|
8570 + | .expect("unable to collect body")
|
8571 + | .to_bytes();
|
8572 + | ::aws_smithy_protocol_test::assert_ok(
|
8573 + | ::aws_smithy_protocol_test::validate_body(&body, "{\"RecursiveList\":[{\"RecursiveList\":[{\"RecursiveList\":[{\"String\":\"value\"}]}]}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
8574 + | );
|
8575 + | }
|
8576 + |
|
8577 + | /// Parses map shapes
|
8578 + | /// Test ID: parses_map_shapes
|
8579 + | #[::tokio::test]
|
8580 + | #[::tracing_test::traced_test]
|
8581 + | async fn parses_map_shapes_response() {
|
8582 + | let output = crate::output::KitchenSinkOperationOutput {
|
8583 + | map_of_strings: ::std::option::Option::Some({
|
8584 + | let mut ret = ::std::collections::HashMap::new();
|
8585 + | ret.insert("size".to_owned(), "large".to_owned());
|
8586 + | ret.insert("color".to_owned(), "red".to_owned());
|
8587 + | ret
|
8588 + | }),
|
8589 + | blob: ::std::option::Option::None,
|
8590 + | boolean: ::std::option::Option::None,
|
8591 + | double: ::std::option::Option::None,
|
8592 + | empty_struct: ::std::option::Option::None,
|
8593 + | float: ::std::option::Option::None,
|
8594 + | httpdate_timestamp: ::std::option::Option::None,
|
8595 + | integer: ::std::option::Option::None,
|
8596 + | iso8601_timestamp: ::std::option::Option::None,
|
8597 + | json_value: ::std::option::Option::None,
|
8598 + | list_of_lists: ::std::option::Option::None,
|
8599 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8600 + | list_of_strings: ::std::option::Option::None,
|
8601 + | list_of_structs: ::std::option::Option::None,
|
8602 + | long: ::std::option::Option::None,
|
8603 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8604 + | map_of_maps: ::std::option::Option::None,
|
8605 + | map_of_structs: ::std::option::Option::None,
|
8606 + | recursive_list: ::std::option::Option::None,
|
8607 + | recursive_map: ::std::option::Option::None,
|
8608 + | recursive_struct: ::std::option::Option::None,
|
8609 + | simple_struct: ::std::option::Option::None,
|
8610 + | string: ::std::option::Option::None,
|
8611 + | struct_with_json_name: ::std::option::Option::None,
|
8612 + | timestamp: ::std::option::Option::None,
|
8613 + | unix_timestamp: ::std::option::Option::None,
|
8614 + | };
|
8615 + | use ::aws_smithy_http_server::response::IntoResponse;
|
8616 + | let http_response = output.into_response();
|
8617 + | ::pretty_assertions::assert_eq!(
|
8618 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8619 + | http_response.status()
|
8620 + | );
|
8621 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8622 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8623 + | http_response.headers(),
|
8624 + | expected_headers,
|
8625 + | ));
|
8626 + | use ::http_body_util::BodyExt;
|
8627 + | let body = http_response
|
8628 + | .into_body()
|
8629 + | .collect()
|
8630 + | .await
|
8631 + | .expect("unable to collect body")
|
8632 + | .to_bytes();
|
8633 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8634 + | &body,
|
8635 + | "{\"MapOfStrings\":{\"size\":\"large\",\"color\":\"red\"}}",
|
8636 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8637 + | ));
|
8638 + | }
|
8639 + |
|
8640 + | /// Parses map of list shapes
|
8641 + | /// Test ID: parses_map_of_list_shapes
|
8642 + | #[::tokio::test]
|
8643 + | #[::tracing_test::traced_test]
|
8644 + | async fn parses_map_of_list_shapes_response() {
|
8645 + | let output = crate::output::KitchenSinkOperationOutput {
|
8646 + | map_of_lists_of_strings: ::std::option::Option::Some({
|
8647 + | let mut ret = ::std::collections::HashMap::new();
|
8648 + | ret.insert(
|
8649 + | "sizes".to_owned(),
|
8650 + | vec!["large".to_owned(), "small".to_owned()],
|
8651 + | );
|
8652 + | ret.insert(
|
8653 + | "colors".to_owned(),
|
8654 + | vec!["red".to_owned(), "green".to_owned()],
|
8655 + | );
|
8656 + | ret
|
8657 + | }),
|
8658 + | blob: ::std::option::Option::None,
|
8659 + | boolean: ::std::option::Option::None,
|
8660 + | double: ::std::option::Option::None,
|
8661 + | empty_struct: ::std::option::Option::None,
|
8662 + | float: ::std::option::Option::None,
|
8663 + | httpdate_timestamp: ::std::option::Option::None,
|
8664 + | integer: ::std::option::Option::None,
|
8665 + | iso8601_timestamp: ::std::option::Option::None,
|
8666 + | json_value: ::std::option::Option::None,
|
8667 + | list_of_lists: ::std::option::Option::None,
|
8668 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8669 + | list_of_strings: ::std::option::Option::None,
|
8670 + | list_of_structs: ::std::option::Option::None,
|
8671 + | long: ::std::option::Option::None,
|
8672 + | map_of_maps: ::std::option::Option::None,
|
8673 + | map_of_strings: ::std::option::Option::None,
|
8674 + | map_of_structs: ::std::option::Option::None,
|
8675 + | recursive_list: ::std::option::Option::None,
|
8676 + | recursive_map: ::std::option::Option::None,
|
8677 + | recursive_struct: ::std::option::Option::None,
|
8678 + | simple_struct: ::std::option::Option::None,
|
8679 + | string: ::std::option::Option::None,
|
8680 + | struct_with_json_name: ::std::option::Option::None,
|
8681 + | timestamp: ::std::option::Option::None,
|
8682 + | unix_timestamp: ::std::option::Option::None,
|
8683 + | };
|
8684 + | use ::aws_smithy_http_server::response::IntoResponse;
|
8685 + | let http_response = output.into_response();
|
8686 + | ::pretty_assertions::assert_eq!(
|
8687 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8688 + | http_response.status()
|
8689 + | );
|
8690 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8691 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8692 + | http_response.headers(),
|
8693 + | expected_headers,
|
8694 + | ));
|
8695 + | use ::http_body_util::BodyExt;
|
8696 + | let body = http_response
|
8697 + | .into_body()
|
8698 + | .collect()
|
8699 + | .await
|
8700 + | .expect("unable to collect body")
|
8701 + | .to_bytes();
|
8702 + | ::aws_smithy_protocol_test::assert_ok(
|
8703 + | ::aws_smithy_protocol_test::validate_body(&body, "{\"MapOfListsOfStrings\":{\"sizes\":[\"large\",\"small\"],\"colors\":[\"red\",\"green\"]}}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
8704 + | );
|
8705 + | }
|
8706 + |
|
8707 + | /// Parses map of map shapes
|
8708 + | /// Test ID: parses_map_of_map_shapes
|
8709 + | #[::tokio::test]
|
8710 + | #[::tracing_test::traced_test]
|
8711 + | async fn parses_map_of_map_shapes_response() {
|
8712 + | let output = crate::output::KitchenSinkOperationOutput {
|
8713 + | map_of_maps: ::std::option::Option::Some({
|
8714 + | let mut ret = ::std::collections::HashMap::new();
|
8715 + | ret.insert("sizes".to_owned(), {
|
8716 + | let mut ret = ::std::collections::HashMap::new();
|
8717 + | ret.insert("large".to_owned(), "L".to_owned());
|
8718 + | ret.insert("medium".to_owned(), "M".to_owned());
|
8719 + | ret
|
8720 + | });
|
8721 + | ret.insert("colors".to_owned(), {
|
8722 + | let mut ret = ::std::collections::HashMap::new();
|
8723 + | ret.insert("red".to_owned(), "R".to_owned());
|
8724 + | ret.insert("blue".to_owned(), "B".to_owned());
|
8725 + | ret
|
8726 + | });
|
8727 + | ret
|
8728 + | }),
|
8729 + | blob: ::std::option::Option::None,
|
8730 + | boolean: ::std::option::Option::None,
|
8731 + | double: ::std::option::Option::None,
|
8732 + | empty_struct: ::std::option::Option::None,
|
8733 + | float: ::std::option::Option::None,
|
8734 + | httpdate_timestamp: ::std::option::Option::None,
|
8735 + | integer: ::std::option::Option::None,
|
8736 + | iso8601_timestamp: ::std::option::Option::None,
|
8737 + | json_value: ::std::option::Option::None,
|
8738 + | list_of_lists: ::std::option::Option::None,
|
8739 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8740 + | list_of_strings: ::std::option::Option::None,
|
8741 + | list_of_structs: ::std::option::Option::None,
|
8742 + | long: ::std::option::Option::None,
|
8743 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8744 + | map_of_strings: ::std::option::Option::None,
|
8745 + | map_of_structs: ::std::option::Option::None,
|
8746 + | recursive_list: ::std::option::Option::None,
|
8747 + | recursive_map: ::std::option::Option::None,
|
8748 + | recursive_struct: ::std::option::Option::None,
|
8749 + | simple_struct: ::std::option::Option::None,
|
8750 + | string: ::std::option::Option::None,
|
8751 + | struct_with_json_name: ::std::option::Option::None,
|
8752 + | timestamp: ::std::option::Option::None,
|
8753 + | unix_timestamp: ::std::option::Option::None,
|
8754 + | };
|
8755 + | use ::aws_smithy_http_server::response::IntoResponse;
|
8756 + | let http_response = output.into_response();
|
8757 + | ::pretty_assertions::assert_eq!(
|
8758 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8759 + | http_response.status()
|
8760 + | );
|
8761 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8762 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8763 + | http_response.headers(),
|
8764 + | expected_headers,
|
8765 + | ));
|
8766 + | use ::http_body_util::BodyExt;
|
8767 + | let body = http_response
|
8768 + | .into_body()
|
8769 + | .collect()
|
10305 8770 | .await
|
10306 - | .expect("unable to make an HTTP request");
|
10307 - | assert!(
|
10308 - | receiver.recv().await.is_some(),
|
10309 - | "we expected operation handler to be invoked but it was not entered"
|
8771 + | .expect("unable to collect body")
|
8772 + | .to_bytes();
|
8773 + | ::aws_smithy_protocol_test::assert_ok(
|
8774 + | ::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"))
|
10310 8775 | );
|
10311 8776 | }
|
10312 8777 |
|
10313 - | /// Serializes structure which have no members
|
10314 - | /// Test ID: serializes_structure_which_have_no_members
|
10315 - | #[::tokio::test]
|
10316 - | #[::tracing_test::traced_test]
|
10317 - | async fn serializes_structure_which_have_no_members_request() {
|
10318 - | #[allow(unused_mut)]
|
10319 - | let mut http_request = ::http_1x::Request::builder()
|
10320 - | .uri("/")
|
10321 - | .method("POST")
|
10322 - | .header("Content-Type", "application/x-amz-json-1.1")
|
10323 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
10324 - | .body(::aws_smithy_http_server::body::boxed(
|
10325 - | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
10326 - | &::aws_smithy_protocol_test::decode_body_data(
|
10327 - | "{\"EmptyStruct\":{}}".as_bytes(),
|
10328 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10329 - | ),
|
10330 - | )),
|
10331 - | ))
|
10332 - | .unwrap();
|
10333 - | #[allow(unused_mut)]
|
10334 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10335 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
10336 - | let service = crate::service::JsonProtocol::builder::<
|
10337 - | ::aws_smithy_http_server::body::BoxBody,
|
10338 - | _,
|
10339 - | _,
|
10340 - | _,
|
10341 - | >(config)
|
10342 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
10343 - | let sender = sender.clone();
|
10344 - | async move {
|
10345 - | let result = {
|
10346 - | use ::aws_smithy_protocol_test::FloatEquals;
|
10347 - | let expected = crate::input::KitchenSinkOperationInput {
|
10348 - | empty_struct: ::std::option::Option::Some(crate::model::EmptyStruct {}),
|
10349 - | blob: ::std::option::Option::None,
|
10350 - | boolean: ::std::option::Option::None,
|
10351 - | double: ::std::option::Option::None,
|
10352 - | float: ::std::option::Option::None,
|
10353 - | httpdate_timestamp: ::std::option::Option::None,
|
10354 - | integer: ::std::option::Option::None,
|
10355 - | iso8601_timestamp: ::std::option::Option::None,
|
10356 - | json_value: ::std::option::Option::None,
|
10357 - | list_of_lists: ::std::option::Option::None,
|
10358 - | list_of_maps_of_strings: ::std::option::Option::None,
|
10359 - | list_of_strings: ::std::option::Option::None,
|
10360 - | list_of_structs: ::std::option::Option::None,
|
10361 - | long: ::std::option::Option::None,
|
10362 - | map_of_lists_of_strings: ::std::option::Option::None,
|
10363 - | map_of_maps: ::std::option::Option::None,
|
10364 - | map_of_strings: ::std::option::Option::None,
|
10365 - | map_of_structs: ::std::option::Option::None,
|
10366 - | recursive_list: ::std::option::Option::None,
|
10367 - | recursive_map: ::std::option::Option::None,
|
10368 - | recursive_struct: ::std::option::Option::None,
|
10369 - | simple_struct: ::std::option::Option::None,
|
10370 - | string: ::std::option::Option::None,
|
10371 - | struct_with_json_name: ::std::option::Option::None,
|
10372 - | timestamp: ::std::option::Option::None,
|
10373 - | unix_timestamp: ::std::option::Option::None,
|
10374 - | };
|
10375 - | ::pretty_assertions::assert_eq!(
|
10376 - | input.blob,
|
10377 - | expected.blob,
|
10378 - | "Unexpected value for `blob`"
|
10379 - | );
|
10380 - | ::pretty_assertions::assert_eq!(
|
10381 - | input.boolean,
|
10382 - | expected.boolean,
|
10383 - | "Unexpected value for `boolean`"
|
10384 - | );
|
10385 - | assert!(
|
10386 - | input.double.float_equals(&expected.double),
|
10387 - | "Unexpected value for `double` {:?} vs. {:?}",
|
10388 - | expected.double,
|
10389 - | input.double
|
10390 - | );
|
10391 - | ::pretty_assertions::assert_eq!(
|
10392 - | input.empty_struct,
|
10393 - | expected.empty_struct,
|
10394 - | "Unexpected value for `empty_struct`"
|
10395 - | );
|
10396 - | assert!(
|
10397 - | input.float.float_equals(&expected.float),
|
10398 - | "Unexpected value for `float` {:?} vs. {:?}",
|
10399 - | expected.float,
|
10400 - | input.float
|
10401 - | );
|
10402 - | ::pretty_assertions::assert_eq!(
|
10403 - | input.httpdate_timestamp,
|
10404 - | expected.httpdate_timestamp,
|
10405 - | "Unexpected value for `httpdate_timestamp`"
|
10406 - | );
|
10407 - | ::pretty_assertions::assert_eq!(
|
10408 - | input.integer,
|
10409 - | expected.integer,
|
10410 - | "Unexpected value for `integer`"
|
10411 - | );
|
10412 - | ::pretty_assertions::assert_eq!(
|
10413 - | input.iso8601_timestamp,
|
10414 - | expected.iso8601_timestamp,
|
10415 - | "Unexpected value for `iso8601_timestamp`"
|
10416 - | );
|
10417 - | ::pretty_assertions::assert_eq!(
|
10418 - | input.json_value,
|
10419 - | expected.json_value,
|
10420 - | "Unexpected value for `json_value`"
|
10421 - | );
|
10422 - | ::pretty_assertions::assert_eq!(
|
10423 - | input.list_of_lists,
|
10424 - | expected.list_of_lists,
|
10425 - | "Unexpected value for `list_of_lists`"
|
10426 - | );
|
10427 - | ::pretty_assertions::assert_eq!(
|
10428 - | input.list_of_maps_of_strings,
|
10429 - | expected.list_of_maps_of_strings,
|
10430 - | "Unexpected value for `list_of_maps_of_strings`"
|
10431 - | );
|
10432 - | ::pretty_assertions::assert_eq!(
|
10433 - | input.list_of_strings,
|
10434 - | expected.list_of_strings,
|
10435 - | "Unexpected value for `list_of_strings`"
|
10436 - | );
|
10437 - | ::pretty_assertions::assert_eq!(
|
10438 - | input.list_of_structs,
|
10439 - | expected.list_of_structs,
|
10440 - | "Unexpected value for `list_of_structs`"
|
10441 - | );
|
10442 - | ::pretty_assertions::assert_eq!(
|
10443 - | input.long,
|
10444 - | expected.long,
|
10445 - | "Unexpected value for `long`"
|
10446 - | );
|
10447 - | ::pretty_assertions::assert_eq!(
|
10448 - | input.map_of_lists_of_strings,
|
10449 - | expected.map_of_lists_of_strings,
|
10450 - | "Unexpected value for `map_of_lists_of_strings`"
|
10451 - | );
|
10452 - | ::pretty_assertions::assert_eq!(
|
10453 - | input.map_of_maps,
|
10454 - | expected.map_of_maps,
|
10455 - | "Unexpected value for `map_of_maps`"
|
10456 - | );
|
10457 - | ::pretty_assertions::assert_eq!(
|
10458 - | input.map_of_strings,
|
10459 - | expected.map_of_strings,
|
10460 - | "Unexpected value for `map_of_strings`"
|
10461 - | );
|
10462 - | ::pretty_assertions::assert_eq!(
|
10463 - | input.map_of_structs,
|
10464 - | expected.map_of_structs,
|
10465 - | "Unexpected value for `map_of_structs`"
|
10466 - | );
|
10467 - | ::pretty_assertions::assert_eq!(
|
10468 - | input.recursive_list,
|
10469 - | expected.recursive_list,
|
10470 - | "Unexpected value for `recursive_list`"
|
10471 - | );
|
10472 - | ::pretty_assertions::assert_eq!(
|
10473 - | input.recursive_map,
|
10474 - | expected.recursive_map,
|
10475 - | "Unexpected value for `recursive_map`"
|
10476 - | );
|
10477 - | ::pretty_assertions::assert_eq!(
|
10478 - | input.recursive_struct,
|
10479 - | expected.recursive_struct,
|
10480 - | "Unexpected value for `recursive_struct`"
|
10481 - | );
|
10482 - | ::pretty_assertions::assert_eq!(
|
10483 - | input.simple_struct,
|
10484 - | expected.simple_struct,
|
10485 - | "Unexpected value for `simple_struct`"
|
10486 - | );
|
10487 - | ::pretty_assertions::assert_eq!(
|
10488 - | input.string,
|
10489 - | expected.string,
|
10490 - | "Unexpected value for `string`"
|
10491 - | );
|
10492 - | ::pretty_assertions::assert_eq!(
|
10493 - | input.struct_with_json_name,
|
10494 - | expected.struct_with_json_name,
|
10495 - | "Unexpected value for `struct_with_json_name`"
|
10496 - | );
|
10497 - | ::pretty_assertions::assert_eq!(
|
10498 - | input.timestamp,
|
10499 - | expected.timestamp,
|
10500 - | "Unexpected value for `timestamp`"
|
10501 - | );
|
10502 - | ::pretty_assertions::assert_eq!(
|
10503 - | input.unix_timestamp,
|
10504 - | expected.unix_timestamp,
|
10505 - | "Unexpected value for `unix_timestamp`"
|
10506 - | );
|
10507 - | let output = crate::output::KitchenSinkOperationOutput {
|
10508 - | blob: ::std::option::Option::None,
|
10509 - | boolean: ::std::option::Option::None,
|
10510 - | double: ::std::option::Option::None,
|
10511 - | empty_struct: ::std::option::Option::None,
|
10512 - | float: ::std::option::Option::None,
|
10513 - | httpdate_timestamp: ::std::option::Option::None,
|
10514 - | integer: ::std::option::Option::None,
|
10515 - | iso8601_timestamp: ::std::option::Option::None,
|
10516 - | json_value: ::std::option::Option::None,
|
10517 - | list_of_lists: ::std::option::Option::None,
|
10518 - | list_of_maps_of_strings: ::std::option::Option::None,
|
10519 - | list_of_strings: ::std::option::Option::None,
|
10520 - | list_of_structs: ::std::option::Option::None,
|
10521 - | long: ::std::option::Option::None,
|
10522 - | map_of_lists_of_strings: ::std::option::Option::None,
|
10523 - | map_of_maps: ::std::option::Option::None,
|
10524 - | map_of_strings: ::std::option::Option::None,
|
10525 - | map_of_structs: ::std::option::Option::None,
|
10526 - | recursive_list: ::std::option::Option::None,
|
10527 - | recursive_map: ::std::option::Option::None,
|
10528 - | recursive_struct: ::std::option::Option::None,
|
10529 - | simple_struct: ::std::option::Option::None,
|
10530 - | string: ::std::option::Option::None,
|
10531 - | struct_with_json_name: ::std::option::Option::None,
|
10532 - | timestamp: ::std::option::Option::None,
|
10533 - | unix_timestamp: ::std::option::Option::None,
|
10534 - | };
|
10535 - | Ok(output)
|
10536 - | };
|
10537 - | sender.send(()).await.expect("receiver dropped early");
|
10538 - | result
|
10539 - | }
|
10540 - | })
|
10541 - | .build_unchecked();
|
10542 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10543 - | .await
|
10544 - | .expect("unable to make an HTTP request");
|
10545 - | assert!(
|
10546 - | receiver.recv().await.is_some(),
|
10547 - | "we expected operation handler to be invoked but it was not entered"
|
8778 + | /// Parses map of structure shapes
|
8779 + | /// Test ID: parses_map_of_structure_shapes
|
8780 + | #[::tokio::test]
|
8781 + | #[::tracing_test::traced_test]
|
8782 + | async fn parses_map_of_structure_shapes_response() {
|
8783 + | let output = crate::output::KitchenSinkOperationOutput {
|
8784 + | map_of_structs: ::std::option::Option::Some({
|
8785 + | let mut ret = ::std::collections::HashMap::new();
|
8786 + | ret.insert(
|
8787 + | "size".to_owned(),
|
8788 + | crate::model::SimpleStruct {
|
8789 + | value: ::std::option::Option::Some("small".to_owned()),
|
8790 + | },
|
8791 + | );
|
8792 + | ret.insert(
|
8793 + | "color".to_owned(),
|
8794 + | crate::model::SimpleStruct {
|
8795 + | value: ::std::option::Option::Some("red".to_owned()),
|
8796 + | },
|
8797 + | );
|
8798 + | ret
|
8799 + | }),
|
8800 + | blob: ::std::option::Option::None,
|
8801 + | boolean: ::std::option::Option::None,
|
8802 + | double: ::std::option::Option::None,
|
8803 + | empty_struct: ::std::option::Option::None,
|
8804 + | float: ::std::option::Option::None,
|
8805 + | httpdate_timestamp: ::std::option::Option::None,
|
8806 + | integer: ::std::option::Option::None,
|
8807 + | iso8601_timestamp: ::std::option::Option::None,
|
8808 + | json_value: ::std::option::Option::None,
|
8809 + | list_of_lists: ::std::option::Option::None,
|
8810 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8811 + | list_of_strings: ::std::option::Option::None,
|
8812 + | list_of_structs: ::std::option::Option::None,
|
8813 + | long: ::std::option::Option::None,
|
8814 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8815 + | map_of_maps: ::std::option::Option::None,
|
8816 + | map_of_strings: ::std::option::Option::None,
|
8817 + | recursive_list: ::std::option::Option::None,
|
8818 + | recursive_map: ::std::option::Option::None,
|
8819 + | recursive_struct: ::std::option::Option::None,
|
8820 + | simple_struct: ::std::option::Option::None,
|
8821 + | string: ::std::option::Option::None,
|
8822 + | struct_with_json_name: ::std::option::Option::None,
|
8823 + | timestamp: ::std::option::Option::None,
|
8824 + | unix_timestamp: ::std::option::Option::None,
|
8825 + | };
|
8826 + | use ::aws_smithy_http_server::response::IntoResponse;
|
8827 + | let http_response = output.into_response();
|
8828 + | ::pretty_assertions::assert_eq!(
|
8829 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8830 + | http_response.status()
|
10548 8831 | );
|
8832 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8833 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8834 + | http_response.headers(),
|
8835 + | expected_headers,
|
8836 + | ));
|
8837 + | use ::http_body_util::BodyExt;
|
8838 + | let body = http_response
|
8839 + | .into_body()
|
8840 + | .collect()
|
8841 + | .await
|
8842 + | .expect("unable to collect body")
|
8843 + | .to_bytes();
|
8844 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8845 + | &body,
|
8846 + | "{\"MapOfStructs\":{\"size\":{\"Value\":\"small\"},\"color\":{\"Value\":\"red\"}}}",
|
8847 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8848 + | ));
|
10549 8849 | }
|
10550 8850 |
|
10551 - | /// Serializes recursive structure shapes
|
10552 - | /// Test ID: serializes_recursive_structure_shapes
|
8851 + | /// Parses map of recursive structure shapes
|
8852 + | /// Test ID: parses_map_of_recursive_structure_shapes
|
10553 8853 | #[::tokio::test]
|
10554 8854 | #[::tracing_test::traced_test]
|
10555 - | async fn serializes_recursive_structure_shapes_request() {
|
10556 - | #[allow(unused_mut)]
|
10557 - | let mut http_request = ::http_1x::Request::builder()
|
10558 - | .uri("/")
|
10559 - | .method("POST")
|
10560 - | .header("Content-Type", "application/x-amz-json-1.1")
|
10561 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
10562 - | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
10563 - | ::bytes::Bytes::copy_from_slice(
|
10564 - | &::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"))
|
10565 - | )
|
10566 - | ))).unwrap();
|
10567 - | #[allow(unused_mut)]
|
10568 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10569 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
10570 - | let service = crate::service::JsonProtocol::builder::<
|
10571 - | ::aws_smithy_http_server::body::BoxBody,
|
10572 - | _,
|
10573 - | _,
|
10574 - | _,
|
10575 - | >(config)
|
10576 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
10577 - | let sender = sender.clone();
|
10578 - | async move {
|
10579 - | let result = {
|
10580 - | use ::aws_smithy_protocol_test::FloatEquals;
|
10581 - | let expected = crate::input::KitchenSinkOperationInput {
|
10582 - | string: ::std::option::Option::Some("top-value".to_owned()),
|
10583 - | boolean: ::std::option::Option::Some(false),
|
10584 - | recursive_struct: ::std::option::Option::Some(::std::boxed::Box::new(
|
10585 - | crate::model::KitchenSink {
|
10586 - | string: ::std::option::Option::Some("nested-value".to_owned()),
|
10587 - | boolean: ::std::option::Option::Some(true),
|
10588 - | recursive_list: ::std::option::Option::Some(vec![
|
10589 - | crate::model::KitchenSink {
|
10590 - | string: ::std::option::Option::Some(
|
10591 - | "string-only".to_owned(),
|
10592 - | ),
|
10593 - | blob: ::std::option::Option::None,
|
10594 - | boolean: ::std::option::Option::None,
|
10595 - | double: ::std::option::Option::None,
|
10596 - | empty_struct: ::std::option::Option::None,
|
10597 - | float: ::std::option::Option::None,
|
10598 - | httpdate_timestamp: ::std::option::Option::None,
|
10599 - | integer: ::std::option::Option::None,
|
10600 - | iso8601_timestamp: ::std::option::Option::None,
|
10601 - | json_value: ::std::option::Option::None,
|
10602 - | list_of_lists: ::std::option::Option::None,
|
10603 - | list_of_maps_of_strings: ::std::option::Option::None,
|
10604 - | list_of_strings: ::std::option::Option::None,
|
10605 - | list_of_structs: ::std::option::Option::None,
|
10606 - | long: ::std::option::Option::None,
|
10607 - | map_of_lists_of_strings: ::std::option::Option::None,
|
10608 - | map_of_maps: ::std::option::Option::None,
|
10609 - | map_of_strings: ::std::option::Option::None,
|
10610 - | map_of_structs: ::std::option::Option::None,
|
10611 - | recursive_list: ::std::option::Option::None,
|
10612 - | recursive_map: ::std::option::Option::None,
|
10613 - | recursive_struct: ::std::option::Option::None,
|
10614 - | simple_struct: ::std::option::Option::None,
|
10615 - | struct_with_json_name: ::std::option::Option::None,
|
10616 - | timestamp: ::std::option::Option::None,
|
10617 - | unix_timestamp: ::std::option::Option::None,
|
10618 - | },
|
10619 - | crate::model::KitchenSink {
|
10620 - | recursive_struct: ::std::option::Option::Some(
|
10621 - | ::std::boxed::Box::new(crate::model::KitchenSink {
|
10622 - | map_of_strings: ::std::option::Option::Some({
|
10623 - | let mut ret =
|
10624 - | ::std::collections::HashMap::new();
|
10625 - | ret.insert(
|
10626 - | "color".to_owned(),
|
10627 - | "red".to_owned(),
|
10628 - | );
|
10629 - | ret.insert(
|
10630 - | "size".to_owned(),
|
10631 - | "large".to_owned(),
|
10632 - | );
|
10633 - | ret
|
10634 - | }),
|
8855 + | async fn parses_map_of_recursive_structure_shapes_response() {
|
8856 + | let output = crate::output::KitchenSinkOperationOutput {
|
8857 + | recursive_map: ::std::option::Option::Some({
|
8858 + | let mut ret = ::std::collections::HashMap::new();
|
8859 + | ret.insert(
|
8860 + | "key-1".to_owned(),
|
8861 + | crate::model::KitchenSink {
|
8862 + | recursive_map: ::std::option::Option::Some({
|
8863 + | let mut ret = ::std::collections::HashMap::new();
|
8864 + | ret.insert(
|
8865 + | "key-2".to_owned(),
|
8866 + | crate::model::KitchenSink {
|
8867 + | recursive_map: ::std::option::Option::Some({
|
8868 + | let mut ret = ::std::collections::HashMap::new();
|
8869 + | ret.insert(
|
8870 + | "key-3".to_owned(),
|
8871 + | crate::model::KitchenSink {
|
8872 + | string: ::std::option::Option::Some(
|
8873 + | "value".to_owned(),
|
8874 + | ),
|
10635 8875 | blob: ::std::option::Option::None,
|
10636 8876 | boolean: ::std::option::Option::None,
|
10637 8877 | double: ::std::option::Option::None,
|
10638 8878 | empty_struct: ::std::option::Option::None,
|
10639 8879 | float: ::std::option::Option::None,
|
10640 8880 | httpdate_timestamp: ::std::option::Option::None,
|
10641 8881 | integer: ::std::option::Option::None,
|
10642 8882 | iso8601_timestamp: ::std::option::Option::None,
|
10643 8883 | json_value: ::std::option::Option::None,
|
10644 8884 | list_of_lists: ::std::option::Option::None,
|
10645 8885 | list_of_maps_of_strings:
|
10646 8886 | ::std::option::Option::None,
|
10647 8887 | list_of_strings: ::std::option::Option::None,
|
10648 8888 | list_of_structs: ::std::option::Option::None,
|
10649 8889 | long: ::std::option::Option::None,
|
10650 8890 | map_of_lists_of_strings:
|
10651 8891 | ::std::option::Option::None,
|
10652 8892 | map_of_maps: ::std::option::Option::None,
|
8893 + | map_of_strings: ::std::option::Option::None,
|
10653 8894 | map_of_structs: ::std::option::Option::None,
|
10654 8895 | recursive_list: ::std::option::Option::None,
|
10655 8896 | recursive_map: ::std::option::Option::None,
|
10656 8897 | recursive_struct: ::std::option::Option::None,
|
10657 8898 | simple_struct: ::std::option::Option::None,
|
10658 - | string: ::std::option::Option::None,
|
10659 8899 | struct_with_json_name: ::std::option::Option::None,
|
10660 8900 | timestamp: ::std::option::Option::None,
|
10661 8901 | unix_timestamp: ::std::option::Option::None,
|
10662 - | }),
|
10663 - | ),
|
10664 - | blob: ::std::option::Option::None,
|
10665 - | boolean: ::std::option::Option::None,
|
10666 - | double: ::std::option::Option::None,
|
10667 - | empty_struct: ::std::option::Option::None,
|
10668 - | float: ::std::option::Option::None,
|
10669 - | httpdate_timestamp: ::std::option::Option::None,
|
10670 - | integer: ::std::option::Option::None,
|
10671 - | iso8601_timestamp: ::std::option::Option::None,
|
10672 - | json_value: ::std::option::Option::None,
|
10673 - | list_of_lists: ::std::option::Option::None,
|
10674 - | list_of_maps_of_strings: ::std::option::Option::None,
|
10675 - | list_of_strings: ::std::option::Option::None,
|
10676 - | list_of_structs: ::std::option::Option::None,
|
10677 - | long: ::std::option::Option::None,
|
10678 - | map_of_lists_of_strings: ::std::option::Option::None,
|
10679 - | map_of_maps: ::std::option::Option::None,
|
10680 - | map_of_strings: ::std::option::Option::None,
|
10681 - | map_of_structs: ::std::option::Option::None,
|
10682 - | recursive_list: ::std::option::Option::None,
|
10683 - | recursive_map: ::std::option::Option::None,
|
10684 - | simple_struct: ::std::option::Option::None,
|
10685 - | string: ::std::option::Option::None,
|
10686 - | struct_with_json_name: ::std::option::Option::None,
|
10687 - | timestamp: ::std::option::Option::None,
|
10688 - | unix_timestamp: ::std::option::Option::None,
|
10689 - | },
|
10690 - | ]),
|
10691 - | blob: ::std::option::Option::None,
|
10692 - | double: ::std::option::Option::None,
|
10693 - | empty_struct: ::std::option::Option::None,
|
10694 - | float: ::std::option::Option::None,
|
10695 - | httpdate_timestamp: ::std::option::Option::None,
|
10696 - | integer: ::std::option::Option::None,
|
10697 - | iso8601_timestamp: ::std::option::Option::None,
|
10698 - | json_value: ::std::option::Option::None,
|
10699 - | list_of_lists: ::std::option::Option::None,
|
10700 - | list_of_maps_of_strings: ::std::option::Option::None,
|
10701 - | list_of_strings: ::std::option::Option::None,
|
10702 - | list_of_structs: ::std::option::Option::None,
|
10703 - | long: ::std::option::Option::None,
|
10704 - | map_of_lists_of_strings: ::std::option::Option::None,
|
10705 - | map_of_maps: ::std::option::Option::None,
|
10706 - | map_of_strings: ::std::option::Option::None,
|
10707 - | map_of_structs: ::std::option::Option::None,
|
10708 - | recursive_map: ::std::option::Option::None,
|
10709 - | recursive_struct: ::std::option::Option::None,
|
10710 - | simple_struct: ::std::option::Option::None,
|
10711 - | struct_with_json_name: ::std::option::Option::None,
|
10712 - | timestamp: ::std::option::Option::None,
|
10713 - | unix_timestamp: ::std::option::Option::None,
|
10714 - | },
|
10715 - | )),
|
8902 + | },
|
8903 + | );
|
8904 + | ret
|
8905 + | }),
|
8906 + | blob: ::std::option::Option::None,
|
8907 + | boolean: ::std::option::Option::None,
|
8908 + | double: ::std::option::Option::None,
|
8909 + | empty_struct: ::std::option::Option::None,
|
8910 + | float: ::std::option::Option::None,
|
8911 + | httpdate_timestamp: ::std::option::Option::None,
|
8912 + | integer: ::std::option::Option::None,
|
8913 + | iso8601_timestamp: ::std::option::Option::None,
|
8914 + | json_value: ::std::option::Option::None,
|
8915 + | list_of_lists: ::std::option::Option::None,
|
8916 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8917 + | list_of_strings: ::std::option::Option::None,
|
8918 + | list_of_structs: ::std::option::Option::None,
|
8919 + | long: ::std::option::Option::None,
|
8920 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8921 + | map_of_maps: ::std::option::Option::None,
|
8922 + | map_of_strings: ::std::option::Option::None,
|
8923 + | map_of_structs: ::std::option::Option::None,
|
8924 + | recursive_list: ::std::option::Option::None,
|
8925 + | recursive_struct: ::std::option::Option::None,
|
8926 + | simple_struct: ::std::option::Option::None,
|
8927 + | string: ::std::option::Option::None,
|
8928 + | struct_with_json_name: ::std::option::Option::None,
|
8929 + | timestamp: ::std::option::Option::None,
|
8930 + | unix_timestamp: ::std::option::Option::None,
|
8931 + | },
|
8932 + | );
|
8933 + | ret
|
8934 + | }),
|
10716 8935 | blob: ::std::option::Option::None,
|
8936 + | boolean: ::std::option::Option::None,
|
10717 8937 | double: ::std::option::Option::None,
|
10718 8938 | empty_struct: ::std::option::Option::None,
|
10719 8939 | float: ::std::option::Option::None,
|
10720 8940 | httpdate_timestamp: ::std::option::Option::None,
|
10721 8941 | integer: ::std::option::Option::None,
|
10722 8942 | iso8601_timestamp: ::std::option::Option::None,
|
10723 8943 | json_value: ::std::option::Option::None,
|
10724 8944 | list_of_lists: ::std::option::Option::None,
|
10725 8945 | list_of_maps_of_strings: ::std::option::Option::None,
|
10726 8946 | list_of_strings: ::std::option::Option::None,
|
10727 8947 | list_of_structs: ::std::option::Option::None,
|
10728 8948 | long: ::std::option::Option::None,
|
10729 8949 | map_of_lists_of_strings: ::std::option::Option::None,
|
10730 8950 | map_of_maps: ::std::option::Option::None,
|
10731 8951 | map_of_strings: ::std::option::Option::None,
|
10732 8952 | map_of_structs: ::std::option::Option::None,
|
10733 8953 | recursive_list: ::std::option::Option::None,
|
10734 - | recursive_map: ::std::option::Option::None,
|
8954 + | recursive_struct: ::std::option::Option::None,
|
10735 8955 | simple_struct: ::std::option::Option::None,
|
8956 + | string: ::std::option::Option::None,
|
10736 8957 | struct_with_json_name: ::std::option::Option::None,
|
10737 8958 | timestamp: ::std::option::Option::None,
|
10738 8959 | unix_timestamp: ::std::option::Option::None,
|
8960 + | },
|
8961 + | );
|
8962 + | ret
|
8963 + | }),
|
8964 + | blob: ::std::option::Option::None,
|
8965 + | boolean: ::std::option::Option::None,
|
8966 + | double: ::std::option::Option::None,
|
8967 + | empty_struct: ::std::option::Option::None,
|
8968 + | float: ::std::option::Option::None,
|
8969 + | httpdate_timestamp: ::std::option::Option::None,
|
8970 + | integer: ::std::option::Option::None,
|
8971 + | iso8601_timestamp: ::std::option::Option::None,
|
8972 + | json_value: ::std::option::Option::None,
|
8973 + | list_of_lists: ::std::option::Option::None,
|
8974 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8975 + | list_of_strings: ::std::option::Option::None,
|
8976 + | list_of_structs: ::std::option::Option::None,
|
8977 + | long: ::std::option::Option::None,
|
8978 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8979 + | map_of_maps: ::std::option::Option::None,
|
8980 + | map_of_strings: ::std::option::Option::None,
|
8981 + | map_of_structs: ::std::option::Option::None,
|
8982 + | recursive_list: ::std::option::Option::None,
|
8983 + | recursive_struct: ::std::option::Option::None,
|
8984 + | simple_struct: ::std::option::Option::None,
|
8985 + | string: ::std::option::Option::None,
|
8986 + | struct_with_json_name: ::std::option::Option::None,
|
8987 + | timestamp: ::std::option::Option::None,
|
8988 + | unix_timestamp: ::std::option::Option::None,
|
8989 + | };
|
8990 + | use ::aws_smithy_http_server::response::IntoResponse;
|
8991 + | let http_response = output.into_response();
|
8992 + | ::pretty_assertions::assert_eq!(
|
8993 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8994 + | http_response.status()
|
8995 + | );
|
8996 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8997 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8998 + | http_response.headers(),
|
8999 + | expected_headers,
|
9000 + | ));
|
9001 + | use ::http_body_util::BodyExt;
|
9002 + | let body = http_response
|
9003 + | .into_body()
|
9004 + | .collect()
|
9005 + | .await
|
9006 + | .expect("unable to collect body")
|
9007 + | .to_bytes();
|
9008 + | ::aws_smithy_protocol_test::assert_ok(
|
9009 + | ::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"))
|
9010 + | );
|
9011 + | }
|
9012 + |
|
9013 + | /// Parses the request id from the response
|
9014 + | /// Test ID: parses_the_request_id_from_the_response
|
9015 + | #[::tokio::test]
|
9016 + | #[::tracing_test::traced_test]
|
9017 + | #[should_panic]
|
9018 + | async fn parses_the_request_id_from_the_response_response() {
|
9019 + | let output = crate::output::KitchenSinkOperationOutput {
|
9020 + | blob: ::std::option::Option::None,
|
9021 + | boolean: ::std::option::Option::None,
|
9022 + | double: ::std::option::Option::None,
|
9023 + | empty_struct: ::std::option::Option::None,
|
9024 + | float: ::std::option::Option::None,
|
9025 + | httpdate_timestamp: ::std::option::Option::None,
|
9026 + | integer: ::std::option::Option::None,
|
9027 + | iso8601_timestamp: ::std::option::Option::None,
|
9028 + | json_value: ::std::option::Option::None,
|
9029 + | list_of_lists: ::std::option::Option::None,
|
9030 + | list_of_maps_of_strings: ::std::option::Option::None,
|
9031 + | list_of_strings: ::std::option::Option::None,
|
9032 + | list_of_structs: ::std::option::Option::None,
|
9033 + | long: ::std::option::Option::None,
|
9034 + | map_of_lists_of_strings: ::std::option::Option::None,
|
9035 + | map_of_maps: ::std::option::Option::None,
|
9036 + | map_of_strings: ::std::option::Option::None,
|
9037 + | map_of_structs: ::std::option::Option::None,
|
9038 + | recursive_list: ::std::option::Option::None,
|
9039 + | recursive_map: ::std::option::Option::None,
|
9040 + | recursive_struct: ::std::option::Option::None,
|
9041 + | simple_struct: ::std::option::Option::None,
|
9042 + | string: ::std::option::Option::None,
|
9043 + | struct_with_json_name: ::std::option::Option::None,
|
9044 + | timestamp: ::std::option::Option::None,
|
9045 + | unix_timestamp: ::std::option::Option::None,
|
9046 + | };
|
9047 + | use ::aws_smithy_http_server::response::IntoResponse;
|
9048 + | let http_response = output.into_response();
|
9049 + | ::pretty_assertions::assert_eq!(
|
9050 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
9051 + | http_response.status()
|
9052 + | );
|
9053 + | let expected_headers = [
|
9054 + | ("Content-Type", "application/x-amz-json-1.1"),
|
9055 + | ("X-Amzn-Requestid", "amazon-uniq-request-id"),
|
9056 + | ];
|
9057 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9058 + | http_response.headers(),
|
9059 + | expected_headers,
|
9060 + | ));
|
9061 + | use ::http_body_util::BodyExt;
|
9062 + | let body = http_response
|
9063 + | .into_body()
|
9064 + | .collect()
|
9065 + | .await
|
9066 + | .expect("unable to collect body")
|
9067 + | .to_bytes();
|
9068 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
9069 + | &body,
|
9070 + | "{}",
|
9071 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9072 + | ));
|
9073 + | }
|
9074 + | }
|
9075 + |
|
9076 + | ::pin_project_lite::pin_project! {
|
9077 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
9078 + | /// [`SimpleScalarPropertiesInput`](crate::input::SimpleScalarPropertiesInput) using modelled bindings.
|
9079 + | pub struct SimpleScalarPropertiesInputFuture {
|
9080 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SimpleScalarPropertiesInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
9081 + | }
|
9082 + | }
|
9083 + |
|
9084 + | impl std::future::Future for SimpleScalarPropertiesInputFuture {
|
9085 + | type Output = Result<
|
9086 + | crate::input::SimpleScalarPropertiesInput,
|
9087 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
9088 + | >;
|
9089 + |
|
9090 + | fn poll(
|
9091 + | self: std::pin::Pin<&mut Self>,
|
9092 + | cx: &mut std::task::Context<'_>,
|
9093 + | ) -> std::task::Poll<Self::Output> {
|
9094 + | let this = self.project();
|
9095 + | this.inner.as_mut().poll(cx)
|
9096 + | }
|
9097 + | }
|
9098 + |
|
9099 + | impl<B>
|
9100 + | ::aws_smithy_http_server::request::FromRequest<
|
9101 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
9102 + | B,
|
9103 + | > for crate::input::SimpleScalarPropertiesInput
|
9104 + | where
|
9105 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
9106 + | B: 'static,
|
9107 + |
|
9108 + | B::Data: Send,
|
9109 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
9110 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
9111 + | {
|
9112 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
9113 + | type Future = SimpleScalarPropertiesInputFuture;
|
9114 + |
|
9115 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
9116 + | let fut = async move {
|
9117 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
9118 + | request.headers(),
|
9119 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
9120 + | ) {
|
9121 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
9122 + | }
|
9123 + | crate::protocol_serde::shape_simple_scalar_properties::de_simple_scalar_properties_http_request(request)
|
9124 + | .await
|
9125 + | };
|
9126 + | use ::futures_util::future::TryFutureExt;
|
9127 + | let fut = fut.map_err(
|
9128 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
9129 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
9130 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
9131 + | },
|
9132 + | );
|
9133 + | SimpleScalarPropertiesInputFuture {
|
9134 + | inner: Box::pin(fut),
|
9135 + | }
|
9136 + | }
|
9137 + | }
|
9138 + | impl
|
9139 + | ::aws_smithy_http_server::response::IntoResponse<
|
9140 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
9141 + | > for crate::output::SimpleScalarPropertiesOutput
|
9142 + | {
|
9143 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
9144 + | match crate::protocol_serde::shape_simple_scalar_properties::ser_simple_scalar_properties_http_response(self) {
|
9145 + | Ok(response) => response,
|
9146 + | Err(e) => {
|
9147 + | ::tracing::error!(error = %e, "failed to serialize response");
|
9148 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
9149 + | }
|
9150 + | }
|
9151 + | }
|
9152 + | }
|
9153 + |
|
9154 + | #[allow(unreachable_code, unused_variables)]
|
9155 + | #[cfg(test)]
|
9156 + | mod simple_scalar_properties_test {
|
9157 + |
|
9158 + | /// Supports handling NaN float values.
|
9159 + | /// Test ID: AwsJson11SupportsNaNFloatInputs
|
9160 + | #[::tokio::test]
|
9161 + | #[::tracing_test::traced_test]
|
9162 + | async fn aws_json11_supports_na_n_float_inputs_request() {
|
9163 + | #[allow(unused_mut)]
|
9164 + | let mut http_request = ::http_1x::Request::builder()
|
9165 + | .uri("/")
|
9166 + | .method("POST")
|
9167 + | .header("Content-Type", "application/x-amz-json-1.1")
|
9168 + | .header("X-Amz-Target", "JsonProtocol.SimpleScalarProperties")
|
9169 + | .body(::aws_smithy_http_server::body::boxed(
|
9170 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
9171 + | &::aws_smithy_protocol_test::decode_body_data(
|
9172 + | "{\n \"floatValue\": \"NaN\",\n \"doubleValue\": \"NaN\"\n}"
|
9173 + | .as_bytes(),
|
9174 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9175 + | ),
|
9176 + | )),
|
9177 + | ))
|
9178 + | .unwrap();
|
9179 + | #[allow(unused_mut)]
|
9180 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9181 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
9182 + | let service = crate::service::JsonProtocol::builder::<
|
9183 + | ::aws_smithy_http_server::body::BoxBody,
|
9184 + | _,
|
9185 + | _,
|
9186 + | _,
|
9187 + | >(config)
|
9188 + | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
9189 + | let sender = sender.clone();
|
9190 + | async move {
|
9191 + | let result = {
|
9192 + | use ::aws_smithy_protocol_test::FloatEquals;
|
9193 + | let expected = crate::input::SimpleScalarPropertiesInput {
|
9194 + | float_value: ::std::option::Option::Some(
|
9195 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
9196 + | "NaN",
|
9197 + | )
|
9198 + | .expect("invalid string for number"),
|
9199 + | ),
|
9200 + | double_value: ::std::option::Option::Some(
|
9201 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
9202 + | "NaN",
|
9203 + | )
|
9204 + | .expect("invalid string for number"),
|
9205 + | ),
|
10739 9206 | };
|
10740 - | ::pretty_assertions::assert_eq!(
|
10741 - | input.blob,
|
10742 - | expected.blob,
|
10743 - | "Unexpected value for `blob`"
|
10744 - | );
|
10745 - | ::pretty_assertions::assert_eq!(
|
10746 - | input.boolean,
|
10747 - | expected.boolean,
|
10748 - | "Unexpected value for `boolean`"
|
10749 - | );
|
10750 9207 | assert!(
|
10751 - | input.double.float_equals(&expected.double),
|
10752 - | "Unexpected value for `double` {:?} vs. {:?}",
|
10753 - | expected.double,
|
10754 - | input.double
|
10755 - | );
|
10756 - | ::pretty_assertions::assert_eq!(
|
10757 - | input.empty_struct,
|
10758 - | expected.empty_struct,
|
10759 - | "Unexpected value for `empty_struct`"
|
9208 + | input.float_value.float_equals(&expected.float_value),
|
9209 + | "Unexpected value for `float_value` {:?} vs. {:?}",
|
9210 + | expected.float_value,
|
9211 + | input.float_value
|
10760 9212 | );
|
10761 9213 | assert!(
|
10762 - | input.float.float_equals(&expected.float),
|
10763 - | "Unexpected value for `float` {:?} vs. {:?}",
|
10764 - | expected.float,
|
10765 - | input.float
|
10766 - | );
|
10767 - | ::pretty_assertions::assert_eq!(
|
10768 - | input.httpdate_timestamp,
|
10769 - | expected.httpdate_timestamp,
|
10770 - | "Unexpected value for `httpdate_timestamp`"
|
10771 - | );
|
10772 - | ::pretty_assertions::assert_eq!(
|
10773 - | input.integer,
|
10774 - | expected.integer,
|
10775 - | "Unexpected value for `integer`"
|
10776 - | );
|
10777 - | ::pretty_assertions::assert_eq!(
|
10778 - | input.iso8601_timestamp,
|
10779 - | expected.iso8601_timestamp,
|
10780 - | "Unexpected value for `iso8601_timestamp`"
|
10781 - | );
|
10782 - | ::pretty_assertions::assert_eq!(
|
10783 - | input.json_value,
|
10784 - | expected.json_value,
|
10785 - | "Unexpected value for `json_value`"
|
10786 - | );
|
10787 - | ::pretty_assertions::assert_eq!(
|
10788 - | input.list_of_lists,
|
10789 - | expected.list_of_lists,
|
10790 - | "Unexpected value for `list_of_lists`"
|
10791 - | );
|
10792 - | ::pretty_assertions::assert_eq!(
|
10793 - | input.list_of_maps_of_strings,
|
10794 - | expected.list_of_maps_of_strings,
|
10795 - | "Unexpected value for `list_of_maps_of_strings`"
|
10796 - | );
|
10797 - | ::pretty_assertions::assert_eq!(
|
10798 - | input.list_of_strings,
|
10799 - | expected.list_of_strings,
|
10800 - | "Unexpected value for `list_of_strings`"
|
10801 - | );
|
10802 - | ::pretty_assertions::assert_eq!(
|
10803 - | input.list_of_structs,
|
10804 - | expected.list_of_structs,
|
10805 - | "Unexpected value for `list_of_structs`"
|
10806 - | );
|
10807 - | ::pretty_assertions::assert_eq!(
|
10808 - | input.long,
|
10809 - | expected.long,
|
10810 - | "Unexpected value for `long`"
|
10811 - | );
|
10812 - | ::pretty_assertions::assert_eq!(
|
10813 - | input.map_of_lists_of_strings,
|
10814 - | expected.map_of_lists_of_strings,
|
10815 - | "Unexpected value for `map_of_lists_of_strings`"
|
10816 - | );
|
10817 - | ::pretty_assertions::assert_eq!(
|
10818 - | input.map_of_maps,
|
10819 - | expected.map_of_maps,
|
10820 - | "Unexpected value for `map_of_maps`"
|
10821 - | );
|
10822 - | ::pretty_assertions::assert_eq!(
|
10823 - | input.map_of_strings,
|
10824 - | expected.map_of_strings,
|
10825 - | "Unexpected value for `map_of_strings`"
|
10826 - | );
|
10827 - | ::pretty_assertions::assert_eq!(
|
10828 - | input.map_of_structs,
|
10829 - | expected.map_of_structs,
|
10830 - | "Unexpected value for `map_of_structs`"
|
10831 - | );
|
10832 - | ::pretty_assertions::assert_eq!(
|
10833 - | input.recursive_list,
|
10834 - | expected.recursive_list,
|
10835 - | "Unexpected value for `recursive_list`"
|
10836 - | );
|
10837 - | ::pretty_assertions::assert_eq!(
|
10838 - | input.recursive_map,
|
10839 - | expected.recursive_map,
|
10840 - | "Unexpected value for `recursive_map`"
|
10841 - | );
|
10842 - | ::pretty_assertions::assert_eq!(
|
10843 - | input.recursive_struct,
|
10844 - | expected.recursive_struct,
|
10845 - | "Unexpected value for `recursive_struct`"
|
10846 - | );
|
10847 - | ::pretty_assertions::assert_eq!(
|
10848 - | input.simple_struct,
|
10849 - | expected.simple_struct,
|
10850 - | "Unexpected value for `simple_struct`"
|
9214 + | input.double_value.float_equals(&expected.double_value),
|
9215 + | "Unexpected value for `double_value` {:?} vs. {:?}",
|
9216 + | expected.double_value,
|
9217 + | input.double_value
|
10851 9218 | );
|
10852 - | ::pretty_assertions::assert_eq!(
|
10853 - | input.string,
|
10854 - | expected.string,
|
10855 - | "Unexpected value for `string`"
|
9219 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
9220 + | float_value: ::std::option::Option::None,
|
9221 + | double_value: ::std::option::Option::None,
|
9222 + | };
|
9223 + | output
|
9224 + | };
|
9225 + | sender.send(()).await.expect("receiver dropped early");
|
9226 + | result
|
9227 + | }
|
9228 + | })
|
9229 + | .build_unchecked();
|
9230 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9231 + | .await
|
9232 + | .expect("unable to make an HTTP request");
|
9233 + | assert!(
|
9234 + | receiver.recv().await.is_some(),
|
9235 + | "we expected operation handler to be invoked but it was not entered"
|
9236 + | );
|
9237 + | }
|
9238 + |
|
9239 + | /// Supports handling Infinity float values.
|
9240 + | /// Test ID: AwsJson11SupportsInfinityFloatInputs
|
9241 + | #[::tokio::test]
|
9242 + | #[::tracing_test::traced_test]
|
9243 + | async fn aws_json11_supports_infinity_float_inputs_request() {
|
9244 + | #[allow(unused_mut)]
|
9245 + | let mut http_request = ::http_1x::Request::builder()
|
9246 + | .uri("/")
|
9247 + | .method("POST")
|
9248 + | .header("Content-Type", "application/x-amz-json-1.1")
|
9249 + | .header("X-Amz-Target", "JsonProtocol.SimpleScalarProperties")
|
9250 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
9251 + | ::bytes::Bytes::copy_from_slice(
|
9252 + | &::aws_smithy_protocol_test::decode_body_data("{\n \"floatValue\": \"Infinity\",\n \"doubleValue\": \"Infinity\"\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
9253 + | )
|
9254 + | ))).unwrap();
|
9255 + | #[allow(unused_mut)]
|
9256 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9257 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
9258 + | let service = crate::service::JsonProtocol::builder::<
|
9259 + | ::aws_smithy_http_server::body::BoxBody,
|
9260 + | _,
|
9261 + | _,
|
9262 + | _,
|
9263 + | >(config)
|
9264 + | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
9265 + | let sender = sender.clone();
|
9266 + | async move {
|
9267 + | let result = {
|
9268 + | use ::aws_smithy_protocol_test::FloatEquals;
|
9269 + | let expected = crate::input::SimpleScalarPropertiesInput {
|
9270 + | float_value: ::std::option::Option::Some(
|
9271 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
9272 + | "Infinity",
|
9273 + | )
|
9274 + | .expect("invalid string for number"),
|
9275 + | ),
|
9276 + | double_value: ::std::option::Option::Some(
|
9277 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
9278 + | "Infinity",
|
9279 + | )
|
9280 + | .expect("invalid string for number"),
|
9281 + | ),
|
9282 + | };
|
9283 + | assert!(
|
9284 + | input.float_value.float_equals(&expected.float_value),
|
9285 + | "Unexpected value for `float_value` {:?} vs. {:?}",
|
9286 + | expected.float_value,
|
9287 + | input.float_value
|
10856 9288 | );
|
10857 - | ::pretty_assertions::assert_eq!(
|
10858 - | input.struct_with_json_name,
|
10859 - | expected.struct_with_json_name,
|
10860 - | "Unexpected value for `struct_with_json_name`"
|
9289 + | assert!(
|
9290 + | input.double_value.float_equals(&expected.double_value),
|
9291 + | "Unexpected value for `double_value` {:?} vs. {:?}",
|
9292 + | expected.double_value,
|
9293 + | input.double_value
|
10861 9294 | );
|
10862 - | ::pretty_assertions::assert_eq!(
|
10863 - | input.timestamp,
|
10864 - | expected.timestamp,
|
10865 - | "Unexpected value for `timestamp`"
|
9295 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
9296 + | float_value: ::std::option::Option::None,
|
9297 + | double_value: ::std::option::Option::None,
|
9298 + | };
|
9299 + | output
|
9300 + | };
|
9301 + | sender.send(()).await.expect("receiver dropped early");
|
9302 + | result
|
9303 + | }
|
9304 + | })
|
9305 + | .build_unchecked();
|
9306 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9307 + | .await
|
9308 + | .expect("unable to make an HTTP request");
|
9309 + | assert!(
|
9310 + | receiver.recv().await.is_some(),
|
9311 + | "we expected operation handler to be invoked but it was not entered"
|
9312 + | );
|
9313 + | }
|
9314 + |
|
9315 + | /// Supports handling -Infinity float values.
|
9316 + | /// Test ID: AwsJson11SupportsNegativeInfinityFloatInputs
|
9317 + | #[::tokio::test]
|
9318 + | #[::tracing_test::traced_test]
|
9319 + | async fn aws_json11_supports_negative_infinity_float_inputs_request() {
|
9320 + | #[allow(unused_mut)]
|
9321 + | let mut http_request = ::http_1x::Request::builder()
|
9322 + | .uri("/")
|
9323 + | .method("POST")
|
9324 + | .header("Content-Type", "application/x-amz-json-1.1")
|
9325 + | .header("X-Amz-Target", "JsonProtocol.SimpleScalarProperties")
|
9326 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
9327 + | ::bytes::Bytes::copy_from_slice(
|
9328 + | &::aws_smithy_protocol_test::decode_body_data("{\n \"floatValue\": \"-Infinity\",\n \"doubleValue\": \"-Infinity\"\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
9329 + | )
|
9330 + | ))).unwrap();
|
9331 + | #[allow(unused_mut)]
|
9332 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9333 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
9334 + | let service = crate::service::JsonProtocol::builder::<
|
9335 + | ::aws_smithy_http_server::body::BoxBody,
|
9336 + | _,
|
9337 + | _,
|
9338 + | _,
|
9339 + | >(config)
|
9340 + | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
9341 + | let sender = sender.clone();
|
9342 + | async move {
|
9343 + | let result = {
|
9344 + | use ::aws_smithy_protocol_test::FloatEquals;
|
9345 + | let expected = crate::input::SimpleScalarPropertiesInput {
|
9346 + | float_value: ::std::option::Option::Some(
|
9347 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
9348 + | "-Infinity",
|
9349 + | )
|
9350 + | .expect("invalid string for number"),
|
9351 + | ),
|
9352 + | double_value: ::std::option::Option::Some(
|
9353 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
9354 + | "-Infinity",
|
9355 + | )
|
9356 + | .expect("invalid string for number"),
|
9357 + | ),
|
9358 + | };
|
9359 + | assert!(
|
9360 + | input.float_value.float_equals(&expected.float_value),
|
9361 + | "Unexpected value for `float_value` {:?} vs. {:?}",
|
9362 + | expected.float_value,
|
9363 + | input.float_value
|
10866 9364 | );
|
10867 - | ::pretty_assertions::assert_eq!(
|
10868 - | input.unix_timestamp,
|
10869 - | expected.unix_timestamp,
|
10870 - | "Unexpected value for `unix_timestamp`"
|
9365 + | assert!(
|
9366 + | input.double_value.float_equals(&expected.double_value),
|
9367 + | "Unexpected value for `double_value` {:?} vs. {:?}",
|
9368 + | expected.double_value,
|
9369 + | input.double_value
|
10871 9370 | );
|
10872 - | let output = crate::output::KitchenSinkOperationOutput {
|
10873 - | blob: ::std::option::Option::None,
|
10874 - | boolean: ::std::option::Option::None,
|
10875 - | double: ::std::option::Option::None,
|
10876 - | empty_struct: ::std::option::Option::None,
|
10877 - | float: ::std::option::Option::None,
|
10878 - | httpdate_timestamp: ::std::option::Option::None,
|
10879 - | integer: ::std::option::Option::None,
|
10880 - | iso8601_timestamp: ::std::option::Option::None,
|
10881 - | json_value: ::std::option::Option::None,
|
10882 - | list_of_lists: ::std::option::Option::None,
|
10883 - | list_of_maps_of_strings: ::std::option::Option::None,
|
10884 - | list_of_strings: ::std::option::Option::None,
|
10885 - | list_of_structs: ::std::option::Option::None,
|
10886 - | long: ::std::option::Option::None,
|
10887 - | map_of_lists_of_strings: ::std::option::Option::None,
|
10888 - | map_of_maps: ::std::option::Option::None,
|
10889 - | map_of_strings: ::std::option::Option::None,
|
10890 - | map_of_structs: ::std::option::Option::None,
|
10891 - | recursive_list: ::std::option::Option::None,
|
10892 - | recursive_map: ::std::option::Option::None,
|
10893 - | recursive_struct: ::std::option::Option::None,
|
10894 - | simple_struct: ::std::option::Option::None,
|
10895 - | string: ::std::option::Option::None,
|
10896 - | struct_with_json_name: ::std::option::Option::None,
|
10897 - | timestamp: ::std::option::Option::None,
|
10898 - | unix_timestamp: ::std::option::Option::None,
|
9371 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
9372 + | float_value: ::std::option::Option::None,
|
9373 + | double_value: ::std::option::Option::None,
|
9374 + | };
|
9375 + | output
|
9376 + | };
|
9377 + | sender.send(()).await.expect("receiver dropped early");
|
9378 + | result
|
9379 + | }
|
9380 + | })
|
9381 + | .build_unchecked();
|
9382 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9383 + | .await
|
9384 + | .expect("unable to make an HTTP request");
|
9385 + | assert!(
|
9386 + | receiver.recv().await.is_some(),
|
9387 + | "we expected operation handler to be invoked but it was not entered"
|
9388 + | );
|
9389 + | }
|
9390 + |
|
9391 + | /// Supports handling NaN float values.
|
9392 + | /// Test ID: AwsJson11SupportsNaNFloatInputs
|
9393 + | #[::tokio::test]
|
9394 + | #[::tracing_test::traced_test]
|
9395 + | async fn aws_json11_supports_na_n_float_inputs_response() {
|
9396 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
9397 + | float_value: ::std::option::Option::Some(
|
9398 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN")
|
9399 + | .expect("invalid string for number"),
|
9400 + | ),
|
9401 + | double_value: ::std::option::Option::Some(
|
9402 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN")
|
9403 + | .expect("invalid string for number"),
|
9404 + | ),
|
9405 + | };
|
9406 + | use ::aws_smithy_http_server::response::IntoResponse;
|
9407 + | let http_response = output.into_response();
|
9408 + | ::pretty_assertions::assert_eq!(
|
9409 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
9410 + | http_response.status()
|
9411 + | );
|
9412 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
9413 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9414 + | http_response.headers(),
|
9415 + | expected_headers,
|
9416 + | ));
|
9417 + | use ::http_body_util::BodyExt;
|
9418 + | let body = http_response
|
9419 + | .into_body()
|
9420 + | .collect()
|
9421 + | .await
|
9422 + | .expect("unable to collect body")
|
9423 + | .to_bytes();
|
9424 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
9425 + | &body,
|
9426 + | "{\n \"floatValue\": \"NaN\",\n \"doubleValue\": \"NaN\"\n}",
|
9427 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9428 + | ));
|
9429 + | }
|
9430 + |
|
9431 + | /// Supports handling Infinity float values.
|
9432 + | /// Test ID: AwsJson11SupportsInfinityFloatInputs
|
9433 + | #[::tokio::test]
|
9434 + | #[::tracing_test::traced_test]
|
9435 + | async fn aws_json11_supports_infinity_float_inputs_response() {
|
9436 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
9437 + | float_value: ::std::option::Option::Some(
|
9438 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity")
|
9439 + | .expect("invalid string for number"),
|
9440 + | ),
|
9441 + | double_value: ::std::option::Option::Some(
|
9442 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity")
|
9443 + | .expect("invalid string for number"),
|
9444 + | ),
|
9445 + | };
|
9446 + | use ::aws_smithy_http_server::response::IntoResponse;
|
9447 + | let http_response = output.into_response();
|
9448 + | ::pretty_assertions::assert_eq!(
|
9449 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
9450 + | http_response.status()
|
9451 + | );
|
9452 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
9453 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9454 + | http_response.headers(),
|
9455 + | expected_headers,
|
9456 + | ));
|
9457 + | use ::http_body_util::BodyExt;
|
9458 + | let body = http_response
|
9459 + | .into_body()
|
9460 + | .collect()
|
9461 + | .await
|
9462 + | .expect("unable to collect body")
|
9463 + | .to_bytes();
|
9464 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
9465 + | &body,
|
9466 + | "{\n \"floatValue\": \"Infinity\",\n \"doubleValue\": \"Infinity\"\n}",
|
9467 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9468 + | ));
|
9469 + | }
|
9470 + |
|
9471 + | /// Supports handling -Infinity float values.
|
9472 + | /// Test ID: AwsJson11SupportsNegativeInfinityFloatInputs
|
9473 + | #[::tokio::test]
|
9474 + | #[::tracing_test::traced_test]
|
9475 + | async fn aws_json11_supports_negative_infinity_float_inputs_response() {
|
9476 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
9477 + | float_value: ::std::option::Option::Some(
|
9478 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity")
|
9479 + | .expect("invalid string for number"),
|
9480 + | ),
|
9481 + | double_value: ::std::option::Option::Some(
|
9482 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity")
|
9483 + | .expect("invalid string for number"),
|
9484 + | ),
|
9485 + | };
|
9486 + | use ::aws_smithy_http_server::response::IntoResponse;
|
9487 + | let http_response = output.into_response();
|
9488 + | ::pretty_assertions::assert_eq!(
|
9489 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
9490 + | http_response.status()
|
9491 + | );
|
9492 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
9493 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9494 + | http_response.headers(),
|
9495 + | expected_headers,
|
9496 + | ));
|
9497 + | use ::http_body_util::BodyExt;
|
9498 + | let body = http_response
|
9499 + | .into_body()
|
9500 + | .collect()
|
9501 + | .await
|
9502 + | .expect("unable to collect body")
|
9503 + | .to_bytes();
|
9504 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
9505 + | &body,
|
9506 + | "{\n \"floatValue\": \"-Infinity\",\n \"doubleValue\": \"-Infinity\"\n}",
|
9507 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9508 + | ));
|
9509 + | }
|
9510 + | }
|
9511 + |
|
9512 + | ::pin_project_lite::pin_project! {
|
9513 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
9514 + | /// [`OperationWithOptionalInputOutputInput`](crate::input::OperationWithOptionalInputOutputInput) using modelled bindings.
|
9515 + | pub struct OperationWithOptionalInputOutputInputFuture {
|
9516 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::OperationWithOptionalInputOutputInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
9517 + | }
|
9518 + | }
|
9519 + |
|
9520 + | impl std::future::Future for OperationWithOptionalInputOutputInputFuture {
|
9521 + | type Output = Result<
|
9522 + | crate::input::OperationWithOptionalInputOutputInput,
|
9523 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
9524 + | >;
|
9525 + |
|
9526 + | fn poll(
|
9527 + | self: std::pin::Pin<&mut Self>,
|
9528 + | cx: &mut std::task::Context<'_>,
|
9529 + | ) -> std::task::Poll<Self::Output> {
|
9530 + | let this = self.project();
|
9531 + | this.inner.as_mut().poll(cx)
|
9532 + | }
|
9533 + | }
|
9534 + |
|
9535 + | impl<B>
|
9536 + | ::aws_smithy_http_server::request::FromRequest<
|
9537 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
9538 + | B,
|
9539 + | > for crate::input::OperationWithOptionalInputOutputInput
|
9540 + | where
|
9541 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
9542 + | B: 'static,
|
9543 + |
|
9544 + | B::Data: Send,
|
9545 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
9546 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
9547 + | {
|
9548 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
9549 + | type Future = OperationWithOptionalInputOutputInputFuture;
|
9550 + |
|
9551 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
9552 + | let fut = async move {
|
9553 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
9554 + | request.headers(),
|
9555 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
9556 + | ) {
|
9557 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
9558 + | }
|
9559 + | crate::protocol_serde::shape_operation_with_optional_input_output::de_operation_with_optional_input_output_http_request(request)
|
9560 + | .await
|
9561 + | };
|
9562 + | use ::futures_util::future::TryFutureExt;
|
9563 + | let fut = fut.map_err(
|
9564 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
9565 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
9566 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
9567 + | },
|
9568 + | );
|
9569 + | OperationWithOptionalInputOutputInputFuture {
|
9570 + | inner: Box::pin(fut),
|
9571 + | }
|
9572 + | }
|
9573 + | }
|
9574 + | impl
|
9575 + | ::aws_smithy_http_server::response::IntoResponse<
|
9576 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
9577 + | > for crate::output::OperationWithOptionalInputOutputOutput
|
9578 + | {
|
9579 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
9580 + | match crate::protocol_serde::shape_operation_with_optional_input_output::ser_operation_with_optional_input_output_http_response(self) {
|
9581 + | Ok(response) => response,
|
9582 + | Err(e) => {
|
9583 + | ::tracing::error!(error = %e, "failed to serialize response");
|
9584 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
9585 + | }
|
9586 + | }
|
9587 + | }
|
9588 + | }
|
9589 + |
|
9590 + | #[allow(unreachable_code, unused_variables)]
|
9591 + | #[cfg(test)]
|
9592 + | mod operation_with_optional_input_output_test {
|
9593 + |
|
9594 + | /// Can call operations with no input or output
|
9595 + | /// Test ID: can_call_operation_with_no_input_or_output
|
9596 + | #[::tokio::test]
|
9597 + | #[::tracing_test::traced_test]
|
9598 + | async fn can_call_operation_with_no_input_or_output_request() {
|
9599 + | #[allow(unused_mut)]
|
9600 + | let mut http_request = ::http_1x::Request::builder()
|
9601 + | .uri("/")
|
9602 + | .method("POST")
|
9603 + | .header("Content-Type", "application/x-amz-json-1.1")
|
9604 + | .header(
|
9605 + | "X-Amz-Target",
|
9606 + | "JsonProtocol.OperationWithOptionalInputOutput",
|
9607 + | )
|
9608 + | .body(::aws_smithy_http_server::body::boxed(
|
9609 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
9610 + | &::aws_smithy_protocol_test::decode_body_data(
|
9611 + | "{}".as_bytes(),
|
9612 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9613 + | ),
|
9614 + | )),
|
9615 + | ))
|
9616 + | .unwrap();
|
9617 + | #[allow(unused_mut)]
|
9618 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9619 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
9620 + | let service = crate::service::JsonProtocol::builder::<
|
9621 + | ::aws_smithy_http_server::body::BoxBody,
|
9622 + | _,
|
9623 + | _,
|
9624 + | _,
|
9625 + | >(config)
|
9626 + | .operation_with_optional_input_output(
|
9627 + | move |input: crate::input::OperationWithOptionalInputOutputInput| {
|
9628 + | let sender = sender.clone();
|
9629 + | async move {
|
9630 + | let result = {
|
9631 + | let expected = crate::input::OperationWithOptionalInputOutputInput {
|
9632 + | value: ::std::option::Option::None,
|
9633 + | };
|
9634 + | ::pretty_assertions::assert_eq!(input, expected);
|
9635 + | let output = crate::output::OperationWithOptionalInputOutputOutput {
|
9636 + | value: ::std::option::Option::None,
|
9637 + | };
|
9638 + | output
|
9639 + | };
|
9640 + | sender.send(()).await.expect("receiver dropped early");
|
9641 + | result
|
9642 + | }
|
9643 + | },
|
9644 + | )
|
9645 + | .build_unchecked();
|
9646 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9647 + | .await
|
9648 + | .expect("unable to make an HTTP request");
|
9649 + | assert!(
|
9650 + | receiver.recv().await.is_some(),
|
9651 + | "we expected operation handler to be invoked but it was not entered"
|
9652 + | );
|
9653 + | }
|
9654 + |
|
9655 + | /// Can invoke operations with optional input
|
9656 + | /// Test ID: can_call_operation_with_optional_input
|
9657 + | #[::tokio::test]
|
9658 + | #[::tracing_test::traced_test]
|
9659 + | async fn can_call_operation_with_optional_input_request() {
|
9660 + | #[allow(unused_mut)]
|
9661 + | let mut http_request = ::http_1x::Request::builder()
|
9662 + | .uri("/")
|
9663 + | .method("POST")
|
9664 + | .header("Content-Type", "application/x-amz-json-1.1")
|
9665 + | .header(
|
9666 + | "X-Amz-Target",
|
9667 + | "JsonProtocol.OperationWithOptionalInputOutput",
|
9668 + | )
|
9669 + | .body(::aws_smithy_http_server::body::boxed(
|
9670 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
9671 + | &::aws_smithy_protocol_test::decode_body_data(
|
9672 + | "{\"Value\":\"Hi\"}".as_bytes(),
|
9673 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9674 + | ),
|
9675 + | )),
|
9676 + | ))
|
9677 + | .unwrap();
|
9678 + | #[allow(unused_mut)]
|
9679 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9680 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
9681 + | let service = crate::service::JsonProtocol::builder::<
|
9682 + | ::aws_smithy_http_server::body::BoxBody,
|
9683 + | _,
|
9684 + | _,
|
9685 + | _,
|
9686 + | >(config)
|
9687 + | .operation_with_optional_input_output(
|
9688 + | move |input: crate::input::OperationWithOptionalInputOutputInput| {
|
9689 + | let sender = sender.clone();
|
9690 + | async move {
|
9691 + | let result = {
|
9692 + | let expected = crate::input::OperationWithOptionalInputOutputInput {
|
9693 + | value: ::std::option::Option::Some("Hi".to_owned()),
|
9694 + | };
|
9695 + | ::pretty_assertions::assert_eq!(input, expected);
|
9696 + | let output = crate::output::OperationWithOptionalInputOutputOutput {
|
9697 + | value: ::std::option::Option::None,
|
9698 + | };
|
9699 + | output
|
9700 + | };
|
9701 + | sender.send(()).await.expect("receiver dropped early");
|
9702 + | result
|
9703 + | }
|
9704 + | },
|
9705 + | )
|
9706 + | .build_unchecked();
|
9707 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9708 + | .await
|
9709 + | .expect("unable to make an HTTP request");
|
9710 + | assert!(
|
9711 + | receiver.recv().await.is_some(),
|
9712 + | "we expected operation handler to be invoked but it was not entered"
|
9713 + | );
|
9714 + | }
|
9715 + | }
|
9716 + |
|
9717 + | ::pin_project_lite::pin_project! {
|
9718 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
9719 + | /// [`PutAndGetInlineDocumentsInput`](crate::input::PutAndGetInlineDocumentsInput) using modelled bindings.
|
9720 + | pub struct PutAndGetInlineDocumentsInputFuture {
|
9721 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::PutAndGetInlineDocumentsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
9722 + | }
|
9723 + | }
|
9724 + |
|
9725 + | impl std::future::Future for PutAndGetInlineDocumentsInputFuture {
|
9726 + | type Output = Result<
|
9727 + | crate::input::PutAndGetInlineDocumentsInput,
|
9728 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
9729 + | >;
|
9730 + |
|
9731 + | fn poll(
|
9732 + | self: std::pin::Pin<&mut Self>,
|
9733 + | cx: &mut std::task::Context<'_>,
|
9734 + | ) -> std::task::Poll<Self::Output> {
|
9735 + | let this = self.project();
|
9736 + | this.inner.as_mut().poll(cx)
|
9737 + | }
|
9738 + | }
|
9739 + |
|
9740 + | impl<B>
|
9741 + | ::aws_smithy_http_server::request::FromRequest<
|
9742 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
9743 + | B,
|
9744 + | > for crate::input::PutAndGetInlineDocumentsInput
|
9745 + | where
|
9746 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
9747 + | B: 'static,
|
9748 + |
|
9749 + | B::Data: Send,
|
9750 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
9751 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
9752 + | {
|
9753 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
9754 + | type Future = PutAndGetInlineDocumentsInputFuture;
|
9755 + |
|
9756 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
9757 + | let fut = async move {
|
9758 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
9759 + | request.headers(),
|
9760 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
9761 + | ) {
|
9762 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
9763 + | }
|
9764 + | crate::protocol_serde::shape_put_and_get_inline_documents::de_put_and_get_inline_documents_http_request(request)
|
9765 + | .await
|
9766 + | };
|
9767 + | use ::futures_util::future::TryFutureExt;
|
9768 + | let fut = fut.map_err(
|
9769 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
9770 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
9771 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
9772 + | },
|
9773 + | );
|
9774 + | PutAndGetInlineDocumentsInputFuture {
|
9775 + | inner: Box::pin(fut),
|
9776 + | }
|
9777 + | }
|
9778 + | }
|
9779 + | impl
|
9780 + | ::aws_smithy_http_server::response::IntoResponse<
|
9781 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
9782 + | > for crate::output::PutAndGetInlineDocumentsOutput
|
9783 + | {
|
9784 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
9785 + | match crate::protocol_serde::shape_put_and_get_inline_documents::ser_put_and_get_inline_documents_http_response(self) {
|
9786 + | Ok(response) => response,
|
9787 + | Err(e) => {
|
9788 + | ::tracing::error!(error = %e, "failed to serialize response");
|
9789 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
9790 + | }
|
9791 + | }
|
9792 + | }
|
9793 + | }
|
9794 + |
|
9795 + | #[allow(unreachable_code, unused_variables)]
|
9796 + | #[cfg(test)]
|
9797 + | mod put_and_get_inline_documents_test {
|
9798 + |
|
9799 + | /// Serializes inline documents in a JSON request.
|
9800 + | /// Test ID: PutAndGetInlineDocumentsInput
|
9801 + | #[::tokio::test]
|
9802 + | #[::tracing_test::traced_test]
|
9803 + | async fn put_and_get_inline_documents_input_request() {
|
9804 + | #[allow(unused_mut)]
|
9805 + | let mut http_request = ::http_1x::Request::builder()
|
9806 + | .uri("/")
|
9807 + | .method("POST")
|
9808 + | .header("Content-Type", "application/x-amz-json-1.1")
|
9809 + | .header("X-Amz-Target", "JsonProtocol.PutAndGetInlineDocuments")
|
9810 + | .body(::aws_smithy_http_server::body::boxed(
|
9811 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
9812 + | &::aws_smithy_protocol_test::decode_body_data(
|
9813 + | "{\n \"inlineDocument\": {\"foo\": \"bar\"}\n}".as_bytes(),
|
9814 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9815 + | ),
|
9816 + | )),
|
9817 + | ))
|
9818 + | .unwrap();
|
9819 + | #[allow(unused_mut)]
|
9820 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9821 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
9822 + | let service = crate::service::JsonProtocol::builder::<
|
9823 + | ::aws_smithy_http_server::body::BoxBody,
|
9824 + | _,
|
9825 + | _,
|
9826 + | _,
|
9827 + | >(config)
|
9828 + | .put_and_get_inline_documents(move |input: crate::input::PutAndGetInlineDocumentsInput| {
|
9829 + | let sender = sender.clone();
|
9830 + | async move {
|
9831 + | let result = {
|
9832 + | let expected = crate::input::PutAndGetInlineDocumentsInput {
|
9833 + | inline_document: ::std::option::Option::Some({
|
9834 + | let json_bytes = br#"{
|
9835 + | "foo": "bar"
|
9836 + | }"#;
|
9837 + | let mut tokens =
|
9838 + | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
9839 + | .peekable();
|
9840 + | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
9841 + | .expect("well formed json")
|
9842 + | }),
|
9843 + | };
|
9844 + | ::pretty_assertions::assert_eq!(input, expected);
|
9845 + | let output = crate::output::PutAndGetInlineDocumentsOutput {
|
9846 + | inline_document: ::std::option::Option::Some({
|
9847 + | let json_bytes = br#"null"#;
|
9848 + | let mut tokens =
|
9849 + | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
9850 + | .peekable();
|
9851 + | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
9852 + | .expect("well formed json")
|
9853 + | }),
|
9854 + | };
|
9855 + | output
|
9856 + | };
|
9857 + | sender.send(()).await.expect("receiver dropped early");
|
9858 + | result
|
9859 + | }
|
9860 + | })
|
9861 + | .build_unchecked();
|
9862 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9863 + | .await
|
9864 + | .expect("unable to make an HTTP request");
|
9865 + | assert!(
|
9866 + | receiver.recv().await.is_some(),
|
9867 + | "we expected operation handler to be invoked but it was not entered"
|
9868 + | );
|
9869 + | }
|
9870 + |
|
9871 + | /// Serializes inline documents in a JSON response.
|
9872 + | /// Test ID: PutAndGetInlineDocumentsInput
|
9873 + | #[::tokio::test]
|
9874 + | #[::tracing_test::traced_test]
|
9875 + | async fn put_and_get_inline_documents_input_response() {
|
9876 + | let output = crate::output::PutAndGetInlineDocumentsOutput {
|
9877 + | inline_document: ::std::option::Option::Some({
|
9878 + | let json_bytes = br#"{
|
9879 + | "foo": "bar"
|
9880 + | }"#;
|
9881 + | let mut tokens =
|
9882 + | ::aws_smithy_json::deserialize::json_token_iter(json_bytes).peekable();
|
9883 + | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
9884 + | .expect("well formed json")
|
9885 + | }),
|
9886 + | };
|
9887 + | use ::aws_smithy_http_server::response::IntoResponse;
|
9888 + | let http_response = output.into_response();
|
9889 + | ::pretty_assertions::assert_eq!(
|
9890 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
9891 + | http_response.status()
|
9892 + | );
|
9893 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
9894 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9895 + | http_response.headers(),
|
9896 + | expected_headers,
|
9897 + | ));
|
9898 + | use ::http_body_util::BodyExt;
|
9899 + | let body = http_response
|
9900 + | .into_body()
|
9901 + | .collect()
|
9902 + | .await
|
9903 + | .expect("unable to collect body")
|
9904 + | .to_bytes();
|
9905 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
9906 + | &body,
|
9907 + | "{\n \"inlineDocument\": {\"foo\": \"bar\"}\n}",
|
9908 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9909 + | ));
|
9910 + | }
|
9911 + | }
|
9912 + |
|
9913 + | ::pin_project_lite::pin_project! {
|
9914 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
9915 + | /// [`JsonEnumsInput`](crate::input::JsonEnumsInput) using modelled bindings.
|
9916 + | pub struct JsonEnumsInputFuture {
|
9917 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::JsonEnumsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
9918 + | }
|
9919 + | }
|
9920 + |
|
9921 + | impl std::future::Future for JsonEnumsInputFuture {
|
9922 + | type Output = Result<
|
9923 + | crate::input::JsonEnumsInput,
|
9924 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
9925 + | >;
|
9926 + |
|
9927 + | fn poll(
|
9928 + | self: std::pin::Pin<&mut Self>,
|
9929 + | cx: &mut std::task::Context<'_>,
|
9930 + | ) -> std::task::Poll<Self::Output> {
|
9931 + | let this = self.project();
|
9932 + | this.inner.as_mut().poll(cx)
|
9933 + | }
|
9934 + | }
|
9935 + |
|
9936 + | impl<B>
|
9937 + | ::aws_smithy_http_server::request::FromRequest<
|
9938 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
9939 + | B,
|
9940 + | > for crate::input::JsonEnumsInput
|
9941 + | where
|
9942 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
9943 + | B: 'static,
|
9944 + |
|
9945 + | B::Data: Send,
|
9946 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
9947 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
9948 + | {
|
9949 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
9950 + | type Future = JsonEnumsInputFuture;
|
9951 + |
|
9952 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
9953 + | let fut = async move {
|
9954 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
9955 + | request.headers(),
|
9956 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
9957 + | ) {
|
9958 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
9959 + | }
|
9960 + | crate::protocol_serde::shape_json_enums::de_json_enums_http_request(request).await
|
9961 + | };
|
9962 + | use ::futures_util::future::TryFutureExt;
|
9963 + | let fut = fut.map_err(
|
9964 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
9965 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
9966 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
9967 + | },
|
9968 + | );
|
9969 + | JsonEnumsInputFuture {
|
9970 + | inner: Box::pin(fut),
|
9971 + | }
|
9972 + | }
|
9973 + | }
|
9974 + | impl
|
9975 + | ::aws_smithy_http_server::response::IntoResponse<
|
9976 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
9977 + | > for crate::output::JsonEnumsOutput
|
9978 + | {
|
9979 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
9980 + | match crate::protocol_serde::shape_json_enums::ser_json_enums_http_response(self) {
|
9981 + | Ok(response) => response,
|
9982 + | Err(e) => {
|
9983 + | ::tracing::error!(error = %e, "failed to serialize response");
|
9984 + | ::aws_smithy_http_server::response::IntoResponse::<
|
9985 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
9986 + | >::into_response(
|
9987 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
9988 + | e,
|
9989 + | ),
|
9990 + | )
|
9991 + | }
|
9992 + | }
|
9993 + | }
|
9994 + | }
|
9995 + | impl
|
9996 + | ::aws_smithy_http_server::response::IntoResponse<
|
9997 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
9998 + | > for crate::error::JsonEnumsError
|
9999 + | {
|
10000 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
10001 + | match crate::protocol_serde::shape_json_enums::ser_json_enums_http_error(&self) {
|
10002 + | Ok(mut response) => {
|
10003 + | response.extensions_mut().insert(
|
10004 + | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
10005 + | );
|
10006 + | response
|
10007 + | }
|
10008 + | Err(e) => {
|
10009 + | ::tracing::error!(error = %e, "failed to serialize response");
|
10010 + | ::aws_smithy_http_server::response::IntoResponse::<
|
10011 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10012 + | >::into_response(
|
10013 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
10014 + | e,
|
10015 + | ),
|
10016 + | )
|
10017 + | }
|
10018 + | }
|
10019 + | }
|
10020 + | }
|
10021 + |
|
10022 + | #[allow(unreachable_code, unused_variables)]
|
10023 + | #[cfg(test)]
|
10024 + | mod json_enums_test {
|
10025 + |
|
10026 + | /// Serializes simple scalar properties
|
10027 + | /// Test ID: AwsJson11Enums
|
10028 + | #[::tokio::test]
|
10029 + | #[::tracing_test::traced_test]
|
10030 + | async fn aws_json11_enums_request() {
|
10031 + | #[allow(unused_mut)]
|
10032 + | let mut http_request = ::http_1x::Request::builder()
|
10033 + | .uri("/")
|
10034 + | .method("POST")
|
10035 + | .header("Content-Type", "application/x-amz-json-1.1")
|
10036 + | .header("X-Amz-Target", "JsonProtocol.JsonEnums")
|
10037 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
10038 + | ::bytes::Bytes::copy_from_slice(
|
10039 + | &::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"))
|
10040 + | )
|
10041 + | ))).unwrap();
|
10042 + | #[allow(unused_mut)]
|
10043 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10044 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
10045 + | let service = crate::service::JsonProtocol::builder::<
|
10046 + | ::aws_smithy_http_server::body::BoxBody,
|
10047 + | _,
|
10048 + | _,
|
10049 + | _,
|
10050 + | >(config)
|
10051 + | .json_enums(move |input: crate::input::JsonEnumsInput| {
|
10052 + | let sender = sender.clone();
|
10053 + | async move {
|
10054 + | let result = {
|
10055 + | let expected = crate::input::JsonEnumsInput {
|
10056 + | foo_enum1: ::std::option::Option::Some(
|
10057 + | "Foo"
|
10058 + | .parse::<crate::model::FooEnum>()
|
10059 + | .expect("static value validated to member"),
|
10060 + | ),
|
10061 + | foo_enum2: ::std::option::Option::Some(
|
10062 + | "0".parse::<crate::model::FooEnum>()
|
10063 + | .expect("static value validated to member"),
|
10064 + | ),
|
10065 + | foo_enum3: ::std::option::Option::Some(
|
10066 + | "1".parse::<crate::model::FooEnum>()
|
10067 + | .expect("static value validated to member"),
|
10068 + | ),
|
10069 + | foo_enum_list: ::std::option::Option::Some(vec![
|
10070 + | "Foo"
|
10071 + | .parse::<crate::model::FooEnum>()
|
10072 + | .expect("static value validated to member"),
|
10073 + | "0".parse::<crate::model::FooEnum>()
|
10074 + | .expect("static value validated to member"),
|
10075 + | ]),
|
10076 + | foo_enum_set: ::std::option::Option::Some(
|
10077 + | vec![
|
10078 + | "Foo"
|
10079 + | .parse::<crate::model::FooEnum>()
|
10080 + | .expect("static value validated to member"),
|
10081 + | "0".parse::<crate::model::FooEnum>()
|
10082 + | .expect("static value validated to member"),
|
10083 + | ]
|
10084 + | .try_into()
|
10085 + | .expect("this is only used in tests"),
|
10086 + | ),
|
10087 + | foo_enum_map: ::std::option::Option::Some({
|
10088 + | let mut ret = ::std::collections::HashMap::new();
|
10089 + | ret.insert(
|
10090 + | "hi".to_owned(),
|
10091 + | "Foo"
|
10092 + | .parse::<crate::model::FooEnum>()
|
10093 + | .expect("static value validated to member"),
|
10094 + | );
|
10095 + | ret.insert(
|
10096 + | "zero".to_owned(),
|
10097 + | "0".parse::<crate::model::FooEnum>()
|
10098 + | .expect("static value validated to member"),
|
10099 + | );
|
10100 + | ret
|
10101 + | }),
|
10102 + | };
|
10103 + | ::pretty_assertions::assert_eq!(input, expected);
|
10104 + | let output = crate::output::JsonEnumsOutput {
|
10105 + | foo_enum1: ::std::option::Option::None,
|
10106 + | foo_enum2: ::std::option::Option::None,
|
10107 + | foo_enum3: ::std::option::Option::None,
|
10108 + | foo_enum_list: ::std::option::Option::None,
|
10109 + | foo_enum_set: ::std::option::Option::None,
|
10110 + | foo_enum_map: ::std::option::Option::None,
|
10899 10111 | };
|
10900 10112 | Ok(output)
|
10901 10113 | };
|
10902 10114 | sender.send(()).await.expect("receiver dropped early");
|
10903 10115 | result
|
10904 10116 | }
|
10905 10117 | })
|
10906 10118 | .build_unchecked();
|
10907 10119 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10908 10120 | .await
|
10909 10121 | .expect("unable to make an HTTP request");
|
10910 10122 | assert!(
|
10911 10123 | receiver.recv().await.is_some(),
|
10912 10124 | "we expected operation handler to be invoked but it was not entered"
|
10913 10125 | );
|
10914 10126 | }
|
10915 10127 |
|
10916 - | /// Parses operations with empty JSON bodies
|
10917 - | /// Test ID: parses_operations_with_empty_json_bodies
|
10128 + | /// Serializes simple scalar properties
|
10129 + | /// Test ID: AwsJson11Enums
|
10918 10130 | #[::tokio::test]
|
10919 10131 | #[::tracing_test::traced_test]
|
10920 - | async fn parses_operations_with_empty_json_bodies_response() {
|
10921 - | let output = crate::output::KitchenSinkOperationOutput {
|
10922 - | blob: ::std::option::Option::None,
|
10923 - | boolean: ::std::option::Option::None,
|
10924 - | double: ::std::option::Option::None,
|
10925 - | empty_struct: ::std::option::Option::None,
|
10926 - | float: ::std::option::Option::None,
|
10927 - | httpdate_timestamp: ::std::option::Option::None,
|
10928 - | integer: ::std::option::Option::None,
|
10929 - | iso8601_timestamp: ::std::option::Option::None,
|
10930 - | json_value: ::std::option::Option::None,
|
10931 - | list_of_lists: ::std::option::Option::None,
|
10932 - | list_of_maps_of_strings: ::std::option::Option::None,
|
10933 - | list_of_strings: ::std::option::Option::None,
|
10934 - | list_of_structs: ::std::option::Option::None,
|
10935 - | long: ::std::option::Option::None,
|
10936 - | map_of_lists_of_strings: ::std::option::Option::None,
|
10937 - | map_of_maps: ::std::option::Option::None,
|
10938 - | map_of_strings: ::std::option::Option::None,
|
10939 - | map_of_structs: ::std::option::Option::None,
|
10940 - | recursive_list: ::std::option::Option::None,
|
10941 - | recursive_map: ::std::option::Option::None,
|
10942 - | recursive_struct: ::std::option::Option::None,
|
10943 - | simple_struct: ::std::option::Option::None,
|
10944 - | string: ::std::option::Option::None,
|
10945 - | struct_with_json_name: ::std::option::Option::None,
|
10946 - | timestamp: ::std::option::Option::None,
|
10947 - | unix_timestamp: ::std::option::Option::None,
|
10132 + | async fn aws_json11_enums_response() {
|
10133 + | let output = crate::output::JsonEnumsOutput {
|
10134 + | foo_enum1: ::std::option::Option::Some(
|
10135 + | "Foo"
|
10136 + | .parse::<crate::model::FooEnum>()
|
10137 + | .expect("static value validated to member"),
|
10138 + | ),
|
10139 + | foo_enum2: ::std::option::Option::Some(
|
10140 + | "0".parse::<crate::model::FooEnum>()
|
10141 + | .expect("static value validated to member"),
|
10142 + | ),
|
10143 + | foo_enum3: ::std::option::Option::Some(
|
10144 + | "1".parse::<crate::model::FooEnum>()
|
10145 + | .expect("static value validated to member"),
|
10146 + | ),
|
10147 + | foo_enum_list: ::std::option::Option::Some(vec![
|
10148 + | "Foo"
|
10149 + | .parse::<crate::model::FooEnum>()
|
10150 + | .expect("static value validated to member"),
|
10151 + | "0".parse::<crate::model::FooEnum>()
|
10152 + | .expect("static value validated to member"),
|
10153 + | ]),
|
10154 + | foo_enum_set: ::std::option::Option::Some(
|
10155 + | vec![
|
10156 + | "Foo"
|
10157 + | .parse::<crate::model::FooEnum>()
|
10158 + | .expect("static value validated to member"),
|
10159 + | "0".parse::<crate::model::FooEnum>()
|
10160 + | .expect("static value validated to member"),
|
10161 + | ]
|
10162 + | .try_into()
|
10163 + | .expect("this is only used in tests"),
|
10164 + | ),
|
10165 + | foo_enum_map: ::std::option::Option::Some({
|
10166 + | let mut ret = ::std::collections::HashMap::new();
|
10167 + | ret.insert(
|
10168 + | "hi".to_owned(),
|
10169 + | "Foo"
|
10170 + | .parse::<crate::model::FooEnum>()
|
10171 + | .expect("static value validated to member"),
|
10172 + | );
|
10173 + | ret.insert(
|
10174 + | "zero".to_owned(),
|
10175 + | "0".parse::<crate::model::FooEnum>()
|
10176 + | .expect("static value validated to member"),
|
10177 + | );
|
10178 + | ret
|
10179 + | }),
|
10948 10180 | };
|
10949 10181 | use ::aws_smithy_http_server::response::IntoResponse;
|
10950 10182 | let http_response = output.into_response();
|
10951 10183 | ::pretty_assertions::assert_eq!(
|
10952 10184 | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10953 10185 | http_response.status()
|
10954 10186 | );
|
10955 10187 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10956 10188 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10957 10189 | http_response.headers(),
|
10958 10190 | expected_headers,
|
10959 10191 | ));
|
10960 10192 | use ::http_body_util::BodyExt;
|
10961 10193 | let body = http_response
|
10962 10194 | .into_body()
|
10963 10195 | .collect()
|
10964 10196 | .await
|
10965 - | .expect("unable to collect body")
|
10966 - | .to_bytes();
|
10967 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10968 - | &body,
|
10969 - | "{}",
|
10970 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10971 - | ));
|
10197 + | .expect("unable to collect body")
|
10198 + | .to_bytes();
|
10199 + | ::aws_smithy_protocol_test::assert_ok(
|
10200 + | ::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"))
|
10201 + | );
|
10202 + | }
|
10203 + | }
|
10204 + |
|
10205 + | ::pin_project_lite::pin_project! {
|
10206 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
10207 + | /// [`JsonIntEnumsInput`](crate::input::JsonIntEnumsInput) using modelled bindings.
|
10208 + | pub struct JsonIntEnumsInputFuture {
|
10209 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::JsonIntEnumsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
10210 + | }
|
10211 + | }
|
10212 + |
|
10213 + | impl std::future::Future for JsonIntEnumsInputFuture {
|
10214 + | type Output = Result<
|
10215 + | crate::input::JsonIntEnumsInput,
|
10216 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
10217 + | >;
|
10218 + |
|
10219 + | fn poll(
|
10220 + | self: std::pin::Pin<&mut Self>,
|
10221 + | cx: &mut std::task::Context<'_>,
|
10222 + | ) -> std::task::Poll<Self::Output> {
|
10223 + | let this = self.project();
|
10224 + | this.inner.as_mut().poll(cx)
|
10225 + | }
|
10226 + | }
|
10227 + |
|
10228 + | impl<B>
|
10229 + | ::aws_smithy_http_server::request::FromRequest<
|
10230 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10231 + | B,
|
10232 + | > for crate::input::JsonIntEnumsInput
|
10233 + | where
|
10234 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
10235 + | B: 'static,
|
10236 + |
|
10237 + | B::Data: Send,
|
10238 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
10239 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
10240 + | {
|
10241 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
10242 + | type Future = JsonIntEnumsInputFuture;
|
10243 + |
|
10244 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
10245 + | let fut = async move {
|
10246 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
10247 + | request.headers(),
|
10248 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
10249 + | ) {
|
10250 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
10251 + | }
|
10252 + | crate::protocol_serde::shape_json_int_enums::de_json_int_enums_http_request(request)
|
10253 + | .await
|
10254 + | };
|
10255 + | use ::futures_util::future::TryFutureExt;
|
10256 + | let fut = fut.map_err(
|
10257 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
10258 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
10259 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
10260 + | },
|
10261 + | );
|
10262 + | JsonIntEnumsInputFuture {
|
10263 + | inner: Box::pin(fut),
|
10264 + | }
|
10265 + | }
|
10266 + | }
|
10267 + | impl
|
10268 + | ::aws_smithy_http_server::response::IntoResponse<
|
10269 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10270 + | > for crate::output::JsonIntEnumsOutput
|
10271 + | {
|
10272 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
10273 + | match crate::protocol_serde::shape_json_int_enums::ser_json_int_enums_http_response(self) {
|
10274 + | Ok(response) => response,
|
10275 + | Err(e) => {
|
10276 + | ::tracing::error!(error = %e, "failed to serialize response");
|
10277 + | ::aws_smithy_http_server::response::IntoResponse::<
|
10278 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10279 + | >::into_response(
|
10280 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
10281 + | e,
|
10282 + | ),
|
10283 + | )
|
10284 + | }
|
10285 + | }
|
10286 + | }
|
10287 + | }
|
10288 + | impl
|
10289 + | ::aws_smithy_http_server::response::IntoResponse<
|
10290 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10291 + | > for crate::error::JsonIntEnumsError
|
10292 + | {
|
10293 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
10294 + | match crate::protocol_serde::shape_json_int_enums::ser_json_int_enums_http_error(&self) {
|
10295 + | Ok(mut response) => {
|
10296 + | response.extensions_mut().insert(
|
10297 + | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
10298 + | );
|
10299 + | response
|
10300 + | }
|
10301 + | Err(e) => {
|
10302 + | ::tracing::error!(error = %e, "failed to serialize response");
|
10303 + | ::aws_smithy_http_server::response::IntoResponse::<
|
10304 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10305 + | >::into_response(
|
10306 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
10307 + | e,
|
10308 + | ),
|
10309 + | )
|
10310 + | }
|
10311 + | }
|
10312 + | }
|
10313 + | }
|
10314 + |
|
10315 + | #[allow(unreachable_code, unused_variables)]
|
10316 + | #[cfg(test)]
|
10317 + | mod json_int_enums_test {
|
10318 + |
|
10319 + | /// Serializes simple scalar properties
|
10320 + | /// Test ID: AwsJson11IntEnums
|
10321 + | #[::tokio::test]
|
10322 + | #[::tracing_test::traced_test]
|
10323 + | async fn aws_json11_int_enums_request() {
|
10324 + | #[allow(unused_mut)]
|
10325 + | let mut http_request = ::http_1x::Request::builder()
|
10326 + | .uri("/")
|
10327 + | .method("POST")
|
10328 + | .header("Content-Type", "application/x-amz-json-1.1")
|
10329 + | .header("X-Amz-Target", "JsonProtocol.JsonIntEnums")
|
10330 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
10331 + | ::bytes::Bytes::copy_from_slice(
|
10332 + | &::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"))
|
10333 + | )
|
10334 + | ))).unwrap();
|
10335 + | #[allow(unused_mut)]
|
10336 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10337 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
10338 + | let service = crate::service::JsonProtocol::builder::<
|
10339 + | ::aws_smithy_http_server::body::BoxBody,
|
10340 + | _,
|
10341 + | _,
|
10342 + | _,
|
10343 + | >(config)
|
10344 + | .json_int_enums(move |input: crate::input::JsonIntEnumsInput| {
|
10345 + | let sender = sender.clone();
|
10346 + | async move {
|
10347 + | let result = {
|
10348 + | let expected = crate::input::JsonIntEnumsInput {
|
10349 + | int_enum1: ::std::option::Option::Some(1),
|
10350 + | int_enum2: ::std::option::Option::Some(2),
|
10351 + | int_enum3: ::std::option::Option::Some(3),
|
10352 + | int_enum_list: ::std::option::Option::Some(vec![1, 2]),
|
10353 + | int_enum_set: ::std::option::Option::Some(
|
10354 + | vec![1, 2].try_into().expect("this is only used in tests"),
|
10355 + | ),
|
10356 + | int_enum_map: ::std::option::Option::Some({
|
10357 + | let mut ret = ::std::collections::HashMap::new();
|
10358 + | ret.insert("a".to_owned(), 1);
|
10359 + | ret.insert("b".to_owned(), 2);
|
10360 + | ret
|
10361 + | }),
|
10362 + | };
|
10363 + | ::pretty_assertions::assert_eq!(input, expected);
|
10364 + | let output = crate::output::JsonIntEnumsOutput {
|
10365 + | int_enum1: ::std::option::Option::None,
|
10366 + | int_enum2: ::std::option::Option::None,
|
10367 + | int_enum3: ::std::option::Option::None,
|
10368 + | int_enum_list: ::std::option::Option::None,
|
10369 + | int_enum_set: ::std::option::Option::None,
|
10370 + | int_enum_map: ::std::option::Option::None,
|
10371 + | };
|
10372 + | Ok(output)
|
10373 + | };
|
10374 + | sender.send(()).await.expect("receiver dropped early");
|
10375 + | result
|
10376 + | }
|
10377 + | })
|
10378 + | .build_unchecked();
|
10379 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10380 + | .await
|
10381 + | .expect("unable to make an HTTP request");
|
10382 + | assert!(
|
10383 + | receiver.recv().await.is_some(),
|
10384 + | "we expected operation handler to be invoked but it was not entered"
|
10385 + | );
|
10972 10386 | }
|
10973 10387 |
|
10974 - | /// Parses string shapes
|
10975 - | /// Test ID: parses_string_shapes
|
10388 + | /// Serializes simple scalar properties
|
10389 + | /// Test ID: AwsJson11IntEnums
|
10976 10390 | #[::tokio::test]
|
10977 10391 | #[::tracing_test::traced_test]
|
10978 - | async fn parses_string_shapes_response() {
|
10979 - | let output = crate::output::KitchenSinkOperationOutput {
|
10980 - | string: ::std::option::Option::Some("string-value".to_owned()),
|
10981 - | blob: ::std::option::Option::None,
|
10982 - | boolean: ::std::option::Option::None,
|
10983 - | double: ::std::option::Option::None,
|
10984 - | empty_struct: ::std::option::Option::None,
|
10985 - | float: ::std::option::Option::None,
|
10986 - | httpdate_timestamp: ::std::option::Option::None,
|
10987 - | integer: ::std::option::Option::None,
|
10988 - | iso8601_timestamp: ::std::option::Option::None,
|
10989 - | json_value: ::std::option::Option::None,
|
10990 - | list_of_lists: ::std::option::Option::None,
|
10991 - | list_of_maps_of_strings: ::std::option::Option::None,
|
10992 - | list_of_strings: ::std::option::Option::None,
|
10993 - | list_of_structs: ::std::option::Option::None,
|
10994 - | long: ::std::option::Option::None,
|
10995 - | map_of_lists_of_strings: ::std::option::Option::None,
|
10996 - | map_of_maps: ::std::option::Option::None,
|
10997 - | map_of_strings: ::std::option::Option::None,
|
10998 - | map_of_structs: ::std::option::Option::None,
|
10999 - | recursive_list: ::std::option::Option::None,
|
11000 - | recursive_map: ::std::option::Option::None,
|
11001 - | recursive_struct: ::std::option::Option::None,
|
11002 - | simple_struct: ::std::option::Option::None,
|
11003 - | struct_with_json_name: ::std::option::Option::None,
|
11004 - | timestamp: ::std::option::Option::None,
|
11005 - | unix_timestamp: ::std::option::Option::None,
|
10392 + | #[should_panic]
|
10393 + | async fn aws_json11_int_enums_response() {
|
10394 + | let output = crate::output::JsonIntEnumsOutput {
|
10395 + | int_enum1: ::std::option::Option::Some(1),
|
10396 + | int_enum2: ::std::option::Option::Some(2),
|
10397 + | int_enum3: ::std::option::Option::Some(3),
|
10398 + | int_enum_list: ::std::option::Option::Some(vec![1, 2]),
|
10399 + | int_enum_set: ::std::option::Option::Some(
|
10400 + | vec![1, 2].try_into().expect("this is only used in tests"),
|
10401 + | ),
|
10402 + | int_enum_map: ::std::option::Option::Some({
|
10403 + | let mut ret = ::std::collections::HashMap::new();
|
10404 + | ret.insert("a".to_owned(), 1);
|
10405 + | ret.insert("b".to_owned(), 2);
|
10406 + | ret
|
10407 + | }),
|
11006 10408 | };
|
11007 10409 | use ::aws_smithy_http_server::response::IntoResponse;
|
11008 10410 | let http_response = output.into_response();
|
11009 10411 | ::pretty_assertions::assert_eq!(
|
11010 10412 | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11011 10413 | http_response.status()
|
11012 10414 | );
|
11013 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10415 + | let expected_headers = [
|
10416 + | ("Content-Type", "application/x-amz-json-1.1"),
|
10417 + | ("X-Amz-Target", "JsonProtocol.JsonIntEnums"),
|
10418 + | ];
|
11014 10419 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11015 10420 | http_response.headers(),
|
11016 10421 | expected_headers,
|
11017 10422 | ));
|
11018 10423 | use ::http_body_util::BodyExt;
|
11019 10424 | let body = http_response
|
11020 10425 | .into_body()
|
11021 10426 | .collect()
|
11022 10427 | .await
|
11023 10428 | .expect("unable to collect body")
|
11024 10429 | .to_bytes();
|
11025 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11026 - | &body,
|
11027 - | "{\"String\":\"string-value\"}",
|
11028 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11029 - | ));
|
10430 + | ::aws_smithy_protocol_test::assert_ok(
|
10431 + | ::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"))
|
10432 + | );
|
11030 10433 | }
|
10434 + | }
|
11031 10435 |
|
11032 - | /// Parses integer shapes
|
11033 - | /// Test ID: parses_integer_shapes
|
10436 + | ::pin_project_lite::pin_project! {
|
10437 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
10438 + | /// [`NullOperationInput`](crate::input::NullOperationInput) using modelled bindings.
|
10439 + | pub struct NullOperationInputFuture {
|
10440 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::NullOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
10441 + | }
|
10442 + | }
|
10443 + |
|
10444 + | impl std::future::Future for NullOperationInputFuture {
|
10445 + | type Output = Result<
|
10446 + | crate::input::NullOperationInput,
|
10447 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
10448 + | >;
|
10449 + |
|
10450 + | fn poll(
|
10451 + | self: std::pin::Pin<&mut Self>,
|
10452 + | cx: &mut std::task::Context<'_>,
|
10453 + | ) -> std::task::Poll<Self::Output> {
|
10454 + | let this = self.project();
|
10455 + | this.inner.as_mut().poll(cx)
|
10456 + | }
|
10457 + | }
|
10458 + |
|
10459 + | impl<B>
|
10460 + | ::aws_smithy_http_server::request::FromRequest<
|
10461 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10462 + | B,
|
10463 + | > for crate::input::NullOperationInput
|
10464 + | where
|
10465 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
10466 + | B: 'static,
|
10467 + |
|
10468 + | B::Data: Send,
|
10469 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
10470 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
10471 + | {
|
10472 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
10473 + | type Future = NullOperationInputFuture;
|
10474 + |
|
10475 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
10476 + | let fut = async move {
|
10477 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
10478 + | request.headers(),
|
10479 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
10480 + | ) {
|
10481 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
10482 + | }
|
10483 + | crate::protocol_serde::shape_null_operation::de_null_operation_http_request(request)
|
10484 + | .await
|
10485 + | };
|
10486 + | use ::futures_util::future::TryFutureExt;
|
10487 + | let fut = fut.map_err(
|
10488 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
10489 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
10490 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
10491 + | },
|
10492 + | );
|
10493 + | NullOperationInputFuture {
|
10494 + | inner: Box::pin(fut),
|
10495 + | }
|
10496 + | }
|
10497 + | }
|
10498 + | impl
|
10499 + | ::aws_smithy_http_server::response::IntoResponse<
|
10500 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10501 + | > for crate::output::NullOperationOutput
|
10502 + | {
|
10503 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
10504 + | match crate::protocol_serde::shape_null_operation::ser_null_operation_http_response(self) {
|
10505 + | Ok(response) => response,
|
10506 + | Err(e) => {
|
10507 + | ::tracing::error!(error = %e, "failed to serialize response");
|
10508 + | ::aws_smithy_http_server::response::IntoResponse::<
|
10509 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10510 + | >::into_response(
|
10511 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
10512 + | e,
|
10513 + | ),
|
10514 + | )
|
10515 + | }
|
10516 + | }
|
10517 + | }
|
10518 + | }
|
10519 + |
|
10520 + | #[allow(unreachable_code, unused_variables)]
|
10521 + | #[cfg(test)]
|
10522 + | mod null_operation_test {
|
10523 + |
|
10524 + | /// Null structure values are dropped
|
10525 + | /// Test ID: AwsJson11ServersDontDeserializeNullStructureValues
|
11034 10526 | #[::tokio::test]
|
11035 10527 | #[::tracing_test::traced_test]
|
11036 - | async fn parses_integer_shapes_response() {
|
11037 - | let output = crate::output::KitchenSinkOperationOutput {
|
11038 - | integer: ::std::option::Option::Some(1234),
|
11039 - | blob: ::std::option::Option::None,
|
11040 - | boolean: ::std::option::Option::None,
|
11041 - | double: ::std::option::Option::None,
|
11042 - | empty_struct: ::std::option::Option::None,
|
11043 - | float: ::std::option::Option::None,
|
11044 - | httpdate_timestamp: ::std::option::Option::None,
|
11045 - | iso8601_timestamp: ::std::option::Option::None,
|
11046 - | json_value: ::std::option::Option::None,
|
11047 - | list_of_lists: ::std::option::Option::None,
|
11048 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11049 - | list_of_strings: ::std::option::Option::None,
|
11050 - | list_of_structs: ::std::option::Option::None,
|
11051 - | long: ::std::option::Option::None,
|
11052 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11053 - | map_of_maps: ::std::option::Option::None,
|
11054 - | map_of_strings: ::std::option::Option::None,
|
11055 - | map_of_structs: ::std::option::Option::None,
|
11056 - | recursive_list: ::std::option::Option::None,
|
11057 - | recursive_map: ::std::option::Option::None,
|
11058 - | recursive_struct: ::std::option::Option::None,
|
11059 - | simple_struct: ::std::option::Option::None,
|
10528 + | async fn aws_json11_servers_dont_deserialize_null_structure_values_request() {
|
10529 + | #[allow(unused_mut)]
|
10530 + | let mut http_request = ::http_1x::Request::builder()
|
10531 + | .uri("/")
|
10532 + | .method("POST")
|
10533 + | .header("Content-Type", "application/x-amz-json-1.1")
|
10534 + | .header("X-Amz-Target", "JsonProtocol.NullOperation")
|
10535 + | .body(::aws_smithy_http_server::body::boxed(
|
10536 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
10537 + | &::aws_smithy_protocol_test::decode_body_data(
|
10538 + | "{\n \"string\": null\n}".as_bytes(),
|
10539 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10540 + | ),
|
10541 + | )),
|
10542 + | ))
|
10543 + | .unwrap();
|
10544 + | #[allow(unused_mut)]
|
10545 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10546 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
10547 + | let service = crate::service::JsonProtocol::builder::<
|
10548 + | ::aws_smithy_http_server::body::BoxBody,
|
10549 + | _,
|
10550 + | _,
|
10551 + | _,
|
10552 + | >(config)
|
10553 + | .null_operation(move |input: crate::input::NullOperationInput| {
|
10554 + | let sender = sender.clone();
|
10555 + | async move {
|
10556 + | let result = {
|
10557 + | let expected = crate::input::NullOperationInput {
|
10558 + | string: ::std::option::Option::None,
|
10559 + | };
|
10560 + | ::pretty_assertions::assert_eq!(input, expected);
|
10561 + | let output = crate::output::NullOperationOutput {
|
10562 + | string: ::std::option::Option::None,
|
10563 + | };
|
10564 + | output
|
10565 + | };
|
10566 + | sender.send(()).await.expect("receiver dropped early");
|
10567 + | result
|
10568 + | }
|
10569 + | })
|
10570 + | .build_unchecked();
|
10571 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10572 + | .await
|
10573 + | .expect("unable to make an HTTP request");
|
10574 + | assert!(
|
10575 + | receiver.recv().await.is_some(),
|
10576 + | "we expected operation handler to be invoked but it was not entered"
|
10577 + | );
|
10578 + | }
|
10579 + |
|
10580 + | /// Null structure values are dropped
|
10581 + | /// Test ID: AwsJson11ServersDontSerializeNullStructureValues
|
10582 + | #[::tokio::test]
|
10583 + | #[::tracing_test::traced_test]
|
10584 + | async fn aws_json11_servers_dont_serialize_null_structure_values_response() {
|
10585 + | let output = crate::output::NullOperationOutput {
|
11060 10586 | string: ::std::option::Option::None,
|
11061 - | struct_with_json_name: ::std::option::Option::None,
|
11062 - | timestamp: ::std::option::Option::None,
|
11063 - | unix_timestamp: ::std::option::Option::None,
|
11064 10587 | };
|
11065 10588 | use ::aws_smithy_http_server::response::IntoResponse;
|
11066 10589 | let http_response = output.into_response();
|
11067 10590 | ::pretty_assertions::assert_eq!(
|
11068 10591 | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11069 10592 | http_response.status()
|
11070 10593 | );
|
11071 10594 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11072 10595 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11073 10596 | http_response.headers(),
|
11074 10597 | expected_headers,
|
11075 10598 | ));
|
11076 10599 | use ::http_body_util::BodyExt;
|
11077 10600 | let body = http_response
|
11078 10601 | .into_body()
|
11079 10602 | .collect()
|
11080 10603 | .await
|
11081 10604 | .expect("unable to collect body")
|
11082 10605 | .to_bytes();
|
11083 10606 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11084 10607 | &body,
|
11085 - | "{\"Integer\":1234}",
|
10608 + | "{}",
|
11086 10609 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11087 10610 | ));
|
11088 10611 | }
|
10612 + | }
|
11089 10613 |
|
11090 - | /// Parses long shapes
|
11091 - | /// Test ID: parses_long_shapes
|
10614 + | ::pin_project_lite::pin_project! {
|
10615 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
10616 + | /// [`SparseNullsOperationInput`](crate::input::SparseNullsOperationInput) using modelled bindings.
|
10617 + | pub struct SparseNullsOperationInputFuture {
|
10618 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SparseNullsOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
10619 + | }
|
10620 + | }
|
10621 + |
|
10622 + | impl std::future::Future for SparseNullsOperationInputFuture {
|
10623 + | type Output = Result<
|
10624 + | crate::input::SparseNullsOperationInput,
|
10625 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
10626 + | >;
|
10627 + |
|
10628 + | fn poll(
|
10629 + | self: std::pin::Pin<&mut Self>,
|
10630 + | cx: &mut std::task::Context<'_>,
|
10631 + | ) -> std::task::Poll<Self::Output> {
|
10632 + | let this = self.project();
|
10633 + | this.inner.as_mut().poll(cx)
|
10634 + | }
|
10635 + | }
|
10636 + |
|
10637 + | impl<B>
|
10638 + | ::aws_smithy_http_server::request::FromRequest<
|
10639 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10640 + | B,
|
10641 + | > for crate::input::SparseNullsOperationInput
|
10642 + | where
|
10643 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
10644 + | B: 'static,
|
10645 + |
|
10646 + | B::Data: Send,
|
10647 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
10648 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
10649 + | {
|
10650 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
10651 + | type Future = SparseNullsOperationInputFuture;
|
10652 + |
|
10653 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
10654 + | let fut = async move {
|
10655 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
10656 + | request.headers(),
|
10657 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
10658 + | ) {
|
10659 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
10660 + | }
|
10661 + | crate::protocol_serde::shape_sparse_nulls_operation::de_sparse_nulls_operation_http_request(request)
|
10662 + | .await
|
10663 + | };
|
10664 + | use ::futures_util::future::TryFutureExt;
|
10665 + | let fut = fut.map_err(
|
10666 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
10667 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
10668 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
10669 + | },
|
10670 + | );
|
10671 + | SparseNullsOperationInputFuture {
|
10672 + | inner: Box::pin(fut),
|
10673 + | }
|
10674 + | }
|
10675 + | }
|
10676 + | impl
|
10677 + | ::aws_smithy_http_server::response::IntoResponse<
|
10678 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10679 + | > for crate::output::SparseNullsOperationOutput
|
10680 + | {
|
10681 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
10682 + | match crate::protocol_serde::shape_sparse_nulls_operation::ser_sparse_nulls_operation_http_response(self) {
|
10683 + | Ok(response) => response,
|
10684 + | Err(e) => {
|
10685 + | ::tracing::error!(error = %e, "failed to serialize response");
|
10686 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
10687 + | }
|
10688 + | }
|
10689 + | }
|
10690 + | }
|
10691 + |
|
10692 + | #[allow(unreachable_code, unused_variables)]
|
10693 + | #[cfg(test)]
|
10694 + | mod sparse_nulls_operation_test {
|
10695 + |
|
10696 + | /// Serializes null values in maps
|
10697 + | /// Test ID: AwsJson11SparseMapsSerializeNullValues
|
11092 10698 | #[::tokio::test]
|
11093 10699 | #[::tracing_test::traced_test]
|
11094 - | async fn parses_long_shapes_response() {
|
11095 - | let output = crate::output::KitchenSinkOperationOutput {
|
11096 - | long: ::std::option::Option::Some(1234567890123456789),
|
11097 - | blob: ::std::option::Option::None,
|
11098 - | boolean: ::std::option::Option::None,
|
11099 - | double: ::std::option::Option::None,
|
11100 - | empty_struct: ::std::option::Option::None,
|
11101 - | float: ::std::option::Option::None,
|
11102 - | httpdate_timestamp: ::std::option::Option::None,
|
11103 - | integer: ::std::option::Option::None,
|
11104 - | iso8601_timestamp: ::std::option::Option::None,
|
11105 - | json_value: ::std::option::Option::None,
|
11106 - | list_of_lists: ::std::option::Option::None,
|
11107 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11108 - | list_of_strings: ::std::option::Option::None,
|
11109 - | list_of_structs: ::std::option::Option::None,
|
11110 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11111 - | map_of_maps: ::std::option::Option::None,
|
11112 - | map_of_strings: ::std::option::Option::None,
|
11113 - | map_of_structs: ::std::option::Option::None,
|
11114 - | recursive_list: ::std::option::Option::None,
|
11115 - | recursive_map: ::std::option::Option::None,
|
11116 - | recursive_struct: ::std::option::Option::None,
|
11117 - | simple_struct: ::std::option::Option::None,
|
11118 - | string: ::std::option::Option::None,
|
11119 - | struct_with_json_name: ::std::option::Option::None,
|
11120 - | timestamp: ::std::option::Option::None,
|
11121 - | unix_timestamp: ::std::option::Option::None,
|
10700 + | async fn aws_json11_sparse_maps_serialize_null_values_request() {
|
10701 + | #[allow(unused_mut)]
|
10702 + | let mut http_request = ::http_1x::Request::builder()
|
10703 + | .uri("/")
|
10704 + | .method("POST")
|
10705 + | .header("Content-Type", "application/x-amz-json-1.1")
|
10706 + | .header("X-Amz-Target", "JsonProtocol.SparseNullsOperation")
|
10707 + | .body(::aws_smithy_http_server::body::boxed(
|
10708 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
10709 + | &::aws_smithy_protocol_test::decode_body_data(
|
10710 + | "{\n \"sparseStringMap\": {\n \"foo\": null\n }\n}".as_bytes(),
|
10711 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10712 + | ),
|
10713 + | )),
|
10714 + | ))
|
10715 + | .unwrap();
|
10716 + | #[allow(unused_mut)]
|
10717 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10718 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
10719 + | let service = crate::service::JsonProtocol::builder::<
|
10720 + | ::aws_smithy_http_server::body::BoxBody,
|
10721 + | _,
|
10722 + | _,
|
10723 + | _,
|
10724 + | >(config)
|
10725 + | .sparse_nulls_operation(move |input: crate::input::SparseNullsOperationInput| {
|
10726 + | let sender = sender.clone();
|
10727 + | async move {
|
10728 + | let result = {
|
10729 + | let expected = crate::input::SparseNullsOperationInput {
|
10730 + | sparse_string_map: ::std::option::Option::Some({
|
10731 + | let mut ret = ::std::collections::HashMap::new();
|
10732 + | ret.insert("foo".to_owned(), ::std::option::Option::None);
|
10733 + | ret
|
10734 + | }),
|
10735 + | sparse_string_list: ::std::option::Option::None,
|
10736 + | };
|
10737 + | ::pretty_assertions::assert_eq!(input, expected);
|
10738 + | let output = crate::output::SparseNullsOperationOutput {
|
10739 + | sparse_string_list: ::std::option::Option::None,
|
10740 + | sparse_string_map: ::std::option::Option::None,
|
10741 + | };
|
10742 + | output
|
10743 + | };
|
10744 + | sender.send(()).await.expect("receiver dropped early");
|
10745 + | result
|
10746 + | }
|
10747 + | })
|
10748 + | .build_unchecked();
|
10749 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10750 + | .await
|
10751 + | .expect("unable to make an HTTP request");
|
10752 + | assert!(
|
10753 + | receiver.recv().await.is_some(),
|
10754 + | "we expected operation handler to be invoked but it was not entered"
|
10755 + | );
|
10756 + | }
|
10757 + |
|
10758 + | /// Serializes null values in lists
|
10759 + | /// Test ID: AwsJson11SparseListsSerializeNull
|
10760 + | #[::tokio::test]
|
10761 + | #[::tracing_test::traced_test]
|
10762 + | async fn aws_json11_sparse_lists_serialize_null_request() {
|
10763 + | #[allow(unused_mut)]
|
10764 + | let mut http_request = ::http_1x::Request::builder()
|
10765 + | .uri("/")
|
10766 + | .method("POST")
|
10767 + | .header("Content-Type", "application/x-amz-json-1.1")
|
10768 + | .header("X-Amz-Target", "JsonProtocol.SparseNullsOperation")
|
10769 + | .body(::aws_smithy_http_server::body::boxed(
|
10770 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
10771 + | &::aws_smithy_protocol_test::decode_body_data(
|
10772 + | "{\n \"sparseStringList\": [\n null\n ]\n}".as_bytes(),
|
10773 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10774 + | ),
|
10775 + | )),
|
10776 + | ))
|
10777 + | .unwrap();
|
10778 + | #[allow(unused_mut)]
|
10779 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10780 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
10781 + | let service = crate::service::JsonProtocol::builder::<
|
10782 + | ::aws_smithy_http_server::body::BoxBody,
|
10783 + | _,
|
10784 + | _,
|
10785 + | _,
|
10786 + | >(config)
|
10787 + | .sparse_nulls_operation(move |input: crate::input::SparseNullsOperationInput| {
|
10788 + | let sender = sender.clone();
|
10789 + | async move {
|
10790 + | let result = {
|
10791 + | let expected = crate::input::SparseNullsOperationInput {
|
10792 + | sparse_string_list: ::std::option::Option::Some(vec![
|
10793 + | ::std::option::Option::None,
|
10794 + | ]),
|
10795 + | sparse_string_map: ::std::option::Option::None,
|
10796 + | };
|
10797 + | ::pretty_assertions::assert_eq!(input, expected);
|
10798 + | let output = crate::output::SparseNullsOperationOutput {
|
10799 + | sparse_string_list: ::std::option::Option::None,
|
10800 + | sparse_string_map: ::std::option::Option::None,
|
10801 + | };
|
10802 + | output
|
10803 + | };
|
10804 + | sender.send(()).await.expect("receiver dropped early");
|
10805 + | result
|
10806 + | }
|
10807 + | })
|
10808 + | .build_unchecked();
|
10809 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10810 + | .await
|
10811 + | .expect("unable to make an HTTP request");
|
10812 + | assert!(
|
10813 + | receiver.recv().await.is_some(),
|
10814 + | "we expected operation handler to be invoked but it was not entered"
|
10815 + | );
|
10816 + | }
|
10817 + |
|
10818 + | /// Deserializes null values in maps
|
10819 + | /// Test ID: AwsJson11SparseMapsDeserializeNullValues
|
10820 + | #[::tokio::test]
|
10821 + | #[::tracing_test::traced_test]
|
10822 + | async fn aws_json11_sparse_maps_deserialize_null_values_response() {
|
10823 + | let output = crate::output::SparseNullsOperationOutput {
|
10824 + | sparse_string_map: ::std::option::Option::Some({
|
10825 + | let mut ret = ::std::collections::HashMap::new();
|
10826 + | ret.insert("foo".to_owned(), ::std::option::Option::None);
|
10827 + | ret
|
10828 + | }),
|
10829 + | sparse_string_list: ::std::option::Option::None,
|
11122 10830 | };
|
11123 10831 | use ::aws_smithy_http_server::response::IntoResponse;
|
11124 10832 | let http_response = output.into_response();
|
11125 10833 | ::pretty_assertions::assert_eq!(
|
11126 10834 | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11127 10835 | http_response.status()
|
11128 10836 | );
|
11129 10837 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11130 10838 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11131 10839 | http_response.headers(),
|
11132 10840 | expected_headers,
|
11133 10841 | ));
|
11134 10842 | use ::http_body_util::BodyExt;
|
11135 10843 | let body = http_response
|
11136 10844 | .into_body()
|
11137 10845 | .collect()
|
11138 10846 | .await
|
11139 10847 | .expect("unable to collect body")
|
11140 10848 | .to_bytes();
|
11141 10849 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11142 10850 | &body,
|
11143 - | "{\"Long\":1234567890123456789}",
|
10851 + | "{\n \"sparseStringMap\": {\n \"foo\": null\n }\n}",
|
11144 10852 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11145 10853 | ));
|
11146 10854 | }
|
11147 10855 |
|
11148 - | /// Parses float shapes
|
11149 - | /// Test ID: parses_float_shapes
|
10856 + | /// Deserializes null values in lists
|
10857 + | /// Test ID: AwsJson11SparseListsDeserializeNull
|
11150 10858 | #[::tokio::test]
|
11151 10859 | #[::tracing_test::traced_test]
|
11152 - | async fn parses_float_shapes_response() {
|
11153 - | let output = crate::output::KitchenSinkOperationOutput {
|
11154 - | float: ::std::option::Option::Some(1234.5_f32),
|
11155 - | blob: ::std::option::Option::None,
|
11156 - | boolean: ::std::option::Option::None,
|
11157 - | double: ::std::option::Option::None,
|
11158 - | empty_struct: ::std::option::Option::None,
|
11159 - | httpdate_timestamp: ::std::option::Option::None,
|
11160 - | integer: ::std::option::Option::None,
|
11161 - | iso8601_timestamp: ::std::option::Option::None,
|
11162 - | json_value: ::std::option::Option::None,
|
11163 - | list_of_lists: ::std::option::Option::None,
|
11164 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11165 - | list_of_strings: ::std::option::Option::None,
|
11166 - | list_of_structs: ::std::option::Option::None,
|
11167 - | long: ::std::option::Option::None,
|
11168 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11169 - | map_of_maps: ::std::option::Option::None,
|
11170 - | map_of_strings: ::std::option::Option::None,
|
11171 - | map_of_structs: ::std::option::Option::None,
|
11172 - | recursive_list: ::std::option::Option::None,
|
11173 - | recursive_map: ::std::option::Option::None,
|
11174 - | recursive_struct: ::std::option::Option::None,
|
11175 - | simple_struct: ::std::option::Option::None,
|
11176 - | string: ::std::option::Option::None,
|
11177 - | struct_with_json_name: ::std::option::Option::None,
|
11178 - | timestamp: ::std::option::Option::None,
|
11179 - | unix_timestamp: ::std::option::Option::None,
|
10860 + | async fn aws_json11_sparse_lists_deserialize_null_response() {
|
10861 + | let output = crate::output::SparseNullsOperationOutput {
|
10862 + | sparse_string_list: ::std::option::Option::Some(vec![::std::option::Option::None]),
|
10863 + | sparse_string_map: ::std::option::Option::None,
|
11180 10864 | };
|
11181 10865 | use ::aws_smithy_http_server::response::IntoResponse;
|
11182 10866 | let http_response = output.into_response();
|
11183 10867 | ::pretty_assertions::assert_eq!(
|
11184 10868 | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11185 10869 | http_response.status()
|
11186 10870 | );
|
11187 10871 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11188 10872 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11189 10873 | http_response.headers(),
|
11190 10874 | expected_headers,
|
11191 10875 | ));
|
11192 10876 | use ::http_body_util::BodyExt;
|
11193 10877 | let body = http_response
|
11194 10878 | .into_body()
|
11195 10879 | .collect()
|
11196 10880 | .await
|
11197 10881 | .expect("unable to collect body")
|
11198 10882 | .to_bytes();
|
11199 10883 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11200 10884 | &body,
|
11201 - | "{\"Float\":1234.5}",
|
10885 + | "{\n \"sparseStringList\": [\n null\n ]\n}",
|
11202 10886 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11203 10887 | ));
|
11204 10888 | }
|
10889 + | }
|
11205 10890 |
|
11206 - | /// Parses double shapes
|
11207 - | /// Test ID: parses_double_shapes
|
10891 + | ::pin_project_lite::pin_project! {
|
10892 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
10893 + | /// [`GreetingWithErrorsInput`](crate::input::GreetingWithErrorsInput) using modelled bindings.
|
10894 + | pub struct GreetingWithErrorsInputFuture {
|
10895 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::GreetingWithErrorsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
10896 + | }
|
10897 + | }
|
10898 + |
|
10899 + | impl std::future::Future for GreetingWithErrorsInputFuture {
|
10900 + | type Output = Result<
|
10901 + | crate::input::GreetingWithErrorsInput,
|
10902 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
10903 + | >;
|
10904 + |
|
10905 + | fn poll(
|
10906 + | self: std::pin::Pin<&mut Self>,
|
10907 + | cx: &mut std::task::Context<'_>,
|
10908 + | ) -> std::task::Poll<Self::Output> {
|
10909 + | let this = self.project();
|
10910 + | this.inner.as_mut().poll(cx)
|
10911 + | }
|
10912 + | }
|
10913 + |
|
10914 + | impl<B>
|
10915 + | ::aws_smithy_http_server::request::FromRequest<
|
10916 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10917 + | B,
|
10918 + | > for crate::input::GreetingWithErrorsInput
|
10919 + | where
|
10920 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
10921 + | B: 'static,
|
10922 + |
|
10923 + | B::Data: Send,
|
10924 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
10925 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
10926 + | {
|
10927 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
10928 + | type Future = GreetingWithErrorsInputFuture;
|
10929 + |
|
10930 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
10931 + | let fut = async move {
|
10932 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
10933 + | request.headers(),
|
10934 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
10935 + | ) {
|
10936 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
10937 + | }
|
10938 + | crate::protocol_serde::shape_greeting_with_errors::de_greeting_with_errors_http_request(
|
10939 + | request,
|
10940 + | )
|
10941 + | .await
|
10942 + | };
|
10943 + | use ::futures_util::future::TryFutureExt;
|
10944 + | let fut = fut.map_err(
|
10945 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
10946 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
10947 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
10948 + | },
|
10949 + | );
|
10950 + | GreetingWithErrorsInputFuture {
|
10951 + | inner: Box::pin(fut),
|
10952 + | }
|
10953 + | }
|
10954 + | }
|
10955 + | impl
|
10956 + | ::aws_smithy_http_server::response::IntoResponse<
|
10957 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10958 + | > for crate::output::GreetingWithErrorsOutput
|
10959 + | {
|
10960 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
10961 + | match crate::protocol_serde::shape_greeting_with_errors::ser_greeting_with_errors_http_response(self) {
|
10962 + | Ok(response) => response,
|
10963 + | Err(e) => {
|
10964 + | ::tracing::error!(error = %e, "failed to serialize response");
|
10965 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
10966 + | }
|
10967 + | }
|
10968 + | }
|
10969 + | }
|
10970 + | impl
|
10971 + | ::aws_smithy_http_server::response::IntoResponse<
|
10972 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10973 + | > for crate::error::GreetingWithErrorsError
|
10974 + | {
|
10975 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
10976 + | match crate::protocol_serde::shape_greeting_with_errors::ser_greeting_with_errors_http_error(
|
10977 + | &self,
|
10978 + | ) {
|
10979 + | Ok(mut response) => {
|
10980 + | response.extensions_mut().insert(
|
10981 + | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
10982 + | );
|
10983 + | response
|
10984 + | }
|
10985 + | Err(e) => {
|
10986 + | ::tracing::error!(error = %e, "failed to serialize response");
|
10987 + | ::aws_smithy_http_server::response::IntoResponse::<
|
10988 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10989 + | >::into_response(
|
10990 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
10991 + | e,
|
10992 + | ),
|
10993 + | )
|
10994 + | }
|
10995 + | }
|
10996 + | }
|
10997 + | }
|
10998 + |
|
10999 + | #[allow(unreachable_code, unused_variables)]
|
11000 + | #[cfg(test)]
|
11001 + | mod greeting_with_errors_test {
|
11002 + |
|
11003 + | /// Parses simple JSON errors
|
11004 + | /// Test ID: AwsJson11InvalidGreetingError
|
11208 11005 | #[::tokio::test]
|
11209 11006 | #[::tracing_test::traced_test]
|
11210 - | async fn parses_double_shapes_response() {
|
11211 - | let output = crate::output::KitchenSinkOperationOutput {
|
11212 - | double: ::std::option::Option::Some(1.2345678912345679E8_f64),
|
11213 - | blob: ::std::option::Option::None,
|
11214 - | boolean: ::std::option::Option::None,
|
11215 - | empty_struct: ::std::option::Option::None,
|
11216 - | float: ::std::option::Option::None,
|
11217 - | httpdate_timestamp: ::std::option::Option::None,
|
11218 - | integer: ::std::option::Option::None,
|
11219 - | iso8601_timestamp: ::std::option::Option::None,
|
11220 - | json_value: ::std::option::Option::None,
|
11221 - | list_of_lists: ::std::option::Option::None,
|
11222 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11223 - | list_of_strings: ::std::option::Option::None,
|
11224 - | list_of_structs: ::std::option::Option::None,
|
11225 - | long: ::std::option::Option::None,
|
11226 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11227 - | map_of_maps: ::std::option::Option::None,
|
11228 - | map_of_strings: ::std::option::Option::None,
|
11229 - | map_of_structs: ::std::option::Option::None,
|
11230 - | recursive_list: ::std::option::Option::None,
|
11231 - | recursive_map: ::std::option::Option::None,
|
11232 - | recursive_struct: ::std::option::Option::None,
|
11233 - | simple_struct: ::std::option::Option::None,
|
11234 - | string: ::std::option::Option::None,
|
11235 - | struct_with_json_name: ::std::option::Option::None,
|
11236 - | timestamp: ::std::option::Option::None,
|
11237 - | unix_timestamp: ::std::option::Option::None,
|
11007 + | async fn aws_json11_invalid_greeting_error_response() {
|
11008 + | let output = crate::error::InvalidGreeting {
|
11009 + | message: ::std::option::Option::Some("Hi".to_owned()),
|
11238 11010 | };
|
11011 + | let output = crate::error::GreetingWithErrorsError::InvalidGreeting(output);
|
11239 11012 | use ::aws_smithy_http_server::response::IntoResponse;
|
11240 11013 | let http_response = output.into_response();
|
11241 11014 | ::pretty_assertions::assert_eq!(
|
11242 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11015 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11243 11016 | http_response.status()
|
11244 11017 | );
|
11245 11018 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11246 11019 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11247 11020 | http_response.headers(),
|
11248 11021 | expected_headers,
|
11249 11022 | ));
|
11250 11023 | use ::http_body_util::BodyExt;
|
11251 11024 | let body = http_response
|
11252 11025 | .into_body()
|
11253 11026 | .collect()
|
11254 11027 | .await
|
11255 11028 | .expect("unable to collect body")
|
11256 11029 | .to_bytes();
|
11257 11030 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11258 11031 | &body,
|
11259 - | "{\"Double\":123456789.12345679}",
|
11032 + | "{\n \"__type\": \"InvalidGreeting\",\n \"Message\": \"Hi\"\n}",
|
11260 11033 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11261 11034 | ));
|
11262 11035 | }
|
11263 11036 |
|
11264 - | /// Parses boolean shapes (true)
|
11265 - | /// Test ID: parses_boolean_shapes_true
|
11037 + | /// Parses a complex error with no message member
|
11038 + | /// Test ID: AwsJson11ComplexError
|
11266 11039 | #[::tokio::test]
|
11267 11040 | #[::tracing_test::traced_test]
|
11268 - | async fn parses_boolean_shapes_true_response() {
|
11269 - | let output = crate::output::KitchenSinkOperationOutput {
|
11270 - | boolean: ::std::option::Option::Some(true),
|
11271 - | blob: ::std::option::Option::None,
|
11272 - | double: ::std::option::Option::None,
|
11273 - | empty_struct: ::std::option::Option::None,
|
11274 - | float: ::std::option::Option::None,
|
11275 - | httpdate_timestamp: ::std::option::Option::None,
|
11276 - | integer: ::std::option::Option::None,
|
11277 - | iso8601_timestamp: ::std::option::Option::None,
|
11278 - | json_value: ::std::option::Option::None,
|
11279 - | list_of_lists: ::std::option::Option::None,
|
11280 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11281 - | list_of_strings: ::std::option::Option::None,
|
11282 - | list_of_structs: ::std::option::Option::None,
|
11283 - | long: ::std::option::Option::None,
|
11284 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11285 - | map_of_maps: ::std::option::Option::None,
|
11286 - | map_of_strings: ::std::option::Option::None,
|
11287 - | map_of_structs: ::std::option::Option::None,
|
11288 - | recursive_list: ::std::option::Option::None,
|
11289 - | recursive_map: ::std::option::Option::None,
|
11290 - | recursive_struct: ::std::option::Option::None,
|
11291 - | simple_struct: ::std::option::Option::None,
|
11292 - | string: ::std::option::Option::None,
|
11293 - | struct_with_json_name: ::std::option::Option::None,
|
11294 - | timestamp: ::std::option::Option::None,
|
11295 - | unix_timestamp: ::std::option::Option::None,
|
11041 + | async fn aws_json11_complex_error_response() {
|
11042 + | let output = crate::error::ComplexError {
|
11043 + | top_level: ::std::option::Option::Some("Top level".to_owned()),
|
11044 + | nested: ::std::option::Option::Some(crate::model::ComplexNestedErrorData {
|
11045 + | foo: ::std::option::Option::Some("bar".to_owned()),
|
11046 + | }),
|
11047 + | };
|
11048 + | let output = crate::error::GreetingWithErrorsError::ComplexError(output);
|
11049 + | use ::aws_smithy_http_server::response::IntoResponse;
|
11050 + | let http_response = output.into_response();
|
11051 + | ::pretty_assertions::assert_eq!(
|
11052 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11053 + | http_response.status()
|
11054 + | );
|
11055 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11056 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11057 + | http_response.headers(),
|
11058 + | expected_headers,
|
11059 + | ));
|
11060 + | use ::http_body_util::BodyExt;
|
11061 + | let body = http_response
|
11062 + | .into_body()
|
11063 + | .collect()
|
11064 + | .await
|
11065 + | .expect("unable to collect body")
|
11066 + | .to_bytes();
|
11067 + | ::aws_smithy_protocol_test::assert_ok(
|
11068 + | ::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"))
|
11069 + | );
|
11070 + | }
|
11071 + | /// Test ID: AwsJson11EmptyComplexError
|
11072 + | #[::tokio::test]
|
11073 + | #[::tracing_test::traced_test]
|
11074 + | async fn aws_json11_empty_complex_error_response() {
|
11075 + | let output = crate::error::ComplexError {
|
11076 + | top_level: ::std::option::Option::None,
|
11077 + | nested: ::std::option::Option::None,
|
11296 11078 | };
|
11079 + | let output = crate::error::GreetingWithErrorsError::ComplexError(output);
|
11297 11080 | use ::aws_smithy_http_server::response::IntoResponse;
|
11298 11081 | let http_response = output.into_response();
|
11299 11082 | ::pretty_assertions::assert_eq!(
|
11300 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11083 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11301 11084 | http_response.status()
|
11302 11085 | );
|
11303 11086 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11304 11087 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11305 11088 | http_response.headers(),
|
11306 11089 | expected_headers,
|
11307 11090 | ));
|
11308 11091 | use ::http_body_util::BodyExt;
|
11309 11092 | let body = http_response
|
11310 11093 | .into_body()
|
11311 11094 | .collect()
|
11312 11095 | .await
|
11313 11096 | .expect("unable to collect body")
|
11314 11097 | .to_bytes();
|
11315 11098 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11316 11099 | &body,
|
11317 - | "{\"Boolean\":true}",
|
11100 + | "{\n \"__type\": \"ComplexError\"\n}",
|
11318 11101 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11319 11102 | ));
|
11320 11103 | }
|
11104 + | }
|
11105 + |
|
11106 + | ::pin_project_lite::pin_project! {
|
11107 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
11108 + | /// [`JsonUnionsInput`](crate::input::JsonUnionsInput) using modelled bindings.
|
11109 + | pub struct JsonUnionsInputFuture {
|
11110 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::JsonUnionsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
11111 + | }
|
11112 + | }
|
11113 + |
|
11114 + | impl std::future::Future for JsonUnionsInputFuture {
|
11115 + | type Output = Result<
|
11116 + | crate::input::JsonUnionsInput,
|
11117 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
11118 + | >;
|
11119 + |
|
11120 + | fn poll(
|
11121 + | self: std::pin::Pin<&mut Self>,
|
11122 + | cx: &mut std::task::Context<'_>,
|
11123 + | ) -> std::task::Poll<Self::Output> {
|
11124 + | let this = self.project();
|
11125 + | this.inner.as_mut().poll(cx)
|
11126 + | }
|
11127 + | }
|
11128 + |
|
11129 + | impl<B>
|
11130 + | ::aws_smithy_http_server::request::FromRequest<
|
11131 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11132 + | B,
|
11133 + | > for crate::input::JsonUnionsInput
|
11134 + | where
|
11135 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
11136 + | B: 'static,
|
11137 + |
|
11138 + | B::Data: Send,
|
11139 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
11140 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
11141 + | {
|
11142 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
11143 + | type Future = JsonUnionsInputFuture;
|
11144 + |
|
11145 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
11146 + | let fut = async move {
|
11147 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
11148 + | request.headers(),
|
11149 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
11150 + | ) {
|
11151 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
11152 + | }
|
11153 + | crate::protocol_serde::shape_json_unions::de_json_unions_http_request(request).await
|
11154 + | };
|
11155 + | use ::futures_util::future::TryFutureExt;
|
11156 + | let fut = fut.map_err(
|
11157 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
11158 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
11159 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
11160 + | },
|
11161 + | );
|
11162 + | JsonUnionsInputFuture {
|
11163 + | inner: Box::pin(fut),
|
11164 + | }
|
11165 + | }
|
11166 + | }
|
11167 + | impl
|
11168 + | ::aws_smithy_http_server::response::IntoResponse<
|
11169 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11170 + | > for crate::output::JsonUnionsOutput
|
11171 + | {
|
11172 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
11173 + | match crate::protocol_serde::shape_json_unions::ser_json_unions_http_response(self) {
|
11174 + | Ok(response) => response,
|
11175 + | Err(e) => {
|
11176 + | ::tracing::error!(error = %e, "failed to serialize response");
|
11177 + | ::aws_smithy_http_server::response::IntoResponse::<
|
11178 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11179 + | >::into_response(
|
11180 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
11181 + | e,
|
11182 + | ),
|
11183 + | )
|
11184 + | }
|
11185 + | }
|
11186 + | }
|
11187 + | }
|
11188 + | impl
|
11189 + | ::aws_smithy_http_server::response::IntoResponse<
|
11190 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11191 + | > for crate::error::JsonUnionsError
|
11192 + | {
|
11193 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
11194 + | match crate::protocol_serde::shape_json_unions::ser_json_unions_http_error(&self) {
|
11195 + | Ok(mut response) => {
|
11196 + | response.extensions_mut().insert(
|
11197 + | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
11198 + | );
|
11199 + | response
|
11200 + | }
|
11201 + | Err(e) => {
|
11202 + | ::tracing::error!(error = %e, "failed to serialize response");
|
11203 + | ::aws_smithy_http_server::response::IntoResponse::<
|
11204 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11205 + | >::into_response(
|
11206 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
11207 + | e,
|
11208 + | ),
|
11209 + | )
|
11210 + | }
|
11211 + | }
|
11212 + | }
|
11213 + | }
|
11214 + |
|
11215 + | #[allow(unreachable_code, unused_variables)]
|
11216 + | #[cfg(test)]
|
11217 + | mod json_unions_test {
|
11218 + |
|
11219 + | /// Serializes a string union value
|
11220 + | /// Test ID: AwsJson11SerializeStringUnionValue
|
11221 + | #[::tokio::test]
|
11222 + | #[::tracing_test::traced_test]
|
11223 + | async fn aws_json11_serialize_string_union_value_request() {
|
11224 + | #[allow(unused_mut)]
|
11225 + | let mut http_request = ::http_1x::Request::builder()
|
11226 + | .uri("/")
|
11227 + | .method("POST")
|
11228 + | .header("Content-Type", "application/x-amz-json-1.1")
|
11229 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
11230 + | .body(::aws_smithy_http_server::body::boxed(
|
11231 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
11232 + | &::aws_smithy_protocol_test::decode_body_data(
|
11233 + | "{\n \"contents\": {\n \"stringValue\": \"foo\"\n }\n}"
|
11234 + | .as_bytes(),
|
11235 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11236 + | ),
|
11237 + | )),
|
11238 + | ))
|
11239 + | .unwrap();
|
11240 + | #[allow(unused_mut)]
|
11241 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11242 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
11243 + | let service = crate::service::JsonProtocol::builder::<
|
11244 + | ::aws_smithy_http_server::body::BoxBody,
|
11245 + | _,
|
11246 + | _,
|
11247 + | _,
|
11248 + | >(config)
|
11249 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
11250 + | let sender = sender.clone();
|
11251 + | async move {
|
11252 + | let result = {
|
11253 + | let expected = crate::input::JsonUnionsInput {
|
11254 + | contents: ::std::option::Option::Some(crate::model::MyUnion::StringValue(
|
11255 + | "foo".to_owned(),
|
11256 + | )),
|
11257 + | };
|
11258 + | ::pretty_assertions::assert_eq!(input, expected);
|
11259 + | let output = crate::output::JsonUnionsOutput {
|
11260 + | contents: ::std::option::Option::None,
|
11261 + | };
|
11262 + | Ok(output)
|
11263 + | };
|
11264 + | sender.send(()).await.expect("receiver dropped early");
|
11265 + | result
|
11266 + | }
|
11267 + | })
|
11268 + | .build_unchecked();
|
11269 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11270 + | .await
|
11271 + | .expect("unable to make an HTTP request");
|
11272 + | assert!(
|
11273 + | receiver.recv().await.is_some(),
|
11274 + | "we expected operation handler to be invoked but it was not entered"
|
11275 + | );
|
11276 + | }
|
11277 + |
|
11278 + | /// Serializes a boolean union value
|
11279 + | /// Test ID: AwsJson11SerializeBooleanUnionValue
|
11280 + | #[::tokio::test]
|
11281 + | #[::tracing_test::traced_test]
|
11282 + | async fn aws_json11_serialize_boolean_union_value_request() {
|
11283 + | #[allow(unused_mut)]
|
11284 + | let mut http_request = ::http_1x::Request::builder()
|
11285 + | .uri("/")
|
11286 + | .method("POST")
|
11287 + | .header("Content-Type", "application/x-amz-json-1.1")
|
11288 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
11289 + | .body(::aws_smithy_http_server::body::boxed(
|
11290 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
11291 + | &::aws_smithy_protocol_test::decode_body_data(
|
11292 + | "{\n \"contents\": {\n \"booleanValue\": true\n }\n}"
|
11293 + | .as_bytes(),
|
11294 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11295 + | ),
|
11296 + | )),
|
11297 + | ))
|
11298 + | .unwrap();
|
11299 + | #[allow(unused_mut)]
|
11300 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11301 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
11302 + | let service = crate::service::JsonProtocol::builder::<
|
11303 + | ::aws_smithy_http_server::body::BoxBody,
|
11304 + | _,
|
11305 + | _,
|
11306 + | _,
|
11307 + | >(config)
|
11308 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
11309 + | let sender = sender.clone();
|
11310 + | async move {
|
11311 + | let result = {
|
11312 + | let expected = crate::input::JsonUnionsInput {
|
11313 + | contents: ::std::option::Option::Some(crate::model::MyUnion::BooleanValue(
|
11314 + | true,
|
11315 + | )),
|
11316 + | };
|
11317 + | ::pretty_assertions::assert_eq!(input, expected);
|
11318 + | let output = crate::output::JsonUnionsOutput {
|
11319 + | contents: ::std::option::Option::None,
|
11320 + | };
|
11321 + | Ok(output)
|
11322 + | };
|
11323 + | sender.send(()).await.expect("receiver dropped early");
|
11324 + | result
|
11325 + | }
|
11326 + | })
|
11327 + | .build_unchecked();
|
11328 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11329 + | .await
|
11330 + | .expect("unable to make an HTTP request");
|
11331 + | assert!(
|
11332 + | receiver.recv().await.is_some(),
|
11333 + | "we expected operation handler to be invoked but it was not entered"
|
11334 + | );
|
11335 + | }
|
11321 11336 |
|
11322 - | /// Parses boolean (false)
|
11323 - | /// Test ID: parses_boolean_false
|
11337 + | /// Serializes a number union value
|
11338 + | /// Test ID: AwsJson11SerializeNumberUnionValue
|
11324 11339 | #[::tokio::test]
|
11325 11340 | #[::tracing_test::traced_test]
|
11326 - | async fn parses_boolean_false_response() {
|
11327 - | let output = crate::output::KitchenSinkOperationOutput {
|
11328 - | boolean: ::std::option::Option::Some(false),
|
11329 - | blob: ::std::option::Option::None,
|
11330 - | double: ::std::option::Option::None,
|
11331 - | empty_struct: ::std::option::Option::None,
|
11332 - | float: ::std::option::Option::None,
|
11333 - | httpdate_timestamp: ::std::option::Option::None,
|
11334 - | integer: ::std::option::Option::None,
|
11335 - | iso8601_timestamp: ::std::option::Option::None,
|
11336 - | json_value: ::std::option::Option::None,
|
11337 - | list_of_lists: ::std::option::Option::None,
|
11338 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11339 - | list_of_strings: ::std::option::Option::None,
|
11340 - | list_of_structs: ::std::option::Option::None,
|
11341 - | long: ::std::option::Option::None,
|
11342 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11343 - | map_of_maps: ::std::option::Option::None,
|
11344 - | map_of_strings: ::std::option::Option::None,
|
11345 - | map_of_structs: ::std::option::Option::None,
|
11346 - | recursive_list: ::std::option::Option::None,
|
11347 - | recursive_map: ::std::option::Option::None,
|
11348 - | recursive_struct: ::std::option::Option::None,
|
11349 - | simple_struct: ::std::option::Option::None,
|
11350 - | string: ::std::option::Option::None,
|
11351 - | struct_with_json_name: ::std::option::Option::None,
|
11352 - | timestamp: ::std::option::Option::None,
|
11353 - | unix_timestamp: ::std::option::Option::None,
|
11354 - | };
|
11355 - | use ::aws_smithy_http_server::response::IntoResponse;
|
11356 - | let http_response = output.into_response();
|
11357 - | ::pretty_assertions::assert_eq!(
|
11358 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11359 - | http_response.status()
|
11360 - | );
|
11361 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11362 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11363 - | http_response.headers(),
|
11364 - | expected_headers,
|
11365 - | ));
|
11366 - | use ::http_body_util::BodyExt;
|
11367 - | let body = http_response
|
11368 - | .into_body()
|
11369 - | .collect()
|
11341 + | async fn aws_json11_serialize_number_union_value_request() {
|
11342 + | #[allow(unused_mut)]
|
11343 + | let mut http_request = ::http_1x::Request::builder()
|
11344 + | .uri("/")
|
11345 + | .method("POST")
|
11346 + | .header("Content-Type", "application/x-amz-json-1.1")
|
11347 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
11348 + | .body(::aws_smithy_http_server::body::boxed(
|
11349 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
11350 + | &::aws_smithy_protocol_test::decode_body_data(
|
11351 + | "{\n \"contents\": {\n \"numberValue\": 1\n }\n}".as_bytes(),
|
11352 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11353 + | ),
|
11354 + | )),
|
11355 + | ))
|
11356 + | .unwrap();
|
11357 + | #[allow(unused_mut)]
|
11358 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11359 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
11360 + | let service = crate::service::JsonProtocol::builder::<
|
11361 + | ::aws_smithy_http_server::body::BoxBody,
|
11362 + | _,
|
11363 + | _,
|
11364 + | _,
|
11365 + | >(config)
|
11366 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
11367 + | let sender = sender.clone();
|
11368 + | async move {
|
11369 + | let result = {
|
11370 + | let expected = crate::input::JsonUnionsInput {
|
11371 + | contents: ::std::option::Option::Some(crate::model::MyUnion::NumberValue(
|
11372 + | 1,
|
11373 + | )),
|
11374 + | };
|
11375 + | ::pretty_assertions::assert_eq!(input, expected);
|
11376 + | let output = crate::output::JsonUnionsOutput {
|
11377 + | contents: ::std::option::Option::None,
|
11378 + | };
|
11379 + | Ok(output)
|
11380 + | };
|
11381 + | sender.send(()).await.expect("receiver dropped early");
|
11382 + | result
|
11383 + | }
|
11384 + | })
|
11385 + | .build_unchecked();
|
11386 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11370 11387 | .await
|
11371 - | .expect("unable to collect body")
|
11372 - | .to_bytes();
|
11373 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11374 - | &body,
|
11375 - | "{\"Boolean\":false}",
|
11376 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11377 - | ));
|
11388 + | .expect("unable to make an HTTP request");
|
11389 + | assert!(
|
11390 + | receiver.recv().await.is_some(),
|
11391 + | "we expected operation handler to be invoked but it was not entered"
|
11392 + | );
|
11378 11393 | }
|
11379 11394 |
|
11380 - | /// Parses blob shapes
|
11381 - | /// Test ID: parses_blob_shapes
|
11395 + | /// Serializes a blob union value
|
11396 + | /// Test ID: AwsJson11SerializeBlobUnionValue
|
11382 11397 | #[::tokio::test]
|
11383 11398 | #[::tracing_test::traced_test]
|
11384 - | async fn parses_blob_shapes_response() {
|
11385 - | let output = crate::output::KitchenSinkOperationOutput {
|
11386 - | blob: ::std::option::Option::Some(::aws_smithy_types::Blob::new("binary-value")),
|
11387 - | boolean: ::std::option::Option::None,
|
11388 - | double: ::std::option::Option::None,
|
11389 - | empty_struct: ::std::option::Option::None,
|
11390 - | float: ::std::option::Option::None,
|
11391 - | httpdate_timestamp: ::std::option::Option::None,
|
11392 - | integer: ::std::option::Option::None,
|
11393 - | iso8601_timestamp: ::std::option::Option::None,
|
11394 - | json_value: ::std::option::Option::None,
|
11395 - | list_of_lists: ::std::option::Option::None,
|
11396 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11397 - | list_of_strings: ::std::option::Option::None,
|
11398 - | list_of_structs: ::std::option::Option::None,
|
11399 - | long: ::std::option::Option::None,
|
11400 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11401 - | map_of_maps: ::std::option::Option::None,
|
11402 - | map_of_strings: ::std::option::Option::None,
|
11403 - | map_of_structs: ::std::option::Option::None,
|
11404 - | recursive_list: ::std::option::Option::None,
|
11405 - | recursive_map: ::std::option::Option::None,
|
11406 - | recursive_struct: ::std::option::Option::None,
|
11407 - | simple_struct: ::std::option::Option::None,
|
11408 - | string: ::std::option::Option::None,
|
11409 - | struct_with_json_name: ::std::option::Option::None,
|
11410 - | timestamp: ::std::option::Option::None,
|
11411 - | unix_timestamp: ::std::option::Option::None,
|
11412 - | };
|
11413 - | use ::aws_smithy_http_server::response::IntoResponse;
|
11414 - | let http_response = output.into_response();
|
11415 - | ::pretty_assertions::assert_eq!(
|
11416 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11417 - | http_response.status()
|
11399 + | async fn aws_json11_serialize_blob_union_value_request() {
|
11400 + | #[allow(unused_mut)]
|
11401 + | let mut http_request = ::http_1x::Request::builder()
|
11402 + | .uri("/")
|
11403 + | .method("POST")
|
11404 + | .header("Content-Type", "application/x-amz-json-1.1")
|
11405 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
11406 + | .body(::aws_smithy_http_server::body::boxed(
|
11407 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
11408 + | &::aws_smithy_protocol_test::decode_body_data(
|
11409 + | "{\n \"contents\": {\n \"blobValue\": \"Zm9v\"\n }\n}"
|
11410 + | .as_bytes(),
|
11411 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11412 + | ),
|
11413 + | )),
|
11414 + | ))
|
11415 + | .unwrap();
|
11416 + | #[allow(unused_mut)]
|
11417 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11418 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
11419 + | let service = crate::service::JsonProtocol::builder::<
|
11420 + | ::aws_smithy_http_server::body::BoxBody,
|
11421 + | _,
|
11422 + | _,
|
11423 + | _,
|
11424 + | >(config)
|
11425 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
11426 + | let sender = sender.clone();
|
11427 + | async move {
|
11428 + | let result = {
|
11429 + | let expected = crate::input::JsonUnionsInput {
|
11430 + | contents: ::std::option::Option::Some(crate::model::MyUnion::BlobValue(
|
11431 + | ::aws_smithy_types::Blob::new("foo"),
|
11432 + | )),
|
11433 + | };
|
11434 + | ::pretty_assertions::assert_eq!(input, expected);
|
11435 + | let output = crate::output::JsonUnionsOutput {
|
11436 + | contents: ::std::option::Option::None,
|
11437 + | };
|
11438 + | Ok(output)
|
11439 + | };
|
11440 + | sender.send(()).await.expect("receiver dropped early");
|
11441 + | result
|
11442 + | }
|
11443 + | })
|
11444 + | .build_unchecked();
|
11445 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11446 + | .await
|
11447 + | .expect("unable to make an HTTP request");
|
11448 + | assert!(
|
11449 + | receiver.recv().await.is_some(),
|
11450 + | "we expected operation handler to be invoked but it was not entered"
|
11418 11451 | );
|
11419 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11420 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11421 - | http_response.headers(),
|
11422 - | expected_headers,
|
11423 - | ));
|
11424 - | use ::http_body_util::BodyExt;
|
11425 - | let body = http_response
|
11426 - | .into_body()
|
11427 - | .collect()
|
11452 + | }
|
11453 + |
|
11454 + | /// Serializes a timestamp union value
|
11455 + | /// Test ID: AwsJson11SerializeTimestampUnionValue
|
11456 + | #[::tokio::test]
|
11457 + | #[::tracing_test::traced_test]
|
11458 + | async fn aws_json11_serialize_timestamp_union_value_request() {
|
11459 + | #[allow(unused_mut)]
|
11460 + | let mut http_request = ::http_1x::Request::builder()
|
11461 + | .uri("/")
|
11462 + | .method("POST")
|
11463 + | .header("Content-Type", "application/x-amz-json-1.1")
|
11464 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
11465 + | .body(::aws_smithy_http_server::body::boxed(
|
11466 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
11467 + | &::aws_smithy_protocol_test::decode_body_data(
|
11468 + | "{\n \"contents\": {\n \"timestampValue\": 1398796238\n }\n}"
|
11469 + | .as_bytes(),
|
11470 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11471 + | ),
|
11472 + | )),
|
11473 + | ))
|
11474 + | .unwrap();
|
11475 + | #[allow(unused_mut)]
|
11476 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11477 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
11478 + | let service = crate::service::JsonProtocol::builder::<
|
11479 + | ::aws_smithy_http_server::body::BoxBody,
|
11480 + | _,
|
11481 + | _,
|
11482 + | _,
|
11483 + | >(config)
|
11484 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
11485 + | let sender = sender.clone();
|
11486 + | async move {
|
11487 + | let result = {
|
11488 + | let expected = crate::input::JsonUnionsInput {
|
11489 + | contents: ::std::option::Option::Some(
|
11490 + | crate::model::MyUnion::TimestampValue(
|
11491 + | ::aws_smithy_types::DateTime::from_fractional_secs(
|
11492 + | 1398796238, 0_f64,
|
11493 + | ),
|
11494 + | ),
|
11495 + | ),
|
11496 + | };
|
11497 + | ::pretty_assertions::assert_eq!(input, expected);
|
11498 + | let output = crate::output::JsonUnionsOutput {
|
11499 + | contents: ::std::option::Option::None,
|
11500 + | };
|
11501 + | Ok(output)
|
11502 + | };
|
11503 + | sender.send(()).await.expect("receiver dropped early");
|
11504 + | result
|
11505 + | }
|
11506 + | })
|
11507 + | .build_unchecked();
|
11508 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11428 11509 | .await
|
11429 - | .expect("unable to collect body")
|
11430 - | .to_bytes();
|
11431 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11432 - | &body,
|
11433 - | "{\"Blob\":\"YmluYXJ5LXZhbHVl\"}",
|
11434 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11435 - | ));
|
11510 + | .expect("unable to make an HTTP request");
|
11511 + | assert!(
|
11512 + | receiver.recv().await.is_some(),
|
11513 + | "we expected operation handler to be invoked but it was not entered"
|
11514 + | );
|
11436 11515 | }
|
11437 11516 |
|
11438 - | /// Parses timestamp shapes
|
11439 - | /// Test ID: parses_timestamp_shapes
|
11517 + | /// Serializes an enum union value
|
11518 + | /// Test ID: AwsJson11SerializeEnumUnionValue
|
11440 11519 | #[::tokio::test]
|
11441 11520 | #[::tracing_test::traced_test]
|
11442 - | async fn parses_timestamp_shapes_response() {
|
11443 - | let output = crate::output::KitchenSinkOperationOutput {
|
11444 - | timestamp: ::std::option::Option::Some(
|
11445 - | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
11446 - | ),
|
11447 - | blob: ::std::option::Option::None,
|
11448 - | boolean: ::std::option::Option::None,
|
11449 - | double: ::std::option::Option::None,
|
11450 - | empty_struct: ::std::option::Option::None,
|
11451 - | float: ::std::option::Option::None,
|
11452 - | httpdate_timestamp: ::std::option::Option::None,
|
11453 - | integer: ::std::option::Option::None,
|
11454 - | iso8601_timestamp: ::std::option::Option::None,
|
11455 - | json_value: ::std::option::Option::None,
|
11456 - | list_of_lists: ::std::option::Option::None,
|
11457 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11458 - | list_of_strings: ::std::option::Option::None,
|
11459 - | list_of_structs: ::std::option::Option::None,
|
11460 - | long: ::std::option::Option::None,
|
11461 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11462 - | map_of_maps: ::std::option::Option::None,
|
11463 - | map_of_strings: ::std::option::Option::None,
|
11464 - | map_of_structs: ::std::option::Option::None,
|
11465 - | recursive_list: ::std::option::Option::None,
|
11466 - | recursive_map: ::std::option::Option::None,
|
11467 - | recursive_struct: ::std::option::Option::None,
|
11468 - | simple_struct: ::std::option::Option::None,
|
11469 - | string: ::std::option::Option::None,
|
11470 - | struct_with_json_name: ::std::option::Option::None,
|
11471 - | unix_timestamp: ::std::option::Option::None,
|
11472 - | };
|
11473 - | use ::aws_smithy_http_server::response::IntoResponse;
|
11474 - | let http_response = output.into_response();
|
11475 - | ::pretty_assertions::assert_eq!(
|
11476 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11477 - | http_response.status()
|
11521 + | async fn aws_json11_serialize_enum_union_value_request() {
|
11522 + | #[allow(unused_mut)]
|
11523 + | let mut http_request = ::http_1x::Request::builder()
|
11524 + | .uri("/")
|
11525 + | .method("POST")
|
11526 + | .header("Content-Type", "application/x-amz-json-1.1")
|
11527 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
11528 + | .body(::aws_smithy_http_server::body::boxed(
|
11529 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
11530 + | &::aws_smithy_protocol_test::decode_body_data(
|
11531 + | "{\n \"contents\": {\n \"enumValue\": \"Foo\"\n }\n}"
|
11532 + | .as_bytes(),
|
11533 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11534 + | ),
|
11535 + | )),
|
11536 + | ))
|
11537 + | .unwrap();
|
11538 + | #[allow(unused_mut)]
|
11539 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11540 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
11541 + | let service = crate::service::JsonProtocol::builder::<
|
11542 + | ::aws_smithy_http_server::body::BoxBody,
|
11543 + | _,
|
11544 + | _,
|
11545 + | _,
|
11546 + | >(config)
|
11547 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
11548 + | let sender = sender.clone();
|
11549 + | async move {
|
11550 + | let result = {
|
11551 + | let expected = crate::input::JsonUnionsInput {
|
11552 + | contents: ::std::option::Option::Some(crate::model::MyUnion::EnumValue(
|
11553 + | "Foo"
|
11554 + | .parse::<crate::model::FooEnum>()
|
11555 + | .expect("static value validated to member"),
|
11556 + | )),
|
11557 + | };
|
11558 + | ::pretty_assertions::assert_eq!(input, expected);
|
11559 + | let output = crate::output::JsonUnionsOutput {
|
11560 + | contents: ::std::option::Option::None,
|
11561 + | };
|
11562 + | Ok(output)
|
11563 + | };
|
11564 + | sender.send(()).await.expect("receiver dropped early");
|
11565 + | result
|
11566 + | }
|
11567 + | })
|
11568 + | .build_unchecked();
|
11569 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11570 + | .await
|
11571 + | .expect("unable to make an HTTP request");
|
11572 + | assert!(
|
11573 + | receiver.recv().await.is_some(),
|
11574 + | "we expected operation handler to be invoked but it was not entered"
|
11478 11575 | );
|
11479 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11480 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11481 - | http_response.headers(),
|
11482 - | expected_headers,
|
11483 - | ));
|
11484 - | use ::http_body_util::BodyExt;
|
11485 - | let body = http_response
|
11486 - | .into_body()
|
11487 - | .collect()
|
11576 + | }
|
11577 + |
|
11578 + | /// Serializes a list union value
|
11579 + | /// Test ID: AwsJson11SerializeListUnionValue
|
11580 + | #[::tokio::test]
|
11581 + | #[::tracing_test::traced_test]
|
11582 + | async fn aws_json11_serialize_list_union_value_request() {
|
11583 + | #[allow(unused_mut)]
|
11584 + | let mut http_request = ::http_1x::Request::builder()
|
11585 + | .uri("/")
|
11586 + | .method("POST")
|
11587 + | .header("Content-Type", "application/x-amz-json-1.1")
|
11588 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
11589 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
11590 + | ::bytes::Bytes::copy_from_slice(
|
11591 + | &::aws_smithy_protocol_test::decode_body_data("{\n \"contents\": {\n \"listValue\": [\"foo\", \"bar\"]\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
11592 + | )
|
11593 + | ))).unwrap();
|
11594 + | #[allow(unused_mut)]
|
11595 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11596 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
11597 + | let service = crate::service::JsonProtocol::builder::<
|
11598 + | ::aws_smithy_http_server::body::BoxBody,
|
11599 + | _,
|
11600 + | _,
|
11601 + | _,
|
11602 + | >(config)
|
11603 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
11604 + | let sender = sender.clone();
|
11605 + | async move {
|
11606 + | let result = {
|
11607 + | let expected = crate::input::JsonUnionsInput {
|
11608 + | contents: ::std::option::Option::Some(crate::model::MyUnion::ListValue(
|
11609 + | vec!["foo".to_owned(), "bar".to_owned()],
|
11610 + | )),
|
11611 + | };
|
11612 + | ::pretty_assertions::assert_eq!(input, expected);
|
11613 + | let output = crate::output::JsonUnionsOutput {
|
11614 + | contents: ::std::option::Option::None,
|
11615 + | };
|
11616 + | Ok(output)
|
11617 + | };
|
11618 + | sender.send(()).await.expect("receiver dropped early");
|
11619 + | result
|
11620 + | }
|
11621 + | })
|
11622 + | .build_unchecked();
|
11623 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11488 11624 | .await
|
11489 - | .expect("unable to collect body")
|
11490 - | .to_bytes();
|
11491 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11492 - | &body,
|
11493 - | "{\"Timestamp\":946845296}",
|
11494 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11495 - | ));
|
11625 + | .expect("unable to make an HTTP request");
|
11626 + | assert!(
|
11627 + | receiver.recv().await.is_some(),
|
11628 + | "we expected operation handler to be invoked but it was not entered"
|
11629 + | );
|
11496 11630 | }
|
11497 11631 |
|
11498 - | /// Parses iso8601 timestamps
|
11499 - | /// Test ID: parses_iso8601_timestamps
|
11632 + | /// Serializes a map union value
|
11633 + | /// Test ID: AwsJson11SerializeMapUnionValue
|
11500 11634 | #[::tokio::test]
|
11501 11635 | #[::tracing_test::traced_test]
|
11502 - | async fn parses_iso8601_timestamps_response() {
|
11503 - | let output = crate::output::KitchenSinkOperationOutput {
|
11504 - | iso8601_timestamp: ::std::option::Option::Some(
|
11505 - | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
11506 - | ),
|
11507 - | blob: ::std::option::Option::None,
|
11508 - | boolean: ::std::option::Option::None,
|
11509 - | double: ::std::option::Option::None,
|
11510 - | empty_struct: ::std::option::Option::None,
|
11511 - | float: ::std::option::Option::None,
|
11512 - | httpdate_timestamp: ::std::option::Option::None,
|
11513 - | integer: ::std::option::Option::None,
|
11514 - | json_value: ::std::option::Option::None,
|
11515 - | list_of_lists: ::std::option::Option::None,
|
11516 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11517 - | list_of_strings: ::std::option::Option::None,
|
11518 - | list_of_structs: ::std::option::Option::None,
|
11519 - | long: ::std::option::Option::None,
|
11520 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11521 - | map_of_maps: ::std::option::Option::None,
|
11522 - | map_of_strings: ::std::option::Option::None,
|
11523 - | map_of_structs: ::std::option::Option::None,
|
11524 - | recursive_list: ::std::option::Option::None,
|
11525 - | recursive_map: ::std::option::Option::None,
|
11526 - | recursive_struct: ::std::option::Option::None,
|
11527 - | simple_struct: ::std::option::Option::None,
|
11528 - | string: ::std::option::Option::None,
|
11529 - | struct_with_json_name: ::std::option::Option::None,
|
11530 - | timestamp: ::std::option::Option::None,
|
11531 - | unix_timestamp: ::std::option::Option::None,
|
11532 - | };
|
11533 - | use ::aws_smithy_http_server::response::IntoResponse;
|
11534 - | let http_response = output.into_response();
|
11535 - | ::pretty_assertions::assert_eq!(
|
11536 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11537 - | http_response.status()
|
11636 + | async fn aws_json11_serialize_map_union_value_request() {
|
11637 + | #[allow(unused_mut)]
|
11638 + | let mut http_request = ::http_1x::Request::builder()
|
11639 + | .uri("/")
|
11640 + | .method("POST")
|
11641 + | .header("Content-Type", "application/x-amz-json-1.1")
|
11642 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
11643 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
11644 + | ::bytes::Bytes::copy_from_slice(
|
11645 + | &::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"))
|
11646 + | )
|
11647 + | ))).unwrap();
|
11648 + | #[allow(unused_mut)]
|
11649 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11650 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
11651 + | let service = crate::service::JsonProtocol::builder::<
|
11652 + | ::aws_smithy_http_server::body::BoxBody,
|
11653 + | _,
|
11654 + | _,
|
11655 + | _,
|
11656 + | >(config)
|
11657 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
11658 + | let sender = sender.clone();
|
11659 + | async move {
|
11660 + | let result = {
|
11661 + | let expected = crate::input::JsonUnionsInput {
|
11662 + | contents: ::std::option::Option::Some(crate::model::MyUnion::MapValue({
|
11663 + | let mut ret = ::std::collections::HashMap::new();
|
11664 + | ret.insert("foo".to_owned(), "bar".to_owned());
|
11665 + | ret.insert("spam".to_owned(), "eggs".to_owned());
|
11666 + | ret
|
11667 + | })),
|
11668 + | };
|
11669 + | ::pretty_assertions::assert_eq!(input, expected);
|
11670 + | let output = crate::output::JsonUnionsOutput {
|
11671 + | contents: ::std::option::Option::None,
|
11672 + | };
|
11673 + | Ok(output)
|
11674 + | };
|
11675 + | sender.send(()).await.expect("receiver dropped early");
|
11676 + | result
|
11677 + | }
|
11678 + | })
|
11679 + | .build_unchecked();
|
11680 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11681 + | .await
|
11682 + | .expect("unable to make an HTTP request");
|
11683 + | assert!(
|
11684 + | receiver.recv().await.is_some(),
|
11685 + | "we expected operation handler to be invoked but it was not entered"
|
11538 11686 | );
|
11539 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11540 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11541 - | http_response.headers(),
|
11542 - | expected_headers,
|
11543 - | ));
|
11544 - | use ::http_body_util::BodyExt;
|
11545 - | let body = http_response
|
11546 - | .into_body()
|
11547 - | .collect()
|
11687 + | }
|
11688 + |
|
11689 + | /// Serializes a structure union value
|
11690 + | /// Test ID: AwsJson11SerializeStructureUnionValue
|
11691 + | #[::tokio::test]
|
11692 + | #[::tracing_test::traced_test]
|
11693 + | async fn aws_json11_serialize_structure_union_value_request() {
|
11694 + | #[allow(unused_mut)]
|
11695 + | let mut http_request = ::http_1x::Request::builder()
|
11696 + | .uri("/")
|
11697 + | .method("POST")
|
11698 + | .header("Content-Type", "application/x-amz-json-1.1")
|
11699 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
11700 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
11701 + | ::bytes::Bytes::copy_from_slice(
|
11702 + | &::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"))
|
11703 + | )
|
11704 + | ))).unwrap();
|
11705 + | #[allow(unused_mut)]
|
11706 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11707 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
11708 + | let service = crate::service::JsonProtocol::builder::<
|
11709 + | ::aws_smithy_http_server::body::BoxBody,
|
11710 + | _,
|
11711 + | _,
|
11712 + | _,
|
11713 + | >(config)
|
11714 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
11715 + | let sender = sender.clone();
|
11716 + | async move {
|
11717 + | let result = {
|
11718 + | let expected = crate::input::JsonUnionsInput {
|
11719 + | contents: ::std::option::Option::Some(
|
11720 + | crate::model::MyUnion::StructureValue(crate::model::GreetingStruct {
|
11721 + | hi: ::std::option::Option::Some("hello".to_owned()),
|
11722 + | }),
|
11723 + | ),
|
11724 + | };
|
11725 + | ::pretty_assertions::assert_eq!(input, expected);
|
11726 + | let output = crate::output::JsonUnionsOutput {
|
11727 + | contents: ::std::option::Option::None,
|
11728 + | };
|
11729 + | Ok(output)
|
11730 + | };
|
11731 + | sender.send(()).await.expect("receiver dropped early");
|
11732 + | result
|
11733 + | }
|
11734 + | })
|
11735 + | .build_unchecked();
|
11736 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11548 11737 | .await
|
11549 - | .expect("unable to collect body")
|
11550 - | .to_bytes();
|
11551 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11552 - | &body,
|
11553 - | "{\"Iso8601Timestamp\":\"2000-01-02T20:34:56Z\"}",
|
11554 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11555 - | ));
|
11738 + | .expect("unable to make an HTTP request");
|
11739 + | assert!(
|
11740 + | receiver.recv().await.is_some(),
|
11741 + | "we expected operation handler to be invoked but it was not entered"
|
11742 + | );
|
11556 11743 | }
|
11557 11744 |
|
11558 - | /// Parses httpdate timestamps
|
11559 - | /// Test ID: parses_httpdate_timestamps
|
11745 + | /// Deserializes a string union value
|
11746 + | /// Test ID: AwsJson11DeserializeStringUnionValue
|
11560 11747 | #[::tokio::test]
|
11561 11748 | #[::tracing_test::traced_test]
|
11562 - | async fn parses_httpdate_timestamps_response() {
|
11563 - | let output = crate::output::KitchenSinkOperationOutput {
|
11564 - | httpdate_timestamp: ::std::option::Option::Some(
|
11565 - | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
11566 - | ),
|
11567 - | blob: ::std::option::Option::None,
|
11568 - | boolean: ::std::option::Option::None,
|
11569 - | double: ::std::option::Option::None,
|
11570 - | empty_struct: ::std::option::Option::None,
|
11571 - | float: ::std::option::Option::None,
|
11572 - | integer: ::std::option::Option::None,
|
11573 - | iso8601_timestamp: ::std::option::Option::None,
|
11574 - | json_value: ::std::option::Option::None,
|
11575 - | list_of_lists: ::std::option::Option::None,
|
11576 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11577 - | list_of_strings: ::std::option::Option::None,
|
11578 - | list_of_structs: ::std::option::Option::None,
|
11579 - | long: ::std::option::Option::None,
|
11580 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11581 - | map_of_maps: ::std::option::Option::None,
|
11582 - | map_of_strings: ::std::option::Option::None,
|
11583 - | map_of_structs: ::std::option::Option::None,
|
11584 - | recursive_list: ::std::option::Option::None,
|
11585 - | recursive_map: ::std::option::Option::None,
|
11586 - | recursive_struct: ::std::option::Option::None,
|
11587 - | simple_struct: ::std::option::Option::None,
|
11588 - | string: ::std::option::Option::None,
|
11589 - | struct_with_json_name: ::std::option::Option::None,
|
11590 - | timestamp: ::std::option::Option::None,
|
11591 - | unix_timestamp: ::std::option::Option::None,
|
11749 + | async fn aws_json11_deserialize_string_union_value_response() {
|
11750 + | let output = crate::output::JsonUnionsOutput {
|
11751 + | contents: ::std::option::Option::Some(crate::model::MyUnion::StringValue(
|
11752 + | "foo".to_owned(),
|
11753 + | )),
|
11592 11754 | };
|
11593 11755 | use ::aws_smithy_http_server::response::IntoResponse;
|
11594 11756 | let http_response = output.into_response();
|
11595 11757 | ::pretty_assertions::assert_eq!(
|
11596 11758 | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11597 11759 | http_response.status()
|
11598 11760 | );
|
11599 11761 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11600 11762 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11601 11763 | http_response.headers(),
|
11602 11764 | expected_headers,
|
11603 11765 | ));
|
11604 11766 | use ::http_body_util::BodyExt;
|
11605 11767 | let body = http_response
|
11606 11768 | .into_body()
|
11607 11769 | .collect()
|
11608 11770 | .await
|
11609 11771 | .expect("unable to collect body")
|
11610 11772 | .to_bytes();
|
11611 11773 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11612 11774 | &body,
|
11613 - | "{\"HttpdateTimestamp\":\"Sun, 02 Jan 2000 20:34:56 GMT\"}",
|
11775 + | "{\n \"contents\": {\n \"stringValue\": \"foo\"\n }\n}",
|
11614 11776 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11615 11777 | ));
|
11616 11778 | }
|
11617 11779 |
|
11618 - | /// Parses list shapes
|
11619 - | /// Test ID: parses_list_shapes
|
11780 + | /// Deserializes a boolean union value
|
11781 + | /// Test ID: AwsJson11DeserializeBooleanUnionValue
|
11620 11782 | #[::tokio::test]
|
11621 11783 | #[::tracing_test::traced_test]
|
11622 - | async fn parses_list_shapes_response() {
|
11623 - | let output = crate::output::KitchenSinkOperationOutput {
|
11624 - | list_of_strings: ::std::option::Option::Some(vec![
|
11625 - | "abc".to_owned(),
|
11626 - | "mno".to_owned(),
|
11627 - | "xyz".to_owned(),
|
11628 - | ]),
|
11629 - | blob: ::std::option::Option::None,
|
11630 - | boolean: ::std::option::Option::None,
|
11631 - | double: ::std::option::Option::None,
|
11632 - | empty_struct: ::std::option::Option::None,
|
11633 - | float: ::std::option::Option::None,
|
11634 - | httpdate_timestamp: ::std::option::Option::None,
|
11635 - | integer: ::std::option::Option::None,
|
11636 - | iso8601_timestamp: ::std::option::Option::None,
|
11637 - | json_value: ::std::option::Option::None,
|
11638 - | list_of_lists: ::std::option::Option::None,
|
11639 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11640 - | list_of_structs: ::std::option::Option::None,
|
11641 - | long: ::std::option::Option::None,
|
11642 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11643 - | map_of_maps: ::std::option::Option::None,
|
11644 - | map_of_strings: ::std::option::Option::None,
|
11645 - | map_of_structs: ::std::option::Option::None,
|
11646 - | recursive_list: ::std::option::Option::None,
|
11647 - | recursive_map: ::std::option::Option::None,
|
11648 - | recursive_struct: ::std::option::Option::None,
|
11649 - | simple_struct: ::std::option::Option::None,
|
11650 - | string: ::std::option::Option::None,
|
11651 - | struct_with_json_name: ::std::option::Option::None,
|
11652 - | timestamp: ::std::option::Option::None,
|
11653 - | unix_timestamp: ::std::option::Option::None,
|
11784 + | async fn aws_json11_deserialize_boolean_union_value_response() {
|
11785 + | let output = crate::output::JsonUnionsOutput {
|
11786 + | contents: ::std::option::Option::Some(crate::model::MyUnion::BooleanValue(true)),
|
11654 11787 | };
|
11655 11788 | use ::aws_smithy_http_server::response::IntoResponse;
|
11656 11789 | let http_response = output.into_response();
|
11657 11790 | ::pretty_assertions::assert_eq!(
|
11658 11791 | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11659 11792 | http_response.status()
|
11660 11793 | );
|
11661 11794 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11662 11795 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11663 11796 | http_response.headers(),
|
11664 11797 | expected_headers,
|
11665 11798 | ));
|
11666 11799 | use ::http_body_util::BodyExt;
|
11667 11800 | let body = http_response
|
11668 11801 | .into_body()
|
11669 11802 | .collect()
|
11670 11803 | .await
|
11671 11804 | .expect("unable to collect body")
|
11672 11805 | .to_bytes();
|
11673 11806 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11674 11807 | &body,
|
11675 - | "{\"ListOfStrings\":[\"abc\",\"mno\",\"xyz\"]}",
|
11808 + | "{\n \"contents\": {\n \"booleanValue\": true\n }\n}",
|
11676 11809 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11677 11810 | ));
|
11678 11811 | }
|
11679 11812 |
|
11680 - | /// Parses list of map shapes
|
11681 - | /// Test ID: parses_list_of_map_shapes
|
11813 + | /// Deserializes a number union value
|
11814 + | /// Test ID: AwsJson11DeserializeNumberUnionValue
|
11682 11815 | #[::tokio::test]
|
11683 11816 | #[::tracing_test::traced_test]
|
11684 - | async fn parses_list_of_map_shapes_response() {
|
11685 - | let output = crate::output::KitchenSinkOperationOutput {
|
11686 - | list_of_maps_of_strings: ::std::option::Option::Some(vec![
|
11687 - | {
|
11688 - | let mut ret = ::std::collections::HashMap::new();
|
11689 - | ret.insert("size".to_owned(), "large".to_owned());
|
11690 - | ret
|
11691 - | },
|
11692 - | {
|
11693 - | let mut ret = ::std::collections::HashMap::new();
|
11694 - | ret.insert("color".to_owned(), "red".to_owned());
|
11695 - | ret
|
11696 - | },
|
11697 - | ]),
|
11698 - | blob: ::std::option::Option::None,
|
11699 - | boolean: ::std::option::Option::None,
|
11700 - | double: ::std::option::Option::None,
|
11701 - | empty_struct: ::std::option::Option::None,
|
11702 - | float: ::std::option::Option::None,
|
11703 - | httpdate_timestamp: ::std::option::Option::None,
|
11704 - | integer: ::std::option::Option::None,
|
11705 - | iso8601_timestamp: ::std::option::Option::None,
|
11706 - | json_value: ::std::option::Option::None,
|
11707 - | list_of_lists: ::std::option::Option::None,
|
11708 - | list_of_strings: ::std::option::Option::None,
|
11709 - | list_of_structs: ::std::option::Option::None,
|
11710 - | long: ::std::option::Option::None,
|
11711 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11712 - | map_of_maps: ::std::option::Option::None,
|
11713 - | map_of_strings: ::std::option::Option::None,
|
11714 - | map_of_structs: ::std::option::Option::None,
|
11715 - | recursive_list: ::std::option::Option::None,
|
11716 - | recursive_map: ::std::option::Option::None,
|
11717 - | recursive_struct: ::std::option::Option::None,
|
11718 - | simple_struct: ::std::option::Option::None,
|
11719 - | string: ::std::option::Option::None,
|
11720 - | struct_with_json_name: ::std::option::Option::None,
|
11721 - | timestamp: ::std::option::Option::None,
|
11722 - | unix_timestamp: ::std::option::Option::None,
|
11817 + | async fn aws_json11_deserialize_number_union_value_response() {
|
11818 + | let output = crate::output::JsonUnionsOutput {
|
11819 + | contents: ::std::option::Option::Some(crate::model::MyUnion::NumberValue(1)),
|
11723 11820 | };
|
11724 11821 | use ::aws_smithy_http_server::response::IntoResponse;
|
11725 11822 | let http_response = output.into_response();
|
11726 11823 | ::pretty_assertions::assert_eq!(
|
11727 11824 | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11728 11825 | http_response.status()
|
11729 11826 | );
|
11730 11827 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11731 11828 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11732 11829 | http_response.headers(),
|
11733 11830 | expected_headers,
|
11734 11831 | ));
|
11735 11832 | use ::http_body_util::BodyExt;
|
11736 11833 | let body = http_response
|
11737 11834 | .into_body()
|
11738 11835 | .collect()
|
11739 11836 | .await
|
11740 11837 | .expect("unable to collect body")
|
11741 11838 | .to_bytes();
|
11742 11839 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11743 11840 | &body,
|
11744 - | "{\"ListOfMapsOfStrings\":[{\"size\":\"large\"},{\"color\":\"red\"}]}",
|
11841 + | "{\n \"contents\": {\n \"numberValue\": 1\n }\n}",
|
11745 11842 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11746 11843 | ));
|
11747 11844 | }
|
11748 11845 |
|
11749 - | /// Parses list of list shapes
|
11750 - | /// Test ID: parses_list_of_list_shapes
|
11846 + | /// Deserializes a blob union value
|
11847 + | /// Test ID: AwsJson11DeserializeBlobUnionValue
|
11751 11848 | #[::tokio::test]
|
11752 11849 | #[::tracing_test::traced_test]
|
11753 - | async fn parses_list_of_list_shapes_response() {
|
11754 - | let output = crate::output::KitchenSinkOperationOutput {
|
11755 - | list_of_lists: ::std::option::Option::Some(vec![
|
11756 - | vec!["abc".to_owned(), "mno".to_owned(), "xyz".to_owned()],
|
11757 - | vec!["hjk".to_owned(), "qrs".to_owned(), "tuv".to_owned()],
|
11758 - | ]),
|
11759 - | blob: ::std::option::Option::None,
|
11760 - | boolean: ::std::option::Option::None,
|
11761 - | double: ::std::option::Option::None,
|
11762 - | empty_struct: ::std::option::Option::None,
|
11763 - | float: ::std::option::Option::None,
|
11764 - | httpdate_timestamp: ::std::option::Option::None,
|
11765 - | integer: ::std::option::Option::None,
|
11766 - | iso8601_timestamp: ::std::option::Option::None,
|
11767 - | json_value: ::std::option::Option::None,
|
11768 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11769 - | list_of_strings: ::std::option::Option::None,
|
11770 - | list_of_structs: ::std::option::Option::None,
|
11771 - | long: ::std::option::Option::None,
|
11772 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11773 - | map_of_maps: ::std::option::Option::None,
|
11774 - | map_of_strings: ::std::option::Option::None,
|
11775 - | map_of_structs: ::std::option::Option::None,
|
11776 - | recursive_list: ::std::option::Option::None,
|
11777 - | recursive_map: ::std::option::Option::None,
|
11778 - | recursive_struct: ::std::option::Option::None,
|
11779 - | simple_struct: ::std::option::Option::None,
|
11780 - | string: ::std::option::Option::None,
|
11781 - | struct_with_json_name: ::std::option::Option::None,
|
11782 - | timestamp: ::std::option::Option::None,
|
11783 - | unix_timestamp: ::std::option::Option::None,
|
11850 + | async fn aws_json11_deserialize_blob_union_value_response() {
|
11851 + | let output = crate::output::JsonUnionsOutput {
|
11852 + | contents: ::std::option::Option::Some(crate::model::MyUnion::BlobValue(
|
11853 + | ::aws_smithy_types::Blob::new("foo"),
|
11854 + | )),
|
11784 11855 | };
|
11785 11856 | use ::aws_smithy_http_server::response::IntoResponse;
|
11786 11857 | let http_response = output.into_response();
|
11787 11858 | ::pretty_assertions::assert_eq!(
|
11788 11859 | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11789 11860 | http_response.status()
|
11790 11861 | );
|
11791 11862 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11792 11863 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11793 11864 | http_response.headers(),
|
11794 11865 | expected_headers,
|
11795 11866 | ));
|
11796 11867 | use ::http_body_util::BodyExt;
|
11797 11868 | let body = http_response
|
11798 11869 | .into_body()
|
11799 11870 | .collect()
|
11800 11871 | .await
|
11801 11872 | .expect("unable to collect body")
|
11802 11873 | .to_bytes();
|
11803 11874 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11804 11875 | &body,
|
11805 - | "{\"ListOfLists\":[[\"abc\",\"mno\",\"xyz\"],[\"hjk\",\"qrs\",\"tuv\"]]}",
|
11876 + | "{\n \"contents\": {\n \"blobValue\": \"Zm9v\"\n }\n}",
|
11806 11877 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11807 11878 | ));
|
11808 11879 | }
|
11809 11880 |
|
11810 - | /// Parses list of structure shapes
|
11811 - | /// Test ID: parses_list_of_structure_shapes
|
11881 + | /// Deserializes a timestamp union value
|
11882 + | /// Test ID: AwsJson11DeserializeTimestampUnionValue
|
11812 11883 | #[::tokio::test]
|
11813 11884 | #[::tracing_test::traced_test]
|
11814 - | async fn parses_list_of_structure_shapes_response() {
|
11815 - | let output = crate::output::KitchenSinkOperationOutput {
|
11816 - | list_of_structs: ::std::option::Option::Some(vec![
|
11817 - | crate::model::SimpleStruct {
|
11818 - | value: ::std::option::Option::Some("value-1".to_owned()),
|
11819 - | },
|
11820 - | crate::model::SimpleStruct {
|
11821 - | value: ::std::option::Option::Some("value-2".to_owned()),
|
11822 - | },
|
11823 - | ]),
|
11824 - | blob: ::std::option::Option::None,
|
11825 - | boolean: ::std::option::Option::None,
|
11826 - | double: ::std::option::Option::None,
|
11827 - | empty_struct: ::std::option::Option::None,
|
11828 - | float: ::std::option::Option::None,
|
11829 - | httpdate_timestamp: ::std::option::Option::None,
|
11830 - | integer: ::std::option::Option::None,
|
11831 - | iso8601_timestamp: ::std::option::Option::None,
|
11832 - | json_value: ::std::option::Option::None,
|
11833 - | list_of_lists: ::std::option::Option::None,
|
11834 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11835 - | list_of_strings: ::std::option::Option::None,
|
11836 - | long: ::std::option::Option::None,
|
11837 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11838 - | map_of_maps: ::std::option::Option::None,
|
11839 - | map_of_strings: ::std::option::Option::None,
|
11840 - | map_of_structs: ::std::option::Option::None,
|
11841 - | recursive_list: ::std::option::Option::None,
|
11842 - | recursive_map: ::std::option::Option::None,
|
11843 - | recursive_struct: ::std::option::Option::None,
|
11844 - | simple_struct: ::std::option::Option::None,
|
11845 - | string: ::std::option::Option::None,
|
11846 - | struct_with_json_name: ::std::option::Option::None,
|
11847 - | timestamp: ::std::option::Option::None,
|
11848 - | unix_timestamp: ::std::option::Option::None,
|
11885 + | async fn aws_json11_deserialize_timestamp_union_value_response() {
|
11886 + | let output = crate::output::JsonUnionsOutput {
|
11887 + | contents: ::std::option::Option::Some(crate::model::MyUnion::TimestampValue(
|
11888 + | ::aws_smithy_types::DateTime::from_fractional_secs(1398796238, 0_f64),
|
11889 + | )),
|
11849 11890 | };
|
11850 11891 | use ::aws_smithy_http_server::response::IntoResponse;
|
11851 11892 | let http_response = output.into_response();
|
11852 11893 | ::pretty_assertions::assert_eq!(
|
11853 11894 | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11854 11895 | http_response.status()
|
11855 11896 | );
|
11856 11897 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11857 11898 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11858 11899 | http_response.headers(),
|
11859 11900 | expected_headers,
|
11860 11901 | ));
|
11861 11902 | use ::http_body_util::BodyExt;
|
11862 11903 | let body = http_response
|
11863 11904 | .into_body()
|
11864 11905 | .collect()
|
11865 11906 | .await
|
11866 11907 | .expect("unable to collect body")
|
11867 11908 | .to_bytes();
|
11868 11909 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11869 11910 | &body,
|
11870 - | "{\"ListOfStructs\":[{\"Value\":\"value-1\"},{\"Value\":\"value-2\"}]}",
|
11911 + | "{\n \"contents\": {\n \"timestampValue\": 1398796238\n }\n}",
|
11871 11912 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11872 11913 | ));
|
11873 11914 | }
|
11874 11915 |
|
11875 - | /// Parses list of recursive structure shapes
|
11876 - | /// Test ID: parses_list_of_recursive_structure_shapes
|
11916 + | /// Deserializes an enum union value
|
11917 + | /// Test ID: AwsJson11DeserializeEnumUnionValue
|
11877 11918 | #[::tokio::test]
|
11878 11919 | #[::tracing_test::traced_test]
|
11879 - | async fn parses_list_of_recursive_structure_shapes_response() {
|
11880 - | let output = crate::output::KitchenSinkOperationOutput {
|
11881 - | recursive_list: ::std::option::Option::Some(vec![crate::model::KitchenSink {
|
11882 - | recursive_list: ::std::option::Option::Some(vec![crate::model::KitchenSink {
|
11883 - | recursive_list: ::std::option::Option::Some(vec![crate::model::KitchenSink {
|
11884 - | string: ::std::option::Option::Some("value".to_owned()),
|
11885 - | blob: ::std::option::Option::None,
|
11886 - | boolean: ::std::option::Option::None,
|
11887 - | double: ::std::option::Option::None,
|
11888 - | empty_struct: ::std::option::Option::None,
|
11889 - | float: ::std::option::Option::None,
|
11890 - | httpdate_timestamp: ::std::option::Option::None,
|
11891 - | integer: ::std::option::Option::None,
|
11892 - | iso8601_timestamp: ::std::option::Option::None,
|
11893 - | json_value: ::std::option::Option::None,
|
11894 - | list_of_lists: ::std::option::Option::None,
|
11895 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11896 - | list_of_strings: ::std::option::Option::None,
|
11897 - | list_of_structs: ::std::option::Option::None,
|
11898 - | long: ::std::option::Option::None,
|
11899 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11900 - | map_of_maps: ::std::option::Option::None,
|
11901 - | map_of_strings: ::std::option::Option::None,
|
11902 - | map_of_structs: ::std::option::Option::None,
|
11903 - | recursive_list: ::std::option::Option::None,
|
11904 - | recursive_map: ::std::option::Option::None,
|
11905 - | recursive_struct: ::std::option::Option::None,
|
11906 - | simple_struct: ::std::option::Option::None,
|
11907 - | struct_with_json_name: ::std::option::Option::None,
|
11908 - | timestamp: ::std::option::Option::None,
|
11909 - | unix_timestamp: ::std::option::Option::None,
|
11910 - | }]),
|
11911 - | blob: ::std::option::Option::None,
|
11912 - | boolean: ::std::option::Option::None,
|
11913 - | double: ::std::option::Option::None,
|
11914 - | empty_struct: ::std::option::Option::None,
|
11915 - | float: ::std::option::Option::None,
|
11916 - | httpdate_timestamp: ::std::option::Option::None,
|
11917 - | integer: ::std::option::Option::None,
|
11918 - | iso8601_timestamp: ::std::option::Option::None,
|
11919 - | json_value: ::std::option::Option::None,
|
11920 - | list_of_lists: ::std::option::Option::None,
|
11921 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11922 - | list_of_strings: ::std::option::Option::None,
|
11923 - | list_of_structs: ::std::option::Option::None,
|
11924 - | long: ::std::option::Option::None,
|
11925 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11926 - | map_of_maps: ::std::option::Option::None,
|
11927 - | map_of_strings: ::std::option::Option::None,
|
11928 - | map_of_structs: ::std::option::Option::None,
|
11929 - | recursive_map: ::std::option::Option::None,
|
11930 - | recursive_struct: ::std::option::Option::None,
|
11931 - | simple_struct: ::std::option::Option::None,
|
11932 - | string: ::std::option::Option::None,
|
11933 - | struct_with_json_name: ::std::option::Option::None,
|
11934 - | timestamp: ::std::option::Option::None,
|
11935 - | unix_timestamp: ::std::option::Option::None,
|
11936 - | }]),
|
11937 - | blob: ::std::option::Option::None,
|
11938 - | boolean: ::std::option::Option::None,
|
11939 - | double: ::std::option::Option::None,
|
11940 - | empty_struct: ::std::option::Option::None,
|
11941 - | float: ::std::option::Option::None,
|
11942 - | httpdate_timestamp: ::std::option::Option::None,
|
11943 - | integer: ::std::option::Option::None,
|
11944 - | iso8601_timestamp: ::std::option::Option::None,
|
11945 - | json_value: ::std::option::Option::None,
|
11946 - | list_of_lists: ::std::option::Option::None,
|
11947 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11948 - | list_of_strings: ::std::option::Option::None,
|
11949 - | list_of_structs: ::std::option::Option::None,
|
11950 - | long: ::std::option::Option::None,
|
11951 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11952 - | map_of_maps: ::std::option::Option::None,
|
11953 - | map_of_strings: ::std::option::Option::None,
|
11954 - | map_of_structs: ::std::option::Option::None,
|
11955 - | recursive_map: ::std::option::Option::None,
|
11956 - | recursive_struct: ::std::option::Option::None,
|
11957 - | simple_struct: ::std::option::Option::None,
|
11958 - | string: ::std::option::Option::None,
|
11959 - | struct_with_json_name: ::std::option::Option::None,
|
11960 - | timestamp: ::std::option::Option::None,
|
11961 - | unix_timestamp: ::std::option::Option::None,
|
11962 - | }]),
|
11963 - | blob: ::std::option::Option::None,
|
11964 - | boolean: ::std::option::Option::None,
|
11965 - | double: ::std::option::Option::None,
|
11966 - | empty_struct: ::std::option::Option::None,
|
11967 - | float: ::std::option::Option::None,
|
11968 - | httpdate_timestamp: ::std::option::Option::None,
|
11969 - | integer: ::std::option::Option::None,
|
11970 - | iso8601_timestamp: ::std::option::Option::None,
|
11971 - | json_value: ::std::option::Option::None,
|
11972 - | list_of_lists: ::std::option::Option::None,
|
11973 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11974 - | list_of_strings: ::std::option::Option::None,
|
11975 - | list_of_structs: ::std::option::Option::None,
|
11976 - | long: ::std::option::Option::None,
|
11977 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11978 - | map_of_maps: ::std::option::Option::None,
|
11979 - | map_of_strings: ::std::option::Option::None,
|
11980 - | map_of_structs: ::std::option::Option::None,
|
11981 - | recursive_map: ::std::option::Option::None,
|
11982 - | recursive_struct: ::std::option::Option::None,
|
11983 - | simple_struct: ::std::option::Option::None,
|
11984 - | string: ::std::option::Option::None,
|
11985 - | struct_with_json_name: ::std::option::Option::None,
|
11986 - | timestamp: ::std::option::Option::None,
|
11987 - | unix_timestamp: ::std::option::Option::None,
|
11920 + | async fn aws_json11_deserialize_enum_union_value_response() {
|
11921 + | let output = crate::output::JsonUnionsOutput {
|
11922 + | contents: ::std::option::Option::Some(crate::model::MyUnion::EnumValue(
|
11923 + | "Foo"
|
11924 + | .parse::<crate::model::FooEnum>()
|
11925 + | .expect("static value validated to member"),
|
11926 + | )),
|
11988 11927 | };
|
11989 11928 | use ::aws_smithy_http_server::response::IntoResponse;
|
11990 11929 | let http_response = output.into_response();
|
11991 11930 | ::pretty_assertions::assert_eq!(
|
11992 11931 | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11993 11932 | http_response.status()
|
11994 11933 | );
|
11995 11934 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11996 11935 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11997 11936 | http_response.headers(),
|
11998 11937 | expected_headers,
|
11999 11938 | ));
|
12000 11939 | use ::http_body_util::BodyExt;
|
12001 11940 | let body = http_response
|
12002 11941 | .into_body()
|
12003 11942 | .collect()
|
12004 11943 | .await
|
12005 11944 | .expect("unable to collect body")
|
12006 11945 | .to_bytes();
|
12007 - | ::aws_smithy_protocol_test::assert_ok(
|
12008 - | ::aws_smithy_protocol_test::validate_body(&body, "{\"RecursiveList\":[{\"RecursiveList\":[{\"RecursiveList\":[{\"String\":\"value\"}]}]}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
12009 - | );
|
11946 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11947 + | &body,
|
11948 + | "{\n \"contents\": {\n \"enumValue\": \"Foo\"\n }\n}",
|
11949 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11950 + | ));
|
12010 11951 | }
|
12011 11952 |
|
12012 - | /// Parses map shapes
|
12013 - | /// Test ID: parses_map_shapes
|
11953 + | /// Deserializes a list union value
|
11954 + | /// Test ID: AwsJson11DeserializeListUnionValue
|
12014 11955 | #[::tokio::test]
|
12015 11956 | #[::tracing_test::traced_test]
|
12016 - | async fn parses_map_shapes_response() {
|
12017 - | let output = crate::output::KitchenSinkOperationOutput {
|
12018 - | map_of_strings: ::std::option::Option::Some({
|
12019 - | let mut ret = ::std::collections::HashMap::new();
|
12020 - | ret.insert("size".to_owned(), "large".to_owned());
|
12021 - | ret.insert("color".to_owned(), "red".to_owned());
|
12022 - | ret
|
12023 - | }),
|
12024 - | blob: ::std::option::Option::None,
|
12025 - | boolean: ::std::option::Option::None,
|
12026 - | double: ::std::option::Option::None,
|
12027 - | empty_struct: ::std::option::Option::None,
|
12028 - | float: ::std::option::Option::None,
|
12029 - | httpdate_timestamp: ::std::option::Option::None,
|
12030 - | integer: ::std::option::Option::None,
|
12031 - | iso8601_timestamp: ::std::option::Option::None,
|
12032 - | json_value: ::std::option::Option::None,
|
12033 - | list_of_lists: ::std::option::Option::None,
|
12034 - | list_of_maps_of_strings: ::std::option::Option::None,
|
12035 - | list_of_strings: ::std::option::Option::None,
|
12036 - | list_of_structs: ::std::option::Option::None,
|
12037 - | long: ::std::option::Option::None,
|
12038 - | map_of_lists_of_strings: ::std::option::Option::None,
|
12039 - | map_of_maps: ::std::option::Option::None,
|
12040 - | map_of_structs: ::std::option::Option::None,
|
12041 - | recursive_list: ::std::option::Option::None,
|
12042 - | recursive_map: ::std::option::Option::None,
|
12043 - | recursive_struct: ::std::option::Option::None,
|
12044 - | simple_struct: ::std::option::Option::None,
|
12045 - | string: ::std::option::Option::None,
|
12046 - | struct_with_json_name: ::std::option::Option::None,
|
12047 - | timestamp: ::std::option::Option::None,
|
12048 - | unix_timestamp: ::std::option::Option::None,
|
11957 + | async fn aws_json11_deserialize_list_union_value_response() {
|
11958 + | let output = crate::output::JsonUnionsOutput {
|
11959 + | contents: ::std::option::Option::Some(crate::model::MyUnion::ListValue(vec![
|
11960 + | "foo".to_owned(),
|
11961 + | "bar".to_owned(),
|
11962 + | ])),
|
12049 11963 | };
|
12050 11964 | use ::aws_smithy_http_server::response::IntoResponse;
|
12051 11965 | let http_response = output.into_response();
|
12052 11966 | ::pretty_assertions::assert_eq!(
|
12053 11967 | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
12054 11968 | http_response.status()
|
12055 11969 | );
|
12056 11970 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
12057 11971 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12058 11972 | http_response.headers(),
|
12059 11973 | expected_headers,
|
12060 11974 | ));
|
12061 11975 | use ::http_body_util::BodyExt;
|
12062 11976 | let body = http_response
|
12063 11977 | .into_body()
|
12064 11978 | .collect()
|
12065 11979 | .await
|
12066 11980 | .expect("unable to collect body")
|
12067 11981 | .to_bytes();
|
12068 11982 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
12069 11983 | &body,
|
12070 - | "{\"MapOfStrings\":{\"size\":\"large\",\"color\":\"red\"}}",
|
11984 + | "{\n \"contents\": {\n \"listValue\": [\"foo\", \"bar\"]\n }\n}",
|
12071 11985 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
12072 11986 | ));
|
12073 11987 | }
|
12074 11988 |
|
12075 - | /// Parses map of list shapes
|
12076 - | /// Test ID: parses_map_of_list_shapes
|
11989 + | /// Deserializes a map union value
|
11990 + | /// Test ID: AwsJson11DeserializeMapUnionValue
|
11991 + | #[::tokio::test]
|
11992 + | #[::tracing_test::traced_test]
|
11993 + | async fn aws_json11_deserialize_map_union_value_response() {
|
11994 + | let output = crate::output::JsonUnionsOutput {
|
11995 + | contents: ::std::option::Option::Some(crate::model::MyUnion::MapValue({
|
11996 + | let mut ret = ::std::collections::HashMap::new();
|
11997 + | ret.insert("foo".to_owned(), "bar".to_owned());
|
11998 + | ret.insert("spam".to_owned(), "eggs".to_owned());
|
11999 + | ret
|
12000 + | })),
|
12001 + | };
|
12002 + | use ::aws_smithy_http_server::response::IntoResponse;
|
12003 + | let http_response = output.into_response();
|
12004 + | ::pretty_assertions::assert_eq!(
|
12005 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
12006 + | http_response.status()
|
12007 + | );
|
12008 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
12009 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12010 + | http_response.headers(),
|
12011 + | expected_headers,
|
12012 + | ));
|
12013 + | use ::http_body_util::BodyExt;
|
12014 + | let body = http_response
|
12015 + | .into_body()
|
12016 + | .collect()
|
12017 + | .await
|
12018 + | .expect("unable to collect body")
|
12019 + | .to_bytes();
|
12020 + | ::aws_smithy_protocol_test::assert_ok(
|
12021 + | ::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"))
|
12022 + | );
|
12023 + | }
|
12024 + |
|
12025 + | /// Deserializes a structure union value
|
12026 + | /// Test ID: AwsJson11DeserializeStructureUnionValue
|
12077 12027 | #[::tokio::test]
|
12078 12028 | #[::tracing_test::traced_test]
|
12079 - | async fn parses_map_of_list_shapes_response() {
|
12080 - | let output = crate::output::KitchenSinkOperationOutput {
|
12081 - | map_of_lists_of_strings: ::std::option::Option::Some({
|
12082 - | let mut ret = ::std::collections::HashMap::new();
|
12083 - | ret.insert(
|
12084 - | "sizes".to_owned(),
|
12085 - | vec!["large".to_owned(), "small".to_owned()],
|
12086 - | );
|
12087 - | ret.insert(
|
12088 - | "colors".to_owned(),
|
12089 - | vec!["red".to_owned(), "green".to_owned()],
|
12090 - | );
|
12091 - | ret
|
12092 - | }),
|
12093 - | blob: ::std::option::Option::None,
|
12094 - | boolean: ::std::option::Option::None,
|
12095 - | double: ::std::option::Option::None,
|
12096 - | empty_struct: ::std::option::Option::None,
|
12097 - | float: ::std::option::Option::None,
|
12098 - | httpdate_timestamp: ::std::option::Option::None,
|
12099 - | integer: ::std::option::Option::None,
|
12100 - | iso8601_timestamp: ::std::option::Option::None,
|
12101 - | json_value: ::std::option::Option::None,
|
12102 - | list_of_lists: ::std::option::Option::None,
|
12103 - | list_of_maps_of_strings: ::std::option::Option::None,
|
12104 - | list_of_strings: ::std::option::Option::None,
|
12105 - | list_of_structs: ::std::option::Option::None,
|
12106 - | long: ::std::option::Option::None,
|
12107 - | map_of_maps: ::std::option::Option::None,
|
12108 - | map_of_strings: ::std::option::Option::None,
|
12109 - | map_of_structs: ::std::option::Option::None,
|
12110 - | recursive_list: ::std::option::Option::None,
|
12111 - | recursive_map: ::std::option::Option::None,
|
12112 - | recursive_struct: ::std::option::Option::None,
|
12113 - | simple_struct: ::std::option::Option::None,
|
12114 - | string: ::std::option::Option::None,
|
12115 - | struct_with_json_name: ::std::option::Option::None,
|
12116 - | timestamp: ::std::option::Option::None,
|
12117 - | unix_timestamp: ::std::option::Option::None,
|
12029 + | async fn aws_json11_deserialize_structure_union_value_response() {
|
12030 + | let output = crate::output::JsonUnionsOutput {
|
12031 + | contents: ::std::option::Option::Some(crate::model::MyUnion::StructureValue(
|
12032 + | crate::model::GreetingStruct {
|
12033 + | hi: ::std::option::Option::Some("hello".to_owned()),
|
12034 + | },
|
12035 + | )),
|
12118 12036 | };
|
12119 12037 | use ::aws_smithy_http_server::response::IntoResponse;
|
12120 12038 | let http_response = output.into_response();
|
12121 12039 | ::pretty_assertions::assert_eq!(
|
12122 12040 | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
12123 12041 | http_response.status()
|
12124 12042 | );
|
12125 12043 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
12126 12044 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12127 12045 | http_response.headers(),
|
12128 12046 | expected_headers,
|
12129 12047 | ));
|
12130 12048 | use ::http_body_util::BodyExt;
|
12131 12049 | let body = http_response
|
12132 12050 | .into_body()
|
12133 12051 | .collect()
|
12134 12052 | .await
|
12135 12053 | .expect("unable to collect body")
|
12136 12054 | .to_bytes();
|
12137 12055 | ::aws_smithy_protocol_test::assert_ok(
|
12138 - | ::aws_smithy_protocol_test::validate_body(&body, "{\"MapOfListsOfStrings\":{\"sizes\":[\"large\",\"small\"],\"colors\":[\"red\",\"green\"]}}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
12056 + | ::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"))
|
12057 + | );
|
12058 + | }
|
12059 + | }
|
12060 + |
|
12061 + | ::pin_project_lite::pin_project! {
|
12062 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
12063 + | /// [`EndpointOperationInput`](crate::input::EndpointOperationInput) using modelled bindings.
|
12064 + | pub struct EndpointOperationInputFuture {
|
12065 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EndpointOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
12066 + | }
|
12067 + | }
|
12068 + |
|
12069 + | impl std::future::Future for EndpointOperationInputFuture {
|
12070 + | type Output = Result<
|
12071 + | crate::input::EndpointOperationInput,
|
12072 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
12073 + | >;
|
12074 + |
|
12075 + | fn poll(
|
12076 + | self: std::pin::Pin<&mut Self>,
|
12077 + | cx: &mut std::task::Context<'_>,
|
12078 + | ) -> std::task::Poll<Self::Output> {
|
12079 + | let this = self.project();
|
12080 + | this.inner.as_mut().poll(cx)
|
12081 + | }
|
12082 + | }
|
12083 + |
|
12084 + | impl<B>
|
12085 + | ::aws_smithy_http_server::request::FromRequest<
|
12086 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12087 + | B,
|
12088 + | > for crate::input::EndpointOperationInput
|
12089 + | where
|
12090 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
12091 + | B: 'static,
|
12092 + |
|
12093 + | B::Data: Send,
|
12094 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
12095 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
12096 + | {
|
12097 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
12098 + | type Future = EndpointOperationInputFuture;
|
12099 + |
|
12100 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
12101 + | let fut = async move {
|
12102 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
12103 + | request.headers(),
|
12104 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
12105 + | ) {
|
12106 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
12107 + | }
|
12108 + | crate::protocol_serde::shape_endpoint_operation::de_endpoint_operation_http_request(
|
12109 + | request,
|
12110 + | )
|
12111 + | .await
|
12112 + | };
|
12113 + | use ::futures_util::future::TryFutureExt;
|
12114 + | let fut = fut.map_err(
|
12115 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
12116 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
12117 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
12118 + | },
|
12119 + | );
|
12120 + | EndpointOperationInputFuture {
|
12121 + | inner: Box::pin(fut),
|
12122 + | }
|
12123 + | }
|
12124 + | }
|
12125 + | impl
|
12126 + | ::aws_smithy_http_server::response::IntoResponse<
|
12127 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12128 + | > for crate::output::EndpointOperationOutput
|
12129 + | {
|
12130 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
12131 + | match crate::protocol_serde::shape_endpoint_operation::ser_endpoint_operation_http_response(
|
12132 + | self,
|
12133 + | ) {
|
12134 + | Ok(response) => response,
|
12135 + | Err(e) => {
|
12136 + | ::tracing::error!(error = %e, "failed to serialize response");
|
12137 + | ::aws_smithy_http_server::response::IntoResponse::<
|
12138 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12139 + | >::into_response(
|
12140 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
12141 + | e,
|
12142 + | ),
|
12143 + | )
|
12144 + | }
|
12145 + | }
|
12146 + | }
|
12147 + | }
|
12148 + |
|
12149 + | #[allow(unreachable_code, unused_variables)]
|
12150 + | #[cfg(test)]
|
12151 + | mod endpoint_operation_test {
|
12152 + |
|
12153 + | /// Operations can prepend to the given host if they define the
|
12154 + | /// endpoint trait.
|
12155 + | /// Test ID: AwsJson11EndpointTrait
|
12156 + | #[::tokio::test]
|
12157 + | #[::tracing_test::traced_test]
|
12158 + | #[should_panic]
|
12159 + | async fn aws_json11_endpoint_trait_request() {
|
12160 + | #[allow(unused_mut)]
|
12161 + | let mut http_request = ::http_1x::Request::builder()
|
12162 + | .uri("/")
|
12163 + | .method("POST")
|
12164 + | .header("Content-Type", "application/x-amz-json-1.1")
|
12165 + | .header("X-Amz-Target", "JsonProtocol.EndpointOperation")
|
12166 + | .body(::aws_smithy_http_server::body::boxed(
|
12167 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
12168 + | &::aws_smithy_protocol_test::decode_body_data(
|
12169 + | "{}".as_bytes(),
|
12170 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
12171 + | ),
|
12172 + | )),
|
12173 + | ))
|
12174 + | .unwrap();
|
12175 + | todo!("endpoint trait not supported yet");
|
12176 + | #[allow(unused_mut)]
|
12177 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12178 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
12179 + | let service = crate::service::JsonProtocol::builder::<
|
12180 + | ::aws_smithy_http_server::body::BoxBody,
|
12181 + | _,
|
12182 + | _,
|
12183 + | _,
|
12184 + | >(config)
|
12185 + | .endpoint_operation(move |input: crate::input::EndpointOperationInput| {
|
12186 + | let sender = sender.clone();
|
12187 + | async move {
|
12188 + | let result = {
|
12189 + | let expected = crate::input::EndpointOperationInput {};
|
12190 + | ::pretty_assertions::assert_eq!(input, expected);
|
12191 + | let output = crate::output::EndpointOperationOutput {};
|
12192 + | output
|
12193 + | };
|
12194 + | sender.send(()).await.expect("receiver dropped early");
|
12195 + | result
|
12196 + | }
|
12197 + | })
|
12198 + | .build_unchecked();
|
12199 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12200 + | .await
|
12201 + | .expect("unable to make an HTTP request");
|
12202 + | assert!(
|
12203 + | receiver.recv().await.is_some(),
|
12204 + | "we expected operation handler to be invoked but it was not entered"
|
12205 + | );
|
12206 + | }
|
12207 + | }
|
12208 + |
|
12209 + | ::pin_project_lite::pin_project! {
|
12210 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
12211 + | /// [`EndpointWithHostLabelOperationInput`](crate::input::EndpointWithHostLabelOperationInput) using modelled bindings.
|
12212 + | pub struct EndpointWithHostLabelOperationInputFuture {
|
12213 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EndpointWithHostLabelOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
12214 + | }
|
12215 + | }
|
12216 + |
|
12217 + | impl std::future::Future for EndpointWithHostLabelOperationInputFuture {
|
12218 + | type Output = Result<
|
12219 + | crate::input::EndpointWithHostLabelOperationInput,
|
12220 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
12221 + | >;
|
12222 + |
|
12223 + | fn poll(
|
12224 + | self: std::pin::Pin<&mut Self>,
|
12225 + | cx: &mut std::task::Context<'_>,
|
12226 + | ) -> std::task::Poll<Self::Output> {
|
12227 + | let this = self.project();
|
12228 + | this.inner.as_mut().poll(cx)
|
12229 + | }
|
12230 + | }
|
12231 + |
|
12232 + | impl<B>
|
12233 + | ::aws_smithy_http_server::request::FromRequest<
|
12234 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12235 + | B,
|
12236 + | > for crate::input::EndpointWithHostLabelOperationInput
|
12237 + | where
|
12238 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
12239 + | B: 'static,
|
12240 + |
|
12241 + | B::Data: Send,
|
12242 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
12243 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
12244 + | {
|
12245 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
12246 + | type Future = EndpointWithHostLabelOperationInputFuture;
|
12247 + |
|
12248 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
12249 + | let fut = async move {
|
12250 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
12251 + | request.headers(),
|
12252 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
12253 + | ) {
|
12254 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
12255 + | }
|
12256 + | crate::protocol_serde::shape_endpoint_with_host_label_operation::de_endpoint_with_host_label_operation_http_request(request)
|
12257 + | .await
|
12258 + | };
|
12259 + | use ::futures_util::future::TryFutureExt;
|
12260 + | let fut = fut.map_err(
|
12261 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
12262 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
12263 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
12264 + | },
|
12139 12265 | );
|
12266 + | EndpointWithHostLabelOperationInputFuture {
|
12267 + | inner: Box::pin(fut),
|
12268 + | }
|
12269 + | }
|
12270 + | }
|
12271 + | impl
|
12272 + | ::aws_smithy_http_server::response::IntoResponse<
|
12273 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12274 + | > for crate::output::EndpointWithHostLabelOperationOutput
|
12275 + | {
|
12276 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
12277 + | match crate::protocol_serde::shape_endpoint_with_host_label_operation::ser_endpoint_with_host_label_operation_http_response(self) {
|
12278 + | Ok(response) => response,
|
12279 + | Err(e) => {
|
12280 + | ::tracing::error!(error = %e, "failed to serialize response");
|
12281 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
12282 + | }
|
12283 + | }
|
12284 + | }
|
12285 + | }
|
12286 + | impl
|
12287 + | ::aws_smithy_http_server::response::IntoResponse<
|
12288 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12289 + | > for crate::error::EndpointWithHostLabelOperationError
|
12290 + | {
|
12291 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
12292 + | match crate::protocol_serde::shape_endpoint_with_host_label_operation::ser_endpoint_with_host_label_operation_http_error(&self) {
|
12293 + | Ok(mut response) => {
|
12294 + | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
12295 + | response
|
12296 + | },
|
12297 + | Err(e) => {
|
12298 + | ::tracing::error!(error = %e, "failed to serialize response");
|
12299 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
12300 + | }
|
12301 + | }
|
12140 12302 | }
|
12303 + | }
|
12141 12304 |
|
12142 - | /// Parses map of map shapes
|
12143 - | /// Test ID: parses_map_of_map_shapes
|
12305 + | #[allow(unreachable_code, unused_variables)]
|
12306 + | #[cfg(test)]
|
12307 + | mod endpoint_with_host_label_operation_test {
|
12308 + |
|
12309 + | /// Operations can prepend to the given host if they define the
|
12310 + | /// endpoint trait, and can use the host label trait to define
|
12311 + | /// further customization based on user input.
|
12312 + | /// Test ID: AwsJson11EndpointTraitWithHostLabel
|
12144 12313 | #[::tokio::test]
|
12145 12314 | #[::tracing_test::traced_test]
|
12146 - | async fn parses_map_of_map_shapes_response() {
|
12147 - | let output = crate::output::KitchenSinkOperationOutput {
|
12148 - | map_of_maps: ::std::option::Option::Some({
|
12149 - | let mut ret = ::std::collections::HashMap::new();
|
12150 - | ret.insert("sizes".to_owned(), {
|
12151 - | let mut ret = ::std::collections::HashMap::new();
|
12152 - | ret.insert("large".to_owned(), "L".to_owned());
|
12153 - | ret.insert("medium".to_owned(), "M".to_owned());
|
12154 - | ret
|
12155 - | });
|
12156 - | ret.insert("colors".to_owned(), {
|
12157 - | let mut ret = ::std::collections::HashMap::new();
|
12158 - | ret.insert("red".to_owned(), "R".to_owned());
|
12159 - | ret.insert("blue".to_owned(), "B".to_owned());
|
12160 - | ret
|
12161 - | });
|
12162 - | ret
|
12163 - | }),
|
12164 - | blob: ::std::option::Option::None,
|
12165 - | boolean: ::std::option::Option::None,
|
12166 - | double: ::std::option::Option::None,
|
12167 - | empty_struct: ::std::option::Option::None,
|
12168 - | float: ::std::option::Option::None,
|
12169 - | httpdate_timestamp: ::std::option::Option::None,
|
12170 - | integer: ::std::option::Option::None,
|
12171 - | iso8601_timestamp: ::std::option::Option::None,
|
12172 - | json_value: ::std::option::Option::None,
|
12173 - | list_of_lists: ::std::option::Option::None,
|
12174 - | list_of_maps_of_strings: ::std::option::Option::None,
|
12175 - | list_of_strings: ::std::option::Option::None,
|
12176 - | list_of_structs: ::std::option::Option::None,
|
12177 - | long: ::std::option::Option::None,
|
12178 - | map_of_lists_of_strings: ::std::option::Option::None,
|
12179 - | map_of_strings: ::std::option::Option::None,
|
12180 - | map_of_structs: ::std::option::Option::None,
|
12181 - | recursive_list: ::std::option::Option::None,
|
12182 - | recursive_map: ::std::option::Option::None,
|
12183 - | recursive_struct: ::std::option::Option::None,
|
12184 - | simple_struct: ::std::option::Option::None,
|
12185 - | string: ::std::option::Option::None,
|
12186 - | struct_with_json_name: ::std::option::Option::None,
|
12187 - | timestamp: ::std::option::Option::None,
|
12188 - | unix_timestamp: ::std::option::Option::None,
|
12189 - | };
|
12190 - | use ::aws_smithy_http_server::response::IntoResponse;
|
12191 - | let http_response = output.into_response();
|
12192 - | ::pretty_assertions::assert_eq!(
|
12193 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
12194 - | http_response.status()
|
12195 - | );
|
12196 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
12197 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12198 - | http_response.headers(),
|
12199 - | expected_headers,
|
12200 - | ));
|
12201 - | use ::http_body_util::BodyExt;
|
12202 - | let body = http_response
|
12203 - | .into_body()
|
12204 - | .collect()
|
12315 + | #[should_panic]
|
12316 + | async fn aws_json11_endpoint_trait_with_host_label_request() {
|
12317 + | #[allow(unused_mut)]
|
12318 + | let mut http_request = ::http_1x::Request::builder()
|
12319 + | .uri("/")
|
12320 + | .method("POST")
|
12321 + | .header("Content-Type", "application/x-amz-json-1.1")
|
12322 + | .header(
|
12323 + | "X-Amz-Target",
|
12324 + | "JsonProtocol.EndpointWithHostLabelOperation",
|
12325 + | )
|
12326 + | .body(::aws_smithy_http_server::body::boxed(
|
12327 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
12328 + | &::aws_smithy_protocol_test::decode_body_data(
|
12329 + | "{\"label\": \"bar\"}".as_bytes(),
|
12330 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
12331 + | ),
|
12332 + | )),
|
12333 + | ))
|
12334 + | .unwrap();
|
12335 + | todo!("endpoint trait not supported yet");
|
12336 + | #[allow(unused_mut)]
|
12337 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12338 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
12339 + | let service = crate::service::JsonProtocol::builder::<
|
12340 + | ::aws_smithy_http_server::body::BoxBody,
|
12341 + | _,
|
12342 + | _,
|
12343 + | _,
|
12344 + | >(config)
|
12345 + | .endpoint_with_host_label_operation(
|
12346 + | move |input: crate::input::EndpointWithHostLabelOperationInput| {
|
12347 + | let sender = sender.clone();
|
12348 + | async move {
|
12349 + | let result = {
|
12350 + | let expected = crate::input::EndpointWithHostLabelOperationInput {
|
12351 + | label: "bar".to_owned(),
|
12352 + | };
|
12353 + | ::pretty_assertions::assert_eq!(input, expected);
|
12354 + | let output = crate::output::EndpointWithHostLabelOperationOutput {};
|
12355 + | Ok(output)
|
12356 + | };
|
12357 + | sender.send(()).await.expect("receiver dropped early");
|
12358 + | result
|
12359 + | }
|
12360 + | },
|
12361 + | )
|
12362 + | .build_unchecked();
|
12363 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12205 12364 | .await
|
12206 - | .expect("unable to collect body")
|
12207 - | .to_bytes();
|
12208 - | ::aws_smithy_protocol_test::assert_ok(
|
12209 - | ::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"))
|
12365 + | .expect("unable to make an HTTP request");
|
12366 + | assert!(
|
12367 + | receiver.recv().await.is_some(),
|
12368 + | "we expected operation handler to be invoked but it was not entered"
|
12210 12369 | );
|
12211 12370 | }
|
12371 + | }
|
12212 12372 |
|
12213 - | /// Parses map of structure shapes
|
12214 - | /// Test ID: parses_map_of_structure_shapes
|
12215 - | #[::tokio::test]
|
12216 - | #[::tracing_test::traced_test]
|
12217 - | async fn parses_map_of_structure_shapes_response() {
|
12218 - | let output = crate::output::KitchenSinkOperationOutput {
|
12219 - | map_of_structs: ::std::option::Option::Some({
|
12220 - | let mut ret = ::std::collections::HashMap::new();
|
12221 - | ret.insert(
|
12222 - | "size".to_owned(),
|
12223 - | crate::model::SimpleStruct {
|
12224 - | value: ::std::option::Option::Some("small".to_owned()),
|
12225 - | },
|
12226 - | );
|
12227 - | ret.insert(
|
12228 - | "color".to_owned(),
|
12229 - | crate::model::SimpleStruct {
|
12230 - | value: ::std::option::Option::Some("red".to_owned()),
|
12231 - | },
|
12232 - | );
|
12233 - | ret
|
12234 - | }),
|
12235 - | blob: ::std::option::Option::None,
|
12236 - | boolean: ::std::option::Option::None,
|
12237 - | double: ::std::option::Option::None,
|
12238 - | empty_struct: ::std::option::Option::None,
|
12239 - | float: ::std::option::Option::None,
|
12240 - | httpdate_timestamp: ::std::option::Option::None,
|
12241 - | integer: ::std::option::Option::None,
|
12242 - | iso8601_timestamp: ::std::option::Option::None,
|
12243 - | json_value: ::std::option::Option::None,
|
12244 - | list_of_lists: ::std::option::Option::None,
|
12245 - | list_of_maps_of_strings: ::std::option::Option::None,
|
12246 - | list_of_strings: ::std::option::Option::None,
|
12247 - | list_of_structs: ::std::option::Option::None,
|
12248 - | long: ::std::option::Option::None,
|
12249 - | map_of_lists_of_strings: ::std::option::Option::None,
|
12250 - | map_of_maps: ::std::option::Option::None,
|
12251 - | map_of_strings: ::std::option::Option::None,
|
12252 - | recursive_list: ::std::option::Option::None,
|
12253 - | recursive_map: ::std::option::Option::None,
|
12254 - | recursive_struct: ::std::option::Option::None,
|
12255 - | simple_struct: ::std::option::Option::None,
|
12256 - | string: ::std::option::Option::None,
|
12257 - | struct_with_json_name: ::std::option::Option::None,
|
12258 - | timestamp: ::std::option::Option::None,
|
12259 - | unix_timestamp: ::std::option::Option::None,
|
12373 + | ::pin_project_lite::pin_project! {
|
12374 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
12375 + | /// [`HostWithPathOperationInput`](crate::input::HostWithPathOperationInput) using modelled bindings.
|
12376 + | pub struct HostWithPathOperationInputFuture {
|
12377 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::HostWithPathOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
12378 + | }
|
12379 + | }
|
12380 + |
|
12381 + | impl std::future::Future for HostWithPathOperationInputFuture {
|
12382 + | type Output = Result<
|
12383 + | crate::input::HostWithPathOperationInput,
|
12384 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
12385 + | >;
|
12386 + |
|
12387 + | fn poll(
|
12388 + | self: std::pin::Pin<&mut Self>,
|
12389 + | cx: &mut std::task::Context<'_>,
|
12390 + | ) -> std::task::Poll<Self::Output> {
|
12391 + | let this = self.project();
|
12392 + | this.inner.as_mut().poll(cx)
|
12393 + | }
|
12394 + | }
|
12395 + |
|
12396 + | impl<B>
|
12397 + | ::aws_smithy_http_server::request::FromRequest<
|
12398 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12399 + | B,
|
12400 + | > for crate::input::HostWithPathOperationInput
|
12401 + | where
|
12402 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
12403 + | B: 'static,
|
12404 + |
|
12405 + | B::Data: Send,
|
12406 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
12407 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
12408 + | {
|
12409 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
12410 + | type Future = HostWithPathOperationInputFuture;
|
12411 + |
|
12412 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
12413 + | let fut = async move {
|
12414 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
12415 + | request.headers(),
|
12416 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
12417 + | ) {
|
12418 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
12419 + | }
|
12420 + | crate::protocol_serde::shape_host_with_path_operation::de_host_with_path_operation_http_request(request)
|
12421 + | .await
|
12260 12422 | };
|
12261 - | use ::aws_smithy_http_server::response::IntoResponse;
|
12262 - | let http_response = output.into_response();
|
12263 - | ::pretty_assertions::assert_eq!(
|
12264 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
12265 - | http_response.status()
|
12423 + | use ::futures_util::future::TryFutureExt;
|
12424 + | let fut = fut.map_err(
|
12425 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
12426 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
12427 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
12428 + | },
|
12266 12429 | );
|
12267 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
12268 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12269 - | http_response.headers(),
|
12270 - | expected_headers,
|
12271 - | ));
|
12272 - | use ::http_body_util::BodyExt;
|
12273 - | let body = http_response
|
12274 - | .into_body()
|
12275 - | .collect()
|
12276 - | .await
|
12277 - | .expect("unable to collect body")
|
12278 - | .to_bytes();
|
12279 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
12280 - | &body,
|
12281 - | "{\"MapOfStructs\":{\"size\":{\"Value\":\"small\"},\"color\":{\"Value\":\"red\"}}}",
|
12282 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
12283 - | ));
|
12430 + | HostWithPathOperationInputFuture {
|
12431 + | inner: Box::pin(fut),
|
12432 + | }
|
12433 + | }
|
12434 + | }
|
12435 + | impl
|
12436 + | ::aws_smithy_http_server::response::IntoResponse<
|
12437 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12438 + | > for crate::output::HostWithPathOperationOutput
|
12439 + | {
|
12440 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
12441 + | match crate::protocol_serde::shape_host_with_path_operation::ser_host_with_path_operation_http_response(self) {
|
12442 + | Ok(response) => response,
|
12443 + | Err(e) => {
|
12444 + | ::tracing::error!(error = %e, "failed to serialize response");
|
12445 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
12446 + | }
|
12447 + | }
|
12284 12448 | }
|
12449 + | }
|
12285 12450 |
|
12286 - | /// Parses map of recursive structure shapes
|
12287 - | /// Test ID: parses_map_of_recursive_structure_shapes
|
12288 - | #[::tokio::test]
|
12289 - | #[::tracing_test::traced_test]
|
12290 - | async fn parses_map_of_recursive_structure_shapes_response() {
|
12291 - | let output = crate::output::KitchenSinkOperationOutput {
|
12292 - | recursive_map: ::std::option::Option::Some({
|
12293 - | let mut ret = ::std::collections::HashMap::new();
|
12294 - | ret.insert(
|
12295 - | "key-1".to_owned(),
|
12296 - | crate::model::KitchenSink {
|
12297 - | recursive_map: ::std::option::Option::Some({
|
12298 - | let mut ret = ::std::collections::HashMap::new();
|
12299 - | ret.insert(
|
12300 - | "key-2".to_owned(),
|
12301 - | crate::model::KitchenSink {
|
12302 - | recursive_map: ::std::option::Option::Some({
|
12303 - | let mut ret = ::std::collections::HashMap::new();
|
12304 - | ret.insert(
|
12305 - | "key-3".to_owned(),
|
12306 - | crate::model::KitchenSink {
|
12307 - | string: ::std::option::Option::Some(
|
12308 - | "value".to_owned(),
|
12309 - | ),
|
12310 - | blob: ::std::option::Option::None,
|
12311 - | boolean: ::std::option::Option::None,
|
12312 - | double: ::std::option::Option::None,
|
12313 - | empty_struct: ::std::option::Option::None,
|
12314 - | float: ::std::option::Option::None,
|
12315 - | httpdate_timestamp: ::std::option::Option::None,
|
12316 - | integer: ::std::option::Option::None,
|
12317 - | iso8601_timestamp: ::std::option::Option::None,
|
12318 - | json_value: ::std::option::Option::None,
|
12319 - | list_of_lists: ::std::option::Option::None,
|
12320 - | list_of_maps_of_strings:
|
12321 - | ::std::option::Option::None,
|
12322 - | list_of_strings: ::std::option::Option::None,
|
12323 - | list_of_structs: ::std::option::Option::None,
|
12324 - | long: ::std::option::Option::None,
|
12325 - | map_of_lists_of_strings:
|
12326 - | ::std::option::Option::None,
|
12327 - | map_of_maps: ::std::option::Option::None,
|
12328 - | map_of_strings: ::std::option::Option::None,
|
12329 - | map_of_structs: ::std::option::Option::None,
|
12330 - | recursive_list: ::std::option::Option::None,
|
12331 - | recursive_map: ::std::option::Option::None,
|
12332 - | recursive_struct: ::std::option::Option::None,
|
12333 - | simple_struct: ::std::option::Option::None,
|
12334 - | struct_with_json_name: ::std::option::Option::None,
|
12335 - | timestamp: ::std::option::Option::None,
|
12336 - | unix_timestamp: ::std::option::Option::None,
|
12337 - | },
|
12338 - | );
|
12339 - | ret
|
12340 - | }),
|
12341 - | blob: ::std::option::Option::None,
|
12342 - | boolean: ::std::option::Option::None,
|
12343 - | double: ::std::option::Option::None,
|
12344 - | empty_struct: ::std::option::Option::None,
|
12345 - | float: ::std::option::Option::None,
|
12346 - | httpdate_timestamp: ::std::option::Option::None,
|
12347 - | integer: ::std::option::Option::None,
|
12348 - | iso8601_timestamp: ::std::option::Option::None,
|
12349 - | json_value: ::std::option::Option::None,
|
12350 - | list_of_lists: ::std::option::Option::None,
|
12351 - | list_of_maps_of_strings: ::std::option::Option::None,
|
12352 - | list_of_strings: ::std::option::Option::None,
|
12353 - | list_of_structs: ::std::option::Option::None,
|
12354 - | long: ::std::option::Option::None,
|
12355 - | map_of_lists_of_strings: ::std::option::Option::None,
|
12356 - | map_of_maps: ::std::option::Option::None,
|
12357 - | map_of_strings: ::std::option::Option::None,
|
12358 - | map_of_structs: ::std::option::Option::None,
|
12359 - | recursive_list: ::std::option::Option::None,
|
12360 - | recursive_struct: ::std::option::Option::None,
|
12361 - | simple_struct: ::std::option::Option::None,
|
12362 - | string: ::std::option::Option::None,
|
12363 - | struct_with_json_name: ::std::option::Option::None,
|
12364 - | timestamp: ::std::option::Option::None,
|
12365 - | unix_timestamp: ::std::option::Option::None,
|
12366 - | },
|
12367 - | );
|
12368 - | ret
|
12369 - | }),
|
12370 - | blob: ::std::option::Option::None,
|
12371 - | boolean: ::std::option::Option::None,
|
12372 - | double: ::std::option::Option::None,
|
12373 - | empty_struct: ::std::option::Option::None,
|
12374 - | float: ::std::option::Option::None,
|
12375 - | httpdate_timestamp: ::std::option::Option::None,
|
12376 - | integer: ::std::option::Option::None,
|
12377 - | iso8601_timestamp: ::std::option::Option::None,
|
12378 - | json_value: ::std::option::Option::None,
|
12379 - | list_of_lists: ::std::option::Option::None,
|
12380 - | list_of_maps_of_strings: ::std::option::Option::None,
|
12381 - | list_of_strings: ::std::option::Option::None,
|
12382 - | list_of_structs: ::std::option::Option::None,
|
12383 - | long: ::std::option::Option::None,
|
12384 - | map_of_lists_of_strings: ::std::option::Option::None,
|
12385 - | map_of_maps: ::std::option::Option::None,
|
12386 - | map_of_strings: ::std::option::Option::None,
|
12387 - | map_of_structs: ::std::option::Option::None,
|
12388 - | recursive_list: ::std::option::Option::None,
|
12389 - | recursive_struct: ::std::option::Option::None,
|
12390 - | simple_struct: ::std::option::Option::None,
|
12391 - | string: ::std::option::Option::None,
|
12392 - | struct_with_json_name: ::std::option::Option::None,
|
12393 - | timestamp: ::std::option::Option::None,
|
12394 - | unix_timestamp: ::std::option::Option::None,
|
12395 - | },
|
12396 - | );
|
12397 - | ret
|
12398 - | }),
|
12399 - | blob: ::std::option::Option::None,
|
12400 - | boolean: ::std::option::Option::None,
|
12401 - | double: ::std::option::Option::None,
|
12402 - | empty_struct: ::std::option::Option::None,
|
12403 - | float: ::std::option::Option::None,
|
12404 - | httpdate_timestamp: ::std::option::Option::None,
|
12405 - | integer: ::std::option::Option::None,
|
12406 - | iso8601_timestamp: ::std::option::Option::None,
|
12407 - | json_value: ::std::option::Option::None,
|
12408 - | list_of_lists: ::std::option::Option::None,
|
12409 - | list_of_maps_of_strings: ::std::option::Option::None,
|
12410 - | list_of_strings: ::std::option::Option::None,
|
12411 - | list_of_structs: ::std::option::Option::None,
|
12412 - | long: ::std::option::Option::None,
|
12413 - | map_of_lists_of_strings: ::std::option::Option::None,
|
12414 - | map_of_maps: ::std::option::Option::None,
|
12415 - | map_of_strings: ::std::option::Option::None,
|
12416 - | map_of_structs: ::std::option::Option::None,
|
12417 - | recursive_list: ::std::option::Option::None,
|
12418 - | recursive_struct: ::std::option::Option::None,
|
12419 - | simple_struct: ::std::option::Option::None,
|
12420 - | string: ::std::option::Option::None,
|
12421 - | struct_with_json_name: ::std::option::Option::None,
|
12422 - | timestamp: ::std::option::Option::None,
|
12423 - | unix_timestamp: ::std::option::Option::None,
|
12451 + | ::pin_project_lite::pin_project! {
|
12452 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
12453 + | /// [`DatetimeOffsetsInput`](crate::input::DatetimeOffsetsInput) using modelled bindings.
|
12454 + | pub struct DatetimeOffsetsInputFuture {
|
12455 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::DatetimeOffsetsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
12456 + | }
|
12457 + | }
|
12458 + |
|
12459 + | impl std::future::Future for DatetimeOffsetsInputFuture {
|
12460 + | type Output = Result<
|
12461 + | crate::input::DatetimeOffsetsInput,
|
12462 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
12463 + | >;
|
12464 + |
|
12465 + | fn poll(
|
12466 + | self: std::pin::Pin<&mut Self>,
|
12467 + | cx: &mut std::task::Context<'_>,
|
12468 + | ) -> std::task::Poll<Self::Output> {
|
12469 + | let this = self.project();
|
12470 + | this.inner.as_mut().poll(cx)
|
12471 + | }
|
12472 + | }
|
12473 + |
|
12474 + | impl<B>
|
12475 + | ::aws_smithy_http_server::request::FromRequest<
|
12476 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12477 + | B,
|
12478 + | > for crate::input::DatetimeOffsetsInput
|
12479 + | where
|
12480 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
12481 + | B: 'static,
|
12482 + |
|
12483 + | B::Data: Send,
|
12484 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
12485 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
12486 + | {
|
12487 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
12488 + | type Future = DatetimeOffsetsInputFuture;
|
12489 + |
|
12490 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
12491 + | let fut = async move {
|
12492 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
12493 + | request.headers(),
|
12494 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
12495 + | ) {
|
12496 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
12497 + | }
|
12498 + | crate::protocol_serde::shape_datetime_offsets::de_datetime_offsets_http_request(request)
|
12499 + | .await
|
12424 12500 | };
|
12425 - | use ::aws_smithy_http_server::response::IntoResponse;
|
12426 - | let http_response = output.into_response();
|
12427 - | ::pretty_assertions::assert_eq!(
|
12428 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
12429 - | http_response.status()
|
12501 + | use ::futures_util::future::TryFutureExt;
|
12502 + | let fut = fut.map_err(
|
12503 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
12504 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
12505 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
12506 + | },
|
12430 12507 | );
|
12431 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
12432 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12433 - | http_response.headers(),
|
12434 - | expected_headers,
|
12435 - | ));
|
12436 - | use ::http_body_util::BodyExt;
|
12437 - | let body = http_response
|
12438 - | .into_body()
|
12439 - | .collect()
|
12508 + | DatetimeOffsetsInputFuture {
|
12509 + | inner: Box::pin(fut),
|
12510 + | }
|
12511 + | }
|
12512 + | }
|
12513 + | impl
|
12514 + | ::aws_smithy_http_server::response::IntoResponse<
|
12515 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12516 + | > for crate::output::DatetimeOffsetsOutput
|
12517 + | {
|
12518 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
12519 + | match crate::protocol_serde::shape_datetime_offsets::ser_datetime_offsets_http_response(
|
12520 + | self,
|
12521 + | ) {
|
12522 + | Ok(response) => response,
|
12523 + | Err(e) => {
|
12524 + | ::tracing::error!(error = %e, "failed to serialize response");
|
12525 + | ::aws_smithy_http_server::response::IntoResponse::<
|
12526 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12527 + | >::into_response(
|
12528 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
12529 + | e,
|
12530 + | ),
|
12531 + | )
|
12532 + | }
|
12533 + | }
|
12534 + | }
|
12535 + | }
|
12536 + |
|
12537 + | ::pin_project_lite::pin_project! {
|
12538 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
12539 + | /// [`FractionalSecondsInput`](crate::input::FractionalSecondsInput) using modelled bindings.
|
12540 + | pub struct FractionalSecondsInputFuture {
|
12541 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::FractionalSecondsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
12542 + | }
|
12543 + | }
|
12544 + |
|
12545 + | impl std::future::Future for FractionalSecondsInputFuture {
|
12546 + | type Output = Result<
|
12547 + | crate::input::FractionalSecondsInput,
|
12548 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
12549 + | >;
|
12550 + |
|
12551 + | fn poll(
|
12552 + | self: std::pin::Pin<&mut Self>,
|
12553 + | cx: &mut std::task::Context<'_>,
|
12554 + | ) -> std::task::Poll<Self::Output> {
|
12555 + | let this = self.project();
|
12556 + | this.inner.as_mut().poll(cx)
|
12557 + | }
|
12558 + | }
|
12559 + |
|
12560 + | impl<B>
|
12561 + | ::aws_smithy_http_server::request::FromRequest<
|
12562 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12563 + | B,
|
12564 + | > for crate::input::FractionalSecondsInput
|
12565 + | where
|
12566 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
12567 + | B: 'static,
|
12568 + |
|
12569 + | B::Data: Send,
|
12570 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
12571 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
12572 + | {
|
12573 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
12574 + | type Future = FractionalSecondsInputFuture;
|
12575 + |
|
12576 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
12577 + | let fut = async move {
|
12578 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
12579 + | request.headers(),
|
12580 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
12581 + | ) {
|
12582 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
12583 + | }
|
12584 + | crate::protocol_serde::shape_fractional_seconds::de_fractional_seconds_http_request(
|
12585 + | request,
|
12586 + | )
|
12440 12587 | .await
|
12441 - | .expect("unable to collect body")
|
12442 - | .to_bytes();
|
12443 - | ::aws_smithy_protocol_test::assert_ok(
|
12444 - | ::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"))
|
12588 + | };
|
12589 + | use ::futures_util::future::TryFutureExt;
|
12590 + | let fut = fut.map_err(
|
12591 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
12592 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
12593 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
12594 + | },
|
12445 12595 | );
|
12596 + | FractionalSecondsInputFuture {
|
12597 + | inner: Box::pin(fut),
|
12598 + | }
|
12599 + | }
|
12600 + | }
|
12601 + | impl
|
12602 + | ::aws_smithy_http_server::response::IntoResponse<
|
12603 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12604 + | > for crate::output::FractionalSecondsOutput
|
12605 + | {
|
12606 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
12607 + | match crate::protocol_serde::shape_fractional_seconds::ser_fractional_seconds_http_response(
|
12608 + | self,
|
12609 + | ) {
|
12610 + | Ok(response) => response,
|
12611 + | Err(e) => {
|
12612 + | ::tracing::error!(error = %e, "failed to serialize response");
|
12613 + | ::aws_smithy_http_server::response::IntoResponse::<
|
12614 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12615 + | >::into_response(
|
12616 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
12617 + | e,
|
12618 + | ),
|
12619 + | )
|
12620 + | }
|
12621 + | }
|
12446 12622 | }
|
12623 + | }
|
12447 12624 |
|
12448 - | /// Parses the request id from the response
|
12449 - | /// Test ID: parses_the_request_id_from_the_response
|
12450 - | #[::tokio::test]
|
12451 - | #[::tracing_test::traced_test]
|
12452 - | #[should_panic]
|
12453 - | async fn parses_the_request_id_from_the_response_response() {
|
12454 - | let output = crate::output::KitchenSinkOperationOutput {
|
12455 - | blob: ::std::option::Option::None,
|
12456 - | boolean: ::std::option::Option::None,
|
12457 - | double: ::std::option::Option::None,
|
12458 - | empty_struct: ::std::option::Option::None,
|
12459 - | float: ::std::option::Option::None,
|
12460 - | httpdate_timestamp: ::std::option::Option::None,
|
12461 - | integer: ::std::option::Option::None,
|
12462 - | iso8601_timestamp: ::std::option::Option::None,
|
12463 - | json_value: ::std::option::Option::None,
|
12464 - | list_of_lists: ::std::option::Option::None,
|
12465 - | list_of_maps_of_strings: ::std::option::Option::None,
|
12466 - | list_of_strings: ::std::option::Option::None,
|
12467 - | list_of_structs: ::std::option::Option::None,
|
12468 - | long: ::std::option::Option::None,
|
12469 - | map_of_lists_of_strings: ::std::option::Option::None,
|
12470 - | map_of_maps: ::std::option::Option::None,
|
12471 - | map_of_strings: ::std::option::Option::None,
|
12472 - | map_of_structs: ::std::option::Option::None,
|
12473 - | recursive_list: ::std::option::Option::None,
|
12474 - | recursive_map: ::std::option::Option::None,
|
12475 - | recursive_struct: ::std::option::Option::None,
|
12476 - | simple_struct: ::std::option::Option::None,
|
12477 - | string: ::std::option::Option::None,
|
12478 - | struct_with_json_name: ::std::option::Option::None,
|
12479 - | timestamp: ::std::option::Option::None,
|
12480 - | unix_timestamp: ::std::option::Option::None,
|
12625 + | ::pin_project_lite::pin_project! {
|
12626 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
12627 + | /// [`PutWithContentEncodingInput`](crate::input::PutWithContentEncodingInput) using modelled bindings.
|
12628 + | pub struct PutWithContentEncodingInputFuture {
|
12629 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::PutWithContentEncodingInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
12630 + | }
|
12631 + | }
|
12632 + |
|
12633 + | impl std::future::Future for PutWithContentEncodingInputFuture {
|
12634 + | type Output = Result<
|
12635 + | crate::input::PutWithContentEncodingInput,
|
12636 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
12637 + | >;
|
12638 + |
|
12639 + | fn poll(
|
12640 + | self: std::pin::Pin<&mut Self>,
|
12641 + | cx: &mut std::task::Context<'_>,
|
12642 + | ) -> std::task::Poll<Self::Output> {
|
12643 + | let this = self.project();
|
12644 + | this.inner.as_mut().poll(cx)
|
12645 + | }
|
12646 + | }
|
12647 + |
|
12648 + | impl<B>
|
12649 + | ::aws_smithy_http_server::request::FromRequest<
|
12650 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12651 + | B,
|
12652 + | > for crate::input::PutWithContentEncodingInput
|
12653 + | where
|
12654 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
12655 + | B: 'static,
|
12656 + |
|
12657 + | B::Data: Send,
|
12658 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
12659 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
12660 + | {
|
12661 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
12662 + | type Future = PutWithContentEncodingInputFuture;
|
12663 + |
|
12664 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
12665 + | let fut = async move {
|
12666 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
12667 + | request.headers(),
|
12668 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
12669 + | ) {
|
12670 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
12671 + | }
|
12672 + | crate::protocol_serde::shape_put_with_content_encoding::de_put_with_content_encoding_http_request(request)
|
12673 + | .await
|
12481 12674 | };
|
12482 - | use ::aws_smithy_http_server::response::IntoResponse;
|
12483 - | let http_response = output.into_response();
|
12484 - | ::pretty_assertions::assert_eq!(
|
12485 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
12486 - | http_response.status()
|
12675 + | use ::futures_util::future::TryFutureExt;
|
12676 + | let fut = fut.map_err(
|
12677 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
12678 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
12679 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
12680 + | },
|
12487 12681 | );
|
12488 - | let expected_headers = [
|
12489 - | ("Content-Type", "application/x-amz-json-1.1"),
|
12490 - | ("X-Amzn-Requestid", "amazon-uniq-request-id"),
|
12491 - | ];
|
12492 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12493 - | http_response.headers(),
|
12494 - | expected_headers,
|
12495 - | ));
|
12496 - | use ::http_body_util::BodyExt;
|
12497 - | let body = http_response
|
12498 - | .into_body()
|
12499 - | .collect()
|
12500 - | .await
|
12501 - | .expect("unable to collect body")
|
12502 - | .to_bytes();
|
12503 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
12504 - | &body,
|
12505 - | "{}",
|
12506 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
12507 - | ));
|
12682 + | PutWithContentEncodingInputFuture {
|
12683 + | inner: Box::pin(fut),
|
12684 + | }
|
12685 + | }
|
12686 + | }
|
12687 + | impl
|
12688 + | ::aws_smithy_http_server::response::IntoResponse<
|
12689 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12690 + | > for crate::output::PutWithContentEncodingOutput
|
12691 + | {
|
12692 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
12693 + | match crate::protocol_serde::shape_put_with_content_encoding::ser_put_with_content_encoding_http_response(self) {
|
12694 + | Ok(response) => response,
|
12695 + | Err(e) => {
|
12696 + | ::tracing::error!(error = %e, "failed to serialize response");
|
12697 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
12698 + | }
|
12699 + | }
|
12508 12700 | }
|
12509 12701 | }
|
12510 12702 |
|
12511 12703 | ::pin_project_lite::pin_project! {
|
12512 12704 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
12513 - | /// [`EmptyOperationInput`](crate::input::EmptyOperationInput) using modelled bindings.
|
12514 - | pub struct EmptyOperationInputFuture {
|
12515 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EmptyOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
12705 + | /// [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput) using modelled bindings.
|
12706 + | pub struct ContentTypeParametersInputFuture {
|
12707 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::ContentTypeParametersInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
12516 12708 | }
|
12517 12709 | }
|
12518 12710 |
|
12519 - | impl std::future::Future for EmptyOperationInputFuture {
|
12711 + | impl std::future::Future for ContentTypeParametersInputFuture {
|
12520 12712 | type Output = Result<
|
12521 - | crate::input::EmptyOperationInput,
|
12713 + | crate::input::ContentTypeParametersInput,
|
12522 12714 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
12523 12715 | >;
|
12524 12716 |
|
12525 12717 | fn poll(
|
12526 12718 | self: std::pin::Pin<&mut Self>,
|
12527 12719 | cx: &mut std::task::Context<'_>,
|
12528 12720 | ) -> std::task::Poll<Self::Output> {
|
12529 12721 | let this = self.project();
|
12530 12722 | this.inner.as_mut().poll(cx)
|
12531 12723 | }
|
12532 12724 | }
|
12533 12725 |
|
12534 12726 | impl<B>
|
12535 12727 | ::aws_smithy_http_server::request::FromRequest<
|
12536 12728 | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12537 12729 | B,
|
12538 - | > for crate::input::EmptyOperationInput
|
12730 + | > for crate::input::ContentTypeParametersInput
|
12539 12731 | where
|
12540 12732 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
12541 12733 | B: 'static,
|
12542 12734 |
|
12543 12735 | B::Data: Send,
|
12544 12736 | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
12545 12737 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
12546 12738 | {
|
12547 12739 | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
12548 - | type Future = EmptyOperationInputFuture;
|
12740 + | type Future = ContentTypeParametersInputFuture;
|
12549 12741 |
|
12550 12742 | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
12551 12743 | let fut = async move {
|
12552 12744 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
12553 12745 | request.headers(),
|
12554 12746 | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
12555 12747 | ) {
|
12556 12748 | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
12557 12749 | }
|
12558 - | crate::protocol_serde::shape_empty_operation::de_empty_operation_http_request(request)
|
12559 - | .await
|
12750 + | crate::protocol_serde::shape_content_type_parameters::de_content_type_parameters_http_request(request)
|
12751 + | .await
|
12560 12752 | };
|
12561 12753 | use ::futures_util::future::TryFutureExt;
|
12562 12754 | let fut = fut.map_err(
|
12563 12755 | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
12564 12756 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
12565 12757 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
12566 12758 | },
|
12567 12759 | );
|
12568 - | EmptyOperationInputFuture {
|
12760 + | ContentTypeParametersInputFuture {
|
12569 12761 | inner: Box::pin(fut),
|
12570 12762 | }
|
12571 12763 | }
|
12572 12764 | }
|
12573 12765 | impl
|
12574 12766 | ::aws_smithy_http_server::response::IntoResponse<
|
12575 12767 | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12576 - | > for crate::output::EmptyOperationOutput
|
12768 + | > for crate::output::ContentTypeParametersOutput
|
12577 12769 | {
|
12578 12770 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
12579 - | match crate::protocol_serde::shape_empty_operation::ser_empty_operation_http_response(self)
|
12580 - | {
|
12581 - | Ok(response) => response,
|
12582 - | Err(e) => {
|
12583 - | ::tracing::error!(error = %e, "failed to serialize response");
|
12584 - | ::aws_smithy_http_server::response::IntoResponse::<
|
12585 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12586 - | >::into_response(
|
12587 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
12588 - | e,
|
12589 - | ),
|
12590 - | )
|
12591 - | }
|
12592 - | }
|
12771 + | match crate::protocol_serde::shape_content_type_parameters::ser_content_type_parameters_http_response(self) {
|
12772 + | Ok(response) => response,
|
12773 + | Err(e) => {
|
12774 + | ::tracing::error!(error = %e, "failed to serialize response");
|
12775 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
12776 + | }
|
12777 + | }
|
12593 12778 | }
|
12594 12779 | }
|
12595 12780 |
|
12596 12781 | #[allow(unreachable_code, unused_variables)]
|
12597 12782 | #[cfg(test)]
|
12598 - | mod empty_operation_test {
|
12599 - |
|
12600 - | /// Sends requests to /
|
12601 - | /// Test ID: sends_requests_to_slash
|
12602 - | #[::tokio::test]
|
12603 - | #[::tracing_test::traced_test]
|
12604 - | async fn sends_requests_to_slash_request() {
|
12605 - | #[allow(unused_mut)]
|
12606 - | let mut http_request = ::http_1x::Request::builder()
|
12607 - | .uri("/")
|
12608 - | .method("POST")
|
12609 - | .header("Content-Type", "application/x-amz-json-1.1")
|
12610 - | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
12611 - | .body(::aws_smithy_http_server::body::boxed(
|
12612 - | ::http_body_util::Empty::new(),
|
12613 - | ))
|
12614 - | .unwrap();
|
12615 - | #[allow(unused_mut)]
|
12616 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12617 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
12618 - | let service = crate::service::JsonProtocol::builder::<
|
12619 - | ::aws_smithy_http_server::body::BoxBody,
|
12620 - | _,
|
12621 - | _,
|
12622 - | _,
|
12623 - | >(config)
|
12624 - | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
12625 - | let sender = sender.clone();
|
12626 - | async move {
|
12627 - | let result = {
|
12628 - | let expected = crate::input::EmptyOperationInput {};
|
12629 - | ::pretty_assertions::assert_eq!(input, expected);
|
12630 - | let output = crate::output::EmptyOperationOutput {};
|
12631 - | output
|
12632 - | };
|
12633 - | sender.send(()).await.expect("receiver dropped early");
|
12634 - | result
|
12635 - | }
|
12636 - | })
|
12637 - | .build_unchecked();
|
12638 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12639 - | .await
|
12640 - | .expect("unable to make an HTTP request");
|
12641 - | assert!(
|
12642 - | receiver.recv().await.is_some(),
|
12643 - | "we expected operation handler to be invoked but it was not entered"
|
12644 - | );
|
12645 - | }
|
12646 - |
|
12647 - | /// Includes X-Amz-Target header and Content-Type
|
12648 - | /// Test ID: includes_x_amz_target_and_content_type
|
12649 - | #[::tokio::test]
|
12650 - | #[::tracing_test::traced_test]
|
12651 - | async fn includes_x_amz_target_and_content_type_request() {
|
12652 - | #[allow(unused_mut)]
|
12653 - | let mut http_request = ::http_1x::Request::builder()
|
12654 - | .uri("/")
|
12655 - | .method("POST")
|
12656 - | .header("Content-Type", "application/x-amz-json-1.1")
|
12657 - | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
12658 - | .body(::aws_smithy_http_server::body::boxed(
|
12659 - | ::http_body_util::Empty::new(),
|
12660 - | ))
|
12661 - | .unwrap();
|
12662 - | #[allow(unused_mut)]
|
12663 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12664 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
12665 - | let service = crate::service::JsonProtocol::builder::<
|
12666 - | ::aws_smithy_http_server::body::BoxBody,
|
12667 - | _,
|
12668 - | _,
|
12669 - | _,
|
12670 - | >(config)
|
12671 - | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
12672 - | let sender = sender.clone();
|
12673 - | async move {
|
12674 - | let result = {
|
12675 - | let expected = crate::input::EmptyOperationInput {};
|
12676 - | ::pretty_assertions::assert_eq!(input, expected);
|
12677 - | let output = crate::output::EmptyOperationOutput {};
|
12678 - | output
|
12679 - | };
|
12680 - | sender.send(()).await.expect("receiver dropped early");
|
12681 - | result
|
12682 - | }
|
12683 - | })
|
12684 - | .build_unchecked();
|
12685 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12686 - | .await
|
12687 - | .expect("unable to make an HTTP request");
|
12688 - | assert!(
|
12689 - | receiver.recv().await.is_some(),
|
12690 - | "we expected operation handler to be invoked but it was not entered"
|
12691 - | );
|
12692 - | }
|
12783 + | mod content_type_parameters_test {
|
12693 12784 |
|
12694 - | /// Clients must always send an empty JSON object payload for
|
12695 - | /// operations with no input (that is, `{}`). While AWS service
|
12696 - | /// implementations support requests with no payload or requests
|
12697 - | /// that send `{}`, always sending `{}` from the client is
|
12698 - | /// preferred for forward compatibility in case input is ever
|
12699 - | /// added to an operation.
|
12700 - | /// Test ID: json_1_1_client_sends_empty_payload_for_no_input_shape
|
12785 + | /// A server should ignore parameters added to the content type
|
12786 + | /// Test ID: AwsJson11MustSupportParametersInContentType
|
12701 12787 | #[::tokio::test]
|
12702 12788 | #[::tracing_test::traced_test]
|
12703 - | async fn json_1_1_client_sends_empty_payload_for_no_input_shape_request() {
|
12789 + | async fn aws_json11_must_support_parameters_in_content_type_request() {
|
12704 12790 | #[allow(unused_mut)]
|
12705 12791 | let mut http_request = ::http_1x::Request::builder()
|
12706 12792 | .uri("/")
|
12707 12793 | .method("POST")
|
12708 - | .header("Content-Type", "application/x-amz-json-1.1")
|
12709 - | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
12794 + | .header("Content-Type", "application/x-amz-json-1.1; charset=utf-8")
|
12795 + | .header("X-Amz-Target", "JsonProtocol.ContentTypeParameters")
|
12710 12796 | .body(::aws_smithy_http_server::body::boxed(
|
12711 12797 | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
12712 12798 | &::aws_smithy_protocol_test::decode_body_data(
|
12713 - | "{}".as_bytes(),
|
12799 + | "{\"value\":5}".as_bytes(),
|
12714 12800 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
12715 12801 | ),
|
12716 12802 | )),
|
12717 12803 | ))
|
12718 12804 | .unwrap();
|
12719 12805 | #[allow(unused_mut)]
|
12720 12806 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12721 12807 | let config = crate::service::JsonProtocolConfig::builder().build();
|
12722 12808 | let service = crate::service::JsonProtocol::builder::<
|
12723 12809 | ::aws_smithy_http_server::body::BoxBody,
|
12724 12810 | _,
|
12725 12811 | _,
|
12726 12812 | _,
|
12727 12813 | >(config)
|
12728 - | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
12729 - | let sender = sender.clone();
|
12730 - | async move {
|
12731 - | let result = {
|
12732 - | let expected = crate::input::EmptyOperationInput {};
|
12733 - | ::pretty_assertions::assert_eq!(input, expected);
|
12734 - | let output = crate::output::EmptyOperationOutput {};
|
12735 - | output
|
12736 - | };
|
12737 - | sender.send(()).await.expect("receiver dropped early");
|
12738 - | result
|
12739 - | }
|
12740 - | })
|
12741 - | .build_unchecked();
|
12742 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12743 - | .await
|
12744 - | .expect("unable to make an HTTP request");
|
12745 - | assert!(
|
12746 - | receiver.recv().await.is_some(),
|
12747 - | "we expected operation handler to be invoked but it was not entered"
|
12748 - | );
|
12749 - | }
|
12750 - |
|
12751 - | /// Service implementations must support no payload or an empty
|
12752 - | /// object payload for operations that define no input. However,
|
12753 - | /// despite the lack of a payload, a Content-Type header is still
|
12754 - | /// required in order for the service to properly detect the
|
12755 - | /// protocol.
|
12756 - | /// Test ID: json_1_1_service_supports_empty_payload_for_no_input_shape
|
12757 - | #[::tokio::test]
|
12758 - | #[::tracing_test::traced_test]
|
12759 - | async fn json_1_1_service_supports_empty_payload_for_no_input_shape_request() {
|
12760 - | #[allow(unused_mut)]
|
12761 - | let mut http_request = ::http_1x::Request::builder()
|
12762 - | .uri("/")
|
12763 - | .method("POST")
|
12764 - | .header("Content-Type", "application/x-amz-json-1.1")
|
12765 - | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
12766 - | .body(::aws_smithy_http_server::body::boxed(
|
12767 - | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
12768 - | &::aws_smithy_protocol_test::decode_body_data(
|
12769 - | "".as_bytes(),
|
12770 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
12771 - | ),
|
12772 - | )),
|
12773 - | ))
|
12774 - | .unwrap();
|
12775 - | #[allow(unused_mut)]
|
12776 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12777 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
12778 - | let service = crate::service::JsonProtocol::builder::<
|
12779 - | ::aws_smithy_http_server::body::BoxBody,
|
12780 - | _,
|
12781 - | _,
|
12782 - | _,
|
12783 - | >(config)
|
12784 - | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
12814 + | .content_type_parameters(move |input: crate::input::ContentTypeParametersInput| {
|
12785 12815 | let sender = sender.clone();
|
12786 12816 | async move {
|
12787 12817 | let result = {
|
12788 - | let expected = crate::input::EmptyOperationInput {};
|
12818 + | let expected = crate::input::ContentTypeParametersInput {
|
12819 + | value: ::std::option::Option::Some(5),
|
12820 + | };
|
12789 12821 | ::pretty_assertions::assert_eq!(input, expected);
|
12790 - | let output = crate::output::EmptyOperationOutput {};
|
12822 + | let output = crate::output::ContentTypeParametersOutput {};
|
12791 12823 | output
|
12792 12824 | };
|
12793 12825 | sender.send(()).await.expect("receiver dropped early");
|
12794 12826 | result
|
12795 12827 | }
|
12796 12828 | })
|
12797 12829 | .build_unchecked();
|
12798 12830 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12799 12831 | .await
|
12800 12832 | .expect("unable to make an HTTP request");
|
12801 12833 | assert!(
|
12802 12834 | receiver.recv().await.is_some(),
|
12803 12835 | "we expected operation handler to be invoked but it was not entered"
|
12804 12836 | );
|
12805 12837 | }
|
12806 - |
|
12807 - | /// When no output is defined, the service is expected to return
|
12808 - | /// an empty payload. Despite the lack of a payload, the service
|
12809 - | /// is expected to always send a Content-Type header. Clients must
|
12810 - | /// handle cases where a service returns a JSON object and where
|
12811 - | /// a service returns no JSON at all.
|
12812 - | /// Test ID: json_1_1_service_responds_with_no_payload
|
12813 - | #[::tokio::test]
|
12814 - | #[::tracing_test::traced_test]
|
12815 - | async fn json_1_1_service_responds_with_no_payload_response() {
|
12816 - | let output = crate::output::EmptyOperationOutput {};
|
12817 - | use ::aws_smithy_http_server::response::IntoResponse;
|
12818 - | let http_response = output.into_response();
|
12819 - | ::pretty_assertions::assert_eq!(
|
12820 - | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
12821 - | http_response.status()
|
12822 - | );
|
12823 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
12824 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12825 - | http_response.headers(),
|
12826 - | expected_headers,
|
12827 - | ));
|
12828 - | use ::http_body_util::BodyExt;
|
12829 - | let body = http_response
|
12830 - | .into_body()
|
12831 - | .collect()
|
12832 - | .await
|
12833 - | .expect("unable to collect body")
|
12834 - | .to_bytes();
|
12835 - | // No body.
|
12836 - | ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
|
12837 - | }
|
12838 12838 | }
|