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_legacy_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_legacy_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_legacy_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_legacy_http_server::request::FromRequest<
|
27 27 | ::aws_smithy_legacy_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_legacy_http_server::body::HttpBody + Send,
|
32 32 | B: 'static,
|
33 33 |
|
34 34 | B::Data: Send,
|
35 35 | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
36 36 | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
37 37 | {
|
38 38 | type Rejection =
|
39 39 | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
40 - | type Future = ContentTypeParametersInputFuture;
|
40 + | type Future = EmptyOperationInputFuture;
|
41 41 |
|
42 42 | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
43 43 | let fut = async move {
|
44 44 | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
45 45 | request.headers(),
|
46 46 | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
47 47 | ) {
|
48 48 | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
49 49 | }
|
50 - | crate::protocol_serde::shape_content_type_parameters::de_content_type_parameters_http_request(request)
|
51 - | .await
|
50 + | crate::protocol_serde::shape_empty_operation::de_empty_operation_http_request(request)
|
51 + | .await
|
52 52 | };
|
53 53 | use ::futures_util::future::TryFutureExt;
|
54 54 | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
55 55 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
56 56 | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
57 57 | });
|
58 - | ContentTypeParametersInputFuture {
|
58 + | EmptyOperationInputFuture {
|
59 59 | inner: Box::pin(fut),
|
60 60 | }
|
61 61 | }
|
62 62 | }
|
63 63 | impl
|
64 64 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
65 65 | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
66 - | > for crate::output::ContentTypeParametersOutput
|
66 + | > for crate::output::EmptyOperationOutput
|
67 67 | {
|
68 68 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
69 - | match crate::protocol_serde::shape_content_type_parameters::ser_content_type_parameters_http_response(self) {
|
70 - | Ok(response) => response,
|
71 - | Err(e) => {
|
72 - | ::tracing::error!(error = %e, "failed to serialize response");
|
73 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
74 - | }
|
75 - | }
|
69 + | match crate::protocol_serde::shape_empty_operation::ser_empty_operation_http_response(self)
|
70 + | {
|
71 + | Ok(response) => response,
|
72 + | Err(e) => {
|
73 + | ::tracing::error!(error = %e, "failed to serialize response");
|
74 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
75 + | }
|
76 + | }
|
76 77 | }
|
77 78 | }
|
78 79 |
|
79 80 | #[allow(unreachable_code, unused_variables)]
|
80 81 | #[cfg(test)]
|
81 - | mod content_type_parameters_test {
|
82 + | mod empty_operation_test {
|
82 83 |
|
83 - | /// A server should ignore parameters added to the content type
|
84 - | /// Test ID: AwsJson11MustSupportParametersInContentType
|
84 + | /// Sends requests to /
|
85 + | /// Test ID: sends_requests_to_slash
|
85 86 | #[::tokio::test]
|
86 87 | #[::tracing_test::traced_test]
|
87 - | async fn aws_json11_must_support_parameters_in_content_type_request() {
|
88 + | async fn sends_requests_to_slash_request() {
|
88 89 | #[allow(unused_mut)]
|
89 90 | let mut http_request = ::http::Request::builder()
|
90 91 | .uri("/")
|
91 92 | .method("POST")
|
92 - | .header("Content-Type", "application/x-amz-json-1.1; charset=utf-8")
|
93 - | .header("X-Amz-Target", "JsonProtocol.ContentTypeParameters")
|
93 + | .header("Content-Type", "application/x-amz-json-1.1")
|
94 + | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
95 + | .body(::aws_smithy_legacy_http_server::body::Body::empty())
|
96 + | .unwrap();
|
97 + | #[allow(unused_mut)]
|
98 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
99 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
100 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
101 + | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
102 + | let sender = sender.clone();
|
103 + | async move {
|
104 + | let result = {
|
105 + | let expected = crate::input::EmptyOperationInput {};
|
106 + | ::pretty_assertions::assert_eq!(input, expected);
|
107 + | let output = crate::output::EmptyOperationOutput {};
|
108 + | output
|
109 + | };
|
110 + | sender.send(()).await.expect("receiver dropped early");
|
111 + | result
|
112 + | }
|
113 + | })
|
114 + | .build_unchecked();
|
115 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
116 + | .await
|
117 + | .expect("unable to make an HTTP request");
|
118 + | assert!(
|
119 + | receiver.recv().await.is_some(),
|
120 + | "we expected operation handler to be invoked but it was not entered"
|
121 + | );
|
122 + | }
|
123 + |
|
124 + | /// Includes X-Amz-Target header and Content-Type
|
125 + | /// Test ID: includes_x_amz_target_and_content_type
|
126 + | #[::tokio::test]
|
127 + | #[::tracing_test::traced_test]
|
128 + | async fn includes_x_amz_target_and_content_type_request() {
|
129 + | #[allow(unused_mut)]
|
130 + | let mut http_request = ::http::Request::builder()
|
131 + | .uri("/")
|
132 + | .method("POST")
|
133 + | .header("Content-Type", "application/x-amz-json-1.1")
|
134 + | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
135 + | .body(::aws_smithy_legacy_http_server::body::Body::empty())
|
136 + | .unwrap();
|
137 + | #[allow(unused_mut)]
|
138 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
139 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
140 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
141 + | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
142 + | let sender = sender.clone();
|
143 + | async move {
|
144 + | let result = {
|
145 + | let expected = crate::input::EmptyOperationInput {};
|
146 + | ::pretty_assertions::assert_eq!(input, expected);
|
147 + | let output = crate::output::EmptyOperationOutput {};
|
148 + | output
|
149 + | };
|
150 + | sender.send(()).await.expect("receiver dropped early");
|
151 + | result
|
152 + | }
|
153 + | })
|
154 + | .build_unchecked();
|
155 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
156 + | .await
|
157 + | .expect("unable to make an HTTP request");
|
158 + | assert!(
|
159 + | receiver.recv().await.is_some(),
|
160 + | "we expected operation handler to be invoked but it was not entered"
|
161 + | );
|
162 + | }
|
163 + |
|
164 + | /// Clients must always send an empty JSON object payload for
|
165 + | /// operations with no input (that is, `{}`). While AWS service
|
166 + | /// implementations support requests with no payload or requests
|
167 + | /// that send `{}`, always sending `{}` from the client is
|
168 + | /// preferred for forward compatibility in case input is ever
|
169 + | /// added to an operation.
|
170 + | /// Test ID: json_1_1_client_sends_empty_payload_for_no_input_shape
|
171 + | #[::tokio::test]
|
172 + | #[::tracing_test::traced_test]
|
173 + | async fn json_1_1_client_sends_empty_payload_for_no_input_shape_request() {
|
174 + | #[allow(unused_mut)]
|
175 + | let mut http_request = ::http::Request::builder()
|
176 + | .uri("/")
|
177 + | .method("POST")
|
178 + | .header("Content-Type", "application/x-amz-json-1.1")
|
179 + | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
94 180 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
95 181 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
96 - | "{\"value\":5}".as_bytes(),
|
182 + | "{}".as_bytes(),
|
97 183 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
98 184 | )),
|
99 185 | ))
|
100 186 | .unwrap();
|
101 187 | #[allow(unused_mut)]
|
102 188 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
103 189 | let config = crate::service::JsonProtocolConfig::builder().build();
|
104 190 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
105 - | .content_type_parameters(move |input: crate::input::ContentTypeParametersInput| {
|
191 + | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
106 192 | let sender = sender.clone();
|
107 193 | async move {
|
108 194 | let result = {
|
109 - | let expected = crate::input::ContentTypeParametersInput {
|
110 - | value: ::std::option::Option::Some(5),
|
111 - | };
|
195 + | let expected = crate::input::EmptyOperationInput {};
|
112 196 | ::pretty_assertions::assert_eq!(input, expected);
|
113 - | let output = crate::output::ContentTypeParametersOutput {};
|
197 + | let output = crate::output::EmptyOperationOutput {};
|
198 + | output
|
199 + | };
|
200 + | sender.send(()).await.expect("receiver dropped early");
|
201 + | result
|
202 + | }
|
203 + | })
|
204 + | .build_unchecked();
|
205 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
206 + | .await
|
207 + | .expect("unable to make an HTTP request");
|
208 + | assert!(
|
209 + | receiver.recv().await.is_some(),
|
210 + | "we expected operation handler to be invoked but it was not entered"
|
211 + | );
|
212 + | }
|
213 + |
|
214 + | /// Service implementations must support no payload or an empty
|
215 + | /// object payload for operations that define no input. However,
|
216 + | /// despite the lack of a payload, a Content-Type header is still
|
217 + | /// required in order for the service to properly detect the
|
218 + | /// protocol.
|
219 + | /// Test ID: json_1_1_service_supports_empty_payload_for_no_input_shape
|
220 + | #[::tokio::test]
|
221 + | #[::tracing_test::traced_test]
|
222 + | async fn json_1_1_service_supports_empty_payload_for_no_input_shape_request() {
|
223 + | #[allow(unused_mut)]
|
224 + | let mut http_request = ::http::Request::builder()
|
225 + | .uri("/")
|
226 + | .method("POST")
|
227 + | .header("Content-Type", "application/x-amz-json-1.1")
|
228 + | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
229 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
230 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
231 + | "".as_bytes(),
|
232 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
233 + | )),
|
234 + | ))
|
235 + | .unwrap();
|
236 + | #[allow(unused_mut)]
|
237 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
238 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
239 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
240 + | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
241 + | let sender = sender.clone();
|
242 + | async move {
|
243 + | let result = {
|
244 + | let expected = crate::input::EmptyOperationInput {};
|
245 + | ::pretty_assertions::assert_eq!(input, expected);
|
246 + | let output = crate::output::EmptyOperationOutput {};
|
114 247 | output
|
115 248 | };
|
116 249 | sender.send(()).await.expect("receiver dropped early");
|
117 250 | result
|
118 251 | }
|
119 252 | })
|
120 253 | .build_unchecked();
|
121 254 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
122 255 | .await
|
123 256 | .expect("unable to make an HTTP request");
|
124 257 | assert!(
|
125 258 | receiver.recv().await.is_some(),
|
126 259 | "we expected operation handler to be invoked but it was not entered"
|
127 260 | );
|
128 261 | }
|
262 + |
|
263 + | /// When no output is defined, the service is expected to return
|
264 + | /// an empty payload. Despite the lack of a payload, the service
|
265 + | /// is expected to always send a Content-Type header. Clients must
|
266 + | /// handle cases where a service returns a JSON object and where
|
267 + | /// a service returns no JSON at all.
|
268 + | /// Test ID: json_1_1_service_responds_with_no_payload
|
269 + | #[::tokio::test]
|
270 + | #[::tracing_test::traced_test]
|
271 + | async fn json_1_1_service_responds_with_no_payload_response() {
|
272 + | let output = crate::output::EmptyOperationOutput {};
|
273 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
274 + | let http_response = output.into_response();
|
275 + | ::pretty_assertions::assert_eq!(
|
276 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
277 + | http_response.status()
|
278 + | );
|
279 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
280 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
281 + | http_response.headers(),
|
282 + | expected_headers,
|
283 + | ));
|
284 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
285 + | .await
|
286 + | .expect("unable to extract body to bytes");
|
287 + | // No body.
|
288 + | ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
|
289 + | }
|
129 290 | }
|
130 291 |
|
131 292 | ::pin_project_lite::pin_project! {
|
132 293 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
133 - | /// [`PutWithContentEncodingInput`](crate::input::PutWithContentEncodingInput) using modelled bindings.
|
134 - | pub struct PutWithContentEncodingInputFuture {
|
135 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::PutWithContentEncodingInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
294 + | /// [`KitchenSinkOperationInput`](crate::input::KitchenSinkOperationInput) using modelled bindings.
|
295 + | pub struct KitchenSinkOperationInputFuture {
|
296 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::KitchenSinkOperationInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
136 297 | }
|
137 298 | }
|
138 299 |
|
139 - | impl std::future::Future for PutWithContentEncodingInputFuture {
|
300 + | impl std::future::Future for KitchenSinkOperationInputFuture {
|
140 301 | type Output = Result<
|
141 - | crate::input::PutWithContentEncodingInput,
|
302 + | crate::input::KitchenSinkOperationInput,
|
142 303 | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
143 304 | >;
|
144 305 |
|
145 306 | fn poll(
|
146 307 | self: std::pin::Pin<&mut Self>,
|
147 308 | cx: &mut std::task::Context<'_>,
|
148 309 | ) -> std::task::Poll<Self::Output> {
|
149 310 | let this = self.project();
|
150 311 | this.inner.as_mut().poll(cx)
|
151 312 | }
|
152 313 | }
|
153 314 |
|
154 315 | impl<B>
|
155 316 | ::aws_smithy_legacy_http_server::request::FromRequest<
|
156 317 | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
157 318 | B,
|
158 - | > for crate::input::PutWithContentEncodingInput
|
319 + | > for crate::input::KitchenSinkOperationInput
|
159 320 | where
|
160 321 | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
161 322 | B: 'static,
|
162 323 |
|
163 324 | B::Data: Send,
|
164 325 | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
165 326 | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
166 327 | {
|
167 328 | type Rejection =
|
168 329 | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
169 - | type Future = PutWithContentEncodingInputFuture;
|
330 + | type Future = KitchenSinkOperationInputFuture;
|
170 331 |
|
171 332 | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
172 333 | let fut = async move {
|
173 334 | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
174 335 | request.headers(),
|
175 336 | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
176 337 | ) {
|
177 338 | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
178 339 | }
|
179 - | crate::protocol_serde::shape_put_with_content_encoding::de_put_with_content_encoding_http_request(request)
|
340 + | crate::protocol_serde::shape_kitchen_sink_operation::de_kitchen_sink_operation_http_request(request)
|
180 341 | .await
|
181 342 | };
|
182 343 | use ::futures_util::future::TryFutureExt;
|
183 344 | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
184 345 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
185 346 | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
186 347 | });
|
187 - | PutWithContentEncodingInputFuture {
|
348 + | KitchenSinkOperationInputFuture {
|
188 349 | inner: Box::pin(fut),
|
189 350 | }
|
190 351 | }
|
191 352 | }
|
192 353 | impl
|
193 354 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
194 355 | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
195 - | > for crate::output::PutWithContentEncodingOutput
|
356 + | > for crate::output::KitchenSinkOperationOutput
|
196 357 | {
|
197 358 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
198 - | match crate::protocol_serde::shape_put_with_content_encoding::ser_put_with_content_encoding_http_response(self) {
|
359 + | match crate::protocol_serde::shape_kitchen_sink_operation::ser_kitchen_sink_operation_http_response(self) {
|
199 360 | Ok(response) => response,
|
200 361 | Err(e) => {
|
201 362 | ::tracing::error!(error = %e, "failed to serialize response");
|
202 363 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
203 364 | }
|
204 365 | }
|
205 366 | }
|
206 367 | }
|
207 - |
|
208 - | ::pin_project_lite::pin_project! {
|
209 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
210 - | /// [`FractionalSecondsInput`](crate::input::FractionalSecondsInput) using modelled bindings.
|
211 - | pub struct FractionalSecondsInputFuture {
|
212 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::FractionalSecondsInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
213 - | }
|
214 - | }
|
215 - |
|
216 - | impl std::future::Future for FractionalSecondsInputFuture {
|
217 - | type Output = Result<
|
218 - | crate::input::FractionalSecondsInput,
|
219 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
220 - | >;
|
221 - |
|
222 - | fn poll(
|
223 - | self: std::pin::Pin<&mut Self>,
|
224 - | cx: &mut std::task::Context<'_>,
|
225 - | ) -> std::task::Poll<Self::Output> {
|
226 - | let this = self.project();
|
227 - | this.inner.as_mut().poll(cx)
|
228 - | }
|
229 - | }
|
230 - |
|
231 - | impl<B>
|
232 - | ::aws_smithy_legacy_http_server::request::FromRequest<
|
233 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
234 - | B,
|
235 - | > for crate::input::FractionalSecondsInput
|
236 - | where
|
237 - | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
238 - | B: 'static,
|
239 - |
|
240 - | B::Data: Send,
|
241 - | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
242 - | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
243 - | {
|
244 - | type Rejection =
|
245 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
246 - | type Future = FractionalSecondsInputFuture;
|
247 - |
|
248 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
249 - | let fut = async move {
|
250 - | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
251 - | request.headers(),
|
252 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
253 - | ) {
|
254 - | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
255 - | }
|
256 - | crate::protocol_serde::shape_fractional_seconds::de_fractional_seconds_http_request(
|
257 - | request,
|
258 - | )
|
259 - | .await
|
260 - | };
|
261 - | use ::futures_util::future::TryFutureExt;
|
262 - | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
263 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
264 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
265 - | });
|
266 - | FractionalSecondsInputFuture {
|
267 - | inner: Box::pin(fut),
|
268 - | }
|
269 - | }
|
270 - | }
|
271 - | impl
|
272 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
273 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
274 - | > for crate::output::FractionalSecondsOutput
|
275 - | {
|
276 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
277 - | match crate::protocol_serde::shape_fractional_seconds::ser_fractional_seconds_http_response(
|
278 - | self,
|
279 - | ) {
|
280 - | Ok(response) => response,
|
281 - | Err(e) => {
|
282 - | ::tracing::error!(error = %e, "failed to serialize response");
|
283 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
284 - | }
|
285 - | }
|
286 - | }
|
287 - | }
|
288 - |
|
289 - | ::pin_project_lite::pin_project! {
|
290 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
291 - | /// [`DatetimeOffsetsInput`](crate::input::DatetimeOffsetsInput) using modelled bindings.
|
292 - | pub struct DatetimeOffsetsInputFuture {
|
293 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::DatetimeOffsetsInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
294 - | }
|
295 - | }
|
296 - |
|
297 - | impl std::future::Future for DatetimeOffsetsInputFuture {
|
298 - | type Output = Result<
|
299 - | crate::input::DatetimeOffsetsInput,
|
300 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
301 - | >;
|
302 - |
|
303 - | fn poll(
|
304 - | self: std::pin::Pin<&mut Self>,
|
305 - | cx: &mut std::task::Context<'_>,
|
306 - | ) -> std::task::Poll<Self::Output> {
|
307 - | let this = self.project();
|
308 - | this.inner.as_mut().poll(cx)
|
309 - | }
|
310 - | }
|
311 - |
|
312 - | impl<B>
|
313 - | ::aws_smithy_legacy_http_server::request::FromRequest<
|
314 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
315 - | B,
|
316 - | > for crate::input::DatetimeOffsetsInput
|
317 - | where
|
318 - | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
319 - | B: 'static,
|
320 - |
|
321 - | B::Data: Send,
|
322 - | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
323 - | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
324 - | {
|
325 - | type Rejection =
|
326 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
327 - | type Future = DatetimeOffsetsInputFuture;
|
328 - |
|
329 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
330 - | let fut = async move {
|
331 - | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
332 - | request.headers(),
|
333 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
334 - | ) {
|
335 - | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
336 - | }
|
337 - | crate::protocol_serde::shape_datetime_offsets::de_datetime_offsets_http_request(request)
|
338 - | .await
|
339 - | };
|
340 - | use ::futures_util::future::TryFutureExt;
|
341 - | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
342 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
343 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
344 - | });
|
345 - | DatetimeOffsetsInputFuture {
|
346 - | inner: Box::pin(fut),
|
347 - | }
|
348 - | }
|
349 - | }
|
350 368 | impl
|
351 369 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
352 370 | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
353 - | > for crate::output::DatetimeOffsetsOutput
|
371 + | > for crate::error::KitchenSinkOperationError
|
354 372 | {
|
355 373 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
356 - | match crate::protocol_serde::shape_datetime_offsets::ser_datetime_offsets_http_response(
|
357 - | self,
|
358 - | ) {
|
359 - | Ok(response) => response,
|
374 + | match crate::protocol_serde::shape_kitchen_sink_operation::ser_kitchen_sink_operation_http_error(&self) {
|
375 + | Ok(mut response) => {
|
376 + | response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
377 + | response
|
378 + | },
|
360 379 | Err(e) => {
|
361 380 | ::tracing::error!(error = %e, "failed to serialize response");
|
362 381 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
363 382 | }
|
364 383 | }
|
365 384 | }
|
366 385 | }
|
367 386 |
|
368 - | ::pin_project_lite::pin_project! {
|
369 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
370 - | /// [`HostWithPathOperationInput`](crate::input::HostWithPathOperationInput) using modelled bindings.
|
371 - | pub struct HostWithPathOperationInputFuture {
|
372 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::HostWithPathOperationInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
373 - | }
|
374 - | }
|
375 - |
|
376 - | impl std::future::Future for HostWithPathOperationInputFuture {
|
377 - | type Output = Result<
|
378 - | crate::input::HostWithPathOperationInput,
|
379 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
380 - | >;
|
381 - |
|
382 - | fn poll(
|
383 - | self: std::pin::Pin<&mut Self>,
|
384 - | cx: &mut std::task::Context<'_>,
|
385 - | ) -> std::task::Poll<Self::Output> {
|
386 - | let this = self.project();
|
387 - | this.inner.as_mut().poll(cx)
|
388 - | }
|
389 - | }
|
390 - |
|
391 - | impl<B>
|
392 - | ::aws_smithy_legacy_http_server::request::FromRequest<
|
393 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
394 - | B,
|
395 - | > for crate::input::HostWithPathOperationInput
|
396 - | where
|
397 - | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
398 - | B: 'static,
|
399 - |
|
400 - | B::Data: Send,
|
401 - | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
402 - | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
403 - | {
|
404 - | type Rejection =
|
405 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
406 - | type Future = HostWithPathOperationInputFuture;
|
407 - |
|
408 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
409 - | let fut = async move {
|
410 - | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
411 - | request.headers(),
|
412 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
413 - | ) {
|
414 - | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
415 - | }
|
416 - | crate::protocol_serde::shape_host_with_path_operation::de_host_with_path_operation_http_request(request)
|
417 - | .await
|
418 - | };
|
419 - | use ::futures_util::future::TryFutureExt;
|
420 - | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
421 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
422 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
423 - | });
|
424 - | HostWithPathOperationInputFuture {
|
425 - | inner: Box::pin(fut),
|
426 - | }
|
427 - | }
|
428 - | }
|
429 - | impl
|
430 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
431 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
432 - | > for crate::output::HostWithPathOperationOutput
|
433 - | {
|
434 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
435 - | match crate::protocol_serde::shape_host_with_path_operation::ser_host_with_path_operation_http_response(self) {
|
436 - | Ok(response) => response,
|
437 - | Err(e) => {
|
438 - | ::tracing::error!(error = %e, "failed to serialize response");
|
439 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
440 - | }
|
441 - | }
|
442 - | }
|
443 - | }
|
444 - |
|
445 - | ::pin_project_lite::pin_project! {
|
446 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
447 - | /// [`EndpointWithHostLabelOperationInput`](crate::input::EndpointWithHostLabelOperationInput) using modelled bindings.
|
448 - | pub struct EndpointWithHostLabelOperationInputFuture {
|
449 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EndpointWithHostLabelOperationInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
450 - | }
|
451 - | }
|
452 - |
|
453 - | impl std::future::Future for EndpointWithHostLabelOperationInputFuture {
|
454 - | type Output = Result<
|
455 - | crate::input::EndpointWithHostLabelOperationInput,
|
456 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
457 - | >;
|
458 - |
|
459 - | fn poll(
|
460 - | self: std::pin::Pin<&mut Self>,
|
461 - | cx: &mut std::task::Context<'_>,
|
462 - | ) -> std::task::Poll<Self::Output> {
|
463 - | let this = self.project();
|
464 - | this.inner.as_mut().poll(cx)
|
465 - | }
|
466 - | }
|
467 - |
|
468 - | impl<B>
|
469 - | ::aws_smithy_legacy_http_server::request::FromRequest<
|
470 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
471 - | B,
|
472 - | > for crate::input::EndpointWithHostLabelOperationInput
|
473 - | where
|
474 - | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
475 - | B: 'static,
|
387 + | #[allow(unreachable_code, unused_variables)]
|
388 + | #[cfg(test)]
|
389 + | mod kitchen_sink_operation_test {
|
476 390 |
|
477 - | B::Data: Send,
|
478 - | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
479 - | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
480 - | {
|
481 - | type Rejection =
|
482 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
483 - | type Future = EndpointWithHostLabelOperationInputFuture;
|
484 - |
|
485 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
486 - | let fut = async move {
|
487 - | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
488 - | request.headers(),
|
489 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
490 - | ) {
|
491 - | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
492 - | }
|
493 - | crate::protocol_serde::shape_endpoint_with_host_label_operation::de_endpoint_with_host_label_operation_http_request(request)
|
494 - | .await
|
495 - | };
|
496 - | use ::futures_util::future::TryFutureExt;
|
497 - | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
498 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
499 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
500 - | });
|
501 - | EndpointWithHostLabelOperationInputFuture {
|
502 - | inner: Box::pin(fut),
|
503 - | }
|
504 - | }
|
505 - | }
|
506 - | impl
|
507 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
508 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
509 - | > for crate::output::EndpointWithHostLabelOperationOutput
|
510 - | {
|
511 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
512 - | match crate::protocol_serde::shape_endpoint_with_host_label_operation::ser_endpoint_with_host_label_operation_http_response(self) {
|
513 - | Ok(response) => response,
|
514 - | Err(e) => {
|
515 - | ::tracing::error!(error = %e, "failed to serialize response");
|
516 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
517 - | }
|
518 - | }
|
519 - | }
|
520 - | }
|
521 - | impl
|
522 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
523 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
524 - | > for crate::error::EndpointWithHostLabelOperationError
|
525 - | {
|
526 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
527 - | match crate::protocol_serde::shape_endpoint_with_host_label_operation::ser_endpoint_with_host_label_operation_http_error(&self) {
|
528 - | Ok(mut response) => {
|
529 - | response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
530 - | response
|
531 - | },
|
532 - | Err(e) => {
|
533 - | ::tracing::error!(error = %e, "failed to serialize response");
|
534 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
535 - | }
|
536 - | }
|
537 - | }
|
538 - | }
|
539 - |
|
540 - | #[allow(unreachable_code, unused_variables)]
|
541 - | #[cfg(test)]
|
542 - | mod endpoint_with_host_label_operation_test {
|
543 - |
|
544 - | /// Operations can prepend to the given host if they define the
|
545 - | /// endpoint trait, and can use the host label trait to define
|
546 - | /// further customization based on user input.
|
547 - | /// Test ID: AwsJson11EndpointTraitWithHostLabel
|
391 + | /// Serializes string shapes
|
392 + | /// Test ID: serializes_string_shapes
|
548 393 | #[::tokio::test]
|
549 394 | #[::tracing_test::traced_test]
|
550 - | #[should_panic]
|
551 - | async fn aws_json11_endpoint_trait_with_host_label_request() {
|
395 + | async fn serializes_string_shapes_request() {
|
552 396 | #[allow(unused_mut)]
|
553 397 | let mut http_request = ::http::Request::builder()
|
554 398 | .uri("/")
|
555 399 | .method("POST")
|
556 400 | .header("Content-Type", "application/x-amz-json-1.1")
|
557 - | .header(
|
558 - | "X-Amz-Target",
|
559 - | "JsonProtocol.EndpointWithHostLabelOperation",
|
560 - | )
|
401 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
561 402 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
562 403 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
563 - | "{\"label\": \"bar\"}".as_bytes(),
|
404 + | "{\"String\":\"abc xyz\"}".as_bytes(),
|
564 405 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
565 406 | )),
|
566 407 | ))
|
567 408 | .unwrap();
|
568 - | todo!("endpoint trait not supported yet");
|
569 - | #[allow(unused_mut)]
|
570 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
571 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
572 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
573 - | .endpoint_with_host_label_operation(
|
574 - | move |input: crate::input::EndpointWithHostLabelOperationInput| {
|
575 - | let sender = sender.clone();
|
576 - | async move {
|
577 - | let result = {
|
578 - | let expected = crate::input::EndpointWithHostLabelOperationInput {
|
579 - | label: "bar".to_owned(),
|
580 - | };
|
581 - | ::pretty_assertions::assert_eq!(input, expected);
|
582 - | let output = crate::output::EndpointWithHostLabelOperationOutput {};
|
583 - | Ok(output)
|
584 - | };
|
585 - | sender.send(()).await.expect("receiver dropped early");
|
586 - | result
|
587 - | }
|
588 - | },
|
589 - | )
|
590 - | .build_unchecked();
|
591 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
592 - | .await
|
593 - | .expect("unable to make an HTTP request");
|
594 - | assert!(
|
595 - | receiver.recv().await.is_some(),
|
596 - | "we expected operation handler to be invoked but it was not entered"
|
597 - | );
|
598 - | }
|
599 - | }
|
600 - |
|
601 - | ::pin_project_lite::pin_project! {
|
602 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
603 - | /// [`EndpointOperationInput`](crate::input::EndpointOperationInput) using modelled bindings.
|
604 - | pub struct EndpointOperationInputFuture {
|
605 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EndpointOperationInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
606 - | }
|
607 - | }
|
608 - |
|
609 - | impl std::future::Future for EndpointOperationInputFuture {
|
610 - | type Output = Result<
|
611 - | crate::input::EndpointOperationInput,
|
612 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
613 - | >;
|
614 - |
|
615 - | fn poll(
|
616 - | self: std::pin::Pin<&mut Self>,
|
617 - | cx: &mut std::task::Context<'_>,
|
618 - | ) -> std::task::Poll<Self::Output> {
|
619 - | let this = self.project();
|
620 - | this.inner.as_mut().poll(cx)
|
621 - | }
|
622 - | }
|
623 - |
|
624 - | impl<B>
|
625 - | ::aws_smithy_legacy_http_server::request::FromRequest<
|
626 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
627 - | B,
|
628 - | > for crate::input::EndpointOperationInput
|
629 - | where
|
630 - | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
631 - | B: 'static,
|
632 - |
|
633 - | B::Data: Send,
|
634 - | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
635 - | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
636 - | {
|
637 - | type Rejection =
|
638 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
639 - | type Future = EndpointOperationInputFuture;
|
640 - |
|
641 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
642 - | let fut = async move {
|
643 - | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
644 - | request.headers(),
|
645 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
646 - | ) {
|
647 - | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
648 - | }
|
649 - | crate::protocol_serde::shape_endpoint_operation::de_endpoint_operation_http_request(
|
650 - | request,
|
651 - | )
|
652 - | .await
|
653 - | };
|
654 - | use ::futures_util::future::TryFutureExt;
|
655 - | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
656 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
657 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
658 - | });
|
659 - | EndpointOperationInputFuture {
|
660 - | inner: Box::pin(fut),
|
661 - | }
|
662 - | }
|
663 - | }
|
664 - | impl
|
665 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
666 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
667 - | > for crate::output::EndpointOperationOutput
|
668 - | {
|
669 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
670 - | match crate::protocol_serde::shape_endpoint_operation::ser_endpoint_operation_http_response(
|
671 - | self,
|
672 - | ) {
|
673 - | Ok(response) => response,
|
674 - | Err(e) => {
|
675 - | ::tracing::error!(error = %e, "failed to serialize response");
|
676 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
677 - | }
|
678 - | }
|
679 - | }
|
680 - | }
|
681 - |
|
682 - | #[allow(unreachable_code, unused_variables)]
|
683 - | #[cfg(test)]
|
684 - | mod endpoint_operation_test {
|
685 - |
|
686 - | /// Operations can prepend to the given host if they define the
|
687 - | /// endpoint trait.
|
688 - | /// Test ID: AwsJson11EndpointTrait
|
689 - | #[::tokio::test]
|
690 - | #[::tracing_test::traced_test]
|
691 - | #[should_panic]
|
692 - | async fn aws_json11_endpoint_trait_request() {
|
693 - | #[allow(unused_mut)]
|
694 - | let mut http_request = ::http::Request::builder()
|
695 - | .uri("/")
|
696 - | .method("POST")
|
697 - | .header("Content-Type", "application/x-amz-json-1.1")
|
698 - | .header("X-Amz-Target", "JsonProtocol.EndpointOperation")
|
699 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
700 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
701 - | "{}".as_bytes(),
|
702 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
703 - | )),
|
704 - | ))
|
705 - | .unwrap();
|
706 - | todo!("endpoint trait not supported yet");
|
707 409 | #[allow(unused_mut)]
|
708 410 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
709 411 | let config = crate::service::JsonProtocolConfig::builder().build();
|
710 412 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
711 - | .endpoint_operation(move |input: crate::input::EndpointOperationInput| {
|
413 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
712 414 | let sender = sender.clone();
|
713 415 | async move {
|
714 416 | let result = {
|
715 - | let expected = crate::input::EndpointOperationInput {};
|
716 - | ::pretty_assertions::assert_eq!(input, expected);
|
717 - | let output = crate::output::EndpointOperationOutput {};
|
718 - | output
|
719 - | };
|
720 - | sender.send(()).await.expect("receiver dropped early");
|
721 - | result
|
722 - | }
|
723 - | })
|
724 - | .build_unchecked();
|
725 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
726 - | .await
|
727 - | .expect("unable to make an HTTP request");
|
728 - | assert!(
|
729 - | receiver.recv().await.is_some(),
|
730 - | "we expected operation handler to be invoked but it was not entered"
|
731 - | );
|
732 - | }
|
733 - | }
|
734 - |
|
735 - | ::pin_project_lite::pin_project! {
|
736 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
737 - | /// [`JsonUnionsInput`](crate::input::JsonUnionsInput) using modelled bindings.
|
738 - | pub struct JsonUnionsInputFuture {
|
739 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::JsonUnionsInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
740 - | }
|
741 - | }
|
742 - |
|
743 - | impl std::future::Future for JsonUnionsInputFuture {
|
744 - | type Output = Result<
|
745 - | crate::input::JsonUnionsInput,
|
746 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
747 - | >;
|
748 - |
|
749 - | fn poll(
|
750 - | self: std::pin::Pin<&mut Self>,
|
751 - | cx: &mut std::task::Context<'_>,
|
752 - | ) -> std::task::Poll<Self::Output> {
|
753 - | let this = self.project();
|
754 - | this.inner.as_mut().poll(cx)
|
417 + | use ::aws_smithy_protocol_test::FloatEquals;
|
418 + | let expected = crate::input::KitchenSinkOperationInput {
|
419 + | string: ::std::option::Option::Some("abc xyz".to_owned()),
|
420 + | blob: ::std::option::Option::None,
|
421 + | boolean: ::std::option::Option::None,
|
422 + | double: ::std::option::Option::None,
|
423 + | empty_struct: ::std::option::Option::None,
|
424 + | float: ::std::option::Option::None,
|
425 + | httpdate_timestamp: ::std::option::Option::None,
|
426 + | integer: ::std::option::Option::None,
|
427 + | iso8601_timestamp: ::std::option::Option::None,
|
428 + | json_value: ::std::option::Option::None,
|
429 + | list_of_lists: ::std::option::Option::None,
|
430 + | list_of_maps_of_strings: ::std::option::Option::None,
|
431 + | list_of_strings: ::std::option::Option::None,
|
432 + | list_of_structs: ::std::option::Option::None,
|
433 + | long: ::std::option::Option::None,
|
434 + | map_of_lists_of_strings: ::std::option::Option::None,
|
435 + | map_of_maps: ::std::option::Option::None,
|
436 + | map_of_strings: ::std::option::Option::None,
|
437 + | map_of_structs: ::std::option::Option::None,
|
438 + | recursive_list: ::std::option::Option::None,
|
439 + | recursive_map: ::std::option::Option::None,
|
440 + | recursive_struct: ::std::option::Option::None,
|
441 + | simple_struct: ::std::option::Option::None,
|
442 + | struct_with_json_name: ::std::option::Option::None,
|
443 + | timestamp: ::std::option::Option::None,
|
444 + | unix_timestamp: ::std::option::Option::None,
|
445 + | };
|
446 + | ::pretty_assertions::assert_eq!(
|
447 + | input.blob,
|
448 + | expected.blob,
|
449 + | "Unexpected value for `blob`"
|
450 + | );
|
451 + | ::pretty_assertions::assert_eq!(
|
452 + | input.boolean,
|
453 + | expected.boolean,
|
454 + | "Unexpected value for `boolean`"
|
455 + | );
|
456 + | assert!(
|
457 + | input.double.float_equals(&expected.double),
|
458 + | "Unexpected value for `double` {:?} vs. {:?}",
|
459 + | expected.double,
|
460 + | input.double
|
461 + | );
|
462 + | ::pretty_assertions::assert_eq!(
|
463 + | input.empty_struct,
|
464 + | expected.empty_struct,
|
465 + | "Unexpected value for `empty_struct`"
|
466 + | );
|
467 + | assert!(
|
468 + | input.float.float_equals(&expected.float),
|
469 + | "Unexpected value for `float` {:?} vs. {:?}",
|
470 + | expected.float,
|
471 + | input.float
|
472 + | );
|
473 + | ::pretty_assertions::assert_eq!(
|
474 + | input.httpdate_timestamp,
|
475 + | expected.httpdate_timestamp,
|
476 + | "Unexpected value for `httpdate_timestamp`"
|
477 + | );
|
478 + | ::pretty_assertions::assert_eq!(
|
479 + | input.integer,
|
480 + | expected.integer,
|
481 + | "Unexpected value for `integer`"
|
482 + | );
|
483 + | ::pretty_assertions::assert_eq!(
|
484 + | input.iso8601_timestamp,
|
485 + | expected.iso8601_timestamp,
|
486 + | "Unexpected value for `iso8601_timestamp`"
|
487 + | );
|
488 + | ::pretty_assertions::assert_eq!(
|
489 + | input.json_value,
|
490 + | expected.json_value,
|
491 + | "Unexpected value for `json_value`"
|
492 + | );
|
493 + | ::pretty_assertions::assert_eq!(
|
494 + | input.list_of_lists,
|
495 + | expected.list_of_lists,
|
496 + | "Unexpected value for `list_of_lists`"
|
497 + | );
|
498 + | ::pretty_assertions::assert_eq!(
|
499 + | input.list_of_maps_of_strings,
|
500 + | expected.list_of_maps_of_strings,
|
501 + | "Unexpected value for `list_of_maps_of_strings`"
|
502 + | );
|
503 + | ::pretty_assertions::assert_eq!(
|
504 + | input.list_of_strings,
|
505 + | expected.list_of_strings,
|
506 + | "Unexpected value for `list_of_strings`"
|
507 + | );
|
508 + | ::pretty_assertions::assert_eq!(
|
509 + | input.list_of_structs,
|
510 + | expected.list_of_structs,
|
511 + | "Unexpected value for `list_of_structs`"
|
512 + | );
|
513 + | ::pretty_assertions::assert_eq!(
|
514 + | input.long,
|
515 + | expected.long,
|
516 + | "Unexpected value for `long`"
|
517 + | );
|
518 + | ::pretty_assertions::assert_eq!(
|
519 + | input.map_of_lists_of_strings,
|
520 + | expected.map_of_lists_of_strings,
|
521 + | "Unexpected value for `map_of_lists_of_strings`"
|
522 + | );
|
523 + | ::pretty_assertions::assert_eq!(
|
524 + | input.map_of_maps,
|
525 + | expected.map_of_maps,
|
526 + | "Unexpected value for `map_of_maps`"
|
527 + | );
|
528 + | ::pretty_assertions::assert_eq!(
|
529 + | input.map_of_strings,
|
530 + | expected.map_of_strings,
|
531 + | "Unexpected value for `map_of_strings`"
|
532 + | );
|
533 + | ::pretty_assertions::assert_eq!(
|
534 + | input.map_of_structs,
|
535 + | expected.map_of_structs,
|
536 + | "Unexpected value for `map_of_structs`"
|
537 + | );
|
538 + | ::pretty_assertions::assert_eq!(
|
539 + | input.recursive_list,
|
540 + | expected.recursive_list,
|
541 + | "Unexpected value for `recursive_list`"
|
542 + | );
|
543 + | ::pretty_assertions::assert_eq!(
|
544 + | input.recursive_map,
|
545 + | expected.recursive_map,
|
546 + | "Unexpected value for `recursive_map`"
|
547 + | );
|
548 + | ::pretty_assertions::assert_eq!(
|
549 + | input.recursive_struct,
|
550 + | expected.recursive_struct,
|
551 + | "Unexpected value for `recursive_struct`"
|
552 + | );
|
553 + | ::pretty_assertions::assert_eq!(
|
554 + | input.simple_struct,
|
555 + | expected.simple_struct,
|
556 + | "Unexpected value for `simple_struct`"
|
557 + | );
|
558 + | ::pretty_assertions::assert_eq!(
|
559 + | input.string,
|
560 + | expected.string,
|
561 + | "Unexpected value for `string`"
|
562 + | );
|
563 + | ::pretty_assertions::assert_eq!(
|
564 + | input.struct_with_json_name,
|
565 + | expected.struct_with_json_name,
|
566 + | "Unexpected value for `struct_with_json_name`"
|
567 + | );
|
568 + | ::pretty_assertions::assert_eq!(
|
569 + | input.timestamp,
|
570 + | expected.timestamp,
|
571 + | "Unexpected value for `timestamp`"
|
572 + | );
|
573 + | ::pretty_assertions::assert_eq!(
|
574 + | input.unix_timestamp,
|
575 + | expected.unix_timestamp,
|
576 + | "Unexpected value for `unix_timestamp`"
|
577 + | );
|
578 + | let output = crate::output::KitchenSinkOperationOutput {
|
579 + | blob: ::std::option::Option::None,
|
580 + | boolean: ::std::option::Option::None,
|
581 + | double: ::std::option::Option::None,
|
582 + | empty_struct: ::std::option::Option::None,
|
583 + | float: ::std::option::Option::None,
|
584 + | httpdate_timestamp: ::std::option::Option::None,
|
585 + | integer: ::std::option::Option::None,
|
586 + | iso8601_timestamp: ::std::option::Option::None,
|
587 + | json_value: ::std::option::Option::None,
|
588 + | list_of_lists: ::std::option::Option::None,
|
589 + | list_of_maps_of_strings: ::std::option::Option::None,
|
590 + | list_of_strings: ::std::option::Option::None,
|
591 + | list_of_structs: ::std::option::Option::None,
|
592 + | long: ::std::option::Option::None,
|
593 + | map_of_lists_of_strings: ::std::option::Option::None,
|
594 + | map_of_maps: ::std::option::Option::None,
|
595 + | map_of_strings: ::std::option::Option::None,
|
596 + | map_of_structs: ::std::option::Option::None,
|
597 + | recursive_list: ::std::option::Option::None,
|
598 + | recursive_map: ::std::option::Option::None,
|
599 + | recursive_struct: ::std::option::Option::None,
|
600 + | simple_struct: ::std::option::Option::None,
|
601 + | string: ::std::option::Option::None,
|
602 + | struct_with_json_name: ::std::option::Option::None,
|
603 + | timestamp: ::std::option::Option::None,
|
604 + | unix_timestamp: ::std::option::Option::None,
|
605 + | };
|
606 + | Ok(output)
|
607 + | };
|
608 + | sender.send(()).await.expect("receiver dropped early");
|
609 + | result
|
610 + | }
|
611 + | })
|
612 + | .build_unchecked();
|
613 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
614 + | .await
|
615 + | .expect("unable to make an HTTP request");
|
616 + | assert!(
|
617 + | receiver.recv().await.is_some(),
|
618 + | "we expected operation handler to be invoked but it was not entered"
|
619 + | );
|
755 620 | }
|
756 - | }
|
757 - |
|
758 - | impl<B>
|
759 - | ::aws_smithy_legacy_http_server::request::FromRequest<
|
760 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
761 - | B,
|
762 - | > for crate::input::JsonUnionsInput
|
763 - | where
|
764 - | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
765 - | B: 'static,
|
766 - |
|
767 - | B::Data: Send,
|
768 - | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
769 - | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
770 - | {
|
771 - | type Rejection =
|
772 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
773 - | type Future = JsonUnionsInputFuture;
|
774 621 |
|
775 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
776 - | let fut = async move {
|
777 - | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
778 - | request.headers(),
|
779 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
780 - | ) {
|
781 - | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
782 - | }
|
783 - | crate::protocol_serde::shape_json_unions::de_json_unions_http_request(request).await
|
784 - | };
|
785 - | use ::futures_util::future::TryFutureExt;
|
786 - | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
787 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
788 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
789 - | });
|
790 - | JsonUnionsInputFuture {
|
791 - | inner: Box::pin(fut),
|
792 - | }
|
793 - | }
|
794 - | }
|
795 - | impl
|
796 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
797 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
798 - | > for crate::output::JsonUnionsOutput
|
799 - | {
|
800 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
801 - | match crate::protocol_serde::shape_json_unions::ser_json_unions_http_response(self) {
|
802 - | Ok(response) => response,
|
803 - | Err(e) => {
|
804 - | ::tracing::error!(error = %e, "failed to serialize response");
|
805 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
806 - | }
|
807 - | }
|
808 - | }
|
809 - | }
|
810 - | impl
|
811 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
812 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
813 - | > for crate::error::JsonUnionsError
|
814 - | {
|
815 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
816 - | match crate::protocol_serde::shape_json_unions::ser_json_unions_http_error(&self) {
|
817 - | Ok(mut response) => {
|
818 - | response.extensions_mut().insert(
|
819 - | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
820 - | self.name(),
|
821 - | ),
|
822 - | );
|
823 - | response
|
824 - | }
|
825 - | Err(e) => {
|
826 - | ::tracing::error!(error = %e, "failed to serialize response");
|
827 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
828 - | }
|
829 - | }
|
830 - | }
|
831 - | }
|
832 - |
|
833 - | #[allow(unreachable_code, unused_variables)]
|
834 - | #[cfg(test)]
|
835 - | mod json_unions_test {
|
836 - |
|
837 - | /// Serializes a string union value
|
838 - | /// Test ID: AwsJson11SerializeStringUnionValue
|
839 - | #[::tokio::test]
|
840 - | #[::tracing_test::traced_test]
|
841 - | async fn aws_json11_serialize_string_union_value_request() {
|
842 - | #[allow(unused_mut)]
|
843 - | let mut http_request = ::http::Request::builder()
|
844 - | .uri("/")
|
845 - | .method("POST")
|
846 - | .header("Content-Type", "application/x-amz-json-1.1")
|
847 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
848 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
849 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
850 - | "{\n \"contents\": {\n \"stringValue\": \"foo\"\n }\n}".as_bytes(),
|
851 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
852 - | )),
|
853 - | ))
|
854 - | .unwrap();
|
855 - | #[allow(unused_mut)]
|
856 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
857 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
858 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
859 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
860 - | let sender = sender.clone();
|
861 - | async move {
|
862 - | let result = {
|
863 - | let expected = crate::input::JsonUnionsInput {
|
864 - | contents: ::std::option::Option::Some(
|
865 - | crate::model::MyUnion::StringValue("foo".to_owned()),
|
866 - | ),
|
867 - | };
|
868 - | ::pretty_assertions::assert_eq!(input, expected);
|
869 - | let output = crate::output::JsonUnionsOutput {
|
870 - | contents: ::std::option::Option::None,
|
871 - | };
|
872 - | Ok(output)
|
873 - | };
|
874 - | sender.send(()).await.expect("receiver dropped early");
|
875 - | result
|
876 - | }
|
877 - | })
|
878 - | .build_unchecked();
|
879 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
880 - | .await
|
881 - | .expect("unable to make an HTTP request");
|
882 - | assert!(
|
883 - | receiver.recv().await.is_some(),
|
884 - | "we expected operation handler to be invoked but it was not entered"
|
885 - | );
|
886 - | }
|
887 - |
|
888 - | /// Serializes a boolean union value
|
889 - | /// Test ID: AwsJson11SerializeBooleanUnionValue
|
890 - | #[::tokio::test]
|
891 - | #[::tracing_test::traced_test]
|
892 - | async fn aws_json11_serialize_boolean_union_value_request() {
|
893 - | #[allow(unused_mut)]
|
894 - | let mut http_request = ::http::Request::builder()
|
895 - | .uri("/")
|
896 - | .method("POST")
|
897 - | .header("Content-Type", "application/x-amz-json-1.1")
|
898 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
899 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
900 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
901 - | "{\n \"contents\": {\n \"booleanValue\": true\n }\n}".as_bytes(),
|
902 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
903 - | )),
|
904 - | ))
|
905 - | .unwrap();
|
906 - | #[allow(unused_mut)]
|
907 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
908 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
909 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
910 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
911 - | let sender = sender.clone();
|
912 - | async move {
|
913 - | let result = {
|
914 - | let expected = crate::input::JsonUnionsInput {
|
915 - | contents: ::std::option::Option::Some(
|
916 - | crate::model::MyUnion::BooleanValue(true),
|
917 - | ),
|
918 - | };
|
919 - | ::pretty_assertions::assert_eq!(input, expected);
|
920 - | let output = crate::output::JsonUnionsOutput {
|
921 - | contents: ::std::option::Option::None,
|
922 - | };
|
923 - | Ok(output)
|
924 - | };
|
925 - | sender.send(()).await.expect("receiver dropped early");
|
926 - | result
|
927 - | }
|
928 - | })
|
929 - | .build_unchecked();
|
930 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
931 - | .await
|
932 - | .expect("unable to make an HTTP request");
|
933 - | assert!(
|
934 - | receiver.recv().await.is_some(),
|
935 - | "we expected operation handler to be invoked but it was not entered"
|
936 - | );
|
937 - | }
|
938 - |
|
939 - | /// Serializes a number union value
|
940 - | /// Test ID: AwsJson11SerializeNumberUnionValue
|
941 - | #[::tokio::test]
|
942 - | #[::tracing_test::traced_test]
|
943 - | async fn aws_json11_serialize_number_union_value_request() {
|
944 - | #[allow(unused_mut)]
|
945 - | let mut http_request = ::http::Request::builder()
|
946 - | .uri("/")
|
947 - | .method("POST")
|
948 - | .header("Content-Type", "application/x-amz-json-1.1")
|
949 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
950 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
951 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
952 - | "{\n \"contents\": {\n \"numberValue\": 1\n }\n}".as_bytes(),
|
953 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
954 - | )),
|
955 - | ))
|
956 - | .unwrap();
|
957 - | #[allow(unused_mut)]
|
958 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
959 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
960 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
961 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
962 - | let sender = sender.clone();
|
963 - | async move {
|
964 - | let result = {
|
965 - | let expected = crate::input::JsonUnionsInput {
|
966 - | contents: ::std::option::Option::Some(
|
967 - | crate::model::MyUnion::NumberValue(1),
|
968 - | ),
|
969 - | };
|
970 - | ::pretty_assertions::assert_eq!(input, expected);
|
971 - | let output = crate::output::JsonUnionsOutput {
|
972 - | contents: ::std::option::Option::None,
|
973 - | };
|
974 - | Ok(output)
|
975 - | };
|
976 - | sender.send(()).await.expect("receiver dropped early");
|
977 - | result
|
978 - | }
|
979 - | })
|
980 - | .build_unchecked();
|
981 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
982 - | .await
|
983 - | .expect("unable to make an HTTP request");
|
984 - | assert!(
|
985 - | receiver.recv().await.is_some(),
|
986 - | "we expected operation handler to be invoked but it was not entered"
|
987 - | );
|
988 - | }
|
989 - |
|
990 - | /// Serializes a blob union value
|
991 - | /// Test ID: AwsJson11SerializeBlobUnionValue
|
622 + | /// Serializes string shapes with jsonvalue trait
|
623 + | /// Test ID: serializes_string_shapes_with_jsonvalue_trait
|
992 624 | #[::tokio::test]
|
993 625 | #[::tracing_test::traced_test]
|
994 - | async fn aws_json11_serialize_blob_union_value_request() {
|
626 + | async fn serializes_string_shapes_with_jsonvalue_trait_request() {
|
995 627 | #[allow(unused_mut)]
|
996 - | let mut http_request = ::http::Request::builder()
|
997 - | .uri("/")
|
998 - | .method("POST")
|
999 - | .header("Content-Type", "application/x-amz-json-1.1")
|
1000 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
1001 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1002 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1003 - | "{\n \"contents\": {\n \"blobValue\": \"Zm9v\"\n }\n}".as_bytes(),
|
1004 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1005 - | )),
|
1006 - | ))
|
1007 - | .unwrap();
|
628 + | let mut http_request = ::http::Request::builder()
|
629 + | .uri("/")
|
630 + | .method("POST")
|
631 + | .header("Content-Type", "application/x-amz-json-1.1")
|
632 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
633 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
634 + | ::bytes::Bytes::copy_from_slice(
|
635 + | &::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"))
|
636 + | )
|
637 + | )).unwrap();
|
1008 638 | #[allow(unused_mut)]
|
1009 639 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1010 640 | let config = crate::service::JsonProtocolConfig::builder().build();
|
1011 641 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1012 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1013 - | let sender = sender.clone();
|
1014 - | async move {
|
1015 - | let result = {
|
1016 - | let expected = crate::input::JsonUnionsInput {
|
1017 - | contents: ::std::option::Option::Some(
|
1018 - | crate::model::MyUnion::BlobValue(::aws_smithy_types::Blob::new(
|
1019 - | "foo",
|
1020 - | )),
|
1021 - | ),
|
1022 - | };
|
1023 - | ::pretty_assertions::assert_eq!(input, expected);
|
1024 - | let output = crate::output::JsonUnionsOutput {
|
1025 - | contents: ::std::option::Option::None,
|
1026 - | };
|
1027 - | Ok(output)
|
1028 - | };
|
1029 - | sender.send(()).await.expect("receiver dropped early");
|
1030 - | result
|
1031 - | }
|
1032 - | })
|
1033 - | .build_unchecked();
|
1034 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1035 - | .await
|
1036 - | .expect("unable to make an HTTP request");
|
1037 - | assert!(
|
1038 - | receiver.recv().await.is_some(),
|
1039 - | "we expected operation handler to be invoked but it was not entered"
|
1040 - | );
|
1041 - | }
|
1042 - |
|
1043 - | /// Serializes a timestamp union value
|
1044 - | /// Test ID: AwsJson11SerializeTimestampUnionValue
|
1045 - | #[::tokio::test]
|
1046 - | #[::tracing_test::traced_test]
|
1047 - | async fn aws_json11_serialize_timestamp_union_value_request() {
|
1048 - | #[allow(unused_mut)]
|
1049 - | let mut http_request = ::http::Request::builder()
|
1050 - | .uri("/")
|
1051 - | .method("POST")
|
1052 - | .header("Content-Type", "application/x-amz-json-1.1")
|
1053 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
1054 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1055 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1056 - | "{\n \"contents\": {\n \"timestampValue\": 1398796238\n }\n}"
|
1057 - | .as_bytes(),
|
1058 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1059 - | )),
|
1060 - | ))
|
1061 - | .unwrap();
|
1062 - | #[allow(unused_mut)]
|
1063 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1064 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
1065 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1066 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1067 - | let sender = sender.clone();
|
1068 - | async move {
|
1069 - | let result = {
|
1070 - | let expected = crate::input::JsonUnionsInput {
|
1071 - | contents: ::std::option::Option::Some(
|
1072 - | crate::model::MyUnion::TimestampValue(
|
1073 - | ::aws_smithy_types::DateTime::from_fractional_secs(
|
1074 - | 1398796238, 0_f64,
|
1075 - | ),
|
1076 - | ),
|
1077 - | ),
|
1078 - | };
|
1079 - | ::pretty_assertions::assert_eq!(input, expected);
|
1080 - | let output = crate::output::JsonUnionsOutput {
|
1081 - | contents: ::std::option::Option::None,
|
1082 - | };
|
1083 - | Ok(output)
|
1084 - | };
|
1085 - | sender.send(()).await.expect("receiver dropped early");
|
1086 - | result
|
1087 - | }
|
1088 - | })
|
1089 - | .build_unchecked();
|
642 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
643 + | let sender = sender.clone();
|
644 + | async move {
|
645 + | let result = { use ::aws_smithy_protocol_test::FloatEquals;
|
646 + | let expected =
|
647 + | crate::input::KitchenSinkOperationInput {
|
648 + | json_value:
|
649 + | ::std::option::Option::Some(
|
650 + | "{\"string\":\"value\",\"number\":1234.5,\"boolTrue\":true,\"boolFalse\":false,\"array\":[1,2,3,4],\"object\":{\"key\":\"value\"},\"null\":null}".to_owned()
|
651 + | )
|
652 + | ,
|
653 + | blob:
|
654 + | ::std::option::Option::None
|
655 + | ,
|
656 + | boolean:
|
657 + | ::std::option::Option::None
|
658 + | ,
|
659 + | double:
|
660 + | ::std::option::Option::None
|
661 + | ,
|
662 + | empty_struct:
|
663 + | ::std::option::Option::None
|
664 + | ,
|
665 + | float:
|
666 + | ::std::option::Option::None
|
667 + | ,
|
668 + | httpdate_timestamp:
|
669 + | ::std::option::Option::None
|
670 + | ,
|
671 + | integer:
|
672 + | ::std::option::Option::None
|
673 + | ,
|
674 + | iso8601_timestamp:
|
675 + | ::std::option::Option::None
|
676 + | ,
|
677 + | list_of_lists:
|
678 + | ::std::option::Option::None
|
679 + | ,
|
680 + | list_of_maps_of_strings:
|
681 + | ::std::option::Option::None
|
682 + | ,
|
683 + | list_of_strings:
|
684 + | ::std::option::Option::None
|
685 + | ,
|
686 + | list_of_structs:
|
687 + | ::std::option::Option::None
|
688 + | ,
|
689 + | long:
|
690 + | ::std::option::Option::None
|
691 + | ,
|
692 + | map_of_lists_of_strings:
|
693 + | ::std::option::Option::None
|
694 + | ,
|
695 + | map_of_maps:
|
696 + | ::std::option::Option::None
|
697 + | ,
|
698 + | map_of_strings:
|
699 + | ::std::option::Option::None
|
700 + | ,
|
701 + | map_of_structs:
|
702 + | ::std::option::Option::None
|
703 + | ,
|
704 + | recursive_list:
|
705 + | ::std::option::Option::None
|
706 + | ,
|
707 + | recursive_map:
|
708 + | ::std::option::Option::None
|
709 + | ,
|
710 + | recursive_struct:
|
711 + | ::std::option::Option::None
|
712 + | ,
|
713 + | simple_struct:
|
714 + | ::std::option::Option::None
|
715 + | ,
|
716 + | string:
|
717 + | ::std::option::Option::None
|
718 + | ,
|
719 + | struct_with_json_name:
|
720 + | ::std::option::Option::None
|
721 + | ,
|
722 + | timestamp:
|
723 + | ::std::option::Option::None
|
724 + | ,
|
725 + | unix_timestamp:
|
726 + | ::std::option::Option::None
|
727 + | ,
|
728 + | }
|
729 + | ;
|
730 + | ::pretty_assertions::assert_eq!(input.blob, expected.blob, "Unexpected value for `blob`");
|
731 + | ::pretty_assertions::assert_eq!(input.boolean, expected.boolean, "Unexpected value for `boolean`");
|
732 + | assert!(input.double.float_equals(&expected.double),
|
733 + | "Unexpected value for `double` {:?} vs. {:?}", expected.double, input.double);
|
734 + | ::pretty_assertions::assert_eq!(input.empty_struct, expected.empty_struct, "Unexpected value for `empty_struct`");
|
735 + | assert!(input.float.float_equals(&expected.float),
|
736 + | "Unexpected value for `float` {:?} vs. {:?}", expected.float, input.float);
|
737 + | ::pretty_assertions::assert_eq!(input.httpdate_timestamp, expected.httpdate_timestamp, "Unexpected value for `httpdate_timestamp`");
|
738 + | ::pretty_assertions::assert_eq!(input.integer, expected.integer, "Unexpected value for `integer`");
|
739 + | ::pretty_assertions::assert_eq!(input.iso8601_timestamp, expected.iso8601_timestamp, "Unexpected value for `iso8601_timestamp`");
|
740 + | ::pretty_assertions::assert_eq!(input.json_value, expected.json_value, "Unexpected value for `json_value`");
|
741 + | ::pretty_assertions::assert_eq!(input.list_of_lists, expected.list_of_lists, "Unexpected value for `list_of_lists`");
|
742 + | ::pretty_assertions::assert_eq!(input.list_of_maps_of_strings, expected.list_of_maps_of_strings, "Unexpected value for `list_of_maps_of_strings`");
|
743 + | ::pretty_assertions::assert_eq!(input.list_of_strings, expected.list_of_strings, "Unexpected value for `list_of_strings`");
|
744 + | ::pretty_assertions::assert_eq!(input.list_of_structs, expected.list_of_structs, "Unexpected value for `list_of_structs`");
|
745 + | ::pretty_assertions::assert_eq!(input.long, expected.long, "Unexpected value for `long`");
|
746 + | ::pretty_assertions::assert_eq!(input.map_of_lists_of_strings, expected.map_of_lists_of_strings, "Unexpected value for `map_of_lists_of_strings`");
|
747 + | ::pretty_assertions::assert_eq!(input.map_of_maps, expected.map_of_maps, "Unexpected value for `map_of_maps`");
|
748 + | ::pretty_assertions::assert_eq!(input.map_of_strings, expected.map_of_strings, "Unexpected value for `map_of_strings`");
|
749 + | ::pretty_assertions::assert_eq!(input.map_of_structs, expected.map_of_structs, "Unexpected value for `map_of_structs`");
|
750 + | ::pretty_assertions::assert_eq!(input.recursive_list, expected.recursive_list, "Unexpected value for `recursive_list`");
|
751 + | ::pretty_assertions::assert_eq!(input.recursive_map, expected.recursive_map, "Unexpected value for `recursive_map`");
|
752 + | ::pretty_assertions::assert_eq!(input.recursive_struct, expected.recursive_struct, "Unexpected value for `recursive_struct`");
|
753 + | ::pretty_assertions::assert_eq!(input.simple_struct, expected.simple_struct, "Unexpected value for `simple_struct`");
|
754 + | ::pretty_assertions::assert_eq!(input.string, expected.string, "Unexpected value for `string`");
|
755 + | ::pretty_assertions::assert_eq!(input.struct_with_json_name, expected.struct_with_json_name, "Unexpected value for `struct_with_json_name`");
|
756 + | ::pretty_assertions::assert_eq!(input.timestamp, expected.timestamp, "Unexpected value for `timestamp`");
|
757 + | ::pretty_assertions::assert_eq!(input.unix_timestamp, expected.unix_timestamp, "Unexpected value for `unix_timestamp`");
|
758 + | let output =
|
759 + | crate::output::KitchenSinkOperationOutput {
|
760 + | blob:
|
761 + | ::std::option::Option::None
|
762 + | ,
|
763 + | boolean:
|
764 + | ::std::option::Option::None
|
765 + | ,
|
766 + | double:
|
767 + | ::std::option::Option::None
|
768 + | ,
|
769 + | empty_struct:
|
770 + | ::std::option::Option::None
|
771 + | ,
|
772 + | float:
|
773 + | ::std::option::Option::None
|
774 + | ,
|
775 + | httpdate_timestamp:
|
776 + | ::std::option::Option::None
|
777 + | ,
|
778 + | integer:
|
779 + | ::std::option::Option::None
|
780 + | ,
|
781 + | iso8601_timestamp:
|
782 + | ::std::option::Option::None
|
783 + | ,
|
784 + | json_value:
|
785 + | ::std::option::Option::None
|
786 + | ,
|
787 + | list_of_lists:
|
788 + | ::std::option::Option::None
|
789 + | ,
|
790 + | list_of_maps_of_strings:
|
791 + | ::std::option::Option::None
|
792 + | ,
|
793 + | list_of_strings:
|
794 + | ::std::option::Option::None
|
795 + | ,
|
796 + | list_of_structs:
|
797 + | ::std::option::Option::None
|
798 + | ,
|
799 + | long:
|
800 + | ::std::option::Option::None
|
801 + | ,
|
802 + | map_of_lists_of_strings:
|
803 + | ::std::option::Option::None
|
804 + | ,
|
805 + | map_of_maps:
|
806 + | ::std::option::Option::None
|
807 + | ,
|
808 + | map_of_strings:
|
809 + | ::std::option::Option::None
|
810 + | ,
|
811 + | map_of_structs:
|
812 + | ::std::option::Option::None
|
813 + | ,
|
814 + | recursive_list:
|
815 + | ::std::option::Option::None
|
816 + | ,
|
817 + | recursive_map:
|
818 + | ::std::option::Option::None
|
819 + | ,
|
820 + | recursive_struct:
|
821 + | ::std::option::Option::None
|
822 + | ,
|
823 + | simple_struct:
|
824 + | ::std::option::Option::None
|
825 + | ,
|
826 + | string:
|
827 + | ::std::option::Option::None
|
828 + | ,
|
829 + | struct_with_json_name:
|
830 + | ::std::option::Option::None
|
831 + | ,
|
832 + | timestamp:
|
833 + | ::std::option::Option::None
|
834 + | ,
|
835 + | unix_timestamp:
|
836 + | ::std::option::Option::None
|
837 + | ,
|
838 + | }
|
839 + | ;
|
840 + | Ok(output) };
|
841 + | sender.send(()).await.expect("receiver dropped early");
|
842 + | result
|
843 + | }
|
844 + | })
|
845 + | .build_unchecked();
|
1090 846 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1091 847 | .await
|
1092 848 | .expect("unable to make an HTTP request");
|
1093 849 | assert!(
|
1094 850 | receiver.recv().await.is_some(),
|
1095 851 | "we expected operation handler to be invoked but it was not entered"
|
1096 852 | );
|
1097 853 | }
|
1098 854 |
|
1099 - | /// Serializes an enum union value
|
1100 - | /// Test ID: AwsJson11SerializeEnumUnionValue
|
855 + | /// Serializes integer shapes
|
856 + | /// Test ID: serializes_integer_shapes
|
1101 857 | #[::tokio::test]
|
1102 858 | #[::tracing_test::traced_test]
|
1103 - | async fn aws_json11_serialize_enum_union_value_request() {
|
859 + | async fn serializes_integer_shapes_request() {
|
1104 860 | #[allow(unused_mut)]
|
1105 861 | let mut http_request = ::http::Request::builder()
|
1106 862 | .uri("/")
|
1107 863 | .method("POST")
|
1108 864 | .header("Content-Type", "application/x-amz-json-1.1")
|
1109 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
865 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
1110 866 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1111 867 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1112 - | "{\n \"contents\": {\n \"enumValue\": \"Foo\"\n }\n}".as_bytes(),
|
868 + | "{\"Integer\":1234}".as_bytes(),
|
1113 869 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1114 870 | )),
|
1115 871 | ))
|
1116 872 | .unwrap();
|
1117 873 | #[allow(unused_mut)]
|
1118 874 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1119 875 | let config = crate::service::JsonProtocolConfig::builder().build();
|
1120 876 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1121 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
877 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
1122 878 | let sender = sender.clone();
|
1123 879 | async move {
|
1124 880 | let result = {
|
1125 - | let expected = crate::input::JsonUnionsInput {
|
1126 - | contents: ::std::option::Option::Some(
|
1127 - | crate::model::MyUnion::EnumValue(
|
1128 - | "Foo"
|
1129 - | .parse::<crate::model::FooEnum>()
|
1130 - | .expect("static value validated to member"),
|
1131 - | ),
|
1132 - | ),
|
881 + | use ::aws_smithy_protocol_test::FloatEquals;
|
882 + | let expected = crate::input::KitchenSinkOperationInput {
|
883 + | integer: ::std::option::Option::Some(1234),
|
884 + | blob: ::std::option::Option::None,
|
885 + | boolean: ::std::option::Option::None,
|
886 + | double: ::std::option::Option::None,
|
887 + | empty_struct: ::std::option::Option::None,
|
888 + | float: ::std::option::Option::None,
|
889 + | httpdate_timestamp: ::std::option::Option::None,
|
890 + | iso8601_timestamp: ::std::option::Option::None,
|
891 + | json_value: ::std::option::Option::None,
|
892 + | list_of_lists: ::std::option::Option::None,
|
893 + | list_of_maps_of_strings: ::std::option::Option::None,
|
894 + | list_of_strings: ::std::option::Option::None,
|
895 + | list_of_structs: ::std::option::Option::None,
|
896 + | long: ::std::option::Option::None,
|
897 + | map_of_lists_of_strings: ::std::option::Option::None,
|
898 + | map_of_maps: ::std::option::Option::None,
|
899 + | map_of_strings: ::std::option::Option::None,
|
900 + | map_of_structs: ::std::option::Option::None,
|
901 + | recursive_list: ::std::option::Option::None,
|
902 + | recursive_map: ::std::option::Option::None,
|
903 + | recursive_struct: ::std::option::Option::None,
|
904 + | simple_struct: ::std::option::Option::None,
|
905 + | string: ::std::option::Option::None,
|
906 + | struct_with_json_name: ::std::option::Option::None,
|
907 + | timestamp: ::std::option::Option::None,
|
908 + | unix_timestamp: ::std::option::Option::None,
|
1133 909 | };
|
1134 - | ::pretty_assertions::assert_eq!(input, expected);
|
1135 - | let output = crate::output::JsonUnionsOutput {
|
1136 - | contents: ::std::option::Option::None,
|
910 + | ::pretty_assertions::assert_eq!(
|
911 + | input.blob,
|
912 + | expected.blob,
|
913 + | "Unexpected value for `blob`"
|
914 + | );
|
915 + | ::pretty_assertions::assert_eq!(
|
916 + | input.boolean,
|
917 + | expected.boolean,
|
918 + | "Unexpected value for `boolean`"
|
919 + | );
|
920 + | assert!(
|
921 + | input.double.float_equals(&expected.double),
|
922 + | "Unexpected value for `double` {:?} vs. {:?}",
|
923 + | expected.double,
|
924 + | input.double
|
925 + | );
|
926 + | ::pretty_assertions::assert_eq!(
|
927 + | input.empty_struct,
|
928 + | expected.empty_struct,
|
929 + | "Unexpected value for `empty_struct`"
|
930 + | );
|
931 + | assert!(
|
932 + | input.float.float_equals(&expected.float),
|
933 + | "Unexpected value for `float` {:?} vs. {:?}",
|
934 + | expected.float,
|
935 + | input.float
|
936 + | );
|
937 + | ::pretty_assertions::assert_eq!(
|
938 + | input.httpdate_timestamp,
|
939 + | expected.httpdate_timestamp,
|
940 + | "Unexpected value for `httpdate_timestamp`"
|
941 + | );
|
942 + | ::pretty_assertions::assert_eq!(
|
943 + | input.integer,
|
944 + | expected.integer,
|
945 + | "Unexpected value for `integer`"
|
946 + | );
|
947 + | ::pretty_assertions::assert_eq!(
|
948 + | input.iso8601_timestamp,
|
949 + | expected.iso8601_timestamp,
|
950 + | "Unexpected value for `iso8601_timestamp`"
|
951 + | );
|
952 + | ::pretty_assertions::assert_eq!(
|
953 + | input.json_value,
|
954 + | expected.json_value,
|
955 + | "Unexpected value for `json_value`"
|
956 + | );
|
957 + | ::pretty_assertions::assert_eq!(
|
958 + | input.list_of_lists,
|
959 + | expected.list_of_lists,
|
960 + | "Unexpected value for `list_of_lists`"
|
961 + | );
|
962 + | ::pretty_assertions::assert_eq!(
|
963 + | input.list_of_maps_of_strings,
|
964 + | expected.list_of_maps_of_strings,
|
965 + | "Unexpected value for `list_of_maps_of_strings`"
|
966 + | );
|
967 + | ::pretty_assertions::assert_eq!(
|
968 + | input.list_of_strings,
|
969 + | expected.list_of_strings,
|
970 + | "Unexpected value for `list_of_strings`"
|
971 + | );
|
972 + | ::pretty_assertions::assert_eq!(
|
973 + | input.list_of_structs,
|
974 + | expected.list_of_structs,
|
975 + | "Unexpected value for `list_of_structs`"
|
976 + | );
|
977 + | ::pretty_assertions::assert_eq!(
|
978 + | input.long,
|
979 + | expected.long,
|
980 + | "Unexpected value for `long`"
|
981 + | );
|
982 + | ::pretty_assertions::assert_eq!(
|
983 + | input.map_of_lists_of_strings,
|
984 + | expected.map_of_lists_of_strings,
|
985 + | "Unexpected value for `map_of_lists_of_strings`"
|
986 + | );
|
987 + | ::pretty_assertions::assert_eq!(
|
988 + | input.map_of_maps,
|
989 + | expected.map_of_maps,
|
990 + | "Unexpected value for `map_of_maps`"
|
991 + | );
|
992 + | ::pretty_assertions::assert_eq!(
|
993 + | input.map_of_strings,
|
994 + | expected.map_of_strings,
|
995 + | "Unexpected value for `map_of_strings`"
|
996 + | );
|
997 + | ::pretty_assertions::assert_eq!(
|
998 + | input.map_of_structs,
|
999 + | expected.map_of_structs,
|
1000 + | "Unexpected value for `map_of_structs`"
|
1001 + | );
|
1002 + | ::pretty_assertions::assert_eq!(
|
1003 + | input.recursive_list,
|
1004 + | expected.recursive_list,
|
1005 + | "Unexpected value for `recursive_list`"
|
1006 + | );
|
1007 + | ::pretty_assertions::assert_eq!(
|
1008 + | input.recursive_map,
|
1009 + | expected.recursive_map,
|
1010 + | "Unexpected value for `recursive_map`"
|
1011 + | );
|
1012 + | ::pretty_assertions::assert_eq!(
|
1013 + | input.recursive_struct,
|
1014 + | expected.recursive_struct,
|
1015 + | "Unexpected value for `recursive_struct`"
|
1016 + | );
|
1017 + | ::pretty_assertions::assert_eq!(
|
1018 + | input.simple_struct,
|
1019 + | expected.simple_struct,
|
1020 + | "Unexpected value for `simple_struct`"
|
1021 + | );
|
1022 + | ::pretty_assertions::assert_eq!(
|
1023 + | input.string,
|
1024 + | expected.string,
|
1025 + | "Unexpected value for `string`"
|
1026 + | );
|
1027 + | ::pretty_assertions::assert_eq!(
|
1028 + | input.struct_with_json_name,
|
1029 + | expected.struct_with_json_name,
|
1030 + | "Unexpected value for `struct_with_json_name`"
|
1031 + | );
|
1032 + | ::pretty_assertions::assert_eq!(
|
1033 + | input.timestamp,
|
1034 + | expected.timestamp,
|
1035 + | "Unexpected value for `timestamp`"
|
1036 + | );
|
1037 + | ::pretty_assertions::assert_eq!(
|
1038 + | input.unix_timestamp,
|
1039 + | expected.unix_timestamp,
|
1040 + | "Unexpected value for `unix_timestamp`"
|
1041 + | );
|
1042 + | let output = crate::output::KitchenSinkOperationOutput {
|
1043 + | blob: ::std::option::Option::None,
|
1044 + | boolean: ::std::option::Option::None,
|
1045 + | double: ::std::option::Option::None,
|
1046 + | empty_struct: ::std::option::Option::None,
|
1047 + | float: ::std::option::Option::None,
|
1048 + | httpdate_timestamp: ::std::option::Option::None,
|
1049 + | integer: ::std::option::Option::None,
|
1050 + | iso8601_timestamp: ::std::option::Option::None,
|
1051 + | json_value: ::std::option::Option::None,
|
1052 + | list_of_lists: ::std::option::Option::None,
|
1053 + | list_of_maps_of_strings: ::std::option::Option::None,
|
1054 + | list_of_strings: ::std::option::Option::None,
|
1055 + | list_of_structs: ::std::option::Option::None,
|
1056 + | long: ::std::option::Option::None,
|
1057 + | map_of_lists_of_strings: ::std::option::Option::None,
|
1058 + | map_of_maps: ::std::option::Option::None,
|
1059 + | map_of_strings: ::std::option::Option::None,
|
1060 + | map_of_structs: ::std::option::Option::None,
|
1061 + | recursive_list: ::std::option::Option::None,
|
1062 + | recursive_map: ::std::option::Option::None,
|
1063 + | recursive_struct: ::std::option::Option::None,
|
1064 + | simple_struct: ::std::option::Option::None,
|
1065 + | string: ::std::option::Option::None,
|
1066 + | struct_with_json_name: ::std::option::Option::None,
|
1067 + | timestamp: ::std::option::Option::None,
|
1068 + | unix_timestamp: ::std::option::Option::None,
|
1137 1069 | };
|
1138 1070 | Ok(output)
|
1139 1071 | };
|
1140 1072 | sender.send(()).await.expect("receiver dropped early");
|
1141 1073 | result
|
1142 1074 | }
|
1143 1075 | })
|
1144 1076 | .build_unchecked();
|
1145 1077 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1146 1078 | .await
|
1147 1079 | .expect("unable to make an HTTP request");
|
1148 1080 | assert!(
|
1149 1081 | receiver.recv().await.is_some(),
|
1150 1082 | "we expected operation handler to be invoked but it was not entered"
|
1151 1083 | );
|
1152 1084 | }
|
1153 1085 |
|
1154 - | /// Serializes a list union value
|
1155 - | /// Test ID: AwsJson11SerializeListUnionValue
|
1086 + | /// Serializes long shapes
|
1087 + | /// Test ID: serializes_long_shapes
|
1156 1088 | #[::tokio::test]
|
1157 1089 | #[::tracing_test::traced_test]
|
1158 - | async fn aws_json11_serialize_list_union_value_request() {
|
1090 + | async fn serializes_long_shapes_request() {
|
1159 1091 | #[allow(unused_mut)]
|
1160 1092 | let mut http_request = ::http::Request::builder()
|
1161 1093 | .uri("/")
|
1162 1094 | .method("POST")
|
1163 1095 | .header("Content-Type", "application/x-amz-json-1.1")
|
1164 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
1096 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
1165 1097 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1166 1098 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1167 - | "{\n \"contents\": {\n \"listValue\": [\"foo\", \"bar\"]\n }\n}"
|
1168 - | .as_bytes(),
|
1099 + | "{\"Long\":999999999999}".as_bytes(),
|
1169 1100 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1170 1101 | )),
|
1171 1102 | ))
|
1172 1103 | .unwrap();
|
1173 1104 | #[allow(unused_mut)]
|
1174 1105 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1175 1106 | let config = crate::service::JsonProtocolConfig::builder().build();
|
1176 1107 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1177 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1108 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
1178 1109 | let sender = sender.clone();
|
1179 1110 | async move {
|
1180 1111 | let result = {
|
1181 - | let expected = crate::input::JsonUnionsInput {
|
1182 - | contents: ::std::option::Option::Some(
|
1183 - | crate::model::MyUnion::ListValue(vec![
|
1184 - | "foo".to_owned(),
|
1185 - | "bar".to_owned(),
|
1186 - | ]),
|
1187 - | ),
|
1188 - | };
|
1189 - | ::pretty_assertions::assert_eq!(input, expected);
|
1190 - | let output = crate::output::JsonUnionsOutput {
|
1191 - | contents: ::std::option::Option::None,
|
1112 + | use ::aws_smithy_protocol_test::FloatEquals;
|
1113 + | let expected = crate::input::KitchenSinkOperationInput {
|
1114 + | long: ::std::option::Option::Some(999999999999),
|
1115 + | blob: ::std::option::Option::None,
|
1116 + | boolean: ::std::option::Option::None,
|
1117 + | double: ::std::option::Option::None,
|
1118 + | empty_struct: ::std::option::Option::None,
|
1119 + | float: ::std::option::Option::None,
|
1120 + | httpdate_timestamp: ::std::option::Option::None,
|
1121 + | integer: ::std::option::Option::None,
|
1122 + | iso8601_timestamp: ::std::option::Option::None,
|
1123 + | json_value: ::std::option::Option::None,
|
1124 + | list_of_lists: ::std::option::Option::None,
|
1125 + | list_of_maps_of_strings: ::std::option::Option::None,
|
1126 + | list_of_strings: ::std::option::Option::None,
|
1127 + | list_of_structs: ::std::option::Option::None,
|
1128 + | map_of_lists_of_strings: ::std::option::Option::None,
|
1129 + | map_of_maps: ::std::option::Option::None,
|
1130 + | map_of_strings: ::std::option::Option::None,
|
1131 + | map_of_structs: ::std::option::Option::None,
|
1132 + | recursive_list: ::std::option::Option::None,
|
1133 + | recursive_map: ::std::option::Option::None,
|
1134 + | recursive_struct: ::std::option::Option::None,
|
1135 + | simple_struct: ::std::option::Option::None,
|
1136 + | string: ::std::option::Option::None,
|
1137 + | struct_with_json_name: ::std::option::Option::None,
|
1138 + | timestamp: ::std::option::Option::None,
|
1139 + | unix_timestamp: ::std::option::Option::None,
|
1192 1140 | };
|
1193 - | Ok(output)
|
1194 - | };
|
1195 - | sender.send(()).await.expect("receiver dropped early");
|
1196 - | result
|
1197 - | }
|
1198 - | })
|
1199 - | .build_unchecked();
|
1200 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1201 - | .await
|
1202 - | .expect("unable to make an HTTP request");
|
1203 - | assert!(
|
1204 - | receiver.recv().await.is_some(),
|
1205 - | "we expected operation handler to be invoked but it was not entered"
|
1206 - | );
|
1207 - | }
|
1208 - |
|
1209 - | /// Serializes a map union value
|
1210 - | /// Test ID: AwsJson11SerializeMapUnionValue
|
1211 - | #[::tokio::test]
|
1212 - | #[::tracing_test::traced_test]
|
1213 - | async fn aws_json11_serialize_map_union_value_request() {
|
1214 - | #[allow(unused_mut)]
|
1215 - | let mut http_request = ::http::Request::builder()
|
1216 - | .uri("/")
|
1217 - | .method("POST")
|
1218 - | .header("Content-Type", "application/x-amz-json-1.1")
|
1219 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
1220 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1221 - | ::bytes::Bytes::copy_from_slice(
|
1222 - | &::aws_smithy_protocol_test::decode_body_data("{\n \"contents\": {\n \"mapValue\": {\n \"foo\": \"bar\",\n \"spam\": \"eggs\"\n }\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1223 - | )
|
1224 - | )).unwrap();
|
1225 - | #[allow(unused_mut)]
|
1226 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1227 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
1228 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1229 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1230 - | let sender = sender.clone();
|
1231 - | async move {
|
1232 - | let result = {
|
1233 - | let expected = crate::input::JsonUnionsInput {
|
1234 - | contents: ::std::option::Option::Some(crate::model::MyUnion::MapValue(
|
1235 - | {
|
1236 - | let mut ret = ::std::collections::HashMap::new();
|
1237 - | ret.insert("foo".to_owned(), "bar".to_owned());
|
1238 - | ret.insert("spam".to_owned(), "eggs".to_owned());
|
1239 - | ret
|
1240 - | },
|
1241 - | )),
|
1242 - | };
|
1243 - | ::pretty_assertions::assert_eq!(input, expected);
|
1244 - | let output = crate::output::JsonUnionsOutput {
|
1245 - | contents: ::std::option::Option::None,
|
1141 + | ::pretty_assertions::assert_eq!(
|
1142 + | input.blob,
|
1143 + | expected.blob,
|
1144 + | "Unexpected value for `blob`"
|
1145 + | );
|
1146 + | ::pretty_assertions::assert_eq!(
|
1147 + | input.boolean,
|
1148 + | expected.boolean,
|
1149 + | "Unexpected value for `boolean`"
|
1150 + | );
|
1151 + | assert!(
|
1152 + | input.double.float_equals(&expected.double),
|
1153 + | "Unexpected value for `double` {:?} vs. {:?}",
|
1154 + | expected.double,
|
1155 + | input.double
|
1156 + | );
|
1157 + | ::pretty_assertions::assert_eq!(
|
1158 + | input.empty_struct,
|
1159 + | expected.empty_struct,
|
1160 + | "Unexpected value for `empty_struct`"
|
1161 + | );
|
1162 + | assert!(
|
1163 + | input.float.float_equals(&expected.float),
|
1164 + | "Unexpected value for `float` {:?} vs. {:?}",
|
1165 + | expected.float,
|
1166 + | input.float
|
1167 + | );
|
1168 + | ::pretty_assertions::assert_eq!(
|
1169 + | input.httpdate_timestamp,
|
1170 + | expected.httpdate_timestamp,
|
1171 + | "Unexpected value for `httpdate_timestamp`"
|
1172 + | );
|
1173 + | ::pretty_assertions::assert_eq!(
|
1174 + | input.integer,
|
1175 + | expected.integer,
|
1176 + | "Unexpected value for `integer`"
|
1177 + | );
|
1178 + | ::pretty_assertions::assert_eq!(
|
1179 + | input.iso8601_timestamp,
|
1180 + | expected.iso8601_timestamp,
|
1181 + | "Unexpected value for `iso8601_timestamp`"
|
1182 + | );
|
1183 + | ::pretty_assertions::assert_eq!(
|
1184 + | input.json_value,
|
1185 + | expected.json_value,
|
1186 + | "Unexpected value for `json_value`"
|
1187 + | );
|
1188 + | ::pretty_assertions::assert_eq!(
|
1189 + | input.list_of_lists,
|
1190 + | expected.list_of_lists,
|
1191 + | "Unexpected value for `list_of_lists`"
|
1192 + | );
|
1193 + | ::pretty_assertions::assert_eq!(
|
1194 + | input.list_of_maps_of_strings,
|
1195 + | expected.list_of_maps_of_strings,
|
1196 + | "Unexpected value for `list_of_maps_of_strings`"
|
1197 + | );
|
1198 + | ::pretty_assertions::assert_eq!(
|
1199 + | input.list_of_strings,
|
1200 + | expected.list_of_strings,
|
1201 + | "Unexpected value for `list_of_strings`"
|
1202 + | );
|
1203 + | ::pretty_assertions::assert_eq!(
|
1204 + | input.list_of_structs,
|
1205 + | expected.list_of_structs,
|
1206 + | "Unexpected value for `list_of_structs`"
|
1207 + | );
|
1208 + | ::pretty_assertions::assert_eq!(
|
1209 + | input.long,
|
1210 + | expected.long,
|
1211 + | "Unexpected value for `long`"
|
1212 + | );
|
1213 + | ::pretty_assertions::assert_eq!(
|
1214 + | input.map_of_lists_of_strings,
|
1215 + | expected.map_of_lists_of_strings,
|
1216 + | "Unexpected value for `map_of_lists_of_strings`"
|
1217 + | );
|
1218 + | ::pretty_assertions::assert_eq!(
|
1219 + | input.map_of_maps,
|
1220 + | expected.map_of_maps,
|
1221 + | "Unexpected value for `map_of_maps`"
|
1222 + | );
|
1223 + | ::pretty_assertions::assert_eq!(
|
1224 + | input.map_of_strings,
|
1225 + | expected.map_of_strings,
|
1226 + | "Unexpected value for `map_of_strings`"
|
1227 + | );
|
1228 + | ::pretty_assertions::assert_eq!(
|
1229 + | input.map_of_structs,
|
1230 + | expected.map_of_structs,
|
1231 + | "Unexpected value for `map_of_structs`"
|
1232 + | );
|
1233 + | ::pretty_assertions::assert_eq!(
|
1234 + | input.recursive_list,
|
1235 + | expected.recursive_list,
|
1236 + | "Unexpected value for `recursive_list`"
|
1237 + | );
|
1238 + | ::pretty_assertions::assert_eq!(
|
1239 + | input.recursive_map,
|
1240 + | expected.recursive_map,
|
1241 + | "Unexpected value for `recursive_map`"
|
1242 + | );
|
1243 + | ::pretty_assertions::assert_eq!(
|
1244 + | input.recursive_struct,
|
1245 + | expected.recursive_struct,
|
1246 + | "Unexpected value for `recursive_struct`"
|
1247 + | );
|
1248 + | ::pretty_assertions::assert_eq!(
|
1249 + | input.simple_struct,
|
1250 + | expected.simple_struct,
|
1251 + | "Unexpected value for `simple_struct`"
|
1252 + | );
|
1253 + | ::pretty_assertions::assert_eq!(
|
1254 + | input.string,
|
1255 + | expected.string,
|
1256 + | "Unexpected value for `string`"
|
1257 + | );
|
1258 + | ::pretty_assertions::assert_eq!(
|
1259 + | input.struct_with_json_name,
|
1260 + | expected.struct_with_json_name,
|
1261 + | "Unexpected value for `struct_with_json_name`"
|
1262 + | );
|
1263 + | ::pretty_assertions::assert_eq!(
|
1264 + | input.timestamp,
|
1265 + | expected.timestamp,
|
1266 + | "Unexpected value for `timestamp`"
|
1267 + | );
|
1268 + | ::pretty_assertions::assert_eq!(
|
1269 + | input.unix_timestamp,
|
1270 + | expected.unix_timestamp,
|
1271 + | "Unexpected value for `unix_timestamp`"
|
1272 + | );
|
1273 + | let output = crate::output::KitchenSinkOperationOutput {
|
1274 + | blob: ::std::option::Option::None,
|
1275 + | boolean: ::std::option::Option::None,
|
1276 + | double: ::std::option::Option::None,
|
1277 + | empty_struct: ::std::option::Option::None,
|
1278 + | float: ::std::option::Option::None,
|
1279 + | httpdate_timestamp: ::std::option::Option::None,
|
1280 + | integer: ::std::option::Option::None,
|
1281 + | iso8601_timestamp: ::std::option::Option::None,
|
1282 + | json_value: ::std::option::Option::None,
|
1283 + | list_of_lists: ::std::option::Option::None,
|
1284 + | list_of_maps_of_strings: ::std::option::Option::None,
|
1285 + | list_of_strings: ::std::option::Option::None,
|
1286 + | list_of_structs: ::std::option::Option::None,
|
1287 + | long: ::std::option::Option::None,
|
1288 + | map_of_lists_of_strings: ::std::option::Option::None,
|
1289 + | map_of_maps: ::std::option::Option::None,
|
1290 + | map_of_strings: ::std::option::Option::None,
|
1291 + | map_of_structs: ::std::option::Option::None,
|
1292 + | recursive_list: ::std::option::Option::None,
|
1293 + | recursive_map: ::std::option::Option::None,
|
1294 + | recursive_struct: ::std::option::Option::None,
|
1295 + | simple_struct: ::std::option::Option::None,
|
1296 + | string: ::std::option::Option::None,
|
1297 + | struct_with_json_name: ::std::option::Option::None,
|
1298 + | timestamp: ::std::option::Option::None,
|
1299 + | unix_timestamp: ::std::option::Option::None,
|
1246 1300 | };
|
1247 1301 | Ok(output)
|
1248 1302 | };
|
1249 1303 | sender.send(()).await.expect("receiver dropped early");
|
1250 1304 | result
|
1251 1305 | }
|
1252 1306 | })
|
1253 1307 | .build_unchecked();
|
1254 1308 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1255 1309 | .await
|
1256 1310 | .expect("unable to make an HTTP request");
|
1257 1311 | assert!(
|
1258 1312 | receiver.recv().await.is_some(),
|
1259 1313 | "we expected operation handler to be invoked but it was not entered"
|
1260 1314 | );
|
1261 1315 | }
|
1262 1316 |
|
1263 - | /// Serializes a structure union value
|
1264 - | /// Test ID: AwsJson11SerializeStructureUnionValue
|
1317 + | /// Serializes float shapes
|
1318 + | /// Test ID: serializes_float_shapes
|
1265 1319 | #[::tokio::test]
|
1266 1320 | #[::tracing_test::traced_test]
|
1267 - | async fn aws_json11_serialize_structure_union_value_request() {
|
1321 + | async fn serializes_float_shapes_request() {
|
1268 1322 | #[allow(unused_mut)]
|
1269 - | let mut http_request = ::http::Request::builder()
|
1270 - | .uri("/")
|
1271 - | .method("POST")
|
1272 - | .header("Content-Type", "application/x-amz-json-1.1")
|
1273 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
1274 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1275 - | ::bytes::Bytes::copy_from_slice(
|
1276 - | &::aws_smithy_protocol_test::decode_body_data("{\n \"contents\": {\n \"structureValue\": {\n \"hi\": \"hello\"\n }\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1277 - | )
|
1278 - | )).unwrap();
|
1323 + | let mut http_request = ::http::Request::builder()
|
1324 + | .uri("/")
|
1325 + | .method("POST")
|
1326 + | .header("Content-Type", "application/x-amz-json-1.1")
|
1327 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
1328 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1329 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1330 + | "{\"Float\":1234.5}".as_bytes(),
|
1331 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1332 + | )),
|
1333 + | ))
|
1334 + | .unwrap();
|
1279 1335 | #[allow(unused_mut)]
|
1280 1336 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1281 1337 | let config = crate::service::JsonProtocolConfig::builder().build();
|
1282 1338 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1283 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1339 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
1284 1340 | let sender = sender.clone();
|
1285 1341 | async move {
|
1286 1342 | let result = {
|
1287 - | let expected = crate::input::JsonUnionsInput {
|
1288 - | contents: ::std::option::Option::Some(
|
1289 - | crate::model::MyUnion::StructureValue(
|
1290 - | crate::model::GreetingStruct {
|
1291 - | hi: ::std::option::Option::Some("hello".to_owned()),
|
1292 - | },
|
1293 - | ),
|
1294 - | ),
|
1295 - | };
|
1296 - | ::pretty_assertions::assert_eq!(input, expected);
|
1297 - | let output = crate::output::JsonUnionsOutput {
|
1298 - | contents: ::std::option::Option::None,
|
1299 - | };
|
1300 - | Ok(output)
|
1301 - | };
|
1302 - | sender.send(()).await.expect("receiver dropped early");
|
1303 - | result
|
1304 - | }
|
1305 - | })
|
1306 - | .build_unchecked();
|
1307 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1308 - | .await
|
1309 - | .expect("unable to make an HTTP request");
|
1310 - | assert!(
|
1311 - | receiver.recv().await.is_some(),
|
1312 - | "we expected operation handler to be invoked but it was not entered"
|
1313 - | );
|
1314 - | }
|
1315 - |
|
1316 - | /// Deserializes a string union value
|
1317 - | /// Test ID: AwsJson11DeserializeStringUnionValue
|
1318 - | #[::tokio::test]
|
1319 - | #[::tracing_test::traced_test]
|
1320 - | async fn aws_json11_deserialize_string_union_value_response() {
|
1321 - | let output = crate::output::JsonUnionsOutput {
|
1322 - | contents: ::std::option::Option::Some(crate::model::MyUnion::StringValue(
|
1323 - | "foo".to_owned(),
|
1324 - | )),
|
1325 - | };
|
1326 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1327 - | let http_response = output.into_response();
|
1328 - | ::pretty_assertions::assert_eq!(
|
1329 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1330 - | http_response.status()
|
1331 - | );
|
1332 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1333 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1334 - | http_response.headers(),
|
1335 - | expected_headers,
|
1336 - | ));
|
1337 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1343 + | use ::aws_smithy_protocol_test::FloatEquals;
|
1344 + | let expected = crate::input::KitchenSinkOperationInput {
|
1345 + | float: ::std::option::Option::Some(1234.5_f32),
|
1346 + | blob: ::std::option::Option::None,
|
1347 + | boolean: ::std::option::Option::None,
|
1348 + | double: ::std::option::Option::None,
|
1349 + | empty_struct: ::std::option::Option::None,
|
1350 + | httpdate_timestamp: ::std::option::Option::None,
|
1351 + | integer: ::std::option::Option::None,
|
1352 + | iso8601_timestamp: ::std::option::Option::None,
|
1353 + | json_value: ::std::option::Option::None,
|
1354 + | list_of_lists: ::std::option::Option::None,
|
1355 + | list_of_maps_of_strings: ::std::option::Option::None,
|
1356 + | list_of_strings: ::std::option::Option::None,
|
1357 + | list_of_structs: ::std::option::Option::None,
|
1358 + | long: ::std::option::Option::None,
|
1359 + | map_of_lists_of_strings: ::std::option::Option::None,
|
1360 + | map_of_maps: ::std::option::Option::None,
|
1361 + | map_of_strings: ::std::option::Option::None,
|
1362 + | map_of_structs: ::std::option::Option::None,
|
1363 + | recursive_list: ::std::option::Option::None,
|
1364 + | recursive_map: ::std::option::Option::None,
|
1365 + | recursive_struct: ::std::option::Option::None,
|
1366 + | simple_struct: ::std::option::Option::None,
|
1367 + | string: ::std::option::Option::None,
|
1368 + | struct_with_json_name: ::std::option::Option::None,
|
1369 + | timestamp: ::std::option::Option::None,
|
1370 + | unix_timestamp: ::std::option::Option::None,
|
1371 + | };
|
1372 + | ::pretty_assertions::assert_eq!(
|
1373 + | input.blob,
|
1374 + | expected.blob,
|
1375 + | "Unexpected value for `blob`"
|
1376 + | );
|
1377 + | ::pretty_assertions::assert_eq!(
|
1378 + | input.boolean,
|
1379 + | expected.boolean,
|
1380 + | "Unexpected value for `boolean`"
|
1381 + | );
|
1382 + | assert!(
|
1383 + | input.double.float_equals(&expected.double),
|
1384 + | "Unexpected value for `double` {:?} vs. {:?}",
|
1385 + | expected.double,
|
1386 + | input.double
|
1387 + | );
|
1388 + | ::pretty_assertions::assert_eq!(
|
1389 + | input.empty_struct,
|
1390 + | expected.empty_struct,
|
1391 + | "Unexpected value for `empty_struct`"
|
1392 + | );
|
1393 + | assert!(
|
1394 + | input.float.float_equals(&expected.float),
|
1395 + | "Unexpected value for `float` {:?} vs. {:?}",
|
1396 + | expected.float,
|
1397 + | input.float
|
1398 + | );
|
1399 + | ::pretty_assertions::assert_eq!(
|
1400 + | input.httpdate_timestamp,
|
1401 + | expected.httpdate_timestamp,
|
1402 + | "Unexpected value for `httpdate_timestamp`"
|
1403 + | );
|
1404 + | ::pretty_assertions::assert_eq!(
|
1405 + | input.integer,
|
1406 + | expected.integer,
|
1407 + | "Unexpected value for `integer`"
|
1408 + | );
|
1409 + | ::pretty_assertions::assert_eq!(
|
1410 + | input.iso8601_timestamp,
|
1411 + | expected.iso8601_timestamp,
|
1412 + | "Unexpected value for `iso8601_timestamp`"
|
1413 + | );
|
1414 + | ::pretty_assertions::assert_eq!(
|
1415 + | input.json_value,
|
1416 + | expected.json_value,
|
1417 + | "Unexpected value for `json_value`"
|
1418 + | );
|
1419 + | ::pretty_assertions::assert_eq!(
|
1420 + | input.list_of_lists,
|
1421 + | expected.list_of_lists,
|
1422 + | "Unexpected value for `list_of_lists`"
|
1423 + | );
|
1424 + | ::pretty_assertions::assert_eq!(
|
1425 + | input.list_of_maps_of_strings,
|
1426 + | expected.list_of_maps_of_strings,
|
1427 + | "Unexpected value for `list_of_maps_of_strings`"
|
1428 + | );
|
1429 + | ::pretty_assertions::assert_eq!(
|
1430 + | input.list_of_strings,
|
1431 + | expected.list_of_strings,
|
1432 + | "Unexpected value for `list_of_strings`"
|
1433 + | );
|
1434 + | ::pretty_assertions::assert_eq!(
|
1435 + | input.list_of_structs,
|
1436 + | expected.list_of_structs,
|
1437 + | "Unexpected value for `list_of_structs`"
|
1438 + | );
|
1439 + | ::pretty_assertions::assert_eq!(
|
1440 + | input.long,
|
1441 + | expected.long,
|
1442 + | "Unexpected value for `long`"
|
1443 + | );
|
1444 + | ::pretty_assertions::assert_eq!(
|
1445 + | input.map_of_lists_of_strings,
|
1446 + | expected.map_of_lists_of_strings,
|
1447 + | "Unexpected value for `map_of_lists_of_strings`"
|
1448 + | );
|
1449 + | ::pretty_assertions::assert_eq!(
|
1450 + | input.map_of_maps,
|
1451 + | expected.map_of_maps,
|
1452 + | "Unexpected value for `map_of_maps`"
|
1453 + | );
|
1454 + | ::pretty_assertions::assert_eq!(
|
1455 + | input.map_of_strings,
|
1456 + | expected.map_of_strings,
|
1457 + | "Unexpected value for `map_of_strings`"
|
1458 + | );
|
1459 + | ::pretty_assertions::assert_eq!(
|
1460 + | input.map_of_structs,
|
1461 + | expected.map_of_structs,
|
1462 + | "Unexpected value for `map_of_structs`"
|
1463 + | );
|
1464 + | ::pretty_assertions::assert_eq!(
|
1465 + | input.recursive_list,
|
1466 + | expected.recursive_list,
|
1467 + | "Unexpected value for `recursive_list`"
|
1468 + | );
|
1469 + | ::pretty_assertions::assert_eq!(
|
1470 + | input.recursive_map,
|
1471 + | expected.recursive_map,
|
1472 + | "Unexpected value for `recursive_map`"
|
1473 + | );
|
1474 + | ::pretty_assertions::assert_eq!(
|
1475 + | input.recursive_struct,
|
1476 + | expected.recursive_struct,
|
1477 + | "Unexpected value for `recursive_struct`"
|
1478 + | );
|
1479 + | ::pretty_assertions::assert_eq!(
|
1480 + | input.simple_struct,
|
1481 + | expected.simple_struct,
|
1482 + | "Unexpected value for `simple_struct`"
|
1483 + | );
|
1484 + | ::pretty_assertions::assert_eq!(
|
1485 + | input.string,
|
1486 + | expected.string,
|
1487 + | "Unexpected value for `string`"
|
1488 + | );
|
1489 + | ::pretty_assertions::assert_eq!(
|
1490 + | input.struct_with_json_name,
|
1491 + | expected.struct_with_json_name,
|
1492 + | "Unexpected value for `struct_with_json_name`"
|
1493 + | );
|
1494 + | ::pretty_assertions::assert_eq!(
|
1495 + | input.timestamp,
|
1496 + | expected.timestamp,
|
1497 + | "Unexpected value for `timestamp`"
|
1498 + | );
|
1499 + | ::pretty_assertions::assert_eq!(
|
1500 + | input.unix_timestamp,
|
1501 + | expected.unix_timestamp,
|
1502 + | "Unexpected value for `unix_timestamp`"
|
1503 + | );
|
1504 + | let output = crate::output::KitchenSinkOperationOutput {
|
1505 + | blob: ::std::option::Option::None,
|
1506 + | boolean: ::std::option::Option::None,
|
1507 + | double: ::std::option::Option::None,
|
1508 + | empty_struct: ::std::option::Option::None,
|
1509 + | float: ::std::option::Option::None,
|
1510 + | httpdate_timestamp: ::std::option::Option::None,
|
1511 + | integer: ::std::option::Option::None,
|
1512 + | iso8601_timestamp: ::std::option::Option::None,
|
1513 + | json_value: ::std::option::Option::None,
|
1514 + | list_of_lists: ::std::option::Option::None,
|
1515 + | list_of_maps_of_strings: ::std::option::Option::None,
|
1516 + | list_of_strings: ::std::option::Option::None,
|
1517 + | list_of_structs: ::std::option::Option::None,
|
1518 + | long: ::std::option::Option::None,
|
1519 + | map_of_lists_of_strings: ::std::option::Option::None,
|
1520 + | map_of_maps: ::std::option::Option::None,
|
1521 + | map_of_strings: ::std::option::Option::None,
|
1522 + | map_of_structs: ::std::option::Option::None,
|
1523 + | recursive_list: ::std::option::Option::None,
|
1524 + | recursive_map: ::std::option::Option::None,
|
1525 + | recursive_struct: ::std::option::Option::None,
|
1526 + | simple_struct: ::std::option::Option::None,
|
1527 + | string: ::std::option::Option::None,
|
1528 + | struct_with_json_name: ::std::option::Option::None,
|
1529 + | timestamp: ::std::option::Option::None,
|
1530 + | unix_timestamp: ::std::option::Option::None,
|
1531 + | };
|
1532 + | Ok(output)
|
1533 + | };
|
1534 + | sender.send(()).await.expect("receiver dropped early");
|
1535 + | result
|
1536 + | }
|
1537 + | })
|
1538 + | .build_unchecked();
|
1539 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1338 1540 | .await
|
1339 - | .expect("unable to extract body to bytes");
|
1340 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1341 - | &body,
|
1342 - | "{\n \"contents\": {\n \"stringValue\": \"foo\"\n }\n}",
|
1343 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1344 - | ));
|
1541 + | .expect("unable to make an HTTP request");
|
1542 + | assert!(
|
1543 + | receiver.recv().await.is_some(),
|
1544 + | "we expected operation handler to be invoked but it was not entered"
|
1545 + | );
|
1345 1546 | }
|
1346 1547 |
|
1347 - | /// Deserializes a boolean union value
|
1348 - | /// Test ID: AwsJson11DeserializeBooleanUnionValue
|
1548 + | /// Serializes double shapes
|
1549 + | /// Test ID: serializes_double_shapes
|
1349 1550 | #[::tokio::test]
|
1350 1551 | #[::tracing_test::traced_test]
|
1351 - | async fn aws_json11_deserialize_boolean_union_value_response() {
|
1352 - | let output = crate::output::JsonUnionsOutput {
|
1353 - | contents: ::std::option::Option::Some(crate::model::MyUnion::BooleanValue(true)),
|
1354 - | };
|
1355 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1356 - | let http_response = output.into_response();
|
1357 - | ::pretty_assertions::assert_eq!(
|
1358 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1359 - | http_response.status()
|
1360 - | );
|
1361 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1362 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1363 - | http_response.headers(),
|
1364 - | expected_headers,
|
1365 - | ));
|
1366 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1367 - | .await
|
1368 - | .expect("unable to extract body to bytes");
|
1369 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1370 - | &body,
|
1371 - | "{\n \"contents\": {\n \"booleanValue\": true\n }\n}",
|
1372 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1373 - | ));
|
1552 + | async fn serializes_double_shapes_request() {
|
1553 + | #[allow(unused_mut)]
|
1554 + | let mut http_request = ::http::Request::builder()
|
1555 + | .uri("/")
|
1556 + | .method("POST")
|
1557 + | .header("Content-Type", "application/x-amz-json-1.1")
|
1558 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
1559 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1560 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1561 + | "{\"Double\":1234.5}".as_bytes(),
|
1562 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1563 + | )),
|
1564 + | ))
|
1565 + | .unwrap();
|
1566 + | #[allow(unused_mut)]
|
1567 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1568 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
1569 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1570 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
1571 + | let sender = sender.clone();
|
1572 + | async move {
|
1573 + | let result = {
|
1574 + | use ::aws_smithy_protocol_test::FloatEquals;
|
1575 + | let expected = crate::input::KitchenSinkOperationInput {
|
1576 + | double: ::std::option::Option::Some(1234.5_f64),
|
1577 + | blob: ::std::option::Option::None,
|
1578 + | boolean: ::std::option::Option::None,
|
1579 + | empty_struct: ::std::option::Option::None,
|
1580 + | float: ::std::option::Option::None,
|
1581 + | httpdate_timestamp: ::std::option::Option::None,
|
1582 + | integer: ::std::option::Option::None,
|
1583 + | iso8601_timestamp: ::std::option::Option::None,
|
1584 + | json_value: ::std::option::Option::None,
|
1585 + | list_of_lists: ::std::option::Option::None,
|
1586 + | list_of_maps_of_strings: ::std::option::Option::None,
|
1587 + | list_of_strings: ::std::option::Option::None,
|
1588 + | list_of_structs: ::std::option::Option::None,
|
1589 + | long: ::std::option::Option::None,
|
1590 + | map_of_lists_of_strings: ::std::option::Option::None,
|
1591 + | map_of_maps: ::std::option::Option::None,
|
1592 + | map_of_strings: ::std::option::Option::None,
|
1593 + | map_of_structs: ::std::option::Option::None,
|
1594 + | recursive_list: ::std::option::Option::None,
|
1595 + | recursive_map: ::std::option::Option::None,
|
1596 + | recursive_struct: ::std::option::Option::None,
|
1597 + | simple_struct: ::std::option::Option::None,
|
1598 + | string: ::std::option::Option::None,
|
1599 + | struct_with_json_name: ::std::option::Option::None,
|
1600 + | timestamp: ::std::option::Option::None,
|
1601 + | unix_timestamp: ::std::option::Option::None,
|
1602 + | };
|
1603 + | ::pretty_assertions::assert_eq!(
|
1604 + | input.blob,
|
1605 + | expected.blob,
|
1606 + | "Unexpected value for `blob`"
|
1607 + | );
|
1608 + | ::pretty_assertions::assert_eq!(
|
1609 + | input.boolean,
|
1610 + | expected.boolean,
|
1611 + | "Unexpected value for `boolean`"
|
1612 + | );
|
1613 + | assert!(
|
1614 + | input.double.float_equals(&expected.double),
|
1615 + | "Unexpected value for `double` {:?} vs. {:?}",
|
1616 + | expected.double,
|
1617 + | input.double
|
1618 + | );
|
1619 + | ::pretty_assertions::assert_eq!(
|
1620 + | input.empty_struct,
|
1621 + | expected.empty_struct,
|
1622 + | "Unexpected value for `empty_struct`"
|
1623 + | );
|
1624 + | assert!(
|
1625 + | input.float.float_equals(&expected.float),
|
1626 + | "Unexpected value for `float` {:?} vs. {:?}",
|
1627 + | expected.float,
|
1628 + | input.float
|
1629 + | );
|
1630 + | ::pretty_assertions::assert_eq!(
|
1631 + | input.httpdate_timestamp,
|
1632 + | expected.httpdate_timestamp,
|
1633 + | "Unexpected value for `httpdate_timestamp`"
|
1634 + | );
|
1635 + | ::pretty_assertions::assert_eq!(
|
1636 + | input.integer,
|
1637 + | expected.integer,
|
1638 + | "Unexpected value for `integer`"
|
1639 + | );
|
1640 + | ::pretty_assertions::assert_eq!(
|
1641 + | input.iso8601_timestamp,
|
1642 + | expected.iso8601_timestamp,
|
1643 + | "Unexpected value for `iso8601_timestamp`"
|
1644 + | );
|
1645 + | ::pretty_assertions::assert_eq!(
|
1646 + | input.json_value,
|
1647 + | expected.json_value,
|
1648 + | "Unexpected value for `json_value`"
|
1649 + | );
|
1650 + | ::pretty_assertions::assert_eq!(
|
1651 + | input.list_of_lists,
|
1652 + | expected.list_of_lists,
|
1653 + | "Unexpected value for `list_of_lists`"
|
1654 + | );
|
1655 + | ::pretty_assertions::assert_eq!(
|
1656 + | input.list_of_maps_of_strings,
|
1657 + | expected.list_of_maps_of_strings,
|
1658 + | "Unexpected value for `list_of_maps_of_strings`"
|
1659 + | );
|
1660 + | ::pretty_assertions::assert_eq!(
|
1661 + | input.list_of_strings,
|
1662 + | expected.list_of_strings,
|
1663 + | "Unexpected value for `list_of_strings`"
|
1664 + | );
|
1665 + | ::pretty_assertions::assert_eq!(
|
1666 + | input.list_of_structs,
|
1667 + | expected.list_of_structs,
|
1668 + | "Unexpected value for `list_of_structs`"
|
1669 + | );
|
1670 + | ::pretty_assertions::assert_eq!(
|
1671 + | input.long,
|
1672 + | expected.long,
|
1673 + | "Unexpected value for `long`"
|
1674 + | );
|
1675 + | ::pretty_assertions::assert_eq!(
|
1676 + | input.map_of_lists_of_strings,
|
1677 + | expected.map_of_lists_of_strings,
|
1678 + | "Unexpected value for `map_of_lists_of_strings`"
|
1679 + | );
|
1680 + | ::pretty_assertions::assert_eq!(
|
1681 + | input.map_of_maps,
|
1682 + | expected.map_of_maps,
|
1683 + | "Unexpected value for `map_of_maps`"
|
1684 + | );
|
1685 + | ::pretty_assertions::assert_eq!(
|
1686 + | input.map_of_strings,
|
1687 + | expected.map_of_strings,
|
1688 + | "Unexpected value for `map_of_strings`"
|
1689 + | );
|
1690 + | ::pretty_assertions::assert_eq!(
|
1691 + | input.map_of_structs,
|
1692 + | expected.map_of_structs,
|
1693 + | "Unexpected value for `map_of_structs`"
|
1694 + | );
|
1695 + | ::pretty_assertions::assert_eq!(
|
1696 + | input.recursive_list,
|
1697 + | expected.recursive_list,
|
1698 + | "Unexpected value for `recursive_list`"
|
1699 + | );
|
1700 + | ::pretty_assertions::assert_eq!(
|
1701 + | input.recursive_map,
|
1702 + | expected.recursive_map,
|
1703 + | "Unexpected value for `recursive_map`"
|
1704 + | );
|
1705 + | ::pretty_assertions::assert_eq!(
|
1706 + | input.recursive_struct,
|
1707 + | expected.recursive_struct,
|
1708 + | "Unexpected value for `recursive_struct`"
|
1709 + | );
|
1710 + | ::pretty_assertions::assert_eq!(
|
1711 + | input.simple_struct,
|
1712 + | expected.simple_struct,
|
1713 + | "Unexpected value for `simple_struct`"
|
1714 + | );
|
1715 + | ::pretty_assertions::assert_eq!(
|
1716 + | input.string,
|
1717 + | expected.string,
|
1718 + | "Unexpected value for `string`"
|
1719 + | );
|
1720 + | ::pretty_assertions::assert_eq!(
|
1721 + | input.struct_with_json_name,
|
1722 + | expected.struct_with_json_name,
|
1723 + | "Unexpected value for `struct_with_json_name`"
|
1724 + | );
|
1725 + | ::pretty_assertions::assert_eq!(
|
1726 + | input.timestamp,
|
1727 + | expected.timestamp,
|
1728 + | "Unexpected value for `timestamp`"
|
1729 + | );
|
1730 + | ::pretty_assertions::assert_eq!(
|
1731 + | input.unix_timestamp,
|
1732 + | expected.unix_timestamp,
|
1733 + | "Unexpected value for `unix_timestamp`"
|
1734 + | );
|
1735 + | let output = crate::output::KitchenSinkOperationOutput {
|
1736 + | blob: ::std::option::Option::None,
|
1737 + | boolean: ::std::option::Option::None,
|
1738 + | double: ::std::option::Option::None,
|
1739 + | empty_struct: ::std::option::Option::None,
|
1740 + | float: ::std::option::Option::None,
|
1741 + | httpdate_timestamp: ::std::option::Option::None,
|
1742 + | integer: ::std::option::Option::None,
|
1743 + | iso8601_timestamp: ::std::option::Option::None,
|
1744 + | json_value: ::std::option::Option::None,
|
1745 + | list_of_lists: ::std::option::Option::None,
|
1746 + | list_of_maps_of_strings: ::std::option::Option::None,
|
1747 + | list_of_strings: ::std::option::Option::None,
|
1748 + | list_of_structs: ::std::option::Option::None,
|
1749 + | long: ::std::option::Option::None,
|
1750 + | map_of_lists_of_strings: ::std::option::Option::None,
|
1751 + | map_of_maps: ::std::option::Option::None,
|
1752 + | map_of_strings: ::std::option::Option::None,
|
1753 + | map_of_structs: ::std::option::Option::None,
|
1754 + | recursive_list: ::std::option::Option::None,
|
1755 + | recursive_map: ::std::option::Option::None,
|
1756 + | recursive_struct: ::std::option::Option::None,
|
1757 + | simple_struct: ::std::option::Option::None,
|
1758 + | string: ::std::option::Option::None,
|
1759 + | struct_with_json_name: ::std::option::Option::None,
|
1760 + | timestamp: ::std::option::Option::None,
|
1761 + | unix_timestamp: ::std::option::Option::None,
|
1762 + | };
|
1763 + | Ok(output)
|
1764 + | };
|
1765 + | sender.send(()).await.expect("receiver dropped early");
|
1766 + | result
|
1767 + | }
|
1768 + | })
|
1769 + | .build_unchecked();
|
1770 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1771 + | .await
|
1772 + | .expect("unable to make an HTTP request");
|
1773 + | assert!(
|
1774 + | receiver.recv().await.is_some(),
|
1775 + | "we expected operation handler to be invoked but it was not entered"
|
1776 + | );
|
1374 1777 | }
|
1375 1778 |
|
1376 - | /// Deserializes a number union value
|
1377 - | /// Test ID: AwsJson11DeserializeNumberUnionValue
|
1779 + | /// Serializes blob shapes
|
1780 + | /// Test ID: serializes_blob_shapes
|
1378 1781 | #[::tokio::test]
|
1379 1782 | #[::tracing_test::traced_test]
|
1380 - | async fn aws_json11_deserialize_number_union_value_response() {
|
1381 - | let output = crate::output::JsonUnionsOutput {
|
1382 - | contents: ::std::option::Option::Some(crate::model::MyUnion::NumberValue(1)),
|
1383 - | };
|
1384 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1385 - | let http_response = output.into_response();
|
1386 - | ::pretty_assertions::assert_eq!(
|
1387 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1388 - | http_response.status()
|
1389 - | );
|
1390 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1391 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1392 - | http_response.headers(),
|
1393 - | expected_headers,
|
1394 - | ));
|
1395 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1396 - | .await
|
1397 - | .expect("unable to extract body to bytes");
|
1398 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1399 - | &body,
|
1400 - | "{\n \"contents\": {\n \"numberValue\": 1\n }\n}",
|
1401 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1402 - | ));
|
1783 + | async fn serializes_blob_shapes_request() {
|
1784 + | #[allow(unused_mut)]
|
1785 + | let mut http_request = ::http::Request::builder()
|
1786 + | .uri("/")
|
1787 + | .method("POST")
|
1788 + | .header("Content-Type", "application/x-amz-json-1.1")
|
1789 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
1790 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1791 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1792 + | "{\"Blob\":\"YmluYXJ5LXZhbHVl\"}".as_bytes(),
|
1793 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1794 + | )),
|
1795 + | ))
|
1796 + | .unwrap();
|
1797 + | #[allow(unused_mut)]
|
1798 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1799 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
1800 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1801 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
1802 + | let sender = sender.clone();
|
1803 + | async move {
|
1804 + | let result = {
|
1805 + | use ::aws_smithy_protocol_test::FloatEquals;
|
1806 + | let expected = crate::input::KitchenSinkOperationInput {
|
1807 + | blob: ::std::option::Option::Some(::aws_smithy_types::Blob::new(
|
1808 + | "binary-value",
|
1809 + | )),
|
1810 + | boolean: ::std::option::Option::None,
|
1811 + | double: ::std::option::Option::None,
|
1812 + | empty_struct: ::std::option::Option::None,
|
1813 + | float: ::std::option::Option::None,
|
1814 + | httpdate_timestamp: ::std::option::Option::None,
|
1815 + | integer: ::std::option::Option::None,
|
1816 + | iso8601_timestamp: ::std::option::Option::None,
|
1817 + | json_value: ::std::option::Option::None,
|
1818 + | list_of_lists: ::std::option::Option::None,
|
1819 + | list_of_maps_of_strings: ::std::option::Option::None,
|
1820 + | list_of_strings: ::std::option::Option::None,
|
1821 + | list_of_structs: ::std::option::Option::None,
|
1822 + | long: ::std::option::Option::None,
|
1823 + | map_of_lists_of_strings: ::std::option::Option::None,
|
1824 + | map_of_maps: ::std::option::Option::None,
|
1825 + | map_of_strings: ::std::option::Option::None,
|
1826 + | map_of_structs: ::std::option::Option::None,
|
1827 + | recursive_list: ::std::option::Option::None,
|
1828 + | recursive_map: ::std::option::Option::None,
|
1829 + | recursive_struct: ::std::option::Option::None,
|
1830 + | simple_struct: ::std::option::Option::None,
|
1831 + | string: ::std::option::Option::None,
|
1832 + | struct_with_json_name: ::std::option::Option::None,
|
1833 + | timestamp: ::std::option::Option::None,
|
1834 + | unix_timestamp: ::std::option::Option::None,
|
1835 + | };
|
1836 + | ::pretty_assertions::assert_eq!(
|
1837 + | input.blob,
|
1838 + | expected.blob,
|
1839 + | "Unexpected value for `blob`"
|
1840 + | );
|
1841 + | ::pretty_assertions::assert_eq!(
|
1842 + | input.boolean,
|
1843 + | expected.boolean,
|
1844 + | "Unexpected value for `boolean`"
|
1845 + | );
|
1846 + | assert!(
|
1847 + | input.double.float_equals(&expected.double),
|
1848 + | "Unexpected value for `double` {:?} vs. {:?}",
|
1849 + | expected.double,
|
1850 + | input.double
|
1851 + | );
|
1852 + | ::pretty_assertions::assert_eq!(
|
1853 + | input.empty_struct,
|
1854 + | expected.empty_struct,
|
1855 + | "Unexpected value for `empty_struct`"
|
1856 + | );
|
1857 + | assert!(
|
1858 + | input.float.float_equals(&expected.float),
|
1859 + | "Unexpected value for `float` {:?} vs. {:?}",
|
1860 + | expected.float,
|
1861 + | input.float
|
1862 + | );
|
1863 + | ::pretty_assertions::assert_eq!(
|
1864 + | input.httpdate_timestamp,
|
1865 + | expected.httpdate_timestamp,
|
1866 + | "Unexpected value for `httpdate_timestamp`"
|
1867 + | );
|
1868 + | ::pretty_assertions::assert_eq!(
|
1869 + | input.integer,
|
1870 + | expected.integer,
|
1871 + | "Unexpected value for `integer`"
|
1872 + | );
|
1873 + | ::pretty_assertions::assert_eq!(
|
1874 + | input.iso8601_timestamp,
|
1875 + | expected.iso8601_timestamp,
|
1876 + | "Unexpected value for `iso8601_timestamp`"
|
1877 + | );
|
1878 + | ::pretty_assertions::assert_eq!(
|
1879 + | input.json_value,
|
1880 + | expected.json_value,
|
1881 + | "Unexpected value for `json_value`"
|
1882 + | );
|
1883 + | ::pretty_assertions::assert_eq!(
|
1884 + | input.list_of_lists,
|
1885 + | expected.list_of_lists,
|
1886 + | "Unexpected value for `list_of_lists`"
|
1887 + | );
|
1888 + | ::pretty_assertions::assert_eq!(
|
1889 + | input.list_of_maps_of_strings,
|
1890 + | expected.list_of_maps_of_strings,
|
1891 + | "Unexpected value for `list_of_maps_of_strings`"
|
1892 + | );
|
1893 + | ::pretty_assertions::assert_eq!(
|
1894 + | input.list_of_strings,
|
1895 + | expected.list_of_strings,
|
1896 + | "Unexpected value for `list_of_strings`"
|
1897 + | );
|
1898 + | ::pretty_assertions::assert_eq!(
|
1899 + | input.list_of_structs,
|
1900 + | expected.list_of_structs,
|
1901 + | "Unexpected value for `list_of_structs`"
|
1902 + | );
|
1903 + | ::pretty_assertions::assert_eq!(
|
1904 + | input.long,
|
1905 + | expected.long,
|
1906 + | "Unexpected value for `long`"
|
1907 + | );
|
1908 + | ::pretty_assertions::assert_eq!(
|
1909 + | input.map_of_lists_of_strings,
|
1910 + | expected.map_of_lists_of_strings,
|
1911 + | "Unexpected value for `map_of_lists_of_strings`"
|
1912 + | );
|
1913 + | ::pretty_assertions::assert_eq!(
|
1914 + | input.map_of_maps,
|
1915 + | expected.map_of_maps,
|
1916 + | "Unexpected value for `map_of_maps`"
|
1917 + | );
|
1918 + | ::pretty_assertions::assert_eq!(
|
1919 + | input.map_of_strings,
|
1920 + | expected.map_of_strings,
|
1921 + | "Unexpected value for `map_of_strings`"
|
1922 + | );
|
1923 + | ::pretty_assertions::assert_eq!(
|
1924 + | input.map_of_structs,
|
1925 + | expected.map_of_structs,
|
1926 + | "Unexpected value for `map_of_structs`"
|
1927 + | );
|
1928 + | ::pretty_assertions::assert_eq!(
|
1929 + | input.recursive_list,
|
1930 + | expected.recursive_list,
|
1931 + | "Unexpected value for `recursive_list`"
|
1932 + | );
|
1933 + | ::pretty_assertions::assert_eq!(
|
1934 + | input.recursive_map,
|
1935 + | expected.recursive_map,
|
1936 + | "Unexpected value for `recursive_map`"
|
1937 + | );
|
1938 + | ::pretty_assertions::assert_eq!(
|
1939 + | input.recursive_struct,
|
1940 + | expected.recursive_struct,
|
1941 + | "Unexpected value for `recursive_struct`"
|
1942 + | );
|
1943 + | ::pretty_assertions::assert_eq!(
|
1944 + | input.simple_struct,
|
1945 + | expected.simple_struct,
|
1946 + | "Unexpected value for `simple_struct`"
|
1947 + | );
|
1948 + | ::pretty_assertions::assert_eq!(
|
1949 + | input.string,
|
1950 + | expected.string,
|
1951 + | "Unexpected value for `string`"
|
1952 + | );
|
1953 + | ::pretty_assertions::assert_eq!(
|
1954 + | input.struct_with_json_name,
|
1955 + | expected.struct_with_json_name,
|
1956 + | "Unexpected value for `struct_with_json_name`"
|
1957 + | );
|
1958 + | ::pretty_assertions::assert_eq!(
|
1959 + | input.timestamp,
|
1960 + | expected.timestamp,
|
1961 + | "Unexpected value for `timestamp`"
|
1962 + | );
|
1963 + | ::pretty_assertions::assert_eq!(
|
1964 + | input.unix_timestamp,
|
1965 + | expected.unix_timestamp,
|
1966 + | "Unexpected value for `unix_timestamp`"
|
1967 + | );
|
1968 + | let output = crate::output::KitchenSinkOperationOutput {
|
1969 + | blob: ::std::option::Option::None,
|
1970 + | boolean: ::std::option::Option::None,
|
1971 + | double: ::std::option::Option::None,
|
1972 + | empty_struct: ::std::option::Option::None,
|
1973 + | float: ::std::option::Option::None,
|
1974 + | httpdate_timestamp: ::std::option::Option::None,
|
1975 + | integer: ::std::option::Option::None,
|
1976 + | iso8601_timestamp: ::std::option::Option::None,
|
1977 + | json_value: ::std::option::Option::None,
|
1978 + | list_of_lists: ::std::option::Option::None,
|
1979 + | list_of_maps_of_strings: ::std::option::Option::None,
|
1980 + | list_of_strings: ::std::option::Option::None,
|
1981 + | list_of_structs: ::std::option::Option::None,
|
1982 + | long: ::std::option::Option::None,
|
1983 + | map_of_lists_of_strings: ::std::option::Option::None,
|
1984 + | map_of_maps: ::std::option::Option::None,
|
1985 + | map_of_strings: ::std::option::Option::None,
|
1986 + | map_of_structs: ::std::option::Option::None,
|
1987 + | recursive_list: ::std::option::Option::None,
|
1988 + | recursive_map: ::std::option::Option::None,
|
1989 + | recursive_struct: ::std::option::Option::None,
|
1990 + | simple_struct: ::std::option::Option::None,
|
1991 + | string: ::std::option::Option::None,
|
1992 + | struct_with_json_name: ::std::option::Option::None,
|
1993 + | timestamp: ::std::option::Option::None,
|
1994 + | unix_timestamp: ::std::option::Option::None,
|
1995 + | };
|
1996 + | Ok(output)
|
1997 + | };
|
1998 + | sender.send(()).await.expect("receiver dropped early");
|
1999 + | result
|
2000 + | }
|
2001 + | })
|
2002 + | .build_unchecked();
|
2003 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2004 + | .await
|
2005 + | .expect("unable to make an HTTP request");
|
2006 + | assert!(
|
2007 + | receiver.recv().await.is_some(),
|
2008 + | "we expected operation handler to be invoked but it was not entered"
|
2009 + | );
|
1403 2010 | }
|
1404 2011 |
|
1405 - | /// Deserializes a blob union value
|
1406 - | /// Test ID: AwsJson11DeserializeBlobUnionValue
|
2012 + | /// Serializes boolean shapes (true)
|
2013 + | /// Test ID: serializes_boolean_shapes_true
|
1407 2014 | #[::tokio::test]
|
1408 2015 | #[::tracing_test::traced_test]
|
1409 - | async fn aws_json11_deserialize_blob_union_value_response() {
|
1410 - | let output = crate::output::JsonUnionsOutput {
|
1411 - | contents: ::std::option::Option::Some(crate::model::MyUnion::BlobValue(
|
1412 - | ::aws_smithy_types::Blob::new("foo"),
|
1413 - | )),
|
1414 - | };
|
1415 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1416 - | let http_response = output.into_response();
|
1417 - | ::pretty_assertions::assert_eq!(
|
1418 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1419 - | http_response.status()
|
1420 - | );
|
1421 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1422 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1423 - | http_response.headers(),
|
1424 - | expected_headers,
|
1425 - | ));
|
1426 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1427 - | .await
|
1428 - | .expect("unable to extract body to bytes");
|
1429 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1430 - | &body,
|
1431 - | "{\n \"contents\": {\n \"blobValue\": \"Zm9v\"\n }\n}",
|
1432 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1433 - | ));
|
2016 + | async fn serializes_boolean_shapes_true_request() {
|
2017 + | #[allow(unused_mut)]
|
2018 + | let mut http_request = ::http::Request::builder()
|
2019 + | .uri("/")
|
2020 + | .method("POST")
|
2021 + | .header("Content-Type", "application/x-amz-json-1.1")
|
2022 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
2023 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2024 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2025 + | "{\"Boolean\":true}".as_bytes(),
|
2026 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2027 + | )),
|
2028 + | ))
|
2029 + | .unwrap();
|
2030 + | #[allow(unused_mut)]
|
2031 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2032 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
2033 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2034 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
2035 + | let sender = sender.clone();
|
2036 + | async move {
|
2037 + | let result = {
|
2038 + | use ::aws_smithy_protocol_test::FloatEquals;
|
2039 + | let expected = crate::input::KitchenSinkOperationInput {
|
2040 + | boolean: ::std::option::Option::Some(true),
|
2041 + | blob: ::std::option::Option::None,
|
2042 + | double: ::std::option::Option::None,
|
2043 + | empty_struct: ::std::option::Option::None,
|
2044 + | float: ::std::option::Option::None,
|
2045 + | httpdate_timestamp: ::std::option::Option::None,
|
2046 + | integer: ::std::option::Option::None,
|
2047 + | iso8601_timestamp: ::std::option::Option::None,
|
2048 + | json_value: ::std::option::Option::None,
|
2049 + | list_of_lists: ::std::option::Option::None,
|
2050 + | list_of_maps_of_strings: ::std::option::Option::None,
|
2051 + | list_of_strings: ::std::option::Option::None,
|
2052 + | list_of_structs: ::std::option::Option::None,
|
2053 + | long: ::std::option::Option::None,
|
2054 + | map_of_lists_of_strings: ::std::option::Option::None,
|
2055 + | map_of_maps: ::std::option::Option::None,
|
2056 + | map_of_strings: ::std::option::Option::None,
|
2057 + | map_of_structs: ::std::option::Option::None,
|
2058 + | recursive_list: ::std::option::Option::None,
|
2059 + | recursive_map: ::std::option::Option::None,
|
2060 + | recursive_struct: ::std::option::Option::None,
|
2061 + | simple_struct: ::std::option::Option::None,
|
2062 + | string: ::std::option::Option::None,
|
2063 + | struct_with_json_name: ::std::option::Option::None,
|
2064 + | timestamp: ::std::option::Option::None,
|
2065 + | unix_timestamp: ::std::option::Option::None,
|
2066 + | };
|
2067 + | ::pretty_assertions::assert_eq!(
|
2068 + | input.blob,
|
2069 + | expected.blob,
|
2070 + | "Unexpected value for `blob`"
|
2071 + | );
|
2072 + | ::pretty_assertions::assert_eq!(
|
2073 + | input.boolean,
|
2074 + | expected.boolean,
|
2075 + | "Unexpected value for `boolean`"
|
2076 + | );
|
2077 + | assert!(
|
2078 + | input.double.float_equals(&expected.double),
|
2079 + | "Unexpected value for `double` {:?} vs. {:?}",
|
2080 + | expected.double,
|
2081 + | input.double
|
2082 + | );
|
2083 + | ::pretty_assertions::assert_eq!(
|
2084 + | input.empty_struct,
|
2085 + | expected.empty_struct,
|
2086 + | "Unexpected value for `empty_struct`"
|
2087 + | );
|
2088 + | assert!(
|
2089 + | input.float.float_equals(&expected.float),
|
2090 + | "Unexpected value for `float` {:?} vs. {:?}",
|
2091 + | expected.float,
|
2092 + | input.float
|
2093 + | );
|
2094 + | ::pretty_assertions::assert_eq!(
|
2095 + | input.httpdate_timestamp,
|
2096 + | expected.httpdate_timestamp,
|
2097 + | "Unexpected value for `httpdate_timestamp`"
|
2098 + | );
|
2099 + | ::pretty_assertions::assert_eq!(
|
2100 + | input.integer,
|
2101 + | expected.integer,
|
2102 + | "Unexpected value for `integer`"
|
2103 + | );
|
2104 + | ::pretty_assertions::assert_eq!(
|
2105 + | input.iso8601_timestamp,
|
2106 + | expected.iso8601_timestamp,
|
2107 + | "Unexpected value for `iso8601_timestamp`"
|
2108 + | );
|
2109 + | ::pretty_assertions::assert_eq!(
|
2110 + | input.json_value,
|
2111 + | expected.json_value,
|
2112 + | "Unexpected value for `json_value`"
|
2113 + | );
|
2114 + | ::pretty_assertions::assert_eq!(
|
2115 + | input.list_of_lists,
|
2116 + | expected.list_of_lists,
|
2117 + | "Unexpected value for `list_of_lists`"
|
2118 + | );
|
2119 + | ::pretty_assertions::assert_eq!(
|
2120 + | input.list_of_maps_of_strings,
|
2121 + | expected.list_of_maps_of_strings,
|
2122 + | "Unexpected value for `list_of_maps_of_strings`"
|
2123 + | );
|
2124 + | ::pretty_assertions::assert_eq!(
|
2125 + | input.list_of_strings,
|
2126 + | expected.list_of_strings,
|
2127 + | "Unexpected value for `list_of_strings`"
|
2128 + | );
|
2129 + | ::pretty_assertions::assert_eq!(
|
2130 + | input.list_of_structs,
|
2131 + | expected.list_of_structs,
|
2132 + | "Unexpected value for `list_of_structs`"
|
2133 + | );
|
2134 + | ::pretty_assertions::assert_eq!(
|
2135 + | input.long,
|
2136 + | expected.long,
|
2137 + | "Unexpected value for `long`"
|
2138 + | );
|
2139 + | ::pretty_assertions::assert_eq!(
|
2140 + | input.map_of_lists_of_strings,
|
2141 + | expected.map_of_lists_of_strings,
|
2142 + | "Unexpected value for `map_of_lists_of_strings`"
|
2143 + | );
|
2144 + | ::pretty_assertions::assert_eq!(
|
2145 + | input.map_of_maps,
|
2146 + | expected.map_of_maps,
|
2147 + | "Unexpected value for `map_of_maps`"
|
2148 + | );
|
2149 + | ::pretty_assertions::assert_eq!(
|
2150 + | input.map_of_strings,
|
2151 + | expected.map_of_strings,
|
2152 + | "Unexpected value for `map_of_strings`"
|
2153 + | );
|
2154 + | ::pretty_assertions::assert_eq!(
|
2155 + | input.map_of_structs,
|
2156 + | expected.map_of_structs,
|
2157 + | "Unexpected value for `map_of_structs`"
|
2158 + | );
|
2159 + | ::pretty_assertions::assert_eq!(
|
2160 + | input.recursive_list,
|
2161 + | expected.recursive_list,
|
2162 + | "Unexpected value for `recursive_list`"
|
2163 + | );
|
2164 + | ::pretty_assertions::assert_eq!(
|
2165 + | input.recursive_map,
|
2166 + | expected.recursive_map,
|
2167 + | "Unexpected value for `recursive_map`"
|
2168 + | );
|
2169 + | ::pretty_assertions::assert_eq!(
|
2170 + | input.recursive_struct,
|
2171 + | expected.recursive_struct,
|
2172 + | "Unexpected value for `recursive_struct`"
|
2173 + | );
|
2174 + | ::pretty_assertions::assert_eq!(
|
2175 + | input.simple_struct,
|
2176 + | expected.simple_struct,
|
2177 + | "Unexpected value for `simple_struct`"
|
2178 + | );
|
2179 + | ::pretty_assertions::assert_eq!(
|
2180 + | input.string,
|
2181 + | expected.string,
|
2182 + | "Unexpected value for `string`"
|
2183 + | );
|
2184 + | ::pretty_assertions::assert_eq!(
|
2185 + | input.struct_with_json_name,
|
2186 + | expected.struct_with_json_name,
|
2187 + | "Unexpected value for `struct_with_json_name`"
|
2188 + | );
|
2189 + | ::pretty_assertions::assert_eq!(
|
2190 + | input.timestamp,
|
2191 + | expected.timestamp,
|
2192 + | "Unexpected value for `timestamp`"
|
2193 + | );
|
2194 + | ::pretty_assertions::assert_eq!(
|
2195 + | input.unix_timestamp,
|
2196 + | expected.unix_timestamp,
|
2197 + | "Unexpected value for `unix_timestamp`"
|
2198 + | );
|
2199 + | let output = crate::output::KitchenSinkOperationOutput {
|
2200 + | blob: ::std::option::Option::None,
|
2201 + | boolean: ::std::option::Option::None,
|
2202 + | double: ::std::option::Option::None,
|
2203 + | empty_struct: ::std::option::Option::None,
|
2204 + | float: ::std::option::Option::None,
|
2205 + | httpdate_timestamp: ::std::option::Option::None,
|
2206 + | integer: ::std::option::Option::None,
|
2207 + | iso8601_timestamp: ::std::option::Option::None,
|
2208 + | json_value: ::std::option::Option::None,
|
2209 + | list_of_lists: ::std::option::Option::None,
|
2210 + | list_of_maps_of_strings: ::std::option::Option::None,
|
2211 + | list_of_strings: ::std::option::Option::None,
|
2212 + | list_of_structs: ::std::option::Option::None,
|
2213 + | long: ::std::option::Option::None,
|
2214 + | map_of_lists_of_strings: ::std::option::Option::None,
|
2215 + | map_of_maps: ::std::option::Option::None,
|
2216 + | map_of_strings: ::std::option::Option::None,
|
2217 + | map_of_structs: ::std::option::Option::None,
|
2218 + | recursive_list: ::std::option::Option::None,
|
2219 + | recursive_map: ::std::option::Option::None,
|
2220 + | recursive_struct: ::std::option::Option::None,
|
2221 + | simple_struct: ::std::option::Option::None,
|
2222 + | string: ::std::option::Option::None,
|
2223 + | struct_with_json_name: ::std::option::Option::None,
|
2224 + | timestamp: ::std::option::Option::None,
|
2225 + | unix_timestamp: ::std::option::Option::None,
|
2226 + | };
|
2227 + | Ok(output)
|
2228 + | };
|
2229 + | sender.send(()).await.expect("receiver dropped early");
|
2230 + | result
|
2231 + | }
|
2232 + | })
|
2233 + | .build_unchecked();
|
2234 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2235 + | .await
|
2236 + | .expect("unable to make an HTTP request");
|
2237 + | assert!(
|
2238 + | receiver.recv().await.is_some(),
|
2239 + | "we expected operation handler to be invoked but it was not entered"
|
2240 + | );
|
1434 2241 | }
|
1435 2242 |
|
1436 - | /// Deserializes a timestamp union value
|
1437 - | /// Test ID: AwsJson11DeserializeTimestampUnionValue
|
2243 + | /// Serializes boolean shapes (false)
|
2244 + | /// Test ID: serializes_boolean_shapes_false
|
1438 2245 | #[::tokio::test]
|
1439 2246 | #[::tracing_test::traced_test]
|
1440 - | async fn aws_json11_deserialize_timestamp_union_value_response() {
|
1441 - | let output = crate::output::JsonUnionsOutput {
|
1442 - | contents: ::std::option::Option::Some(crate::model::MyUnion::TimestampValue(
|
1443 - | ::aws_smithy_types::DateTime::from_fractional_secs(1398796238, 0_f64),
|
1444 - | )),
|
1445 - | };
|
1446 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1447 - | let http_response = output.into_response();
|
1448 - | ::pretty_assertions::assert_eq!(
|
1449 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1450 - | http_response.status()
|
1451 - | );
|
1452 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1453 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1454 - | http_response.headers(),
|
1455 - | expected_headers,
|
1456 - | ));
|
1457 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1458 - | .await
|
1459 - | .expect("unable to extract body to bytes");
|
1460 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1461 - | &body,
|
1462 - | "{\n \"contents\": {\n \"timestampValue\": 1398796238\n }\n}",
|
1463 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1464 - | ));
|
1465 - | }
|
1466 - |
|
1467 - | /// Deserializes an enum union value
|
1468 - | /// Test ID: AwsJson11DeserializeEnumUnionValue
|
1469 - | #[::tokio::test]
|
1470 - | #[::tracing_test::traced_test]
|
1471 - | async fn aws_json11_deserialize_enum_union_value_response() {
|
1472 - | let output = crate::output::JsonUnionsOutput {
|
1473 - | contents: ::std::option::Option::Some(crate::model::MyUnion::EnumValue(
|
1474 - | "Foo"
|
1475 - | .parse::<crate::model::FooEnum>()
|
1476 - | .expect("static value validated to member"),
|
1477 - | )),
|
1478 - | };
|
1479 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1480 - | let http_response = output.into_response();
|
1481 - | ::pretty_assertions::assert_eq!(
|
1482 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1483 - | http_response.status()
|
1484 - | );
|
1485 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1486 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1487 - | http_response.headers(),
|
1488 - | expected_headers,
|
1489 - | ));
|
1490 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2247 + | async fn serializes_boolean_shapes_false_request() {
|
2248 + | #[allow(unused_mut)]
|
2249 + | let mut http_request = ::http::Request::builder()
|
2250 + | .uri("/")
|
2251 + | .method("POST")
|
2252 + | .header("Content-Type", "application/x-amz-json-1.1")
|
2253 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
2254 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2255 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2256 + | "{\"Boolean\":false}".as_bytes(),
|
2257 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2258 + | )),
|
2259 + | ))
|
2260 + | .unwrap();
|
2261 + | #[allow(unused_mut)]
|
2262 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2263 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
2264 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2265 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
2266 + | let sender = sender.clone();
|
2267 + | async move {
|
2268 + | let result = {
|
2269 + | use ::aws_smithy_protocol_test::FloatEquals;
|
2270 + | let expected = crate::input::KitchenSinkOperationInput {
|
2271 + | boolean: ::std::option::Option::Some(false),
|
2272 + | blob: ::std::option::Option::None,
|
2273 + | double: ::std::option::Option::None,
|
2274 + | empty_struct: ::std::option::Option::None,
|
2275 + | float: ::std::option::Option::None,
|
2276 + | httpdate_timestamp: ::std::option::Option::None,
|
2277 + | integer: ::std::option::Option::None,
|
2278 + | iso8601_timestamp: ::std::option::Option::None,
|
2279 + | json_value: ::std::option::Option::None,
|
2280 + | list_of_lists: ::std::option::Option::None,
|
2281 + | list_of_maps_of_strings: ::std::option::Option::None,
|
2282 + | list_of_strings: ::std::option::Option::None,
|
2283 + | list_of_structs: ::std::option::Option::None,
|
2284 + | long: ::std::option::Option::None,
|
2285 + | map_of_lists_of_strings: ::std::option::Option::None,
|
2286 + | map_of_maps: ::std::option::Option::None,
|
2287 + | map_of_strings: ::std::option::Option::None,
|
2288 + | map_of_structs: ::std::option::Option::None,
|
2289 + | recursive_list: ::std::option::Option::None,
|
2290 + | recursive_map: ::std::option::Option::None,
|
2291 + | recursive_struct: ::std::option::Option::None,
|
2292 + | simple_struct: ::std::option::Option::None,
|
2293 + | string: ::std::option::Option::None,
|
2294 + | struct_with_json_name: ::std::option::Option::None,
|
2295 + | timestamp: ::std::option::Option::None,
|
2296 + | unix_timestamp: ::std::option::Option::None,
|
2297 + | };
|
2298 + | ::pretty_assertions::assert_eq!(
|
2299 + | input.blob,
|
2300 + | expected.blob,
|
2301 + | "Unexpected value for `blob`"
|
2302 + | );
|
2303 + | ::pretty_assertions::assert_eq!(
|
2304 + | input.boolean,
|
2305 + | expected.boolean,
|
2306 + | "Unexpected value for `boolean`"
|
2307 + | );
|
2308 + | assert!(
|
2309 + | input.double.float_equals(&expected.double),
|
2310 + | "Unexpected value for `double` {:?} vs. {:?}",
|
2311 + | expected.double,
|
2312 + | input.double
|
2313 + | );
|
2314 + | ::pretty_assertions::assert_eq!(
|
2315 + | input.empty_struct,
|
2316 + | expected.empty_struct,
|
2317 + | "Unexpected value for `empty_struct`"
|
2318 + | );
|
2319 + | assert!(
|
2320 + | input.float.float_equals(&expected.float),
|
2321 + | "Unexpected value for `float` {:?} vs. {:?}",
|
2322 + | expected.float,
|
2323 + | input.float
|
2324 + | );
|
2325 + | ::pretty_assertions::assert_eq!(
|
2326 + | input.httpdate_timestamp,
|
2327 + | expected.httpdate_timestamp,
|
2328 + | "Unexpected value for `httpdate_timestamp`"
|
2329 + | );
|
2330 + | ::pretty_assertions::assert_eq!(
|
2331 + | input.integer,
|
2332 + | expected.integer,
|
2333 + | "Unexpected value for `integer`"
|
2334 + | );
|
2335 + | ::pretty_assertions::assert_eq!(
|
2336 + | input.iso8601_timestamp,
|
2337 + | expected.iso8601_timestamp,
|
2338 + | "Unexpected value for `iso8601_timestamp`"
|
2339 + | );
|
2340 + | ::pretty_assertions::assert_eq!(
|
2341 + | input.json_value,
|
2342 + | expected.json_value,
|
2343 + | "Unexpected value for `json_value`"
|
2344 + | );
|
2345 + | ::pretty_assertions::assert_eq!(
|
2346 + | input.list_of_lists,
|
2347 + | expected.list_of_lists,
|
2348 + | "Unexpected value for `list_of_lists`"
|
2349 + | );
|
2350 + | ::pretty_assertions::assert_eq!(
|
2351 + | input.list_of_maps_of_strings,
|
2352 + | expected.list_of_maps_of_strings,
|
2353 + | "Unexpected value for `list_of_maps_of_strings`"
|
2354 + | );
|
2355 + | ::pretty_assertions::assert_eq!(
|
2356 + | input.list_of_strings,
|
2357 + | expected.list_of_strings,
|
2358 + | "Unexpected value for `list_of_strings`"
|
2359 + | );
|
2360 + | ::pretty_assertions::assert_eq!(
|
2361 + | input.list_of_structs,
|
2362 + | expected.list_of_structs,
|
2363 + | "Unexpected value for `list_of_structs`"
|
2364 + | );
|
2365 + | ::pretty_assertions::assert_eq!(
|
2366 + | input.long,
|
2367 + | expected.long,
|
2368 + | "Unexpected value for `long`"
|
2369 + | );
|
2370 + | ::pretty_assertions::assert_eq!(
|
2371 + | input.map_of_lists_of_strings,
|
2372 + | expected.map_of_lists_of_strings,
|
2373 + | "Unexpected value for `map_of_lists_of_strings`"
|
2374 + | );
|
2375 + | ::pretty_assertions::assert_eq!(
|
2376 + | input.map_of_maps,
|
2377 + | expected.map_of_maps,
|
2378 + | "Unexpected value for `map_of_maps`"
|
2379 + | );
|
2380 + | ::pretty_assertions::assert_eq!(
|
2381 + | input.map_of_strings,
|
2382 + | expected.map_of_strings,
|
2383 + | "Unexpected value for `map_of_strings`"
|
2384 + | );
|
2385 + | ::pretty_assertions::assert_eq!(
|
2386 + | input.map_of_structs,
|
2387 + | expected.map_of_structs,
|
2388 + | "Unexpected value for `map_of_structs`"
|
2389 + | );
|
2390 + | ::pretty_assertions::assert_eq!(
|
2391 + | input.recursive_list,
|
2392 + | expected.recursive_list,
|
2393 + | "Unexpected value for `recursive_list`"
|
2394 + | );
|
2395 + | ::pretty_assertions::assert_eq!(
|
2396 + | input.recursive_map,
|
2397 + | expected.recursive_map,
|
2398 + | "Unexpected value for `recursive_map`"
|
2399 + | );
|
2400 + | ::pretty_assertions::assert_eq!(
|
2401 + | input.recursive_struct,
|
2402 + | expected.recursive_struct,
|
2403 + | "Unexpected value for `recursive_struct`"
|
2404 + | );
|
2405 + | ::pretty_assertions::assert_eq!(
|
2406 + | input.simple_struct,
|
2407 + | expected.simple_struct,
|
2408 + | "Unexpected value for `simple_struct`"
|
2409 + | );
|
2410 + | ::pretty_assertions::assert_eq!(
|
2411 + | input.string,
|
2412 + | expected.string,
|
2413 + | "Unexpected value for `string`"
|
2414 + | );
|
2415 + | ::pretty_assertions::assert_eq!(
|
2416 + | input.struct_with_json_name,
|
2417 + | expected.struct_with_json_name,
|
2418 + | "Unexpected value for `struct_with_json_name`"
|
2419 + | );
|
2420 + | ::pretty_assertions::assert_eq!(
|
2421 + | input.timestamp,
|
2422 + | expected.timestamp,
|
2423 + | "Unexpected value for `timestamp`"
|
2424 + | );
|
2425 + | ::pretty_assertions::assert_eq!(
|
2426 + | input.unix_timestamp,
|
2427 + | expected.unix_timestamp,
|
2428 + | "Unexpected value for `unix_timestamp`"
|
2429 + | );
|
2430 + | let output = crate::output::KitchenSinkOperationOutput {
|
2431 + | blob: ::std::option::Option::None,
|
2432 + | boolean: ::std::option::Option::None,
|
2433 + | double: ::std::option::Option::None,
|
2434 + | empty_struct: ::std::option::Option::None,
|
2435 + | float: ::std::option::Option::None,
|
2436 + | httpdate_timestamp: ::std::option::Option::None,
|
2437 + | integer: ::std::option::Option::None,
|
2438 + | iso8601_timestamp: ::std::option::Option::None,
|
2439 + | json_value: ::std::option::Option::None,
|
2440 + | list_of_lists: ::std::option::Option::None,
|
2441 + | list_of_maps_of_strings: ::std::option::Option::None,
|
2442 + | list_of_strings: ::std::option::Option::None,
|
2443 + | list_of_structs: ::std::option::Option::None,
|
2444 + | long: ::std::option::Option::None,
|
2445 + | map_of_lists_of_strings: ::std::option::Option::None,
|
2446 + | map_of_maps: ::std::option::Option::None,
|
2447 + | map_of_strings: ::std::option::Option::None,
|
2448 + | map_of_structs: ::std::option::Option::None,
|
2449 + | recursive_list: ::std::option::Option::None,
|
2450 + | recursive_map: ::std::option::Option::None,
|
2451 + | recursive_struct: ::std::option::Option::None,
|
2452 + | simple_struct: ::std::option::Option::None,
|
2453 + | string: ::std::option::Option::None,
|
2454 + | struct_with_json_name: ::std::option::Option::None,
|
2455 + | timestamp: ::std::option::Option::None,
|
2456 + | unix_timestamp: ::std::option::Option::None,
|
2457 + | };
|
2458 + | Ok(output)
|
2459 + | };
|
2460 + | sender.send(()).await.expect("receiver dropped early");
|
2461 + | result
|
2462 + | }
|
2463 + | })
|
2464 + | .build_unchecked();
|
2465 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1491 2466 | .await
|
1492 - | .expect("unable to extract body to bytes");
|
1493 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1494 - | &body,
|
1495 - | "{\n \"contents\": {\n \"enumValue\": \"Foo\"\n }\n}",
|
1496 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1497 - | ));
|
2467 + | .expect("unable to make an HTTP request");
|
2468 + | assert!(
|
2469 + | receiver.recv().await.is_some(),
|
2470 + | "we expected operation handler to be invoked but it was not entered"
|
2471 + | );
|
1498 2472 | }
|
1499 2473 |
|
1500 - | /// Deserializes a list union value
|
1501 - | /// Test ID: AwsJson11DeserializeListUnionValue
|
2474 + | /// Serializes timestamp shapes
|
2475 + | /// Test ID: serializes_timestamp_shapes
|
1502 2476 | #[::tokio::test]
|
1503 2477 | #[::tracing_test::traced_test]
|
1504 - | async fn aws_json11_deserialize_list_union_value_response() {
|
1505 - | let output = crate::output::JsonUnionsOutput {
|
1506 - | contents: ::std::option::Option::Some(crate::model::MyUnion::ListValue(vec![
|
1507 - | "foo".to_owned(),
|
1508 - | "bar".to_owned(),
|
1509 - | ])),
|
1510 - | };
|
1511 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1512 - | let http_response = output.into_response();
|
1513 - | ::pretty_assertions::assert_eq!(
|
1514 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1515 - | http_response.status()
|
1516 - | );
|
1517 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1518 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1519 - | http_response.headers(),
|
1520 - | expected_headers,
|
1521 - | ));
|
1522 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2478 + | async fn serializes_timestamp_shapes_request() {
|
2479 + | #[allow(unused_mut)]
|
2480 + | let mut http_request = ::http::Request::builder()
|
2481 + | .uri("/")
|
2482 + | .method("POST")
|
2483 + | .header("Content-Type", "application/x-amz-json-1.1")
|
2484 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
2485 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2486 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2487 + | "{\"Timestamp\":946845296}".as_bytes(),
|
2488 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2489 + | )),
|
2490 + | ))
|
2491 + | .unwrap();
|
2492 + | #[allow(unused_mut)]
|
2493 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2494 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
2495 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2496 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
2497 + | let sender = sender.clone();
|
2498 + | async move {
|
2499 + | let result = {
|
2500 + | use ::aws_smithy_protocol_test::FloatEquals;
|
2501 + | let expected = crate::input::KitchenSinkOperationInput {
|
2502 + | timestamp: ::std::option::Option::Some(
|
2503 + | ::aws_smithy_types::DateTime::from_fractional_secs(
|
2504 + | 946845296, 0_f64,
|
2505 + | ),
|
2506 + | ),
|
2507 + | blob: ::std::option::Option::None,
|
2508 + | boolean: ::std::option::Option::None,
|
2509 + | double: ::std::option::Option::None,
|
2510 + | empty_struct: ::std::option::Option::None,
|
2511 + | float: ::std::option::Option::None,
|
2512 + | httpdate_timestamp: ::std::option::Option::None,
|
2513 + | integer: ::std::option::Option::None,
|
2514 + | iso8601_timestamp: ::std::option::Option::None,
|
2515 + | json_value: ::std::option::Option::None,
|
2516 + | list_of_lists: ::std::option::Option::None,
|
2517 + | list_of_maps_of_strings: ::std::option::Option::None,
|
2518 + | list_of_strings: ::std::option::Option::None,
|
2519 + | list_of_structs: ::std::option::Option::None,
|
2520 + | long: ::std::option::Option::None,
|
2521 + | map_of_lists_of_strings: ::std::option::Option::None,
|
2522 + | map_of_maps: ::std::option::Option::None,
|
2523 + | map_of_strings: ::std::option::Option::None,
|
2524 + | map_of_structs: ::std::option::Option::None,
|
2525 + | recursive_list: ::std::option::Option::None,
|
2526 + | recursive_map: ::std::option::Option::None,
|
2527 + | recursive_struct: ::std::option::Option::None,
|
2528 + | simple_struct: ::std::option::Option::None,
|
2529 + | string: ::std::option::Option::None,
|
2530 + | struct_with_json_name: ::std::option::Option::None,
|
2531 + | unix_timestamp: ::std::option::Option::None,
|
2532 + | };
|
2533 + | ::pretty_assertions::assert_eq!(
|
2534 + | input.blob,
|
2535 + | expected.blob,
|
2536 + | "Unexpected value for `blob`"
|
2537 + | );
|
2538 + | ::pretty_assertions::assert_eq!(
|
2539 + | input.boolean,
|
2540 + | expected.boolean,
|
2541 + | "Unexpected value for `boolean`"
|
2542 + | );
|
2543 + | assert!(
|
2544 + | input.double.float_equals(&expected.double),
|
2545 + | "Unexpected value for `double` {:?} vs. {:?}",
|
2546 + | expected.double,
|
2547 + | input.double
|
2548 + | );
|
2549 + | ::pretty_assertions::assert_eq!(
|
2550 + | input.empty_struct,
|
2551 + | expected.empty_struct,
|
2552 + | "Unexpected value for `empty_struct`"
|
2553 + | );
|
2554 + | assert!(
|
2555 + | input.float.float_equals(&expected.float),
|
2556 + | "Unexpected value for `float` {:?} vs. {:?}",
|
2557 + | expected.float,
|
2558 + | input.float
|
2559 + | );
|
2560 + | ::pretty_assertions::assert_eq!(
|
2561 + | input.httpdate_timestamp,
|
2562 + | expected.httpdate_timestamp,
|
2563 + | "Unexpected value for `httpdate_timestamp`"
|
2564 + | );
|
2565 + | ::pretty_assertions::assert_eq!(
|
2566 + | input.integer,
|
2567 + | expected.integer,
|
2568 + | "Unexpected value for `integer`"
|
2569 + | );
|
2570 + | ::pretty_assertions::assert_eq!(
|
2571 + | input.iso8601_timestamp,
|
2572 + | expected.iso8601_timestamp,
|
2573 + | "Unexpected value for `iso8601_timestamp`"
|
2574 + | );
|
2575 + | ::pretty_assertions::assert_eq!(
|
2576 + | input.json_value,
|
2577 + | expected.json_value,
|
2578 + | "Unexpected value for `json_value`"
|
2579 + | );
|
2580 + | ::pretty_assertions::assert_eq!(
|
2581 + | input.list_of_lists,
|
2582 + | expected.list_of_lists,
|
2583 + | "Unexpected value for `list_of_lists`"
|
2584 + | );
|
2585 + | ::pretty_assertions::assert_eq!(
|
2586 + | input.list_of_maps_of_strings,
|
2587 + | expected.list_of_maps_of_strings,
|
2588 + | "Unexpected value for `list_of_maps_of_strings`"
|
2589 + | );
|
2590 + | ::pretty_assertions::assert_eq!(
|
2591 + | input.list_of_strings,
|
2592 + | expected.list_of_strings,
|
2593 + | "Unexpected value for `list_of_strings`"
|
2594 + | );
|
2595 + | ::pretty_assertions::assert_eq!(
|
2596 + | input.list_of_structs,
|
2597 + | expected.list_of_structs,
|
2598 + | "Unexpected value for `list_of_structs`"
|
2599 + | );
|
2600 + | ::pretty_assertions::assert_eq!(
|
2601 + | input.long,
|
2602 + | expected.long,
|
2603 + | "Unexpected value for `long`"
|
2604 + | );
|
2605 + | ::pretty_assertions::assert_eq!(
|
2606 + | input.map_of_lists_of_strings,
|
2607 + | expected.map_of_lists_of_strings,
|
2608 + | "Unexpected value for `map_of_lists_of_strings`"
|
2609 + | );
|
2610 + | ::pretty_assertions::assert_eq!(
|
2611 + | input.map_of_maps,
|
2612 + | expected.map_of_maps,
|
2613 + | "Unexpected value for `map_of_maps`"
|
2614 + | );
|
2615 + | ::pretty_assertions::assert_eq!(
|
2616 + | input.map_of_strings,
|
2617 + | expected.map_of_strings,
|
2618 + | "Unexpected value for `map_of_strings`"
|
2619 + | );
|
2620 + | ::pretty_assertions::assert_eq!(
|
2621 + | input.map_of_structs,
|
2622 + | expected.map_of_structs,
|
2623 + | "Unexpected value for `map_of_structs`"
|
2624 + | );
|
2625 + | ::pretty_assertions::assert_eq!(
|
2626 + | input.recursive_list,
|
2627 + | expected.recursive_list,
|
2628 + | "Unexpected value for `recursive_list`"
|
2629 + | );
|
2630 + | ::pretty_assertions::assert_eq!(
|
2631 + | input.recursive_map,
|
2632 + | expected.recursive_map,
|
2633 + | "Unexpected value for `recursive_map`"
|
2634 + | );
|
2635 + | ::pretty_assertions::assert_eq!(
|
2636 + | input.recursive_struct,
|
2637 + | expected.recursive_struct,
|
2638 + | "Unexpected value for `recursive_struct`"
|
2639 + | );
|
2640 + | ::pretty_assertions::assert_eq!(
|
2641 + | input.simple_struct,
|
2642 + | expected.simple_struct,
|
2643 + | "Unexpected value for `simple_struct`"
|
2644 + | );
|
2645 + | ::pretty_assertions::assert_eq!(
|
2646 + | input.string,
|
2647 + | expected.string,
|
2648 + | "Unexpected value for `string`"
|
2649 + | );
|
2650 + | ::pretty_assertions::assert_eq!(
|
2651 + | input.struct_with_json_name,
|
2652 + | expected.struct_with_json_name,
|
2653 + | "Unexpected value for `struct_with_json_name`"
|
2654 + | );
|
2655 + | ::pretty_assertions::assert_eq!(
|
2656 + | input.timestamp,
|
2657 + | expected.timestamp,
|
2658 + | "Unexpected value for `timestamp`"
|
2659 + | );
|
2660 + | ::pretty_assertions::assert_eq!(
|
2661 + | input.unix_timestamp,
|
2662 + | expected.unix_timestamp,
|
2663 + | "Unexpected value for `unix_timestamp`"
|
2664 + | );
|
2665 + | let output = crate::output::KitchenSinkOperationOutput {
|
2666 + | blob: ::std::option::Option::None,
|
2667 + | boolean: ::std::option::Option::None,
|
2668 + | double: ::std::option::Option::None,
|
2669 + | empty_struct: ::std::option::Option::None,
|
2670 + | float: ::std::option::Option::None,
|
2671 + | httpdate_timestamp: ::std::option::Option::None,
|
2672 + | integer: ::std::option::Option::None,
|
2673 + | iso8601_timestamp: ::std::option::Option::None,
|
2674 + | json_value: ::std::option::Option::None,
|
2675 + | list_of_lists: ::std::option::Option::None,
|
2676 + | list_of_maps_of_strings: ::std::option::Option::None,
|
2677 + | list_of_strings: ::std::option::Option::None,
|
2678 + | list_of_structs: ::std::option::Option::None,
|
2679 + | long: ::std::option::Option::None,
|
2680 + | map_of_lists_of_strings: ::std::option::Option::None,
|
2681 + | map_of_maps: ::std::option::Option::None,
|
2682 + | map_of_strings: ::std::option::Option::None,
|
2683 + | map_of_structs: ::std::option::Option::None,
|
2684 + | recursive_list: ::std::option::Option::None,
|
2685 + | recursive_map: ::std::option::Option::None,
|
2686 + | recursive_struct: ::std::option::Option::None,
|
2687 + | simple_struct: ::std::option::Option::None,
|
2688 + | string: ::std::option::Option::None,
|
2689 + | struct_with_json_name: ::std::option::Option::None,
|
2690 + | timestamp: ::std::option::Option::None,
|
2691 + | unix_timestamp: ::std::option::Option::None,
|
2692 + | };
|
2693 + | Ok(output)
|
2694 + | };
|
2695 + | sender.send(()).await.expect("receiver dropped early");
|
2696 + | result
|
2697 + | }
|
2698 + | })
|
2699 + | .build_unchecked();
|
2700 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1523 2701 | .await
|
1524 - | .expect("unable to extract body to bytes");
|
1525 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1526 - | &body,
|
1527 - | "{\n \"contents\": {\n \"listValue\": [\"foo\", \"bar\"]\n }\n}",
|
1528 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1529 - | ));
|
2702 + | .expect("unable to make an HTTP request");
|
2703 + | assert!(
|
2704 + | receiver.recv().await.is_some(),
|
2705 + | "we expected operation handler to be invoked but it was not entered"
|
2706 + | );
|
1530 2707 | }
|
1531 2708 |
|
1532 - | /// Deserializes a map union value
|
1533 - | /// Test ID: AwsJson11DeserializeMapUnionValue
|
2709 + | /// Serializes timestamp shapes with iso8601 timestampFormat
|
2710 + | /// Test ID: serializes_timestamp_shapes_with_iso8601_timestampformat
|
1534 2711 | #[::tokio::test]
|
1535 2712 | #[::tracing_test::traced_test]
|
1536 - | async fn aws_json11_deserialize_map_union_value_response() {
|
1537 - | let output = crate::output::JsonUnionsOutput {
|
1538 - | contents: ::std::option::Option::Some(crate::model::MyUnion::MapValue({
|
1539 - | let mut ret = ::std::collections::HashMap::new();
|
1540 - | ret.insert("foo".to_owned(), "bar".to_owned());
|
1541 - | ret.insert("spam".to_owned(), "eggs".to_owned());
|
1542 - | ret
|
1543 - | })),
|
1544 - | };
|
1545 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1546 - | let http_response = output.into_response();
|
1547 - | ::pretty_assertions::assert_eq!(
|
1548 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1549 - | http_response.status()
|
1550 - | );
|
1551 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1552 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1553 - | http_response.headers(),
|
1554 - | expected_headers,
|
1555 - | ));
|
1556 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2713 + | async fn serializes_timestamp_shapes_with_iso8601_timestampformat_request() {
|
2714 + | #[allow(unused_mut)]
|
2715 + | let mut http_request = ::http::Request::builder()
|
2716 + | .uri("/")
|
2717 + | .method("POST")
|
2718 + | .header("Content-Type", "application/x-amz-json-1.1")
|
2719 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
2720 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2721 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2722 + | "{\"Iso8601Timestamp\":\"2000-01-02T20:34:56Z\"}".as_bytes(),
|
2723 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2724 + | )),
|
2725 + | ))
|
2726 + | .unwrap();
|
2727 + | #[allow(unused_mut)]
|
2728 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2729 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
2730 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2731 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
2732 + | let sender = sender.clone();
|
2733 + | async move {
|
2734 + | let result = {
|
2735 + | use ::aws_smithy_protocol_test::FloatEquals;
|
2736 + | let expected = crate::input::KitchenSinkOperationInput {
|
2737 + | iso8601_timestamp: ::std::option::Option::Some(
|
2738 + | ::aws_smithy_types::DateTime::from_fractional_secs(
|
2739 + | 946845296, 0_f64,
|
2740 + | ),
|
2741 + | ),
|
2742 + | blob: ::std::option::Option::None,
|
2743 + | boolean: ::std::option::Option::None,
|
2744 + | double: ::std::option::Option::None,
|
2745 + | empty_struct: ::std::option::Option::None,
|
2746 + | float: ::std::option::Option::None,
|
2747 + | httpdate_timestamp: ::std::option::Option::None,
|
2748 + | integer: ::std::option::Option::None,
|
2749 + | json_value: ::std::option::Option::None,
|
2750 + | list_of_lists: ::std::option::Option::None,
|
2751 + | list_of_maps_of_strings: ::std::option::Option::None,
|
2752 + | list_of_strings: ::std::option::Option::None,
|
2753 + | list_of_structs: ::std::option::Option::None,
|
2754 + | long: ::std::option::Option::None,
|
2755 + | map_of_lists_of_strings: ::std::option::Option::None,
|
2756 + | map_of_maps: ::std::option::Option::None,
|
2757 + | map_of_strings: ::std::option::Option::None,
|
2758 + | map_of_structs: ::std::option::Option::None,
|
2759 + | recursive_list: ::std::option::Option::None,
|
2760 + | recursive_map: ::std::option::Option::None,
|
2761 + | recursive_struct: ::std::option::Option::None,
|
2762 + | simple_struct: ::std::option::Option::None,
|
2763 + | string: ::std::option::Option::None,
|
2764 + | struct_with_json_name: ::std::option::Option::None,
|
2765 + | timestamp: ::std::option::Option::None,
|
2766 + | unix_timestamp: ::std::option::Option::None,
|
2767 + | };
|
2768 + | ::pretty_assertions::assert_eq!(
|
2769 + | input.blob,
|
2770 + | expected.blob,
|
2771 + | "Unexpected value for `blob`"
|
2772 + | );
|
2773 + | ::pretty_assertions::assert_eq!(
|
2774 + | input.boolean,
|
2775 + | expected.boolean,
|
2776 + | "Unexpected value for `boolean`"
|
2777 + | );
|
2778 + | assert!(
|
2779 + | input.double.float_equals(&expected.double),
|
2780 + | "Unexpected value for `double` {:?} vs. {:?}",
|
2781 + | expected.double,
|
2782 + | input.double
|
2783 + | );
|
2784 + | ::pretty_assertions::assert_eq!(
|
2785 + | input.empty_struct,
|
2786 + | expected.empty_struct,
|
2787 + | "Unexpected value for `empty_struct`"
|
2788 + | );
|
2789 + | assert!(
|
2790 + | input.float.float_equals(&expected.float),
|
2791 + | "Unexpected value for `float` {:?} vs. {:?}",
|
2792 + | expected.float,
|
2793 + | input.float
|
2794 + | );
|
2795 + | ::pretty_assertions::assert_eq!(
|
2796 + | input.httpdate_timestamp,
|
2797 + | expected.httpdate_timestamp,
|
2798 + | "Unexpected value for `httpdate_timestamp`"
|
2799 + | );
|
2800 + | ::pretty_assertions::assert_eq!(
|
2801 + | input.integer,
|
2802 + | expected.integer,
|
2803 + | "Unexpected value for `integer`"
|
2804 + | );
|
2805 + | ::pretty_assertions::assert_eq!(
|
2806 + | input.iso8601_timestamp,
|
2807 + | expected.iso8601_timestamp,
|
2808 + | "Unexpected value for `iso8601_timestamp`"
|
2809 + | );
|
2810 + | ::pretty_assertions::assert_eq!(
|
2811 + | input.json_value,
|
2812 + | expected.json_value,
|
2813 + | "Unexpected value for `json_value`"
|
2814 + | );
|
2815 + | ::pretty_assertions::assert_eq!(
|
2816 + | input.list_of_lists,
|
2817 + | expected.list_of_lists,
|
2818 + | "Unexpected value for `list_of_lists`"
|
2819 + | );
|
2820 + | ::pretty_assertions::assert_eq!(
|
2821 + | input.list_of_maps_of_strings,
|
2822 + | expected.list_of_maps_of_strings,
|
2823 + | "Unexpected value for `list_of_maps_of_strings`"
|
2824 + | );
|
2825 + | ::pretty_assertions::assert_eq!(
|
2826 + | input.list_of_strings,
|
2827 + | expected.list_of_strings,
|
2828 + | "Unexpected value for `list_of_strings`"
|
2829 + | );
|
2830 + | ::pretty_assertions::assert_eq!(
|
2831 + | input.list_of_structs,
|
2832 + | expected.list_of_structs,
|
2833 + | "Unexpected value for `list_of_structs`"
|
2834 + | );
|
2835 + | ::pretty_assertions::assert_eq!(
|
2836 + | input.long,
|
2837 + | expected.long,
|
2838 + | "Unexpected value for `long`"
|
2839 + | );
|
2840 + | ::pretty_assertions::assert_eq!(
|
2841 + | input.map_of_lists_of_strings,
|
2842 + | expected.map_of_lists_of_strings,
|
2843 + | "Unexpected value for `map_of_lists_of_strings`"
|
2844 + | );
|
2845 + | ::pretty_assertions::assert_eq!(
|
2846 + | input.map_of_maps,
|
2847 + | expected.map_of_maps,
|
2848 + | "Unexpected value for `map_of_maps`"
|
2849 + | );
|
2850 + | ::pretty_assertions::assert_eq!(
|
2851 + | input.map_of_strings,
|
2852 + | expected.map_of_strings,
|
2853 + | "Unexpected value for `map_of_strings`"
|
2854 + | );
|
2855 + | ::pretty_assertions::assert_eq!(
|
2856 + | input.map_of_structs,
|
2857 + | expected.map_of_structs,
|
2858 + | "Unexpected value for `map_of_structs`"
|
2859 + | );
|
2860 + | ::pretty_assertions::assert_eq!(
|
2861 + | input.recursive_list,
|
2862 + | expected.recursive_list,
|
2863 + | "Unexpected value for `recursive_list`"
|
2864 + | );
|
2865 + | ::pretty_assertions::assert_eq!(
|
2866 + | input.recursive_map,
|
2867 + | expected.recursive_map,
|
2868 + | "Unexpected value for `recursive_map`"
|
2869 + | );
|
2870 + | ::pretty_assertions::assert_eq!(
|
2871 + | input.recursive_struct,
|
2872 + | expected.recursive_struct,
|
2873 + | "Unexpected value for `recursive_struct`"
|
2874 + | );
|
2875 + | ::pretty_assertions::assert_eq!(
|
2876 + | input.simple_struct,
|
2877 + | expected.simple_struct,
|
2878 + | "Unexpected value for `simple_struct`"
|
2879 + | );
|
2880 + | ::pretty_assertions::assert_eq!(
|
2881 + | input.string,
|
2882 + | expected.string,
|
2883 + | "Unexpected value for `string`"
|
2884 + | );
|
2885 + | ::pretty_assertions::assert_eq!(
|
2886 + | input.struct_with_json_name,
|
2887 + | expected.struct_with_json_name,
|
2888 + | "Unexpected value for `struct_with_json_name`"
|
2889 + | );
|
2890 + | ::pretty_assertions::assert_eq!(
|
2891 + | input.timestamp,
|
2892 + | expected.timestamp,
|
2893 + | "Unexpected value for `timestamp`"
|
2894 + | );
|
2895 + | ::pretty_assertions::assert_eq!(
|
2896 + | input.unix_timestamp,
|
2897 + | expected.unix_timestamp,
|
2898 + | "Unexpected value for `unix_timestamp`"
|
2899 + | );
|
2900 + | let output = crate::output::KitchenSinkOperationOutput {
|
2901 + | blob: ::std::option::Option::None,
|
2902 + | boolean: ::std::option::Option::None,
|
2903 + | double: ::std::option::Option::None,
|
2904 + | empty_struct: ::std::option::Option::None,
|
2905 + | float: ::std::option::Option::None,
|
2906 + | httpdate_timestamp: ::std::option::Option::None,
|
2907 + | integer: ::std::option::Option::None,
|
2908 + | iso8601_timestamp: ::std::option::Option::None,
|
2909 + | json_value: ::std::option::Option::None,
|
2910 + | list_of_lists: ::std::option::Option::None,
|
2911 + | list_of_maps_of_strings: ::std::option::Option::None,
|
2912 + | list_of_strings: ::std::option::Option::None,
|
2913 + | list_of_structs: ::std::option::Option::None,
|
2914 + | long: ::std::option::Option::None,
|
2915 + | map_of_lists_of_strings: ::std::option::Option::None,
|
2916 + | map_of_maps: ::std::option::Option::None,
|
2917 + | map_of_strings: ::std::option::Option::None,
|
2918 + | map_of_structs: ::std::option::Option::None,
|
2919 + | recursive_list: ::std::option::Option::None,
|
2920 + | recursive_map: ::std::option::Option::None,
|
2921 + | recursive_struct: ::std::option::Option::None,
|
2922 + | simple_struct: ::std::option::Option::None,
|
2923 + | string: ::std::option::Option::None,
|
2924 + | struct_with_json_name: ::std::option::Option::None,
|
2925 + | timestamp: ::std::option::Option::None,
|
2926 + | unix_timestamp: ::std::option::Option::None,
|
2927 + | };
|
2928 + | Ok(output)
|
2929 + | };
|
2930 + | sender.send(()).await.expect("receiver dropped early");
|
2931 + | result
|
2932 + | }
|
2933 + | })
|
2934 + | .build_unchecked();
|
2935 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1557 2936 | .await
|
1558 - | .expect("unable to extract body to bytes");
|
1559 - | ::aws_smithy_protocol_test::assert_ok(
|
1560 - | ::aws_smithy_protocol_test::validate_body(&body, "{\n \"contents\": {\n \"mapValue\": {\n \"foo\": \"bar\",\n \"spam\": \"eggs\"\n }\n }\n}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2937 + | .expect("unable to make an HTTP request");
|
2938 + | assert!(
|
2939 + | receiver.recv().await.is_some(),
|
2940 + | "we expected operation handler to be invoked but it was not entered"
|
1561 2941 | );
|
1562 2942 | }
|
1563 2943 |
|
1564 - | /// Deserializes a structure union value
|
1565 - | /// Test ID: AwsJson11DeserializeStructureUnionValue
|
2944 + | /// Serializes timestamp shapes with httpdate timestampFormat
|
2945 + | /// Test ID: serializes_timestamp_shapes_with_httpdate_timestampformat
|
1566 2946 | #[::tokio::test]
|
1567 2947 | #[::tracing_test::traced_test]
|
1568 - | async fn aws_json11_deserialize_structure_union_value_response() {
|
1569 - | let output = crate::output::JsonUnionsOutput {
|
1570 - | contents: ::std::option::Option::Some(crate::model::MyUnion::StructureValue(
|
1571 - | crate::model::GreetingStruct {
|
1572 - | hi: ::std::option::Option::Some("hello".to_owned()),
|
1573 - | },
|
1574 - | )),
|
1575 - | };
|
1576 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1577 - | let http_response = output.into_response();
|
1578 - | ::pretty_assertions::assert_eq!(
|
1579 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1580 - | http_response.status()
|
1581 - | );
|
1582 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1583 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1584 - | http_response.headers(),
|
1585 - | expected_headers,
|
1586 - | ));
|
1587 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2948 + | async fn serializes_timestamp_shapes_with_httpdate_timestampformat_request() {
|
2949 + | #[allow(unused_mut)]
|
2950 + | let mut http_request = ::http::Request::builder()
|
2951 + | .uri("/")
|
2952 + | .method("POST")
|
2953 + | .header("Content-Type", "application/x-amz-json-1.1")
|
2954 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
2955 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2956 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2957 + | "{\"HttpdateTimestamp\":\"Sun, 02 Jan 2000 20:34:56 GMT\"}".as_bytes(),
|
2958 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2959 + | )),
|
2960 + | ))
|
2961 + | .unwrap();
|
2962 + | #[allow(unused_mut)]
|
2963 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2964 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
2965 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2966 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
2967 + | let sender = sender.clone();
|
2968 + | async move {
|
2969 + | let result = {
|
2970 + | use ::aws_smithy_protocol_test::FloatEquals;
|
2971 + | let expected = crate::input::KitchenSinkOperationInput {
|
2972 + | httpdate_timestamp: ::std::option::Option::Some(
|
2973 + | ::aws_smithy_types::DateTime::from_fractional_secs(
|
2974 + | 946845296, 0_f64,
|
2975 + | ),
|
2976 + | ),
|
2977 + | blob: ::std::option::Option::None,
|
2978 + | boolean: ::std::option::Option::None,
|
2979 + | double: ::std::option::Option::None,
|
2980 + | empty_struct: ::std::option::Option::None,
|
2981 + | float: ::std::option::Option::None,
|
2982 + | integer: ::std::option::Option::None,
|
2983 + | iso8601_timestamp: ::std::option::Option::None,
|
2984 + | json_value: ::std::option::Option::None,
|
2985 + | list_of_lists: ::std::option::Option::None,
|
2986 + | list_of_maps_of_strings: ::std::option::Option::None,
|
2987 + | list_of_strings: ::std::option::Option::None,
|
2988 + | list_of_structs: ::std::option::Option::None,
|
2989 + | long: ::std::option::Option::None,
|
2990 + | map_of_lists_of_strings: ::std::option::Option::None,
|
2991 + | map_of_maps: ::std::option::Option::None,
|
2992 + | map_of_strings: ::std::option::Option::None,
|
2993 + | map_of_structs: ::std::option::Option::None,
|
2994 + | recursive_list: ::std::option::Option::None,
|
2995 + | recursive_map: ::std::option::Option::None,
|
2996 + | recursive_struct: ::std::option::Option::None,
|
2997 + | simple_struct: ::std::option::Option::None,
|
2998 + | string: ::std::option::Option::None,
|
2999 + | struct_with_json_name: ::std::option::Option::None,
|
3000 + | timestamp: ::std::option::Option::None,
|
3001 + | unix_timestamp: ::std::option::Option::None,
|
3002 + | };
|
3003 + | ::pretty_assertions::assert_eq!(
|
3004 + | input.blob,
|
3005 + | expected.blob,
|
3006 + | "Unexpected value for `blob`"
|
3007 + | );
|
3008 + | ::pretty_assertions::assert_eq!(
|
3009 + | input.boolean,
|
3010 + | expected.boolean,
|
3011 + | "Unexpected value for `boolean`"
|
3012 + | );
|
3013 + | assert!(
|
3014 + | input.double.float_equals(&expected.double),
|
3015 + | "Unexpected value for `double` {:?} vs. {:?}",
|
3016 + | expected.double,
|
3017 + | input.double
|
3018 + | );
|
3019 + | ::pretty_assertions::assert_eq!(
|
3020 + | input.empty_struct,
|
3021 + | expected.empty_struct,
|
3022 + | "Unexpected value for `empty_struct`"
|
3023 + | );
|
3024 + | assert!(
|
3025 + | input.float.float_equals(&expected.float),
|
3026 + | "Unexpected value for `float` {:?} vs. {:?}",
|
3027 + | expected.float,
|
3028 + | input.float
|
3029 + | );
|
3030 + | ::pretty_assertions::assert_eq!(
|
3031 + | input.httpdate_timestamp,
|
3032 + | expected.httpdate_timestamp,
|
3033 + | "Unexpected value for `httpdate_timestamp`"
|
3034 + | );
|
3035 + | ::pretty_assertions::assert_eq!(
|
3036 + | input.integer,
|
3037 + | expected.integer,
|
3038 + | "Unexpected value for `integer`"
|
3039 + | );
|
3040 + | ::pretty_assertions::assert_eq!(
|
3041 + | input.iso8601_timestamp,
|
3042 + | expected.iso8601_timestamp,
|
3043 + | "Unexpected value for `iso8601_timestamp`"
|
3044 + | );
|
3045 + | ::pretty_assertions::assert_eq!(
|
3046 + | input.json_value,
|
3047 + | expected.json_value,
|
3048 + | "Unexpected value for `json_value`"
|
3049 + | );
|
3050 + | ::pretty_assertions::assert_eq!(
|
3051 + | input.list_of_lists,
|
3052 + | expected.list_of_lists,
|
3053 + | "Unexpected value for `list_of_lists`"
|
3054 + | );
|
3055 + | ::pretty_assertions::assert_eq!(
|
3056 + | input.list_of_maps_of_strings,
|
3057 + | expected.list_of_maps_of_strings,
|
3058 + | "Unexpected value for `list_of_maps_of_strings`"
|
3059 + | );
|
3060 + | ::pretty_assertions::assert_eq!(
|
3061 + | input.list_of_strings,
|
3062 + | expected.list_of_strings,
|
3063 + | "Unexpected value for `list_of_strings`"
|
3064 + | );
|
3065 + | ::pretty_assertions::assert_eq!(
|
3066 + | input.list_of_structs,
|
3067 + | expected.list_of_structs,
|
3068 + | "Unexpected value for `list_of_structs`"
|
3069 + | );
|
3070 + | ::pretty_assertions::assert_eq!(
|
3071 + | input.long,
|
3072 + | expected.long,
|
3073 + | "Unexpected value for `long`"
|
3074 + | );
|
3075 + | ::pretty_assertions::assert_eq!(
|
3076 + | input.map_of_lists_of_strings,
|
3077 + | expected.map_of_lists_of_strings,
|
3078 + | "Unexpected value for `map_of_lists_of_strings`"
|
3079 + | );
|
3080 + | ::pretty_assertions::assert_eq!(
|
3081 + | input.map_of_maps,
|
3082 + | expected.map_of_maps,
|
3083 + | "Unexpected value for `map_of_maps`"
|
3084 + | );
|
3085 + | ::pretty_assertions::assert_eq!(
|
3086 + | input.map_of_strings,
|
3087 + | expected.map_of_strings,
|
3088 + | "Unexpected value for `map_of_strings`"
|
3089 + | );
|
3090 + | ::pretty_assertions::assert_eq!(
|
3091 + | input.map_of_structs,
|
3092 + | expected.map_of_structs,
|
3093 + | "Unexpected value for `map_of_structs`"
|
3094 + | );
|
3095 + | ::pretty_assertions::assert_eq!(
|
3096 + | input.recursive_list,
|
3097 + | expected.recursive_list,
|
3098 + | "Unexpected value for `recursive_list`"
|
3099 + | );
|
3100 + | ::pretty_assertions::assert_eq!(
|
3101 + | input.recursive_map,
|
3102 + | expected.recursive_map,
|
3103 + | "Unexpected value for `recursive_map`"
|
3104 + | );
|
3105 + | ::pretty_assertions::assert_eq!(
|
3106 + | input.recursive_struct,
|
3107 + | expected.recursive_struct,
|
3108 + | "Unexpected value for `recursive_struct`"
|
3109 + | );
|
3110 + | ::pretty_assertions::assert_eq!(
|
3111 + | input.simple_struct,
|
3112 + | expected.simple_struct,
|
3113 + | "Unexpected value for `simple_struct`"
|
3114 + | );
|
3115 + | ::pretty_assertions::assert_eq!(
|
3116 + | input.string,
|
3117 + | expected.string,
|
3118 + | "Unexpected value for `string`"
|
3119 + | );
|
3120 + | ::pretty_assertions::assert_eq!(
|
3121 + | input.struct_with_json_name,
|
3122 + | expected.struct_with_json_name,
|
3123 + | "Unexpected value for `struct_with_json_name`"
|
3124 + | );
|
3125 + | ::pretty_assertions::assert_eq!(
|
3126 + | input.timestamp,
|
3127 + | expected.timestamp,
|
3128 + | "Unexpected value for `timestamp`"
|
3129 + | );
|
3130 + | ::pretty_assertions::assert_eq!(
|
3131 + | input.unix_timestamp,
|
3132 + | expected.unix_timestamp,
|
3133 + | "Unexpected value for `unix_timestamp`"
|
3134 + | );
|
3135 + | let output = crate::output::KitchenSinkOperationOutput {
|
3136 + | blob: ::std::option::Option::None,
|
3137 + | boolean: ::std::option::Option::None,
|
3138 + | double: ::std::option::Option::None,
|
3139 + | empty_struct: ::std::option::Option::None,
|
3140 + | float: ::std::option::Option::None,
|
3141 + | httpdate_timestamp: ::std::option::Option::None,
|
3142 + | integer: ::std::option::Option::None,
|
3143 + | iso8601_timestamp: ::std::option::Option::None,
|
3144 + | json_value: ::std::option::Option::None,
|
3145 + | list_of_lists: ::std::option::Option::None,
|
3146 + | list_of_maps_of_strings: ::std::option::Option::None,
|
3147 + | list_of_strings: ::std::option::Option::None,
|
3148 + | list_of_structs: ::std::option::Option::None,
|
3149 + | long: ::std::option::Option::None,
|
3150 + | map_of_lists_of_strings: ::std::option::Option::None,
|
3151 + | map_of_maps: ::std::option::Option::None,
|
3152 + | map_of_strings: ::std::option::Option::None,
|
3153 + | map_of_structs: ::std::option::Option::None,
|
3154 + | recursive_list: ::std::option::Option::None,
|
3155 + | recursive_map: ::std::option::Option::None,
|
3156 + | recursive_struct: ::std::option::Option::None,
|
3157 + | simple_struct: ::std::option::Option::None,
|
3158 + | string: ::std::option::Option::None,
|
3159 + | struct_with_json_name: ::std::option::Option::None,
|
3160 + | timestamp: ::std::option::Option::None,
|
3161 + | unix_timestamp: ::std::option::Option::None,
|
3162 + | };
|
3163 + | Ok(output)
|
3164 + | };
|
3165 + | sender.send(()).await.expect("receiver dropped early");
|
3166 + | result
|
3167 + | }
|
3168 + | })
|
3169 + | .build_unchecked();
|
3170 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1588 3171 | .await
|
1589 - | .expect("unable to extract body to bytes");
|
1590 - | ::aws_smithy_protocol_test::assert_ok(
|
1591 - | ::aws_smithy_protocol_test::validate_body(&body, "{\n \"contents\": {\n \"structureValue\": {\n \"hi\": \"hello\"\n }\n }\n}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3172 + | .expect("unable to make an HTTP request");
|
3173 + | assert!(
|
3174 + | receiver.recv().await.is_some(),
|
3175 + | "we expected operation handler to be invoked but it was not entered"
|
1592 3176 | );
|
1593 3177 | }
|
1594 - | }
|
1595 3178 |
|
1596 - | ::pin_project_lite::pin_project! {
|
1597 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
1598 - | /// [`GreetingWithErrorsInput`](crate::input::GreetingWithErrorsInput) using modelled bindings.
|
1599 - | pub struct GreetingWithErrorsInputFuture {
|
1600 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::GreetingWithErrorsInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
1601 - | }
|
1602 - | }
|
1603 - |
|
1604 - | impl std::future::Future for GreetingWithErrorsInputFuture {
|
1605 - | type Output = Result<
|
1606 - | crate::input::GreetingWithErrorsInput,
|
1607 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
1608 - | >;
|
1609 - |
|
1610 - | fn poll(
|
1611 - | self: std::pin::Pin<&mut Self>,
|
1612 - | cx: &mut std::task::Context<'_>,
|
1613 - | ) -> std::task::Poll<Self::Output> {
|
1614 - | let this = self.project();
|
1615 - | this.inner.as_mut().poll(cx)
|
1616 - | }
|
1617 - | }
|
1618 - |
|
1619 - | impl<B>
|
1620 - | ::aws_smithy_legacy_http_server::request::FromRequest<
|
1621 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1622 - | B,
|
1623 - | > for crate::input::GreetingWithErrorsInput
|
1624 - | where
|
1625 - | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
1626 - | B: 'static,
|
1627 - |
|
1628 - | B::Data: Send,
|
1629 - | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
1630 - | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
1631 - | {
|
1632 - | type Rejection =
|
1633 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
1634 - | type Future = GreetingWithErrorsInputFuture;
|
1635 - |
|
1636 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
1637 - | let fut = async move {
|
1638 - | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
1639 - | request.headers(),
|
1640 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
1641 - | ) {
|
1642 - | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
1643 - | }
|
1644 - | crate::protocol_serde::shape_greeting_with_errors::de_greeting_with_errors_http_request(
|
1645 - | request,
|
1646 - | )
|
1647 - | .await
|
1648 - | };
|
1649 - | use ::futures_util::future::TryFutureExt;
|
1650 - | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
1651 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
1652 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
1653 - | });
|
1654 - | GreetingWithErrorsInputFuture {
|
1655 - | inner: Box::pin(fut),
|
1656 - | }
|
1657 - | }
|
1658 - | }
|
1659 - | impl
|
1660 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
1661 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1662 - | > for crate::output::GreetingWithErrorsOutput
|
1663 - | {
|
1664 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
1665 - | match crate::protocol_serde::shape_greeting_with_errors::ser_greeting_with_errors_http_response(self) {
|
1666 - | Ok(response) => response,
|
1667 - | Err(e) => {
|
1668 - | ::tracing::error!(error = %e, "failed to serialize response");
|
1669 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
1670 - | }
|
1671 - | }
|
1672 - | }
|
1673 - | }
|
1674 - | impl
|
1675 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
1676 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1677 - | > for crate::error::GreetingWithErrorsError
|
1678 - | {
|
1679 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
1680 - | match crate::protocol_serde::shape_greeting_with_errors::ser_greeting_with_errors_http_error(
|
1681 - | &self,
|
1682 - | ) {
|
1683 - | Ok(mut response) => {
|
1684 - | response.extensions_mut().insert(
|
1685 - | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
1686 - | self.name(),
|
1687 - | ),
|
1688 - | );
|
1689 - | response
|
1690 - | }
|
1691 - | Err(e) => {
|
1692 - | ::tracing::error!(error = %e, "failed to serialize response");
|
1693 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
1694 - | }
|
1695 - | }
|
1696 - | }
|
1697 - | }
|
1698 - |
|
1699 - | #[allow(unreachable_code, unused_variables)]
|
1700 - | #[cfg(test)]
|
1701 - | mod greeting_with_errors_test {
|
1702 - |
|
1703 - | /// Parses simple JSON errors
|
1704 - | /// Test ID: AwsJson11InvalidGreetingError
|
1705 - | #[::tokio::test]
|
1706 - | #[::tracing_test::traced_test]
|
1707 - | async fn aws_json11_invalid_greeting_error_response() {
|
1708 - | let output = crate::error::InvalidGreeting {
|
1709 - | message: ::std::option::Option::Some("Hi".to_owned()),
|
1710 - | };
|
1711 - | let output = crate::error::GreetingWithErrorsError::InvalidGreeting(output);
|
1712 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1713 - | let http_response = output.into_response();
|
1714 - | ::pretty_assertions::assert_eq!(
|
1715 - | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1716 - | http_response.status()
|
1717 - | );
|
1718 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1719 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1720 - | http_response.headers(),
|
1721 - | expected_headers,
|
1722 - | ));
|
1723 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1724 - | .await
|
1725 - | .expect("unable to extract body to bytes");
|
1726 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1727 - | &body,
|
1728 - | "{\n \"__type\": \"InvalidGreeting\",\n \"Message\": \"Hi\"\n}",
|
1729 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1730 - | ));
|
1731 - | }
|
1732 - |
|
1733 - | /// Parses a complex error with no message member
|
1734 - | /// Test ID: AwsJson11ComplexError
|
1735 - | #[::tokio::test]
|
1736 - | #[::tracing_test::traced_test]
|
1737 - | async fn aws_json11_complex_error_response() {
|
1738 - | let output = crate::error::ComplexError {
|
1739 - | top_level: ::std::option::Option::Some("Top level".to_owned()),
|
1740 - | nested: ::std::option::Option::Some(crate::model::ComplexNestedErrorData {
|
1741 - | foo: ::std::option::Option::Some("bar".to_owned()),
|
1742 - | }),
|
1743 - | };
|
1744 - | let output = crate::error::GreetingWithErrorsError::ComplexError(output);
|
1745 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1746 - | let http_response = output.into_response();
|
1747 - | ::pretty_assertions::assert_eq!(
|
1748 - | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1749 - | http_response.status()
|
1750 - | );
|
1751 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1752 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1753 - | http_response.headers(),
|
1754 - | expected_headers,
|
1755 - | ));
|
1756 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1757 - | .await
|
1758 - | .expect("unable to extract body to bytes");
|
1759 - | ::aws_smithy_protocol_test::assert_ok(
|
1760 - | ::aws_smithy_protocol_test::validate_body(&body, "{\n \"__type\": \"ComplexError\",\n \"TopLevel\": \"Top level\",\n \"Nested\": {\n \"Foo\": \"bar\"\n }\n}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1761 - | );
|
1762 - | }
|
1763 - | /// Test ID: AwsJson11EmptyComplexError
|
3179 + | /// Serializes timestamp shapes with unixTimestamp timestampFormat
|
3180 + | /// Test ID: serializes_timestamp_shapes_with_unixtimestamp_timestampformat
|
1764 3181 | #[::tokio::test]
|
1765 3182 | #[::tracing_test::traced_test]
|
1766 - | async fn aws_json11_empty_complex_error_response() {
|
1767 - | let output = crate::error::ComplexError {
|
1768 - | top_level: ::std::option::Option::None,
|
1769 - | nested: ::std::option::Option::None,
|
1770 - | };
|
1771 - | let output = crate::error::GreetingWithErrorsError::ComplexError(output);
|
1772 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1773 - | let http_response = output.into_response();
|
1774 - | ::pretty_assertions::assert_eq!(
|
1775 - | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1776 - | http_response.status()
|
1777 - | );
|
1778 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1779 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1780 - | http_response.headers(),
|
1781 - | expected_headers,
|
1782 - | ));
|
1783 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1784 - | .await
|
1785 - | .expect("unable to extract body to bytes");
|
1786 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1787 - | &body,
|
1788 - | "{\n \"__type\": \"ComplexError\"\n}",
|
1789 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1790 - | ));
|
1791 - | }
|
1792 - | }
|
1793 - |
|
1794 - | ::pin_project_lite::pin_project! {
|
1795 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
1796 - | /// [`SparseNullsOperationInput`](crate::input::SparseNullsOperationInput) using modelled bindings.
|
1797 - | pub struct SparseNullsOperationInputFuture {
|
1798 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SparseNullsOperationInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
1799 - | }
|
1800 - | }
|
1801 - |
|
1802 - | impl std::future::Future for SparseNullsOperationInputFuture {
|
1803 - | type Output = Result<
|
1804 - | crate::input::SparseNullsOperationInput,
|
1805 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
1806 - | >;
|
1807 - |
|
1808 - | fn poll(
|
1809 - | self: std::pin::Pin<&mut Self>,
|
1810 - | cx: &mut std::task::Context<'_>,
|
1811 - | ) -> std::task::Poll<Self::Output> {
|
1812 - | let this = self.project();
|
1813 - | this.inner.as_mut().poll(cx)
|
1814 - | }
|
1815 - | }
|
1816 - |
|
1817 - | impl<B>
|
1818 - | ::aws_smithy_legacy_http_server::request::FromRequest<
|
1819 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1820 - | B,
|
1821 - | > for crate::input::SparseNullsOperationInput
|
1822 - | where
|
1823 - | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
1824 - | B: 'static,
|
1825 - |
|
1826 - | B::Data: Send,
|
1827 - | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
1828 - | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
1829 - | {
|
1830 - | type Rejection =
|
1831 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
1832 - | type Future = SparseNullsOperationInputFuture;
|
1833 - |
|
1834 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
1835 - | let fut = async move {
|
1836 - | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
1837 - | request.headers(),
|
1838 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
1839 - | ) {
|
1840 - | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
1841 - | }
|
1842 - | crate::protocol_serde::shape_sparse_nulls_operation::de_sparse_nulls_operation_http_request(request)
|
1843 - | .await
|
1844 - | };
|
1845 - | use ::futures_util::future::TryFutureExt;
|
1846 - | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
1847 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
1848 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
1849 - | });
|
1850 - | SparseNullsOperationInputFuture {
|
1851 - | inner: Box::pin(fut),
|
1852 - | }
|
1853 - | }
|
1854 - | }
|
1855 - | impl
|
1856 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
1857 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1858 - | > for crate::output::SparseNullsOperationOutput
|
1859 - | {
|
1860 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
1861 - | match crate::protocol_serde::shape_sparse_nulls_operation::ser_sparse_nulls_operation_http_response(self) {
|
1862 - | Ok(response) => response,
|
1863 - | Err(e) => {
|
1864 - | ::tracing::error!(error = %e, "failed to serialize response");
|
1865 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
1866 - | }
|
1867 - | }
|
1868 - | }
|
1869 - | }
|
1870 - |
|
1871 - | #[allow(unreachable_code, unused_variables)]
|
1872 - | #[cfg(test)]
|
1873 - | mod sparse_nulls_operation_test {
|
1874 - |
|
1875 - | /// Serializes null values in maps
|
1876 - | /// Test ID: AwsJson11SparseMapsSerializeNullValues
|
1877 - | #[::tokio::test]
|
1878 - | #[::tracing_test::traced_test]
|
1879 - | async fn aws_json11_sparse_maps_serialize_null_values_request() {
|
3183 + | async fn serializes_timestamp_shapes_with_unixtimestamp_timestampformat_request() {
|
1880 3184 | #[allow(unused_mut)]
|
1881 3185 | let mut http_request = ::http::Request::builder()
|
1882 3186 | .uri("/")
|
1883 3187 | .method("POST")
|
1884 3188 | .header("Content-Type", "application/x-amz-json-1.1")
|
1885 - | .header("X-Amz-Target", "JsonProtocol.SparseNullsOperation")
|
3189 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
1886 3190 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1887 3191 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1888 - | "{\n \"sparseStringMap\": {\n \"foo\": null\n }\n}".as_bytes(),
|
3192 + | "{\"UnixTimestamp\":946845296}".as_bytes(),
|
1889 3193 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1890 3194 | )),
|
1891 3195 | ))
|
1892 3196 | .unwrap();
|
1893 3197 | #[allow(unused_mut)]
|
1894 3198 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1895 3199 | let config = crate::service::JsonProtocolConfig::builder().build();
|
1896 3200 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1897 - | .sparse_nulls_operation(move |input: crate::input::SparseNullsOperationInput| {
|
3201 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
1898 3202 | let sender = sender.clone();
|
1899 3203 | async move {
|
1900 3204 | let result = {
|
1901 - | let expected = crate::input::SparseNullsOperationInput {
|
1902 - | sparse_string_map: ::std::option::Option::Some({
|
1903 - | let mut ret = ::std::collections::HashMap::new();
|
1904 - | ret.insert("foo".to_owned(), ::std::option::Option::None);
|
1905 - | ret
|
1906 - | }),
|
1907 - | sparse_string_list: ::std::option::Option::None,
|
3205 + | use ::aws_smithy_protocol_test::FloatEquals;
|
3206 + | let expected = crate::input::KitchenSinkOperationInput {
|
3207 + | unix_timestamp: ::std::option::Option::Some(
|
3208 + | ::aws_smithy_types::DateTime::from_fractional_secs(
|
3209 + | 946845296, 0_f64,
|
3210 + | ),
|
3211 + | ),
|
3212 + | blob: ::std::option::Option::None,
|
3213 + | boolean: ::std::option::Option::None,
|
3214 + | double: ::std::option::Option::None,
|
3215 + | empty_struct: ::std::option::Option::None,
|
3216 + | float: ::std::option::Option::None,
|
3217 + | httpdate_timestamp: ::std::option::Option::None,
|
3218 + | integer: ::std::option::Option::None,
|
3219 + | iso8601_timestamp: ::std::option::Option::None,
|
3220 + | json_value: ::std::option::Option::None,
|
3221 + | list_of_lists: ::std::option::Option::None,
|
3222 + | list_of_maps_of_strings: ::std::option::Option::None,
|
3223 + | list_of_strings: ::std::option::Option::None,
|
3224 + | list_of_structs: ::std::option::Option::None,
|
3225 + | long: ::std::option::Option::None,
|
3226 + | map_of_lists_of_strings: ::std::option::Option::None,
|
3227 + | map_of_maps: ::std::option::Option::None,
|
3228 + | map_of_strings: ::std::option::Option::None,
|
3229 + | map_of_structs: ::std::option::Option::None,
|
3230 + | recursive_list: ::std::option::Option::None,
|
3231 + | recursive_map: ::std::option::Option::None,
|
3232 + | recursive_struct: ::std::option::Option::None,
|
3233 + | simple_struct: ::std::option::Option::None,
|
3234 + | string: ::std::option::Option::None,
|
3235 + | struct_with_json_name: ::std::option::Option::None,
|
3236 + | timestamp: ::std::option::Option::None,
|
1908 3237 | };
|
1909 - | ::pretty_assertions::assert_eq!(input, expected);
|
1910 - | let output = crate::output::SparseNullsOperationOutput {
|
1911 - | sparse_string_list: ::std::option::Option::None,
|
1912 - | sparse_string_map: ::std::option::Option::None,
|
3238 + | ::pretty_assertions::assert_eq!(
|
3239 + | input.blob,
|
3240 + | expected.blob,
|
3241 + | "Unexpected value for `blob`"
|
3242 + | );
|
3243 + | ::pretty_assertions::assert_eq!(
|
3244 + | input.boolean,
|
3245 + | expected.boolean,
|
3246 + | "Unexpected value for `boolean`"
|
3247 + | );
|
3248 + | assert!(
|
3249 + | input.double.float_equals(&expected.double),
|
3250 + | "Unexpected value for `double` {:?} vs. {:?}",
|
3251 + | expected.double,
|
3252 + | input.double
|
3253 + | );
|
3254 + | ::pretty_assertions::assert_eq!(
|
3255 + | input.empty_struct,
|
3256 + | expected.empty_struct,
|
3257 + | "Unexpected value for `empty_struct`"
|
3258 + | );
|
3259 + | assert!(
|
3260 + | input.float.float_equals(&expected.float),
|
3261 + | "Unexpected value for `float` {:?} vs. {:?}",
|
3262 + | expected.float,
|
3263 + | input.float
|
3264 + | );
|
3265 + | ::pretty_assertions::assert_eq!(
|
3266 + | input.httpdate_timestamp,
|
3267 + | expected.httpdate_timestamp,
|
3268 + | "Unexpected value for `httpdate_timestamp`"
|
3269 + | );
|
3270 + | ::pretty_assertions::assert_eq!(
|
3271 + | input.integer,
|
3272 + | expected.integer,
|
3273 + | "Unexpected value for `integer`"
|
3274 + | );
|
3275 + | ::pretty_assertions::assert_eq!(
|
3276 + | input.iso8601_timestamp,
|
3277 + | expected.iso8601_timestamp,
|
3278 + | "Unexpected value for `iso8601_timestamp`"
|
3279 + | );
|
3280 + | ::pretty_assertions::assert_eq!(
|
3281 + | input.json_value,
|
3282 + | expected.json_value,
|
3283 + | "Unexpected value for `json_value`"
|
3284 + | );
|
3285 + | ::pretty_assertions::assert_eq!(
|
3286 + | input.list_of_lists,
|
3287 + | expected.list_of_lists,
|
3288 + | "Unexpected value for `list_of_lists`"
|
3289 + | );
|
3290 + | ::pretty_assertions::assert_eq!(
|
3291 + | input.list_of_maps_of_strings,
|
3292 + | expected.list_of_maps_of_strings,
|
3293 + | "Unexpected value for `list_of_maps_of_strings`"
|
3294 + | );
|
3295 + | ::pretty_assertions::assert_eq!(
|
3296 + | input.list_of_strings,
|
3297 + | expected.list_of_strings,
|
3298 + | "Unexpected value for `list_of_strings`"
|
3299 + | );
|
3300 + | ::pretty_assertions::assert_eq!(
|
3301 + | input.list_of_structs,
|
3302 + | expected.list_of_structs,
|
3303 + | "Unexpected value for `list_of_structs`"
|
3304 + | );
|
3305 + | ::pretty_assertions::assert_eq!(
|
3306 + | input.long,
|
3307 + | expected.long,
|
3308 + | "Unexpected value for `long`"
|
3309 + | );
|
3310 + | ::pretty_assertions::assert_eq!(
|
3311 + | input.map_of_lists_of_strings,
|
3312 + | expected.map_of_lists_of_strings,
|
3313 + | "Unexpected value for `map_of_lists_of_strings`"
|
3314 + | );
|
3315 + | ::pretty_assertions::assert_eq!(
|
3316 + | input.map_of_maps,
|
3317 + | expected.map_of_maps,
|
3318 + | "Unexpected value for `map_of_maps`"
|
3319 + | );
|
3320 + | ::pretty_assertions::assert_eq!(
|
3321 + | input.map_of_strings,
|
3322 + | expected.map_of_strings,
|
3323 + | "Unexpected value for `map_of_strings`"
|
3324 + | );
|
3325 + | ::pretty_assertions::assert_eq!(
|
3326 + | input.map_of_structs,
|
3327 + | expected.map_of_structs,
|
3328 + | "Unexpected value for `map_of_structs`"
|
3329 + | );
|
3330 + | ::pretty_assertions::assert_eq!(
|
3331 + | input.recursive_list,
|
3332 + | expected.recursive_list,
|
3333 + | "Unexpected value for `recursive_list`"
|
3334 + | );
|
3335 + | ::pretty_assertions::assert_eq!(
|
3336 + | input.recursive_map,
|
3337 + | expected.recursive_map,
|
3338 + | "Unexpected value for `recursive_map`"
|
3339 + | );
|
3340 + | ::pretty_assertions::assert_eq!(
|
3341 + | input.recursive_struct,
|
3342 + | expected.recursive_struct,
|
3343 + | "Unexpected value for `recursive_struct`"
|
3344 + | );
|
3345 + | ::pretty_assertions::assert_eq!(
|
3346 + | input.simple_struct,
|
3347 + | expected.simple_struct,
|
3348 + | "Unexpected value for `simple_struct`"
|
3349 + | );
|
3350 + | ::pretty_assertions::assert_eq!(
|
3351 + | input.string,
|
3352 + | expected.string,
|
3353 + | "Unexpected value for `string`"
|
3354 + | );
|
3355 + | ::pretty_assertions::assert_eq!(
|
3356 + | input.struct_with_json_name,
|
3357 + | expected.struct_with_json_name,
|
3358 + | "Unexpected value for `struct_with_json_name`"
|
3359 + | );
|
3360 + | ::pretty_assertions::assert_eq!(
|
3361 + | input.timestamp,
|
3362 + | expected.timestamp,
|
3363 + | "Unexpected value for `timestamp`"
|
3364 + | );
|
3365 + | ::pretty_assertions::assert_eq!(
|
3366 + | input.unix_timestamp,
|
3367 + | expected.unix_timestamp,
|
3368 + | "Unexpected value for `unix_timestamp`"
|
3369 + | );
|
3370 + | let output = crate::output::KitchenSinkOperationOutput {
|
3371 + | blob: ::std::option::Option::None,
|
3372 + | boolean: ::std::option::Option::None,
|
3373 + | double: ::std::option::Option::None,
|
3374 + | empty_struct: ::std::option::Option::None,
|
3375 + | float: ::std::option::Option::None,
|
3376 + | httpdate_timestamp: ::std::option::Option::None,
|
3377 + | integer: ::std::option::Option::None,
|
3378 + | iso8601_timestamp: ::std::option::Option::None,
|
3379 + | json_value: ::std::option::Option::None,
|
3380 + | list_of_lists: ::std::option::Option::None,
|
3381 + | list_of_maps_of_strings: ::std::option::Option::None,
|
3382 + | list_of_strings: ::std::option::Option::None,
|
3383 + | list_of_structs: ::std::option::Option::None,
|
3384 + | long: ::std::option::Option::None,
|
3385 + | map_of_lists_of_strings: ::std::option::Option::None,
|
3386 + | map_of_maps: ::std::option::Option::None,
|
3387 + | map_of_strings: ::std::option::Option::None,
|
3388 + | map_of_structs: ::std::option::Option::None,
|
3389 + | recursive_list: ::std::option::Option::None,
|
3390 + | recursive_map: ::std::option::Option::None,
|
3391 + | recursive_struct: ::std::option::Option::None,
|
3392 + | simple_struct: ::std::option::Option::None,
|
3393 + | string: ::std::option::Option::None,
|
3394 + | struct_with_json_name: ::std::option::Option::None,
|
3395 + | timestamp: ::std::option::Option::None,
|
3396 + | unix_timestamp: ::std::option::Option::None,
|
1913 3397 | };
|
1914 - | output
|
3398 + | Ok(output)
|
1915 3399 | };
|
1916 3400 | sender.send(()).await.expect("receiver dropped early");
|
1917 3401 | result
|
1918 3402 | }
|
1919 3403 | })
|
1920 3404 | .build_unchecked();
|
1921 3405 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1922 3406 | .await
|
1923 3407 | .expect("unable to make an HTTP request");
|
1924 3408 | assert!(
|
1925 3409 | receiver.recv().await.is_some(),
|
1926 3410 | "we expected operation handler to be invoked but it was not entered"
|
1927 3411 | );
|
1928 3412 | }
|
1929 3413 |
|
1930 - | /// Serializes null values in lists
|
1931 - | /// Test ID: AwsJson11SparseListsSerializeNull
|
3414 + | /// Serializes list shapes
|
3415 + | /// Test ID: serializes_list_shapes
|
1932 3416 | #[::tokio::test]
|
1933 3417 | #[::tracing_test::traced_test]
|
1934 - | async fn aws_json11_sparse_lists_serialize_null_request() {
|
3418 + | async fn serializes_list_shapes_request() {
|
1935 3419 | #[allow(unused_mut)]
|
1936 3420 | let mut http_request = ::http::Request::builder()
|
1937 3421 | .uri("/")
|
1938 3422 | .method("POST")
|
1939 3423 | .header("Content-Type", "application/x-amz-json-1.1")
|
1940 - | .header("X-Amz-Target", "JsonProtocol.SparseNullsOperation")
|
3424 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
1941 3425 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1942 3426 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1943 - | "{\n \"sparseStringList\": [\n null\n ]\n}".as_bytes(),
|
3427 + | "{\"ListOfStrings\":[\"abc\",\"mno\",\"xyz\"]}".as_bytes(),
|
1944 3428 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1945 3429 | )),
|
1946 3430 | ))
|
1947 3431 | .unwrap();
|
1948 3432 | #[allow(unused_mut)]
|
1949 3433 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1950 3434 | let config = crate::service::JsonProtocolConfig::builder().build();
|
1951 3435 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1952 - | .sparse_nulls_operation(move |input: crate::input::SparseNullsOperationInput| {
|
3436 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
1953 3437 | let sender = sender.clone();
|
1954 3438 | async move {
|
1955 3439 | let result = {
|
1956 - | let expected = crate::input::SparseNullsOperationInput {
|
1957 - | sparse_string_list: ::std::option::Option::Some(vec![
|
1958 - | ::std::option::Option::None,
|
1959 - | ]),
|
1960 - | sparse_string_map: ::std::option::Option::None,
|
1961 - | };
|
1962 - | ::pretty_assertions::assert_eq!(input, expected);
|
1963 - | let output = crate::output::SparseNullsOperationOutput {
|
1964 - | sparse_string_list: ::std::option::Option::None,
|
1965 - | sparse_string_map: ::std::option::Option::None,
|
3440 + | use ::aws_smithy_protocol_test::FloatEquals;
|
3441 + | let expected = crate::input::KitchenSinkOperationInput {
|
3442 + | list_of_strings: ::std::option::Option::Some(vec![
|
3443 + | "abc".to_owned(),
|
3444 + | "mno".to_owned(),
|
3445 + | "xyz".to_owned(),
|
3446 + | ]),
|
3447 + | blob: ::std::option::Option::None,
|
3448 + | boolean: ::std::option::Option::None,
|
3449 + | double: ::std::option::Option::None,
|
3450 + | empty_struct: ::std::option::Option::None,
|
3451 + | float: ::std::option::Option::None,
|
3452 + | httpdate_timestamp: ::std::option::Option::None,
|
3453 + | integer: ::std::option::Option::None,
|
3454 + | iso8601_timestamp: ::std::option::Option::None,
|
3455 + | json_value: ::std::option::Option::None,
|
3456 + | list_of_lists: ::std::option::Option::None,
|
3457 + | list_of_maps_of_strings: ::std::option::Option::None,
|
3458 + | list_of_structs: ::std::option::Option::None,
|
3459 + | long: ::std::option::Option::None,
|
3460 + | map_of_lists_of_strings: ::std::option::Option::None,
|
3461 + | map_of_maps: ::std::option::Option::None,
|
3462 + | map_of_strings: ::std::option::Option::None,
|
3463 + | map_of_structs: ::std::option::Option::None,
|
3464 + | recursive_list: ::std::option::Option::None,
|
3465 + | recursive_map: ::std::option::Option::None,
|
3466 + | recursive_struct: ::std::option::Option::None,
|
3467 + | simple_struct: ::std::option::Option::None,
|
3468 + | string: ::std::option::Option::None,
|
3469 + | struct_with_json_name: ::std::option::Option::None,
|
3470 + | timestamp: ::std::option::Option::None,
|
3471 + | unix_timestamp: ::std::option::Option::None,
|
1966 3472 | };
|
1967 - | output
|
3473 + | ::pretty_assertions::assert_eq!(
|
3474 + | input.blob,
|
3475 + | expected.blob,
|
3476 + | "Unexpected value for `blob`"
|
3477 + | );
|
3478 + | ::pretty_assertions::assert_eq!(
|
3479 + | input.boolean,
|
3480 + | expected.boolean,
|
3481 + | "Unexpected value for `boolean`"
|
3482 + | );
|
3483 + | assert!(
|
3484 + | input.double.float_equals(&expected.double),
|
3485 + | "Unexpected value for `double` {:?} vs. {:?}",
|
3486 + | expected.double,
|
3487 + | input.double
|
3488 + | );
|
3489 + | ::pretty_assertions::assert_eq!(
|
3490 + | input.empty_struct,
|
3491 + | expected.empty_struct,
|
3492 + | "Unexpected value for `empty_struct`"
|
3493 + | );
|
3494 + | assert!(
|
3495 + | input.float.float_equals(&expected.float),
|
3496 + | "Unexpected value for `float` {:?} vs. {:?}",
|
3497 + | expected.float,
|
3498 + | input.float
|
3499 + | );
|
3500 + | ::pretty_assertions::assert_eq!(
|
3501 + | input.httpdate_timestamp,
|
3502 + | expected.httpdate_timestamp,
|
3503 + | "Unexpected value for `httpdate_timestamp`"
|
3504 + | );
|
3505 + | ::pretty_assertions::assert_eq!(
|
3506 + | input.integer,
|
3507 + | expected.integer,
|
3508 + | "Unexpected value for `integer`"
|
3509 + | );
|
3510 + | ::pretty_assertions::assert_eq!(
|
3511 + | input.iso8601_timestamp,
|
3512 + | expected.iso8601_timestamp,
|
3513 + | "Unexpected value for `iso8601_timestamp`"
|
3514 + | );
|
3515 + | ::pretty_assertions::assert_eq!(
|
3516 + | input.json_value,
|
3517 + | expected.json_value,
|
3518 + | "Unexpected value for `json_value`"
|
3519 + | );
|
3520 + | ::pretty_assertions::assert_eq!(
|
3521 + | input.list_of_lists,
|
3522 + | expected.list_of_lists,
|
3523 + | "Unexpected value for `list_of_lists`"
|
3524 + | );
|
3525 + | ::pretty_assertions::assert_eq!(
|
3526 + | input.list_of_maps_of_strings,
|
3527 + | expected.list_of_maps_of_strings,
|
3528 + | "Unexpected value for `list_of_maps_of_strings`"
|
3529 + | );
|
3530 + | ::pretty_assertions::assert_eq!(
|
3531 + | input.list_of_strings,
|
3532 + | expected.list_of_strings,
|
3533 + | "Unexpected value for `list_of_strings`"
|
3534 + | );
|
3535 + | ::pretty_assertions::assert_eq!(
|
3536 + | input.list_of_structs,
|
3537 + | expected.list_of_structs,
|
3538 + | "Unexpected value for `list_of_structs`"
|
3539 + | );
|
3540 + | ::pretty_assertions::assert_eq!(
|
3541 + | input.long,
|
3542 + | expected.long,
|
3543 + | "Unexpected value for `long`"
|
3544 + | );
|
3545 + | ::pretty_assertions::assert_eq!(
|
3546 + | input.map_of_lists_of_strings,
|
3547 + | expected.map_of_lists_of_strings,
|
3548 + | "Unexpected value for `map_of_lists_of_strings`"
|
3549 + | );
|
3550 + | ::pretty_assertions::assert_eq!(
|
3551 + | input.map_of_maps,
|
3552 + | expected.map_of_maps,
|
3553 + | "Unexpected value for `map_of_maps`"
|
3554 + | );
|
3555 + | ::pretty_assertions::assert_eq!(
|
3556 + | input.map_of_strings,
|
3557 + | expected.map_of_strings,
|
3558 + | "Unexpected value for `map_of_strings`"
|
3559 + | );
|
3560 + | ::pretty_assertions::assert_eq!(
|
3561 + | input.map_of_structs,
|
3562 + | expected.map_of_structs,
|
3563 + | "Unexpected value for `map_of_structs`"
|
3564 + | );
|
3565 + | ::pretty_assertions::assert_eq!(
|
3566 + | input.recursive_list,
|
3567 + | expected.recursive_list,
|
3568 + | "Unexpected value for `recursive_list`"
|
3569 + | );
|
3570 + | ::pretty_assertions::assert_eq!(
|
3571 + | input.recursive_map,
|
3572 + | expected.recursive_map,
|
3573 + | "Unexpected value for `recursive_map`"
|
3574 + | );
|
3575 + | ::pretty_assertions::assert_eq!(
|
3576 + | input.recursive_struct,
|
3577 + | expected.recursive_struct,
|
3578 + | "Unexpected value for `recursive_struct`"
|
3579 + | );
|
3580 + | ::pretty_assertions::assert_eq!(
|
3581 + | input.simple_struct,
|
3582 + | expected.simple_struct,
|
3583 + | "Unexpected value for `simple_struct`"
|
3584 + | );
|
3585 + | ::pretty_assertions::assert_eq!(
|
3586 + | input.string,
|
3587 + | expected.string,
|
3588 + | "Unexpected value for `string`"
|
3589 + | );
|
3590 + | ::pretty_assertions::assert_eq!(
|
3591 + | input.struct_with_json_name,
|
3592 + | expected.struct_with_json_name,
|
3593 + | "Unexpected value for `struct_with_json_name`"
|
3594 + | );
|
3595 + | ::pretty_assertions::assert_eq!(
|
3596 + | input.timestamp,
|
3597 + | expected.timestamp,
|
3598 + | "Unexpected value for `timestamp`"
|
3599 + | );
|
3600 + | ::pretty_assertions::assert_eq!(
|
3601 + | input.unix_timestamp,
|
3602 + | expected.unix_timestamp,
|
3603 + | "Unexpected value for `unix_timestamp`"
|
3604 + | );
|
3605 + | let output = crate::output::KitchenSinkOperationOutput {
|
3606 + | blob: ::std::option::Option::None,
|
3607 + | boolean: ::std::option::Option::None,
|
3608 + | double: ::std::option::Option::None,
|
3609 + | empty_struct: ::std::option::Option::None,
|
3610 + | float: ::std::option::Option::None,
|
3611 + | httpdate_timestamp: ::std::option::Option::None,
|
3612 + | integer: ::std::option::Option::None,
|
3613 + | iso8601_timestamp: ::std::option::Option::None,
|
3614 + | json_value: ::std::option::Option::None,
|
3615 + | list_of_lists: ::std::option::Option::None,
|
3616 + | list_of_maps_of_strings: ::std::option::Option::None,
|
3617 + | list_of_strings: ::std::option::Option::None,
|
3618 + | list_of_structs: ::std::option::Option::None,
|
3619 + | long: ::std::option::Option::None,
|
3620 + | map_of_lists_of_strings: ::std::option::Option::None,
|
3621 + | map_of_maps: ::std::option::Option::None,
|
3622 + | map_of_strings: ::std::option::Option::None,
|
3623 + | map_of_structs: ::std::option::Option::None,
|
3624 + | recursive_list: ::std::option::Option::None,
|
3625 + | recursive_map: ::std::option::Option::None,
|
3626 + | recursive_struct: ::std::option::Option::None,
|
3627 + | simple_struct: ::std::option::Option::None,
|
3628 + | string: ::std::option::Option::None,
|
3629 + | struct_with_json_name: ::std::option::Option::None,
|
3630 + | timestamp: ::std::option::Option::None,
|
3631 + | unix_timestamp: ::std::option::Option::None,
|
3632 + | };
|
3633 + | Ok(output)
|
1968 3634 | };
|
1969 3635 | sender.send(()).await.expect("receiver dropped early");
|
1970 3636 | result
|
1971 3637 | }
|
1972 3638 | })
|
1973 3639 | .build_unchecked();
|
1974 3640 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1975 3641 | .await
|
1976 3642 | .expect("unable to make an HTTP request");
|
1977 3643 | assert!(
|
1978 3644 | receiver.recv().await.is_some(),
|
1979 3645 | "we expected operation handler to be invoked but it was not entered"
|
1980 3646 | );
|
1981 3647 | }
|
1982 3648 |
|
1983 - | /// Deserializes null values in maps
|
1984 - | /// Test ID: AwsJson11SparseMapsDeserializeNullValues
|
1985 - | #[::tokio::test]
|
1986 - | #[::tracing_test::traced_test]
|
1987 - | async fn aws_json11_sparse_maps_deserialize_null_values_response() {
|
1988 - | let output = crate::output::SparseNullsOperationOutput {
|
1989 - | sparse_string_map: ::std::option::Option::Some({
|
1990 - | let mut ret = ::std::collections::HashMap::new();
|
1991 - | ret.insert("foo".to_owned(), ::std::option::Option::None);
|
1992 - | ret
|
1993 - | }),
|
1994 - | sparse_string_list: ::std::option::Option::None,
|
1995 - | };
|
1996 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1997 - | let http_response = output.into_response();
|
1998 - | ::pretty_assertions::assert_eq!(
|
1999 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2000 - | http_response.status()
|
2001 - | );
|
2002 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
2003 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2004 - | http_response.headers(),
|
2005 - | expected_headers,
|
2006 - | ));
|
2007 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2008 - | .await
|
2009 - | .expect("unable to extract body to bytes");
|
2010 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2011 - | &body,
|
2012 - | "{\n \"sparseStringMap\": {\n \"foo\": null\n }\n}",
|
2013 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2014 - | ));
|
2015 - | }
|
2016 - |
|
2017 - | /// Deserializes null values in lists
|
2018 - | /// Test ID: AwsJson11SparseListsDeserializeNull
|
3649 + | /// Serializes empty list shapes
|
3650 + | /// Test ID: serializes_empty_list_shapes
|
2019 3651 | #[::tokio::test]
|
2020 3652 | #[::tracing_test::traced_test]
|
2021 - | async fn aws_json11_sparse_lists_deserialize_null_response() {
|
2022 - | let output = crate::output::SparseNullsOperationOutput {
|
2023 - | sparse_string_list: ::std::option::Option::Some(vec![::std::option::Option::None]),
|
2024 - | sparse_string_map: ::std::option::Option::None,
|
2025 - | };
|
2026 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
2027 - | let http_response = output.into_response();
|
2028 - | ::pretty_assertions::assert_eq!(
|
2029 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2030 - | http_response.status()
|
2031 - | );
|
2032 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
2033 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2034 - | http_response.headers(),
|
2035 - | expected_headers,
|
2036 - | ));
|
2037 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2038 - | .await
|
2039 - | .expect("unable to extract body to bytes");
|
2040 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2041 - | &body,
|
2042 - | "{\n \"sparseStringList\": [\n null\n ]\n}",
|
2043 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2044 - | ));
|
2045 - | }
|
2046 - | }
|
2047 - |
|
2048 - | ::pin_project_lite::pin_project! {
|
2049 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2050 - | /// [`NullOperationInput`](crate::input::NullOperationInput) using modelled bindings.
|
2051 - | pub struct NullOperationInputFuture {
|
2052 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::NullOperationInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
2053 - | }
|
2054 - | }
|
2055 - |
|
2056 - | impl std::future::Future for NullOperationInputFuture {
|
2057 - | type Output = Result<
|
2058 - | crate::input::NullOperationInput,
|
2059 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
2060 - | >;
|
2061 - |
|
2062 - | fn poll(
|
2063 - | self: std::pin::Pin<&mut Self>,
|
2064 - | cx: &mut std::task::Context<'_>,
|
2065 - | ) -> std::task::Poll<Self::Output> {
|
2066 - | let this = self.project();
|
2067 - | this.inner.as_mut().poll(cx)
|
2068 - | }
|
2069 - | }
|
2070 - |
|
2071 - | impl<B>
|
2072 - | ::aws_smithy_legacy_http_server::request::FromRequest<
|
2073 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2074 - | B,
|
2075 - | > for crate::input::NullOperationInput
|
2076 - | where
|
2077 - | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
2078 - | B: 'static,
|
2079 - |
|
2080 - | B::Data: Send,
|
2081 - | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
2082 - | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
2083 - | {
|
2084 - | type Rejection =
|
2085 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
2086 - | type Future = NullOperationInputFuture;
|
2087 - |
|
2088 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2089 - | let fut = async move {
|
2090 - | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
2091 - | request.headers(),
|
2092 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
2093 - | ) {
|
2094 - | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
2095 - | }
|
2096 - | crate::protocol_serde::shape_null_operation::de_null_operation_http_request(request)
|
2097 - | .await
|
2098 - | };
|
2099 - | use ::futures_util::future::TryFutureExt;
|
2100 - | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
2101 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2102 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
2103 - | });
|
2104 - | NullOperationInputFuture {
|
2105 - | inner: Box::pin(fut),
|
2106 - | }
|
2107 - | }
|
2108 - | }
|
2109 - | impl
|
2110 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
2111 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2112 - | > for crate::output::NullOperationOutput
|
2113 - | {
|
2114 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
2115 - | match crate::protocol_serde::shape_null_operation::ser_null_operation_http_response(self) {
|
2116 - | Ok(response) => response,
|
2117 - | Err(e) => {
|
2118 - | ::tracing::error!(error = %e, "failed to serialize response");
|
2119 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
2120 - | }
|
2121 - | }
|
2122 - | }
|
2123 - | }
|
2124 - |
|
2125 - | #[allow(unreachable_code, unused_variables)]
|
2126 - | #[cfg(test)]
|
2127 - | mod null_operation_test {
|
2128 - |
|
2129 - | /// Null structure values are dropped
|
2130 - | /// Test ID: AwsJson11ServersDontDeserializeNullStructureValues
|
2131 - | #[::tokio::test]
|
2132 - | #[::tracing_test::traced_test]
|
2133 - | async fn aws_json11_servers_dont_deserialize_null_structure_values_request() {
|
3653 + | async fn serializes_empty_list_shapes_request() {
|
2134 3654 | #[allow(unused_mut)]
|
2135 3655 | let mut http_request = ::http::Request::builder()
|
2136 3656 | .uri("/")
|
2137 3657 | .method("POST")
|
2138 3658 | .header("Content-Type", "application/x-amz-json-1.1")
|
2139 - | .header("X-Amz-Target", "JsonProtocol.NullOperation")
|
3659 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
2140 3660 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2141 3661 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2142 - | "{\n \"string\": null\n}".as_bytes(),
|
3662 + | "{\"ListOfStrings\":[]}".as_bytes(),
|
2143 3663 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2144 3664 | )),
|
2145 3665 | ))
|
2146 3666 | .unwrap();
|
2147 3667 | #[allow(unused_mut)]
|
2148 3668 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2149 3669 | let config = crate::service::JsonProtocolConfig::builder().build();
|
2150 3670 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2151 - | .null_operation(move |input: crate::input::NullOperationInput| {
|
3671 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
2152 3672 | let sender = sender.clone();
|
2153 3673 | async move {
|
2154 3674 | let result = {
|
2155 - | let expected = crate::input::NullOperationInput {
|
2156 - | string: ::std::option::Option::None,
|
2157 - | };
|
2158 - | ::pretty_assertions::assert_eq!(input, expected);
|
2159 - | let output = crate::output::NullOperationOutput {
|
3675 + | use ::aws_smithy_protocol_test::FloatEquals;
|
3676 + | let expected = crate::input::KitchenSinkOperationInput {
|
3677 + | list_of_strings: ::std::option::Option::Some(vec![]),
|
3678 + | blob: ::std::option::Option::None,
|
3679 + | boolean: ::std::option::Option::None,
|
3680 + | double: ::std::option::Option::None,
|
3681 + | empty_struct: ::std::option::Option::None,
|
3682 + | float: ::std::option::Option::None,
|
3683 + | httpdate_timestamp: ::std::option::Option::None,
|
3684 + | integer: ::std::option::Option::None,
|
3685 + | iso8601_timestamp: ::std::option::Option::None,
|
3686 + | json_value: ::std::option::Option::None,
|
3687 + | list_of_lists: ::std::option::Option::None,
|
3688 + | list_of_maps_of_strings: ::std::option::Option::None,
|
3689 + | list_of_structs: ::std::option::Option::None,
|
3690 + | long: ::std::option::Option::None,
|
3691 + | map_of_lists_of_strings: ::std::option::Option::None,
|
3692 + | map_of_maps: ::std::option::Option::None,
|
3693 + | map_of_strings: ::std::option::Option::None,
|
3694 + | map_of_structs: ::std::option::Option::None,
|
3695 + | recursive_list: ::std::option::Option::None,
|
3696 + | recursive_map: ::std::option::Option::None,
|
3697 + | recursive_struct: ::std::option::Option::None,
|
3698 + | simple_struct: ::std::option::Option::None,
|
2160 3699 | string: ::std::option::Option::None,
|
3700 + | struct_with_json_name: ::std::option::Option::None,
|
3701 + | timestamp: ::std::option::Option::None,
|
3702 + | unix_timestamp: ::std::option::Option::None,
|
2161 3703 | };
|
2162 - | output
|
2163 - | };
|
2164 - | sender.send(()).await.expect("receiver dropped early");
|
2165 - | result
|
2166 - | }
|
2167 - | })
|
2168 - | .build_unchecked();
|
2169 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2170 - | .await
|
2171 - | .expect("unable to make an HTTP request");
|
2172 - | assert!(
|
2173 - | receiver.recv().await.is_some(),
|
2174 - | "we expected operation handler to be invoked but it was not entered"
|
2175 - | );
|
2176 - | }
|
2177 - |
|
2178 - | /// Null structure values are dropped
|
2179 - | /// Test ID: AwsJson11ServersDontSerializeNullStructureValues
|
2180 - | #[::tokio::test]
|
2181 - | #[::tracing_test::traced_test]
|
2182 - | async fn aws_json11_servers_dont_serialize_null_structure_values_response() {
|
2183 - | let output = crate::output::NullOperationOutput {
|
2184 - | string: ::std::option::Option::None,
|
2185 - | };
|
2186 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
2187 - | let http_response = output.into_response();
|
2188 - | ::pretty_assertions::assert_eq!(
|
2189 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2190 - | http_response.status()
|
2191 - | );
|
2192 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
2193 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2194 - | http_response.headers(),
|
2195 - | expected_headers,
|
2196 - | ));
|
2197 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2198 - | .await
|
2199 - | .expect("unable to extract body to bytes");
|
2200 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2201 - | &body,
|
2202 - | "{}",
|
2203 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2204 - | ));
|
2205 - | }
|
2206 - | }
|
2207 - |
|
2208 - | ::pin_project_lite::pin_project! {
|
2209 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2210 - | /// [`JsonIntEnumsInput`](crate::input::JsonIntEnumsInput) using modelled bindings.
|
2211 - | pub struct JsonIntEnumsInputFuture {
|
2212 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::JsonIntEnumsInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
2213 - | }
|
2214 - | }
|
2215 - |
|
2216 - | impl std::future::Future for JsonIntEnumsInputFuture {
|
2217 - | type Output = Result<
|
2218 - | crate::input::JsonIntEnumsInput,
|
2219 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
2220 - | >;
|
2221 - |
|
2222 - | fn poll(
|
2223 - | self: std::pin::Pin<&mut Self>,
|
2224 - | cx: &mut std::task::Context<'_>,
|
2225 - | ) -> std::task::Poll<Self::Output> {
|
2226 - | let this = self.project();
|
2227 - | this.inner.as_mut().poll(cx)
|
2228 - | }
|
2229 - | }
|
2230 - |
|
2231 - | impl<B>
|
2232 - | ::aws_smithy_legacy_http_server::request::FromRequest<
|
2233 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2234 - | B,
|
2235 - | > for crate::input::JsonIntEnumsInput
|
2236 - | where
|
2237 - | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
2238 - | B: 'static,
|
2239 - |
|
2240 - | B::Data: Send,
|
2241 - | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
2242 - | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
2243 - | {
|
2244 - | type Rejection =
|
2245 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
2246 - | type Future = JsonIntEnumsInputFuture;
|
2247 - |
|
2248 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2249 - | let fut = async move {
|
2250 - | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
2251 - | request.headers(),
|
2252 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
2253 - | ) {
|
2254 - | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
2255 - | }
|
2256 - | crate::protocol_serde::shape_json_int_enums::de_json_int_enums_http_request(request)
|
2257 - | .await
|
2258 - | };
|
2259 - | use ::futures_util::future::TryFutureExt;
|
2260 - | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
2261 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2262 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
2263 - | });
|
2264 - | JsonIntEnumsInputFuture {
|
2265 - | inner: Box::pin(fut),
|
2266 - | }
|
2267 - | }
|
2268 - | }
|
2269 - | impl
|
2270 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
2271 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2272 - | > for crate::output::JsonIntEnumsOutput
|
2273 - | {
|
2274 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
2275 - | match crate::protocol_serde::shape_json_int_enums::ser_json_int_enums_http_response(self) {
|
2276 - | Ok(response) => response,
|
2277 - | Err(e) => {
|
2278 - | ::tracing::error!(error = %e, "failed to serialize response");
|
2279 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
2280 - | }
|
2281 - | }
|
2282 - | }
|
2283 - | }
|
2284 - | impl
|
2285 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
2286 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2287 - | > for crate::error::JsonIntEnumsError
|
2288 - | {
|
2289 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
2290 - | match crate::protocol_serde::shape_json_int_enums::ser_json_int_enums_http_error(&self) {
|
2291 - | Ok(mut response) => {
|
2292 - | response.extensions_mut().insert(
|
2293 - | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
2294 - | self.name(),
|
2295 - | ),
|
2296 - | );
|
2297 - | response
|
2298 - | }
|
2299 - | Err(e) => {
|
2300 - | ::tracing::error!(error = %e, "failed to serialize response");
|
2301 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
2302 - | }
|
2303 - | }
|
3704 + | ::pretty_assertions::assert_eq!(
|
3705 + | input.blob,
|
3706 + | expected.blob,
|
3707 + | "Unexpected value for `blob`"
|
3708 + | );
|
3709 + | ::pretty_assertions::assert_eq!(
|
3710 + | input.boolean,
|
3711 + | expected.boolean,
|
3712 + | "Unexpected value for `boolean`"
|
3713 + | );
|
3714 + | assert!(
|
3715 + | input.double.float_equals(&expected.double),
|
3716 + | "Unexpected value for `double` {:?} vs. {:?}",
|
3717 + | expected.double,
|
3718 + | input.double
|
3719 + | );
|
3720 + | ::pretty_assertions::assert_eq!(
|
3721 + | input.empty_struct,
|
3722 + | expected.empty_struct,
|
3723 + | "Unexpected value for `empty_struct`"
|
3724 + | );
|
3725 + | assert!(
|
3726 + | input.float.float_equals(&expected.float),
|
3727 + | "Unexpected value for `float` {:?} vs. {:?}",
|
3728 + | expected.float,
|
3729 + | input.float
|
3730 + | );
|
3731 + | ::pretty_assertions::assert_eq!(
|
3732 + | input.httpdate_timestamp,
|
3733 + | expected.httpdate_timestamp,
|
3734 + | "Unexpected value for `httpdate_timestamp`"
|
3735 + | );
|
3736 + | ::pretty_assertions::assert_eq!(
|
3737 + | input.integer,
|
3738 + | expected.integer,
|
3739 + | "Unexpected value for `integer`"
|
3740 + | );
|
3741 + | ::pretty_assertions::assert_eq!(
|
3742 + | input.iso8601_timestamp,
|
3743 + | expected.iso8601_timestamp,
|
3744 + | "Unexpected value for `iso8601_timestamp`"
|
3745 + | );
|
3746 + | ::pretty_assertions::assert_eq!(
|
3747 + | input.json_value,
|
3748 + | expected.json_value,
|
3749 + | "Unexpected value for `json_value`"
|
3750 + | );
|
3751 + | ::pretty_assertions::assert_eq!(
|
3752 + | input.list_of_lists,
|
3753 + | expected.list_of_lists,
|
3754 + | "Unexpected value for `list_of_lists`"
|
3755 + | );
|
3756 + | ::pretty_assertions::assert_eq!(
|
3757 + | input.list_of_maps_of_strings,
|
3758 + | expected.list_of_maps_of_strings,
|
3759 + | "Unexpected value for `list_of_maps_of_strings`"
|
3760 + | );
|
3761 + | ::pretty_assertions::assert_eq!(
|
3762 + | input.list_of_strings,
|
3763 + | expected.list_of_strings,
|
3764 + | "Unexpected value for `list_of_strings`"
|
3765 + | );
|
3766 + | ::pretty_assertions::assert_eq!(
|
3767 + | input.list_of_structs,
|
3768 + | expected.list_of_structs,
|
3769 + | "Unexpected value for `list_of_structs`"
|
3770 + | );
|
3771 + | ::pretty_assertions::assert_eq!(
|
3772 + | input.long,
|
3773 + | expected.long,
|
3774 + | "Unexpected value for `long`"
|
3775 + | );
|
3776 + | ::pretty_assertions::assert_eq!(
|
3777 + | input.map_of_lists_of_strings,
|
3778 + | expected.map_of_lists_of_strings,
|
3779 + | "Unexpected value for `map_of_lists_of_strings`"
|
3780 + | );
|
3781 + | ::pretty_assertions::assert_eq!(
|
3782 + | input.map_of_maps,
|
3783 + | expected.map_of_maps,
|
3784 + | "Unexpected value for `map_of_maps`"
|
3785 + | );
|
3786 + | ::pretty_assertions::assert_eq!(
|
3787 + | input.map_of_strings,
|
3788 + | expected.map_of_strings,
|
3789 + | "Unexpected value for `map_of_strings`"
|
3790 + | );
|
3791 + | ::pretty_assertions::assert_eq!(
|
3792 + | input.map_of_structs,
|
3793 + | expected.map_of_structs,
|
3794 + | "Unexpected value for `map_of_structs`"
|
3795 + | );
|
3796 + | ::pretty_assertions::assert_eq!(
|
3797 + | input.recursive_list,
|
3798 + | expected.recursive_list,
|
3799 + | "Unexpected value for `recursive_list`"
|
3800 + | );
|
3801 + | ::pretty_assertions::assert_eq!(
|
3802 + | input.recursive_map,
|
3803 + | expected.recursive_map,
|
3804 + | "Unexpected value for `recursive_map`"
|
3805 + | );
|
3806 + | ::pretty_assertions::assert_eq!(
|
3807 + | input.recursive_struct,
|
3808 + | expected.recursive_struct,
|
3809 + | "Unexpected value for `recursive_struct`"
|
3810 + | );
|
3811 + | ::pretty_assertions::assert_eq!(
|
3812 + | input.simple_struct,
|
3813 + | expected.simple_struct,
|
3814 + | "Unexpected value for `simple_struct`"
|
3815 + | );
|
3816 + | ::pretty_assertions::assert_eq!(
|
3817 + | input.string,
|
3818 + | expected.string,
|
3819 + | "Unexpected value for `string`"
|
3820 + | );
|
3821 + | ::pretty_assertions::assert_eq!(
|
3822 + | input.struct_with_json_name,
|
3823 + | expected.struct_with_json_name,
|
3824 + | "Unexpected value for `struct_with_json_name`"
|
3825 + | );
|
3826 + | ::pretty_assertions::assert_eq!(
|
3827 + | input.timestamp,
|
3828 + | expected.timestamp,
|
3829 + | "Unexpected value for `timestamp`"
|
3830 + | );
|
3831 + | ::pretty_assertions::assert_eq!(
|
3832 + | input.unix_timestamp,
|
3833 + | expected.unix_timestamp,
|
3834 + | "Unexpected value for `unix_timestamp`"
|
3835 + | );
|
3836 + | let output = crate::output::KitchenSinkOperationOutput {
|
3837 + | blob: ::std::option::Option::None,
|
3838 + | boolean: ::std::option::Option::None,
|
3839 + | double: ::std::option::Option::None,
|
3840 + | empty_struct: ::std::option::Option::None,
|
3841 + | float: ::std::option::Option::None,
|
3842 + | httpdate_timestamp: ::std::option::Option::None,
|
3843 + | integer: ::std::option::Option::None,
|
3844 + | iso8601_timestamp: ::std::option::Option::None,
|
3845 + | json_value: ::std::option::Option::None,
|
3846 + | list_of_lists: ::std::option::Option::None,
|
3847 + | list_of_maps_of_strings: ::std::option::Option::None,
|
3848 + | list_of_strings: ::std::option::Option::None,
|
3849 + | list_of_structs: ::std::option::Option::None,
|
3850 + | long: ::std::option::Option::None,
|
3851 + | map_of_lists_of_strings: ::std::option::Option::None,
|
3852 + | map_of_maps: ::std::option::Option::None,
|
3853 + | map_of_strings: ::std::option::Option::None,
|
3854 + | map_of_structs: ::std::option::Option::None,
|
3855 + | recursive_list: ::std::option::Option::None,
|
3856 + | recursive_map: ::std::option::Option::None,
|
3857 + | recursive_struct: ::std::option::Option::None,
|
3858 + | simple_struct: ::std::option::Option::None,
|
3859 + | string: ::std::option::Option::None,
|
3860 + | struct_with_json_name: ::std::option::Option::None,
|
3861 + | timestamp: ::std::option::Option::None,
|
3862 + | unix_timestamp: ::std::option::Option::None,
|
3863 + | };
|
3864 + | Ok(output)
|
3865 + | };
|
3866 + | sender.send(()).await.expect("receiver dropped early");
|
3867 + | result
|
3868 + | }
|
3869 + | })
|
3870 + | .build_unchecked();
|
3871 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3872 + | .await
|
3873 + | .expect("unable to make an HTTP request");
|
3874 + | assert!(
|
3875 + | receiver.recv().await.is_some(),
|
3876 + | "we expected operation handler to be invoked but it was not entered"
|
3877 + | );
|
2304 3878 | }
|
2305 - | }
|
2306 - |
|
2307 - | #[allow(unreachable_code, unused_variables)]
|
2308 - | #[cfg(test)]
|
2309 - | mod json_int_enums_test {
|
2310 3879 |
|
2311 - | /// Serializes simple scalar properties
|
2312 - | /// Test ID: AwsJson11IntEnums
|
3880 + | /// Serializes list of map shapes
|
3881 + | /// Test ID: serializes_list_of_map_shapes
|
2313 3882 | #[::tokio::test]
|
2314 3883 | #[::tracing_test::traced_test]
|
2315 - | async fn aws_json11_int_enums_request() {
|
3884 + | async fn serializes_list_of_map_shapes_request() {
|
2316 3885 | #[allow(unused_mut)]
|
2317 3886 | let mut http_request = ::http::Request::builder()
|
2318 3887 | .uri("/")
|
2319 3888 | .method("POST")
|
2320 3889 | .header("Content-Type", "application/x-amz-json-1.1")
|
2321 - | .header("X-Amz-Target", "JsonProtocol.JsonIntEnums")
|
3890 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
2322 3891 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2323 3892 | ::bytes::Bytes::copy_from_slice(
|
2324 - | &::aws_smithy_protocol_test::decode_body_data("{\n \"intEnum1\": 1,\n \"intEnum2\": 2,\n \"intEnum3\": 3,\n \"intEnumList\": [\n 1,\n 2\n ],\n \"intEnumSet\": [\n 1,\n 2\n ],\n \"intEnumMap\": {\n \"a\": 1,\n \"b\": 2\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3893 + | &::aws_smithy_protocol_test::decode_body_data("{\"ListOfMapsOfStrings\":[{\"foo\":\"bar\"},{\"abc\":\"xyz\"},{\"red\":\"blue\"}]}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2325 3894 | )
|
2326 3895 | )).unwrap();
|
2327 3896 | #[allow(unused_mut)]
|
2328 3897 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2329 3898 | let config = crate::service::JsonProtocolConfig::builder().build();
|
2330 3899 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2331 - | .json_int_enums(move |input: crate::input::JsonIntEnumsInput| {
|
3900 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
2332 3901 | let sender = sender.clone();
|
2333 3902 | async move {
|
2334 3903 | let result = {
|
2335 - | let expected = crate::input::JsonIntEnumsInput {
|
2336 - | int_enum1: ::std::option::Option::Some(1),
|
2337 - | int_enum2: ::std::option::Option::Some(2),
|
2338 - | int_enum3: ::std::option::Option::Some(3),
|
2339 - | int_enum_list: ::std::option::Option::Some(vec![1, 2]),
|
2340 - | int_enum_set: ::std::option::Option::Some(
|
2341 - | vec![1, 2].try_into().expect("this is only used in tests"),
|
2342 - | ),
|
2343 - | int_enum_map: ::std::option::Option::Some({
|
2344 - | let mut ret = ::std::collections::HashMap::new();
|
2345 - | ret.insert("a".to_owned(), 1);
|
2346 - | ret.insert("b".to_owned(), 2);
|
2347 - | ret
|
2348 - | }),
|
2349 - | };
|
2350 - | ::pretty_assertions::assert_eq!(input, expected);
|
2351 - | let output = crate::output::JsonIntEnumsOutput {
|
2352 - | int_enum1: ::std::option::Option::None,
|
2353 - | int_enum2: ::std::option::Option::None,
|
2354 - | int_enum3: ::std::option::Option::None,
|
2355 - | int_enum_list: ::std::option::Option::None,
|
2356 - | int_enum_set: ::std::option::Option::None,
|
2357 - | int_enum_map: ::std::option::Option::None,
|
2358 - | };
|
2359 - | Ok(output)
|
2360 - | };
|
2361 - | sender.send(()).await.expect("receiver dropped early");
|
2362 - | result
|
2363 - | }
|
2364 - | })
|
2365 - | .build_unchecked();
|
2366 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2367 - | .await
|
2368 - | .expect("unable to make an HTTP request");
|
2369 - | assert!(
|
2370 - | receiver.recv().await.is_some(),
|
2371 - | "we expected operation handler to be invoked but it was not entered"
|
2372 - | );
|
2373 - | }
|
2374 - |
|
2375 - | /// Serializes simple scalar properties
|
2376 - | /// Test ID: AwsJson11IntEnums
|
2377 - | #[::tokio::test]
|
2378 - | #[::tracing_test::traced_test]
|
2379 - | #[should_panic]
|
2380 - | async fn aws_json11_int_enums_response() {
|
2381 - | let output = crate::output::JsonIntEnumsOutput {
|
2382 - | int_enum1: ::std::option::Option::Some(1),
|
2383 - | int_enum2: ::std::option::Option::Some(2),
|
2384 - | int_enum3: ::std::option::Option::Some(3),
|
2385 - | int_enum_list: ::std::option::Option::Some(vec![1, 2]),
|
2386 - | int_enum_set: ::std::option::Option::Some(
|
2387 - | vec![1, 2].try_into().expect("this is only used in tests"),
|
2388 - | ),
|
2389 - | int_enum_map: ::std::option::Option::Some({
|
2390 - | let mut ret = ::std::collections::HashMap::new();
|
2391 - | ret.insert("a".to_owned(), 1);
|
2392 - | ret.insert("b".to_owned(), 2);
|
2393 - | ret
|
2394 - | }),
|
2395 - | };
|
2396 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
2397 - | let http_response = output.into_response();
|
2398 - | ::pretty_assertions::assert_eq!(
|
2399 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2400 - | http_response.status()
|
2401 - | );
|
2402 - | let expected_headers = [
|
2403 - | ("Content-Type", "application/x-amz-json-1.1"),
|
2404 - | ("X-Amz-Target", "JsonProtocol.JsonIntEnums"),
|
2405 - | ];
|
2406 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2407 - | http_response.headers(),
|
2408 - | expected_headers,
|
2409 - | ));
|
2410 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3904 + | use ::aws_smithy_protocol_test::FloatEquals;
|
3905 + | let expected = crate::input::KitchenSinkOperationInput {
|
3906 + | list_of_maps_of_strings: ::std::option::Option::Some(vec![
|
3907 + | {
|
3908 + | let mut ret = ::std::collections::HashMap::new();
|
3909 + | ret.insert("foo".to_owned(), "bar".to_owned());
|
3910 + | ret
|
3911 + | },
|
3912 + | {
|
3913 + | let mut ret = ::std::collections::HashMap::new();
|
3914 + | ret.insert("abc".to_owned(), "xyz".to_owned());
|
3915 + | ret
|
3916 + | },
|
3917 + | {
|
3918 + | let mut ret = ::std::collections::HashMap::new();
|
3919 + | ret.insert("red".to_owned(), "blue".to_owned());
|
3920 + | ret
|
3921 + | },
|
3922 + | ]),
|
3923 + | blob: ::std::option::Option::None,
|
3924 + | boolean: ::std::option::Option::None,
|
3925 + | double: ::std::option::Option::None,
|
3926 + | empty_struct: ::std::option::Option::None,
|
3927 + | float: ::std::option::Option::None,
|
3928 + | httpdate_timestamp: ::std::option::Option::None,
|
3929 + | integer: ::std::option::Option::None,
|
3930 + | iso8601_timestamp: ::std::option::Option::None,
|
3931 + | json_value: ::std::option::Option::None,
|
3932 + | list_of_lists: ::std::option::Option::None,
|
3933 + | list_of_strings: ::std::option::Option::None,
|
3934 + | list_of_structs: ::std::option::Option::None,
|
3935 + | long: ::std::option::Option::None,
|
3936 + | map_of_lists_of_strings: ::std::option::Option::None,
|
3937 + | map_of_maps: ::std::option::Option::None,
|
3938 + | map_of_strings: ::std::option::Option::None,
|
3939 + | map_of_structs: ::std::option::Option::None,
|
3940 + | recursive_list: ::std::option::Option::None,
|
3941 + | recursive_map: ::std::option::Option::None,
|
3942 + | recursive_struct: ::std::option::Option::None,
|
3943 + | simple_struct: ::std::option::Option::None,
|
3944 + | string: ::std::option::Option::None,
|
3945 + | struct_with_json_name: ::std::option::Option::None,
|
3946 + | timestamp: ::std::option::Option::None,
|
3947 + | unix_timestamp: ::std::option::Option::None,
|
3948 + | };
|
3949 + | ::pretty_assertions::assert_eq!(
|
3950 + | input.blob,
|
3951 + | expected.blob,
|
3952 + | "Unexpected value for `blob`"
|
3953 + | );
|
3954 + | ::pretty_assertions::assert_eq!(
|
3955 + | input.boolean,
|
3956 + | expected.boolean,
|
3957 + | "Unexpected value for `boolean`"
|
3958 + | );
|
3959 + | assert!(
|
3960 + | input.double.float_equals(&expected.double),
|
3961 + | "Unexpected value for `double` {:?} vs. {:?}",
|
3962 + | expected.double,
|
3963 + | input.double
|
3964 + | );
|
3965 + | ::pretty_assertions::assert_eq!(
|
3966 + | input.empty_struct,
|
3967 + | expected.empty_struct,
|
3968 + | "Unexpected value for `empty_struct`"
|
3969 + | );
|
3970 + | assert!(
|
3971 + | input.float.float_equals(&expected.float),
|
3972 + | "Unexpected value for `float` {:?} vs. {:?}",
|
3973 + | expected.float,
|
3974 + | input.float
|
3975 + | );
|
3976 + | ::pretty_assertions::assert_eq!(
|
3977 + | input.httpdate_timestamp,
|
3978 + | expected.httpdate_timestamp,
|
3979 + | "Unexpected value for `httpdate_timestamp`"
|
3980 + | );
|
3981 + | ::pretty_assertions::assert_eq!(
|
3982 + | input.integer,
|
3983 + | expected.integer,
|
3984 + | "Unexpected value for `integer`"
|
3985 + | );
|
3986 + | ::pretty_assertions::assert_eq!(
|
3987 + | input.iso8601_timestamp,
|
3988 + | expected.iso8601_timestamp,
|
3989 + | "Unexpected value for `iso8601_timestamp`"
|
3990 + | );
|
3991 + | ::pretty_assertions::assert_eq!(
|
3992 + | input.json_value,
|
3993 + | expected.json_value,
|
3994 + | "Unexpected value for `json_value`"
|
3995 + | );
|
3996 + | ::pretty_assertions::assert_eq!(
|
3997 + | input.list_of_lists,
|
3998 + | expected.list_of_lists,
|
3999 + | "Unexpected value for `list_of_lists`"
|
4000 + | );
|
4001 + | ::pretty_assertions::assert_eq!(
|
4002 + | input.list_of_maps_of_strings,
|
4003 + | expected.list_of_maps_of_strings,
|
4004 + | "Unexpected value for `list_of_maps_of_strings`"
|
4005 + | );
|
4006 + | ::pretty_assertions::assert_eq!(
|
4007 + | input.list_of_strings,
|
4008 + | expected.list_of_strings,
|
4009 + | "Unexpected value for `list_of_strings`"
|
4010 + | );
|
4011 + | ::pretty_assertions::assert_eq!(
|
4012 + | input.list_of_structs,
|
4013 + | expected.list_of_structs,
|
4014 + | "Unexpected value for `list_of_structs`"
|
4015 + | );
|
4016 + | ::pretty_assertions::assert_eq!(
|
4017 + | input.long,
|
4018 + | expected.long,
|
4019 + | "Unexpected value for `long`"
|
4020 + | );
|
4021 + | ::pretty_assertions::assert_eq!(
|
4022 + | input.map_of_lists_of_strings,
|
4023 + | expected.map_of_lists_of_strings,
|
4024 + | "Unexpected value for `map_of_lists_of_strings`"
|
4025 + | );
|
4026 + | ::pretty_assertions::assert_eq!(
|
4027 + | input.map_of_maps,
|
4028 + | expected.map_of_maps,
|
4029 + | "Unexpected value for `map_of_maps`"
|
4030 + | );
|
4031 + | ::pretty_assertions::assert_eq!(
|
4032 + | input.map_of_strings,
|
4033 + | expected.map_of_strings,
|
4034 + | "Unexpected value for `map_of_strings`"
|
4035 + | );
|
4036 + | ::pretty_assertions::assert_eq!(
|
4037 + | input.map_of_structs,
|
4038 + | expected.map_of_structs,
|
4039 + | "Unexpected value for `map_of_structs`"
|
4040 + | );
|
4041 + | ::pretty_assertions::assert_eq!(
|
4042 + | input.recursive_list,
|
4043 + | expected.recursive_list,
|
4044 + | "Unexpected value for `recursive_list`"
|
4045 + | );
|
4046 + | ::pretty_assertions::assert_eq!(
|
4047 + | input.recursive_map,
|
4048 + | expected.recursive_map,
|
4049 + | "Unexpected value for `recursive_map`"
|
4050 + | );
|
4051 + | ::pretty_assertions::assert_eq!(
|
4052 + | input.recursive_struct,
|
4053 + | expected.recursive_struct,
|
4054 + | "Unexpected value for `recursive_struct`"
|
4055 + | );
|
4056 + | ::pretty_assertions::assert_eq!(
|
4057 + | input.simple_struct,
|
4058 + | expected.simple_struct,
|
4059 + | "Unexpected value for `simple_struct`"
|
4060 + | );
|
4061 + | ::pretty_assertions::assert_eq!(
|
4062 + | input.string,
|
4063 + | expected.string,
|
4064 + | "Unexpected value for `string`"
|
4065 + | );
|
4066 + | ::pretty_assertions::assert_eq!(
|
4067 + | input.struct_with_json_name,
|
4068 + | expected.struct_with_json_name,
|
4069 + | "Unexpected value for `struct_with_json_name`"
|
4070 + | );
|
4071 + | ::pretty_assertions::assert_eq!(
|
4072 + | input.timestamp,
|
4073 + | expected.timestamp,
|
4074 + | "Unexpected value for `timestamp`"
|
4075 + | );
|
4076 + | ::pretty_assertions::assert_eq!(
|
4077 + | input.unix_timestamp,
|
4078 + | expected.unix_timestamp,
|
4079 + | "Unexpected value for `unix_timestamp`"
|
4080 + | );
|
4081 + | let output = crate::output::KitchenSinkOperationOutput {
|
4082 + | blob: ::std::option::Option::None,
|
4083 + | boolean: ::std::option::Option::None,
|
4084 + | double: ::std::option::Option::None,
|
4085 + | empty_struct: ::std::option::Option::None,
|
4086 + | float: ::std::option::Option::None,
|
4087 + | httpdate_timestamp: ::std::option::Option::None,
|
4088 + | integer: ::std::option::Option::None,
|
4089 + | iso8601_timestamp: ::std::option::Option::None,
|
4090 + | json_value: ::std::option::Option::None,
|
4091 + | list_of_lists: ::std::option::Option::None,
|
4092 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4093 + | list_of_strings: ::std::option::Option::None,
|
4094 + | list_of_structs: ::std::option::Option::None,
|
4095 + | long: ::std::option::Option::None,
|
4096 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4097 + | map_of_maps: ::std::option::Option::None,
|
4098 + | map_of_strings: ::std::option::Option::None,
|
4099 + | map_of_structs: ::std::option::Option::None,
|
4100 + | recursive_list: ::std::option::Option::None,
|
4101 + | recursive_map: ::std::option::Option::None,
|
4102 + | recursive_struct: ::std::option::Option::None,
|
4103 + | simple_struct: ::std::option::Option::None,
|
4104 + | string: ::std::option::Option::None,
|
4105 + | struct_with_json_name: ::std::option::Option::None,
|
4106 + | timestamp: ::std::option::Option::None,
|
4107 + | unix_timestamp: ::std::option::Option::None,
|
4108 + | };
|
4109 + | Ok(output)
|
4110 + | };
|
4111 + | sender.send(()).await.expect("receiver dropped early");
|
4112 + | result
|
4113 + | }
|
4114 + | })
|
4115 + | .build_unchecked();
|
4116 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2411 4117 | .await
|
2412 - | .expect("unable to extract body to bytes");
|
2413 - | ::aws_smithy_protocol_test::assert_ok(
|
2414 - | ::aws_smithy_protocol_test::validate_body(&body, "{\n \"intEnum1\": 1,\n \"intEnum2\": 2,\n \"intEnum3\": 3,\n \"intEnumList\": [\n 1,\n 2\n ],\n \"intEnumSet\": [\n 1,\n 2\n ],\n \"intEnumMap\": {\n \"a\": 1,\n \"b\": 2\n }\n}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4118 + | .expect("unable to make an HTTP request");
|
4119 + | assert!(
|
4120 + | receiver.recv().await.is_some(),
|
4121 + | "we expected operation handler to be invoked but it was not entered"
|
2415 4122 | );
|
2416 4123 | }
|
2417 - | }
|
2418 - |
|
2419 - | ::pin_project_lite::pin_project! {
|
2420 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2421 - | /// [`JsonEnumsInput`](crate::input::JsonEnumsInput) using modelled bindings.
|
2422 - | pub struct JsonEnumsInputFuture {
|
2423 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::JsonEnumsInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
2424 - | }
|
2425 - | }
|
2426 4124 |
|
2427 - | impl std::future::Future for JsonEnumsInputFuture {
|
2428 - | type Output = Result<
|
2429 - | crate::input::JsonEnumsInput,
|
2430 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
2431 - | >;
|
2432 - |
|
2433 - | fn poll(
|
2434 - | self: std::pin::Pin<&mut Self>,
|
2435 - | cx: &mut std::task::Context<'_>,
|
2436 - | ) -> std::task::Poll<Self::Output> {
|
2437 - | let this = self.project();
|
2438 - | this.inner.as_mut().poll(cx)
|
2439 - | }
|
2440 - | }
|
2441 - |
|
2442 - | impl<B>
|
2443 - | ::aws_smithy_legacy_http_server::request::FromRequest<
|
2444 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2445 - | B,
|
2446 - | > for crate::input::JsonEnumsInput
|
2447 - | where
|
2448 - | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
2449 - | B: 'static,
|
2450 - |
|
2451 - | B::Data: Send,
|
2452 - | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
2453 - | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
2454 - | {
|
2455 - | type Rejection =
|
2456 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
2457 - | type Future = JsonEnumsInputFuture;
|
2458 - |
|
2459 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2460 - | let fut = async move {
|
2461 - | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
2462 - | request.headers(),
|
2463 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
2464 - | ) {
|
2465 - | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
2466 - | }
|
2467 - | crate::protocol_serde::shape_json_enums::de_json_enums_http_request(request).await
|
2468 - | };
|
2469 - | use ::futures_util::future::TryFutureExt;
|
2470 - | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
2471 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2472 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
2473 - | });
|
2474 - | JsonEnumsInputFuture {
|
2475 - | inner: Box::pin(fut),
|
2476 - | }
|
2477 - | }
|
2478 - | }
|
2479 - | impl
|
2480 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
2481 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2482 - | > for crate::output::JsonEnumsOutput
|
2483 - | {
|
2484 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
2485 - | match crate::protocol_serde::shape_json_enums::ser_json_enums_http_response(self) {
|
2486 - | Ok(response) => response,
|
2487 - | Err(e) => {
|
2488 - | ::tracing::error!(error = %e, "failed to serialize response");
|
2489 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
2490 - | }
|
2491 - | }
|
2492 - | }
|
2493 - | }
|
2494 - | impl
|
2495 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
2496 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2497 - | > for crate::error::JsonEnumsError
|
2498 - | {
|
2499 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
2500 - | match crate::protocol_serde::shape_json_enums::ser_json_enums_http_error(&self) {
|
2501 - | Ok(mut response) => {
|
2502 - | response.extensions_mut().insert(
|
2503 - | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
2504 - | self.name(),
|
2505 - | ),
|
2506 - | );
|
2507 - | response
|
2508 - | }
|
2509 - | Err(e) => {
|
2510 - | ::tracing::error!(error = %e, "failed to serialize response");
|
2511 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
2512 - | }
|
2513 - | }
|
2514 - | }
|
2515 - | }
|
2516 - |
|
2517 - | #[allow(unreachable_code, unused_variables)]
|
2518 - | #[cfg(test)]
|
2519 - | mod json_enums_test {
|
2520 - |
|
2521 - | /// Serializes simple scalar properties
|
2522 - | /// Test ID: AwsJson11Enums
|
4125 + | /// Serializes list of structure shapes
|
4126 + | /// Test ID: serializes_list_of_structure_shapes
|
2523 4127 | #[::tokio::test]
|
2524 4128 | #[::tracing_test::traced_test]
|
2525 - | async fn aws_json11_enums_request() {
|
4129 + | async fn serializes_list_of_structure_shapes_request() {
|
2526 4130 | #[allow(unused_mut)]
|
2527 4131 | let mut http_request = ::http::Request::builder()
|
2528 4132 | .uri("/")
|
2529 4133 | .method("POST")
|
2530 4134 | .header("Content-Type", "application/x-amz-json-1.1")
|
2531 - | .header("X-Amz-Target", "JsonProtocol.JsonEnums")
|
4135 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
2532 4136 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2533 4137 | ::bytes::Bytes::copy_from_slice(
|
2534 - | &::aws_smithy_protocol_test::decode_body_data("{\n \"fooEnum1\": \"Foo\",\n \"fooEnum2\": \"0\",\n \"fooEnum3\": \"1\",\n \"fooEnumList\": [\n \"Foo\",\n \"0\"\n ],\n \"fooEnumSet\": [\n \"Foo\",\n \"0\"\n ],\n \"fooEnumMap\": {\n \"hi\": \"Foo\",\n \"zero\": \"0\"\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4138 + | &::aws_smithy_protocol_test::decode_body_data("{\"ListOfStructs\":[{\"Value\":\"abc\"},{\"Value\":\"mno\"},{\"Value\":\"xyz\"}]}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2535 4139 | )
|
2536 4140 | )).unwrap();
|
2537 4141 | #[allow(unused_mut)]
|
2538 4142 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2539 4143 | let config = crate::service::JsonProtocolConfig::builder().build();
|
2540 4144 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2541 - | .json_enums(move |input: crate::input::JsonEnumsInput| {
|
4145 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
2542 4146 | let sender = sender.clone();
|
2543 4147 | async move {
|
2544 4148 | let result = {
|
2545 - | let expected = crate::input::JsonEnumsInput {
|
2546 - | foo_enum1: ::std::option::Option::Some(
|
2547 - | "Foo"
|
2548 - | .parse::<crate::model::FooEnum>()
|
2549 - | .expect("static value validated to member"),
|
2550 - | ),
|
2551 - | foo_enum2: ::std::option::Option::Some(
|
2552 - | "0".parse::<crate::model::FooEnum>()
|
2553 - | .expect("static value validated to member"),
|
2554 - | ),
|
2555 - | foo_enum3: ::std::option::Option::Some(
|
2556 - | "1".parse::<crate::model::FooEnum>()
|
2557 - | .expect("static value validated to member"),
|
2558 - | ),
|
2559 - | foo_enum_list: ::std::option::Option::Some(vec![
|
2560 - | "Foo"
|
2561 - | .parse::<crate::model::FooEnum>()
|
2562 - | .expect("static value validated to member"),
|
2563 - | "0".parse::<crate::model::FooEnum>()
|
2564 - | .expect("static value validated to member"),
|
4149 + | use ::aws_smithy_protocol_test::FloatEquals;
|
4150 + | let expected = crate::input::KitchenSinkOperationInput {
|
4151 + | list_of_structs: ::std::option::Option::Some(vec![
|
4152 + | crate::model::SimpleStruct {
|
4153 + | value: ::std::option::Option::Some("abc".to_owned()),
|
4154 + | },
|
4155 + | crate::model::SimpleStruct {
|
4156 + | value: ::std::option::Option::Some("mno".to_owned()),
|
4157 + | },
|
4158 + | crate::model::SimpleStruct {
|
4159 + | value: ::std::option::Option::Some("xyz".to_owned()),
|
4160 + | },
|
2565 4161 | ]),
|
2566 - | foo_enum_set: ::std::option::Option::Some(
|
2567 - | vec![
|
2568 - | "Foo"
|
2569 - | .parse::<crate::model::FooEnum>()
|
2570 - | .expect("static value validated to member"),
|
2571 - | "0".parse::<crate::model::FooEnum>()
|
2572 - | .expect("static value validated to member"),
|
2573 - | ]
|
2574 - | .try_into()
|
2575 - | .expect("this is only used in tests"),
|
2576 - | ),
|
2577 - | foo_enum_map: ::std::option::Option::Some({
|
2578 - | let mut ret = ::std::collections::HashMap::new();
|
2579 - | ret.insert(
|
2580 - | "hi".to_owned(),
|
2581 - | "Foo"
|
2582 - | .parse::<crate::model::FooEnum>()
|
2583 - | .expect("static value validated to member"),
|
2584 - | );
|
2585 - | ret.insert(
|
2586 - | "zero".to_owned(),
|
2587 - | "0".parse::<crate::model::FooEnum>()
|
2588 - | .expect("static value validated to member"),
|
2589 - | );
|
2590 - | ret
|
2591 - | }),
|
2592 - | };
|
2593 - | ::pretty_assertions::assert_eq!(input, expected);
|
2594 - | let output = crate::output::JsonEnumsOutput {
|
2595 - | foo_enum1: ::std::option::Option::None,
|
2596 - | foo_enum2: ::std::option::Option::None,
|
2597 - | foo_enum3: ::std::option::Option::None,
|
2598 - | foo_enum_list: ::std::option::Option::None,
|
2599 - | foo_enum_set: ::std::option::Option::None,
|
2600 - | foo_enum_map: ::std::option::Option::None,
|
4162 + | blob: ::std::option::Option::None,
|
4163 + | boolean: ::std::option::Option::None,
|
4164 + | double: ::std::option::Option::None,
|
4165 + | empty_struct: ::std::option::Option::None,
|
4166 + | float: ::std::option::Option::None,
|
4167 + | httpdate_timestamp: ::std::option::Option::None,
|
4168 + | integer: ::std::option::Option::None,
|
4169 + | iso8601_timestamp: ::std::option::Option::None,
|
4170 + | json_value: ::std::option::Option::None,
|
4171 + | list_of_lists: ::std::option::Option::None,
|
4172 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4173 + | list_of_strings: ::std::option::Option::None,
|
4174 + | long: ::std::option::Option::None,
|
4175 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4176 + | map_of_maps: ::std::option::Option::None,
|
4177 + | map_of_strings: ::std::option::Option::None,
|
4178 + | map_of_structs: ::std::option::Option::None,
|
4179 + | recursive_list: ::std::option::Option::None,
|
4180 + | recursive_map: ::std::option::Option::None,
|
4181 + | recursive_struct: ::std::option::Option::None,
|
4182 + | simple_struct: ::std::option::Option::None,
|
4183 + | string: ::std::option::Option::None,
|
4184 + | struct_with_json_name: ::std::option::Option::None,
|
4185 + | timestamp: ::std::option::Option::None,
|
4186 + | unix_timestamp: ::std::option::Option::None,
|
2601 4187 | };
|
2602 - | Ok(output)
|
2603 - | };
|
2604 - | sender.send(()).await.expect("receiver dropped early");
|
2605 - | result
|
2606 - | }
|
2607 - | })
|
2608 - | .build_unchecked();
|
2609 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2610 - | .await
|
2611 - | .expect("unable to make an HTTP request");
|
2612 - | assert!(
|
2613 - | receiver.recv().await.is_some(),
|
2614 - | "we expected operation handler to be invoked but it was not entered"
|
2615 - | );
|
2616 - | }
|
2617 - |
|
2618 - | /// Serializes simple scalar properties
|
2619 - | /// Test ID: AwsJson11Enums
|
2620 - | #[::tokio::test]
|
2621 - | #[::tracing_test::traced_test]
|
2622 - | async fn aws_json11_enums_response() {
|
2623 - | let output = crate::output::JsonEnumsOutput {
|
2624 - | foo_enum1: ::std::option::Option::Some(
|
2625 - | "Foo"
|
2626 - | .parse::<crate::model::FooEnum>()
|
2627 - | .expect("static value validated to member"),
|
2628 - | ),
|
2629 - | foo_enum2: ::std::option::Option::Some(
|
2630 - | "0".parse::<crate::model::FooEnum>()
|
2631 - | .expect("static value validated to member"),
|
2632 - | ),
|
2633 - | foo_enum3: ::std::option::Option::Some(
|
2634 - | "1".parse::<crate::model::FooEnum>()
|
2635 - | .expect("static value validated to member"),
|
2636 - | ),
|
2637 - | foo_enum_list: ::std::option::Option::Some(vec![
|
2638 - | "Foo"
|
2639 - | .parse::<crate::model::FooEnum>()
|
2640 - | .expect("static value validated to member"),
|
2641 - | "0".parse::<crate::model::FooEnum>()
|
2642 - | .expect("static value validated to member"),
|
2643 - | ]),
|
2644 - | foo_enum_set: ::std::option::Option::Some(
|
2645 - | vec![
|
2646 - | "Foo"
|
2647 - | .parse::<crate::model::FooEnum>()
|
2648 - | .expect("static value validated to member"),
|
2649 - | "0".parse::<crate::model::FooEnum>()
|
2650 - | .expect("static value validated to member"),
|
2651 - | ]
|
2652 - | .try_into()
|
2653 - | .expect("this is only used in tests"),
|
2654 - | ),
|
2655 - | foo_enum_map: ::std::option::Option::Some({
|
2656 - | let mut ret = ::std::collections::HashMap::new();
|
2657 - | ret.insert(
|
2658 - | "hi".to_owned(),
|
2659 - | "Foo"
|
2660 - | .parse::<crate::model::FooEnum>()
|
2661 - | .expect("static value validated to member"),
|
2662 - | );
|
2663 - | ret.insert(
|
2664 - | "zero".to_owned(),
|
2665 - | "0".parse::<crate::model::FooEnum>()
|
2666 - | .expect("static value validated to member"),
|
2667 - | );
|
2668 - | ret
|
2669 - | }),
|
2670 - | };
|
2671 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
2672 - | let http_response = output.into_response();
|
2673 - | ::pretty_assertions::assert_eq!(
|
2674 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2675 - | http_response.status()
|
2676 - | );
|
2677 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
2678 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2679 - | http_response.headers(),
|
2680 - | expected_headers,
|
2681 - | ));
|
2682 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4188 + | ::pretty_assertions::assert_eq!(
|
4189 + | input.blob,
|
4190 + | expected.blob,
|
4191 + | "Unexpected value for `blob`"
|
4192 + | );
|
4193 + | ::pretty_assertions::assert_eq!(
|
4194 + | input.boolean,
|
4195 + | expected.boolean,
|
4196 + | "Unexpected value for `boolean`"
|
4197 + | );
|
4198 + | assert!(
|
4199 + | input.double.float_equals(&expected.double),
|
4200 + | "Unexpected value for `double` {:?} vs. {:?}",
|
4201 + | expected.double,
|
4202 + | input.double
|
4203 + | );
|
4204 + | ::pretty_assertions::assert_eq!(
|
4205 + | input.empty_struct,
|
4206 + | expected.empty_struct,
|
4207 + | "Unexpected value for `empty_struct`"
|
4208 + | );
|
4209 + | assert!(
|
4210 + | input.float.float_equals(&expected.float),
|
4211 + | "Unexpected value for `float` {:?} vs. {:?}",
|
4212 + | expected.float,
|
4213 + | input.float
|
4214 + | );
|
4215 + | ::pretty_assertions::assert_eq!(
|
4216 + | input.httpdate_timestamp,
|
4217 + | expected.httpdate_timestamp,
|
4218 + | "Unexpected value for `httpdate_timestamp`"
|
4219 + | );
|
4220 + | ::pretty_assertions::assert_eq!(
|
4221 + | input.integer,
|
4222 + | expected.integer,
|
4223 + | "Unexpected value for `integer`"
|
4224 + | );
|
4225 + | ::pretty_assertions::assert_eq!(
|
4226 + | input.iso8601_timestamp,
|
4227 + | expected.iso8601_timestamp,
|
4228 + | "Unexpected value for `iso8601_timestamp`"
|
4229 + | );
|
4230 + | ::pretty_assertions::assert_eq!(
|
4231 + | input.json_value,
|
4232 + | expected.json_value,
|
4233 + | "Unexpected value for `json_value`"
|
4234 + | );
|
4235 + | ::pretty_assertions::assert_eq!(
|
4236 + | input.list_of_lists,
|
4237 + | expected.list_of_lists,
|
4238 + | "Unexpected value for `list_of_lists`"
|
4239 + | );
|
4240 + | ::pretty_assertions::assert_eq!(
|
4241 + | input.list_of_maps_of_strings,
|
4242 + | expected.list_of_maps_of_strings,
|
4243 + | "Unexpected value for `list_of_maps_of_strings`"
|
4244 + | );
|
4245 + | ::pretty_assertions::assert_eq!(
|
4246 + | input.list_of_strings,
|
4247 + | expected.list_of_strings,
|
4248 + | "Unexpected value for `list_of_strings`"
|
4249 + | );
|
4250 + | ::pretty_assertions::assert_eq!(
|
4251 + | input.list_of_structs,
|
4252 + | expected.list_of_structs,
|
4253 + | "Unexpected value for `list_of_structs`"
|
4254 + | );
|
4255 + | ::pretty_assertions::assert_eq!(
|
4256 + | input.long,
|
4257 + | expected.long,
|
4258 + | "Unexpected value for `long`"
|
4259 + | );
|
4260 + | ::pretty_assertions::assert_eq!(
|
4261 + | input.map_of_lists_of_strings,
|
4262 + | expected.map_of_lists_of_strings,
|
4263 + | "Unexpected value for `map_of_lists_of_strings`"
|
4264 + | );
|
4265 + | ::pretty_assertions::assert_eq!(
|
4266 + | input.map_of_maps,
|
4267 + | expected.map_of_maps,
|
4268 + | "Unexpected value for `map_of_maps`"
|
4269 + | );
|
4270 + | ::pretty_assertions::assert_eq!(
|
4271 + | input.map_of_strings,
|
4272 + | expected.map_of_strings,
|
4273 + | "Unexpected value for `map_of_strings`"
|
4274 + | );
|
4275 + | ::pretty_assertions::assert_eq!(
|
4276 + | input.map_of_structs,
|
4277 + | expected.map_of_structs,
|
4278 + | "Unexpected value for `map_of_structs`"
|
4279 + | );
|
4280 + | ::pretty_assertions::assert_eq!(
|
4281 + | input.recursive_list,
|
4282 + | expected.recursive_list,
|
4283 + | "Unexpected value for `recursive_list`"
|
4284 + | );
|
4285 + | ::pretty_assertions::assert_eq!(
|
4286 + | input.recursive_map,
|
4287 + | expected.recursive_map,
|
4288 + | "Unexpected value for `recursive_map`"
|
4289 + | );
|
4290 + | ::pretty_assertions::assert_eq!(
|
4291 + | input.recursive_struct,
|
4292 + | expected.recursive_struct,
|
4293 + | "Unexpected value for `recursive_struct`"
|
4294 + | );
|
4295 + | ::pretty_assertions::assert_eq!(
|
4296 + | input.simple_struct,
|
4297 + | expected.simple_struct,
|
4298 + | "Unexpected value for `simple_struct`"
|
4299 + | );
|
4300 + | ::pretty_assertions::assert_eq!(
|
4301 + | input.string,
|
4302 + | expected.string,
|
4303 + | "Unexpected value for `string`"
|
4304 + | );
|
4305 + | ::pretty_assertions::assert_eq!(
|
4306 + | input.struct_with_json_name,
|
4307 + | expected.struct_with_json_name,
|
4308 + | "Unexpected value for `struct_with_json_name`"
|
4309 + | );
|
4310 + | ::pretty_assertions::assert_eq!(
|
4311 + | input.timestamp,
|
4312 + | expected.timestamp,
|
4313 + | "Unexpected value for `timestamp`"
|
4314 + | );
|
4315 + | ::pretty_assertions::assert_eq!(
|
4316 + | input.unix_timestamp,
|
4317 + | expected.unix_timestamp,
|
4318 + | "Unexpected value for `unix_timestamp`"
|
4319 + | );
|
4320 + | let output = crate::output::KitchenSinkOperationOutput {
|
4321 + | blob: ::std::option::Option::None,
|
4322 + | boolean: ::std::option::Option::None,
|
4323 + | double: ::std::option::Option::None,
|
4324 + | empty_struct: ::std::option::Option::None,
|
4325 + | float: ::std::option::Option::None,
|
4326 + | httpdate_timestamp: ::std::option::Option::None,
|
4327 + | integer: ::std::option::Option::None,
|
4328 + | iso8601_timestamp: ::std::option::Option::None,
|
4329 + | json_value: ::std::option::Option::None,
|
4330 + | list_of_lists: ::std::option::Option::None,
|
4331 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4332 + | list_of_strings: ::std::option::Option::None,
|
4333 + | list_of_structs: ::std::option::Option::None,
|
4334 + | long: ::std::option::Option::None,
|
4335 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4336 + | map_of_maps: ::std::option::Option::None,
|
4337 + | map_of_strings: ::std::option::Option::None,
|
4338 + | map_of_structs: ::std::option::Option::None,
|
4339 + | recursive_list: ::std::option::Option::None,
|
4340 + | recursive_map: ::std::option::Option::None,
|
4341 + | recursive_struct: ::std::option::Option::None,
|
4342 + | simple_struct: ::std::option::Option::None,
|
4343 + | string: ::std::option::Option::None,
|
4344 + | struct_with_json_name: ::std::option::Option::None,
|
4345 + | timestamp: ::std::option::Option::None,
|
4346 + | unix_timestamp: ::std::option::Option::None,
|
4347 + | };
|
4348 + | Ok(output)
|
4349 + | };
|
4350 + | sender.send(()).await.expect("receiver dropped early");
|
4351 + | result
|
4352 + | }
|
4353 + | })
|
4354 + | .build_unchecked();
|
4355 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2683 4356 | .await
|
2684 - | .expect("unable to extract body to bytes");
|
2685 - | ::aws_smithy_protocol_test::assert_ok(
|
2686 - | ::aws_smithy_protocol_test::validate_body(&body, "{\n \"fooEnum1\": \"Foo\",\n \"fooEnum2\": \"0\",\n \"fooEnum3\": \"1\",\n \"fooEnumList\": [\n \"Foo\",\n \"0\"\n ],\n \"fooEnumSet\": [\n \"Foo\",\n \"0\"\n ],\n \"fooEnumMap\": {\n \"hi\": \"Foo\",\n \"zero\": \"0\"\n }\n}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4357 + | .expect("unable to make an HTTP request");
|
4358 + | assert!(
|
4359 + | receiver.recv().await.is_some(),
|
4360 + | "we expected operation handler to be invoked but it was not entered"
|
2687 4361 | );
|
2688 4362 | }
|
2689 - | }
|
2690 - |
|
2691 - | ::pin_project_lite::pin_project! {
|
2692 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2693 - | /// [`PutAndGetInlineDocumentsInput`](crate::input::PutAndGetInlineDocumentsInput) using modelled bindings.
|
2694 - | pub struct PutAndGetInlineDocumentsInputFuture {
|
2695 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::PutAndGetInlineDocumentsInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
2696 - | }
|
2697 - | }
|
2698 - |
|
2699 - | impl std::future::Future for PutAndGetInlineDocumentsInputFuture {
|
2700 - | type Output = Result<
|
2701 - | crate::input::PutAndGetInlineDocumentsInput,
|
2702 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
2703 - | >;
|
2704 - |
|
2705 - | fn poll(
|
2706 - | self: std::pin::Pin<&mut Self>,
|
2707 - | cx: &mut std::task::Context<'_>,
|
2708 - | ) -> std::task::Poll<Self::Output> {
|
2709 - | let this = self.project();
|
2710 - | this.inner.as_mut().poll(cx)
|
2711 - | }
|
2712 - | }
|
2713 - |
|
2714 - | impl<B>
|
2715 - | ::aws_smithy_legacy_http_server::request::FromRequest<
|
2716 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2717 - | B,
|
2718 - | > for crate::input::PutAndGetInlineDocumentsInput
|
2719 - | where
|
2720 - | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
2721 - | B: 'static,
|
2722 - |
|
2723 - | B::Data: Send,
|
2724 - | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
2725 - | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
2726 - | {
|
2727 - | type Rejection =
|
2728 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
2729 - | type Future = PutAndGetInlineDocumentsInputFuture;
|
2730 4363 |
|
2731 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2732 - | let fut = async move {
|
2733 - | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
2734 - | request.headers(),
|
2735 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
2736 - | ) {
|
2737 - | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
2738 - | }
|
2739 - | crate::protocol_serde::shape_put_and_get_inline_documents::de_put_and_get_inline_documents_http_request(request)
|
2740 - | .await
|
2741 - | };
|
2742 - | use ::futures_util::future::TryFutureExt;
|
2743 - | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
2744 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2745 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
2746 - | });
|
2747 - | PutAndGetInlineDocumentsInputFuture {
|
2748 - | inner: Box::pin(fut),
|
2749 - | }
|
2750 - | }
|
2751 - | }
|
2752 - | impl
|
2753 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
2754 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2755 - | > for crate::output::PutAndGetInlineDocumentsOutput
|
2756 - | {
|
2757 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
2758 - | match crate::protocol_serde::shape_put_and_get_inline_documents::ser_put_and_get_inline_documents_http_response(self) {
|
2759 - | Ok(response) => response,
|
2760 - | Err(e) => {
|
2761 - | ::tracing::error!(error = %e, "failed to serialize response");
|
2762 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
2763 - | }
|
2764 - | }
|
2765 - | }
|
2766 - | }
|
2767 - |
|
2768 - | #[allow(unreachable_code, unused_variables)]
|
2769 - | #[cfg(test)]
|
2770 - | mod put_and_get_inline_documents_test {
|
2771 - |
|
2772 - | /// Serializes inline documents in a JSON request.
|
2773 - | /// Test ID: PutAndGetInlineDocumentsInput
|
4364 + | /// Serializes list of recursive structure shapes
|
4365 + | /// Test ID: serializes_list_of_recursive_structure_shapes
|
2774 4366 | #[::tokio::test]
|
2775 4367 | #[::tracing_test::traced_test]
|
2776 - | async fn put_and_get_inline_documents_input_request() {
|
4368 + | async fn serializes_list_of_recursive_structure_shapes_request() {
|
2777 4369 | #[allow(unused_mut)]
|
2778 - | let mut http_request = ::http::Request::builder()
|
2779 - | .uri("/")
|
2780 - | .method("POST")
|
2781 - | .header("Content-Type", "application/x-amz-json-1.1")
|
2782 - | .header("X-Amz-Target", "JsonProtocol.PutAndGetInlineDocuments")
|
2783 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2784 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2785 - | "{\n \"inlineDocument\": {\"foo\": \"bar\"}\n}".as_bytes(),
|
2786 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2787 - | )),
|
2788 - | ))
|
2789 - | .unwrap();
|
4370 + | let mut http_request = ::http::Request::builder()
|
4371 + | .uri("/")
|
4372 + | .method("POST")
|
4373 + | .header("Content-Type", "application/x-amz-json-1.1")
|
4374 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
4375 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
4376 + | ::bytes::Bytes::copy_from_slice(
|
4377 + | &::aws_smithy_protocol_test::decode_body_data("{\"RecursiveList\":[{\"RecursiveList\":[{\"RecursiveList\":[{\"Integer\":123}]}]}]}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4378 + | )
|
4379 + | )).unwrap();
|
2790 4380 | #[allow(unused_mut)]
|
2791 4381 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2792 4382 | let config = crate::service::JsonProtocolConfig::builder().build();
|
2793 4383 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2794 - | .put_and_get_inline_documents(
|
2795 - | move |input: crate::input::PutAndGetInlineDocumentsInput| {
|
2796 - | let sender = sender.clone();
|
2797 - | async move {
|
2798 - | let result = {
|
2799 - | let expected = crate::input::PutAndGetInlineDocumentsInput {
|
2800 - | inline_document: ::std::option::Option::Some({
|
2801 - | let json_bytes = br#"{
|
2802 - | "foo": "bar"
|
2803 - | }"#;
|
2804 - | let mut tokens =
|
2805 - | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
2806 - | .peekable();
|
2807 - | ::aws_smithy_json::deserialize::token::expect_document(
|
2808 - | &mut tokens,
|
2809 - | )
|
2810 - | .expect("well formed json")
|
2811 - | }),
|
2812 - | };
|
2813 - | ::pretty_assertions::assert_eq!(input, expected);
|
2814 - | let output = crate::output::PutAndGetInlineDocumentsOutput {
|
2815 - | inline_document: ::std::option::Option::Some({
|
2816 - | let json_bytes = br#"null"#;
|
2817 - | let mut tokens =
|
2818 - | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
2819 - | .peekable();
|
2820 - | ::aws_smithy_json::deserialize::token::expect_document(
|
2821 - | &mut tokens,
|
2822 - | )
|
2823 - | .expect("well formed json")
|
2824 - | }),
|
2825 - | };
|
2826 - | output
|
4384 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
4385 + | let sender = sender.clone();
|
4386 + | async move {
|
4387 + | let result = {
|
4388 + | use ::aws_smithy_protocol_test::FloatEquals;
|
4389 + | let expected = crate::input::KitchenSinkOperationInput {
|
4390 + | recursive_list: ::std::option::Option::Some(vec![
|
4391 + | crate::model::KitchenSink {
|
4392 + | recursive_list: ::std::option::Option::Some(vec![
|
4393 + | crate::model::KitchenSink {
|
4394 + | recursive_list: ::std::option::Option::Some(vec![
|
4395 + | crate::model::KitchenSink {
|
4396 + | integer: ::std::option::Option::Some(123),
|
4397 + | blob: ::std::option::Option::None,
|
4398 + | boolean: ::std::option::Option::None,
|
4399 + | double: ::std::option::Option::None,
|
4400 + | empty_struct: ::std::option::Option::None,
|
4401 + | float: ::std::option::Option::None,
|
4402 + | httpdate_timestamp: ::std::option::Option::None,
|
4403 + | iso8601_timestamp: ::std::option::Option::None,
|
4404 + | json_value: ::std::option::Option::None,
|
4405 + | list_of_lists: ::std::option::Option::None,
|
4406 + | list_of_maps_of_strings:
|
4407 + | ::std::option::Option::None,
|
4408 + | list_of_strings: ::std::option::Option::None,
|
4409 + | list_of_structs: ::std::option::Option::None,
|
4410 + | long: ::std::option::Option::None,
|
4411 + | map_of_lists_of_strings:
|
4412 + | ::std::option::Option::None,
|
4413 + | map_of_maps: ::std::option::Option::None,
|
4414 + | map_of_strings: ::std::option::Option::None,
|
4415 + | map_of_structs: ::std::option::Option::None,
|
4416 + | recursive_list: ::std::option::Option::None,
|
4417 + | recursive_map: ::std::option::Option::None,
|
4418 + | recursive_struct: ::std::option::Option::None,
|
4419 + | simple_struct: ::std::option::Option::None,
|
4420 + | string: ::std::option::Option::None,
|
4421 + | struct_with_json_name:
|
4422 + | ::std::option::Option::None,
|
4423 + | timestamp: ::std::option::Option::None,
|
4424 + | unix_timestamp: ::std::option::Option::None,
|
4425 + | },
|
4426 + | ]),
|
4427 + | blob: ::std::option::Option::None,
|
4428 + | boolean: ::std::option::Option::None,
|
4429 + | double: ::std::option::Option::None,
|
4430 + | empty_struct: ::std::option::Option::None,
|
4431 + | float: ::std::option::Option::None,
|
4432 + | httpdate_timestamp: ::std::option::Option::None,
|
4433 + | integer: ::std::option::Option::None,
|
4434 + | iso8601_timestamp: ::std::option::Option::None,
|
4435 + | json_value: ::std::option::Option::None,
|
4436 + | list_of_lists: ::std::option::Option::None,
|
4437 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4438 + | list_of_strings: ::std::option::Option::None,
|
4439 + | list_of_structs: ::std::option::Option::None,
|
4440 + | long: ::std::option::Option::None,
|
4441 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4442 + | map_of_maps: ::std::option::Option::None,
|
4443 + | map_of_strings: ::std::option::Option::None,
|
4444 + | map_of_structs: ::std::option::Option::None,
|
4445 + | recursive_map: ::std::option::Option::None,
|
4446 + | recursive_struct: ::std::option::Option::None,
|
4447 + | simple_struct: ::std::option::Option::None,
|
4448 + | string: ::std::option::Option::None,
|
4449 + | struct_with_json_name: ::std::option::Option::None,
|
4450 + | timestamp: ::std::option::Option::None,
|
4451 + | unix_timestamp: ::std::option::Option::None,
|
4452 + | },
|
4453 + | ]),
|
4454 + | blob: ::std::option::Option::None,
|
4455 + | boolean: ::std::option::Option::None,
|
4456 + | double: ::std::option::Option::None,
|
4457 + | empty_struct: ::std::option::Option::None,
|
4458 + | float: ::std::option::Option::None,
|
4459 + | httpdate_timestamp: ::std::option::Option::None,
|
4460 + | integer: ::std::option::Option::None,
|
4461 + | iso8601_timestamp: ::std::option::Option::None,
|
4462 + | json_value: ::std::option::Option::None,
|
4463 + | list_of_lists: ::std::option::Option::None,
|
4464 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4465 + | list_of_strings: ::std::option::Option::None,
|
4466 + | list_of_structs: ::std::option::Option::None,
|
4467 + | long: ::std::option::Option::None,
|
4468 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4469 + | map_of_maps: ::std::option::Option::None,
|
4470 + | map_of_strings: ::std::option::Option::None,
|
4471 + | map_of_structs: ::std::option::Option::None,
|
4472 + | recursive_map: ::std::option::Option::None,
|
4473 + | recursive_struct: ::std::option::Option::None,
|
4474 + | simple_struct: ::std::option::Option::None,
|
4475 + | string: ::std::option::Option::None,
|
4476 + | struct_with_json_name: ::std::option::Option::None,
|
4477 + | timestamp: ::std::option::Option::None,
|
4478 + | unix_timestamp: ::std::option::Option::None,
|
4479 + | },
|
4480 + | ]),
|
4481 + | blob: ::std::option::Option::None,
|
4482 + | boolean: ::std::option::Option::None,
|
4483 + | double: ::std::option::Option::None,
|
4484 + | empty_struct: ::std::option::Option::None,
|
4485 + | float: ::std::option::Option::None,
|
4486 + | httpdate_timestamp: ::std::option::Option::None,
|
4487 + | integer: ::std::option::Option::None,
|
4488 + | iso8601_timestamp: ::std::option::Option::None,
|
4489 + | json_value: ::std::option::Option::None,
|
4490 + | list_of_lists: ::std::option::Option::None,
|
4491 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4492 + | list_of_strings: ::std::option::Option::None,
|
4493 + | list_of_structs: ::std::option::Option::None,
|
4494 + | long: ::std::option::Option::None,
|
4495 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4496 + | map_of_maps: ::std::option::Option::None,
|
4497 + | map_of_strings: ::std::option::Option::None,
|
4498 + | map_of_structs: ::std::option::Option::None,
|
4499 + | recursive_map: ::std::option::Option::None,
|
4500 + | recursive_struct: ::std::option::Option::None,
|
4501 + | simple_struct: ::std::option::Option::None,
|
4502 + | string: ::std::option::Option::None,
|
4503 + | struct_with_json_name: ::std::option::Option::None,
|
4504 + | timestamp: ::std::option::Option::None,
|
4505 + | unix_timestamp: ::std::option::Option::None,
|
2827 4506 | };
|
2828 - | sender.send(()).await.expect("receiver dropped early");
|
2829 - | result
|
2830 - | }
|
2831 - | },
|
2832 - | )
|
2833 - | .build_unchecked();
|
2834 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2835 - | .await
|
2836 - | .expect("unable to make an HTTP request");
|
2837 - | assert!(
|
2838 - | receiver.recv().await.is_some(),
|
2839 - | "we expected operation handler to be invoked but it was not entered"
|
2840 - | );
|
2841 - | }
|
2842 - |
|
2843 - | /// Serializes inline documents in a JSON response.
|
2844 - | /// Test ID: PutAndGetInlineDocumentsInput
|
2845 - | #[::tokio::test]
|
2846 - | #[::tracing_test::traced_test]
|
2847 - | async fn put_and_get_inline_documents_input_response() {
|
2848 - | let output = crate::output::PutAndGetInlineDocumentsOutput {
|
2849 - | inline_document: ::std::option::Option::Some({
|
2850 - | let json_bytes = br#"{
|
2851 - | "foo": "bar"
|
2852 - | }"#;
|
2853 - | let mut tokens =
|
2854 - | ::aws_smithy_json::deserialize::json_token_iter(json_bytes).peekable();
|
2855 - | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
2856 - | .expect("well formed json")
|
2857 - | }),
|
2858 - | };
|
2859 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
2860 - | let http_response = output.into_response();
|
2861 - | ::pretty_assertions::assert_eq!(
|
2862 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2863 - | http_response.status()
|
2864 - | );
|
2865 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
2866 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2867 - | http_response.headers(),
|
2868 - | expected_headers,
|
2869 - | ));
|
2870 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2871 - | .await
|
2872 - | .expect("unable to extract body to bytes");
|
2873 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2874 - | &body,
|
2875 - | "{\n \"inlineDocument\": {\"foo\": \"bar\"}\n}",
|
2876 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2877 - | ));
|
2878 - | }
|
2879 - | }
|
2880 - |
|
2881 - | ::pin_project_lite::pin_project! {
|
2882 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2883 - | /// [`OperationWithOptionalInputOutputInput`](crate::input::OperationWithOptionalInputOutputInput) using modelled bindings.
|
2884 - | pub struct OperationWithOptionalInputOutputInputFuture {
|
2885 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::OperationWithOptionalInputOutputInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
2886 - | }
|
2887 - | }
|
2888 - |
|
2889 - | impl std::future::Future for OperationWithOptionalInputOutputInputFuture {
|
2890 - | type Output = Result<
|
2891 - | crate::input::OperationWithOptionalInputOutputInput,
|
2892 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
2893 - | >;
|
2894 - |
|
2895 - | fn poll(
|
2896 - | self: std::pin::Pin<&mut Self>,
|
2897 - | cx: &mut std::task::Context<'_>,
|
2898 - | ) -> std::task::Poll<Self::Output> {
|
2899 - | let this = self.project();
|
2900 - | this.inner.as_mut().poll(cx)
|
2901 - | }
|
2902 - | }
|
2903 - |
|
2904 - | impl<B>
|
2905 - | ::aws_smithy_legacy_http_server::request::FromRequest<
|
2906 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2907 - | B,
|
2908 - | > for crate::input::OperationWithOptionalInputOutputInput
|
2909 - | where
|
2910 - | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
2911 - | B: 'static,
|
2912 - |
|
2913 - | B::Data: Send,
|
2914 - | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
2915 - | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
2916 - | {
|
2917 - | type Rejection =
|
2918 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
2919 - | type Future = OperationWithOptionalInputOutputInputFuture;
|
2920 - |
|
2921 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2922 - | let fut = async move {
|
2923 - | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
2924 - | request.headers(),
|
2925 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
2926 - | ) {
|
2927 - | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
2928 - | }
|
2929 - | crate::protocol_serde::shape_operation_with_optional_input_output::de_operation_with_optional_input_output_http_request(request)
|
2930 - | .await
|
2931 - | };
|
2932 - | use ::futures_util::future::TryFutureExt;
|
2933 - | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
2934 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2935 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
2936 - | });
|
2937 - | OperationWithOptionalInputOutputInputFuture {
|
2938 - | inner: Box::pin(fut),
|
2939 - | }
|
2940 - | }
|
2941 - | }
|
2942 - | impl
|
2943 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
2944 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2945 - | > for crate::output::OperationWithOptionalInputOutputOutput
|
2946 - | {
|
2947 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
2948 - | match crate::protocol_serde::shape_operation_with_optional_input_output::ser_operation_with_optional_input_output_http_response(self) {
|
2949 - | Ok(response) => response,
|
2950 - | Err(e) => {
|
2951 - | ::tracing::error!(error = %e, "failed to serialize response");
|
2952 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
2953 - | }
|
2954 - | }
|
4507 + | ::pretty_assertions::assert_eq!(
|
4508 + | input.blob,
|
4509 + | expected.blob,
|
4510 + | "Unexpected value for `blob`"
|
4511 + | );
|
4512 + | ::pretty_assertions::assert_eq!(
|
4513 + | input.boolean,
|
4514 + | expected.boolean,
|
4515 + | "Unexpected value for `boolean`"
|
4516 + | );
|
4517 + | assert!(
|
4518 + | input.double.float_equals(&expected.double),
|
4519 + | "Unexpected value for `double` {:?} vs. {:?}",
|
4520 + | expected.double,
|
4521 + | input.double
|
4522 + | );
|
4523 + | ::pretty_assertions::assert_eq!(
|
4524 + | input.empty_struct,
|
4525 + | expected.empty_struct,
|
4526 + | "Unexpected value for `empty_struct`"
|
4527 + | );
|
4528 + | assert!(
|
4529 + | input.float.float_equals(&expected.float),
|
4530 + | "Unexpected value for `float` {:?} vs. {:?}",
|
4531 + | expected.float,
|
4532 + | input.float
|
4533 + | );
|
4534 + | ::pretty_assertions::assert_eq!(
|
4535 + | input.httpdate_timestamp,
|
4536 + | expected.httpdate_timestamp,
|
4537 + | "Unexpected value for `httpdate_timestamp`"
|
4538 + | );
|
4539 + | ::pretty_assertions::assert_eq!(
|
4540 + | input.integer,
|
4541 + | expected.integer,
|
4542 + | "Unexpected value for `integer`"
|
4543 + | );
|
4544 + | ::pretty_assertions::assert_eq!(
|
4545 + | input.iso8601_timestamp,
|
4546 + | expected.iso8601_timestamp,
|
4547 + | "Unexpected value for `iso8601_timestamp`"
|
4548 + | );
|
4549 + | ::pretty_assertions::assert_eq!(
|
4550 + | input.json_value,
|
4551 + | expected.json_value,
|
4552 + | "Unexpected value for `json_value`"
|
4553 + | );
|
4554 + | ::pretty_assertions::assert_eq!(
|
4555 + | input.list_of_lists,
|
4556 + | expected.list_of_lists,
|
4557 + | "Unexpected value for `list_of_lists`"
|
4558 + | );
|
4559 + | ::pretty_assertions::assert_eq!(
|
4560 + | input.list_of_maps_of_strings,
|
4561 + | expected.list_of_maps_of_strings,
|
4562 + | "Unexpected value for `list_of_maps_of_strings`"
|
4563 + | );
|
4564 + | ::pretty_assertions::assert_eq!(
|
4565 + | input.list_of_strings,
|
4566 + | expected.list_of_strings,
|
4567 + | "Unexpected value for `list_of_strings`"
|
4568 + | );
|
4569 + | ::pretty_assertions::assert_eq!(
|
4570 + | input.list_of_structs,
|
4571 + | expected.list_of_structs,
|
4572 + | "Unexpected value for `list_of_structs`"
|
4573 + | );
|
4574 + | ::pretty_assertions::assert_eq!(
|
4575 + | input.long,
|
4576 + | expected.long,
|
4577 + | "Unexpected value for `long`"
|
4578 + | );
|
4579 + | ::pretty_assertions::assert_eq!(
|
4580 + | input.map_of_lists_of_strings,
|
4581 + | expected.map_of_lists_of_strings,
|
4582 + | "Unexpected value for `map_of_lists_of_strings`"
|
4583 + | );
|
4584 + | ::pretty_assertions::assert_eq!(
|
4585 + | input.map_of_maps,
|
4586 + | expected.map_of_maps,
|
4587 + | "Unexpected value for `map_of_maps`"
|
4588 + | );
|
4589 + | ::pretty_assertions::assert_eq!(
|
4590 + | input.map_of_strings,
|
4591 + | expected.map_of_strings,
|
4592 + | "Unexpected value for `map_of_strings`"
|
4593 + | );
|
4594 + | ::pretty_assertions::assert_eq!(
|
4595 + | input.map_of_structs,
|
4596 + | expected.map_of_structs,
|
4597 + | "Unexpected value for `map_of_structs`"
|
4598 + | );
|
4599 + | ::pretty_assertions::assert_eq!(
|
4600 + | input.recursive_list,
|
4601 + | expected.recursive_list,
|
4602 + | "Unexpected value for `recursive_list`"
|
4603 + | );
|
4604 + | ::pretty_assertions::assert_eq!(
|
4605 + | input.recursive_map,
|
4606 + | expected.recursive_map,
|
4607 + | "Unexpected value for `recursive_map`"
|
4608 + | );
|
4609 + | ::pretty_assertions::assert_eq!(
|
4610 + | input.recursive_struct,
|
4611 + | expected.recursive_struct,
|
4612 + | "Unexpected value for `recursive_struct`"
|
4613 + | );
|
4614 + | ::pretty_assertions::assert_eq!(
|
4615 + | input.simple_struct,
|
4616 + | expected.simple_struct,
|
4617 + | "Unexpected value for `simple_struct`"
|
4618 + | );
|
4619 + | ::pretty_assertions::assert_eq!(
|
4620 + | input.string,
|
4621 + | expected.string,
|
4622 + | "Unexpected value for `string`"
|
4623 + | );
|
4624 + | ::pretty_assertions::assert_eq!(
|
4625 + | input.struct_with_json_name,
|
4626 + | expected.struct_with_json_name,
|
4627 + | "Unexpected value for `struct_with_json_name`"
|
4628 + | );
|
4629 + | ::pretty_assertions::assert_eq!(
|
4630 + | input.timestamp,
|
4631 + | expected.timestamp,
|
4632 + | "Unexpected value for `timestamp`"
|
4633 + | );
|
4634 + | ::pretty_assertions::assert_eq!(
|
4635 + | input.unix_timestamp,
|
4636 + | expected.unix_timestamp,
|
4637 + | "Unexpected value for `unix_timestamp`"
|
4638 + | );
|
4639 + | let output = crate::output::KitchenSinkOperationOutput {
|
4640 + | blob: ::std::option::Option::None,
|
4641 + | boolean: ::std::option::Option::None,
|
4642 + | double: ::std::option::Option::None,
|
4643 + | empty_struct: ::std::option::Option::None,
|
4644 + | float: ::std::option::Option::None,
|
4645 + | httpdate_timestamp: ::std::option::Option::None,
|
4646 + | integer: ::std::option::Option::None,
|
4647 + | iso8601_timestamp: ::std::option::Option::None,
|
4648 + | json_value: ::std::option::Option::None,
|
4649 + | list_of_lists: ::std::option::Option::None,
|
4650 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4651 + | list_of_strings: ::std::option::Option::None,
|
4652 + | list_of_structs: ::std::option::Option::None,
|
4653 + | long: ::std::option::Option::None,
|
4654 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4655 + | map_of_maps: ::std::option::Option::None,
|
4656 + | map_of_strings: ::std::option::Option::None,
|
4657 + | map_of_structs: ::std::option::Option::None,
|
4658 + | recursive_list: ::std::option::Option::None,
|
4659 + | recursive_map: ::std::option::Option::None,
|
4660 + | recursive_struct: ::std::option::Option::None,
|
4661 + | simple_struct: ::std::option::Option::None,
|
4662 + | string: ::std::option::Option::None,
|
4663 + | struct_with_json_name: ::std::option::Option::None,
|
4664 + | timestamp: ::std::option::Option::None,
|
4665 + | unix_timestamp: ::std::option::Option::None,
|
4666 + | };
|
4667 + | Ok(output)
|
4668 + | };
|
4669 + | sender.send(()).await.expect("receiver dropped early");
|
4670 + | result
|
4671 + | }
|
4672 + | })
|
4673 + | .build_unchecked();
|
4674 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4675 + | .await
|
4676 + | .expect("unable to make an HTTP request");
|
4677 + | assert!(
|
4678 + | receiver.recv().await.is_some(),
|
4679 + | "we expected operation handler to be invoked but it was not entered"
|
4680 + | );
|
2955 4681 | }
|
2956 - | }
|
2957 4682 |
|
2958 - | #[allow(unreachable_code, unused_variables)]
|
2959 - | #[cfg(test)]
|
2960 - | mod operation_with_optional_input_output_test {
|
2961 - |
|
2962 - | /// Can call operations with no input or output
|
2963 - | /// Test ID: can_call_operation_with_no_input_or_output
|
4683 + | /// Serializes map shapes
|
4684 + | /// Test ID: serializes_map_shapes
|
2964 4685 | #[::tokio::test]
|
2965 4686 | #[::tracing_test::traced_test]
|
2966 - | async fn can_call_operation_with_no_input_or_output_request() {
|
4687 + | async fn serializes_map_shapes_request() {
|
2967 4688 | #[allow(unused_mut)]
|
2968 4689 | let mut http_request = ::http::Request::builder()
|
2969 4690 | .uri("/")
|
2970 4691 | .method("POST")
|
2971 4692 | .header("Content-Type", "application/x-amz-json-1.1")
|
2972 - | .header(
|
2973 - | "X-Amz-Target",
|
2974 - | "JsonProtocol.OperationWithOptionalInputOutput",
|
2975 - | )
|
4693 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
2976 4694 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2977 4695 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2978 - | "{}".as_bytes(),
|
4696 + | "{\"MapOfStrings\":{\"abc\":\"xyz\",\"mno\":\"hjk\"}}".as_bytes(),
|
2979 4697 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2980 4698 | )),
|
2981 4699 | ))
|
2982 4700 | .unwrap();
|
2983 4701 | #[allow(unused_mut)]
|
2984 4702 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2985 4703 | let config = crate::service::JsonProtocolConfig::builder().build();
|
2986 4704 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2987 - | .operation_with_optional_input_output(
|
2988 - | move |input: crate::input::OperationWithOptionalInputOutputInput| {
|
2989 - | let sender = sender.clone();
|
2990 - | async move {
|
2991 - | let result = {
|
2992 - | let expected = crate::input::OperationWithOptionalInputOutputInput {
|
2993 - | value: ::std::option::Option::None,
|
2994 - | };
|
2995 - | ::pretty_assertions::assert_eq!(input, expected);
|
2996 - | let output = crate::output::OperationWithOptionalInputOutputOutput {
|
2997 - | value: ::std::option::Option::None,
|
2998 - | };
|
2999 - | output
|
4705 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
4706 + | let sender = sender.clone();
|
4707 + | async move {
|
4708 + | let result = {
|
4709 + | use ::aws_smithy_protocol_test::FloatEquals;
|
4710 + | let expected = crate::input::KitchenSinkOperationInput {
|
4711 + | map_of_strings: ::std::option::Option::Some({
|
4712 + | let mut ret = ::std::collections::HashMap::new();
|
4713 + | ret.insert("abc".to_owned(), "xyz".to_owned());
|
4714 + | ret.insert("mno".to_owned(), "hjk".to_owned());
|
4715 + | ret
|
4716 + | }),
|
4717 + | blob: ::std::option::Option::None,
|
4718 + | boolean: ::std::option::Option::None,
|
4719 + | double: ::std::option::Option::None,
|
4720 + | empty_struct: ::std::option::Option::None,
|
4721 + | float: ::std::option::Option::None,
|
4722 + | httpdate_timestamp: ::std::option::Option::None,
|
4723 + | integer: ::std::option::Option::None,
|
4724 + | iso8601_timestamp: ::std::option::Option::None,
|
4725 + | json_value: ::std::option::Option::None,
|
4726 + | list_of_lists: ::std::option::Option::None,
|
4727 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4728 + | list_of_strings: ::std::option::Option::None,
|
4729 + | list_of_structs: ::std::option::Option::None,
|
4730 + | long: ::std::option::Option::None,
|
4731 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4732 + | map_of_maps: ::std::option::Option::None,
|
4733 + | map_of_structs: ::std::option::Option::None,
|
4734 + | recursive_list: ::std::option::Option::None,
|
4735 + | recursive_map: ::std::option::Option::None,
|
4736 + | recursive_struct: ::std::option::Option::None,
|
4737 + | simple_struct: ::std::option::Option::None,
|
4738 + | string: ::std::option::Option::None,
|
4739 + | struct_with_json_name: ::std::option::Option::None,
|
4740 + | timestamp: ::std::option::Option::None,
|
4741 + | unix_timestamp: ::std::option::Option::None,
|
3000 4742 | };
|
3001 - | sender.send(()).await.expect("receiver dropped early");
|
3002 - | result
|
3003 - | }
|
3004 - | },
|
3005 - | )
|
4743 + | ::pretty_assertions::assert_eq!(
|
4744 + | input.blob,
|
4745 + | expected.blob,
|
4746 + | "Unexpected value for `blob`"
|
4747 + | );
|
4748 + | ::pretty_assertions::assert_eq!(
|
4749 + | input.boolean,
|
4750 + | expected.boolean,
|
4751 + | "Unexpected value for `boolean`"
|
4752 + | );
|
4753 + | assert!(
|
4754 + | input.double.float_equals(&expected.double),
|
4755 + | "Unexpected value for `double` {:?} vs. {:?}",
|
4756 + | expected.double,
|
4757 + | input.double
|
4758 + | );
|
4759 + | ::pretty_assertions::assert_eq!(
|
4760 + | input.empty_struct,
|
4761 + | expected.empty_struct,
|
4762 + | "Unexpected value for `empty_struct`"
|
4763 + | );
|
4764 + | assert!(
|
4765 + | input.float.float_equals(&expected.float),
|
4766 + | "Unexpected value for `float` {:?} vs. {:?}",
|
4767 + | expected.float,
|
4768 + | input.float
|
4769 + | );
|
4770 + | ::pretty_assertions::assert_eq!(
|
4771 + | input.httpdate_timestamp,
|
4772 + | expected.httpdate_timestamp,
|
4773 + | "Unexpected value for `httpdate_timestamp`"
|
4774 + | );
|
4775 + | ::pretty_assertions::assert_eq!(
|
4776 + | input.integer,
|
4777 + | expected.integer,
|
4778 + | "Unexpected value for `integer`"
|
4779 + | );
|
4780 + | ::pretty_assertions::assert_eq!(
|
4781 + | input.iso8601_timestamp,
|
4782 + | expected.iso8601_timestamp,
|
4783 + | "Unexpected value for `iso8601_timestamp`"
|
4784 + | );
|
4785 + | ::pretty_assertions::assert_eq!(
|
4786 + | input.json_value,
|
4787 + | expected.json_value,
|
4788 + | "Unexpected value for `json_value`"
|
4789 + | );
|
4790 + | ::pretty_assertions::assert_eq!(
|
4791 + | input.list_of_lists,
|
4792 + | expected.list_of_lists,
|
4793 + | "Unexpected value for `list_of_lists`"
|
4794 + | );
|
4795 + | ::pretty_assertions::assert_eq!(
|
4796 + | input.list_of_maps_of_strings,
|
4797 + | expected.list_of_maps_of_strings,
|
4798 + | "Unexpected value for `list_of_maps_of_strings`"
|
4799 + | );
|
4800 + | ::pretty_assertions::assert_eq!(
|
4801 + | input.list_of_strings,
|
4802 + | expected.list_of_strings,
|
4803 + | "Unexpected value for `list_of_strings`"
|
4804 + | );
|
4805 + | ::pretty_assertions::assert_eq!(
|
4806 + | input.list_of_structs,
|
4807 + | expected.list_of_structs,
|
4808 + | "Unexpected value for `list_of_structs`"
|
4809 + | );
|
4810 + | ::pretty_assertions::assert_eq!(
|
4811 + | input.long,
|
4812 + | expected.long,
|
4813 + | "Unexpected value for `long`"
|
4814 + | );
|
4815 + | ::pretty_assertions::assert_eq!(
|
4816 + | input.map_of_lists_of_strings,
|
4817 + | expected.map_of_lists_of_strings,
|
4818 + | "Unexpected value for `map_of_lists_of_strings`"
|
4819 + | );
|
4820 + | ::pretty_assertions::assert_eq!(
|
4821 + | input.map_of_maps,
|
4822 + | expected.map_of_maps,
|
4823 + | "Unexpected value for `map_of_maps`"
|
4824 + | );
|
4825 + | ::pretty_assertions::assert_eq!(
|
4826 + | input.map_of_strings,
|
4827 + | expected.map_of_strings,
|
4828 + | "Unexpected value for `map_of_strings`"
|
4829 + | );
|
4830 + | ::pretty_assertions::assert_eq!(
|
4831 + | input.map_of_structs,
|
4832 + | expected.map_of_structs,
|
4833 + | "Unexpected value for `map_of_structs`"
|
4834 + | );
|
4835 + | ::pretty_assertions::assert_eq!(
|
4836 + | input.recursive_list,
|
4837 + | expected.recursive_list,
|
4838 + | "Unexpected value for `recursive_list`"
|
4839 + | );
|
4840 + | ::pretty_assertions::assert_eq!(
|
4841 + | input.recursive_map,
|
4842 + | expected.recursive_map,
|
4843 + | "Unexpected value for `recursive_map`"
|
4844 + | );
|
4845 + | ::pretty_assertions::assert_eq!(
|
4846 + | input.recursive_struct,
|
4847 + | expected.recursive_struct,
|
4848 + | "Unexpected value for `recursive_struct`"
|
4849 + | );
|
4850 + | ::pretty_assertions::assert_eq!(
|
4851 + | input.simple_struct,
|
4852 + | expected.simple_struct,
|
4853 + | "Unexpected value for `simple_struct`"
|
4854 + | );
|
4855 + | ::pretty_assertions::assert_eq!(
|
4856 + | input.string,
|
4857 + | expected.string,
|
4858 + | "Unexpected value for `string`"
|
4859 + | );
|
4860 + | ::pretty_assertions::assert_eq!(
|
4861 + | input.struct_with_json_name,
|
4862 + | expected.struct_with_json_name,
|
4863 + | "Unexpected value for `struct_with_json_name`"
|
4864 + | );
|
4865 + | ::pretty_assertions::assert_eq!(
|
4866 + | input.timestamp,
|
4867 + | expected.timestamp,
|
4868 + | "Unexpected value for `timestamp`"
|
4869 + | );
|
4870 + | ::pretty_assertions::assert_eq!(
|
4871 + | input.unix_timestamp,
|
4872 + | expected.unix_timestamp,
|
4873 + | "Unexpected value for `unix_timestamp`"
|
4874 + | );
|
4875 + | let output = crate::output::KitchenSinkOperationOutput {
|
4876 + | blob: ::std::option::Option::None,
|
4877 + | boolean: ::std::option::Option::None,
|
4878 + | double: ::std::option::Option::None,
|
4879 + | empty_struct: ::std::option::Option::None,
|
4880 + | float: ::std::option::Option::None,
|
4881 + | httpdate_timestamp: ::std::option::Option::None,
|
4882 + | integer: ::std::option::Option::None,
|
4883 + | iso8601_timestamp: ::std::option::Option::None,
|
4884 + | json_value: ::std::option::Option::None,
|
4885 + | list_of_lists: ::std::option::Option::None,
|
4886 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4887 + | list_of_strings: ::std::option::Option::None,
|
4888 + | list_of_structs: ::std::option::Option::None,
|
4889 + | long: ::std::option::Option::None,
|
4890 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4891 + | map_of_maps: ::std::option::Option::None,
|
4892 + | map_of_strings: ::std::option::Option::None,
|
4893 + | map_of_structs: ::std::option::Option::None,
|
4894 + | recursive_list: ::std::option::Option::None,
|
4895 + | recursive_map: ::std::option::Option::None,
|
4896 + | recursive_struct: ::std::option::Option::None,
|
4897 + | simple_struct: ::std::option::Option::None,
|
4898 + | string: ::std::option::Option::None,
|
4899 + | struct_with_json_name: ::std::option::Option::None,
|
4900 + | timestamp: ::std::option::Option::None,
|
4901 + | unix_timestamp: ::std::option::Option::None,
|
4902 + | };
|
4903 + | Ok(output)
|
4904 + | };
|
4905 + | sender.send(()).await.expect("receiver dropped early");
|
4906 + | result
|
4907 + | }
|
4908 + | })
|
3006 4909 | .build_unchecked();
|
3007 4910 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3008 4911 | .await
|
3009 4912 | .expect("unable to make an HTTP request");
|
3010 4913 | assert!(
|
3011 4914 | receiver.recv().await.is_some(),
|
3012 4915 | "we expected operation handler to be invoked but it was not entered"
|
3013 4916 | );
|
3014 4917 | }
|
3015 4918 |
|
3016 - | /// Can invoke operations with optional input
|
3017 - | /// Test ID: can_call_operation_with_optional_input
|
4919 + | /// Serializes empty map shapes
|
4920 + | /// Test ID: serializes_empty_map_shapes
|
3018 4921 | #[::tokio::test]
|
3019 4922 | #[::tracing_test::traced_test]
|
3020 - | async fn can_call_operation_with_optional_input_request() {
|
4923 + | async fn serializes_empty_map_shapes_request() {
|
3021 4924 | #[allow(unused_mut)]
|
3022 4925 | let mut http_request = ::http::Request::builder()
|
3023 4926 | .uri("/")
|
3024 4927 | .method("POST")
|
3025 4928 | .header("Content-Type", "application/x-amz-json-1.1")
|
3026 - | .header(
|
3027 - | "X-Amz-Target",
|
3028 - | "JsonProtocol.OperationWithOptionalInputOutput",
|
3029 - | )
|
4929 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
3030 4930 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3031 4931 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3032 - | "{\"Value\":\"Hi\"}".as_bytes(),
|
4932 + | "{\"MapOfStrings\":{}}".as_bytes(),
|
3033 4933 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3034 4934 | )),
|
3035 4935 | ))
|
3036 4936 | .unwrap();
|
3037 4937 | #[allow(unused_mut)]
|
3038 4938 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3039 4939 | let config = crate::service::JsonProtocolConfig::builder().build();
|
3040 4940 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3041 - | .operation_with_optional_input_output(
|
3042 - | move |input: crate::input::OperationWithOptionalInputOutputInput| {
|
3043 - | let sender = sender.clone();
|
3044 - | async move {
|
3045 - | let result = {
|
3046 - | let expected = crate::input::OperationWithOptionalInputOutputInput {
|
3047 - | value: ::std::option::Option::Some("Hi".to_owned()),
|
3048 - | };
|
3049 - | ::pretty_assertions::assert_eq!(input, expected);
|
3050 - | let output = crate::output::OperationWithOptionalInputOutputOutput {
|
3051 - | value: ::std::option::Option::None,
|
3052 - | };
|
3053 - | output
|
4941 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
4942 + | let sender = sender.clone();
|
4943 + | async move {
|
4944 + | let result = {
|
4945 + | use ::aws_smithy_protocol_test::FloatEquals;
|
4946 + | let expected = crate::input::KitchenSinkOperationInput {
|
4947 + | map_of_strings: ::std::option::Option::Some(
|
4948 + | ::std::collections::HashMap::new(),
|
4949 + | ),
|
4950 + | blob: ::std::option::Option::None,
|
4951 + | boolean: ::std::option::Option::None,
|
4952 + | double: ::std::option::Option::None,
|
4953 + | empty_struct: ::std::option::Option::None,
|
4954 + | float: ::std::option::Option::None,
|
4955 + | httpdate_timestamp: ::std::option::Option::None,
|
4956 + | integer: ::std::option::Option::None,
|
4957 + | iso8601_timestamp: ::std::option::Option::None,
|
4958 + | json_value: ::std::option::Option::None,
|
4959 + | list_of_lists: ::std::option::Option::None,
|
4960 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4961 + | list_of_strings: ::std::option::Option::None,
|
4962 + | list_of_structs: ::std::option::Option::None,
|
4963 + | long: ::std::option::Option::None,
|
4964 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4965 + | map_of_maps: ::std::option::Option::None,
|
4966 + | map_of_structs: ::std::option::Option::None,
|
4967 + | recursive_list: ::std::option::Option::None,
|
4968 + | recursive_map: ::std::option::Option::None,
|
4969 + | recursive_struct: ::std::option::Option::None,
|
4970 + | simple_struct: ::std::option::Option::None,
|
4971 + | string: ::std::option::Option::None,
|
4972 + | struct_with_json_name: ::std::option::Option::None,
|
4973 + | timestamp: ::std::option::Option::None,
|
4974 + | unix_timestamp: ::std::option::Option::None,
|
3054 4975 | };
|
3055 - | sender.send(()).await.expect("receiver dropped early");
|
3056 - | result
|
3057 - | }
|
3058 - | },
|
3059 - | )
|
4976 + | ::pretty_assertions::assert_eq!(
|
4977 + | input.blob,
|
4978 + | expected.blob,
|
4979 + | "Unexpected value for `blob`"
|
4980 + | );
|
4981 + | ::pretty_assertions::assert_eq!(
|
4982 + | input.boolean,
|
4983 + | expected.boolean,
|
4984 + | "Unexpected value for `boolean`"
|
4985 + | );
|
4986 + | assert!(
|
4987 + | input.double.float_equals(&expected.double),
|
4988 + | "Unexpected value for `double` {:?} vs. {:?}",
|
4989 + | expected.double,
|
4990 + | input.double
|
4991 + | );
|
4992 + | ::pretty_assertions::assert_eq!(
|
4993 + | input.empty_struct,
|
4994 + | expected.empty_struct,
|
4995 + | "Unexpected value for `empty_struct`"
|
4996 + | );
|
4997 + | assert!(
|
4998 + | input.float.float_equals(&expected.float),
|
4999 + | "Unexpected value for `float` {:?} vs. {:?}",
|
5000 + | expected.float,
|
5001 + | input.float
|
5002 + | );
|
5003 + | ::pretty_assertions::assert_eq!(
|
5004 + | input.httpdate_timestamp,
|
5005 + | expected.httpdate_timestamp,
|
5006 + | "Unexpected value for `httpdate_timestamp`"
|
5007 + | );
|
5008 + | ::pretty_assertions::assert_eq!(
|
5009 + | input.integer,
|
5010 + | expected.integer,
|
5011 + | "Unexpected value for `integer`"
|
5012 + | );
|
5013 + | ::pretty_assertions::assert_eq!(
|
5014 + | input.iso8601_timestamp,
|
5015 + | expected.iso8601_timestamp,
|
5016 + | "Unexpected value for `iso8601_timestamp`"
|
5017 + | );
|
5018 + | ::pretty_assertions::assert_eq!(
|
5019 + | input.json_value,
|
5020 + | expected.json_value,
|
5021 + | "Unexpected value for `json_value`"
|
5022 + | );
|
5023 + | ::pretty_assertions::assert_eq!(
|
5024 + | input.list_of_lists,
|
5025 + | expected.list_of_lists,
|
5026 + | "Unexpected value for `list_of_lists`"
|
5027 + | );
|
5028 + | ::pretty_assertions::assert_eq!(
|
5029 + | input.list_of_maps_of_strings,
|
5030 + | expected.list_of_maps_of_strings,
|
5031 + | "Unexpected value for `list_of_maps_of_strings`"
|
5032 + | );
|
5033 + | ::pretty_assertions::assert_eq!(
|
5034 + | input.list_of_strings,
|
5035 + | expected.list_of_strings,
|
5036 + | "Unexpected value for `list_of_strings`"
|
5037 + | );
|
5038 + | ::pretty_assertions::assert_eq!(
|
5039 + | input.list_of_structs,
|
5040 + | expected.list_of_structs,
|
5041 + | "Unexpected value for `list_of_structs`"
|
5042 + | );
|
5043 + | ::pretty_assertions::assert_eq!(
|
5044 + | input.long,
|
5045 + | expected.long,
|
5046 + | "Unexpected value for `long`"
|
5047 + | );
|
5048 + | ::pretty_assertions::assert_eq!(
|
5049 + | input.map_of_lists_of_strings,
|
5050 + | expected.map_of_lists_of_strings,
|
5051 + | "Unexpected value for `map_of_lists_of_strings`"
|
5052 + | );
|
5053 + | ::pretty_assertions::assert_eq!(
|
5054 + | input.map_of_maps,
|
5055 + | expected.map_of_maps,
|
5056 + | "Unexpected value for `map_of_maps`"
|
5057 + | );
|
5058 + | ::pretty_assertions::assert_eq!(
|
5059 + | input.map_of_strings,
|
5060 + | expected.map_of_strings,
|
5061 + | "Unexpected value for `map_of_strings`"
|
5062 + | );
|
5063 + | ::pretty_assertions::assert_eq!(
|
5064 + | input.map_of_structs,
|
5065 + | expected.map_of_structs,
|
5066 + | "Unexpected value for `map_of_structs`"
|
5067 + | );
|
5068 + | ::pretty_assertions::assert_eq!(
|
5069 + | input.recursive_list,
|
5070 + | expected.recursive_list,
|
5071 + | "Unexpected value for `recursive_list`"
|
5072 + | );
|
5073 + | ::pretty_assertions::assert_eq!(
|
5074 + | input.recursive_map,
|
5075 + | expected.recursive_map,
|
5076 + | "Unexpected value for `recursive_map`"
|
5077 + | );
|
5078 + | ::pretty_assertions::assert_eq!(
|
5079 + | input.recursive_struct,
|
5080 + | expected.recursive_struct,
|
5081 + | "Unexpected value for `recursive_struct`"
|
5082 + | );
|
5083 + | ::pretty_assertions::assert_eq!(
|
5084 + | input.simple_struct,
|
5085 + | expected.simple_struct,
|
5086 + | "Unexpected value for `simple_struct`"
|
5087 + | );
|
5088 + | ::pretty_assertions::assert_eq!(
|
5089 + | input.string,
|
5090 + | expected.string,
|
5091 + | "Unexpected value for `string`"
|
5092 + | );
|
5093 + | ::pretty_assertions::assert_eq!(
|
5094 + | input.struct_with_json_name,
|
5095 + | expected.struct_with_json_name,
|
5096 + | "Unexpected value for `struct_with_json_name`"
|
5097 + | );
|
5098 + | ::pretty_assertions::assert_eq!(
|
5099 + | input.timestamp,
|
5100 + | expected.timestamp,
|
5101 + | "Unexpected value for `timestamp`"
|
5102 + | );
|
5103 + | ::pretty_assertions::assert_eq!(
|
5104 + | input.unix_timestamp,
|
5105 + | expected.unix_timestamp,
|
5106 + | "Unexpected value for `unix_timestamp`"
|
5107 + | );
|
5108 + | let output = crate::output::KitchenSinkOperationOutput {
|
5109 + | blob: ::std::option::Option::None,
|
5110 + | boolean: ::std::option::Option::None,
|
5111 + | double: ::std::option::Option::None,
|
5112 + | empty_struct: ::std::option::Option::None,
|
5113 + | float: ::std::option::Option::None,
|
5114 + | httpdate_timestamp: ::std::option::Option::None,
|
5115 + | integer: ::std::option::Option::None,
|
5116 + | iso8601_timestamp: ::std::option::Option::None,
|
5117 + | json_value: ::std::option::Option::None,
|
5118 + | list_of_lists: ::std::option::Option::None,
|
5119 + | list_of_maps_of_strings: ::std::option::Option::None,
|
5120 + | list_of_strings: ::std::option::Option::None,
|
5121 + | list_of_structs: ::std::option::Option::None,
|
5122 + | long: ::std::option::Option::None,
|
5123 + | map_of_lists_of_strings: ::std::option::Option::None,
|
5124 + | map_of_maps: ::std::option::Option::None,
|
5125 + | map_of_strings: ::std::option::Option::None,
|
5126 + | map_of_structs: ::std::option::Option::None,
|
5127 + | recursive_list: ::std::option::Option::None,
|
5128 + | recursive_map: ::std::option::Option::None,
|
5129 + | recursive_struct: ::std::option::Option::None,
|
5130 + | simple_struct: ::std::option::Option::None,
|
5131 + | string: ::std::option::Option::None,
|
5132 + | struct_with_json_name: ::std::option::Option::None,
|
5133 + | timestamp: ::std::option::Option::None,
|
5134 + | unix_timestamp: ::std::option::Option::None,
|
5135 + | };
|
5136 + | Ok(output)
|
5137 + | };
|
5138 + | sender.send(()).await.expect("receiver dropped early");
|
5139 + | result
|
5140 + | }
|
5141 + | })
|
3060 5142 | .build_unchecked();
|
3061 5143 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3062 5144 | .await
|
3063 5145 | .expect("unable to make an HTTP request");
|
3064 5146 | assert!(
|
3065 5147 | receiver.recv().await.is_some(),
|
3066 5148 | "we expected operation handler to be invoked but it was not entered"
|
3067 5149 | );
|
3068 5150 | }
|
3069 - | }
|
3070 - |
|
3071 - | ::pin_project_lite::pin_project! {
|
3072 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
3073 - | /// [`SimpleScalarPropertiesInput`](crate::input::SimpleScalarPropertiesInput) using modelled bindings.
|
3074 - | pub struct SimpleScalarPropertiesInputFuture {
|
3075 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SimpleScalarPropertiesInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
3076 - | }
|
3077 - | }
|
3078 - |
|
3079 - | impl std::future::Future for SimpleScalarPropertiesInputFuture {
|
3080 - | type Output = Result<
|
3081 - | crate::input::SimpleScalarPropertiesInput,
|
3082 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
3083 - | >;
|
3084 - |
|
3085 - | fn poll(
|
3086 - | self: std::pin::Pin<&mut Self>,
|
3087 - | cx: &mut std::task::Context<'_>,
|
3088 - | ) -> std::task::Poll<Self::Output> {
|
3089 - | let this = self.project();
|
3090 - | this.inner.as_mut().poll(cx)
|
3091 - | }
|
3092 - | }
|
3093 - |
|
3094 - | impl<B>
|
3095 - | ::aws_smithy_legacy_http_server::request::FromRequest<
|
3096 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
3097 - | B,
|
3098 - | > for crate::input::SimpleScalarPropertiesInput
|
3099 - | where
|
3100 - | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
3101 - | B: 'static,
|
3102 - |
|
3103 - | B::Data: Send,
|
3104 - | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
3105 - | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
3106 - | {
|
3107 - | type Rejection =
|
3108 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
3109 - | type Future = SimpleScalarPropertiesInputFuture;
|
3110 5151 |
|
3111 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
3112 - | let fut = async move {
|
3113 - | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
3114 - | request.headers(),
|
3115 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
3116 - | ) {
|
3117 - | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
3118 - | }
|
3119 - | crate::protocol_serde::shape_simple_scalar_properties::de_simple_scalar_properties_http_request(request)
|
3120 - | .await
|
3121 - | };
|
3122 - | use ::futures_util::future::TryFutureExt;
|
3123 - | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
3124 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
3125 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
3126 - | });
|
3127 - | SimpleScalarPropertiesInputFuture {
|
3128 - | inner: Box::pin(fut),
|
3129 - | }
|
3130 - | }
|
3131 - | }
|
3132 - | impl
|
3133 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
3134 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
3135 - | > for crate::output::SimpleScalarPropertiesOutput
|
3136 - | {
|
3137 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
3138 - | match crate::protocol_serde::shape_simple_scalar_properties::ser_simple_scalar_properties_http_response(self) {
|
3139 - | Ok(response) => response,
|
3140 - | Err(e) => {
|
3141 - | ::tracing::error!(error = %e, "failed to serialize response");
|
3142 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
3143 - | }
|
3144 - | }
|
3145 - | }
|
3146 - | }
|
3147 - |
|
3148 - | #[allow(unreachable_code, unused_variables)]
|
3149 - | #[cfg(test)]
|
3150 - | mod simple_scalar_properties_test {
|
3151 - |
|
3152 - | /// Supports handling NaN float values.
|
3153 - | /// Test ID: AwsJson11SupportsNaNFloatInputs
|
3154 - | #[::tokio::test]
|
3155 - | #[::tracing_test::traced_test]
|
3156 - | async fn aws_json11_supports_na_n_float_inputs_request() {
|
3157 - | #[allow(unused_mut)]
|
3158 - | let mut http_request = ::http::Request::builder()
|
3159 - | .uri("/")
|
3160 - | .method("POST")
|
3161 - | .header("Content-Type", "application/x-amz-json-1.1")
|
3162 - | .header("X-Amz-Target", "JsonProtocol.SimpleScalarProperties")
|
3163 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3164 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3165 - | "{\n \"floatValue\": \"NaN\",\n \"doubleValue\": \"NaN\"\n}".as_bytes(),
|
3166 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3167 - | )),
|
3168 - | ))
|
3169 - | .unwrap();
|
3170 - | #[allow(unused_mut)]
|
3171 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3172 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
3173 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3174 - | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
3175 - | let sender = sender.clone();
|
3176 - | async move {
|
3177 - | let result = { use ::aws_smithy_protocol_test::FloatEquals;
|
3178 - | let expected =
|
3179 - | crate::input::SimpleScalarPropertiesInput {
|
3180 - | float_value:
|
3181 - | ::std::option::Option::Some(
|
3182 - | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number")
|
3183 - | )
|
3184 - | ,
|
3185 - | double_value:
|
3186 - | ::std::option::Option::Some(
|
3187 - | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number")
|
3188 - | )
|
3189 - | ,
|
3190 - | }
|
3191 - | ;
|
3192 - | assert!(input.float_value.float_equals(&expected.float_value),
|
3193 - | "Unexpected value for `float_value` {:?} vs. {:?}", expected.float_value, input.float_value);
|
3194 - | assert!(input.double_value.float_equals(&expected.double_value),
|
3195 - | "Unexpected value for `double_value` {:?} vs. {:?}", expected.double_value, input.double_value);
|
3196 - | let output =
|
3197 - | crate::output::SimpleScalarPropertiesOutput {
|
3198 - | float_value:
|
3199 - | ::std::option::Option::None
|
3200 - | ,
|
3201 - | double_value:
|
3202 - | ::std::option::Option::None
|
3203 - | ,
|
3204 - | }
|
3205 - | ;
|
3206 - | output };
|
3207 - | sender.send(()).await.expect("receiver dropped early");
|
3208 - | result
|
3209 - | }
|
3210 - | })
|
3211 - | .build_unchecked();
|
3212 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3213 - | .await
|
3214 - | .expect("unable to make an HTTP request");
|
3215 - | assert!(
|
3216 - | receiver.recv().await.is_some(),
|
3217 - | "we expected operation handler to be invoked but it was not entered"
|
3218 - | );
|
3219 - | }
|
3220 - |
|
3221 - | /// Supports handling Infinity float values.
|
3222 - | /// Test ID: AwsJson11SupportsInfinityFloatInputs
|
3223 - | #[::tokio::test]
|
3224 - | #[::tracing_test::traced_test]
|
3225 - | async fn aws_json11_supports_infinity_float_inputs_request() {
|
3226 - | #[allow(unused_mut)]
|
3227 - | let mut http_request = ::http::Request::builder()
|
3228 - | .uri("/")
|
3229 - | .method("POST")
|
3230 - | .header("Content-Type", "application/x-amz-json-1.1")
|
3231 - | .header("X-Amz-Target", "JsonProtocol.SimpleScalarProperties")
|
3232 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3233 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3234 - | "{\n \"floatValue\": \"Infinity\",\n \"doubleValue\": \"Infinity\"\n}"
|
3235 - | .as_bytes(),
|
3236 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3237 - | )),
|
3238 - | ))
|
3239 - | .unwrap();
|
3240 - | #[allow(unused_mut)]
|
3241 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3242 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
3243 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3244 - | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
3245 - | let sender = sender.clone();
|
3246 - | async move {
|
3247 - | let result = { use ::aws_smithy_protocol_test::FloatEquals;
|
3248 - | let expected =
|
3249 - | crate::input::SimpleScalarPropertiesInput {
|
3250 - | float_value:
|
3251 - | ::std::option::Option::Some(
|
3252 - | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number")
|
3253 - | )
|
3254 - | ,
|
3255 - | double_value:
|
3256 - | ::std::option::Option::Some(
|
3257 - | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number")
|
3258 - | )
|
3259 - | ,
|
3260 - | }
|
3261 - | ;
|
3262 - | assert!(input.float_value.float_equals(&expected.float_value),
|
3263 - | "Unexpected value for `float_value` {:?} vs. {:?}", expected.float_value, input.float_value);
|
3264 - | assert!(input.double_value.float_equals(&expected.double_value),
|
3265 - | "Unexpected value for `double_value` {:?} vs. {:?}", expected.double_value, input.double_value);
|
3266 - | let output =
|
3267 - | crate::output::SimpleScalarPropertiesOutput {
|
3268 - | float_value:
|
3269 - | ::std::option::Option::None
|
3270 - | ,
|
3271 - | double_value:
|
3272 - | ::std::option::Option::None
|
3273 - | ,
|
3274 - | }
|
3275 - | ;
|
3276 - | output };
|
3277 - | sender.send(()).await.expect("receiver dropped early");
|
3278 - | result
|
3279 - | }
|
3280 - | })
|
3281 - | .build_unchecked();
|
3282 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3283 - | .await
|
3284 - | .expect("unable to make an HTTP request");
|
3285 - | assert!(
|
3286 - | receiver.recv().await.is_some(),
|
3287 - | "we expected operation handler to be invoked but it was not entered"
|
3288 - | );
|
3289 - | }
|
3290 - |
|
3291 - | /// Supports handling -Infinity float values.
|
3292 - | /// Test ID: AwsJson11SupportsNegativeInfinityFloatInputs
|
5152 + | /// Serializes map of list shapes
|
5153 + | /// Test ID: serializes_map_of_list_shapes
|
3293 5154 | #[::tokio::test]
|
3294 5155 | #[::tracing_test::traced_test]
|
3295 - | async fn aws_json11_supports_negative_infinity_float_inputs_request() {
|
5156 + | async fn serializes_map_of_list_shapes_request() {
|
3296 5157 | #[allow(unused_mut)]
|
3297 - | let mut http_request = ::http::Request::builder()
|
3298 - | .uri("/")
|
3299 - | .method("POST")
|
3300 - | .header("Content-Type", "application/x-amz-json-1.1")
|
3301 - | .header("X-Amz-Target", "JsonProtocol.SimpleScalarProperties")
|
3302 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3303 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3304 - | "{\n \"floatValue\": \"-Infinity\",\n \"doubleValue\": \"-Infinity\"\n}"
|
3305 - | .as_bytes(),
|
3306 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3307 - | )),
|
3308 - | ))
|
3309 - | .unwrap();
|
3310 - | #[allow(unused_mut)]
|
3311 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3312 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
3313 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3314 - | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
3315 - | let sender = sender.clone();
|
3316 - | async move {
|
3317 - | let result = { use ::aws_smithy_protocol_test::FloatEquals;
|
3318 - | let expected =
|
3319 - | crate::input::SimpleScalarPropertiesInput {
|
3320 - | float_value:
|
3321 - | ::std::option::Option::Some(
|
3322 - | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number")
|
3323 - | )
|
3324 - | ,
|
3325 - | double_value:
|
3326 - | ::std::option::Option::Some(
|
3327 - | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number")
|
3328 - | )
|
3329 - | ,
|
3330 - | }
|
3331 - | ;
|
3332 - | assert!(input.float_value.float_equals(&expected.float_value),
|
3333 - | "Unexpected value for `float_value` {:?} vs. {:?}", expected.float_value, input.float_value);
|
3334 - | assert!(input.double_value.float_equals(&expected.double_value),
|
3335 - | "Unexpected value for `double_value` {:?} vs. {:?}", expected.double_value, input.double_value);
|
3336 - | let output =
|
3337 - | crate::output::SimpleScalarPropertiesOutput {
|
3338 - | float_value:
|
3339 - | ::std::option::Option::None
|
3340 - | ,
|
3341 - | double_value:
|
3342 - | ::std::option::Option::None
|
3343 - | ,
|
3344 - | }
|
3345 - | ;
|
3346 - | output };
|
3347 - | sender.send(()).await.expect("receiver dropped early");
|
3348 - | result
|
3349 - | }
|
3350 - | })
|
3351 - | .build_unchecked();
|
3352 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3353 - | .await
|
3354 - | .expect("unable to make an HTTP request");
|
3355 - | assert!(
|
3356 - | receiver.recv().await.is_some(),
|
3357 - | "we expected operation handler to be invoked but it was not entered"
|
3358 - | );
|
3359 - | }
|
3360 - |
|
3361 - | /// Supports handling NaN float values.
|
3362 - | /// Test ID: AwsJson11SupportsNaNFloatInputs
|
3363 - | #[::tokio::test]
|
3364 - | #[::tracing_test::traced_test]
|
3365 - | async fn aws_json11_supports_na_n_float_inputs_response() {
|
3366 - | let output = crate::output::SimpleScalarPropertiesOutput {
|
3367 - | float_value: ::std::option::Option::Some(
|
3368 - | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN")
|
3369 - | .expect("invalid string for number"),
|
3370 - | ),
|
3371 - | double_value: ::std::option::Option::Some(
|
3372 - | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN")
|
3373 - | .expect("invalid string for number"),
|
3374 - | ),
|
3375 - | };
|
3376 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
3377 - | let http_response = output.into_response();
|
3378 - | ::pretty_assertions::assert_eq!(
|
3379 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3380 - | http_response.status()
|
3381 - | );
|
3382 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
3383 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3384 - | http_response.headers(),
|
3385 - | expected_headers,
|
3386 - | ));
|
3387 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3388 - | .await
|
3389 - | .expect("unable to extract body to bytes");
|
3390 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
3391 - | &body,
|
3392 - | "{\n \"floatValue\": \"NaN\",\n \"doubleValue\": \"NaN\"\n}",
|
3393 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3394 - | ));
|
3395 - | }
|
3396 - |
|
3397 - | /// Supports handling Infinity float values.
|
3398 - | /// Test ID: AwsJson11SupportsInfinityFloatInputs
|
3399 - | #[::tokio::test]
|
3400 - | #[::tracing_test::traced_test]
|
3401 - | async fn aws_json11_supports_infinity_float_inputs_response() {
|
3402 - | let output = crate::output::SimpleScalarPropertiesOutput {
|
3403 - | float_value: ::std::option::Option::Some(
|
3404 - | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity")
|
3405 - | .expect("invalid string for number"),
|
3406 - | ),
|
3407 - | double_value: ::std::option::Option::Some(
|
3408 - | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity")
|
3409 - | .expect("invalid string for number"),
|
3410 - | ),
|
3411 - | };
|
3412 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
3413 - | let http_response = output.into_response();
|
3414 - | ::pretty_assertions::assert_eq!(
|
3415 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3416 - | http_response.status()
|
3417 - | );
|
3418 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
3419 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3420 - | http_response.headers(),
|
3421 - | expected_headers,
|
3422 - | ));
|
3423 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3424 - | .await
|
3425 - | .expect("unable to extract body to bytes");
|
3426 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
3427 - | &body,
|
3428 - | "{\n \"floatValue\": \"Infinity\",\n \"doubleValue\": \"Infinity\"\n}",
|
3429 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3430 - | ));
|
3431 - | }
|
3432 - |
|
3433 - | /// Supports handling -Infinity float values.
|
3434 - | /// Test ID: AwsJson11SupportsNegativeInfinityFloatInputs
|
3435 - | #[::tokio::test]
|
3436 - | #[::tracing_test::traced_test]
|
3437 - | async fn aws_json11_supports_negative_infinity_float_inputs_response() {
|
3438 - | let output = crate::output::SimpleScalarPropertiesOutput {
|
3439 - | float_value: ::std::option::Option::Some(
|
3440 - | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity")
|
3441 - | .expect("invalid string for number"),
|
3442 - | ),
|
3443 - | double_value: ::std::option::Option::Some(
|
3444 - | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity")
|
3445 - | .expect("invalid string for number"),
|
3446 - | ),
|
3447 - | };
|
3448 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
3449 - | let http_response = output.into_response();
|
3450 - | ::pretty_assertions::assert_eq!(
|
3451 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3452 - | http_response.status()
|
3453 - | );
|
3454 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
3455 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3456 - | http_response.headers(),
|
3457 - | expected_headers,
|
3458 - | ));
|
3459 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3460 - | .await
|
3461 - | .expect("unable to extract body to bytes");
|
3462 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
3463 - | &body,
|
3464 - | "{\n \"floatValue\": \"-Infinity\",\n \"doubleValue\": \"-Infinity\"\n}",
|
3465 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3466 - | ));
|
3467 - | }
|
3468 - | }
|
3469 - |
|
3470 - | ::pin_project_lite::pin_project! {
|
3471 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
3472 - | /// [`KitchenSinkOperationInput`](crate::input::KitchenSinkOperationInput) using modelled bindings.
|
3473 - | pub struct KitchenSinkOperationInputFuture {
|
3474 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::KitchenSinkOperationInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
3475 - | }
|
3476 - | }
|
3477 - |
|
3478 - | impl std::future::Future for KitchenSinkOperationInputFuture {
|
3479 - | type Output = Result<
|
3480 - | crate::input::KitchenSinkOperationInput,
|
3481 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
3482 - | >;
|
3483 - |
|
3484 - | fn poll(
|
3485 - | self: std::pin::Pin<&mut Self>,
|
3486 - | cx: &mut std::task::Context<'_>,
|
3487 - | ) -> std::task::Poll<Self::Output> {
|
3488 - | let this = self.project();
|
3489 - | this.inner.as_mut().poll(cx)
|
3490 - | }
|
3491 - | }
|
3492 - |
|
3493 - | impl<B>
|
3494 - | ::aws_smithy_legacy_http_server::request::FromRequest<
|
3495 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
3496 - | B,
|
3497 - | > for crate::input::KitchenSinkOperationInput
|
3498 - | where
|
3499 - | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
3500 - | B: 'static,
|
3501 - |
|
3502 - | B::Data: Send,
|
3503 - | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
3504 - | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
3505 - | {
|
3506 - | type Rejection =
|
3507 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
3508 - | type Future = KitchenSinkOperationInputFuture;
|
3509 - |
|
3510 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
3511 - | let fut = async move {
|
3512 - | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
3513 - | request.headers(),
|
3514 - | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
3515 - | ) {
|
3516 - | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
3517 - | }
|
3518 - | crate::protocol_serde::shape_kitchen_sink_operation::de_kitchen_sink_operation_http_request(request)
|
3519 - | .await
|
3520 - | };
|
3521 - | use ::futures_util::future::TryFutureExt;
|
3522 - | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
3523 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
3524 - | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
3525 - | });
|
3526 - | KitchenSinkOperationInputFuture {
|
3527 - | inner: Box::pin(fut),
|
3528 - | }
|
3529 - | }
|
3530 - | }
|
3531 - | impl
|
3532 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
3533 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
3534 - | > for crate::output::KitchenSinkOperationOutput
|
3535 - | {
|
3536 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
3537 - | match crate::protocol_serde::shape_kitchen_sink_operation::ser_kitchen_sink_operation_http_response(self) {
|
3538 - | Ok(response) => response,
|
3539 - | Err(e) => {
|
3540 - | ::tracing::error!(error = %e, "failed to serialize response");
|
3541 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
3542 - | }
|
3543 - | }
|
3544 - | }
|
3545 - | }
|
3546 - | impl
|
3547 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
3548 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
3549 - | > for crate::error::KitchenSinkOperationError
|
3550 - | {
|
3551 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
3552 - | match crate::protocol_serde::shape_kitchen_sink_operation::ser_kitchen_sink_operation_http_error(&self) {
|
3553 - | Ok(mut response) => {
|
3554 - | response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
3555 - | response
|
3556 - | },
|
3557 - | Err(e) => {
|
3558 - | ::tracing::error!(error = %e, "failed to serialize response");
|
3559 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
3560 - | }
|
3561 - | }
|
3562 - | }
|
3563 - | }
|
3564 - |
|
3565 - | #[allow(unreachable_code, unused_variables)]
|
3566 - | #[cfg(test)]
|
3567 - | mod kitchen_sink_operation_test {
|
3568 - |
|
3569 - | /// Serializes string shapes
|
3570 - | /// Test ID: serializes_string_shapes
|
3571 - | #[::tokio::test]
|
3572 - | #[::tracing_test::traced_test]
|
3573 - | async fn serializes_string_shapes_request() {
|
3574 - | #[allow(unused_mut)]
|
3575 - | let mut http_request = ::http::Request::builder()
|
3576 - | .uri("/")
|
3577 - | .method("POST")
|
3578 - | .header("Content-Type", "application/x-amz-json-1.1")
|
3579 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
3580 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3581 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3582 - | "{\"String\":\"abc xyz\"}".as_bytes(),
|
3583 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3584 - | )),
|
3585 - | ))
|
3586 - | .unwrap();
|
5158 + | let mut http_request = ::http::Request::builder()
|
5159 + | .uri("/")
|
5160 + | .method("POST")
|
5161 + | .header("Content-Type", "application/x-amz-json-1.1")
|
5162 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
5163 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
5164 + | ::bytes::Bytes::copy_from_slice(
|
5165 + | &::aws_smithy_protocol_test::decode_body_data("{\"MapOfListsOfStrings\":{\"abc\":[\"abc\",\"xyz\"],\"mno\":[\"xyz\",\"abc\"]}}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5166 + | )
|
5167 + | )).unwrap();
|
3587 5168 | #[allow(unused_mut)]
|
3588 5169 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3589 5170 | let config = crate::service::JsonProtocolConfig::builder().build();
|
3590 5171 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3591 5172 | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
3592 5173 | let sender = sender.clone();
|
3593 5174 | async move {
|
3594 5175 | let result = {
|
3595 5176 | use ::aws_smithy_protocol_test::FloatEquals;
|
3596 5177 | let expected = crate::input::KitchenSinkOperationInput {
|
3597 - | string: ::std::option::Option::Some("abc xyz".to_owned()),
|
5178 + | map_of_lists_of_strings: ::std::option::Option::Some({
|
5179 + | let mut ret = ::std::collections::HashMap::new();
|
5180 + | ret.insert(
|
5181 + | "abc".to_owned(),
|
5182 + | vec!["abc".to_owned(), "xyz".to_owned()],
|
5183 + | );
|
5184 + | ret.insert(
|
5185 + | "mno".to_owned(),
|
5186 + | vec!["xyz".to_owned(), "abc".to_owned()],
|
5187 + | );
|
5188 + | ret
|
5189 + | }),
|
3598 5190 | blob: ::std::option::Option::None,
|
3599 5191 | boolean: ::std::option::Option::None,
|
3600 5192 | double: ::std::option::Option::None,
|
3601 5193 | empty_struct: ::std::option::Option::None,
|
3602 5194 | float: ::std::option::Option::None,
|
3603 5195 | httpdate_timestamp: ::std::option::Option::None,
|
3604 5196 | integer: ::std::option::Option::None,
|
3605 5197 | iso8601_timestamp: ::std::option::Option::None,
|
3606 5198 | json_value: ::std::option::Option::None,
|
3607 5199 | list_of_lists: ::std::option::Option::None,
|
3608 5200 | list_of_maps_of_strings: ::std::option::Option::None,
|
3609 5201 | list_of_strings: ::std::option::Option::None,
|
3610 5202 | list_of_structs: ::std::option::Option::None,
|
3611 5203 | long: ::std::option::Option::None,
|
3612 - | map_of_lists_of_strings: ::std::option::Option::None,
|
3613 5204 | map_of_maps: ::std::option::Option::None,
|
3614 5205 | map_of_strings: ::std::option::Option::None,
|
3615 5206 | map_of_structs: ::std::option::Option::None,
|
3616 5207 | recursive_list: ::std::option::Option::None,
|
3617 5208 | recursive_map: ::std::option::Option::None,
|
3618 5209 | recursive_struct: ::std::option::Option::None,
|
3619 5210 | simple_struct: ::std::option::Option::None,
|
5211 + | string: ::std::option::Option::None,
|
3620 5212 | struct_with_json_name: ::std::option::Option::None,
|
3621 5213 | timestamp: ::std::option::Option::None,
|
3622 5214 | unix_timestamp: ::std::option::Option::None,
|
3623 5215 | };
|
3624 5216 | ::pretty_assertions::assert_eq!(
|
3625 5217 | input.blob,
|
3626 5218 | expected.blob,
|
3627 5219 | "Unexpected value for `blob`"
|
3628 5220 | );
|
3629 5221 | ::pretty_assertions::assert_eq!(
|
5642 7281 | .build_unchecked();
|
5643 7282 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5644 7283 | .await
|
5645 7284 | .expect("unable to make an HTTP request");
|
5646 7285 | assert!(
|
5647 7286 | receiver.recv().await.is_some(),
|
5648 7287 | "we expected operation handler to be invoked but it was not entered"
|
5649 7288 | );
|
5650 7289 | }
|
5651 7290 |
|
5652 - | /// Serializes timestamp shapes
|
5653 - | /// Test ID: serializes_timestamp_shapes
|
7291 + | /// Parses operations with empty JSON bodies
|
7292 + | /// Test ID: parses_operations_with_empty_json_bodies
|
5654 7293 | #[::tokio::test]
|
5655 7294 | #[::tracing_test::traced_test]
|
5656 - | async fn serializes_timestamp_shapes_request() {
|
5657 - | #[allow(unused_mut)]
|
5658 - | let mut http_request = ::http::Request::builder()
|
5659 - | .uri("/")
|
5660 - | .method("POST")
|
5661 - | .header("Content-Type", "application/x-amz-json-1.1")
|
5662 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
5663 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
5664 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5665 - | "{\"Timestamp\":946845296}".as_bytes(),
|
5666 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
5667 - | )),
|
5668 - | ))
|
5669 - | .unwrap();
|
5670 - | #[allow(unused_mut)]
|
5671 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5672 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
5673 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
5674 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
5675 - | let sender = sender.clone();
|
5676 - | async move {
|
5677 - | let result = {
|
5678 - | use ::aws_smithy_protocol_test::FloatEquals;
|
5679 - | let expected = crate::input::KitchenSinkOperationInput {
|
5680 - | timestamp: ::std::option::Option::Some(
|
5681 - | ::aws_smithy_types::DateTime::from_fractional_secs(
|
5682 - | 946845296, 0_f64,
|
5683 - | ),
|
5684 - | ),
|
5685 - | blob: ::std::option::Option::None,
|
5686 - | boolean: ::std::option::Option::None,
|
5687 - | double: ::std::option::Option::None,
|
5688 - | empty_struct: ::std::option::Option::None,
|
5689 - | float: ::std::option::Option::None,
|
5690 - | httpdate_timestamp: ::std::option::Option::None,
|
5691 - | integer: ::std::option::Option::None,
|
5692 - | iso8601_timestamp: ::std::option::Option::None,
|
5693 - | json_value: ::std::option::Option::None,
|
5694 - | list_of_lists: ::std::option::Option::None,
|
5695 - | list_of_maps_of_strings: ::std::option::Option::None,
|
5696 - | list_of_strings: ::std::option::Option::None,
|
5697 - | list_of_structs: ::std::option::Option::None,
|
5698 - | long: ::std::option::Option::None,
|
5699 - | map_of_lists_of_strings: ::std::option::Option::None,
|
5700 - | map_of_maps: ::std::option::Option::None,
|
5701 - | map_of_strings: ::std::option::Option::None,
|
5702 - | map_of_structs: ::std::option::Option::None,
|
5703 - | recursive_list: ::std::option::Option::None,
|
5704 - | recursive_map: ::std::option::Option::None,
|
5705 - | recursive_struct: ::std::option::Option::None,
|
5706 - | simple_struct: ::std::option::Option::None,
|
5707 - | string: ::std::option::Option::None,
|
5708 - | struct_with_json_name: ::std::option::Option::None,
|
5709 - | unix_timestamp: ::std::option::Option::None,
|
5710 - | };
|
5711 - | ::pretty_assertions::assert_eq!(
|
5712 - | input.blob,
|
5713 - | expected.blob,
|
5714 - | "Unexpected value for `blob`"
|
5715 - | );
|
5716 - | ::pretty_assertions::assert_eq!(
|
5717 - | input.boolean,
|
5718 - | expected.boolean,
|
5719 - | "Unexpected value for `boolean`"
|
5720 - | );
|
5721 - | assert!(
|
5722 - | input.double.float_equals(&expected.double),
|
5723 - | "Unexpected value for `double` {:?} vs. {:?}",
|
5724 - | expected.double,
|
5725 - | input.double
|
5726 - | );
|
5727 - | ::pretty_assertions::assert_eq!(
|
5728 - | input.empty_struct,
|
5729 - | expected.empty_struct,
|
5730 - | "Unexpected value for `empty_struct`"
|
5731 - | );
|
5732 - | assert!(
|
5733 - | input.float.float_equals(&expected.float),
|
5734 - | "Unexpected value for `float` {:?} vs. {:?}",
|
5735 - | expected.float,
|
5736 - | input.float
|
5737 - | );
|
5738 - | ::pretty_assertions::assert_eq!(
|
5739 - | input.httpdate_timestamp,
|
5740 - | expected.httpdate_timestamp,
|
5741 - | "Unexpected value for `httpdate_timestamp`"
|
5742 - | );
|
5743 - | ::pretty_assertions::assert_eq!(
|
5744 - | input.integer,
|
5745 - | expected.integer,
|
5746 - | "Unexpected value for `integer`"
|
5747 - | );
|
5748 - | ::pretty_assertions::assert_eq!(
|
5749 - | input.iso8601_timestamp,
|
5750 - | expected.iso8601_timestamp,
|
5751 - | "Unexpected value for `iso8601_timestamp`"
|
5752 - | );
|
5753 - | ::pretty_assertions::assert_eq!(
|
5754 - | input.json_value,
|
5755 - | expected.json_value,
|
5756 - | "Unexpected value for `json_value`"
|
5757 - | );
|
5758 - | ::pretty_assertions::assert_eq!(
|
5759 - | input.list_of_lists,
|
5760 - | expected.list_of_lists,
|
5761 - | "Unexpected value for `list_of_lists`"
|
5762 - | );
|
5763 - | ::pretty_assertions::assert_eq!(
|
5764 - | input.list_of_maps_of_strings,
|
5765 - | expected.list_of_maps_of_strings,
|
5766 - | "Unexpected value for `list_of_maps_of_strings`"
|
5767 - | );
|
5768 - | ::pretty_assertions::assert_eq!(
|
5769 - | input.list_of_strings,
|
5770 - | expected.list_of_strings,
|
5771 - | "Unexpected value for `list_of_strings`"
|
5772 - | );
|
5773 - | ::pretty_assertions::assert_eq!(
|
5774 - | input.list_of_structs,
|
5775 - | expected.list_of_structs,
|
5776 - | "Unexpected value for `list_of_structs`"
|
5777 - | );
|
5778 - | ::pretty_assertions::assert_eq!(
|
5779 - | input.long,
|
5780 - | expected.long,
|
5781 - | "Unexpected value for `long`"
|
5782 - | );
|
5783 - | ::pretty_assertions::assert_eq!(
|
5784 - | input.map_of_lists_of_strings,
|
5785 - | expected.map_of_lists_of_strings,
|
5786 - | "Unexpected value for `map_of_lists_of_strings`"
|
5787 - | );
|
5788 - | ::pretty_assertions::assert_eq!(
|
5789 - | input.map_of_maps,
|
5790 - | expected.map_of_maps,
|
5791 - | "Unexpected value for `map_of_maps`"
|
5792 - | );
|
5793 - | ::pretty_assertions::assert_eq!(
|
5794 - | input.map_of_strings,
|
5795 - | expected.map_of_strings,
|
5796 - | "Unexpected value for `map_of_strings`"
|
5797 - | );
|
5798 - | ::pretty_assertions::assert_eq!(
|
5799 - | input.map_of_structs,
|
5800 - | expected.map_of_structs,
|
5801 - | "Unexpected value for `map_of_structs`"
|
5802 - | );
|
5803 - | ::pretty_assertions::assert_eq!(
|
5804 - | input.recursive_list,
|
5805 - | expected.recursive_list,
|
5806 - | "Unexpected value for `recursive_list`"
|
5807 - | );
|
5808 - | ::pretty_assertions::assert_eq!(
|
5809 - | input.recursive_map,
|
5810 - | expected.recursive_map,
|
5811 - | "Unexpected value for `recursive_map`"
|
5812 - | );
|
5813 - | ::pretty_assertions::assert_eq!(
|
5814 - | input.recursive_struct,
|
5815 - | expected.recursive_struct,
|
5816 - | "Unexpected value for `recursive_struct`"
|
5817 - | );
|
5818 - | ::pretty_assertions::assert_eq!(
|
5819 - | input.simple_struct,
|
5820 - | expected.simple_struct,
|
5821 - | "Unexpected value for `simple_struct`"
|
5822 - | );
|
5823 - | ::pretty_assertions::assert_eq!(
|
5824 - | input.string,
|
5825 - | expected.string,
|
5826 - | "Unexpected value for `string`"
|
5827 - | );
|
5828 - | ::pretty_assertions::assert_eq!(
|
5829 - | input.struct_with_json_name,
|
5830 - | expected.struct_with_json_name,
|
5831 - | "Unexpected value for `struct_with_json_name`"
|
5832 - | );
|
5833 - | ::pretty_assertions::assert_eq!(
|
5834 - | input.timestamp,
|
5835 - | expected.timestamp,
|
5836 - | "Unexpected value for `timestamp`"
|
5837 - | );
|
5838 - | ::pretty_assertions::assert_eq!(
|
5839 - | input.unix_timestamp,
|
5840 - | expected.unix_timestamp,
|
5841 - | "Unexpected value for `unix_timestamp`"
|
5842 - | );
|
5843 - | let output = crate::output::KitchenSinkOperationOutput {
|
5844 - | blob: ::std::option::Option::None,
|
5845 - | boolean: ::std::option::Option::None,
|
5846 - | double: ::std::option::Option::None,
|
5847 - | empty_struct: ::std::option::Option::None,
|
5848 - | float: ::std::option::Option::None,
|
5849 - | httpdate_timestamp: ::std::option::Option::None,
|
5850 - | integer: ::std::option::Option::None,
|
5851 - | iso8601_timestamp: ::std::option::Option::None,
|
5852 - | json_value: ::std::option::Option::None,
|
5853 - | list_of_lists: ::std::option::Option::None,
|
5854 - | list_of_maps_of_strings: ::std::option::Option::None,
|
5855 - | list_of_strings: ::std::option::Option::None,
|
5856 - | list_of_structs: ::std::option::Option::None,
|
5857 - | long: ::std::option::Option::None,
|
5858 - | map_of_lists_of_strings: ::std::option::Option::None,
|
5859 - | map_of_maps: ::std::option::Option::None,
|
5860 - | map_of_strings: ::std::option::Option::None,
|
5861 - | map_of_structs: ::std::option::Option::None,
|
5862 - | recursive_list: ::std::option::Option::None,
|
5863 - | recursive_map: ::std::option::Option::None,
|
5864 - | recursive_struct: ::std::option::Option::None,
|
5865 - | simple_struct: ::std::option::Option::None,
|
5866 - | string: ::std::option::Option::None,
|
5867 - | struct_with_json_name: ::std::option::Option::None,
|
5868 - | timestamp: ::std::option::Option::None,
|
5869 - | unix_timestamp: ::std::option::Option::None,
|
5870 - | };
|
5871 - | Ok(output)
|
5872 - | };
|
5873 - | sender.send(()).await.expect("receiver dropped early");
|
5874 - | result
|
5875 - | }
|
5876 - | })
|
5877 - | .build_unchecked();
|
5878 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7295 + | async fn parses_operations_with_empty_json_bodies_response() {
|
7296 + | let output = crate::output::KitchenSinkOperationOutput {
|
7297 + | blob: ::std::option::Option::None,
|
7298 + | boolean: ::std::option::Option::None,
|
7299 + | double: ::std::option::Option::None,
|
7300 + | empty_struct: ::std::option::Option::None,
|
7301 + | float: ::std::option::Option::None,
|
7302 + | httpdate_timestamp: ::std::option::Option::None,
|
7303 + | integer: ::std::option::Option::None,
|
7304 + | iso8601_timestamp: ::std::option::Option::None,
|
7305 + | json_value: ::std::option::Option::None,
|
7306 + | list_of_lists: ::std::option::Option::None,
|
7307 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7308 + | list_of_strings: ::std::option::Option::None,
|
7309 + | list_of_structs: ::std::option::Option::None,
|
7310 + | long: ::std::option::Option::None,
|
7311 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7312 + | map_of_maps: ::std::option::Option::None,
|
7313 + | map_of_strings: ::std::option::Option::None,
|
7314 + | map_of_structs: ::std::option::Option::None,
|
7315 + | recursive_list: ::std::option::Option::None,
|
7316 + | recursive_map: ::std::option::Option::None,
|
7317 + | recursive_struct: ::std::option::Option::None,
|
7318 + | simple_struct: ::std::option::Option::None,
|
7319 + | string: ::std::option::Option::None,
|
7320 + | struct_with_json_name: ::std::option::Option::None,
|
7321 + | timestamp: ::std::option::Option::None,
|
7322 + | unix_timestamp: ::std::option::Option::None,
|
7323 + | };
|
7324 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
7325 + | let http_response = output.into_response();
|
7326 + | ::pretty_assertions::assert_eq!(
|
7327 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
7328 + | http_response.status()
|
7329 + | );
|
7330 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
7331 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7332 + | http_response.headers(),
|
7333 + | expected_headers,
|
7334 + | ));
|
7335 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5879 7336 | .await
|
5880 - | .expect("unable to make an HTTP request");
|
5881 - | assert!(
|
5882 - | receiver.recv().await.is_some(),
|
5883 - | "we expected operation handler to be invoked but it was not entered"
|
7337 + | .expect("unable to extract body to bytes");
|
7338 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
7339 + | &body,
|
7340 + | "{}",
|
7341 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
7342 + | ));
|
7343 + | }
|
7344 + |
|
7345 + | /// Parses string shapes
|
7346 + | /// Test ID: parses_string_shapes
|
7347 + | #[::tokio::test]
|
7348 + | #[::tracing_test::traced_test]
|
7349 + | async fn parses_string_shapes_response() {
|
7350 + | let output = crate::output::KitchenSinkOperationOutput {
|
7351 + | string: ::std::option::Option::Some("string-value".to_owned()),
|
7352 + | blob: ::std::option::Option::None,
|
7353 + | boolean: ::std::option::Option::None,
|
7354 + | double: ::std::option::Option::None,
|
7355 + | empty_struct: ::std::option::Option::None,
|
7356 + | float: ::std::option::Option::None,
|
7357 + | httpdate_timestamp: ::std::option::Option::None,
|
7358 + | integer: ::std::option::Option::None,
|
7359 + | iso8601_timestamp: ::std::option::Option::None,
|
7360 + | json_value: ::std::option::Option::None,
|
7361 + | list_of_lists: ::std::option::Option::None,
|
7362 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7363 + | list_of_strings: ::std::option::Option::None,
|
7364 + | list_of_structs: ::std::option::Option::None,
|
7365 + | long: ::std::option::Option::None,
|
7366 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7367 + | map_of_maps: ::std::option::Option::None,
|
7368 + | map_of_strings: ::std::option::Option::None,
|
7369 + | map_of_structs: ::std::option::Option::None,
|
7370 + | recursive_list: ::std::option::Option::None,
|
7371 + | recursive_map: ::std::option::Option::None,
|
7372 + | recursive_struct: ::std::option::Option::None,
|
7373 + | simple_struct: ::std::option::Option::None,
|
7374 + | struct_with_json_name: ::std::option::Option::None,
|
7375 + | timestamp: ::std::option::Option::None,
|
7376 + | unix_timestamp: ::std::option::Option::None,
|
7377 + | };
|
7378 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
7379 + | let http_response = output.into_response();
|
7380 + | ::pretty_assertions::assert_eq!(
|
7381 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
7382 + | http_response.status()
|
5884 7383 | );
|
7384 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
7385 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7386 + | http_response.headers(),
|
7387 + | expected_headers,
|
7388 + | ));
|
7389 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7390 + | .await
|
7391 + | .expect("unable to extract body to bytes");
|
7392 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
7393 + | &body,
|
7394 + | "{\"String\":\"string-value\"}",
|
7395 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
7396 + | ));
|
5885 7397 | }
|
5886 7398 |
|
5887 - | /// Serializes timestamp shapes with iso8601 timestampFormat
|
5888 - | /// Test ID: serializes_timestamp_shapes_with_iso8601_timestampformat
|
7399 + | /// Parses integer shapes
|
7400 + | /// Test ID: parses_integer_shapes
|
5889 7401 | #[::tokio::test]
|
5890 7402 | #[::tracing_test::traced_test]
|
5891 - | async fn serializes_timestamp_shapes_with_iso8601_timestampformat_request() {
|
5892 - | #[allow(unused_mut)]
|
5893 - | let mut http_request = ::http::Request::builder()
|
5894 - | .uri("/")
|
5895 - | .method("POST")
|
5896 - | .header("Content-Type", "application/x-amz-json-1.1")
|
5897 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
5898 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
5899 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5900 - | "{\"Iso8601Timestamp\":\"2000-01-02T20:34:56Z\"}".as_bytes(),
|
5901 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
5902 - | )),
|
5903 - | ))
|
5904 - | .unwrap();
|
5905 - | #[allow(unused_mut)]
|
5906 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5907 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
5908 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
5909 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
5910 - | let sender = sender.clone();
|
5911 - | async move {
|
5912 - | let result = {
|
5913 - | use ::aws_smithy_protocol_test::FloatEquals;
|
5914 - | let expected = crate::input::KitchenSinkOperationInput {
|
5915 - | iso8601_timestamp: ::std::option::Option::Some(
|
5916 - | ::aws_smithy_types::DateTime::from_fractional_secs(
|
5917 - | 946845296, 0_f64,
|
5918 - | ),
|
5919 - | ),
|
5920 - | blob: ::std::option::Option::None,
|
5921 - | boolean: ::std::option::Option::None,
|
5922 - | double: ::std::option::Option::None,
|
5923 - | empty_struct: ::std::option::Option::None,
|
5924 - | float: ::std::option::Option::None,
|
5925 - | httpdate_timestamp: ::std::option::Option::None,
|
5926 - | integer: ::std::option::Option::None,
|
5927 - | json_value: ::std::option::Option::None,
|
5928 - | list_of_lists: ::std::option::Option::None,
|
5929 - | list_of_maps_of_strings: ::std::option::Option::None,
|
5930 - | list_of_strings: ::std::option::Option::None,
|
5931 - | list_of_structs: ::std::option::Option::None,
|
5932 - | long: ::std::option::Option::None,
|
5933 - | map_of_lists_of_strings: ::std::option::Option::None,
|
5934 - | map_of_maps: ::std::option::Option::None,
|
5935 - | map_of_strings: ::std::option::Option::None,
|
5936 - | map_of_structs: ::std::option::Option::None,
|
5937 - | recursive_list: ::std::option::Option::None,
|
5938 - | recursive_map: ::std::option::Option::None,
|
5939 - | recursive_struct: ::std::option::Option::None,
|
5940 - | simple_struct: ::std::option::Option::None,
|
5941 - | string: ::std::option::Option::None,
|
5942 - | struct_with_json_name: ::std::option::Option::None,
|
5943 - | timestamp: ::std::option::Option::None,
|
5944 - | unix_timestamp: ::std::option::Option::None,
|
5945 - | };
|
5946 - | ::pretty_assertions::assert_eq!(
|
5947 - | input.blob,
|
5948 - | expected.blob,
|
5949 - | "Unexpected value for `blob`"
|
5950 - | );
|
5951 - | ::pretty_assertions::assert_eq!(
|
5952 - | input.boolean,
|
5953 - | expected.boolean,
|
5954 - | "Unexpected value for `boolean`"
|
5955 - | );
|
5956 - | assert!(
|
5957 - | input.double.float_equals(&expected.double),
|
5958 - | "Unexpected value for `double` {:?} vs. {:?}",
|
5959 - | expected.double,
|
5960 - | input.double
|
5961 - | );
|
5962 - | ::pretty_assertions::assert_eq!(
|
5963 - | input.empty_struct,
|
5964 - | expected.empty_struct,
|
5965 - | "Unexpected value for `empty_struct`"
|
5966 - | );
|
5967 - | assert!(
|
5968 - | input.float.float_equals(&expected.float),
|
5969 - | "Unexpected value for `float` {:?} vs. {:?}",
|
5970 - | expected.float,
|
5971 - | input.float
|
5972 - | );
|
5973 - | ::pretty_assertions::assert_eq!(
|
5974 - | input.httpdate_timestamp,
|
5975 - | expected.httpdate_timestamp,
|
5976 - | "Unexpected value for `httpdate_timestamp`"
|
5977 - | );
|
5978 - | ::pretty_assertions::assert_eq!(
|
5979 - | input.integer,
|
5980 - | expected.integer,
|
5981 - | "Unexpected value for `integer`"
|
5982 - | );
|
5983 - | ::pretty_assertions::assert_eq!(
|
5984 - | input.iso8601_timestamp,
|
5985 - | expected.iso8601_timestamp,
|
5986 - | "Unexpected value for `iso8601_timestamp`"
|
5987 - | );
|
5988 - | ::pretty_assertions::assert_eq!(
|
5989 - | input.json_value,
|
5990 - | expected.json_value,
|
5991 - | "Unexpected value for `json_value`"
|
5992 - | );
|
5993 - | ::pretty_assertions::assert_eq!(
|
5994 - | input.list_of_lists,
|
5995 - | expected.list_of_lists,
|
5996 - | "Unexpected value for `list_of_lists`"
|
5997 - | );
|
5998 - | ::pretty_assertions::assert_eq!(
|
5999 - | input.list_of_maps_of_strings,
|
6000 - | expected.list_of_maps_of_strings,
|
6001 - | "Unexpected value for `list_of_maps_of_strings`"
|
6002 - | );
|
6003 - | ::pretty_assertions::assert_eq!(
|
6004 - | input.list_of_strings,
|
6005 - | expected.list_of_strings,
|
6006 - | "Unexpected value for `list_of_strings`"
|
6007 - | );
|
6008 - | ::pretty_assertions::assert_eq!(
|
6009 - | input.list_of_structs,
|
6010 - | expected.list_of_structs,
|
6011 - | "Unexpected value for `list_of_structs`"
|
6012 - | );
|
6013 - | ::pretty_assertions::assert_eq!(
|
6014 - | input.long,
|
6015 - | expected.long,
|
6016 - | "Unexpected value for `long`"
|
6017 - | );
|
6018 - | ::pretty_assertions::assert_eq!(
|
6019 - | input.map_of_lists_of_strings,
|
6020 - | expected.map_of_lists_of_strings,
|
6021 - | "Unexpected value for `map_of_lists_of_strings`"
|
6022 - | );
|
6023 - | ::pretty_assertions::assert_eq!(
|
6024 - | input.map_of_maps,
|
6025 - | expected.map_of_maps,
|
6026 - | "Unexpected value for `map_of_maps`"
|
6027 - | );
|
6028 - | ::pretty_assertions::assert_eq!(
|
6029 - | input.map_of_strings,
|
6030 - | expected.map_of_strings,
|
6031 - | "Unexpected value for `map_of_strings`"
|
6032 - | );
|
6033 - | ::pretty_assertions::assert_eq!(
|
6034 - | input.map_of_structs,
|
6035 - | expected.map_of_structs,
|
6036 - | "Unexpected value for `map_of_structs`"
|
6037 - | );
|
6038 - | ::pretty_assertions::assert_eq!(
|
6039 - | input.recursive_list,
|
6040 - | expected.recursive_list,
|
6041 - | "Unexpected value for `recursive_list`"
|
6042 - | );
|
6043 - | ::pretty_assertions::assert_eq!(
|
6044 - | input.recursive_map,
|
6045 - | expected.recursive_map,
|
6046 - | "Unexpected value for `recursive_map`"
|
6047 - | );
|
6048 - | ::pretty_assertions::assert_eq!(
|
6049 - | input.recursive_struct,
|
6050 - | expected.recursive_struct,
|
6051 - | "Unexpected value for `recursive_struct`"
|
6052 - | );
|
6053 - | ::pretty_assertions::assert_eq!(
|
6054 - | input.simple_struct,
|
6055 - | expected.simple_struct,
|
6056 - | "Unexpected value for `simple_struct`"
|
6057 - | );
|
6058 - | ::pretty_assertions::assert_eq!(
|
6059 - | input.string,
|
6060 - | expected.string,
|
6061 - | "Unexpected value for `string`"
|
6062 - | );
|
6063 - | ::pretty_assertions::assert_eq!(
|
6064 - | input.struct_with_json_name,
|
6065 - | expected.struct_with_json_name,
|
6066 - | "Unexpected value for `struct_with_json_name`"
|
6067 - | );
|
6068 - | ::pretty_assertions::assert_eq!(
|
6069 - | input.timestamp,
|
6070 - | expected.timestamp,
|
6071 - | "Unexpected value for `timestamp`"
|
6072 - | );
|
6073 - | ::pretty_assertions::assert_eq!(
|
6074 - | input.unix_timestamp,
|
6075 - | expected.unix_timestamp,
|
6076 - | "Unexpected value for `unix_timestamp`"
|
6077 - | );
|
6078 - | let output = crate::output::KitchenSinkOperationOutput {
|
6079 - | blob: ::std::option::Option::None,
|
6080 - | boolean: ::std::option::Option::None,
|
6081 - | double: ::std::option::Option::None,
|
6082 - | empty_struct: ::std::option::Option::None,
|
6083 - | float: ::std::option::Option::None,
|
6084 - | httpdate_timestamp: ::std::option::Option::None,
|
6085 - | integer: ::std::option::Option::None,
|
6086 - | iso8601_timestamp: ::std::option::Option::None,
|
6087 - | json_value: ::std::option::Option::None,
|
6088 - | list_of_lists: ::std::option::Option::None,
|
6089 - | list_of_maps_of_strings: ::std::option::Option::None,
|
6090 - | list_of_strings: ::std::option::Option::None,
|
6091 - | list_of_structs: ::std::option::Option::None,
|
6092 - | long: ::std::option::Option::None,
|
6093 - | map_of_lists_of_strings: ::std::option::Option::None,
|
6094 - | map_of_maps: ::std::option::Option::None,
|
6095 - | map_of_strings: ::std::option::Option::None,
|
6096 - | map_of_structs: ::std::option::Option::None,
|
6097 - | recursive_list: ::std::option::Option::None,
|
6098 - | recursive_map: ::std::option::Option::None,
|
6099 - | recursive_struct: ::std::option::Option::None,
|
6100 - | simple_struct: ::std::option::Option::None,
|
6101 - | string: ::std::option::Option::None,
|
6102 - | struct_with_json_name: ::std::option::Option::None,
|
6103 - | timestamp: ::std::option::Option::None,
|
6104 - | unix_timestamp: ::std::option::Option::None,
|
6105 - | };
|
6106 - | Ok(output)
|
6107 - | };
|
6108 - | sender.send(()).await.expect("receiver dropped early");
|
6109 - | result
|
6110 - | }
|
6111 - | })
|
6112 - | .build_unchecked();
|
6113 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6114 - | .await
|
6115 - | .expect("unable to make an HTTP request");
|
6116 - | assert!(
|
6117 - | receiver.recv().await.is_some(),
|
6118 - | "we expected operation handler to be invoked but it was not entered"
|
7403 + | async fn parses_integer_shapes_response() {
|
7404 + | let output = crate::output::KitchenSinkOperationOutput {
|
7405 + | integer: ::std::option::Option::Some(1234),
|
7406 + | blob: ::std::option::Option::None,
|
7407 + | boolean: ::std::option::Option::None,
|
7408 + | double: ::std::option::Option::None,
|
7409 + | empty_struct: ::std::option::Option::None,
|
7410 + | float: ::std::option::Option::None,
|
7411 + | httpdate_timestamp: ::std::option::Option::None,
|
7412 + | iso8601_timestamp: ::std::option::Option::None,
|
7413 + | json_value: ::std::option::Option::None,
|
7414 + | list_of_lists: ::std::option::Option::None,
|
7415 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7416 + | list_of_strings: ::std::option::Option::None,
|
7417 + | list_of_structs: ::std::option::Option::None,
|
7418 + | long: ::std::option::Option::None,
|
7419 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7420 + | map_of_maps: ::std::option::Option::None,
|
7421 + | map_of_strings: ::std::option::Option::None,
|
7422 + | map_of_structs: ::std::option::Option::None,
|
7423 + | recursive_list: ::std::option::Option::None,
|
7424 + | recursive_map: ::std::option::Option::None,
|
7425 + | recursive_struct: ::std::option::Option::None,
|
7426 + | simple_struct: ::std::option::Option::None,
|
7427 + | string: ::std::option::Option::None,
|
7428 + | struct_with_json_name: ::std::option::Option::None,
|
7429 + | timestamp: ::std::option::Option::None,
|
7430 + | unix_timestamp: ::std::option::Option::None,
|
7431 + | };
|
7432 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
7433 + | let http_response = output.into_response();
|
7434 + | ::pretty_assertions::assert_eq!(
|
7435 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
7436 + | http_response.status()
|
6119 7437 | );
|
7438 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
7439 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7440 + | http_response.headers(),
|
7441 + | expected_headers,
|
7442 + | ));
|
7443 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7444 + | .await
|
7445 + | .expect("unable to extract body to bytes");
|
7446 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
7447 + | &body,
|
7448 + | "{\"Integer\":1234}",
|
7449 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
7450 + | ));
|
6120 7451 | }
|
6121 7452 |
|
6122 - | /// Serializes timestamp shapes with httpdate timestampFormat
|
6123 - | /// Test ID: serializes_timestamp_shapes_with_httpdate_timestampformat
|
7453 + | /// Parses long shapes
|
7454 + | /// Test ID: parses_long_shapes
|
6124 7455 | #[::tokio::test]
|
6125 7456 | #[::tracing_test::traced_test]
|
6126 - | async fn serializes_timestamp_shapes_with_httpdate_timestampformat_request() {
|
6127 - | #[allow(unused_mut)]
|
6128 - | let mut http_request = ::http::Request::builder()
|
6129 - | .uri("/")
|
6130 - | .method("POST")
|
6131 - | .header("Content-Type", "application/x-amz-json-1.1")
|
6132 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
6133 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
6134 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6135 - | "{\"HttpdateTimestamp\":\"Sun, 02 Jan 2000 20:34:56 GMT\"}".as_bytes(),
|
6136 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
6137 - | )),
|
6138 - | ))
|
6139 - | .unwrap();
|
6140 - | #[allow(unused_mut)]
|
6141 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6142 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
6143 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
6144 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
6145 - | let sender = sender.clone();
|
6146 - | async move {
|
6147 - | let result = {
|
6148 - | use ::aws_smithy_protocol_test::FloatEquals;
|
6149 - | let expected = crate::input::KitchenSinkOperationInput {
|
6150 - | httpdate_timestamp: ::std::option::Option::Some(
|
6151 - | ::aws_smithy_types::DateTime::from_fractional_secs(
|
6152 - | 946845296, 0_f64,
|
6153 - | ),
|
6154 - | ),
|
6155 - | blob: ::std::option::Option::None,
|
6156 - | boolean: ::std::option::Option::None,
|
6157 - | double: ::std::option::Option::None,
|
6158 - | empty_struct: ::std::option::Option::None,
|
6159 - | float: ::std::option::Option::None,
|
6160 - | integer: ::std::option::Option::None,
|
6161 - | iso8601_timestamp: ::std::option::Option::None,
|
6162 - | json_value: ::std::option::Option::None,
|
6163 - | list_of_lists: ::std::option::Option::None,
|
6164 - | list_of_maps_of_strings: ::std::option::Option::None,
|
6165 - | list_of_strings: ::std::option::Option::None,
|
6166 - | list_of_structs: ::std::option::Option::None,
|
6167 - | long: ::std::option::Option::None,
|
6168 - | map_of_lists_of_strings: ::std::option::Option::None,
|
6169 - | map_of_maps: ::std::option::Option::None,
|
6170 - | map_of_strings: ::std::option::Option::None,
|
6171 - | map_of_structs: ::std::option::Option::None,
|
6172 - | recursive_list: ::std::option::Option::None,
|
6173 - | recursive_map: ::std::option::Option::None,
|
6174 - | recursive_struct: ::std::option::Option::None,
|
6175 - | simple_struct: ::std::option::Option::None,
|
6176 - | string: ::std::option::Option::None,
|
6177 - | struct_with_json_name: ::std::option::Option::None,
|
6178 - | timestamp: ::std::option::Option::None,
|
6179 - | unix_timestamp: ::std::option::Option::None,
|
6180 - | };
|
6181 - | ::pretty_assertions::assert_eq!(
|
6182 - | input.blob,
|
6183 - | expected.blob,
|
6184 - | "Unexpected value for `blob`"
|
6185 - | );
|
6186 - | ::pretty_assertions::assert_eq!(
|
6187 - | input.boolean,
|
6188 - | expected.boolean,
|
6189 - | "Unexpected value for `boolean`"
|
6190 - | );
|
6191 - | assert!(
|
6192 - | input.double.float_equals(&expected.double),
|
6193 - | "Unexpected value for `double` {:?} vs. {:?}",
|
6194 - | expected.double,
|
6195 - | input.double
|
6196 - | );
|
6197 - | ::pretty_assertions::assert_eq!(
|
6198 - | input.empty_struct,
|
6199 - | expected.empty_struct,
|
6200 - | "Unexpected value for `empty_struct`"
|
6201 - | );
|
6202 - | assert!(
|
6203 - | input.float.float_equals(&expected.float),
|
6204 - | "Unexpected value for `float` {:?} vs. {:?}",
|
6205 - | expected.float,
|
6206 - | input.float
|
6207 - | );
|
6208 - | ::pretty_assertions::assert_eq!(
|
6209 - | input.httpdate_timestamp,
|
6210 - | expected.httpdate_timestamp,
|
6211 - | "Unexpected value for `httpdate_timestamp`"
|
6212 - | );
|
6213 - | ::pretty_assertions::assert_eq!(
|
6214 - | input.integer,
|
6215 - | expected.integer,
|
6216 - | "Unexpected value for `integer`"
|
6217 - | );
|
6218 - | ::pretty_assertions::assert_eq!(
|
6219 - | input.iso8601_timestamp,
|
6220 - | expected.iso8601_timestamp,
|
6221 - | "Unexpected value for `iso8601_timestamp`"
|
6222 - | );
|
6223 - | ::pretty_assertions::assert_eq!(
|
6224 - | input.json_value,
|
6225 - | expected.json_value,
|
6226 - | "Unexpected value for `json_value`"
|
6227 - | );
|
6228 - | ::pretty_assertions::assert_eq!(
|
6229 - | input.list_of_lists,
|
6230 - | expected.list_of_lists,
|
6231 - | "Unexpected value for `list_of_lists`"
|
6232 - | );
|
6233 - | ::pretty_assertions::assert_eq!(
|
6234 - | input.list_of_maps_of_strings,
|
6235 - | expected.list_of_maps_of_strings,
|
6236 - | "Unexpected value for `list_of_maps_of_strings`"
|
6237 - | );
|
6238 - | ::pretty_assertions::assert_eq!(
|
6239 - | input.list_of_strings,
|
6240 - | expected.list_of_strings,
|
6241 - | "Unexpected value for `list_of_strings`"
|
6242 - | );
|
6243 - | ::pretty_assertions::assert_eq!(
|
6244 - | input.list_of_structs,
|
6245 - | expected.list_of_structs,
|
6246 - | "Unexpected value for `list_of_structs`"
|
6247 - | );
|
6248 - | ::pretty_assertions::assert_eq!(
|
6249 - | input.long,
|
6250 - | expected.long,
|
6251 - | "Unexpected value for `long`"
|
6252 - | );
|
6253 - | ::pretty_assertions::assert_eq!(
|
6254 - | input.map_of_lists_of_strings,
|
6255 - | expected.map_of_lists_of_strings,
|
6256 - | "Unexpected value for `map_of_lists_of_strings`"
|
6257 - | );
|
6258 - | ::pretty_assertions::assert_eq!(
|
6259 - | input.map_of_maps,
|
6260 - | expected.map_of_maps,
|
6261 - | "Unexpected value for `map_of_maps`"
|
6262 - | );
|
6263 - | ::pretty_assertions::assert_eq!(
|
6264 - | input.map_of_strings,
|
6265 - | expected.map_of_strings,
|
6266 - | "Unexpected value for `map_of_strings`"
|
6267 - | );
|
6268 - | ::pretty_assertions::assert_eq!(
|
6269 - | input.map_of_structs,
|
6270 - | expected.map_of_structs,
|
6271 - | "Unexpected value for `map_of_structs`"
|
6272 - | );
|
6273 - | ::pretty_assertions::assert_eq!(
|
6274 - | input.recursive_list,
|
6275 - | expected.recursive_list,
|
6276 - | "Unexpected value for `recursive_list`"
|
6277 - | );
|
6278 - | ::pretty_assertions::assert_eq!(
|
6279 - | input.recursive_map,
|
6280 - | expected.recursive_map,
|
6281 - | "Unexpected value for `recursive_map`"
|
6282 - | );
|
6283 - | ::pretty_assertions::assert_eq!(
|
6284 - | input.recursive_struct,
|
6285 - | expected.recursive_struct,
|
6286 - | "Unexpected value for `recursive_struct`"
|
6287 - | );
|
6288 - | ::pretty_assertions::assert_eq!(
|
6289 - | input.simple_struct,
|
6290 - | expected.simple_struct,
|
6291 - | "Unexpected value for `simple_struct`"
|
6292 - | );
|
6293 - | ::pretty_assertions::assert_eq!(
|
6294 - | input.string,
|
6295 - | expected.string,
|
6296 - | "Unexpected value for `string`"
|
6297 - | );
|
6298 - | ::pretty_assertions::assert_eq!(
|
6299 - | input.struct_with_json_name,
|
6300 - | expected.struct_with_json_name,
|
6301 - | "Unexpected value for `struct_with_json_name`"
|
6302 - | );
|
6303 - | ::pretty_assertions::assert_eq!(
|
6304 - | input.timestamp,
|
6305 - | expected.timestamp,
|
6306 - | "Unexpected value for `timestamp`"
|
6307 - | );
|
6308 - | ::pretty_assertions::assert_eq!(
|
6309 - | input.unix_timestamp,
|
6310 - | expected.unix_timestamp,
|
6311 - | "Unexpected value for `unix_timestamp`"
|
6312 - | );
|
6313 - | let output = crate::output::KitchenSinkOperationOutput {
|
6314 - | blob: ::std::option::Option::None,
|
6315 - | boolean: ::std::option::Option::None,
|
6316 - | double: ::std::option::Option::None,
|
6317 - | empty_struct: ::std::option::Option::None,
|
6318 - | float: ::std::option::Option::None,
|
6319 - | httpdate_timestamp: ::std::option::Option::None,
|
6320 - | integer: ::std::option::Option::None,
|
6321 - | iso8601_timestamp: ::std::option::Option::None,
|
6322 - | json_value: ::std::option::Option::None,
|
6323 - | list_of_lists: ::std::option::Option::None,
|
6324 - | list_of_maps_of_strings: ::std::option::Option::None,
|
6325 - | list_of_strings: ::std::option::Option::None,
|
6326 - | list_of_structs: ::std::option::Option::None,
|
6327 - | long: ::std::option::Option::None,
|
6328 - | map_of_lists_of_strings: ::std::option::Option::None,
|
6329 - | map_of_maps: ::std::option::Option::None,
|
6330 - | map_of_strings: ::std::option::Option::None,
|
6331 - | map_of_structs: ::std::option::Option::None,
|
6332 - | recursive_list: ::std::option::Option::None,
|
6333 - | recursive_map: ::std::option::Option::None,
|
6334 - | recursive_struct: ::std::option::Option::None,
|
6335 - | simple_struct: ::std::option::Option::None,
|
6336 - | string: ::std::option::Option::None,
|
6337 - | struct_with_json_name: ::std::option::Option::None,
|
6338 - | timestamp: ::std::option::Option::None,
|
6339 - | unix_timestamp: ::std::option::Option::None,
|
6340 - | };
|
6341 - | Ok(output)
|
6342 - | };
|
6343 - | sender.send(()).await.expect("receiver dropped early");
|
6344 - | result
|
6345 - | }
|
6346 - | })
|
6347 - | .build_unchecked();
|
6348 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6349 - | .await
|
6350 - | .expect("unable to make an HTTP request");
|
6351 - | assert!(
|
6352 - | receiver.recv().await.is_some(),
|
6353 - | "we expected operation handler to be invoked but it was not entered"
|
6354 - | );
|
6355 - | }
|
6356 - |
|
6357 - | /// Serializes timestamp shapes with unixTimestamp timestampFormat
|
6358 - | /// Test ID: serializes_timestamp_shapes_with_unixtimestamp_timestampformat
|
6359 - | #[::tokio::test]
|
6360 - | #[::tracing_test::traced_test]
|
6361 - | async fn serializes_timestamp_shapes_with_unixtimestamp_timestampformat_request() {
|
6362 - | #[allow(unused_mut)]
|
6363 - | let mut http_request = ::http::Request::builder()
|
6364 - | .uri("/")
|
6365 - | .method("POST")
|
6366 - | .header("Content-Type", "application/x-amz-json-1.1")
|
6367 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
6368 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
6369 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6370 - | "{\"UnixTimestamp\":946845296}".as_bytes(),
|
6371 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
6372 - | )),
|
6373 - | ))
|
6374 - | .unwrap();
|
6375 - | #[allow(unused_mut)]
|
6376 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6377 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
6378 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
6379 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
6380 - | let sender = sender.clone();
|
6381 - | async move {
|
6382 - | let result = {
|
6383 - | use ::aws_smithy_protocol_test::FloatEquals;
|
6384 - | let expected = crate::input::KitchenSinkOperationInput {
|
6385 - | unix_timestamp: ::std::option::Option::Some(
|
6386 - | ::aws_smithy_types::DateTime::from_fractional_secs(
|
6387 - | 946845296, 0_f64,
|
6388 - | ),
|
6389 - | ),
|
6390 - | blob: ::std::option::Option::None,
|
6391 - | boolean: ::std::option::Option::None,
|
6392 - | double: ::std::option::Option::None,
|
6393 - | empty_struct: ::std::option::Option::None,
|
6394 - | float: ::std::option::Option::None,
|
6395 - | httpdate_timestamp: ::std::option::Option::None,
|
6396 - | integer: ::std::option::Option::None,
|
6397 - | iso8601_timestamp: ::std::option::Option::None,
|
6398 - | json_value: ::std::option::Option::None,
|
6399 - | list_of_lists: ::std::option::Option::None,
|
6400 - | list_of_maps_of_strings: ::std::option::Option::None,
|
6401 - | list_of_strings: ::std::option::Option::None,
|
6402 - | list_of_structs: ::std::option::Option::None,
|
6403 - | long: ::std::option::Option::None,
|
6404 - | map_of_lists_of_strings: ::std::option::Option::None,
|
6405 - | map_of_maps: ::std::option::Option::None,
|
6406 - | map_of_strings: ::std::option::Option::None,
|
6407 - | map_of_structs: ::std::option::Option::None,
|
6408 - | recursive_list: ::std::option::Option::None,
|
6409 - | recursive_map: ::std::option::Option::None,
|
6410 - | recursive_struct: ::std::option::Option::None,
|
6411 - | simple_struct: ::std::option::Option::None,
|
6412 - | string: ::std::option::Option::None,
|
6413 - | struct_with_json_name: ::std::option::Option::None,
|
6414 - | timestamp: ::std::option::Option::None,
|
6415 - | };
|
6416 - | ::pretty_assertions::assert_eq!(
|
6417 - | input.blob,
|
6418 - | expected.blob,
|
6419 - | "Unexpected value for `blob`"
|
6420 - | );
|
6421 - | ::pretty_assertions::assert_eq!(
|
6422 - | input.boolean,
|
6423 - | expected.boolean,
|
6424 - | "Unexpected value for `boolean`"
|
6425 - | );
|
6426 - | assert!(
|
6427 - | input.double.float_equals(&expected.double),
|
6428 - | "Unexpected value for `double` {:?} vs. {:?}",
|
6429 - | expected.double,
|
6430 - | input.double
|
6431 - | );
|
6432 - | ::pretty_assertions::assert_eq!(
|
6433 - | input.empty_struct,
|
6434 - | expected.empty_struct,
|
6435 - | "Unexpected value for `empty_struct`"
|
6436 - | );
|
6437 - | assert!(
|
6438 - | input.float.float_equals(&expected.float),
|
6439 - | "Unexpected value for `float` {:?} vs. {:?}",
|
6440 - | expected.float,
|
6441 - | input.float
|
6442 - | );
|
6443 - | ::pretty_assertions::assert_eq!(
|
6444 - | input.httpdate_timestamp,
|
6445 - | expected.httpdate_timestamp,
|
6446 - | "Unexpected value for `httpdate_timestamp`"
|
6447 - | );
|
6448 - | ::pretty_assertions::assert_eq!(
|
6449 - | input.integer,
|
6450 - | expected.integer,
|
6451 - | "Unexpected value for `integer`"
|
6452 - | );
|
6453 - | ::pretty_assertions::assert_eq!(
|
6454 - | input.iso8601_timestamp,
|
6455 - | expected.iso8601_timestamp,
|
6456 - | "Unexpected value for `iso8601_timestamp`"
|
6457 - | );
|
6458 - | ::pretty_assertions::assert_eq!(
|
6459 - | input.json_value,
|
6460 - | expected.json_value,
|
6461 - | "Unexpected value for `json_value`"
|
6462 - | );
|
6463 - | ::pretty_assertions::assert_eq!(
|
6464 - | input.list_of_lists,
|
6465 - | expected.list_of_lists,
|
6466 - | "Unexpected value for `list_of_lists`"
|
6467 - | );
|
6468 - | ::pretty_assertions::assert_eq!(
|
6469 - | input.list_of_maps_of_strings,
|
6470 - | expected.list_of_maps_of_strings,
|
6471 - | "Unexpected value for `list_of_maps_of_strings`"
|
6472 - | );
|
6473 - | ::pretty_assertions::assert_eq!(
|
6474 - | input.list_of_strings,
|
6475 - | expected.list_of_strings,
|
6476 - | "Unexpected value for `list_of_strings`"
|
6477 - | );
|
6478 - | ::pretty_assertions::assert_eq!(
|
6479 - | input.list_of_structs,
|
6480 - | expected.list_of_structs,
|
6481 - | "Unexpected value for `list_of_structs`"
|
6482 - | );
|
6483 - | ::pretty_assertions::assert_eq!(
|
6484 - | input.long,
|
6485 - | expected.long,
|
6486 - | "Unexpected value for `long`"
|
6487 - | );
|
6488 - | ::pretty_assertions::assert_eq!(
|
6489 - | input.map_of_lists_of_strings,
|
6490 - | expected.map_of_lists_of_strings,
|
6491 - | "Unexpected value for `map_of_lists_of_strings`"
|
6492 - | );
|
6493 - | ::pretty_assertions::assert_eq!(
|
6494 - | input.map_of_maps,
|
6495 - | expected.map_of_maps,
|
6496 - | "Unexpected value for `map_of_maps`"
|
6497 - | );
|
6498 - | ::pretty_assertions::assert_eq!(
|
6499 - | input.map_of_strings,
|
6500 - | expected.map_of_strings,
|
6501 - | "Unexpected value for `map_of_strings`"
|
6502 - | );
|
6503 - | ::pretty_assertions::assert_eq!(
|
6504 - | input.map_of_structs,
|
6505 - | expected.map_of_structs,
|
6506 - | "Unexpected value for `map_of_structs`"
|
6507 - | );
|
6508 - | ::pretty_assertions::assert_eq!(
|
6509 - | input.recursive_list,
|
6510 - | expected.recursive_list,
|
6511 - | "Unexpected value for `recursive_list`"
|
6512 - | );
|
6513 - | ::pretty_assertions::assert_eq!(
|
6514 - | input.recursive_map,
|
6515 - | expected.recursive_map,
|
6516 - | "Unexpected value for `recursive_map`"
|
6517 - | );
|
6518 - | ::pretty_assertions::assert_eq!(
|
6519 - | input.recursive_struct,
|
6520 - | expected.recursive_struct,
|
6521 - | "Unexpected value for `recursive_struct`"
|
6522 - | );
|
6523 - | ::pretty_assertions::assert_eq!(
|
6524 - | input.simple_struct,
|
6525 - | expected.simple_struct,
|
6526 - | "Unexpected value for `simple_struct`"
|
6527 - | );
|
6528 - | ::pretty_assertions::assert_eq!(
|
6529 - | input.string,
|
6530 - | expected.string,
|
6531 - | "Unexpected value for `string`"
|
6532 - | );
|
6533 - | ::pretty_assertions::assert_eq!(
|
6534 - | input.struct_with_json_name,
|
6535 - | expected.struct_with_json_name,
|
6536 - | "Unexpected value for `struct_with_json_name`"
|
6537 - | );
|
6538 - | ::pretty_assertions::assert_eq!(
|
6539 - | input.timestamp,
|
6540 - | expected.timestamp,
|
6541 - | "Unexpected value for `timestamp`"
|
6542 - | );
|
6543 - | ::pretty_assertions::assert_eq!(
|
6544 - | input.unix_timestamp,
|
6545 - | expected.unix_timestamp,
|
6546 - | "Unexpected value for `unix_timestamp`"
|
6547 - | );
|
6548 - | let output = crate::output::KitchenSinkOperationOutput {
|
6549 - | blob: ::std::option::Option::None,
|
6550 - | boolean: ::std::option::Option::None,
|
6551 - | double: ::std::option::Option::None,
|
6552 - | empty_struct: ::std::option::Option::None,
|
6553 - | float: ::std::option::Option::None,
|
6554 - | httpdate_timestamp: ::std::option::Option::None,
|
6555 - | integer: ::std::option::Option::None,
|
6556 - | iso8601_timestamp: ::std::option::Option::None,
|
6557 - | json_value: ::std::option::Option::None,
|
6558 - | list_of_lists: ::std::option::Option::None,
|
6559 - | list_of_maps_of_strings: ::std::option::Option::None,
|
6560 - | list_of_strings: ::std::option::Option::None,
|
6561 - | list_of_structs: ::std::option::Option::None,
|
6562 - | long: ::std::option::Option::None,
|
6563 - | map_of_lists_of_strings: ::std::option::Option::None,
|
6564 - | map_of_maps: ::std::option::Option::None,
|
6565 - | map_of_strings: ::std::option::Option::None,
|
6566 - | map_of_structs: ::std::option::Option::None,
|
6567 - | recursive_list: ::std::option::Option::None,
|
6568 - | recursive_map: ::std::option::Option::None,
|
6569 - | recursive_struct: ::std::option::Option::None,
|
6570 - | simple_struct: ::std::option::Option::None,
|
6571 - | string: ::std::option::Option::None,
|
6572 - | struct_with_json_name: ::std::option::Option::None,
|
6573 - | timestamp: ::std::option::Option::None,
|
6574 - | unix_timestamp: ::std::option::Option::None,
|
6575 - | };
|
6576 - | Ok(output)
|
6577 - | };
|
6578 - | sender.send(()).await.expect("receiver dropped early");
|
6579 - | result
|
6580 - | }
|
6581 - | })
|
6582 - | .build_unchecked();
|
6583 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6584 - | .await
|
6585 - | .expect("unable to make an HTTP request");
|
6586 - | assert!(
|
6587 - | receiver.recv().await.is_some(),
|
6588 - | "we expected operation handler to be invoked but it was not entered"
|
6589 - | );
|
6590 - | }
|
6591 - |
|
6592 - | /// Serializes list shapes
|
6593 - | /// Test ID: serializes_list_shapes
|
6594 - | #[::tokio::test]
|
6595 - | #[::tracing_test::traced_test]
|
6596 - | async fn serializes_list_shapes_request() {
|
6597 - | #[allow(unused_mut)]
|
6598 - | let mut http_request = ::http::Request::builder()
|
6599 - | .uri("/")
|
6600 - | .method("POST")
|
6601 - | .header("Content-Type", "application/x-amz-json-1.1")
|
6602 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
6603 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
6604 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6605 - | "{\"ListOfStrings\":[\"abc\",\"mno\",\"xyz\"]}".as_bytes(),
|
6606 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
6607 - | )),
|
6608 - | ))
|
6609 - | .unwrap();
|
6610 - | #[allow(unused_mut)]
|
6611 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6612 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
6613 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
6614 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
6615 - | let sender = sender.clone();
|
6616 - | async move {
|
6617 - | let result = {
|
6618 - | use ::aws_smithy_protocol_test::FloatEquals;
|
6619 - | let expected = crate::input::KitchenSinkOperationInput {
|
6620 - | list_of_strings: ::std::option::Option::Some(vec![
|
6621 - | "abc".to_owned(),
|
6622 - | "mno".to_owned(),
|
6623 - | "xyz".to_owned(),
|
6624 - | ]),
|
6625 - | blob: ::std::option::Option::None,
|
6626 - | boolean: ::std::option::Option::None,
|
6627 - | double: ::std::option::Option::None,
|
6628 - | empty_struct: ::std::option::Option::None,
|
6629 - | float: ::std::option::Option::None,
|
6630 - | httpdate_timestamp: ::std::option::Option::None,
|
6631 - | integer: ::std::option::Option::None,
|
6632 - | iso8601_timestamp: ::std::option::Option::None,
|
6633 - | json_value: ::std::option::Option::None,
|
6634 - | list_of_lists: ::std::option::Option::None,
|
6635 - | list_of_maps_of_strings: ::std::option::Option::None,
|
6636 - | list_of_structs: ::std::option::Option::None,
|
6637 - | long: ::std::option::Option::None,
|
6638 - | map_of_lists_of_strings: ::std::option::Option::None,
|
6639 - | map_of_maps: ::std::option::Option::None,
|
6640 - | map_of_strings: ::std::option::Option::None,
|
6641 - | map_of_structs: ::std::option::Option::None,
|
6642 - | recursive_list: ::std::option::Option::None,
|
6643 - | recursive_map: ::std::option::Option::None,
|
6644 - | recursive_struct: ::std::option::Option::None,
|
6645 - | simple_struct: ::std::option::Option::None,
|
6646 - | string: ::std::option::Option::None,
|
6647 - | struct_with_json_name: ::std::option::Option::None,
|
6648 - | timestamp: ::std::option::Option::None,
|
6649 - | unix_timestamp: ::std::option::Option::None,
|
6650 - | };
|
6651 - | ::pretty_assertions::assert_eq!(
|
6652 - | input.blob,
|
6653 - | expected.blob,
|
6654 - | "Unexpected value for `blob`"
|
6655 - | );
|
6656 - | ::pretty_assertions::assert_eq!(
|
6657 - | input.boolean,
|
6658 - | expected.boolean,
|
6659 - | "Unexpected value for `boolean`"
|
6660 - | );
|
6661 - | assert!(
|
6662 - | input.double.float_equals(&expected.double),
|
6663 - | "Unexpected value for `double` {:?} vs. {:?}",
|
6664 - | expected.double,
|
6665 - | input.double
|
6666 - | );
|
6667 - | ::pretty_assertions::assert_eq!(
|
6668 - | input.empty_struct,
|
6669 - | expected.empty_struct,
|
6670 - | "Unexpected value for `empty_struct`"
|
6671 - | );
|
6672 - | assert!(
|
6673 - | input.float.float_equals(&expected.float),
|
6674 - | "Unexpected value for `float` {:?} vs. {:?}",
|
6675 - | expected.float,
|
6676 - | input.float
|
6677 - | );
|
6678 - | ::pretty_assertions::assert_eq!(
|
6679 - | input.httpdate_timestamp,
|
6680 - | expected.httpdate_timestamp,
|
6681 - | "Unexpected value for `httpdate_timestamp`"
|
6682 - | );
|
6683 - | ::pretty_assertions::assert_eq!(
|
6684 - | input.integer,
|
6685 - | expected.integer,
|
6686 - | "Unexpected value for `integer`"
|
6687 - | );
|
6688 - | ::pretty_assertions::assert_eq!(
|
6689 - | input.iso8601_timestamp,
|
6690 - | expected.iso8601_timestamp,
|
6691 - | "Unexpected value for `iso8601_timestamp`"
|
6692 - | );
|
6693 - | ::pretty_assertions::assert_eq!(
|
6694 - | input.json_value,
|
6695 - | expected.json_value,
|
6696 - | "Unexpected value for `json_value`"
|
6697 - | );
|
6698 - | ::pretty_assertions::assert_eq!(
|
6699 - | input.list_of_lists,
|
6700 - | expected.list_of_lists,
|
6701 - | "Unexpected value for `list_of_lists`"
|
6702 - | );
|
6703 - | ::pretty_assertions::assert_eq!(
|
6704 - | input.list_of_maps_of_strings,
|
6705 - | expected.list_of_maps_of_strings,
|
6706 - | "Unexpected value for `list_of_maps_of_strings`"
|
6707 - | );
|
6708 - | ::pretty_assertions::assert_eq!(
|
6709 - | input.list_of_strings,
|
6710 - | expected.list_of_strings,
|
6711 - | "Unexpected value for `list_of_strings`"
|
6712 - | );
|
6713 - | ::pretty_assertions::assert_eq!(
|
6714 - | input.list_of_structs,
|
6715 - | expected.list_of_structs,
|
6716 - | "Unexpected value for `list_of_structs`"
|
6717 - | );
|
6718 - | ::pretty_assertions::assert_eq!(
|
6719 - | input.long,
|
6720 - | expected.long,
|
6721 - | "Unexpected value for `long`"
|
6722 - | );
|
6723 - | ::pretty_assertions::assert_eq!(
|
6724 - | input.map_of_lists_of_strings,
|
6725 - | expected.map_of_lists_of_strings,
|
6726 - | "Unexpected value for `map_of_lists_of_strings`"
|
6727 - | );
|
6728 - | ::pretty_assertions::assert_eq!(
|
6729 - | input.map_of_maps,
|
6730 - | expected.map_of_maps,
|
6731 - | "Unexpected value for `map_of_maps`"
|
6732 - | );
|
6733 - | ::pretty_assertions::assert_eq!(
|
6734 - | input.map_of_strings,
|
6735 - | expected.map_of_strings,
|
6736 - | "Unexpected value for `map_of_strings`"
|
6737 - | );
|
6738 - | ::pretty_assertions::assert_eq!(
|
6739 - | input.map_of_structs,
|
6740 - | expected.map_of_structs,
|
6741 - | "Unexpected value for `map_of_structs`"
|
6742 - | );
|
6743 - | ::pretty_assertions::assert_eq!(
|
6744 - | input.recursive_list,
|
6745 - | expected.recursive_list,
|
6746 - | "Unexpected value for `recursive_list`"
|
6747 - | );
|
6748 - | ::pretty_assertions::assert_eq!(
|
6749 - | input.recursive_map,
|
6750 - | expected.recursive_map,
|
6751 - | "Unexpected value for `recursive_map`"
|
6752 - | );
|
6753 - | ::pretty_assertions::assert_eq!(
|
6754 - | input.recursive_struct,
|
6755 - | expected.recursive_struct,
|
6756 - | "Unexpected value for `recursive_struct`"
|
6757 - | );
|
6758 - | ::pretty_assertions::assert_eq!(
|
6759 - | input.simple_struct,
|
6760 - | expected.simple_struct,
|
6761 - | "Unexpected value for `simple_struct`"
|
6762 - | );
|
6763 - | ::pretty_assertions::assert_eq!(
|
6764 - | input.string,
|
6765 - | expected.string,
|
6766 - | "Unexpected value for `string`"
|
6767 - | );
|
6768 - | ::pretty_assertions::assert_eq!(
|
6769 - | input.struct_with_json_name,
|
6770 - | expected.struct_with_json_name,
|
6771 - | "Unexpected value for `struct_with_json_name`"
|
6772 - | );
|
6773 - | ::pretty_assertions::assert_eq!(
|
6774 - | input.timestamp,
|
6775 - | expected.timestamp,
|
6776 - | "Unexpected value for `timestamp`"
|
6777 - | );
|
6778 - | ::pretty_assertions::assert_eq!(
|
6779 - | input.unix_timestamp,
|
6780 - | expected.unix_timestamp,
|
6781 - | "Unexpected value for `unix_timestamp`"
|
6782 - | );
|
6783 - | let output = crate::output::KitchenSinkOperationOutput {
|
6784 - | blob: ::std::option::Option::None,
|
6785 - | boolean: ::std::option::Option::None,
|
6786 - | double: ::std::option::Option::None,
|
6787 - | empty_struct: ::std::option::Option::None,
|
6788 - | float: ::std::option::Option::None,
|
6789 - | httpdate_timestamp: ::std::option::Option::None,
|
6790 - | integer: ::std::option::Option::None,
|
6791 - | iso8601_timestamp: ::std::option::Option::None,
|
6792 - | json_value: ::std::option::Option::None,
|
6793 - | list_of_lists: ::std::option::Option::None,
|
6794 - | list_of_maps_of_strings: ::std::option::Option::None,
|
6795 - | list_of_strings: ::std::option::Option::None,
|
6796 - | list_of_structs: ::std::option::Option::None,
|
6797 - | long: ::std::option::Option::None,
|
6798 - | map_of_lists_of_strings: ::std::option::Option::None,
|
6799 - | map_of_maps: ::std::option::Option::None,
|
6800 - | map_of_strings: ::std::option::Option::None,
|
6801 - | map_of_structs: ::std::option::Option::None,
|
6802 - | recursive_list: ::std::option::Option::None,
|
6803 - | recursive_map: ::std::option::Option::None,
|
6804 - | recursive_struct: ::std::option::Option::None,
|
6805 - | simple_struct: ::std::option::Option::None,
|
6806 - | string: ::std::option::Option::None,
|
6807 - | struct_with_json_name: ::std::option::Option::None,
|
6808 - | timestamp: ::std::option::Option::None,
|
6809 - | unix_timestamp: ::std::option::Option::None,
|
6810 - | };
|
6811 - | Ok(output)
|
6812 - | };
|
6813 - | sender.send(()).await.expect("receiver dropped early");
|
6814 - | result
|
6815 - | }
|
6816 - | })
|
6817 - | .build_unchecked();
|
6818 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6819 - | .await
|
6820 - | .expect("unable to make an HTTP request");
|
6821 - | assert!(
|
6822 - | receiver.recv().await.is_some(),
|
6823 - | "we expected operation handler to be invoked but it was not entered"
|
6824 - | );
|
6825 - | }
|
6826 - |
|
6827 - | /// Serializes empty list shapes
|
6828 - | /// Test ID: serializes_empty_list_shapes
|
6829 - | #[::tokio::test]
|
6830 - | #[::tracing_test::traced_test]
|
6831 - | async fn serializes_empty_list_shapes_request() {
|
6832 - | #[allow(unused_mut)]
|
6833 - | let mut http_request = ::http::Request::builder()
|
6834 - | .uri("/")
|
6835 - | .method("POST")
|
6836 - | .header("Content-Type", "application/x-amz-json-1.1")
|
6837 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
6838 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
6839 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6840 - | "{\"ListOfStrings\":[]}".as_bytes(),
|
6841 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
6842 - | )),
|
6843 - | ))
|
6844 - | .unwrap();
|
6845 - | #[allow(unused_mut)]
|
6846 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6847 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
6848 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
6849 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
6850 - | let sender = sender.clone();
|
6851 - | async move {
|
6852 - | let result = {
|
6853 - | use ::aws_smithy_protocol_test::FloatEquals;
|
6854 - | let expected = crate::input::KitchenSinkOperationInput {
|
6855 - | list_of_strings: ::std::option::Option::Some(vec![]),
|
6856 - | blob: ::std::option::Option::None,
|
6857 - | boolean: ::std::option::Option::None,
|
6858 - | double: ::std::option::Option::None,
|
6859 - | empty_struct: ::std::option::Option::None,
|
6860 - | float: ::std::option::Option::None,
|
6861 - | httpdate_timestamp: ::std::option::Option::None,
|
6862 - | integer: ::std::option::Option::None,
|
6863 - | iso8601_timestamp: ::std::option::Option::None,
|
6864 - | json_value: ::std::option::Option::None,
|
6865 - | list_of_lists: ::std::option::Option::None,
|
6866 - | list_of_maps_of_strings: ::std::option::Option::None,
|
6867 - | list_of_structs: ::std::option::Option::None,
|
6868 - | long: ::std::option::Option::None,
|
6869 - | map_of_lists_of_strings: ::std::option::Option::None,
|
6870 - | map_of_maps: ::std::option::Option::None,
|
6871 - | map_of_strings: ::std::option::Option::None,
|
6872 - | map_of_structs: ::std::option::Option::None,
|
6873 - | recursive_list: ::std::option::Option::None,
|
6874 - | recursive_map: ::std::option::Option::None,
|
6875 - | recursive_struct: ::std::option::Option::None,
|
6876 - | simple_struct: ::std::option::Option::None,
|
6877 - | string: ::std::option::Option::None,
|
6878 - | struct_with_json_name: ::std::option::Option::None,
|
6879 - | timestamp: ::std::option::Option::None,
|
6880 - | unix_timestamp: ::std::option::Option::None,
|
6881 - | };
|
6882 - | ::pretty_assertions::assert_eq!(
|
6883 - | input.blob,
|
6884 - | expected.blob,
|
6885 - | "Unexpected value for `blob`"
|
6886 - | );
|
6887 - | ::pretty_assertions::assert_eq!(
|
6888 - | input.boolean,
|
6889 - | expected.boolean,
|
6890 - | "Unexpected value for `boolean`"
|
6891 - | );
|
6892 - | assert!(
|
6893 - | input.double.float_equals(&expected.double),
|
6894 - | "Unexpected value for `double` {:?} vs. {:?}",
|
6895 - | expected.double,
|
6896 - | input.double
|
6897 - | );
|
6898 - | ::pretty_assertions::assert_eq!(
|
6899 - | input.empty_struct,
|
6900 - | expected.empty_struct,
|
6901 - | "Unexpected value for `empty_struct`"
|
6902 - | );
|
6903 - | assert!(
|
6904 - | input.float.float_equals(&expected.float),
|
6905 - | "Unexpected value for `float` {:?} vs. {:?}",
|
6906 - | expected.float,
|
6907 - | input.float
|
6908 - | );
|
6909 - | ::pretty_assertions::assert_eq!(
|
6910 - | input.httpdate_timestamp,
|
6911 - | expected.httpdate_timestamp,
|
6912 - | "Unexpected value for `httpdate_timestamp`"
|
6913 - | );
|
6914 - | ::pretty_assertions::assert_eq!(
|
6915 - | input.integer,
|
6916 - | expected.integer,
|
6917 - | "Unexpected value for `integer`"
|
6918 - | );
|
6919 - | ::pretty_assertions::assert_eq!(
|
6920 - | input.iso8601_timestamp,
|
6921 - | expected.iso8601_timestamp,
|
6922 - | "Unexpected value for `iso8601_timestamp`"
|
6923 - | );
|
6924 - | ::pretty_assertions::assert_eq!(
|
6925 - | input.json_value,
|
6926 - | expected.json_value,
|
6927 - | "Unexpected value for `json_value`"
|
6928 - | );
|
6929 - | ::pretty_assertions::assert_eq!(
|
6930 - | input.list_of_lists,
|
6931 - | expected.list_of_lists,
|
6932 - | "Unexpected value for `list_of_lists`"
|
6933 - | );
|
6934 - | ::pretty_assertions::assert_eq!(
|
6935 - | input.list_of_maps_of_strings,
|
6936 - | expected.list_of_maps_of_strings,
|
6937 - | "Unexpected value for `list_of_maps_of_strings`"
|
6938 - | );
|
6939 - | ::pretty_assertions::assert_eq!(
|
6940 - | input.list_of_strings,
|
6941 - | expected.list_of_strings,
|
6942 - | "Unexpected value for `list_of_strings`"
|
6943 - | );
|
6944 - | ::pretty_assertions::assert_eq!(
|
6945 - | input.list_of_structs,
|
6946 - | expected.list_of_structs,
|
6947 - | "Unexpected value for `list_of_structs`"
|
6948 - | );
|
6949 - | ::pretty_assertions::assert_eq!(
|
6950 - | input.long,
|
6951 - | expected.long,
|
6952 - | "Unexpected value for `long`"
|
6953 - | );
|
6954 - | ::pretty_assertions::assert_eq!(
|
6955 - | input.map_of_lists_of_strings,
|
6956 - | expected.map_of_lists_of_strings,
|
6957 - | "Unexpected value for `map_of_lists_of_strings`"
|
6958 - | );
|
6959 - | ::pretty_assertions::assert_eq!(
|
6960 - | input.map_of_maps,
|
6961 - | expected.map_of_maps,
|
6962 - | "Unexpected value for `map_of_maps`"
|
6963 - | );
|
6964 - | ::pretty_assertions::assert_eq!(
|
6965 - | input.map_of_strings,
|
6966 - | expected.map_of_strings,
|
6967 - | "Unexpected value for `map_of_strings`"
|
6968 - | );
|
6969 - | ::pretty_assertions::assert_eq!(
|
6970 - | input.map_of_structs,
|
6971 - | expected.map_of_structs,
|
6972 - | "Unexpected value for `map_of_structs`"
|
6973 - | );
|
6974 - | ::pretty_assertions::assert_eq!(
|
6975 - | input.recursive_list,
|
6976 - | expected.recursive_list,
|
6977 - | "Unexpected value for `recursive_list`"
|
6978 - | );
|
6979 - | ::pretty_assertions::assert_eq!(
|
6980 - | input.recursive_map,
|
6981 - | expected.recursive_map,
|
6982 - | "Unexpected value for `recursive_map`"
|
6983 - | );
|
6984 - | ::pretty_assertions::assert_eq!(
|
6985 - | input.recursive_struct,
|
6986 - | expected.recursive_struct,
|
6987 - | "Unexpected value for `recursive_struct`"
|
6988 - | );
|
6989 - | ::pretty_assertions::assert_eq!(
|
6990 - | input.simple_struct,
|
6991 - | expected.simple_struct,
|
6992 - | "Unexpected value for `simple_struct`"
|
6993 - | );
|
6994 - | ::pretty_assertions::assert_eq!(
|
6995 - | input.string,
|
6996 - | expected.string,
|
6997 - | "Unexpected value for `string`"
|
6998 - | );
|
6999 - | ::pretty_assertions::assert_eq!(
|
7000 - | input.struct_with_json_name,
|
7001 - | expected.struct_with_json_name,
|
7002 - | "Unexpected value for `struct_with_json_name`"
|
7003 - | );
|
7004 - | ::pretty_assertions::assert_eq!(
|
7005 - | input.timestamp,
|
7006 - | expected.timestamp,
|
7007 - | "Unexpected value for `timestamp`"
|
7008 - | );
|
7009 - | ::pretty_assertions::assert_eq!(
|
7010 - | input.unix_timestamp,
|
7011 - | expected.unix_timestamp,
|
7012 - | "Unexpected value for `unix_timestamp`"
|
7013 - | );
|
7014 - | let output = crate::output::KitchenSinkOperationOutput {
|
7015 - | blob: ::std::option::Option::None,
|
7016 - | boolean: ::std::option::Option::None,
|
7017 - | double: ::std::option::Option::None,
|
7018 - | empty_struct: ::std::option::Option::None,
|
7019 - | float: ::std::option::Option::None,
|
7020 - | httpdate_timestamp: ::std::option::Option::None,
|
7021 - | integer: ::std::option::Option::None,
|
7022 - | iso8601_timestamp: ::std::option::Option::None,
|
7023 - | json_value: ::std::option::Option::None,
|
7024 - | list_of_lists: ::std::option::Option::None,
|
7025 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7026 - | list_of_strings: ::std::option::Option::None,
|
7027 - | list_of_structs: ::std::option::Option::None,
|
7028 - | long: ::std::option::Option::None,
|
7029 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7030 - | map_of_maps: ::std::option::Option::None,
|
7031 - | map_of_strings: ::std::option::Option::None,
|
7032 - | map_of_structs: ::std::option::Option::None,
|
7033 - | recursive_list: ::std::option::Option::None,
|
7034 - | recursive_map: ::std::option::Option::None,
|
7035 - | recursive_struct: ::std::option::Option::None,
|
7036 - | simple_struct: ::std::option::Option::None,
|
7037 - | string: ::std::option::Option::None,
|
7038 - | struct_with_json_name: ::std::option::Option::None,
|
7039 - | timestamp: ::std::option::Option::None,
|
7040 - | unix_timestamp: ::std::option::Option::None,
|
7041 - | };
|
7042 - | Ok(output)
|
7043 - | };
|
7044 - | sender.send(()).await.expect("receiver dropped early");
|
7045 - | result
|
7046 - | }
|
7047 - | })
|
7048 - | .build_unchecked();
|
7049 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7050 - | .await
|
7051 - | .expect("unable to make an HTTP request");
|
7052 - | assert!(
|
7053 - | receiver.recv().await.is_some(),
|
7054 - | "we expected operation handler to be invoked but it was not entered"
|
7055 - | );
|
7056 - | }
|
7057 - |
|
7058 - | /// Serializes list of map shapes
|
7059 - | /// Test ID: serializes_list_of_map_shapes
|
7060 - | #[::tokio::test]
|
7061 - | #[::tracing_test::traced_test]
|
7062 - | async fn serializes_list_of_map_shapes_request() {
|
7063 - | #[allow(unused_mut)]
|
7064 - | let mut http_request = ::http::Request::builder()
|
7065 - | .uri("/")
|
7066 - | .method("POST")
|
7067 - | .header("Content-Type", "application/x-amz-json-1.1")
|
7068 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
7069 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7070 - | ::bytes::Bytes::copy_from_slice(
|
7071 - | &::aws_smithy_protocol_test::decode_body_data("{\"ListOfMapsOfStrings\":[{\"foo\":\"bar\"},{\"abc\":\"xyz\"},{\"red\":\"blue\"}]}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7072 - | )
|
7073 - | )).unwrap();
|
7074 - | #[allow(unused_mut)]
|
7075 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7076 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
7077 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
7078 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
7079 - | let sender = sender.clone();
|
7080 - | async move {
|
7081 - | let result = {
|
7082 - | use ::aws_smithy_protocol_test::FloatEquals;
|
7083 - | let expected = crate::input::KitchenSinkOperationInput {
|
7084 - | list_of_maps_of_strings: ::std::option::Option::Some(vec![
|
7085 - | {
|
7086 - | let mut ret = ::std::collections::HashMap::new();
|
7087 - | ret.insert("foo".to_owned(), "bar".to_owned());
|
7088 - | ret
|
7089 - | },
|
7090 - | {
|
7091 - | let mut ret = ::std::collections::HashMap::new();
|
7092 - | ret.insert("abc".to_owned(), "xyz".to_owned());
|
7093 - | ret
|
7094 - | },
|
7095 - | {
|
7096 - | let mut ret = ::std::collections::HashMap::new();
|
7097 - | ret.insert("red".to_owned(), "blue".to_owned());
|
7098 - | ret
|
7099 - | },
|
7100 - | ]),
|
7101 - | blob: ::std::option::Option::None,
|
7102 - | boolean: ::std::option::Option::None,
|
7103 - | double: ::std::option::Option::None,
|
7104 - | empty_struct: ::std::option::Option::None,
|
7105 - | float: ::std::option::Option::None,
|
7106 - | httpdate_timestamp: ::std::option::Option::None,
|
7107 - | integer: ::std::option::Option::None,
|
7108 - | iso8601_timestamp: ::std::option::Option::None,
|
7109 - | json_value: ::std::option::Option::None,
|
7110 - | list_of_lists: ::std::option::Option::None,
|
7111 - | list_of_strings: ::std::option::Option::None,
|
7112 - | list_of_structs: ::std::option::Option::None,
|
7113 - | long: ::std::option::Option::None,
|
7114 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7115 - | map_of_maps: ::std::option::Option::None,
|
7116 - | map_of_strings: ::std::option::Option::None,
|
7117 - | map_of_structs: ::std::option::Option::None,
|
7118 - | recursive_list: ::std::option::Option::None,
|
7119 - | recursive_map: ::std::option::Option::None,
|
7120 - | recursive_struct: ::std::option::Option::None,
|
7121 - | simple_struct: ::std::option::Option::None,
|
7122 - | string: ::std::option::Option::None,
|
7123 - | struct_with_json_name: ::std::option::Option::None,
|
7124 - | timestamp: ::std::option::Option::None,
|
7125 - | unix_timestamp: ::std::option::Option::None,
|
7126 - | };
|
7127 - | ::pretty_assertions::assert_eq!(
|
7128 - | input.blob,
|
7129 - | expected.blob,
|
7130 - | "Unexpected value for `blob`"
|
7131 - | );
|
7132 - | ::pretty_assertions::assert_eq!(
|
7133 - | input.boolean,
|
7134 - | expected.boolean,
|
7135 - | "Unexpected value for `boolean`"
|
7136 - | );
|
7137 - | assert!(
|
7138 - | input.double.float_equals(&expected.double),
|
7139 - | "Unexpected value for `double` {:?} vs. {:?}",
|
7140 - | expected.double,
|
7141 - | input.double
|
7142 - | );
|
7143 - | ::pretty_assertions::assert_eq!(
|
7144 - | input.empty_struct,
|
7145 - | expected.empty_struct,
|
7146 - | "Unexpected value for `empty_struct`"
|
7147 - | );
|
7148 - | assert!(
|
7149 - | input.float.float_equals(&expected.float),
|
7150 - | "Unexpected value for `float` {:?} vs. {:?}",
|
7151 - | expected.float,
|
7152 - | input.float
|
7153 - | );
|
7154 - | ::pretty_assertions::assert_eq!(
|
7155 - | input.httpdate_timestamp,
|
7156 - | expected.httpdate_timestamp,
|
7157 - | "Unexpected value for `httpdate_timestamp`"
|
7158 - | );
|
7159 - | ::pretty_assertions::assert_eq!(
|
7160 - | input.integer,
|
7161 - | expected.integer,
|
7162 - | "Unexpected value for `integer`"
|
7163 - | );
|
7164 - | ::pretty_assertions::assert_eq!(
|
7165 - | input.iso8601_timestamp,
|
7166 - | expected.iso8601_timestamp,
|
7167 - | "Unexpected value for `iso8601_timestamp`"
|
7168 - | );
|
7169 - | ::pretty_assertions::assert_eq!(
|
7170 - | input.json_value,
|
7171 - | expected.json_value,
|
7172 - | "Unexpected value for `json_value`"
|
7173 - | );
|
7174 - | ::pretty_assertions::assert_eq!(
|
7175 - | input.list_of_lists,
|
7176 - | expected.list_of_lists,
|
7177 - | "Unexpected value for `list_of_lists`"
|
7178 - | );
|
7179 - | ::pretty_assertions::assert_eq!(
|
7180 - | input.list_of_maps_of_strings,
|
7181 - | expected.list_of_maps_of_strings,
|
7182 - | "Unexpected value for `list_of_maps_of_strings`"
|
7183 - | );
|
7184 - | ::pretty_assertions::assert_eq!(
|
7185 - | input.list_of_strings,
|
7186 - | expected.list_of_strings,
|
7187 - | "Unexpected value for `list_of_strings`"
|
7188 - | );
|
7189 - | ::pretty_assertions::assert_eq!(
|
7190 - | input.list_of_structs,
|
7191 - | expected.list_of_structs,
|
7192 - | "Unexpected value for `list_of_structs`"
|
7193 - | );
|
7194 - | ::pretty_assertions::assert_eq!(
|
7195 - | input.long,
|
7196 - | expected.long,
|
7197 - | "Unexpected value for `long`"
|
7198 - | );
|
7199 - | ::pretty_assertions::assert_eq!(
|
7200 - | input.map_of_lists_of_strings,
|
7201 - | expected.map_of_lists_of_strings,
|
7202 - | "Unexpected value for `map_of_lists_of_strings`"
|
7203 - | );
|
7204 - | ::pretty_assertions::assert_eq!(
|
7205 - | input.map_of_maps,
|
7206 - | expected.map_of_maps,
|
7207 - | "Unexpected value for `map_of_maps`"
|
7208 - | );
|
7209 - | ::pretty_assertions::assert_eq!(
|
7210 - | input.map_of_strings,
|
7211 - | expected.map_of_strings,
|
7212 - | "Unexpected value for `map_of_strings`"
|
7213 - | );
|
7214 - | ::pretty_assertions::assert_eq!(
|
7215 - | input.map_of_structs,
|
7216 - | expected.map_of_structs,
|
7217 - | "Unexpected value for `map_of_structs`"
|
7218 - | );
|
7219 - | ::pretty_assertions::assert_eq!(
|
7220 - | input.recursive_list,
|
7221 - | expected.recursive_list,
|
7222 - | "Unexpected value for `recursive_list`"
|
7223 - | );
|
7224 - | ::pretty_assertions::assert_eq!(
|
7225 - | input.recursive_map,
|
7226 - | expected.recursive_map,
|
7227 - | "Unexpected value for `recursive_map`"
|
7228 - | );
|
7229 - | ::pretty_assertions::assert_eq!(
|
7230 - | input.recursive_struct,
|
7231 - | expected.recursive_struct,
|
7232 - | "Unexpected value for `recursive_struct`"
|
7233 - | );
|
7234 - | ::pretty_assertions::assert_eq!(
|
7235 - | input.simple_struct,
|
7236 - | expected.simple_struct,
|
7237 - | "Unexpected value for `simple_struct`"
|
7238 - | );
|
7239 - | ::pretty_assertions::assert_eq!(
|
7240 - | input.string,
|
7241 - | expected.string,
|
7242 - | "Unexpected value for `string`"
|
7243 - | );
|
7244 - | ::pretty_assertions::assert_eq!(
|
7245 - | input.struct_with_json_name,
|
7246 - | expected.struct_with_json_name,
|
7247 - | "Unexpected value for `struct_with_json_name`"
|
7248 - | );
|
7249 - | ::pretty_assertions::assert_eq!(
|
7250 - | input.timestamp,
|
7251 - | expected.timestamp,
|
7252 - | "Unexpected value for `timestamp`"
|
7253 - | );
|
7254 - | ::pretty_assertions::assert_eq!(
|
7255 - | input.unix_timestamp,
|
7256 - | expected.unix_timestamp,
|
7257 - | "Unexpected value for `unix_timestamp`"
|
7258 - | );
|
7259 - | let output = crate::output::KitchenSinkOperationOutput {
|
7260 - | blob: ::std::option::Option::None,
|
7261 - | boolean: ::std::option::Option::None,
|
7262 - | double: ::std::option::Option::None,
|
7263 - | empty_struct: ::std::option::Option::None,
|
7264 - | float: ::std::option::Option::None,
|
7265 - | httpdate_timestamp: ::std::option::Option::None,
|
7266 - | integer: ::std::option::Option::None,
|
7267 - | iso8601_timestamp: ::std::option::Option::None,
|
7268 - | json_value: ::std::option::Option::None,
|
7269 - | list_of_lists: ::std::option::Option::None,
|
7270 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7271 - | list_of_strings: ::std::option::Option::None,
|
7272 - | list_of_structs: ::std::option::Option::None,
|
7273 - | long: ::std::option::Option::None,
|
7274 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7275 - | map_of_maps: ::std::option::Option::None,
|
7276 - | map_of_strings: ::std::option::Option::None,
|
7277 - | map_of_structs: ::std::option::Option::None,
|
7278 - | recursive_list: ::std::option::Option::None,
|
7279 - | recursive_map: ::std::option::Option::None,
|
7280 - | recursive_struct: ::std::option::Option::None,
|
7281 - | simple_struct: ::std::option::Option::None,
|
7282 - | string: ::std::option::Option::None,
|
7283 - | struct_with_json_name: ::std::option::Option::None,
|
7284 - | timestamp: ::std::option::Option::None,
|
7285 - | unix_timestamp: ::std::option::Option::None,
|
7286 - | };
|
7287 - | Ok(output)
|
7288 - | };
|
7289 - | sender.send(()).await.expect("receiver dropped early");
|
7290 - | result
|
7291 - | }
|
7292 - | })
|
7293 - | .build_unchecked();
|
7294 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7295 - | .await
|
7296 - | .expect("unable to make an HTTP request");
|
7297 - | assert!(
|
7298 - | receiver.recv().await.is_some(),
|
7299 - | "we expected operation handler to be invoked but it was not entered"
|
7300 - | );
|
7301 - | }
|
7302 - |
|
7303 - | /// Serializes list of structure shapes
|
7304 - | /// Test ID: serializes_list_of_structure_shapes
|
7305 - | #[::tokio::test]
|
7306 - | #[::tracing_test::traced_test]
|
7307 - | async fn serializes_list_of_structure_shapes_request() {
|
7308 - | #[allow(unused_mut)]
|
7309 - | let mut http_request = ::http::Request::builder()
|
7310 - | .uri("/")
|
7311 - | .method("POST")
|
7312 - | .header("Content-Type", "application/x-amz-json-1.1")
|
7313 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
7314 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7315 - | ::bytes::Bytes::copy_from_slice(
|
7316 - | &::aws_smithy_protocol_test::decode_body_data("{\"ListOfStructs\":[{\"Value\":\"abc\"},{\"Value\":\"mno\"},{\"Value\":\"xyz\"}]}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7317 - | )
|
7318 - | )).unwrap();
|
7319 - | #[allow(unused_mut)]
|
7320 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7321 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
7322 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
7323 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
7324 - | let sender = sender.clone();
|
7325 - | async move {
|
7326 - | let result = {
|
7327 - | use ::aws_smithy_protocol_test::FloatEquals;
|
7328 - | let expected = crate::input::KitchenSinkOperationInput {
|
7329 - | list_of_structs: ::std::option::Option::Some(vec![
|
7330 - | crate::model::SimpleStruct {
|
7331 - | value: ::std::option::Option::Some("abc".to_owned()),
|
7332 - | },
|
7333 - | crate::model::SimpleStruct {
|
7334 - | value: ::std::option::Option::Some("mno".to_owned()),
|
7335 - | },
|
7336 - | crate::model::SimpleStruct {
|
7337 - | value: ::std::option::Option::Some("xyz".to_owned()),
|
7338 - | },
|
7339 - | ]),
|
7340 - | blob: ::std::option::Option::None,
|
7341 - | boolean: ::std::option::Option::None,
|
7342 - | double: ::std::option::Option::None,
|
7343 - | empty_struct: ::std::option::Option::None,
|
7344 - | float: ::std::option::Option::None,
|
7345 - | httpdate_timestamp: ::std::option::Option::None,
|
7346 - | integer: ::std::option::Option::None,
|
7347 - | iso8601_timestamp: ::std::option::Option::None,
|
7348 - | json_value: ::std::option::Option::None,
|
7349 - | list_of_lists: ::std::option::Option::None,
|
7350 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7351 - | list_of_strings: ::std::option::Option::None,
|
7352 - | long: ::std::option::Option::None,
|
7353 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7354 - | map_of_maps: ::std::option::Option::None,
|
7355 - | map_of_strings: ::std::option::Option::None,
|
7356 - | map_of_structs: ::std::option::Option::None,
|
7357 - | recursive_list: ::std::option::Option::None,
|
7358 - | recursive_map: ::std::option::Option::None,
|
7359 - | recursive_struct: ::std::option::Option::None,
|
7360 - | simple_struct: ::std::option::Option::None,
|
7361 - | string: ::std::option::Option::None,
|
7362 - | struct_with_json_name: ::std::option::Option::None,
|
7363 - | timestamp: ::std::option::Option::None,
|
7364 - | unix_timestamp: ::std::option::Option::None,
|
7365 - | };
|
7366 - | ::pretty_assertions::assert_eq!(
|
7367 - | input.blob,
|
7368 - | expected.blob,
|
7369 - | "Unexpected value for `blob`"
|
7370 - | );
|
7371 - | ::pretty_assertions::assert_eq!(
|
7372 - | input.boolean,
|
7373 - | expected.boolean,
|
7374 - | "Unexpected value for `boolean`"
|
7375 - | );
|
7376 - | assert!(
|
7377 - | input.double.float_equals(&expected.double),
|
7378 - | "Unexpected value for `double` {:?} vs. {:?}",
|
7379 - | expected.double,
|
7380 - | input.double
|
7381 - | );
|
7382 - | ::pretty_assertions::assert_eq!(
|
7383 - | input.empty_struct,
|
7384 - | expected.empty_struct,
|
7385 - | "Unexpected value for `empty_struct`"
|
7386 - | );
|
7387 - | assert!(
|
7388 - | input.float.float_equals(&expected.float),
|
7389 - | "Unexpected value for `float` {:?} vs. {:?}",
|
7390 - | expected.float,
|
7391 - | input.float
|
7392 - | );
|
7393 - | ::pretty_assertions::assert_eq!(
|
7394 - | input.httpdate_timestamp,
|
7395 - | expected.httpdate_timestamp,
|
7396 - | "Unexpected value for `httpdate_timestamp`"
|
7397 - | );
|
7398 - | ::pretty_assertions::assert_eq!(
|
7399 - | input.integer,
|
7400 - | expected.integer,
|
7401 - | "Unexpected value for `integer`"
|
7402 - | );
|
7403 - | ::pretty_assertions::assert_eq!(
|
7404 - | input.iso8601_timestamp,
|
7405 - | expected.iso8601_timestamp,
|
7406 - | "Unexpected value for `iso8601_timestamp`"
|
7407 - | );
|
7408 - | ::pretty_assertions::assert_eq!(
|
7409 - | input.json_value,
|
7410 - | expected.json_value,
|
7411 - | "Unexpected value for `json_value`"
|
7412 - | );
|
7413 - | ::pretty_assertions::assert_eq!(
|
7414 - | input.list_of_lists,
|
7415 - | expected.list_of_lists,
|
7416 - | "Unexpected value for `list_of_lists`"
|
7417 - | );
|
7418 - | ::pretty_assertions::assert_eq!(
|
7419 - | input.list_of_maps_of_strings,
|
7420 - | expected.list_of_maps_of_strings,
|
7421 - | "Unexpected value for `list_of_maps_of_strings`"
|
7422 - | );
|
7423 - | ::pretty_assertions::assert_eq!(
|
7424 - | input.list_of_strings,
|
7425 - | expected.list_of_strings,
|
7426 - | "Unexpected value for `list_of_strings`"
|
7427 - | );
|
7428 - | ::pretty_assertions::assert_eq!(
|
7429 - | input.list_of_structs,
|
7430 - | expected.list_of_structs,
|
7431 - | "Unexpected value for `list_of_structs`"
|
7432 - | );
|
7433 - | ::pretty_assertions::assert_eq!(
|
7434 - | input.long,
|
7435 - | expected.long,
|
7436 - | "Unexpected value for `long`"
|
7437 - | );
|
7438 - | ::pretty_assertions::assert_eq!(
|
7439 - | input.map_of_lists_of_strings,
|
7440 - | expected.map_of_lists_of_strings,
|
7441 - | "Unexpected value for `map_of_lists_of_strings`"
|
7442 - | );
|
7443 - | ::pretty_assertions::assert_eq!(
|
7444 - | input.map_of_maps,
|
7445 - | expected.map_of_maps,
|
7446 - | "Unexpected value for `map_of_maps`"
|
7447 - | );
|
7448 - | ::pretty_assertions::assert_eq!(
|
7449 - | input.map_of_strings,
|
7450 - | expected.map_of_strings,
|
7451 - | "Unexpected value for `map_of_strings`"
|
7452 - | );
|
7453 - | ::pretty_assertions::assert_eq!(
|
7454 - | input.map_of_structs,
|
7455 - | expected.map_of_structs,
|
7456 - | "Unexpected value for `map_of_structs`"
|
7457 - | );
|
7458 - | ::pretty_assertions::assert_eq!(
|
7459 - | input.recursive_list,
|
7460 - | expected.recursive_list,
|
7461 - | "Unexpected value for `recursive_list`"
|
7462 - | );
|
7463 - | ::pretty_assertions::assert_eq!(
|
7464 - | input.recursive_map,
|
7465 - | expected.recursive_map,
|
7466 - | "Unexpected value for `recursive_map`"
|
7467 - | );
|
7468 - | ::pretty_assertions::assert_eq!(
|
7469 - | input.recursive_struct,
|
7470 - | expected.recursive_struct,
|
7471 - | "Unexpected value for `recursive_struct`"
|
7472 - | );
|
7473 - | ::pretty_assertions::assert_eq!(
|
7474 - | input.simple_struct,
|
7475 - | expected.simple_struct,
|
7476 - | "Unexpected value for `simple_struct`"
|
7477 - | );
|
7478 - | ::pretty_assertions::assert_eq!(
|
7479 - | input.string,
|
7480 - | expected.string,
|
7481 - | "Unexpected value for `string`"
|
7482 - | );
|
7483 - | ::pretty_assertions::assert_eq!(
|
7484 - | input.struct_with_json_name,
|
7485 - | expected.struct_with_json_name,
|
7486 - | "Unexpected value for `struct_with_json_name`"
|
7487 - | );
|
7488 - | ::pretty_assertions::assert_eq!(
|
7489 - | input.timestamp,
|
7490 - | expected.timestamp,
|
7491 - | "Unexpected value for `timestamp`"
|
7492 - | );
|
7493 - | ::pretty_assertions::assert_eq!(
|
7494 - | input.unix_timestamp,
|
7495 - | expected.unix_timestamp,
|
7496 - | "Unexpected value for `unix_timestamp`"
|
7497 - | );
|
7498 - | let output = crate::output::KitchenSinkOperationOutput {
|
7499 - | blob: ::std::option::Option::None,
|
7500 - | boolean: ::std::option::Option::None,
|
7501 - | double: ::std::option::Option::None,
|
7502 - | empty_struct: ::std::option::Option::None,
|
7503 - | float: ::std::option::Option::None,
|
7504 - | httpdate_timestamp: ::std::option::Option::None,
|
7505 - | integer: ::std::option::Option::None,
|
7506 - | iso8601_timestamp: ::std::option::Option::None,
|
7507 - | json_value: ::std::option::Option::None,
|
7508 - | list_of_lists: ::std::option::Option::None,
|
7509 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7510 - | list_of_strings: ::std::option::Option::None,
|
7511 - | list_of_structs: ::std::option::Option::None,
|
7512 - | long: ::std::option::Option::None,
|
7513 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7514 - | map_of_maps: ::std::option::Option::None,
|
7515 - | map_of_strings: ::std::option::Option::None,
|
7516 - | map_of_structs: ::std::option::Option::None,
|
7517 - | recursive_list: ::std::option::Option::None,
|
7518 - | recursive_map: ::std::option::Option::None,
|
7519 - | recursive_struct: ::std::option::Option::None,
|
7520 - | simple_struct: ::std::option::Option::None,
|
7521 - | string: ::std::option::Option::None,
|
7522 - | struct_with_json_name: ::std::option::Option::None,
|
7523 - | timestamp: ::std::option::Option::None,
|
7524 - | unix_timestamp: ::std::option::Option::None,
|
7525 - | };
|
7526 - | Ok(output)
|
7527 - | };
|
7528 - | sender.send(()).await.expect("receiver dropped early");
|
7529 - | result
|
7530 - | }
|
7531 - | })
|
7532 - | .build_unchecked();
|
7533 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7534 - | .await
|
7535 - | .expect("unable to make an HTTP request");
|
7536 - | assert!(
|
7537 - | receiver.recv().await.is_some(),
|
7538 - | "we expected operation handler to be invoked but it was not entered"
|
7539 - | );
|
7540 - | }
|
7541 - |
|
7542 - | /// Serializes list of recursive structure shapes
|
7543 - | /// Test ID: serializes_list_of_recursive_structure_shapes
|
7544 - | #[::tokio::test]
|
7545 - | #[::tracing_test::traced_test]
|
7546 - | async fn serializes_list_of_recursive_structure_shapes_request() {
|
7547 - | #[allow(unused_mut)]
|
7548 - | let mut http_request = ::http::Request::builder()
|
7549 - | .uri("/")
|
7550 - | .method("POST")
|
7551 - | .header("Content-Type", "application/x-amz-json-1.1")
|
7552 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
7553 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7554 - | ::bytes::Bytes::copy_from_slice(
|
7555 - | &::aws_smithy_protocol_test::decode_body_data("{\"RecursiveList\":[{\"RecursiveList\":[{\"RecursiveList\":[{\"Integer\":123}]}]}]}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7556 - | )
|
7557 - | )).unwrap();
|
7558 - | #[allow(unused_mut)]
|
7559 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7560 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
7561 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
7562 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
7563 - | let sender = sender.clone();
|
7564 - | async move {
|
7565 - | let result = {
|
7566 - | use ::aws_smithy_protocol_test::FloatEquals;
|
7567 - | let expected = crate::input::KitchenSinkOperationInput {
|
7568 - | recursive_list: ::std::option::Option::Some(vec![
|
7569 - | crate::model::KitchenSink {
|
7570 - | recursive_list: ::std::option::Option::Some(vec![
|
7571 - | crate::model::KitchenSink {
|
7572 - | recursive_list: ::std::option::Option::Some(vec![
|
7573 - | crate::model::KitchenSink {
|
7574 - | integer: ::std::option::Option::Some(123),
|
7575 - | blob: ::std::option::Option::None,
|
7576 - | boolean: ::std::option::Option::None,
|
7577 - | double: ::std::option::Option::None,
|
7578 - | empty_struct: ::std::option::Option::None,
|
7579 - | float: ::std::option::Option::None,
|
7580 - | httpdate_timestamp: ::std::option::Option::None,
|
7581 - | iso8601_timestamp: ::std::option::Option::None,
|
7582 - | json_value: ::std::option::Option::None,
|
7583 - | list_of_lists: ::std::option::Option::None,
|
7584 - | list_of_maps_of_strings:
|
7585 - | ::std::option::Option::None,
|
7586 - | list_of_strings: ::std::option::Option::None,
|
7587 - | list_of_structs: ::std::option::Option::None,
|
7588 - | long: ::std::option::Option::None,
|
7589 - | map_of_lists_of_strings:
|
7590 - | ::std::option::Option::None,
|
7591 - | map_of_maps: ::std::option::Option::None,
|
7592 - | map_of_strings: ::std::option::Option::None,
|
7593 - | map_of_structs: ::std::option::Option::None,
|
7594 - | recursive_list: ::std::option::Option::None,
|
7595 - | recursive_map: ::std::option::Option::None,
|
7596 - | recursive_struct: ::std::option::Option::None,
|
7597 - | simple_struct: ::std::option::Option::None,
|
7598 - | string: ::std::option::Option::None,
|
7599 - | struct_with_json_name:
|
7600 - | ::std::option::Option::None,
|
7601 - | timestamp: ::std::option::Option::None,
|
7602 - | unix_timestamp: ::std::option::Option::None,
|
7603 - | },
|
7604 - | ]),
|
7605 - | blob: ::std::option::Option::None,
|
7606 - | boolean: ::std::option::Option::None,
|
7607 - | double: ::std::option::Option::None,
|
7608 - | empty_struct: ::std::option::Option::None,
|
7609 - | float: ::std::option::Option::None,
|
7610 - | httpdate_timestamp: ::std::option::Option::None,
|
7611 - | integer: ::std::option::Option::None,
|
7612 - | iso8601_timestamp: ::std::option::Option::None,
|
7613 - | json_value: ::std::option::Option::None,
|
7614 - | list_of_lists: ::std::option::Option::None,
|
7615 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7616 - | list_of_strings: ::std::option::Option::None,
|
7617 - | list_of_structs: ::std::option::Option::None,
|
7618 - | long: ::std::option::Option::None,
|
7619 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7620 - | map_of_maps: ::std::option::Option::None,
|
7621 - | map_of_strings: ::std::option::Option::None,
|
7622 - | map_of_structs: ::std::option::Option::None,
|
7623 - | recursive_map: ::std::option::Option::None,
|
7624 - | recursive_struct: ::std::option::Option::None,
|
7625 - | simple_struct: ::std::option::Option::None,
|
7626 - | string: ::std::option::Option::None,
|
7627 - | struct_with_json_name: ::std::option::Option::None,
|
7628 - | timestamp: ::std::option::Option::None,
|
7629 - | unix_timestamp: ::std::option::Option::None,
|
7630 - | },
|
7631 - | ]),
|
7632 - | blob: ::std::option::Option::None,
|
7633 - | boolean: ::std::option::Option::None,
|
7634 - | double: ::std::option::Option::None,
|
7635 - | empty_struct: ::std::option::Option::None,
|
7636 - | float: ::std::option::Option::None,
|
7637 - | httpdate_timestamp: ::std::option::Option::None,
|
7638 - | integer: ::std::option::Option::None,
|
7639 - | iso8601_timestamp: ::std::option::Option::None,
|
7640 - | json_value: ::std::option::Option::None,
|
7641 - | list_of_lists: ::std::option::Option::None,
|
7642 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7643 - | list_of_strings: ::std::option::Option::None,
|
7644 - | list_of_structs: ::std::option::Option::None,
|
7645 - | long: ::std::option::Option::None,
|
7646 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7647 - | map_of_maps: ::std::option::Option::None,
|
7648 - | map_of_strings: ::std::option::Option::None,
|
7649 - | map_of_structs: ::std::option::Option::None,
|
7650 - | recursive_map: ::std::option::Option::None,
|
7651 - | recursive_struct: ::std::option::Option::None,
|
7652 - | simple_struct: ::std::option::Option::None,
|
7653 - | string: ::std::option::Option::None,
|
7654 - | struct_with_json_name: ::std::option::Option::None,
|
7655 - | timestamp: ::std::option::Option::None,
|
7656 - | unix_timestamp: ::std::option::Option::None,
|
7657 - | },
|
7658 - | ]),
|
7659 - | blob: ::std::option::Option::None,
|
7660 - | boolean: ::std::option::Option::None,
|
7661 - | double: ::std::option::Option::None,
|
7662 - | empty_struct: ::std::option::Option::None,
|
7663 - | float: ::std::option::Option::None,
|
7664 - | httpdate_timestamp: ::std::option::Option::None,
|
7665 - | integer: ::std::option::Option::None,
|
7666 - | iso8601_timestamp: ::std::option::Option::None,
|
7667 - | json_value: ::std::option::Option::None,
|
7668 - | list_of_lists: ::std::option::Option::None,
|
7669 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7670 - | list_of_strings: ::std::option::Option::None,
|
7671 - | list_of_structs: ::std::option::Option::None,
|
7672 - | long: ::std::option::Option::None,
|
7673 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7674 - | map_of_maps: ::std::option::Option::None,
|
7675 - | map_of_strings: ::std::option::Option::None,
|
7676 - | map_of_structs: ::std::option::Option::None,
|
7677 - | recursive_map: ::std::option::Option::None,
|
7678 - | recursive_struct: ::std::option::Option::None,
|
7679 - | simple_struct: ::std::option::Option::None,
|
7680 - | string: ::std::option::Option::None,
|
7681 - | struct_with_json_name: ::std::option::Option::None,
|
7682 - | timestamp: ::std::option::Option::None,
|
7683 - | unix_timestamp: ::std::option::Option::None,
|
7684 - | };
|
7685 - | ::pretty_assertions::assert_eq!(
|
7686 - | input.blob,
|
7687 - | expected.blob,
|
7688 - | "Unexpected value for `blob`"
|
7689 - | );
|
7690 - | ::pretty_assertions::assert_eq!(
|
7691 - | input.boolean,
|
7692 - | expected.boolean,
|
7693 - | "Unexpected value for `boolean`"
|
7694 - | );
|
7695 - | assert!(
|
7696 - | input.double.float_equals(&expected.double),
|
7697 - | "Unexpected value for `double` {:?} vs. {:?}",
|
7698 - | expected.double,
|
7699 - | input.double
|
7700 - | );
|
7701 - | ::pretty_assertions::assert_eq!(
|
7702 - | input.empty_struct,
|
7703 - | expected.empty_struct,
|
7704 - | "Unexpected value for `empty_struct`"
|
7705 - | );
|
7706 - | assert!(
|
7707 - | input.float.float_equals(&expected.float),
|
7708 - | "Unexpected value for `float` {:?} vs. {:?}",
|
7709 - | expected.float,
|
7710 - | input.float
|
7711 - | );
|
7712 - | ::pretty_assertions::assert_eq!(
|
7713 - | input.httpdate_timestamp,
|
7714 - | expected.httpdate_timestamp,
|
7715 - | "Unexpected value for `httpdate_timestamp`"
|
7716 - | );
|
7717 - | ::pretty_assertions::assert_eq!(
|
7718 - | input.integer,
|
7719 - | expected.integer,
|
7720 - | "Unexpected value for `integer`"
|
7721 - | );
|
7722 - | ::pretty_assertions::assert_eq!(
|
7723 - | input.iso8601_timestamp,
|
7724 - | expected.iso8601_timestamp,
|
7725 - | "Unexpected value for `iso8601_timestamp`"
|
7726 - | );
|
7727 - | ::pretty_assertions::assert_eq!(
|
7728 - | input.json_value,
|
7729 - | expected.json_value,
|
7730 - | "Unexpected value for `json_value`"
|
7731 - | );
|
7732 - | ::pretty_assertions::assert_eq!(
|
7733 - | input.list_of_lists,
|
7734 - | expected.list_of_lists,
|
7735 - | "Unexpected value for `list_of_lists`"
|
7736 - | );
|
7737 - | ::pretty_assertions::assert_eq!(
|
7738 - | input.list_of_maps_of_strings,
|
7739 - | expected.list_of_maps_of_strings,
|
7740 - | "Unexpected value for `list_of_maps_of_strings`"
|
7741 - | );
|
7742 - | ::pretty_assertions::assert_eq!(
|
7743 - | input.list_of_strings,
|
7744 - | expected.list_of_strings,
|
7745 - | "Unexpected value for `list_of_strings`"
|
7746 - | );
|
7747 - | ::pretty_assertions::assert_eq!(
|
7748 - | input.list_of_structs,
|
7749 - | expected.list_of_structs,
|
7750 - | "Unexpected value for `list_of_structs`"
|
7751 - | );
|
7752 - | ::pretty_assertions::assert_eq!(
|
7753 - | input.long,
|
7754 - | expected.long,
|
7755 - | "Unexpected value for `long`"
|
7756 - | );
|
7757 - | ::pretty_assertions::assert_eq!(
|
7758 - | input.map_of_lists_of_strings,
|
7759 - | expected.map_of_lists_of_strings,
|
7760 - | "Unexpected value for `map_of_lists_of_strings`"
|
7761 - | );
|
7762 - | ::pretty_assertions::assert_eq!(
|
7763 - | input.map_of_maps,
|
7764 - | expected.map_of_maps,
|
7765 - | "Unexpected value for `map_of_maps`"
|
7766 - | );
|
7767 - | ::pretty_assertions::assert_eq!(
|
7768 - | input.map_of_strings,
|
7769 - | expected.map_of_strings,
|
7770 - | "Unexpected value for `map_of_strings`"
|
7771 - | );
|
7772 - | ::pretty_assertions::assert_eq!(
|
7773 - | input.map_of_structs,
|
7774 - | expected.map_of_structs,
|
7775 - | "Unexpected value for `map_of_structs`"
|
7776 - | );
|
7777 - | ::pretty_assertions::assert_eq!(
|
7778 - | input.recursive_list,
|
7779 - | expected.recursive_list,
|
7780 - | "Unexpected value for `recursive_list`"
|
7781 - | );
|
7782 - | ::pretty_assertions::assert_eq!(
|
7783 - | input.recursive_map,
|
7784 - | expected.recursive_map,
|
7785 - | "Unexpected value for `recursive_map`"
|
7786 - | );
|
7787 - | ::pretty_assertions::assert_eq!(
|
7788 - | input.recursive_struct,
|
7789 - | expected.recursive_struct,
|
7790 - | "Unexpected value for `recursive_struct`"
|
7791 - | );
|
7792 - | ::pretty_assertions::assert_eq!(
|
7793 - | input.simple_struct,
|
7794 - | expected.simple_struct,
|
7795 - | "Unexpected value for `simple_struct`"
|
7796 - | );
|
7797 - | ::pretty_assertions::assert_eq!(
|
7798 - | input.string,
|
7799 - | expected.string,
|
7800 - | "Unexpected value for `string`"
|
7801 - | );
|
7802 - | ::pretty_assertions::assert_eq!(
|
7803 - | input.struct_with_json_name,
|
7804 - | expected.struct_with_json_name,
|
7805 - | "Unexpected value for `struct_with_json_name`"
|
7806 - | );
|
7807 - | ::pretty_assertions::assert_eq!(
|
7808 - | input.timestamp,
|
7809 - | expected.timestamp,
|
7810 - | "Unexpected value for `timestamp`"
|
7811 - | );
|
7812 - | ::pretty_assertions::assert_eq!(
|
7813 - | input.unix_timestamp,
|
7814 - | expected.unix_timestamp,
|
7815 - | "Unexpected value for `unix_timestamp`"
|
7816 - | );
|
7817 - | let output = crate::output::KitchenSinkOperationOutput {
|
7818 - | blob: ::std::option::Option::None,
|
7819 - | boolean: ::std::option::Option::None,
|
7820 - | double: ::std::option::Option::None,
|
7821 - | empty_struct: ::std::option::Option::None,
|
7822 - | float: ::std::option::Option::None,
|
7823 - | httpdate_timestamp: ::std::option::Option::None,
|
7824 - | integer: ::std::option::Option::None,
|
7825 - | iso8601_timestamp: ::std::option::Option::None,
|
7826 - | json_value: ::std::option::Option::None,
|
7827 - | list_of_lists: ::std::option::Option::None,
|
7828 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7829 - | list_of_strings: ::std::option::Option::None,
|
7830 - | list_of_structs: ::std::option::Option::None,
|
7831 - | long: ::std::option::Option::None,
|
7832 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7833 - | map_of_maps: ::std::option::Option::None,
|
7834 - | map_of_strings: ::std::option::Option::None,
|
7835 - | map_of_structs: ::std::option::Option::None,
|
7836 - | recursive_list: ::std::option::Option::None,
|
7837 - | recursive_map: ::std::option::Option::None,
|
7838 - | recursive_struct: ::std::option::Option::None,
|
7839 - | simple_struct: ::std::option::Option::None,
|
7840 - | string: ::std::option::Option::None,
|
7841 - | struct_with_json_name: ::std::option::Option::None,
|
7842 - | timestamp: ::std::option::Option::None,
|
7843 - | unix_timestamp: ::std::option::Option::None,
|
7844 - | };
|
7845 - | Ok(output)
|
7846 - | };
|
7847 - | sender.send(()).await.expect("receiver dropped early");
|
7848 - | result
|
7849 - | }
|
7850 - | })
|
7851 - | .build_unchecked();
|
7852 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7853 - | .await
|
7854 - | .expect("unable to make an HTTP request");
|
7855 - | assert!(
|
7856 - | receiver.recv().await.is_some(),
|
7857 - | "we expected operation handler to be invoked but it was not entered"
|
7858 - | );
|
7859 - | }
|
7860 - |
|
7861 - | /// Serializes map shapes
|
7862 - | /// Test ID: serializes_map_shapes
|
7863 - | #[::tokio::test]
|
7864 - | #[::tracing_test::traced_test]
|
7865 - | async fn serializes_map_shapes_request() {
|
7866 - | #[allow(unused_mut)]
|
7867 - | let mut http_request = ::http::Request::builder()
|
7868 - | .uri("/")
|
7869 - | .method("POST")
|
7870 - | .header("Content-Type", "application/x-amz-json-1.1")
|
7871 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
7872 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7873 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
7874 - | "{\"MapOfStrings\":{\"abc\":\"xyz\",\"mno\":\"hjk\"}}".as_bytes(),
|
7875 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
7876 - | )),
|
7877 - | ))
|
7878 - | .unwrap();
|
7879 - | #[allow(unused_mut)]
|
7880 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7881 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
7882 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
7883 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
7884 - | let sender = sender.clone();
|
7885 - | async move {
|
7886 - | let result = {
|
7887 - | use ::aws_smithy_protocol_test::FloatEquals;
|
7888 - | let expected = crate::input::KitchenSinkOperationInput {
|
7889 - | map_of_strings: ::std::option::Option::Some({
|
7890 - | let mut ret = ::std::collections::HashMap::new();
|
7891 - | ret.insert("abc".to_owned(), "xyz".to_owned());
|
7892 - | ret.insert("mno".to_owned(), "hjk".to_owned());
|
7893 - | ret
|
7894 - | }),
|
7895 - | blob: ::std::option::Option::None,
|
7896 - | boolean: ::std::option::Option::None,
|
7897 - | double: ::std::option::Option::None,
|
7898 - | empty_struct: ::std::option::Option::None,
|
7899 - | float: ::std::option::Option::None,
|
7900 - | httpdate_timestamp: ::std::option::Option::None,
|
7901 - | integer: ::std::option::Option::None,
|
7902 - | iso8601_timestamp: ::std::option::Option::None,
|
7903 - | json_value: ::std::option::Option::None,
|
7904 - | list_of_lists: ::std::option::Option::None,
|
7905 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7906 - | list_of_strings: ::std::option::Option::None,
|
7907 - | list_of_structs: ::std::option::Option::None,
|
7908 - | long: ::std::option::Option::None,
|
7909 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7910 - | map_of_maps: ::std::option::Option::None,
|
7911 - | map_of_structs: ::std::option::Option::None,
|
7912 - | recursive_list: ::std::option::Option::None,
|
7913 - | recursive_map: ::std::option::Option::None,
|
7914 - | recursive_struct: ::std::option::Option::None,
|
7915 - | simple_struct: ::std::option::Option::None,
|
7916 - | string: ::std::option::Option::None,
|
7917 - | struct_with_json_name: ::std::option::Option::None,
|
7918 - | timestamp: ::std::option::Option::None,
|
7919 - | unix_timestamp: ::std::option::Option::None,
|
7920 - | };
|
7921 - | ::pretty_assertions::assert_eq!(
|
7922 - | input.blob,
|
7923 - | expected.blob,
|
7924 - | "Unexpected value for `blob`"
|
7925 - | );
|
7926 - | ::pretty_assertions::assert_eq!(
|
7927 - | input.boolean,
|
7928 - | expected.boolean,
|
7929 - | "Unexpected value for `boolean`"
|
7930 - | );
|
7931 - | assert!(
|
7932 - | input.double.float_equals(&expected.double),
|
7933 - | "Unexpected value for `double` {:?} vs. {:?}",
|
7934 - | expected.double,
|
7935 - | input.double
|
7936 - | );
|
7937 - | ::pretty_assertions::assert_eq!(
|
7938 - | input.empty_struct,
|
7939 - | expected.empty_struct,
|
7940 - | "Unexpected value for `empty_struct`"
|
7941 - | );
|
7942 - | assert!(
|
7943 - | input.float.float_equals(&expected.float),
|
7944 - | "Unexpected value for `float` {:?} vs. {:?}",
|
7945 - | expected.float,
|
7946 - | input.float
|
7947 - | );
|
7948 - | ::pretty_assertions::assert_eq!(
|
7949 - | input.httpdate_timestamp,
|
7950 - | expected.httpdate_timestamp,
|
7951 - | "Unexpected value for `httpdate_timestamp`"
|
7952 - | );
|
7953 - | ::pretty_assertions::assert_eq!(
|
7954 - | input.integer,
|
7955 - | expected.integer,
|
7956 - | "Unexpected value for `integer`"
|
7957 - | );
|
7958 - | ::pretty_assertions::assert_eq!(
|
7959 - | input.iso8601_timestamp,
|
7960 - | expected.iso8601_timestamp,
|
7961 - | "Unexpected value for `iso8601_timestamp`"
|
7962 - | );
|
7963 - | ::pretty_assertions::assert_eq!(
|
7964 - | input.json_value,
|
7965 - | expected.json_value,
|
7966 - | "Unexpected value for `json_value`"
|
7967 - | );
|
7968 - | ::pretty_assertions::assert_eq!(
|
7969 - | input.list_of_lists,
|
7970 - | expected.list_of_lists,
|
7971 - | "Unexpected value for `list_of_lists`"
|
7972 - | );
|
7973 - | ::pretty_assertions::assert_eq!(
|
7974 - | input.list_of_maps_of_strings,
|
7975 - | expected.list_of_maps_of_strings,
|
7976 - | "Unexpected value for `list_of_maps_of_strings`"
|
7977 - | );
|
7978 - | ::pretty_assertions::assert_eq!(
|
7979 - | input.list_of_strings,
|
7980 - | expected.list_of_strings,
|
7981 - | "Unexpected value for `list_of_strings`"
|
7982 - | );
|
7983 - | ::pretty_assertions::assert_eq!(
|
7984 - | input.list_of_structs,
|
7985 - | expected.list_of_structs,
|
7986 - | "Unexpected value for `list_of_structs`"
|
7987 - | );
|
7988 - | ::pretty_assertions::assert_eq!(
|
7989 - | input.long,
|
7990 - | expected.long,
|
7991 - | "Unexpected value for `long`"
|
7992 - | );
|
7993 - | ::pretty_assertions::assert_eq!(
|
7994 - | input.map_of_lists_of_strings,
|
7995 - | expected.map_of_lists_of_strings,
|
7996 - | "Unexpected value for `map_of_lists_of_strings`"
|
7997 - | );
|
7998 - | ::pretty_assertions::assert_eq!(
|
7999 - | input.map_of_maps,
|
8000 - | expected.map_of_maps,
|
8001 - | "Unexpected value for `map_of_maps`"
|
8002 - | );
|
8003 - | ::pretty_assertions::assert_eq!(
|
8004 - | input.map_of_strings,
|
8005 - | expected.map_of_strings,
|
8006 - | "Unexpected value for `map_of_strings`"
|
8007 - | );
|
8008 - | ::pretty_assertions::assert_eq!(
|
8009 - | input.map_of_structs,
|
8010 - | expected.map_of_structs,
|
8011 - | "Unexpected value for `map_of_structs`"
|
8012 - | );
|
8013 - | ::pretty_assertions::assert_eq!(
|
8014 - | input.recursive_list,
|
8015 - | expected.recursive_list,
|
8016 - | "Unexpected value for `recursive_list`"
|
8017 - | );
|
8018 - | ::pretty_assertions::assert_eq!(
|
8019 - | input.recursive_map,
|
8020 - | expected.recursive_map,
|
8021 - | "Unexpected value for `recursive_map`"
|
8022 - | );
|
8023 - | ::pretty_assertions::assert_eq!(
|
8024 - | input.recursive_struct,
|
8025 - | expected.recursive_struct,
|
8026 - | "Unexpected value for `recursive_struct`"
|
8027 - | );
|
8028 - | ::pretty_assertions::assert_eq!(
|
8029 - | input.simple_struct,
|
8030 - | expected.simple_struct,
|
8031 - | "Unexpected value for `simple_struct`"
|
8032 - | );
|
8033 - | ::pretty_assertions::assert_eq!(
|
8034 - | input.string,
|
8035 - | expected.string,
|
8036 - | "Unexpected value for `string`"
|
8037 - | );
|
8038 - | ::pretty_assertions::assert_eq!(
|
8039 - | input.struct_with_json_name,
|
8040 - | expected.struct_with_json_name,
|
8041 - | "Unexpected value for `struct_with_json_name`"
|
8042 - | );
|
8043 - | ::pretty_assertions::assert_eq!(
|
8044 - | input.timestamp,
|
8045 - | expected.timestamp,
|
8046 - | "Unexpected value for `timestamp`"
|
8047 - | );
|
8048 - | ::pretty_assertions::assert_eq!(
|
8049 - | input.unix_timestamp,
|
8050 - | expected.unix_timestamp,
|
8051 - | "Unexpected value for `unix_timestamp`"
|
8052 - | );
|
8053 - | let output = crate::output::KitchenSinkOperationOutput {
|
8054 - | blob: ::std::option::Option::None,
|
8055 - | boolean: ::std::option::Option::None,
|
8056 - | double: ::std::option::Option::None,
|
8057 - | empty_struct: ::std::option::Option::None,
|
8058 - | float: ::std::option::Option::None,
|
8059 - | httpdate_timestamp: ::std::option::Option::None,
|
8060 - | integer: ::std::option::Option::None,
|
8061 - | iso8601_timestamp: ::std::option::Option::None,
|
8062 - | json_value: ::std::option::Option::None,
|
8063 - | list_of_lists: ::std::option::Option::None,
|
8064 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8065 - | list_of_strings: ::std::option::Option::None,
|
8066 - | list_of_structs: ::std::option::Option::None,
|
8067 - | long: ::std::option::Option::None,
|
8068 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8069 - | map_of_maps: ::std::option::Option::None,
|
8070 - | map_of_strings: ::std::option::Option::None,
|
8071 - | map_of_structs: ::std::option::Option::None,
|
8072 - | recursive_list: ::std::option::Option::None,
|
8073 - | recursive_map: ::std::option::Option::None,
|
8074 - | recursive_struct: ::std::option::Option::None,
|
8075 - | simple_struct: ::std::option::Option::None,
|
8076 - | string: ::std::option::Option::None,
|
8077 - | struct_with_json_name: ::std::option::Option::None,
|
8078 - | timestamp: ::std::option::Option::None,
|
8079 - | unix_timestamp: ::std::option::Option::None,
|
8080 - | };
|
8081 - | Ok(output)
|
8082 - | };
|
8083 - | sender.send(()).await.expect("receiver dropped early");
|
8084 - | result
|
8085 - | }
|
8086 - | })
|
8087 - | .build_unchecked();
|
8088 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8089 - | .await
|
8090 - | .expect("unable to make an HTTP request");
|
8091 - | assert!(
|
8092 - | receiver.recv().await.is_some(),
|
8093 - | "we expected operation handler to be invoked but it was not entered"
|
8094 - | );
|
8095 - | }
|
8096 - |
|
8097 - | /// Serializes empty map shapes
|
8098 - | /// Test ID: serializes_empty_map_shapes
|
8099 - | #[::tokio::test]
|
8100 - | #[::tracing_test::traced_test]
|
8101 - | async fn serializes_empty_map_shapes_request() {
|
8102 - | #[allow(unused_mut)]
|
8103 - | let mut http_request = ::http::Request::builder()
|
8104 - | .uri("/")
|
8105 - | .method("POST")
|
8106 - | .header("Content-Type", "application/x-amz-json-1.1")
|
8107 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
8108 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
8109 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
8110 - | "{\"MapOfStrings\":{}}".as_bytes(),
|
8111 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8112 - | )),
|
8113 - | ))
|
8114 - | .unwrap();
|
8115 - | #[allow(unused_mut)]
|
8116 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8117 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
8118 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
8119 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
8120 - | let sender = sender.clone();
|
8121 - | async move {
|
8122 - | let result = {
|
8123 - | use ::aws_smithy_protocol_test::FloatEquals;
|
8124 - | let expected = crate::input::KitchenSinkOperationInput {
|
8125 - | map_of_strings: ::std::option::Option::Some(
|
8126 - | ::std::collections::HashMap::new(),
|
8127 - | ),
|
8128 - | blob: ::std::option::Option::None,
|
8129 - | boolean: ::std::option::Option::None,
|
8130 - | double: ::std::option::Option::None,
|
8131 - | empty_struct: ::std::option::Option::None,
|
8132 - | float: ::std::option::Option::None,
|
8133 - | httpdate_timestamp: ::std::option::Option::None,
|
8134 - | integer: ::std::option::Option::None,
|
8135 - | iso8601_timestamp: ::std::option::Option::None,
|
8136 - | json_value: ::std::option::Option::None,
|
8137 - | list_of_lists: ::std::option::Option::None,
|
8138 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8139 - | list_of_strings: ::std::option::Option::None,
|
8140 - | list_of_structs: ::std::option::Option::None,
|
8141 - | long: ::std::option::Option::None,
|
8142 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8143 - | map_of_maps: ::std::option::Option::None,
|
8144 - | map_of_structs: ::std::option::Option::None,
|
8145 - | recursive_list: ::std::option::Option::None,
|
8146 - | recursive_map: ::std::option::Option::None,
|
8147 - | recursive_struct: ::std::option::Option::None,
|
8148 - | simple_struct: ::std::option::Option::None,
|
8149 - | string: ::std::option::Option::None,
|
8150 - | struct_with_json_name: ::std::option::Option::None,
|
8151 - | timestamp: ::std::option::Option::None,
|
8152 - | unix_timestamp: ::std::option::Option::None,
|
8153 - | };
|
8154 - | ::pretty_assertions::assert_eq!(
|
8155 - | input.blob,
|
8156 - | expected.blob,
|
8157 - | "Unexpected value for `blob`"
|
8158 - | );
|
8159 - | ::pretty_assertions::assert_eq!(
|
8160 - | input.boolean,
|
8161 - | expected.boolean,
|
8162 - | "Unexpected value for `boolean`"
|
8163 - | );
|
8164 - | assert!(
|
8165 - | input.double.float_equals(&expected.double),
|
8166 - | "Unexpected value for `double` {:?} vs. {:?}",
|
8167 - | expected.double,
|
8168 - | input.double
|
8169 - | );
|
8170 - | ::pretty_assertions::assert_eq!(
|
8171 - | input.empty_struct,
|
8172 - | expected.empty_struct,
|
8173 - | "Unexpected value for `empty_struct`"
|
8174 - | );
|
8175 - | assert!(
|
8176 - | input.float.float_equals(&expected.float),
|
8177 - | "Unexpected value for `float` {:?} vs. {:?}",
|
8178 - | expected.float,
|
8179 - | input.float
|
8180 - | );
|
8181 - | ::pretty_assertions::assert_eq!(
|
8182 - | input.httpdate_timestamp,
|
8183 - | expected.httpdate_timestamp,
|
8184 - | "Unexpected value for `httpdate_timestamp`"
|
8185 - | );
|
8186 - | ::pretty_assertions::assert_eq!(
|
8187 - | input.integer,
|
8188 - | expected.integer,
|
8189 - | "Unexpected value for `integer`"
|
8190 - | );
|
8191 - | ::pretty_assertions::assert_eq!(
|
8192 - | input.iso8601_timestamp,
|
8193 - | expected.iso8601_timestamp,
|
8194 - | "Unexpected value for `iso8601_timestamp`"
|
8195 - | );
|
8196 - | ::pretty_assertions::assert_eq!(
|
8197 - | input.json_value,
|
8198 - | expected.json_value,
|
8199 - | "Unexpected value for `json_value`"
|
8200 - | );
|
8201 - | ::pretty_assertions::assert_eq!(
|
8202 - | input.list_of_lists,
|
8203 - | expected.list_of_lists,
|
8204 - | "Unexpected value for `list_of_lists`"
|
8205 - | );
|
8206 - | ::pretty_assertions::assert_eq!(
|
8207 - | input.list_of_maps_of_strings,
|
8208 - | expected.list_of_maps_of_strings,
|
8209 - | "Unexpected value for `list_of_maps_of_strings`"
|
8210 - | );
|
8211 - | ::pretty_assertions::assert_eq!(
|
8212 - | input.list_of_strings,
|
8213 - | expected.list_of_strings,
|
8214 - | "Unexpected value for `list_of_strings`"
|
8215 - | );
|
8216 - | ::pretty_assertions::assert_eq!(
|
8217 - | input.list_of_structs,
|
8218 - | expected.list_of_structs,
|
8219 - | "Unexpected value for `list_of_structs`"
|
8220 - | );
|
8221 - | ::pretty_assertions::assert_eq!(
|
8222 - | input.long,
|
8223 - | expected.long,
|
8224 - | "Unexpected value for `long`"
|
8225 - | );
|
8226 - | ::pretty_assertions::assert_eq!(
|
8227 - | input.map_of_lists_of_strings,
|
8228 - | expected.map_of_lists_of_strings,
|
8229 - | "Unexpected value for `map_of_lists_of_strings`"
|
8230 - | );
|
8231 - | ::pretty_assertions::assert_eq!(
|
8232 - | input.map_of_maps,
|
8233 - | expected.map_of_maps,
|
8234 - | "Unexpected value for `map_of_maps`"
|
8235 - | );
|
8236 - | ::pretty_assertions::assert_eq!(
|
8237 - | input.map_of_strings,
|
8238 - | expected.map_of_strings,
|
8239 - | "Unexpected value for `map_of_strings`"
|
8240 - | );
|
8241 - | ::pretty_assertions::assert_eq!(
|
8242 - | input.map_of_structs,
|
8243 - | expected.map_of_structs,
|
8244 - | "Unexpected value for `map_of_structs`"
|
8245 - | );
|
8246 - | ::pretty_assertions::assert_eq!(
|
8247 - | input.recursive_list,
|
8248 - | expected.recursive_list,
|
8249 - | "Unexpected value for `recursive_list`"
|
8250 - | );
|
8251 - | ::pretty_assertions::assert_eq!(
|
8252 - | input.recursive_map,
|
8253 - | expected.recursive_map,
|
8254 - | "Unexpected value for `recursive_map`"
|
8255 - | );
|
8256 - | ::pretty_assertions::assert_eq!(
|
8257 - | input.recursive_struct,
|
8258 - | expected.recursive_struct,
|
8259 - | "Unexpected value for `recursive_struct`"
|
8260 - | );
|
8261 - | ::pretty_assertions::assert_eq!(
|
8262 - | input.simple_struct,
|
8263 - | expected.simple_struct,
|
8264 - | "Unexpected value for `simple_struct`"
|
8265 - | );
|
8266 - | ::pretty_assertions::assert_eq!(
|
8267 - | input.string,
|
8268 - | expected.string,
|
8269 - | "Unexpected value for `string`"
|
8270 - | );
|
8271 - | ::pretty_assertions::assert_eq!(
|
8272 - | input.struct_with_json_name,
|
8273 - | expected.struct_with_json_name,
|
8274 - | "Unexpected value for `struct_with_json_name`"
|
8275 - | );
|
8276 - | ::pretty_assertions::assert_eq!(
|
8277 - | input.timestamp,
|
8278 - | expected.timestamp,
|
8279 - | "Unexpected value for `timestamp`"
|
8280 - | );
|
8281 - | ::pretty_assertions::assert_eq!(
|
8282 - | input.unix_timestamp,
|
8283 - | expected.unix_timestamp,
|
8284 - | "Unexpected value for `unix_timestamp`"
|
8285 - | );
|
8286 - | let output = crate::output::KitchenSinkOperationOutput {
|
8287 - | blob: ::std::option::Option::None,
|
8288 - | boolean: ::std::option::Option::None,
|
8289 - | double: ::std::option::Option::None,
|
8290 - | empty_struct: ::std::option::Option::None,
|
8291 - | float: ::std::option::Option::None,
|
8292 - | httpdate_timestamp: ::std::option::Option::None,
|
8293 - | integer: ::std::option::Option::None,
|
8294 - | iso8601_timestamp: ::std::option::Option::None,
|
8295 - | json_value: ::std::option::Option::None,
|
8296 - | list_of_lists: ::std::option::Option::None,
|
8297 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8298 - | list_of_strings: ::std::option::Option::None,
|
8299 - | list_of_structs: ::std::option::Option::None,
|
8300 - | long: ::std::option::Option::None,
|
8301 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8302 - | map_of_maps: ::std::option::Option::None,
|
8303 - | map_of_strings: ::std::option::Option::None,
|
8304 - | map_of_structs: ::std::option::Option::None,
|
8305 - | recursive_list: ::std::option::Option::None,
|
8306 - | recursive_map: ::std::option::Option::None,
|
8307 - | recursive_struct: ::std::option::Option::None,
|
8308 - | simple_struct: ::std::option::Option::None,
|
8309 - | string: ::std::option::Option::None,
|
8310 - | struct_with_json_name: ::std::option::Option::None,
|
8311 - | timestamp: ::std::option::Option::None,
|
8312 - | unix_timestamp: ::std::option::Option::None,
|
8313 - | };
|
8314 - | Ok(output)
|
8315 - | };
|
8316 - | sender.send(()).await.expect("receiver dropped early");
|
8317 - | result
|
8318 - | }
|
8319 - | })
|
8320 - | .build_unchecked();
|
8321 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8322 - | .await
|
8323 - | .expect("unable to make an HTTP request");
|
8324 - | assert!(
|
8325 - | receiver.recv().await.is_some(),
|
8326 - | "we expected operation handler to be invoked but it was not entered"
|
8327 - | );
|
8328 - | }
|
8329 - |
|
8330 - | /// Serializes map of list shapes
|
8331 - | /// Test ID: serializes_map_of_list_shapes
|
8332 - | #[::tokio::test]
|
8333 - | #[::tracing_test::traced_test]
|
8334 - | async fn serializes_map_of_list_shapes_request() {
|
8335 - | #[allow(unused_mut)]
|
8336 - | let mut http_request = ::http::Request::builder()
|
8337 - | .uri("/")
|
8338 - | .method("POST")
|
8339 - | .header("Content-Type", "application/x-amz-json-1.1")
|
8340 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
8341 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
8342 - | ::bytes::Bytes::copy_from_slice(
|
8343 - | &::aws_smithy_protocol_test::decode_body_data("{\"MapOfListsOfStrings\":{\"abc\":[\"abc\",\"xyz\"],\"mno\":[\"xyz\",\"abc\"]}}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
8344 - | )
|
8345 - | )).unwrap();
|
8346 - | #[allow(unused_mut)]
|
8347 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8348 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
8349 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
8350 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
8351 - | let sender = sender.clone();
|
8352 - | async move {
|
8353 - | let result = {
|
8354 - | use ::aws_smithy_protocol_test::FloatEquals;
|
8355 - | let expected = crate::input::KitchenSinkOperationInput {
|
8356 - | map_of_lists_of_strings: ::std::option::Option::Some({
|
8357 - | let mut ret = ::std::collections::HashMap::new();
|
8358 - | ret.insert(
|
8359 - | "abc".to_owned(),
|
8360 - | vec!["abc".to_owned(), "xyz".to_owned()],
|
8361 - | );
|
8362 - | ret.insert(
|
8363 - | "mno".to_owned(),
|
8364 - | vec!["xyz".to_owned(), "abc".to_owned()],
|
8365 - | );
|
8366 - | ret
|
8367 - | }),
|
8368 - | blob: ::std::option::Option::None,
|
8369 - | boolean: ::std::option::Option::None,
|
8370 - | double: ::std::option::Option::None,
|
8371 - | empty_struct: ::std::option::Option::None,
|
8372 - | float: ::std::option::Option::None,
|
8373 - | httpdate_timestamp: ::std::option::Option::None,
|
8374 - | integer: ::std::option::Option::None,
|
8375 - | iso8601_timestamp: ::std::option::Option::None,
|
8376 - | json_value: ::std::option::Option::None,
|
8377 - | list_of_lists: ::std::option::Option::None,
|
8378 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8379 - | list_of_strings: ::std::option::Option::None,
|
8380 - | list_of_structs: ::std::option::Option::None,
|
8381 - | long: ::std::option::Option::None,
|
8382 - | map_of_maps: ::std::option::Option::None,
|
8383 - | map_of_strings: ::std::option::Option::None,
|
8384 - | map_of_structs: ::std::option::Option::None,
|
8385 - | recursive_list: ::std::option::Option::None,
|
8386 - | recursive_map: ::std::option::Option::None,
|
8387 - | recursive_struct: ::std::option::Option::None,
|
8388 - | simple_struct: ::std::option::Option::None,
|
8389 - | string: ::std::option::Option::None,
|
8390 - | struct_with_json_name: ::std::option::Option::None,
|
8391 - | timestamp: ::std::option::Option::None,
|
8392 - | unix_timestamp: ::std::option::Option::None,
|
8393 - | };
|
8394 - | ::pretty_assertions::assert_eq!(
|
8395 - | input.blob,
|
8396 - | expected.blob,
|
8397 - | "Unexpected value for `blob`"
|
8398 - | );
|
8399 - | ::pretty_assertions::assert_eq!(
|
8400 - | input.boolean,
|
8401 - | expected.boolean,
|
8402 - | "Unexpected value for `boolean`"
|
8403 - | );
|
8404 - | assert!(
|
8405 - | input.double.float_equals(&expected.double),
|
8406 - | "Unexpected value for `double` {:?} vs. {:?}",
|
8407 - | expected.double,
|
8408 - | input.double
|
8409 - | );
|
8410 - | ::pretty_assertions::assert_eq!(
|
8411 - | input.empty_struct,
|
8412 - | expected.empty_struct,
|
8413 - | "Unexpected value for `empty_struct`"
|
8414 - | );
|
8415 - | assert!(
|
8416 - | input.float.float_equals(&expected.float),
|
8417 - | "Unexpected value for `float` {:?} vs. {:?}",
|
8418 - | expected.float,
|
8419 - | input.float
|
8420 - | );
|
8421 - | ::pretty_assertions::assert_eq!(
|
8422 - | input.httpdate_timestamp,
|
8423 - | expected.httpdate_timestamp,
|
8424 - | "Unexpected value for `httpdate_timestamp`"
|
8425 - | );
|
8426 - | ::pretty_assertions::assert_eq!(
|
8427 - | input.integer,
|
8428 - | expected.integer,
|
8429 - | "Unexpected value for `integer`"
|
8430 - | );
|
8431 - | ::pretty_assertions::assert_eq!(
|
8432 - | input.iso8601_timestamp,
|
8433 - | expected.iso8601_timestamp,
|
8434 - | "Unexpected value for `iso8601_timestamp`"
|
8435 - | );
|
8436 - | ::pretty_assertions::assert_eq!(
|
8437 - | input.json_value,
|
8438 - | expected.json_value,
|
8439 - | "Unexpected value for `json_value`"
|
8440 - | );
|
8441 - | ::pretty_assertions::assert_eq!(
|
8442 - | input.list_of_lists,
|
8443 - | expected.list_of_lists,
|
8444 - | "Unexpected value for `list_of_lists`"
|
8445 - | );
|
8446 - | ::pretty_assertions::assert_eq!(
|
8447 - | input.list_of_maps_of_strings,
|
8448 - | expected.list_of_maps_of_strings,
|
8449 - | "Unexpected value for `list_of_maps_of_strings`"
|
8450 - | );
|
8451 - | ::pretty_assertions::assert_eq!(
|
8452 - | input.list_of_strings,
|
8453 - | expected.list_of_strings,
|
8454 - | "Unexpected value for `list_of_strings`"
|
8455 - | );
|
8456 - | ::pretty_assertions::assert_eq!(
|
8457 - | input.list_of_structs,
|
8458 - | expected.list_of_structs,
|
8459 - | "Unexpected value for `list_of_structs`"
|
8460 - | );
|
8461 - | ::pretty_assertions::assert_eq!(
|
8462 - | input.long,
|
8463 - | expected.long,
|
8464 - | "Unexpected value for `long`"
|
8465 - | );
|
8466 - | ::pretty_assertions::assert_eq!(
|
8467 - | input.map_of_lists_of_strings,
|
8468 - | expected.map_of_lists_of_strings,
|
8469 - | "Unexpected value for `map_of_lists_of_strings`"
|
8470 - | );
|
8471 - | ::pretty_assertions::assert_eq!(
|
8472 - | input.map_of_maps,
|
8473 - | expected.map_of_maps,
|
8474 - | "Unexpected value for `map_of_maps`"
|
8475 - | );
|
8476 - | ::pretty_assertions::assert_eq!(
|
8477 - | input.map_of_strings,
|
8478 - | expected.map_of_strings,
|
8479 - | "Unexpected value for `map_of_strings`"
|
8480 - | );
|
8481 - | ::pretty_assertions::assert_eq!(
|
8482 - | input.map_of_structs,
|
8483 - | expected.map_of_structs,
|
8484 - | "Unexpected value for `map_of_structs`"
|
8485 - | );
|
8486 - | ::pretty_assertions::assert_eq!(
|
8487 - | input.recursive_list,
|
8488 - | expected.recursive_list,
|
8489 - | "Unexpected value for `recursive_list`"
|
8490 - | );
|
8491 - | ::pretty_assertions::assert_eq!(
|
8492 - | input.recursive_map,
|
8493 - | expected.recursive_map,
|
8494 - | "Unexpected value for `recursive_map`"
|
8495 - | );
|
8496 - | ::pretty_assertions::assert_eq!(
|
8497 - | input.recursive_struct,
|
8498 - | expected.recursive_struct,
|
8499 - | "Unexpected value for `recursive_struct`"
|
8500 - | );
|
8501 - | ::pretty_assertions::assert_eq!(
|
8502 - | input.simple_struct,
|
8503 - | expected.simple_struct,
|
8504 - | "Unexpected value for `simple_struct`"
|
8505 - | );
|
8506 - | ::pretty_assertions::assert_eq!(
|
8507 - | input.string,
|
8508 - | expected.string,
|
8509 - | "Unexpected value for `string`"
|
8510 - | );
|
8511 - | ::pretty_assertions::assert_eq!(
|
8512 - | input.struct_with_json_name,
|
8513 - | expected.struct_with_json_name,
|
8514 - | "Unexpected value for `struct_with_json_name`"
|
8515 - | );
|
8516 - | ::pretty_assertions::assert_eq!(
|
8517 - | input.timestamp,
|
8518 - | expected.timestamp,
|
8519 - | "Unexpected value for `timestamp`"
|
8520 - | );
|
8521 - | ::pretty_assertions::assert_eq!(
|
8522 - | input.unix_timestamp,
|
8523 - | expected.unix_timestamp,
|
8524 - | "Unexpected value for `unix_timestamp`"
|
8525 - | );
|
8526 - | let output = crate::output::KitchenSinkOperationOutput {
|
8527 - | blob: ::std::option::Option::None,
|
8528 - | boolean: ::std::option::Option::None,
|
8529 - | double: ::std::option::Option::None,
|
8530 - | empty_struct: ::std::option::Option::None,
|
8531 - | float: ::std::option::Option::None,
|
8532 - | httpdate_timestamp: ::std::option::Option::None,
|
8533 - | integer: ::std::option::Option::None,
|
8534 - | iso8601_timestamp: ::std::option::Option::None,
|
8535 - | json_value: ::std::option::Option::None,
|
8536 - | list_of_lists: ::std::option::Option::None,
|
8537 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8538 - | list_of_strings: ::std::option::Option::None,
|
8539 - | list_of_structs: ::std::option::Option::None,
|
8540 - | long: ::std::option::Option::None,
|
8541 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8542 - | map_of_maps: ::std::option::Option::None,
|
8543 - | map_of_strings: ::std::option::Option::None,
|
8544 - | map_of_structs: ::std::option::Option::None,
|
8545 - | recursive_list: ::std::option::Option::None,
|
8546 - | recursive_map: ::std::option::Option::None,
|
8547 - | recursive_struct: ::std::option::Option::None,
|
8548 - | simple_struct: ::std::option::Option::None,
|
8549 - | string: ::std::option::Option::None,
|
8550 - | struct_with_json_name: ::std::option::Option::None,
|
8551 - | timestamp: ::std::option::Option::None,
|
8552 - | unix_timestamp: ::std::option::Option::None,
|
8553 - | };
|
8554 - | Ok(output)
|
8555 - | };
|
8556 - | sender.send(()).await.expect("receiver dropped early");
|
8557 - | result
|
8558 - | }
|
8559 - | })
|
8560 - | .build_unchecked();
|
8561 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8562 - | .await
|
8563 - | .expect("unable to make an HTTP request");
|
8564 - | assert!(
|
8565 - | receiver.recv().await.is_some(),
|
8566 - | "we expected operation handler to be invoked but it was not entered"
|
8567 - | );
|
8568 - | }
|
8569 - |
|
8570 - | /// Serializes map of structure shapes
|
8571 - | /// Test ID: serializes_map_of_structure_shapes
|
8572 - | #[::tokio::test]
|
8573 - | #[::tracing_test::traced_test]
|
8574 - | async fn serializes_map_of_structure_shapes_request() {
|
8575 - | #[allow(unused_mut)]
|
8576 - | let mut http_request = ::http::Request::builder()
|
8577 - | .uri("/")
|
8578 - | .method("POST")
|
8579 - | .header("Content-Type", "application/x-amz-json-1.1")
|
8580 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
8581 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
8582 - | ::bytes::Bytes::copy_from_slice(
|
8583 - | &::aws_smithy_protocol_test::decode_body_data("{\"MapOfStructs\":{\"key1\":{\"Value\":\"value-1\"},\"key2\":{\"Value\":\"value-2\"}}}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
8584 - | )
|
8585 - | )).unwrap();
|
8586 - | #[allow(unused_mut)]
|
8587 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8588 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
8589 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
8590 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
8591 - | let sender = sender.clone();
|
8592 - | async move {
|
8593 - | let result = {
|
8594 - | use ::aws_smithy_protocol_test::FloatEquals;
|
8595 - | let expected = crate::input::KitchenSinkOperationInput {
|
8596 - | map_of_structs: ::std::option::Option::Some({
|
8597 - | let mut ret = ::std::collections::HashMap::new();
|
8598 - | ret.insert(
|
8599 - | "key1".to_owned(),
|
8600 - | crate::model::SimpleStruct {
|
8601 - | value: ::std::option::Option::Some("value-1".to_owned()),
|
8602 - | },
|
8603 - | );
|
8604 - | ret.insert(
|
8605 - | "key2".to_owned(),
|
8606 - | crate::model::SimpleStruct {
|
8607 - | value: ::std::option::Option::Some("value-2".to_owned()),
|
8608 - | },
|
8609 - | );
|
8610 - | ret
|
8611 - | }),
|
8612 - | blob: ::std::option::Option::None,
|
8613 - | boolean: ::std::option::Option::None,
|
8614 - | double: ::std::option::Option::None,
|
8615 - | empty_struct: ::std::option::Option::None,
|
8616 - | float: ::std::option::Option::None,
|
8617 - | httpdate_timestamp: ::std::option::Option::None,
|
8618 - | integer: ::std::option::Option::None,
|
8619 - | iso8601_timestamp: ::std::option::Option::None,
|
8620 - | json_value: ::std::option::Option::None,
|
8621 - | list_of_lists: ::std::option::Option::None,
|
8622 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8623 - | list_of_strings: ::std::option::Option::None,
|
8624 - | list_of_structs: ::std::option::Option::None,
|
8625 - | long: ::std::option::Option::None,
|
8626 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8627 - | map_of_maps: ::std::option::Option::None,
|
8628 - | map_of_strings: ::std::option::Option::None,
|
8629 - | recursive_list: ::std::option::Option::None,
|
8630 - | recursive_map: ::std::option::Option::None,
|
8631 - | recursive_struct: ::std::option::Option::None,
|
8632 - | simple_struct: ::std::option::Option::None,
|
8633 - | string: ::std::option::Option::None,
|
8634 - | struct_with_json_name: ::std::option::Option::None,
|
8635 - | timestamp: ::std::option::Option::None,
|
8636 - | unix_timestamp: ::std::option::Option::None,
|
8637 - | };
|
8638 - | ::pretty_assertions::assert_eq!(
|
8639 - | input.blob,
|
8640 - | expected.blob,
|
8641 - | "Unexpected value for `blob`"
|
8642 - | );
|
8643 - | ::pretty_assertions::assert_eq!(
|
8644 - | input.boolean,
|
8645 - | expected.boolean,
|
8646 - | "Unexpected value for `boolean`"
|
8647 - | );
|
8648 - | assert!(
|
8649 - | input.double.float_equals(&expected.double),
|
8650 - | "Unexpected value for `double` {:?} vs. {:?}",
|
8651 - | expected.double,
|
8652 - | input.double
|
8653 - | );
|
8654 - | ::pretty_assertions::assert_eq!(
|
8655 - | input.empty_struct,
|
8656 - | expected.empty_struct,
|
8657 - | "Unexpected value for `empty_struct`"
|
8658 - | );
|
8659 - | assert!(
|
8660 - | input.float.float_equals(&expected.float),
|
8661 - | "Unexpected value for `float` {:?} vs. {:?}",
|
8662 - | expected.float,
|
8663 - | input.float
|
8664 - | );
|
8665 - | ::pretty_assertions::assert_eq!(
|
8666 - | input.httpdate_timestamp,
|
8667 - | expected.httpdate_timestamp,
|
8668 - | "Unexpected value for `httpdate_timestamp`"
|
8669 - | );
|
8670 - | ::pretty_assertions::assert_eq!(
|
8671 - | input.integer,
|
8672 - | expected.integer,
|
8673 - | "Unexpected value for `integer`"
|
8674 - | );
|
8675 - | ::pretty_assertions::assert_eq!(
|
8676 - | input.iso8601_timestamp,
|
8677 - | expected.iso8601_timestamp,
|
8678 - | "Unexpected value for `iso8601_timestamp`"
|
8679 - | );
|
8680 - | ::pretty_assertions::assert_eq!(
|
8681 - | input.json_value,
|
8682 - | expected.json_value,
|
8683 - | "Unexpected value for `json_value`"
|
8684 - | );
|
8685 - | ::pretty_assertions::assert_eq!(
|
8686 - | input.list_of_lists,
|
8687 - | expected.list_of_lists,
|
8688 - | "Unexpected value for `list_of_lists`"
|
8689 - | );
|
8690 - | ::pretty_assertions::assert_eq!(
|
8691 - | input.list_of_maps_of_strings,
|
8692 - | expected.list_of_maps_of_strings,
|
8693 - | "Unexpected value for `list_of_maps_of_strings`"
|
8694 - | );
|
8695 - | ::pretty_assertions::assert_eq!(
|
8696 - | input.list_of_strings,
|
8697 - | expected.list_of_strings,
|
8698 - | "Unexpected value for `list_of_strings`"
|
8699 - | );
|
8700 - | ::pretty_assertions::assert_eq!(
|
8701 - | input.list_of_structs,
|
8702 - | expected.list_of_structs,
|
8703 - | "Unexpected value for `list_of_structs`"
|
8704 - | );
|
8705 - | ::pretty_assertions::assert_eq!(
|
8706 - | input.long,
|
8707 - | expected.long,
|
8708 - | "Unexpected value for `long`"
|
8709 - | );
|
8710 - | ::pretty_assertions::assert_eq!(
|
8711 - | input.map_of_lists_of_strings,
|
8712 - | expected.map_of_lists_of_strings,
|
8713 - | "Unexpected value for `map_of_lists_of_strings`"
|
8714 - | );
|
8715 - | ::pretty_assertions::assert_eq!(
|
8716 - | input.map_of_maps,
|
8717 - | expected.map_of_maps,
|
8718 - | "Unexpected value for `map_of_maps`"
|
8719 - | );
|
8720 - | ::pretty_assertions::assert_eq!(
|
8721 - | input.map_of_strings,
|
8722 - | expected.map_of_strings,
|
8723 - | "Unexpected value for `map_of_strings`"
|
8724 - | );
|
8725 - | ::pretty_assertions::assert_eq!(
|
8726 - | input.map_of_structs,
|
8727 - | expected.map_of_structs,
|
8728 - | "Unexpected value for `map_of_structs`"
|
8729 - | );
|
8730 - | ::pretty_assertions::assert_eq!(
|
8731 - | input.recursive_list,
|
8732 - | expected.recursive_list,
|
8733 - | "Unexpected value for `recursive_list`"
|
8734 - | );
|
8735 - | ::pretty_assertions::assert_eq!(
|
8736 - | input.recursive_map,
|
8737 - | expected.recursive_map,
|
8738 - | "Unexpected value for `recursive_map`"
|
8739 - | );
|
8740 - | ::pretty_assertions::assert_eq!(
|
8741 - | input.recursive_struct,
|
8742 - | expected.recursive_struct,
|
8743 - | "Unexpected value for `recursive_struct`"
|
8744 - | );
|
8745 - | ::pretty_assertions::assert_eq!(
|
8746 - | input.simple_struct,
|
8747 - | expected.simple_struct,
|
8748 - | "Unexpected value for `simple_struct`"
|
8749 - | );
|
8750 - | ::pretty_assertions::assert_eq!(
|
8751 - | input.string,
|
8752 - | expected.string,
|
8753 - | "Unexpected value for `string`"
|
8754 - | );
|
8755 - | ::pretty_assertions::assert_eq!(
|
8756 - | input.struct_with_json_name,
|
8757 - | expected.struct_with_json_name,
|
8758 - | "Unexpected value for `struct_with_json_name`"
|
8759 - | );
|
8760 - | ::pretty_assertions::assert_eq!(
|
8761 - | input.timestamp,
|
8762 - | expected.timestamp,
|
8763 - | "Unexpected value for `timestamp`"
|
8764 - | );
|
8765 - | ::pretty_assertions::assert_eq!(
|
8766 - | input.unix_timestamp,
|
8767 - | expected.unix_timestamp,
|
8768 - | "Unexpected value for `unix_timestamp`"
|
8769 - | );
|
8770 - | let output = crate::output::KitchenSinkOperationOutput {
|
8771 - | blob: ::std::option::Option::None,
|
8772 - | boolean: ::std::option::Option::None,
|
8773 - | double: ::std::option::Option::None,
|
8774 - | empty_struct: ::std::option::Option::None,
|
8775 - | float: ::std::option::Option::None,
|
8776 - | httpdate_timestamp: ::std::option::Option::None,
|
8777 - | integer: ::std::option::Option::None,
|
8778 - | iso8601_timestamp: ::std::option::Option::None,
|
8779 - | json_value: ::std::option::Option::None,
|
8780 - | list_of_lists: ::std::option::Option::None,
|
8781 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8782 - | list_of_strings: ::std::option::Option::None,
|
8783 - | list_of_structs: ::std::option::Option::None,
|
8784 - | long: ::std::option::Option::None,
|
8785 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8786 - | map_of_maps: ::std::option::Option::None,
|
8787 - | map_of_strings: ::std::option::Option::None,
|
8788 - | map_of_structs: ::std::option::Option::None,
|
8789 - | recursive_list: ::std::option::Option::None,
|
8790 - | recursive_map: ::std::option::Option::None,
|
8791 - | recursive_struct: ::std::option::Option::None,
|
8792 - | simple_struct: ::std::option::Option::None,
|
8793 - | string: ::std::option::Option::None,
|
8794 - | struct_with_json_name: ::std::option::Option::None,
|
8795 - | timestamp: ::std::option::Option::None,
|
8796 - | unix_timestamp: ::std::option::Option::None,
|
8797 - | };
|
8798 - | Ok(output)
|
8799 - | };
|
8800 - | sender.send(()).await.expect("receiver dropped early");
|
8801 - | result
|
8802 - | }
|
8803 - | })
|
8804 - | .build_unchecked();
|
8805 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8806 - | .await
|
8807 - | .expect("unable to make an HTTP request");
|
8808 - | assert!(
|
8809 - | receiver.recv().await.is_some(),
|
8810 - | "we expected operation handler to be invoked but it was not entered"
|
8811 - | );
|
8812 - | }
|
8813 - |
|
8814 - | /// Serializes map of recursive structure shapes
|
8815 - | /// Test ID: serializes_map_of_recursive_structure_shapes
|
8816 - | #[::tokio::test]
|
8817 - | #[::tracing_test::traced_test]
|
8818 - | async fn serializes_map_of_recursive_structure_shapes_request() {
|
8819 - | #[allow(unused_mut)]
|
8820 - | let mut http_request = ::http::Request::builder()
|
8821 - | .uri("/")
|
8822 - | .method("POST")
|
8823 - | .header("Content-Type", "application/x-amz-json-1.1")
|
8824 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
8825 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
8826 - | ::bytes::Bytes::copy_from_slice(
|
8827 - | &::aws_smithy_protocol_test::decode_body_data("{\"RecursiveMap\":{\"key1\":{\"RecursiveMap\":{\"key2\":{\"RecursiveMap\":{\"key3\":{\"Boolean\":false}}}}}}}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
8828 - | )
|
8829 - | )).unwrap();
|
8830 - | #[allow(unused_mut)]
|
8831 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8832 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
8833 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
8834 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
8835 - | let sender = sender.clone();
|
8836 - | async move {
|
8837 - | let result = {
|
8838 - | use ::aws_smithy_protocol_test::FloatEquals;
|
8839 - | let expected = crate::input::KitchenSinkOperationInput {
|
8840 - | recursive_map: ::std::option::Option::Some({
|
8841 - | let mut ret = ::std::collections::HashMap::new();
|
8842 - | ret.insert(
|
8843 - | "key1".to_owned(),
|
8844 - | crate::model::KitchenSink {
|
8845 - | recursive_map: ::std::option::Option::Some({
|
8846 - | let mut ret = ::std::collections::HashMap::new();
|
8847 - | ret.insert(
|
8848 - | "key2".to_owned(),
|
8849 - | crate::model::KitchenSink {
|
8850 - | recursive_map: ::std::option::Option::Some({
|
8851 - | let mut ret =
|
8852 - | ::std::collections::HashMap::new();
|
8853 - | ret.insert(
|
8854 - | "key3".to_owned(),
|
8855 - | crate::model::KitchenSink {
|
8856 - | boolean:
|
8857 - | ::std::option::Option::Some(
|
8858 - | false,
|
8859 - | ),
|
8860 - | blob: ::std::option::Option::None,
|
8861 - | double: ::std::option::Option::None,
|
8862 - | empty_struct:
|
8863 - | ::std::option::Option::None,
|
8864 - | float: ::std::option::Option::None,
|
8865 - | httpdate_timestamp:
|
8866 - | ::std::option::Option::None,
|
8867 - | integer:
|
8868 - | ::std::option::Option::None,
|
8869 - | iso8601_timestamp:
|
8870 - | ::std::option::Option::None,
|
8871 - | json_value:
|
8872 - | ::std::option::Option::None,
|
8873 - | list_of_lists:
|
8874 - | ::std::option::Option::None,
|
8875 - | list_of_maps_of_strings:
|
8876 - | ::std::option::Option::None,
|
8877 - | list_of_strings:
|
8878 - | ::std::option::Option::None,
|
8879 - | list_of_structs:
|
8880 - | ::std::option::Option::None,
|
8881 - | long: ::std::option::Option::None,
|
8882 - | map_of_lists_of_strings:
|
8883 - | ::std::option::Option::None,
|
8884 - | map_of_maps:
|
8885 - | ::std::option::Option::None,
|
8886 - | map_of_strings:
|
8887 - | ::std::option::Option::None,
|
8888 - | map_of_structs:
|
8889 - | ::std::option::Option::None,
|
8890 - | recursive_list:
|
8891 - | ::std::option::Option::None,
|
8892 - | recursive_map:
|
8893 - | ::std::option::Option::None,
|
8894 - | recursive_struct:
|
8895 - | ::std::option::Option::None,
|
8896 - | simple_struct:
|
8897 - | ::std::option::Option::None,
|
8898 - | string: ::std::option::Option::None,
|
8899 - | struct_with_json_name:
|
8900 - | ::std::option::Option::None,
|
8901 - | timestamp:
|
8902 - | ::std::option::Option::None,
|
8903 - | unix_timestamp:
|
8904 - | ::std::option::Option::None,
|
8905 - | },
|
8906 - | );
|
8907 - | ret
|
8908 - | }),
|
8909 - | blob: ::std::option::Option::None,
|
8910 - | boolean: ::std::option::Option::None,
|
8911 - | double: ::std::option::Option::None,
|
8912 - | empty_struct: ::std::option::Option::None,
|
8913 - | float: ::std::option::Option::None,
|
8914 - | httpdate_timestamp: ::std::option::Option::None,
|
8915 - | integer: ::std::option::Option::None,
|
8916 - | iso8601_timestamp: ::std::option::Option::None,
|
8917 - | json_value: ::std::option::Option::None,
|
8918 - | list_of_lists: ::std::option::Option::None,
|
8919 - | list_of_maps_of_strings:
|
8920 - | ::std::option::Option::None,
|
8921 - | list_of_strings: ::std::option::Option::None,
|
8922 - | list_of_structs: ::std::option::Option::None,
|
8923 - | long: ::std::option::Option::None,
|
8924 - | map_of_lists_of_strings:
|
8925 - | ::std::option::Option::None,
|
8926 - | map_of_maps: ::std::option::Option::None,
|
8927 - | map_of_strings: ::std::option::Option::None,
|
8928 - | map_of_structs: ::std::option::Option::None,
|
8929 - | recursive_list: ::std::option::Option::None,
|
8930 - | recursive_struct: ::std::option::Option::None,
|
8931 - | simple_struct: ::std::option::Option::None,
|
8932 - | string: ::std::option::Option::None,
|
8933 - | struct_with_json_name:
|
8934 - | ::std::option::Option::None,
|
8935 - | timestamp: ::std::option::Option::None,
|
8936 - | unix_timestamp: ::std::option::Option::None,
|
8937 - | },
|
8938 - | );
|
8939 - | ret
|
8940 - | }),
|
8941 - | blob: ::std::option::Option::None,
|
8942 - | boolean: ::std::option::Option::None,
|
8943 - | double: ::std::option::Option::None,
|
8944 - | empty_struct: ::std::option::Option::None,
|
8945 - | float: ::std::option::Option::None,
|
8946 - | httpdate_timestamp: ::std::option::Option::None,
|
8947 - | integer: ::std::option::Option::None,
|
8948 - | iso8601_timestamp: ::std::option::Option::None,
|
8949 - | json_value: ::std::option::Option::None,
|
8950 - | list_of_lists: ::std::option::Option::None,
|
8951 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8952 - | list_of_strings: ::std::option::Option::None,
|
8953 - | list_of_structs: ::std::option::Option::None,
|
8954 - | long: ::std::option::Option::None,
|
8955 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8956 - | map_of_maps: ::std::option::Option::None,
|
8957 - | map_of_strings: ::std::option::Option::None,
|
8958 - | map_of_structs: ::std::option::Option::None,
|
8959 - | recursive_list: ::std::option::Option::None,
|
8960 - | recursive_struct: ::std::option::Option::None,
|
8961 - | simple_struct: ::std::option::Option::None,
|
8962 - | string: ::std::option::Option::None,
|
8963 - | struct_with_json_name: ::std::option::Option::None,
|
8964 - | timestamp: ::std::option::Option::None,
|
8965 - | unix_timestamp: ::std::option::Option::None,
|
8966 - | },
|
8967 - | );
|
8968 - | ret
|
8969 - | }),
|
8970 - | blob: ::std::option::Option::None,
|
8971 - | boolean: ::std::option::Option::None,
|
8972 - | double: ::std::option::Option::None,
|
8973 - | empty_struct: ::std::option::Option::None,
|
8974 - | float: ::std::option::Option::None,
|
8975 - | httpdate_timestamp: ::std::option::Option::None,
|
8976 - | integer: ::std::option::Option::None,
|
8977 - | iso8601_timestamp: ::std::option::Option::None,
|
8978 - | json_value: ::std::option::Option::None,
|
8979 - | list_of_lists: ::std::option::Option::None,
|
8980 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8981 - | list_of_strings: ::std::option::Option::None,
|
8982 - | list_of_structs: ::std::option::Option::None,
|
8983 - | long: ::std::option::Option::None,
|
8984 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8985 - | map_of_maps: ::std::option::Option::None,
|
8986 - | map_of_strings: ::std::option::Option::None,
|
8987 - | map_of_structs: ::std::option::Option::None,
|
8988 - | recursive_list: ::std::option::Option::None,
|
8989 - | recursive_struct: ::std::option::Option::None,
|
8990 - | simple_struct: ::std::option::Option::None,
|
8991 - | string: ::std::option::Option::None,
|
8992 - | struct_with_json_name: ::std::option::Option::None,
|
8993 - | timestamp: ::std::option::Option::None,
|
8994 - | unix_timestamp: ::std::option::Option::None,
|
8995 - | };
|
8996 - | ::pretty_assertions::assert_eq!(
|
8997 - | input.blob,
|
8998 - | expected.blob,
|
8999 - | "Unexpected value for `blob`"
|
9000 - | );
|
9001 - | ::pretty_assertions::assert_eq!(
|
9002 - | input.boolean,
|
9003 - | expected.boolean,
|
9004 - | "Unexpected value for `boolean`"
|
9005 - | );
|
9006 - | assert!(
|
9007 - | input.double.float_equals(&expected.double),
|
9008 - | "Unexpected value for `double` {:?} vs. {:?}",
|
9009 - | expected.double,
|
9010 - | input.double
|
9011 - | );
|
9012 - | ::pretty_assertions::assert_eq!(
|
9013 - | input.empty_struct,
|
9014 - | expected.empty_struct,
|
9015 - | "Unexpected value for `empty_struct`"
|
9016 - | );
|
9017 - | assert!(
|
9018 - | input.float.float_equals(&expected.float),
|
9019 - | "Unexpected value for `float` {:?} vs. {:?}",
|
9020 - | expected.float,
|
9021 - | input.float
|
9022 - | );
|
9023 - | ::pretty_assertions::assert_eq!(
|
9024 - | input.httpdate_timestamp,
|
9025 - | expected.httpdate_timestamp,
|
9026 - | "Unexpected value for `httpdate_timestamp`"
|
9027 - | );
|
9028 - | ::pretty_assertions::assert_eq!(
|
9029 - | input.integer,
|
9030 - | expected.integer,
|
9031 - | "Unexpected value for `integer`"
|
9032 - | );
|
9033 - | ::pretty_assertions::assert_eq!(
|
9034 - | input.iso8601_timestamp,
|
9035 - | expected.iso8601_timestamp,
|
9036 - | "Unexpected value for `iso8601_timestamp`"
|
9037 - | );
|
9038 - | ::pretty_assertions::assert_eq!(
|
9039 - | input.json_value,
|
9040 - | expected.json_value,
|
9041 - | "Unexpected value for `json_value`"
|
9042 - | );
|
9043 - | ::pretty_assertions::assert_eq!(
|
9044 - | input.list_of_lists,
|
9045 - | expected.list_of_lists,
|
9046 - | "Unexpected value for `list_of_lists`"
|
9047 - | );
|
9048 - | ::pretty_assertions::assert_eq!(
|
9049 - | input.list_of_maps_of_strings,
|
9050 - | expected.list_of_maps_of_strings,
|
9051 - | "Unexpected value for `list_of_maps_of_strings`"
|
9052 - | );
|
9053 - | ::pretty_assertions::assert_eq!(
|
9054 - | input.list_of_strings,
|
9055 - | expected.list_of_strings,
|
9056 - | "Unexpected value for `list_of_strings`"
|
9057 - | );
|
9058 - | ::pretty_assertions::assert_eq!(
|
9059 - | input.list_of_structs,
|
9060 - | expected.list_of_structs,
|
9061 - | "Unexpected value for `list_of_structs`"
|
9062 - | );
|
9063 - | ::pretty_assertions::assert_eq!(
|
9064 - | input.long,
|
9065 - | expected.long,
|
9066 - | "Unexpected value for `long`"
|
9067 - | );
|
9068 - | ::pretty_assertions::assert_eq!(
|
9069 - | input.map_of_lists_of_strings,
|
9070 - | expected.map_of_lists_of_strings,
|
9071 - | "Unexpected value for `map_of_lists_of_strings`"
|
9072 - | );
|
9073 - | ::pretty_assertions::assert_eq!(
|
9074 - | input.map_of_maps,
|
9075 - | expected.map_of_maps,
|
9076 - | "Unexpected value for `map_of_maps`"
|
9077 - | );
|
9078 - | ::pretty_assertions::assert_eq!(
|
9079 - | input.map_of_strings,
|
9080 - | expected.map_of_strings,
|
9081 - | "Unexpected value for `map_of_strings`"
|
9082 - | );
|
9083 - | ::pretty_assertions::assert_eq!(
|
9084 - | input.map_of_structs,
|
9085 - | expected.map_of_structs,
|
9086 - | "Unexpected value for `map_of_structs`"
|
9087 - | );
|
9088 - | ::pretty_assertions::assert_eq!(
|
9089 - | input.recursive_list,
|
9090 - | expected.recursive_list,
|
9091 - | "Unexpected value for `recursive_list`"
|
9092 - | );
|
9093 - | ::pretty_assertions::assert_eq!(
|
9094 - | input.recursive_map,
|
9095 - | expected.recursive_map,
|
9096 - | "Unexpected value for `recursive_map`"
|
9097 - | );
|
9098 - | ::pretty_assertions::assert_eq!(
|
9099 - | input.recursive_struct,
|
9100 - | expected.recursive_struct,
|
9101 - | "Unexpected value for `recursive_struct`"
|
9102 - | );
|
9103 - | ::pretty_assertions::assert_eq!(
|
9104 - | input.simple_struct,
|
9105 - | expected.simple_struct,
|
9106 - | "Unexpected value for `simple_struct`"
|
9107 - | );
|
9108 - | ::pretty_assertions::assert_eq!(
|
9109 - | input.string,
|
9110 - | expected.string,
|
9111 - | "Unexpected value for `string`"
|
9112 - | );
|
9113 - | ::pretty_assertions::assert_eq!(
|
9114 - | input.struct_with_json_name,
|
9115 - | expected.struct_with_json_name,
|
9116 - | "Unexpected value for `struct_with_json_name`"
|
9117 - | );
|
9118 - | ::pretty_assertions::assert_eq!(
|
9119 - | input.timestamp,
|
9120 - | expected.timestamp,
|
9121 - | "Unexpected value for `timestamp`"
|
9122 - | );
|
9123 - | ::pretty_assertions::assert_eq!(
|
9124 - | input.unix_timestamp,
|
9125 - | expected.unix_timestamp,
|
9126 - | "Unexpected value for `unix_timestamp`"
|
9127 - | );
|
9128 - | let output = crate::output::KitchenSinkOperationOutput {
|
9129 - | blob: ::std::option::Option::None,
|
9130 - | boolean: ::std::option::Option::None,
|
9131 - | double: ::std::option::Option::None,
|
9132 - | empty_struct: ::std::option::Option::None,
|
9133 - | float: ::std::option::Option::None,
|
9134 - | httpdate_timestamp: ::std::option::Option::None,
|
9135 - | integer: ::std::option::Option::None,
|
9136 - | iso8601_timestamp: ::std::option::Option::None,
|
9137 - | json_value: ::std::option::Option::None,
|
9138 - | list_of_lists: ::std::option::Option::None,
|
9139 - | list_of_maps_of_strings: ::std::option::Option::None,
|
9140 - | list_of_strings: ::std::option::Option::None,
|
9141 - | list_of_structs: ::std::option::Option::None,
|
9142 - | long: ::std::option::Option::None,
|
9143 - | map_of_lists_of_strings: ::std::option::Option::None,
|
9144 - | map_of_maps: ::std::option::Option::None,
|
9145 - | map_of_strings: ::std::option::Option::None,
|
9146 - | map_of_structs: ::std::option::Option::None,
|
9147 - | recursive_list: ::std::option::Option::None,
|
9148 - | recursive_map: ::std::option::Option::None,
|
9149 - | recursive_struct: ::std::option::Option::None,
|
9150 - | simple_struct: ::std::option::Option::None,
|
9151 - | string: ::std::option::Option::None,
|
9152 - | struct_with_json_name: ::std::option::Option::None,
|
9153 - | timestamp: ::std::option::Option::None,
|
9154 - | unix_timestamp: ::std::option::Option::None,
|
9155 - | };
|
9156 - | Ok(output)
|
9157 - | };
|
9158 - | sender.send(()).await.expect("receiver dropped early");
|
9159 - | result
|
9160 - | }
|
9161 - | })
|
9162 - | .build_unchecked();
|
9163 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7457 + | async fn parses_long_shapes_response() {
|
7458 + | let output = crate::output::KitchenSinkOperationOutput {
|
7459 + | long: ::std::option::Option::Some(1234567890123456789),
|
7460 + | blob: ::std::option::Option::None,
|
7461 + | boolean: ::std::option::Option::None,
|
7462 + | double: ::std::option::Option::None,
|
7463 + | empty_struct: ::std::option::Option::None,
|
7464 + | float: ::std::option::Option::None,
|
7465 + | httpdate_timestamp: ::std::option::Option::None,
|
7466 + | integer: ::std::option::Option::None,
|
7467 + | iso8601_timestamp: ::std::option::Option::None,
|
7468 + | json_value: ::std::option::Option::None,
|
7469 + | list_of_lists: ::std::option::Option::None,
|
7470 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7471 + | list_of_strings: ::std::option::Option::None,
|
7472 + | list_of_structs: ::std::option::Option::None,
|
7473 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7474 + | map_of_maps: ::std::option::Option::None,
|
7475 + | map_of_strings: ::std::option::Option::None,
|
7476 + | map_of_structs: ::std::option::Option::None,
|
7477 + | recursive_list: ::std::option::Option::None,
|
7478 + | recursive_map: ::std::option::Option::None,
|
7479 + | recursive_struct: ::std::option::Option::None,
|
7480 + | simple_struct: ::std::option::Option::None,
|
7481 + | string: ::std::option::Option::None,
|
7482 + | struct_with_json_name: ::std::option::Option::None,
|
7483 + | timestamp: ::std::option::Option::None,
|
7484 + | unix_timestamp: ::std::option::Option::None,
|
7485 + | };
|
7486 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
7487 + | let http_response = output.into_response();
|
7488 + | ::pretty_assertions::assert_eq!(
|
7489 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
7490 + | http_response.status()
|
7491 + | );
|
7492 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
7493 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7494 + | http_response.headers(),
|
7495 + | expected_headers,
|
7496 + | ));
|
7497 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7498 + | .await
|
7499 + | .expect("unable to extract body to bytes");
|
7500 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
7501 + | &body,
|
7502 + | "{\"Long\":1234567890123456789}",
|
7503 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
7504 + | ));
|
7505 + | }
|
7506 + |
|
7507 + | /// Parses float shapes
|
7508 + | /// Test ID: parses_float_shapes
|
7509 + | #[::tokio::test]
|
7510 + | #[::tracing_test::traced_test]
|
7511 + | async fn parses_float_shapes_response() {
|
7512 + | let output = crate::output::KitchenSinkOperationOutput {
|
7513 + | float: ::std::option::Option::Some(1234.5_f32),
|
7514 + | blob: ::std::option::Option::None,
|
7515 + | boolean: ::std::option::Option::None,
|
7516 + | double: ::std::option::Option::None,
|
7517 + | empty_struct: ::std::option::Option::None,
|
7518 + | httpdate_timestamp: ::std::option::Option::None,
|
7519 + | integer: ::std::option::Option::None,
|
7520 + | iso8601_timestamp: ::std::option::Option::None,
|
7521 + | json_value: ::std::option::Option::None,
|
7522 + | list_of_lists: ::std::option::Option::None,
|
7523 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7524 + | list_of_strings: ::std::option::Option::None,
|
7525 + | list_of_structs: ::std::option::Option::None,
|
7526 + | long: ::std::option::Option::None,
|
7527 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7528 + | map_of_maps: ::std::option::Option::None,
|
7529 + | map_of_strings: ::std::option::Option::None,
|
7530 + | map_of_structs: ::std::option::Option::None,
|
7531 + | recursive_list: ::std::option::Option::None,
|
7532 + | recursive_map: ::std::option::Option::None,
|
7533 + | recursive_struct: ::std::option::Option::None,
|
7534 + | simple_struct: ::std::option::Option::None,
|
7535 + | string: ::std::option::Option::None,
|
7536 + | struct_with_json_name: ::std::option::Option::None,
|
7537 + | timestamp: ::std::option::Option::None,
|
7538 + | unix_timestamp: ::std::option::Option::None,
|
7539 + | };
|
7540 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
7541 + | let http_response = output.into_response();
|
7542 + | ::pretty_assertions::assert_eq!(
|
7543 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
7544 + | http_response.status()
|
7545 + | );
|
7546 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
7547 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7548 + | http_response.headers(),
|
7549 + | expected_headers,
|
7550 + | ));
|
7551 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7552 + | .await
|
7553 + | .expect("unable to extract body to bytes");
|
7554 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
7555 + | &body,
|
7556 + | "{\"Float\":1234.5}",
|
7557 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
7558 + | ));
|
7559 + | }
|
7560 + |
|
7561 + | /// Parses double shapes
|
7562 + | /// Test ID: parses_double_shapes
|
7563 + | #[::tokio::test]
|
7564 + | #[::tracing_test::traced_test]
|
7565 + | async fn parses_double_shapes_response() {
|
7566 + | let output = crate::output::KitchenSinkOperationOutput {
|
7567 + | double: ::std::option::Option::Some(1.2345678912345679E8_f64),
|
7568 + | blob: ::std::option::Option::None,
|
7569 + | boolean: ::std::option::Option::None,
|
7570 + | empty_struct: ::std::option::Option::None,
|
7571 + | float: ::std::option::Option::None,
|
7572 + | httpdate_timestamp: ::std::option::Option::None,
|
7573 + | integer: ::std::option::Option::None,
|
7574 + | iso8601_timestamp: ::std::option::Option::None,
|
7575 + | json_value: ::std::option::Option::None,
|
7576 + | list_of_lists: ::std::option::Option::None,
|
7577 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7578 + | list_of_strings: ::std::option::Option::None,
|
7579 + | list_of_structs: ::std::option::Option::None,
|
7580 + | long: ::std::option::Option::None,
|
7581 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7582 + | map_of_maps: ::std::option::Option::None,
|
7583 + | map_of_strings: ::std::option::Option::None,
|
7584 + | map_of_structs: ::std::option::Option::None,
|
7585 + | recursive_list: ::std::option::Option::None,
|
7586 + | recursive_map: ::std::option::Option::None,
|
7587 + | recursive_struct: ::std::option::Option::None,
|
7588 + | simple_struct: ::std::option::Option::None,
|
7589 + | string: ::std::option::Option::None,
|
7590 + | struct_with_json_name: ::std::option::Option::None,
|
7591 + | timestamp: ::std::option::Option::None,
|
7592 + | unix_timestamp: ::std::option::Option::None,
|
7593 + | };
|
7594 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
7595 + | let http_response = output.into_response();
|
7596 + | ::pretty_assertions::assert_eq!(
|
7597 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
7598 + | http_response.status()
|
7599 + | );
|
7600 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
7601 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7602 + | http_response.headers(),
|
7603 + | expected_headers,
|
7604 + | ));
|
7605 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7606 + | .await
|
7607 + | .expect("unable to extract body to bytes");
|
7608 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
7609 + | &body,
|
7610 + | "{\"Double\":123456789.12345679}",
|
7611 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
7612 + | ));
|
7613 + | }
|
7614 + |
|
7615 + | /// Parses boolean shapes (true)
|
7616 + | /// Test ID: parses_boolean_shapes_true
|
7617 + | #[::tokio::test]
|
7618 + | #[::tracing_test::traced_test]
|
7619 + | async fn parses_boolean_shapes_true_response() {
|
7620 + | let output = crate::output::KitchenSinkOperationOutput {
|
7621 + | boolean: ::std::option::Option::Some(true),
|
7622 + | blob: ::std::option::Option::None,
|
7623 + | double: ::std::option::Option::None,
|
7624 + | empty_struct: ::std::option::Option::None,
|
7625 + | float: ::std::option::Option::None,
|
7626 + | httpdate_timestamp: ::std::option::Option::None,
|
7627 + | integer: ::std::option::Option::None,
|
7628 + | iso8601_timestamp: ::std::option::Option::None,
|
7629 + | json_value: ::std::option::Option::None,
|
7630 + | list_of_lists: ::std::option::Option::None,
|
7631 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7632 + | list_of_strings: ::std::option::Option::None,
|
7633 + | list_of_structs: ::std::option::Option::None,
|
7634 + | long: ::std::option::Option::None,
|
7635 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7636 + | map_of_maps: ::std::option::Option::None,
|
7637 + | map_of_strings: ::std::option::Option::None,
|
7638 + | map_of_structs: ::std::option::Option::None,
|
7639 + | recursive_list: ::std::option::Option::None,
|
7640 + | recursive_map: ::std::option::Option::None,
|
7641 + | recursive_struct: ::std::option::Option::None,
|
7642 + | simple_struct: ::std::option::Option::None,
|
7643 + | string: ::std::option::Option::None,
|
7644 + | struct_with_json_name: ::std::option::Option::None,
|
7645 + | timestamp: ::std::option::Option::None,
|
7646 + | unix_timestamp: ::std::option::Option::None,
|
7647 + | };
|
7648 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
7649 + | let http_response = output.into_response();
|
7650 + | ::pretty_assertions::assert_eq!(
|
7651 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
7652 + | http_response.status()
|
7653 + | );
|
7654 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
7655 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7656 + | http_response.headers(),
|
7657 + | expected_headers,
|
7658 + | ));
|
7659 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7660 + | .await
|
7661 + | .expect("unable to extract body to bytes");
|
7662 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
7663 + | &body,
|
7664 + | "{\"Boolean\":true}",
|
7665 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
7666 + | ));
|
7667 + | }
|
7668 + |
|
7669 + | /// Parses boolean (false)
|
7670 + | /// Test ID: parses_boolean_false
|
7671 + | #[::tokio::test]
|
7672 + | #[::tracing_test::traced_test]
|
7673 + | async fn parses_boolean_false_response() {
|
7674 + | let output = crate::output::KitchenSinkOperationOutput {
|
7675 + | boolean: ::std::option::Option::Some(false),
|
7676 + | blob: ::std::option::Option::None,
|
7677 + | double: ::std::option::Option::None,
|
7678 + | empty_struct: ::std::option::Option::None,
|
7679 + | float: ::std::option::Option::None,
|
7680 + | httpdate_timestamp: ::std::option::Option::None,
|
7681 + | integer: ::std::option::Option::None,
|
7682 + | iso8601_timestamp: ::std::option::Option::None,
|
7683 + | json_value: ::std::option::Option::None,
|
7684 + | list_of_lists: ::std::option::Option::None,
|
7685 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7686 + | list_of_strings: ::std::option::Option::None,
|
7687 + | list_of_structs: ::std::option::Option::None,
|
7688 + | long: ::std::option::Option::None,
|
7689 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7690 + | map_of_maps: ::std::option::Option::None,
|
7691 + | map_of_strings: ::std::option::Option::None,
|
7692 + | map_of_structs: ::std::option::Option::None,
|
7693 + | recursive_list: ::std::option::Option::None,
|
7694 + | recursive_map: ::std::option::Option::None,
|
7695 + | recursive_struct: ::std::option::Option::None,
|
7696 + | simple_struct: ::std::option::Option::None,
|
7697 + | string: ::std::option::Option::None,
|
7698 + | struct_with_json_name: ::std::option::Option::None,
|
7699 + | timestamp: ::std::option::Option::None,
|
7700 + | unix_timestamp: ::std::option::Option::None,
|
7701 + | };
|
7702 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
7703 + | let http_response = output.into_response();
|
7704 + | ::pretty_assertions::assert_eq!(
|
7705 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
7706 + | http_response.status()
|
7707 + | );
|
7708 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
7709 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7710 + | http_response.headers(),
|
7711 + | expected_headers,
|
7712 + | ));
|
7713 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7714 + | .await
|
7715 + | .expect("unable to extract body to bytes");
|
7716 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
7717 + | &body,
|
7718 + | "{\"Boolean\":false}",
|
7719 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
7720 + | ));
|
7721 + | }
|
7722 + |
|
7723 + | /// Parses blob shapes
|
7724 + | /// Test ID: parses_blob_shapes
|
7725 + | #[::tokio::test]
|
7726 + | #[::tracing_test::traced_test]
|
7727 + | async fn parses_blob_shapes_response() {
|
7728 + | let output = crate::output::KitchenSinkOperationOutput {
|
7729 + | blob: ::std::option::Option::Some(::aws_smithy_types::Blob::new("binary-value")),
|
7730 + | boolean: ::std::option::Option::None,
|
7731 + | double: ::std::option::Option::None,
|
7732 + | empty_struct: ::std::option::Option::None,
|
7733 + | float: ::std::option::Option::None,
|
7734 + | httpdate_timestamp: ::std::option::Option::None,
|
7735 + | integer: ::std::option::Option::None,
|
7736 + | iso8601_timestamp: ::std::option::Option::None,
|
7737 + | json_value: ::std::option::Option::None,
|
7738 + | list_of_lists: ::std::option::Option::None,
|
7739 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7740 + | list_of_strings: ::std::option::Option::None,
|
7741 + | list_of_structs: ::std::option::Option::None,
|
7742 + | long: ::std::option::Option::None,
|
7743 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7744 + | map_of_maps: ::std::option::Option::None,
|
7745 + | map_of_strings: ::std::option::Option::None,
|
7746 + | map_of_structs: ::std::option::Option::None,
|
7747 + | recursive_list: ::std::option::Option::None,
|
7748 + | recursive_map: ::std::option::Option::None,
|
7749 + | recursive_struct: ::std::option::Option::None,
|
7750 + | simple_struct: ::std::option::Option::None,
|
7751 + | string: ::std::option::Option::None,
|
7752 + | struct_with_json_name: ::std::option::Option::None,
|
7753 + | timestamp: ::std::option::Option::None,
|
7754 + | unix_timestamp: ::std::option::Option::None,
|
7755 + | };
|
7756 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
7757 + | let http_response = output.into_response();
|
7758 + | ::pretty_assertions::assert_eq!(
|
7759 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
7760 + | http_response.status()
|
7761 + | );
|
7762 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
7763 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7764 + | http_response.headers(),
|
7765 + | expected_headers,
|
7766 + | ));
|
7767 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
9164 7768 | .await
|
9165 - | .expect("unable to make an HTTP request");
|
9166 - | assert!(
|
9167 - | receiver.recv().await.is_some(),
|
9168 - | "we expected operation handler to be invoked but it was not entered"
|
7769 + | .expect("unable to extract body to bytes");
|
7770 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
7771 + | &body,
|
7772 + | "{\"Blob\":\"YmluYXJ5LXZhbHVl\"}",
|
7773 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
7774 + | ));
|
7775 + | }
|
7776 + |
|
7777 + | /// Parses timestamp shapes
|
7778 + | /// Test ID: parses_timestamp_shapes
|
7779 + | #[::tokio::test]
|
7780 + | #[::tracing_test::traced_test]
|
7781 + | async fn parses_timestamp_shapes_response() {
|
7782 + | let output = crate::output::KitchenSinkOperationOutput {
|
7783 + | timestamp: ::std::option::Option::Some(
|
7784 + | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
7785 + | ),
|
7786 + | blob: ::std::option::Option::None,
|
7787 + | boolean: ::std::option::Option::None,
|
7788 + | double: ::std::option::Option::None,
|
7789 + | empty_struct: ::std::option::Option::None,
|
7790 + | float: ::std::option::Option::None,
|
7791 + | httpdate_timestamp: ::std::option::Option::None,
|
7792 + | integer: ::std::option::Option::None,
|
7793 + | iso8601_timestamp: ::std::option::Option::None,
|
7794 + | json_value: ::std::option::Option::None,
|
7795 + | list_of_lists: ::std::option::Option::None,
|
7796 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7797 + | list_of_strings: ::std::option::Option::None,
|
7798 + | list_of_structs: ::std::option::Option::None,
|
7799 + | long: ::std::option::Option::None,
|
7800 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7801 + | map_of_maps: ::std::option::Option::None,
|
7802 + | map_of_strings: ::std::option::Option::None,
|
7803 + | map_of_structs: ::std::option::Option::None,
|
7804 + | recursive_list: ::std::option::Option::None,
|
7805 + | recursive_map: ::std::option::Option::None,
|
7806 + | recursive_struct: ::std::option::Option::None,
|
7807 + | simple_struct: ::std::option::Option::None,
|
7808 + | string: ::std::option::Option::None,
|
7809 + | struct_with_json_name: ::std::option::Option::None,
|
7810 + | unix_timestamp: ::std::option::Option::None,
|
7811 + | };
|
7812 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
7813 + | let http_response = output.into_response();
|
7814 + | ::pretty_assertions::assert_eq!(
|
7815 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
7816 + | http_response.status()
|
9169 7817 | );
|
7818 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
7819 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7820 + | http_response.headers(),
|
7821 + | expected_headers,
|
7822 + | ));
|
7823 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7824 + | .await
|
7825 + | .expect("unable to extract body to bytes");
|
7826 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
7827 + | &body,
|
7828 + | "{\"Timestamp\":946845296}",
|
7829 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
7830 + | ));
|
9170 7831 | }
|
9171 7832 |
|
9172 - | /// Serializes structure shapes
|
9173 - | /// Test ID: serializes_structure_shapes
|
7833 + | /// Parses iso8601 timestamps
|
7834 + | /// Test ID: parses_iso8601_timestamps
|
7835 + | #[::tokio::test]
|
7836 + | #[::tracing_test::traced_test]
|
7837 + | async fn parses_iso8601_timestamps_response() {
|
7838 + | let output = crate::output::KitchenSinkOperationOutput {
|
7839 + | iso8601_timestamp: ::std::option::Option::Some(
|
7840 + | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
7841 + | ),
|
7842 + | blob: ::std::option::Option::None,
|
7843 + | boolean: ::std::option::Option::None,
|
7844 + | double: ::std::option::Option::None,
|
7845 + | empty_struct: ::std::option::Option::None,
|
7846 + | float: ::std::option::Option::None,
|
7847 + | httpdate_timestamp: ::std::option::Option::None,
|
7848 + | integer: ::std::option::Option::None,
|
7849 + | json_value: ::std::option::Option::None,
|
7850 + | list_of_lists: ::std::option::Option::None,
|
7851 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7852 + | list_of_strings: ::std::option::Option::None,
|
7853 + | list_of_structs: ::std::option::Option::None,
|
7854 + | long: ::std::option::Option::None,
|
7855 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7856 + | map_of_maps: ::std::option::Option::None,
|
7857 + | map_of_strings: ::std::option::Option::None,
|
7858 + | map_of_structs: ::std::option::Option::None,
|
7859 + | recursive_list: ::std::option::Option::None,
|
7860 + | recursive_map: ::std::option::Option::None,
|
7861 + | recursive_struct: ::std::option::Option::None,
|
7862 + | simple_struct: ::std::option::Option::None,
|
7863 + | string: ::std::option::Option::None,
|
7864 + | struct_with_json_name: ::std::option::Option::None,
|
7865 + | timestamp: ::std::option::Option::None,
|
7866 + | unix_timestamp: ::std::option::Option::None,
|
7867 + | };
|
7868 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
7869 + | let http_response = output.into_response();
|
7870 + | ::pretty_assertions::assert_eq!(
|
7871 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
7872 + | http_response.status()
|
7873 + | );
|
7874 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
7875 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7876 + | http_response.headers(),
|
7877 + | expected_headers,
|
7878 + | ));
|
7879 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7880 + | .await
|
7881 + | .expect("unable to extract body to bytes");
|
7882 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
7883 + | &body,
|
7884 + | "{\"Iso8601Timestamp\":\"2000-01-02T20:34:56Z\"}",
|
7885 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
7886 + | ));
|
7887 + | }
|
7888 + |
|
7889 + | /// Parses httpdate timestamps
|
7890 + | /// Test ID: parses_httpdate_timestamps
|
7891 + | #[::tokio::test]
|
7892 + | #[::tracing_test::traced_test]
|
7893 + | async fn parses_httpdate_timestamps_response() {
|
7894 + | let output = crate::output::KitchenSinkOperationOutput {
|
7895 + | httpdate_timestamp: ::std::option::Option::Some(
|
7896 + | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
7897 + | ),
|
7898 + | blob: ::std::option::Option::None,
|
7899 + | boolean: ::std::option::Option::None,
|
7900 + | double: ::std::option::Option::None,
|
7901 + | empty_struct: ::std::option::Option::None,
|
7902 + | float: ::std::option::Option::None,
|
7903 + | integer: ::std::option::Option::None,
|
7904 + | iso8601_timestamp: ::std::option::Option::None,
|
7905 + | json_value: ::std::option::Option::None,
|
7906 + | list_of_lists: ::std::option::Option::None,
|
7907 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7908 + | list_of_strings: ::std::option::Option::None,
|
7909 + | list_of_structs: ::std::option::Option::None,
|
7910 + | long: ::std::option::Option::None,
|
7911 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7912 + | map_of_maps: ::std::option::Option::None,
|
7913 + | map_of_strings: ::std::option::Option::None,
|
7914 + | map_of_structs: ::std::option::Option::None,
|
7915 + | recursive_list: ::std::option::Option::None,
|
7916 + | recursive_map: ::std::option::Option::None,
|
7917 + | recursive_struct: ::std::option::Option::None,
|
7918 + | simple_struct: ::std::option::Option::None,
|
7919 + | string: ::std::option::Option::None,
|
7920 + | struct_with_json_name: ::std::option::Option::None,
|
7921 + | timestamp: ::std::option::Option::None,
|
7922 + | unix_timestamp: ::std::option::Option::None,
|
7923 + | };
|
7924 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
7925 + | let http_response = output.into_response();
|
7926 + | ::pretty_assertions::assert_eq!(
|
7927 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
7928 + | http_response.status()
|
7929 + | );
|
7930 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
7931 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7932 + | http_response.headers(),
|
7933 + | expected_headers,
|
7934 + | ));
|
7935 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7936 + | .await
|
7937 + | .expect("unable to extract body to bytes");
|
7938 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
7939 + | &body,
|
7940 + | "{\"HttpdateTimestamp\":\"Sun, 02 Jan 2000 20:34:56 GMT\"}",
|
7941 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
7942 + | ));
|
7943 + | }
|
7944 + |
|
7945 + | /// Parses list shapes
|
7946 + | /// Test ID: parses_list_shapes
|
7947 + | #[::tokio::test]
|
7948 + | #[::tracing_test::traced_test]
|
7949 + | async fn parses_list_shapes_response() {
|
7950 + | let output = crate::output::KitchenSinkOperationOutput {
|
7951 + | list_of_strings: ::std::option::Option::Some(vec![
|
7952 + | "abc".to_owned(),
|
7953 + | "mno".to_owned(),
|
7954 + | "xyz".to_owned(),
|
7955 + | ]),
|
7956 + | blob: ::std::option::Option::None,
|
7957 + | boolean: ::std::option::Option::None,
|
7958 + | double: ::std::option::Option::None,
|
7959 + | empty_struct: ::std::option::Option::None,
|
7960 + | float: ::std::option::Option::None,
|
7961 + | httpdate_timestamp: ::std::option::Option::None,
|
7962 + | integer: ::std::option::Option::None,
|
7963 + | iso8601_timestamp: ::std::option::Option::None,
|
7964 + | json_value: ::std::option::Option::None,
|
7965 + | list_of_lists: ::std::option::Option::None,
|
7966 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7967 + | list_of_structs: ::std::option::Option::None,
|
7968 + | long: ::std::option::Option::None,
|
7969 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7970 + | map_of_maps: ::std::option::Option::None,
|
7971 + | map_of_strings: ::std::option::Option::None,
|
7972 + | map_of_structs: ::std::option::Option::None,
|
7973 + | recursive_list: ::std::option::Option::None,
|
7974 + | recursive_map: ::std::option::Option::None,
|
7975 + | recursive_struct: ::std::option::Option::None,
|
7976 + | simple_struct: ::std::option::Option::None,
|
7977 + | string: ::std::option::Option::None,
|
7978 + | struct_with_json_name: ::std::option::Option::None,
|
7979 + | timestamp: ::std::option::Option::None,
|
7980 + | unix_timestamp: ::std::option::Option::None,
|
7981 + | };
|
7982 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
7983 + | let http_response = output.into_response();
|
7984 + | ::pretty_assertions::assert_eq!(
|
7985 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
7986 + | http_response.status()
|
7987 + | );
|
7988 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
7989 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7990 + | http_response.headers(),
|
7991 + | expected_headers,
|
7992 + | ));
|
7993 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7994 + | .await
|
7995 + | .expect("unable to extract body to bytes");
|
7996 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
7997 + | &body,
|
7998 + | "{\"ListOfStrings\":[\"abc\",\"mno\",\"xyz\"]}",
|
7999 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8000 + | ));
|
8001 + | }
|
8002 + |
|
8003 + | /// Parses list of map shapes
|
8004 + | /// Test ID: parses_list_of_map_shapes
|
9174 8005 | #[::tokio::test]
|
9175 8006 | #[::tracing_test::traced_test]
|
9176 - | async fn serializes_structure_shapes_request() {
|
9177 - | #[allow(unused_mut)]
|
9178 - | let mut http_request = ::http::Request::builder()
|
9179 - | .uri("/")
|
9180 - | .method("POST")
|
9181 - | .header("Content-Type", "application/x-amz-json-1.1")
|
9182 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
9183 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
9184 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
9185 - | "{\"SimpleStruct\":{\"Value\":\"abc\"}}".as_bytes(),
|
9186 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9187 - | )),
|
9188 - | ))
|
9189 - | .unwrap();
|
9190 - | #[allow(unused_mut)]
|
9191 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9192 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
9193 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9194 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
9195 - | let sender = sender.clone();
|
9196 - | async move {
|
9197 - | let result = {
|
9198 - | use ::aws_smithy_protocol_test::FloatEquals;
|
9199 - | let expected = crate::input::KitchenSinkOperationInput {
|
9200 - | simple_struct: ::std::option::Option::Some(
|
9201 - | crate::model::SimpleStruct {
|
9202 - | value: ::std::option::Option::Some("abc".to_owned()),
|
9203 - | },
|
9204 - | ),
|
9205 - | blob: ::std::option::Option::None,
|
9206 - | boolean: ::std::option::Option::None,
|
9207 - | double: ::std::option::Option::None,
|
9208 - | empty_struct: ::std::option::Option::None,
|
9209 - | float: ::std::option::Option::None,
|
9210 - | httpdate_timestamp: ::std::option::Option::None,
|
9211 - | integer: ::std::option::Option::None,
|
9212 - | iso8601_timestamp: ::std::option::Option::None,
|
9213 - | json_value: ::std::option::Option::None,
|
9214 - | list_of_lists: ::std::option::Option::None,
|
9215 - | list_of_maps_of_strings: ::std::option::Option::None,
|
9216 - | list_of_strings: ::std::option::Option::None,
|
9217 - | list_of_structs: ::std::option::Option::None,
|
9218 - | long: ::std::option::Option::None,
|
9219 - | map_of_lists_of_strings: ::std::option::Option::None,
|
9220 - | map_of_maps: ::std::option::Option::None,
|
9221 - | map_of_strings: ::std::option::Option::None,
|
9222 - | map_of_structs: ::std::option::Option::None,
|
9223 - | recursive_list: ::std::option::Option::None,
|
9224 - | recursive_map: ::std::option::Option::None,
|
9225 - | recursive_struct: ::std::option::Option::None,
|
9226 - | string: ::std::option::Option::None,
|
9227 - | struct_with_json_name: ::std::option::Option::None,
|
9228 - | timestamp: ::std::option::Option::None,
|
9229 - | unix_timestamp: ::std::option::Option::None,
|
9230 - | };
|
9231 - | ::pretty_assertions::assert_eq!(
|
9232 - | input.blob,
|
9233 - | expected.blob,
|
9234 - | "Unexpected value for `blob`"
|
9235 - | );
|
9236 - | ::pretty_assertions::assert_eq!(
|
9237 - | input.boolean,
|
9238 - | expected.boolean,
|
9239 - | "Unexpected value for `boolean`"
|
9240 - | );
|
9241 - | assert!(
|
9242 - | input.double.float_equals(&expected.double),
|
9243 - | "Unexpected value for `double` {:?} vs. {:?}",
|
9244 - | expected.double,
|
9245 - | input.double
|
9246 - | );
|
9247 - | ::pretty_assertions::assert_eq!(
|
9248 - | input.empty_struct,
|
9249 - | expected.empty_struct,
|
9250 - | "Unexpected value for `empty_struct`"
|
9251 - | );
|
9252 - | assert!(
|
9253 - | input.float.float_equals(&expected.float),
|
9254 - | "Unexpected value for `float` {:?} vs. {:?}",
|
9255 - | expected.float,
|
9256 - | input.float
|
9257 - | );
|
9258 - | ::pretty_assertions::assert_eq!(
|
9259 - | input.httpdate_timestamp,
|
9260 - | expected.httpdate_timestamp,
|
9261 - | "Unexpected value for `httpdate_timestamp`"
|
9262 - | );
|
9263 - | ::pretty_assertions::assert_eq!(
|
9264 - | input.integer,
|
9265 - | expected.integer,
|
9266 - | "Unexpected value for `integer`"
|
9267 - | );
|
9268 - | ::pretty_assertions::assert_eq!(
|
9269 - | input.iso8601_timestamp,
|
9270 - | expected.iso8601_timestamp,
|
9271 - | "Unexpected value for `iso8601_timestamp`"
|
9272 - | );
|
9273 - | ::pretty_assertions::assert_eq!(
|
9274 - | input.json_value,
|
9275 - | expected.json_value,
|
9276 - | "Unexpected value for `json_value`"
|
9277 - | );
|
9278 - | ::pretty_assertions::assert_eq!(
|
9279 - | input.list_of_lists,
|
9280 - | expected.list_of_lists,
|
9281 - | "Unexpected value for `list_of_lists`"
|
9282 - | );
|
9283 - | ::pretty_assertions::assert_eq!(
|
9284 - | input.list_of_maps_of_strings,
|
9285 - | expected.list_of_maps_of_strings,
|
9286 - | "Unexpected value for `list_of_maps_of_strings`"
|
9287 - | );
|
9288 - | ::pretty_assertions::assert_eq!(
|
9289 - | input.list_of_strings,
|
9290 - | expected.list_of_strings,
|
9291 - | "Unexpected value for `list_of_strings`"
|
9292 - | );
|
9293 - | ::pretty_assertions::assert_eq!(
|
9294 - | input.list_of_structs,
|
9295 - | expected.list_of_structs,
|
9296 - | "Unexpected value for `list_of_structs`"
|
9297 - | );
|
9298 - | ::pretty_assertions::assert_eq!(
|
9299 - | input.long,
|
9300 - | expected.long,
|
9301 - | "Unexpected value for `long`"
|
9302 - | );
|
9303 - | ::pretty_assertions::assert_eq!(
|
9304 - | input.map_of_lists_of_strings,
|
9305 - | expected.map_of_lists_of_strings,
|
9306 - | "Unexpected value for `map_of_lists_of_strings`"
|
9307 - | );
|
9308 - | ::pretty_assertions::assert_eq!(
|
9309 - | input.map_of_maps,
|
9310 - | expected.map_of_maps,
|
9311 - | "Unexpected value for `map_of_maps`"
|
9312 - | );
|
9313 - | ::pretty_assertions::assert_eq!(
|
9314 - | input.map_of_strings,
|
9315 - | expected.map_of_strings,
|
9316 - | "Unexpected value for `map_of_strings`"
|
9317 - | );
|
9318 - | ::pretty_assertions::assert_eq!(
|
9319 - | input.map_of_structs,
|
9320 - | expected.map_of_structs,
|
9321 - | "Unexpected value for `map_of_structs`"
|
9322 - | );
|
9323 - | ::pretty_assertions::assert_eq!(
|
9324 - | input.recursive_list,
|
9325 - | expected.recursive_list,
|
9326 - | "Unexpected value for `recursive_list`"
|
9327 - | );
|
9328 - | ::pretty_assertions::assert_eq!(
|
9329 - | input.recursive_map,
|
9330 - | expected.recursive_map,
|
9331 - | "Unexpected value for `recursive_map`"
|
9332 - | );
|
9333 - | ::pretty_assertions::assert_eq!(
|
9334 - | input.recursive_struct,
|
9335 - | expected.recursive_struct,
|
9336 - | "Unexpected value for `recursive_struct`"
|
9337 - | );
|
9338 - | ::pretty_assertions::assert_eq!(
|
9339 - | input.simple_struct,
|
9340 - | expected.simple_struct,
|
9341 - | "Unexpected value for `simple_struct`"
|
9342 - | );
|
9343 - | ::pretty_assertions::assert_eq!(
|
9344 - | input.string,
|
9345 - | expected.string,
|
9346 - | "Unexpected value for `string`"
|
9347 - | );
|
9348 - | ::pretty_assertions::assert_eq!(
|
9349 - | input.struct_with_json_name,
|
9350 - | expected.struct_with_json_name,
|
9351 - | "Unexpected value for `struct_with_json_name`"
|
9352 - | );
|
9353 - | ::pretty_assertions::assert_eq!(
|
9354 - | input.timestamp,
|
9355 - | expected.timestamp,
|
9356 - | "Unexpected value for `timestamp`"
|
9357 - | );
|
9358 - | ::pretty_assertions::assert_eq!(
|
9359 - | input.unix_timestamp,
|
9360 - | expected.unix_timestamp,
|
9361 - | "Unexpected value for `unix_timestamp`"
|
9362 - | );
|
9363 - | let output = crate::output::KitchenSinkOperationOutput {
|
9364 - | blob: ::std::option::Option::None,
|
9365 - | boolean: ::std::option::Option::None,
|
9366 - | double: ::std::option::Option::None,
|
9367 - | empty_struct: ::std::option::Option::None,
|
9368 - | float: ::std::option::Option::None,
|
9369 - | httpdate_timestamp: ::std::option::Option::None,
|
9370 - | integer: ::std::option::Option::None,
|
9371 - | iso8601_timestamp: ::std::option::Option::None,
|
9372 - | json_value: ::std::option::Option::None,
|
9373 - | list_of_lists: ::std::option::Option::None,
|
9374 - | list_of_maps_of_strings: ::std::option::Option::None,
|
9375 - | list_of_strings: ::std::option::Option::None,
|
9376 - | list_of_structs: ::std::option::Option::None,
|
9377 - | long: ::std::option::Option::None,
|
9378 - | map_of_lists_of_strings: ::std::option::Option::None,
|
9379 - | map_of_maps: ::std::option::Option::None,
|
9380 - | map_of_strings: ::std::option::Option::None,
|
9381 - | map_of_structs: ::std::option::Option::None,
|
9382 - | recursive_list: ::std::option::Option::None,
|
9383 - | recursive_map: ::std::option::Option::None,
|
9384 - | recursive_struct: ::std::option::Option::None,
|
9385 - | simple_struct: ::std::option::Option::None,
|
9386 - | string: ::std::option::Option::None,
|
9387 - | struct_with_json_name: ::std::option::Option::None,
|
9388 - | timestamp: ::std::option::Option::None,
|
9389 - | unix_timestamp: ::std::option::Option::None,
|
9390 - | };
|
9391 - | Ok(output)
|
9392 - | };
|
9393 - | sender.send(()).await.expect("receiver dropped early");
|
9394 - | result
|
9395 - | }
|
9396 - | })
|
9397 - | .build_unchecked();
|
9398 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8007 + | async fn parses_list_of_map_shapes_response() {
|
8008 + | let output = crate::output::KitchenSinkOperationOutput {
|
8009 + | list_of_maps_of_strings: ::std::option::Option::Some(vec![
|
8010 + | {
|
8011 + | let mut ret = ::std::collections::HashMap::new();
|
8012 + | ret.insert("size".to_owned(), "large".to_owned());
|
8013 + | ret
|
8014 + | },
|
8015 + | {
|
8016 + | let mut ret = ::std::collections::HashMap::new();
|
8017 + | ret.insert("color".to_owned(), "red".to_owned());
|
8018 + | ret
|
8019 + | },
|
8020 + | ]),
|
8021 + | blob: ::std::option::Option::None,
|
8022 + | boolean: ::std::option::Option::None,
|
8023 + | double: ::std::option::Option::None,
|
8024 + | empty_struct: ::std::option::Option::None,
|
8025 + | float: ::std::option::Option::None,
|
8026 + | httpdate_timestamp: ::std::option::Option::None,
|
8027 + | integer: ::std::option::Option::None,
|
8028 + | iso8601_timestamp: ::std::option::Option::None,
|
8029 + | json_value: ::std::option::Option::None,
|
8030 + | list_of_lists: ::std::option::Option::None,
|
8031 + | list_of_strings: ::std::option::Option::None,
|
8032 + | list_of_structs: ::std::option::Option::None,
|
8033 + | long: ::std::option::Option::None,
|
8034 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8035 + | map_of_maps: ::std::option::Option::None,
|
8036 + | map_of_strings: ::std::option::Option::None,
|
8037 + | map_of_structs: ::std::option::Option::None,
|
8038 + | recursive_list: ::std::option::Option::None,
|
8039 + | recursive_map: ::std::option::Option::None,
|
8040 + | recursive_struct: ::std::option::Option::None,
|
8041 + | simple_struct: ::std::option::Option::None,
|
8042 + | string: ::std::option::Option::None,
|
8043 + | struct_with_json_name: ::std::option::Option::None,
|
8044 + | timestamp: ::std::option::Option::None,
|
8045 + | unix_timestamp: ::std::option::Option::None,
|
8046 + | };
|
8047 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
8048 + | let http_response = output.into_response();
|
8049 + | ::pretty_assertions::assert_eq!(
|
8050 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8051 + | http_response.status()
|
8052 + | );
|
8053 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8054 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8055 + | http_response.headers(),
|
8056 + | expected_headers,
|
8057 + | ));
|
8058 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8059 + | .await
|
8060 + | .expect("unable to extract body to bytes");
|
8061 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8062 + | &body,
|
8063 + | "{\"ListOfMapsOfStrings\":[{\"size\":\"large\"},{\"color\":\"red\"}]}",
|
8064 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8065 + | ));
|
8066 + | }
|
8067 + |
|
8068 + | /// Parses list of list shapes
|
8069 + | /// Test ID: parses_list_of_list_shapes
|
8070 + | #[::tokio::test]
|
8071 + | #[::tracing_test::traced_test]
|
8072 + | async fn parses_list_of_list_shapes_response() {
|
8073 + | let output = crate::output::KitchenSinkOperationOutput {
|
8074 + | list_of_lists: ::std::option::Option::Some(vec![
|
8075 + | vec!["abc".to_owned(), "mno".to_owned(), "xyz".to_owned()],
|
8076 + | vec!["hjk".to_owned(), "qrs".to_owned(), "tuv".to_owned()],
|
8077 + | ]),
|
8078 + | blob: ::std::option::Option::None,
|
8079 + | boolean: ::std::option::Option::None,
|
8080 + | double: ::std::option::Option::None,
|
8081 + | empty_struct: ::std::option::Option::None,
|
8082 + | float: ::std::option::Option::None,
|
8083 + | httpdate_timestamp: ::std::option::Option::None,
|
8084 + | integer: ::std::option::Option::None,
|
8085 + | iso8601_timestamp: ::std::option::Option::None,
|
8086 + | json_value: ::std::option::Option::None,
|
8087 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8088 + | list_of_strings: ::std::option::Option::None,
|
8089 + | list_of_structs: ::std::option::Option::None,
|
8090 + | long: ::std::option::Option::None,
|
8091 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8092 + | map_of_maps: ::std::option::Option::None,
|
8093 + | map_of_strings: ::std::option::Option::None,
|
8094 + | map_of_structs: ::std::option::Option::None,
|
8095 + | recursive_list: ::std::option::Option::None,
|
8096 + | recursive_map: ::std::option::Option::None,
|
8097 + | recursive_struct: ::std::option::Option::None,
|
8098 + | simple_struct: ::std::option::Option::None,
|
8099 + | string: ::std::option::Option::None,
|
8100 + | struct_with_json_name: ::std::option::Option::None,
|
8101 + | timestamp: ::std::option::Option::None,
|
8102 + | unix_timestamp: ::std::option::Option::None,
|
8103 + | };
|
8104 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
8105 + | let http_response = output.into_response();
|
8106 + | ::pretty_assertions::assert_eq!(
|
8107 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8108 + | http_response.status()
|
8109 + | );
|
8110 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8111 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8112 + | http_response.headers(),
|
8113 + | expected_headers,
|
8114 + | ));
|
8115 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8116 + | .await
|
8117 + | .expect("unable to extract body to bytes");
|
8118 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8119 + | &body,
|
8120 + | "{\"ListOfLists\":[[\"abc\",\"mno\",\"xyz\"],[\"hjk\",\"qrs\",\"tuv\"]]}",
|
8121 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8122 + | ));
|
8123 + | }
|
8124 + |
|
8125 + | /// Parses list of structure shapes
|
8126 + | /// Test ID: parses_list_of_structure_shapes
|
8127 + | #[::tokio::test]
|
8128 + | #[::tracing_test::traced_test]
|
8129 + | async fn parses_list_of_structure_shapes_response() {
|
8130 + | let output = crate::output::KitchenSinkOperationOutput {
|
8131 + | list_of_structs: ::std::option::Option::Some(vec![
|
8132 + | crate::model::SimpleStruct {
|
8133 + | value: ::std::option::Option::Some("value-1".to_owned()),
|
8134 + | },
|
8135 + | crate::model::SimpleStruct {
|
8136 + | value: ::std::option::Option::Some("value-2".to_owned()),
|
8137 + | },
|
8138 + | ]),
|
8139 + | blob: ::std::option::Option::None,
|
8140 + | boolean: ::std::option::Option::None,
|
8141 + | double: ::std::option::Option::None,
|
8142 + | empty_struct: ::std::option::Option::None,
|
8143 + | float: ::std::option::Option::None,
|
8144 + | httpdate_timestamp: ::std::option::Option::None,
|
8145 + | integer: ::std::option::Option::None,
|
8146 + | iso8601_timestamp: ::std::option::Option::None,
|
8147 + | json_value: ::std::option::Option::None,
|
8148 + | list_of_lists: ::std::option::Option::None,
|
8149 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8150 + | list_of_strings: ::std::option::Option::None,
|
8151 + | long: ::std::option::Option::None,
|
8152 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8153 + | map_of_maps: ::std::option::Option::None,
|
8154 + | map_of_strings: ::std::option::Option::None,
|
8155 + | map_of_structs: ::std::option::Option::None,
|
8156 + | recursive_list: ::std::option::Option::None,
|
8157 + | recursive_map: ::std::option::Option::None,
|
8158 + | recursive_struct: ::std::option::Option::None,
|
8159 + | simple_struct: ::std::option::Option::None,
|
8160 + | string: ::std::option::Option::None,
|
8161 + | struct_with_json_name: ::std::option::Option::None,
|
8162 + | timestamp: ::std::option::Option::None,
|
8163 + | unix_timestamp: ::std::option::Option::None,
|
8164 + | };
|
8165 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
8166 + | let http_response = output.into_response();
|
8167 + | ::pretty_assertions::assert_eq!(
|
8168 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8169 + | http_response.status()
|
8170 + | );
|
8171 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8172 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8173 + | http_response.headers(),
|
8174 + | expected_headers,
|
8175 + | ));
|
8176 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8177 + | .await
|
8178 + | .expect("unable to extract body to bytes");
|
8179 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8180 + | &body,
|
8181 + | "{\"ListOfStructs\":[{\"Value\":\"value-1\"},{\"Value\":\"value-2\"}]}",
|
8182 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8183 + | ));
|
8184 + | }
|
8185 + |
|
8186 + | /// Parses list of recursive structure shapes
|
8187 + | /// Test ID: parses_list_of_recursive_structure_shapes
|
8188 + | #[::tokio::test]
|
8189 + | #[::tracing_test::traced_test]
|
8190 + | async fn parses_list_of_recursive_structure_shapes_response() {
|
8191 + | let output = crate::output::KitchenSinkOperationOutput {
|
8192 + | recursive_list: ::std::option::Option::Some(vec![crate::model::KitchenSink {
|
8193 + | recursive_list: ::std::option::Option::Some(vec![crate::model::KitchenSink {
|
8194 + | recursive_list: ::std::option::Option::Some(vec![crate::model::KitchenSink {
|
8195 + | string: ::std::option::Option::Some("value".to_owned()),
|
8196 + | blob: ::std::option::Option::None,
|
8197 + | boolean: ::std::option::Option::None,
|
8198 + | double: ::std::option::Option::None,
|
8199 + | empty_struct: ::std::option::Option::None,
|
8200 + | float: ::std::option::Option::None,
|
8201 + | httpdate_timestamp: ::std::option::Option::None,
|
8202 + | integer: ::std::option::Option::None,
|
8203 + | iso8601_timestamp: ::std::option::Option::None,
|
8204 + | json_value: ::std::option::Option::None,
|
8205 + | list_of_lists: ::std::option::Option::None,
|
8206 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8207 + | list_of_strings: ::std::option::Option::None,
|
8208 + | list_of_structs: ::std::option::Option::None,
|
8209 + | long: ::std::option::Option::None,
|
8210 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8211 + | map_of_maps: ::std::option::Option::None,
|
8212 + | map_of_strings: ::std::option::Option::None,
|
8213 + | map_of_structs: ::std::option::Option::None,
|
8214 + | recursive_list: ::std::option::Option::None,
|
8215 + | recursive_map: ::std::option::Option::None,
|
8216 + | recursive_struct: ::std::option::Option::None,
|
8217 + | simple_struct: ::std::option::Option::None,
|
8218 + | struct_with_json_name: ::std::option::Option::None,
|
8219 + | timestamp: ::std::option::Option::None,
|
8220 + | unix_timestamp: ::std::option::Option::None,
|
8221 + | }]),
|
8222 + | blob: ::std::option::Option::None,
|
8223 + | boolean: ::std::option::Option::None,
|
8224 + | double: ::std::option::Option::None,
|
8225 + | empty_struct: ::std::option::Option::None,
|
8226 + | float: ::std::option::Option::None,
|
8227 + | httpdate_timestamp: ::std::option::Option::None,
|
8228 + | integer: ::std::option::Option::None,
|
8229 + | iso8601_timestamp: ::std::option::Option::None,
|
8230 + | json_value: ::std::option::Option::None,
|
8231 + | list_of_lists: ::std::option::Option::None,
|
8232 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8233 + | list_of_strings: ::std::option::Option::None,
|
8234 + | list_of_structs: ::std::option::Option::None,
|
8235 + | long: ::std::option::Option::None,
|
8236 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8237 + | map_of_maps: ::std::option::Option::None,
|
8238 + | map_of_strings: ::std::option::Option::None,
|
8239 + | map_of_structs: ::std::option::Option::None,
|
8240 + | recursive_map: ::std::option::Option::None,
|
8241 + | recursive_struct: ::std::option::Option::None,
|
8242 + | simple_struct: ::std::option::Option::None,
|
8243 + | string: ::std::option::Option::None,
|
8244 + | struct_with_json_name: ::std::option::Option::None,
|
8245 + | timestamp: ::std::option::Option::None,
|
8246 + | unix_timestamp: ::std::option::Option::None,
|
8247 + | }]),
|
8248 + | blob: ::std::option::Option::None,
|
8249 + | boolean: ::std::option::Option::None,
|
8250 + | double: ::std::option::Option::None,
|
8251 + | empty_struct: ::std::option::Option::None,
|
8252 + | float: ::std::option::Option::None,
|
8253 + | httpdate_timestamp: ::std::option::Option::None,
|
8254 + | integer: ::std::option::Option::None,
|
8255 + | iso8601_timestamp: ::std::option::Option::None,
|
8256 + | json_value: ::std::option::Option::None,
|
8257 + | list_of_lists: ::std::option::Option::None,
|
8258 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8259 + | list_of_strings: ::std::option::Option::None,
|
8260 + | list_of_structs: ::std::option::Option::None,
|
8261 + | long: ::std::option::Option::None,
|
8262 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8263 + | map_of_maps: ::std::option::Option::None,
|
8264 + | map_of_strings: ::std::option::Option::None,
|
8265 + | map_of_structs: ::std::option::Option::None,
|
8266 + | recursive_map: ::std::option::Option::None,
|
8267 + | recursive_struct: ::std::option::Option::None,
|
8268 + | simple_struct: ::std::option::Option::None,
|
8269 + | string: ::std::option::Option::None,
|
8270 + | struct_with_json_name: ::std::option::Option::None,
|
8271 + | timestamp: ::std::option::Option::None,
|
8272 + | unix_timestamp: ::std::option::Option::None,
|
8273 + | }]),
|
8274 + | blob: ::std::option::Option::None,
|
8275 + | boolean: ::std::option::Option::None,
|
8276 + | double: ::std::option::Option::None,
|
8277 + | empty_struct: ::std::option::Option::None,
|
8278 + | float: ::std::option::Option::None,
|
8279 + | httpdate_timestamp: ::std::option::Option::None,
|
8280 + | integer: ::std::option::Option::None,
|
8281 + | iso8601_timestamp: ::std::option::Option::None,
|
8282 + | json_value: ::std::option::Option::None,
|
8283 + | list_of_lists: ::std::option::Option::None,
|
8284 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8285 + | list_of_strings: ::std::option::Option::None,
|
8286 + | list_of_structs: ::std::option::Option::None,
|
8287 + | long: ::std::option::Option::None,
|
8288 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8289 + | map_of_maps: ::std::option::Option::None,
|
8290 + | map_of_strings: ::std::option::Option::None,
|
8291 + | map_of_structs: ::std::option::Option::None,
|
8292 + | recursive_map: ::std::option::Option::None,
|
8293 + | recursive_struct: ::std::option::Option::None,
|
8294 + | simple_struct: ::std::option::Option::None,
|
8295 + | string: ::std::option::Option::None,
|
8296 + | struct_with_json_name: ::std::option::Option::None,
|
8297 + | timestamp: ::std::option::Option::None,
|
8298 + | unix_timestamp: ::std::option::Option::None,
|
8299 + | };
|
8300 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
8301 + | let http_response = output.into_response();
|
8302 + | ::pretty_assertions::assert_eq!(
|
8303 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8304 + | http_response.status()
|
8305 + | );
|
8306 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8307 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8308 + | http_response.headers(),
|
8309 + | expected_headers,
|
8310 + | ));
|
8311 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
9399 8312 | .await
|
9400 - | .expect("unable to make an HTTP request");
|
9401 - | assert!(
|
9402 - | receiver.recv().await.is_some(),
|
9403 - | "we expected operation handler to be invoked but it was not entered"
|
8313 + | .expect("unable to extract body to bytes");
|
8314 + | ::aws_smithy_protocol_test::assert_ok(
|
8315 + | ::aws_smithy_protocol_test::validate_body(&body, "{\"RecursiveList\":[{\"RecursiveList\":[{\"RecursiveList\":[{\"String\":\"value\"}]}]}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
8316 + | );
|
8317 + | }
|
8318 + |
|
8319 + | /// Parses map shapes
|
8320 + | /// Test ID: parses_map_shapes
|
8321 + | #[::tokio::test]
|
8322 + | #[::tracing_test::traced_test]
|
8323 + | async fn parses_map_shapes_response() {
|
8324 + | let output = crate::output::KitchenSinkOperationOutput {
|
8325 + | map_of_strings: ::std::option::Option::Some({
|
8326 + | let mut ret = ::std::collections::HashMap::new();
|
8327 + | ret.insert("size".to_owned(), "large".to_owned());
|
8328 + | ret.insert("color".to_owned(), "red".to_owned());
|
8329 + | ret
|
8330 + | }),
|
8331 + | blob: ::std::option::Option::None,
|
8332 + | boolean: ::std::option::Option::None,
|
8333 + | double: ::std::option::Option::None,
|
8334 + | empty_struct: ::std::option::Option::None,
|
8335 + | float: ::std::option::Option::None,
|
8336 + | httpdate_timestamp: ::std::option::Option::None,
|
8337 + | integer: ::std::option::Option::None,
|
8338 + | iso8601_timestamp: ::std::option::Option::None,
|
8339 + | json_value: ::std::option::Option::None,
|
8340 + | list_of_lists: ::std::option::Option::None,
|
8341 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8342 + | list_of_strings: ::std::option::Option::None,
|
8343 + | list_of_structs: ::std::option::Option::None,
|
8344 + | long: ::std::option::Option::None,
|
8345 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8346 + | map_of_maps: ::std::option::Option::None,
|
8347 + | map_of_structs: ::std::option::Option::None,
|
8348 + | recursive_list: ::std::option::Option::None,
|
8349 + | recursive_map: ::std::option::Option::None,
|
8350 + | recursive_struct: ::std::option::Option::None,
|
8351 + | simple_struct: ::std::option::Option::None,
|
8352 + | string: ::std::option::Option::None,
|
8353 + | struct_with_json_name: ::std::option::Option::None,
|
8354 + | timestamp: ::std::option::Option::None,
|
8355 + | unix_timestamp: ::std::option::Option::None,
|
8356 + | };
|
8357 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
8358 + | let http_response = output.into_response();
|
8359 + | ::pretty_assertions::assert_eq!(
|
8360 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8361 + | http_response.status()
|
8362 + | );
|
8363 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8364 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8365 + | http_response.headers(),
|
8366 + | expected_headers,
|
8367 + | ));
|
8368 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8369 + | .await
|
8370 + | .expect("unable to extract body to bytes");
|
8371 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8372 + | &body,
|
8373 + | "{\"MapOfStrings\":{\"size\":\"large\",\"color\":\"red\"}}",
|
8374 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8375 + | ));
|
8376 + | }
|
8377 + |
|
8378 + | /// Parses map of list shapes
|
8379 + | /// Test ID: parses_map_of_list_shapes
|
8380 + | #[::tokio::test]
|
8381 + | #[::tracing_test::traced_test]
|
8382 + | async fn parses_map_of_list_shapes_response() {
|
8383 + | let output = crate::output::KitchenSinkOperationOutput {
|
8384 + | map_of_lists_of_strings: ::std::option::Option::Some({
|
8385 + | let mut ret = ::std::collections::HashMap::new();
|
8386 + | ret.insert(
|
8387 + | "sizes".to_owned(),
|
8388 + | vec!["large".to_owned(), "small".to_owned()],
|
8389 + | );
|
8390 + | ret.insert(
|
8391 + | "colors".to_owned(),
|
8392 + | vec!["red".to_owned(), "green".to_owned()],
|
8393 + | );
|
8394 + | ret
|
8395 + | }),
|
8396 + | blob: ::std::option::Option::None,
|
8397 + | boolean: ::std::option::Option::None,
|
8398 + | double: ::std::option::Option::None,
|
8399 + | empty_struct: ::std::option::Option::None,
|
8400 + | float: ::std::option::Option::None,
|
8401 + | httpdate_timestamp: ::std::option::Option::None,
|
8402 + | integer: ::std::option::Option::None,
|
8403 + | iso8601_timestamp: ::std::option::Option::None,
|
8404 + | json_value: ::std::option::Option::None,
|
8405 + | list_of_lists: ::std::option::Option::None,
|
8406 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8407 + | list_of_strings: ::std::option::Option::None,
|
8408 + | list_of_structs: ::std::option::Option::None,
|
8409 + | long: ::std::option::Option::None,
|
8410 + | map_of_maps: ::std::option::Option::None,
|
8411 + | map_of_strings: ::std::option::Option::None,
|
8412 + | map_of_structs: ::std::option::Option::None,
|
8413 + | recursive_list: ::std::option::Option::None,
|
8414 + | recursive_map: ::std::option::Option::None,
|
8415 + | recursive_struct: ::std::option::Option::None,
|
8416 + | simple_struct: ::std::option::Option::None,
|
8417 + | string: ::std::option::Option::None,
|
8418 + | struct_with_json_name: ::std::option::Option::None,
|
8419 + | timestamp: ::std::option::Option::None,
|
8420 + | unix_timestamp: ::std::option::Option::None,
|
8421 + | };
|
8422 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
8423 + | let http_response = output.into_response();
|
8424 + | ::pretty_assertions::assert_eq!(
|
8425 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8426 + | http_response.status()
|
8427 + | );
|
8428 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8429 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8430 + | http_response.headers(),
|
8431 + | expected_headers,
|
8432 + | ));
|
8433 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8434 + | .await
|
8435 + | .expect("unable to extract body to bytes");
|
8436 + | ::aws_smithy_protocol_test::assert_ok(
|
8437 + | ::aws_smithy_protocol_test::validate_body(&body, "{\"MapOfListsOfStrings\":{\"sizes\":[\"large\",\"small\"],\"colors\":[\"red\",\"green\"]}}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
8438 + | );
|
8439 + | }
|
8440 + |
|
8441 + | /// Parses map of map shapes
|
8442 + | /// Test ID: parses_map_of_map_shapes
|
8443 + | #[::tokio::test]
|
8444 + | #[::tracing_test::traced_test]
|
8445 + | async fn parses_map_of_map_shapes_response() {
|
8446 + | let output = crate::output::KitchenSinkOperationOutput {
|
8447 + | map_of_maps: ::std::option::Option::Some({
|
8448 + | let mut ret = ::std::collections::HashMap::new();
|
8449 + | ret.insert("sizes".to_owned(), {
|
8450 + | let mut ret = ::std::collections::HashMap::new();
|
8451 + | ret.insert("large".to_owned(), "L".to_owned());
|
8452 + | ret.insert("medium".to_owned(), "M".to_owned());
|
8453 + | ret
|
8454 + | });
|
8455 + | ret.insert("colors".to_owned(), {
|
8456 + | let mut ret = ::std::collections::HashMap::new();
|
8457 + | ret.insert("red".to_owned(), "R".to_owned());
|
8458 + | ret.insert("blue".to_owned(), "B".to_owned());
|
8459 + | ret
|
8460 + | });
|
8461 + | ret
|
8462 + | }),
|
8463 + | blob: ::std::option::Option::None,
|
8464 + | boolean: ::std::option::Option::None,
|
8465 + | double: ::std::option::Option::None,
|
8466 + | empty_struct: ::std::option::Option::None,
|
8467 + | float: ::std::option::Option::None,
|
8468 + | httpdate_timestamp: ::std::option::Option::None,
|
8469 + | integer: ::std::option::Option::None,
|
8470 + | iso8601_timestamp: ::std::option::Option::None,
|
8471 + | json_value: ::std::option::Option::None,
|
8472 + | list_of_lists: ::std::option::Option::None,
|
8473 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8474 + | list_of_strings: ::std::option::Option::None,
|
8475 + | list_of_structs: ::std::option::Option::None,
|
8476 + | long: ::std::option::Option::None,
|
8477 + | map_of_lists_of_strings: ::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 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
8490 + | let http_response = output.into_response();
|
8491 + | ::pretty_assertions::assert_eq!(
|
8492 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8493 + | http_response.status()
|
8494 + | );
|
8495 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8496 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8497 + | http_response.headers(),
|
8498 + | expected_headers,
|
8499 + | ));
|
8500 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8501 + | .await
|
8502 + | .expect("unable to extract body to bytes");
|
8503 + | ::aws_smithy_protocol_test::assert_ok(
|
8504 + | ::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"))
|
8505 + | );
|
8506 + | }
|
8507 + |
|
8508 + | /// Parses map of structure shapes
|
8509 + | /// Test ID: parses_map_of_structure_shapes
|
8510 + | #[::tokio::test]
|
8511 + | #[::tracing_test::traced_test]
|
8512 + | async fn parses_map_of_structure_shapes_response() {
|
8513 + | let output = crate::output::KitchenSinkOperationOutput {
|
8514 + | map_of_structs: ::std::option::Option::Some({
|
8515 + | let mut ret = ::std::collections::HashMap::new();
|
8516 + | ret.insert(
|
8517 + | "size".to_owned(),
|
8518 + | crate::model::SimpleStruct {
|
8519 + | value: ::std::option::Option::Some("small".to_owned()),
|
8520 + | },
|
8521 + | );
|
8522 + | ret.insert(
|
8523 + | "color".to_owned(),
|
8524 + | crate::model::SimpleStruct {
|
8525 + | value: ::std::option::Option::Some("red".to_owned()),
|
8526 + | },
|
8527 + | );
|
8528 + | ret
|
8529 + | }),
|
8530 + | blob: ::std::option::Option::None,
|
8531 + | boolean: ::std::option::Option::None,
|
8532 + | double: ::std::option::Option::None,
|
8533 + | empty_struct: ::std::option::Option::None,
|
8534 + | float: ::std::option::Option::None,
|
8535 + | httpdate_timestamp: ::std::option::Option::None,
|
8536 + | integer: ::std::option::Option::None,
|
8537 + | iso8601_timestamp: ::std::option::Option::None,
|
8538 + | json_value: ::std::option::Option::None,
|
8539 + | list_of_lists: ::std::option::Option::None,
|
8540 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8541 + | list_of_strings: ::std::option::Option::None,
|
8542 + | list_of_structs: ::std::option::Option::None,
|
8543 + | long: ::std::option::Option::None,
|
8544 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8545 + | map_of_maps: ::std::option::Option::None,
|
8546 + | map_of_strings: ::std::option::Option::None,
|
8547 + | recursive_list: ::std::option::Option::None,
|
8548 + | recursive_map: ::std::option::Option::None,
|
8549 + | recursive_struct: ::std::option::Option::None,
|
8550 + | simple_struct: ::std::option::Option::None,
|
8551 + | string: ::std::option::Option::None,
|
8552 + | struct_with_json_name: ::std::option::Option::None,
|
8553 + | timestamp: ::std::option::Option::None,
|
8554 + | unix_timestamp: ::std::option::Option::None,
|
8555 + | };
|
8556 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
8557 + | let http_response = output.into_response();
|
8558 + | ::pretty_assertions::assert_eq!(
|
8559 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8560 + | http_response.status()
|
9404 8561 | );
|
9405 - | }
|
9406 - |
|
9407 - | /// Serializes structure members with locationName traits
|
9408 - | /// Test ID: serializes_structure_members_with_locationname_traits
|
9409 - | #[::tokio::test]
|
9410 - | #[::tracing_test::traced_test]
|
9411 - | async fn serializes_structure_members_with_locationname_traits_request() {
|
9412 - | #[allow(unused_mut)]
|
9413 - | let mut http_request = ::http::Request::builder()
|
9414 - | .uri("/")
|
9415 - | .method("POST")
|
9416 - | .header("Content-Type", "application/x-amz-json-1.1")
|
9417 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
9418 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
9419 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
9420 - | "{\"StructWithJsonName\":{\"Value\":\"some-value\"}}".as_bytes(),
|
9421 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9422 - | )),
|
9423 - | ))
|
9424 - | .unwrap();
|
9425 - | #[allow(unused_mut)]
|
9426 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9427 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
9428 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9429 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
9430 - | let sender = sender.clone();
|
9431 - | async move {
|
9432 - | let result = {
|
9433 - | use ::aws_smithy_protocol_test::FloatEquals;
|
9434 - | let expected = crate::input::KitchenSinkOperationInput {
|
9435 - | struct_with_json_name: ::std::option::Option::Some(
|
9436 - | crate::model::StructWithJsonName {
|
9437 - | value: ::std::option::Option::Some("some-value".to_owned()),
|
9438 - | },
|
9439 - | ),
|
9440 - | blob: ::std::option::Option::None,
|
9441 - | boolean: ::std::option::Option::None,
|
9442 - | double: ::std::option::Option::None,
|
9443 - | empty_struct: ::std::option::Option::None,
|
9444 - | float: ::std::option::Option::None,
|
9445 - | httpdate_timestamp: ::std::option::Option::None,
|
9446 - | integer: ::std::option::Option::None,
|
9447 - | iso8601_timestamp: ::std::option::Option::None,
|
9448 - | json_value: ::std::option::Option::None,
|
9449 - | list_of_lists: ::std::option::Option::None,
|
9450 - | list_of_maps_of_strings: ::std::option::Option::None,
|
9451 - | list_of_strings: ::std::option::Option::None,
|
9452 - | list_of_structs: ::std::option::Option::None,
|
9453 - | long: ::std::option::Option::None,
|
9454 - | map_of_lists_of_strings: ::std::option::Option::None,
|
9455 - | map_of_maps: ::std::option::Option::None,
|
9456 - | map_of_strings: ::std::option::Option::None,
|
9457 - | map_of_structs: ::std::option::Option::None,
|
9458 - | recursive_list: ::std::option::Option::None,
|
9459 - | recursive_map: ::std::option::Option::None,
|
9460 - | recursive_struct: ::std::option::Option::None,
|
9461 - | simple_struct: ::std::option::Option::None,
|
9462 - | string: ::std::option::Option::None,
|
9463 - | timestamp: ::std::option::Option::None,
|
9464 - | unix_timestamp: ::std::option::Option::None,
|
9465 - | };
|
9466 - | ::pretty_assertions::assert_eq!(
|
9467 - | input.blob,
|
9468 - | expected.blob,
|
9469 - | "Unexpected value for `blob`"
|
9470 - | );
|
9471 - | ::pretty_assertions::assert_eq!(
|
9472 - | input.boolean,
|
9473 - | expected.boolean,
|
9474 - | "Unexpected value for `boolean`"
|
9475 - | );
|
9476 - | assert!(
|
9477 - | input.double.float_equals(&expected.double),
|
9478 - | "Unexpected value for `double` {:?} vs. {:?}",
|
9479 - | expected.double,
|
9480 - | input.double
|
9481 - | );
|
9482 - | ::pretty_assertions::assert_eq!(
|
9483 - | input.empty_struct,
|
9484 - | expected.empty_struct,
|
9485 - | "Unexpected value for `empty_struct`"
|
9486 - | );
|
9487 - | assert!(
|
9488 - | input.float.float_equals(&expected.float),
|
9489 - | "Unexpected value for `float` {:?} vs. {:?}",
|
9490 - | expected.float,
|
9491 - | input.float
|
9492 - | );
|
9493 - | ::pretty_assertions::assert_eq!(
|
9494 - | input.httpdate_timestamp,
|
9495 - | expected.httpdate_timestamp,
|
9496 - | "Unexpected value for `httpdate_timestamp`"
|
9497 - | );
|
9498 - | ::pretty_assertions::assert_eq!(
|
9499 - | input.integer,
|
9500 - | expected.integer,
|
9501 - | "Unexpected value for `integer`"
|
9502 - | );
|
9503 - | ::pretty_assertions::assert_eq!(
|
9504 - | input.iso8601_timestamp,
|
9505 - | expected.iso8601_timestamp,
|
9506 - | "Unexpected value for `iso8601_timestamp`"
|
9507 - | );
|
9508 - | ::pretty_assertions::assert_eq!(
|
9509 - | input.json_value,
|
9510 - | expected.json_value,
|
9511 - | "Unexpected value for `json_value`"
|
9512 - | );
|
9513 - | ::pretty_assertions::assert_eq!(
|
9514 - | input.list_of_lists,
|
9515 - | expected.list_of_lists,
|
9516 - | "Unexpected value for `list_of_lists`"
|
9517 - | );
|
9518 - | ::pretty_assertions::assert_eq!(
|
9519 - | input.list_of_maps_of_strings,
|
9520 - | expected.list_of_maps_of_strings,
|
9521 - | "Unexpected value for `list_of_maps_of_strings`"
|
9522 - | );
|
9523 - | ::pretty_assertions::assert_eq!(
|
9524 - | input.list_of_strings,
|
9525 - | expected.list_of_strings,
|
9526 - | "Unexpected value for `list_of_strings`"
|
9527 - | );
|
9528 - | ::pretty_assertions::assert_eq!(
|
9529 - | input.list_of_structs,
|
9530 - | expected.list_of_structs,
|
9531 - | "Unexpected value for `list_of_structs`"
|
9532 - | );
|
9533 - | ::pretty_assertions::assert_eq!(
|
9534 - | input.long,
|
9535 - | expected.long,
|
9536 - | "Unexpected value for `long`"
|
9537 - | );
|
9538 - | ::pretty_assertions::assert_eq!(
|
9539 - | input.map_of_lists_of_strings,
|
9540 - | expected.map_of_lists_of_strings,
|
9541 - | "Unexpected value for `map_of_lists_of_strings`"
|
9542 - | );
|
9543 - | ::pretty_assertions::assert_eq!(
|
9544 - | input.map_of_maps,
|
9545 - | expected.map_of_maps,
|
9546 - | "Unexpected value for `map_of_maps`"
|
9547 - | );
|
9548 - | ::pretty_assertions::assert_eq!(
|
9549 - | input.map_of_strings,
|
9550 - | expected.map_of_strings,
|
9551 - | "Unexpected value for `map_of_strings`"
|
9552 - | );
|
9553 - | ::pretty_assertions::assert_eq!(
|
9554 - | input.map_of_structs,
|
9555 - | expected.map_of_structs,
|
9556 - | "Unexpected value for `map_of_structs`"
|
9557 - | );
|
9558 - | ::pretty_assertions::assert_eq!(
|
9559 - | input.recursive_list,
|
9560 - | expected.recursive_list,
|
9561 - | "Unexpected value for `recursive_list`"
|
9562 - | );
|
9563 - | ::pretty_assertions::assert_eq!(
|
9564 - | input.recursive_map,
|
9565 - | expected.recursive_map,
|
9566 - | "Unexpected value for `recursive_map`"
|
9567 - | );
|
9568 - | ::pretty_assertions::assert_eq!(
|
9569 - | input.recursive_struct,
|
9570 - | expected.recursive_struct,
|
9571 - | "Unexpected value for `recursive_struct`"
|
9572 - | );
|
9573 - | ::pretty_assertions::assert_eq!(
|
9574 - | input.simple_struct,
|
9575 - | expected.simple_struct,
|
9576 - | "Unexpected value for `simple_struct`"
|
9577 - | );
|
9578 - | ::pretty_assertions::assert_eq!(
|
9579 - | input.string,
|
9580 - | expected.string,
|
9581 - | "Unexpected value for `string`"
|
9582 - | );
|
9583 - | ::pretty_assertions::assert_eq!(
|
9584 - | input.struct_with_json_name,
|
9585 - | expected.struct_with_json_name,
|
9586 - | "Unexpected value for `struct_with_json_name`"
|
9587 - | );
|
9588 - | ::pretty_assertions::assert_eq!(
|
9589 - | input.timestamp,
|
9590 - | expected.timestamp,
|
9591 - | "Unexpected value for `timestamp`"
|
9592 - | );
|
9593 - | ::pretty_assertions::assert_eq!(
|
9594 - | input.unix_timestamp,
|
9595 - | expected.unix_timestamp,
|
9596 - | "Unexpected value for `unix_timestamp`"
|
9597 - | );
|
9598 - | let output = crate::output::KitchenSinkOperationOutput {
|
9599 - | blob: ::std::option::Option::None,
|
9600 - | boolean: ::std::option::Option::None,
|
9601 - | double: ::std::option::Option::None,
|
9602 - | empty_struct: ::std::option::Option::None,
|
9603 - | float: ::std::option::Option::None,
|
9604 - | httpdate_timestamp: ::std::option::Option::None,
|
9605 - | integer: ::std::option::Option::None,
|
9606 - | iso8601_timestamp: ::std::option::Option::None,
|
9607 - | json_value: ::std::option::Option::None,
|
9608 - | list_of_lists: ::std::option::Option::None,
|
9609 - | list_of_maps_of_strings: ::std::option::Option::None,
|
9610 - | list_of_strings: ::std::option::Option::None,
|
9611 - | list_of_structs: ::std::option::Option::None,
|
9612 - | long: ::std::option::Option::None,
|
9613 - | map_of_lists_of_strings: ::std::option::Option::None,
|
9614 - | map_of_maps: ::std::option::Option::None,
|
9615 - | map_of_strings: ::std::option::Option::None,
|
9616 - | map_of_structs: ::std::option::Option::None,
|
9617 - | recursive_list: ::std::option::Option::None,
|
9618 - | recursive_map: ::std::option::Option::None,
|
9619 - | recursive_struct: ::std::option::Option::None,
|
9620 - | simple_struct: ::std::option::Option::None,
|
9621 - | string: ::std::option::Option::None,
|
9622 - | struct_with_json_name: ::std::option::Option::None,
|
9623 - | timestamp: ::std::option::Option::None,
|
9624 - | unix_timestamp: ::std::option::Option::None,
|
9625 - | };
|
9626 - | Ok(output)
|
9627 - | };
|
9628 - | sender.send(()).await.expect("receiver dropped early");
|
9629 - | result
|
9630 - | }
|
9631 - | })
|
9632 - | .build_unchecked();
|
9633 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8562 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8563 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8564 + | http_response.headers(),
|
8565 + | expected_headers,
|
8566 + | ));
|
8567 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8568 + | .await
|
8569 + | .expect("unable to extract body to bytes");
|
8570 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8571 + | &body,
|
8572 + | "{\"MapOfStructs\":{\"size\":{\"Value\":\"small\"},\"color\":{\"Value\":\"red\"}}}",
|
8573 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8574 + | ));
|
8575 + | }
|
8576 + |
|
8577 + | /// Parses map of recursive structure shapes
|
8578 + | /// Test ID: parses_map_of_recursive_structure_shapes
|
8579 + | #[::tokio::test]
|
8580 + | #[::tracing_test::traced_test]
|
8581 + | async fn parses_map_of_recursive_structure_shapes_response() {
|
8582 + | let output = crate::output::KitchenSinkOperationOutput {
|
8583 + | recursive_map: ::std::option::Option::Some({
|
8584 + | let mut ret = ::std::collections::HashMap::new();
|
8585 + | ret.insert(
|
8586 + | "key-1".to_owned(),
|
8587 + | crate::model::KitchenSink {
|
8588 + | recursive_map: ::std::option::Option::Some({
|
8589 + | let mut ret = ::std::collections::HashMap::new();
|
8590 + | ret.insert(
|
8591 + | "key-2".to_owned(),
|
8592 + | crate::model::KitchenSink {
|
8593 + | recursive_map: ::std::option::Option::Some({
|
8594 + | let mut ret = ::std::collections::HashMap::new();
|
8595 + | ret.insert(
|
8596 + | "key-3".to_owned(),
|
8597 + | crate::model::KitchenSink {
|
8598 + | string: ::std::option::Option::Some(
|
8599 + | "value".to_owned(),
|
8600 + | ),
|
8601 + | blob: ::std::option::Option::None,
|
8602 + | boolean: ::std::option::Option::None,
|
8603 + | double: ::std::option::Option::None,
|
8604 + | empty_struct: ::std::option::Option::None,
|
8605 + | float: ::std::option::Option::None,
|
8606 + | httpdate_timestamp: ::std::option::Option::None,
|
8607 + | integer: ::std::option::Option::None,
|
8608 + | iso8601_timestamp: ::std::option::Option::None,
|
8609 + | json_value: ::std::option::Option::None,
|
8610 + | list_of_lists: ::std::option::Option::None,
|
8611 + | list_of_maps_of_strings:
|
8612 + | ::std::option::Option::None,
|
8613 + | list_of_strings: ::std::option::Option::None,
|
8614 + | list_of_structs: ::std::option::Option::None,
|
8615 + | long: ::std::option::Option::None,
|
8616 + | map_of_lists_of_strings:
|
8617 + | ::std::option::Option::None,
|
8618 + | map_of_maps: ::std::option::Option::None,
|
8619 + | map_of_strings: ::std::option::Option::None,
|
8620 + | map_of_structs: ::std::option::Option::None,
|
8621 + | recursive_list: ::std::option::Option::None,
|
8622 + | recursive_map: ::std::option::Option::None,
|
8623 + | recursive_struct: ::std::option::Option::None,
|
8624 + | simple_struct: ::std::option::Option::None,
|
8625 + | struct_with_json_name: ::std::option::Option::None,
|
8626 + | timestamp: ::std::option::Option::None,
|
8627 + | unix_timestamp: ::std::option::Option::None,
|
8628 + | },
|
8629 + | );
|
8630 + | ret
|
8631 + | }),
|
8632 + | blob: ::std::option::Option::None,
|
8633 + | boolean: ::std::option::Option::None,
|
8634 + | double: ::std::option::Option::None,
|
8635 + | empty_struct: ::std::option::Option::None,
|
8636 + | float: ::std::option::Option::None,
|
8637 + | httpdate_timestamp: ::std::option::Option::None,
|
8638 + | integer: ::std::option::Option::None,
|
8639 + | iso8601_timestamp: ::std::option::Option::None,
|
8640 + | json_value: ::std::option::Option::None,
|
8641 + | list_of_lists: ::std::option::Option::None,
|
8642 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8643 + | list_of_strings: ::std::option::Option::None,
|
8644 + | list_of_structs: ::std::option::Option::None,
|
8645 + | long: ::std::option::Option::None,
|
8646 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8647 + | map_of_maps: ::std::option::Option::None,
|
8648 + | map_of_strings: ::std::option::Option::None,
|
8649 + | map_of_structs: ::std::option::Option::None,
|
8650 + | recursive_list: ::std::option::Option::None,
|
8651 + | recursive_struct: ::std::option::Option::None,
|
8652 + | simple_struct: ::std::option::Option::None,
|
8653 + | string: ::std::option::Option::None,
|
8654 + | struct_with_json_name: ::std::option::Option::None,
|
8655 + | timestamp: ::std::option::Option::None,
|
8656 + | unix_timestamp: ::std::option::Option::None,
|
8657 + | },
|
8658 + | );
|
8659 + | ret
|
8660 + | }),
|
8661 + | blob: ::std::option::Option::None,
|
8662 + | boolean: ::std::option::Option::None,
|
8663 + | double: ::std::option::Option::None,
|
8664 + | empty_struct: ::std::option::Option::None,
|
8665 + | float: ::std::option::Option::None,
|
8666 + | httpdate_timestamp: ::std::option::Option::None,
|
8667 + | integer: ::std::option::Option::None,
|
8668 + | iso8601_timestamp: ::std::option::Option::None,
|
8669 + | json_value: ::std::option::Option::None,
|
8670 + | list_of_lists: ::std::option::Option::None,
|
8671 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8672 + | list_of_strings: ::std::option::Option::None,
|
8673 + | list_of_structs: ::std::option::Option::None,
|
8674 + | long: ::std::option::Option::None,
|
8675 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8676 + | map_of_maps: ::std::option::Option::None,
|
8677 + | map_of_strings: ::std::option::Option::None,
|
8678 + | map_of_structs: ::std::option::Option::None,
|
8679 + | recursive_list: ::std::option::Option::None,
|
8680 + | recursive_struct: ::std::option::Option::None,
|
8681 + | simple_struct: ::std::option::Option::None,
|
8682 + | string: ::std::option::Option::None,
|
8683 + | struct_with_json_name: ::std::option::Option::None,
|
8684 + | timestamp: ::std::option::Option::None,
|
8685 + | unix_timestamp: ::std::option::Option::None,
|
8686 + | },
|
8687 + | );
|
8688 + | ret
|
8689 + | }),
|
8690 + | blob: ::std::option::Option::None,
|
8691 + | boolean: ::std::option::Option::None,
|
8692 + | double: ::std::option::Option::None,
|
8693 + | empty_struct: ::std::option::Option::None,
|
8694 + | float: ::std::option::Option::None,
|
8695 + | httpdate_timestamp: ::std::option::Option::None,
|
8696 + | integer: ::std::option::Option::None,
|
8697 + | iso8601_timestamp: ::std::option::Option::None,
|
8698 + | json_value: ::std::option::Option::None,
|
8699 + | list_of_lists: ::std::option::Option::None,
|
8700 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8701 + | list_of_strings: ::std::option::Option::None,
|
8702 + | list_of_structs: ::std::option::Option::None,
|
8703 + | long: ::std::option::Option::None,
|
8704 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8705 + | map_of_maps: ::std::option::Option::None,
|
8706 + | map_of_strings: ::std::option::Option::None,
|
8707 + | map_of_structs: ::std::option::Option::None,
|
8708 + | recursive_list: ::std::option::Option::None,
|
8709 + | recursive_struct: ::std::option::Option::None,
|
8710 + | simple_struct: ::std::option::Option::None,
|
8711 + | string: ::std::option::Option::None,
|
8712 + | struct_with_json_name: ::std::option::Option::None,
|
8713 + | timestamp: ::std::option::Option::None,
|
8714 + | unix_timestamp: ::std::option::Option::None,
|
8715 + | };
|
8716 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
8717 + | let http_response = output.into_response();
|
8718 + | ::pretty_assertions::assert_eq!(
|
8719 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8720 + | http_response.status()
|
8721 + | );
|
8722 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8723 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8724 + | http_response.headers(),
|
8725 + | expected_headers,
|
8726 + | ));
|
8727 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
9634 8728 | .await
|
9635 - | .expect("unable to make an HTTP request");
|
9636 - | assert!(
|
9637 - | receiver.recv().await.is_some(),
|
9638 - | "we expected operation handler to be invoked but it was not entered"
|
8729 + | .expect("unable to extract body to bytes");
|
8730 + | ::aws_smithy_protocol_test::assert_ok(
|
8731 + | ::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"))
|
8732 + | );
|
8733 + | }
|
8734 + |
|
8735 + | /// Parses the request id from the response
|
8736 + | /// Test ID: parses_the_request_id_from_the_response
|
8737 + | #[::tokio::test]
|
8738 + | #[::tracing_test::traced_test]
|
8739 + | #[should_panic]
|
8740 + | async fn parses_the_request_id_from_the_response_response() {
|
8741 + | let output = crate::output::KitchenSinkOperationOutput {
|
8742 + | blob: ::std::option::Option::None,
|
8743 + | boolean: ::std::option::Option::None,
|
8744 + | double: ::std::option::Option::None,
|
8745 + | empty_struct: ::std::option::Option::None,
|
8746 + | float: ::std::option::Option::None,
|
8747 + | httpdate_timestamp: ::std::option::Option::None,
|
8748 + | integer: ::std::option::Option::None,
|
8749 + | iso8601_timestamp: ::std::option::Option::None,
|
8750 + | json_value: ::std::option::Option::None,
|
8751 + | list_of_lists: ::std::option::Option::None,
|
8752 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8753 + | list_of_strings: ::std::option::Option::None,
|
8754 + | list_of_structs: ::std::option::Option::None,
|
8755 + | long: ::std::option::Option::None,
|
8756 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8757 + | map_of_maps: ::std::option::Option::None,
|
8758 + | map_of_strings: ::std::option::Option::None,
|
8759 + | map_of_structs: ::std::option::Option::None,
|
8760 + | recursive_list: ::std::option::Option::None,
|
8761 + | recursive_map: ::std::option::Option::None,
|
8762 + | recursive_struct: ::std::option::Option::None,
|
8763 + | simple_struct: ::std::option::Option::None,
|
8764 + | string: ::std::option::Option::None,
|
8765 + | struct_with_json_name: ::std::option::Option::None,
|
8766 + | timestamp: ::std::option::Option::None,
|
8767 + | unix_timestamp: ::std::option::Option::None,
|
8768 + | };
|
8769 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
8770 + | let http_response = output.into_response();
|
8771 + | ::pretty_assertions::assert_eq!(
|
8772 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8773 + | http_response.status()
|
9639 8774 | );
|
8775 + | let expected_headers = [
|
8776 + | ("Content-Type", "application/x-amz-json-1.1"),
|
8777 + | ("X-Amzn-Requestid", "amazon-uniq-request-id"),
|
8778 + | ];
|
8779 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8780 + | http_response.headers(),
|
8781 + | expected_headers,
|
8782 + | ));
|
8783 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8784 + | .await
|
8785 + | .expect("unable to extract body to bytes");
|
8786 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8787 + | &body,
|
8788 + | "{}",
|
8789 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8790 + | ));
|
8791 + | }
|
8792 + | }
|
8793 + |
|
8794 + | ::pin_project_lite::pin_project! {
|
8795 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
8796 + | /// [`SimpleScalarPropertiesInput`](crate::input::SimpleScalarPropertiesInput) using modelled bindings.
|
8797 + | pub struct SimpleScalarPropertiesInputFuture {
|
8798 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SimpleScalarPropertiesInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
8799 + | }
|
8800 + | }
|
8801 + |
|
8802 + | impl std::future::Future for SimpleScalarPropertiesInputFuture {
|
8803 + | type Output = Result<
|
8804 + | crate::input::SimpleScalarPropertiesInput,
|
8805 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
8806 + | >;
|
8807 + |
|
8808 + | fn poll(
|
8809 + | self: std::pin::Pin<&mut Self>,
|
8810 + | cx: &mut std::task::Context<'_>,
|
8811 + | ) -> std::task::Poll<Self::Output> {
|
8812 + | let this = self.project();
|
8813 + | this.inner.as_mut().poll(cx)
|
9640 8814 | }
|
8815 + | }
|
8816 + |
|
8817 + | impl<B>
|
8818 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
8819 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
8820 + | B,
|
8821 + | > for crate::input::SimpleScalarPropertiesInput
|
8822 + | where
|
8823 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
8824 + | B: 'static,
|
8825 + |
|
8826 + | B::Data: Send,
|
8827 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
8828 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
8829 + | {
|
8830 + | type Rejection =
|
8831 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
8832 + | type Future = SimpleScalarPropertiesInputFuture;
|
9641 8833 |
|
9642 - | /// Serializes empty structure shapes
|
9643 - | /// Test ID: serializes_empty_structure_shapes
|
9644 - | #[::tokio::test]
|
9645 - | #[::tracing_test::traced_test]
|
9646 - | async fn serializes_empty_structure_shapes_request() {
|
9647 - | #[allow(unused_mut)]
|
9648 - | let mut http_request = ::http::Request::builder()
|
9649 - | .uri("/")
|
9650 - | .method("POST")
|
9651 - | .header("Content-Type", "application/x-amz-json-1.1")
|
9652 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
9653 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
9654 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
9655 - | "{\"SimpleStruct\":{}}".as_bytes(),
|
9656 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9657 - | )),
|
9658 - | ))
|
9659 - | .unwrap();
|
9660 - | #[allow(unused_mut)]
|
9661 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9662 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
9663 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9664 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
9665 - | let sender = sender.clone();
|
9666 - | async move {
|
9667 - | let result = {
|
9668 - | use ::aws_smithy_protocol_test::FloatEquals;
|
9669 - | let expected = crate::input::KitchenSinkOperationInput {
|
9670 - | simple_struct: ::std::option::Option::Some(
|
9671 - | crate::model::SimpleStruct {
|
9672 - | value: ::std::option::Option::None,
|
9673 - | },
|
9674 - | ),
|
9675 - | blob: ::std::option::Option::None,
|
9676 - | boolean: ::std::option::Option::None,
|
9677 - | double: ::std::option::Option::None,
|
9678 - | empty_struct: ::std::option::Option::None,
|
9679 - | float: ::std::option::Option::None,
|
9680 - | httpdate_timestamp: ::std::option::Option::None,
|
9681 - | integer: ::std::option::Option::None,
|
9682 - | iso8601_timestamp: ::std::option::Option::None,
|
9683 - | json_value: ::std::option::Option::None,
|
9684 - | list_of_lists: ::std::option::Option::None,
|
9685 - | list_of_maps_of_strings: ::std::option::Option::None,
|
9686 - | list_of_strings: ::std::option::Option::None,
|
9687 - | list_of_structs: ::std::option::Option::None,
|
9688 - | long: ::std::option::Option::None,
|
9689 - | map_of_lists_of_strings: ::std::option::Option::None,
|
9690 - | map_of_maps: ::std::option::Option::None,
|
9691 - | map_of_strings: ::std::option::Option::None,
|
9692 - | map_of_structs: ::std::option::Option::None,
|
9693 - | recursive_list: ::std::option::Option::None,
|
9694 - | recursive_map: ::std::option::Option::None,
|
9695 - | recursive_struct: ::std::option::Option::None,
|
9696 - | string: ::std::option::Option::None,
|
9697 - | struct_with_json_name: ::std::option::Option::None,
|
9698 - | timestamp: ::std::option::Option::None,
|
9699 - | unix_timestamp: ::std::option::Option::None,
|
9700 - | };
|
9701 - | ::pretty_assertions::assert_eq!(
|
9702 - | input.blob,
|
9703 - | expected.blob,
|
9704 - | "Unexpected value for `blob`"
|
9705 - | );
|
9706 - | ::pretty_assertions::assert_eq!(
|
9707 - | input.boolean,
|
9708 - | expected.boolean,
|
9709 - | "Unexpected value for `boolean`"
|
9710 - | );
|
9711 - | assert!(
|
9712 - | input.double.float_equals(&expected.double),
|
9713 - | "Unexpected value for `double` {:?} vs. {:?}",
|
9714 - | expected.double,
|
9715 - | input.double
|
9716 - | );
|
9717 - | ::pretty_assertions::assert_eq!(
|
9718 - | input.empty_struct,
|
9719 - | expected.empty_struct,
|
9720 - | "Unexpected value for `empty_struct`"
|
9721 - | );
|
9722 - | assert!(
|
9723 - | input.float.float_equals(&expected.float),
|
9724 - | "Unexpected value for `float` {:?} vs. {:?}",
|
9725 - | expected.float,
|
9726 - | input.float
|
9727 - | );
|
9728 - | ::pretty_assertions::assert_eq!(
|
9729 - | input.httpdate_timestamp,
|
9730 - | expected.httpdate_timestamp,
|
9731 - | "Unexpected value for `httpdate_timestamp`"
|
9732 - | );
|
9733 - | ::pretty_assertions::assert_eq!(
|
9734 - | input.integer,
|
9735 - | expected.integer,
|
9736 - | "Unexpected value for `integer`"
|
9737 - | );
|
9738 - | ::pretty_assertions::assert_eq!(
|
9739 - | input.iso8601_timestamp,
|
9740 - | expected.iso8601_timestamp,
|
9741 - | "Unexpected value for `iso8601_timestamp`"
|
9742 - | );
|
9743 - | ::pretty_assertions::assert_eq!(
|
9744 - | input.json_value,
|
9745 - | expected.json_value,
|
9746 - | "Unexpected value for `json_value`"
|
9747 - | );
|
9748 - | ::pretty_assertions::assert_eq!(
|
9749 - | input.list_of_lists,
|
9750 - | expected.list_of_lists,
|
9751 - | "Unexpected value for `list_of_lists`"
|
9752 - | );
|
9753 - | ::pretty_assertions::assert_eq!(
|
9754 - | input.list_of_maps_of_strings,
|
9755 - | expected.list_of_maps_of_strings,
|
9756 - | "Unexpected value for `list_of_maps_of_strings`"
|
9757 - | );
|
9758 - | ::pretty_assertions::assert_eq!(
|
9759 - | input.list_of_strings,
|
9760 - | expected.list_of_strings,
|
9761 - | "Unexpected value for `list_of_strings`"
|
9762 - | );
|
9763 - | ::pretty_assertions::assert_eq!(
|
9764 - | input.list_of_structs,
|
9765 - | expected.list_of_structs,
|
9766 - | "Unexpected value for `list_of_structs`"
|
9767 - | );
|
9768 - | ::pretty_assertions::assert_eq!(
|
9769 - | input.long,
|
9770 - | expected.long,
|
9771 - | "Unexpected value for `long`"
|
9772 - | );
|
9773 - | ::pretty_assertions::assert_eq!(
|
9774 - | input.map_of_lists_of_strings,
|
9775 - | expected.map_of_lists_of_strings,
|
9776 - | "Unexpected value for `map_of_lists_of_strings`"
|
9777 - | );
|
9778 - | ::pretty_assertions::assert_eq!(
|
9779 - | input.map_of_maps,
|
9780 - | expected.map_of_maps,
|
9781 - | "Unexpected value for `map_of_maps`"
|
9782 - | );
|
9783 - | ::pretty_assertions::assert_eq!(
|
9784 - | input.map_of_strings,
|
9785 - | expected.map_of_strings,
|
9786 - | "Unexpected value for `map_of_strings`"
|
9787 - | );
|
9788 - | ::pretty_assertions::assert_eq!(
|
9789 - | input.map_of_structs,
|
9790 - | expected.map_of_structs,
|
9791 - | "Unexpected value for `map_of_structs`"
|
9792 - | );
|
9793 - | ::pretty_assertions::assert_eq!(
|
9794 - | input.recursive_list,
|
9795 - | expected.recursive_list,
|
9796 - | "Unexpected value for `recursive_list`"
|
9797 - | );
|
9798 - | ::pretty_assertions::assert_eq!(
|
9799 - | input.recursive_map,
|
9800 - | expected.recursive_map,
|
9801 - | "Unexpected value for `recursive_map`"
|
9802 - | );
|
9803 - | ::pretty_assertions::assert_eq!(
|
9804 - | input.recursive_struct,
|
9805 - | expected.recursive_struct,
|
9806 - | "Unexpected value for `recursive_struct`"
|
9807 - | );
|
9808 - | ::pretty_assertions::assert_eq!(
|
9809 - | input.simple_struct,
|
9810 - | expected.simple_struct,
|
9811 - | "Unexpected value for `simple_struct`"
|
9812 - | );
|
9813 - | ::pretty_assertions::assert_eq!(
|
9814 - | input.string,
|
9815 - | expected.string,
|
9816 - | "Unexpected value for `string`"
|
9817 - | );
|
9818 - | ::pretty_assertions::assert_eq!(
|
9819 - | input.struct_with_json_name,
|
9820 - | expected.struct_with_json_name,
|
9821 - | "Unexpected value for `struct_with_json_name`"
|
9822 - | );
|
9823 - | ::pretty_assertions::assert_eq!(
|
9824 - | input.timestamp,
|
9825 - | expected.timestamp,
|
9826 - | "Unexpected value for `timestamp`"
|
9827 - | );
|
9828 - | ::pretty_assertions::assert_eq!(
|
9829 - | input.unix_timestamp,
|
9830 - | expected.unix_timestamp,
|
9831 - | "Unexpected value for `unix_timestamp`"
|
9832 - | );
|
9833 - | let output = crate::output::KitchenSinkOperationOutput {
|
9834 - | blob: ::std::option::Option::None,
|
9835 - | boolean: ::std::option::Option::None,
|
9836 - | double: ::std::option::Option::None,
|
9837 - | empty_struct: ::std::option::Option::None,
|
9838 - | float: ::std::option::Option::None,
|
9839 - | httpdate_timestamp: ::std::option::Option::None,
|
9840 - | integer: ::std::option::Option::None,
|
9841 - | iso8601_timestamp: ::std::option::Option::None,
|
9842 - | json_value: ::std::option::Option::None,
|
9843 - | list_of_lists: ::std::option::Option::None,
|
9844 - | list_of_maps_of_strings: ::std::option::Option::None,
|
9845 - | list_of_strings: ::std::option::Option::None,
|
9846 - | list_of_structs: ::std::option::Option::None,
|
9847 - | long: ::std::option::Option::None,
|
9848 - | map_of_lists_of_strings: ::std::option::Option::None,
|
9849 - | map_of_maps: ::std::option::Option::None,
|
9850 - | map_of_strings: ::std::option::Option::None,
|
9851 - | map_of_structs: ::std::option::Option::None,
|
9852 - | recursive_list: ::std::option::Option::None,
|
9853 - | recursive_map: ::std::option::Option::None,
|
9854 - | recursive_struct: ::std::option::Option::None,
|
9855 - | simple_struct: ::std::option::Option::None,
|
9856 - | string: ::std::option::Option::None,
|
9857 - | struct_with_json_name: ::std::option::Option::None,
|
9858 - | timestamp: ::std::option::Option::None,
|
9859 - | unix_timestamp: ::std::option::Option::None,
|
9860 - | };
|
9861 - | Ok(output)
|
9862 - | };
|
9863 - | sender.send(()).await.expect("receiver dropped early");
|
9864 - | result
|
9865 - | }
|
9866 - | })
|
9867 - | .build_unchecked();
|
8834 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
8835 + | let fut = async move {
|
8836 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
8837 + | request.headers(),
|
8838 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
8839 + | ) {
|
8840 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
8841 + | }
|
8842 + | crate::protocol_serde::shape_simple_scalar_properties::de_simple_scalar_properties_http_request(request)
|
8843 + | .await
|
8844 + | };
|
8845 + | use ::futures_util::future::TryFutureExt;
|
8846 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
8847 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
8848 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
8849 + | });
|
8850 + | SimpleScalarPropertiesInputFuture {
|
8851 + | inner: Box::pin(fut),
|
8852 + | }
|
8853 + | }
|
8854 + | }
|
8855 + | impl
|
8856 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
8857 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
8858 + | > for crate::output::SimpleScalarPropertiesOutput
|
8859 + | {
|
8860 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
8861 + | match crate::protocol_serde::shape_simple_scalar_properties::ser_simple_scalar_properties_http_response(self) {
|
8862 + | Ok(response) => response,
|
8863 + | Err(e) => {
|
8864 + | ::tracing::error!(error = %e, "failed to serialize response");
|
8865 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
8866 + | }
|
8867 + | }
|
8868 + | }
|
8869 + | }
|
8870 + |
|
8871 + | #[allow(unreachable_code, unused_variables)]
|
8872 + | #[cfg(test)]
|
8873 + | mod simple_scalar_properties_test {
|
8874 + |
|
8875 + | /// Supports handling NaN float values.
|
8876 + | /// Test ID: AwsJson11SupportsNaNFloatInputs
|
8877 + | #[::tokio::test]
|
8878 + | #[::tracing_test::traced_test]
|
8879 + | async fn aws_json11_supports_na_n_float_inputs_request() {
|
8880 + | #[allow(unused_mut)]
|
8881 + | let mut http_request = ::http::Request::builder()
|
8882 + | .uri("/")
|
8883 + | .method("POST")
|
8884 + | .header("Content-Type", "application/x-amz-json-1.1")
|
8885 + | .header("X-Amz-Target", "JsonProtocol.SimpleScalarProperties")
|
8886 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
8887 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
8888 + | "{\n \"floatValue\": \"NaN\",\n \"doubleValue\": \"NaN\"\n}".as_bytes(),
|
8889 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8890 + | )),
|
8891 + | ))
|
8892 + | .unwrap();
|
8893 + | #[allow(unused_mut)]
|
8894 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8895 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
8896 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
8897 + | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
8898 + | let sender = sender.clone();
|
8899 + | async move {
|
8900 + | let result = { use ::aws_smithy_protocol_test::FloatEquals;
|
8901 + | let expected =
|
8902 + | crate::input::SimpleScalarPropertiesInput {
|
8903 + | float_value:
|
8904 + | ::std::option::Option::Some(
|
8905 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number")
|
8906 + | )
|
8907 + | ,
|
8908 + | double_value:
|
8909 + | ::std::option::Option::Some(
|
8910 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number")
|
8911 + | )
|
8912 + | ,
|
8913 + | }
|
8914 + | ;
|
8915 + | assert!(input.float_value.float_equals(&expected.float_value),
|
8916 + | "Unexpected value for `float_value` {:?} vs. {:?}", expected.float_value, input.float_value);
|
8917 + | assert!(input.double_value.float_equals(&expected.double_value),
|
8918 + | "Unexpected value for `double_value` {:?} vs. {:?}", expected.double_value, input.double_value);
|
8919 + | let output =
|
8920 + | crate::output::SimpleScalarPropertiesOutput {
|
8921 + | float_value:
|
8922 + | ::std::option::Option::None
|
8923 + | ,
|
8924 + | double_value:
|
8925 + | ::std::option::Option::None
|
8926 + | ,
|
8927 + | }
|
8928 + | ;
|
8929 + | output };
|
8930 + | sender.send(()).await.expect("receiver dropped early");
|
8931 + | result
|
8932 + | }
|
8933 + | })
|
8934 + | .build_unchecked();
|
8935 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8936 + | .await
|
8937 + | .expect("unable to make an HTTP request");
|
8938 + | assert!(
|
8939 + | receiver.recv().await.is_some(),
|
8940 + | "we expected operation handler to be invoked but it was not entered"
|
8941 + | );
|
8942 + | }
|
8943 + |
|
8944 + | /// Supports handling Infinity float values.
|
8945 + | /// Test ID: AwsJson11SupportsInfinityFloatInputs
|
8946 + | #[::tokio::test]
|
8947 + | #[::tracing_test::traced_test]
|
8948 + | async fn aws_json11_supports_infinity_float_inputs_request() {
|
8949 + | #[allow(unused_mut)]
|
8950 + | let mut http_request = ::http::Request::builder()
|
8951 + | .uri("/")
|
8952 + | .method("POST")
|
8953 + | .header("Content-Type", "application/x-amz-json-1.1")
|
8954 + | .header("X-Amz-Target", "JsonProtocol.SimpleScalarProperties")
|
8955 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
8956 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
8957 + | "{\n \"floatValue\": \"Infinity\",\n \"doubleValue\": \"Infinity\"\n}"
|
8958 + | .as_bytes(),
|
8959 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8960 + | )),
|
8961 + | ))
|
8962 + | .unwrap();
|
8963 + | #[allow(unused_mut)]
|
8964 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8965 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
8966 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
8967 + | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
8968 + | let sender = sender.clone();
|
8969 + | async move {
|
8970 + | let result = { use ::aws_smithy_protocol_test::FloatEquals;
|
8971 + | let expected =
|
8972 + | crate::input::SimpleScalarPropertiesInput {
|
8973 + | float_value:
|
8974 + | ::std::option::Option::Some(
|
8975 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number")
|
8976 + | )
|
8977 + | ,
|
8978 + | double_value:
|
8979 + | ::std::option::Option::Some(
|
8980 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number")
|
8981 + | )
|
8982 + | ,
|
8983 + | }
|
8984 + | ;
|
8985 + | assert!(input.float_value.float_equals(&expected.float_value),
|
8986 + | "Unexpected value for `float_value` {:?} vs. {:?}", expected.float_value, input.float_value);
|
8987 + | assert!(input.double_value.float_equals(&expected.double_value),
|
8988 + | "Unexpected value for `double_value` {:?} vs. {:?}", expected.double_value, input.double_value);
|
8989 + | let output =
|
8990 + | crate::output::SimpleScalarPropertiesOutput {
|
8991 + | float_value:
|
8992 + | ::std::option::Option::None
|
8993 + | ,
|
8994 + | double_value:
|
8995 + | ::std::option::Option::None
|
8996 + | ,
|
8997 + | }
|
8998 + | ;
|
8999 + | output };
|
9000 + | sender.send(()).await.expect("receiver dropped early");
|
9001 + | result
|
9002 + | }
|
9003 + | })
|
9004 + | .build_unchecked();
|
9005 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9006 + | .await
|
9007 + | .expect("unable to make an HTTP request");
|
9008 + | assert!(
|
9009 + | receiver.recv().await.is_some(),
|
9010 + | "we expected operation handler to be invoked but it was not entered"
|
9011 + | );
|
9012 + | }
|
9013 + |
|
9014 + | /// Supports handling -Infinity float values.
|
9015 + | /// Test ID: AwsJson11SupportsNegativeInfinityFloatInputs
|
9016 + | #[::tokio::test]
|
9017 + | #[::tracing_test::traced_test]
|
9018 + | async fn aws_json11_supports_negative_infinity_float_inputs_request() {
|
9019 + | #[allow(unused_mut)]
|
9020 + | let mut http_request = ::http::Request::builder()
|
9021 + | .uri("/")
|
9022 + | .method("POST")
|
9023 + | .header("Content-Type", "application/x-amz-json-1.1")
|
9024 + | .header("X-Amz-Target", "JsonProtocol.SimpleScalarProperties")
|
9025 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
9026 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
9027 + | "{\n \"floatValue\": \"-Infinity\",\n \"doubleValue\": \"-Infinity\"\n}"
|
9028 + | .as_bytes(),
|
9029 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9030 + | )),
|
9031 + | ))
|
9032 + | .unwrap();
|
9033 + | #[allow(unused_mut)]
|
9034 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9035 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
9036 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9037 + | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
9038 + | let sender = sender.clone();
|
9039 + | async move {
|
9040 + | let result = { use ::aws_smithy_protocol_test::FloatEquals;
|
9041 + | let expected =
|
9042 + | crate::input::SimpleScalarPropertiesInput {
|
9043 + | float_value:
|
9044 + | ::std::option::Option::Some(
|
9045 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number")
|
9046 + | )
|
9047 + | ,
|
9048 + | double_value:
|
9049 + | ::std::option::Option::Some(
|
9050 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number")
|
9051 + | )
|
9052 + | ,
|
9053 + | }
|
9054 + | ;
|
9055 + | assert!(input.float_value.float_equals(&expected.float_value),
|
9056 + | "Unexpected value for `float_value` {:?} vs. {:?}", expected.float_value, input.float_value);
|
9057 + | assert!(input.double_value.float_equals(&expected.double_value),
|
9058 + | "Unexpected value for `double_value` {:?} vs. {:?}", expected.double_value, input.double_value);
|
9059 + | let output =
|
9060 + | crate::output::SimpleScalarPropertiesOutput {
|
9061 + | float_value:
|
9062 + | ::std::option::Option::None
|
9063 + | ,
|
9064 + | double_value:
|
9065 + | ::std::option::Option::None
|
9066 + | ,
|
9067 + | }
|
9068 + | ;
|
9069 + | output };
|
9070 + | sender.send(()).await.expect("receiver dropped early");
|
9071 + | result
|
9072 + | }
|
9073 + | })
|
9074 + | .build_unchecked();
|
9868 9075 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9869 9076 | .await
|
9870 9077 | .expect("unable to make an HTTP request");
|
9871 9078 | assert!(
|
9872 9079 | receiver.recv().await.is_some(),
|
9873 9080 | "we expected operation handler to be invoked but it was not entered"
|
9874 9081 | );
|
9875 9082 | }
|
9876 9083 |
|
9877 - | /// Serializes structure which have no members
|
9878 - | /// Test ID: serializes_structure_which_have_no_members
|
9084 + | /// Supports handling NaN float values.
|
9085 + | /// Test ID: AwsJson11SupportsNaNFloatInputs
|
9086 + | #[::tokio::test]
|
9087 + | #[::tracing_test::traced_test]
|
9088 + | async fn aws_json11_supports_na_n_float_inputs_response() {
|
9089 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
9090 + | float_value: ::std::option::Option::Some(
|
9091 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN")
|
9092 + | .expect("invalid string for number"),
|
9093 + | ),
|
9094 + | double_value: ::std::option::Option::Some(
|
9095 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN")
|
9096 + | .expect("invalid string for number"),
|
9097 + | ),
|
9098 + | };
|
9099 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
9100 + | let http_response = output.into_response();
|
9101 + | ::pretty_assertions::assert_eq!(
|
9102 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
9103 + | http_response.status()
|
9104 + | );
|
9105 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
9106 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9107 + | http_response.headers(),
|
9108 + | expected_headers,
|
9109 + | ));
|
9110 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
9111 + | .await
|
9112 + | .expect("unable to extract body to bytes");
|
9113 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
9114 + | &body,
|
9115 + | "{\n \"floatValue\": \"NaN\",\n \"doubleValue\": \"NaN\"\n}",
|
9116 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9117 + | ));
|
9118 + | }
|
9119 + |
|
9120 + | /// Supports handling Infinity float values.
|
9121 + | /// Test ID: AwsJson11SupportsInfinityFloatInputs
|
9122 + | #[::tokio::test]
|
9123 + | #[::tracing_test::traced_test]
|
9124 + | async fn aws_json11_supports_infinity_float_inputs_response() {
|
9125 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
9126 + | float_value: ::std::option::Option::Some(
|
9127 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity")
|
9128 + | .expect("invalid string for number"),
|
9129 + | ),
|
9130 + | double_value: ::std::option::Option::Some(
|
9131 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity")
|
9132 + | .expect("invalid string for number"),
|
9133 + | ),
|
9134 + | };
|
9135 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
9136 + | let http_response = output.into_response();
|
9137 + | ::pretty_assertions::assert_eq!(
|
9138 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
9139 + | http_response.status()
|
9140 + | );
|
9141 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
9142 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9143 + | http_response.headers(),
|
9144 + | expected_headers,
|
9145 + | ));
|
9146 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
9147 + | .await
|
9148 + | .expect("unable to extract body to bytes");
|
9149 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
9150 + | &body,
|
9151 + | "{\n \"floatValue\": \"Infinity\",\n \"doubleValue\": \"Infinity\"\n}",
|
9152 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9153 + | ));
|
9154 + | }
|
9155 + |
|
9156 + | /// Supports handling -Infinity float values.
|
9157 + | /// Test ID: AwsJson11SupportsNegativeInfinityFloatInputs
|
9879 9158 | #[::tokio::test]
|
9880 9159 | #[::tracing_test::traced_test]
|
9881 - | async fn serializes_structure_which_have_no_members_request() {
|
9882 - | #[allow(unused_mut)]
|
9883 - | let mut http_request = ::http::Request::builder()
|
9884 - | .uri("/")
|
9885 - | .method("POST")
|
9886 - | .header("Content-Type", "application/x-amz-json-1.1")
|
9887 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
9888 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
9889 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
9890 - | "{\"EmptyStruct\":{}}".as_bytes(),
|
9891 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9892 - | )),
|
9893 - | ))
|
9894 - | .unwrap();
|
9895 - | #[allow(unused_mut)]
|
9896 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9897 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
9898 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9899 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
9900 - | let sender = sender.clone();
|
9901 - | async move {
|
9902 - | let result = {
|
9903 - | use ::aws_smithy_protocol_test::FloatEquals;
|
9904 - | let expected = crate::input::KitchenSinkOperationInput {
|
9905 - | empty_struct: ::std::option::Option::Some(crate::model::EmptyStruct {}),
|
9906 - | blob: ::std::option::Option::None,
|
9907 - | boolean: ::std::option::Option::None,
|
9908 - | double: ::std::option::Option::None,
|
9909 - | float: ::std::option::Option::None,
|
9910 - | httpdate_timestamp: ::std::option::Option::None,
|
9911 - | integer: ::std::option::Option::None,
|
9912 - | iso8601_timestamp: ::std::option::Option::None,
|
9913 - | json_value: ::std::option::Option::None,
|
9914 - | list_of_lists: ::std::option::Option::None,
|
9915 - | list_of_maps_of_strings: ::std::option::Option::None,
|
9916 - | list_of_strings: ::std::option::Option::None,
|
9917 - | list_of_structs: ::std::option::Option::None,
|
9918 - | long: ::std::option::Option::None,
|
9919 - | map_of_lists_of_strings: ::std::option::Option::None,
|
9920 - | map_of_maps: ::std::option::Option::None,
|
9921 - | map_of_strings: ::std::option::Option::None,
|
9922 - | map_of_structs: ::std::option::Option::None,
|
9923 - | recursive_list: ::std::option::Option::None,
|
9924 - | recursive_map: ::std::option::Option::None,
|
9925 - | recursive_struct: ::std::option::Option::None,
|
9926 - | simple_struct: ::std::option::Option::None,
|
9927 - | string: ::std::option::Option::None,
|
9928 - | struct_with_json_name: ::std::option::Option::None,
|
9929 - | timestamp: ::std::option::Option::None,
|
9930 - | unix_timestamp: ::std::option::Option::None,
|
9931 - | };
|
9932 - | ::pretty_assertions::assert_eq!(
|
9933 - | input.blob,
|
9934 - | expected.blob,
|
9935 - | "Unexpected value for `blob`"
|
9936 - | );
|
9937 - | ::pretty_assertions::assert_eq!(
|
9938 - | input.boolean,
|
9939 - | expected.boolean,
|
9940 - | "Unexpected value for `boolean`"
|
9941 - | );
|
9942 - | assert!(
|
9943 - | input.double.float_equals(&expected.double),
|
9944 - | "Unexpected value for `double` {:?} vs. {:?}",
|
9945 - | expected.double,
|
9946 - | input.double
|
9947 - | );
|
9948 - | ::pretty_assertions::assert_eq!(
|
9949 - | input.empty_struct,
|
9950 - | expected.empty_struct,
|
9951 - | "Unexpected value for `empty_struct`"
|
9952 - | );
|
9953 - | assert!(
|
9954 - | input.float.float_equals(&expected.float),
|
9955 - | "Unexpected value for `float` {:?} vs. {:?}",
|
9956 - | expected.float,
|
9957 - | input.float
|
9958 - | );
|
9959 - | ::pretty_assertions::assert_eq!(
|
9960 - | input.httpdate_timestamp,
|
9961 - | expected.httpdate_timestamp,
|
9962 - | "Unexpected value for `httpdate_timestamp`"
|
9963 - | );
|
9964 - | ::pretty_assertions::assert_eq!(
|
9965 - | input.integer,
|
9966 - | expected.integer,
|
9967 - | "Unexpected value for `integer`"
|
9968 - | );
|
9969 - | ::pretty_assertions::assert_eq!(
|
9970 - | input.iso8601_timestamp,
|
9971 - | expected.iso8601_timestamp,
|
9972 - | "Unexpected value for `iso8601_timestamp`"
|
9973 - | );
|
9974 - | ::pretty_assertions::assert_eq!(
|
9975 - | input.json_value,
|
9976 - | expected.json_value,
|
9977 - | "Unexpected value for `json_value`"
|
9978 - | );
|
9979 - | ::pretty_assertions::assert_eq!(
|
9980 - | input.list_of_lists,
|
9981 - | expected.list_of_lists,
|
9982 - | "Unexpected value for `list_of_lists`"
|
9983 - | );
|
9984 - | ::pretty_assertions::assert_eq!(
|
9985 - | input.list_of_maps_of_strings,
|
9986 - | expected.list_of_maps_of_strings,
|
9987 - | "Unexpected value for `list_of_maps_of_strings`"
|
9988 - | );
|
9989 - | ::pretty_assertions::assert_eq!(
|
9990 - | input.list_of_strings,
|
9991 - | expected.list_of_strings,
|
9992 - | "Unexpected value for `list_of_strings`"
|
9993 - | );
|
9994 - | ::pretty_assertions::assert_eq!(
|
9995 - | input.list_of_structs,
|
9996 - | expected.list_of_structs,
|
9997 - | "Unexpected value for `list_of_structs`"
|
9998 - | );
|
9999 - | ::pretty_assertions::assert_eq!(
|
10000 - | input.long,
|
10001 - | expected.long,
|
10002 - | "Unexpected value for `long`"
|
10003 - | );
|
10004 - | ::pretty_assertions::assert_eq!(
|
10005 - | input.map_of_lists_of_strings,
|
10006 - | expected.map_of_lists_of_strings,
|
10007 - | "Unexpected value for `map_of_lists_of_strings`"
|
10008 - | );
|
10009 - | ::pretty_assertions::assert_eq!(
|
10010 - | input.map_of_maps,
|
10011 - | expected.map_of_maps,
|
10012 - | "Unexpected value for `map_of_maps`"
|
10013 - | );
|
10014 - | ::pretty_assertions::assert_eq!(
|
10015 - | input.map_of_strings,
|
10016 - | expected.map_of_strings,
|
10017 - | "Unexpected value for `map_of_strings`"
|
10018 - | );
|
10019 - | ::pretty_assertions::assert_eq!(
|
10020 - | input.map_of_structs,
|
10021 - | expected.map_of_structs,
|
10022 - | "Unexpected value for `map_of_structs`"
|
10023 - | );
|
10024 - | ::pretty_assertions::assert_eq!(
|
10025 - | input.recursive_list,
|
10026 - | expected.recursive_list,
|
10027 - | "Unexpected value for `recursive_list`"
|
10028 - | );
|
10029 - | ::pretty_assertions::assert_eq!(
|
10030 - | input.recursive_map,
|
10031 - | expected.recursive_map,
|
10032 - | "Unexpected value for `recursive_map`"
|
10033 - | );
|
10034 - | ::pretty_assertions::assert_eq!(
|
10035 - | input.recursive_struct,
|
10036 - | expected.recursive_struct,
|
10037 - | "Unexpected value for `recursive_struct`"
|
10038 - | );
|
10039 - | ::pretty_assertions::assert_eq!(
|
10040 - | input.simple_struct,
|
10041 - | expected.simple_struct,
|
10042 - | "Unexpected value for `simple_struct`"
|
10043 - | );
|
10044 - | ::pretty_assertions::assert_eq!(
|
10045 - | input.string,
|
10046 - | expected.string,
|
10047 - | "Unexpected value for `string`"
|
10048 - | );
|
10049 - | ::pretty_assertions::assert_eq!(
|
10050 - | input.struct_with_json_name,
|
10051 - | expected.struct_with_json_name,
|
10052 - | "Unexpected value for `struct_with_json_name`"
|
10053 - | );
|
10054 - | ::pretty_assertions::assert_eq!(
|
10055 - | input.timestamp,
|
10056 - | expected.timestamp,
|
10057 - | "Unexpected value for `timestamp`"
|
10058 - | );
|
10059 - | ::pretty_assertions::assert_eq!(
|
10060 - | input.unix_timestamp,
|
10061 - | expected.unix_timestamp,
|
10062 - | "Unexpected value for `unix_timestamp`"
|
10063 - | );
|
10064 - | let output = crate::output::KitchenSinkOperationOutput {
|
10065 - | blob: ::std::option::Option::None,
|
10066 - | boolean: ::std::option::Option::None,
|
10067 - | double: ::std::option::Option::None,
|
10068 - | empty_struct: ::std::option::Option::None,
|
10069 - | float: ::std::option::Option::None,
|
10070 - | httpdate_timestamp: ::std::option::Option::None,
|
10071 - | integer: ::std::option::Option::None,
|
10072 - | iso8601_timestamp: ::std::option::Option::None,
|
10073 - | json_value: ::std::option::Option::None,
|
10074 - | list_of_lists: ::std::option::Option::None,
|
10075 - | list_of_maps_of_strings: ::std::option::Option::None,
|
10076 - | list_of_strings: ::std::option::Option::None,
|
10077 - | list_of_structs: ::std::option::Option::None,
|
10078 - | long: ::std::option::Option::None,
|
10079 - | map_of_lists_of_strings: ::std::option::Option::None,
|
10080 - | map_of_maps: ::std::option::Option::None,
|
10081 - | map_of_strings: ::std::option::Option::None,
|
10082 - | map_of_structs: ::std::option::Option::None,
|
10083 - | recursive_list: ::std::option::Option::None,
|
10084 - | recursive_map: ::std::option::Option::None,
|
10085 - | recursive_struct: ::std::option::Option::None,
|
10086 - | simple_struct: ::std::option::Option::None,
|
10087 - | string: ::std::option::Option::None,
|
10088 - | struct_with_json_name: ::std::option::Option::None,
|
10089 - | timestamp: ::std::option::Option::None,
|
10090 - | unix_timestamp: ::std::option::Option::None,
|
9160 + | async fn aws_json11_supports_negative_infinity_float_inputs_response() {
|
9161 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
9162 + | float_value: ::std::option::Option::Some(
|
9163 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity")
|
9164 + | .expect("invalid string for number"),
|
9165 + | ),
|
9166 + | double_value: ::std::option::Option::Some(
|
9167 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity")
|
9168 + | .expect("invalid string for number"),
|
9169 + | ),
|
9170 + | };
|
9171 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
9172 + | let http_response = output.into_response();
|
9173 + | ::pretty_assertions::assert_eq!(
|
9174 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
9175 + | http_response.status()
|
9176 + | );
|
9177 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
9178 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9179 + | http_response.headers(),
|
9180 + | expected_headers,
|
9181 + | ));
|
9182 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
9183 + | .await
|
9184 + | .expect("unable to extract body to bytes");
|
9185 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
9186 + | &body,
|
9187 + | "{\n \"floatValue\": \"-Infinity\",\n \"doubleValue\": \"-Infinity\"\n}",
|
9188 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9189 + | ));
|
9190 + | }
|
9191 + | }
|
9192 + |
|
9193 + | ::pin_project_lite::pin_project! {
|
9194 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
9195 + | /// [`OperationWithOptionalInputOutputInput`](crate::input::OperationWithOptionalInputOutputInput) using modelled bindings.
|
9196 + | pub struct OperationWithOptionalInputOutputInputFuture {
|
9197 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::OperationWithOptionalInputOutputInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
9198 + | }
|
9199 + | }
|
9200 + |
|
9201 + | impl std::future::Future for OperationWithOptionalInputOutputInputFuture {
|
9202 + | type Output = Result<
|
9203 + | crate::input::OperationWithOptionalInputOutputInput,
|
9204 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
9205 + | >;
|
9206 + |
|
9207 + | fn poll(
|
9208 + | self: std::pin::Pin<&mut Self>,
|
9209 + | cx: &mut std::task::Context<'_>,
|
9210 + | ) -> std::task::Poll<Self::Output> {
|
9211 + | let this = self.project();
|
9212 + | this.inner.as_mut().poll(cx)
|
9213 + | }
|
9214 + | }
|
9215 + |
|
9216 + | impl<B>
|
9217 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
9218 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
9219 + | B,
|
9220 + | > for crate::input::OperationWithOptionalInputOutputInput
|
9221 + | where
|
9222 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
9223 + | B: 'static,
|
9224 + |
|
9225 + | B::Data: Send,
|
9226 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
9227 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
9228 + | {
|
9229 + | type Rejection =
|
9230 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
9231 + | type Future = OperationWithOptionalInputOutputInputFuture;
|
9232 + |
|
9233 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
9234 + | let fut = async move {
|
9235 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
9236 + | request.headers(),
|
9237 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
9238 + | ) {
|
9239 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
9240 + | }
|
9241 + | crate::protocol_serde::shape_operation_with_optional_input_output::de_operation_with_optional_input_output_http_request(request)
|
9242 + | .await
|
9243 + | };
|
9244 + | use ::futures_util::future::TryFutureExt;
|
9245 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
9246 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
9247 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
9248 + | });
|
9249 + | OperationWithOptionalInputOutputInputFuture {
|
9250 + | inner: Box::pin(fut),
|
9251 + | }
|
9252 + | }
|
9253 + | }
|
9254 + | impl
|
9255 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
9256 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
9257 + | > for crate::output::OperationWithOptionalInputOutputOutput
|
9258 + | {
|
9259 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
9260 + | match crate::protocol_serde::shape_operation_with_optional_input_output::ser_operation_with_optional_input_output_http_response(self) {
|
9261 + | Ok(response) => response,
|
9262 + | Err(e) => {
|
9263 + | ::tracing::error!(error = %e, "failed to serialize response");
|
9264 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
9265 + | }
|
9266 + | }
|
9267 + | }
|
9268 + | }
|
9269 + |
|
9270 + | #[allow(unreachable_code, unused_variables)]
|
9271 + | #[cfg(test)]
|
9272 + | mod operation_with_optional_input_output_test {
|
9273 + |
|
9274 + | /// Can call operations with no input or output
|
9275 + | /// Test ID: can_call_operation_with_no_input_or_output
|
9276 + | #[::tokio::test]
|
9277 + | #[::tracing_test::traced_test]
|
9278 + | async fn can_call_operation_with_no_input_or_output_request() {
|
9279 + | #[allow(unused_mut)]
|
9280 + | let mut http_request = ::http::Request::builder()
|
9281 + | .uri("/")
|
9282 + | .method("POST")
|
9283 + | .header("Content-Type", "application/x-amz-json-1.1")
|
9284 + | .header(
|
9285 + | "X-Amz-Target",
|
9286 + | "JsonProtocol.OperationWithOptionalInputOutput",
|
9287 + | )
|
9288 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
9289 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
9290 + | "{}".as_bytes(),
|
9291 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9292 + | )),
|
9293 + | ))
|
9294 + | .unwrap();
|
9295 + | #[allow(unused_mut)]
|
9296 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9297 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
9298 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9299 + | .operation_with_optional_input_output(
|
9300 + | move |input: crate::input::OperationWithOptionalInputOutputInput| {
|
9301 + | let sender = sender.clone();
|
9302 + | async move {
|
9303 + | let result = {
|
9304 + | let expected = crate::input::OperationWithOptionalInputOutputInput {
|
9305 + | value: ::std::option::Option::None,
|
9306 + | };
|
9307 + | ::pretty_assertions::assert_eq!(input, expected);
|
9308 + | let output = crate::output::OperationWithOptionalInputOutputOutput {
|
9309 + | value: ::std::option::Option::None,
|
9310 + | };
|
9311 + | output
|
10091 9312 | };
|
10092 - | Ok(output)
|
10093 - | };
|
10094 - | sender.send(()).await.expect("receiver dropped early");
|
10095 - | result
|
10096 - | }
|
10097 - | })
|
9313 + | sender.send(()).await.expect("receiver dropped early");
|
9314 + | result
|
9315 + | }
|
9316 + | },
|
9317 + | )
|
9318 + | .build_unchecked();
|
9319 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9320 + | .await
|
9321 + | .expect("unable to make an HTTP request");
|
9322 + | assert!(
|
9323 + | receiver.recv().await.is_some(),
|
9324 + | "we expected operation handler to be invoked but it was not entered"
|
9325 + | );
|
9326 + | }
|
9327 + |
|
9328 + | /// Can invoke operations with optional input
|
9329 + | /// Test ID: can_call_operation_with_optional_input
|
9330 + | #[::tokio::test]
|
9331 + | #[::tracing_test::traced_test]
|
9332 + | async fn can_call_operation_with_optional_input_request() {
|
9333 + | #[allow(unused_mut)]
|
9334 + | let mut http_request = ::http::Request::builder()
|
9335 + | .uri("/")
|
9336 + | .method("POST")
|
9337 + | .header("Content-Type", "application/x-amz-json-1.1")
|
9338 + | .header(
|
9339 + | "X-Amz-Target",
|
9340 + | "JsonProtocol.OperationWithOptionalInputOutput",
|
9341 + | )
|
9342 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
9343 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
9344 + | "{\"Value\":\"Hi\"}".as_bytes(),
|
9345 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9346 + | )),
|
9347 + | ))
|
9348 + | .unwrap();
|
9349 + | #[allow(unused_mut)]
|
9350 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9351 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
9352 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9353 + | .operation_with_optional_input_output(
|
9354 + | move |input: crate::input::OperationWithOptionalInputOutputInput| {
|
9355 + | let sender = sender.clone();
|
9356 + | async move {
|
9357 + | let result = {
|
9358 + | let expected = crate::input::OperationWithOptionalInputOutputInput {
|
9359 + | value: ::std::option::Option::Some("Hi".to_owned()),
|
9360 + | };
|
9361 + | ::pretty_assertions::assert_eq!(input, expected);
|
9362 + | let output = crate::output::OperationWithOptionalInputOutputOutput {
|
9363 + | value: ::std::option::Option::None,
|
9364 + | };
|
9365 + | output
|
9366 + | };
|
9367 + | sender.send(()).await.expect("receiver dropped early");
|
9368 + | result
|
9369 + | }
|
9370 + | },
|
9371 + | )
|
10098 9372 | .build_unchecked();
|
10099 9373 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10100 9374 | .await
|
10101 9375 | .expect("unable to make an HTTP request");
|
10102 9376 | assert!(
|
10103 9377 | receiver.recv().await.is_some(),
|
10104 9378 | "we expected operation handler to be invoked but it was not entered"
|
10105 9379 | );
|
10106 9380 | }
|
9381 + | }
|
9382 + |
|
9383 + | ::pin_project_lite::pin_project! {
|
9384 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
9385 + | /// [`PutAndGetInlineDocumentsInput`](crate::input::PutAndGetInlineDocumentsInput) using modelled bindings.
|
9386 + | pub struct PutAndGetInlineDocumentsInputFuture {
|
9387 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::PutAndGetInlineDocumentsInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
9388 + | }
|
9389 + | }
|
9390 + |
|
9391 + | impl std::future::Future for PutAndGetInlineDocumentsInputFuture {
|
9392 + | type Output = Result<
|
9393 + | crate::input::PutAndGetInlineDocumentsInput,
|
9394 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
9395 + | >;
|
9396 + |
|
9397 + | fn poll(
|
9398 + | self: std::pin::Pin<&mut Self>,
|
9399 + | cx: &mut std::task::Context<'_>,
|
9400 + | ) -> std::task::Poll<Self::Output> {
|
9401 + | let this = self.project();
|
9402 + | this.inner.as_mut().poll(cx)
|
9403 + | }
|
9404 + | }
|
9405 + |
|
9406 + | impl<B>
|
9407 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
9408 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
9409 + | B,
|
9410 + | > for crate::input::PutAndGetInlineDocumentsInput
|
9411 + | where
|
9412 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
9413 + | B: 'static,
|
9414 + |
|
9415 + | B::Data: Send,
|
9416 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
9417 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
9418 + | {
|
9419 + | type Rejection =
|
9420 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
9421 + | type Future = PutAndGetInlineDocumentsInputFuture;
|
9422 + |
|
9423 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
9424 + | let fut = async move {
|
9425 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
9426 + | request.headers(),
|
9427 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
9428 + | ) {
|
9429 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
9430 + | }
|
9431 + | crate::protocol_serde::shape_put_and_get_inline_documents::de_put_and_get_inline_documents_http_request(request)
|
9432 + | .await
|
9433 + | };
|
9434 + | use ::futures_util::future::TryFutureExt;
|
9435 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
9436 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
9437 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
9438 + | });
|
9439 + | PutAndGetInlineDocumentsInputFuture {
|
9440 + | inner: Box::pin(fut),
|
9441 + | }
|
9442 + | }
|
9443 + | }
|
9444 + | impl
|
9445 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
9446 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
9447 + | > for crate::output::PutAndGetInlineDocumentsOutput
|
9448 + | {
|
9449 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
9450 + | match crate::protocol_serde::shape_put_and_get_inline_documents::ser_put_and_get_inline_documents_http_response(self) {
|
9451 + | Ok(response) => response,
|
9452 + | Err(e) => {
|
9453 + | ::tracing::error!(error = %e, "failed to serialize response");
|
9454 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
9455 + | }
|
9456 + | }
|
9457 + | }
|
9458 + | }
|
10107 9459 |
|
10108 - | /// Serializes recursive structure shapes
|
10109 - | /// Test ID: serializes_recursive_structure_shapes
|
9460 + | #[allow(unreachable_code, unused_variables)]
|
9461 + | #[cfg(test)]
|
9462 + | mod put_and_get_inline_documents_test {
|
9463 + |
|
9464 + | /// Serializes inline documents in a JSON request.
|
9465 + | /// Test ID: PutAndGetInlineDocumentsInput
|
10110 9466 | #[::tokio::test]
|
10111 9467 | #[::tracing_test::traced_test]
|
10112 - | async fn serializes_recursive_structure_shapes_request() {
|
9468 + | async fn put_and_get_inline_documents_input_request() {
|
10113 9469 | #[allow(unused_mut)]
|
10114 - | let mut http_request = ::http::Request::builder()
|
10115 - | .uri("/")
|
10116 - | .method("POST")
|
10117 - | .header("Content-Type", "application/x-amz-json-1.1")
|
10118 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
10119 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
10120 - | ::bytes::Bytes::copy_from_slice(
|
10121 - | &::aws_smithy_protocol_test::decode_body_data("{\"String\":\"top-value\",\"Boolean\":false,\"RecursiveStruct\":{\"String\":\"nested-value\",\"Boolean\":true,\"RecursiveList\":[{\"String\":\"string-only\"},{\"RecursiveStruct\":{\"MapOfStrings\":{\"color\":\"red\",\"size\":\"large\"}}}]}}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
10122 - | )
|
10123 - | )).unwrap();
|
9470 + | let mut http_request = ::http::Request::builder()
|
9471 + | .uri("/")
|
9472 + | .method("POST")
|
9473 + | .header("Content-Type", "application/x-amz-json-1.1")
|
9474 + | .header("X-Amz-Target", "JsonProtocol.PutAndGetInlineDocuments")
|
9475 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
9476 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
9477 + | "{\n \"inlineDocument\": {\"foo\": \"bar\"}\n}".as_bytes(),
|
9478 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9479 + | )),
|
9480 + | ))
|
9481 + | .unwrap();
|
10124 9482 | #[allow(unused_mut)]
|
10125 9483 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10126 9484 | let config = crate::service::JsonProtocolConfig::builder().build();
|
10127 9485 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
10128 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
10129 - | let sender = sender.clone();
|
10130 - | async move {
|
10131 - | let result = {
|
10132 - | use ::aws_smithy_protocol_test::FloatEquals;
|
10133 - | let expected = crate::input::KitchenSinkOperationInput {
|
10134 - | string: ::std::option::Option::Some("top-value".to_owned()),
|
10135 - | boolean: ::std::option::Option::Some(false),
|
10136 - | recursive_struct: ::std::option::Option::Some(::std::boxed::Box::new(
|
10137 - | crate::model::KitchenSink {
|
10138 - | string: ::std::option::Option::Some("nested-value".to_owned()),
|
10139 - | boolean: ::std::option::Option::Some(true),
|
10140 - | recursive_list: ::std::option::Option::Some(vec![
|
10141 - | crate::model::KitchenSink {
|
10142 - | string: ::std::option::Option::Some(
|
10143 - | "string-only".to_owned(),
|
10144 - | ),
|
10145 - | blob: ::std::option::Option::None,
|
10146 - | boolean: ::std::option::Option::None,
|
10147 - | double: ::std::option::Option::None,
|
10148 - | empty_struct: ::std::option::Option::None,
|
10149 - | float: ::std::option::Option::None,
|
10150 - | httpdate_timestamp: ::std::option::Option::None,
|
10151 - | integer: ::std::option::Option::None,
|
10152 - | iso8601_timestamp: ::std::option::Option::None,
|
10153 - | json_value: ::std::option::Option::None,
|
10154 - | list_of_lists: ::std::option::Option::None,
|
10155 - | list_of_maps_of_strings: ::std::option::Option::None,
|
10156 - | list_of_strings: ::std::option::Option::None,
|
10157 - | list_of_structs: ::std::option::Option::None,
|
10158 - | long: ::std::option::Option::None,
|
10159 - | map_of_lists_of_strings: ::std::option::Option::None,
|
10160 - | map_of_maps: ::std::option::Option::None,
|
10161 - | map_of_strings: ::std::option::Option::None,
|
10162 - | map_of_structs: ::std::option::Option::None,
|
10163 - | recursive_list: ::std::option::Option::None,
|
10164 - | recursive_map: ::std::option::Option::None,
|
10165 - | recursive_struct: ::std::option::Option::None,
|
10166 - | simple_struct: ::std::option::Option::None,
|
10167 - | struct_with_json_name: ::std::option::Option::None,
|
10168 - | timestamp: ::std::option::Option::None,
|
10169 - | unix_timestamp: ::std::option::Option::None,
|
10170 - | },
|
10171 - | crate::model::KitchenSink {
|
10172 - | recursive_struct: ::std::option::Option::Some(
|
10173 - | ::std::boxed::Box::new(crate::model::KitchenSink {
|
10174 - | map_of_strings: ::std::option::Option::Some({
|
10175 - | let mut ret =
|
10176 - | ::std::collections::HashMap::new();
|
10177 - | ret.insert(
|
10178 - | "color".to_owned(),
|
10179 - | "red".to_owned(),
|
10180 - | );
|
10181 - | ret.insert(
|
10182 - | "size".to_owned(),
|
10183 - | "large".to_owned(),
|
10184 - | );
|
10185 - | ret
|
10186 - | }),
|
10187 - | blob: ::std::option::Option::None,
|
10188 - | boolean: ::std::option::Option::None,
|
10189 - | double: ::std::option::Option::None,
|
10190 - | empty_struct: ::std::option::Option::None,
|
10191 - | float: ::std::option::Option::None,
|
10192 - | httpdate_timestamp: ::std::option::Option::None,
|
10193 - | integer: ::std::option::Option::None,
|
10194 - | iso8601_timestamp: ::std::option::Option::None,
|
10195 - | json_value: ::std::option::Option::None,
|
10196 - | list_of_lists: ::std::option::Option::None,
|
10197 - | list_of_maps_of_strings:
|
10198 - | ::std::option::Option::None,
|
10199 - | list_of_strings: ::std::option::Option::None,
|
10200 - | list_of_structs: ::std::option::Option::None,
|
10201 - | long: ::std::option::Option::None,
|
10202 - | map_of_lists_of_strings:
|
10203 - | ::std::option::Option::None,
|
10204 - | map_of_maps: ::std::option::Option::None,
|
10205 - | map_of_structs: ::std::option::Option::None,
|
10206 - | recursive_list: ::std::option::Option::None,
|
10207 - | recursive_map: ::std::option::Option::None,
|
10208 - | recursive_struct: ::std::option::Option::None,
|
10209 - | simple_struct: ::std::option::Option::None,
|
10210 - | string: ::std::option::Option::None,
|
10211 - | struct_with_json_name:
|
10212 - | ::std::option::Option::None,
|
10213 - | timestamp: ::std::option::Option::None,
|
10214 - | unix_timestamp: ::std::option::Option::None,
|
10215 - | }),
|
10216 - | ),
|
10217 - | blob: ::std::option::Option::None,
|
10218 - | boolean: ::std::option::Option::None,
|
10219 - | double: ::std::option::Option::None,
|
10220 - | empty_struct: ::std::option::Option::None,
|
10221 - | float: ::std::option::Option::None,
|
10222 - | httpdate_timestamp: ::std::option::Option::None,
|
10223 - | integer: ::std::option::Option::None,
|
10224 - | iso8601_timestamp: ::std::option::Option::None,
|
10225 - | json_value: ::std::option::Option::None,
|
10226 - | list_of_lists: ::std::option::Option::None,
|
10227 - | list_of_maps_of_strings: ::std::option::Option::None,
|
10228 - | list_of_strings: ::std::option::Option::None,
|
10229 - | list_of_structs: ::std::option::Option::None,
|
10230 - | long: ::std::option::Option::None,
|
10231 - | map_of_lists_of_strings: ::std::option::Option::None,
|
10232 - | map_of_maps: ::std::option::Option::None,
|
10233 - | map_of_strings: ::std::option::Option::None,
|
10234 - | map_of_structs: ::std::option::Option::None,
|
10235 - | recursive_list: ::std::option::Option::None,
|
10236 - | recursive_map: ::std::option::Option::None,
|
10237 - | simple_struct: ::std::option::Option::None,
|
10238 - | string: ::std::option::Option::None,
|
10239 - | struct_with_json_name: ::std::option::Option::None,
|
10240 - | timestamp: ::std::option::Option::None,
|
10241 - | unix_timestamp: ::std::option::Option::None,
|
10242 - | },
|
10243 - | ]),
|
10244 - | blob: ::std::option::Option::None,
|
10245 - | double: ::std::option::Option::None,
|
10246 - | empty_struct: ::std::option::Option::None,
|
10247 - | float: ::std::option::Option::None,
|
10248 - | httpdate_timestamp: ::std::option::Option::None,
|
10249 - | integer: ::std::option::Option::None,
|
10250 - | iso8601_timestamp: ::std::option::Option::None,
|
10251 - | json_value: ::std::option::Option::None,
|
10252 - | list_of_lists: ::std::option::Option::None,
|
10253 - | list_of_maps_of_strings: ::std::option::Option::None,
|
10254 - | list_of_strings: ::std::option::Option::None,
|
10255 - | list_of_structs: ::std::option::Option::None,
|
10256 - | long: ::std::option::Option::None,
|
10257 - | map_of_lists_of_strings: ::std::option::Option::None,
|
10258 - | map_of_maps: ::std::option::Option::None,
|
10259 - | map_of_strings: ::std::option::Option::None,
|
10260 - | map_of_structs: ::std::option::Option::None,
|
10261 - | recursive_map: ::std::option::Option::None,
|
10262 - | recursive_struct: ::std::option::Option::None,
|
10263 - | simple_struct: ::std::option::Option::None,
|
10264 - | struct_with_json_name: ::std::option::Option::None,
|
10265 - | timestamp: ::std::option::Option::None,
|
10266 - | unix_timestamp: ::std::option::Option::None,
|
10267 - | },
|
10268 - | )),
|
10269 - | blob: ::std::option::Option::None,
|
10270 - | double: ::std::option::Option::None,
|
10271 - | empty_struct: ::std::option::Option::None,
|
10272 - | float: ::std::option::Option::None,
|
10273 - | httpdate_timestamp: ::std::option::Option::None,
|
10274 - | integer: ::std::option::Option::None,
|
10275 - | iso8601_timestamp: ::std::option::Option::None,
|
10276 - | json_value: ::std::option::Option::None,
|
10277 - | list_of_lists: ::std::option::Option::None,
|
10278 - | list_of_maps_of_strings: ::std::option::Option::None,
|
10279 - | list_of_strings: ::std::option::Option::None,
|
10280 - | list_of_structs: ::std::option::Option::None,
|
10281 - | long: ::std::option::Option::None,
|
10282 - | map_of_lists_of_strings: ::std::option::Option::None,
|
10283 - | map_of_maps: ::std::option::Option::None,
|
10284 - | map_of_strings: ::std::option::Option::None,
|
10285 - | map_of_structs: ::std::option::Option::None,
|
10286 - | recursive_list: ::std::option::Option::None,
|
10287 - | recursive_map: ::std::option::Option::None,
|
10288 - | simple_struct: ::std::option::Option::None,
|
10289 - | struct_with_json_name: ::std::option::Option::None,
|
10290 - | timestamp: ::std::option::Option::None,
|
10291 - | unix_timestamp: ::std::option::Option::None,
|
9486 + | .put_and_get_inline_documents(
|
9487 + | move |input: crate::input::PutAndGetInlineDocumentsInput| {
|
9488 + | let sender = sender.clone();
|
9489 + | async move {
|
9490 + | let result = {
|
9491 + | let expected = crate::input::PutAndGetInlineDocumentsInput {
|
9492 + | inline_document: ::std::option::Option::Some({
|
9493 + | let json_bytes = br#"{
|
9494 + | "foo": "bar"
|
9495 + | }"#;
|
9496 + | let mut tokens =
|
9497 + | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
9498 + | .peekable();
|
9499 + | ::aws_smithy_json::deserialize::token::expect_document(
|
9500 + | &mut tokens,
|
9501 + | )
|
9502 + | .expect("well formed json")
|
9503 + | }),
|
9504 + | };
|
9505 + | ::pretty_assertions::assert_eq!(input, expected);
|
9506 + | let output = crate::output::PutAndGetInlineDocumentsOutput {
|
9507 + | inline_document: ::std::option::Option::Some({
|
9508 + | let json_bytes = br#"null"#;
|
9509 + | let mut tokens =
|
9510 + | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
9511 + | .peekable();
|
9512 + | ::aws_smithy_json::deserialize::token::expect_document(
|
9513 + | &mut tokens,
|
9514 + | )
|
9515 + | .expect("well formed json")
|
9516 + | }),
|
9517 + | };
|
9518 + | output
|
10292 9519 | };
|
10293 - | ::pretty_assertions::assert_eq!(
|
10294 - | input.blob,
|
10295 - | expected.blob,
|
10296 - | "Unexpected value for `blob`"
|
10297 - | );
|
10298 - | ::pretty_assertions::assert_eq!(
|
10299 - | input.boolean,
|
10300 - | expected.boolean,
|
10301 - | "Unexpected value for `boolean`"
|
10302 - | );
|
10303 - | assert!(
|
10304 - | input.double.float_equals(&expected.double),
|
10305 - | "Unexpected value for `double` {:?} vs. {:?}",
|
10306 - | expected.double,
|
10307 - | input.double
|
10308 - | );
|
10309 - | ::pretty_assertions::assert_eq!(
|
10310 - | input.empty_struct,
|
10311 - | expected.empty_struct,
|
10312 - | "Unexpected value for `empty_struct`"
|
10313 - | );
|
10314 - | assert!(
|
10315 - | input.float.float_equals(&expected.float),
|
10316 - | "Unexpected value for `float` {:?} vs. {:?}",
|
10317 - | expected.float,
|
10318 - | input.float
|
10319 - | );
|
10320 - | ::pretty_assertions::assert_eq!(
|
10321 - | input.httpdate_timestamp,
|
10322 - | expected.httpdate_timestamp,
|
10323 - | "Unexpected value for `httpdate_timestamp`"
|
10324 - | );
|
10325 - | ::pretty_assertions::assert_eq!(
|
10326 - | input.integer,
|
10327 - | expected.integer,
|
10328 - | "Unexpected value for `integer`"
|
10329 - | );
|
10330 - | ::pretty_assertions::assert_eq!(
|
10331 - | input.iso8601_timestamp,
|
10332 - | expected.iso8601_timestamp,
|
10333 - | "Unexpected value for `iso8601_timestamp`"
|
10334 - | );
|
10335 - | ::pretty_assertions::assert_eq!(
|
10336 - | input.json_value,
|
10337 - | expected.json_value,
|
10338 - | "Unexpected value for `json_value`"
|
10339 - | );
|
10340 - | ::pretty_assertions::assert_eq!(
|
10341 - | input.list_of_lists,
|
10342 - | expected.list_of_lists,
|
10343 - | "Unexpected value for `list_of_lists`"
|
10344 - | );
|
10345 - | ::pretty_assertions::assert_eq!(
|
10346 - | input.list_of_maps_of_strings,
|
10347 - | expected.list_of_maps_of_strings,
|
10348 - | "Unexpected value for `list_of_maps_of_strings`"
|
10349 - | );
|
10350 - | ::pretty_assertions::assert_eq!(
|
10351 - | input.list_of_strings,
|
10352 - | expected.list_of_strings,
|
10353 - | "Unexpected value for `list_of_strings`"
|
10354 - | );
|
10355 - | ::pretty_assertions::assert_eq!(
|
10356 - | input.list_of_structs,
|
10357 - | expected.list_of_structs,
|
10358 - | "Unexpected value for `list_of_structs`"
|
10359 - | );
|
10360 - | ::pretty_assertions::assert_eq!(
|
10361 - | input.long,
|
10362 - | expected.long,
|
10363 - | "Unexpected value for `long`"
|
10364 - | );
|
10365 - | ::pretty_assertions::assert_eq!(
|
10366 - | input.map_of_lists_of_strings,
|
10367 - | expected.map_of_lists_of_strings,
|
10368 - | "Unexpected value for `map_of_lists_of_strings`"
|
10369 - | );
|
10370 - | ::pretty_assertions::assert_eq!(
|
10371 - | input.map_of_maps,
|
10372 - | expected.map_of_maps,
|
10373 - | "Unexpected value for `map_of_maps`"
|
10374 - | );
|
10375 - | ::pretty_assertions::assert_eq!(
|
10376 - | input.map_of_strings,
|
10377 - | expected.map_of_strings,
|
10378 - | "Unexpected value for `map_of_strings`"
|
10379 - | );
|
10380 - | ::pretty_assertions::assert_eq!(
|
10381 - | input.map_of_structs,
|
10382 - | expected.map_of_structs,
|
10383 - | "Unexpected value for `map_of_structs`"
|
10384 - | );
|
10385 - | ::pretty_assertions::assert_eq!(
|
10386 - | input.recursive_list,
|
10387 - | expected.recursive_list,
|
10388 - | "Unexpected value for `recursive_list`"
|
10389 - | );
|
10390 - | ::pretty_assertions::assert_eq!(
|
10391 - | input.recursive_map,
|
10392 - | expected.recursive_map,
|
10393 - | "Unexpected value for `recursive_map`"
|
10394 - | );
|
10395 - | ::pretty_assertions::assert_eq!(
|
10396 - | input.recursive_struct,
|
10397 - | expected.recursive_struct,
|
10398 - | "Unexpected value for `recursive_struct`"
|
10399 - | );
|
10400 - | ::pretty_assertions::assert_eq!(
|
10401 - | input.simple_struct,
|
10402 - | expected.simple_struct,
|
10403 - | "Unexpected value for `simple_struct`"
|
10404 - | );
|
10405 - | ::pretty_assertions::assert_eq!(
|
10406 - | input.string,
|
10407 - | expected.string,
|
10408 - | "Unexpected value for `string`"
|
10409 - | );
|
10410 - | ::pretty_assertions::assert_eq!(
|
10411 - | input.struct_with_json_name,
|
10412 - | expected.struct_with_json_name,
|
10413 - | "Unexpected value for `struct_with_json_name`"
|
10414 - | );
|
10415 - | ::pretty_assertions::assert_eq!(
|
10416 - | input.timestamp,
|
10417 - | expected.timestamp,
|
10418 - | "Unexpected value for `timestamp`"
|
10419 - | );
|
10420 - | ::pretty_assertions::assert_eq!(
|
10421 - | input.unix_timestamp,
|
10422 - | expected.unix_timestamp,
|
10423 - | "Unexpected value for `unix_timestamp`"
|
10424 - | );
|
10425 - | let output = crate::output::KitchenSinkOperationOutput {
|
10426 - | blob: ::std::option::Option::None,
|
10427 - | boolean: ::std::option::Option::None,
|
10428 - | double: ::std::option::Option::None,
|
10429 - | empty_struct: ::std::option::Option::None,
|
10430 - | float: ::std::option::Option::None,
|
10431 - | httpdate_timestamp: ::std::option::Option::None,
|
10432 - | integer: ::std::option::Option::None,
|
10433 - | iso8601_timestamp: ::std::option::Option::None,
|
10434 - | json_value: ::std::option::Option::None,
|
10435 - | list_of_lists: ::std::option::Option::None,
|
10436 - | list_of_maps_of_strings: ::std::option::Option::None,
|
10437 - | list_of_strings: ::std::option::Option::None,
|
10438 - | list_of_structs: ::std::option::Option::None,
|
10439 - | long: ::std::option::Option::None,
|
10440 - | map_of_lists_of_strings: ::std::option::Option::None,
|
10441 - | map_of_maps: ::std::option::Option::None,
|
10442 - | map_of_strings: ::std::option::Option::None,
|
10443 - | map_of_structs: ::std::option::Option::None,
|
10444 - | recursive_list: ::std::option::Option::None,
|
10445 - | recursive_map: ::std::option::Option::None,
|
10446 - | recursive_struct: ::std::option::Option::None,
|
10447 - | simple_struct: ::std::option::Option::None,
|
9520 + | sender.send(()).await.expect("receiver dropped early");
|
9521 + | result
|
9522 + | }
|
9523 + | },
|
9524 + | )
|
9525 + | .build_unchecked();
|
9526 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9527 + | .await
|
9528 + | .expect("unable to make an HTTP request");
|
9529 + | assert!(
|
9530 + | receiver.recv().await.is_some(),
|
9531 + | "we expected operation handler to be invoked but it was not entered"
|
9532 + | );
|
9533 + | }
|
9534 + |
|
9535 + | /// Serializes inline documents in a JSON response.
|
9536 + | /// Test ID: PutAndGetInlineDocumentsInput
|
9537 + | #[::tokio::test]
|
9538 + | #[::tracing_test::traced_test]
|
9539 + | async fn put_and_get_inline_documents_input_response() {
|
9540 + | let output = crate::output::PutAndGetInlineDocumentsOutput {
|
9541 + | inline_document: ::std::option::Option::Some({
|
9542 + | let json_bytes = br#"{
|
9543 + | "foo": "bar"
|
9544 + | }"#;
|
9545 + | let mut tokens =
|
9546 + | ::aws_smithy_json::deserialize::json_token_iter(json_bytes).peekable();
|
9547 + | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
9548 + | .expect("well formed json")
|
9549 + | }),
|
9550 + | };
|
9551 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
9552 + | let http_response = output.into_response();
|
9553 + | ::pretty_assertions::assert_eq!(
|
9554 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
9555 + | http_response.status()
|
9556 + | );
|
9557 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
9558 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9559 + | http_response.headers(),
|
9560 + | expected_headers,
|
9561 + | ));
|
9562 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
9563 + | .await
|
9564 + | .expect("unable to extract body to bytes");
|
9565 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
9566 + | &body,
|
9567 + | "{\n \"inlineDocument\": {\"foo\": \"bar\"}\n}",
|
9568 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9569 + | ));
|
9570 + | }
|
9571 + | }
|
9572 + |
|
9573 + | ::pin_project_lite::pin_project! {
|
9574 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
9575 + | /// [`JsonEnumsInput`](crate::input::JsonEnumsInput) using modelled bindings.
|
9576 + | pub struct JsonEnumsInputFuture {
|
9577 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::JsonEnumsInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
9578 + | }
|
9579 + | }
|
9580 + |
|
9581 + | impl std::future::Future for JsonEnumsInputFuture {
|
9582 + | type Output = Result<
|
9583 + | crate::input::JsonEnumsInput,
|
9584 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
9585 + | >;
|
9586 + |
|
9587 + | fn poll(
|
9588 + | self: std::pin::Pin<&mut Self>,
|
9589 + | cx: &mut std::task::Context<'_>,
|
9590 + | ) -> std::task::Poll<Self::Output> {
|
9591 + | let this = self.project();
|
9592 + | this.inner.as_mut().poll(cx)
|
9593 + | }
|
9594 + | }
|
9595 + |
|
9596 + | impl<B>
|
9597 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
9598 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
9599 + | B,
|
9600 + | > for crate::input::JsonEnumsInput
|
9601 + | where
|
9602 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
9603 + | B: 'static,
|
9604 + |
|
9605 + | B::Data: Send,
|
9606 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
9607 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
9608 + | {
|
9609 + | type Rejection =
|
9610 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
9611 + | type Future = JsonEnumsInputFuture;
|
9612 + |
|
9613 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
9614 + | let fut = async move {
|
9615 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
9616 + | request.headers(),
|
9617 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
9618 + | ) {
|
9619 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
9620 + | }
|
9621 + | crate::protocol_serde::shape_json_enums::de_json_enums_http_request(request).await
|
9622 + | };
|
9623 + | use ::futures_util::future::TryFutureExt;
|
9624 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
9625 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
9626 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
9627 + | });
|
9628 + | JsonEnumsInputFuture {
|
9629 + | inner: Box::pin(fut),
|
9630 + | }
|
9631 + | }
|
9632 + | }
|
9633 + | impl
|
9634 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
9635 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
9636 + | > for crate::output::JsonEnumsOutput
|
9637 + | {
|
9638 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
9639 + | match crate::protocol_serde::shape_json_enums::ser_json_enums_http_response(self) {
|
9640 + | Ok(response) => response,
|
9641 + | Err(e) => {
|
9642 + | ::tracing::error!(error = %e, "failed to serialize response");
|
9643 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
9644 + | }
|
9645 + | }
|
9646 + | }
|
9647 + | }
|
9648 + | impl
|
9649 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
9650 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
9651 + | > for crate::error::JsonEnumsError
|
9652 + | {
|
9653 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
9654 + | match crate::protocol_serde::shape_json_enums::ser_json_enums_http_error(&self) {
|
9655 + | Ok(mut response) => {
|
9656 + | response.extensions_mut().insert(
|
9657 + | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
9658 + | self.name(),
|
9659 + | ),
|
9660 + | );
|
9661 + | response
|
9662 + | }
|
9663 + | Err(e) => {
|
9664 + | ::tracing::error!(error = %e, "failed to serialize response");
|
9665 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
9666 + | }
|
9667 + | }
|
9668 + | }
|
9669 + | }
|
9670 + |
|
9671 + | #[allow(unreachable_code, unused_variables)]
|
9672 + | #[cfg(test)]
|
9673 + | mod json_enums_test {
|
9674 + |
|
9675 + | /// Serializes simple scalar properties
|
9676 + | /// Test ID: AwsJson11Enums
|
9677 + | #[::tokio::test]
|
9678 + | #[::tracing_test::traced_test]
|
9679 + | async fn aws_json11_enums_request() {
|
9680 + | #[allow(unused_mut)]
|
9681 + | let mut http_request = ::http::Request::builder()
|
9682 + | .uri("/")
|
9683 + | .method("POST")
|
9684 + | .header("Content-Type", "application/x-amz-json-1.1")
|
9685 + | .header("X-Amz-Target", "JsonProtocol.JsonEnums")
|
9686 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
9687 + | ::bytes::Bytes::copy_from_slice(
|
9688 + | &::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"))
|
9689 + | )
|
9690 + | )).unwrap();
|
9691 + | #[allow(unused_mut)]
|
9692 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9693 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
9694 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9695 + | .json_enums(move |input: crate::input::JsonEnumsInput| {
|
9696 + | let sender = sender.clone();
|
9697 + | async move {
|
9698 + | let result = {
|
9699 + | let expected = crate::input::JsonEnumsInput {
|
9700 + | foo_enum1: ::std::option::Option::Some(
|
9701 + | "Foo"
|
9702 + | .parse::<crate::model::FooEnum>()
|
9703 + | .expect("static value validated to member"),
|
9704 + | ),
|
9705 + | foo_enum2: ::std::option::Option::Some(
|
9706 + | "0".parse::<crate::model::FooEnum>()
|
9707 + | .expect("static value validated to member"),
|
9708 + | ),
|
9709 + | foo_enum3: ::std::option::Option::Some(
|
9710 + | "1".parse::<crate::model::FooEnum>()
|
9711 + | .expect("static value validated to member"),
|
9712 + | ),
|
9713 + | foo_enum_list: ::std::option::Option::Some(vec![
|
9714 + | "Foo"
|
9715 + | .parse::<crate::model::FooEnum>()
|
9716 + | .expect("static value validated to member"),
|
9717 + | "0".parse::<crate::model::FooEnum>()
|
9718 + | .expect("static value validated to member"),
|
9719 + | ]),
|
9720 + | foo_enum_set: ::std::option::Option::Some(
|
9721 + | vec![
|
9722 + | "Foo"
|
9723 + | .parse::<crate::model::FooEnum>()
|
9724 + | .expect("static value validated to member"),
|
9725 + | "0".parse::<crate::model::FooEnum>()
|
9726 + | .expect("static value validated to member"),
|
9727 + | ]
|
9728 + | .try_into()
|
9729 + | .expect("this is only used in tests"),
|
9730 + | ),
|
9731 + | foo_enum_map: ::std::option::Option::Some({
|
9732 + | let mut ret = ::std::collections::HashMap::new();
|
9733 + | ret.insert(
|
9734 + | "hi".to_owned(),
|
9735 + | "Foo"
|
9736 + | .parse::<crate::model::FooEnum>()
|
9737 + | .expect("static value validated to member"),
|
9738 + | );
|
9739 + | ret.insert(
|
9740 + | "zero".to_owned(),
|
9741 + | "0".parse::<crate::model::FooEnum>()
|
9742 + | .expect("static value validated to member"),
|
9743 + | );
|
9744 + | ret
|
9745 + | }),
|
9746 + | };
|
9747 + | ::pretty_assertions::assert_eq!(input, expected);
|
9748 + | let output = crate::output::JsonEnumsOutput {
|
9749 + | foo_enum1: ::std::option::Option::None,
|
9750 + | foo_enum2: ::std::option::Option::None,
|
9751 + | foo_enum3: ::std::option::Option::None,
|
9752 + | foo_enum_list: ::std::option::Option::None,
|
9753 + | foo_enum_set: ::std::option::Option::None,
|
9754 + | foo_enum_map: ::std::option::Option::None,
|
9755 + | };
|
9756 + | Ok(output)
|
9757 + | };
|
9758 + | sender.send(()).await.expect("receiver dropped early");
|
9759 + | result
|
9760 + | }
|
9761 + | })
|
9762 + | .build_unchecked();
|
9763 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9764 + | .await
|
9765 + | .expect("unable to make an HTTP request");
|
9766 + | assert!(
|
9767 + | receiver.recv().await.is_some(),
|
9768 + | "we expected operation handler to be invoked but it was not entered"
|
9769 + | );
|
9770 + | }
|
9771 + |
|
9772 + | /// Serializes simple scalar properties
|
9773 + | /// Test ID: AwsJson11Enums
|
9774 + | #[::tokio::test]
|
9775 + | #[::tracing_test::traced_test]
|
9776 + | async fn aws_json11_enums_response() {
|
9777 + | let output = crate::output::JsonEnumsOutput {
|
9778 + | foo_enum1: ::std::option::Option::Some(
|
9779 + | "Foo"
|
9780 + | .parse::<crate::model::FooEnum>()
|
9781 + | .expect("static value validated to member"),
|
9782 + | ),
|
9783 + | foo_enum2: ::std::option::Option::Some(
|
9784 + | "0".parse::<crate::model::FooEnum>()
|
9785 + | .expect("static value validated to member"),
|
9786 + | ),
|
9787 + | foo_enum3: ::std::option::Option::Some(
|
9788 + | "1".parse::<crate::model::FooEnum>()
|
9789 + | .expect("static value validated to member"),
|
9790 + | ),
|
9791 + | foo_enum_list: ::std::option::Option::Some(vec![
|
9792 + | "Foo"
|
9793 + | .parse::<crate::model::FooEnum>()
|
9794 + | .expect("static value validated to member"),
|
9795 + | "0".parse::<crate::model::FooEnum>()
|
9796 + | .expect("static value validated to member"),
|
9797 + | ]),
|
9798 + | foo_enum_set: ::std::option::Option::Some(
|
9799 + | vec![
|
9800 + | "Foo"
|
9801 + | .parse::<crate::model::FooEnum>()
|
9802 + | .expect("static value validated to member"),
|
9803 + | "0".parse::<crate::model::FooEnum>()
|
9804 + | .expect("static value validated to member"),
|
9805 + | ]
|
9806 + | .try_into()
|
9807 + | .expect("this is only used in tests"),
|
9808 + | ),
|
9809 + | foo_enum_map: ::std::option::Option::Some({
|
9810 + | let mut ret = ::std::collections::HashMap::new();
|
9811 + | ret.insert(
|
9812 + | "hi".to_owned(),
|
9813 + | "Foo"
|
9814 + | .parse::<crate::model::FooEnum>()
|
9815 + | .expect("static value validated to member"),
|
9816 + | );
|
9817 + | ret.insert(
|
9818 + | "zero".to_owned(),
|
9819 + | "0".parse::<crate::model::FooEnum>()
|
9820 + | .expect("static value validated to member"),
|
9821 + | );
|
9822 + | ret
|
9823 + | }),
|
9824 + | };
|
9825 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
9826 + | let http_response = output.into_response();
|
9827 + | ::pretty_assertions::assert_eq!(
|
9828 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
9829 + | http_response.status()
|
9830 + | );
|
9831 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
9832 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9833 + | http_response.headers(),
|
9834 + | expected_headers,
|
9835 + | ));
|
9836 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
9837 + | .await
|
9838 + | .expect("unable to extract body to bytes");
|
9839 + | ::aws_smithy_protocol_test::assert_ok(
|
9840 + | ::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"))
|
9841 + | );
|
9842 + | }
|
9843 + | }
|
9844 + |
|
9845 + | ::pin_project_lite::pin_project! {
|
9846 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
9847 + | /// [`JsonIntEnumsInput`](crate::input::JsonIntEnumsInput) using modelled bindings.
|
9848 + | pub struct JsonIntEnumsInputFuture {
|
9849 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::JsonIntEnumsInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
9850 + | }
|
9851 + | }
|
9852 + |
|
9853 + | impl std::future::Future for JsonIntEnumsInputFuture {
|
9854 + | type Output = Result<
|
9855 + | crate::input::JsonIntEnumsInput,
|
9856 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
9857 + | >;
|
9858 + |
|
9859 + | fn poll(
|
9860 + | self: std::pin::Pin<&mut Self>,
|
9861 + | cx: &mut std::task::Context<'_>,
|
9862 + | ) -> std::task::Poll<Self::Output> {
|
9863 + | let this = self.project();
|
9864 + | this.inner.as_mut().poll(cx)
|
9865 + | }
|
9866 + | }
|
9867 + |
|
9868 + | impl<B>
|
9869 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
9870 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
9871 + | B,
|
9872 + | > for crate::input::JsonIntEnumsInput
|
9873 + | where
|
9874 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
9875 + | B: 'static,
|
9876 + |
|
9877 + | B::Data: Send,
|
9878 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
9879 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
9880 + | {
|
9881 + | type Rejection =
|
9882 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
9883 + | type Future = JsonIntEnumsInputFuture;
|
9884 + |
|
9885 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
9886 + | let fut = async move {
|
9887 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
9888 + | request.headers(),
|
9889 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
9890 + | ) {
|
9891 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
9892 + | }
|
9893 + | crate::protocol_serde::shape_json_int_enums::de_json_int_enums_http_request(request)
|
9894 + | .await
|
9895 + | };
|
9896 + | use ::futures_util::future::TryFutureExt;
|
9897 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
9898 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
9899 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
9900 + | });
|
9901 + | JsonIntEnumsInputFuture {
|
9902 + | inner: Box::pin(fut),
|
9903 + | }
|
9904 + | }
|
9905 + | }
|
9906 + | impl
|
9907 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
9908 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
9909 + | > for crate::output::JsonIntEnumsOutput
|
9910 + | {
|
9911 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
9912 + | match crate::protocol_serde::shape_json_int_enums::ser_json_int_enums_http_response(self) {
|
9913 + | Ok(response) => response,
|
9914 + | Err(e) => {
|
9915 + | ::tracing::error!(error = %e, "failed to serialize response");
|
9916 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
9917 + | }
|
9918 + | }
|
9919 + | }
|
9920 + | }
|
9921 + | impl
|
9922 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
9923 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
9924 + | > for crate::error::JsonIntEnumsError
|
9925 + | {
|
9926 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
9927 + | match crate::protocol_serde::shape_json_int_enums::ser_json_int_enums_http_error(&self) {
|
9928 + | Ok(mut response) => {
|
9929 + | response.extensions_mut().insert(
|
9930 + | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
9931 + | self.name(),
|
9932 + | ),
|
9933 + | );
|
9934 + | response
|
9935 + | }
|
9936 + | Err(e) => {
|
9937 + | ::tracing::error!(error = %e, "failed to serialize response");
|
9938 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
9939 + | }
|
9940 + | }
|
9941 + | }
|
9942 + | }
|
9943 + |
|
9944 + | #[allow(unreachable_code, unused_variables)]
|
9945 + | #[cfg(test)]
|
9946 + | mod json_int_enums_test {
|
9947 + |
|
9948 + | /// Serializes simple scalar properties
|
9949 + | /// Test ID: AwsJson11IntEnums
|
9950 + | #[::tokio::test]
|
9951 + | #[::tracing_test::traced_test]
|
9952 + | async fn aws_json11_int_enums_request() {
|
9953 + | #[allow(unused_mut)]
|
9954 + | let mut http_request = ::http::Request::builder()
|
9955 + | .uri("/")
|
9956 + | .method("POST")
|
9957 + | .header("Content-Type", "application/x-amz-json-1.1")
|
9958 + | .header("X-Amz-Target", "JsonProtocol.JsonIntEnums")
|
9959 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
9960 + | ::bytes::Bytes::copy_from_slice(
|
9961 + | &::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"))
|
9962 + | )
|
9963 + | )).unwrap();
|
9964 + | #[allow(unused_mut)]
|
9965 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9966 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
9967 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9968 + | .json_int_enums(move |input: crate::input::JsonIntEnumsInput| {
|
9969 + | let sender = sender.clone();
|
9970 + | async move {
|
9971 + | let result = {
|
9972 + | let expected = crate::input::JsonIntEnumsInput {
|
9973 + | int_enum1: ::std::option::Option::Some(1),
|
9974 + | int_enum2: ::std::option::Option::Some(2),
|
9975 + | int_enum3: ::std::option::Option::Some(3),
|
9976 + | int_enum_list: ::std::option::Option::Some(vec![1, 2]),
|
9977 + | int_enum_set: ::std::option::Option::Some(
|
9978 + | vec![1, 2].try_into().expect("this is only used in tests"),
|
9979 + | ),
|
9980 + | int_enum_map: ::std::option::Option::Some({
|
9981 + | let mut ret = ::std::collections::HashMap::new();
|
9982 + | ret.insert("a".to_owned(), 1);
|
9983 + | ret.insert("b".to_owned(), 2);
|
9984 + | ret
|
9985 + | }),
|
9986 + | };
|
9987 + | ::pretty_assertions::assert_eq!(input, expected);
|
9988 + | let output = crate::output::JsonIntEnumsOutput {
|
9989 + | int_enum1: ::std::option::Option::None,
|
9990 + | int_enum2: ::std::option::Option::None,
|
9991 + | int_enum3: ::std::option::Option::None,
|
9992 + | int_enum_list: ::std::option::Option::None,
|
9993 + | int_enum_set: ::std::option::Option::None,
|
9994 + | int_enum_map: ::std::option::Option::None,
|
9995 + | };
|
9996 + | Ok(output)
|
9997 + | };
|
9998 + | sender.send(()).await.expect("receiver dropped early");
|
9999 + | result
|
10000 + | }
|
10001 + | })
|
10002 + | .build_unchecked();
|
10003 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10004 + | .await
|
10005 + | .expect("unable to make an HTTP request");
|
10006 + | assert!(
|
10007 + | receiver.recv().await.is_some(),
|
10008 + | "we expected operation handler to be invoked but it was not entered"
|
10009 + | );
|
10010 + | }
|
10011 + |
|
10012 + | /// Serializes simple scalar properties
|
10013 + | /// Test ID: AwsJson11IntEnums
|
10014 + | #[::tokio::test]
|
10015 + | #[::tracing_test::traced_test]
|
10016 + | #[should_panic]
|
10017 + | async fn aws_json11_int_enums_response() {
|
10018 + | let output = crate::output::JsonIntEnumsOutput {
|
10019 + | int_enum1: ::std::option::Option::Some(1),
|
10020 + | int_enum2: ::std::option::Option::Some(2),
|
10021 + | int_enum3: ::std::option::Option::Some(3),
|
10022 + | int_enum_list: ::std::option::Option::Some(vec![1, 2]),
|
10023 + | int_enum_set: ::std::option::Option::Some(
|
10024 + | vec![1, 2].try_into().expect("this is only used in tests"),
|
10025 + | ),
|
10026 + | int_enum_map: ::std::option::Option::Some({
|
10027 + | let mut ret = ::std::collections::HashMap::new();
|
10028 + | ret.insert("a".to_owned(), 1);
|
10029 + | ret.insert("b".to_owned(), 2);
|
10030 + | ret
|
10031 + | }),
|
10032 + | };
|
10033 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
10034 + | let http_response = output.into_response();
|
10035 + | ::pretty_assertions::assert_eq!(
|
10036 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10037 + | http_response.status()
|
10038 + | );
|
10039 + | let expected_headers = [
|
10040 + | ("Content-Type", "application/x-amz-json-1.1"),
|
10041 + | ("X-Amz-Target", "JsonProtocol.JsonIntEnums"),
|
10042 + | ];
|
10043 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10044 + | http_response.headers(),
|
10045 + | expected_headers,
|
10046 + | ));
|
10047 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10048 + | .await
|
10049 + | .expect("unable to extract body to bytes");
|
10050 + | ::aws_smithy_protocol_test::assert_ok(
|
10051 + | ::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"))
|
10052 + | );
|
10053 + | }
|
10054 + | }
|
10055 + |
|
10056 + | ::pin_project_lite::pin_project! {
|
10057 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
10058 + | /// [`NullOperationInput`](crate::input::NullOperationInput) using modelled bindings.
|
10059 + | pub struct NullOperationInputFuture {
|
10060 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::NullOperationInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
10061 + | }
|
10062 + | }
|
10063 + |
|
10064 + | impl std::future::Future for NullOperationInputFuture {
|
10065 + | type Output = Result<
|
10066 + | crate::input::NullOperationInput,
|
10067 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
10068 + | >;
|
10069 + |
|
10070 + | fn poll(
|
10071 + | self: std::pin::Pin<&mut Self>,
|
10072 + | cx: &mut std::task::Context<'_>,
|
10073 + | ) -> std::task::Poll<Self::Output> {
|
10074 + | let this = self.project();
|
10075 + | this.inner.as_mut().poll(cx)
|
10076 + | }
|
10077 + | }
|
10078 + |
|
10079 + | impl<B>
|
10080 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
10081 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10082 + | B,
|
10083 + | > for crate::input::NullOperationInput
|
10084 + | where
|
10085 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
10086 + | B: 'static,
|
10087 + |
|
10088 + | B::Data: Send,
|
10089 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
10090 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
10091 + | {
|
10092 + | type Rejection =
|
10093 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
10094 + | type Future = NullOperationInputFuture;
|
10095 + |
|
10096 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
10097 + | let fut = async move {
|
10098 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
10099 + | request.headers(),
|
10100 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
10101 + | ) {
|
10102 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
10103 + | }
|
10104 + | crate::protocol_serde::shape_null_operation::de_null_operation_http_request(request)
|
10105 + | .await
|
10106 + | };
|
10107 + | use ::futures_util::future::TryFutureExt;
|
10108 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
10109 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
10110 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
10111 + | });
|
10112 + | NullOperationInputFuture {
|
10113 + | inner: Box::pin(fut),
|
10114 + | }
|
10115 + | }
|
10116 + | }
|
10117 + | impl
|
10118 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
10119 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10120 + | > for crate::output::NullOperationOutput
|
10121 + | {
|
10122 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
10123 + | match crate::protocol_serde::shape_null_operation::ser_null_operation_http_response(self) {
|
10124 + | Ok(response) => response,
|
10125 + | Err(e) => {
|
10126 + | ::tracing::error!(error = %e, "failed to serialize response");
|
10127 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
10128 + | }
|
10129 + | }
|
10130 + | }
|
10131 + | }
|
10132 + |
|
10133 + | #[allow(unreachable_code, unused_variables)]
|
10134 + | #[cfg(test)]
|
10135 + | mod null_operation_test {
|
10136 + |
|
10137 + | /// Null structure values are dropped
|
10138 + | /// Test ID: AwsJson11ServersDontDeserializeNullStructureValues
|
10139 + | #[::tokio::test]
|
10140 + | #[::tracing_test::traced_test]
|
10141 + | async fn aws_json11_servers_dont_deserialize_null_structure_values_request() {
|
10142 + | #[allow(unused_mut)]
|
10143 + | let mut http_request = ::http::Request::builder()
|
10144 + | .uri("/")
|
10145 + | .method("POST")
|
10146 + | .header("Content-Type", "application/x-amz-json-1.1")
|
10147 + | .header("X-Amz-Target", "JsonProtocol.NullOperation")
|
10148 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
10149 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
10150 + | "{\n \"string\": null\n}".as_bytes(),
|
10151 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10152 + | )),
|
10153 + | ))
|
10154 + | .unwrap();
|
10155 + | #[allow(unused_mut)]
|
10156 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10157 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
10158 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
10159 + | .null_operation(move |input: crate::input::NullOperationInput| {
|
10160 + | let sender = sender.clone();
|
10161 + | async move {
|
10162 + | let result = {
|
10163 + | let expected = crate::input::NullOperationInput {
|
10448 10164 | string: ::std::option::Option::None,
|
10449 - | struct_with_json_name: ::std::option::Option::None,
|
10450 - | timestamp: ::std::option::Option::None,
|
10451 - | unix_timestamp: ::std::option::Option::None,
|
10452 10165 | };
|
10453 - | Ok(output)
|
10166 + | ::pretty_assertions::assert_eq!(input, expected);
|
10167 + | let output = crate::output::NullOperationOutput {
|
10168 + | string: ::std::option::Option::None,
|
10169 + | };
|
10170 + | output
|
10454 10171 | };
|
10455 10172 | sender.send(()).await.expect("receiver dropped early");
|
10456 10173 | result
|
10457 10174 | }
|
10458 10175 | })
|
10459 10176 | .build_unchecked();
|
10460 10177 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10461 10178 | .await
|
10462 10179 | .expect("unable to make an HTTP request");
|
10463 10180 | assert!(
|
10464 10181 | receiver.recv().await.is_some(),
|
10465 10182 | "we expected operation handler to be invoked but it was not entered"
|
10466 10183 | );
|
10467 10184 | }
|
10468 10185 |
|
10469 - | /// Parses operations with empty JSON bodies
|
10470 - | /// Test ID: parses_operations_with_empty_json_bodies
|
10186 + | /// Null structure values are dropped
|
10187 + | /// Test ID: AwsJson11ServersDontSerializeNullStructureValues
|
10471 10188 | #[::tokio::test]
|
10472 10189 | #[::tracing_test::traced_test]
|
10473 - | async fn parses_operations_with_empty_json_bodies_response() {
|
10474 - | let output = crate::output::KitchenSinkOperationOutput {
|
10475 - | blob: ::std::option::Option::None,
|
10476 - | boolean: ::std::option::Option::None,
|
10477 - | double: ::std::option::Option::None,
|
10478 - | empty_struct: ::std::option::Option::None,
|
10479 - | float: ::std::option::Option::None,
|
10480 - | httpdate_timestamp: ::std::option::Option::None,
|
10481 - | integer: ::std::option::Option::None,
|
10482 - | iso8601_timestamp: ::std::option::Option::None,
|
10483 - | json_value: ::std::option::Option::None,
|
10484 - | list_of_lists: ::std::option::Option::None,
|
10485 - | list_of_maps_of_strings: ::std::option::Option::None,
|
10486 - | list_of_strings: ::std::option::Option::None,
|
10487 - | list_of_structs: ::std::option::Option::None,
|
10488 - | long: ::std::option::Option::None,
|
10489 - | map_of_lists_of_strings: ::std::option::Option::None,
|
10490 - | map_of_maps: ::std::option::Option::None,
|
10491 - | map_of_strings: ::std::option::Option::None,
|
10492 - | map_of_structs: ::std::option::Option::None,
|
10493 - | recursive_list: ::std::option::Option::None,
|
10494 - | recursive_map: ::std::option::Option::None,
|
10495 - | recursive_struct: ::std::option::Option::None,
|
10496 - | simple_struct: ::std::option::Option::None,
|
10190 + | async fn aws_json11_servers_dont_serialize_null_structure_values_response() {
|
10191 + | let output = crate::output::NullOperationOutput {
|
10497 10192 | string: ::std::option::Option::None,
|
10498 - | struct_with_json_name: ::std::option::Option::None,
|
10499 - | timestamp: ::std::option::Option::None,
|
10500 - | unix_timestamp: ::std::option::Option::None,
|
10501 10193 | };
|
10502 10194 | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
10503 10195 | let http_response = output.into_response();
|
10504 10196 | ::pretty_assertions::assert_eq!(
|
10505 10197 | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10506 10198 | http_response.status()
|
10507 10199 | );
|
10508 10200 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10509 10201 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10510 10202 | http_response.headers(),
|
10511 10203 | expected_headers,
|
10512 10204 | ));
|
10513 10205 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10514 10206 | .await
|
10515 10207 | .expect("unable to extract body to bytes");
|
10516 10208 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10517 10209 | &body,
|
10518 10210 | "{}",
|
10519 10211 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10520 10212 | ));
|
10521 10213 | }
|
10214 + | }
|
10215 + |
|
10216 + | ::pin_project_lite::pin_project! {
|
10217 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
10218 + | /// [`SparseNullsOperationInput`](crate::input::SparseNullsOperationInput) using modelled bindings.
|
10219 + | pub struct SparseNullsOperationInputFuture {
|
10220 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SparseNullsOperationInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
10221 + | }
|
10222 + | }
|
10223 + |
|
10224 + | impl std::future::Future for SparseNullsOperationInputFuture {
|
10225 + | type Output = Result<
|
10226 + | crate::input::SparseNullsOperationInput,
|
10227 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
10228 + | >;
|
10229 + |
|
10230 + | fn poll(
|
10231 + | self: std::pin::Pin<&mut Self>,
|
10232 + | cx: &mut std::task::Context<'_>,
|
10233 + | ) -> std::task::Poll<Self::Output> {
|
10234 + | let this = self.project();
|
10235 + | this.inner.as_mut().poll(cx)
|
10236 + | }
|
10237 + | }
|
10238 + |
|
10239 + | impl<B>
|
10240 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
10241 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10242 + | B,
|
10243 + | > for crate::input::SparseNullsOperationInput
|
10244 + | where
|
10245 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
10246 + | B: 'static,
|
10247 + |
|
10248 + | B::Data: Send,
|
10249 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
10250 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
10251 + | {
|
10252 + | type Rejection =
|
10253 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
10254 + | type Future = SparseNullsOperationInputFuture;
|
10255 + |
|
10256 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
10257 + | let fut = async move {
|
10258 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
10259 + | request.headers(),
|
10260 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
10261 + | ) {
|
10262 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
10263 + | }
|
10264 + | crate::protocol_serde::shape_sparse_nulls_operation::de_sparse_nulls_operation_http_request(request)
|
10265 + | .await
|
10266 + | };
|
10267 + | use ::futures_util::future::TryFutureExt;
|
10268 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
10269 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
10270 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
10271 + | });
|
10272 + | SparseNullsOperationInputFuture {
|
10273 + | inner: Box::pin(fut),
|
10274 + | }
|
10275 + | }
|
10276 + | }
|
10277 + | impl
|
10278 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
10279 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10280 + | > for crate::output::SparseNullsOperationOutput
|
10281 + | {
|
10282 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
10283 + | match crate::protocol_serde::shape_sparse_nulls_operation::ser_sparse_nulls_operation_http_response(self) {
|
10284 + | Ok(response) => response,
|
10285 + | Err(e) => {
|
10286 + | ::tracing::error!(error = %e, "failed to serialize response");
|
10287 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
10288 + | }
|
10289 + | }
|
10290 + | }
|
10291 + | }
|
10292 + |
|
10293 + | #[allow(unreachable_code, unused_variables)]
|
10294 + | #[cfg(test)]
|
10295 + | mod sparse_nulls_operation_test {
|
10296 + |
|
10297 + | /// Serializes null values in maps
|
10298 + | /// Test ID: AwsJson11SparseMapsSerializeNullValues
|
10299 + | #[::tokio::test]
|
10300 + | #[::tracing_test::traced_test]
|
10301 + | async fn aws_json11_sparse_maps_serialize_null_values_request() {
|
10302 + | #[allow(unused_mut)]
|
10303 + | let mut http_request = ::http::Request::builder()
|
10304 + | .uri("/")
|
10305 + | .method("POST")
|
10306 + | .header("Content-Type", "application/x-amz-json-1.1")
|
10307 + | .header("X-Amz-Target", "JsonProtocol.SparseNullsOperation")
|
10308 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
10309 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
10310 + | "{\n \"sparseStringMap\": {\n \"foo\": null\n }\n}".as_bytes(),
|
10311 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10312 + | )),
|
10313 + | ))
|
10314 + | .unwrap();
|
10315 + | #[allow(unused_mut)]
|
10316 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10317 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
10318 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
10319 + | .sparse_nulls_operation(move |input: crate::input::SparseNullsOperationInput| {
|
10320 + | let sender = sender.clone();
|
10321 + | async move {
|
10322 + | let result = {
|
10323 + | let expected = crate::input::SparseNullsOperationInput {
|
10324 + | sparse_string_map: ::std::option::Option::Some({
|
10325 + | let mut ret = ::std::collections::HashMap::new();
|
10326 + | ret.insert("foo".to_owned(), ::std::option::Option::None);
|
10327 + | ret
|
10328 + | }),
|
10329 + | sparse_string_list: ::std::option::Option::None,
|
10330 + | };
|
10331 + | ::pretty_assertions::assert_eq!(input, expected);
|
10332 + | let output = crate::output::SparseNullsOperationOutput {
|
10333 + | sparse_string_list: ::std::option::Option::None,
|
10334 + | sparse_string_map: ::std::option::Option::None,
|
10335 + | };
|
10336 + | output
|
10337 + | };
|
10338 + | sender.send(()).await.expect("receiver dropped early");
|
10339 + | result
|
10340 + | }
|
10341 + | })
|
10342 + | .build_unchecked();
|
10343 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10344 + | .await
|
10345 + | .expect("unable to make an HTTP request");
|
10346 + | assert!(
|
10347 + | receiver.recv().await.is_some(),
|
10348 + | "we expected operation handler to be invoked but it was not entered"
|
10349 + | );
|
10350 + | }
|
10351 + |
|
10352 + | /// Serializes null values in lists
|
10353 + | /// Test ID: AwsJson11SparseListsSerializeNull
|
10354 + | #[::tokio::test]
|
10355 + | #[::tracing_test::traced_test]
|
10356 + | async fn aws_json11_sparse_lists_serialize_null_request() {
|
10357 + | #[allow(unused_mut)]
|
10358 + | let mut http_request = ::http::Request::builder()
|
10359 + | .uri("/")
|
10360 + | .method("POST")
|
10361 + | .header("Content-Type", "application/x-amz-json-1.1")
|
10362 + | .header("X-Amz-Target", "JsonProtocol.SparseNullsOperation")
|
10363 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
10364 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
10365 + | "{\n \"sparseStringList\": [\n null\n ]\n}".as_bytes(),
|
10366 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10367 + | )),
|
10368 + | ))
|
10369 + | .unwrap();
|
10370 + | #[allow(unused_mut)]
|
10371 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10372 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
10373 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
10374 + | .sparse_nulls_operation(move |input: crate::input::SparseNullsOperationInput| {
|
10375 + | let sender = sender.clone();
|
10376 + | async move {
|
10377 + | let result = {
|
10378 + | let expected = crate::input::SparseNullsOperationInput {
|
10379 + | sparse_string_list: ::std::option::Option::Some(vec![
|
10380 + | ::std::option::Option::None,
|
10381 + | ]),
|
10382 + | sparse_string_map: ::std::option::Option::None,
|
10383 + | };
|
10384 + | ::pretty_assertions::assert_eq!(input, expected);
|
10385 + | let output = crate::output::SparseNullsOperationOutput {
|
10386 + | sparse_string_list: ::std::option::Option::None,
|
10387 + | sparse_string_map: ::std::option::Option::None,
|
10388 + | };
|
10389 + | output
|
10390 + | };
|
10391 + | sender.send(()).await.expect("receiver dropped early");
|
10392 + | result
|
10393 + | }
|
10394 + | })
|
10395 + | .build_unchecked();
|
10396 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10397 + | .await
|
10398 + | .expect("unable to make an HTTP request");
|
10399 + | assert!(
|
10400 + | receiver.recv().await.is_some(),
|
10401 + | "we expected operation handler to be invoked but it was not entered"
|
10402 + | );
|
10403 + | }
|
10522 10404 |
|
10523 - | /// Parses string shapes
|
10524 - | /// Test ID: parses_string_shapes
|
10405 + | /// Deserializes null values in maps
|
10406 + | /// Test ID: AwsJson11SparseMapsDeserializeNullValues
|
10525 10407 | #[::tokio::test]
|
10526 10408 | #[::tracing_test::traced_test]
|
10527 - | async fn parses_string_shapes_response() {
|
10528 - | let output = crate::output::KitchenSinkOperationOutput {
|
10529 - | string: ::std::option::Option::Some("string-value".to_owned()),
|
10530 - | blob: ::std::option::Option::None,
|
10531 - | boolean: ::std::option::Option::None,
|
10532 - | double: ::std::option::Option::None,
|
10533 - | empty_struct: ::std::option::Option::None,
|
10534 - | float: ::std::option::Option::None,
|
10535 - | httpdate_timestamp: ::std::option::Option::None,
|
10536 - | integer: ::std::option::Option::None,
|
10537 - | iso8601_timestamp: ::std::option::Option::None,
|
10538 - | json_value: ::std::option::Option::None,
|
10539 - | list_of_lists: ::std::option::Option::None,
|
10540 - | list_of_maps_of_strings: ::std::option::Option::None,
|
10541 - | list_of_strings: ::std::option::Option::None,
|
10542 - | list_of_structs: ::std::option::Option::None,
|
10543 - | long: ::std::option::Option::None,
|
10544 - | map_of_lists_of_strings: ::std::option::Option::None,
|
10545 - | map_of_maps: ::std::option::Option::None,
|
10546 - | map_of_strings: ::std::option::Option::None,
|
10547 - | map_of_structs: ::std::option::Option::None,
|
10548 - | recursive_list: ::std::option::Option::None,
|
10549 - | recursive_map: ::std::option::Option::None,
|
10550 - | recursive_struct: ::std::option::Option::None,
|
10551 - | simple_struct: ::std::option::Option::None,
|
10552 - | struct_with_json_name: ::std::option::Option::None,
|
10553 - | timestamp: ::std::option::Option::None,
|
10554 - | unix_timestamp: ::std::option::Option::None,
|
10409 + | async fn aws_json11_sparse_maps_deserialize_null_values_response() {
|
10410 + | let output = crate::output::SparseNullsOperationOutput {
|
10411 + | sparse_string_map: ::std::option::Option::Some({
|
10412 + | let mut ret = ::std::collections::HashMap::new();
|
10413 + | ret.insert("foo".to_owned(), ::std::option::Option::None);
|
10414 + | ret
|
10415 + | }),
|
10416 + | sparse_string_list: ::std::option::Option::None,
|
10555 10417 | };
|
10556 10418 | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
10557 10419 | let http_response = output.into_response();
|
10558 10420 | ::pretty_assertions::assert_eq!(
|
10559 10421 | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10560 10422 | http_response.status()
|
10561 10423 | );
|
10562 10424 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10563 10425 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10564 10426 | http_response.headers(),
|
10565 10427 | expected_headers,
|
10566 10428 | ));
|
10567 10429 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10568 10430 | .await
|
10569 10431 | .expect("unable to extract body to bytes");
|
10570 10432 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10571 10433 | &body,
|
10572 - | "{\"String\":\"string-value\"}",
|
10434 + | "{\n \"sparseStringMap\": {\n \"foo\": null\n }\n}",
|
10573 10435 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10574 10436 | ));
|
10575 10437 | }
|
10576 10438 |
|
10577 - | /// Parses integer shapes
|
10578 - | /// Test ID: parses_integer_shapes
|
10439 + | /// Deserializes null values in lists
|
10440 + | /// Test ID: AwsJson11SparseListsDeserializeNull
|
10579 10441 | #[::tokio::test]
|
10580 10442 | #[::tracing_test::traced_test]
|
10581 - | async fn parses_integer_shapes_response() {
|
10582 - | let output = crate::output::KitchenSinkOperationOutput {
|
10583 - | integer: ::std::option::Option::Some(1234),
|
10584 - | blob: ::std::option::Option::None,
|
10585 - | boolean: ::std::option::Option::None,
|
10586 - | double: ::std::option::Option::None,
|
10587 - | empty_struct: ::std::option::Option::None,
|
10588 - | float: ::std::option::Option::None,
|
10589 - | httpdate_timestamp: ::std::option::Option::None,
|
10590 - | iso8601_timestamp: ::std::option::Option::None,
|
10591 - | json_value: ::std::option::Option::None,
|
10592 - | list_of_lists: ::std::option::Option::None,
|
10593 - | list_of_maps_of_strings: ::std::option::Option::None,
|
10594 - | list_of_strings: ::std::option::Option::None,
|
10595 - | list_of_structs: ::std::option::Option::None,
|
10596 - | long: ::std::option::Option::None,
|
10597 - | map_of_lists_of_strings: ::std::option::Option::None,
|
10598 - | map_of_maps: ::std::option::Option::None,
|
10599 - | map_of_strings: ::std::option::Option::None,
|
10600 - | map_of_structs: ::std::option::Option::None,
|
10601 - | recursive_list: ::std::option::Option::None,
|
10602 - | recursive_map: ::std::option::Option::None,
|
10603 - | recursive_struct: ::std::option::Option::None,
|
10604 - | simple_struct: ::std::option::Option::None,
|
10605 - | string: ::std::option::Option::None,
|
10606 - | struct_with_json_name: ::std::option::Option::None,
|
10607 - | timestamp: ::std::option::Option::None,
|
10608 - | unix_timestamp: ::std::option::Option::None,
|
10443 + | async fn aws_json11_sparse_lists_deserialize_null_response() {
|
10444 + | let output = crate::output::SparseNullsOperationOutput {
|
10445 + | sparse_string_list: ::std::option::Option::Some(vec![::std::option::Option::None]),
|
10446 + | sparse_string_map: ::std::option::Option::None,
|
10609 10447 | };
|
10610 10448 | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
10611 10449 | let http_response = output.into_response();
|
10612 10450 | ::pretty_assertions::assert_eq!(
|
10613 10451 | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10614 10452 | http_response.status()
|
10615 10453 | );
|
10616 10454 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10617 10455 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10618 10456 | http_response.headers(),
|
10619 10457 | expected_headers,
|
10620 10458 | ));
|
10621 10459 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10622 10460 | .await
|
10623 10461 | .expect("unable to extract body to bytes");
|
10624 10462 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10625 10463 | &body,
|
10626 - | "{\"Integer\":1234}",
|
10464 + | "{\n \"sparseStringList\": [\n null\n ]\n}",
|
10627 10465 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10628 10466 | ));
|
10629 10467 | }
|
10468 + | }
|
10630 10469 |
|
10631 - | /// Parses long shapes
|
10632 - | /// Test ID: parses_long_shapes
|
10633 - | #[::tokio::test]
|
10634 - | #[::tracing_test::traced_test]
|
10635 - | async fn parses_long_shapes_response() {
|
10636 - | let output = crate::output::KitchenSinkOperationOutput {
|
10637 - | long: ::std::option::Option::Some(1234567890123456789),
|
10638 - | blob: ::std::option::Option::None,
|
10639 - | boolean: ::std::option::Option::None,
|
10640 - | double: ::std::option::Option::None,
|
10641 - | empty_struct: ::std::option::Option::None,
|
10642 - | float: ::std::option::Option::None,
|
10643 - | httpdate_timestamp: ::std::option::Option::None,
|
10644 - | integer: ::std::option::Option::None,
|
10645 - | iso8601_timestamp: ::std::option::Option::None,
|
10646 - | json_value: ::std::option::Option::None,
|
10647 - | list_of_lists: ::std::option::Option::None,
|
10648 - | list_of_maps_of_strings: ::std::option::Option::None,
|
10649 - | list_of_strings: ::std::option::Option::None,
|
10650 - | list_of_structs: ::std::option::Option::None,
|
10651 - | map_of_lists_of_strings: ::std::option::Option::None,
|
10652 - | map_of_maps: ::std::option::Option::None,
|
10653 - | map_of_strings: ::std::option::Option::None,
|
10654 - | map_of_structs: ::std::option::Option::None,
|
10655 - | recursive_list: ::std::option::Option::None,
|
10656 - | recursive_map: ::std::option::Option::None,
|
10657 - | recursive_struct: ::std::option::Option::None,
|
10658 - | simple_struct: ::std::option::Option::None,
|
10659 - | string: ::std::option::Option::None,
|
10660 - | struct_with_json_name: ::std::option::Option::None,
|
10661 - | timestamp: ::std::option::Option::None,
|
10662 - | unix_timestamp: ::std::option::Option::None,
|
10663 - | };
|
10664 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
10665 - | let http_response = output.into_response();
|
10666 - | ::pretty_assertions::assert_eq!(
|
10667 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10668 - | http_response.status()
|
10669 - | );
|
10670 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10671 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10672 - | http_response.headers(),
|
10673 - | expected_headers,
|
10674 - | ));
|
10675 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10676 - | .await
|
10677 - | .expect("unable to extract body to bytes");
|
10678 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10679 - | &body,
|
10680 - | "{\"Long\":1234567890123456789}",
|
10681 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10682 - | ));
|
10470 + | ::pin_project_lite::pin_project! {
|
10471 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
10472 + | /// [`GreetingWithErrorsInput`](crate::input::GreetingWithErrorsInput) using modelled bindings.
|
10473 + | pub struct GreetingWithErrorsInputFuture {
|
10474 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::GreetingWithErrorsInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
10683 10475 | }
|
10476 + | }
|
10684 10477 |
|
10685 - | /// Parses float shapes
|
10686 - | /// Test ID: parses_float_shapes
|
10687 - | #[::tokio::test]
|
10688 - | #[::tracing_test::traced_test]
|
10689 - | async fn parses_float_shapes_response() {
|
10690 - | let output = crate::output::KitchenSinkOperationOutput {
|
10691 - | float: ::std::option::Option::Some(1234.5_f32),
|
10692 - | blob: ::std::option::Option::None,
|
10693 - | boolean: ::std::option::Option::None,
|
10694 - | double: ::std::option::Option::None,
|
10695 - | empty_struct: ::std::option::Option::None,
|
10696 - | httpdate_timestamp: ::std::option::Option::None,
|
10697 - | integer: ::std::option::Option::None,
|
10698 - | iso8601_timestamp: ::std::option::Option::None,
|
10699 - | json_value: ::std::option::Option::None,
|
10700 - | list_of_lists: ::std::option::Option::None,
|
10701 - | list_of_maps_of_strings: ::std::option::Option::None,
|
10702 - | list_of_strings: ::std::option::Option::None,
|
10703 - | list_of_structs: ::std::option::Option::None,
|
10704 - | long: ::std::option::Option::None,
|
10705 - | map_of_lists_of_strings: ::std::option::Option::None,
|
10706 - | map_of_maps: ::std::option::Option::None,
|
10707 - | map_of_strings: ::std::option::Option::None,
|
10708 - | map_of_structs: ::std::option::Option::None,
|
10709 - | recursive_list: ::std::option::Option::None,
|
10710 - | recursive_map: ::std::option::Option::None,
|
10711 - | recursive_struct: ::std::option::Option::None,
|
10712 - | simple_struct: ::std::option::Option::None,
|
10713 - | string: ::std::option::Option::None,
|
10714 - | struct_with_json_name: ::std::option::Option::None,
|
10715 - | timestamp: ::std::option::Option::None,
|
10716 - | unix_timestamp: ::std::option::Option::None,
|
10478 + | impl std::future::Future for GreetingWithErrorsInputFuture {
|
10479 + | type Output = Result<
|
10480 + | crate::input::GreetingWithErrorsInput,
|
10481 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
10482 + | >;
|
10483 + |
|
10484 + | fn poll(
|
10485 + | self: std::pin::Pin<&mut Self>,
|
10486 + | cx: &mut std::task::Context<'_>,
|
10487 + | ) -> std::task::Poll<Self::Output> {
|
10488 + | let this = self.project();
|
10489 + | this.inner.as_mut().poll(cx)
|
10490 + | }
|
10491 + | }
|
10492 + |
|
10493 + | impl<B>
|
10494 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
10495 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10496 + | B,
|
10497 + | > for crate::input::GreetingWithErrorsInput
|
10498 + | where
|
10499 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
10500 + | B: 'static,
|
10501 + |
|
10502 + | B::Data: Send,
|
10503 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
10504 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
10505 + | {
|
10506 + | type Rejection =
|
10507 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
10508 + | type Future = GreetingWithErrorsInputFuture;
|
10509 + |
|
10510 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
10511 + | let fut = async move {
|
10512 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
10513 + | request.headers(),
|
10514 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
10515 + | ) {
|
10516 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
10517 + | }
|
10518 + | crate::protocol_serde::shape_greeting_with_errors::de_greeting_with_errors_http_request(
|
10519 + | request,
|
10520 + | )
|
10521 + | .await
|
10522 + | };
|
10523 + | use ::futures_util::future::TryFutureExt;
|
10524 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
10525 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
10526 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
10527 + | });
|
10528 + | GreetingWithErrorsInputFuture {
|
10529 + | inner: Box::pin(fut),
|
10530 + | }
|
10531 + | }
|
10532 + | }
|
10533 + | impl
|
10534 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
10535 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10536 + | > for crate::output::GreetingWithErrorsOutput
|
10537 + | {
|
10538 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
10539 + | match crate::protocol_serde::shape_greeting_with_errors::ser_greeting_with_errors_http_response(self) {
|
10540 + | Ok(response) => response,
|
10541 + | Err(e) => {
|
10542 + | ::tracing::error!(error = %e, "failed to serialize response");
|
10543 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
10544 + | }
|
10545 + | }
|
10546 + | }
|
10547 + | }
|
10548 + | impl
|
10549 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
10550 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10551 + | > for crate::error::GreetingWithErrorsError
|
10552 + | {
|
10553 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
10554 + | match crate::protocol_serde::shape_greeting_with_errors::ser_greeting_with_errors_http_error(
|
10555 + | &self,
|
10556 + | ) {
|
10557 + | Ok(mut response) => {
|
10558 + | response.extensions_mut().insert(
|
10559 + | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
10560 + | self.name(),
|
10561 + | ),
|
10562 + | );
|
10563 + | response
|
10564 + | }
|
10565 + | Err(e) => {
|
10566 + | ::tracing::error!(error = %e, "failed to serialize response");
|
10567 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
10568 + | }
|
10569 + | }
|
10570 + | }
|
10571 + | }
|
10572 + |
|
10573 + | #[allow(unreachable_code, unused_variables)]
|
10574 + | #[cfg(test)]
|
10575 + | mod greeting_with_errors_test {
|
10576 + |
|
10577 + | /// Parses simple JSON errors
|
10578 + | /// Test ID: AwsJson11InvalidGreetingError
|
10579 + | #[::tokio::test]
|
10580 + | #[::tracing_test::traced_test]
|
10581 + | async fn aws_json11_invalid_greeting_error_response() {
|
10582 + | let output = crate::error::InvalidGreeting {
|
10583 + | message: ::std::option::Option::Some("Hi".to_owned()),
|
10717 10584 | };
|
10585 + | let output = crate::error::GreetingWithErrorsError::InvalidGreeting(output);
|
10718 10586 | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
10719 10587 | let http_response = output.into_response();
|
10720 10588 | ::pretty_assertions::assert_eq!(
|
10721 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10589 + | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10722 10590 | http_response.status()
|
10723 10591 | );
|
10724 10592 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10725 10593 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10726 10594 | http_response.headers(),
|
10727 10595 | expected_headers,
|
10728 10596 | ));
|
10729 10597 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10730 10598 | .await
|
10731 10599 | .expect("unable to extract body to bytes");
|
10732 10600 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10733 10601 | &body,
|
10734 - | "{\"Float\":1234.5}",
|
10602 + | "{\n \"__type\": \"InvalidGreeting\",\n \"Message\": \"Hi\"\n}",
|
10735 10603 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10736 10604 | ));
|
10737 10605 | }
|
10738 10606 |
|
10739 - | /// Parses double shapes
|
10740 - | /// Test ID: parses_double_shapes
|
10607 + | /// Parses a complex error with no message member
|
10608 + | /// Test ID: AwsJson11ComplexError
|
10741 10609 | #[::tokio::test]
|
10742 10610 | #[::tracing_test::traced_test]
|
10743 - | async fn parses_double_shapes_response() {
|
10744 - | let output = crate::output::KitchenSinkOperationOutput {
|
10745 - | double: ::std::option::Option::Some(1.2345678912345679E8_f64),
|
10746 - | blob: ::std::option::Option::None,
|
10747 - | boolean: ::std::option::Option::None,
|
10748 - | empty_struct: ::std::option::Option::None,
|
10749 - | float: ::std::option::Option::None,
|
10750 - | httpdate_timestamp: ::std::option::Option::None,
|
10751 - | integer: ::std::option::Option::None,
|
10752 - | iso8601_timestamp: ::std::option::Option::None,
|
10753 - | json_value: ::std::option::Option::None,
|
10754 - | list_of_lists: ::std::option::Option::None,
|
10755 - | list_of_maps_of_strings: ::std::option::Option::None,
|
10756 - | list_of_strings: ::std::option::Option::None,
|
10757 - | list_of_structs: ::std::option::Option::None,
|
10758 - | long: ::std::option::Option::None,
|
10759 - | map_of_lists_of_strings: ::std::option::Option::None,
|
10760 - | map_of_maps: ::std::option::Option::None,
|
10761 - | map_of_strings: ::std::option::Option::None,
|
10762 - | map_of_structs: ::std::option::Option::None,
|
10763 - | recursive_list: ::std::option::Option::None,
|
10764 - | recursive_map: ::std::option::Option::None,
|
10765 - | recursive_struct: ::std::option::Option::None,
|
10766 - | simple_struct: ::std::option::Option::None,
|
10767 - | string: ::std::option::Option::None,
|
10768 - | struct_with_json_name: ::std::option::Option::None,
|
10769 - | timestamp: ::std::option::Option::None,
|
10770 - | unix_timestamp: ::std::option::Option::None,
|
10611 + | async fn aws_json11_complex_error_response() {
|
10612 + | let output = crate::error::ComplexError {
|
10613 + | top_level: ::std::option::Option::Some("Top level".to_owned()),
|
10614 + | nested: ::std::option::Option::Some(crate::model::ComplexNestedErrorData {
|
10615 + | foo: ::std::option::Option::Some("bar".to_owned()),
|
10616 + | }),
|
10771 10617 | };
|
10618 + | let output = crate::error::GreetingWithErrorsError::ComplexError(output);
|
10772 10619 | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
10773 10620 | let http_response = output.into_response();
|
10774 10621 | ::pretty_assertions::assert_eq!(
|
10775 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10622 + | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10776 10623 | http_response.status()
|
10777 10624 | );
|
10778 10625 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10779 10626 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10780 10627 | http_response.headers(),
|
10781 10628 | expected_headers,
|
10782 10629 | ));
|
10783 10630 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10784 10631 | .await
|
10785 10632 | .expect("unable to extract body to bytes");
|
10786 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10787 - | &body,
|
10788 - | "{\"Double\":123456789.12345679}",
|
10789 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10790 - | ));
|
10633 + | ::aws_smithy_protocol_test::assert_ok(
|
10634 + | ::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"))
|
10635 + | );
|
10791 10636 | }
|
10792 - |
|
10793 - | /// Parses boolean shapes (true)
|
10794 - | /// Test ID: parses_boolean_shapes_true
|
10637 + | /// Test ID: AwsJson11EmptyComplexError
|
10795 10638 | #[::tokio::test]
|
10796 10639 | #[::tracing_test::traced_test]
|
10797 - | async fn parses_boolean_shapes_true_response() {
|
10798 - | let output = crate::output::KitchenSinkOperationOutput {
|
10799 - | boolean: ::std::option::Option::Some(true),
|
10800 - | blob: ::std::option::Option::None,
|
10801 - | double: ::std::option::Option::None,
|
10802 - | empty_struct: ::std::option::Option::None,
|
10803 - | float: ::std::option::Option::None,
|
10804 - | httpdate_timestamp: ::std::option::Option::None,
|
10805 - | integer: ::std::option::Option::None,
|
10806 - | iso8601_timestamp: ::std::option::Option::None,
|
10807 - | json_value: ::std::option::Option::None,
|
10808 - | list_of_lists: ::std::option::Option::None,
|
10809 - | list_of_maps_of_strings: ::std::option::Option::None,
|
10810 - | list_of_strings: ::std::option::Option::None,
|
10811 - | list_of_structs: ::std::option::Option::None,
|
10812 - | long: ::std::option::Option::None,
|
10813 - | map_of_lists_of_strings: ::std::option::Option::None,
|
10814 - | map_of_maps: ::std::option::Option::None,
|
10815 - | map_of_strings: ::std::option::Option::None,
|
10816 - | map_of_structs: ::std::option::Option::None,
|
10817 - | recursive_list: ::std::option::Option::None,
|
10818 - | recursive_map: ::std::option::Option::None,
|
10819 - | recursive_struct: ::std::option::Option::None,
|
10820 - | simple_struct: ::std::option::Option::None,
|
10821 - | string: ::std::option::Option::None,
|
10822 - | struct_with_json_name: ::std::option::Option::None,
|
10823 - | timestamp: ::std::option::Option::None,
|
10824 - | unix_timestamp: ::std::option::Option::None,
|
10640 + | async fn aws_json11_empty_complex_error_response() {
|
10641 + | let output = crate::error::ComplexError {
|
10642 + | top_level: ::std::option::Option::None,
|
10643 + | nested: ::std::option::Option::None,
|
10825 10644 | };
|
10645 + | let output = crate::error::GreetingWithErrorsError::ComplexError(output);
|
10826 10646 | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
10827 10647 | let http_response = output.into_response();
|
10828 10648 | ::pretty_assertions::assert_eq!(
|
10829 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10649 + | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10830 10650 | http_response.status()
|
10831 10651 | );
|
10832 10652 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10833 10653 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10834 10654 | http_response.headers(),
|
10835 10655 | expected_headers,
|
10836 10656 | ));
|
10837 10657 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10838 10658 | .await
|
10839 - | .expect("unable to extract body to bytes");
|
10840 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10841 - | &body,
|
10842 - | "{\"Boolean\":true}",
|
10843 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10844 - | ));
|
10659 + | .expect("unable to extract body to bytes");
|
10660 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10661 + | &body,
|
10662 + | "{\n \"__type\": \"ComplexError\"\n}",
|
10663 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10664 + | ));
|
10665 + | }
|
10666 + | }
|
10667 + |
|
10668 + | ::pin_project_lite::pin_project! {
|
10669 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
10670 + | /// [`JsonUnionsInput`](crate::input::JsonUnionsInput) using modelled bindings.
|
10671 + | pub struct JsonUnionsInputFuture {
|
10672 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::JsonUnionsInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
10673 + | }
|
10674 + | }
|
10675 + |
|
10676 + | impl std::future::Future for JsonUnionsInputFuture {
|
10677 + | type Output = Result<
|
10678 + | crate::input::JsonUnionsInput,
|
10679 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
10680 + | >;
|
10681 + |
|
10682 + | fn poll(
|
10683 + | self: std::pin::Pin<&mut Self>,
|
10684 + | cx: &mut std::task::Context<'_>,
|
10685 + | ) -> std::task::Poll<Self::Output> {
|
10686 + | let this = self.project();
|
10687 + | this.inner.as_mut().poll(cx)
|
10688 + | }
|
10689 + | }
|
10690 + |
|
10691 + | impl<B>
|
10692 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
10693 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10694 + | B,
|
10695 + | > for crate::input::JsonUnionsInput
|
10696 + | where
|
10697 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
10698 + | B: 'static,
|
10699 + |
|
10700 + | B::Data: Send,
|
10701 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
10702 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
10703 + | {
|
10704 + | type Rejection =
|
10705 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
10706 + | type Future = JsonUnionsInputFuture;
|
10707 + |
|
10708 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
10709 + | let fut = async move {
|
10710 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
10711 + | request.headers(),
|
10712 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
10713 + | ) {
|
10714 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
10715 + | }
|
10716 + | crate::protocol_serde::shape_json_unions::de_json_unions_http_request(request).await
|
10717 + | };
|
10718 + | use ::futures_util::future::TryFutureExt;
|
10719 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
10720 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
10721 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
10722 + | });
|
10723 + | JsonUnionsInputFuture {
|
10724 + | inner: Box::pin(fut),
|
10725 + | }
|
10726 + | }
|
10727 + | }
|
10728 + | impl
|
10729 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
10730 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10731 + | > for crate::output::JsonUnionsOutput
|
10732 + | {
|
10733 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
10734 + | match crate::protocol_serde::shape_json_unions::ser_json_unions_http_response(self) {
|
10735 + | Ok(response) => response,
|
10736 + | Err(e) => {
|
10737 + | ::tracing::error!(error = %e, "failed to serialize response");
|
10738 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
10739 + | }
|
10740 + | }
|
10741 + | }
|
10742 + | }
|
10743 + | impl
|
10744 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
10745 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10746 + | > for crate::error::JsonUnionsError
|
10747 + | {
|
10748 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
10749 + | match crate::protocol_serde::shape_json_unions::ser_json_unions_http_error(&self) {
|
10750 + | Ok(mut response) => {
|
10751 + | response.extensions_mut().insert(
|
10752 + | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
10753 + | self.name(),
|
10754 + | ),
|
10755 + | );
|
10756 + | response
|
10757 + | }
|
10758 + | Err(e) => {
|
10759 + | ::tracing::error!(error = %e, "failed to serialize response");
|
10760 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
10761 + | }
|
10762 + | }
|
10763 + | }
|
10764 + | }
|
10765 + |
|
10766 + | #[allow(unreachable_code, unused_variables)]
|
10767 + | #[cfg(test)]
|
10768 + | mod json_unions_test {
|
10769 + |
|
10770 + | /// Serializes a string union value
|
10771 + | /// Test ID: AwsJson11SerializeStringUnionValue
|
10772 + | #[::tokio::test]
|
10773 + | #[::tracing_test::traced_test]
|
10774 + | async fn aws_json11_serialize_string_union_value_request() {
|
10775 + | #[allow(unused_mut)]
|
10776 + | let mut http_request = ::http::Request::builder()
|
10777 + | .uri("/")
|
10778 + | .method("POST")
|
10779 + | .header("Content-Type", "application/x-amz-json-1.1")
|
10780 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
10781 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
10782 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
10783 + | "{\n \"contents\": {\n \"stringValue\": \"foo\"\n }\n}".as_bytes(),
|
10784 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10785 + | )),
|
10786 + | ))
|
10787 + | .unwrap();
|
10788 + | #[allow(unused_mut)]
|
10789 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10790 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
10791 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
10792 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
10793 + | let sender = sender.clone();
|
10794 + | async move {
|
10795 + | let result = {
|
10796 + | let expected = crate::input::JsonUnionsInput {
|
10797 + | contents: ::std::option::Option::Some(
|
10798 + | crate::model::MyUnion::StringValue("foo".to_owned()),
|
10799 + | ),
|
10800 + | };
|
10801 + | ::pretty_assertions::assert_eq!(input, expected);
|
10802 + | let output = crate::output::JsonUnionsOutput {
|
10803 + | contents: ::std::option::Option::None,
|
10804 + | };
|
10805 + | Ok(output)
|
10806 + | };
|
10807 + | sender.send(()).await.expect("receiver dropped early");
|
10808 + | result
|
10809 + | }
|
10810 + | })
|
10811 + | .build_unchecked();
|
10812 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10813 + | .await
|
10814 + | .expect("unable to make an HTTP request");
|
10815 + | assert!(
|
10816 + | receiver.recv().await.is_some(),
|
10817 + | "we expected operation handler to be invoked but it was not entered"
|
10818 + | );
|
10845 10819 | }
|
10846 10820 |
|
10847 - | /// Parses boolean (false)
|
10848 - | /// Test ID: parses_boolean_false
|
10821 + | /// Serializes a boolean union value
|
10822 + | /// Test ID: AwsJson11SerializeBooleanUnionValue
|
10849 10823 | #[::tokio::test]
|
10850 10824 | #[::tracing_test::traced_test]
|
10851 - | async fn parses_boolean_false_response() {
|
10852 - | let output = crate::output::KitchenSinkOperationOutput {
|
10853 - | boolean: ::std::option::Option::Some(false),
|
10854 - | blob: ::std::option::Option::None,
|
10855 - | double: ::std::option::Option::None,
|
10856 - | empty_struct: ::std::option::Option::None,
|
10857 - | float: ::std::option::Option::None,
|
10858 - | httpdate_timestamp: ::std::option::Option::None,
|
10859 - | integer: ::std::option::Option::None,
|
10860 - | iso8601_timestamp: ::std::option::Option::None,
|
10861 - | json_value: ::std::option::Option::None,
|
10862 - | list_of_lists: ::std::option::Option::None,
|
10863 - | list_of_maps_of_strings: ::std::option::Option::None,
|
10864 - | list_of_strings: ::std::option::Option::None,
|
10865 - | list_of_structs: ::std::option::Option::None,
|
10866 - | long: ::std::option::Option::None,
|
10867 - | map_of_lists_of_strings: ::std::option::Option::None,
|
10868 - | map_of_maps: ::std::option::Option::None,
|
10869 - | map_of_strings: ::std::option::Option::None,
|
10870 - | map_of_structs: ::std::option::Option::None,
|
10871 - | recursive_list: ::std::option::Option::None,
|
10872 - | recursive_map: ::std::option::Option::None,
|
10873 - | recursive_struct: ::std::option::Option::None,
|
10874 - | simple_struct: ::std::option::Option::None,
|
10875 - | string: ::std::option::Option::None,
|
10876 - | struct_with_json_name: ::std::option::Option::None,
|
10877 - | timestamp: ::std::option::Option::None,
|
10878 - | unix_timestamp: ::std::option::Option::None,
|
10879 - | };
|
10880 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
10881 - | let http_response = output.into_response();
|
10882 - | ::pretty_assertions::assert_eq!(
|
10883 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10884 - | http_response.status()
|
10885 - | );
|
10886 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10887 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10888 - | http_response.headers(),
|
10889 - | expected_headers,
|
10890 - | ));
|
10891 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10825 + | async fn aws_json11_serialize_boolean_union_value_request() {
|
10826 + | #[allow(unused_mut)]
|
10827 + | let mut http_request = ::http::Request::builder()
|
10828 + | .uri("/")
|
10829 + | .method("POST")
|
10830 + | .header("Content-Type", "application/x-amz-json-1.1")
|
10831 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
10832 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
10833 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
10834 + | "{\n \"contents\": {\n \"booleanValue\": true\n }\n}".as_bytes(),
|
10835 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10836 + | )),
|
10837 + | ))
|
10838 + | .unwrap();
|
10839 + | #[allow(unused_mut)]
|
10840 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10841 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
10842 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
10843 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
10844 + | let sender = sender.clone();
|
10845 + | async move {
|
10846 + | let result = {
|
10847 + | let expected = crate::input::JsonUnionsInput {
|
10848 + | contents: ::std::option::Option::Some(
|
10849 + | crate::model::MyUnion::BooleanValue(true),
|
10850 + | ),
|
10851 + | };
|
10852 + | ::pretty_assertions::assert_eq!(input, expected);
|
10853 + | let output = crate::output::JsonUnionsOutput {
|
10854 + | contents: ::std::option::Option::None,
|
10855 + | };
|
10856 + | Ok(output)
|
10857 + | };
|
10858 + | sender.send(()).await.expect("receiver dropped early");
|
10859 + | result
|
10860 + | }
|
10861 + | })
|
10862 + | .build_unchecked();
|
10863 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10892 10864 | .await
|
10893 - | .expect("unable to extract body to bytes");
|
10894 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10895 - | &body,
|
10896 - | "{\"Boolean\":false}",
|
10897 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10898 - | ));
|
10865 + | .expect("unable to make an HTTP request");
|
10866 + | assert!(
|
10867 + | receiver.recv().await.is_some(),
|
10868 + | "we expected operation handler to be invoked but it was not entered"
|
10869 + | );
|
10899 10870 | }
|
10900 10871 |
|
10901 - | /// Parses blob shapes
|
10902 - | /// Test ID: parses_blob_shapes
|
10872 + | /// Serializes a number union value
|
10873 + | /// Test ID: AwsJson11SerializeNumberUnionValue
|
10903 10874 | #[::tokio::test]
|
10904 10875 | #[::tracing_test::traced_test]
|
10905 - | async fn parses_blob_shapes_response() {
|
10906 - | let output = crate::output::KitchenSinkOperationOutput {
|
10907 - | blob: ::std::option::Option::Some(::aws_smithy_types::Blob::new("binary-value")),
|
10908 - | boolean: ::std::option::Option::None,
|
10909 - | double: ::std::option::Option::None,
|
10910 - | empty_struct: ::std::option::Option::None,
|
10911 - | float: ::std::option::Option::None,
|
10912 - | httpdate_timestamp: ::std::option::Option::None,
|
10913 - | integer: ::std::option::Option::None,
|
10914 - | iso8601_timestamp: ::std::option::Option::None,
|
10915 - | json_value: ::std::option::Option::None,
|
10916 - | list_of_lists: ::std::option::Option::None,
|
10917 - | list_of_maps_of_strings: ::std::option::Option::None,
|
10918 - | list_of_strings: ::std::option::Option::None,
|
10919 - | list_of_structs: ::std::option::Option::None,
|
10920 - | long: ::std::option::Option::None,
|
10921 - | map_of_lists_of_strings: ::std::option::Option::None,
|
10922 - | map_of_maps: ::std::option::Option::None,
|
10923 - | map_of_strings: ::std::option::Option::None,
|
10924 - | map_of_structs: ::std::option::Option::None,
|
10925 - | recursive_list: ::std::option::Option::None,
|
10926 - | recursive_map: ::std::option::Option::None,
|
10927 - | recursive_struct: ::std::option::Option::None,
|
10928 - | simple_struct: ::std::option::Option::None,
|
10929 - | string: ::std::option::Option::None,
|
10930 - | struct_with_json_name: ::std::option::Option::None,
|
10931 - | timestamp: ::std::option::Option::None,
|
10932 - | unix_timestamp: ::std::option::Option::None,
|
10933 - | };
|
10934 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
10935 - | let http_response = output.into_response();
|
10936 - | ::pretty_assertions::assert_eq!(
|
10937 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10938 - | http_response.status()
|
10876 + | async fn aws_json11_serialize_number_union_value_request() {
|
10877 + | #[allow(unused_mut)]
|
10878 + | let mut http_request = ::http::Request::builder()
|
10879 + | .uri("/")
|
10880 + | .method("POST")
|
10881 + | .header("Content-Type", "application/x-amz-json-1.1")
|
10882 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
10883 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
10884 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
10885 + | "{\n \"contents\": {\n \"numberValue\": 1\n }\n}".as_bytes(),
|
10886 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10887 + | )),
|
10888 + | ))
|
10889 + | .unwrap();
|
10890 + | #[allow(unused_mut)]
|
10891 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10892 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
10893 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
10894 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
10895 + | let sender = sender.clone();
|
10896 + | async move {
|
10897 + | let result = {
|
10898 + | let expected = crate::input::JsonUnionsInput {
|
10899 + | contents: ::std::option::Option::Some(
|
10900 + | crate::model::MyUnion::NumberValue(1),
|
10901 + | ),
|
10902 + | };
|
10903 + | ::pretty_assertions::assert_eq!(input, expected);
|
10904 + | let output = crate::output::JsonUnionsOutput {
|
10905 + | contents: ::std::option::Option::None,
|
10906 + | };
|
10907 + | Ok(output)
|
10908 + | };
|
10909 + | sender.send(()).await.expect("receiver dropped early");
|
10910 + | result
|
10911 + | }
|
10912 + | })
|
10913 + | .build_unchecked();
|
10914 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10915 + | .await
|
10916 + | .expect("unable to make an HTTP request");
|
10917 + | assert!(
|
10918 + | receiver.recv().await.is_some(),
|
10919 + | "we expected operation handler to be invoked but it was not entered"
|
10939 10920 | );
|
10940 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10941 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10942 - | http_response.headers(),
|
10943 - | expected_headers,
|
10944 - | ));
|
10945 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10921 + | }
|
10922 + |
|
10923 + | /// Serializes a blob union value
|
10924 + | /// Test ID: AwsJson11SerializeBlobUnionValue
|
10925 + | #[::tokio::test]
|
10926 + | #[::tracing_test::traced_test]
|
10927 + | async fn aws_json11_serialize_blob_union_value_request() {
|
10928 + | #[allow(unused_mut)]
|
10929 + | let mut http_request = ::http::Request::builder()
|
10930 + | .uri("/")
|
10931 + | .method("POST")
|
10932 + | .header("Content-Type", "application/x-amz-json-1.1")
|
10933 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
10934 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
10935 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
10936 + | "{\n \"contents\": {\n \"blobValue\": \"Zm9v\"\n }\n}".as_bytes(),
|
10937 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10938 + | )),
|
10939 + | ))
|
10940 + | .unwrap();
|
10941 + | #[allow(unused_mut)]
|
10942 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10943 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
10944 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
10945 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
10946 + | let sender = sender.clone();
|
10947 + | async move {
|
10948 + | let result = {
|
10949 + | let expected = crate::input::JsonUnionsInput {
|
10950 + | contents: ::std::option::Option::Some(
|
10951 + | crate::model::MyUnion::BlobValue(::aws_smithy_types::Blob::new(
|
10952 + | "foo",
|
10953 + | )),
|
10954 + | ),
|
10955 + | };
|
10956 + | ::pretty_assertions::assert_eq!(input, expected);
|
10957 + | let output = crate::output::JsonUnionsOutput {
|
10958 + | contents: ::std::option::Option::None,
|
10959 + | };
|
10960 + | Ok(output)
|
10961 + | };
|
10962 + | sender.send(()).await.expect("receiver dropped early");
|
10963 + | result
|
10964 + | }
|
10965 + | })
|
10966 + | .build_unchecked();
|
10967 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10946 10968 | .await
|
10947 - | .expect("unable to extract body to bytes");
|
10948 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10949 - | &body,
|
10950 - | "{\"Blob\":\"YmluYXJ5LXZhbHVl\"}",
|
10951 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10952 - | ));
|
10969 + | .expect("unable to make an HTTP request");
|
10970 + | assert!(
|
10971 + | receiver.recv().await.is_some(),
|
10972 + | "we expected operation handler to be invoked but it was not entered"
|
10973 + | );
|
10953 10974 | }
|
10954 10975 |
|
10955 - | /// Parses timestamp shapes
|
10956 - | /// Test ID: parses_timestamp_shapes
|
10976 + | /// Serializes a timestamp union value
|
10977 + | /// Test ID: AwsJson11SerializeTimestampUnionValue
|
10957 10978 | #[::tokio::test]
|
10958 10979 | #[::tracing_test::traced_test]
|
10959 - | async fn parses_timestamp_shapes_response() {
|
10960 - | let output = crate::output::KitchenSinkOperationOutput {
|
10961 - | timestamp: ::std::option::Option::Some(
|
10962 - | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
10963 - | ),
|
10964 - | blob: ::std::option::Option::None,
|
10965 - | boolean: ::std::option::Option::None,
|
10966 - | double: ::std::option::Option::None,
|
10967 - | empty_struct: ::std::option::Option::None,
|
10968 - | float: ::std::option::Option::None,
|
10969 - | httpdate_timestamp: ::std::option::Option::None,
|
10970 - | integer: ::std::option::Option::None,
|
10971 - | iso8601_timestamp: ::std::option::Option::None,
|
10972 - | json_value: ::std::option::Option::None,
|
10973 - | list_of_lists: ::std::option::Option::None,
|
10974 - | list_of_maps_of_strings: ::std::option::Option::None,
|
10975 - | list_of_strings: ::std::option::Option::None,
|
10976 - | list_of_structs: ::std::option::Option::None,
|
10977 - | long: ::std::option::Option::None,
|
10978 - | map_of_lists_of_strings: ::std::option::Option::None,
|
10979 - | map_of_maps: ::std::option::Option::None,
|
10980 - | map_of_strings: ::std::option::Option::None,
|
10981 - | map_of_structs: ::std::option::Option::None,
|
10982 - | recursive_list: ::std::option::Option::None,
|
10983 - | recursive_map: ::std::option::Option::None,
|
10984 - | recursive_struct: ::std::option::Option::None,
|
10985 - | simple_struct: ::std::option::Option::None,
|
10986 - | string: ::std::option::Option::None,
|
10987 - | struct_with_json_name: ::std::option::Option::None,
|
10988 - | unix_timestamp: ::std::option::Option::None,
|
10989 - | };
|
10990 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
10991 - | let http_response = output.into_response();
|
10992 - | ::pretty_assertions::assert_eq!(
|
10993 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10994 - | http_response.status()
|
10995 - | );
|
10996 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10997 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10998 - | http_response.headers(),
|
10999 - | expected_headers,
|
11000 - | ));
|
11001 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10980 + | async fn aws_json11_serialize_timestamp_union_value_request() {
|
10981 + | #[allow(unused_mut)]
|
10982 + | let mut http_request = ::http::Request::builder()
|
10983 + | .uri("/")
|
10984 + | .method("POST")
|
10985 + | .header("Content-Type", "application/x-amz-json-1.1")
|
10986 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
10987 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
10988 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
10989 + | "{\n \"contents\": {\n \"timestampValue\": 1398796238\n }\n}"
|
10990 + | .as_bytes(),
|
10991 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10992 + | )),
|
10993 + | ))
|
10994 + | .unwrap();
|
10995 + | #[allow(unused_mut)]
|
10996 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10997 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
10998 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
10999 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
11000 + | let sender = sender.clone();
|
11001 + | async move {
|
11002 + | let result = {
|
11003 + | let expected = crate::input::JsonUnionsInput {
|
11004 + | contents: ::std::option::Option::Some(
|
11005 + | crate::model::MyUnion::TimestampValue(
|
11006 + | ::aws_smithy_types::DateTime::from_fractional_secs(
|
11007 + | 1398796238, 0_f64,
|
11008 + | ),
|
11009 + | ),
|
11010 + | ),
|
11011 + | };
|
11012 + | ::pretty_assertions::assert_eq!(input, expected);
|
11013 + | let output = crate::output::JsonUnionsOutput {
|
11014 + | contents: ::std::option::Option::None,
|
11015 + | };
|
11016 + | Ok(output)
|
11017 + | };
|
11018 + | sender.send(()).await.expect("receiver dropped early");
|
11019 + | result
|
11020 + | }
|
11021 + | })
|
11022 + | .build_unchecked();
|
11023 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11002 11024 | .await
|
11003 - | .expect("unable to extract body to bytes");
|
11004 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11005 - | &body,
|
11006 - | "{\"Timestamp\":946845296}",
|
11007 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11008 - | ));
|
11025 + | .expect("unable to make an HTTP request");
|
11026 + | assert!(
|
11027 + | receiver.recv().await.is_some(),
|
11028 + | "we expected operation handler to be invoked but it was not entered"
|
11029 + | );
|
11009 11030 | }
|
11010 11031 |
|
11011 - | /// Parses iso8601 timestamps
|
11012 - | /// Test ID: parses_iso8601_timestamps
|
11032 + | /// Serializes an enum union value
|
11033 + | /// Test ID: AwsJson11SerializeEnumUnionValue
|
11013 11034 | #[::tokio::test]
|
11014 11035 | #[::tracing_test::traced_test]
|
11015 - | async fn parses_iso8601_timestamps_response() {
|
11016 - | let output = crate::output::KitchenSinkOperationOutput {
|
11017 - | iso8601_timestamp: ::std::option::Option::Some(
|
11018 - | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
11019 - | ),
|
11020 - | blob: ::std::option::Option::None,
|
11021 - | boolean: ::std::option::Option::None,
|
11022 - | double: ::std::option::Option::None,
|
11023 - | empty_struct: ::std::option::Option::None,
|
11024 - | float: ::std::option::Option::None,
|
11025 - | httpdate_timestamp: ::std::option::Option::None,
|
11026 - | integer: ::std::option::Option::None,
|
11027 - | json_value: ::std::option::Option::None,
|
11028 - | list_of_lists: ::std::option::Option::None,
|
11029 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11030 - | list_of_strings: ::std::option::Option::None,
|
11031 - | list_of_structs: ::std::option::Option::None,
|
11032 - | long: ::std::option::Option::None,
|
11033 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11034 - | map_of_maps: ::std::option::Option::None,
|
11035 - | map_of_strings: ::std::option::Option::None,
|
11036 - | map_of_structs: ::std::option::Option::None,
|
11037 - | recursive_list: ::std::option::Option::None,
|
11038 - | recursive_map: ::std::option::Option::None,
|
11039 - | recursive_struct: ::std::option::Option::None,
|
11040 - | simple_struct: ::std::option::Option::None,
|
11041 - | string: ::std::option::Option::None,
|
11042 - | struct_with_json_name: ::std::option::Option::None,
|
11043 - | timestamp: ::std::option::Option::None,
|
11044 - | unix_timestamp: ::std::option::Option::None,
|
11045 - | };
|
11046 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11047 - | let http_response = output.into_response();
|
11048 - | ::pretty_assertions::assert_eq!(
|
11049 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11050 - | http_response.status()
|
11036 + | async fn aws_json11_serialize_enum_union_value_request() {
|
11037 + | #[allow(unused_mut)]
|
11038 + | let mut http_request = ::http::Request::builder()
|
11039 + | .uri("/")
|
11040 + | .method("POST")
|
11041 + | .header("Content-Type", "application/x-amz-json-1.1")
|
11042 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
11043 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
11044 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
11045 + | "{\n \"contents\": {\n \"enumValue\": \"Foo\"\n }\n}".as_bytes(),
|
11046 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11047 + | )),
|
11048 + | ))
|
11049 + | .unwrap();
|
11050 + | #[allow(unused_mut)]
|
11051 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11052 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
11053 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
11054 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
11055 + | let sender = sender.clone();
|
11056 + | async move {
|
11057 + | let result = {
|
11058 + | let expected = crate::input::JsonUnionsInput {
|
11059 + | contents: ::std::option::Option::Some(
|
11060 + | crate::model::MyUnion::EnumValue(
|
11061 + | "Foo"
|
11062 + | .parse::<crate::model::FooEnum>()
|
11063 + | .expect("static value validated to member"),
|
11064 + | ),
|
11065 + | ),
|
11066 + | };
|
11067 + | ::pretty_assertions::assert_eq!(input, expected);
|
11068 + | let output = crate::output::JsonUnionsOutput {
|
11069 + | contents: ::std::option::Option::None,
|
11070 + | };
|
11071 + | Ok(output)
|
11072 + | };
|
11073 + | sender.send(()).await.expect("receiver dropped early");
|
11074 + | result
|
11075 + | }
|
11076 + | })
|
11077 + | .build_unchecked();
|
11078 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11079 + | .await
|
11080 + | .expect("unable to make an HTTP request");
|
11081 + | assert!(
|
11082 + | receiver.recv().await.is_some(),
|
11083 + | "we expected operation handler to be invoked but it was not entered"
|
11051 11084 | );
|
11052 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11053 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11054 - | http_response.headers(),
|
11055 - | expected_headers,
|
11056 - | ));
|
11057 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11085 + | }
|
11086 + |
|
11087 + | /// Serializes a list union value
|
11088 + | /// Test ID: AwsJson11SerializeListUnionValue
|
11089 + | #[::tokio::test]
|
11090 + | #[::tracing_test::traced_test]
|
11091 + | async fn aws_json11_serialize_list_union_value_request() {
|
11092 + | #[allow(unused_mut)]
|
11093 + | let mut http_request = ::http::Request::builder()
|
11094 + | .uri("/")
|
11095 + | .method("POST")
|
11096 + | .header("Content-Type", "application/x-amz-json-1.1")
|
11097 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
11098 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
11099 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
11100 + | "{\n \"contents\": {\n \"listValue\": [\"foo\", \"bar\"]\n }\n}"
|
11101 + | .as_bytes(),
|
11102 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11103 + | )),
|
11104 + | ))
|
11105 + | .unwrap();
|
11106 + | #[allow(unused_mut)]
|
11107 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11108 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
11109 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
11110 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
11111 + | let sender = sender.clone();
|
11112 + | async move {
|
11113 + | let result = {
|
11114 + | let expected = crate::input::JsonUnionsInput {
|
11115 + | contents: ::std::option::Option::Some(
|
11116 + | crate::model::MyUnion::ListValue(vec![
|
11117 + | "foo".to_owned(),
|
11118 + | "bar".to_owned(),
|
11119 + | ]),
|
11120 + | ),
|
11121 + | };
|
11122 + | ::pretty_assertions::assert_eq!(input, expected);
|
11123 + | let output = crate::output::JsonUnionsOutput {
|
11124 + | contents: ::std::option::Option::None,
|
11125 + | };
|
11126 + | Ok(output)
|
11127 + | };
|
11128 + | sender.send(()).await.expect("receiver dropped early");
|
11129 + | result
|
11130 + | }
|
11131 + | })
|
11132 + | .build_unchecked();
|
11133 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11058 11134 | .await
|
11059 - | .expect("unable to extract body to bytes");
|
11060 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11061 - | &body,
|
11062 - | "{\"Iso8601Timestamp\":\"2000-01-02T20:34:56Z\"}",
|
11063 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11064 - | ));
|
11135 + | .expect("unable to make an HTTP request");
|
11136 + | assert!(
|
11137 + | receiver.recv().await.is_some(),
|
11138 + | "we expected operation handler to be invoked but it was not entered"
|
11139 + | );
|
11065 11140 | }
|
11066 11141 |
|
11067 - | /// Parses httpdate timestamps
|
11068 - | /// Test ID: parses_httpdate_timestamps
|
11142 + | /// Serializes a map union value
|
11143 + | /// Test ID: AwsJson11SerializeMapUnionValue
|
11069 11144 | #[::tokio::test]
|
11070 11145 | #[::tracing_test::traced_test]
|
11071 - | async fn parses_httpdate_timestamps_response() {
|
11072 - | let output = crate::output::KitchenSinkOperationOutput {
|
11073 - | httpdate_timestamp: ::std::option::Option::Some(
|
11074 - | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
11075 - | ),
|
11076 - | blob: ::std::option::Option::None,
|
11077 - | boolean: ::std::option::Option::None,
|
11078 - | double: ::std::option::Option::None,
|
11079 - | empty_struct: ::std::option::Option::None,
|
11080 - | float: ::std::option::Option::None,
|
11081 - | integer: ::std::option::Option::None,
|
11082 - | iso8601_timestamp: ::std::option::Option::None,
|
11083 - | json_value: ::std::option::Option::None,
|
11084 - | list_of_lists: ::std::option::Option::None,
|
11085 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11086 - | list_of_strings: ::std::option::Option::None,
|
11087 - | list_of_structs: ::std::option::Option::None,
|
11088 - | long: ::std::option::Option::None,
|
11089 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11090 - | map_of_maps: ::std::option::Option::None,
|
11091 - | map_of_strings: ::std::option::Option::None,
|
11092 - | map_of_structs: ::std::option::Option::None,
|
11093 - | recursive_list: ::std::option::Option::None,
|
11094 - | recursive_map: ::std::option::Option::None,
|
11095 - | recursive_struct: ::std::option::Option::None,
|
11096 - | simple_struct: ::std::option::Option::None,
|
11097 - | string: ::std::option::Option::None,
|
11098 - | struct_with_json_name: ::std::option::Option::None,
|
11099 - | timestamp: ::std::option::Option::None,
|
11100 - | unix_timestamp: ::std::option::Option::None,
|
11101 - | };
|
11102 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11103 - | let http_response = output.into_response();
|
11104 - | ::pretty_assertions::assert_eq!(
|
11105 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11106 - | http_response.status()
|
11146 + | async fn aws_json11_serialize_map_union_value_request() {
|
11147 + | #[allow(unused_mut)]
|
11148 + | let mut http_request = ::http::Request::builder()
|
11149 + | .uri("/")
|
11150 + | .method("POST")
|
11151 + | .header("Content-Type", "application/x-amz-json-1.1")
|
11152 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
11153 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
11154 + | ::bytes::Bytes::copy_from_slice(
|
11155 + | &::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"))
|
11156 + | )
|
11157 + | )).unwrap();
|
11158 + | #[allow(unused_mut)]
|
11159 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11160 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
11161 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
11162 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
11163 + | let sender = sender.clone();
|
11164 + | async move {
|
11165 + | let result = {
|
11166 + | let expected = crate::input::JsonUnionsInput {
|
11167 + | contents: ::std::option::Option::Some(crate::model::MyUnion::MapValue(
|
11168 + | {
|
11169 + | let mut ret = ::std::collections::HashMap::new();
|
11170 + | ret.insert("foo".to_owned(), "bar".to_owned());
|
11171 + | ret.insert("spam".to_owned(), "eggs".to_owned());
|
11172 + | ret
|
11173 + | },
|
11174 + | )),
|
11175 + | };
|
11176 + | ::pretty_assertions::assert_eq!(input, expected);
|
11177 + | let output = crate::output::JsonUnionsOutput {
|
11178 + | contents: ::std::option::Option::None,
|
11179 + | };
|
11180 + | Ok(output)
|
11181 + | };
|
11182 + | sender.send(()).await.expect("receiver dropped early");
|
11183 + | result
|
11184 + | }
|
11185 + | })
|
11186 + | .build_unchecked();
|
11187 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11188 + | .await
|
11189 + | .expect("unable to make an HTTP request");
|
11190 + | assert!(
|
11191 + | receiver.recv().await.is_some(),
|
11192 + | "we expected operation handler to be invoked but it was not entered"
|
11107 11193 | );
|
11108 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11109 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11110 - | http_response.headers(),
|
11111 - | expected_headers,
|
11112 - | ));
|
11113 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11194 + | }
|
11195 + |
|
11196 + | /// Serializes a structure union value
|
11197 + | /// Test ID: AwsJson11SerializeStructureUnionValue
|
11198 + | #[::tokio::test]
|
11199 + | #[::tracing_test::traced_test]
|
11200 + | async fn aws_json11_serialize_structure_union_value_request() {
|
11201 + | #[allow(unused_mut)]
|
11202 + | let mut http_request = ::http::Request::builder()
|
11203 + | .uri("/")
|
11204 + | .method("POST")
|
11205 + | .header("Content-Type", "application/x-amz-json-1.1")
|
11206 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
11207 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
11208 + | ::bytes::Bytes::copy_from_slice(
|
11209 + | &::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"))
|
11210 + | )
|
11211 + | )).unwrap();
|
11212 + | #[allow(unused_mut)]
|
11213 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11214 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
11215 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
11216 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
11217 + | let sender = sender.clone();
|
11218 + | async move {
|
11219 + | let result = {
|
11220 + | let expected = crate::input::JsonUnionsInput {
|
11221 + | contents: ::std::option::Option::Some(
|
11222 + | crate::model::MyUnion::StructureValue(
|
11223 + | crate::model::GreetingStruct {
|
11224 + | hi: ::std::option::Option::Some("hello".to_owned()),
|
11225 + | },
|
11226 + | ),
|
11227 + | ),
|
11228 + | };
|
11229 + | ::pretty_assertions::assert_eq!(input, expected);
|
11230 + | let output = crate::output::JsonUnionsOutput {
|
11231 + | contents: ::std::option::Option::None,
|
11232 + | };
|
11233 + | Ok(output)
|
11234 + | };
|
11235 + | sender.send(()).await.expect("receiver dropped early");
|
11236 + | result
|
11237 + | }
|
11238 + | })
|
11239 + | .build_unchecked();
|
11240 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11114 11241 | .await
|
11115 - | .expect("unable to extract body to bytes");
|
11116 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11117 - | &body,
|
11118 - | "{\"HttpdateTimestamp\":\"Sun, 02 Jan 2000 20:34:56 GMT\"}",
|
11119 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11120 - | ));
|
11242 + | .expect("unable to make an HTTP request");
|
11243 + | assert!(
|
11244 + | receiver.recv().await.is_some(),
|
11245 + | "we expected operation handler to be invoked but it was not entered"
|
11246 + | );
|
11121 11247 | }
|
11122 11248 |
|
11123 - | /// Parses list shapes
|
11124 - | /// Test ID: parses_list_shapes
|
11249 + | /// Deserializes a string union value
|
11250 + | /// Test ID: AwsJson11DeserializeStringUnionValue
|
11125 11251 | #[::tokio::test]
|
11126 11252 | #[::tracing_test::traced_test]
|
11127 - | async fn parses_list_shapes_response() {
|
11128 - | let output = crate::output::KitchenSinkOperationOutput {
|
11129 - | list_of_strings: ::std::option::Option::Some(vec![
|
11130 - | "abc".to_owned(),
|
11131 - | "mno".to_owned(),
|
11132 - | "xyz".to_owned(),
|
11133 - | ]),
|
11134 - | blob: ::std::option::Option::None,
|
11135 - | boolean: ::std::option::Option::None,
|
11136 - | double: ::std::option::Option::None,
|
11137 - | empty_struct: ::std::option::Option::None,
|
11138 - | float: ::std::option::Option::None,
|
11139 - | httpdate_timestamp: ::std::option::Option::None,
|
11140 - | integer: ::std::option::Option::None,
|
11141 - | iso8601_timestamp: ::std::option::Option::None,
|
11142 - | json_value: ::std::option::Option::None,
|
11143 - | list_of_lists: ::std::option::Option::None,
|
11144 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11145 - | list_of_structs: ::std::option::Option::None,
|
11146 - | long: ::std::option::Option::None,
|
11147 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11148 - | map_of_maps: ::std::option::Option::None,
|
11149 - | map_of_strings: ::std::option::Option::None,
|
11150 - | map_of_structs: ::std::option::Option::None,
|
11151 - | recursive_list: ::std::option::Option::None,
|
11152 - | recursive_map: ::std::option::Option::None,
|
11153 - | recursive_struct: ::std::option::Option::None,
|
11154 - | simple_struct: ::std::option::Option::None,
|
11155 - | string: ::std::option::Option::None,
|
11156 - | struct_with_json_name: ::std::option::Option::None,
|
11157 - | timestamp: ::std::option::Option::None,
|
11158 - | unix_timestamp: ::std::option::Option::None,
|
11253 + | async fn aws_json11_deserialize_string_union_value_response() {
|
11254 + | let output = crate::output::JsonUnionsOutput {
|
11255 + | contents: ::std::option::Option::Some(crate::model::MyUnion::StringValue(
|
11256 + | "foo".to_owned(),
|
11257 + | )),
|
11159 11258 | };
|
11160 11259 | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11161 11260 | let http_response = output.into_response();
|
11162 11261 | ::pretty_assertions::assert_eq!(
|
11163 11262 | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11164 11263 | http_response.status()
|
11165 11264 | );
|
11166 11265 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11167 11266 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11168 11267 | http_response.headers(),
|
11169 11268 | expected_headers,
|
11170 11269 | ));
|
11171 11270 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11172 11271 | .await
|
11173 11272 | .expect("unable to extract body to bytes");
|
11174 11273 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11175 11274 | &body,
|
11176 - | "{\"ListOfStrings\":[\"abc\",\"mno\",\"xyz\"]}",
|
11275 + | "{\n \"contents\": {\n \"stringValue\": \"foo\"\n }\n}",
|
11177 11276 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11178 11277 | ));
|
11179 11278 | }
|
11180 11279 |
|
11181 - | /// Parses list of map shapes
|
11182 - | /// Test ID: parses_list_of_map_shapes
|
11183 - | #[::tokio::test]
|
11184 - | #[::tracing_test::traced_test]
|
11185 - | async fn parses_list_of_map_shapes_response() {
|
11186 - | let output = crate::output::KitchenSinkOperationOutput {
|
11187 - | list_of_maps_of_strings: ::std::option::Option::Some(vec![
|
11188 - | {
|
11189 - | let mut ret = ::std::collections::HashMap::new();
|
11190 - | ret.insert("size".to_owned(), "large".to_owned());
|
11191 - | ret
|
11192 - | },
|
11193 - | {
|
11194 - | let mut ret = ::std::collections::HashMap::new();
|
11195 - | ret.insert("color".to_owned(), "red".to_owned());
|
11196 - | ret
|
11197 - | },
|
11198 - | ]),
|
11199 - | blob: ::std::option::Option::None,
|
11200 - | boolean: ::std::option::Option::None,
|
11201 - | double: ::std::option::Option::None,
|
11202 - | empty_struct: ::std::option::Option::None,
|
11203 - | float: ::std::option::Option::None,
|
11204 - | httpdate_timestamp: ::std::option::Option::None,
|
11205 - | integer: ::std::option::Option::None,
|
11206 - | iso8601_timestamp: ::std::option::Option::None,
|
11207 - | json_value: ::std::option::Option::None,
|
11208 - | list_of_lists: ::std::option::Option::None,
|
11209 - | list_of_strings: ::std::option::Option::None,
|
11210 - | list_of_structs: ::std::option::Option::None,
|
11211 - | long: ::std::option::Option::None,
|
11212 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11213 - | map_of_maps: ::std::option::Option::None,
|
11214 - | map_of_strings: ::std::option::Option::None,
|
11215 - | map_of_structs: ::std::option::Option::None,
|
11216 - | recursive_list: ::std::option::Option::None,
|
11217 - | recursive_map: ::std::option::Option::None,
|
11218 - | recursive_struct: ::std::option::Option::None,
|
11219 - | simple_struct: ::std::option::Option::None,
|
11220 - | string: ::std::option::Option::None,
|
11221 - | struct_with_json_name: ::std::option::Option::None,
|
11222 - | timestamp: ::std::option::Option::None,
|
11223 - | unix_timestamp: ::std::option::Option::None,
|
11280 + | /// Deserializes a boolean union value
|
11281 + | /// Test ID: AwsJson11DeserializeBooleanUnionValue
|
11282 + | #[::tokio::test]
|
11283 + | #[::tracing_test::traced_test]
|
11284 + | async fn aws_json11_deserialize_boolean_union_value_response() {
|
11285 + | let output = crate::output::JsonUnionsOutput {
|
11286 + | contents: ::std::option::Option::Some(crate::model::MyUnion::BooleanValue(true)),
|
11224 11287 | };
|
11225 11288 | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11226 11289 | let http_response = output.into_response();
|
11227 11290 | ::pretty_assertions::assert_eq!(
|
11228 11291 | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11229 11292 | http_response.status()
|
11230 11293 | );
|
11231 11294 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11232 11295 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11233 11296 | http_response.headers(),
|
11234 11297 | expected_headers,
|
11235 11298 | ));
|
11236 11299 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11237 11300 | .await
|
11238 11301 | .expect("unable to extract body to bytes");
|
11239 11302 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11240 11303 | &body,
|
11241 - | "{\"ListOfMapsOfStrings\":[{\"size\":\"large\"},{\"color\":\"red\"}]}",
|
11304 + | "{\n \"contents\": {\n \"booleanValue\": true\n }\n}",
|
11242 11305 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11243 11306 | ));
|
11244 11307 | }
|
11245 11308 |
|
11246 - | /// Parses list of list shapes
|
11247 - | /// Test ID: parses_list_of_list_shapes
|
11309 + | /// Deserializes a number union value
|
11310 + | /// Test ID: AwsJson11DeserializeNumberUnionValue
|
11248 11311 | #[::tokio::test]
|
11249 11312 | #[::tracing_test::traced_test]
|
11250 - | async fn parses_list_of_list_shapes_response() {
|
11251 - | let output = crate::output::KitchenSinkOperationOutput {
|
11252 - | list_of_lists: ::std::option::Option::Some(vec![
|
11253 - | vec!["abc".to_owned(), "mno".to_owned(), "xyz".to_owned()],
|
11254 - | vec!["hjk".to_owned(), "qrs".to_owned(), "tuv".to_owned()],
|
11255 - | ]),
|
11256 - | blob: ::std::option::Option::None,
|
11257 - | boolean: ::std::option::Option::None,
|
11258 - | double: ::std::option::Option::None,
|
11259 - | empty_struct: ::std::option::Option::None,
|
11260 - | float: ::std::option::Option::None,
|
11261 - | httpdate_timestamp: ::std::option::Option::None,
|
11262 - | integer: ::std::option::Option::None,
|
11263 - | iso8601_timestamp: ::std::option::Option::None,
|
11264 - | json_value: ::std::option::Option::None,
|
11265 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11266 - | list_of_strings: ::std::option::Option::None,
|
11267 - | list_of_structs: ::std::option::Option::None,
|
11268 - | long: ::std::option::Option::None,
|
11269 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11270 - | map_of_maps: ::std::option::Option::None,
|
11271 - | map_of_strings: ::std::option::Option::None,
|
11272 - | map_of_structs: ::std::option::Option::None,
|
11273 - | recursive_list: ::std::option::Option::None,
|
11274 - | recursive_map: ::std::option::Option::None,
|
11275 - | recursive_struct: ::std::option::Option::None,
|
11276 - | simple_struct: ::std::option::Option::None,
|
11277 - | string: ::std::option::Option::None,
|
11278 - | struct_with_json_name: ::std::option::Option::None,
|
11279 - | timestamp: ::std::option::Option::None,
|
11280 - | unix_timestamp: ::std::option::Option::None,
|
11313 + | async fn aws_json11_deserialize_number_union_value_response() {
|
11314 + | let output = crate::output::JsonUnionsOutput {
|
11315 + | contents: ::std::option::Option::Some(crate::model::MyUnion::NumberValue(1)),
|
11281 11316 | };
|
11282 11317 | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11283 11318 | let http_response = output.into_response();
|
11284 11319 | ::pretty_assertions::assert_eq!(
|
11285 11320 | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11286 11321 | http_response.status()
|
11287 11322 | );
|
11288 11323 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11289 11324 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11290 11325 | http_response.headers(),
|
11291 11326 | expected_headers,
|
11292 11327 | ));
|
11293 11328 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11294 11329 | .await
|
11295 11330 | .expect("unable to extract body to bytes");
|
11296 11331 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11297 11332 | &body,
|
11298 - | "{\"ListOfLists\":[[\"abc\",\"mno\",\"xyz\"],[\"hjk\",\"qrs\",\"tuv\"]]}",
|
11333 + | "{\n \"contents\": {\n \"numberValue\": 1\n }\n}",
|
11299 11334 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11300 11335 | ));
|
11301 11336 | }
|
11302 11337 |
|
11303 - | /// Parses list of structure shapes
|
11304 - | /// Test ID: parses_list_of_structure_shapes
|
11338 + | /// Deserializes a blob union value
|
11339 + | /// Test ID: AwsJson11DeserializeBlobUnionValue
|
11305 11340 | #[::tokio::test]
|
11306 11341 | #[::tracing_test::traced_test]
|
11307 - | async fn parses_list_of_structure_shapes_response() {
|
11308 - | let output = crate::output::KitchenSinkOperationOutput {
|
11309 - | list_of_structs: ::std::option::Option::Some(vec![
|
11310 - | crate::model::SimpleStruct {
|
11311 - | value: ::std::option::Option::Some("value-1".to_owned()),
|
11312 - | },
|
11313 - | crate::model::SimpleStruct {
|
11314 - | value: ::std::option::Option::Some("value-2".to_owned()),
|
11315 - | },
|
11316 - | ]),
|
11317 - | blob: ::std::option::Option::None,
|
11318 - | boolean: ::std::option::Option::None,
|
11319 - | double: ::std::option::Option::None,
|
11320 - | empty_struct: ::std::option::Option::None,
|
11321 - | float: ::std::option::Option::None,
|
11322 - | httpdate_timestamp: ::std::option::Option::None,
|
11323 - | integer: ::std::option::Option::None,
|
11324 - | iso8601_timestamp: ::std::option::Option::None,
|
11325 - | json_value: ::std::option::Option::None,
|
11326 - | list_of_lists: ::std::option::Option::None,
|
11327 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11328 - | list_of_strings: ::std::option::Option::None,
|
11329 - | long: ::std::option::Option::None,
|
11330 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11331 - | map_of_maps: ::std::option::Option::None,
|
11332 - | map_of_strings: ::std::option::Option::None,
|
11333 - | map_of_structs: ::std::option::Option::None,
|
11334 - | recursive_list: ::std::option::Option::None,
|
11335 - | recursive_map: ::std::option::Option::None,
|
11336 - | recursive_struct: ::std::option::Option::None,
|
11337 - | simple_struct: ::std::option::Option::None,
|
11338 - | string: ::std::option::Option::None,
|
11339 - | struct_with_json_name: ::std::option::Option::None,
|
11340 - | timestamp: ::std::option::Option::None,
|
11341 - | unix_timestamp: ::std::option::Option::None,
|
11342 + | async fn aws_json11_deserialize_blob_union_value_response() {
|
11343 + | let output = crate::output::JsonUnionsOutput {
|
11344 + | contents: ::std::option::Option::Some(crate::model::MyUnion::BlobValue(
|
11345 + | ::aws_smithy_types::Blob::new("foo"),
|
11346 + | )),
|
11342 11347 | };
|
11343 11348 | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11344 11349 | let http_response = output.into_response();
|
11345 11350 | ::pretty_assertions::assert_eq!(
|
11346 11351 | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11347 11352 | http_response.status()
|
11348 11353 | );
|
11349 11354 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11350 11355 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11351 11356 | http_response.headers(),
|
11352 11357 | expected_headers,
|
11353 11358 | ));
|
11354 11359 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11355 11360 | .await
|
11356 11361 | .expect("unable to extract body to bytes");
|
11357 11362 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11358 11363 | &body,
|
11359 - | "{\"ListOfStructs\":[{\"Value\":\"value-1\"},{\"Value\":\"value-2\"}]}",
|
11364 + | "{\n \"contents\": {\n \"blobValue\": \"Zm9v\"\n }\n}",
|
11360 11365 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11361 11366 | ));
|
11362 11367 | }
|
11363 11368 |
|
11364 - | /// Parses list of recursive structure shapes
|
11365 - | /// Test ID: parses_list_of_recursive_structure_shapes
|
11369 + | /// Deserializes a timestamp union value
|
11370 + | /// Test ID: AwsJson11DeserializeTimestampUnionValue
|
11366 11371 | #[::tokio::test]
|
11367 11372 | #[::tracing_test::traced_test]
|
11368 - | async fn parses_list_of_recursive_structure_shapes_response() {
|
11369 - | let output = crate::output::KitchenSinkOperationOutput {
|
11370 - | recursive_list: ::std::option::Option::Some(vec![crate::model::KitchenSink {
|
11371 - | recursive_list: ::std::option::Option::Some(vec![crate::model::KitchenSink {
|
11372 - | recursive_list: ::std::option::Option::Some(vec![crate::model::KitchenSink {
|
11373 - | string: ::std::option::Option::Some("value".to_owned()),
|
11374 - | blob: ::std::option::Option::None,
|
11375 - | boolean: ::std::option::Option::None,
|
11376 - | double: ::std::option::Option::None,
|
11377 - | empty_struct: ::std::option::Option::None,
|
11378 - | float: ::std::option::Option::None,
|
11379 - | httpdate_timestamp: ::std::option::Option::None,
|
11380 - | integer: ::std::option::Option::None,
|
11381 - | iso8601_timestamp: ::std::option::Option::None,
|
11382 - | json_value: ::std::option::Option::None,
|
11383 - | list_of_lists: ::std::option::Option::None,
|
11384 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11385 - | list_of_strings: ::std::option::Option::None,
|
11386 - | list_of_structs: ::std::option::Option::None,
|
11387 - | long: ::std::option::Option::None,
|
11388 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11389 - | map_of_maps: ::std::option::Option::None,
|
11390 - | map_of_strings: ::std::option::Option::None,
|
11391 - | map_of_structs: ::std::option::Option::None,
|
11392 - | recursive_list: ::std::option::Option::None,
|
11393 - | recursive_map: ::std::option::Option::None,
|
11394 - | recursive_struct: ::std::option::Option::None,
|
11395 - | simple_struct: ::std::option::Option::None,
|
11396 - | struct_with_json_name: ::std::option::Option::None,
|
11397 - | timestamp: ::std::option::Option::None,
|
11398 - | unix_timestamp: ::std::option::Option::None,
|
11399 - | }]),
|
11400 - | blob: ::std::option::Option::None,
|
11401 - | boolean: ::std::option::Option::None,
|
11402 - | double: ::std::option::Option::None,
|
11403 - | empty_struct: ::std::option::Option::None,
|
11404 - | float: ::std::option::Option::None,
|
11405 - | httpdate_timestamp: ::std::option::Option::None,
|
11406 - | integer: ::std::option::Option::None,
|
11407 - | iso8601_timestamp: ::std::option::Option::None,
|
11408 - | json_value: ::std::option::Option::None,
|
11409 - | list_of_lists: ::std::option::Option::None,
|
11410 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11411 - | list_of_strings: ::std::option::Option::None,
|
11412 - | list_of_structs: ::std::option::Option::None,
|
11413 - | long: ::std::option::Option::None,
|
11414 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11415 - | map_of_maps: ::std::option::Option::None,
|
11416 - | map_of_strings: ::std::option::Option::None,
|
11417 - | map_of_structs: ::std::option::Option::None,
|
11418 - | recursive_map: ::std::option::Option::None,
|
11419 - | recursive_struct: ::std::option::Option::None,
|
11420 - | simple_struct: ::std::option::Option::None,
|
11421 - | string: ::std::option::Option::None,
|
11422 - | struct_with_json_name: ::std::option::Option::None,
|
11423 - | timestamp: ::std::option::Option::None,
|
11424 - | unix_timestamp: ::std::option::Option::None,
|
11425 - | }]),
|
11426 - | blob: ::std::option::Option::None,
|
11427 - | boolean: ::std::option::Option::None,
|
11428 - | double: ::std::option::Option::None,
|
11429 - | empty_struct: ::std::option::Option::None,
|
11430 - | float: ::std::option::Option::None,
|
11431 - | httpdate_timestamp: ::std::option::Option::None,
|
11432 - | integer: ::std::option::Option::None,
|
11433 - | iso8601_timestamp: ::std::option::Option::None,
|
11434 - | json_value: ::std::option::Option::None,
|
11435 - | list_of_lists: ::std::option::Option::None,
|
11436 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11437 - | list_of_strings: ::std::option::Option::None,
|
11438 - | list_of_structs: ::std::option::Option::None,
|
11439 - | long: ::std::option::Option::None,
|
11440 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11441 - | map_of_maps: ::std::option::Option::None,
|
11442 - | map_of_strings: ::std::option::Option::None,
|
11443 - | map_of_structs: ::std::option::Option::None,
|
11444 - | recursive_map: ::std::option::Option::None,
|
11445 - | recursive_struct: ::std::option::Option::None,
|
11446 - | simple_struct: ::std::option::Option::None,
|
11447 - | string: ::std::option::Option::None,
|
11448 - | struct_with_json_name: ::std::option::Option::None,
|
11449 - | timestamp: ::std::option::Option::None,
|
11450 - | unix_timestamp: ::std::option::Option::None,
|
11451 - | }]),
|
11452 - | blob: ::std::option::Option::None,
|
11453 - | boolean: ::std::option::Option::None,
|
11454 - | double: ::std::option::Option::None,
|
11455 - | empty_struct: ::std::option::Option::None,
|
11456 - | float: ::std::option::Option::None,
|
11457 - | httpdate_timestamp: ::std::option::Option::None,
|
11458 - | integer: ::std::option::Option::None,
|
11459 - | iso8601_timestamp: ::std::option::Option::None,
|
11460 - | json_value: ::std::option::Option::None,
|
11461 - | list_of_lists: ::std::option::Option::None,
|
11462 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11463 - | list_of_strings: ::std::option::Option::None,
|
11464 - | list_of_structs: ::std::option::Option::None,
|
11465 - | long: ::std::option::Option::None,
|
11466 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11467 - | map_of_maps: ::std::option::Option::None,
|
11468 - | map_of_strings: ::std::option::Option::None,
|
11469 - | map_of_structs: ::std::option::Option::None,
|
11470 - | recursive_map: ::std::option::Option::None,
|
11471 - | recursive_struct: ::std::option::Option::None,
|
11472 - | simple_struct: ::std::option::Option::None,
|
11473 - | string: ::std::option::Option::None,
|
11474 - | struct_with_json_name: ::std::option::Option::None,
|
11475 - | timestamp: ::std::option::Option::None,
|
11476 - | unix_timestamp: ::std::option::Option::None,
|
11373 + | async fn aws_json11_deserialize_timestamp_union_value_response() {
|
11374 + | let output = crate::output::JsonUnionsOutput {
|
11375 + | contents: ::std::option::Option::Some(crate::model::MyUnion::TimestampValue(
|
11376 + | ::aws_smithy_types::DateTime::from_fractional_secs(1398796238, 0_f64),
|
11377 + | )),
|
11378 + | };
|
11379 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11380 + | let http_response = output.into_response();
|
11381 + | ::pretty_assertions::assert_eq!(
|
11382 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11383 + | http_response.status()
|
11384 + | );
|
11385 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11386 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11387 + | http_response.headers(),
|
11388 + | expected_headers,
|
11389 + | ));
|
11390 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11391 + | .await
|
11392 + | .expect("unable to extract body to bytes");
|
11393 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11394 + | &body,
|
11395 + | "{\n \"contents\": {\n \"timestampValue\": 1398796238\n }\n}",
|
11396 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11397 + | ));
|
11398 + | }
|
11399 + |
|
11400 + | /// Deserializes an enum union value
|
11401 + | /// Test ID: AwsJson11DeserializeEnumUnionValue
|
11402 + | #[::tokio::test]
|
11403 + | #[::tracing_test::traced_test]
|
11404 + | async fn aws_json11_deserialize_enum_union_value_response() {
|
11405 + | let output = crate::output::JsonUnionsOutput {
|
11406 + | contents: ::std::option::Option::Some(crate::model::MyUnion::EnumValue(
|
11407 + | "Foo"
|
11408 + | .parse::<crate::model::FooEnum>()
|
11409 + | .expect("static value validated to member"),
|
11410 + | )),
|
11411 + | };
|
11412 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11413 + | let http_response = output.into_response();
|
11414 + | ::pretty_assertions::assert_eq!(
|
11415 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11416 + | http_response.status()
|
11417 + | );
|
11418 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11419 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11420 + | http_response.headers(),
|
11421 + | expected_headers,
|
11422 + | ));
|
11423 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11424 + | .await
|
11425 + | .expect("unable to extract body to bytes");
|
11426 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11427 + | &body,
|
11428 + | "{\n \"contents\": {\n \"enumValue\": \"Foo\"\n }\n}",
|
11429 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11430 + | ));
|
11431 + | }
|
11432 + |
|
11433 + | /// Deserializes a list union value
|
11434 + | /// Test ID: AwsJson11DeserializeListUnionValue
|
11435 + | #[::tokio::test]
|
11436 + | #[::tracing_test::traced_test]
|
11437 + | async fn aws_json11_deserialize_list_union_value_response() {
|
11438 + | let output = crate::output::JsonUnionsOutput {
|
11439 + | contents: ::std::option::Option::Some(crate::model::MyUnion::ListValue(vec![
|
11440 + | "foo".to_owned(),
|
11441 + | "bar".to_owned(),
|
11442 + | ])),
|
11477 11443 | };
|
11478 11444 | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11479 11445 | let http_response = output.into_response();
|
11480 11446 | ::pretty_assertions::assert_eq!(
|
11481 11447 | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11482 11448 | http_response.status()
|
11483 11449 | );
|
11484 11450 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11485 11451 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11486 11452 | http_response.headers(),
|
11487 11453 | expected_headers,
|
11488 11454 | ));
|
11489 11455 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11490 11456 | .await
|
11491 11457 | .expect("unable to extract body to bytes");
|
11492 - | ::aws_smithy_protocol_test::assert_ok(
|
11493 - | ::aws_smithy_protocol_test::validate_body(&body, "{\"RecursiveList\":[{\"RecursiveList\":[{\"RecursiveList\":[{\"String\":\"value\"}]}]}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
11494 - | );
|
11458 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11459 + | &body,
|
11460 + | "{\n \"contents\": {\n \"listValue\": [\"foo\", \"bar\"]\n }\n}",
|
11461 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11462 + | ));
|
11495 11463 | }
|
11496 11464 |
|
11497 - | /// Parses map shapes
|
11498 - | /// Test ID: parses_map_shapes
|
11465 + | /// Deserializes a map union value
|
11466 + | /// Test ID: AwsJson11DeserializeMapUnionValue
|
11499 11467 | #[::tokio::test]
|
11500 11468 | #[::tracing_test::traced_test]
|
11501 - | async fn parses_map_shapes_response() {
|
11502 - | let output = crate::output::KitchenSinkOperationOutput {
|
11503 - | map_of_strings: ::std::option::Option::Some({
|
11469 + | async fn aws_json11_deserialize_map_union_value_response() {
|
11470 + | let output = crate::output::JsonUnionsOutput {
|
11471 + | contents: ::std::option::Option::Some(crate::model::MyUnion::MapValue({
|
11504 11472 | let mut ret = ::std::collections::HashMap::new();
|
11505 - | ret.insert("size".to_owned(), "large".to_owned());
|
11506 - | ret.insert("color".to_owned(), "red".to_owned());
|
11473 + | ret.insert("foo".to_owned(), "bar".to_owned());
|
11474 + | ret.insert("spam".to_owned(), "eggs".to_owned());
|
11507 11475 | ret
|
11508 - | }),
|
11509 - | blob: ::std::option::Option::None,
|
11510 - | boolean: ::std::option::Option::None,
|
11511 - | double: ::std::option::Option::None,
|
11512 - | empty_struct: ::std::option::Option::None,
|
11513 - | float: ::std::option::Option::None,
|
11514 - | httpdate_timestamp: ::std::option::Option::None,
|
11515 - | integer: ::std::option::Option::None,
|
11516 - | iso8601_timestamp: ::std::option::Option::None,
|
11517 - | json_value: ::std::option::Option::None,
|
11518 - | list_of_lists: ::std::option::Option::None,
|
11519 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11520 - | list_of_strings: ::std::option::Option::None,
|
11521 - | list_of_structs: ::std::option::Option::None,
|
11522 - | long: ::std::option::Option::None,
|
11523 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11524 - | map_of_maps: ::std::option::Option::None,
|
11525 - | map_of_structs: ::std::option::Option::None,
|
11526 - | recursive_list: ::std::option::Option::None,
|
11527 - | recursive_map: ::std::option::Option::None,
|
11528 - | recursive_struct: ::std::option::Option::None,
|
11529 - | simple_struct: ::std::option::Option::None,
|
11530 - | string: ::std::option::Option::None,
|
11531 - | struct_with_json_name: ::std::option::Option::None,
|
11532 - | timestamp: ::std::option::Option::None,
|
11533 - | unix_timestamp: ::std::option::Option::None,
|
11476 + | })),
|
11534 11477 | };
|
11535 11478 | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11536 11479 | let http_response = output.into_response();
|
11537 11480 | ::pretty_assertions::assert_eq!(
|
11538 11481 | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11539 11482 | http_response.status()
|
11540 11483 | );
|
11541 11484 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11542 11485 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11543 11486 | http_response.headers(),
|
11544 11487 | expected_headers,
|
11545 11488 | ));
|
11546 11489 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11547 11490 | .await
|
11548 11491 | .expect("unable to extract body to bytes");
|
11549 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11550 - | &body,
|
11551 - | "{\"MapOfStrings\":{\"size\":\"large\",\"color\":\"red\"}}",
|
11552 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11553 - | ));
|
11492 + | ::aws_smithy_protocol_test::assert_ok(
|
11493 + | ::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"))
|
11494 + | );
|
11554 11495 | }
|
11555 11496 |
|
11556 - | /// Parses map of list shapes
|
11557 - | /// Test ID: parses_map_of_list_shapes
|
11497 + | /// Deserializes a structure union value
|
11498 + | /// Test ID: AwsJson11DeserializeStructureUnionValue
|
11558 11499 | #[::tokio::test]
|
11559 11500 | #[::tracing_test::traced_test]
|
11560 - | async fn parses_map_of_list_shapes_response() {
|
11561 - | let output = crate::output::KitchenSinkOperationOutput {
|
11562 - | map_of_lists_of_strings: ::std::option::Option::Some({
|
11563 - | let mut ret = ::std::collections::HashMap::new();
|
11564 - | ret.insert(
|
11565 - | "sizes".to_owned(),
|
11566 - | vec!["large".to_owned(), "small".to_owned()],
|
11567 - | );
|
11568 - | ret.insert(
|
11569 - | "colors".to_owned(),
|
11570 - | vec!["red".to_owned(), "green".to_owned()],
|
11571 - | );
|
11572 - | ret
|
11573 - | }),
|
11574 - | blob: ::std::option::Option::None,
|
11575 - | boolean: ::std::option::Option::None,
|
11576 - | double: ::std::option::Option::None,
|
11577 - | empty_struct: ::std::option::Option::None,
|
11578 - | float: ::std::option::Option::None,
|
11579 - | httpdate_timestamp: ::std::option::Option::None,
|
11580 - | integer: ::std::option::Option::None,
|
11581 - | iso8601_timestamp: ::std::option::Option::None,
|
11582 - | json_value: ::std::option::Option::None,
|
11583 - | list_of_lists: ::std::option::Option::None,
|
11584 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11585 - | list_of_strings: ::std::option::Option::None,
|
11586 - | list_of_structs: ::std::option::Option::None,
|
11587 - | long: ::std::option::Option::None,
|
11588 - | map_of_maps: ::std::option::Option::None,
|
11589 - | map_of_strings: ::std::option::Option::None,
|
11590 - | map_of_structs: ::std::option::Option::None,
|
11591 - | recursive_list: ::std::option::Option::None,
|
11592 - | recursive_map: ::std::option::Option::None,
|
11593 - | recursive_struct: ::std::option::Option::None,
|
11594 - | simple_struct: ::std::option::Option::None,
|
11595 - | string: ::std::option::Option::None,
|
11596 - | struct_with_json_name: ::std::option::Option::None,
|
11597 - | timestamp: ::std::option::Option::None,
|
11598 - | unix_timestamp: ::std::option::Option::None,
|
11501 + | async fn aws_json11_deserialize_structure_union_value_response() {
|
11502 + | let output = crate::output::JsonUnionsOutput {
|
11503 + | contents: ::std::option::Option::Some(crate::model::MyUnion::StructureValue(
|
11504 + | crate::model::GreetingStruct {
|
11505 + | hi: ::std::option::Option::Some("hello".to_owned()),
|
11506 + | },
|
11507 + | )),
|
11599 11508 | };
|
11600 11509 | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11601 11510 | let http_response = output.into_response();
|
11602 11511 | ::pretty_assertions::assert_eq!(
|
11603 11512 | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11604 11513 | http_response.status()
|
11605 11514 | );
|
11606 11515 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11607 11516 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11608 11517 | http_response.headers(),
|
11609 11518 | expected_headers,
|
11610 11519 | ));
|
11611 11520 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11612 11521 | .await
|
11613 - | .expect("unable to extract body to bytes");
|
11614 - | ::aws_smithy_protocol_test::assert_ok(
|
11615 - | ::aws_smithy_protocol_test::validate_body(&body, "{\"MapOfListsOfStrings\":{\"sizes\":[\"large\",\"small\"],\"colors\":[\"red\",\"green\"]}}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
11522 + | .expect("unable to extract body to bytes");
|
11523 + | ::aws_smithy_protocol_test::assert_ok(
|
11524 + | ::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"))
|
11525 + | );
|
11526 + | }
|
11527 + | }
|
11528 + |
|
11529 + | ::pin_project_lite::pin_project! {
|
11530 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
11531 + | /// [`EndpointOperationInput`](crate::input::EndpointOperationInput) using modelled bindings.
|
11532 + | pub struct EndpointOperationInputFuture {
|
11533 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EndpointOperationInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
11534 + | }
|
11535 + | }
|
11536 + |
|
11537 + | impl std::future::Future for EndpointOperationInputFuture {
|
11538 + | type Output = Result<
|
11539 + | crate::input::EndpointOperationInput,
|
11540 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
11541 + | >;
|
11542 + |
|
11543 + | fn poll(
|
11544 + | self: std::pin::Pin<&mut Self>,
|
11545 + | cx: &mut std::task::Context<'_>,
|
11546 + | ) -> std::task::Poll<Self::Output> {
|
11547 + | let this = self.project();
|
11548 + | this.inner.as_mut().poll(cx)
|
11549 + | }
|
11550 + | }
|
11551 + |
|
11552 + | impl<B>
|
11553 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
11554 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11555 + | B,
|
11556 + | > for crate::input::EndpointOperationInput
|
11557 + | where
|
11558 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
11559 + | B: 'static,
|
11560 + |
|
11561 + | B::Data: Send,
|
11562 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
11563 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
11564 + | {
|
11565 + | type Rejection =
|
11566 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
11567 + | type Future = EndpointOperationInputFuture;
|
11568 + |
|
11569 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
11570 + | let fut = async move {
|
11571 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
11572 + | request.headers(),
|
11573 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
11574 + | ) {
|
11575 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
11576 + | }
|
11577 + | crate::protocol_serde::shape_endpoint_operation::de_endpoint_operation_http_request(
|
11578 + | request,
|
11579 + | )
|
11580 + | .await
|
11581 + | };
|
11582 + | use ::futures_util::future::TryFutureExt;
|
11583 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
11584 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
11585 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
11586 + | });
|
11587 + | EndpointOperationInputFuture {
|
11588 + | inner: Box::pin(fut),
|
11589 + | }
|
11590 + | }
|
11591 + | }
|
11592 + | impl
|
11593 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
11594 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11595 + | > for crate::output::EndpointOperationOutput
|
11596 + | {
|
11597 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
11598 + | match crate::protocol_serde::shape_endpoint_operation::ser_endpoint_operation_http_response(
|
11599 + | self,
|
11600 + | ) {
|
11601 + | Ok(response) => response,
|
11602 + | Err(e) => {
|
11603 + | ::tracing::error!(error = %e, "failed to serialize response");
|
11604 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
11605 + | }
|
11606 + | }
|
11607 + | }
|
11608 + | }
|
11609 + |
|
11610 + | #[allow(unreachable_code, unused_variables)]
|
11611 + | #[cfg(test)]
|
11612 + | mod endpoint_operation_test {
|
11613 + |
|
11614 + | /// Operations can prepend to the given host if they define the
|
11615 + | /// endpoint trait.
|
11616 + | /// Test ID: AwsJson11EndpointTrait
|
11617 + | #[::tokio::test]
|
11618 + | #[::tracing_test::traced_test]
|
11619 + | #[should_panic]
|
11620 + | async fn aws_json11_endpoint_trait_request() {
|
11621 + | #[allow(unused_mut)]
|
11622 + | let mut http_request = ::http::Request::builder()
|
11623 + | .uri("/")
|
11624 + | .method("POST")
|
11625 + | .header("Content-Type", "application/x-amz-json-1.1")
|
11626 + | .header("X-Amz-Target", "JsonProtocol.EndpointOperation")
|
11627 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
11628 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
11629 + | "{}".as_bytes(),
|
11630 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
11631 + | )),
|
11632 + | ))
|
11633 + | .unwrap();
|
11634 + | todo!("endpoint trait not supported yet");
|
11635 + | #[allow(unused_mut)]
|
11636 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11637 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
11638 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
11639 + | .endpoint_operation(move |input: crate::input::EndpointOperationInput| {
|
11640 + | let sender = sender.clone();
|
11641 + | async move {
|
11642 + | let result = {
|
11643 + | let expected = crate::input::EndpointOperationInput {};
|
11644 + | ::pretty_assertions::assert_eq!(input, expected);
|
11645 + | let output = crate::output::EndpointOperationOutput {};
|
11646 + | output
|
11647 + | };
|
11648 + | sender.send(()).await.expect("receiver dropped early");
|
11649 + | result
|
11650 + | }
|
11651 + | })
|
11652 + | .build_unchecked();
|
11653 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11654 + | .await
|
11655 + | .expect("unable to make an HTTP request");
|
11656 + | assert!(
|
11657 + | receiver.recv().await.is_some(),
|
11658 + | "we expected operation handler to be invoked but it was not entered"
|
11616 11659 | );
|
11617 11660 | }
|
11661 + | }
|
11618 11662 |
|
11619 - | /// Parses map of map shapes
|
11620 - | /// Test ID: parses_map_of_map_shapes
|
11621 - | #[::tokio::test]
|
11622 - | #[::tracing_test::traced_test]
|
11623 - | async fn parses_map_of_map_shapes_response() {
|
11624 - | let output = crate::output::KitchenSinkOperationOutput {
|
11625 - | map_of_maps: ::std::option::Option::Some({
|
11626 - | let mut ret = ::std::collections::HashMap::new();
|
11627 - | ret.insert("sizes".to_owned(), {
|
11628 - | let mut ret = ::std::collections::HashMap::new();
|
11629 - | ret.insert("large".to_owned(), "L".to_owned());
|
11630 - | ret.insert("medium".to_owned(), "M".to_owned());
|
11631 - | ret
|
11632 - | });
|
11633 - | ret.insert("colors".to_owned(), {
|
11634 - | let mut ret = ::std::collections::HashMap::new();
|
11635 - | ret.insert("red".to_owned(), "R".to_owned());
|
11636 - | ret.insert("blue".to_owned(), "B".to_owned());
|
11637 - | ret
|
11638 - | });
|
11639 - | ret
|
11640 - | }),
|
11641 - | blob: ::std::option::Option::None,
|
11642 - | boolean: ::std::option::Option::None,
|
11643 - | double: ::std::option::Option::None,
|
11644 - | empty_struct: ::std::option::Option::None,
|
11645 - | float: ::std::option::Option::None,
|
11646 - | httpdate_timestamp: ::std::option::Option::None,
|
11647 - | integer: ::std::option::Option::None,
|
11648 - | iso8601_timestamp: ::std::option::Option::None,
|
11649 - | json_value: ::std::option::Option::None,
|
11650 - | list_of_lists: ::std::option::Option::None,
|
11651 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11652 - | list_of_strings: ::std::option::Option::None,
|
11653 - | list_of_structs: ::std::option::Option::None,
|
11654 - | long: ::std::option::Option::None,
|
11655 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11656 - | map_of_strings: ::std::option::Option::None,
|
11657 - | map_of_structs: ::std::option::Option::None,
|
11658 - | recursive_list: ::std::option::Option::None,
|
11659 - | recursive_map: ::std::option::Option::None,
|
11660 - | recursive_struct: ::std::option::Option::None,
|
11661 - | simple_struct: ::std::option::Option::None,
|
11662 - | string: ::std::option::Option::None,
|
11663 - | struct_with_json_name: ::std::option::Option::None,
|
11664 - | timestamp: ::std::option::Option::None,
|
11665 - | unix_timestamp: ::std::option::Option::None,
|
11663 + | ::pin_project_lite::pin_project! {
|
11664 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
11665 + | /// [`EndpointWithHostLabelOperationInput`](crate::input::EndpointWithHostLabelOperationInput) using modelled bindings.
|
11666 + | pub struct EndpointWithHostLabelOperationInputFuture {
|
11667 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EndpointWithHostLabelOperationInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
11668 + | }
|
11669 + | }
|
11670 + |
|
11671 + | impl std::future::Future for EndpointWithHostLabelOperationInputFuture {
|
11672 + | type Output = Result<
|
11673 + | crate::input::EndpointWithHostLabelOperationInput,
|
11674 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
11675 + | >;
|
11676 + |
|
11677 + | fn poll(
|
11678 + | self: std::pin::Pin<&mut Self>,
|
11679 + | cx: &mut std::task::Context<'_>,
|
11680 + | ) -> std::task::Poll<Self::Output> {
|
11681 + | let this = self.project();
|
11682 + | this.inner.as_mut().poll(cx)
|
11683 + | }
|
11684 + | }
|
11685 + |
|
11686 + | impl<B>
|
11687 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
11688 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11689 + | B,
|
11690 + | > for crate::input::EndpointWithHostLabelOperationInput
|
11691 + | where
|
11692 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
11693 + | B: 'static,
|
11694 + |
|
11695 + | B::Data: Send,
|
11696 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
11697 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
11698 + | {
|
11699 + | type Rejection =
|
11700 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
11701 + | type Future = EndpointWithHostLabelOperationInputFuture;
|
11702 + |
|
11703 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
11704 + | let fut = async move {
|
11705 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
11706 + | request.headers(),
|
11707 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
11708 + | ) {
|
11709 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
11710 + | }
|
11711 + | crate::protocol_serde::shape_endpoint_with_host_label_operation::de_endpoint_with_host_label_operation_http_request(request)
|
11712 + | .await
|
11666 11713 | };
|
11667 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11668 - | let http_response = output.into_response();
|
11669 - | ::pretty_assertions::assert_eq!(
|
11670 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11671 - | http_response.status()
|
11672 - | );
|
11673 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11674 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11675 - | http_response.headers(),
|
11676 - | expected_headers,
|
11677 - | ));
|
11678 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11679 - | .await
|
11680 - | .expect("unable to extract body to bytes");
|
11681 - | ::aws_smithy_protocol_test::assert_ok(
|
11682 - | ::aws_smithy_protocol_test::validate_body(&body, "{\"MapOfMaps\":{\"sizes\":{\"large\":\"L\",\"medium\":\"M\"},\"colors\":{\"red\":\"R\",\"blue\":\"B\"}}}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
11683 - | );
|
11714 + | use ::futures_util::future::TryFutureExt;
|
11715 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
11716 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
11717 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
11718 + | });
|
11719 + | EndpointWithHostLabelOperationInputFuture {
|
11720 + | inner: Box::pin(fut),
|
11721 + | }
|
11722 + | }
|
11723 + | }
|
11724 + | impl
|
11725 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
11726 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11727 + | > for crate::output::EndpointWithHostLabelOperationOutput
|
11728 + | {
|
11729 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
11730 + | match crate::protocol_serde::shape_endpoint_with_host_label_operation::ser_endpoint_with_host_label_operation_http_response(self) {
|
11731 + | Ok(response) => response,
|
11732 + | Err(e) => {
|
11733 + | ::tracing::error!(error = %e, "failed to serialize response");
|
11734 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
11735 + | }
|
11736 + | }
|
11737 + | }
|
11738 + | }
|
11739 + | impl
|
11740 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
11741 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11742 + | > for crate::error::EndpointWithHostLabelOperationError
|
11743 + | {
|
11744 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
11745 + | match crate::protocol_serde::shape_endpoint_with_host_label_operation::ser_endpoint_with_host_label_operation_http_error(&self) {
|
11746 + | Ok(mut response) => {
|
11747 + | response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
11748 + | response
|
11749 + | },
|
11750 + | Err(e) => {
|
11751 + | ::tracing::error!(error = %e, "failed to serialize response");
|
11752 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
11753 + | }
|
11754 + | }
|
11684 11755 | }
|
11756 + | }
|
11685 11757 |
|
11686 - | /// Parses map of structure shapes
|
11687 - | /// Test ID: parses_map_of_structure_shapes
|
11758 + | #[allow(unreachable_code, unused_variables)]
|
11759 + | #[cfg(test)]
|
11760 + | mod endpoint_with_host_label_operation_test {
|
11761 + |
|
11762 + | /// Operations can prepend to the given host if they define the
|
11763 + | /// endpoint trait, and can use the host label trait to define
|
11764 + | /// further customization based on user input.
|
11765 + | /// Test ID: AwsJson11EndpointTraitWithHostLabel
|
11688 11766 | #[::tokio::test]
|
11689 11767 | #[::tracing_test::traced_test]
|
11690 - | async fn parses_map_of_structure_shapes_response() {
|
11691 - | let output = crate::output::KitchenSinkOperationOutput {
|
11692 - | map_of_structs: ::std::option::Option::Some({
|
11693 - | let mut ret = ::std::collections::HashMap::new();
|
11694 - | ret.insert(
|
11695 - | "size".to_owned(),
|
11696 - | crate::model::SimpleStruct {
|
11697 - | value: ::std::option::Option::Some("small".to_owned()),
|
11698 - | },
|
11699 - | );
|
11700 - | ret.insert(
|
11701 - | "color".to_owned(),
|
11702 - | crate::model::SimpleStruct {
|
11703 - | value: ::std::option::Option::Some("red".to_owned()),
|
11704 - | },
|
11705 - | );
|
11706 - | ret
|
11707 - | }),
|
11708 - | blob: ::std::option::Option::None,
|
11709 - | boolean: ::std::option::Option::None,
|
11710 - | double: ::std::option::Option::None,
|
11711 - | empty_struct: ::std::option::Option::None,
|
11712 - | float: ::std::option::Option::None,
|
11713 - | httpdate_timestamp: ::std::option::Option::None,
|
11714 - | integer: ::std::option::Option::None,
|
11715 - | iso8601_timestamp: ::std::option::Option::None,
|
11716 - | json_value: ::std::option::Option::None,
|
11717 - | list_of_lists: ::std::option::Option::None,
|
11718 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11719 - | list_of_strings: ::std::option::Option::None,
|
11720 - | list_of_structs: ::std::option::Option::None,
|
11721 - | long: ::std::option::Option::None,
|
11722 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11723 - | map_of_maps: ::std::option::Option::None,
|
11724 - | map_of_strings: ::std::option::Option::None,
|
11725 - | recursive_list: ::std::option::Option::None,
|
11726 - | recursive_map: ::std::option::Option::None,
|
11727 - | recursive_struct: ::std::option::Option::None,
|
11728 - | simple_struct: ::std::option::Option::None,
|
11729 - | string: ::std::option::Option::None,
|
11730 - | struct_with_json_name: ::std::option::Option::None,
|
11731 - | timestamp: ::std::option::Option::None,
|
11732 - | unix_timestamp: ::std::option::Option::None,
|
11733 - | };
|
11734 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11735 - | let http_response = output.into_response();
|
11736 - | ::pretty_assertions::assert_eq!(
|
11737 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11738 - | http_response.status()
|
11739 - | );
|
11740 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11741 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11742 - | http_response.headers(),
|
11743 - | expected_headers,
|
11744 - | ));
|
11745 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11768 + | #[should_panic]
|
11769 + | async fn aws_json11_endpoint_trait_with_host_label_request() {
|
11770 + | #[allow(unused_mut)]
|
11771 + | let mut http_request = ::http::Request::builder()
|
11772 + | .uri("/")
|
11773 + | .method("POST")
|
11774 + | .header("Content-Type", "application/x-amz-json-1.1")
|
11775 + | .header(
|
11776 + | "X-Amz-Target",
|
11777 + | "JsonProtocol.EndpointWithHostLabelOperation",
|
11778 + | )
|
11779 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
11780 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
11781 + | "{\"label\": \"bar\"}".as_bytes(),
|
11782 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11783 + | )),
|
11784 + | ))
|
11785 + | .unwrap();
|
11786 + | todo!("endpoint trait not supported yet");
|
11787 + | #[allow(unused_mut)]
|
11788 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11789 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
11790 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
11791 + | .endpoint_with_host_label_operation(
|
11792 + | move |input: crate::input::EndpointWithHostLabelOperationInput| {
|
11793 + | let sender = sender.clone();
|
11794 + | async move {
|
11795 + | let result = {
|
11796 + | let expected = crate::input::EndpointWithHostLabelOperationInput {
|
11797 + | label: "bar".to_owned(),
|
11798 + | };
|
11799 + | ::pretty_assertions::assert_eq!(input, expected);
|
11800 + | let output = crate::output::EndpointWithHostLabelOperationOutput {};
|
11801 + | Ok(output)
|
11802 + | };
|
11803 + | sender.send(()).await.expect("receiver dropped early");
|
11804 + | result
|
11805 + | }
|
11806 + | },
|
11807 + | )
|
11808 + | .build_unchecked();
|
11809 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11746 11810 | .await
|
11747 - | .expect("unable to extract body to bytes");
|
11748 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11749 - | &body,
|
11750 - | "{\"MapOfStructs\":{\"size\":{\"Value\":\"small\"},\"color\":{\"Value\":\"red\"}}}",
|
11751 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11752 - | ));
|
11811 + | .expect("unable to make an HTTP request");
|
11812 + | assert!(
|
11813 + | receiver.recv().await.is_some(),
|
11814 + | "we expected operation handler to be invoked but it was not entered"
|
11815 + | );
|
11753 11816 | }
|
11817 + | }
|
11754 11818 |
|
11755 - | /// Parses map of recursive structure shapes
|
11756 - | /// Test ID: parses_map_of_recursive_structure_shapes
|
11757 - | #[::tokio::test]
|
11758 - | #[::tracing_test::traced_test]
|
11759 - | async fn parses_map_of_recursive_structure_shapes_response() {
|
11760 - | let output = crate::output::KitchenSinkOperationOutput {
|
11761 - | recursive_map: ::std::option::Option::Some({
|
11762 - | let mut ret = ::std::collections::HashMap::new();
|
11763 - | ret.insert(
|
11764 - | "key-1".to_owned(),
|
11765 - | crate::model::KitchenSink {
|
11766 - | recursive_map: ::std::option::Option::Some({
|
11767 - | let mut ret = ::std::collections::HashMap::new();
|
11768 - | ret.insert(
|
11769 - | "key-2".to_owned(),
|
11770 - | crate::model::KitchenSink {
|
11771 - | recursive_map: ::std::option::Option::Some({
|
11772 - | let mut ret = ::std::collections::HashMap::new();
|
11773 - | ret.insert(
|
11774 - | "key-3".to_owned(),
|
11775 - | crate::model::KitchenSink {
|
11776 - | string: ::std::option::Option::Some(
|
11777 - | "value".to_owned(),
|
11778 - | ),
|
11779 - | blob: ::std::option::Option::None,
|
11780 - | boolean: ::std::option::Option::None,
|
11781 - | double: ::std::option::Option::None,
|
11782 - | empty_struct: ::std::option::Option::None,
|
11783 - | float: ::std::option::Option::None,
|
11784 - | httpdate_timestamp: ::std::option::Option::None,
|
11785 - | integer: ::std::option::Option::None,
|
11786 - | iso8601_timestamp: ::std::option::Option::None,
|
11787 - | json_value: ::std::option::Option::None,
|
11788 - | list_of_lists: ::std::option::Option::None,
|
11789 - | list_of_maps_of_strings:
|
11790 - | ::std::option::Option::None,
|
11791 - | list_of_strings: ::std::option::Option::None,
|
11792 - | list_of_structs: ::std::option::Option::None,
|
11793 - | long: ::std::option::Option::None,
|
11794 - | map_of_lists_of_strings:
|
11795 - | ::std::option::Option::None,
|
11796 - | map_of_maps: ::std::option::Option::None,
|
11797 - | map_of_strings: ::std::option::Option::None,
|
11798 - | map_of_structs: ::std::option::Option::None,
|
11799 - | recursive_list: ::std::option::Option::None,
|
11800 - | recursive_map: ::std::option::Option::None,
|
11801 - | recursive_struct: ::std::option::Option::None,
|
11802 - | simple_struct: ::std::option::Option::None,
|
11803 - | struct_with_json_name: ::std::option::Option::None,
|
11804 - | timestamp: ::std::option::Option::None,
|
11805 - | unix_timestamp: ::std::option::Option::None,
|
11806 - | },
|
11807 - | );
|
11808 - | ret
|
11809 - | }),
|
11810 - | blob: ::std::option::Option::None,
|
11811 - | boolean: ::std::option::Option::None,
|
11812 - | double: ::std::option::Option::None,
|
11813 - | empty_struct: ::std::option::Option::None,
|
11814 - | float: ::std::option::Option::None,
|
11815 - | httpdate_timestamp: ::std::option::Option::None,
|
11816 - | integer: ::std::option::Option::None,
|
11817 - | iso8601_timestamp: ::std::option::Option::None,
|
11818 - | json_value: ::std::option::Option::None,
|
11819 - | list_of_lists: ::std::option::Option::None,
|
11820 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11821 - | list_of_strings: ::std::option::Option::None,
|
11822 - | list_of_structs: ::std::option::Option::None,
|
11823 - | long: ::std::option::Option::None,
|
11824 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11825 - | map_of_maps: ::std::option::Option::None,
|
11826 - | map_of_strings: ::std::option::Option::None,
|
11827 - | map_of_structs: ::std::option::Option::None,
|
11828 - | recursive_list: ::std::option::Option::None,
|
11829 - | recursive_struct: ::std::option::Option::None,
|
11830 - | simple_struct: ::std::option::Option::None,
|
11831 - | string: ::std::option::Option::None,
|
11832 - | struct_with_json_name: ::std::option::Option::None,
|
11833 - | timestamp: ::std::option::Option::None,
|
11834 - | unix_timestamp: ::std::option::Option::None,
|
11835 - | },
|
11836 - | );
|
11837 - | ret
|
11838 - | }),
|
11839 - | blob: ::std::option::Option::None,
|
11840 - | boolean: ::std::option::Option::None,
|
11841 - | double: ::std::option::Option::None,
|
11842 - | empty_struct: ::std::option::Option::None,
|
11843 - | float: ::std::option::Option::None,
|
11844 - | httpdate_timestamp: ::std::option::Option::None,
|
11845 - | integer: ::std::option::Option::None,
|
11846 - | iso8601_timestamp: ::std::option::Option::None,
|
11847 - | json_value: ::std::option::Option::None,
|
11848 - | list_of_lists: ::std::option::Option::None,
|
11849 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11850 - | list_of_strings: ::std::option::Option::None,
|
11851 - | list_of_structs: ::std::option::Option::None,
|
11852 - | long: ::std::option::Option::None,
|
11853 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11854 - | map_of_maps: ::std::option::Option::None,
|
11855 - | map_of_strings: ::std::option::Option::None,
|
11856 - | map_of_structs: ::std::option::Option::None,
|
11857 - | recursive_list: ::std::option::Option::None,
|
11858 - | recursive_struct: ::std::option::Option::None,
|
11859 - | simple_struct: ::std::option::Option::None,
|
11860 - | string: ::std::option::Option::None,
|
11861 - | struct_with_json_name: ::std::option::Option::None,
|
11862 - | timestamp: ::std::option::Option::None,
|
11863 - | unix_timestamp: ::std::option::Option::None,
|
11864 - | },
|
11865 - | );
|
11866 - | ret
|
11867 - | }),
|
11868 - | blob: ::std::option::Option::None,
|
11869 - | boolean: ::std::option::Option::None,
|
11870 - | double: ::std::option::Option::None,
|
11871 - | empty_struct: ::std::option::Option::None,
|
11872 - | float: ::std::option::Option::None,
|
11873 - | httpdate_timestamp: ::std::option::Option::None,
|
11874 - | integer: ::std::option::Option::None,
|
11875 - | iso8601_timestamp: ::std::option::Option::None,
|
11876 - | json_value: ::std::option::Option::None,
|
11877 - | list_of_lists: ::std::option::Option::None,
|
11878 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11879 - | list_of_strings: ::std::option::Option::None,
|
11880 - | list_of_structs: ::std::option::Option::None,
|
11881 - | long: ::std::option::Option::None,
|
11882 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11883 - | map_of_maps: ::std::option::Option::None,
|
11884 - | map_of_strings: ::std::option::Option::None,
|
11885 - | map_of_structs: ::std::option::Option::None,
|
11886 - | recursive_list: ::std::option::Option::None,
|
11887 - | recursive_struct: ::std::option::Option::None,
|
11888 - | simple_struct: ::std::option::Option::None,
|
11889 - | string: ::std::option::Option::None,
|
11890 - | struct_with_json_name: ::std::option::Option::None,
|
11891 - | timestamp: ::std::option::Option::None,
|
11892 - | unix_timestamp: ::std::option::Option::None,
|
11819 + | ::pin_project_lite::pin_project! {
|
11820 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
11821 + | /// [`HostWithPathOperationInput`](crate::input::HostWithPathOperationInput) using modelled bindings.
|
11822 + | pub struct HostWithPathOperationInputFuture {
|
11823 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::HostWithPathOperationInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
11824 + | }
|
11825 + | }
|
11826 + |
|
11827 + | impl std::future::Future for HostWithPathOperationInputFuture {
|
11828 + | type Output = Result<
|
11829 + | crate::input::HostWithPathOperationInput,
|
11830 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
11831 + | >;
|
11832 + |
|
11833 + | fn poll(
|
11834 + | self: std::pin::Pin<&mut Self>,
|
11835 + | cx: &mut std::task::Context<'_>,
|
11836 + | ) -> std::task::Poll<Self::Output> {
|
11837 + | let this = self.project();
|
11838 + | this.inner.as_mut().poll(cx)
|
11839 + | }
|
11840 + | }
|
11841 + |
|
11842 + | impl<B>
|
11843 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
11844 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11845 + | B,
|
11846 + | > for crate::input::HostWithPathOperationInput
|
11847 + | where
|
11848 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
11849 + | B: 'static,
|
11850 + |
|
11851 + | B::Data: Send,
|
11852 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
11853 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
11854 + | {
|
11855 + | type Rejection =
|
11856 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
11857 + | type Future = HostWithPathOperationInputFuture;
|
11858 + |
|
11859 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
11860 + | let fut = async move {
|
11861 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
11862 + | request.headers(),
|
11863 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
11864 + | ) {
|
11865 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
11866 + | }
|
11867 + | crate::protocol_serde::shape_host_with_path_operation::de_host_with_path_operation_http_request(request)
|
11868 + | .await
|
11893 11869 | };
|
11894 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11895 - | let http_response = output.into_response();
|
11896 - | ::pretty_assertions::assert_eq!(
|
11897 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11898 - | http_response.status()
|
11899 - | );
|
11900 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11901 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11902 - | http_response.headers(),
|
11903 - | expected_headers,
|
11904 - | ));
|
11905 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11906 - | .await
|
11907 - | .expect("unable to extract body to bytes");
|
11908 - | ::aws_smithy_protocol_test::assert_ok(
|
11909 - | ::aws_smithy_protocol_test::validate_body(&body, "{\"RecursiveMap\":{\"key-1\":{\"RecursiveMap\":{\"key-2\":{\"RecursiveMap\":{\"key-3\":{\"String\":\"value\"}}}}}}}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
11910 - | );
|
11870 + | use ::futures_util::future::TryFutureExt;
|
11871 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
11872 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
11873 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
11874 + | });
|
11875 + | HostWithPathOperationInputFuture {
|
11876 + | inner: Box::pin(fut),
|
11877 + | }
|
11878 + | }
|
11879 + | }
|
11880 + | impl
|
11881 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
11882 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11883 + | > for crate::output::HostWithPathOperationOutput
|
11884 + | {
|
11885 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
11886 + | match crate::protocol_serde::shape_host_with_path_operation::ser_host_with_path_operation_http_response(self) {
|
11887 + | Ok(response) => response,
|
11888 + | Err(e) => {
|
11889 + | ::tracing::error!(error = %e, "failed to serialize response");
|
11890 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
11891 + | }
|
11892 + | }
|
11911 11893 | }
|
11894 + | }
|
11912 11895 |
|
11913 - | /// Parses the request id from the response
|
11914 - | /// Test ID: parses_the_request_id_from_the_response
|
11915 - | #[::tokio::test]
|
11916 - | #[::tracing_test::traced_test]
|
11917 - | #[should_panic]
|
11918 - | async fn parses_the_request_id_from_the_response_response() {
|
11919 - | let output = crate::output::KitchenSinkOperationOutput {
|
11920 - | blob: ::std::option::Option::None,
|
11921 - | boolean: ::std::option::Option::None,
|
11922 - | double: ::std::option::Option::None,
|
11923 - | empty_struct: ::std::option::Option::None,
|
11924 - | float: ::std::option::Option::None,
|
11925 - | httpdate_timestamp: ::std::option::Option::None,
|
11926 - | integer: ::std::option::Option::None,
|
11927 - | iso8601_timestamp: ::std::option::Option::None,
|
11928 - | json_value: ::std::option::Option::None,
|
11929 - | list_of_lists: ::std::option::Option::None,
|
11930 - | list_of_maps_of_strings: ::std::option::Option::None,
|
11931 - | list_of_strings: ::std::option::Option::None,
|
11932 - | list_of_structs: ::std::option::Option::None,
|
11933 - | long: ::std::option::Option::None,
|
11934 - | map_of_lists_of_strings: ::std::option::Option::None,
|
11935 - | map_of_maps: ::std::option::Option::None,
|
11936 - | map_of_strings: ::std::option::Option::None,
|
11937 - | map_of_structs: ::std::option::Option::None,
|
11938 - | recursive_list: ::std::option::Option::None,
|
11939 - | recursive_map: ::std::option::Option::None,
|
11940 - | recursive_struct: ::std::option::Option::None,
|
11941 - | simple_struct: ::std::option::Option::None,
|
11942 - | string: ::std::option::Option::None,
|
11943 - | struct_with_json_name: ::std::option::Option::None,
|
11944 - | timestamp: ::std::option::Option::None,
|
11945 - | unix_timestamp: ::std::option::Option::None,
|
11896 + | ::pin_project_lite::pin_project! {
|
11897 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
11898 + | /// [`DatetimeOffsetsInput`](crate::input::DatetimeOffsetsInput) using modelled bindings.
|
11899 + | pub struct DatetimeOffsetsInputFuture {
|
11900 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::DatetimeOffsetsInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
11901 + | }
|
11902 + | }
|
11903 + |
|
11904 + | impl std::future::Future for DatetimeOffsetsInputFuture {
|
11905 + | type Output = Result<
|
11906 + | crate::input::DatetimeOffsetsInput,
|
11907 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
11908 + | >;
|
11909 + |
|
11910 + | fn poll(
|
11911 + | self: std::pin::Pin<&mut Self>,
|
11912 + | cx: &mut std::task::Context<'_>,
|
11913 + | ) -> std::task::Poll<Self::Output> {
|
11914 + | let this = self.project();
|
11915 + | this.inner.as_mut().poll(cx)
|
11916 + | }
|
11917 + | }
|
11918 + |
|
11919 + | impl<B>
|
11920 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
11921 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11922 + | B,
|
11923 + | > for crate::input::DatetimeOffsetsInput
|
11924 + | where
|
11925 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
11926 + | B: 'static,
|
11927 + |
|
11928 + | B::Data: Send,
|
11929 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
11930 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
11931 + | {
|
11932 + | type Rejection =
|
11933 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
11934 + | type Future = DatetimeOffsetsInputFuture;
|
11935 + |
|
11936 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
11937 + | let fut = async move {
|
11938 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
11939 + | request.headers(),
|
11940 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
11941 + | ) {
|
11942 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
11943 + | }
|
11944 + | crate::protocol_serde::shape_datetime_offsets::de_datetime_offsets_http_request(request)
|
11945 + | .await
|
11946 11946 | };
|
11947 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
11948 - | let http_response = output.into_response();
|
11949 - | ::pretty_assertions::assert_eq!(
|
11950 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11951 - | http_response.status()
|
11952 - | );
|
11953 - | let expected_headers = [
|
11954 - | ("Content-Type", "application/x-amz-json-1.1"),
|
11955 - | ("X-Amzn-Requestid", "amazon-uniq-request-id"),
|
11956 - | ];
|
11957 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11958 - | http_response.headers(),
|
11959 - | expected_headers,
|
11960 - | ));
|
11961 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11947 + | use ::futures_util::future::TryFutureExt;
|
11948 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
11949 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
11950 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
11951 + | });
|
11952 + | DatetimeOffsetsInputFuture {
|
11953 + | inner: Box::pin(fut),
|
11954 + | }
|
11955 + | }
|
11956 + | }
|
11957 + | impl
|
11958 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
11959 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11960 + | > for crate::output::DatetimeOffsetsOutput
|
11961 + | {
|
11962 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
11963 + | match crate::protocol_serde::shape_datetime_offsets::ser_datetime_offsets_http_response(
|
11964 + | self,
|
11965 + | ) {
|
11966 + | Ok(response) => response,
|
11967 + | Err(e) => {
|
11968 + | ::tracing::error!(error = %e, "failed to serialize response");
|
11969 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
11970 + | }
|
11971 + | }
|
11972 + | }
|
11973 + | }
|
11974 + |
|
11975 + | ::pin_project_lite::pin_project! {
|
11976 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
11977 + | /// [`FractionalSecondsInput`](crate::input::FractionalSecondsInput) using modelled bindings.
|
11978 + | pub struct FractionalSecondsInputFuture {
|
11979 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::FractionalSecondsInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
11980 + | }
|
11981 + | }
|
11982 + |
|
11983 + | impl std::future::Future for FractionalSecondsInputFuture {
|
11984 + | type Output = Result<
|
11985 + | crate::input::FractionalSecondsInput,
|
11986 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
11987 + | >;
|
11988 + |
|
11989 + | fn poll(
|
11990 + | self: std::pin::Pin<&mut Self>,
|
11991 + | cx: &mut std::task::Context<'_>,
|
11992 + | ) -> std::task::Poll<Self::Output> {
|
11993 + | let this = self.project();
|
11994 + | this.inner.as_mut().poll(cx)
|
11995 + | }
|
11996 + | }
|
11997 + |
|
11998 + | impl<B>
|
11999 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
12000 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12001 + | B,
|
12002 + | > for crate::input::FractionalSecondsInput
|
12003 + | where
|
12004 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
12005 + | B: 'static,
|
12006 + |
|
12007 + | B::Data: Send,
|
12008 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
12009 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
12010 + | {
|
12011 + | type Rejection =
|
12012 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
12013 + | type Future = FractionalSecondsInputFuture;
|
12014 + |
|
12015 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
12016 + | let fut = async move {
|
12017 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
12018 + | request.headers(),
|
12019 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
12020 + | ) {
|
12021 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
12022 + | }
|
12023 + | crate::protocol_serde::shape_fractional_seconds::de_fractional_seconds_http_request(
|
12024 + | request,
|
12025 + | )
|
11962 12026 | .await
|
11963 - | .expect("unable to extract body to bytes");
|
11964 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11965 - | &body,
|
11966 - | "{}",
|
11967 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11968 - | ));
|
12027 + | };
|
12028 + | use ::futures_util::future::TryFutureExt;
|
12029 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
12030 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
12031 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
12032 + | });
|
12033 + | FractionalSecondsInputFuture {
|
12034 + | inner: Box::pin(fut),
|
12035 + | }
|
12036 + | }
|
12037 + | }
|
12038 + | impl
|
12039 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
12040 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12041 + | > for crate::output::FractionalSecondsOutput
|
12042 + | {
|
12043 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
12044 + | match crate::protocol_serde::shape_fractional_seconds::ser_fractional_seconds_http_response(
|
12045 + | self,
|
12046 + | ) {
|
12047 + | Ok(response) => response,
|
12048 + | Err(e) => {
|
12049 + | ::tracing::error!(error = %e, "failed to serialize response");
|
12050 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
12051 + | }
|
12052 + | }
|
12053 + | }
|
12054 + | }
|
12055 + |
|
12056 + | ::pin_project_lite::pin_project! {
|
12057 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
12058 + | /// [`PutWithContentEncodingInput`](crate::input::PutWithContentEncodingInput) using modelled bindings.
|
12059 + | pub struct PutWithContentEncodingInputFuture {
|
12060 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::PutWithContentEncodingInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
12061 + | }
|
12062 + | }
|
12063 + |
|
12064 + | impl std::future::Future for PutWithContentEncodingInputFuture {
|
12065 + | type Output = Result<
|
12066 + | crate::input::PutWithContentEncodingInput,
|
12067 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
12068 + | >;
|
12069 + |
|
12070 + | fn poll(
|
12071 + | self: std::pin::Pin<&mut Self>,
|
12072 + | cx: &mut std::task::Context<'_>,
|
12073 + | ) -> std::task::Poll<Self::Output> {
|
12074 + | let this = self.project();
|
12075 + | this.inner.as_mut().poll(cx)
|
12076 + | }
|
12077 + | }
|
12078 + |
|
12079 + | impl<B>
|
12080 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
12081 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12082 + | B,
|
12083 + | > for crate::input::PutWithContentEncodingInput
|
12084 + | where
|
12085 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
12086 + | B: 'static,
|
12087 + |
|
12088 + | B::Data: Send,
|
12089 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
12090 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
12091 + | {
|
12092 + | type Rejection =
|
12093 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
12094 + | type Future = PutWithContentEncodingInputFuture;
|
12095 + |
|
12096 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
12097 + | let fut = async move {
|
12098 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
12099 + | request.headers(),
|
12100 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
12101 + | ) {
|
12102 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
12103 + | }
|
12104 + | crate::protocol_serde::shape_put_with_content_encoding::de_put_with_content_encoding_http_request(request)
|
12105 + | .await
|
12106 + | };
|
12107 + | use ::futures_util::future::TryFutureExt;
|
12108 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
12109 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
12110 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
12111 + | });
|
12112 + | PutWithContentEncodingInputFuture {
|
12113 + | inner: Box::pin(fut),
|
12114 + | }
|
12115 + | }
|
12116 + | }
|
12117 + | impl
|
12118 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
12119 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12120 + | > for crate::output::PutWithContentEncodingOutput
|
12121 + | {
|
12122 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
12123 + | match crate::protocol_serde::shape_put_with_content_encoding::ser_put_with_content_encoding_http_response(self) {
|
12124 + | Ok(response) => response,
|
12125 + | Err(e) => {
|
12126 + | ::tracing::error!(error = %e, "failed to serialize response");
|
12127 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
12128 + | }
|
12129 + | }
|
11969 12130 | }
|
11970 12131 | }
|
11971 12132 |
|
11972 12133 | ::pin_project_lite::pin_project! {
|
11973 12134 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
11974 - | /// [`EmptyOperationInput`](crate::input::EmptyOperationInput) using modelled bindings.
|
11975 - | pub struct EmptyOperationInputFuture {
|
11976 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EmptyOperationInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
12135 + | /// [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput) using modelled bindings.
|
12136 + | pub struct ContentTypeParametersInputFuture {
|
12137 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::ContentTypeParametersInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
11977 12138 | }
|
11978 12139 | }
|
11979 12140 |
|
11980 - | impl std::future::Future for EmptyOperationInputFuture {
|
12141 + | impl std::future::Future for ContentTypeParametersInputFuture {
|
11981 12142 | type Output = Result<
|
11982 - | crate::input::EmptyOperationInput,
|
12143 + | crate::input::ContentTypeParametersInput,
|
11983 12144 | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
11984 12145 | >;
|
11985 12146 |
|
11986 12147 | fn poll(
|
11987 12148 | self: std::pin::Pin<&mut Self>,
|
11988 12149 | cx: &mut std::task::Context<'_>,
|
11989 12150 | ) -> std::task::Poll<Self::Output> {
|
11990 12151 | let this = self.project();
|
11991 12152 | this.inner.as_mut().poll(cx)
|
11992 12153 | }
|
11993 12154 | }
|
11994 12155 |
|
11995 12156 | impl<B>
|
11996 12157 | ::aws_smithy_legacy_http_server::request::FromRequest<
|
11997 12158 | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11998 12159 | B,
|
11999 - | > for crate::input::EmptyOperationInput
|
12160 + | > for crate::input::ContentTypeParametersInput
|
12000 12161 | where
|
12001 12162 | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
12002 12163 | B: 'static,
|
12003 12164 |
|
12004 12165 | B::Data: Send,
|
12005 12166 | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
12006 12167 | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
12007 12168 | {
|
12008 12169 | type Rejection =
|
12009 12170 | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
12010 - | type Future = EmptyOperationInputFuture;
|
12171 + | type Future = ContentTypeParametersInputFuture;
|
12011 12172 |
|
12012 12173 | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
12013 12174 | let fut = async move {
|
12014 12175 | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
12015 12176 | request.headers(),
|
12016 12177 | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
12017 12178 | ) {
|
12018 12179 | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
12019 12180 | }
|
12020 - | crate::protocol_serde::shape_empty_operation::de_empty_operation_http_request(request)
|
12021 - | .await
|
12181 + | crate::protocol_serde::shape_content_type_parameters::de_content_type_parameters_http_request(request)
|
12182 + | .await
|
12022 12183 | };
|
12023 12184 | use ::futures_util::future::TryFutureExt;
|
12024 12185 | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
12025 12186 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
12026 12187 | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
12027 12188 | });
|
12028 - | EmptyOperationInputFuture {
|
12189 + | ContentTypeParametersInputFuture {
|
12029 12190 | inner: Box::pin(fut),
|
12030 12191 | }
|
12031 12192 | }
|
12032 12193 | }
|
12033 12194 | impl
|
12034 12195 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
12035 12196 | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12036 - | > for crate::output::EmptyOperationOutput
|
12197 + | > for crate::output::ContentTypeParametersOutput
|
12037 12198 | {
|
12038 12199 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
12039 - | match crate::protocol_serde::shape_empty_operation::ser_empty_operation_http_response(self)
|
12040 - | {
|
12041 - | Ok(response) => response,
|
12042 - | Err(e) => {
|
12043 - | ::tracing::error!(error = %e, "failed to serialize response");
|
12044 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
12045 - | }
|
12046 - | }
|
12200 + | match crate::protocol_serde::shape_content_type_parameters::ser_content_type_parameters_http_response(self) {
|
12201 + | Ok(response) => response,
|
12202 + | Err(e) => {
|
12203 + | ::tracing::error!(error = %e, "failed to serialize response");
|
12204 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
12205 + | }
|
12206 + | }
|
12047 12207 | }
|
12048 12208 | }
|
12049 12209 |
|
12050 12210 | #[allow(unreachable_code, unused_variables)]
|
12051 12211 | #[cfg(test)]
|
12052 - | mod empty_operation_test {
|
12053 - |
|
12054 - | /// Sends requests to /
|
12055 - | /// Test ID: sends_requests_to_slash
|
12056 - | #[::tokio::test]
|
12057 - | #[::tracing_test::traced_test]
|
12058 - | async fn sends_requests_to_slash_request() {
|
12059 - | #[allow(unused_mut)]
|
12060 - | let mut http_request = ::http::Request::builder()
|
12061 - | .uri("/")
|
12062 - | .method("POST")
|
12063 - | .header("Content-Type", "application/x-amz-json-1.1")
|
12064 - | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
12065 - | .body(::aws_smithy_legacy_http_server::body::Body::empty())
|
12066 - | .unwrap();
|
12067 - | #[allow(unused_mut)]
|
12068 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12069 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
12070 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
12071 - | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
12072 - | let sender = sender.clone();
|
12073 - | async move {
|
12074 - | let result = {
|
12075 - | let expected = crate::input::EmptyOperationInput {};
|
12076 - | ::pretty_assertions::assert_eq!(input, expected);
|
12077 - | let output = crate::output::EmptyOperationOutput {};
|
12078 - | output
|
12079 - | };
|
12080 - | sender.send(()).await.expect("receiver dropped early");
|
12081 - | result
|
12082 - | }
|
12083 - | })
|
12084 - | .build_unchecked();
|
12085 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12086 - | .await
|
12087 - | .expect("unable to make an HTTP request");
|
12088 - | assert!(
|
12089 - | receiver.recv().await.is_some(),
|
12090 - | "we expected operation handler to be invoked but it was not entered"
|
12091 - | );
|
12092 - | }
|
12093 - |
|
12094 - | /// Includes X-Amz-Target header and Content-Type
|
12095 - | /// Test ID: includes_x_amz_target_and_content_type
|
12096 - | #[::tokio::test]
|
12097 - | #[::tracing_test::traced_test]
|
12098 - | async fn includes_x_amz_target_and_content_type_request() {
|
12099 - | #[allow(unused_mut)]
|
12100 - | let mut http_request = ::http::Request::builder()
|
12101 - | .uri("/")
|
12102 - | .method("POST")
|
12103 - | .header("Content-Type", "application/x-amz-json-1.1")
|
12104 - | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
12105 - | .body(::aws_smithy_legacy_http_server::body::Body::empty())
|
12106 - | .unwrap();
|
12107 - | #[allow(unused_mut)]
|
12108 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12109 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
12110 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
12111 - | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
12112 - | let sender = sender.clone();
|
12113 - | async move {
|
12114 - | let result = {
|
12115 - | let expected = crate::input::EmptyOperationInput {};
|
12116 - | ::pretty_assertions::assert_eq!(input, expected);
|
12117 - | let output = crate::output::EmptyOperationOutput {};
|
12118 - | output
|
12119 - | };
|
12120 - | sender.send(()).await.expect("receiver dropped early");
|
12121 - | result
|
12122 - | }
|
12123 - | })
|
12124 - | .build_unchecked();
|
12125 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12126 - | .await
|
12127 - | .expect("unable to make an HTTP request");
|
12128 - | assert!(
|
12129 - | receiver.recv().await.is_some(),
|
12130 - | "we expected operation handler to be invoked but it was not entered"
|
12131 - | );
|
12132 - | }
|
12212 + | mod content_type_parameters_test {
|
12133 12213 |
|
12134 - | /// Clients must always send an empty JSON object payload for
|
12135 - | /// operations with no input (that is, `{}`). While AWS service
|
12136 - | /// implementations support requests with no payload or requests
|
12137 - | /// that send `{}`, always sending `{}` from the client is
|
12138 - | /// preferred for forward compatibility in case input is ever
|
12139 - | /// added to an operation.
|
12140 - | /// Test ID: json_1_1_client_sends_empty_payload_for_no_input_shape
|
12214 + | /// A server should ignore parameters added to the content type
|
12215 + | /// Test ID: AwsJson11MustSupportParametersInContentType
|
12141 12216 | #[::tokio::test]
|
12142 12217 | #[::tracing_test::traced_test]
|
12143 - | async fn json_1_1_client_sends_empty_payload_for_no_input_shape_request() {
|
12218 + | async fn aws_json11_must_support_parameters_in_content_type_request() {
|
12144 12219 | #[allow(unused_mut)]
|
12145 12220 | let mut http_request = ::http::Request::builder()
|
12146 12221 | .uri("/")
|
12147 12222 | .method("POST")
|
12148 - | .header("Content-Type", "application/x-amz-json-1.1")
|
12149 - | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
12223 + | .header("Content-Type", "application/x-amz-json-1.1; charset=utf-8")
|
12224 + | .header("X-Amz-Target", "JsonProtocol.ContentTypeParameters")
|
12150 12225 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
12151 12226 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
12152 - | "{}".as_bytes(),
|
12227 + | "{\"value\":5}".as_bytes(),
|
12153 12228 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
12154 12229 | )),
|
12155 12230 | ))
|
12156 12231 | .unwrap();
|
12157 12232 | #[allow(unused_mut)]
|
12158 12233 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12159 12234 | let config = crate::service::JsonProtocolConfig::builder().build();
|
12160 12235 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
12161 - | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
12162 - | let sender = sender.clone();
|
12163 - | async move {
|
12164 - | let result = {
|
12165 - | let expected = crate::input::EmptyOperationInput {};
|
12166 - | ::pretty_assertions::assert_eq!(input, expected);
|
12167 - | let output = crate::output::EmptyOperationOutput {};
|
12168 - | output
|
12169 - | };
|
12170 - | sender.send(()).await.expect("receiver dropped early");
|
12171 - | result
|
12172 - | }
|
12173 - | })
|
12174 - | .build_unchecked();
|
12175 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12176 - | .await
|
12177 - | .expect("unable to make an HTTP request");
|
12178 - | assert!(
|
12179 - | receiver.recv().await.is_some(),
|
12180 - | "we expected operation handler to be invoked but it was not entered"
|
12181 - | );
|
12182 - | }
|
12183 - |
|
12184 - | /// Service implementations must support no payload or an empty
|
12185 - | /// object payload for operations that define no input. However,
|
12186 - | /// despite the lack of a payload, a Content-Type header is still
|
12187 - | /// required in order for the service to properly detect the
|
12188 - | /// protocol.
|
12189 - | /// Test ID: json_1_1_service_supports_empty_payload_for_no_input_shape
|
12190 - | #[::tokio::test]
|
12191 - | #[::tracing_test::traced_test]
|
12192 - | async fn json_1_1_service_supports_empty_payload_for_no_input_shape_request() {
|
12193 - | #[allow(unused_mut)]
|
12194 - | let mut http_request = ::http::Request::builder()
|
12195 - | .uri("/")
|
12196 - | .method("POST")
|
12197 - | .header("Content-Type", "application/x-amz-json-1.1")
|
12198 - | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
12199 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
12200 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
12201 - | "".as_bytes(),
|
12202 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
12203 - | )),
|
12204 - | ))
|
12205 - | .unwrap();
|
12206 - | #[allow(unused_mut)]
|
12207 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12208 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
12209 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
12210 - | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
12236 + | .content_type_parameters(move |input: crate::input::ContentTypeParametersInput| {
|
12211 12237 | let sender = sender.clone();
|
12212 12238 | async move {
|
12213 12239 | let result = {
|
12214 - | let expected = crate::input::EmptyOperationInput {};
|
12240 + | let expected = crate::input::ContentTypeParametersInput {
|
12241 + | value: ::std::option::Option::Some(5),
|
12242 + | };
|
12215 12243 | ::pretty_assertions::assert_eq!(input, expected);
|
12216 - | let output = crate::output::EmptyOperationOutput {};
|
12244 + | let output = crate::output::ContentTypeParametersOutput {};
|
12217 12245 | output
|
12218 12246 | };
|
12219 12247 | sender.send(()).await.expect("receiver dropped early");
|
12220 12248 | result
|
12221 12249 | }
|
12222 12250 | })
|
12223 12251 | .build_unchecked();
|
12224 12252 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12225 12253 | .await
|
12226 12254 | .expect("unable to make an HTTP request");
|
12227 12255 | assert!(
|
12228 12256 | receiver.recv().await.is_some(),
|
12229 12257 | "we expected operation handler to be invoked but it was not entered"
|
12230 12258 | );
|
12231 12259 | }
|
12232 - |
|
12233 - | /// When no output is defined, the service is expected to return
|
12234 - | /// an empty payload. Despite the lack of a payload, the service
|
12235 - | /// is expected to always send a Content-Type header. Clients must
|
12236 - | /// handle cases where a service returns a JSON object and where
|
12237 - | /// a service returns no JSON at all.
|
12238 - | /// Test ID: json_1_1_service_responds_with_no_payload
|
12239 - | #[::tokio::test]
|
12240 - | #[::tracing_test::traced_test]
|
12241 - | async fn json_1_1_service_responds_with_no_payload_response() {
|
12242 - | let output = crate::output::EmptyOperationOutput {};
|
12243 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
12244 - | let http_response = output.into_response();
|
12245 - | ::pretty_assertions::assert_eq!(
|
12246 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
12247 - | http_response.status()
|
12248 - | );
|
12249 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
12250 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12251 - | http_response.headers(),
|
12252 - | expected_headers,
|
12253 - | ));
|
12254 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
12255 - | .await
|
12256 - | .expect("unable to extract body to bytes");
|
12257 - | // No body.
|
12258 - | ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
|
12259 - | }
|
12260 12260 | }
|