1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[cfg(test)]
|
3 - | #[allow(unreachable_code, unused_variables)]
|
4 - | mod server_empty_operation_test {
|
5 - | /// Sends requests to /
|
6 - | /// Test ID: sends_requests_to_slash
|
7 - | #[::tokio::test]
|
8 - | async fn sends_requests_to_slash_request() {
|
9 - | #[allow(unused_mut)]
|
10 - | let mut http_request = http::Request::builder()
|
11 - | .uri("/")
|
12 - | .method("POST")
|
13 - | .header("Content-Type", "application/x-amz-json-1.1")
|
14 - | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
15 - | .body(::aws_smithy_http_server::body::Body::empty())
|
16 - | .unwrap();
|
17 - | #[allow(unused_mut)]
|
18 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
19 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
20 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
21 - | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
22 - | let sender = sender.clone();
|
23 - | async move {
|
24 - | let result = {
|
25 - | let expected = crate::input::EmptyOperationInput {};
|
26 - | ::pretty_assertions::assert_eq!(input, expected);
|
27 - | let response = crate::output::EmptyOperationOutput {};
|
28 - | response
|
29 - | };
|
30 - | sender.send(()).await.expect("receiver dropped early");
|
31 - | result
|
32 - | }
|
33 - | })
|
34 - | .build_unchecked();
|
35 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
36 - | .await
|
37 - | .expect("unable to make an HTTP request");
|
38 - | assert!(receiver.recv().await.is_some());
|
39 - | }
|
40 - | /// Includes X-Amz-Target header and Content-Type
|
41 - | /// Test ID: includes_x_amz_target_and_content_type
|
42 - | #[::tokio::test]
|
43 - | async fn includes_x_amz_target_and_content_type_request() {
|
44 - | #[allow(unused_mut)]
|
45 - | let mut http_request = http::Request::builder()
|
46 - | .uri("/")
|
47 - | .method("POST")
|
48 - | .header("Content-Type", "application/x-amz-json-1.1")
|
49 - | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
50 - | .body(::aws_smithy_http_server::body::Body::empty())
|
51 - | .unwrap();
|
52 - | #[allow(unused_mut)]
|
53 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
54 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
55 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
56 - | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
57 - | let sender = sender.clone();
|
58 - | async move {
|
59 - | let result = {
|
60 - | let expected = crate::input::EmptyOperationInput {};
|
61 - | ::pretty_assertions::assert_eq!(input, expected);
|
62 - | let response = crate::output::EmptyOperationOutput {};
|
63 - | response
|
64 - | };
|
65 - | sender.send(()).await.expect("receiver dropped early");
|
66 - | result
|
67 - | }
|
68 - | })
|
69 - | .build_unchecked();
|
70 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
71 - | .await
|
72 - | .expect("unable to make an HTTP request");
|
73 - | assert!(receiver.recv().await.is_some());
|
74 - | }
|
75 - | /// Clients must always send an empty JSON object payload for
|
76 - | /// operations with no input (that is, `{}`). While AWS service
|
77 - | /// implementations support requests with no payload or requests
|
78 - | /// that send `{}`, always sending `{}` from the client is
|
79 - | /// preferred for forward compatibility in case input is ever
|
80 - | /// added to an operation.
|
81 - | /// Test ID: json_1_1_client_sends_empty_payload_for_no_input_shape
|
82 - | #[::tokio::test]
|
83 - | async fn json_1_1_client_sends_empty_payload_for_no_input_shape_request() {
|
84 - | #[allow(unused_mut)]
|
85 - | let mut http_request = http::Request::builder()
|
86 - | .uri("/")
|
87 - | .method("POST")
|
88 - | .header("Content-Type", "application/x-amz-json-1.1")
|
89 - | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
90 - | .body(::aws_smithy_http_server::body::Body::from(
|
91 - | ::bytes::Bytes::from_static("{}".as_bytes()),
|
92 - | ))
|
93 - | .unwrap();
|
94 - | #[allow(unused_mut)]
|
95 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
96 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
97 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
98 - | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
99 - | let sender = sender.clone();
|
100 - | async move {
|
101 - | let result = {
|
102 - | let expected = crate::input::EmptyOperationInput {};
|
103 - | ::pretty_assertions::assert_eq!(input, expected);
|
104 - | let response = crate::output::EmptyOperationOutput {};
|
105 - | response
|
106 - | };
|
107 - | sender.send(()).await.expect("receiver dropped early");
|
108 - | result
|
109 - | }
|
110 - | })
|
111 - | .build_unchecked();
|
112 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
113 - | .await
|
114 - | .expect("unable to make an HTTP request");
|
115 - | assert!(receiver.recv().await.is_some());
|
2 + | static CONTENT_TYPE_PUTWITHCONTENTENCODING: ::once_cell::sync::Lazy<::mime::Mime> =
|
3 + | ::once_cell::sync::Lazy::new(|| {
|
4 + | "application/x-amz-json-1.1"
|
5 + | .parse::<::mime::Mime>()
|
6 + | .expect("BUG: MIME parsing failed, content_type is not valid")
|
7 + | });
|
8 + | ::pin_project_lite::pin_project! {
|
9 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
10 + | /// [`PutWithContentEncodingInput`](crate::input::PutWithContentEncodingInput) using modelled bindings.
|
11 + | pub struct PutWithContentEncodingInputFuture {
|
12 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::PutWithContentEncodingInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
116 13 | }
|
117 - | /// Service implementations must support no payload or an empty
|
118 - | /// object payload for operations that define no input. However,
|
119 - | /// despite the lack of a payload, a Content-Type header is still
|
120 - | /// required in order for the service to properly detect the
|
121 - | /// protocol.
|
122 - | /// Test ID: json_1_1_service_supports_empty_payload_for_no_input_shape
|
123 - | #[::tokio::test]
|
124 - | async fn json_1_1_service_supports_empty_payload_for_no_input_shape_request() {
|
125 - | #[allow(unused_mut)]
|
126 - | let mut http_request = http::Request::builder()
|
127 - | .uri("/")
|
128 - | .method("POST")
|
129 - | .header("Content-Type", "application/x-amz-json-1.1")
|
130 - | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
131 - | .body(::aws_smithy_http_server::body::Body::from(
|
132 - | ::bytes::Bytes::from_static("".as_bytes()),
|
133 - | ))
|
134 - | .unwrap();
|
135 - | #[allow(unused_mut)]
|
136 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
137 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
138 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
139 - | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
140 - | let sender = sender.clone();
|
141 - | async move {
|
142 - | let result = {
|
143 - | let expected = crate::input::EmptyOperationInput {};
|
144 - | ::pretty_assertions::assert_eq!(input, expected);
|
145 - | let response = crate::output::EmptyOperationOutput {};
|
146 - | response
|
147 - | };
|
148 - | sender.send(()).await.expect("receiver dropped early");
|
149 - | result
|
150 - | }
|
151 - | })
|
152 - | .build_unchecked();
|
153 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
154 - | .await
|
155 - | .expect("unable to make an HTTP request");
|
156 - | assert!(receiver.recv().await.is_some());
|
14 + | }
|
15 + |
|
16 + | impl std::future::Future for PutWithContentEncodingInputFuture {
|
17 + | type Output = Result<
|
18 + | crate::input::PutWithContentEncodingInput,
|
19 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
20 + | >;
|
21 + |
|
22 + | fn poll(
|
23 + | self: std::pin::Pin<&mut Self>,
|
24 + | cx: &mut std::task::Context<'_>,
|
25 + | ) -> std::task::Poll<Self::Output> {
|
26 + | let this = self.project();
|
27 + | this.inner.as_mut().poll(cx)
|
157 28 | }
|
158 - | /// When no output is defined, the service is expected to return
|
159 - | /// an empty payload. Despite the lack of a payload, the service
|
160 - | /// is expected to always send a Content-Type header. Clients must
|
161 - | /// handle cases where a service returns a JSON object and where
|
162 - | /// a service returns no JSON at all.
|
163 - | /// Test ID: json_1_1_service_responds_with_no_payload
|
164 - | #[::tokio::test]
|
165 - | async fn json_1_1_service_responds_with_no_payload_response() {
|
166 - | let output = crate::output::EmptyOperationOutput {};
|
167 - | use ::aws_smithy_http_server::response::IntoResponse;
|
168 - | let http_response = output.into_response();
|
169 - | ::pretty_assertions::assert_eq!(
|
170 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
171 - | http_response.status()
|
29 + | }
|
30 + |
|
31 + | impl<B>
|
32 + | ::aws_smithy_http_server::request::FromRequest<
|
33 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
34 + | B,
|
35 + | > for crate::input::PutWithContentEncodingInput
|
36 + | where
|
37 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
38 + | B: 'static,
|
39 + |
|
40 + | B::Data: Send,
|
41 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
42 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
43 + | {
|
44 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
45 + | type Future = PutWithContentEncodingInputFuture;
|
46 + |
|
47 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
48 + | let fut = async move {
|
49 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
50 + | request.headers(),
|
51 + | &CONTENT_TYPE_PUTWITHCONTENTENCODING,
|
52 + | ) {
|
53 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
54 + | }
|
55 + | crate::protocol_serde::shape_put_with_content_encoding::de_put_with_content_encoding_http_request(request)
|
56 + | .await
|
57 + | .map_err(Into::into)
|
58 + | };
|
59 + | use ::futures_util::future::TryFutureExt;
|
60 + | let fut = fut.map_err(
|
61 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
62 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
63 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
64 + | },
|
172 65 | );
|
173 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
174 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
175 - | http_response.headers(),
|
176 - | expected_headers,
|
177 - | ));
|
178 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
179 - | .await
|
180 - | .expect("unable to extract body to bytes");
|
181 - | // No body.
|
182 - | ::pretty_assertions::assert_eq!(std::str::from_utf8(&body).unwrap(), "");
|
66 + | PutWithContentEncodingInputFuture {
|
67 + | inner: Box::pin(fut),
|
68 + | }
|
183 69 | }
|
184 70 | }
|
185 - | #[cfg(test)]
|
186 - | #[allow(unreachable_code, unused_variables)]
|
187 - | mod server_endpoint_operation_test {
|
188 - | /// Operations can prepend to the given host if they define the
|
189 - | /// endpoint trait.
|
190 - | /// Test ID: AwsJson11EndpointTrait
|
191 - | #[::tokio::test]
|
192 - | #[should_panic]
|
193 - | async fn aws_json11_endpoint_trait_request() {
|
194 - | #[allow(unused_mut)]
|
195 - | let mut http_request = http::Request::builder()
|
196 - | .uri("/")
|
197 - | .method("POST")
|
198 - | .header("Content-Type", "application/x-amz-json-1.1")
|
199 - | .header("X-Amz-Target", "JsonProtocol.EndpointOperation")
|
200 - | .body(::aws_smithy_http_server::body::Body::from(
|
201 - | ::bytes::Bytes::from_static("{}".as_bytes()),
|
202 - | ))
|
203 - | .unwrap();
|
204 - | todo!("endpoint trait not supported yet");
|
205 - | #[allow(unused_mut)]
|
206 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
207 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
208 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
209 - | .endpoint_operation(move |input: crate::input::EndpointOperationInput| {
|
210 - | let sender = sender.clone();
|
211 - | async move {
|
212 - | let result = {
|
213 - | let expected = crate::input::EndpointOperationInput {};
|
214 - | ::pretty_assertions::assert_eq!(input, expected);
|
215 - | let response = crate::output::EndpointOperationOutput {};
|
216 - | response
|
217 - | };
|
218 - | sender.send(()).await.expect("receiver dropped early");
|
219 - | result
|
220 - | }
|
221 - | })
|
222 - | .build_unchecked();
|
223 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
224 - | .await
|
225 - | .expect("unable to make an HTTP request");
|
226 - | assert!(receiver.recv().await.is_some());
|
71 + | impl
|
72 + | ::aws_smithy_http_server::response::IntoResponse<
|
73 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
74 + | > for crate::output::PutWithContentEncodingOutput
|
75 + | {
|
76 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
77 + | match crate::protocol_serde::shape_put_with_content_encoding::ser_put_with_content_encoding_http_response(self) {
|
78 + | Ok(response) => response,
|
79 + | Err(e) => {
|
80 + | ::tracing::error!(error = %e, "failed to serialize response");
|
81 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
82 + | }
|
83 + | }
|
227 84 | }
|
228 85 | }
|
229 - | #[cfg(test)]
|
230 - | #[allow(unreachable_code, unused_variables)]
|
231 - | mod server_endpoint_with_host_label_operation_test {
|
232 - | /// Operations can prepend to the given host if they define the
|
233 - | /// endpoint trait, and can use the host label trait to define
|
234 - | /// further customization based on user input.
|
235 - | /// Test ID: AwsJson11EndpointTraitWithHostLabel
|
236 - | #[::tokio::test]
|
237 - | #[should_panic]
|
238 - | async fn aws_json11_endpoint_trait_with_host_label_request() {
|
239 - | #[allow(unused_mut)]
|
240 - | let mut http_request = http::Request::builder()
|
241 - | .uri("/")
|
242 - | .method("POST")
|
243 - | .header("Content-Type", "application/x-amz-json-1.1")
|
244 - | .header(
|
245 - | "X-Amz-Target",
|
246 - | "JsonProtocol.EndpointWithHostLabelOperation",
|
247 - | )
|
248 - | .body(::aws_smithy_http_server::body::Body::from(
|
249 - | ::bytes::Bytes::from_static("{\"label\": \"bar\"}".as_bytes()),
|
250 - | ))
|
251 - | .unwrap();
|
252 - | todo!("endpoint trait not supported yet");
|
253 - | #[allow(unused_mut)]
|
254 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
255 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
256 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
257 - | .endpoint_with_host_label_operation(
|
258 - | move |input: crate::input::EndpointWithHostLabelOperationInput| {
|
259 - | let sender = sender.clone();
|
260 - | async move {
|
261 - | let result = {
|
262 - | let expected = crate::input::EndpointWithHostLabelOperationInput {
|
263 - | label: "bar".to_owned(),
|
264 - | };
|
265 - | ::pretty_assertions::assert_eq!(input, expected);
|
266 - | let response = crate::output::EndpointWithHostLabelOperationOutput {};
|
267 - | Ok(response)
|
268 - | };
|
269 - | sender.send(()).await.expect("receiver dropped early");
|
270 - | result
|
271 - | }
|
272 - | },
|
273 - | )
|
274 - | .build_unchecked();
|
275 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
276 - | .await
|
277 - | .expect("unable to make an HTTP request");
|
278 - | assert!(receiver.recv().await.is_some());
|
86 + |
|
87 + | static CONTENT_TYPE_FRACTIONALSECONDS: ::once_cell::sync::Lazy<::mime::Mime> =
|
88 + | ::once_cell::sync::Lazy::new(|| {
|
89 + | "application/x-amz-json-1.1"
|
90 + | .parse::<::mime::Mime>()
|
91 + | .expect("BUG: MIME parsing failed, content_type is not valid")
|
92 + | });
|
93 + | ::pin_project_lite::pin_project! {
|
94 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
95 + | /// [`FractionalSecondsInput`](crate::input::FractionalSecondsInput) using modelled bindings.
|
96 + | pub struct FractionalSecondsInputFuture {
|
97 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::FractionalSecondsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
279 98 | }
|
280 99 | }
|
281 - | #[cfg(test)]
|
282 - | #[allow(unreachable_code, unused_variables)]
|
283 - | mod server_greeting_with_errors_test {
|
284 - | /// Parses simple JSON errors
|
285 - | /// Test ID: AwsJson11InvalidGreetingError
|
286 - | #[::tokio::test]
|
287 - | async fn aws_json11_invalid_greeting_error_response() {
|
288 - | let output = crate::error::InvalidGreeting {
|
289 - | message: ::std::option::Option::Some("Hi".to_owned()),
|
290 - | };
|
291 - | let output = crate::error::GreetingWithErrorsError::InvalidGreeting(output);
|
292 - | use ::aws_smithy_http_server::response::IntoResponse;
|
293 - | let http_response = output.into_response();
|
294 - | ::pretty_assertions::assert_eq!(
|
295 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
296 - | http_response.status()
|
297 - | );
|
298 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
299 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
300 - | http_response.headers(),
|
301 - | expected_headers,
|
302 - | ));
|
303 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
304 - | .await
|
305 - | .expect("unable to extract body to bytes");
|
306 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
307 - | &body,
|
308 - | "{\n \"__type\": \"InvalidGreeting\",\n \"Message\": \"Hi\"\n}",
|
309 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
310 - | ));
|
100 + |
|
101 + | impl std::future::Future for FractionalSecondsInputFuture {
|
102 + | type Output = Result<
|
103 + | crate::input::FractionalSecondsInput,
|
104 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
105 + | >;
|
106 + |
|
107 + | fn poll(
|
108 + | self: std::pin::Pin<&mut Self>,
|
109 + | cx: &mut std::task::Context<'_>,
|
110 + | ) -> std::task::Poll<Self::Output> {
|
111 + | let this = self.project();
|
112 + | this.inner.as_mut().poll(cx)
|
311 113 | }
|
312 - | /// Parses a complex error with no message member
|
313 - | /// Test ID: AwsJson11ComplexError
|
314 - | #[::tokio::test]
|
315 - | async fn aws_json11_complex_error_response() {
|
316 - | let output = crate::error::ComplexError {
|
317 - | top_level: ::std::option::Option::Some("Top level".to_owned()),
|
318 - | nested: ::std::option::Option::Some(crate::model::ComplexNestedErrorData {
|
319 - | foo: ::std::option::Option::Some("bar".to_owned()),
|
320 - | }),
|
321 - | };
|
322 - | let output = crate::error::GreetingWithErrorsError::ComplexError(output);
|
323 - | use ::aws_smithy_http_server::response::IntoResponse;
|
324 - | let http_response = output.into_response();
|
325 - | ::pretty_assertions::assert_eq!(
|
326 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
327 - | http_response.status()
|
328 - | );
|
329 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
330 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
331 - | http_response.headers(),
|
332 - | expected_headers,
|
333 - | ));
|
334 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
114 + | }
|
115 + |
|
116 + | impl<B>
|
117 + | ::aws_smithy_http_server::request::FromRequest<
|
118 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
119 + | B,
|
120 + | > for crate::input::FractionalSecondsInput
|
121 + | where
|
122 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
123 + | B: 'static,
|
124 + |
|
125 + | B::Data: Send,
|
126 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
127 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
128 + | {
|
129 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
130 + | type Future = FractionalSecondsInputFuture;
|
131 + |
|
132 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
133 + | let fut = async move {
|
134 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
135 + | request.headers(),
|
136 + | &CONTENT_TYPE_FRACTIONALSECONDS,
|
137 + | ) {
|
138 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
139 + | }
|
140 + | crate::protocol_serde::shape_fractional_seconds::de_fractional_seconds_http_request(
|
141 + | request,
|
142 + | )
|
335 143 | .await
|
336 - | .expect("unable to extract body to bytes");
|
337 - | ::aws_smithy_protocol_test::assert_ok(
|
338 - | ::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"))
|
339 - | );
|
340 - | }
|
341 - | /// Test ID: AwsJson11EmptyComplexError
|
342 - | #[::tokio::test]
|
343 - | async fn aws_json11_empty_complex_error_response() {
|
344 - | let output = crate::error::ComplexError {
|
345 - | top_level: ::std::option::Option::None,
|
346 - | nested: ::std::option::Option::None,
|
144 + | .map_err(Into::into)
|
347 145 | };
|
348 - | let output = crate::error::GreetingWithErrorsError::ComplexError(output);
|
349 - | use ::aws_smithy_http_server::response::IntoResponse;
|
350 - | let http_response = output.into_response();
|
351 - | ::pretty_assertions::assert_eq!(
|
352 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
353 - | http_response.status()
|
146 + | use ::futures_util::future::TryFutureExt;
|
147 + | let fut = fut.map_err(
|
148 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
149 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
150 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
151 + | },
|
354 152 | );
|
355 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
356 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
357 - | http_response.headers(),
|
358 - | expected_headers,
|
359 - | ));
|
360 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
361 - | .await
|
362 - | .expect("unable to extract body to bytes");
|
363 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
364 - | &body,
|
365 - | "{\n \"__type\": \"ComplexError\"\n}",
|
366 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
367 - | ));
|
153 + | FractionalSecondsInputFuture {
|
154 + | inner: Box::pin(fut),
|
155 + | }
|
368 156 | }
|
369 157 | }
|
370 - | #[cfg(test)]
|
371 - | #[allow(unreachable_code, unused_variables)]
|
372 - | mod server_json_enums_test {
|
373 - | /// Serializes simple scalar properties
|
374 - | /// Test ID: AwsJson11Enums
|
375 - | #[::tokio::test]
|
376 - | async fn aws_json11_enums_request() {
|
377 - | #[allow(unused_mut)]
|
378 - | let mut http_request = http::Request::builder()
|
379 - | .uri("/")
|
380 - | .method("POST")
|
381 - | .header("Content-Type", "application/x-amz-json-1.1")
|
382 - | .header("X-Amz-Target", "JsonProtocol.JsonEnums")
|
383 - | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{\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()))).unwrap();
|
384 - | #[allow(unused_mut)]
|
385 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
386 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
387 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
388 - | .json_enums(move |input: crate::input::JsonEnumsInput| {
|
389 - | let sender = sender.clone();
|
390 - | async move {
|
391 - | let result = {
|
392 - | let expected = crate::input::JsonEnumsInput {
|
393 - | foo_enum1: ::std::option::Option::Some(
|
394 - | "Foo"
|
395 - | .parse::<crate::model::FooEnum>()
|
396 - | .expect("static value validated to member"),
|
397 - | ),
|
398 - | foo_enum2: ::std::option::Option::Some(
|
399 - | "0".parse::<crate::model::FooEnum>()
|
400 - | .expect("static value validated to member"),
|
401 - | ),
|
402 - | foo_enum3: ::std::option::Option::Some(
|
403 - | "1".parse::<crate::model::FooEnum>()
|
404 - | .expect("static value validated to member"),
|
405 - | ),
|
406 - | foo_enum_list: ::std::option::Option::Some(vec![
|
407 - | "Foo"
|
408 - | .parse::<crate::model::FooEnum>()
|
409 - | .expect("static value validated to member"),
|
410 - | "0".parse::<crate::model::FooEnum>()
|
411 - | .expect("static value validated to member"),
|
412 - | ]),
|
413 - | foo_enum_set: ::std::option::Option::Some(
|
414 - | vec![
|
415 - | "Foo"
|
416 - | .parse::<crate::model::FooEnum>()
|
417 - | .expect("static value validated to member"),
|
418 - | "0".parse::<crate::model::FooEnum>()
|
419 - | .expect("static value validated to member"),
|
420 - | ]
|
421 - | .try_into()
|
422 - | .expect("this is only used in tests"),
|
423 - | ),
|
424 - | foo_enum_map: ::std::option::Option::Some({
|
425 - | let mut ret = ::std::collections::HashMap::new();
|
426 - | ret.insert(
|
427 - | "hi".to_owned(),
|
428 - | "Foo"
|
429 - | .parse::<crate::model::FooEnum>()
|
430 - | .expect("static value validated to member"),
|
431 - | );
|
432 - | ret.insert(
|
433 - | "zero".to_owned(),
|
434 - | "0".parse::<crate::model::FooEnum>()
|
435 - | .expect("static value validated to member"),
|
436 - | );
|
437 - | ret
|
438 - | }),
|
439 - | };
|
440 - | ::pretty_assertions::assert_eq!(input, expected);
|
441 - | let response = crate::output::JsonEnumsOutput {
|
442 - | foo_enum1: ::std::option::Option::None,
|
443 - | foo_enum2: ::std::option::Option::None,
|
444 - | foo_enum3: ::std::option::Option::None,
|
445 - | foo_enum_list: ::std::option::Option::None,
|
446 - | foo_enum_set: ::std::option::Option::None,
|
447 - | foo_enum_map: ::std::option::Option::None,
|
448 - | };
|
449 - | Ok(response)
|
450 - | };
|
451 - | sender.send(()).await.expect("receiver dropped early");
|
452 - | result
|
453 - | }
|
454 - | })
|
455 - | .build_unchecked();
|
456 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
457 - | .await
|
458 - | .expect("unable to make an HTTP request");
|
459 - | assert!(receiver.recv().await.is_some());
|
158 + | impl
|
159 + | ::aws_smithy_http_server::response::IntoResponse<
|
160 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
161 + | > for crate::output::FractionalSecondsOutput
|
162 + | {
|
163 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
164 + | match crate::protocol_serde::shape_fractional_seconds::ser_fractional_seconds_http_response(
|
165 + | self,
|
166 + | ) {
|
167 + | Ok(response) => response,
|
168 + | Err(e) => {
|
169 + | ::tracing::error!(error = %e, "failed to serialize response");
|
170 + | ::aws_smithy_http_server::response::IntoResponse::<
|
171 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
172 + | >::into_response(
|
173 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
174 + | e,
|
175 + | ),
|
176 + | )
|
177 + | }
|
178 + | }
|
460 179 | }
|
461 - | /// Serializes simple scalar properties
|
462 - | /// Test ID: AwsJson11Enums
|
463 - | #[::tokio::test]
|
464 - | async fn aws_json11_enums_response() {
|
465 - | let output = crate::output::JsonEnumsOutput {
|
466 - | foo_enum1: ::std::option::Option::Some(
|
467 - | "Foo"
|
468 - | .parse::<crate::model::FooEnum>()
|
469 - | .expect("static value validated to member"),
|
470 - | ),
|
471 - | foo_enum2: ::std::option::Option::Some(
|
472 - | "0".parse::<crate::model::FooEnum>()
|
473 - | .expect("static value validated to member"),
|
474 - | ),
|
475 - | foo_enum3: ::std::option::Option::Some(
|
476 - | "1".parse::<crate::model::FooEnum>()
|
477 - | .expect("static value validated to member"),
|
478 - | ),
|
479 - | foo_enum_list: ::std::option::Option::Some(vec![
|
480 - | "Foo"
|
481 - | .parse::<crate::model::FooEnum>()
|
482 - | .expect("static value validated to member"),
|
483 - | "0".parse::<crate::model::FooEnum>()
|
484 - | .expect("static value validated to member"),
|
485 - | ]),
|
486 - | foo_enum_set: ::std::option::Option::Some(
|
487 - | vec![
|
488 - | "Foo"
|
489 - | .parse::<crate::model::FooEnum>()
|
490 - | .expect("static value validated to member"),
|
491 - | "0".parse::<crate::model::FooEnum>()
|
492 - | .expect("static value validated to member"),
|
493 - | ]
|
494 - | .try_into()
|
495 - | .expect("this is only used in tests"),
|
496 - | ),
|
497 - | foo_enum_map: ::std::option::Option::Some({
|
498 - | let mut ret = ::std::collections::HashMap::new();
|
499 - | ret.insert(
|
500 - | "hi".to_owned(),
|
501 - | "Foo"
|
502 - | .parse::<crate::model::FooEnum>()
|
503 - | .expect("static value validated to member"),
|
504 - | );
|
505 - | ret.insert(
|
506 - | "zero".to_owned(),
|
507 - | "0".parse::<crate::model::FooEnum>()
|
508 - | .expect("static value validated to member"),
|
509 - | );
|
510 - | ret
|
511 - | }),
|
180 + | }
|
181 + |
|
182 + | static CONTENT_TYPE_DATETIMEOFFSETS: ::once_cell::sync::Lazy<::mime::Mime> =
|
183 + | ::once_cell::sync::Lazy::new(|| {
|
184 + | "application/x-amz-json-1.1"
|
185 + | .parse::<::mime::Mime>()
|
186 + | .expect("BUG: MIME parsing failed, content_type is not valid")
|
187 + | });
|
188 + | ::pin_project_lite::pin_project! {
|
189 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
190 + | /// [`DatetimeOffsetsInput`](crate::input::DatetimeOffsetsInput) using modelled bindings.
|
191 + | pub struct DatetimeOffsetsInputFuture {
|
192 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::DatetimeOffsetsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
193 + | }
|
194 + | }
|
195 + |
|
196 + | impl std::future::Future for DatetimeOffsetsInputFuture {
|
197 + | type Output = Result<
|
198 + | crate::input::DatetimeOffsetsInput,
|
199 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
200 + | >;
|
201 + |
|
202 + | fn poll(
|
203 + | self: std::pin::Pin<&mut Self>,
|
204 + | cx: &mut std::task::Context<'_>,
|
205 + | ) -> std::task::Poll<Self::Output> {
|
206 + | let this = self.project();
|
207 + | this.inner.as_mut().poll(cx)
|
208 + | }
|
209 + | }
|
210 + |
|
211 + | impl<B>
|
212 + | ::aws_smithy_http_server::request::FromRequest<
|
213 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
214 + | B,
|
215 + | > for crate::input::DatetimeOffsetsInput
|
216 + | where
|
217 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
218 + | B: 'static,
|
219 + |
|
220 + | B::Data: Send,
|
221 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
222 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
223 + | {
|
224 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
225 + | type Future = DatetimeOffsetsInputFuture;
|
226 + |
|
227 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
228 + | let fut = async move {
|
229 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
230 + | request.headers(),
|
231 + | &CONTENT_TYPE_DATETIMEOFFSETS,
|
232 + | ) {
|
233 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
234 + | }
|
235 + | crate::protocol_serde::shape_datetime_offsets::de_datetime_offsets_http_request(request)
|
236 + | .await
|
237 + | .map_err(Into::into)
|
512 238 | };
|
513 - | use ::aws_smithy_http_server::response::IntoResponse;
|
514 - | let http_response = output.into_response();
|
515 - | ::pretty_assertions::assert_eq!(
|
516 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
517 - | http_response.status()
|
518 - | );
|
519 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
520 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
521 - | http_response.headers(),
|
522 - | expected_headers,
|
523 - | ));
|
524 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
525 - | .await
|
526 - | .expect("unable to extract body to bytes");
|
527 - | ::aws_smithy_protocol_test::assert_ok(
|
528 - | ::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"))
|
239 + | use ::futures_util::future::TryFutureExt;
|
240 + | let fut = fut.map_err(
|
241 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
242 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
243 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
244 + | },
|
529 245 | );
|
246 + | DatetimeOffsetsInputFuture {
|
247 + | inner: Box::pin(fut),
|
248 + | }
|
530 249 | }
|
531 250 | }
|
532 - | #[cfg(test)]
|
533 - | #[allow(unreachable_code, unused_variables)]
|
534 - | mod server_json_unions_test {
|
535 - | /// Serializes a string union value
|
536 - | /// Test ID: AwsJson11SerializeStringUnionValue
|
537 - | #[::tokio::test]
|
538 - | async fn aws_json11_serialize_string_union_value_request() {
|
539 - | #[allow(unused_mut)]
|
540 - | let mut http_request = http::Request::builder()
|
541 - | .uri("/")
|
542 - | .method("POST")
|
543 - | .header("Content-Type", "application/x-amz-json-1.1")
|
544 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
545 - | .body(::aws_smithy_http_server::body::Body::from(
|
546 - | ::bytes::Bytes::from_static(
|
547 - | "{\n \"contents\": {\n \"stringValue\": \"foo\"\n }\n}".as_bytes(),
|
548 - | ),
|
549 - | ))
|
550 - | .unwrap();
|
551 - | #[allow(unused_mut)]
|
552 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
553 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
554 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
555 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
556 - | let sender = sender.clone();
|
557 - | async move {
|
558 - | let result = {
|
559 - | let expected = crate::input::JsonUnionsInput {
|
560 - | contents: ::std::option::Option::Some(
|
561 - | crate::model::MyUnion::StringValue("foo".to_owned()),
|
562 - | ),
|
563 - | };
|
564 - | ::pretty_assertions::assert_eq!(input, expected);
|
565 - | let response = crate::output::JsonUnionsOutput {
|
566 - | contents: ::std::option::Option::None,
|
567 - | };
|
568 - | Ok(response)
|
569 - | };
|
570 - | sender.send(()).await.expect("receiver dropped early");
|
571 - | result
|
572 - | }
|
573 - | })
|
574 - | .build_unchecked();
|
575 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
576 - | .await
|
577 - | .expect("unable to make an HTTP request");
|
578 - | assert!(receiver.recv().await.is_some());
|
251 + | impl
|
252 + | ::aws_smithy_http_server::response::IntoResponse<
|
253 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
254 + | > for crate::output::DatetimeOffsetsOutput
|
255 + | {
|
256 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
257 + | match crate::protocol_serde::shape_datetime_offsets::ser_datetime_offsets_http_response(
|
258 + | self,
|
259 + | ) {
|
260 + | Ok(response) => response,
|
261 + | Err(e) => {
|
262 + | ::tracing::error!(error = %e, "failed to serialize response");
|
263 + | ::aws_smithy_http_server::response::IntoResponse::<
|
264 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
265 + | >::into_response(
|
266 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
267 + | e,
|
268 + | ),
|
269 + | )
|
270 + | }
|
271 + | }
|
579 272 | }
|
580 - | /// Serializes a boolean union value
|
581 - | /// Test ID: AwsJson11SerializeBooleanUnionValue
|
273 + | }
|
274 + |
|
275 + | static CONTENT_TYPE_HOSTWITHPATHOPERATION: ::once_cell::sync::Lazy<::mime::Mime> =
|
276 + | ::once_cell::sync::Lazy::new(|| {
|
277 + | "application/x-amz-json-1.1"
|
278 + | .parse::<::mime::Mime>()
|
279 + | .expect("BUG: MIME parsing failed, content_type is not valid")
|
280 + | });
|
281 + | ::pin_project_lite::pin_project! {
|
282 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
283 + | /// [`HostWithPathOperationInput`](crate::input::HostWithPathOperationInput) using modelled bindings.
|
284 + | pub struct HostWithPathOperationInputFuture {
|
285 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::HostWithPathOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
286 + | }
|
287 + | }
|
288 + |
|
289 + | impl std::future::Future for HostWithPathOperationInputFuture {
|
290 + | type Output = Result<
|
291 + | crate::input::HostWithPathOperationInput,
|
292 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
293 + | >;
|
294 + |
|
295 + | fn poll(
|
296 + | self: std::pin::Pin<&mut Self>,
|
297 + | cx: &mut std::task::Context<'_>,
|
298 + | ) -> std::task::Poll<Self::Output> {
|
299 + | let this = self.project();
|
300 + | this.inner.as_mut().poll(cx)
|
301 + | }
|
302 + | }
|
303 + |
|
304 + | impl<B>
|
305 + | ::aws_smithy_http_server::request::FromRequest<
|
306 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
307 + | B,
|
308 + | > for crate::input::HostWithPathOperationInput
|
309 + | where
|
310 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
311 + | B: 'static,
|
312 + |
|
313 + | B::Data: Send,
|
314 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
315 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
316 + | {
|
317 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
318 + | type Future = HostWithPathOperationInputFuture;
|
319 + |
|
320 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
321 + | let fut = async move {
|
322 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
323 + | request.headers(),
|
324 + | &CONTENT_TYPE_HOSTWITHPATHOPERATION,
|
325 + | ) {
|
326 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
327 + | }
|
328 + | crate::protocol_serde::shape_host_with_path_operation::de_host_with_path_operation_http_request(request)
|
329 + | .await
|
330 + | .map_err(Into::into)
|
331 + | };
|
332 + | use ::futures_util::future::TryFutureExt;
|
333 + | let fut = fut.map_err(
|
334 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
335 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
336 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
337 + | },
|
338 + | );
|
339 + | HostWithPathOperationInputFuture {
|
340 + | inner: Box::pin(fut),
|
341 + | }
|
342 + | }
|
343 + | }
|
344 + | impl
|
345 + | ::aws_smithy_http_server::response::IntoResponse<
|
346 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
347 + | > for crate::output::HostWithPathOperationOutput
|
348 + | {
|
349 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
350 + | match crate::protocol_serde::shape_host_with_path_operation::ser_host_with_path_operation_http_response(self) {
|
351 + | Ok(response) => response,
|
352 + | Err(e) => {
|
353 + | ::tracing::error!(error = %e, "failed to serialize response");
|
354 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
355 + | }
|
356 + | }
|
357 + | }
|
358 + | }
|
359 + |
|
360 + | static CONTENT_TYPE_ENDPOINTWITHHOSTLABELOPERATION: ::once_cell::sync::Lazy<::mime::Mime> =
|
361 + | ::once_cell::sync::Lazy::new(|| {
|
362 + | "application/x-amz-json-1.1"
|
363 + | .parse::<::mime::Mime>()
|
364 + | .expect("BUG: MIME parsing failed, content_type is not valid")
|
365 + | });
|
366 + | ::pin_project_lite::pin_project! {
|
367 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
368 + | /// [`EndpointWithHostLabelOperationInput`](crate::input::EndpointWithHostLabelOperationInput) using modelled bindings.
|
369 + | pub struct EndpointWithHostLabelOperationInputFuture {
|
370 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EndpointWithHostLabelOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
371 + | }
|
372 + | }
|
373 + |
|
374 + | impl std::future::Future for EndpointWithHostLabelOperationInputFuture {
|
375 + | type Output = Result<
|
376 + | crate::input::EndpointWithHostLabelOperationInput,
|
377 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
378 + | >;
|
379 + |
|
380 + | fn poll(
|
381 + | self: std::pin::Pin<&mut Self>,
|
382 + | cx: &mut std::task::Context<'_>,
|
383 + | ) -> std::task::Poll<Self::Output> {
|
384 + | let this = self.project();
|
385 + | this.inner.as_mut().poll(cx)
|
386 + | }
|
387 + | }
|
388 + |
|
389 + | impl<B>
|
390 + | ::aws_smithy_http_server::request::FromRequest<
|
391 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
392 + | B,
|
393 + | > for crate::input::EndpointWithHostLabelOperationInput
|
394 + | where
|
395 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
396 + | B: 'static,
|
397 + |
|
398 + | B::Data: Send,
|
399 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
400 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
401 + | {
|
402 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
403 + | type Future = EndpointWithHostLabelOperationInputFuture;
|
404 + |
|
405 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
406 + | let fut = async move {
|
407 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
408 + | request.headers(),
|
409 + | &CONTENT_TYPE_ENDPOINTWITHHOSTLABELOPERATION,
|
410 + | ) {
|
411 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
412 + | }
|
413 + | crate::protocol_serde::shape_endpoint_with_host_label_operation::de_endpoint_with_host_label_operation_http_request(request)
|
414 + | .await
|
415 + | .map_err(Into::into)
|
416 + | };
|
417 + | use ::futures_util::future::TryFutureExt;
|
418 + | let fut = fut.map_err(
|
419 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
420 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
421 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
422 + | },
|
423 + | );
|
424 + | EndpointWithHostLabelOperationInputFuture {
|
425 + | inner: Box::pin(fut),
|
426 + | }
|
427 + | }
|
428 + | }
|
429 + | impl
|
430 + | ::aws_smithy_http_server::response::IntoResponse<
|
431 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
432 + | > for crate::output::EndpointWithHostLabelOperationOutput
|
433 + | {
|
434 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
435 + | match crate::protocol_serde::shape_endpoint_with_host_label_operation::ser_endpoint_with_host_label_operation_http_response(self) {
|
436 + | Ok(response) => response,
|
437 + | Err(e) => {
|
438 + | ::tracing::error!(error = %e, "failed to serialize response");
|
439 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
440 + | }
|
441 + | }
|
442 + | }
|
443 + | }
|
444 + | impl
|
445 + | ::aws_smithy_http_server::response::IntoResponse<
|
446 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
447 + | > for crate::error::EndpointWithHostLabelOperationError
|
448 + | {
|
449 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
450 + | match crate::protocol_serde::shape_endpoint_with_host_label_operation::ser_endpoint_with_host_label_operation_http_error(&self) {
|
451 + | Ok(mut response) => {
|
452 + | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
453 + | response
|
454 + | },
|
455 + | Err(e) => {
|
456 + | ::tracing::error!(error = %e, "failed to serialize response");
|
457 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
458 + | }
|
459 + | }
|
460 + | }
|
461 + | }
|
462 + |
|
463 + | #[allow(unreachable_code, unused_variables)]
|
464 + | #[cfg(test)]
|
465 + | mod endpoint_with_host_label_operation_test {
|
466 + |
|
467 + | /// Operations can prepend to the given host if they define the
|
468 + | /// endpoint trait, and can use the host label trait to define
|
469 + | /// further customization based on user input.
|
470 + | /// Test ID: AwsJson11EndpointTraitWithHostLabel
|
582 471 | #[::tokio::test]
|
583 - | async fn aws_json11_serialize_boolean_union_value_request() {
|
472 + | #[::tracing_test::traced_test]
|
473 + | #[should_panic]
|
474 + | async fn aws_json11_endpoint_trait_with_host_label_request() {
|
584 475 | #[allow(unused_mut)]
|
585 476 | let mut http_request = http::Request::builder()
|
586 477 | .uri("/")
|
587 478 | .method("POST")
|
588 479 | .header("Content-Type", "application/x-amz-json-1.1")
|
589 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
480 + | .header(
|
481 + | "X-Amz-Target",
|
482 + | "JsonProtocol.EndpointWithHostLabelOperation",
|
483 + | )
|
590 484 | .body(::aws_smithy_http_server::body::Body::from(
|
591 - | ::bytes::Bytes::from_static(
|
592 - | "{\n \"contents\": {\n \"booleanValue\": true\n }\n}".as_bytes(),
|
593 - | ),
|
485 + | ::bytes::Bytes::from_static("{\"label\": \"bar\"}".as_bytes()),
|
594 486 | ))
|
595 487 | .unwrap();
|
488 + | todo!("endpoint trait not supported yet");
|
596 489 | #[allow(unused_mut)]
|
597 490 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
598 491 | let config = crate::service::JsonProtocolConfig::builder().build();
|
599 492 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
600 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
601 - | let sender = sender.clone();
|
602 - | async move {
|
603 - | let result = {
|
604 - | let expected = crate::input::JsonUnionsInput {
|
605 - | contents: ::std::option::Option::Some(
|
606 - | crate::model::MyUnion::BooleanValue(true),
|
607 - | ),
|
493 + | .endpoint_with_host_label_operation(
|
494 + | move |input: crate::input::EndpointWithHostLabelOperationInput| {
|
495 + | let sender = sender.clone();
|
496 + | async move {
|
497 + | let result = {
|
498 + | let expected = crate::input::EndpointWithHostLabelOperationInput {
|
499 + | label: "bar".to_owned(),
|
500 + | };
|
501 + | ::pretty_assertions::assert_eq!(input, expected);
|
502 + | let response = crate::output::EndpointWithHostLabelOperationOutput {};
|
503 + | Ok(response)
|
608 504 | };
|
609 - | ::pretty_assertions::assert_eq!(input, expected);
|
610 - | let response = crate::output::JsonUnionsOutput {
|
611 - | contents: ::std::option::Option::None,
|
612 - | };
|
613 - | Ok(response)
|
614 - | };
|
615 - | sender.send(()).await.expect("receiver dropped early");
|
616 - | result
|
617 - | }
|
618 - | })
|
505 + | sender.send(()).await.expect("receiver dropped early");
|
506 + | result
|
507 + | }
|
508 + | },
|
509 + | )
|
619 510 | .build_unchecked();
|
620 511 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
621 512 | .await
|
622 513 | .expect("unable to make an HTTP request");
|
623 - | assert!(receiver.recv().await.is_some());
|
514 + | assert!(
|
515 + | receiver.recv().await.is_some(),
|
516 + | "we expected operation handler to be invoked but it was not entered"
|
517 + | );
|
624 518 | }
|
625 - | /// Serializes a number union value
|
626 - | /// Test ID: AwsJson11SerializeNumberUnionValue
|
627 - | #[::tokio::test]
|
628 - | async fn aws_json11_serialize_number_union_value_request() {
|
629 - | #[allow(unused_mut)]
|
630 - | let mut http_request = http::Request::builder()
|
631 - | .uri("/")
|
632 - | .method("POST")
|
633 - | .header("Content-Type", "application/x-amz-json-1.1")
|
634 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
635 - | .body(::aws_smithy_http_server::body::Body::from(
|
636 - | ::bytes::Bytes::from_static(
|
637 - | "{\n \"contents\": {\n \"numberValue\": 1\n }\n}".as_bytes(),
|
638 - | ),
|
639 - | ))
|
640 - | .unwrap();
|
641 - | #[allow(unused_mut)]
|
642 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
643 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
644 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
645 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
646 - | let sender = sender.clone();
|
647 - | async move {
|
648 - | let result = {
|
649 - | let expected = crate::input::JsonUnionsInput {
|
650 - | contents: ::std::option::Option::Some(
|
651 - | crate::model::MyUnion::NumberValue(1),
|
652 - | ),
|
653 - | };
|
654 - | ::pretty_assertions::assert_eq!(input, expected);
|
655 - | let response = crate::output::JsonUnionsOutput {
|
656 - | contents: ::std::option::Option::None,
|
657 - | };
|
658 - | Ok(response)
|
659 - | };
|
660 - | sender.send(()).await.expect("receiver dropped early");
|
661 - | result
|
662 - | }
|
663 - | })
|
664 - | .build_unchecked();
|
665 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
666 - | .await
|
667 - | .expect("unable to make an HTTP request");
|
668 - | assert!(receiver.recv().await.is_some());
|
519 + | }
|
520 + |
|
521 + | static CONTENT_TYPE_ENDPOINTOPERATION: ::once_cell::sync::Lazy<::mime::Mime> =
|
522 + | ::once_cell::sync::Lazy::new(|| {
|
523 + | "application/x-amz-json-1.1"
|
524 + | .parse::<::mime::Mime>()
|
525 + | .expect("BUG: MIME parsing failed, content_type is not valid")
|
526 + | });
|
527 + | ::pin_project_lite::pin_project! {
|
528 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
529 + | /// [`EndpointOperationInput`](crate::input::EndpointOperationInput) using modelled bindings.
|
530 + | pub struct EndpointOperationInputFuture {
|
531 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EndpointOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
669 532 | }
|
670 - | /// Serializes a blob union value
|
671 - | /// Test ID: AwsJson11SerializeBlobUnionValue
|
672 - | #[::tokio::test]
|
673 - | async fn aws_json11_serialize_blob_union_value_request() {
|
674 - | #[allow(unused_mut)]
|
675 - | let mut http_request = http::Request::builder()
|
676 - | .uri("/")
|
677 - | .method("POST")
|
678 - | .header("Content-Type", "application/x-amz-json-1.1")
|
679 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
680 - | .body(::aws_smithy_http_server::body::Body::from(
|
681 - | ::bytes::Bytes::from_static(
|
682 - | "{\n \"contents\": {\n \"blobValue\": \"Zm9v\"\n }\n}".as_bytes(),
|
683 - | ),
|
684 - | ))
|
685 - | .unwrap();
|
686 - | #[allow(unused_mut)]
|
687 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
688 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
689 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
690 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
691 - | let sender = sender.clone();
|
692 - | async move {
|
693 - | let result = {
|
694 - | let expected = crate::input::JsonUnionsInput {
|
695 - | contents: ::std::option::Option::Some(
|
696 - | crate::model::MyUnion::BlobValue(::aws_smithy_types::Blob::new(
|
697 - | "foo",
|
698 - | )),
|
699 - | ),
|
700 - | };
|
701 - | ::pretty_assertions::assert_eq!(input, expected);
|
702 - | let response = crate::output::JsonUnionsOutput {
|
703 - | contents: ::std::option::Option::None,
|
704 - | };
|
705 - | Ok(response)
|
706 - | };
|
707 - | sender.send(()).await.expect("receiver dropped early");
|
708 - | result
|
709 - | }
|
710 - | })
|
711 - | .build_unchecked();
|
712 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
533 + | }
|
534 + |
|
535 + | impl std::future::Future for EndpointOperationInputFuture {
|
536 + | type Output = Result<
|
537 + | crate::input::EndpointOperationInput,
|
538 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
539 + | >;
|
540 + |
|
541 + | fn poll(
|
542 + | self: std::pin::Pin<&mut Self>,
|
543 + | cx: &mut std::task::Context<'_>,
|
544 + | ) -> std::task::Poll<Self::Output> {
|
545 + | let this = self.project();
|
546 + | this.inner.as_mut().poll(cx)
|
547 + | }
|
548 + | }
|
549 + |
|
550 + | impl<B>
|
551 + | ::aws_smithy_http_server::request::FromRequest<
|
552 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
553 + | B,
|
554 + | > for crate::input::EndpointOperationInput
|
555 + | where
|
556 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
557 + | B: 'static,
|
558 + |
|
559 + | B::Data: Send,
|
560 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
561 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
562 + | {
|
563 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
564 + | type Future = EndpointOperationInputFuture;
|
565 + |
|
566 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
567 + | let fut = async move {
|
568 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
569 + | request.headers(),
|
570 + | &CONTENT_TYPE_ENDPOINTOPERATION,
|
571 + | ) {
|
572 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
573 + | }
|
574 + | crate::protocol_serde::shape_endpoint_operation::de_endpoint_operation_http_request(
|
575 + | request,
|
576 + | )
|
713 577 | .await
|
714 - | .expect("unable to make an HTTP request");
|
715 - | assert!(receiver.recv().await.is_some());
|
578 + | .map_err(Into::into)
|
579 + | };
|
580 + | use ::futures_util::future::TryFutureExt;
|
581 + | let fut = fut.map_err(
|
582 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
583 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
584 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
585 + | },
|
586 + | );
|
587 + | EndpointOperationInputFuture {
|
588 + | inner: Box::pin(fut),
|
589 + | }
|
716 590 | }
|
717 - | /// Serializes a timestamp union value
|
718 - | /// Test ID: AwsJson11SerializeTimestampUnionValue
|
591 + | }
|
592 + | impl
|
593 + | ::aws_smithy_http_server::response::IntoResponse<
|
594 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
595 + | > for crate::output::EndpointOperationOutput
|
596 + | {
|
597 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
598 + | match crate::protocol_serde::shape_endpoint_operation::ser_endpoint_operation_http_response(
|
599 + | self,
|
600 + | ) {
|
601 + | Ok(response) => response,
|
602 + | Err(e) => {
|
603 + | ::tracing::error!(error = %e, "failed to serialize response");
|
604 + | ::aws_smithy_http_server::response::IntoResponse::<
|
605 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
606 + | >::into_response(
|
607 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
608 + | e,
|
609 + | ),
|
610 + | )
|
611 + | }
|
612 + | }
|
613 + | }
|
614 + | }
|
615 + |
|
616 + | #[allow(unreachable_code, unused_variables)]
|
617 + | #[cfg(test)]
|
618 + | mod endpoint_operation_test {
|
619 + |
|
620 + | /// Operations can prepend to the given host if they define the
|
621 + | /// endpoint trait.
|
622 + | /// Test ID: AwsJson11EndpointTrait
|
719 623 | #[::tokio::test]
|
720 - | async fn aws_json11_serialize_timestamp_union_value_request() {
|
624 + | #[::tracing_test::traced_test]
|
625 + | #[should_panic]
|
626 + | async fn aws_json11_endpoint_trait_request() {
|
721 627 | #[allow(unused_mut)]
|
722 628 | let mut http_request = http::Request::builder()
|
723 629 | .uri("/")
|
724 630 | .method("POST")
|
725 631 | .header("Content-Type", "application/x-amz-json-1.1")
|
726 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
632 + | .header("X-Amz-Target", "JsonProtocol.EndpointOperation")
|
727 633 | .body(::aws_smithy_http_server::body::Body::from(
|
728 - | ::bytes::Bytes::from_static(
|
729 - | "{\n \"contents\": {\n \"timestampValue\": 1398796238\n }\n}"
|
730 - | .as_bytes(),
|
731 - | ),
|
634 + | ::bytes::Bytes::from_static("{}".as_bytes()),
|
732 635 | ))
|
733 636 | .unwrap();
|
637 + | todo!("endpoint trait not supported yet");
|
734 638 | #[allow(unused_mut)]
|
735 639 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
736 640 | let config = crate::service::JsonProtocolConfig::builder().build();
|
737 641 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
738 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
642 + | .endpoint_operation(move |input: crate::input::EndpointOperationInput| {
|
739 643 | let sender = sender.clone();
|
740 644 | async move {
|
741 645 | let result = {
|
742 - | let expected = crate::input::JsonUnionsInput {
|
743 - | contents: ::std::option::Option::Some(
|
744 - | crate::model::MyUnion::TimestampValue(
|
745 - | ::aws_smithy_types::DateTime::from_fractional_secs(
|
746 - | 1398796238, 0_f64,
|
747 - | ),
|
748 - | ),
|
749 - | ),
|
750 - | };
|
646 + | let expected = crate::input::EndpointOperationInput {};
|
751 647 | ::pretty_assertions::assert_eq!(input, expected);
|
752 - | let response = crate::output::JsonUnionsOutput {
|
753 - | contents: ::std::option::Option::None,
|
754 - | };
|
755 - | Ok(response)
|
648 + | let response = crate::output::EndpointOperationOutput {};
|
649 + | response
|
756 650 | };
|
757 651 | sender.send(()).await.expect("receiver dropped early");
|
758 652 | result
|
759 653 | }
|
760 654 | })
|
761 655 | .build_unchecked();
|
762 656 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
763 657 | .await
|
764 658 | .expect("unable to make an HTTP request");
|
765 - | assert!(receiver.recv().await.is_some());
|
659 + | assert!(
|
660 + | receiver.recv().await.is_some(),
|
661 + | "we expected operation handler to be invoked but it was not entered"
|
662 + | );
|
766 663 | }
|
767 - | /// Serializes an enum union value
|
768 - | /// Test ID: AwsJson11SerializeEnumUnionValue
|
769 - | #[::tokio::test]
|
770 - | async fn aws_json11_serialize_enum_union_value_request() {
|
771 - | #[allow(unused_mut)]
|
772 - | let mut http_request = http::Request::builder()
|
773 - | .uri("/")
|
774 - | .method("POST")
|
775 - | .header("Content-Type", "application/x-amz-json-1.1")
|
776 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
777 - | .body(::aws_smithy_http_server::body::Body::from(
|
778 - | ::bytes::Bytes::from_static(
|
779 - | "{\n \"contents\": {\n \"enumValue\": \"Foo\"\n }\n}".as_bytes(),
|
780 - | ),
|
781 - | ))
|
782 - | .unwrap();
|
783 - | #[allow(unused_mut)]
|
784 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
785 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
786 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
787 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
664 + | }
|
665 + |
|
666 + | static CONTENT_TYPE_JSONUNIONS: ::once_cell::sync::Lazy<::mime::Mime> =
|
667 + | ::once_cell::sync::Lazy::new(|| {
|
668 + | "application/x-amz-json-1.1"
|
669 + | .parse::<::mime::Mime>()
|
670 + | .expect("BUG: MIME parsing failed, content_type is not valid")
|
671 + | });
|
672 + | ::pin_project_lite::pin_project! {
|
673 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
674 + | /// [`JsonUnionsInput`](crate::input::JsonUnionsInput) using modelled bindings.
|
675 + | pub struct JsonUnionsInputFuture {
|
676 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::JsonUnionsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
677 + | }
|
678 + | }
|
679 + |
|
680 + | impl std::future::Future for JsonUnionsInputFuture {
|
681 + | type Output = Result<
|
682 + | crate::input::JsonUnionsInput,
|
683 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
684 + | >;
|
685 + |
|
686 + | fn poll(
|
687 + | self: std::pin::Pin<&mut Self>,
|
688 + | cx: &mut std::task::Context<'_>,
|
689 + | ) -> std::task::Poll<Self::Output> {
|
690 + | let this = self.project();
|
691 + | this.inner.as_mut().poll(cx)
|
692 + | }
|
693 + | }
|
694 + |
|
695 + | impl<B>
|
696 + | ::aws_smithy_http_server::request::FromRequest<
|
697 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
698 + | B,
|
699 + | > for crate::input::JsonUnionsInput
|
700 + | where
|
701 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
702 + | B: 'static,
|
703 + |
|
704 + | B::Data: Send,
|
705 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
706 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
707 + | {
|
708 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
709 + | type Future = JsonUnionsInputFuture;
|
710 + |
|
711 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
712 + | let fut = async move {
|
713 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
714 + | request.headers(),
|
715 + | &CONTENT_TYPE_JSONUNIONS,
|
716 + | ) {
|
717 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
718 + | }
|
719 + | crate::protocol_serde::shape_json_unions::de_json_unions_http_request(request)
|
720 + | .await
|
721 + | .map_err(Into::into)
|
722 + | };
|
723 + | use ::futures_util::future::TryFutureExt;
|
724 + | let fut = fut.map_err(
|
725 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
726 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
727 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
728 + | },
|
729 + | );
|
730 + | JsonUnionsInputFuture {
|
731 + | inner: Box::pin(fut),
|
732 + | }
|
733 + | }
|
734 + | }
|
735 + | impl
|
736 + | ::aws_smithy_http_server::response::IntoResponse<
|
737 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
738 + | > for crate::output::JsonUnionsOutput
|
739 + | {
|
740 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
741 + | match crate::protocol_serde::shape_json_unions::ser_json_unions_http_response(self) {
|
742 + | Ok(response) => response,
|
743 + | Err(e) => {
|
744 + | ::tracing::error!(error = %e, "failed to serialize response");
|
745 + | ::aws_smithy_http_server::response::IntoResponse::<
|
746 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
747 + | >::into_response(
|
748 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
749 + | e,
|
750 + | ),
|
751 + | )
|
752 + | }
|
753 + | }
|
754 + | }
|
755 + | }
|
756 + | impl
|
757 + | ::aws_smithy_http_server::response::IntoResponse<
|
758 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
759 + | > for crate::error::JsonUnionsError
|
760 + | {
|
761 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
762 + | match crate::protocol_serde::shape_json_unions::ser_json_unions_http_error(&self) {
|
763 + | Ok(mut response) => {
|
764 + | response.extensions_mut().insert(
|
765 + | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
766 + | );
|
767 + | response
|
768 + | }
|
769 + | Err(e) => {
|
770 + | ::tracing::error!(error = %e, "failed to serialize response");
|
771 + | ::aws_smithy_http_server::response::IntoResponse::<
|
772 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
773 + | >::into_response(
|
774 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
775 + | e,
|
776 + | ),
|
777 + | )
|
778 + | }
|
779 + | }
|
780 + | }
|
781 + | }
|
782 + |
|
783 + | #[allow(unreachable_code, unused_variables)]
|
784 + | #[cfg(test)]
|
785 + | mod json_unions_test {
|
786 + |
|
787 + | /// Serializes a string union value
|
788 + | /// Test ID: AwsJson11SerializeStringUnionValue
|
789 + | #[::tokio::test]
|
790 + | #[::tracing_test::traced_test]
|
791 + | async fn aws_json11_serialize_string_union_value_request() {
|
792 + | #[allow(unused_mut)]
|
793 + | let mut http_request = http::Request::builder()
|
794 + | .uri("/")
|
795 + | .method("POST")
|
796 + | .header("Content-Type", "application/x-amz-json-1.1")
|
797 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
798 + | .body(::aws_smithy_http_server::body::Body::from(
|
799 + | ::bytes::Bytes::from_static(
|
800 + | "{\n \"contents\": {\n \"stringValue\": \"foo\"\n }\n}".as_bytes(),
|
801 + | ),
|
802 + | ))
|
803 + | .unwrap();
|
804 + | #[allow(unused_mut)]
|
805 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
806 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
807 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
808 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
788 809 | let sender = sender.clone();
|
789 810 | async move {
|
790 811 | let result = {
|
791 812 | let expected = crate::input::JsonUnionsInput {
|
792 813 | contents: ::std::option::Option::Some(
|
793 - | crate::model::MyUnion::EnumValue(
|
794 - | "Foo"
|
795 - | .parse::<crate::model::FooEnum>()
|
796 - | .expect("static value validated to member"),
|
797 - | ),
|
814 + | crate::model::MyUnion::StringValue("foo".to_owned()),
|
798 815 | ),
|
799 816 | };
|
800 817 | ::pretty_assertions::assert_eq!(input, expected);
|
801 818 | let response = crate::output::JsonUnionsOutput {
|
802 819 | contents: ::std::option::Option::None,
|
803 820 | };
|
804 821 | Ok(response)
|
805 822 | };
|
806 823 | sender.send(()).await.expect("receiver dropped early");
|
807 824 | result
|
808 825 | }
|
809 826 | })
|
810 827 | .build_unchecked();
|
811 828 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
812 829 | .await
|
813 830 | .expect("unable to make an HTTP request");
|
814 - | assert!(receiver.recv().await.is_some());
|
831 + | assert!(
|
832 + | receiver.recv().await.is_some(),
|
833 + | "we expected operation handler to be invoked but it was not entered"
|
834 + | );
|
815 835 | }
|
816 - | /// Serializes a list union value
|
817 - | /// Test ID: AwsJson11SerializeListUnionValue
|
836 + | /// Serializes a boolean union value
|
837 + | /// Test ID: AwsJson11SerializeBooleanUnionValue
|
818 838 | #[::tokio::test]
|
819 - | async fn aws_json11_serialize_list_union_value_request() {
|
839 + | #[::tracing_test::traced_test]
|
840 + | async fn aws_json11_serialize_boolean_union_value_request() {
|
820 841 | #[allow(unused_mut)]
|
821 842 | let mut http_request = http::Request::builder()
|
822 843 | .uri("/")
|
823 844 | .method("POST")
|
824 845 | .header("Content-Type", "application/x-amz-json-1.1")
|
825 846 | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
826 847 | .body(::aws_smithy_http_server::body::Body::from(
|
827 848 | ::bytes::Bytes::from_static(
|
828 - | "{\n \"contents\": {\n \"listValue\": [\"foo\", \"bar\"]\n }\n}"
|
829 - | .as_bytes(),
|
849 + | "{\n \"contents\": {\n \"booleanValue\": true\n }\n}".as_bytes(),
|
830 850 | ),
|
831 851 | ))
|
832 852 | .unwrap();
|
833 853 | #[allow(unused_mut)]
|
834 854 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
835 855 | let config = crate::service::JsonProtocolConfig::builder().build();
|
836 856 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
837 857 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
838 858 | let sender = sender.clone();
|
839 859 | async move {
|
840 860 | let result = {
|
841 861 | let expected = crate::input::JsonUnionsInput {
|
842 862 | contents: ::std::option::Option::Some(
|
843 - | crate::model::MyUnion::ListValue(vec![
|
844 - | "foo".to_owned(),
|
845 - | "bar".to_owned(),
|
846 - | ]),
|
863 + | crate::model::MyUnion::BooleanValue(true),
|
847 864 | ),
|
848 865 | };
|
849 866 | ::pretty_assertions::assert_eq!(input, expected);
|
850 867 | let response = crate::output::JsonUnionsOutput {
|
851 868 | contents: ::std::option::Option::None,
|
852 869 | };
|
853 870 | Ok(response)
|
854 871 | };
|
855 872 | sender.send(()).await.expect("receiver dropped early");
|
856 873 | result
|
857 874 | }
|
858 875 | })
|
859 876 | .build_unchecked();
|
860 877 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
861 878 | .await
|
862 879 | .expect("unable to make an HTTP request");
|
863 - | assert!(receiver.recv().await.is_some());
|
880 + | assert!(
|
881 + | receiver.recv().await.is_some(),
|
882 + | "we expected operation handler to be invoked but it was not entered"
|
883 + | );
|
864 884 | }
|
865 - | /// Serializes a map union value
|
866 - | /// Test ID: AwsJson11SerializeMapUnionValue
|
885 + | /// Serializes a number union value
|
886 + | /// Test ID: AwsJson11SerializeNumberUnionValue
|
867 887 | #[::tokio::test]
|
868 - | async fn aws_json11_serialize_map_union_value_request() {
|
888 + | #[::tracing_test::traced_test]
|
889 + | async fn aws_json11_serialize_number_union_value_request() {
|
869 890 | #[allow(unused_mut)]
|
870 - | let mut http_request = http::Request::builder()
|
871 - | .uri("/")
|
872 - | .method("POST")
|
873 - | .header("Content-Type", "application/x-amz-json-1.1")
|
874 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
875 - | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{\n \"contents\": {\n \"mapValue\": {\n \"foo\": \"bar\",\n \"spam\": \"eggs\"\n }\n }\n}".as_bytes()))).unwrap();
|
891 + | let mut http_request = http::Request::builder()
|
892 + | .uri("/")
|
893 + | .method("POST")
|
894 + | .header("Content-Type", "application/x-amz-json-1.1")
|
895 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
896 + | .body(::aws_smithy_http_server::body::Body::from(
|
897 + | ::bytes::Bytes::from_static(
|
898 + | "{\n \"contents\": {\n \"numberValue\": 1\n }\n}".as_bytes(),
|
899 + | ),
|
900 + | ))
|
901 + | .unwrap();
|
876 902 | #[allow(unused_mut)]
|
877 903 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
878 904 | let config = crate::service::JsonProtocolConfig::builder().build();
|
879 905 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
880 906 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
881 907 | let sender = sender.clone();
|
882 908 | async move {
|
883 909 | let result = {
|
884 910 | let expected = crate::input::JsonUnionsInput {
|
885 - | contents: ::std::option::Option::Some(crate::model::MyUnion::MapValue(
|
886 - | {
|
887 - | let mut ret = ::std::collections::HashMap::new();
|
888 - | ret.insert("foo".to_owned(), "bar".to_owned());
|
889 - | ret.insert("spam".to_owned(), "eggs".to_owned());
|
890 - | ret
|
891 - | },
|
892 - | )),
|
911 + | contents: ::std::option::Option::Some(
|
912 + | crate::model::MyUnion::NumberValue(1),
|
913 + | ),
|
893 914 | };
|
894 915 | ::pretty_assertions::assert_eq!(input, expected);
|
895 916 | let response = crate::output::JsonUnionsOutput {
|
896 917 | contents: ::std::option::Option::None,
|
897 918 | };
|
898 919 | Ok(response)
|
899 920 | };
|
900 921 | sender.send(()).await.expect("receiver dropped early");
|
901 922 | result
|
902 923 | }
|
903 924 | })
|
904 925 | .build_unchecked();
|
905 926 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
906 927 | .await
|
907 928 | .expect("unable to make an HTTP request");
|
908 - | assert!(receiver.recv().await.is_some());
|
929 + | assert!(
|
930 + | receiver.recv().await.is_some(),
|
931 + | "we expected operation handler to be invoked but it was not entered"
|
932 + | );
|
909 933 | }
|
910 - | /// Serializes a structure union value
|
911 - | /// Test ID: AwsJson11SerializeStructureUnionValue
|
934 + | /// Serializes a blob union value
|
935 + | /// Test ID: AwsJson11SerializeBlobUnionValue
|
912 936 | #[::tokio::test]
|
913 - | async fn aws_json11_serialize_structure_union_value_request() {
|
937 + | #[::tracing_test::traced_test]
|
938 + | async fn aws_json11_serialize_blob_union_value_request() {
|
914 939 | #[allow(unused_mut)]
|
915 - | let mut http_request = http::Request::builder()
|
916 - | .uri("/")
|
917 - | .method("POST")
|
918 - | .header("Content-Type", "application/x-amz-json-1.1")
|
919 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
920 - | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{\n \"contents\": {\n \"structureValue\": {\n \"hi\": \"hello\"\n }\n }\n}".as_bytes()))).unwrap();
|
940 + | let mut http_request = http::Request::builder()
|
941 + | .uri("/")
|
942 + | .method("POST")
|
943 + | .header("Content-Type", "application/x-amz-json-1.1")
|
944 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
945 + | .body(::aws_smithy_http_server::body::Body::from(
|
946 + | ::bytes::Bytes::from_static(
|
947 + | "{\n \"contents\": {\n \"blobValue\": \"Zm9v\"\n }\n}".as_bytes(),
|
948 + | ),
|
949 + | ))
|
950 + | .unwrap();
|
921 951 | #[allow(unused_mut)]
|
922 952 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
923 953 | let config = crate::service::JsonProtocolConfig::builder().build();
|
924 954 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
925 955 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
926 956 | let sender = sender.clone();
|
927 957 | async move {
|
928 958 | let result = {
|
929 959 | let expected = crate::input::JsonUnionsInput {
|
930 960 | contents: ::std::option::Option::Some(
|
931 - | crate::model::MyUnion::StructureValue(
|
932 - | crate::model::GreetingStruct {
|
933 - | hi: ::std::option::Option::Some("hello".to_owned()),
|
934 - | },
|
935 - | ),
|
961 + | crate::model::MyUnion::BlobValue(::aws_smithy_types::Blob::new(
|
962 + | "foo",
|
963 + | )),
|
936 964 | ),
|
937 965 | };
|
938 966 | ::pretty_assertions::assert_eq!(input, expected);
|
939 967 | let response = crate::output::JsonUnionsOutput {
|
940 968 | contents: ::std::option::Option::None,
|
941 969 | };
|
942 970 | Ok(response)
|
943 971 | };
|
944 972 | sender.send(()).await.expect("receiver dropped early");
|
945 973 | result
|
946 974 | }
|
947 975 | })
|
948 976 | .build_unchecked();
|
949 977 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
950 978 | .await
|
951 979 | .expect("unable to make an HTTP request");
|
952 - | assert!(receiver.recv().await.is_some());
|
980 + | assert!(
|
981 + | receiver.recv().await.is_some(),
|
982 + | "we expected operation handler to be invoked but it was not entered"
|
983 + | );
|
953 984 | }
|
954 - | /// Deserializes a string union value
|
955 - | /// Test ID: AwsJson11DeserializeStringUnionValue
|
985 + | /// Serializes a timestamp union value
|
986 + | /// Test ID: AwsJson11SerializeTimestampUnionValue
|
956 987 | #[::tokio::test]
|
957 - | async fn aws_json11_deserialize_string_union_value_response() {
|
958 - | let output = crate::output::JsonUnionsOutput {
|
959 - | contents: ::std::option::Option::Some(crate::model::MyUnion::StringValue(
|
960 - | "foo".to_owned(),
|
961 - | )),
|
962 - | };
|
963 - | use ::aws_smithy_http_server::response::IntoResponse;
|
964 - | let http_response = output.into_response();
|
965 - | ::pretty_assertions::assert_eq!(
|
966 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
967 - | http_response.status()
|
968 - | );
|
969 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
970 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
971 - | http_response.headers(),
|
972 - | expected_headers,
|
973 - | ));
|
974 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
975 - | .await
|
976 - | .expect("unable to extract body to bytes");
|
977 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
978 - | &body,
|
979 - | "{\n \"contents\": {\n \"stringValue\": \"foo\"\n }\n}",
|
980 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
981 - | ));
|
988 + | #[::tracing_test::traced_test]
|
989 + | async fn aws_json11_serialize_timestamp_union_value_request() {
|
990 + | #[allow(unused_mut)]
|
991 + | let mut http_request = http::Request::builder()
|
992 + | .uri("/")
|
993 + | .method("POST")
|
994 + | .header("Content-Type", "application/x-amz-json-1.1")
|
995 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
996 + | .body(::aws_smithy_http_server::body::Body::from(
|
997 + | ::bytes::Bytes::from_static(
|
998 + | "{\n \"contents\": {\n \"timestampValue\": 1398796238\n }\n}"
|
999 + | .as_bytes(),
|
1000 + | ),
|
1001 + | ))
|
1002 + | .unwrap();
|
1003 + | #[allow(unused_mut)]
|
1004 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1005 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
1006 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1007 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1008 + | let sender = sender.clone();
|
1009 + | async move {
|
1010 + | let result = {
|
1011 + | let expected = crate::input::JsonUnionsInput {
|
1012 + | contents: ::std::option::Option::Some(
|
1013 + | crate::model::MyUnion::TimestampValue(
|
1014 + | ::aws_smithy_types::DateTime::from_fractional_secs(
|
1015 + | 1398796238, 0_f64,
|
1016 + | ),
|
1017 + | ),
|
1018 + | ),
|
1019 + | };
|
1020 + | ::pretty_assertions::assert_eq!(input, expected);
|
1021 + | let response = crate::output::JsonUnionsOutput {
|
1022 + | contents: ::std::option::Option::None,
|
1023 + | };
|
1024 + | Ok(response)
|
1025 + | };
|
1026 + | sender.send(()).await.expect("receiver dropped early");
|
1027 + | result
|
1028 + | }
|
1029 + | })
|
1030 + | .build_unchecked();
|
1031 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1032 + | .await
|
1033 + | .expect("unable to make an HTTP request");
|
1034 + | assert!(
|
1035 + | receiver.recv().await.is_some(),
|
1036 + | "we expected operation handler to be invoked but it was not entered"
|
1037 + | );
|
982 1038 | }
|
983 - | /// Deserializes a boolean union value
|
984 - | /// Test ID: AwsJson11DeserializeBooleanUnionValue
|
1039 + | /// Serializes an enum union value
|
1040 + | /// Test ID: AwsJson11SerializeEnumUnionValue
|
985 1041 | #[::tokio::test]
|
986 - | async fn aws_json11_deserialize_boolean_union_value_response() {
|
1042 + | #[::tracing_test::traced_test]
|
1043 + | async fn aws_json11_serialize_enum_union_value_request() {
|
1044 + | #[allow(unused_mut)]
|
1045 + | let mut http_request = http::Request::builder()
|
1046 + | .uri("/")
|
1047 + | .method("POST")
|
1048 + | .header("Content-Type", "application/x-amz-json-1.1")
|
1049 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
1050 + | .body(::aws_smithy_http_server::body::Body::from(
|
1051 + | ::bytes::Bytes::from_static(
|
1052 + | "{\n \"contents\": {\n \"enumValue\": \"Foo\"\n }\n}".as_bytes(),
|
1053 + | ),
|
1054 + | ))
|
1055 + | .unwrap();
|
1056 + | #[allow(unused_mut)]
|
1057 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1058 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
1059 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1060 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1061 + | let sender = sender.clone();
|
1062 + | async move {
|
1063 + | let result = {
|
1064 + | let expected = crate::input::JsonUnionsInput {
|
1065 + | contents: ::std::option::Option::Some(
|
1066 + | crate::model::MyUnion::EnumValue(
|
1067 + | "Foo"
|
1068 + | .parse::<crate::model::FooEnum>()
|
1069 + | .expect("static value validated to member"),
|
1070 + | ),
|
1071 + | ),
|
1072 + | };
|
1073 + | ::pretty_assertions::assert_eq!(input, expected);
|
1074 + | let response = crate::output::JsonUnionsOutput {
|
1075 + | contents: ::std::option::Option::None,
|
1076 + | };
|
1077 + | Ok(response)
|
1078 + | };
|
1079 + | sender.send(()).await.expect("receiver dropped early");
|
1080 + | result
|
1081 + | }
|
1082 + | })
|
1083 + | .build_unchecked();
|
1084 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1085 + | .await
|
1086 + | .expect("unable to make an HTTP request");
|
1087 + | assert!(
|
1088 + | receiver.recv().await.is_some(),
|
1089 + | "we expected operation handler to be invoked but it was not entered"
|
1090 + | );
|
1091 + | }
|
1092 + | /// Serializes a list union value
|
1093 + | /// Test ID: AwsJson11SerializeListUnionValue
|
1094 + | #[::tokio::test]
|
1095 + | #[::tracing_test::traced_test]
|
1096 + | async fn aws_json11_serialize_list_union_value_request() {
|
1097 + | #[allow(unused_mut)]
|
1098 + | let mut http_request = http::Request::builder()
|
1099 + | .uri("/")
|
1100 + | .method("POST")
|
1101 + | .header("Content-Type", "application/x-amz-json-1.1")
|
1102 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
1103 + | .body(::aws_smithy_http_server::body::Body::from(
|
1104 + | ::bytes::Bytes::from_static(
|
1105 + | "{\n \"contents\": {\n \"listValue\": [\"foo\", \"bar\"]\n }\n}"
|
1106 + | .as_bytes(),
|
1107 + | ),
|
1108 + | ))
|
1109 + | .unwrap();
|
1110 + | #[allow(unused_mut)]
|
1111 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1112 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
1113 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1114 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1115 + | let sender = sender.clone();
|
1116 + | async move {
|
1117 + | let result = {
|
1118 + | let expected = crate::input::JsonUnionsInput {
|
1119 + | contents: ::std::option::Option::Some(
|
1120 + | crate::model::MyUnion::ListValue(vec![
|
1121 + | "foo".to_owned(),
|
1122 + | "bar".to_owned(),
|
1123 + | ]),
|
1124 + | ),
|
1125 + | };
|
1126 + | ::pretty_assertions::assert_eq!(input, expected);
|
1127 + | let response = crate::output::JsonUnionsOutput {
|
1128 + | contents: ::std::option::Option::None,
|
1129 + | };
|
1130 + | Ok(response)
|
1131 + | };
|
1132 + | sender.send(()).await.expect("receiver dropped early");
|
1133 + | result
|
1134 + | }
|
1135 + | })
|
1136 + | .build_unchecked();
|
1137 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1138 + | .await
|
1139 + | .expect("unable to make an HTTP request");
|
1140 + | assert!(
|
1141 + | receiver.recv().await.is_some(),
|
1142 + | "we expected operation handler to be invoked but it was not entered"
|
1143 + | );
|
1144 + | }
|
1145 + | /// Serializes a map union value
|
1146 + | /// Test ID: AwsJson11SerializeMapUnionValue
|
1147 + | #[::tokio::test]
|
1148 + | #[::tracing_test::traced_test]
|
1149 + | async fn aws_json11_serialize_map_union_value_request() {
|
1150 + | #[allow(unused_mut)]
|
1151 + | let mut http_request = http::Request::builder()
|
1152 + | .uri("/")
|
1153 + | .method("POST")
|
1154 + | .header("Content-Type", "application/x-amz-json-1.1")
|
1155 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
1156 + | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{\n \"contents\": {\n \"mapValue\": {\n \"foo\": \"bar\",\n \"spam\": \"eggs\"\n }\n }\n}".as_bytes()))).unwrap();
|
1157 + | #[allow(unused_mut)]
|
1158 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1159 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
1160 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1161 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1162 + | let sender = sender.clone();
|
1163 + | async move {
|
1164 + | let result = {
|
1165 + | let expected = crate::input::JsonUnionsInput {
|
1166 + | contents: ::std::option::Option::Some(crate::model::MyUnion::MapValue(
|
1167 + | {
|
1168 + | let mut ret = ::std::collections::HashMap::new();
|
1169 + | ret.insert("foo".to_owned(), "bar".to_owned());
|
1170 + | ret.insert("spam".to_owned(), "eggs".to_owned());
|
1171 + | ret
|
1172 + | },
|
1173 + | )),
|
1174 + | };
|
1175 + | ::pretty_assertions::assert_eq!(input, expected);
|
1176 + | let response = crate::output::JsonUnionsOutput {
|
1177 + | contents: ::std::option::Option::None,
|
1178 + | };
|
1179 + | Ok(response)
|
1180 + | };
|
1181 + | sender.send(()).await.expect("receiver dropped early");
|
1182 + | result
|
1183 + | }
|
1184 + | })
|
1185 + | .build_unchecked();
|
1186 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1187 + | .await
|
1188 + | .expect("unable to make an HTTP request");
|
1189 + | assert!(
|
1190 + | receiver.recv().await.is_some(),
|
1191 + | "we expected operation handler to be invoked but it was not entered"
|
1192 + | );
|
1193 + | }
|
1194 + | /// Serializes a structure union value
|
1195 + | /// Test ID: AwsJson11SerializeStructureUnionValue
|
1196 + | #[::tokio::test]
|
1197 + | #[::tracing_test::traced_test]
|
1198 + | async fn aws_json11_serialize_structure_union_value_request() {
|
1199 + | #[allow(unused_mut)]
|
1200 + | let mut http_request = http::Request::builder()
|
1201 + | .uri("/")
|
1202 + | .method("POST")
|
1203 + | .header("Content-Type", "application/x-amz-json-1.1")
|
1204 + | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
1205 + | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{\n \"contents\": {\n \"structureValue\": {\n \"hi\": \"hello\"\n }\n }\n}".as_bytes()))).unwrap();
|
1206 + | #[allow(unused_mut)]
|
1207 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1208 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
1209 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1210 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1211 + | let sender = sender.clone();
|
1212 + | async move {
|
1213 + | let result = {
|
1214 + | let expected = crate::input::JsonUnionsInput {
|
1215 + | contents: ::std::option::Option::Some(
|
1216 + | crate::model::MyUnion::StructureValue(
|
1217 + | crate::model::GreetingStruct {
|
1218 + | hi: ::std::option::Option::Some("hello".to_owned()),
|
1219 + | },
|
1220 + | ),
|
1221 + | ),
|
1222 + | };
|
1223 + | ::pretty_assertions::assert_eq!(input, expected);
|
1224 + | let response = crate::output::JsonUnionsOutput {
|
1225 + | contents: ::std::option::Option::None,
|
1226 + | };
|
1227 + | Ok(response)
|
1228 + | };
|
1229 + | sender.send(()).await.expect("receiver dropped early");
|
1230 + | result
|
1231 + | }
|
1232 + | })
|
1233 + | .build_unchecked();
|
1234 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1235 + | .await
|
1236 + | .expect("unable to make an HTTP request");
|
1237 + | assert!(
|
1238 + | receiver.recv().await.is_some(),
|
1239 + | "we expected operation handler to be invoked but it was not entered"
|
1240 + | );
|
1241 + | }
|
1242 + | /// Deserializes a string union value
|
1243 + | /// Test ID: AwsJson11DeserializeStringUnionValue
|
1244 + | #[::tokio::test]
|
1245 + | #[::tracing_test::traced_test]
|
1246 + | async fn aws_json11_deserialize_string_union_value_response() {
|
987 1247 | let output = crate::output::JsonUnionsOutput {
|
988 - | contents: ::std::option::Option::Some(crate::model::MyUnion::BooleanValue(true)),
|
1248 + | contents: ::std::option::Option::Some(crate::model::MyUnion::StringValue(
|
1249 + | "foo".to_owned(),
|
1250 + | )),
|
989 1251 | };
|
990 1252 | use ::aws_smithy_http_server::response::IntoResponse;
|
991 1253 | let http_response = output.into_response();
|
992 1254 | ::pretty_assertions::assert_eq!(
|
993 1255 | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
994 1256 | http_response.status()
|
995 1257 | );
|
996 1258 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
997 1259 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
998 1260 | http_response.headers(),
|
999 1261 | expected_headers,
|
1000 1262 | ));
|
1001 1263 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1002 1264 | .await
|
1003 1265 | .expect("unable to extract body to bytes");
|
1004 1266 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1005 1267 | &body,
|
1006 - | "{\n \"contents\": {\n \"booleanValue\": true\n }\n}",
|
1268 + | "{\n \"contents\": {\n \"stringValue\": \"foo\"\n }\n}",
|
1007 1269 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1008 1270 | ));
|
1009 1271 | }
|
1010 - | /// Deserializes a number union value
|
1011 - | /// Test ID: AwsJson11DeserializeNumberUnionValue
|
1272 + | /// Deserializes a boolean union value
|
1273 + | /// Test ID: AwsJson11DeserializeBooleanUnionValue
|
1012 1274 | #[::tokio::test]
|
1013 - | async fn aws_json11_deserialize_number_union_value_response() {
|
1275 + | #[::tracing_test::traced_test]
|
1276 + | async fn aws_json11_deserialize_boolean_union_value_response() {
|
1277 + | let output = crate::output::JsonUnionsOutput {
|
1278 + | contents: ::std::option::Option::Some(crate::model::MyUnion::BooleanValue(true)),
|
1279 + | };
|
1280 + | use ::aws_smithy_http_server::response::IntoResponse;
|
1281 + | let http_response = output.into_response();
|
1282 + | ::pretty_assertions::assert_eq!(
|
1283 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1284 + | http_response.status()
|
1285 + | );
|
1286 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1287 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1288 + | http_response.headers(),
|
1289 + | expected_headers,
|
1290 + | ));
|
1291 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1292 + | .await
|
1293 + | .expect("unable to extract body to bytes");
|
1294 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1295 + | &body,
|
1296 + | "{\n \"contents\": {\n \"booleanValue\": true\n }\n}",
|
1297 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1298 + | ));
|
1299 + | }
|
1300 + | /// Deserializes a number union value
|
1301 + | /// Test ID: AwsJson11DeserializeNumberUnionValue
|
1302 + | #[::tokio::test]
|
1303 + | #[::tracing_test::traced_test]
|
1304 + | async fn aws_json11_deserialize_number_union_value_response() {
|
1014 1305 | let output = crate::output::JsonUnionsOutput {
|
1015 1306 | contents: ::std::option::Option::Some(crate::model::MyUnion::NumberValue(1)),
|
1016 1307 | };
|
1017 1308 | use ::aws_smithy_http_server::response::IntoResponse;
|
1018 1309 | let http_response = output.into_response();
|
1019 1310 | ::pretty_assertions::assert_eq!(
|
1020 1311 | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1021 1312 | http_response.status()
|
1022 1313 | );
|
1023 1314 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1024 1315 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1025 1316 | http_response.headers(),
|
1026 1317 | expected_headers,
|
1027 1318 | ));
|
1028 1319 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1029 1320 | .await
|
1030 1321 | .expect("unable to extract body to bytes");
|
1031 1322 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1032 1323 | &body,
|
1033 1324 | "{\n \"contents\": {\n \"numberValue\": 1\n }\n}",
|
1034 1325 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1035 1326 | ));
|
1036 1327 | }
|
1037 1328 | /// Deserializes a blob union value
|
1038 1329 | /// Test ID: AwsJson11DeserializeBlobUnionValue
|
1039 1330 | #[::tokio::test]
|
1331 + | #[::tracing_test::traced_test]
|
1040 1332 | async fn aws_json11_deserialize_blob_union_value_response() {
|
1041 1333 | let output = crate::output::JsonUnionsOutput {
|
1042 1334 | contents: ::std::option::Option::Some(crate::model::MyUnion::BlobValue(
|
1043 1335 | ::aws_smithy_types::Blob::new("foo"),
|
1044 1336 | )),
|
1045 1337 | };
|
1046 1338 | use ::aws_smithy_http_server::response::IntoResponse;
|
1047 1339 | let http_response = output.into_response();
|
1048 1340 | ::pretty_assertions::assert_eq!(
|
1049 1341 | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1050 1342 | http_response.status()
|
1051 1343 | );
|
1052 1344 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1053 1345 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1054 1346 | http_response.headers(),
|
1055 1347 | expected_headers,
|
1056 1348 | ));
|
1057 1349 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1058 1350 | .await
|
1059 1351 | .expect("unable to extract body to bytes");
|
1060 1352 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1061 1353 | &body,
|
1062 1354 | "{\n \"contents\": {\n \"blobValue\": \"Zm9v\"\n }\n}",
|
1063 1355 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1064 1356 | ));
|
1065 1357 | }
|
1066 1358 | /// Deserializes a timestamp union value
|
1067 1359 | /// Test ID: AwsJson11DeserializeTimestampUnionValue
|
1068 1360 | #[::tokio::test]
|
1361 + | #[::tracing_test::traced_test]
|
1069 1362 | async fn aws_json11_deserialize_timestamp_union_value_response() {
|
1070 1363 | let output = crate::output::JsonUnionsOutput {
|
1071 1364 | contents: ::std::option::Option::Some(crate::model::MyUnion::TimestampValue(
|
1072 1365 | ::aws_smithy_types::DateTime::from_fractional_secs(1398796238, 0_f64),
|
1073 1366 | )),
|
1074 1367 | };
|
1075 1368 | use ::aws_smithy_http_server::response::IntoResponse;
|
1076 1369 | let http_response = output.into_response();
|
1077 1370 | ::pretty_assertions::assert_eq!(
|
1078 1371 | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1079 1372 | http_response.status()
|
1080 1373 | );
|
1081 1374 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1082 1375 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1083 1376 | http_response.headers(),
|
1084 1377 | expected_headers,
|
1085 1378 | ));
|
1086 1379 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1087 1380 | .await
|
1088 1381 | .expect("unable to extract body to bytes");
|
1089 1382 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1090 1383 | &body,
|
1091 1384 | "{\n \"contents\": {\n \"timestampValue\": 1398796238\n }\n}",
|
1092 1385 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1093 1386 | ));
|
1094 1387 | }
|
1095 1388 | /// Deserializes an enum union value
|
1096 1389 | /// Test ID: AwsJson11DeserializeEnumUnionValue
|
1097 1390 | #[::tokio::test]
|
1391 + | #[::tracing_test::traced_test]
|
1098 1392 | async fn aws_json11_deserialize_enum_union_value_response() {
|
1099 1393 | let output = crate::output::JsonUnionsOutput {
|
1100 1394 | contents: ::std::option::Option::Some(crate::model::MyUnion::EnumValue(
|
1101 1395 | "Foo"
|
1102 1396 | .parse::<crate::model::FooEnum>()
|
1103 1397 | .expect("static value validated to member"),
|
1104 1398 | )),
|
1105 1399 | };
|
1106 1400 | use ::aws_smithy_http_server::response::IntoResponse;
|
1107 1401 | let http_response = output.into_response();
|
1108 1402 | ::pretty_assertions::assert_eq!(
|
1109 1403 | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1110 1404 | http_response.status()
|
1111 1405 | );
|
1112 1406 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1113 1407 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1114 1408 | http_response.headers(),
|
1115 1409 | expected_headers,
|
1116 1410 | ));
|
1117 1411 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1118 1412 | .await
|
1119 1413 | .expect("unable to extract body to bytes");
|
1120 1414 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1121 1415 | &body,
|
1122 1416 | "{\n \"contents\": {\n \"enumValue\": \"Foo\"\n }\n}",
|
1123 1417 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1124 1418 | ));
|
1125 1419 | }
|
1126 1420 | /// Deserializes a list union value
|
1127 1421 | /// Test ID: AwsJson11DeserializeListUnionValue
|
1128 1422 | #[::tokio::test]
|
1423 + | #[::tracing_test::traced_test]
|
1129 1424 | async fn aws_json11_deserialize_list_union_value_response() {
|
1130 1425 | let output = crate::output::JsonUnionsOutput {
|
1131 1426 | contents: ::std::option::Option::Some(crate::model::MyUnion::ListValue(vec![
|
1132 1427 | "foo".to_owned(),
|
1133 1428 | "bar".to_owned(),
|
1134 1429 | ])),
|
1135 1430 | };
|
1136 1431 | use ::aws_smithy_http_server::response::IntoResponse;
|
1137 1432 | let http_response = output.into_response();
|
1138 1433 | ::pretty_assertions::assert_eq!(
|
1139 1434 | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1140 1435 | http_response.status()
|
1141 1436 | );
|
1142 1437 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1143 1438 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1144 1439 | http_response.headers(),
|
1145 1440 | expected_headers,
|
1146 1441 | ));
|
1147 1442 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1148 1443 | .await
|
1149 1444 | .expect("unable to extract body to bytes");
|
1150 1445 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1151 1446 | &body,
|
1152 1447 | "{\n \"contents\": {\n \"listValue\": [\"foo\", \"bar\"]\n }\n}",
|
1153 1448 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1154 1449 | ));
|
1155 1450 | }
|
1156 1451 | /// Deserializes a map union value
|
1157 1452 | /// Test ID: AwsJson11DeserializeMapUnionValue
|
1158 1453 | #[::tokio::test]
|
1454 + | #[::tracing_test::traced_test]
|
1159 1455 | async fn aws_json11_deserialize_map_union_value_response() {
|
1160 1456 | let output = crate::output::JsonUnionsOutput {
|
1161 1457 | contents: ::std::option::Option::Some(crate::model::MyUnion::MapValue({
|
1162 1458 | let mut ret = ::std::collections::HashMap::new();
|
1163 1459 | ret.insert("foo".to_owned(), "bar".to_owned());
|
1164 1460 | ret.insert("spam".to_owned(), "eggs".to_owned());
|
1165 1461 | ret
|
1166 1462 | })),
|
1167 1463 | };
|
1168 1464 | use ::aws_smithy_http_server::response::IntoResponse;
|
1169 1465 | let http_response = output.into_response();
|
1170 1466 | ::pretty_assertions::assert_eq!(
|
1171 1467 | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1172 1468 | http_response.status()
|
1173 1469 | );
|
1174 1470 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1175 1471 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1176 1472 | http_response.headers(),
|
1177 1473 | expected_headers,
|
1178 1474 | ));
|
1179 1475 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1180 1476 | .await
|
1181 1477 | .expect("unable to extract body to bytes");
|
1182 1478 | ::aws_smithy_protocol_test::assert_ok(
|
1183 1479 | ::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"))
|
1184 1480 | );
|
1185 1481 | }
|
1186 1482 | /// Deserializes a structure union value
|
1187 1483 | /// Test ID: AwsJson11DeserializeStructureUnionValue
|
1188 1484 | #[::tokio::test]
|
1485 + | #[::tracing_test::traced_test]
|
1189 1486 | async fn aws_json11_deserialize_structure_union_value_response() {
|
1190 1487 | let output = crate::output::JsonUnionsOutput {
|
1191 1488 | contents: ::std::option::Option::Some(crate::model::MyUnion::StructureValue(
|
1192 1489 | crate::model::GreetingStruct {
|
1193 1490 | hi: ::std::option::Option::Some("hello".to_owned()),
|
1194 1491 | },
|
1195 1492 | )),
|
1196 1493 | };
|
1197 1494 | use ::aws_smithy_http_server::response::IntoResponse;
|
1198 1495 | let http_response = output.into_response();
|
1199 1496 | ::pretty_assertions::assert_eq!(
|
1200 1497 | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1201 1498 | http_response.status()
|
1202 1499 | );
|
1203 1500 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1204 1501 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1205 1502 | http_response.headers(),
|
1206 1503 | expected_headers,
|
1207 1504 | ));
|
1208 1505 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1209 1506 | .await
|
1210 1507 | .expect("unable to extract body to bytes");
|
1211 1508 | ::aws_smithy_protocol_test::assert_ok(
|
1212 1509 | ::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"))
|
1213 1510 | );
|
1214 1511 | }
|
1215 1512 | }
|
1216 - | #[cfg(test)]
|
1513 + |
|
1514 + | static CONTENT_TYPE_GREETINGWITHERRORS: ::once_cell::sync::Lazy<::mime::Mime> =
|
1515 + | ::once_cell::sync::Lazy::new(|| {
|
1516 + | "application/x-amz-json-1.1"
|
1517 + | .parse::<::mime::Mime>()
|
1518 + | .expect("BUG: MIME parsing failed, content_type is not valid")
|
1519 + | });
|
1520 + | ::pin_project_lite::pin_project! {
|
1521 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
1522 + | /// [`GreetingWithErrorsInput`](crate::input::GreetingWithErrorsInput) using modelled bindings.
|
1523 + | pub struct GreetingWithErrorsInputFuture {
|
1524 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::GreetingWithErrorsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
1525 + | }
|
1526 + | }
|
1527 + |
|
1528 + | impl std::future::Future for GreetingWithErrorsInputFuture {
|
1529 + | type Output = Result<
|
1530 + | crate::input::GreetingWithErrorsInput,
|
1531 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
1532 + | >;
|
1533 + |
|
1534 + | fn poll(
|
1535 + | self: std::pin::Pin<&mut Self>,
|
1536 + | cx: &mut std::task::Context<'_>,
|
1537 + | ) -> std::task::Poll<Self::Output> {
|
1538 + | let this = self.project();
|
1539 + | this.inner.as_mut().poll(cx)
|
1540 + | }
|
1541 + | }
|
1542 + |
|
1543 + | impl<B>
|
1544 + | ::aws_smithy_http_server::request::FromRequest<
|
1545 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1546 + | B,
|
1547 + | > for crate::input::GreetingWithErrorsInput
|
1548 + | where
|
1549 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
1550 + | B: 'static,
|
1551 + |
|
1552 + | B::Data: Send,
|
1553 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
1554 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
1555 + | {
|
1556 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
1557 + | type Future = GreetingWithErrorsInputFuture;
|
1558 + |
|
1559 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
1560 + | let fut = async move {
|
1561 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
1562 + | request.headers(),
|
1563 + | &CONTENT_TYPE_GREETINGWITHERRORS,
|
1564 + | ) {
|
1565 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
1566 + | }
|
1567 + | crate::protocol_serde::shape_greeting_with_errors::de_greeting_with_errors_http_request(
|
1568 + | request,
|
1569 + | )
|
1570 + | .await
|
1571 + | .map_err(Into::into)
|
1572 + | };
|
1573 + | use ::futures_util::future::TryFutureExt;
|
1574 + | let fut = fut.map_err(
|
1575 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
1576 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
1577 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
1578 + | },
|
1579 + | );
|
1580 + | GreetingWithErrorsInputFuture {
|
1581 + | inner: Box::pin(fut),
|
1582 + | }
|
1583 + | }
|
1584 + | }
|
1585 + | impl
|
1586 + | ::aws_smithy_http_server::response::IntoResponse<
|
1587 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1588 + | > for crate::output::GreetingWithErrorsOutput
|
1589 + | {
|
1590 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
1591 + | match crate::protocol_serde::shape_greeting_with_errors::ser_greeting_with_errors_http_response(self) {
|
1592 + | Ok(response) => response,
|
1593 + | Err(e) => {
|
1594 + | ::tracing::error!(error = %e, "failed to serialize response");
|
1595 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
1596 + | }
|
1597 + | }
|
1598 + | }
|
1599 + | }
|
1600 + | impl
|
1601 + | ::aws_smithy_http_server::response::IntoResponse<
|
1602 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1603 + | > for crate::error::GreetingWithErrorsError
|
1604 + | {
|
1605 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
1606 + | match crate::protocol_serde::shape_greeting_with_errors::ser_greeting_with_errors_http_error(
|
1607 + | &self,
|
1608 + | ) {
|
1609 + | Ok(mut response) => {
|
1610 + | response.extensions_mut().insert(
|
1611 + | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
1612 + | );
|
1613 + | response
|
1614 + | }
|
1615 + | Err(e) => {
|
1616 + | ::tracing::error!(error = %e, "failed to serialize response");
|
1617 + | ::aws_smithy_http_server::response::IntoResponse::<
|
1618 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1619 + | >::into_response(
|
1620 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
1621 + | e,
|
1622 + | ),
|
1623 + | )
|
1624 + | }
|
1625 + | }
|
1626 + | }
|
1627 + | }
|
1628 + |
|
1217 1629 | #[allow(unreachable_code, unused_variables)]
|
1218 - | mod server_kitchen_sink_operation_test {
|
1219 - | /// Serializes string shapes
|
1220 - | /// Test ID: serializes_string_shapes
|
1630 + | #[cfg(test)]
|
1631 + | mod greeting_with_errors_test {
|
1632 + |
|
1633 + | /// Parses simple JSON errors
|
1634 + | /// Test ID: AwsJson11InvalidGreetingError
|
1221 1635 | #[::tokio::test]
|
1222 - | async fn serializes_string_shapes_request() {
|
1223 - | #[allow(unused_mut)]
|
1224 - | let mut http_request = http::Request::builder()
|
1225 - | .uri("/")
|
1226 - | .method("POST")
|
1227 - | .header("Content-Type", "application/x-amz-json-1.1")
|
1228 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
1229 - | .body(::aws_smithy_http_server::body::Body::from(
|
1230 - | ::bytes::Bytes::from_static("{\"String\":\"abc xyz\"}".as_bytes()),
|
1231 - | ))
|
1232 - | .unwrap();
|
1233 - | #[allow(unused_mut)]
|
1234 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1235 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
1236 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1237 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
1238 - | let sender = sender.clone();
|
1239 - | async move {
|
1240 - | let result = {
|
1241 - | use ::aws_smithy_protocol_test::FloatEquals;
|
1242 - | let expected = crate::input::KitchenSinkOperationInput {
|
1243 - | string: ::std::option::Option::Some("abc xyz".to_owned()),
|
1244 - | blob: ::std::option::Option::None,
|
1245 - | boolean: ::std::option::Option::None,
|
1246 - | double: ::std::option::Option::None,
|
1247 - | empty_struct: ::std::option::Option::None,
|
1248 - | float: ::std::option::Option::None,
|
1249 - | httpdate_timestamp: ::std::option::Option::None,
|
1250 - | integer: ::std::option::Option::None,
|
1251 - | iso8601_timestamp: ::std::option::Option::None,
|
1252 - | json_value: ::std::option::Option::None,
|
1253 - | list_of_lists: ::std::option::Option::None,
|
1254 - | list_of_maps_of_strings: ::std::option::Option::None,
|
1255 - | list_of_strings: ::std::option::Option::None,
|
1256 - | list_of_structs: ::std::option::Option::None,
|
1257 - | long: ::std::option::Option::None,
|
1258 - | map_of_lists_of_strings: ::std::option::Option::None,
|
1259 - | map_of_maps: ::std::option::Option::None,
|
1260 - | map_of_strings: ::std::option::Option::None,
|
1261 - | map_of_structs: ::std::option::Option::None,
|
1262 - | recursive_list: ::std::option::Option::None,
|
1263 - | recursive_map: ::std::option::Option::None,
|
1264 - | recursive_struct: ::std::option::Option::None,
|
1265 - | simple_struct: ::std::option::Option::None,
|
1266 - | struct_with_json_name: ::std::option::Option::None,
|
1267 - | timestamp: ::std::option::Option::None,
|
1268 - | unix_timestamp: ::std::option::Option::None,
|
1269 - | };
|
1270 - | ::pretty_assertions::assert_eq!(
|
1271 - | input.blob,
|
1272 - | expected.blob,
|
1273 - | "Unexpected value for `blob`"
|
1274 - | );
|
1275 - | ::pretty_assertions::assert_eq!(
|
1276 - | input.boolean,
|
1277 - | expected.boolean,
|
1278 - | "Unexpected value for `boolean`"
|
1279 - | );
|
1280 - | assert!(
|
1281 - | input.double.float_equals(&expected.double),
|
1282 - | "Unexpected value for `double` {:?} vs. {:?}",
|
1283 - | expected.double,
|
1284 - | input.double
|
1285 - | );
|
1286 - | ::pretty_assertions::assert_eq!(
|
1287 - | input.empty_struct,
|
1288 - | expected.empty_struct,
|
1289 - | "Unexpected value for `empty_struct`"
|
1290 - | );
|
1291 - | assert!(
|
1292 - | input.float.float_equals(&expected.float),
|
1293 - | "Unexpected value for `float` {:?} vs. {:?}",
|
1294 - | expected.float,
|
1295 - | input.float
|
1296 - | );
|
1297 - | ::pretty_assertions::assert_eq!(
|
1298 - | input.httpdate_timestamp,
|
1299 - | expected.httpdate_timestamp,
|
1300 - | "Unexpected value for `httpdate_timestamp`"
|
1301 - | );
|
1302 - | ::pretty_assertions::assert_eq!(
|
1303 - | input.integer,
|
1304 - | expected.integer,
|
1305 - | "Unexpected value for `integer`"
|
1306 - | );
|
1307 - | ::pretty_assertions::assert_eq!(
|
1308 - | input.iso8601_timestamp,
|
1309 - | expected.iso8601_timestamp,
|
1310 - | "Unexpected value for `iso8601_timestamp`"
|
1311 - | );
|
1312 - | ::pretty_assertions::assert_eq!(
|
1313 - | input.json_value,
|
1314 - | expected.json_value,
|
1315 - | "Unexpected value for `json_value`"
|
1316 - | );
|
1317 - | ::pretty_assertions::assert_eq!(
|
1318 - | input.list_of_lists,
|
1319 - | expected.list_of_lists,
|
1320 - | "Unexpected value for `list_of_lists`"
|
1321 - | );
|
1322 - | ::pretty_assertions::assert_eq!(
|
1323 - | input.list_of_maps_of_strings,
|
1324 - | expected.list_of_maps_of_strings,
|
1325 - | "Unexpected value for `list_of_maps_of_strings`"
|
1326 - | );
|
1327 - | ::pretty_assertions::assert_eq!(
|
1328 - | input.list_of_strings,
|
1329 - | expected.list_of_strings,
|
1330 - | "Unexpected value for `list_of_strings`"
|
1331 - | );
|
1332 - | ::pretty_assertions::assert_eq!(
|
1333 - | input.list_of_structs,
|
1334 - | expected.list_of_structs,
|
1335 - | "Unexpected value for `list_of_structs`"
|
1336 - | );
|
1337 - | ::pretty_assertions::assert_eq!(
|
1338 - | input.long,
|
1339 - | expected.long,
|
1340 - | "Unexpected value for `long`"
|
1341 - | );
|
1342 - | ::pretty_assertions::assert_eq!(
|
1343 - | input.map_of_lists_of_strings,
|
1344 - | expected.map_of_lists_of_strings,
|
1345 - | "Unexpected value for `map_of_lists_of_strings`"
|
1346 - | );
|
1347 - | ::pretty_assertions::assert_eq!(
|
1348 - | input.map_of_maps,
|
1349 - | expected.map_of_maps,
|
1350 - | "Unexpected value for `map_of_maps`"
|
1351 - | );
|
1352 - | ::pretty_assertions::assert_eq!(
|
1353 - | input.map_of_strings,
|
1354 - | expected.map_of_strings,
|
1355 - | "Unexpected value for `map_of_strings`"
|
1356 - | );
|
1357 - | ::pretty_assertions::assert_eq!(
|
1358 - | input.map_of_structs,
|
1359 - | expected.map_of_structs,
|
1360 - | "Unexpected value for `map_of_structs`"
|
1361 - | );
|
1362 - | ::pretty_assertions::assert_eq!(
|
1363 - | input.recursive_list,
|
1364 - | expected.recursive_list,
|
1365 - | "Unexpected value for `recursive_list`"
|
1366 - | );
|
1367 - | ::pretty_assertions::assert_eq!(
|
1368 - | input.recursive_map,
|
1369 - | expected.recursive_map,
|
1370 - | "Unexpected value for `recursive_map`"
|
1371 - | );
|
1372 - | ::pretty_assertions::assert_eq!(
|
1373 - | input.recursive_struct,
|
1374 - | expected.recursive_struct,
|
1375 - | "Unexpected value for `recursive_struct`"
|
1376 - | );
|
1377 - | ::pretty_assertions::assert_eq!(
|
1378 - | input.simple_struct,
|
1379 - | expected.simple_struct,
|
1380 - | "Unexpected value for `simple_struct`"
|
1381 - | );
|
1382 - | ::pretty_assertions::assert_eq!(
|
1383 - | input.string,
|
1384 - | expected.string,
|
1385 - | "Unexpected value for `string`"
|
1386 - | );
|
1387 - | ::pretty_assertions::assert_eq!(
|
1388 - | input.struct_with_json_name,
|
1389 - | expected.struct_with_json_name,
|
1390 - | "Unexpected value for `struct_with_json_name`"
|
1391 - | );
|
1392 - | ::pretty_assertions::assert_eq!(
|
1393 - | input.timestamp,
|
1394 - | expected.timestamp,
|
1395 - | "Unexpected value for `timestamp`"
|
1396 - | );
|
1397 - | ::pretty_assertions::assert_eq!(
|
1398 - | input.unix_timestamp,
|
1399 - | expected.unix_timestamp,
|
1400 - | "Unexpected value for `unix_timestamp`"
|
1401 - | );
|
1402 - | let response = crate::output::KitchenSinkOperationOutput {
|
1403 - | blob: ::std::option::Option::None,
|
1404 - | boolean: ::std::option::Option::None,
|
1405 - | double: ::std::option::Option::None,
|
1406 - | empty_struct: ::std::option::Option::None,
|
1407 - | float: ::std::option::Option::None,
|
1408 - | httpdate_timestamp: ::std::option::Option::None,
|
1409 - | integer: ::std::option::Option::None,
|
1410 - | iso8601_timestamp: ::std::option::Option::None,
|
1411 - | json_value: ::std::option::Option::None,
|
1412 - | list_of_lists: ::std::option::Option::None,
|
1413 - | list_of_maps_of_strings: ::std::option::Option::None,
|
1414 - | list_of_strings: ::std::option::Option::None,
|
1415 - | list_of_structs: ::std::option::Option::None,
|
1416 - | long: ::std::option::Option::None,
|
1417 - | map_of_lists_of_strings: ::std::option::Option::None,
|
1418 - | map_of_maps: ::std::option::Option::None,
|
1419 - | map_of_strings: ::std::option::Option::None,
|
1420 - | map_of_structs: ::std::option::Option::None,
|
1421 - | recursive_list: ::std::option::Option::None,
|
1422 - | recursive_map: ::std::option::Option::None,
|
1423 - | recursive_struct: ::std::option::Option::None,
|
1424 - | simple_struct: ::std::option::Option::None,
|
1425 - | string: ::std::option::Option::None,
|
1426 - | struct_with_json_name: ::std::option::Option::None,
|
1427 - | timestamp: ::std::option::Option::None,
|
1428 - | unix_timestamp: ::std::option::Option::None,
|
1429 - | };
|
1430 - | Ok(response)
|
1431 - | };
|
1432 - | sender.send(()).await.expect("receiver dropped early");
|
1433 - | result
|
1434 - | }
|
1435 - | })
|
1436 - | .build_unchecked();
|
1437 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1636 + | #[::tracing_test::traced_test]
|
1637 + | async fn aws_json11_invalid_greeting_error_response() {
|
1638 + | let output = crate::error::InvalidGreeting {
|
1639 + | message: ::std::option::Option::Some("Hi".to_owned()),
|
1640 + | };
|
1641 + | let output = crate::error::GreetingWithErrorsError::InvalidGreeting(output);
|
1642 + | use ::aws_smithy_http_server::response::IntoResponse;
|
1643 + | let http_response = output.into_response();
|
1644 + | ::pretty_assertions::assert_eq!(
|
1645 + | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1646 + | http_response.status()
|
1647 + | );
|
1648 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1649 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1650 + | http_response.headers(),
|
1651 + | expected_headers,
|
1652 + | ));
|
1653 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1438 1654 | .await
|
1439 - | .expect("unable to make an HTTP request");
|
1440 - | assert!(receiver.recv().await.is_some());
|
1655 + | .expect("unable to extract body to bytes");
|
1656 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1657 + | &body,
|
1658 + | "{\n \"__type\": \"InvalidGreeting\",\n \"Message\": \"Hi\"\n}",
|
1659 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1660 + | ));
|
1441 1661 | }
|
1442 - | /// Serializes string shapes with jsonvalue trait
|
1443 - | /// Test ID: serializes_string_shapes_with_jsonvalue_trait
|
1662 + | /// Parses a complex error with no message member
|
1663 + | /// Test ID: AwsJson11ComplexError
|
1444 1664 | #[::tokio::test]
|
1445 - | async fn serializes_string_shapes_with_jsonvalue_trait_request() {
|
1446 - | #[allow(unused_mut)]
|
1447 - | let mut http_request = http::Request::builder()
|
1448 - | .uri("/")
|
1449 - | .method("POST")
|
1450 - | .header("Content-Type", "application/x-amz-json-1.1")
|
1451 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
1452 - | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{\"JsonValue\":\"{\\\"string\\\":\\\"value\\\",\\\"number\\\":1234.5,\\\"boolTrue\\\":true,\\\"boolFalse\\\":false,\\\"array\\\":[1,2,3,4],\\\"object\\\":{\\\"key\\\":\\\"value\\\"},\\\"null\\\":null}\"}".as_bytes()))).unwrap();
|
1453 - | #[allow(unused_mut)]
|
1454 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1455 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
1456 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1457 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
1458 - | let sender = sender.clone();
|
1459 - | async move {
|
1460 - | let result = { use ::aws_smithy_protocol_test::FloatEquals;
|
1461 - | let expected =
|
1462 - | crate::input::KitchenSinkOperationInput {
|
1463 - | json_value:
|
1464 - | ::std::option::Option::Some(
|
1465 - | "{\"string\":\"value\",\"number\":1234.5,\"boolTrue\":true,\"boolFalse\":false,\"array\":[1,2,3,4],\"object\":{\"key\":\"value\"},\"null\":null}".to_owned()
|
1466 - | )
|
1467 - | ,
|
1468 - | blob:
|
1469 - | ::std::option::Option::None
|
1470 - | ,
|
1471 - | boolean:
|
1472 - | ::std::option::Option::None
|
1473 - | ,
|
1474 - | double:
|
1475 - | ::std::option::Option::None
|
1476 - | ,
|
1477 - | empty_struct:
|
1478 - | ::std::option::Option::None
|
1479 - | ,
|
1480 - | float:
|
1481 - | ::std::option::Option::None
|
1482 - | ,
|
1483 - | httpdate_timestamp:
|
1484 - | ::std::option::Option::None
|
1485 - | ,
|
1486 - | integer:
|
1487 - | ::std::option::Option::None
|
1488 - | ,
|
1489 - | iso8601_timestamp:
|
1490 - | ::std::option::Option::None
|
1491 - | ,
|
1492 - | list_of_lists:
|
1493 - | ::std::option::Option::None
|
1494 - | ,
|
1495 - | list_of_maps_of_strings:
|
1496 - | ::std::option::Option::None
|
1497 - | ,
|
1498 - | list_of_strings:
|
1499 - | ::std::option::Option::None
|
1500 - | ,
|
1501 - | list_of_structs:
|
1502 - | ::std::option::Option::None
|
1503 - | ,
|
1504 - | long:
|
1505 - | ::std::option::Option::None
|
1506 - | ,
|
1507 - | map_of_lists_of_strings:
|
1508 - | ::std::option::Option::None
|
1509 - | ,
|
1510 - | map_of_maps:
|
1511 - | ::std::option::Option::None
|
1512 - | ,
|
1513 - | map_of_strings:
|
1514 - | ::std::option::Option::None
|
1515 - | ,
|
1516 - | map_of_structs:
|
1517 - | ::std::option::Option::None
|
1518 - | ,
|
1519 - | recursive_list:
|
1520 - | ::std::option::Option::None
|
1521 - | ,
|
1522 - | recursive_map:
|
1523 - | ::std::option::Option::None
|
1524 - | ,
|
1525 - | recursive_struct:
|
1526 - | ::std::option::Option::None
|
1527 - | ,
|
1528 - | simple_struct:
|
1529 - | ::std::option::Option::None
|
1530 - | ,
|
1531 - | string:
|
1532 - | ::std::option::Option::None
|
1533 - | ,
|
1534 - | struct_with_json_name:
|
1535 - | ::std::option::Option::None
|
1536 - | ,
|
1537 - | timestamp:
|
1538 - | ::std::option::Option::None
|
1539 - | ,
|
1540 - | unix_timestamp:
|
1541 - | ::std::option::Option::None
|
1542 - | ,
|
1543 - | }
|
1544 - | ;
|
1545 - | ::pretty_assertions::assert_eq!(input.blob, expected.blob, "Unexpected value for `blob`");
|
1546 - | ::pretty_assertions::assert_eq!(input.boolean, expected.boolean, "Unexpected value for `boolean`");
|
1547 - | assert!(input.double.float_equals(&expected.double),
|
1548 - | "Unexpected value for `double` {:?} vs. {:?}", expected.double, input.double);
|
1549 - | ::pretty_assertions::assert_eq!(input.empty_struct, expected.empty_struct, "Unexpected value for `empty_struct`");
|
1550 - | assert!(input.float.float_equals(&expected.float),
|
1551 - | "Unexpected value for `float` {:?} vs. {:?}", expected.float, input.float);
|
1552 - | ::pretty_assertions::assert_eq!(input.httpdate_timestamp, expected.httpdate_timestamp, "Unexpected value for `httpdate_timestamp`");
|
1553 - | ::pretty_assertions::assert_eq!(input.integer, expected.integer, "Unexpected value for `integer`");
|
1554 - | ::pretty_assertions::assert_eq!(input.iso8601_timestamp, expected.iso8601_timestamp, "Unexpected value for `iso8601_timestamp`");
|
1555 - | ::pretty_assertions::assert_eq!(input.json_value, expected.json_value, "Unexpected value for `json_value`");
|
1556 - | ::pretty_assertions::assert_eq!(input.list_of_lists, expected.list_of_lists, "Unexpected value for `list_of_lists`");
|
1557 - | ::pretty_assertions::assert_eq!(input.list_of_maps_of_strings, expected.list_of_maps_of_strings, "Unexpected value for `list_of_maps_of_strings`");
|
1558 - | ::pretty_assertions::assert_eq!(input.list_of_strings, expected.list_of_strings, "Unexpected value for `list_of_strings`");
|
1559 - | ::pretty_assertions::assert_eq!(input.list_of_structs, expected.list_of_structs, "Unexpected value for `list_of_structs`");
|
1560 - | ::pretty_assertions::assert_eq!(input.long, expected.long, "Unexpected value for `long`");
|
1561 - | ::pretty_assertions::assert_eq!(input.map_of_lists_of_strings, expected.map_of_lists_of_strings, "Unexpected value for `map_of_lists_of_strings`");
|
1562 - | ::pretty_assertions::assert_eq!(input.map_of_maps, expected.map_of_maps, "Unexpected value for `map_of_maps`");
|
1563 - | ::pretty_assertions::assert_eq!(input.map_of_strings, expected.map_of_strings, "Unexpected value for `map_of_strings`");
|
1564 - | ::pretty_assertions::assert_eq!(input.map_of_structs, expected.map_of_structs, "Unexpected value for `map_of_structs`");
|
1565 - | ::pretty_assertions::assert_eq!(input.recursive_list, expected.recursive_list, "Unexpected value for `recursive_list`");
|
1566 - | ::pretty_assertions::assert_eq!(input.recursive_map, expected.recursive_map, "Unexpected value for `recursive_map`");
|
1567 - | ::pretty_assertions::assert_eq!(input.recursive_struct, expected.recursive_struct, "Unexpected value for `recursive_struct`");
|
1568 - | ::pretty_assertions::assert_eq!(input.simple_struct, expected.simple_struct, "Unexpected value for `simple_struct`");
|
1569 - | ::pretty_assertions::assert_eq!(input.string, expected.string, "Unexpected value for `string`");
|
1570 - | ::pretty_assertions::assert_eq!(input.struct_with_json_name, expected.struct_with_json_name, "Unexpected value for `struct_with_json_name`");
|
1571 - | ::pretty_assertions::assert_eq!(input.timestamp, expected.timestamp, "Unexpected value for `timestamp`");
|
1572 - | ::pretty_assertions::assert_eq!(input.unix_timestamp, expected.unix_timestamp, "Unexpected value for `unix_timestamp`");
|
1573 - | let response =
|
1574 - | crate::output::KitchenSinkOperationOutput {
|
1575 - | blob:
|
1576 - | ::std::option::Option::None
|
1577 - | ,
|
1578 - | boolean:
|
1579 - | ::std::option::Option::None
|
1580 - | ,
|
1581 - | double:
|
1582 - | ::std::option::Option::None
|
1583 - | ,
|
1584 - | empty_struct:
|
1585 - | ::std::option::Option::None
|
1586 - | ,
|
1587 - | float:
|
1588 - | ::std::option::Option::None
|
1589 - | ,
|
1590 - | httpdate_timestamp:
|
1591 - | ::std::option::Option::None
|
1592 - | ,
|
1593 - | integer:
|
1594 - | ::std::option::Option::None
|
1595 - | ,
|
1596 - | iso8601_timestamp:
|
1597 - | ::std::option::Option::None
|
1598 - | ,
|
1599 - | json_value:
|
1600 - | ::std::option::Option::None
|
1601 - | ,
|
1602 - | list_of_lists:
|
1603 - | ::std::option::Option::None
|
1604 - | ,
|
1605 - | list_of_maps_of_strings:
|
1606 - | ::std::option::Option::None
|
1607 - | ,
|
1608 - | list_of_strings:
|
1609 - | ::std::option::Option::None
|
1610 - | ,
|
1611 - | list_of_structs:
|
1612 - | ::std::option::Option::None
|
1613 - | ,
|
1614 - | long:
|
1615 - | ::std::option::Option::None
|
1616 - | ,
|
1617 - | map_of_lists_of_strings:
|
1618 - | ::std::option::Option::None
|
1619 - | ,
|
1620 - | map_of_maps:
|
1621 - | ::std::option::Option::None
|
1622 - | ,
|
1623 - | map_of_strings:
|
1624 - | ::std::option::Option::None
|
1625 - | ,
|
1626 - | map_of_structs:
|
1627 - | ::std::option::Option::None
|
1628 - | ,
|
1629 - | recursive_list:
|
1630 - | ::std::option::Option::None
|
1631 - | ,
|
1632 - | recursive_map:
|
1633 - | ::std::option::Option::None
|
1634 - | ,
|
1635 - | recursive_struct:
|
1636 - | ::std::option::Option::None
|
1637 - | ,
|
1638 - | simple_struct:
|
1639 - | ::std::option::Option::None
|
1640 - | ,
|
1641 - | string:
|
1642 - | ::std::option::Option::None
|
1643 - | ,
|
1644 - | struct_with_json_name:
|
1645 - | ::std::option::Option::None
|
1646 - | ,
|
1647 - | timestamp:
|
1648 - | ::std::option::Option::None
|
1649 - | ,
|
1650 - | unix_timestamp:
|
1651 - | ::std::option::Option::None
|
1652 - | ,
|
1653 - | }
|
1654 - | ;
|
1655 - | Ok(response) };
|
1656 - | sender.send(()).await.expect("receiver dropped early");
|
1657 - | result
|
1658 - | }
|
1659 - | })
|
1660 - | .build_unchecked();
|
1661 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1665 + | #[::tracing_test::traced_test]
|
1666 + | async fn aws_json11_complex_error_response() {
|
1667 + | let output = crate::error::ComplexError {
|
1668 + | top_level: ::std::option::Option::Some("Top level".to_owned()),
|
1669 + | nested: ::std::option::Option::Some(crate::model::ComplexNestedErrorData {
|
1670 + | foo: ::std::option::Option::Some("bar".to_owned()),
|
1671 + | }),
|
1672 + | };
|
1673 + | let output = crate::error::GreetingWithErrorsError::ComplexError(output);
|
1674 + | use ::aws_smithy_http_server::response::IntoResponse;
|
1675 + | let http_response = output.into_response();
|
1676 + | ::pretty_assertions::assert_eq!(
|
1677 + | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1678 + | http_response.status()
|
1679 + | );
|
1680 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1681 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1682 + | http_response.headers(),
|
1683 + | expected_headers,
|
1684 + | ));
|
1685 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1662 1686 | .await
|
1663 - | .expect("unable to make an HTTP request");
|
1664 - | assert!(receiver.recv().await.is_some());
|
1687 + | .expect("unable to extract body to bytes");
|
1688 + | ::aws_smithy_protocol_test::assert_ok(
|
1689 + | ::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"))
|
1690 + | );
|
1665 1691 | }
|
1666 - | /// Serializes integer shapes
|
1667 - | /// Test ID: serializes_integer_shapes
|
1692 + | /// Test ID: AwsJson11EmptyComplexError
|
1668 1693 | #[::tokio::test]
|
1669 - | async fn serializes_integer_shapes_request() {
|
1694 + | #[::tracing_test::traced_test]
|
1695 + | async fn aws_json11_empty_complex_error_response() {
|
1696 + | let output = crate::error::ComplexError {
|
1697 + | top_level: ::std::option::Option::None,
|
1698 + | nested: ::std::option::Option::None,
|
1699 + | };
|
1700 + | let output = crate::error::GreetingWithErrorsError::ComplexError(output);
|
1701 + | use ::aws_smithy_http_server::response::IntoResponse;
|
1702 + | let http_response = output.into_response();
|
1703 + | ::pretty_assertions::assert_eq!(
|
1704 + | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1705 + | http_response.status()
|
1706 + | );
|
1707 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1708 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1709 + | http_response.headers(),
|
1710 + | expected_headers,
|
1711 + | ));
|
1712 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1713 + | .await
|
1714 + | .expect("unable to extract body to bytes");
|
1715 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1716 + | &body,
|
1717 + | "{\n \"__type\": \"ComplexError\"\n}",
|
1718 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1719 + | ));
|
1720 + | }
|
1721 + | }
|
1722 + |
|
1723 + | static CONTENT_TYPE_SPARSENULLSOPERATION: ::once_cell::sync::Lazy<::mime::Mime> =
|
1724 + | ::once_cell::sync::Lazy::new(|| {
|
1725 + | "application/x-amz-json-1.1"
|
1726 + | .parse::<::mime::Mime>()
|
1727 + | .expect("BUG: MIME parsing failed, content_type is not valid")
|
1728 + | });
|
1729 + | ::pin_project_lite::pin_project! {
|
1730 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
1731 + | /// [`SparseNullsOperationInput`](crate::input::SparseNullsOperationInput) using modelled bindings.
|
1732 + | pub struct SparseNullsOperationInputFuture {
|
1733 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SparseNullsOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
1734 + | }
|
1735 + | }
|
1736 + |
|
1737 + | impl std::future::Future for SparseNullsOperationInputFuture {
|
1738 + | type Output = Result<
|
1739 + | crate::input::SparseNullsOperationInput,
|
1740 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
1741 + | >;
|
1742 + |
|
1743 + | fn poll(
|
1744 + | self: std::pin::Pin<&mut Self>,
|
1745 + | cx: &mut std::task::Context<'_>,
|
1746 + | ) -> std::task::Poll<Self::Output> {
|
1747 + | let this = self.project();
|
1748 + | this.inner.as_mut().poll(cx)
|
1749 + | }
|
1750 + | }
|
1751 + |
|
1752 + | impl<B>
|
1753 + | ::aws_smithy_http_server::request::FromRequest<
|
1754 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1755 + | B,
|
1756 + | > for crate::input::SparseNullsOperationInput
|
1757 + | where
|
1758 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
1759 + | B: 'static,
|
1760 + |
|
1761 + | B::Data: Send,
|
1762 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
1763 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
1764 + | {
|
1765 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
1766 + | type Future = SparseNullsOperationInputFuture;
|
1767 + |
|
1768 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
1769 + | let fut = async move {
|
1770 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
1771 + | request.headers(),
|
1772 + | &CONTENT_TYPE_SPARSENULLSOPERATION,
|
1773 + | ) {
|
1774 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
1775 + | }
|
1776 + | crate::protocol_serde::shape_sparse_nulls_operation::de_sparse_nulls_operation_http_request(request)
|
1777 + | .await
|
1778 + | .map_err(Into::into)
|
1779 + | };
|
1780 + | use ::futures_util::future::TryFutureExt;
|
1781 + | let fut = fut.map_err(
|
1782 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
1783 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
1784 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
1785 + | },
|
1786 + | );
|
1787 + | SparseNullsOperationInputFuture {
|
1788 + | inner: Box::pin(fut),
|
1789 + | }
|
1790 + | }
|
1791 + | }
|
1792 + | impl
|
1793 + | ::aws_smithy_http_server::response::IntoResponse<
|
1794 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1795 + | > for crate::output::SparseNullsOperationOutput
|
1796 + | {
|
1797 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
1798 + | match crate::protocol_serde::shape_sparse_nulls_operation::ser_sparse_nulls_operation_http_response(self) {
|
1799 + | Ok(response) => response,
|
1800 + | Err(e) => {
|
1801 + | ::tracing::error!(error = %e, "failed to serialize response");
|
1802 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
1803 + | }
|
1804 + | }
|
1805 + | }
|
1806 + | }
|
1807 + |
|
1808 + | #[allow(unreachable_code, unused_variables)]
|
1809 + | #[cfg(test)]
|
1810 + | mod sparse_nulls_operation_test {
|
1811 + |
|
1812 + | /// Serializes null values in maps
|
1813 + | /// Test ID: AwsJson11SparseMapsSerializeNullValues
|
1814 + | #[::tokio::test]
|
1815 + | #[::tracing_test::traced_test]
|
1816 + | async fn aws_json11_sparse_maps_serialize_null_values_request() {
|
1670 1817 | #[allow(unused_mut)]
|
1671 1818 | let mut http_request = http::Request::builder()
|
1672 1819 | .uri("/")
|
1673 1820 | .method("POST")
|
1674 1821 | .header("Content-Type", "application/x-amz-json-1.1")
|
1675 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
1822 + | .header("X-Amz-Target", "JsonProtocol.SparseNullsOperation")
|
1676 1823 | .body(::aws_smithy_http_server::body::Body::from(
|
1677 - | ::bytes::Bytes::from_static("{\"Integer\":1234}".as_bytes()),
|
1824 + | ::bytes::Bytes::from_static(
|
1825 + | "{\n \"sparseStringMap\": {\n \"foo\": null\n }\n}".as_bytes(),
|
1826 + | ),
|
1678 1827 | ))
|
1679 1828 | .unwrap();
|
1680 1829 | #[allow(unused_mut)]
|
1681 1830 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1682 1831 | let config = crate::service::JsonProtocolConfig::builder().build();
|
1683 1832 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1684 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
1833 + | .sparse_nulls_operation(move |input: crate::input::SparseNullsOperationInput| {
|
1685 1834 | let sender = sender.clone();
|
1686 1835 | async move {
|
1687 1836 | let result = {
|
1688 - | use ::aws_smithy_protocol_test::FloatEquals;
|
1689 - | let expected = crate::input::KitchenSinkOperationInput {
|
1690 - | integer: ::std::option::Option::Some(1234),
|
1691 - | blob: ::std::option::Option::None,
|
1692 - | boolean: ::std::option::Option::None,
|
1693 - | double: ::std::option::Option::None,
|
1694 - | empty_struct: ::std::option::Option::None,
|
1695 - | float: ::std::option::Option::None,
|
1696 - | httpdate_timestamp: ::std::option::Option::None,
|
1697 - | iso8601_timestamp: ::std::option::Option::None,
|
1698 - | json_value: ::std::option::Option::None,
|
1699 - | list_of_lists: ::std::option::Option::None,
|
1700 - | list_of_maps_of_strings: ::std::option::Option::None,
|
1701 - | list_of_strings: ::std::option::Option::None,
|
1702 - | list_of_structs: ::std::option::Option::None,
|
1703 - | long: ::std::option::Option::None,
|
1704 - | map_of_lists_of_strings: ::std::option::Option::None,
|
1705 - | map_of_maps: ::std::option::Option::None,
|
1706 - | map_of_strings: ::std::option::Option::None,
|
1707 - | map_of_structs: ::std::option::Option::None,
|
1708 - | recursive_list: ::std::option::Option::None,
|
1709 - | recursive_map: ::std::option::Option::None,
|
1710 - | recursive_struct: ::std::option::Option::None,
|
1711 - | simple_struct: ::std::option::Option::None,
|
1712 - | string: ::std::option::Option::None,
|
1713 - | struct_with_json_name: ::std::option::Option::None,
|
1714 - | timestamp: ::std::option::Option::None,
|
1715 - | unix_timestamp: ::std::option::Option::None,
|
1837 + | let expected = crate::input::SparseNullsOperationInput {
|
1838 + | sparse_string_map: ::std::option::Option::Some({
|
1839 + | let mut ret = ::std::collections::HashMap::new();
|
1840 + | ret.insert("foo".to_owned(), ::std::option::Option::None);
|
1841 + | ret
|
1842 + | }),
|
1843 + | sparse_string_list: ::std::option::Option::None,
|
1716 1844 | };
|
1717 - | ::pretty_assertions::assert_eq!(
|
1718 - | input.blob,
|
1719 - | expected.blob,
|
1720 - | "Unexpected value for `blob`"
|
1721 - | );
|
1722 - | ::pretty_assertions::assert_eq!(
|
1723 - | input.boolean,
|
1724 - | expected.boolean,
|
1725 - | "Unexpected value for `boolean`"
|
1726 - | );
|
1727 - | assert!(
|
1728 - | input.double.float_equals(&expected.double),
|
1729 - | "Unexpected value for `double` {:?} vs. {:?}",
|
1730 - | expected.double,
|
1731 - | input.double
|
1732 - | );
|
1733 - | ::pretty_assertions::assert_eq!(
|
1734 - | input.empty_struct,
|
1735 - | expected.empty_struct,
|
1736 - | "Unexpected value for `empty_struct`"
|
1737 - | );
|
1738 - | assert!(
|
1739 - | input.float.float_equals(&expected.float),
|
1740 - | "Unexpected value for `float` {:?} vs. {:?}",
|
1741 - | expected.float,
|
1742 - | input.float
|
1743 - | );
|
1744 - | ::pretty_assertions::assert_eq!(
|
1745 - | input.httpdate_timestamp,
|
1746 - | expected.httpdate_timestamp,
|
1747 - | "Unexpected value for `httpdate_timestamp`"
|
1748 - | );
|
1749 - | ::pretty_assertions::assert_eq!(
|
1750 - | input.integer,
|
1751 - | expected.integer,
|
1752 - | "Unexpected value for `integer`"
|
1753 - | );
|
1754 - | ::pretty_assertions::assert_eq!(
|
1755 - | input.iso8601_timestamp,
|
1756 - | expected.iso8601_timestamp,
|
1757 - | "Unexpected value for `iso8601_timestamp`"
|
1758 - | );
|
1759 - | ::pretty_assertions::assert_eq!(
|
1760 - | input.json_value,
|
1761 - | expected.json_value,
|
1762 - | "Unexpected value for `json_value`"
|
1763 - | );
|
1764 - | ::pretty_assertions::assert_eq!(
|
1765 - | input.list_of_lists,
|
1766 - | expected.list_of_lists,
|
1767 - | "Unexpected value for `list_of_lists`"
|
1768 - | );
|
1769 - | ::pretty_assertions::assert_eq!(
|
1770 - | input.list_of_maps_of_strings,
|
1771 - | expected.list_of_maps_of_strings,
|
1772 - | "Unexpected value for `list_of_maps_of_strings`"
|
1773 - | );
|
1774 - | ::pretty_assertions::assert_eq!(
|
1775 - | input.list_of_strings,
|
1776 - | expected.list_of_strings,
|
1777 - | "Unexpected value for `list_of_strings`"
|
1778 - | );
|
1779 - | ::pretty_assertions::assert_eq!(
|
1780 - | input.list_of_structs,
|
1781 - | expected.list_of_structs,
|
1782 - | "Unexpected value for `list_of_structs`"
|
1783 - | );
|
1784 - | ::pretty_assertions::assert_eq!(
|
1785 - | input.long,
|
1786 - | expected.long,
|
1787 - | "Unexpected value for `long`"
|
1788 - | );
|
1789 - | ::pretty_assertions::assert_eq!(
|
1790 - | input.map_of_lists_of_strings,
|
1791 - | expected.map_of_lists_of_strings,
|
1792 - | "Unexpected value for `map_of_lists_of_strings`"
|
1793 - | );
|
1794 - | ::pretty_assertions::assert_eq!(
|
1795 - | input.map_of_maps,
|
1796 - | expected.map_of_maps,
|
1797 - | "Unexpected value for `map_of_maps`"
|
1798 - | );
|
1799 - | ::pretty_assertions::assert_eq!(
|
1800 - | input.map_of_strings,
|
1801 - | expected.map_of_strings,
|
1802 - | "Unexpected value for `map_of_strings`"
|
1803 - | );
|
1804 - | ::pretty_assertions::assert_eq!(
|
1805 - | input.map_of_structs,
|
1806 - | expected.map_of_structs,
|
1807 - | "Unexpected value for `map_of_structs`"
|
1808 - | );
|
1809 - | ::pretty_assertions::assert_eq!(
|
1810 - | input.recursive_list,
|
1811 - | expected.recursive_list,
|
1812 - | "Unexpected value for `recursive_list`"
|
1813 - | );
|
1814 - | ::pretty_assertions::assert_eq!(
|
1815 - | input.recursive_map,
|
1816 - | expected.recursive_map,
|
1817 - | "Unexpected value for `recursive_map`"
|
1818 - | );
|
1819 - | ::pretty_assertions::assert_eq!(
|
1820 - | input.recursive_struct,
|
1821 - | expected.recursive_struct,
|
1822 - | "Unexpected value for `recursive_struct`"
|
1823 - | );
|
1824 - | ::pretty_assertions::assert_eq!(
|
1825 - | input.simple_struct,
|
1826 - | expected.simple_struct,
|
1827 - | "Unexpected value for `simple_struct`"
|
1828 - | );
|
1829 - | ::pretty_assertions::assert_eq!(
|
1830 - | input.string,
|
1831 - | expected.string,
|
1832 - | "Unexpected value for `string`"
|
1833 - | );
|
1834 - | ::pretty_assertions::assert_eq!(
|
1835 - | input.struct_with_json_name,
|
1836 - | expected.struct_with_json_name,
|
1837 - | "Unexpected value for `struct_with_json_name`"
|
1838 - | );
|
1839 - | ::pretty_assertions::assert_eq!(
|
1840 - | input.timestamp,
|
1841 - | expected.timestamp,
|
1842 - | "Unexpected value for `timestamp`"
|
1843 - | );
|
1844 - | ::pretty_assertions::assert_eq!(
|
1845 - | input.unix_timestamp,
|
1846 - | expected.unix_timestamp,
|
1847 - | "Unexpected value for `unix_timestamp`"
|
1848 - | );
|
1849 - | let response = crate::output::KitchenSinkOperationOutput {
|
1850 - | blob: ::std::option::Option::None,
|
1851 - | boolean: ::std::option::Option::None,
|
1852 - | double: ::std::option::Option::None,
|
1853 - | empty_struct: ::std::option::Option::None,
|
1854 - | float: ::std::option::Option::None,
|
1855 - | httpdate_timestamp: ::std::option::Option::None,
|
1856 - | integer: ::std::option::Option::None,
|
1857 - | iso8601_timestamp: ::std::option::Option::None,
|
1858 - | json_value: ::std::option::Option::None,
|
1859 - | list_of_lists: ::std::option::Option::None,
|
1860 - | list_of_maps_of_strings: ::std::option::Option::None,
|
1861 - | list_of_strings: ::std::option::Option::None,
|
1862 - | list_of_structs: ::std::option::Option::None,
|
1863 - | long: ::std::option::Option::None,
|
1864 - | map_of_lists_of_strings: ::std::option::Option::None,
|
1865 - | map_of_maps: ::std::option::Option::None,
|
1866 - | map_of_strings: ::std::option::Option::None,
|
1867 - | map_of_structs: ::std::option::Option::None,
|
1868 - | recursive_list: ::std::option::Option::None,
|
1869 - | recursive_map: ::std::option::Option::None,
|
1870 - | recursive_struct: ::std::option::Option::None,
|
1871 - | simple_struct: ::std::option::Option::None,
|
1872 - | string: ::std::option::Option::None,
|
1873 - | struct_with_json_name: ::std::option::Option::None,
|
1874 - | timestamp: ::std::option::Option::None,
|
1875 - | unix_timestamp: ::std::option::Option::None,
|
1845 + | ::pretty_assertions::assert_eq!(input, expected);
|
1846 + | let response = crate::output::SparseNullsOperationOutput {
|
1847 + | sparse_string_list: ::std::option::Option::None,
|
1848 + | sparse_string_map: ::std::option::Option::None,
|
1876 1849 | };
|
1877 - | Ok(response)
|
1850 + | response
|
1878 1851 | };
|
1879 1852 | sender.send(()).await.expect("receiver dropped early");
|
1880 1853 | result
|
1881 1854 | }
|
1882 1855 | })
|
1883 1856 | .build_unchecked();
|
1884 1857 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1885 1858 | .await
|
1886 1859 | .expect("unable to make an HTTP request");
|
1887 - | assert!(receiver.recv().await.is_some());
|
1860 + | assert!(
|
1861 + | receiver.recv().await.is_some(),
|
1862 + | "we expected operation handler to be invoked but it was not entered"
|
1863 + | );
|
1888 1864 | }
|
1889 - | /// Serializes long shapes
|
1890 - | /// Test ID: serializes_long_shapes
|
1865 + | /// Serializes null values in lists
|
1866 + | /// Test ID: AwsJson11SparseListsSerializeNull
|
1891 1867 | #[::tokio::test]
|
1892 - | async fn serializes_long_shapes_request() {
|
1868 + | #[::tracing_test::traced_test]
|
1869 + | async fn aws_json11_sparse_lists_serialize_null_request() {
|
1893 1870 | #[allow(unused_mut)]
|
1894 1871 | let mut http_request = http::Request::builder()
|
1895 1872 | .uri("/")
|
1896 1873 | .method("POST")
|
1897 1874 | .header("Content-Type", "application/x-amz-json-1.1")
|
1898 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
1875 + | .header("X-Amz-Target", "JsonProtocol.SparseNullsOperation")
|
1899 1876 | .body(::aws_smithy_http_server::body::Body::from(
|
1900 - | ::bytes::Bytes::from_static("{\"Long\":999999999999}".as_bytes()),
|
1877 + | ::bytes::Bytes::from_static(
|
1878 + | "{\n \"sparseStringList\": [\n null\n ]\n}".as_bytes(),
|
1879 + | ),
|
1901 1880 | ))
|
1902 1881 | .unwrap();
|
1903 1882 | #[allow(unused_mut)]
|
1904 1883 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1905 1884 | let config = crate::service::JsonProtocolConfig::builder().build();
|
1906 1885 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1907 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
1886 + | .sparse_nulls_operation(move |input: crate::input::SparseNullsOperationInput| {
|
1908 1887 | let sender = sender.clone();
|
1909 1888 | async move {
|
1910 1889 | let result = {
|
1911 - | use ::aws_smithy_protocol_test::FloatEquals;
|
1912 - | let expected = crate::input::KitchenSinkOperationInput {
|
1913 - | long: ::std::option::Option::Some(999999999999),
|
1914 - | blob: ::std::option::Option::None,
|
1915 - | boolean: ::std::option::Option::None,
|
1916 - | double: ::std::option::Option::None,
|
1917 - | empty_struct: ::std::option::Option::None,
|
1918 - | float: ::std::option::Option::None,
|
1919 - | httpdate_timestamp: ::std::option::Option::None,
|
1920 - | integer: ::std::option::Option::None,
|
1921 - | iso8601_timestamp: ::std::option::Option::None,
|
1922 - | json_value: ::std::option::Option::None,
|
1923 - | list_of_lists: ::std::option::Option::None,
|
1924 - | list_of_maps_of_strings: ::std::option::Option::None,
|
1925 - | list_of_strings: ::std::option::Option::None,
|
1926 - | list_of_structs: ::std::option::Option::None,
|
1927 - | map_of_lists_of_strings: ::std::option::Option::None,
|
1928 - | map_of_maps: ::std::option::Option::None,
|
1929 - | map_of_strings: ::std::option::Option::None,
|
1930 - | map_of_structs: ::std::option::Option::None,
|
1931 - | recursive_list: ::std::option::Option::None,
|
1932 - | recursive_map: ::std::option::Option::None,
|
1933 - | recursive_struct: ::std::option::Option::None,
|
1934 - | simple_struct: ::std::option::Option::None,
|
1935 - | string: ::std::option::Option::None,
|
1936 - | struct_with_json_name: ::std::option::Option::None,
|
1937 - | timestamp: ::std::option::Option::None,
|
1938 - | unix_timestamp: ::std::option::Option::None,
|
1890 + | let expected = crate::input::SparseNullsOperationInput {
|
1891 + | sparse_string_list: ::std::option::Option::Some(vec![
|
1892 + | ::std::option::Option::None,
|
1893 + | ]),
|
1894 + | sparse_string_map: ::std::option::Option::None,
|
1939 1895 | };
|
1940 - | ::pretty_assertions::assert_eq!(
|
1941 - | input.blob,
|
1942 - | expected.blob,
|
1943 - | "Unexpected value for `blob`"
|
1944 - | );
|
1945 - | ::pretty_assertions::assert_eq!(
|
1946 - | input.boolean,
|
1947 - | expected.boolean,
|
1948 - | "Unexpected value for `boolean`"
|
1949 - | );
|
1950 - | assert!(
|
1951 - | input.double.float_equals(&expected.double),
|
1952 - | "Unexpected value for `double` {:?} vs. {:?}",
|
1953 - | expected.double,
|
1954 - | input.double
|
1955 - | );
|
1956 - | ::pretty_assertions::assert_eq!(
|
1957 - | input.empty_struct,
|
1958 - | expected.empty_struct,
|
1959 - | "Unexpected value for `empty_struct`"
|
1960 - | );
|
1961 - | assert!(
|
1962 - | input.float.float_equals(&expected.float),
|
1963 - | "Unexpected value for `float` {:?} vs. {:?}",
|
1964 - | expected.float,
|
1965 - | input.float
|
1966 - | );
|
1967 - | ::pretty_assertions::assert_eq!(
|
1968 - | input.httpdate_timestamp,
|
1969 - | expected.httpdate_timestamp,
|
1970 - | "Unexpected value for `httpdate_timestamp`"
|
1971 - | );
|
1972 - | ::pretty_assertions::assert_eq!(
|
1973 - | input.integer,
|
1974 - | expected.integer,
|
1975 - | "Unexpected value for `integer`"
|
1976 - | );
|
1977 - | ::pretty_assertions::assert_eq!(
|
1978 - | input.iso8601_timestamp,
|
1979 - | expected.iso8601_timestamp,
|
1980 - | "Unexpected value for `iso8601_timestamp`"
|
1981 - | );
|
1982 - | ::pretty_assertions::assert_eq!(
|
1983 - | input.json_value,
|
1984 - | expected.json_value,
|
1985 - | "Unexpected value for `json_value`"
|
1986 - | );
|
1987 - | ::pretty_assertions::assert_eq!(
|
1988 - | input.list_of_lists,
|
1989 - | expected.list_of_lists,
|
1990 - | "Unexpected value for `list_of_lists`"
|
1991 - | );
|
1992 - | ::pretty_assertions::assert_eq!(
|
1993 - | input.list_of_maps_of_strings,
|
1994 - | expected.list_of_maps_of_strings,
|
1995 - | "Unexpected value for `list_of_maps_of_strings`"
|
1996 - | );
|
1997 - | ::pretty_assertions::assert_eq!(
|
1998 - | input.list_of_strings,
|
1999 - | expected.list_of_strings,
|
2000 - | "Unexpected value for `list_of_strings`"
|
2001 - | );
|
2002 - | ::pretty_assertions::assert_eq!(
|
2003 - | input.list_of_structs,
|
2004 - | expected.list_of_structs,
|
2005 - | "Unexpected value for `list_of_structs`"
|
2006 - | );
|
2007 - | ::pretty_assertions::assert_eq!(
|
2008 - | input.long,
|
2009 - | expected.long,
|
2010 - | "Unexpected value for `long`"
|
2011 - | );
|
2012 - | ::pretty_assertions::assert_eq!(
|
2013 - | input.map_of_lists_of_strings,
|
2014 - | expected.map_of_lists_of_strings,
|
2015 - | "Unexpected value for `map_of_lists_of_strings`"
|
2016 - | );
|
2017 - | ::pretty_assertions::assert_eq!(
|
2018 - | input.map_of_maps,
|
2019 - | expected.map_of_maps,
|
2020 - | "Unexpected value for `map_of_maps`"
|
2021 - | );
|
2022 - | ::pretty_assertions::assert_eq!(
|
2023 - | input.map_of_strings,
|
2024 - | expected.map_of_strings,
|
2025 - | "Unexpected value for `map_of_strings`"
|
2026 - | );
|
2027 - | ::pretty_assertions::assert_eq!(
|
2028 - | input.map_of_structs,
|
2029 - | expected.map_of_structs,
|
2030 - | "Unexpected value for `map_of_structs`"
|
2031 - | );
|
2032 - | ::pretty_assertions::assert_eq!(
|
2033 - | input.recursive_list,
|
2034 - | expected.recursive_list,
|
2035 - | "Unexpected value for `recursive_list`"
|
2036 - | );
|
2037 - | ::pretty_assertions::assert_eq!(
|
2038 - | input.recursive_map,
|
2039 - | expected.recursive_map,
|
2040 - | "Unexpected value for `recursive_map`"
|
2041 - | );
|
2042 - | ::pretty_assertions::assert_eq!(
|
2043 - | input.recursive_struct,
|
2044 - | expected.recursive_struct,
|
2045 - | "Unexpected value for `recursive_struct`"
|
2046 - | );
|
2047 - | ::pretty_assertions::assert_eq!(
|
2048 - | input.simple_struct,
|
2049 - | expected.simple_struct,
|
2050 - | "Unexpected value for `simple_struct`"
|
2051 - | );
|
2052 - | ::pretty_assertions::assert_eq!(
|
2053 - | input.string,
|
2054 - | expected.string,
|
2055 - | "Unexpected value for `string`"
|
2056 - | );
|
2057 - | ::pretty_assertions::assert_eq!(
|
2058 - | input.struct_with_json_name,
|
2059 - | expected.struct_with_json_name,
|
2060 - | "Unexpected value for `struct_with_json_name`"
|
2061 - | );
|
2062 - | ::pretty_assertions::assert_eq!(
|
2063 - | input.timestamp,
|
2064 - | expected.timestamp,
|
2065 - | "Unexpected value for `timestamp`"
|
2066 - | );
|
2067 - | ::pretty_assertions::assert_eq!(
|
2068 - | input.unix_timestamp,
|
2069 - | expected.unix_timestamp,
|
2070 - | "Unexpected value for `unix_timestamp`"
|
2071 - | );
|
2072 - | let response = crate::output::KitchenSinkOperationOutput {
|
2073 - | blob: ::std::option::Option::None,
|
2074 - | boolean: ::std::option::Option::None,
|
2075 - | double: ::std::option::Option::None,
|
2076 - | empty_struct: ::std::option::Option::None,
|
2077 - | float: ::std::option::Option::None,
|
2078 - | httpdate_timestamp: ::std::option::Option::None,
|
2079 - | integer: ::std::option::Option::None,
|
2080 - | iso8601_timestamp: ::std::option::Option::None,
|
2081 - | json_value: ::std::option::Option::None,
|
2082 - | list_of_lists: ::std::option::Option::None,
|
2083 - | list_of_maps_of_strings: ::std::option::Option::None,
|
2084 - | list_of_strings: ::std::option::Option::None,
|
2085 - | list_of_structs: ::std::option::Option::None,
|
2086 - | long: ::std::option::Option::None,
|
2087 - | map_of_lists_of_strings: ::std::option::Option::None,
|
2088 - | map_of_maps: ::std::option::Option::None,
|
2089 - | map_of_strings: ::std::option::Option::None,
|
2090 - | map_of_structs: ::std::option::Option::None,
|
2091 - | recursive_list: ::std::option::Option::None,
|
2092 - | recursive_map: ::std::option::Option::None,
|
2093 - | recursive_struct: ::std::option::Option::None,
|
2094 - | simple_struct: ::std::option::Option::None,
|
2095 - | string: ::std::option::Option::None,
|
2096 - | struct_with_json_name: ::std::option::Option::None,
|
2097 - | timestamp: ::std::option::Option::None,
|
2098 - | unix_timestamp: ::std::option::Option::None,
|
1896 + | ::pretty_assertions::assert_eq!(input, expected);
|
1897 + | let response = crate::output::SparseNullsOperationOutput {
|
1898 + | sparse_string_list: ::std::option::Option::None,
|
1899 + | sparse_string_map: ::std::option::Option::None,
|
2099 1900 | };
|
2100 - | Ok(response)
|
1901 + | response
|
2101 1902 | };
|
2102 1903 | sender.send(()).await.expect("receiver dropped early");
|
2103 1904 | result
|
2104 1905 | }
|
2105 1906 | })
|
2106 1907 | .build_unchecked();
|
2107 1908 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2108 1909 | .await
|
2109 1910 | .expect("unable to make an HTTP request");
|
2110 - | assert!(receiver.recv().await.is_some());
|
1911 + | assert!(
|
1912 + | receiver.recv().await.is_some(),
|
1913 + | "we expected operation handler to be invoked but it was not entered"
|
1914 + | );
|
2111 1915 | }
|
2112 - | /// Serializes float shapes
|
2113 - | /// Test ID: serializes_float_shapes
|
1916 + | /// Deserializes null values in maps
|
1917 + | /// Test ID: AwsJson11SparseMapsDeserializeNullValues
|
2114 1918 | #[::tokio::test]
|
2115 - | async fn serializes_float_shapes_request() {
|
2116 - | #[allow(unused_mut)]
|
2117 - | let mut http_request = http::Request::builder()
|
2118 - | .uri("/")
|
2119 - | .method("POST")
|
2120 - | .header("Content-Type", "application/x-amz-json-1.1")
|
2121 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
2122 - | .body(::aws_smithy_http_server::body::Body::from(
|
2123 - | ::bytes::Bytes::from_static("{\"Float\":1234.5}".as_bytes()),
|
2124 - | ))
|
2125 - | .unwrap();
|
2126 - | #[allow(unused_mut)]
|
2127 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2128 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
2129 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2130 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
2131 - | let sender = sender.clone();
|
2132 - | async move {
|
2133 - | let result = {
|
2134 - | use ::aws_smithy_protocol_test::FloatEquals;
|
2135 - | let expected = crate::input::KitchenSinkOperationInput {
|
2136 - | float: ::std::option::Option::Some(1234.5_f32),
|
2137 - | blob: ::std::option::Option::None,
|
2138 - | boolean: ::std::option::Option::None,
|
2139 - | double: ::std::option::Option::None,
|
2140 - | empty_struct: ::std::option::Option::None,
|
2141 - | httpdate_timestamp: ::std::option::Option::None,
|
2142 - | integer: ::std::option::Option::None,
|
2143 - | iso8601_timestamp: ::std::option::Option::None,
|
2144 - | json_value: ::std::option::Option::None,
|
2145 - | list_of_lists: ::std::option::Option::None,
|
2146 - | list_of_maps_of_strings: ::std::option::Option::None,
|
2147 - | list_of_strings: ::std::option::Option::None,
|
2148 - | list_of_structs: ::std::option::Option::None,
|
2149 - | long: ::std::option::Option::None,
|
2150 - | map_of_lists_of_strings: ::std::option::Option::None,
|
2151 - | map_of_maps: ::std::option::Option::None,
|
2152 - | map_of_strings: ::std::option::Option::None,
|
2153 - | map_of_structs: ::std::option::Option::None,
|
2154 - | recursive_list: ::std::option::Option::None,
|
2155 - | recursive_map: ::std::option::Option::None,
|
2156 - | recursive_struct: ::std::option::Option::None,
|
2157 - | simple_struct: ::std::option::Option::None,
|
2158 - | string: ::std::option::Option::None,
|
2159 - | struct_with_json_name: ::std::option::Option::None,
|
2160 - | timestamp: ::std::option::Option::None,
|
2161 - | unix_timestamp: ::std::option::Option::None,
|
2162 - | };
|
2163 - | ::pretty_assertions::assert_eq!(
|
2164 - | input.blob,
|
2165 - | expected.blob,
|
2166 - | "Unexpected value for `blob`"
|
2167 - | );
|
2168 - | ::pretty_assertions::assert_eq!(
|
2169 - | input.boolean,
|
2170 - | expected.boolean,
|
2171 - | "Unexpected value for `boolean`"
|
2172 - | );
|
2173 - | assert!(
|
2174 - | input.double.float_equals(&expected.double),
|
2175 - | "Unexpected value for `double` {:?} vs. {:?}",
|
2176 - | expected.double,
|
2177 - | input.double
|
2178 - | );
|
2179 - | ::pretty_assertions::assert_eq!(
|
2180 - | input.empty_struct,
|
2181 - | expected.empty_struct,
|
2182 - | "Unexpected value for `empty_struct`"
|
2183 - | );
|
2184 - | assert!(
|
2185 - | input.float.float_equals(&expected.float),
|
2186 - | "Unexpected value for `float` {:?} vs. {:?}",
|
2187 - | expected.float,
|
2188 - | input.float
|
2189 - | );
|
2190 - | ::pretty_assertions::assert_eq!(
|
2191 - | input.httpdate_timestamp,
|
2192 - | expected.httpdate_timestamp,
|
2193 - | "Unexpected value for `httpdate_timestamp`"
|
2194 - | );
|
2195 - | ::pretty_assertions::assert_eq!(
|
2196 - | input.integer,
|
2197 - | expected.integer,
|
2198 - | "Unexpected value for `integer`"
|
2199 - | );
|
2200 - | ::pretty_assertions::assert_eq!(
|
2201 - | input.iso8601_timestamp,
|
2202 - | expected.iso8601_timestamp,
|
2203 - | "Unexpected value for `iso8601_timestamp`"
|
2204 - | );
|
2205 - | ::pretty_assertions::assert_eq!(
|
2206 - | input.json_value,
|
2207 - | expected.json_value,
|
2208 - | "Unexpected value for `json_value`"
|
2209 - | );
|
2210 - | ::pretty_assertions::assert_eq!(
|
2211 - | input.list_of_lists,
|
2212 - | expected.list_of_lists,
|
2213 - | "Unexpected value for `list_of_lists`"
|
2214 - | );
|
2215 - | ::pretty_assertions::assert_eq!(
|
2216 - | input.list_of_maps_of_strings,
|
2217 - | expected.list_of_maps_of_strings,
|
2218 - | "Unexpected value for `list_of_maps_of_strings`"
|
2219 - | );
|
2220 - | ::pretty_assertions::assert_eq!(
|
2221 - | input.list_of_strings,
|
2222 - | expected.list_of_strings,
|
2223 - | "Unexpected value for `list_of_strings`"
|
2224 - | );
|
2225 - | ::pretty_assertions::assert_eq!(
|
2226 - | input.list_of_structs,
|
2227 - | expected.list_of_structs,
|
2228 - | "Unexpected value for `list_of_structs`"
|
2229 - | );
|
2230 - | ::pretty_assertions::assert_eq!(
|
2231 - | input.long,
|
2232 - | expected.long,
|
2233 - | "Unexpected value for `long`"
|
2234 - | );
|
2235 - | ::pretty_assertions::assert_eq!(
|
2236 - | input.map_of_lists_of_strings,
|
2237 - | expected.map_of_lists_of_strings,
|
2238 - | "Unexpected value for `map_of_lists_of_strings`"
|
2239 - | );
|
2240 - | ::pretty_assertions::assert_eq!(
|
2241 - | input.map_of_maps,
|
2242 - | expected.map_of_maps,
|
2243 - | "Unexpected value for `map_of_maps`"
|
2244 - | );
|
2245 - | ::pretty_assertions::assert_eq!(
|
2246 - | input.map_of_strings,
|
2247 - | expected.map_of_strings,
|
2248 - | "Unexpected value for `map_of_strings`"
|
2249 - | );
|
2250 - | ::pretty_assertions::assert_eq!(
|
2251 - | input.map_of_structs,
|
2252 - | expected.map_of_structs,
|
2253 - | "Unexpected value for `map_of_structs`"
|
2254 - | );
|
2255 - | ::pretty_assertions::assert_eq!(
|
2256 - | input.recursive_list,
|
2257 - | expected.recursive_list,
|
2258 - | "Unexpected value for `recursive_list`"
|
2259 - | );
|
2260 - | ::pretty_assertions::assert_eq!(
|
2261 - | input.recursive_map,
|
2262 - | expected.recursive_map,
|
2263 - | "Unexpected value for `recursive_map`"
|
2264 - | );
|
2265 - | ::pretty_assertions::assert_eq!(
|
2266 - | input.recursive_struct,
|
2267 - | expected.recursive_struct,
|
2268 - | "Unexpected value for `recursive_struct`"
|
2269 - | );
|
2270 - | ::pretty_assertions::assert_eq!(
|
2271 - | input.simple_struct,
|
2272 - | expected.simple_struct,
|
2273 - | "Unexpected value for `simple_struct`"
|
2274 - | );
|
2275 - | ::pretty_assertions::assert_eq!(
|
2276 - | input.string,
|
2277 - | expected.string,
|
2278 - | "Unexpected value for `string`"
|
2279 - | );
|
2280 - | ::pretty_assertions::assert_eq!(
|
2281 - | input.struct_with_json_name,
|
2282 - | expected.struct_with_json_name,
|
2283 - | "Unexpected value for `struct_with_json_name`"
|
2284 - | );
|
2285 - | ::pretty_assertions::assert_eq!(
|
2286 - | input.timestamp,
|
2287 - | expected.timestamp,
|
2288 - | "Unexpected value for `timestamp`"
|
2289 - | );
|
2290 - | ::pretty_assertions::assert_eq!(
|
2291 - | input.unix_timestamp,
|
2292 - | expected.unix_timestamp,
|
2293 - | "Unexpected value for `unix_timestamp`"
|
2294 - | );
|
2295 - | let response = crate::output::KitchenSinkOperationOutput {
|
2296 - | blob: ::std::option::Option::None,
|
2297 - | boolean: ::std::option::Option::None,
|
2298 - | double: ::std::option::Option::None,
|
2299 - | empty_struct: ::std::option::Option::None,
|
2300 - | float: ::std::option::Option::None,
|
2301 - | httpdate_timestamp: ::std::option::Option::None,
|
2302 - | integer: ::std::option::Option::None,
|
2303 - | iso8601_timestamp: ::std::option::Option::None,
|
2304 - | json_value: ::std::option::Option::None,
|
2305 - | list_of_lists: ::std::option::Option::None,
|
2306 - | list_of_maps_of_strings: ::std::option::Option::None,
|
2307 - | list_of_strings: ::std::option::Option::None,
|
2308 - | list_of_structs: ::std::option::Option::None,
|
2309 - | long: ::std::option::Option::None,
|
2310 - | map_of_lists_of_strings: ::std::option::Option::None,
|
2311 - | map_of_maps: ::std::option::Option::None,
|
2312 - | map_of_strings: ::std::option::Option::None,
|
2313 - | map_of_structs: ::std::option::Option::None,
|
2314 - | recursive_list: ::std::option::Option::None,
|
2315 - | recursive_map: ::std::option::Option::None,
|
2316 - | recursive_struct: ::std::option::Option::None,
|
2317 - | simple_struct: ::std::option::Option::None,
|
2318 - | string: ::std::option::Option::None,
|
2319 - | struct_with_json_name: ::std::option::Option::None,
|
2320 - | timestamp: ::std::option::Option::None,
|
2321 - | unix_timestamp: ::std::option::Option::None,
|
2322 - | };
|
2323 - | Ok(response)
|
2324 - | };
|
2325 - | sender.send(()).await.expect("receiver dropped early");
|
2326 - | result
|
2327 - | }
|
2328 - | })
|
2329 - | .build_unchecked();
|
2330 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1919 + | #[::tracing_test::traced_test]
|
1920 + | async fn aws_json11_sparse_maps_deserialize_null_values_response() {
|
1921 + | let output = crate::output::SparseNullsOperationOutput {
|
1922 + | sparse_string_map: ::std::option::Option::Some({
|
1923 + | let mut ret = ::std::collections::HashMap::new();
|
1924 + | ret.insert("foo".to_owned(), ::std::option::Option::None);
|
1925 + | ret
|
1926 + | }),
|
1927 + | sparse_string_list: ::std::option::Option::None,
|
1928 + | };
|
1929 + | use ::aws_smithy_http_server::response::IntoResponse;
|
1930 + | let http_response = output.into_response();
|
1931 + | ::pretty_assertions::assert_eq!(
|
1932 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1933 + | http_response.status()
|
1934 + | );
|
1935 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1936 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1937 + | http_response.headers(),
|
1938 + | expected_headers,
|
1939 + | ));
|
1940 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2331 1941 | .await
|
2332 - | .expect("unable to make an HTTP request");
|
2333 - | assert!(receiver.recv().await.is_some());
|
1942 + | .expect("unable to extract body to bytes");
|
1943 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1944 + | &body,
|
1945 + | "{\n \"sparseStringMap\": {\n \"foo\": null\n }\n}",
|
1946 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1947 + | ));
|
2334 1948 | }
|
2335 - | /// Serializes double shapes
|
2336 - | /// Test ID: serializes_double_shapes
|
1949 + | /// Deserializes null values in lists
|
1950 + | /// Test ID: AwsJson11SparseListsDeserializeNull
|
2337 1951 | #[::tokio::test]
|
2338 - | async fn serializes_double_shapes_request() {
|
2339 - | #[allow(unused_mut)]
|
2340 - | let mut http_request = http::Request::builder()
|
2341 - | .uri("/")
|
2342 - | .method("POST")
|
2343 - | .header("Content-Type", "application/x-amz-json-1.1")
|
2344 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
2345 - | .body(::aws_smithy_http_server::body::Body::from(
|
2346 - | ::bytes::Bytes::from_static("{\"Double\":1234.5}".as_bytes()),
|
2347 - | ))
|
2348 - | .unwrap();
|
2349 - | #[allow(unused_mut)]
|
2350 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2351 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
2352 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2353 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
2354 - | let sender = sender.clone();
|
2355 - | async move {
|
2356 - | let result = {
|
2357 - | use ::aws_smithy_protocol_test::FloatEquals;
|
2358 - | let expected = crate::input::KitchenSinkOperationInput {
|
2359 - | double: ::std::option::Option::Some(1234.5_f64),
|
2360 - | blob: ::std::option::Option::None,
|
2361 - | boolean: ::std::option::Option::None,
|
2362 - | empty_struct: ::std::option::Option::None,
|
2363 - | float: ::std::option::Option::None,
|
2364 - | httpdate_timestamp: ::std::option::Option::None,
|
2365 - | integer: ::std::option::Option::None,
|
2366 - | iso8601_timestamp: ::std::option::Option::None,
|
2367 - | json_value: ::std::option::Option::None,
|
2368 - | list_of_lists: ::std::option::Option::None,
|
2369 - | list_of_maps_of_strings: ::std::option::Option::None,
|
2370 - | list_of_strings: ::std::option::Option::None,
|
2371 - | list_of_structs: ::std::option::Option::None,
|
2372 - | long: ::std::option::Option::None,
|
2373 - | map_of_lists_of_strings: ::std::option::Option::None,
|
2374 - | map_of_maps: ::std::option::Option::None,
|
2375 - | map_of_strings: ::std::option::Option::None,
|
2376 - | map_of_structs: ::std::option::Option::None,
|
2377 - | recursive_list: ::std::option::Option::None,
|
2378 - | recursive_map: ::std::option::Option::None,
|
2379 - | recursive_struct: ::std::option::Option::None,
|
2380 - | simple_struct: ::std::option::Option::None,
|
2381 - | string: ::std::option::Option::None,
|
2382 - | struct_with_json_name: ::std::option::Option::None,
|
2383 - | timestamp: ::std::option::Option::None,
|
2384 - | unix_timestamp: ::std::option::Option::None,
|
2385 - | };
|
2386 - | ::pretty_assertions::assert_eq!(
|
2387 - | input.blob,
|
2388 - | expected.blob,
|
2389 - | "Unexpected value for `blob`"
|
2390 - | );
|
2391 - | ::pretty_assertions::assert_eq!(
|
2392 - | input.boolean,
|
2393 - | expected.boolean,
|
2394 - | "Unexpected value for `boolean`"
|
2395 - | );
|
2396 - | assert!(
|
2397 - | input.double.float_equals(&expected.double),
|
2398 - | "Unexpected value for `double` {:?} vs. {:?}",
|
2399 - | expected.double,
|
2400 - | input.double
|
2401 - | );
|
2402 - | ::pretty_assertions::assert_eq!(
|
2403 - | input.empty_struct,
|
2404 - | expected.empty_struct,
|
2405 - | "Unexpected value for `empty_struct`"
|
2406 - | );
|
2407 - | assert!(
|
2408 - | input.float.float_equals(&expected.float),
|
2409 - | "Unexpected value for `float` {:?} vs. {:?}",
|
2410 - | expected.float,
|
2411 - | input.float
|
2412 - | );
|
2413 - | ::pretty_assertions::assert_eq!(
|
2414 - | input.httpdate_timestamp,
|
2415 - | expected.httpdate_timestamp,
|
2416 - | "Unexpected value for `httpdate_timestamp`"
|
2417 - | );
|
2418 - | ::pretty_assertions::assert_eq!(
|
2419 - | input.integer,
|
2420 - | expected.integer,
|
2421 - | "Unexpected value for `integer`"
|
2422 - | );
|
2423 - | ::pretty_assertions::assert_eq!(
|
2424 - | input.iso8601_timestamp,
|
2425 - | expected.iso8601_timestamp,
|
2426 - | "Unexpected value for `iso8601_timestamp`"
|
2427 - | );
|
2428 - | ::pretty_assertions::assert_eq!(
|
2429 - | input.json_value,
|
2430 - | expected.json_value,
|
2431 - | "Unexpected value for `json_value`"
|
2432 - | );
|
2433 - | ::pretty_assertions::assert_eq!(
|
2434 - | input.list_of_lists,
|
2435 - | expected.list_of_lists,
|
2436 - | "Unexpected value for `list_of_lists`"
|
2437 - | );
|
2438 - | ::pretty_assertions::assert_eq!(
|
2439 - | input.list_of_maps_of_strings,
|
2440 - | expected.list_of_maps_of_strings,
|
2441 - | "Unexpected value for `list_of_maps_of_strings`"
|
2442 - | );
|
2443 - | ::pretty_assertions::assert_eq!(
|
2444 - | input.list_of_strings,
|
2445 - | expected.list_of_strings,
|
2446 - | "Unexpected value for `list_of_strings`"
|
2447 - | );
|
2448 - | ::pretty_assertions::assert_eq!(
|
2449 - | input.list_of_structs,
|
2450 - | expected.list_of_structs,
|
2451 - | "Unexpected value for `list_of_structs`"
|
2452 - | );
|
2453 - | ::pretty_assertions::assert_eq!(
|
2454 - | input.long,
|
2455 - | expected.long,
|
2456 - | "Unexpected value for `long`"
|
2457 - | );
|
2458 - | ::pretty_assertions::assert_eq!(
|
2459 - | input.map_of_lists_of_strings,
|
2460 - | expected.map_of_lists_of_strings,
|
2461 - | "Unexpected value for `map_of_lists_of_strings`"
|
2462 - | );
|
2463 - | ::pretty_assertions::assert_eq!(
|
2464 - | input.map_of_maps,
|
2465 - | expected.map_of_maps,
|
2466 - | "Unexpected value for `map_of_maps`"
|
2467 - | );
|
2468 - | ::pretty_assertions::assert_eq!(
|
2469 - | input.map_of_strings,
|
2470 - | expected.map_of_strings,
|
2471 - | "Unexpected value for `map_of_strings`"
|
2472 - | );
|
2473 - | ::pretty_assertions::assert_eq!(
|
2474 - | input.map_of_structs,
|
2475 - | expected.map_of_structs,
|
2476 - | "Unexpected value for `map_of_structs`"
|
2477 - | );
|
2478 - | ::pretty_assertions::assert_eq!(
|
2479 - | input.recursive_list,
|
2480 - | expected.recursive_list,
|
2481 - | "Unexpected value for `recursive_list`"
|
2482 - | );
|
2483 - | ::pretty_assertions::assert_eq!(
|
2484 - | input.recursive_map,
|
2485 - | expected.recursive_map,
|
2486 - | "Unexpected value for `recursive_map`"
|
2487 - | );
|
2488 - | ::pretty_assertions::assert_eq!(
|
2489 - | input.recursive_struct,
|
2490 - | expected.recursive_struct,
|
2491 - | "Unexpected value for `recursive_struct`"
|
2492 - | );
|
2493 - | ::pretty_assertions::assert_eq!(
|
2494 - | input.simple_struct,
|
2495 - | expected.simple_struct,
|
2496 - | "Unexpected value for `simple_struct`"
|
2497 - | );
|
2498 - | ::pretty_assertions::assert_eq!(
|
2499 - | input.string,
|
2500 - | expected.string,
|
2501 - | "Unexpected value for `string`"
|
2502 - | );
|
2503 - | ::pretty_assertions::assert_eq!(
|
2504 - | input.struct_with_json_name,
|
2505 - | expected.struct_with_json_name,
|
2506 - | "Unexpected value for `struct_with_json_name`"
|
2507 - | );
|
2508 - | ::pretty_assertions::assert_eq!(
|
2509 - | input.timestamp,
|
2510 - | expected.timestamp,
|
2511 - | "Unexpected value for `timestamp`"
|
2512 - | );
|
2513 - | ::pretty_assertions::assert_eq!(
|
2514 - | input.unix_timestamp,
|
2515 - | expected.unix_timestamp,
|
2516 - | "Unexpected value for `unix_timestamp`"
|
2517 - | );
|
2518 - | let response = crate::output::KitchenSinkOperationOutput {
|
2519 - | blob: ::std::option::Option::None,
|
2520 - | boolean: ::std::option::Option::None,
|
2521 - | double: ::std::option::Option::None,
|
2522 - | empty_struct: ::std::option::Option::None,
|
2523 - | float: ::std::option::Option::None,
|
2524 - | httpdate_timestamp: ::std::option::Option::None,
|
2525 - | integer: ::std::option::Option::None,
|
2526 - | iso8601_timestamp: ::std::option::Option::None,
|
2527 - | json_value: ::std::option::Option::None,
|
2528 - | list_of_lists: ::std::option::Option::None,
|
2529 - | list_of_maps_of_strings: ::std::option::Option::None,
|
2530 - | list_of_strings: ::std::option::Option::None,
|
2531 - | list_of_structs: ::std::option::Option::None,
|
2532 - | long: ::std::option::Option::None,
|
2533 - | map_of_lists_of_strings: ::std::option::Option::None,
|
2534 - | map_of_maps: ::std::option::Option::None,
|
2535 - | map_of_strings: ::std::option::Option::None,
|
2536 - | map_of_structs: ::std::option::Option::None,
|
2537 - | recursive_list: ::std::option::Option::None,
|
2538 - | recursive_map: ::std::option::Option::None,
|
2539 - | recursive_struct: ::std::option::Option::None,
|
2540 - | simple_struct: ::std::option::Option::None,
|
2541 - | string: ::std::option::Option::None,
|
2542 - | struct_with_json_name: ::std::option::Option::None,
|
2543 - | timestamp: ::std::option::Option::None,
|
2544 - | unix_timestamp: ::std::option::Option::None,
|
2545 - | };
|
2546 - | Ok(response)
|
2547 - | };
|
2548 - | sender.send(()).await.expect("receiver dropped early");
|
2549 - | result
|
2550 - | }
|
2551 - | })
|
2552 - | .build_unchecked();
|
2553 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1952 + | #[::tracing_test::traced_test]
|
1953 + | async fn aws_json11_sparse_lists_deserialize_null_response() {
|
1954 + | let output = crate::output::SparseNullsOperationOutput {
|
1955 + | sparse_string_list: ::std::option::Option::Some(vec![::std::option::Option::None]),
|
1956 + | sparse_string_map: ::std::option::Option::None,
|
1957 + | };
|
1958 + | use ::aws_smithy_http_server::response::IntoResponse;
|
1959 + | let http_response = output.into_response();
|
1960 + | ::pretty_assertions::assert_eq!(
|
1961 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1962 + | http_response.status()
|
1963 + | );
|
1964 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1965 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1966 + | http_response.headers(),
|
1967 + | expected_headers,
|
1968 + | ));
|
1969 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2554 1970 | .await
|
2555 - | .expect("unable to make an HTTP request");
|
2556 - | assert!(receiver.recv().await.is_some());
|
1971 + | .expect("unable to extract body to bytes");
|
1972 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1973 + | &body,
|
1974 + | "{\n \"sparseStringList\": [\n null\n ]\n}",
|
1975 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1976 + | ));
|
2557 1977 | }
|
2558 - | /// Serializes blob shapes
|
2559 - | /// Test ID: serializes_blob_shapes
|
1978 + | }
|
1979 + |
|
1980 + | static CONTENT_TYPE_NULLOPERATION: ::once_cell::sync::Lazy<::mime::Mime> =
|
1981 + | ::once_cell::sync::Lazy::new(|| {
|
1982 + | "application/x-amz-json-1.1"
|
1983 + | .parse::<::mime::Mime>()
|
1984 + | .expect("BUG: MIME parsing failed, content_type is not valid")
|
1985 + | });
|
1986 + | ::pin_project_lite::pin_project! {
|
1987 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
1988 + | /// [`NullOperationInput`](crate::input::NullOperationInput) using modelled bindings.
|
1989 + | pub struct NullOperationInputFuture {
|
1990 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::NullOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
1991 + | }
|
1992 + | }
|
1993 + |
|
1994 + | impl std::future::Future for NullOperationInputFuture {
|
1995 + | type Output = Result<
|
1996 + | crate::input::NullOperationInput,
|
1997 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
1998 + | >;
|
1999 + |
|
2000 + | fn poll(
|
2001 + | self: std::pin::Pin<&mut Self>,
|
2002 + | cx: &mut std::task::Context<'_>,
|
2003 + | ) -> std::task::Poll<Self::Output> {
|
2004 + | let this = self.project();
|
2005 + | this.inner.as_mut().poll(cx)
|
2006 + | }
|
2007 + | }
|
2008 + |
|
2009 + | impl<B>
|
2010 + | ::aws_smithy_http_server::request::FromRequest<
|
2011 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2012 + | B,
|
2013 + | > for crate::input::NullOperationInput
|
2014 + | where
|
2015 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
2016 + | B: 'static,
|
2017 + |
|
2018 + | B::Data: Send,
|
2019 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
2020 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
2021 + | {
|
2022 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
2023 + | type Future = NullOperationInputFuture;
|
2024 + |
|
2025 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2026 + | let fut = async move {
|
2027 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
2028 + | request.headers(),
|
2029 + | &CONTENT_TYPE_NULLOPERATION,
|
2030 + | ) {
|
2031 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
2032 + | }
|
2033 + | crate::protocol_serde::shape_null_operation::de_null_operation_http_request(request)
|
2034 + | .await
|
2035 + | .map_err(Into::into)
|
2036 + | };
|
2037 + | use ::futures_util::future::TryFutureExt;
|
2038 + | let fut = fut.map_err(
|
2039 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
2040 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2041 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
2042 + | },
|
2043 + | );
|
2044 + | NullOperationInputFuture {
|
2045 + | inner: Box::pin(fut),
|
2046 + | }
|
2047 + | }
|
2048 + | }
|
2049 + | impl
|
2050 + | ::aws_smithy_http_server::response::IntoResponse<
|
2051 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2052 + | > for crate::output::NullOperationOutput
|
2053 + | {
|
2054 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
2055 + | match crate::protocol_serde::shape_null_operation::ser_null_operation_http_response(self) {
|
2056 + | Ok(response) => response,
|
2057 + | Err(e) => {
|
2058 + | ::tracing::error!(error = %e, "failed to serialize response");
|
2059 + | ::aws_smithy_http_server::response::IntoResponse::<
|
2060 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2061 + | >::into_response(
|
2062 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
2063 + | e,
|
2064 + | ),
|
2065 + | )
|
2066 + | }
|
2067 + | }
|
2068 + | }
|
2069 + | }
|
2070 + |
|
2071 + | #[allow(unreachable_code, unused_variables)]
|
2072 + | #[cfg(test)]
|
2073 + | mod null_operation_test {
|
2074 + |
|
2075 + | /// Null structure values are dropped
|
2076 + | /// Test ID: AwsJson11ServersDontDeserializeNullStructureValues
|
2560 2077 | #[::tokio::test]
|
2561 - | async fn serializes_blob_shapes_request() {
|
2078 + | #[::tracing_test::traced_test]
|
2079 + | async fn aws_json11_servers_dont_deserialize_null_structure_values_request() {
|
2562 2080 | #[allow(unused_mut)]
|
2563 2081 | let mut http_request = http::Request::builder()
|
2564 2082 | .uri("/")
|
2565 2083 | .method("POST")
|
2566 2084 | .header("Content-Type", "application/x-amz-json-1.1")
|
2567 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
2085 + | .header("X-Amz-Target", "JsonProtocol.NullOperation")
|
2568 2086 | .body(::aws_smithy_http_server::body::Body::from(
|
2569 - | ::bytes::Bytes::from_static("{\"Blob\":\"YmluYXJ5LXZhbHVl\"}".as_bytes()),
|
2087 + | ::bytes::Bytes::from_static("{\n \"string\": null\n}".as_bytes()),
|
2570 2088 | ))
|
2571 2089 | .unwrap();
|
2572 2090 | #[allow(unused_mut)]
|
2573 2091 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2574 2092 | let config = crate::service::JsonProtocolConfig::builder().build();
|
2575 2093 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2576 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
2094 + | .null_operation(move |input: crate::input::NullOperationInput| {
|
2577 2095 | let sender = sender.clone();
|
2578 2096 | async move {
|
2579 2097 | let result = {
|
2580 - | use ::aws_smithy_protocol_test::FloatEquals;
|
2581 - | let expected = crate::input::KitchenSinkOperationInput {
|
2582 - | blob: ::std::option::Option::Some(::aws_smithy_types::Blob::new(
|
2583 - | "binary-value",
|
2584 - | )),
|
2585 - | boolean: ::std::option::Option::None,
|
2586 - | double: ::std::option::Option::None,
|
2587 - | empty_struct: ::std::option::Option::None,
|
2588 - | float: ::std::option::Option::None,
|
2589 - | httpdate_timestamp: ::std::option::Option::None,
|
2590 - | integer: ::std::option::Option::None,
|
2591 - | iso8601_timestamp: ::std::option::Option::None,
|
2592 - | json_value: ::std::option::Option::None,
|
2593 - | list_of_lists: ::std::option::Option::None,
|
2594 - | list_of_maps_of_strings: ::std::option::Option::None,
|
2595 - | list_of_strings: ::std::option::Option::None,
|
2596 - | list_of_structs: ::std::option::Option::None,
|
2597 - | long: ::std::option::Option::None,
|
2598 - | map_of_lists_of_strings: ::std::option::Option::None,
|
2599 - | map_of_maps: ::std::option::Option::None,
|
2600 - | map_of_strings: ::std::option::Option::None,
|
2601 - | map_of_structs: ::std::option::Option::None,
|
2602 - | recursive_list: ::std::option::Option::None,
|
2603 - | recursive_map: ::std::option::Option::None,
|
2604 - | recursive_struct: ::std::option::Option::None,
|
2605 - | simple_struct: ::std::option::Option::None,
|
2098 + | let expected = crate::input::NullOperationInput {
|
2606 2099 | string: ::std::option::Option::None,
|
2607 - | struct_with_json_name: ::std::option::Option::None,
|
2608 - | timestamp: ::std::option::Option::None,
|
2609 - | unix_timestamp: ::std::option::Option::None,
|
2610 2100 | };
|
2611 - | ::pretty_assertions::assert_eq!(
|
2612 - | input.blob,
|
2613 - | expected.blob,
|
2614 - | "Unexpected value for `blob`"
|
2615 - | );
|
2616 - | ::pretty_assertions::assert_eq!(
|
2617 - | input.boolean,
|
2618 - | expected.boolean,
|
2619 - | "Unexpected value for `boolean`"
|
2620 - | );
|
2621 - | assert!(
|
2622 - | input.double.float_equals(&expected.double),
|
2623 - | "Unexpected value for `double` {:?} vs. {:?}",
|
2624 - | expected.double,
|
2625 - | input.double
|
2626 - | );
|
2627 - | ::pretty_assertions::assert_eq!(
|
2628 - | input.empty_struct,
|
2629 - | expected.empty_struct,
|
2630 - | "Unexpected value for `empty_struct`"
|
2631 - | );
|
2632 - | assert!(
|
2633 - | input.float.float_equals(&expected.float),
|
2634 - | "Unexpected value for `float` {:?} vs. {:?}",
|
2635 - | expected.float,
|
2636 - | input.float
|
2637 - | );
|
2638 - | ::pretty_assertions::assert_eq!(
|
2639 - | input.httpdate_timestamp,
|
2640 - | expected.httpdate_timestamp,
|
2641 - | "Unexpected value for `httpdate_timestamp`"
|
2642 - | );
|
2643 - | ::pretty_assertions::assert_eq!(
|
2644 - | input.integer,
|
2645 - | expected.integer,
|
2646 - | "Unexpected value for `integer`"
|
2647 - | );
|
2648 - | ::pretty_assertions::assert_eq!(
|
2649 - | input.iso8601_timestamp,
|
2650 - | expected.iso8601_timestamp,
|
2651 - | "Unexpected value for `iso8601_timestamp`"
|
2652 - | );
|
2653 - | ::pretty_assertions::assert_eq!(
|
2654 - | input.json_value,
|
2655 - | expected.json_value,
|
2656 - | "Unexpected value for `json_value`"
|
2657 - | );
|
2658 - | ::pretty_assertions::assert_eq!(
|
2659 - | input.list_of_lists,
|
2660 - | expected.list_of_lists,
|
2661 - | "Unexpected value for `list_of_lists`"
|
2662 - | );
|
2663 - | ::pretty_assertions::assert_eq!(
|
2664 - | input.list_of_maps_of_strings,
|
2665 - | expected.list_of_maps_of_strings,
|
2666 - | "Unexpected value for `list_of_maps_of_strings`"
|
2667 - | );
|
2668 - | ::pretty_assertions::assert_eq!(
|
2669 - | input.list_of_strings,
|
2670 - | expected.list_of_strings,
|
2671 - | "Unexpected value for `list_of_strings`"
|
2672 - | );
|
2673 - | ::pretty_assertions::assert_eq!(
|
2674 - | input.list_of_structs,
|
2675 - | expected.list_of_structs,
|
2676 - | "Unexpected value for `list_of_structs`"
|
2677 - | );
|
2678 - | ::pretty_assertions::assert_eq!(
|
2679 - | input.long,
|
2680 - | expected.long,
|
2681 - | "Unexpected value for `long`"
|
2682 - | );
|
2683 - | ::pretty_assertions::assert_eq!(
|
2684 - | input.map_of_lists_of_strings,
|
2685 - | expected.map_of_lists_of_strings,
|
2686 - | "Unexpected value for `map_of_lists_of_strings`"
|
2687 - | );
|
2688 - | ::pretty_assertions::assert_eq!(
|
2689 - | input.map_of_maps,
|
2690 - | expected.map_of_maps,
|
2691 - | "Unexpected value for `map_of_maps`"
|
2692 - | );
|
2693 - | ::pretty_assertions::assert_eq!(
|
2694 - | input.map_of_strings,
|
2695 - | expected.map_of_strings,
|
2696 - | "Unexpected value for `map_of_strings`"
|
2697 - | );
|
2698 - | ::pretty_assertions::assert_eq!(
|
2699 - | input.map_of_structs,
|
2700 - | expected.map_of_structs,
|
2701 - | "Unexpected value for `map_of_structs`"
|
2702 - | );
|
2703 - | ::pretty_assertions::assert_eq!(
|
2704 - | input.recursive_list,
|
2705 - | expected.recursive_list,
|
2706 - | "Unexpected value for `recursive_list`"
|
2707 - | );
|
2708 - | ::pretty_assertions::assert_eq!(
|
2709 - | input.recursive_map,
|
2710 - | expected.recursive_map,
|
2711 - | "Unexpected value for `recursive_map`"
|
2712 - | );
|
2713 - | ::pretty_assertions::assert_eq!(
|
2714 - | input.recursive_struct,
|
2715 - | expected.recursive_struct,
|
2716 - | "Unexpected value for `recursive_struct`"
|
2717 - | );
|
2718 - | ::pretty_assertions::assert_eq!(
|
2719 - | input.simple_struct,
|
2720 - | expected.simple_struct,
|
2721 - | "Unexpected value for `simple_struct`"
|
2722 - | );
|
2723 - | ::pretty_assertions::assert_eq!(
|
2724 - | input.string,
|
2725 - | expected.string,
|
2726 - | "Unexpected value for `string`"
|
2727 - | );
|
2728 - | ::pretty_assertions::assert_eq!(
|
2729 - | input.struct_with_json_name,
|
2730 - | expected.struct_with_json_name,
|
2731 - | "Unexpected value for `struct_with_json_name`"
|
2732 - | );
|
2733 - | ::pretty_assertions::assert_eq!(
|
2734 - | input.timestamp,
|
2735 - | expected.timestamp,
|
2736 - | "Unexpected value for `timestamp`"
|
2737 - | );
|
2738 - | ::pretty_assertions::assert_eq!(
|
2739 - | input.unix_timestamp,
|
2740 - | expected.unix_timestamp,
|
2741 - | "Unexpected value for `unix_timestamp`"
|
2742 - | );
|
2743 - | let response = crate::output::KitchenSinkOperationOutput {
|
2744 - | blob: ::std::option::Option::None,
|
2745 - | boolean: ::std::option::Option::None,
|
2746 - | double: ::std::option::Option::None,
|
2747 - | empty_struct: ::std::option::Option::None,
|
2748 - | float: ::std::option::Option::None,
|
2749 - | httpdate_timestamp: ::std::option::Option::None,
|
2750 - | integer: ::std::option::Option::None,
|
2751 - | iso8601_timestamp: ::std::option::Option::None,
|
2752 - | json_value: ::std::option::Option::None,
|
2753 - | list_of_lists: ::std::option::Option::None,
|
2754 - | list_of_maps_of_strings: ::std::option::Option::None,
|
2755 - | list_of_strings: ::std::option::Option::None,
|
2756 - | list_of_structs: ::std::option::Option::None,
|
2757 - | long: ::std::option::Option::None,
|
2758 - | map_of_lists_of_strings: ::std::option::Option::None,
|
2759 - | map_of_maps: ::std::option::Option::None,
|
2760 - | map_of_strings: ::std::option::Option::None,
|
2761 - | map_of_structs: ::std::option::Option::None,
|
2762 - | recursive_list: ::std::option::Option::None,
|
2763 - | recursive_map: ::std::option::Option::None,
|
2764 - | recursive_struct: ::std::option::Option::None,
|
2765 - | simple_struct: ::std::option::Option::None,
|
2101 + | ::pretty_assertions::assert_eq!(input, expected);
|
2102 + | let response = crate::output::NullOperationOutput {
|
2766 2103 | string: ::std::option::Option::None,
|
2767 - | struct_with_json_name: ::std::option::Option::None,
|
2768 - | timestamp: ::std::option::Option::None,
|
2769 - | unix_timestamp: ::std::option::Option::None,
|
2770 2104 | };
|
2771 - | Ok(response)
|
2105 + | response
|
2772 2106 | };
|
2773 2107 | sender.send(()).await.expect("receiver dropped early");
|
2774 2108 | result
|
2775 2109 | }
|
2776 2110 | })
|
2777 2111 | .build_unchecked();
|
2778 2112 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2779 2113 | .await
|
2780 2114 | .expect("unable to make an HTTP request");
|
2781 - | assert!(receiver.recv().await.is_some());
|
2115 + | assert!(
|
2116 + | receiver.recv().await.is_some(),
|
2117 + | "we expected operation handler to be invoked but it was not entered"
|
2118 + | );
|
2782 2119 | }
|
2783 - | /// Serializes boolean shapes (true)
|
2784 - | /// Test ID: serializes_boolean_shapes_true
|
2120 + | /// Null structure values are dropped
|
2121 + | /// Test ID: AwsJson11ServersDontSerializeNullStructureValues
|
2785 2122 | #[::tokio::test]
|
2786 - | async fn serializes_boolean_shapes_true_request() {
|
2787 - | #[allow(unused_mut)]
|
2788 - | let mut http_request = http::Request::builder()
|
2789 - | .uri("/")
|
2790 - | .method("POST")
|
2791 - | .header("Content-Type", "application/x-amz-json-1.1")
|
2792 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
2793 - | .body(::aws_smithy_http_server::body::Body::from(
|
2794 - | ::bytes::Bytes::from_static("{\"Boolean\":true}".as_bytes()),
|
2795 - | ))
|
2796 - | .unwrap();
|
2797 - | #[allow(unused_mut)]
|
2798 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2799 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
2800 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2801 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
2802 - | let sender = sender.clone();
|
2803 - | async move {
|
2804 - | let result = {
|
2805 - | use ::aws_smithy_protocol_test::FloatEquals;
|
2806 - | let expected = crate::input::KitchenSinkOperationInput {
|
2807 - | boolean: ::std::option::Option::Some(true),
|
2808 - | blob: ::std::option::Option::None,
|
2809 - | double: ::std::option::Option::None,
|
2810 - | empty_struct: ::std::option::Option::None,
|
2811 - | float: ::std::option::Option::None,
|
2812 - | httpdate_timestamp: ::std::option::Option::None,
|
2813 - | integer: ::std::option::Option::None,
|
2814 - | iso8601_timestamp: ::std::option::Option::None,
|
2815 - | json_value: ::std::option::Option::None,
|
2816 - | list_of_lists: ::std::option::Option::None,
|
2817 - | list_of_maps_of_strings: ::std::option::Option::None,
|
2818 - | list_of_strings: ::std::option::Option::None,
|
2819 - | list_of_structs: ::std::option::Option::None,
|
2820 - | long: ::std::option::Option::None,
|
2821 - | map_of_lists_of_strings: ::std::option::Option::None,
|
2822 - | map_of_maps: ::std::option::Option::None,
|
2823 - | map_of_strings: ::std::option::Option::None,
|
2824 - | map_of_structs: ::std::option::Option::None,
|
2825 - | recursive_list: ::std::option::Option::None,
|
2826 - | recursive_map: ::std::option::Option::None,
|
2827 - | recursive_struct: ::std::option::Option::None,
|
2828 - | simple_struct: ::std::option::Option::None,
|
2829 - | string: ::std::option::Option::None,
|
2830 - | struct_with_json_name: ::std::option::Option::None,
|
2831 - | timestamp: ::std::option::Option::None,
|
2832 - | unix_timestamp: ::std::option::Option::None,
|
2833 - | };
|
2834 - | ::pretty_assertions::assert_eq!(
|
2835 - | input.blob,
|
2836 - | expected.blob,
|
2837 - | "Unexpected value for `blob`"
|
2838 - | );
|
2839 - | ::pretty_assertions::assert_eq!(
|
2840 - | input.boolean,
|
2841 - | expected.boolean,
|
2842 - | "Unexpected value for `boolean`"
|
2843 - | );
|
2844 - | assert!(
|
2845 - | input.double.float_equals(&expected.double),
|
2846 - | "Unexpected value for `double` {:?} vs. {:?}",
|
2847 - | expected.double,
|
2848 - | input.double
|
2849 - | );
|
2850 - | ::pretty_assertions::assert_eq!(
|
2851 - | input.empty_struct,
|
2852 - | expected.empty_struct,
|
2853 - | "Unexpected value for `empty_struct`"
|
2854 - | );
|
2855 - | assert!(
|
2856 - | input.float.float_equals(&expected.float),
|
2857 - | "Unexpected value for `float` {:?} vs. {:?}",
|
2858 - | expected.float,
|
2859 - | input.float
|
2860 - | );
|
2861 - | ::pretty_assertions::assert_eq!(
|
2862 - | input.httpdate_timestamp,
|
2863 - | expected.httpdate_timestamp,
|
2864 - | "Unexpected value for `httpdate_timestamp`"
|
2865 - | );
|
2866 - | ::pretty_assertions::assert_eq!(
|
2867 - | input.integer,
|
2868 - | expected.integer,
|
2869 - | "Unexpected value for `integer`"
|
2870 - | );
|
2871 - | ::pretty_assertions::assert_eq!(
|
2872 - | input.iso8601_timestamp,
|
2873 - | expected.iso8601_timestamp,
|
2874 - | "Unexpected value for `iso8601_timestamp`"
|
2875 - | );
|
2876 - | ::pretty_assertions::assert_eq!(
|
2877 - | input.json_value,
|
2878 - | expected.json_value,
|
2879 - | "Unexpected value for `json_value`"
|
2880 - | );
|
2881 - | ::pretty_assertions::assert_eq!(
|
2882 - | input.list_of_lists,
|
2883 - | expected.list_of_lists,
|
2884 - | "Unexpected value for `list_of_lists`"
|
2885 - | );
|
2886 - | ::pretty_assertions::assert_eq!(
|
2887 - | input.list_of_maps_of_strings,
|
2888 - | expected.list_of_maps_of_strings,
|
2889 - | "Unexpected value for `list_of_maps_of_strings`"
|
2890 - | );
|
2891 - | ::pretty_assertions::assert_eq!(
|
2892 - | input.list_of_strings,
|
2893 - | expected.list_of_strings,
|
2894 - | "Unexpected value for `list_of_strings`"
|
2895 - | );
|
2896 - | ::pretty_assertions::assert_eq!(
|
2897 - | input.list_of_structs,
|
2898 - | expected.list_of_structs,
|
2899 - | "Unexpected value for `list_of_structs`"
|
2900 - | );
|
2901 - | ::pretty_assertions::assert_eq!(
|
2902 - | input.long,
|
2903 - | expected.long,
|
2904 - | "Unexpected value for `long`"
|
2905 - | );
|
2906 - | ::pretty_assertions::assert_eq!(
|
2907 - | input.map_of_lists_of_strings,
|
2908 - | expected.map_of_lists_of_strings,
|
2909 - | "Unexpected value for `map_of_lists_of_strings`"
|
2910 - | );
|
2911 - | ::pretty_assertions::assert_eq!(
|
2912 - | input.map_of_maps,
|
2913 - | expected.map_of_maps,
|
2914 - | "Unexpected value for `map_of_maps`"
|
2915 - | );
|
2916 - | ::pretty_assertions::assert_eq!(
|
2917 - | input.map_of_strings,
|
2918 - | expected.map_of_strings,
|
2919 - | "Unexpected value for `map_of_strings`"
|
2920 - | );
|
2921 - | ::pretty_assertions::assert_eq!(
|
2922 - | input.map_of_structs,
|
2923 - | expected.map_of_structs,
|
2924 - | "Unexpected value for `map_of_structs`"
|
2925 - | );
|
2926 - | ::pretty_assertions::assert_eq!(
|
2927 - | input.recursive_list,
|
2928 - | expected.recursive_list,
|
2929 - | "Unexpected value for `recursive_list`"
|
2930 - | );
|
2931 - | ::pretty_assertions::assert_eq!(
|
2932 - | input.recursive_map,
|
2933 - | expected.recursive_map,
|
2934 - | "Unexpected value for `recursive_map`"
|
2935 - | );
|
2936 - | ::pretty_assertions::assert_eq!(
|
2937 - | input.recursive_struct,
|
2938 - | expected.recursive_struct,
|
2939 - | "Unexpected value for `recursive_struct`"
|
2940 - | );
|
2941 - | ::pretty_assertions::assert_eq!(
|
2942 - | input.simple_struct,
|
2943 - | expected.simple_struct,
|
2944 - | "Unexpected value for `simple_struct`"
|
2945 - | );
|
2946 - | ::pretty_assertions::assert_eq!(
|
2947 - | input.string,
|
2948 - | expected.string,
|
2949 - | "Unexpected value for `string`"
|
2950 - | );
|
2951 - | ::pretty_assertions::assert_eq!(
|
2952 - | input.struct_with_json_name,
|
2953 - | expected.struct_with_json_name,
|
2954 - | "Unexpected value for `struct_with_json_name`"
|
2955 - | );
|
2956 - | ::pretty_assertions::assert_eq!(
|
2957 - | input.timestamp,
|
2958 - | expected.timestamp,
|
2959 - | "Unexpected value for `timestamp`"
|
2960 - | );
|
2961 - | ::pretty_assertions::assert_eq!(
|
2962 - | input.unix_timestamp,
|
2963 - | expected.unix_timestamp,
|
2964 - | "Unexpected value for `unix_timestamp`"
|
2965 - | );
|
2966 - | let response = crate::output::KitchenSinkOperationOutput {
|
2967 - | blob: ::std::option::Option::None,
|
2968 - | boolean: ::std::option::Option::None,
|
2969 - | double: ::std::option::Option::None,
|
2970 - | empty_struct: ::std::option::Option::None,
|
2971 - | float: ::std::option::Option::None,
|
2972 - | httpdate_timestamp: ::std::option::Option::None,
|
2973 - | integer: ::std::option::Option::None,
|
2974 - | iso8601_timestamp: ::std::option::Option::None,
|
2975 - | json_value: ::std::option::Option::None,
|
2976 - | list_of_lists: ::std::option::Option::None,
|
2977 - | list_of_maps_of_strings: ::std::option::Option::None,
|
2978 - | list_of_strings: ::std::option::Option::None,
|
2979 - | list_of_structs: ::std::option::Option::None,
|
2980 - | long: ::std::option::Option::None,
|
2981 - | map_of_lists_of_strings: ::std::option::Option::None,
|
2982 - | map_of_maps: ::std::option::Option::None,
|
2983 - | map_of_strings: ::std::option::Option::None,
|
2984 - | map_of_structs: ::std::option::Option::None,
|
2985 - | recursive_list: ::std::option::Option::None,
|
2986 - | recursive_map: ::std::option::Option::None,
|
2987 - | recursive_struct: ::std::option::Option::None,
|
2988 - | simple_struct: ::std::option::Option::None,
|
2989 - | string: ::std::option::Option::None,
|
2990 - | struct_with_json_name: ::std::option::Option::None,
|
2991 - | timestamp: ::std::option::Option::None,
|
2992 - | unix_timestamp: ::std::option::Option::None,
|
2993 - | };
|
2994 - | Ok(response)
|
2995 - | };
|
2996 - | sender.send(()).await.expect("receiver dropped early");
|
2997 - | result
|
2998 - | }
|
2999 - | })
|
3000 - | .build_unchecked();
|
3001 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2123 + | #[::tracing_test::traced_test]
|
2124 + | async fn aws_json11_servers_dont_serialize_null_structure_values_response() {
|
2125 + | let output = crate::output::NullOperationOutput {
|
2126 + | string: ::std::option::Option::None,
|
2127 + | };
|
2128 + | use ::aws_smithy_http_server::response::IntoResponse;
|
2129 + | let http_response = output.into_response();
|
2130 + | ::pretty_assertions::assert_eq!(
|
2131 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2132 + | http_response.status()
|
2133 + | );
|
2134 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
2135 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2136 + | http_response.headers(),
|
2137 + | expected_headers,
|
2138 + | ));
|
2139 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3002 2140 | .await
|
3003 - | .expect("unable to make an HTTP request");
|
3004 - | assert!(receiver.recv().await.is_some());
|
2141 + | .expect("unable to extract body to bytes");
|
2142 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2143 + | &body,
|
2144 + | "{}",
|
2145 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2146 + | ));
|
3005 2147 | }
|
3006 - | /// Serializes boolean shapes (false)
|
3007 - | /// Test ID: serializes_boolean_shapes_false
|
3008 - | #[::tokio::test]
|
3009 - | async fn serializes_boolean_shapes_false_request() {
|
3010 - | #[allow(unused_mut)]
|
3011 - | let mut http_request = http::Request::builder()
|
3012 - | .uri("/")
|
3013 - | .method("POST")
|
3014 - | .header("Content-Type", "application/x-amz-json-1.1")
|
3015 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
3016 - | .body(::aws_smithy_http_server::body::Body::from(
|
3017 - | ::bytes::Bytes::from_static("{\"Boolean\":false}".as_bytes()),
|
3018 - | ))
|
3019 - | .unwrap();
|
3020 - | #[allow(unused_mut)]
|
3021 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3022 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
3023 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3024 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
3025 - | let sender = sender.clone();
|
3026 - | async move {
|
3027 - | let result = {
|
3028 - | use ::aws_smithy_protocol_test::FloatEquals;
|
3029 - | let expected = crate::input::KitchenSinkOperationInput {
|
3030 - | boolean: ::std::option::Option::Some(false),
|
3031 - | blob: ::std::option::Option::None,
|
3032 - | double: ::std::option::Option::None,
|
3033 - | empty_struct: ::std::option::Option::None,
|
3034 - | float: ::std::option::Option::None,
|
3035 - | httpdate_timestamp: ::std::option::Option::None,
|
3036 - | integer: ::std::option::Option::None,
|
3037 - | iso8601_timestamp: ::std::option::Option::None,
|
3038 - | json_value: ::std::option::Option::None,
|
3039 - | list_of_lists: ::std::option::Option::None,
|
3040 - | list_of_maps_of_strings: ::std::option::Option::None,
|
3041 - | list_of_strings: ::std::option::Option::None,
|
3042 - | list_of_structs: ::std::option::Option::None,
|
3043 - | long: ::std::option::Option::None,
|
3044 - | map_of_lists_of_strings: ::std::option::Option::None,
|
3045 - | map_of_maps: ::std::option::Option::None,
|
3046 - | map_of_strings: ::std::option::Option::None,
|
3047 - | map_of_structs: ::std::option::Option::None,
|
3048 - | recursive_list: ::std::option::Option::None,
|
3049 - | recursive_map: ::std::option::Option::None,
|
3050 - | recursive_struct: ::std::option::Option::None,
|
3051 - | simple_struct: ::std::option::Option::None,
|
3052 - | string: ::std::option::Option::None,
|
3053 - | struct_with_json_name: ::std::option::Option::None,
|
3054 - | timestamp: ::std::option::Option::None,
|
3055 - | unix_timestamp: ::std::option::Option::None,
|
3056 - | };
|
3057 - | ::pretty_assertions::assert_eq!(
|
3058 - | input.blob,
|
3059 - | expected.blob,
|
3060 - | "Unexpected value for `blob`"
|
3061 - | );
|
3062 - | ::pretty_assertions::assert_eq!(
|
3063 - | input.boolean,
|
3064 - | expected.boolean,
|
3065 - | "Unexpected value for `boolean`"
|
3066 - | );
|
3067 - | assert!(
|
3068 - | input.double.float_equals(&expected.double),
|
3069 - | "Unexpected value for `double` {:?} vs. {:?}",
|
3070 - | expected.double,
|
3071 - | input.double
|
3072 - | );
|
3073 - | ::pretty_assertions::assert_eq!(
|
3074 - | input.empty_struct,
|
3075 - | expected.empty_struct,
|
3076 - | "Unexpected value for `empty_struct`"
|
3077 - | );
|
3078 - | assert!(
|
3079 - | input.float.float_equals(&expected.float),
|
3080 - | "Unexpected value for `float` {:?} vs. {:?}",
|
3081 - | expected.float,
|
3082 - | input.float
|
3083 - | );
|
3084 - | ::pretty_assertions::assert_eq!(
|
3085 - | input.httpdate_timestamp,
|
3086 - | expected.httpdate_timestamp,
|
3087 - | "Unexpected value for `httpdate_timestamp`"
|
3088 - | );
|
3089 - | ::pretty_assertions::assert_eq!(
|
3090 - | input.integer,
|
3091 - | expected.integer,
|
3092 - | "Unexpected value for `integer`"
|
3093 - | );
|
3094 - | ::pretty_assertions::assert_eq!(
|
3095 - | input.iso8601_timestamp,
|
3096 - | expected.iso8601_timestamp,
|
3097 - | "Unexpected value for `iso8601_timestamp`"
|
3098 - | );
|
3099 - | ::pretty_assertions::assert_eq!(
|
3100 - | input.json_value,
|
3101 - | expected.json_value,
|
3102 - | "Unexpected value for `json_value`"
|
3103 - | );
|
3104 - | ::pretty_assertions::assert_eq!(
|
3105 - | input.list_of_lists,
|
3106 - | expected.list_of_lists,
|
3107 - | "Unexpected value for `list_of_lists`"
|
3108 - | );
|
3109 - | ::pretty_assertions::assert_eq!(
|
3110 - | input.list_of_maps_of_strings,
|
3111 - | expected.list_of_maps_of_strings,
|
3112 - | "Unexpected value for `list_of_maps_of_strings`"
|
3113 - | );
|
3114 - | ::pretty_assertions::assert_eq!(
|
3115 - | input.list_of_strings,
|
3116 - | expected.list_of_strings,
|
3117 - | "Unexpected value for `list_of_strings`"
|
3118 - | );
|
3119 - | ::pretty_assertions::assert_eq!(
|
3120 - | input.list_of_structs,
|
3121 - | expected.list_of_structs,
|
3122 - | "Unexpected value for `list_of_structs`"
|
3123 - | );
|
3124 - | ::pretty_assertions::assert_eq!(
|
3125 - | input.long,
|
3126 - | expected.long,
|
3127 - | "Unexpected value for `long`"
|
3128 - | );
|
3129 - | ::pretty_assertions::assert_eq!(
|
3130 - | input.map_of_lists_of_strings,
|
3131 - | expected.map_of_lists_of_strings,
|
3132 - | "Unexpected value for `map_of_lists_of_strings`"
|
3133 - | );
|
3134 - | ::pretty_assertions::assert_eq!(
|
3135 - | input.map_of_maps,
|
3136 - | expected.map_of_maps,
|
3137 - | "Unexpected value for `map_of_maps`"
|
3138 - | );
|
3139 - | ::pretty_assertions::assert_eq!(
|
3140 - | input.map_of_strings,
|
3141 - | expected.map_of_strings,
|
3142 - | "Unexpected value for `map_of_strings`"
|
3143 - | );
|
3144 - | ::pretty_assertions::assert_eq!(
|
3145 - | input.map_of_structs,
|
3146 - | expected.map_of_structs,
|
3147 - | "Unexpected value for `map_of_structs`"
|
3148 - | );
|
3149 - | ::pretty_assertions::assert_eq!(
|
3150 - | input.recursive_list,
|
3151 - | expected.recursive_list,
|
3152 - | "Unexpected value for `recursive_list`"
|
3153 - | );
|
3154 - | ::pretty_assertions::assert_eq!(
|
3155 - | input.recursive_map,
|
3156 - | expected.recursive_map,
|
3157 - | "Unexpected value for `recursive_map`"
|
3158 - | );
|
3159 - | ::pretty_assertions::assert_eq!(
|
3160 - | input.recursive_struct,
|
3161 - | expected.recursive_struct,
|
3162 - | "Unexpected value for `recursive_struct`"
|
3163 - | );
|
3164 - | ::pretty_assertions::assert_eq!(
|
3165 - | input.simple_struct,
|
3166 - | expected.simple_struct,
|
3167 - | "Unexpected value for `simple_struct`"
|
3168 - | );
|
3169 - | ::pretty_assertions::assert_eq!(
|
3170 - | input.string,
|
3171 - | expected.string,
|
3172 - | "Unexpected value for `string`"
|
3173 - | );
|
3174 - | ::pretty_assertions::assert_eq!(
|
3175 - | input.struct_with_json_name,
|
3176 - | expected.struct_with_json_name,
|
3177 - | "Unexpected value for `struct_with_json_name`"
|
3178 - | );
|
3179 - | ::pretty_assertions::assert_eq!(
|
3180 - | input.timestamp,
|
3181 - | expected.timestamp,
|
3182 - | "Unexpected value for `timestamp`"
|
3183 - | );
|
3184 - | ::pretty_assertions::assert_eq!(
|
3185 - | input.unix_timestamp,
|
3186 - | expected.unix_timestamp,
|
3187 - | "Unexpected value for `unix_timestamp`"
|
3188 - | );
|
3189 - | let response = crate::output::KitchenSinkOperationOutput {
|
3190 - | blob: ::std::option::Option::None,
|
3191 - | boolean: ::std::option::Option::None,
|
3192 - | double: ::std::option::Option::None,
|
3193 - | empty_struct: ::std::option::Option::None,
|
3194 - | float: ::std::option::Option::None,
|
3195 - | httpdate_timestamp: ::std::option::Option::None,
|
3196 - | integer: ::std::option::Option::None,
|
3197 - | iso8601_timestamp: ::std::option::Option::None,
|
3198 - | json_value: ::std::option::Option::None,
|
3199 - | list_of_lists: ::std::option::Option::None,
|
3200 - | list_of_maps_of_strings: ::std::option::Option::None,
|
3201 - | list_of_strings: ::std::option::Option::None,
|
3202 - | list_of_structs: ::std::option::Option::None,
|
3203 - | long: ::std::option::Option::None,
|
3204 - | map_of_lists_of_strings: ::std::option::Option::None,
|
3205 - | map_of_maps: ::std::option::Option::None,
|
3206 - | map_of_strings: ::std::option::Option::None,
|
3207 - | map_of_structs: ::std::option::Option::None,
|
3208 - | recursive_list: ::std::option::Option::None,
|
3209 - | recursive_map: ::std::option::Option::None,
|
3210 - | recursive_struct: ::std::option::Option::None,
|
3211 - | simple_struct: ::std::option::Option::None,
|
3212 - | string: ::std::option::Option::None,
|
3213 - | struct_with_json_name: ::std::option::Option::None,
|
3214 - | timestamp: ::std::option::Option::None,
|
3215 - | unix_timestamp: ::std::option::Option::None,
|
3216 - | };
|
3217 - | Ok(response)
|
3218 - | };
|
3219 - | sender.send(()).await.expect("receiver dropped early");
|
3220 - | result
|
3221 - | }
|
3222 - | })
|
3223 - | .build_unchecked();
|
3224 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3225 - | .await
|
3226 - | .expect("unable to make an HTTP request");
|
3227 - | assert!(receiver.recv().await.is_some());
|
2148 + | }
|
2149 + |
|
2150 + | static CONTENT_TYPE_JSONENUMS: ::once_cell::sync::Lazy<::mime::Mime> =
|
2151 + | ::once_cell::sync::Lazy::new(|| {
|
2152 + | "application/x-amz-json-1.1"
|
2153 + | .parse::<::mime::Mime>()
|
2154 + | .expect("BUG: MIME parsing failed, content_type is not valid")
|
2155 + | });
|
2156 + | ::pin_project_lite::pin_project! {
|
2157 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2158 + | /// [`JsonEnumsInput`](crate::input::JsonEnumsInput) using modelled bindings.
|
2159 + | pub struct JsonEnumsInputFuture {
|
2160 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::JsonEnumsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
3228 2161 | }
|
3229 - | /// Serializes timestamp shapes
|
3230 - | /// Test ID: serializes_timestamp_shapes
|
3231 - | #[::tokio::test]
|
3232 - | async fn serializes_timestamp_shapes_request() {
|
3233 - | #[allow(unused_mut)]
|
3234 - | let mut http_request = http::Request::builder()
|
3235 - | .uri("/")
|
3236 - | .method("POST")
|
3237 - | .header("Content-Type", "application/x-amz-json-1.1")
|
3238 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
3239 - | .body(::aws_smithy_http_server::body::Body::from(
|
3240 - | ::bytes::Bytes::from_static("{\"Timestamp\":946845296}".as_bytes()),
|
3241 - | ))
|
3242 - | .unwrap();
|
3243 - | #[allow(unused_mut)]
|
3244 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3245 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
3246 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3247 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
3248 - | let sender = sender.clone();
|
3249 - | async move {
|
3250 - | let result = {
|
3251 - | use ::aws_smithy_protocol_test::FloatEquals;
|
3252 - | let expected = crate::input::KitchenSinkOperationInput {
|
3253 - | timestamp: ::std::option::Option::Some(
|
3254 - | ::aws_smithy_types::DateTime::from_fractional_secs(
|
3255 - | 946845296, 0_f64,
|
3256 - | ),
|
3257 - | ),
|
3258 - | blob: ::std::option::Option::None,
|
3259 - | boolean: ::std::option::Option::None,
|
3260 - | double: ::std::option::Option::None,
|
3261 - | empty_struct: ::std::option::Option::None,
|
3262 - | float: ::std::option::Option::None,
|
3263 - | httpdate_timestamp: ::std::option::Option::None,
|
3264 - | integer: ::std::option::Option::None,
|
3265 - | iso8601_timestamp: ::std::option::Option::None,
|
3266 - | json_value: ::std::option::Option::None,
|
3267 - | list_of_lists: ::std::option::Option::None,
|
3268 - | list_of_maps_of_strings: ::std::option::Option::None,
|
3269 - | list_of_strings: ::std::option::Option::None,
|
3270 - | list_of_structs: ::std::option::Option::None,
|
3271 - | long: ::std::option::Option::None,
|
3272 - | map_of_lists_of_strings: ::std::option::Option::None,
|
3273 - | map_of_maps: ::std::option::Option::None,
|
3274 - | map_of_strings: ::std::option::Option::None,
|
3275 - | map_of_structs: ::std::option::Option::None,
|
3276 - | recursive_list: ::std::option::Option::None,
|
3277 - | recursive_map: ::std::option::Option::None,
|
3278 - | recursive_struct: ::std::option::Option::None,
|
3279 - | simple_struct: ::std::option::Option::None,
|
3280 - | string: ::std::option::Option::None,
|
3281 - | struct_with_json_name: ::std::option::Option::None,
|
3282 - | unix_timestamp: ::std::option::Option::None,
|
3283 - | };
|
3284 - | ::pretty_assertions::assert_eq!(
|
3285 - | input.blob,
|
3286 - | expected.blob,
|
3287 - | "Unexpected value for `blob`"
|
3288 - | );
|
3289 - | ::pretty_assertions::assert_eq!(
|
3290 - | input.boolean,
|
3291 - | expected.boolean,
|
3292 - | "Unexpected value for `boolean`"
|
3293 - | );
|
3294 - | assert!(
|
3295 - | input.double.float_equals(&expected.double),
|
3296 - | "Unexpected value for `double` {:?} vs. {:?}",
|
3297 - | expected.double,
|
3298 - | input.double
|
3299 - | );
|
3300 - | ::pretty_assertions::assert_eq!(
|
3301 - | input.empty_struct,
|
3302 - | expected.empty_struct,
|
3303 - | "Unexpected value for `empty_struct`"
|
3304 - | );
|
3305 - | assert!(
|
3306 - | input.float.float_equals(&expected.float),
|
3307 - | "Unexpected value for `float` {:?} vs. {:?}",
|
3308 - | expected.float,
|
3309 - | input.float
|
3310 - | );
|
3311 - | ::pretty_assertions::assert_eq!(
|
3312 - | input.httpdate_timestamp,
|
3313 - | expected.httpdate_timestamp,
|
3314 - | "Unexpected value for `httpdate_timestamp`"
|
3315 - | );
|
3316 - | ::pretty_assertions::assert_eq!(
|
3317 - | input.integer,
|
3318 - | expected.integer,
|
3319 - | "Unexpected value for `integer`"
|
3320 - | );
|
3321 - | ::pretty_assertions::assert_eq!(
|
3322 - | input.iso8601_timestamp,
|
3323 - | expected.iso8601_timestamp,
|
3324 - | "Unexpected value for `iso8601_timestamp`"
|
3325 - | );
|
3326 - | ::pretty_assertions::assert_eq!(
|
3327 - | input.json_value,
|
3328 - | expected.json_value,
|
3329 - | "Unexpected value for `json_value`"
|
3330 - | );
|
3331 - | ::pretty_assertions::assert_eq!(
|
3332 - | input.list_of_lists,
|
3333 - | expected.list_of_lists,
|
3334 - | "Unexpected value for `list_of_lists`"
|
3335 - | );
|
3336 - | ::pretty_assertions::assert_eq!(
|
3337 - | input.list_of_maps_of_strings,
|
3338 - | expected.list_of_maps_of_strings,
|
3339 - | "Unexpected value for `list_of_maps_of_strings`"
|
3340 - | );
|
3341 - | ::pretty_assertions::assert_eq!(
|
3342 - | input.list_of_strings,
|
3343 - | expected.list_of_strings,
|
3344 - | "Unexpected value for `list_of_strings`"
|
3345 - | );
|
3346 - | ::pretty_assertions::assert_eq!(
|
3347 - | input.list_of_structs,
|
3348 - | expected.list_of_structs,
|
3349 - | "Unexpected value for `list_of_structs`"
|
3350 - | );
|
3351 - | ::pretty_assertions::assert_eq!(
|
3352 - | input.long,
|
3353 - | expected.long,
|
3354 - | "Unexpected value for `long`"
|
3355 - | );
|
3356 - | ::pretty_assertions::assert_eq!(
|
3357 - | input.map_of_lists_of_strings,
|
3358 - | expected.map_of_lists_of_strings,
|
3359 - | "Unexpected value for `map_of_lists_of_strings`"
|
3360 - | );
|
3361 - | ::pretty_assertions::assert_eq!(
|
3362 - | input.map_of_maps,
|
3363 - | expected.map_of_maps,
|
3364 - | "Unexpected value for `map_of_maps`"
|
3365 - | );
|
3366 - | ::pretty_assertions::assert_eq!(
|
3367 - | input.map_of_strings,
|
3368 - | expected.map_of_strings,
|
3369 - | "Unexpected value for `map_of_strings`"
|
3370 - | );
|
3371 - | ::pretty_assertions::assert_eq!(
|
3372 - | input.map_of_structs,
|
3373 - | expected.map_of_structs,
|
3374 - | "Unexpected value for `map_of_structs`"
|
3375 - | );
|
3376 - | ::pretty_assertions::assert_eq!(
|
3377 - | input.recursive_list,
|
3378 - | expected.recursive_list,
|
3379 - | "Unexpected value for `recursive_list`"
|
3380 - | );
|
3381 - | ::pretty_assertions::assert_eq!(
|
3382 - | input.recursive_map,
|
3383 - | expected.recursive_map,
|
3384 - | "Unexpected value for `recursive_map`"
|
3385 - | );
|
3386 - | ::pretty_assertions::assert_eq!(
|
3387 - | input.recursive_struct,
|
3388 - | expected.recursive_struct,
|
3389 - | "Unexpected value for `recursive_struct`"
|
3390 - | );
|
3391 - | ::pretty_assertions::assert_eq!(
|
3392 - | input.simple_struct,
|
3393 - | expected.simple_struct,
|
3394 - | "Unexpected value for `simple_struct`"
|
3395 - | );
|
3396 - | ::pretty_assertions::assert_eq!(
|
3397 - | input.string,
|
3398 - | expected.string,
|
3399 - | "Unexpected value for `string`"
|
3400 - | );
|
3401 - | ::pretty_assertions::assert_eq!(
|
3402 - | input.struct_with_json_name,
|
3403 - | expected.struct_with_json_name,
|
3404 - | "Unexpected value for `struct_with_json_name`"
|
3405 - | );
|
3406 - | ::pretty_assertions::assert_eq!(
|
3407 - | input.timestamp,
|
3408 - | expected.timestamp,
|
3409 - | "Unexpected value for `timestamp`"
|
3410 - | );
|
3411 - | ::pretty_assertions::assert_eq!(
|
3412 - | input.unix_timestamp,
|
3413 - | expected.unix_timestamp,
|
3414 - | "Unexpected value for `unix_timestamp`"
|
3415 - | );
|
3416 - | let response = crate::output::KitchenSinkOperationOutput {
|
3417 - | blob: ::std::option::Option::None,
|
3418 - | boolean: ::std::option::Option::None,
|
3419 - | double: ::std::option::Option::None,
|
3420 - | empty_struct: ::std::option::Option::None,
|
3421 - | float: ::std::option::Option::None,
|
3422 - | httpdate_timestamp: ::std::option::Option::None,
|
3423 - | integer: ::std::option::Option::None,
|
3424 - | iso8601_timestamp: ::std::option::Option::None,
|
3425 - | json_value: ::std::option::Option::None,
|
3426 - | list_of_lists: ::std::option::Option::None,
|
3427 - | list_of_maps_of_strings: ::std::option::Option::None,
|
3428 - | list_of_strings: ::std::option::Option::None,
|
3429 - | list_of_structs: ::std::option::Option::None,
|
3430 - | long: ::std::option::Option::None,
|
3431 - | map_of_lists_of_strings: ::std::option::Option::None,
|
3432 - | map_of_maps: ::std::option::Option::None,
|
3433 - | map_of_strings: ::std::option::Option::None,
|
3434 - | map_of_structs: ::std::option::Option::None,
|
3435 - | recursive_list: ::std::option::Option::None,
|
3436 - | recursive_map: ::std::option::Option::None,
|
3437 - | recursive_struct: ::std::option::Option::None,
|
3438 - | simple_struct: ::std::option::Option::None,
|
3439 - | string: ::std::option::Option::None,
|
3440 - | struct_with_json_name: ::std::option::Option::None,
|
3441 - | timestamp: ::std::option::Option::None,
|
3442 - | unix_timestamp: ::std::option::Option::None,
|
3443 - | };
|
3444 - | Ok(response)
|
3445 - | };
|
3446 - | sender.send(()).await.expect("receiver dropped early");
|
3447 - | result
|
3448 - | }
|
3449 - | })
|
3450 - | .build_unchecked();
|
3451 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3452 - | .await
|
3453 - | .expect("unable to make an HTTP request");
|
3454 - | assert!(receiver.recv().await.is_some());
|
2162 + | }
|
2163 + |
|
2164 + | impl std::future::Future for JsonEnumsInputFuture {
|
2165 + | type Output = Result<
|
2166 + | crate::input::JsonEnumsInput,
|
2167 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
2168 + | >;
|
2169 + |
|
2170 + | fn poll(
|
2171 + | self: std::pin::Pin<&mut Self>,
|
2172 + | cx: &mut std::task::Context<'_>,
|
2173 + | ) -> std::task::Poll<Self::Output> {
|
2174 + | let this = self.project();
|
2175 + | this.inner.as_mut().poll(cx)
|
3455 2176 | }
|
3456 - | /// Serializes timestamp shapes with iso8601 timestampFormat
|
3457 - | /// Test ID: serializes_timestamp_shapes_with_iso8601_timestampformat
|
2177 + | }
|
2178 + |
|
2179 + | impl<B>
|
2180 + | ::aws_smithy_http_server::request::FromRequest<
|
2181 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2182 + | B,
|
2183 + | > for crate::input::JsonEnumsInput
|
2184 + | where
|
2185 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
2186 + | B: 'static,
|
2187 + |
|
2188 + | B::Data: Send,
|
2189 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
2190 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
2191 + | {
|
2192 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
2193 + | type Future = JsonEnumsInputFuture;
|
2194 + |
|
2195 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2196 + | let fut = async move {
|
2197 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
2198 + | request.headers(),
|
2199 + | &CONTENT_TYPE_JSONENUMS,
|
2200 + | ) {
|
2201 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
2202 + | }
|
2203 + | crate::protocol_serde::shape_json_enums::de_json_enums_http_request(request)
|
2204 + | .await
|
2205 + | .map_err(Into::into)
|
2206 + | };
|
2207 + | use ::futures_util::future::TryFutureExt;
|
2208 + | let fut = fut.map_err(
|
2209 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
2210 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2211 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
2212 + | },
|
2213 + | );
|
2214 + | JsonEnumsInputFuture {
|
2215 + | inner: Box::pin(fut),
|
2216 + | }
|
2217 + | }
|
2218 + | }
|
2219 + | impl
|
2220 + | ::aws_smithy_http_server::response::IntoResponse<
|
2221 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2222 + | > for crate::output::JsonEnumsOutput
|
2223 + | {
|
2224 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
2225 + | match crate::protocol_serde::shape_json_enums::ser_json_enums_http_response(self) {
|
2226 + | Ok(response) => response,
|
2227 + | Err(e) => {
|
2228 + | ::tracing::error!(error = %e, "failed to serialize response");
|
2229 + | ::aws_smithy_http_server::response::IntoResponse::<
|
2230 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2231 + | >::into_response(
|
2232 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
2233 + | e,
|
2234 + | ),
|
2235 + | )
|
2236 + | }
|
2237 + | }
|
2238 + | }
|
2239 + | }
|
2240 + | impl
|
2241 + | ::aws_smithy_http_server::response::IntoResponse<
|
2242 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2243 + | > for crate::error::JsonEnumsError
|
2244 + | {
|
2245 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
2246 + | match crate::protocol_serde::shape_json_enums::ser_json_enums_http_error(&self) {
|
2247 + | Ok(mut response) => {
|
2248 + | response.extensions_mut().insert(
|
2249 + | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
2250 + | );
|
2251 + | response
|
2252 + | }
|
2253 + | Err(e) => {
|
2254 + | ::tracing::error!(error = %e, "failed to serialize response");
|
2255 + | ::aws_smithy_http_server::response::IntoResponse::<
|
2256 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2257 + | >::into_response(
|
2258 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
2259 + | e,
|
2260 + | ),
|
2261 + | )
|
2262 + | }
|
2263 + | }
|
2264 + | }
|
2265 + | }
|
2266 + |
|
2267 + | #[allow(unreachable_code, unused_variables)]
|
2268 + | #[cfg(test)]
|
2269 + | mod json_enums_test {
|
2270 + |
|
2271 + | /// Serializes simple scalar properties
|
2272 + | /// Test ID: AwsJson11Enums
|
3458 2273 | #[::tokio::test]
|
3459 - | async fn serializes_timestamp_shapes_with_iso8601_timestampformat_request() {
|
2274 + | #[::tracing_test::traced_test]
|
2275 + | async fn aws_json11_enums_request() {
|
3460 2276 | #[allow(unused_mut)]
|
3461 - | let mut http_request = http::Request::builder()
|
3462 - | .uri("/")
|
3463 - | .method("POST")
|
3464 - | .header("Content-Type", "application/x-amz-json-1.1")
|
3465 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
3466 - | .body(::aws_smithy_http_server::body::Body::from(
|
3467 - | ::bytes::Bytes::from_static(
|
3468 - | "{\"Iso8601Timestamp\":\"2000-01-02T20:34:56Z\"}".as_bytes(),
|
3469 - | ),
|
3470 - | ))
|
3471 - | .unwrap();
|
2277 + | let mut http_request = http::Request::builder()
|
2278 + | .uri("/")
|
2279 + | .method("POST")
|
2280 + | .header("Content-Type", "application/x-amz-json-1.1")
|
2281 + | .header("X-Amz-Target", "JsonProtocol.JsonEnums")
|
2282 + | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{\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()))).unwrap();
|
3472 2283 | #[allow(unused_mut)]
|
3473 2284 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3474 2285 | let config = crate::service::JsonProtocolConfig::builder().build();
|
3475 2286 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3476 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
2287 + | .json_enums(move |input: crate::input::JsonEnumsInput| {
|
3477 2288 | let sender = sender.clone();
|
3478 2289 | async move {
|
3479 2290 | let result = {
|
3480 - | use ::aws_smithy_protocol_test::FloatEquals;
|
3481 - | let expected = crate::input::KitchenSinkOperationInput {
|
3482 - | iso8601_timestamp: ::std::option::Option::Some(
|
3483 - | ::aws_smithy_types::DateTime::from_fractional_secs(
|
3484 - | 946845296, 0_f64,
|
3485 - | ),
|
3486 - | ),
|
3487 - | blob: ::std::option::Option::None,
|
3488 - | boolean: ::std::option::Option::None,
|
3489 - | double: ::std::option::Option::None,
|
3490 - | empty_struct: ::std::option::Option::None,
|
3491 - | float: ::std::option::Option::None,
|
3492 - | httpdate_timestamp: ::std::option::Option::None,
|
3493 - | integer: ::std::option::Option::None,
|
3494 - | json_value: ::std::option::Option::None,
|
3495 - | list_of_lists: ::std::option::Option::None,
|
3496 - | list_of_maps_of_strings: ::std::option::Option::None,
|
3497 - | list_of_strings: ::std::option::Option::None,
|
3498 - | list_of_structs: ::std::option::Option::None,
|
3499 - | long: ::std::option::Option::None,
|
3500 - | map_of_lists_of_strings: ::std::option::Option::None,
|
3501 - | map_of_maps: ::std::option::Option::None,
|
3502 - | map_of_strings: ::std::option::Option::None,
|
3503 - | map_of_structs: ::std::option::Option::None,
|
3504 - | recursive_list: ::std::option::Option::None,
|
3505 - | recursive_map: ::std::option::Option::None,
|
3506 - | recursive_struct: ::std::option::Option::None,
|
3507 - | simple_struct: ::std::option::Option::None,
|
3508 - | string: ::std::option::Option::None,
|
3509 - | struct_with_json_name: ::std::option::Option::None,
|
3510 - | timestamp: ::std::option::Option::None,
|
3511 - | unix_timestamp: ::std::option::Option::None,
|
2291 + | let expected = crate::input::JsonEnumsInput {
|
2292 + | foo_enum1: ::std::option::Option::Some(
|
2293 + | "Foo"
|
2294 + | .parse::<crate::model::FooEnum>()
|
2295 + | .expect("static value validated to member"),
|
2296 + | ),
|
2297 + | foo_enum2: ::std::option::Option::Some(
|
2298 + | "0".parse::<crate::model::FooEnum>()
|
2299 + | .expect("static value validated to member"),
|
2300 + | ),
|
2301 + | foo_enum3: ::std::option::Option::Some(
|
2302 + | "1".parse::<crate::model::FooEnum>()
|
2303 + | .expect("static value validated to member"),
|
2304 + | ),
|
2305 + | foo_enum_list: ::std::option::Option::Some(vec![
|
2306 + | "Foo"
|
2307 + | .parse::<crate::model::FooEnum>()
|
2308 + | .expect("static value validated to member"),
|
2309 + | "0".parse::<crate::model::FooEnum>()
|
2310 + | .expect("static value validated to member"),
|
2311 + | ]),
|
2312 + | foo_enum_set: ::std::option::Option::Some(
|
2313 + | vec![
|
2314 + | "Foo"
|
2315 + | .parse::<crate::model::FooEnum>()
|
2316 + | .expect("static value validated to member"),
|
2317 + | "0".parse::<crate::model::FooEnum>()
|
2318 + | .expect("static value validated to member"),
|
2319 + | ]
|
2320 + | .try_into()
|
2321 + | .expect("this is only used in tests"),
|
2322 + | ),
|
2323 + | foo_enum_map: ::std::option::Option::Some({
|
2324 + | let mut ret = ::std::collections::HashMap::new();
|
2325 + | ret.insert(
|
2326 + | "hi".to_owned(),
|
2327 + | "Foo"
|
2328 + | .parse::<crate::model::FooEnum>()
|
2329 + | .expect("static value validated to member"),
|
2330 + | );
|
2331 + | ret.insert(
|
2332 + | "zero".to_owned(),
|
2333 + | "0".parse::<crate::model::FooEnum>()
|
2334 + | .expect("static value validated to member"),
|
2335 + | );
|
2336 + | ret
|
2337 + | }),
|
3512 2338 | };
|
3513 - | ::pretty_assertions::assert_eq!(
|
3514 - | input.blob,
|
3515 - | expected.blob,
|
3516 - | "Unexpected value for `blob`"
|
3517 - | );
|
3518 - | ::pretty_assertions::assert_eq!(
|
3519 - | input.boolean,
|
3520 - | expected.boolean,
|
3521 - | "Unexpected value for `boolean`"
|
3522 - | );
|
3523 - | assert!(
|
3524 - | input.double.float_equals(&expected.double),
|
3525 - | "Unexpected value for `double` {:?} vs. {:?}",
|
3526 - | expected.double,
|
3527 - | input.double
|
3528 - | );
|
3529 - | ::pretty_assertions::assert_eq!(
|
3530 - | input.empty_struct,
|
3531 - | expected.empty_struct,
|
3532 - | "Unexpected value for `empty_struct`"
|
3533 - | );
|
3534 - | assert!(
|
3535 - | input.float.float_equals(&expected.float),
|
3536 - | "Unexpected value for `float` {:?} vs. {:?}",
|
3537 - | expected.float,
|
3538 - | input.float
|
3539 - | );
|
3540 - | ::pretty_assertions::assert_eq!(
|
3541 - | input.httpdate_timestamp,
|
3542 - | expected.httpdate_timestamp,
|
3543 - | "Unexpected value for `httpdate_timestamp`"
|
3544 - | );
|
3545 - | ::pretty_assertions::assert_eq!(
|
3546 - | input.integer,
|
3547 - | expected.integer,
|
3548 - | "Unexpected value for `integer`"
|
3549 - | );
|
3550 - | ::pretty_assertions::assert_eq!(
|
3551 - | input.iso8601_timestamp,
|
3552 - | expected.iso8601_timestamp,
|
3553 - | "Unexpected value for `iso8601_timestamp`"
|
3554 - | );
|
3555 - | ::pretty_assertions::assert_eq!(
|
3556 - | input.json_value,
|
3557 - | expected.json_value,
|
3558 - | "Unexpected value for `json_value`"
|
3559 - | );
|
3560 - | ::pretty_assertions::assert_eq!(
|
3561 - | input.list_of_lists,
|
3562 - | expected.list_of_lists,
|
3563 - | "Unexpected value for `list_of_lists`"
|
3564 - | );
|
3565 - | ::pretty_assertions::assert_eq!(
|
3566 - | input.list_of_maps_of_strings,
|
3567 - | expected.list_of_maps_of_strings,
|
3568 - | "Unexpected value for `list_of_maps_of_strings`"
|
3569 - | );
|
3570 - | ::pretty_assertions::assert_eq!(
|
3571 - | input.list_of_strings,
|
3572 - | expected.list_of_strings,
|
3573 - | "Unexpected value for `list_of_strings`"
|
3574 - | );
|
3575 - | ::pretty_assertions::assert_eq!(
|
3576 - | input.list_of_structs,
|
3577 - | expected.list_of_structs,
|
3578 - | "Unexpected value for `list_of_structs`"
|
3579 - | );
|
3580 - | ::pretty_assertions::assert_eq!(
|
3581 - | input.long,
|
3582 - | expected.long,
|
3583 - | "Unexpected value for `long`"
|
3584 - | );
|
3585 - | ::pretty_assertions::assert_eq!(
|
3586 - | input.map_of_lists_of_strings,
|
3587 - | expected.map_of_lists_of_strings,
|
3588 - | "Unexpected value for `map_of_lists_of_strings`"
|
3589 - | );
|
3590 - | ::pretty_assertions::assert_eq!(
|
3591 - | input.map_of_maps,
|
3592 - | expected.map_of_maps,
|
3593 - | "Unexpected value for `map_of_maps`"
|
3594 - | );
|
3595 - | ::pretty_assertions::assert_eq!(
|
3596 - | input.map_of_strings,
|
3597 - | expected.map_of_strings,
|
3598 - | "Unexpected value for `map_of_strings`"
|
3599 - | );
|
3600 - | ::pretty_assertions::assert_eq!(
|
3601 - | input.map_of_structs,
|
3602 - | expected.map_of_structs,
|
3603 - | "Unexpected value for `map_of_structs`"
|
3604 - | );
|
3605 - | ::pretty_assertions::assert_eq!(
|
3606 - | input.recursive_list,
|
3607 - | expected.recursive_list,
|
3608 - | "Unexpected value for `recursive_list`"
|
3609 - | );
|
3610 - | ::pretty_assertions::assert_eq!(
|
3611 - | input.recursive_map,
|
3612 - | expected.recursive_map,
|
3613 - | "Unexpected value for `recursive_map`"
|
3614 - | );
|
3615 - | ::pretty_assertions::assert_eq!(
|
3616 - | input.recursive_struct,
|
3617 - | expected.recursive_struct,
|
3618 - | "Unexpected value for `recursive_struct`"
|
3619 - | );
|
3620 - | ::pretty_assertions::assert_eq!(
|
3621 - | input.simple_struct,
|
3622 - | expected.simple_struct,
|
3623 - | "Unexpected value for `simple_struct`"
|
3624 - | );
|
3625 - | ::pretty_assertions::assert_eq!(
|
3626 - | input.string,
|
3627 - | expected.string,
|
3628 - | "Unexpected value for `string`"
|
3629 - | );
|
3630 - | ::pretty_assertions::assert_eq!(
|
3631 - | input.struct_with_json_name,
|
3632 - | expected.struct_with_json_name,
|
3633 - | "Unexpected value for `struct_with_json_name`"
|
3634 - | );
|
3635 - | ::pretty_assertions::assert_eq!(
|
3636 - | input.timestamp,
|
3637 - | expected.timestamp,
|
3638 - | "Unexpected value for `timestamp`"
|
3639 - | );
|
3640 - | ::pretty_assertions::assert_eq!(
|
3641 - | input.unix_timestamp,
|
3642 - | expected.unix_timestamp,
|
3643 - | "Unexpected value for `unix_timestamp`"
|
3644 - | );
|
3645 - | let response = crate::output::KitchenSinkOperationOutput {
|
3646 - | blob: ::std::option::Option::None,
|
3647 - | boolean: ::std::option::Option::None,
|
3648 - | double: ::std::option::Option::None,
|
3649 - | empty_struct: ::std::option::Option::None,
|
3650 - | float: ::std::option::Option::None,
|
3651 - | httpdate_timestamp: ::std::option::Option::None,
|
3652 - | integer: ::std::option::Option::None,
|
3653 - | iso8601_timestamp: ::std::option::Option::None,
|
3654 - | json_value: ::std::option::Option::None,
|
3655 - | list_of_lists: ::std::option::Option::None,
|
3656 - | list_of_maps_of_strings: ::std::option::Option::None,
|
3657 - | list_of_strings: ::std::option::Option::None,
|
3658 - | list_of_structs: ::std::option::Option::None,
|
3659 - | long: ::std::option::Option::None,
|
3660 - | map_of_lists_of_strings: ::std::option::Option::None,
|
3661 - | map_of_maps: ::std::option::Option::None,
|
3662 - | map_of_strings: ::std::option::Option::None,
|
3663 - | map_of_structs: ::std::option::Option::None,
|
3664 - | recursive_list: ::std::option::Option::None,
|
3665 - | recursive_map: ::std::option::Option::None,
|
3666 - | recursive_struct: ::std::option::Option::None,
|
3667 - | simple_struct: ::std::option::Option::None,
|
3668 - | string: ::std::option::Option::None,
|
3669 - | struct_with_json_name: ::std::option::Option::None,
|
3670 - | timestamp: ::std::option::Option::None,
|
3671 - | unix_timestamp: ::std::option::Option::None,
|
2339 + | ::pretty_assertions::assert_eq!(input, expected);
|
2340 + | let response = crate::output::JsonEnumsOutput {
|
2341 + | foo_enum1: ::std::option::Option::None,
|
2342 + | foo_enum2: ::std::option::Option::None,
|
2343 + | foo_enum3: ::std::option::Option::None,
|
2344 + | foo_enum_list: ::std::option::Option::None,
|
2345 + | foo_enum_set: ::std::option::Option::None,
|
2346 + | foo_enum_map: ::std::option::Option::None,
|
3672 2347 | };
|
3673 2348 | Ok(response)
|
3674 2349 | };
|
3675 2350 | sender.send(()).await.expect("receiver dropped early");
|
3676 2351 | result
|
3677 2352 | }
|
3678 2353 | })
|
3679 2354 | .build_unchecked();
|
3680 2355 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3681 2356 | .await
|
3682 2357 | .expect("unable to make an HTTP request");
|
3683 - | assert!(receiver.recv().await.is_some());
|
2358 + | assert!(
|
2359 + | receiver.recv().await.is_some(),
|
2360 + | "we expected operation handler to be invoked but it was not entered"
|
2361 + | );
|
3684 2362 | }
|
3685 - | /// Serializes timestamp shapes with httpdate timestampFormat
|
3686 - | /// Test ID: serializes_timestamp_shapes_with_httpdate_timestampformat
|
2363 + | /// Serializes simple scalar properties
|
2364 + | /// Test ID: AwsJson11Enums
|
3687 2365 | #[::tokio::test]
|
3688 - | async fn serializes_timestamp_shapes_with_httpdate_timestampformat_request() {
|
3689 - | #[allow(unused_mut)]
|
3690 - | let mut http_request = http::Request::builder()
|
3691 - | .uri("/")
|
3692 - | .method("POST")
|
3693 - | .header("Content-Type", "application/x-amz-json-1.1")
|
3694 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
3695 - | .body(::aws_smithy_http_server::body::Body::from(
|
3696 - | ::bytes::Bytes::from_static(
|
3697 - | "{\"HttpdateTimestamp\":\"Sun, 02 Jan 2000 20:34:56 GMT\"}".as_bytes(),
|
3698 - | ),
|
3699 - | ))
|
2366 + | #[::tracing_test::traced_test]
|
2367 + | async fn aws_json11_enums_response() {
|
2368 + | let output = crate::output::JsonEnumsOutput {
|
2369 + | foo_enum1: ::std::option::Option::Some(
|
2370 + | "Foo"
|
2371 + | .parse::<crate::model::FooEnum>()
|
2372 + | .expect("static value validated to member"),
|
2373 + | ),
|
2374 + | foo_enum2: ::std::option::Option::Some(
|
2375 + | "0".parse::<crate::model::FooEnum>()
|
2376 + | .expect("static value validated to member"),
|
2377 + | ),
|
2378 + | foo_enum3: ::std::option::Option::Some(
|
2379 + | "1".parse::<crate::model::FooEnum>()
|
2380 + | .expect("static value validated to member"),
|
2381 + | ),
|
2382 + | foo_enum_list: ::std::option::Option::Some(vec![
|
2383 + | "Foo"
|
2384 + | .parse::<crate::model::FooEnum>()
|
2385 + | .expect("static value validated to member"),
|
2386 + | "0".parse::<crate::model::FooEnum>()
|
2387 + | .expect("static value validated to member"),
|
2388 + | ]),
|
2389 + | foo_enum_set: ::std::option::Option::Some(
|
2390 + | vec![
|
2391 + | "Foo"
|
2392 + | .parse::<crate::model::FooEnum>()
|
2393 + | .expect("static value validated to member"),
|
2394 + | "0".parse::<crate::model::FooEnum>()
|
2395 + | .expect("static value validated to member"),
|
2396 + | ]
|
2397 + | .try_into()
|
2398 + | .expect("this is only used in tests"),
|
2399 + | ),
|
2400 + | foo_enum_map: ::std::option::Option::Some({
|
2401 + | let mut ret = ::std::collections::HashMap::new();
|
2402 + | ret.insert(
|
2403 + | "hi".to_owned(),
|
2404 + | "Foo"
|
2405 + | .parse::<crate::model::FooEnum>()
|
2406 + | .expect("static value validated to member"),
|
2407 + | );
|
2408 + | ret.insert(
|
2409 + | "zero".to_owned(),
|
2410 + | "0".parse::<crate::model::FooEnum>()
|
2411 + | .expect("static value validated to member"),
|
2412 + | );
|
2413 + | ret
|
2414 + | }),
|
2415 + | };
|
2416 + | use ::aws_smithy_http_server::response::IntoResponse;
|
2417 + | let http_response = output.into_response();
|
2418 + | ::pretty_assertions::assert_eq!(
|
2419 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2420 + | http_response.status()
|
2421 + | );
|
2422 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
2423 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2424 + | http_response.headers(),
|
2425 + | expected_headers,
|
2426 + | ));
|
2427 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2428 + | .await
|
2429 + | .expect("unable to extract body to bytes");
|
2430 + | ::aws_smithy_protocol_test::assert_ok(
|
2431 + | ::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"))
|
2432 + | );
|
2433 + | }
|
2434 + | }
|
2435 + |
|
2436 + | static CONTENT_TYPE_PUTANDGETINLINEDOCUMENTS: ::once_cell::sync::Lazy<::mime::Mime> =
|
2437 + | ::once_cell::sync::Lazy::new(|| {
|
2438 + | "application/x-amz-json-1.1"
|
2439 + | .parse::<::mime::Mime>()
|
2440 + | .expect("BUG: MIME parsing failed, content_type is not valid")
|
2441 + | });
|
2442 + | ::pin_project_lite::pin_project! {
|
2443 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2444 + | /// [`PutAndGetInlineDocumentsInput`](crate::input::PutAndGetInlineDocumentsInput) using modelled bindings.
|
2445 + | pub struct PutAndGetInlineDocumentsInputFuture {
|
2446 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::PutAndGetInlineDocumentsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
2447 + | }
|
2448 + | }
|
2449 + |
|
2450 + | impl std::future::Future for PutAndGetInlineDocumentsInputFuture {
|
2451 + | type Output = Result<
|
2452 + | crate::input::PutAndGetInlineDocumentsInput,
|
2453 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
2454 + | >;
|
2455 + |
|
2456 + | fn poll(
|
2457 + | self: std::pin::Pin<&mut Self>,
|
2458 + | cx: &mut std::task::Context<'_>,
|
2459 + | ) -> std::task::Poll<Self::Output> {
|
2460 + | let this = self.project();
|
2461 + | this.inner.as_mut().poll(cx)
|
2462 + | }
|
2463 + | }
|
2464 + |
|
2465 + | impl<B>
|
2466 + | ::aws_smithy_http_server::request::FromRequest<
|
2467 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2468 + | B,
|
2469 + | > for crate::input::PutAndGetInlineDocumentsInput
|
2470 + | where
|
2471 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
2472 + | B: 'static,
|
2473 + |
|
2474 + | B::Data: Send,
|
2475 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
2476 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
2477 + | {
|
2478 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
2479 + | type Future = PutAndGetInlineDocumentsInputFuture;
|
2480 + |
|
2481 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2482 + | let fut = async move {
|
2483 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
2484 + | request.headers(),
|
2485 + | &CONTENT_TYPE_PUTANDGETINLINEDOCUMENTS,
|
2486 + | ) {
|
2487 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
2488 + | }
|
2489 + | crate::protocol_serde::shape_put_and_get_inline_documents::de_put_and_get_inline_documents_http_request(request)
|
2490 + | .await
|
2491 + | .map_err(Into::into)
|
2492 + | };
|
2493 + | use ::futures_util::future::TryFutureExt;
|
2494 + | let fut = fut.map_err(
|
2495 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
2496 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2497 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
2498 + | },
|
2499 + | );
|
2500 + | PutAndGetInlineDocumentsInputFuture {
|
2501 + | inner: Box::pin(fut),
|
2502 + | }
|
2503 + | }
|
2504 + | }
|
2505 + | impl
|
2506 + | ::aws_smithy_http_server::response::IntoResponse<
|
2507 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2508 + | > for crate::output::PutAndGetInlineDocumentsOutput
|
2509 + | {
|
2510 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
2511 + | match crate::protocol_serde::shape_put_and_get_inline_documents::ser_put_and_get_inline_documents_http_response(self) {
|
2512 + | Ok(response) => response,
|
2513 + | Err(e) => {
|
2514 + | ::tracing::error!(error = %e, "failed to serialize response");
|
2515 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
2516 + | }
|
2517 + | }
|
2518 + | }
|
2519 + | }
|
2520 + |
|
2521 + | #[allow(unreachable_code, unused_variables)]
|
2522 + | #[cfg(test)]
|
2523 + | mod put_and_get_inline_documents_test {
|
2524 + |
|
2525 + | /// Serializes inline documents in a JSON request.
|
2526 + | /// Test ID: PutAndGetInlineDocumentsInput
|
2527 + | #[::tokio::test]
|
2528 + | #[::tracing_test::traced_test]
|
2529 + | async fn put_and_get_inline_documents_input_request() {
|
2530 + | #[allow(unused_mut)]
|
2531 + | let mut http_request = http::Request::builder()
|
2532 + | .uri("/")
|
2533 + | .method("POST")
|
2534 + | .header("Content-Type", "application/x-amz-json-1.1")
|
2535 + | .header("X-Amz-Target", "JsonProtocol.PutAndGetInlineDocuments")
|
2536 + | .body(::aws_smithy_http_server::body::Body::from(
|
2537 + | ::bytes::Bytes::from_static(
|
2538 + | "{\n \"inlineDocument\": {\"foo\": \"bar\"}\n}".as_bytes(),
|
2539 + | ),
|
2540 + | ))
|
3700 2541 | .unwrap();
|
3701 2542 | #[allow(unused_mut)]
|
3702 2543 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3703 2544 | let config = crate::service::JsonProtocolConfig::builder().build();
|
3704 2545 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3705 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
3706 - | let sender = sender.clone();
|
3707 - | async move {
|
3708 - | let result = {
|
3709 - | use ::aws_smithy_protocol_test::FloatEquals;
|
3710 - | let expected = crate::input::KitchenSinkOperationInput {
|
3711 - | httpdate_timestamp: ::std::option::Option::Some(
|
3712 - | ::aws_smithy_types::DateTime::from_fractional_secs(
|
3713 - | 946845296, 0_f64,
|
3714 - | ),
|
3715 - | ),
|
3716 - | blob: ::std::option::Option::None,
|
3717 - | boolean: ::std::option::Option::None,
|
3718 - | double: ::std::option::Option::None,
|
3719 - | empty_struct: ::std::option::Option::None,
|
3720 - | float: ::std::option::Option::None,
|
3721 - | integer: ::std::option::Option::None,
|
3722 - | iso8601_timestamp: ::std::option::Option::None,
|
3723 - | json_value: ::std::option::Option::None,
|
3724 - | list_of_lists: ::std::option::Option::None,
|
3725 - | list_of_maps_of_strings: ::std::option::Option::None,
|
3726 - | list_of_strings: ::std::option::Option::None,
|
3727 - | list_of_structs: ::std::option::Option::None,
|
3728 - | long: ::std::option::Option::None,
|
3729 - | map_of_lists_of_strings: ::std::option::Option::None,
|
3730 - | map_of_maps: ::std::option::Option::None,
|
3731 - | map_of_strings: ::std::option::Option::None,
|
3732 - | map_of_structs: ::std::option::Option::None,
|
3733 - | recursive_list: ::std::option::Option::None,
|
3734 - | recursive_map: ::std::option::Option::None,
|
3735 - | recursive_struct: ::std::option::Option::None,
|
3736 - | simple_struct: ::std::option::Option::None,
|
3737 - | string: ::std::option::Option::None,
|
3738 - | struct_with_json_name: ::std::option::Option::None,
|
3739 - | timestamp: ::std::option::Option::None,
|
3740 - | unix_timestamp: ::std::option::Option::None,
|
2546 + | .put_and_get_inline_documents(
|
2547 + | move |input: crate::input::PutAndGetInlineDocumentsInput| {
|
2548 + | let sender = sender.clone();
|
2549 + | async move {
|
2550 + | let result = {
|
2551 + | let expected = crate::input::PutAndGetInlineDocumentsInput {
|
2552 + | inline_document: ::std::option::Option::Some({
|
2553 + | let json_bytes = br#"{
|
2554 + | "foo": "bar"
|
2555 + | }"#;
|
2556 + | let mut tokens =
|
2557 + | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
2558 + | .peekable();
|
2559 + | ::aws_smithy_json::deserialize::token::expect_document(
|
2560 + | &mut tokens,
|
2561 + | )
|
2562 + | .expect("well formed json")
|
2563 + | }),
|
2564 + | };
|
2565 + | ::pretty_assertions::assert_eq!(input, expected);
|
2566 + | let response = crate::output::PutAndGetInlineDocumentsOutput {
|
2567 + | inline_document: ::std::option::Option::Some({
|
2568 + | let json_bytes = br#"null"#;
|
2569 + | let mut tokens =
|
2570 + | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
2571 + | .peekable();
|
2572 + | ::aws_smithy_json::deserialize::token::expect_document(
|
2573 + | &mut tokens,
|
2574 + | )
|
2575 + | .expect("well formed json")
|
2576 + | }),
|
2577 + | };
|
2578 + | response
|
3741 2579 | };
|
3742 - | ::pretty_assertions::assert_eq!(
|
3743 - | input.blob,
|
3744 - | expected.blob,
|
3745 - | "Unexpected value for `blob`"
|
3746 - | );
|
3747 - | ::pretty_assertions::assert_eq!(
|
3748 - | input.boolean,
|
3749 - | expected.boolean,
|
3750 - | "Unexpected value for `boolean`"
|
3751 - | );
|
3752 - | assert!(
|
3753 - | input.double.float_equals(&expected.double),
|
3754 - | "Unexpected value for `double` {:?} vs. {:?}",
|
3755 - | expected.double,
|
3756 - | input.double
|
3757 - | );
|
3758 - | ::pretty_assertions::assert_eq!(
|
3759 - | input.empty_struct,
|
3760 - | expected.empty_struct,
|
3761 - | "Unexpected value for `empty_struct`"
|
3762 - | );
|
3763 - | assert!(
|
3764 - | input.float.float_equals(&expected.float),
|
3765 - | "Unexpected value for `float` {:?} vs. {:?}",
|
3766 - | expected.float,
|
3767 - | input.float
|
3768 - | );
|
3769 - | ::pretty_assertions::assert_eq!(
|
3770 - | input.httpdate_timestamp,
|
3771 - | expected.httpdate_timestamp,
|
3772 - | "Unexpected value for `httpdate_timestamp`"
|
3773 - | );
|
3774 - | ::pretty_assertions::assert_eq!(
|
3775 - | input.integer,
|
3776 - | expected.integer,
|
3777 - | "Unexpected value for `integer`"
|
3778 - | );
|
3779 - | ::pretty_assertions::assert_eq!(
|
3780 - | input.iso8601_timestamp,
|
3781 - | expected.iso8601_timestamp,
|
3782 - | "Unexpected value for `iso8601_timestamp`"
|
3783 - | );
|
3784 - | ::pretty_assertions::assert_eq!(
|
3785 - | input.json_value,
|
3786 - | expected.json_value,
|
3787 - | "Unexpected value for `json_value`"
|
3788 - | );
|
3789 - | ::pretty_assertions::assert_eq!(
|
3790 - | input.list_of_lists,
|
3791 - | expected.list_of_lists,
|
3792 - | "Unexpected value for `list_of_lists`"
|
3793 - | );
|
3794 - | ::pretty_assertions::assert_eq!(
|
3795 - | input.list_of_maps_of_strings,
|
3796 - | expected.list_of_maps_of_strings,
|
3797 - | "Unexpected value for `list_of_maps_of_strings`"
|
3798 - | );
|
3799 - | ::pretty_assertions::assert_eq!(
|
3800 - | input.list_of_strings,
|
3801 - | expected.list_of_strings,
|
3802 - | "Unexpected value for `list_of_strings`"
|
3803 - | );
|
3804 - | ::pretty_assertions::assert_eq!(
|
3805 - | input.list_of_structs,
|
3806 - | expected.list_of_structs,
|
3807 - | "Unexpected value for `list_of_structs`"
|
3808 - | );
|
3809 - | ::pretty_assertions::assert_eq!(
|
3810 - | input.long,
|
3811 - | expected.long,
|
3812 - | "Unexpected value for `long`"
|
3813 - | );
|
3814 - | ::pretty_assertions::assert_eq!(
|
3815 - | input.map_of_lists_of_strings,
|
3816 - | expected.map_of_lists_of_strings,
|
3817 - | "Unexpected value for `map_of_lists_of_strings`"
|
3818 - | );
|
3819 - | ::pretty_assertions::assert_eq!(
|
3820 - | input.map_of_maps,
|
3821 - | expected.map_of_maps,
|
3822 - | "Unexpected value for `map_of_maps`"
|
3823 - | );
|
3824 - | ::pretty_assertions::assert_eq!(
|
3825 - | input.map_of_strings,
|
3826 - | expected.map_of_strings,
|
3827 - | "Unexpected value for `map_of_strings`"
|
3828 - | );
|
3829 - | ::pretty_assertions::assert_eq!(
|
3830 - | input.map_of_structs,
|
3831 - | expected.map_of_structs,
|
3832 - | "Unexpected value for `map_of_structs`"
|
3833 - | );
|
3834 - | ::pretty_assertions::assert_eq!(
|
3835 - | input.recursive_list,
|
3836 - | expected.recursive_list,
|
3837 - | "Unexpected value for `recursive_list`"
|
3838 - | );
|
3839 - | ::pretty_assertions::assert_eq!(
|
3840 - | input.recursive_map,
|
3841 - | expected.recursive_map,
|
3842 - | "Unexpected value for `recursive_map`"
|
3843 - | );
|
3844 - | ::pretty_assertions::assert_eq!(
|
3845 - | input.recursive_struct,
|
3846 - | expected.recursive_struct,
|
3847 - | "Unexpected value for `recursive_struct`"
|
3848 - | );
|
3849 - | ::pretty_assertions::assert_eq!(
|
3850 - | input.simple_struct,
|
3851 - | expected.simple_struct,
|
3852 - | "Unexpected value for `simple_struct`"
|
3853 - | );
|
3854 - | ::pretty_assertions::assert_eq!(
|
3855 - | input.string,
|
3856 - | expected.string,
|
3857 - | "Unexpected value for `string`"
|
3858 - | );
|
3859 - | ::pretty_assertions::assert_eq!(
|
3860 - | input.struct_with_json_name,
|
3861 - | expected.struct_with_json_name,
|
3862 - | "Unexpected value for `struct_with_json_name`"
|
3863 - | );
|
3864 - | ::pretty_assertions::assert_eq!(
|
3865 - | input.timestamp,
|
3866 - | expected.timestamp,
|
3867 - | "Unexpected value for `timestamp`"
|
3868 - | );
|
3869 - | ::pretty_assertions::assert_eq!(
|
3870 - | input.unix_timestamp,
|
3871 - | expected.unix_timestamp,
|
3872 - | "Unexpected value for `unix_timestamp`"
|
3873 - | );
|
3874 - | let response = crate::output::KitchenSinkOperationOutput {
|
3875 - | blob: ::std::option::Option::None,
|
3876 - | boolean: ::std::option::Option::None,
|
3877 - | double: ::std::option::Option::None,
|
3878 - | empty_struct: ::std::option::Option::None,
|
3879 - | float: ::std::option::Option::None,
|
3880 - | httpdate_timestamp: ::std::option::Option::None,
|
3881 - | integer: ::std::option::Option::None,
|
3882 - | iso8601_timestamp: ::std::option::Option::None,
|
3883 - | json_value: ::std::option::Option::None,
|
3884 - | list_of_lists: ::std::option::Option::None,
|
3885 - | list_of_maps_of_strings: ::std::option::Option::None,
|
3886 - | list_of_strings: ::std::option::Option::None,
|
3887 - | list_of_structs: ::std::option::Option::None,
|
3888 - | long: ::std::option::Option::None,
|
3889 - | map_of_lists_of_strings: ::std::option::Option::None,
|
3890 - | map_of_maps: ::std::option::Option::None,
|
3891 - | map_of_strings: ::std::option::Option::None,
|
3892 - | map_of_structs: ::std::option::Option::None,
|
3893 - | recursive_list: ::std::option::Option::None,
|
3894 - | recursive_map: ::std::option::Option::None,
|
3895 - | recursive_struct: ::std::option::Option::None,
|
3896 - | simple_struct: ::std::option::Option::None,
|
3897 - | string: ::std::option::Option::None,
|
3898 - | struct_with_json_name: ::std::option::Option::None,
|
3899 - | timestamp: ::std::option::Option::None,
|
3900 - | unix_timestamp: ::std::option::Option::None,
|
3901 - | };
|
3902 - | Ok(response)
|
3903 - | };
|
3904 - | sender.send(()).await.expect("receiver dropped early");
|
3905 - | result
|
3906 - | }
|
3907 - | })
|
2580 + | sender.send(()).await.expect("receiver dropped early");
|
2581 + | result
|
2582 + | }
|
2583 + | },
|
2584 + | )
|
3908 2585 | .build_unchecked();
|
3909 2586 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3910 2587 | .await
|
3911 2588 | .expect("unable to make an HTTP request");
|
3912 - | assert!(receiver.recv().await.is_some());
|
2589 + | assert!(
|
2590 + | receiver.recv().await.is_some(),
|
2591 + | "we expected operation handler to be invoked but it was not entered"
|
2592 + | );
|
3913 2593 | }
|
3914 - | /// Serializes timestamp shapes with unixTimestamp timestampFormat
|
3915 - | /// Test ID: serializes_timestamp_shapes_with_unixtimestamp_timestampformat
|
2594 + | /// Serializes inline documents in a JSON response.
|
2595 + | /// Test ID: PutAndGetInlineDocumentsInput
|
3916 2596 | #[::tokio::test]
|
3917 - | async fn serializes_timestamp_shapes_with_unixtimestamp_timestampformat_request() {
|
3918 - | #[allow(unused_mut)]
|
3919 - | let mut http_request = http::Request::builder()
|
3920 - | .uri("/")
|
3921 - | .method("POST")
|
3922 - | .header("Content-Type", "application/x-amz-json-1.1")
|
3923 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
3924 - | .body(::aws_smithy_http_server::body::Body::from(
|
3925 - | ::bytes::Bytes::from_static("{\"UnixTimestamp\":946845296}".as_bytes()),
|
3926 - | ))
|
3927 - | .unwrap();
|
3928 - | #[allow(unused_mut)]
|
3929 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3930 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
3931 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3932 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
3933 - | let sender = sender.clone();
|
3934 - | async move {
|
3935 - | let result = {
|
3936 - | use ::aws_smithy_protocol_test::FloatEquals;
|
3937 - | let expected = crate::input::KitchenSinkOperationInput {
|
3938 - | unix_timestamp: ::std::option::Option::Some(
|
3939 - | ::aws_smithy_types::DateTime::from_fractional_secs(
|
3940 - | 946845296, 0_f64,
|
3941 - | ),
|
3942 - | ),
|
3943 - | blob: ::std::option::Option::None,
|
3944 - | boolean: ::std::option::Option::None,
|
3945 - | double: ::std::option::Option::None,
|
3946 - | empty_struct: ::std::option::Option::None,
|
3947 - | float: ::std::option::Option::None,
|
3948 - | httpdate_timestamp: ::std::option::Option::None,
|
3949 - | integer: ::std::option::Option::None,
|
3950 - | iso8601_timestamp: ::std::option::Option::None,
|
3951 - | json_value: ::std::option::Option::None,
|
3952 - | list_of_lists: ::std::option::Option::None,
|
3953 - | list_of_maps_of_strings: ::std::option::Option::None,
|
3954 - | list_of_strings: ::std::option::Option::None,
|
3955 - | list_of_structs: ::std::option::Option::None,
|
3956 - | long: ::std::option::Option::None,
|
3957 - | map_of_lists_of_strings: ::std::option::Option::None,
|
3958 - | map_of_maps: ::std::option::Option::None,
|
3959 - | map_of_strings: ::std::option::Option::None,
|
3960 - | map_of_structs: ::std::option::Option::None,
|
3961 - | recursive_list: ::std::option::Option::None,
|
3962 - | recursive_map: ::std::option::Option::None,
|
3963 - | recursive_struct: ::std::option::Option::None,
|
3964 - | simple_struct: ::std::option::Option::None,
|
3965 - | string: ::std::option::Option::None,
|
3966 - | struct_with_json_name: ::std::option::Option::None,
|
3967 - | timestamp: ::std::option::Option::None,
|
3968 - | };
|
3969 - | ::pretty_assertions::assert_eq!(
|
3970 - | input.blob,
|
3971 - | expected.blob,
|
3972 - | "Unexpected value for `blob`"
|
3973 - | );
|
3974 - | ::pretty_assertions::assert_eq!(
|
3975 - | input.boolean,
|
3976 - | expected.boolean,
|
3977 - | "Unexpected value for `boolean`"
|
3978 - | );
|
3979 - | assert!(
|
3980 - | input.double.float_equals(&expected.double),
|
3981 - | "Unexpected value for `double` {:?} vs. {:?}",
|
3982 - | expected.double,
|
3983 - | input.double
|
3984 - | );
|
3985 - | ::pretty_assertions::assert_eq!(
|
3986 - | input.empty_struct,
|
3987 - | expected.empty_struct,
|
3988 - | "Unexpected value for `empty_struct`"
|
3989 - | );
|
3990 - | assert!(
|
3991 - | input.float.float_equals(&expected.float),
|
3992 - | "Unexpected value for `float` {:?} vs. {:?}",
|
3993 - | expected.float,
|
3994 - | input.float
|
3995 - | );
|
3996 - | ::pretty_assertions::assert_eq!(
|
3997 - | input.httpdate_timestamp,
|
3998 - | expected.httpdate_timestamp,
|
3999 - | "Unexpected value for `httpdate_timestamp`"
|
4000 - | );
|
4001 - | ::pretty_assertions::assert_eq!(
|
4002 - | input.integer,
|
4003 - | expected.integer,
|
4004 - | "Unexpected value for `integer`"
|
4005 - | );
|
4006 - | ::pretty_assertions::assert_eq!(
|
4007 - | input.iso8601_timestamp,
|
4008 - | expected.iso8601_timestamp,
|
4009 - | "Unexpected value for `iso8601_timestamp`"
|
4010 - | );
|
4011 - | ::pretty_assertions::assert_eq!(
|
4012 - | input.json_value,
|
4013 - | expected.json_value,
|
4014 - | "Unexpected value for `json_value`"
|
4015 - | );
|
4016 - | ::pretty_assertions::assert_eq!(
|
4017 - | input.list_of_lists,
|
4018 - | expected.list_of_lists,
|
4019 - | "Unexpected value for `list_of_lists`"
|
4020 - | );
|
4021 - | ::pretty_assertions::assert_eq!(
|
4022 - | input.list_of_maps_of_strings,
|
4023 - | expected.list_of_maps_of_strings,
|
4024 - | "Unexpected value for `list_of_maps_of_strings`"
|
4025 - | );
|
4026 - | ::pretty_assertions::assert_eq!(
|
4027 - | input.list_of_strings,
|
4028 - | expected.list_of_strings,
|
4029 - | "Unexpected value for `list_of_strings`"
|
4030 - | );
|
4031 - | ::pretty_assertions::assert_eq!(
|
4032 - | input.list_of_structs,
|
4033 - | expected.list_of_structs,
|
4034 - | "Unexpected value for `list_of_structs`"
|
4035 - | );
|
4036 - | ::pretty_assertions::assert_eq!(
|
4037 - | input.long,
|
4038 - | expected.long,
|
4039 - | "Unexpected value for `long`"
|
4040 - | );
|
4041 - | ::pretty_assertions::assert_eq!(
|
4042 - | input.map_of_lists_of_strings,
|
4043 - | expected.map_of_lists_of_strings,
|
4044 - | "Unexpected value for `map_of_lists_of_strings`"
|
4045 - | );
|
4046 - | ::pretty_assertions::assert_eq!(
|
4047 - | input.map_of_maps,
|
4048 - | expected.map_of_maps,
|
4049 - | "Unexpected value for `map_of_maps`"
|
4050 - | );
|
4051 - | ::pretty_assertions::assert_eq!(
|
4052 - | input.map_of_strings,
|
4053 - | expected.map_of_strings,
|
4054 - | "Unexpected value for `map_of_strings`"
|
4055 - | );
|
4056 - | ::pretty_assertions::assert_eq!(
|
4057 - | input.map_of_structs,
|
4058 - | expected.map_of_structs,
|
4059 - | "Unexpected value for `map_of_structs`"
|
4060 - | );
|
4061 - | ::pretty_assertions::assert_eq!(
|
4062 - | input.recursive_list,
|
4063 - | expected.recursive_list,
|
4064 - | "Unexpected value for `recursive_list`"
|
4065 - | );
|
4066 - | ::pretty_assertions::assert_eq!(
|
4067 - | input.recursive_map,
|
4068 - | expected.recursive_map,
|
4069 - | "Unexpected value for `recursive_map`"
|
4070 - | );
|
4071 - | ::pretty_assertions::assert_eq!(
|
4072 - | input.recursive_struct,
|
4073 - | expected.recursive_struct,
|
4074 - | "Unexpected value for `recursive_struct`"
|
4075 - | );
|
4076 - | ::pretty_assertions::assert_eq!(
|
4077 - | input.simple_struct,
|
4078 - | expected.simple_struct,
|
4079 - | "Unexpected value for `simple_struct`"
|
4080 - | );
|
4081 - | ::pretty_assertions::assert_eq!(
|
4082 - | input.string,
|
4083 - | expected.string,
|
4084 - | "Unexpected value for `string`"
|
4085 - | );
|
4086 - | ::pretty_assertions::assert_eq!(
|
4087 - | input.struct_with_json_name,
|
4088 - | expected.struct_with_json_name,
|
4089 - | "Unexpected value for `struct_with_json_name`"
|
4090 - | );
|
4091 - | ::pretty_assertions::assert_eq!(
|
4092 - | input.timestamp,
|
4093 - | expected.timestamp,
|
4094 - | "Unexpected value for `timestamp`"
|
4095 - | );
|
4096 - | ::pretty_assertions::assert_eq!(
|
4097 - | input.unix_timestamp,
|
4098 - | expected.unix_timestamp,
|
4099 - | "Unexpected value for `unix_timestamp`"
|
4100 - | );
|
4101 - | let response = crate::output::KitchenSinkOperationOutput {
|
4102 - | blob: ::std::option::Option::None,
|
4103 - | boolean: ::std::option::Option::None,
|
4104 - | double: ::std::option::Option::None,
|
4105 - | empty_struct: ::std::option::Option::None,
|
4106 - | float: ::std::option::Option::None,
|
4107 - | httpdate_timestamp: ::std::option::Option::None,
|
4108 - | integer: ::std::option::Option::None,
|
4109 - | iso8601_timestamp: ::std::option::Option::None,
|
4110 - | json_value: ::std::option::Option::None,
|
4111 - | list_of_lists: ::std::option::Option::None,
|
4112 - | list_of_maps_of_strings: ::std::option::Option::None,
|
4113 - | list_of_strings: ::std::option::Option::None,
|
4114 - | list_of_structs: ::std::option::Option::None,
|
4115 - | long: ::std::option::Option::None,
|
4116 - | map_of_lists_of_strings: ::std::option::Option::None,
|
4117 - | map_of_maps: ::std::option::Option::None,
|
4118 - | map_of_strings: ::std::option::Option::None,
|
4119 - | map_of_structs: ::std::option::Option::None,
|
4120 - | recursive_list: ::std::option::Option::None,
|
4121 - | recursive_map: ::std::option::Option::None,
|
4122 - | recursive_struct: ::std::option::Option::None,
|
4123 - | simple_struct: ::std::option::Option::None,
|
4124 - | string: ::std::option::Option::None,
|
4125 - | struct_with_json_name: ::std::option::Option::None,
|
4126 - | timestamp: ::std::option::Option::None,
|
4127 - | unix_timestamp: ::std::option::Option::None,
|
4128 - | };
|
4129 - | Ok(response)
|
4130 - | };
|
4131 - | sender.send(()).await.expect("receiver dropped early");
|
4132 - | result
|
4133 - | }
|
4134 - | })
|
4135 - | .build_unchecked();
|
4136 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2597 + | #[::tracing_test::traced_test]
|
2598 + | async fn put_and_get_inline_documents_input_response() {
|
2599 + | let output = crate::output::PutAndGetInlineDocumentsOutput {
|
2600 + | inline_document: ::std::option::Option::Some({
|
2601 + | let json_bytes = br#"{
|
2602 + | "foo": "bar"
|
2603 + | }"#;
|
2604 + | let mut tokens =
|
2605 + | ::aws_smithy_json::deserialize::json_token_iter(json_bytes).peekable();
|
2606 + | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
2607 + | .expect("well formed json")
|
2608 + | }),
|
2609 + | };
|
2610 + | use ::aws_smithy_http_server::response::IntoResponse;
|
2611 + | let http_response = output.into_response();
|
2612 + | ::pretty_assertions::assert_eq!(
|
2613 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2614 + | http_response.status()
|
2615 + | );
|
2616 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
2617 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2618 + | http_response.headers(),
|
2619 + | expected_headers,
|
2620 + | ));
|
2621 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4137 2622 | .await
|
4138 - | .expect("unable to make an HTTP request");
|
4139 - | assert!(receiver.recv().await.is_some());
|
2623 + | .expect("unable to extract body to bytes");
|
2624 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2625 + | &body,
|
2626 + | "{\n \"inlineDocument\": {\"foo\": \"bar\"}\n}",
|
2627 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2628 + | ));
|
4140 2629 | }
|
4141 - | /// Serializes list shapes
|
4142 - | /// Test ID: serializes_list_shapes
|
2630 + | }
|
2631 + |
|
2632 + | static CONTENT_TYPE_OPERATIONWITHOPTIONALINPUTOUTPUT: ::once_cell::sync::Lazy<::mime::Mime> =
|
2633 + | ::once_cell::sync::Lazy::new(|| {
|
2634 + | "application/x-amz-json-1.1"
|
2635 + | .parse::<::mime::Mime>()
|
2636 + | .expect("BUG: MIME parsing failed, content_type is not valid")
|
2637 + | });
|
2638 + | ::pin_project_lite::pin_project! {
|
2639 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2640 + | /// [`OperationWithOptionalInputOutputInput`](crate::input::OperationWithOptionalInputOutputInput) using modelled bindings.
|
2641 + | pub struct OperationWithOptionalInputOutputInputFuture {
|
2642 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::OperationWithOptionalInputOutputInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
2643 + | }
|
2644 + | }
|
2645 + |
|
2646 + | impl std::future::Future for OperationWithOptionalInputOutputInputFuture {
|
2647 + | type Output = Result<
|
2648 + | crate::input::OperationWithOptionalInputOutputInput,
|
2649 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
2650 + | >;
|
2651 + |
|
2652 + | fn poll(
|
2653 + | self: std::pin::Pin<&mut Self>,
|
2654 + | cx: &mut std::task::Context<'_>,
|
2655 + | ) -> std::task::Poll<Self::Output> {
|
2656 + | let this = self.project();
|
2657 + | this.inner.as_mut().poll(cx)
|
2658 + | }
|
2659 + | }
|
2660 + |
|
2661 + | impl<B>
|
2662 + | ::aws_smithy_http_server::request::FromRequest<
|
2663 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2664 + | B,
|
2665 + | > for crate::input::OperationWithOptionalInputOutputInput
|
2666 + | where
|
2667 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
2668 + | B: 'static,
|
2669 + |
|
2670 + | B::Data: Send,
|
2671 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
2672 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
2673 + | {
|
2674 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
2675 + | type Future = OperationWithOptionalInputOutputInputFuture;
|
2676 + |
|
2677 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2678 + | let fut = async move {
|
2679 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
2680 + | request.headers(),
|
2681 + | &CONTENT_TYPE_OPERATIONWITHOPTIONALINPUTOUTPUT,
|
2682 + | ) {
|
2683 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
2684 + | }
|
2685 + | crate::protocol_serde::shape_operation_with_optional_input_output::de_operation_with_optional_input_output_http_request(request)
|
2686 + | .await
|
2687 + | .map_err(Into::into)
|
2688 + | };
|
2689 + | use ::futures_util::future::TryFutureExt;
|
2690 + | let fut = fut.map_err(
|
2691 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
2692 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2693 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
2694 + | },
|
2695 + | );
|
2696 + | OperationWithOptionalInputOutputInputFuture {
|
2697 + | inner: Box::pin(fut),
|
2698 + | }
|
2699 + | }
|
2700 + | }
|
2701 + | impl
|
2702 + | ::aws_smithy_http_server::response::IntoResponse<
|
2703 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2704 + | > for crate::output::OperationWithOptionalInputOutputOutput
|
2705 + | {
|
2706 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
2707 + | match crate::protocol_serde::shape_operation_with_optional_input_output::ser_operation_with_optional_input_output_http_response(self) {
|
2708 + | Ok(response) => response,
|
2709 + | Err(e) => {
|
2710 + | ::tracing::error!(error = %e, "failed to serialize response");
|
2711 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
2712 + | }
|
2713 + | }
|
2714 + | }
|
2715 + | }
|
2716 + |
|
2717 + | #[allow(unreachable_code, unused_variables)]
|
2718 + | #[cfg(test)]
|
2719 + | mod operation_with_optional_input_output_test {
|
2720 + |
|
2721 + | /// Can call operations with no input or output
|
2722 + | /// Test ID: can_call_operation_with_no_input_or_output
|
4143 2723 | #[::tokio::test]
|
4144 - | async fn serializes_list_shapes_request() {
|
2724 + | #[::tracing_test::traced_test]
|
2725 + | async fn can_call_operation_with_no_input_or_output_request() {
|
4145 2726 | #[allow(unused_mut)]
|
4146 2727 | let mut http_request = http::Request::builder()
|
4147 2728 | .uri("/")
|
4148 2729 | .method("POST")
|
4149 2730 | .header("Content-Type", "application/x-amz-json-1.1")
|
4150 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
4151 - | .body(::aws_smithy_http_server::body::Body::from(
|
4152 - | ::bytes::Bytes::from_static(
|
4153 - | "{\"ListOfStrings\":[\"abc\",\"mno\",\"xyz\"]}".as_bytes(),
|
4154 - | ),
|
2731 + | .header(
|
2732 + | "X-Amz-Target",
|
2733 + | "JsonProtocol.OperationWithOptionalInputOutput",
|
2734 + | )
|
2735 + | .body(::aws_smithy_http_server::body::Body::from(
|
2736 + | ::bytes::Bytes::from_static("{}".as_bytes()),
|
4155 2737 | ))
|
4156 2738 | .unwrap();
|
4157 2739 | #[allow(unused_mut)]
|
4158 2740 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4159 2741 | let config = crate::service::JsonProtocolConfig::builder().build();
|
4160 2742 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
4161 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
4162 - | let sender = sender.clone();
|
4163 - | async move {
|
4164 - | let result = {
|
4165 - | use ::aws_smithy_protocol_test::FloatEquals;
|
4166 - | let expected = crate::input::KitchenSinkOperationInput {
|
4167 - | list_of_strings: ::std::option::Option::Some(vec![
|
4168 - | "abc".to_owned(),
|
4169 - | "mno".to_owned(),
|
4170 - | "xyz".to_owned(),
|
4171 - | ]),
|
4172 - | blob: ::std::option::Option::None,
|
4173 - | boolean: ::std::option::Option::None,
|
4174 - | double: ::std::option::Option::None,
|
4175 - | empty_struct: ::std::option::Option::None,
|
4176 - | float: ::std::option::Option::None,
|
4177 - | httpdate_timestamp: ::std::option::Option::None,
|
4178 - | integer: ::std::option::Option::None,
|
4179 - | iso8601_timestamp: ::std::option::Option::None,
|
4180 - | json_value: ::std::option::Option::None,
|
4181 - | list_of_lists: ::std::option::Option::None,
|
4182 - | list_of_maps_of_strings: ::std::option::Option::None,
|
4183 - | list_of_structs: ::std::option::Option::None,
|
4184 - | long: ::std::option::Option::None,
|
4185 - | map_of_lists_of_strings: ::std::option::Option::None,
|
4186 - | map_of_maps: ::std::option::Option::None,
|
4187 - | map_of_strings: ::std::option::Option::None,
|
4188 - | map_of_structs: ::std::option::Option::None,
|
4189 - | recursive_list: ::std::option::Option::None,
|
4190 - | recursive_map: ::std::option::Option::None,
|
4191 - | recursive_struct: ::std::option::Option::None,
|
4192 - | simple_struct: ::std::option::Option::None,
|
4193 - | string: ::std::option::Option::None,
|
4194 - | struct_with_json_name: ::std::option::Option::None,
|
4195 - | timestamp: ::std::option::Option::None,
|
4196 - | unix_timestamp: ::std::option::Option::None,
|
4197 - | };
|
4198 - | ::pretty_assertions::assert_eq!(
|
4199 - | input.blob,
|
4200 - | expected.blob,
|
4201 - | "Unexpected value for `blob`"
|
4202 - | );
|
4203 - | ::pretty_assertions::assert_eq!(
|
4204 - | input.boolean,
|
4205 - | expected.boolean,
|
4206 - | "Unexpected value for `boolean`"
|
4207 - | );
|
4208 - | assert!(
|
4209 - | input.double.float_equals(&expected.double),
|
4210 - | "Unexpected value for `double` {:?} vs. {:?}",
|
4211 - | expected.double,
|
4212 - | input.double
|
4213 - | );
|
4214 - | ::pretty_assertions::assert_eq!(
|
4215 - | input.empty_struct,
|
4216 - | expected.empty_struct,
|
4217 - | "Unexpected value for `empty_struct`"
|
4218 - | );
|
4219 - | assert!(
|
4220 - | input.float.float_equals(&expected.float),
|
4221 - | "Unexpected value for `float` {:?} vs. {:?}",
|
4222 - | expected.float,
|
4223 - | input.float
|
4224 - | );
|
4225 - | ::pretty_assertions::assert_eq!(
|
4226 - | input.httpdate_timestamp,
|
4227 - | expected.httpdate_timestamp,
|
4228 - | "Unexpected value for `httpdate_timestamp`"
|
4229 - | );
|
4230 - | ::pretty_assertions::assert_eq!(
|
4231 - | input.integer,
|
4232 - | expected.integer,
|
4233 - | "Unexpected value for `integer`"
|
4234 - | );
|
4235 - | ::pretty_assertions::assert_eq!(
|
4236 - | input.iso8601_timestamp,
|
4237 - | expected.iso8601_timestamp,
|
4238 - | "Unexpected value for `iso8601_timestamp`"
|
4239 - | );
|
4240 - | ::pretty_assertions::assert_eq!(
|
4241 - | input.json_value,
|
4242 - | expected.json_value,
|
4243 - | "Unexpected value for `json_value`"
|
4244 - | );
|
4245 - | ::pretty_assertions::assert_eq!(
|
4246 - | input.list_of_lists,
|
4247 - | expected.list_of_lists,
|
4248 - | "Unexpected value for `list_of_lists`"
|
4249 - | );
|
4250 - | ::pretty_assertions::assert_eq!(
|
4251 - | input.list_of_maps_of_strings,
|
4252 - | expected.list_of_maps_of_strings,
|
4253 - | "Unexpected value for `list_of_maps_of_strings`"
|
4254 - | );
|
4255 - | ::pretty_assertions::assert_eq!(
|
4256 - | input.list_of_strings,
|
4257 - | expected.list_of_strings,
|
4258 - | "Unexpected value for `list_of_strings`"
|
4259 - | );
|
4260 - | ::pretty_assertions::assert_eq!(
|
4261 - | input.list_of_structs,
|
4262 - | expected.list_of_structs,
|
4263 - | "Unexpected value for `list_of_structs`"
|
4264 - | );
|
4265 - | ::pretty_assertions::assert_eq!(
|
4266 - | input.long,
|
4267 - | expected.long,
|
4268 - | "Unexpected value for `long`"
|
4269 - | );
|
4270 - | ::pretty_assertions::assert_eq!(
|
4271 - | input.map_of_lists_of_strings,
|
4272 - | expected.map_of_lists_of_strings,
|
4273 - | "Unexpected value for `map_of_lists_of_strings`"
|
4274 - | );
|
4275 - | ::pretty_assertions::assert_eq!(
|
4276 - | input.map_of_maps,
|
4277 - | expected.map_of_maps,
|
4278 - | "Unexpected value for `map_of_maps`"
|
4279 - | );
|
4280 - | ::pretty_assertions::assert_eq!(
|
4281 - | input.map_of_strings,
|
4282 - | expected.map_of_strings,
|
4283 - | "Unexpected value for `map_of_strings`"
|
4284 - | );
|
4285 - | ::pretty_assertions::assert_eq!(
|
4286 - | input.map_of_structs,
|
4287 - | expected.map_of_structs,
|
4288 - | "Unexpected value for `map_of_structs`"
|
4289 - | );
|
4290 - | ::pretty_assertions::assert_eq!(
|
4291 - | input.recursive_list,
|
4292 - | expected.recursive_list,
|
4293 - | "Unexpected value for `recursive_list`"
|
4294 - | );
|
4295 - | ::pretty_assertions::assert_eq!(
|
4296 - | input.recursive_map,
|
4297 - | expected.recursive_map,
|
4298 - | "Unexpected value for `recursive_map`"
|
4299 - | );
|
4300 - | ::pretty_assertions::assert_eq!(
|
4301 - | input.recursive_struct,
|
4302 - | expected.recursive_struct,
|
4303 - | "Unexpected value for `recursive_struct`"
|
4304 - | );
|
4305 - | ::pretty_assertions::assert_eq!(
|
4306 - | input.simple_struct,
|
4307 - | expected.simple_struct,
|
4308 - | "Unexpected value for `simple_struct`"
|
4309 - | );
|
4310 - | ::pretty_assertions::assert_eq!(
|
4311 - | input.string,
|
4312 - | expected.string,
|
4313 - | "Unexpected value for `string`"
|
4314 - | );
|
4315 - | ::pretty_assertions::assert_eq!(
|
4316 - | input.struct_with_json_name,
|
4317 - | expected.struct_with_json_name,
|
4318 - | "Unexpected value for `struct_with_json_name`"
|
4319 - | );
|
4320 - | ::pretty_assertions::assert_eq!(
|
4321 - | input.timestamp,
|
4322 - | expected.timestamp,
|
4323 - | "Unexpected value for `timestamp`"
|
4324 - | );
|
4325 - | ::pretty_assertions::assert_eq!(
|
4326 - | input.unix_timestamp,
|
4327 - | expected.unix_timestamp,
|
4328 - | "Unexpected value for `unix_timestamp`"
|
4329 - | );
|
4330 - | let response = crate::output::KitchenSinkOperationOutput {
|
4331 - | blob: ::std::option::Option::None,
|
4332 - | boolean: ::std::option::Option::None,
|
4333 - | double: ::std::option::Option::None,
|
4334 - | empty_struct: ::std::option::Option::None,
|
4335 - | float: ::std::option::Option::None,
|
4336 - | httpdate_timestamp: ::std::option::Option::None,
|
4337 - | integer: ::std::option::Option::None,
|
4338 - | iso8601_timestamp: ::std::option::Option::None,
|
4339 - | json_value: ::std::option::Option::None,
|
4340 - | list_of_lists: ::std::option::Option::None,
|
4341 - | list_of_maps_of_strings: ::std::option::Option::None,
|
4342 - | list_of_strings: ::std::option::Option::None,
|
4343 - | list_of_structs: ::std::option::Option::None,
|
4344 - | long: ::std::option::Option::None,
|
4345 - | map_of_lists_of_strings: ::std::option::Option::None,
|
4346 - | map_of_maps: ::std::option::Option::None,
|
4347 - | map_of_strings: ::std::option::Option::None,
|
4348 - | map_of_structs: ::std::option::Option::None,
|
4349 - | recursive_list: ::std::option::Option::None,
|
4350 - | recursive_map: ::std::option::Option::None,
|
4351 - | recursive_struct: ::std::option::Option::None,
|
4352 - | simple_struct: ::std::option::Option::None,
|
4353 - | string: ::std::option::Option::None,
|
4354 - | struct_with_json_name: ::std::option::Option::None,
|
4355 - | timestamp: ::std::option::Option::None,
|
4356 - | unix_timestamp: ::std::option::Option::None,
|
2743 + | .operation_with_optional_input_output(
|
2744 + | move |input: crate::input::OperationWithOptionalInputOutputInput| {
|
2745 + | let sender = sender.clone();
|
2746 + | async move {
|
2747 + | let result = {
|
2748 + | let expected = crate::input::OperationWithOptionalInputOutputInput {
|
2749 + | value: ::std::option::Option::None,
|
2750 + | };
|
2751 + | ::pretty_assertions::assert_eq!(input, expected);
|
2752 + | let response = crate::output::OperationWithOptionalInputOutputOutput {
|
2753 + | value: ::std::option::Option::None,
|
2754 + | };
|
2755 + | response
|
4357 2756 | };
|
4358 - | Ok(response)
|
4359 - | };
|
4360 - | sender.send(()).await.expect("receiver dropped early");
|
4361 - | result
|
4362 - | }
|
4363 - | })
|
2757 + | sender.send(()).await.expect("receiver dropped early");
|
2758 + | result
|
2759 + | }
|
2760 + | },
|
2761 + | )
|
4364 2762 | .build_unchecked();
|
4365 2763 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4366 2764 | .await
|
4367 2765 | .expect("unable to make an HTTP request");
|
4368 - | assert!(receiver.recv().await.is_some());
|
2766 + | assert!(
|
2767 + | receiver.recv().await.is_some(),
|
2768 + | "we expected operation handler to be invoked but it was not entered"
|
2769 + | );
|
4369 2770 | }
|
4370 - | /// Serializes empty list shapes
|
4371 - | /// Test ID: serializes_empty_list_shapes
|
2771 + | /// Can invoke operations with optional input
|
2772 + | /// Test ID: can_call_operation_with_optional_input
|
4372 2773 | #[::tokio::test]
|
4373 - | async fn serializes_empty_list_shapes_request() {
|
2774 + | #[::tracing_test::traced_test]
|
2775 + | async fn can_call_operation_with_optional_input_request() {
|
4374 2776 | #[allow(unused_mut)]
|
4375 2777 | let mut http_request = http::Request::builder()
|
4376 2778 | .uri("/")
|
4377 2779 | .method("POST")
|
4378 2780 | .header("Content-Type", "application/x-amz-json-1.1")
|
4379 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
2781 + | .header(
|
2782 + | "X-Amz-Target",
|
2783 + | "JsonProtocol.OperationWithOptionalInputOutput",
|
2784 + | )
|
4380 2785 | .body(::aws_smithy_http_server::body::Body::from(
|
4381 - | ::bytes::Bytes::from_static("{\"ListOfStrings\":[]}".as_bytes()),
|
2786 + | ::bytes::Bytes::from_static("{\"Value\":\"Hi\"}".as_bytes()),
|
4382 2787 | ))
|
4383 2788 | .unwrap();
|
4384 2789 | #[allow(unused_mut)]
|
4385 2790 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4386 2791 | let config = crate::service::JsonProtocolConfig::builder().build();
|
4387 2792 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
4388 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
4389 - | let sender = sender.clone();
|
4390 - | async move {
|
4391 - | let result = {
|
4392 - | use ::aws_smithy_protocol_test::FloatEquals;
|
4393 - | let expected = crate::input::KitchenSinkOperationInput {
|
4394 - | list_of_strings: ::std::option::Option::Some(vec![]),
|
4395 - | blob: ::std::option::Option::None,
|
4396 - | boolean: ::std::option::Option::None,
|
4397 - | double: ::std::option::Option::None,
|
4398 - | empty_struct: ::std::option::Option::None,
|
4399 - | float: ::std::option::Option::None,
|
4400 - | httpdate_timestamp: ::std::option::Option::None,
|
4401 - | integer: ::std::option::Option::None,
|
4402 - | iso8601_timestamp: ::std::option::Option::None,
|
4403 - | json_value: ::std::option::Option::None,
|
4404 - | list_of_lists: ::std::option::Option::None,
|
4405 - | list_of_maps_of_strings: ::std::option::Option::None,
|
4406 - | list_of_structs: ::std::option::Option::None,
|
4407 - | long: ::std::option::Option::None,
|
4408 - | map_of_lists_of_strings: ::std::option::Option::None,
|
4409 - | map_of_maps: ::std::option::Option::None,
|
4410 - | map_of_strings: ::std::option::Option::None,
|
4411 - | map_of_structs: ::std::option::Option::None,
|
4412 - | recursive_list: ::std::option::Option::None,
|
4413 - | recursive_map: ::std::option::Option::None,
|
4414 - | recursive_struct: ::std::option::Option::None,
|
4415 - | simple_struct: ::std::option::Option::None,
|
4416 - | string: ::std::option::Option::None,
|
4417 - | struct_with_json_name: ::std::option::Option::None,
|
4418 - | timestamp: ::std::option::Option::None,
|
4419 - | unix_timestamp: ::std::option::Option::None,
|
4420 - | };
|
4421 - | ::pretty_assertions::assert_eq!(
|
4422 - | input.blob,
|
4423 - | expected.blob,
|
4424 - | "Unexpected value for `blob`"
|
4425 - | );
|
4426 - | ::pretty_assertions::assert_eq!(
|
4427 - | input.boolean,
|
4428 - | expected.boolean,
|
4429 - | "Unexpected value for `boolean`"
|
4430 - | );
|
4431 - | assert!(
|
4432 - | input.double.float_equals(&expected.double),
|
4433 - | "Unexpected value for `double` {:?} vs. {:?}",
|
4434 - | expected.double,
|
4435 - | input.double
|
4436 - | );
|
4437 - | ::pretty_assertions::assert_eq!(
|
4438 - | input.empty_struct,
|
4439 - | expected.empty_struct,
|
4440 - | "Unexpected value for `empty_struct`"
|
4441 - | );
|
4442 - | assert!(
|
4443 - | input.float.float_equals(&expected.float),
|
4444 - | "Unexpected value for `float` {:?} vs. {:?}",
|
4445 - | expected.float,
|
4446 - | input.float
|
4447 - | );
|
4448 - | ::pretty_assertions::assert_eq!(
|
4449 - | input.httpdate_timestamp,
|
4450 - | expected.httpdate_timestamp,
|
4451 - | "Unexpected value for `httpdate_timestamp`"
|
4452 - | );
|
4453 - | ::pretty_assertions::assert_eq!(
|
4454 - | input.integer,
|
4455 - | expected.integer,
|
4456 - | "Unexpected value for `integer`"
|
4457 - | );
|
4458 - | ::pretty_assertions::assert_eq!(
|
4459 - | input.iso8601_timestamp,
|
4460 - | expected.iso8601_timestamp,
|
4461 - | "Unexpected value for `iso8601_timestamp`"
|
4462 - | );
|
4463 - | ::pretty_assertions::assert_eq!(
|
4464 - | input.json_value,
|
4465 - | expected.json_value,
|
4466 - | "Unexpected value for `json_value`"
|
4467 - | );
|
4468 - | ::pretty_assertions::assert_eq!(
|
4469 - | input.list_of_lists,
|
4470 - | expected.list_of_lists,
|
4471 - | "Unexpected value for `list_of_lists`"
|
4472 - | );
|
4473 - | ::pretty_assertions::assert_eq!(
|
4474 - | input.list_of_maps_of_strings,
|
4475 - | expected.list_of_maps_of_strings,
|
4476 - | "Unexpected value for `list_of_maps_of_strings`"
|
4477 - | );
|
4478 - | ::pretty_assertions::assert_eq!(
|
4479 - | input.list_of_strings,
|
4480 - | expected.list_of_strings,
|
4481 - | "Unexpected value for `list_of_strings`"
|
4482 - | );
|
4483 - | ::pretty_assertions::assert_eq!(
|
4484 - | input.list_of_structs,
|
4485 - | expected.list_of_structs,
|
4486 - | "Unexpected value for `list_of_structs`"
|
4487 - | );
|
4488 - | ::pretty_assertions::assert_eq!(
|
4489 - | input.long,
|
4490 - | expected.long,
|
4491 - | "Unexpected value for `long`"
|
4492 - | );
|
4493 - | ::pretty_assertions::assert_eq!(
|
4494 - | input.map_of_lists_of_strings,
|
4495 - | expected.map_of_lists_of_strings,
|
4496 - | "Unexpected value for `map_of_lists_of_strings`"
|
4497 - | );
|
4498 - | ::pretty_assertions::assert_eq!(
|
4499 - | input.map_of_maps,
|
4500 - | expected.map_of_maps,
|
4501 - | "Unexpected value for `map_of_maps`"
|
4502 - | );
|
4503 - | ::pretty_assertions::assert_eq!(
|
4504 - | input.map_of_strings,
|
4505 - | expected.map_of_strings,
|
4506 - | "Unexpected value for `map_of_strings`"
|
4507 - | );
|
4508 - | ::pretty_assertions::assert_eq!(
|
4509 - | input.map_of_structs,
|
4510 - | expected.map_of_structs,
|
4511 - | "Unexpected value for `map_of_structs`"
|
4512 - | );
|
4513 - | ::pretty_assertions::assert_eq!(
|
4514 - | input.recursive_list,
|
4515 - | expected.recursive_list,
|
4516 - | "Unexpected value for `recursive_list`"
|
4517 - | );
|
4518 - | ::pretty_assertions::assert_eq!(
|
4519 - | input.recursive_map,
|
4520 - | expected.recursive_map,
|
4521 - | "Unexpected value for `recursive_map`"
|
4522 - | );
|
4523 - | ::pretty_assertions::assert_eq!(
|
4524 - | input.recursive_struct,
|
4525 - | expected.recursive_struct,
|
4526 - | "Unexpected value for `recursive_struct`"
|
4527 - | );
|
4528 - | ::pretty_assertions::assert_eq!(
|
4529 - | input.simple_struct,
|
4530 - | expected.simple_struct,
|
4531 - | "Unexpected value for `simple_struct`"
|
4532 - | );
|
4533 - | ::pretty_assertions::assert_eq!(
|
4534 - | input.string,
|
4535 - | expected.string,
|
4536 - | "Unexpected value for `string`"
|
4537 - | );
|
4538 - | ::pretty_assertions::assert_eq!(
|
4539 - | input.struct_with_json_name,
|
4540 - | expected.struct_with_json_name,
|
4541 - | "Unexpected value for `struct_with_json_name`"
|
4542 - | );
|
4543 - | ::pretty_assertions::assert_eq!(
|
4544 - | input.timestamp,
|
4545 - | expected.timestamp,
|
4546 - | "Unexpected value for `timestamp`"
|
4547 - | );
|
4548 - | ::pretty_assertions::assert_eq!(
|
4549 - | input.unix_timestamp,
|
4550 - | expected.unix_timestamp,
|
4551 - | "Unexpected value for `unix_timestamp`"
|
4552 - | );
|
4553 - | let response = crate::output::KitchenSinkOperationOutput {
|
4554 - | blob: ::std::option::Option::None,
|
4555 - | boolean: ::std::option::Option::None,
|
4556 - | double: ::std::option::Option::None,
|
4557 - | empty_struct: ::std::option::Option::None,
|
4558 - | float: ::std::option::Option::None,
|
4559 - | httpdate_timestamp: ::std::option::Option::None,
|
4560 - | integer: ::std::option::Option::None,
|
4561 - | iso8601_timestamp: ::std::option::Option::None,
|
4562 - | json_value: ::std::option::Option::None,
|
4563 - | list_of_lists: ::std::option::Option::None,
|
4564 - | list_of_maps_of_strings: ::std::option::Option::None,
|
4565 - | list_of_strings: ::std::option::Option::None,
|
4566 - | list_of_structs: ::std::option::Option::None,
|
4567 - | long: ::std::option::Option::None,
|
4568 - | map_of_lists_of_strings: ::std::option::Option::None,
|
4569 - | map_of_maps: ::std::option::Option::None,
|
4570 - | map_of_strings: ::std::option::Option::None,
|
4571 - | map_of_structs: ::std::option::Option::None,
|
4572 - | recursive_list: ::std::option::Option::None,
|
4573 - | recursive_map: ::std::option::Option::None,
|
4574 - | recursive_struct: ::std::option::Option::None,
|
4575 - | simple_struct: ::std::option::Option::None,
|
4576 - | string: ::std::option::Option::None,
|
4577 - | struct_with_json_name: ::std::option::Option::None,
|
4578 - | timestamp: ::std::option::Option::None,
|
4579 - | unix_timestamp: ::std::option::Option::None,
|
2793 + | .operation_with_optional_input_output(
|
2794 + | move |input: crate::input::OperationWithOptionalInputOutputInput| {
|
2795 + | let sender = sender.clone();
|
2796 + | async move {
|
2797 + | let result = {
|
2798 + | let expected = crate::input::OperationWithOptionalInputOutputInput {
|
2799 + | value: ::std::option::Option::Some("Hi".to_owned()),
|
2800 + | };
|
2801 + | ::pretty_assertions::assert_eq!(input, expected);
|
2802 + | let response = crate::output::OperationWithOptionalInputOutputOutput {
|
2803 + | value: ::std::option::Option::None,
|
2804 + | };
|
2805 + | response
|
4580 2806 | };
|
4581 - | Ok(response)
|
4582 - | };
|
4583 - | sender.send(()).await.expect("receiver dropped early");
|
4584 - | result
|
4585 - | }
|
4586 - | })
|
2807 + | sender.send(()).await.expect("receiver dropped early");
|
2808 + | result
|
2809 + | }
|
2810 + | },
|
2811 + | )
|
4587 2812 | .build_unchecked();
|
4588 2813 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4589 2814 | .await
|
4590 2815 | .expect("unable to make an HTTP request");
|
4591 - | assert!(receiver.recv().await.is_some());
|
2816 + | assert!(
|
2817 + | receiver.recv().await.is_some(),
|
2818 + | "we expected operation handler to be invoked but it was not entered"
|
2819 + | );
|
4592 2820 | }
|
4593 - | /// Serializes list of map shapes
|
4594 - | /// Test ID: serializes_list_of_map_shapes
|
4595 - | #[::tokio::test]
|
4596 - | async fn serializes_list_of_map_shapes_request() {
|
4597 - | #[allow(unused_mut)]
|
4598 - | let mut http_request = http::Request::builder()
|
4599 - | .uri("/")
|
4600 - | .method("POST")
|
4601 - | .header("Content-Type", "application/x-amz-json-1.1")
|
4602 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
4603 - | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{\"ListOfMapsOfStrings\":[{\"foo\":\"bar\"},{\"abc\":\"xyz\"},{\"red\":\"blue\"}]}".as_bytes()))).unwrap();
|
4604 - | #[allow(unused_mut)]
|
4605 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4606 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
4607 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
4608 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
4609 - | let sender = sender.clone();
|
4610 - | async move {
|
4611 - | let result = {
|
4612 - | use ::aws_smithy_protocol_test::FloatEquals;
|
4613 - | let expected = crate::input::KitchenSinkOperationInput {
|
4614 - | list_of_maps_of_strings: ::std::option::Option::Some(vec![
|
4615 - | {
|
4616 - | let mut ret = ::std::collections::HashMap::new();
|
4617 - | ret.insert("foo".to_owned(), "bar".to_owned());
|
4618 - | ret
|
4619 - | },
|
4620 - | {
|
4621 - | let mut ret = ::std::collections::HashMap::new();
|
4622 - | ret.insert("abc".to_owned(), "xyz".to_owned());
|
4623 - | ret
|
4624 - | },
|
4625 - | {
|
4626 - | let mut ret = ::std::collections::HashMap::new();
|
4627 - | ret.insert("red".to_owned(), "blue".to_owned());
|
4628 - | ret
|
4629 - | },
|
4630 - | ]),
|
4631 - | blob: ::std::option::Option::None,
|
4632 - | boolean: ::std::option::Option::None,
|
4633 - | double: ::std::option::Option::None,
|
4634 - | empty_struct: ::std::option::Option::None,
|
4635 - | float: ::std::option::Option::None,
|
4636 - | httpdate_timestamp: ::std::option::Option::None,
|
4637 - | integer: ::std::option::Option::None,
|
4638 - | iso8601_timestamp: ::std::option::Option::None,
|
4639 - | json_value: ::std::option::Option::None,
|
4640 - | list_of_lists: ::std::option::Option::None,
|
4641 - | list_of_strings: ::std::option::Option::None,
|
4642 - | list_of_structs: ::std::option::Option::None,
|
4643 - | long: ::std::option::Option::None,
|
4644 - | map_of_lists_of_strings: ::std::option::Option::None,
|
4645 - | map_of_maps: ::std::option::Option::None,
|
4646 - | map_of_strings: ::std::option::Option::None,
|
4647 - | map_of_structs: ::std::option::Option::None,
|
4648 - | recursive_list: ::std::option::Option::None,
|
4649 - | recursive_map: ::std::option::Option::None,
|
4650 - | recursive_struct: ::std::option::Option::None,
|
4651 - | simple_struct: ::std::option::Option::None,
|
4652 - | string: ::std::option::Option::None,
|
4653 - | struct_with_json_name: ::std::option::Option::None,
|
4654 - | timestamp: ::std::option::Option::None,
|
4655 - | unix_timestamp: ::std::option::Option::None,
|
4656 - | };
|
4657 - | ::pretty_assertions::assert_eq!(
|
4658 - | input.blob,
|
4659 - | expected.blob,
|
4660 - | "Unexpected value for `blob`"
|
4661 - | );
|
4662 - | ::pretty_assertions::assert_eq!(
|
4663 - | input.boolean,
|
4664 - | expected.boolean,
|
4665 - | "Unexpected value for `boolean`"
|
4666 - | );
|
4667 - | assert!(
|
4668 - | input.double.float_equals(&expected.double),
|
4669 - | "Unexpected value for `double` {:?} vs. {:?}",
|
4670 - | expected.double,
|
4671 - | input.double
|
4672 - | );
|
4673 - | ::pretty_assertions::assert_eq!(
|
4674 - | input.empty_struct,
|
4675 - | expected.empty_struct,
|
4676 - | "Unexpected value for `empty_struct`"
|
4677 - | );
|
4678 - | assert!(
|
4679 - | input.float.float_equals(&expected.float),
|
4680 - | "Unexpected value for `float` {:?} vs. {:?}",
|
4681 - | expected.float,
|
4682 - | input.float
|
4683 - | );
|
4684 - | ::pretty_assertions::assert_eq!(
|
4685 - | input.httpdate_timestamp,
|
4686 - | expected.httpdate_timestamp,
|
4687 - | "Unexpected value for `httpdate_timestamp`"
|
4688 - | );
|
4689 - | ::pretty_assertions::assert_eq!(
|
4690 - | input.integer,
|
4691 - | expected.integer,
|
4692 - | "Unexpected value for `integer`"
|
4693 - | );
|
4694 - | ::pretty_assertions::assert_eq!(
|
4695 - | input.iso8601_timestamp,
|
4696 - | expected.iso8601_timestamp,
|
4697 - | "Unexpected value for `iso8601_timestamp`"
|
4698 - | );
|
4699 - | ::pretty_assertions::assert_eq!(
|
4700 - | input.json_value,
|
4701 - | expected.json_value,
|
4702 - | "Unexpected value for `json_value`"
|
4703 - | );
|
4704 - | ::pretty_assertions::assert_eq!(
|
4705 - | input.list_of_lists,
|
4706 - | expected.list_of_lists,
|
4707 - | "Unexpected value for `list_of_lists`"
|
4708 - | );
|
4709 - | ::pretty_assertions::assert_eq!(
|
4710 - | input.list_of_maps_of_strings,
|
4711 - | expected.list_of_maps_of_strings,
|
4712 - | "Unexpected value for `list_of_maps_of_strings`"
|
4713 - | );
|
4714 - | ::pretty_assertions::assert_eq!(
|
4715 - | input.list_of_strings,
|
4716 - | expected.list_of_strings,
|
4717 - | "Unexpected value for `list_of_strings`"
|
4718 - | );
|
4719 - | ::pretty_assertions::assert_eq!(
|
4720 - | input.list_of_structs,
|
4721 - | expected.list_of_structs,
|
4722 - | "Unexpected value for `list_of_structs`"
|
4723 - | );
|
4724 - | ::pretty_assertions::assert_eq!(
|
4725 - | input.long,
|
4726 - | expected.long,
|
4727 - | "Unexpected value for `long`"
|
4728 - | );
|
4729 - | ::pretty_assertions::assert_eq!(
|
4730 - | input.map_of_lists_of_strings,
|
4731 - | expected.map_of_lists_of_strings,
|
4732 - | "Unexpected value for `map_of_lists_of_strings`"
|
4733 - | );
|
4734 - | ::pretty_assertions::assert_eq!(
|
4735 - | input.map_of_maps,
|
4736 - | expected.map_of_maps,
|
4737 - | "Unexpected value for `map_of_maps`"
|
4738 - | );
|
4739 - | ::pretty_assertions::assert_eq!(
|
4740 - | input.map_of_strings,
|
4741 - | expected.map_of_strings,
|
4742 - | "Unexpected value for `map_of_strings`"
|
4743 - | );
|
4744 - | ::pretty_assertions::assert_eq!(
|
4745 - | input.map_of_structs,
|
4746 - | expected.map_of_structs,
|
4747 - | "Unexpected value for `map_of_structs`"
|
4748 - | );
|
4749 - | ::pretty_assertions::assert_eq!(
|
4750 - | input.recursive_list,
|
4751 - | expected.recursive_list,
|
4752 - | "Unexpected value for `recursive_list`"
|
4753 - | );
|
4754 - | ::pretty_assertions::assert_eq!(
|
4755 - | input.recursive_map,
|
4756 - | expected.recursive_map,
|
4757 - | "Unexpected value for `recursive_map`"
|
4758 - | );
|
4759 - | ::pretty_assertions::assert_eq!(
|
4760 - | input.recursive_struct,
|
4761 - | expected.recursive_struct,
|
4762 - | "Unexpected value for `recursive_struct`"
|
4763 - | );
|
4764 - | ::pretty_assertions::assert_eq!(
|
4765 - | input.simple_struct,
|
4766 - | expected.simple_struct,
|
4767 - | "Unexpected value for `simple_struct`"
|
4768 - | );
|
4769 - | ::pretty_assertions::assert_eq!(
|
4770 - | input.string,
|
4771 - | expected.string,
|
4772 - | "Unexpected value for `string`"
|
4773 - | );
|
4774 - | ::pretty_assertions::assert_eq!(
|
4775 - | input.struct_with_json_name,
|
4776 - | expected.struct_with_json_name,
|
4777 - | "Unexpected value for `struct_with_json_name`"
|
4778 - | );
|
4779 - | ::pretty_assertions::assert_eq!(
|
4780 - | input.timestamp,
|
4781 - | expected.timestamp,
|
4782 - | "Unexpected value for `timestamp`"
|
4783 - | );
|
4784 - | ::pretty_assertions::assert_eq!(
|
4785 - | input.unix_timestamp,
|
4786 - | expected.unix_timestamp,
|
4787 - | "Unexpected value for `unix_timestamp`"
|
4788 - | );
|
4789 - | let response = crate::output::KitchenSinkOperationOutput {
|
4790 - | blob: ::std::option::Option::None,
|
4791 - | boolean: ::std::option::Option::None,
|
4792 - | double: ::std::option::Option::None,
|
4793 - | empty_struct: ::std::option::Option::None,
|
4794 - | float: ::std::option::Option::None,
|
4795 - | httpdate_timestamp: ::std::option::Option::None,
|
4796 - | integer: ::std::option::Option::None,
|
4797 - | iso8601_timestamp: ::std::option::Option::None,
|
4798 - | json_value: ::std::option::Option::None,
|
4799 - | list_of_lists: ::std::option::Option::None,
|
4800 - | list_of_maps_of_strings: ::std::option::Option::None,
|
4801 - | list_of_strings: ::std::option::Option::None,
|
4802 - | list_of_structs: ::std::option::Option::None,
|
4803 - | long: ::std::option::Option::None,
|
4804 - | map_of_lists_of_strings: ::std::option::Option::None,
|
4805 - | map_of_maps: ::std::option::Option::None,
|
4806 - | map_of_strings: ::std::option::Option::None,
|
4807 - | map_of_structs: ::std::option::Option::None,
|
4808 - | recursive_list: ::std::option::Option::None,
|
4809 - | recursive_map: ::std::option::Option::None,
|
4810 - | recursive_struct: ::std::option::Option::None,
|
4811 - | simple_struct: ::std::option::Option::None,
|
4812 - | string: ::std::option::Option::None,
|
4813 - | struct_with_json_name: ::std::option::Option::None,
|
4814 - | timestamp: ::std::option::Option::None,
|
4815 - | unix_timestamp: ::std::option::Option::None,
|
4816 - | };
|
4817 - | Ok(response)
|
4818 - | };
|
4819 - | sender.send(()).await.expect("receiver dropped early");
|
4820 - | result
|
4821 - | }
|
4822 - | })
|
4823 - | .build_unchecked();
|
4824 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4825 - | .await
|
4826 - | .expect("unable to make an HTTP request");
|
4827 - | assert!(receiver.recv().await.is_some());
|
2821 + | }
|
2822 + |
|
2823 + | static CONTENT_TYPE_SIMPLESCALARPROPERTIES: ::once_cell::sync::Lazy<::mime::Mime> =
|
2824 + | ::once_cell::sync::Lazy::new(|| {
|
2825 + | "application/x-amz-json-1.1"
|
2826 + | .parse::<::mime::Mime>()
|
2827 + | .expect("BUG: MIME parsing failed, content_type is not valid")
|
2828 + | });
|
2829 + | ::pin_project_lite::pin_project! {
|
2830 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2831 + | /// [`SimpleScalarPropertiesInput`](crate::input::SimpleScalarPropertiesInput) using modelled bindings.
|
2832 + | pub struct SimpleScalarPropertiesInputFuture {
|
2833 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SimpleScalarPropertiesInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
4828 2834 | }
|
4829 - | /// Serializes list of structure shapes
|
4830 - | /// Test ID: serializes_list_of_structure_shapes
|
4831 - | #[::tokio::test]
|
4832 - | async fn serializes_list_of_structure_shapes_request() {
|
4833 - | #[allow(unused_mut)]
|
4834 - | let mut http_request = http::Request::builder()
|
4835 - | .uri("/")
|
4836 - | .method("POST")
|
4837 - | .header("Content-Type", "application/x-amz-json-1.1")
|
4838 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
4839 - | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{\"ListOfStructs\":[{\"Value\":\"abc\"},{\"Value\":\"mno\"},{\"Value\":\"xyz\"}]}".as_bytes()))).unwrap();
|
4840 - | #[allow(unused_mut)]
|
4841 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4842 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
4843 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
4844 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
4845 - | let sender = sender.clone();
|
4846 - | async move {
|
4847 - | let result = {
|
4848 - | use ::aws_smithy_protocol_test::FloatEquals;
|
4849 - | let expected = crate::input::KitchenSinkOperationInput {
|
4850 - | list_of_structs: ::std::option::Option::Some(vec![
|
4851 - | crate::model::SimpleStruct {
|
4852 - | value: ::std::option::Option::Some("abc".to_owned()),
|
4853 - | },
|
4854 - | crate::model::SimpleStruct {
|
4855 - | value: ::std::option::Option::Some("mno".to_owned()),
|
4856 - | },
|
4857 - | crate::model::SimpleStruct {
|
4858 - | value: ::std::option::Option::Some("xyz".to_owned()),
|
4859 - | },
|
4860 - | ]),
|
4861 - | blob: ::std::option::Option::None,
|
4862 - | boolean: ::std::option::Option::None,
|
4863 - | double: ::std::option::Option::None,
|
4864 - | empty_struct: ::std::option::Option::None,
|
4865 - | float: ::std::option::Option::None,
|
4866 - | httpdate_timestamp: ::std::option::Option::None,
|
4867 - | integer: ::std::option::Option::None,
|
4868 - | iso8601_timestamp: ::std::option::Option::None,
|
4869 - | json_value: ::std::option::Option::None,
|
4870 - | list_of_lists: ::std::option::Option::None,
|
4871 - | list_of_maps_of_strings: ::std::option::Option::None,
|
4872 - | list_of_strings: ::std::option::Option::None,
|
4873 - | long: ::std::option::Option::None,
|
4874 - | map_of_lists_of_strings: ::std::option::Option::None,
|
4875 - | map_of_maps: ::std::option::Option::None,
|
4876 - | map_of_strings: ::std::option::Option::None,
|
4877 - | map_of_structs: ::std::option::Option::None,
|
4878 - | recursive_list: ::std::option::Option::None,
|
4879 - | recursive_map: ::std::option::Option::None,
|
4880 - | recursive_struct: ::std::option::Option::None,
|
4881 - | simple_struct: ::std::option::Option::None,
|
4882 - | string: ::std::option::Option::None,
|
4883 - | struct_with_json_name: ::std::option::Option::None,
|
4884 - | timestamp: ::std::option::Option::None,
|
4885 - | unix_timestamp: ::std::option::Option::None,
|
4886 - | };
|
4887 - | ::pretty_assertions::assert_eq!(
|
4888 - | input.blob,
|
4889 - | expected.blob,
|
4890 - | "Unexpected value for `blob`"
|
4891 - | );
|
4892 - | ::pretty_assertions::assert_eq!(
|
4893 - | input.boolean,
|
4894 - | expected.boolean,
|
4895 - | "Unexpected value for `boolean`"
|
4896 - | );
|
4897 - | assert!(
|
4898 - | input.double.float_equals(&expected.double),
|
4899 - | "Unexpected value for `double` {:?} vs. {:?}",
|
4900 - | expected.double,
|
4901 - | input.double
|
4902 - | );
|
4903 - | ::pretty_assertions::assert_eq!(
|
4904 - | input.empty_struct,
|
4905 - | expected.empty_struct,
|
4906 - | "Unexpected value for `empty_struct`"
|
4907 - | );
|
4908 - | assert!(
|
4909 - | input.float.float_equals(&expected.float),
|
4910 - | "Unexpected value for `float` {:?} vs. {:?}",
|
4911 - | expected.float,
|
4912 - | input.float
|
4913 - | );
|
4914 - | ::pretty_assertions::assert_eq!(
|
4915 - | input.httpdate_timestamp,
|
4916 - | expected.httpdate_timestamp,
|
4917 - | "Unexpected value for `httpdate_timestamp`"
|
4918 - | );
|
4919 - | ::pretty_assertions::assert_eq!(
|
4920 - | input.integer,
|
4921 - | expected.integer,
|
4922 - | "Unexpected value for `integer`"
|
4923 - | );
|
4924 - | ::pretty_assertions::assert_eq!(
|
4925 - | input.iso8601_timestamp,
|
4926 - | expected.iso8601_timestamp,
|
4927 - | "Unexpected value for `iso8601_timestamp`"
|
4928 - | );
|
4929 - | ::pretty_assertions::assert_eq!(
|
4930 - | input.json_value,
|
4931 - | expected.json_value,
|
4932 - | "Unexpected value for `json_value`"
|
4933 - | );
|
4934 - | ::pretty_assertions::assert_eq!(
|
4935 - | input.list_of_lists,
|
4936 - | expected.list_of_lists,
|
4937 - | "Unexpected value for `list_of_lists`"
|
4938 - | );
|
4939 - | ::pretty_assertions::assert_eq!(
|
4940 - | input.list_of_maps_of_strings,
|
4941 - | expected.list_of_maps_of_strings,
|
4942 - | "Unexpected value for `list_of_maps_of_strings`"
|
4943 - | );
|
4944 - | ::pretty_assertions::assert_eq!(
|
4945 - | input.list_of_strings,
|
4946 - | expected.list_of_strings,
|
4947 - | "Unexpected value for `list_of_strings`"
|
4948 - | );
|
4949 - | ::pretty_assertions::assert_eq!(
|
4950 - | input.list_of_structs,
|
4951 - | expected.list_of_structs,
|
4952 - | "Unexpected value for `list_of_structs`"
|
4953 - | );
|
4954 - | ::pretty_assertions::assert_eq!(
|
4955 - | input.long,
|
4956 - | expected.long,
|
4957 - | "Unexpected value for `long`"
|
4958 - | );
|
4959 - | ::pretty_assertions::assert_eq!(
|
4960 - | input.map_of_lists_of_strings,
|
4961 - | expected.map_of_lists_of_strings,
|
4962 - | "Unexpected value for `map_of_lists_of_strings`"
|
4963 - | );
|
4964 - | ::pretty_assertions::assert_eq!(
|
4965 - | input.map_of_maps,
|
4966 - | expected.map_of_maps,
|
4967 - | "Unexpected value for `map_of_maps`"
|
4968 - | );
|
4969 - | ::pretty_assertions::assert_eq!(
|
4970 - | input.map_of_strings,
|
4971 - | expected.map_of_strings,
|
4972 - | "Unexpected value for `map_of_strings`"
|
4973 - | );
|
4974 - | ::pretty_assertions::assert_eq!(
|
4975 - | input.map_of_structs,
|
4976 - | expected.map_of_structs,
|
4977 - | "Unexpected value for `map_of_structs`"
|
4978 - | );
|
4979 - | ::pretty_assertions::assert_eq!(
|
4980 - | input.recursive_list,
|
4981 - | expected.recursive_list,
|
4982 - | "Unexpected value for `recursive_list`"
|
4983 - | );
|
4984 - | ::pretty_assertions::assert_eq!(
|
4985 - | input.recursive_map,
|
4986 - | expected.recursive_map,
|
4987 - | "Unexpected value for `recursive_map`"
|
4988 - | );
|
4989 - | ::pretty_assertions::assert_eq!(
|
4990 - | input.recursive_struct,
|
4991 - | expected.recursive_struct,
|
4992 - | "Unexpected value for `recursive_struct`"
|
4993 - | );
|
4994 - | ::pretty_assertions::assert_eq!(
|
4995 - | input.simple_struct,
|
4996 - | expected.simple_struct,
|
4997 - | "Unexpected value for `simple_struct`"
|
4998 - | );
|
4999 - | ::pretty_assertions::assert_eq!(
|
5000 - | input.string,
|
5001 - | expected.string,
|
5002 - | "Unexpected value for `string`"
|
5003 - | );
|
5004 - | ::pretty_assertions::assert_eq!(
|
5005 - | input.struct_with_json_name,
|
5006 - | expected.struct_with_json_name,
|
5007 - | "Unexpected value for `struct_with_json_name`"
|
5008 - | );
|
5009 - | ::pretty_assertions::assert_eq!(
|
5010 - | input.timestamp,
|
5011 - | expected.timestamp,
|
5012 - | "Unexpected value for `timestamp`"
|
5013 - | );
|
5014 - | ::pretty_assertions::assert_eq!(
|
5015 - | input.unix_timestamp,
|
5016 - | expected.unix_timestamp,
|
5017 - | "Unexpected value for `unix_timestamp`"
|
5018 - | );
|
5019 - | let response = crate::output::KitchenSinkOperationOutput {
|
5020 - | blob: ::std::option::Option::None,
|
5021 - | boolean: ::std::option::Option::None,
|
5022 - | double: ::std::option::Option::None,
|
5023 - | empty_struct: ::std::option::Option::None,
|
5024 - | float: ::std::option::Option::None,
|
5025 - | httpdate_timestamp: ::std::option::Option::None,
|
5026 - | integer: ::std::option::Option::None,
|
5027 - | iso8601_timestamp: ::std::option::Option::None,
|
5028 - | json_value: ::std::option::Option::None,
|
5029 - | list_of_lists: ::std::option::Option::None,
|
5030 - | list_of_maps_of_strings: ::std::option::Option::None,
|
5031 - | list_of_strings: ::std::option::Option::None,
|
5032 - | list_of_structs: ::std::option::Option::None,
|
5033 - | long: ::std::option::Option::None,
|
5034 - | map_of_lists_of_strings: ::std::option::Option::None,
|
5035 - | map_of_maps: ::std::option::Option::None,
|
5036 - | map_of_strings: ::std::option::Option::None,
|
5037 - | map_of_structs: ::std::option::Option::None,
|
5038 - | recursive_list: ::std::option::Option::None,
|
5039 - | recursive_map: ::std::option::Option::None,
|
5040 - | recursive_struct: ::std::option::Option::None,
|
5041 - | simple_struct: ::std::option::Option::None,
|
5042 - | string: ::std::option::Option::None,
|
5043 - | struct_with_json_name: ::std::option::Option::None,
|
5044 - | timestamp: ::std::option::Option::None,
|
5045 - | unix_timestamp: ::std::option::Option::None,
|
5046 - | };
|
5047 - | Ok(response)
|
5048 - | };
|
5049 - | sender.send(()).await.expect("receiver dropped early");
|
5050 - | result
|
5051 - | }
|
5052 - | })
|
5053 - | .build_unchecked();
|
5054 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5055 - | .await
|
5056 - | .expect("unable to make an HTTP request");
|
5057 - | assert!(receiver.recv().await.is_some());
|
2835 + | }
|
2836 + |
|
2837 + | impl std::future::Future for SimpleScalarPropertiesInputFuture {
|
2838 + | type Output = Result<
|
2839 + | crate::input::SimpleScalarPropertiesInput,
|
2840 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
2841 + | >;
|
2842 + |
|
2843 + | fn poll(
|
2844 + | self: std::pin::Pin<&mut Self>,
|
2845 + | cx: &mut std::task::Context<'_>,
|
2846 + | ) -> std::task::Poll<Self::Output> {
|
2847 + | let this = self.project();
|
2848 + | this.inner.as_mut().poll(cx)
|
5058 2849 | }
|
5059 - | /// Serializes list of recursive structure shapes
|
5060 - | /// Test ID: serializes_list_of_recursive_structure_shapes
|
2850 + | }
|
2851 + |
|
2852 + | impl<B>
|
2853 + | ::aws_smithy_http_server::request::FromRequest<
|
2854 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2855 + | B,
|
2856 + | > for crate::input::SimpleScalarPropertiesInput
|
2857 + | where
|
2858 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
2859 + | B: 'static,
|
2860 + |
|
2861 + | B::Data: Send,
|
2862 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
2863 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
2864 + | {
|
2865 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
2866 + | type Future = SimpleScalarPropertiesInputFuture;
|
2867 + |
|
2868 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2869 + | let fut = async move {
|
2870 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
2871 + | request.headers(),
|
2872 + | &CONTENT_TYPE_SIMPLESCALARPROPERTIES,
|
2873 + | ) {
|
2874 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
2875 + | }
|
2876 + | crate::protocol_serde::shape_simple_scalar_properties::de_simple_scalar_properties_http_request(request)
|
2877 + | .await
|
2878 + | .map_err(Into::into)
|
2879 + | };
|
2880 + | use ::futures_util::future::TryFutureExt;
|
2881 + | let fut = fut.map_err(
|
2882 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
2883 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2884 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
2885 + | },
|
2886 + | );
|
2887 + | SimpleScalarPropertiesInputFuture {
|
2888 + | inner: Box::pin(fut),
|
2889 + | }
|
2890 + | }
|
2891 + | }
|
2892 + | impl
|
2893 + | ::aws_smithy_http_server::response::IntoResponse<
|
2894 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2895 + | > for crate::output::SimpleScalarPropertiesOutput
|
2896 + | {
|
2897 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
2898 + | match crate::protocol_serde::shape_simple_scalar_properties::ser_simple_scalar_properties_http_response(self) {
|
2899 + | Ok(response) => response,
|
2900 + | Err(e) => {
|
2901 + | ::tracing::error!(error = %e, "failed to serialize response");
|
2902 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
2903 + | }
|
2904 + | }
|
2905 + | }
|
2906 + | }
|
2907 + |
|
2908 + | #[allow(unreachable_code, unused_variables)]
|
2909 + | #[cfg(test)]
|
2910 + | mod simple_scalar_properties_test {
|
2911 + |
|
2912 + | /// Supports handling NaN float values.
|
2913 + | /// Test ID: AwsJson11SupportsNaNFloatInputs
|
5061 2914 | #[::tokio::test]
|
5062 - | async fn serializes_list_of_recursive_structure_shapes_request() {
|
5063 - | #[allow(unused_mut)]
|
5064 - | let mut http_request = http::Request::builder()
|
5065 - | .uri("/")
|
5066 - | .method("POST")
|
5067 - | .header("Content-Type", "application/x-amz-json-1.1")
|
5068 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
5069 - | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{\"RecursiveList\":[{\"RecursiveList\":[{\"RecursiveList\":[{\"Integer\":123}]}]}]}".as_bytes()))).unwrap();
|
2915 + | #[::tracing_test::traced_test]
|
2916 + | async fn aws_json11_supports_na_n_float_inputs_request() {
|
5070 2917 | #[allow(unused_mut)]
|
5071 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5072 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
5073 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
5074 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
5075 - | let sender = sender.clone();
|
5076 - | async move {
|
5077 - | let result = {
|
5078 - | use ::aws_smithy_protocol_test::FloatEquals;
|
5079 - | let expected = crate::input::KitchenSinkOperationInput {
|
5080 - | recursive_list: ::std::option::Option::Some(vec![
|
5081 - | crate::model::KitchenSink {
|
5082 - | recursive_list: ::std::option::Option::Some(vec![
|
5083 - | crate::model::KitchenSink {
|
5084 - | recursive_list: ::std::option::Option::Some(vec![
|
5085 - | crate::model::KitchenSink {
|
5086 - | integer: ::std::option::Option::Some(123),
|
5087 - | blob: ::std::option::Option::None,
|
5088 - | boolean: ::std::option::Option::None,
|
5089 - | double: ::std::option::Option::None,
|
5090 - | empty_struct: ::std::option::Option::None,
|
5091 - | float: ::std::option::Option::None,
|
5092 - | httpdate_timestamp: ::std::option::Option::None,
|
5093 - | iso8601_timestamp: ::std::option::Option::None,
|
5094 - | json_value: ::std::option::Option::None,
|
5095 - | list_of_lists: ::std::option::Option::None,
|
5096 - | list_of_maps_of_strings:
|
5097 - | ::std::option::Option::None,
|
5098 - | list_of_strings: ::std::option::Option::None,
|
5099 - | list_of_structs: ::std::option::Option::None,
|
5100 - | long: ::std::option::Option::None,
|
5101 - | map_of_lists_of_strings:
|
5102 - | ::std::option::Option::None,
|
5103 - | map_of_maps: ::std::option::Option::None,
|
5104 - | map_of_strings: ::std::option::Option::None,
|
5105 - | map_of_structs: ::std::option::Option::None,
|
5106 - | recursive_list: ::std::option::Option::None,
|
5107 - | recursive_map: ::std::option::Option::None,
|
5108 - | recursive_struct: ::std::option::Option::None,
|
5109 - | simple_struct: ::std::option::Option::None,
|
5110 - | string: ::std::option::Option::None,
|
5111 - | struct_with_json_name:
|
5112 - | ::std::option::Option::None,
|
5113 - | timestamp: ::std::option::Option::None,
|
5114 - | unix_timestamp: ::std::option::Option::None,
|
5115 - | },
|
5116 - | ]),
|
5117 - | blob: ::std::option::Option::None,
|
5118 - | boolean: ::std::option::Option::None,
|
5119 - | double: ::std::option::Option::None,
|
5120 - | empty_struct: ::std::option::Option::None,
|
5121 - | float: ::std::option::Option::None,
|
5122 - | httpdate_timestamp: ::std::option::Option::None,
|
5123 - | integer: ::std::option::Option::None,
|
5124 - | iso8601_timestamp: ::std::option::Option::None,
|
5125 - | json_value: ::std::option::Option::None,
|
5126 - | list_of_lists: ::std::option::Option::None,
|
5127 - | list_of_maps_of_strings: ::std::option::Option::None,
|
5128 - | list_of_strings: ::std::option::Option::None,
|
5129 - | list_of_structs: ::std::option::Option::None,
|
5130 - | long: ::std::option::Option::None,
|
5131 - | map_of_lists_of_strings: ::std::option::Option::None,
|
5132 - | map_of_maps: ::std::option::Option::None,
|
5133 - | map_of_strings: ::std::option::Option::None,
|
5134 - | map_of_structs: ::std::option::Option::None,
|
5135 - | recursive_map: ::std::option::Option::None,
|
5136 - | recursive_struct: ::std::option::Option::None,
|
5137 - | simple_struct: ::std::option::Option::None,
|
5138 - | string: ::std::option::Option::None,
|
5139 - | struct_with_json_name: ::std::option::Option::None,
|
5140 - | timestamp: ::std::option::Option::None,
|
5141 - | unix_timestamp: ::std::option::Option::None,
|
5142 - | },
|
5143 - | ]),
|
5144 - | blob: ::std::option::Option::None,
|
5145 - | boolean: ::std::option::Option::None,
|
5146 - | double: ::std::option::Option::None,
|
5147 - | empty_struct: ::std::option::Option::None,
|
5148 - | float: ::std::option::Option::None,
|
5149 - | httpdate_timestamp: ::std::option::Option::None,
|
5150 - | integer: ::std::option::Option::None,
|
5151 - | iso8601_timestamp: ::std::option::Option::None,
|
5152 - | json_value: ::std::option::Option::None,
|
5153 - | list_of_lists: ::std::option::Option::None,
|
5154 - | list_of_maps_of_strings: ::std::option::Option::None,
|
5155 - | list_of_strings: ::std::option::Option::None,
|
5156 - | list_of_structs: ::std::option::Option::None,
|
5157 - | long: ::std::option::Option::None,
|
5158 - | map_of_lists_of_strings: ::std::option::Option::None,
|
5159 - | map_of_maps: ::std::option::Option::None,
|
5160 - | map_of_strings: ::std::option::Option::None,
|
5161 - | map_of_structs: ::std::option::Option::None,
|
5162 - | recursive_map: ::std::option::Option::None,
|
5163 - | recursive_struct: ::std::option::Option::None,
|
5164 - | simple_struct: ::std::option::Option::None,
|
5165 - | string: ::std::option::Option::None,
|
5166 - | struct_with_json_name: ::std::option::Option::None,
|
5167 - | timestamp: ::std::option::Option::None,
|
5168 - | unix_timestamp: ::std::option::Option::None,
|
5169 - | },
|
5170 - | ]),
|
5171 - | blob: ::std::option::Option::None,
|
5172 - | boolean: ::std::option::Option::None,
|
5173 - | double: ::std::option::Option::None,
|
5174 - | empty_struct: ::std::option::Option::None,
|
5175 - | float: ::std::option::Option::None,
|
5176 - | httpdate_timestamp: ::std::option::Option::None,
|
5177 - | integer: ::std::option::Option::None,
|
5178 - | iso8601_timestamp: ::std::option::Option::None,
|
5179 - | json_value: ::std::option::Option::None,
|
5180 - | list_of_lists: ::std::option::Option::None,
|
5181 - | list_of_maps_of_strings: ::std::option::Option::None,
|
5182 - | list_of_strings: ::std::option::Option::None,
|
5183 - | list_of_structs: ::std::option::Option::None,
|
5184 - | long: ::std::option::Option::None,
|
5185 - | map_of_lists_of_strings: ::std::option::Option::None,
|
5186 - | map_of_maps: ::std::option::Option::None,
|
5187 - | map_of_strings: ::std::option::Option::None,
|
5188 - | map_of_structs: ::std::option::Option::None,
|
5189 - | recursive_map: ::std::option::Option::None,
|
5190 - | recursive_struct: ::std::option::Option::None,
|
5191 - | simple_struct: ::std::option::Option::None,
|
5192 - | string: ::std::option::Option::None,
|
5193 - | struct_with_json_name: ::std::option::Option::None,
|
5194 - | timestamp: ::std::option::Option::None,
|
5195 - | unix_timestamp: ::std::option::Option::None,
|
5196 - | };
|
5197 - | ::pretty_assertions::assert_eq!(
|
5198 - | input.blob,
|
5199 - | expected.blob,
|
5200 - | "Unexpected value for `blob`"
|
5201 - | );
|
5202 - | ::pretty_assertions::assert_eq!(
|
5203 - | input.boolean,
|
5204 - | expected.boolean,
|
5205 - | "Unexpected value for `boolean`"
|
5206 - | );
|
5207 - | assert!(
|
5208 - | input.double.float_equals(&expected.double),
|
5209 - | "Unexpected value for `double` {:?} vs. {:?}",
|
5210 - | expected.double,
|
5211 - | input.double
|
5212 - | );
|
5213 - | ::pretty_assertions::assert_eq!(
|
5214 - | input.empty_struct,
|
5215 - | expected.empty_struct,
|
5216 - | "Unexpected value for `empty_struct`"
|
5217 - | );
|
5218 - | assert!(
|
5219 - | input.float.float_equals(&expected.float),
|
5220 - | "Unexpected value for `float` {:?} vs. {:?}",
|
5221 - | expected.float,
|
5222 - | input.float
|
5223 - | );
|
5224 - | ::pretty_assertions::assert_eq!(
|
5225 - | input.httpdate_timestamp,
|
5226 - | expected.httpdate_timestamp,
|
5227 - | "Unexpected value for `httpdate_timestamp`"
|
5228 - | );
|
5229 - | ::pretty_assertions::assert_eq!(
|
5230 - | input.integer,
|
5231 - | expected.integer,
|
5232 - | "Unexpected value for `integer`"
|
5233 - | );
|
5234 - | ::pretty_assertions::assert_eq!(
|
5235 - | input.iso8601_timestamp,
|
5236 - | expected.iso8601_timestamp,
|
5237 - | "Unexpected value for `iso8601_timestamp`"
|
5238 - | );
|
5239 - | ::pretty_assertions::assert_eq!(
|
5240 - | input.json_value,
|
5241 - | expected.json_value,
|
5242 - | "Unexpected value for `json_value`"
|
5243 - | );
|
5244 - | ::pretty_assertions::assert_eq!(
|
5245 - | input.list_of_lists,
|
5246 - | expected.list_of_lists,
|
5247 - | "Unexpected value for `list_of_lists`"
|
5248 - | );
|
5249 - | ::pretty_assertions::assert_eq!(
|
5250 - | input.list_of_maps_of_strings,
|
5251 - | expected.list_of_maps_of_strings,
|
5252 - | "Unexpected value for `list_of_maps_of_strings`"
|
5253 - | );
|
5254 - | ::pretty_assertions::assert_eq!(
|
5255 - | input.list_of_strings,
|
5256 - | expected.list_of_strings,
|
5257 - | "Unexpected value for `list_of_strings`"
|
5258 - | );
|
5259 - | ::pretty_assertions::assert_eq!(
|
5260 - | input.list_of_structs,
|
5261 - | expected.list_of_structs,
|
5262 - | "Unexpected value for `list_of_structs`"
|
5263 - | );
|
5264 - | ::pretty_assertions::assert_eq!(
|
5265 - | input.long,
|
5266 - | expected.long,
|
5267 - | "Unexpected value for `long`"
|
5268 - | );
|
5269 - | ::pretty_assertions::assert_eq!(
|
5270 - | input.map_of_lists_of_strings,
|
5271 - | expected.map_of_lists_of_strings,
|
5272 - | "Unexpected value for `map_of_lists_of_strings`"
|
5273 - | );
|
5274 - | ::pretty_assertions::assert_eq!(
|
5275 - | input.map_of_maps,
|
5276 - | expected.map_of_maps,
|
5277 - | "Unexpected value for `map_of_maps`"
|
5278 - | );
|
5279 - | ::pretty_assertions::assert_eq!(
|
5280 - | input.map_of_strings,
|
5281 - | expected.map_of_strings,
|
5282 - | "Unexpected value for `map_of_strings`"
|
5283 - | );
|
5284 - | ::pretty_assertions::assert_eq!(
|
5285 - | input.map_of_structs,
|
5286 - | expected.map_of_structs,
|
5287 - | "Unexpected value for `map_of_structs`"
|
5288 - | );
|
5289 - | ::pretty_assertions::assert_eq!(
|
5290 - | input.recursive_list,
|
5291 - | expected.recursive_list,
|
5292 - | "Unexpected value for `recursive_list`"
|
5293 - | );
|
5294 - | ::pretty_assertions::assert_eq!(
|
5295 - | input.recursive_map,
|
5296 - | expected.recursive_map,
|
5297 - | "Unexpected value for `recursive_map`"
|
5298 - | );
|
5299 - | ::pretty_assertions::assert_eq!(
|
5300 - | input.recursive_struct,
|
5301 - | expected.recursive_struct,
|
5302 - | "Unexpected value for `recursive_struct`"
|
5303 - | );
|
5304 - | ::pretty_assertions::assert_eq!(
|
5305 - | input.simple_struct,
|
5306 - | expected.simple_struct,
|
5307 - | "Unexpected value for `simple_struct`"
|
5308 - | );
|
5309 - | ::pretty_assertions::assert_eq!(
|
5310 - | input.string,
|
5311 - | expected.string,
|
5312 - | "Unexpected value for `string`"
|
5313 - | );
|
5314 - | ::pretty_assertions::assert_eq!(
|
5315 - | input.struct_with_json_name,
|
5316 - | expected.struct_with_json_name,
|
5317 - | "Unexpected value for `struct_with_json_name`"
|
5318 - | );
|
5319 - | ::pretty_assertions::assert_eq!(
|
5320 - | input.timestamp,
|
5321 - | expected.timestamp,
|
5322 - | "Unexpected value for `timestamp`"
|
5323 - | );
|
5324 - | ::pretty_assertions::assert_eq!(
|
5325 - | input.unix_timestamp,
|
5326 - | expected.unix_timestamp,
|
5327 - | "Unexpected value for `unix_timestamp`"
|
5328 - | );
|
5329 - | let response = crate::output::KitchenSinkOperationOutput {
|
5330 - | blob: ::std::option::Option::None,
|
5331 - | boolean: ::std::option::Option::None,
|
5332 - | double: ::std::option::Option::None,
|
5333 - | empty_struct: ::std::option::Option::None,
|
5334 - | float: ::std::option::Option::None,
|
5335 - | httpdate_timestamp: ::std::option::Option::None,
|
5336 - | integer: ::std::option::Option::None,
|
5337 - | iso8601_timestamp: ::std::option::Option::None,
|
5338 - | json_value: ::std::option::Option::None,
|
5339 - | list_of_lists: ::std::option::Option::None,
|
5340 - | list_of_maps_of_strings: ::std::option::Option::None,
|
5341 - | list_of_strings: ::std::option::Option::None,
|
5342 - | list_of_structs: ::std::option::Option::None,
|
5343 - | long: ::std::option::Option::None,
|
5344 - | map_of_lists_of_strings: ::std::option::Option::None,
|
5345 - | map_of_maps: ::std::option::Option::None,
|
5346 - | map_of_strings: ::std::option::Option::None,
|
5347 - | map_of_structs: ::std::option::Option::None,
|
5348 - | recursive_list: ::std::option::Option::None,
|
5349 - | recursive_map: ::std::option::Option::None,
|
5350 - | recursive_struct: ::std::option::Option::None,
|
5351 - | simple_struct: ::std::option::Option::None,
|
5352 - | string: ::std::option::Option::None,
|
5353 - | struct_with_json_name: ::std::option::Option::None,
|
5354 - | timestamp: ::std::option::Option::None,
|
5355 - | unix_timestamp: ::std::option::Option::None,
|
5356 - | };
|
5357 - | Ok(response)
|
5358 - | };
|
5359 - | sender.send(()).await.expect("receiver dropped early");
|
5360 - | result
|
5361 - | }
|
5362 - | })
|
5363 - | .build_unchecked();
|
5364 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5365 - | .await
|
5366 - | .expect("unable to make an HTTP request");
|
5367 - | assert!(receiver.recv().await.is_some());
|
5368 - | }
|
5369 - | /// Serializes map shapes
|
5370 - | /// Test ID: serializes_map_shapes
|
5371 - | #[::tokio::test]
|
5372 - | async fn serializes_map_shapes_request() {
|
5373 - | #[allow(unused_mut)]
|
5374 - | let mut http_request = http::Request::builder()
|
5375 - | .uri("/")
|
5376 - | .method("POST")
|
5377 - | .header("Content-Type", "application/x-amz-json-1.1")
|
5378 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
5379 - | .body(::aws_smithy_http_server::body::Body::from(
|
5380 - | ::bytes::Bytes::from_static(
|
5381 - | "{\"MapOfStrings\":{\"abc\":\"xyz\",\"mno\":\"hjk\"}}".as_bytes(),
|
5382 - | ),
|
5383 - | ))
|
5384 - | .unwrap();
|
5385 - | #[allow(unused_mut)]
|
5386 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5387 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
5388 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
5389 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
5390 - | let sender = sender.clone();
|
5391 - | async move {
|
5392 - | let result = {
|
5393 - | use ::aws_smithy_protocol_test::FloatEquals;
|
5394 - | let expected = crate::input::KitchenSinkOperationInput {
|
5395 - | map_of_strings: ::std::option::Option::Some({
|
5396 - | let mut ret = ::std::collections::HashMap::new();
|
5397 - | ret.insert("abc".to_owned(), "xyz".to_owned());
|
5398 - | ret.insert("mno".to_owned(), "hjk".to_owned());
|
5399 - | ret
|
5400 - | }),
|
5401 - | blob: ::std::option::Option::None,
|
5402 - | boolean: ::std::option::Option::None,
|
5403 - | double: ::std::option::Option::None,
|
5404 - | empty_struct: ::std::option::Option::None,
|
5405 - | float: ::std::option::Option::None,
|
5406 - | httpdate_timestamp: ::std::option::Option::None,
|
5407 - | integer: ::std::option::Option::None,
|
5408 - | iso8601_timestamp: ::std::option::Option::None,
|
5409 - | json_value: ::std::option::Option::None,
|
5410 - | list_of_lists: ::std::option::Option::None,
|
5411 - | list_of_maps_of_strings: ::std::option::Option::None,
|
5412 - | list_of_strings: ::std::option::Option::None,
|
5413 - | list_of_structs: ::std::option::Option::None,
|
5414 - | long: ::std::option::Option::None,
|
5415 - | map_of_lists_of_strings: ::std::option::Option::None,
|
5416 - | map_of_maps: ::std::option::Option::None,
|
5417 - | map_of_structs: ::std::option::Option::None,
|
5418 - | recursive_list: ::std::option::Option::None,
|
5419 - | recursive_map: ::std::option::Option::None,
|
5420 - | recursive_struct: ::std::option::Option::None,
|
5421 - | simple_struct: ::std::option::Option::None,
|
5422 - | string: ::std::option::Option::None,
|
5423 - | struct_with_json_name: ::std::option::Option::None,
|
5424 - | timestamp: ::std::option::Option::None,
|
5425 - | unix_timestamp: ::std::option::Option::None,
|
5426 - | };
|
5427 - | ::pretty_assertions::assert_eq!(
|
5428 - | input.blob,
|
5429 - | expected.blob,
|
5430 - | "Unexpected value for `blob`"
|
5431 - | );
|
5432 - | ::pretty_assertions::assert_eq!(
|
5433 - | input.boolean,
|
5434 - | expected.boolean,
|
5435 - | "Unexpected value for `boolean`"
|
5436 - | );
|
5437 - | assert!(
|
5438 - | input.double.float_equals(&expected.double),
|
5439 - | "Unexpected value for `double` {:?} vs. {:?}",
|
5440 - | expected.double,
|
5441 - | input.double
|
5442 - | );
|
5443 - | ::pretty_assertions::assert_eq!(
|
5444 - | input.empty_struct,
|
5445 - | expected.empty_struct,
|
5446 - | "Unexpected value for `empty_struct`"
|
5447 - | );
|
5448 - | assert!(
|
5449 - | input.float.float_equals(&expected.float),
|
5450 - | "Unexpected value for `float` {:?} vs. {:?}",
|
5451 - | expected.float,
|
5452 - | input.float
|
5453 - | );
|
5454 - | ::pretty_assertions::assert_eq!(
|
5455 - | input.httpdate_timestamp,
|
5456 - | expected.httpdate_timestamp,
|
5457 - | "Unexpected value for `httpdate_timestamp`"
|
5458 - | );
|
5459 - | ::pretty_assertions::assert_eq!(
|
5460 - | input.integer,
|
5461 - | expected.integer,
|
5462 - | "Unexpected value for `integer`"
|
5463 - | );
|
5464 - | ::pretty_assertions::assert_eq!(
|
5465 - | input.iso8601_timestamp,
|
5466 - | expected.iso8601_timestamp,
|
5467 - | "Unexpected value for `iso8601_timestamp`"
|
5468 - | );
|
5469 - | ::pretty_assertions::assert_eq!(
|
5470 - | input.json_value,
|
5471 - | expected.json_value,
|
5472 - | "Unexpected value for `json_value`"
|
5473 - | );
|
5474 - | ::pretty_assertions::assert_eq!(
|
5475 - | input.list_of_lists,
|
5476 - | expected.list_of_lists,
|
5477 - | "Unexpected value for `list_of_lists`"
|
5478 - | );
|
5479 - | ::pretty_assertions::assert_eq!(
|
5480 - | input.list_of_maps_of_strings,
|
5481 - | expected.list_of_maps_of_strings,
|
5482 - | "Unexpected value for `list_of_maps_of_strings`"
|
5483 - | );
|
5484 - | ::pretty_assertions::assert_eq!(
|
5485 - | input.list_of_strings,
|
5486 - | expected.list_of_strings,
|
5487 - | "Unexpected value for `list_of_strings`"
|
5488 - | );
|
5489 - | ::pretty_assertions::assert_eq!(
|
5490 - | input.list_of_structs,
|
5491 - | expected.list_of_structs,
|
5492 - | "Unexpected value for `list_of_structs`"
|
5493 - | );
|
5494 - | ::pretty_assertions::assert_eq!(
|
5495 - | input.long,
|
5496 - | expected.long,
|
5497 - | "Unexpected value for `long`"
|
5498 - | );
|
5499 - | ::pretty_assertions::assert_eq!(
|
5500 - | input.map_of_lists_of_strings,
|
5501 - | expected.map_of_lists_of_strings,
|
5502 - | "Unexpected value for `map_of_lists_of_strings`"
|
5503 - | );
|
5504 - | ::pretty_assertions::assert_eq!(
|
5505 - | input.map_of_maps,
|
5506 - | expected.map_of_maps,
|
5507 - | "Unexpected value for `map_of_maps`"
|
5508 - | );
|
5509 - | ::pretty_assertions::assert_eq!(
|
5510 - | input.map_of_strings,
|
5511 - | expected.map_of_strings,
|
5512 - | "Unexpected value for `map_of_strings`"
|
5513 - | );
|
5514 - | ::pretty_assertions::assert_eq!(
|
5515 - | input.map_of_structs,
|
5516 - | expected.map_of_structs,
|
5517 - | "Unexpected value for `map_of_structs`"
|
5518 - | );
|
5519 - | ::pretty_assertions::assert_eq!(
|
5520 - | input.recursive_list,
|
5521 - | expected.recursive_list,
|
5522 - | "Unexpected value for `recursive_list`"
|
5523 - | );
|
5524 - | ::pretty_assertions::assert_eq!(
|
5525 - | input.recursive_map,
|
5526 - | expected.recursive_map,
|
5527 - | "Unexpected value for `recursive_map`"
|
5528 - | );
|
5529 - | ::pretty_assertions::assert_eq!(
|
5530 - | input.recursive_struct,
|
5531 - | expected.recursive_struct,
|
5532 - | "Unexpected value for `recursive_struct`"
|
5533 - | );
|
5534 - | ::pretty_assertions::assert_eq!(
|
5535 - | input.simple_struct,
|
5536 - | expected.simple_struct,
|
5537 - | "Unexpected value for `simple_struct`"
|
5538 - | );
|
5539 - | ::pretty_assertions::assert_eq!(
|
5540 - | input.string,
|
5541 - | expected.string,
|
5542 - | "Unexpected value for `string`"
|
5543 - | );
|
5544 - | ::pretty_assertions::assert_eq!(
|
5545 - | input.struct_with_json_name,
|
5546 - | expected.struct_with_json_name,
|
5547 - | "Unexpected value for `struct_with_json_name`"
|
5548 - | );
|
5549 - | ::pretty_assertions::assert_eq!(
|
5550 - | input.timestamp,
|
5551 - | expected.timestamp,
|
5552 - | "Unexpected value for `timestamp`"
|
5553 - | );
|
5554 - | ::pretty_assertions::assert_eq!(
|
5555 - | input.unix_timestamp,
|
5556 - | expected.unix_timestamp,
|
5557 - | "Unexpected value for `unix_timestamp`"
|
5558 - | );
|
5559 - | let response = crate::output::KitchenSinkOperationOutput {
|
5560 - | blob: ::std::option::Option::None,
|
5561 - | boolean: ::std::option::Option::None,
|
5562 - | double: ::std::option::Option::None,
|
5563 - | empty_struct: ::std::option::Option::None,
|
5564 - | float: ::std::option::Option::None,
|
5565 - | httpdate_timestamp: ::std::option::Option::None,
|
5566 - | integer: ::std::option::Option::None,
|
5567 - | iso8601_timestamp: ::std::option::Option::None,
|
5568 - | json_value: ::std::option::Option::None,
|
5569 - | list_of_lists: ::std::option::Option::None,
|
5570 - | list_of_maps_of_strings: ::std::option::Option::None,
|
5571 - | list_of_strings: ::std::option::Option::None,
|
5572 - | list_of_structs: ::std::option::Option::None,
|
5573 - | long: ::std::option::Option::None,
|
5574 - | map_of_lists_of_strings: ::std::option::Option::None,
|
5575 - | map_of_maps: ::std::option::Option::None,
|
5576 - | map_of_strings: ::std::option::Option::None,
|
5577 - | map_of_structs: ::std::option::Option::None,
|
5578 - | recursive_list: ::std::option::Option::None,
|
5579 - | recursive_map: ::std::option::Option::None,
|
5580 - | recursive_struct: ::std::option::Option::None,
|
5581 - | simple_struct: ::std::option::Option::None,
|
5582 - | string: ::std::option::Option::None,
|
5583 - | struct_with_json_name: ::std::option::Option::None,
|
5584 - | timestamp: ::std::option::Option::None,
|
5585 - | unix_timestamp: ::std::option::Option::None,
|
5586 - | };
|
5587 - | Ok(response)
|
5588 - | };
|
5589 - | sender.send(()).await.expect("receiver dropped early");
|
5590 - | result
|
5591 - | }
|
5592 - | })
|
5593 - | .build_unchecked();
|
5594 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5595 - | .await
|
5596 - | .expect("unable to make an HTTP request");
|
5597 - | assert!(receiver.recv().await.is_some());
|
5598 - | }
|
5599 - | /// Serializes empty map shapes
|
5600 - | /// Test ID: serializes_empty_map_shapes
|
5601 - | #[::tokio::test]
|
5602 - | async fn serializes_empty_map_shapes_request() {
|
5603 - | #[allow(unused_mut)]
|
5604 - | let mut http_request = http::Request::builder()
|
5605 - | .uri("/")
|
5606 - | .method("POST")
|
5607 - | .header("Content-Type", "application/x-amz-json-1.1")
|
5608 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
5609 - | .body(::aws_smithy_http_server::body::Body::from(
|
5610 - | ::bytes::Bytes::from_static("{\"MapOfStrings\":{}}".as_bytes()),
|
5611 - | ))
|
5612 - | .unwrap();
|
5613 - | #[allow(unused_mut)]
|
5614 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5615 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
5616 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
5617 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
5618 - | let sender = sender.clone();
|
5619 - | async move {
|
5620 - | let result = {
|
5621 - | use ::aws_smithy_protocol_test::FloatEquals;
|
5622 - | let expected = crate::input::KitchenSinkOperationInput {
|
5623 - | map_of_strings: ::std::option::Option::Some(
|
5624 - | ::std::collections::HashMap::new(),
|
5625 - | ),
|
5626 - | blob: ::std::option::Option::None,
|
5627 - | boolean: ::std::option::Option::None,
|
5628 - | double: ::std::option::Option::None,
|
5629 - | empty_struct: ::std::option::Option::None,
|
5630 - | float: ::std::option::Option::None,
|
5631 - | httpdate_timestamp: ::std::option::Option::None,
|
5632 - | integer: ::std::option::Option::None,
|
5633 - | iso8601_timestamp: ::std::option::Option::None,
|
5634 - | json_value: ::std::option::Option::None,
|
5635 - | list_of_lists: ::std::option::Option::None,
|
5636 - | list_of_maps_of_strings: ::std::option::Option::None,
|
5637 - | list_of_strings: ::std::option::Option::None,
|
5638 - | list_of_structs: ::std::option::Option::None,
|
5639 - | long: ::std::option::Option::None,
|
5640 - | map_of_lists_of_strings: ::std::option::Option::None,
|
5641 - | map_of_maps: ::std::option::Option::None,
|
5642 - | map_of_structs: ::std::option::Option::None,
|
5643 - | recursive_list: ::std::option::Option::None,
|
5644 - | recursive_map: ::std::option::Option::None,
|
5645 - | recursive_struct: ::std::option::Option::None,
|
5646 - | simple_struct: ::std::option::Option::None,
|
5647 - | string: ::std::option::Option::None,
|
5648 - | struct_with_json_name: ::std::option::Option::None,
|
5649 - | timestamp: ::std::option::Option::None,
|
5650 - | unix_timestamp: ::std::option::Option::None,
|
5651 - | };
|
5652 - | ::pretty_assertions::assert_eq!(
|
5653 - | input.blob,
|
5654 - | expected.blob,
|
5655 - | "Unexpected value for `blob`"
|
5656 - | );
|
5657 - | ::pretty_assertions::assert_eq!(
|
5658 - | input.boolean,
|
5659 - | expected.boolean,
|
5660 - | "Unexpected value for `boolean`"
|
5661 - | );
|
5662 - | assert!(
|
5663 - | input.double.float_equals(&expected.double),
|
5664 - | "Unexpected value for `double` {:?} vs. {:?}",
|
5665 - | expected.double,
|
5666 - | input.double
|
5667 - | );
|
5668 - | ::pretty_assertions::assert_eq!(
|
5669 - | input.empty_struct,
|
5670 - | expected.empty_struct,
|
5671 - | "Unexpected value for `empty_struct`"
|
5672 - | );
|
5673 - | assert!(
|
5674 - | input.float.float_equals(&expected.float),
|
5675 - | "Unexpected value for `float` {:?} vs. {:?}",
|
5676 - | expected.float,
|
5677 - | input.float
|
5678 - | );
|
5679 - | ::pretty_assertions::assert_eq!(
|
5680 - | input.httpdate_timestamp,
|
5681 - | expected.httpdate_timestamp,
|
5682 - | "Unexpected value for `httpdate_timestamp`"
|
5683 - | );
|
5684 - | ::pretty_assertions::assert_eq!(
|
5685 - | input.integer,
|
5686 - | expected.integer,
|
5687 - | "Unexpected value for `integer`"
|
5688 - | );
|
5689 - | ::pretty_assertions::assert_eq!(
|
5690 - | input.iso8601_timestamp,
|
5691 - | expected.iso8601_timestamp,
|
5692 - | "Unexpected value for `iso8601_timestamp`"
|
5693 - | );
|
5694 - | ::pretty_assertions::assert_eq!(
|
5695 - | input.json_value,
|
5696 - | expected.json_value,
|
5697 - | "Unexpected value for `json_value`"
|
5698 - | );
|
5699 - | ::pretty_assertions::assert_eq!(
|
5700 - | input.list_of_lists,
|
5701 - | expected.list_of_lists,
|
5702 - | "Unexpected value for `list_of_lists`"
|
5703 - | );
|
5704 - | ::pretty_assertions::assert_eq!(
|
5705 - | input.list_of_maps_of_strings,
|
5706 - | expected.list_of_maps_of_strings,
|
5707 - | "Unexpected value for `list_of_maps_of_strings`"
|
5708 - | );
|
5709 - | ::pretty_assertions::assert_eq!(
|
5710 - | input.list_of_strings,
|
5711 - | expected.list_of_strings,
|
5712 - | "Unexpected value for `list_of_strings`"
|
5713 - | );
|
5714 - | ::pretty_assertions::assert_eq!(
|
5715 - | input.list_of_structs,
|
5716 - | expected.list_of_structs,
|
5717 - | "Unexpected value for `list_of_structs`"
|
5718 - | );
|
5719 - | ::pretty_assertions::assert_eq!(
|
5720 - | input.long,
|
5721 - | expected.long,
|
5722 - | "Unexpected value for `long`"
|
5723 - | );
|
5724 - | ::pretty_assertions::assert_eq!(
|
5725 - | input.map_of_lists_of_strings,
|
5726 - | expected.map_of_lists_of_strings,
|
5727 - | "Unexpected value for `map_of_lists_of_strings`"
|
5728 - | );
|
5729 - | ::pretty_assertions::assert_eq!(
|
5730 - | input.map_of_maps,
|
5731 - | expected.map_of_maps,
|
5732 - | "Unexpected value for `map_of_maps`"
|
5733 - | );
|
5734 - | ::pretty_assertions::assert_eq!(
|
5735 - | input.map_of_strings,
|
5736 - | expected.map_of_strings,
|
5737 - | "Unexpected value for `map_of_strings`"
|
5738 - | );
|
5739 - | ::pretty_assertions::assert_eq!(
|
5740 - | input.map_of_structs,
|
5741 - | expected.map_of_structs,
|
5742 - | "Unexpected value for `map_of_structs`"
|
5743 - | );
|
5744 - | ::pretty_assertions::assert_eq!(
|
5745 - | input.recursive_list,
|
5746 - | expected.recursive_list,
|
5747 - | "Unexpected value for `recursive_list`"
|
5748 - | );
|
5749 - | ::pretty_assertions::assert_eq!(
|
5750 - | input.recursive_map,
|
5751 - | expected.recursive_map,
|
5752 - | "Unexpected value for `recursive_map`"
|
5753 - | );
|
5754 - | ::pretty_assertions::assert_eq!(
|
5755 - | input.recursive_struct,
|
5756 - | expected.recursive_struct,
|
5757 - | "Unexpected value for `recursive_struct`"
|
5758 - | );
|
5759 - | ::pretty_assertions::assert_eq!(
|
5760 - | input.simple_struct,
|
5761 - | expected.simple_struct,
|
5762 - | "Unexpected value for `simple_struct`"
|
5763 - | );
|
5764 - | ::pretty_assertions::assert_eq!(
|
5765 - | input.string,
|
5766 - | expected.string,
|
5767 - | "Unexpected value for `string`"
|
5768 - | );
|
5769 - | ::pretty_assertions::assert_eq!(
|
5770 - | input.struct_with_json_name,
|
5771 - | expected.struct_with_json_name,
|
5772 - | "Unexpected value for `struct_with_json_name`"
|
5773 - | );
|
5774 - | ::pretty_assertions::assert_eq!(
|
5775 - | input.timestamp,
|
5776 - | expected.timestamp,
|
5777 - | "Unexpected value for `timestamp`"
|
5778 - | );
|
5779 - | ::pretty_assertions::assert_eq!(
|
5780 - | input.unix_timestamp,
|
5781 - | expected.unix_timestamp,
|
5782 - | "Unexpected value for `unix_timestamp`"
|
5783 - | );
|
5784 - | let response = crate::output::KitchenSinkOperationOutput {
|
5785 - | blob: ::std::option::Option::None,
|
5786 - | boolean: ::std::option::Option::None,
|
5787 - | double: ::std::option::Option::None,
|
5788 - | empty_struct: ::std::option::Option::None,
|
5789 - | float: ::std::option::Option::None,
|
5790 - | httpdate_timestamp: ::std::option::Option::None,
|
5791 - | integer: ::std::option::Option::None,
|
5792 - | iso8601_timestamp: ::std::option::Option::None,
|
5793 - | json_value: ::std::option::Option::None,
|
5794 - | list_of_lists: ::std::option::Option::None,
|
5795 - | list_of_maps_of_strings: ::std::option::Option::None,
|
5796 - | list_of_strings: ::std::option::Option::None,
|
5797 - | list_of_structs: ::std::option::Option::None,
|
5798 - | long: ::std::option::Option::None,
|
5799 - | map_of_lists_of_strings: ::std::option::Option::None,
|
5800 - | map_of_maps: ::std::option::Option::None,
|
5801 - | map_of_strings: ::std::option::Option::None,
|
5802 - | map_of_structs: ::std::option::Option::None,
|
5803 - | recursive_list: ::std::option::Option::None,
|
5804 - | recursive_map: ::std::option::Option::None,
|
5805 - | recursive_struct: ::std::option::Option::None,
|
5806 - | simple_struct: ::std::option::Option::None,
|
5807 - | string: ::std::option::Option::None,
|
5808 - | struct_with_json_name: ::std::option::Option::None,
|
5809 - | timestamp: ::std::option::Option::None,
|
5810 - | unix_timestamp: ::std::option::Option::None,
|
5811 - | };
|
5812 - | Ok(response)
|
5813 - | };
|
5814 - | sender.send(()).await.expect("receiver dropped early");
|
5815 - | result
|
5816 - | }
|
5817 - | })
|
5818 - | .build_unchecked();
|
5819 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5820 - | .await
|
5821 - | .expect("unable to make an HTTP request");
|
5822 - | assert!(receiver.recv().await.is_some());
|
5823 - | }
|
5824 - | /// Serializes map of list shapes
|
5825 - | /// Test ID: serializes_map_of_list_shapes
|
5826 - | #[::tokio::test]
|
5827 - | async fn serializes_map_of_list_shapes_request() {
|
5828 - | #[allow(unused_mut)]
|
5829 - | let mut http_request = http::Request::builder()
|
5830 - | .uri("/")
|
5831 - | .method("POST")
|
5832 - | .header("Content-Type", "application/x-amz-json-1.1")
|
5833 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
5834 - | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{\"MapOfListsOfStrings\":{\"abc\":[\"abc\",\"xyz\"],\"mno\":[\"xyz\",\"abc\"]}}".as_bytes()))).unwrap();
|
5835 - | #[allow(unused_mut)]
|
5836 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5837 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
5838 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
5839 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
5840 - | let sender = sender.clone();
|
5841 - | async move {
|
5842 - | let result = {
|
5843 - | use ::aws_smithy_protocol_test::FloatEquals;
|
5844 - | let expected = crate::input::KitchenSinkOperationInput {
|
5845 - | map_of_lists_of_strings: ::std::option::Option::Some({
|
5846 - | let mut ret = ::std::collections::HashMap::new();
|
5847 - | ret.insert(
|
5848 - | "abc".to_owned(),
|
5849 - | vec!["abc".to_owned(), "xyz".to_owned()],
|
5850 - | );
|
5851 - | ret.insert(
|
5852 - | "mno".to_owned(),
|
5853 - | vec!["xyz".to_owned(), "abc".to_owned()],
|
5854 - | );
|
5855 - | ret
|
5856 - | }),
|
5857 - | blob: ::std::option::Option::None,
|
5858 - | boolean: ::std::option::Option::None,
|
5859 - | double: ::std::option::Option::None,
|
5860 - | empty_struct: ::std::option::Option::None,
|
5861 - | float: ::std::option::Option::None,
|
5862 - | httpdate_timestamp: ::std::option::Option::None,
|
5863 - | integer: ::std::option::Option::None,
|
5864 - | iso8601_timestamp: ::std::option::Option::None,
|
5865 - | json_value: ::std::option::Option::None,
|
5866 - | list_of_lists: ::std::option::Option::None,
|
5867 - | list_of_maps_of_strings: ::std::option::Option::None,
|
5868 - | list_of_strings: ::std::option::Option::None,
|
5869 - | list_of_structs: ::std::option::Option::None,
|
5870 - | long: ::std::option::Option::None,
|
5871 - | map_of_maps: ::std::option::Option::None,
|
5872 - | map_of_strings: ::std::option::Option::None,
|
5873 - | map_of_structs: ::std::option::Option::None,
|
5874 - | recursive_list: ::std::option::Option::None,
|
5875 - | recursive_map: ::std::option::Option::None,
|
5876 - | recursive_struct: ::std::option::Option::None,
|
5877 - | simple_struct: ::std::option::Option::None,
|
5878 - | string: ::std::option::Option::None,
|
5879 - | struct_with_json_name: ::std::option::Option::None,
|
5880 - | timestamp: ::std::option::Option::None,
|
5881 - | unix_timestamp: ::std::option::Option::None,
|
5882 - | };
|
5883 - | ::pretty_assertions::assert_eq!(
|
5884 - | input.blob,
|
5885 - | expected.blob,
|
5886 - | "Unexpected value for `blob`"
|
5887 - | );
|
5888 - | ::pretty_assertions::assert_eq!(
|
5889 - | input.boolean,
|
5890 - | expected.boolean,
|
5891 - | "Unexpected value for `boolean`"
|
5892 - | );
|
5893 - | assert!(
|
5894 - | input.double.float_equals(&expected.double),
|
5895 - | "Unexpected value for `double` {:?} vs. {:?}",
|
5896 - | expected.double,
|
5897 - | input.double
|
5898 - | );
|
5899 - | ::pretty_assertions::assert_eq!(
|
5900 - | input.empty_struct,
|
5901 - | expected.empty_struct,
|
5902 - | "Unexpected value for `empty_struct`"
|
5903 - | );
|
5904 - | assert!(
|
5905 - | input.float.float_equals(&expected.float),
|
5906 - | "Unexpected value for `float` {:?} vs. {:?}",
|
5907 - | expected.float,
|
5908 - | input.float
|
5909 - | );
|
5910 - | ::pretty_assertions::assert_eq!(
|
5911 - | input.httpdate_timestamp,
|
5912 - | expected.httpdate_timestamp,
|
5913 - | "Unexpected value for `httpdate_timestamp`"
|
5914 - | );
|
5915 - | ::pretty_assertions::assert_eq!(
|
5916 - | input.integer,
|
5917 - | expected.integer,
|
5918 - | "Unexpected value for `integer`"
|
5919 - | );
|
5920 - | ::pretty_assertions::assert_eq!(
|
5921 - | input.iso8601_timestamp,
|
5922 - | expected.iso8601_timestamp,
|
5923 - | "Unexpected value for `iso8601_timestamp`"
|
5924 - | );
|
5925 - | ::pretty_assertions::assert_eq!(
|
5926 - | input.json_value,
|
5927 - | expected.json_value,
|
5928 - | "Unexpected value for `json_value`"
|
5929 - | );
|
5930 - | ::pretty_assertions::assert_eq!(
|
5931 - | input.list_of_lists,
|
5932 - | expected.list_of_lists,
|
5933 - | "Unexpected value for `list_of_lists`"
|
5934 - | );
|
5935 - | ::pretty_assertions::assert_eq!(
|
5936 - | input.list_of_maps_of_strings,
|
5937 - | expected.list_of_maps_of_strings,
|
5938 - | "Unexpected value for `list_of_maps_of_strings`"
|
5939 - | );
|
5940 - | ::pretty_assertions::assert_eq!(
|
5941 - | input.list_of_strings,
|
5942 - | expected.list_of_strings,
|
5943 - | "Unexpected value for `list_of_strings`"
|
5944 - | );
|
5945 - | ::pretty_assertions::assert_eq!(
|
5946 - | input.list_of_structs,
|
5947 - | expected.list_of_structs,
|
5948 - | "Unexpected value for `list_of_structs`"
|
5949 - | );
|
5950 - | ::pretty_assertions::assert_eq!(
|
5951 - | input.long,
|
5952 - | expected.long,
|
5953 - | "Unexpected value for `long`"
|
5954 - | );
|
5955 - | ::pretty_assertions::assert_eq!(
|
5956 - | input.map_of_lists_of_strings,
|
5957 - | expected.map_of_lists_of_strings,
|
5958 - | "Unexpected value for `map_of_lists_of_strings`"
|
5959 - | );
|
5960 - | ::pretty_assertions::assert_eq!(
|
5961 - | input.map_of_maps,
|
5962 - | expected.map_of_maps,
|
5963 - | "Unexpected value for `map_of_maps`"
|
5964 - | );
|
5965 - | ::pretty_assertions::assert_eq!(
|
5966 - | input.map_of_strings,
|
5967 - | expected.map_of_strings,
|
5968 - | "Unexpected value for `map_of_strings`"
|
5969 - | );
|
5970 - | ::pretty_assertions::assert_eq!(
|
5971 - | input.map_of_structs,
|
5972 - | expected.map_of_structs,
|
5973 - | "Unexpected value for `map_of_structs`"
|
5974 - | );
|
5975 - | ::pretty_assertions::assert_eq!(
|
5976 - | input.recursive_list,
|
5977 - | expected.recursive_list,
|
5978 - | "Unexpected value for `recursive_list`"
|
5979 - | );
|
5980 - | ::pretty_assertions::assert_eq!(
|
5981 - | input.recursive_map,
|
5982 - | expected.recursive_map,
|
5983 - | "Unexpected value for `recursive_map`"
|
5984 - | );
|
5985 - | ::pretty_assertions::assert_eq!(
|
5986 - | input.recursive_struct,
|
5987 - | expected.recursive_struct,
|
5988 - | "Unexpected value for `recursive_struct`"
|
5989 - | );
|
5990 - | ::pretty_assertions::assert_eq!(
|
5991 - | input.simple_struct,
|
5992 - | expected.simple_struct,
|
5993 - | "Unexpected value for `simple_struct`"
|
5994 - | );
|
5995 - | ::pretty_assertions::assert_eq!(
|
5996 - | input.string,
|
5997 - | expected.string,
|
5998 - | "Unexpected value for `string`"
|
5999 - | );
|
6000 - | ::pretty_assertions::assert_eq!(
|
6001 - | input.struct_with_json_name,
|
6002 - | expected.struct_with_json_name,
|
6003 - | "Unexpected value for `struct_with_json_name`"
|
6004 - | );
|
6005 - | ::pretty_assertions::assert_eq!(
|
6006 - | input.timestamp,
|
6007 - | expected.timestamp,
|
6008 - | "Unexpected value for `timestamp`"
|
6009 - | );
|
6010 - | ::pretty_assertions::assert_eq!(
|
6011 - | input.unix_timestamp,
|
6012 - | expected.unix_timestamp,
|
6013 - | "Unexpected value for `unix_timestamp`"
|
6014 - | );
|
6015 - | let response = crate::output::KitchenSinkOperationOutput {
|
6016 - | blob: ::std::option::Option::None,
|
6017 - | boolean: ::std::option::Option::None,
|
6018 - | double: ::std::option::Option::None,
|
6019 - | empty_struct: ::std::option::Option::None,
|
6020 - | float: ::std::option::Option::None,
|
6021 - | httpdate_timestamp: ::std::option::Option::None,
|
6022 - | integer: ::std::option::Option::None,
|
6023 - | iso8601_timestamp: ::std::option::Option::None,
|
6024 - | json_value: ::std::option::Option::None,
|
6025 - | list_of_lists: ::std::option::Option::None,
|
6026 - | list_of_maps_of_strings: ::std::option::Option::None,
|
6027 - | list_of_strings: ::std::option::Option::None,
|
6028 - | list_of_structs: ::std::option::Option::None,
|
6029 - | long: ::std::option::Option::None,
|
6030 - | map_of_lists_of_strings: ::std::option::Option::None,
|
6031 - | map_of_maps: ::std::option::Option::None,
|
6032 - | map_of_strings: ::std::option::Option::None,
|
6033 - | map_of_structs: ::std::option::Option::None,
|
6034 - | recursive_list: ::std::option::Option::None,
|
6035 - | recursive_map: ::std::option::Option::None,
|
6036 - | recursive_struct: ::std::option::Option::None,
|
6037 - | simple_struct: ::std::option::Option::None,
|
6038 - | string: ::std::option::Option::None,
|
6039 - | struct_with_json_name: ::std::option::Option::None,
|
6040 - | timestamp: ::std::option::Option::None,
|
6041 - | unix_timestamp: ::std::option::Option::None,
|
6042 - | };
|
6043 - | Ok(response)
|
6044 - | };
|
6045 - | sender.send(()).await.expect("receiver dropped early");
|
6046 - | result
|
6047 - | }
|
6048 - | })
|
6049 - | .build_unchecked();
|
6050 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6051 - | .await
|
6052 - | .expect("unable to make an HTTP request");
|
6053 - | assert!(receiver.recv().await.is_some());
|
6054 - | }
|
6055 - | /// Serializes map of structure shapes
|
6056 - | /// Test ID: serializes_map_of_structure_shapes
|
6057 - | #[::tokio::test]
|
6058 - | async fn serializes_map_of_structure_shapes_request() {
|
6059 - | #[allow(unused_mut)]
|
6060 - | let mut http_request = http::Request::builder()
|
6061 - | .uri("/")
|
6062 - | .method("POST")
|
6063 - | .header("Content-Type", "application/x-amz-json-1.1")
|
6064 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
6065 - | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{\"MapOfStructs\":{\"key1\":{\"Value\":\"value-1\"},\"key2\":{\"Value\":\"value-2\"}}}".as_bytes()))).unwrap();
|
6066 - | #[allow(unused_mut)]
|
6067 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6068 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
6069 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
6070 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
6071 - | let sender = sender.clone();
|
6072 - | async move {
|
6073 - | let result = {
|
6074 - | use ::aws_smithy_protocol_test::FloatEquals;
|
6075 - | let expected = crate::input::KitchenSinkOperationInput {
|
6076 - | map_of_structs: ::std::option::Option::Some({
|
6077 - | let mut ret = ::std::collections::HashMap::new();
|
6078 - | ret.insert(
|
6079 - | "key1".to_owned(),
|
6080 - | crate::model::SimpleStruct {
|
6081 - | value: ::std::option::Option::Some("value-1".to_owned()),
|
6082 - | },
|
6083 - | );
|
6084 - | ret.insert(
|
6085 - | "key2".to_owned(),
|
6086 - | crate::model::SimpleStruct {
|
6087 - | value: ::std::option::Option::Some("value-2".to_owned()),
|
6088 - | },
|
6089 - | );
|
6090 - | ret
|
6091 - | }),
|
6092 - | blob: ::std::option::Option::None,
|
6093 - | boolean: ::std::option::Option::None,
|
6094 - | double: ::std::option::Option::None,
|
6095 - | empty_struct: ::std::option::Option::None,
|
6096 - | float: ::std::option::Option::None,
|
6097 - | httpdate_timestamp: ::std::option::Option::None,
|
6098 - | integer: ::std::option::Option::None,
|
6099 - | iso8601_timestamp: ::std::option::Option::None,
|
6100 - | json_value: ::std::option::Option::None,
|
6101 - | list_of_lists: ::std::option::Option::None,
|
6102 - | list_of_maps_of_strings: ::std::option::Option::None,
|
6103 - | list_of_strings: ::std::option::Option::None,
|
6104 - | list_of_structs: ::std::option::Option::None,
|
6105 - | long: ::std::option::Option::None,
|
6106 - | map_of_lists_of_strings: ::std::option::Option::None,
|
6107 - | map_of_maps: ::std::option::Option::None,
|
6108 - | map_of_strings: ::std::option::Option::None,
|
6109 - | recursive_list: ::std::option::Option::None,
|
6110 - | recursive_map: ::std::option::Option::None,
|
6111 - | recursive_struct: ::std::option::Option::None,
|
6112 - | simple_struct: ::std::option::Option::None,
|
6113 - | string: ::std::option::Option::None,
|
6114 - | struct_with_json_name: ::std::option::Option::None,
|
6115 - | timestamp: ::std::option::Option::None,
|
6116 - | unix_timestamp: ::std::option::Option::None,
|
6117 - | };
|
6118 - | ::pretty_assertions::assert_eq!(
|
6119 - | input.blob,
|
6120 - | expected.blob,
|
6121 - | "Unexpected value for `blob`"
|
6122 - | );
|
6123 - | ::pretty_assertions::assert_eq!(
|
6124 - | input.boolean,
|
6125 - | expected.boolean,
|
6126 - | "Unexpected value for `boolean`"
|
6127 - | );
|
6128 - | assert!(
|
6129 - | input.double.float_equals(&expected.double),
|
6130 - | "Unexpected value for `double` {:?} vs. {:?}",
|
6131 - | expected.double,
|
6132 - | input.double
|
6133 - | );
|
6134 - | ::pretty_assertions::assert_eq!(
|
6135 - | input.empty_struct,
|
6136 - | expected.empty_struct,
|
6137 - | "Unexpected value for `empty_struct`"
|
6138 - | );
|
6139 - | assert!(
|
6140 - | input.float.float_equals(&expected.float),
|
6141 - | "Unexpected value for `float` {:?} vs. {:?}",
|
6142 - | expected.float,
|
6143 - | input.float
|
6144 - | );
|
6145 - | ::pretty_assertions::assert_eq!(
|
6146 - | input.httpdate_timestamp,
|
6147 - | expected.httpdate_timestamp,
|
6148 - | "Unexpected value for `httpdate_timestamp`"
|
6149 - | );
|
6150 - | ::pretty_assertions::assert_eq!(
|
6151 - | input.integer,
|
6152 - | expected.integer,
|
6153 - | "Unexpected value for `integer`"
|
6154 - | );
|
6155 - | ::pretty_assertions::assert_eq!(
|
6156 - | input.iso8601_timestamp,
|
6157 - | expected.iso8601_timestamp,
|
6158 - | "Unexpected value for `iso8601_timestamp`"
|
6159 - | );
|
6160 - | ::pretty_assertions::assert_eq!(
|
6161 - | input.json_value,
|
6162 - | expected.json_value,
|
6163 - | "Unexpected value for `json_value`"
|
6164 - | );
|
6165 - | ::pretty_assertions::assert_eq!(
|
6166 - | input.list_of_lists,
|
6167 - | expected.list_of_lists,
|
6168 - | "Unexpected value for `list_of_lists`"
|
6169 - | );
|
6170 - | ::pretty_assertions::assert_eq!(
|
6171 - | input.list_of_maps_of_strings,
|
6172 - | expected.list_of_maps_of_strings,
|
6173 - | "Unexpected value for `list_of_maps_of_strings`"
|
6174 - | );
|
6175 - | ::pretty_assertions::assert_eq!(
|
6176 - | input.list_of_strings,
|
6177 - | expected.list_of_strings,
|
6178 - | "Unexpected value for `list_of_strings`"
|
6179 - | );
|
6180 - | ::pretty_assertions::assert_eq!(
|
6181 - | input.list_of_structs,
|
6182 - | expected.list_of_structs,
|
6183 - | "Unexpected value for `list_of_structs`"
|
6184 - | );
|
6185 - | ::pretty_assertions::assert_eq!(
|
6186 - | input.long,
|
6187 - | expected.long,
|
6188 - | "Unexpected value for `long`"
|
6189 - | );
|
6190 - | ::pretty_assertions::assert_eq!(
|
6191 - | input.map_of_lists_of_strings,
|
6192 - | expected.map_of_lists_of_strings,
|
6193 - | "Unexpected value for `map_of_lists_of_strings`"
|
6194 - | );
|
6195 - | ::pretty_assertions::assert_eq!(
|
6196 - | input.map_of_maps,
|
6197 - | expected.map_of_maps,
|
6198 - | "Unexpected value for `map_of_maps`"
|
6199 - | );
|
6200 - | ::pretty_assertions::assert_eq!(
|
6201 - | input.map_of_strings,
|
6202 - | expected.map_of_strings,
|
6203 - | "Unexpected value for `map_of_strings`"
|
6204 - | );
|
6205 - | ::pretty_assertions::assert_eq!(
|
6206 - | input.map_of_structs,
|
6207 - | expected.map_of_structs,
|
6208 - | "Unexpected value for `map_of_structs`"
|
6209 - | );
|
6210 - | ::pretty_assertions::assert_eq!(
|
6211 - | input.recursive_list,
|
6212 - | expected.recursive_list,
|
6213 - | "Unexpected value for `recursive_list`"
|
6214 - | );
|
6215 - | ::pretty_assertions::assert_eq!(
|
6216 - | input.recursive_map,
|
6217 - | expected.recursive_map,
|
6218 - | "Unexpected value for `recursive_map`"
|
6219 - | );
|
6220 - | ::pretty_assertions::assert_eq!(
|
6221 - | input.recursive_struct,
|
6222 - | expected.recursive_struct,
|
6223 - | "Unexpected value for `recursive_struct`"
|
6224 - | );
|
6225 - | ::pretty_assertions::assert_eq!(
|
6226 - | input.simple_struct,
|
6227 - | expected.simple_struct,
|
6228 - | "Unexpected value for `simple_struct`"
|
6229 - | );
|
6230 - | ::pretty_assertions::assert_eq!(
|
6231 - | input.string,
|
6232 - | expected.string,
|
6233 - | "Unexpected value for `string`"
|
6234 - | );
|
6235 - | ::pretty_assertions::assert_eq!(
|
6236 - | input.struct_with_json_name,
|
6237 - | expected.struct_with_json_name,
|
6238 - | "Unexpected value for `struct_with_json_name`"
|
6239 - | );
|
6240 - | ::pretty_assertions::assert_eq!(
|
6241 - | input.timestamp,
|
6242 - | expected.timestamp,
|
6243 - | "Unexpected value for `timestamp`"
|
6244 - | );
|
6245 - | ::pretty_assertions::assert_eq!(
|
6246 - | input.unix_timestamp,
|
6247 - | expected.unix_timestamp,
|
6248 - | "Unexpected value for `unix_timestamp`"
|
6249 - | );
|
6250 - | let response = crate::output::KitchenSinkOperationOutput {
|
6251 - | blob: ::std::option::Option::None,
|
6252 - | boolean: ::std::option::Option::None,
|
6253 - | double: ::std::option::Option::None,
|
6254 - | empty_struct: ::std::option::Option::None,
|
6255 - | float: ::std::option::Option::None,
|
6256 - | httpdate_timestamp: ::std::option::Option::None,
|
6257 - | integer: ::std::option::Option::None,
|
6258 - | iso8601_timestamp: ::std::option::Option::None,
|
6259 - | json_value: ::std::option::Option::None,
|
6260 - | list_of_lists: ::std::option::Option::None,
|
6261 - | list_of_maps_of_strings: ::std::option::Option::None,
|
6262 - | list_of_strings: ::std::option::Option::None,
|
6263 - | list_of_structs: ::std::option::Option::None,
|
6264 - | long: ::std::option::Option::None,
|
6265 - | map_of_lists_of_strings: ::std::option::Option::None,
|
6266 - | map_of_maps: ::std::option::Option::None,
|
6267 - | map_of_strings: ::std::option::Option::None,
|
6268 - | map_of_structs: ::std::option::Option::None,
|
6269 - | recursive_list: ::std::option::Option::None,
|
6270 - | recursive_map: ::std::option::Option::None,
|
6271 - | recursive_struct: ::std::option::Option::None,
|
6272 - | simple_struct: ::std::option::Option::None,
|
6273 - | string: ::std::option::Option::None,
|
6274 - | struct_with_json_name: ::std::option::Option::None,
|
6275 - | timestamp: ::std::option::Option::None,
|
6276 - | unix_timestamp: ::std::option::Option::None,
|
6277 - | };
|
6278 - | Ok(response)
|
6279 - | };
|
6280 - | sender.send(()).await.expect("receiver dropped early");
|
6281 - | result
|
6282 - | }
|
6283 - | })
|
6284 - | .build_unchecked();
|
6285 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6286 - | .await
|
6287 - | .expect("unable to make an HTTP request");
|
6288 - | assert!(receiver.recv().await.is_some());
|
6289 - | }
|
6290 - | /// Serializes map of recursive structure shapes
|
6291 - | /// Test ID: serializes_map_of_recursive_structure_shapes
|
6292 - | #[::tokio::test]
|
6293 - | async fn serializes_map_of_recursive_structure_shapes_request() {
|
6294 - | #[allow(unused_mut)]
|
6295 - | let mut http_request = http::Request::builder()
|
6296 - | .uri("/")
|
6297 - | .method("POST")
|
6298 - | .header("Content-Type", "application/x-amz-json-1.1")
|
6299 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
6300 - | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{\"RecursiveMap\":{\"key1\":{\"RecursiveMap\":{\"key2\":{\"RecursiveMap\":{\"key3\":{\"Boolean\":false}}}}}}}".as_bytes()))).unwrap();
|
6301 - | #[allow(unused_mut)]
|
6302 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6303 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
6304 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
6305 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
6306 - | let sender = sender.clone();
|
6307 - | async move {
|
6308 - | let result = {
|
6309 - | use ::aws_smithy_protocol_test::FloatEquals;
|
6310 - | let expected = crate::input::KitchenSinkOperationInput {
|
6311 - | recursive_map: ::std::option::Option::Some({
|
6312 - | let mut ret = ::std::collections::HashMap::new();
|
6313 - | ret.insert(
|
6314 - | "key1".to_owned(),
|
6315 - | crate::model::KitchenSink {
|
6316 - | recursive_map: ::std::option::Option::Some({
|
6317 - | let mut ret = ::std::collections::HashMap::new();
|
6318 - | ret.insert(
|
6319 - | "key2".to_owned(),
|
6320 - | crate::model::KitchenSink {
|
6321 - | recursive_map: ::std::option::Option::Some({
|
6322 - | let mut ret =
|
6323 - | ::std::collections::HashMap::new();
|
6324 - | ret.insert(
|
6325 - | "key3".to_owned(),
|
6326 - | crate::model::KitchenSink {
|
6327 - | boolean:
|
6328 - | ::std::option::Option::Some(
|
6329 - | false,
|
6330 - | ),
|
6331 - | blob: ::std::option::Option::None,
|
6332 - | double: ::std::option::Option::None,
|
6333 - | empty_struct:
|
6334 - | ::std::option::Option::None,
|
6335 - | float: ::std::option::Option::None,
|
6336 - | httpdate_timestamp:
|
6337 - | ::std::option::Option::None,
|
6338 - | integer:
|
6339 - | ::std::option::Option::None,
|
6340 - | iso8601_timestamp:
|
6341 - | ::std::option::Option::None,
|
6342 - | json_value:
|
6343 - | ::std::option::Option::None,
|
6344 - | list_of_lists:
|
6345 - | ::std::option::Option::None,
|
6346 - | list_of_maps_of_strings:
|
6347 - | ::std::option::Option::None,
|
6348 - | list_of_strings:
|
6349 - | ::std::option::Option::None,
|
6350 - | list_of_structs:
|
6351 - | ::std::option::Option::None,
|
6352 - | long: ::std::option::Option::None,
|
6353 - | map_of_lists_of_strings:
|
6354 - | ::std::option::Option::None,
|
6355 - | map_of_maps:
|
6356 - | ::std::option::Option::None,
|
6357 - | map_of_strings:
|
6358 - | ::std::option::Option::None,
|
6359 - | map_of_structs:
|
6360 - | ::std::option::Option::None,
|
6361 - | recursive_list:
|
6362 - | ::std::option::Option::None,
|
6363 - | recursive_map:
|
6364 - | ::std::option::Option::None,
|
6365 - | recursive_struct:
|
6366 - | ::std::option::Option::None,
|
6367 - | simple_struct:
|
6368 - | ::std::option::Option::None,
|
6369 - | string: ::std::option::Option::None,
|
6370 - | struct_with_json_name:
|
6371 - | ::std::option::Option::None,
|
6372 - | timestamp:
|
6373 - | ::std::option::Option::None,
|
6374 - | unix_timestamp:
|
6375 - | ::std::option::Option::None,
|
6376 - | },
|
6377 - | );
|
6378 - | ret
|
6379 - | }),
|
6380 - | blob: ::std::option::Option::None,
|
6381 - | boolean: ::std::option::Option::None,
|
6382 - | double: ::std::option::Option::None,
|
6383 - | empty_struct: ::std::option::Option::None,
|
6384 - | float: ::std::option::Option::None,
|
6385 - | httpdate_timestamp: ::std::option::Option::None,
|
6386 - | integer: ::std::option::Option::None,
|
6387 - | iso8601_timestamp: ::std::option::Option::None,
|
6388 - | json_value: ::std::option::Option::None,
|
6389 - | list_of_lists: ::std::option::Option::None,
|
6390 - | list_of_maps_of_strings:
|
6391 - | ::std::option::Option::None,
|
6392 - | list_of_strings: ::std::option::Option::None,
|
6393 - | list_of_structs: ::std::option::Option::None,
|
6394 - | long: ::std::option::Option::None,
|
6395 - | map_of_lists_of_strings:
|
6396 - | ::std::option::Option::None,
|
6397 - | map_of_maps: ::std::option::Option::None,
|
6398 - | map_of_strings: ::std::option::Option::None,
|
6399 - | map_of_structs: ::std::option::Option::None,
|
6400 - | recursive_list: ::std::option::Option::None,
|
6401 - | recursive_struct: ::std::option::Option::None,
|
6402 - | simple_struct: ::std::option::Option::None,
|
6403 - | string: ::std::option::Option::None,
|
6404 - | struct_with_json_name:
|
6405 - | ::std::option::Option::None,
|
6406 - | timestamp: ::std::option::Option::None,
|
6407 - | unix_timestamp: ::std::option::Option::None,
|
6408 - | },
|
6409 - | );
|
6410 - | ret
|
6411 - | }),
|
6412 - | blob: ::std::option::Option::None,
|
6413 - | boolean: ::std::option::Option::None,
|
6414 - | double: ::std::option::Option::None,
|
6415 - | empty_struct: ::std::option::Option::None,
|
6416 - | float: ::std::option::Option::None,
|
6417 - | httpdate_timestamp: ::std::option::Option::None,
|
6418 - | integer: ::std::option::Option::None,
|
6419 - | iso8601_timestamp: ::std::option::Option::None,
|
6420 - | json_value: ::std::option::Option::None,
|
6421 - | list_of_lists: ::std::option::Option::None,
|
6422 - | list_of_maps_of_strings: ::std::option::Option::None,
|
6423 - | list_of_strings: ::std::option::Option::None,
|
6424 - | list_of_structs: ::std::option::Option::None,
|
6425 - | long: ::std::option::Option::None,
|
6426 - | map_of_lists_of_strings: ::std::option::Option::None,
|
6427 - | map_of_maps: ::std::option::Option::None,
|
6428 - | map_of_strings: ::std::option::Option::None,
|
6429 - | map_of_structs: ::std::option::Option::None,
|
6430 - | recursive_list: ::std::option::Option::None,
|
6431 - | recursive_struct: ::std::option::Option::None,
|
6432 - | simple_struct: ::std::option::Option::None,
|
6433 - | string: ::std::option::Option::None,
|
6434 - | struct_with_json_name: ::std::option::Option::None,
|
6435 - | timestamp: ::std::option::Option::None,
|
6436 - | unix_timestamp: ::std::option::Option::None,
|
6437 - | },
|
6438 - | );
|
6439 - | ret
|
6440 - | }),
|
6441 - | blob: ::std::option::Option::None,
|
6442 - | boolean: ::std::option::Option::None,
|
6443 - | double: ::std::option::Option::None,
|
6444 - | empty_struct: ::std::option::Option::None,
|
6445 - | float: ::std::option::Option::None,
|
6446 - | httpdate_timestamp: ::std::option::Option::None,
|
6447 - | integer: ::std::option::Option::None,
|
6448 - | iso8601_timestamp: ::std::option::Option::None,
|
6449 - | json_value: ::std::option::Option::None,
|
6450 - | list_of_lists: ::std::option::Option::None,
|
6451 - | list_of_maps_of_strings: ::std::option::Option::None,
|
6452 - | list_of_strings: ::std::option::Option::None,
|
6453 - | list_of_structs: ::std::option::Option::None,
|
6454 - | long: ::std::option::Option::None,
|
6455 - | map_of_lists_of_strings: ::std::option::Option::None,
|
6456 - | map_of_maps: ::std::option::Option::None,
|
6457 - | map_of_strings: ::std::option::Option::None,
|
6458 - | map_of_structs: ::std::option::Option::None,
|
6459 - | recursive_list: ::std::option::Option::None,
|
6460 - | recursive_struct: ::std::option::Option::None,
|
6461 - | simple_struct: ::std::option::Option::None,
|
6462 - | string: ::std::option::Option::None,
|
6463 - | struct_with_json_name: ::std::option::Option::None,
|
6464 - | timestamp: ::std::option::Option::None,
|
6465 - | unix_timestamp: ::std::option::Option::None,
|
6466 - | };
|
6467 - | ::pretty_assertions::assert_eq!(
|
6468 - | input.blob,
|
6469 - | expected.blob,
|
6470 - | "Unexpected value for `blob`"
|
6471 - | );
|
6472 - | ::pretty_assertions::assert_eq!(
|
6473 - | input.boolean,
|
6474 - | expected.boolean,
|
6475 - | "Unexpected value for `boolean`"
|
6476 - | );
|
6477 - | assert!(
|
6478 - | input.double.float_equals(&expected.double),
|
6479 - | "Unexpected value for `double` {:?} vs. {:?}",
|
6480 - | expected.double,
|
6481 - | input.double
|
6482 - | );
|
6483 - | ::pretty_assertions::assert_eq!(
|
6484 - | input.empty_struct,
|
6485 - | expected.empty_struct,
|
6486 - | "Unexpected value for `empty_struct`"
|
6487 - | );
|
6488 - | assert!(
|
6489 - | input.float.float_equals(&expected.float),
|
6490 - | "Unexpected value for `float` {:?} vs. {:?}",
|
6491 - | expected.float,
|
6492 - | input.float
|
6493 - | );
|
6494 - | ::pretty_assertions::assert_eq!(
|
6495 - | input.httpdate_timestamp,
|
6496 - | expected.httpdate_timestamp,
|
6497 - | "Unexpected value for `httpdate_timestamp`"
|
6498 - | );
|
6499 - | ::pretty_assertions::assert_eq!(
|
6500 - | input.integer,
|
6501 - | expected.integer,
|
6502 - | "Unexpected value for `integer`"
|
6503 - | );
|
6504 - | ::pretty_assertions::assert_eq!(
|
6505 - | input.iso8601_timestamp,
|
6506 - | expected.iso8601_timestamp,
|
6507 - | "Unexpected value for `iso8601_timestamp`"
|
6508 - | );
|
6509 - | ::pretty_assertions::assert_eq!(
|
6510 - | input.json_value,
|
6511 - | expected.json_value,
|
6512 - | "Unexpected value for `json_value`"
|
6513 - | );
|
6514 - | ::pretty_assertions::assert_eq!(
|
6515 - | input.list_of_lists,
|
6516 - | expected.list_of_lists,
|
6517 - | "Unexpected value for `list_of_lists`"
|
6518 - | );
|
6519 - | ::pretty_assertions::assert_eq!(
|
6520 - | input.list_of_maps_of_strings,
|
6521 - | expected.list_of_maps_of_strings,
|
6522 - | "Unexpected value for `list_of_maps_of_strings`"
|
6523 - | );
|
6524 - | ::pretty_assertions::assert_eq!(
|
6525 - | input.list_of_strings,
|
6526 - | expected.list_of_strings,
|
6527 - | "Unexpected value for `list_of_strings`"
|
6528 - | );
|
6529 - | ::pretty_assertions::assert_eq!(
|
6530 - | input.list_of_structs,
|
6531 - | expected.list_of_structs,
|
6532 - | "Unexpected value for `list_of_structs`"
|
6533 - | );
|
6534 - | ::pretty_assertions::assert_eq!(
|
6535 - | input.long,
|
6536 - | expected.long,
|
6537 - | "Unexpected value for `long`"
|
6538 - | );
|
6539 - | ::pretty_assertions::assert_eq!(
|
6540 - | input.map_of_lists_of_strings,
|
6541 - | expected.map_of_lists_of_strings,
|
6542 - | "Unexpected value for `map_of_lists_of_strings`"
|
6543 - | );
|
6544 - | ::pretty_assertions::assert_eq!(
|
6545 - | input.map_of_maps,
|
6546 - | expected.map_of_maps,
|
6547 - | "Unexpected value for `map_of_maps`"
|
6548 - | );
|
6549 - | ::pretty_assertions::assert_eq!(
|
6550 - | input.map_of_strings,
|
6551 - | expected.map_of_strings,
|
6552 - | "Unexpected value for `map_of_strings`"
|
6553 - | );
|
6554 - | ::pretty_assertions::assert_eq!(
|
6555 - | input.map_of_structs,
|
6556 - | expected.map_of_structs,
|
6557 - | "Unexpected value for `map_of_structs`"
|
6558 - | );
|
6559 - | ::pretty_assertions::assert_eq!(
|
6560 - | input.recursive_list,
|
6561 - | expected.recursive_list,
|
6562 - | "Unexpected value for `recursive_list`"
|
6563 - | );
|
6564 - | ::pretty_assertions::assert_eq!(
|
6565 - | input.recursive_map,
|
6566 - | expected.recursive_map,
|
6567 - | "Unexpected value for `recursive_map`"
|
6568 - | );
|
6569 - | ::pretty_assertions::assert_eq!(
|
6570 - | input.recursive_struct,
|
6571 - | expected.recursive_struct,
|
6572 - | "Unexpected value for `recursive_struct`"
|
6573 - | );
|
6574 - | ::pretty_assertions::assert_eq!(
|
6575 - | input.simple_struct,
|
6576 - | expected.simple_struct,
|
6577 - | "Unexpected value for `simple_struct`"
|
6578 - | );
|
6579 - | ::pretty_assertions::assert_eq!(
|
6580 - | input.string,
|
6581 - | expected.string,
|
6582 - | "Unexpected value for `string`"
|
6583 - | );
|
6584 - | ::pretty_assertions::assert_eq!(
|
6585 - | input.struct_with_json_name,
|
6586 - | expected.struct_with_json_name,
|
6587 - | "Unexpected value for `struct_with_json_name`"
|
6588 - | );
|
6589 - | ::pretty_assertions::assert_eq!(
|
6590 - | input.timestamp,
|
6591 - | expected.timestamp,
|
6592 - | "Unexpected value for `timestamp`"
|
6593 - | );
|
6594 - | ::pretty_assertions::assert_eq!(
|
6595 - | input.unix_timestamp,
|
6596 - | expected.unix_timestamp,
|
6597 - | "Unexpected value for `unix_timestamp`"
|
6598 - | );
|
6599 - | let response = crate::output::KitchenSinkOperationOutput {
|
6600 - | blob: ::std::option::Option::None,
|
6601 - | boolean: ::std::option::Option::None,
|
6602 - | double: ::std::option::Option::None,
|
6603 - | empty_struct: ::std::option::Option::None,
|
6604 - | float: ::std::option::Option::None,
|
6605 - | httpdate_timestamp: ::std::option::Option::None,
|
6606 - | integer: ::std::option::Option::None,
|
6607 - | iso8601_timestamp: ::std::option::Option::None,
|
6608 - | json_value: ::std::option::Option::None,
|
6609 - | list_of_lists: ::std::option::Option::None,
|
6610 - | list_of_maps_of_strings: ::std::option::Option::None,
|
6611 - | list_of_strings: ::std::option::Option::None,
|
6612 - | list_of_structs: ::std::option::Option::None,
|
6613 - | long: ::std::option::Option::None,
|
6614 - | map_of_lists_of_strings: ::std::option::Option::None,
|
6615 - | map_of_maps: ::std::option::Option::None,
|
6616 - | map_of_strings: ::std::option::Option::None,
|
6617 - | map_of_structs: ::std::option::Option::None,
|
6618 - | recursive_list: ::std::option::Option::None,
|
6619 - | recursive_map: ::std::option::Option::None,
|
6620 - | recursive_struct: ::std::option::Option::None,
|
6621 - | simple_struct: ::std::option::Option::None,
|
6622 - | string: ::std::option::Option::None,
|
6623 - | struct_with_json_name: ::std::option::Option::None,
|
6624 - | timestamp: ::std::option::Option::None,
|
6625 - | unix_timestamp: ::std::option::Option::None,
|
6626 - | };
|
6627 - | Ok(response)
|
6628 - | };
|
6629 - | sender.send(()).await.expect("receiver dropped early");
|
6630 - | result
|
6631 - | }
|
6632 - | })
|
6633 - | .build_unchecked();
|
6634 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6635 - | .await
|
6636 - | .expect("unable to make an HTTP request");
|
6637 - | assert!(receiver.recv().await.is_some());
|
6638 - | }
|
6639 - | /// Serializes structure shapes
|
6640 - | /// Test ID: serializes_structure_shapes
|
6641 - | #[::tokio::test]
|
6642 - | async fn serializes_structure_shapes_request() {
|
6643 - | #[allow(unused_mut)]
|
6644 - | let mut http_request = http::Request::builder()
|
6645 - | .uri("/")
|
6646 - | .method("POST")
|
6647 - | .header("Content-Type", "application/x-amz-json-1.1")
|
6648 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
6649 - | .body(::aws_smithy_http_server::body::Body::from(
|
6650 - | ::bytes::Bytes::from_static("{\"SimpleStruct\":{\"Value\":\"abc\"}}".as_bytes()),
|
6651 - | ))
|
6652 - | .unwrap();
|
6653 - | #[allow(unused_mut)]
|
6654 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6655 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
6656 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
6657 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
6658 - | let sender = sender.clone();
|
6659 - | async move {
|
6660 - | let result = {
|
6661 - | use ::aws_smithy_protocol_test::FloatEquals;
|
6662 - | let expected = crate::input::KitchenSinkOperationInput {
|
6663 - | simple_struct: ::std::option::Option::Some(
|
6664 - | crate::model::SimpleStruct {
|
6665 - | value: ::std::option::Option::Some("abc".to_owned()),
|
6666 - | },
|
6667 - | ),
|
6668 - | blob: ::std::option::Option::None,
|
6669 - | boolean: ::std::option::Option::None,
|
6670 - | double: ::std::option::Option::None,
|
6671 - | empty_struct: ::std::option::Option::None,
|
6672 - | float: ::std::option::Option::None,
|
6673 - | httpdate_timestamp: ::std::option::Option::None,
|
6674 - | integer: ::std::option::Option::None,
|
6675 - | iso8601_timestamp: ::std::option::Option::None,
|
6676 - | json_value: ::std::option::Option::None,
|
6677 - | list_of_lists: ::std::option::Option::None,
|
6678 - | list_of_maps_of_strings: ::std::option::Option::None,
|
6679 - | list_of_strings: ::std::option::Option::None,
|
6680 - | list_of_structs: ::std::option::Option::None,
|
6681 - | long: ::std::option::Option::None,
|
6682 - | map_of_lists_of_strings: ::std::option::Option::None,
|
6683 - | map_of_maps: ::std::option::Option::None,
|
6684 - | map_of_strings: ::std::option::Option::None,
|
6685 - | map_of_structs: ::std::option::Option::None,
|
6686 - | recursive_list: ::std::option::Option::None,
|
6687 - | recursive_map: ::std::option::Option::None,
|
6688 - | recursive_struct: ::std::option::Option::None,
|
6689 - | string: ::std::option::Option::None,
|
6690 - | struct_with_json_name: ::std::option::Option::None,
|
6691 - | timestamp: ::std::option::Option::None,
|
6692 - | unix_timestamp: ::std::option::Option::None,
|
6693 - | };
|
6694 - | ::pretty_assertions::assert_eq!(
|
6695 - | input.blob,
|
6696 - | expected.blob,
|
6697 - | "Unexpected value for `blob`"
|
6698 - | );
|
6699 - | ::pretty_assertions::assert_eq!(
|
6700 - | input.boolean,
|
6701 - | expected.boolean,
|
6702 - | "Unexpected value for `boolean`"
|
6703 - | );
|
6704 - | assert!(
|
6705 - | input.double.float_equals(&expected.double),
|
6706 - | "Unexpected value for `double` {:?} vs. {:?}",
|
6707 - | expected.double,
|
6708 - | input.double
|
6709 - | );
|
6710 - | ::pretty_assertions::assert_eq!(
|
6711 - | input.empty_struct,
|
6712 - | expected.empty_struct,
|
6713 - | "Unexpected value for `empty_struct`"
|
6714 - | );
|
6715 - | assert!(
|
6716 - | input.float.float_equals(&expected.float),
|
6717 - | "Unexpected value for `float` {:?} vs. {:?}",
|
6718 - | expected.float,
|
6719 - | input.float
|
6720 - | );
|
6721 - | ::pretty_assertions::assert_eq!(
|
6722 - | input.httpdate_timestamp,
|
6723 - | expected.httpdate_timestamp,
|
6724 - | "Unexpected value for `httpdate_timestamp`"
|
6725 - | );
|
6726 - | ::pretty_assertions::assert_eq!(
|
6727 - | input.integer,
|
6728 - | expected.integer,
|
6729 - | "Unexpected value for `integer`"
|
6730 - | );
|
6731 - | ::pretty_assertions::assert_eq!(
|
6732 - | input.iso8601_timestamp,
|
6733 - | expected.iso8601_timestamp,
|
6734 - | "Unexpected value for `iso8601_timestamp`"
|
6735 - | );
|
6736 - | ::pretty_assertions::assert_eq!(
|
6737 - | input.json_value,
|
6738 - | expected.json_value,
|
6739 - | "Unexpected value for `json_value`"
|
6740 - | );
|
6741 - | ::pretty_assertions::assert_eq!(
|
6742 - | input.list_of_lists,
|
6743 - | expected.list_of_lists,
|
6744 - | "Unexpected value for `list_of_lists`"
|
6745 - | );
|
6746 - | ::pretty_assertions::assert_eq!(
|
6747 - | input.list_of_maps_of_strings,
|
6748 - | expected.list_of_maps_of_strings,
|
6749 - | "Unexpected value for `list_of_maps_of_strings`"
|
6750 - | );
|
6751 - | ::pretty_assertions::assert_eq!(
|
6752 - | input.list_of_strings,
|
6753 - | expected.list_of_strings,
|
6754 - | "Unexpected value for `list_of_strings`"
|
6755 - | );
|
6756 - | ::pretty_assertions::assert_eq!(
|
6757 - | input.list_of_structs,
|
6758 - | expected.list_of_structs,
|
6759 - | "Unexpected value for `list_of_structs`"
|
6760 - | );
|
6761 - | ::pretty_assertions::assert_eq!(
|
6762 - | input.long,
|
6763 - | expected.long,
|
6764 - | "Unexpected value for `long`"
|
6765 - | );
|
6766 - | ::pretty_assertions::assert_eq!(
|
6767 - | input.map_of_lists_of_strings,
|
6768 - | expected.map_of_lists_of_strings,
|
6769 - | "Unexpected value for `map_of_lists_of_strings`"
|
6770 - | );
|
6771 - | ::pretty_assertions::assert_eq!(
|
6772 - | input.map_of_maps,
|
6773 - | expected.map_of_maps,
|
6774 - | "Unexpected value for `map_of_maps`"
|
6775 - | );
|
6776 - | ::pretty_assertions::assert_eq!(
|
6777 - | input.map_of_strings,
|
6778 - | expected.map_of_strings,
|
6779 - | "Unexpected value for `map_of_strings`"
|
6780 - | );
|
6781 - | ::pretty_assertions::assert_eq!(
|
6782 - | input.map_of_structs,
|
6783 - | expected.map_of_structs,
|
6784 - | "Unexpected value for `map_of_structs`"
|
6785 - | );
|
6786 - | ::pretty_assertions::assert_eq!(
|
6787 - | input.recursive_list,
|
6788 - | expected.recursive_list,
|
6789 - | "Unexpected value for `recursive_list`"
|
6790 - | );
|
6791 - | ::pretty_assertions::assert_eq!(
|
6792 - | input.recursive_map,
|
6793 - | expected.recursive_map,
|
6794 - | "Unexpected value for `recursive_map`"
|
6795 - | );
|
6796 - | ::pretty_assertions::assert_eq!(
|
6797 - | input.recursive_struct,
|
6798 - | expected.recursive_struct,
|
6799 - | "Unexpected value for `recursive_struct`"
|
6800 - | );
|
6801 - | ::pretty_assertions::assert_eq!(
|
6802 - | input.simple_struct,
|
6803 - | expected.simple_struct,
|
6804 - | "Unexpected value for `simple_struct`"
|
6805 - | );
|
6806 - | ::pretty_assertions::assert_eq!(
|
6807 - | input.string,
|
6808 - | expected.string,
|
6809 - | "Unexpected value for `string`"
|
6810 - | );
|
6811 - | ::pretty_assertions::assert_eq!(
|
6812 - | input.struct_with_json_name,
|
6813 - | expected.struct_with_json_name,
|
6814 - | "Unexpected value for `struct_with_json_name`"
|
6815 - | );
|
6816 - | ::pretty_assertions::assert_eq!(
|
6817 - | input.timestamp,
|
6818 - | expected.timestamp,
|
6819 - | "Unexpected value for `timestamp`"
|
6820 - | );
|
6821 - | ::pretty_assertions::assert_eq!(
|
6822 - | input.unix_timestamp,
|
6823 - | expected.unix_timestamp,
|
6824 - | "Unexpected value for `unix_timestamp`"
|
6825 - | );
|
6826 - | let response = crate::output::KitchenSinkOperationOutput {
|
6827 - | blob: ::std::option::Option::None,
|
6828 - | boolean: ::std::option::Option::None,
|
6829 - | double: ::std::option::Option::None,
|
6830 - | empty_struct: ::std::option::Option::None,
|
6831 - | float: ::std::option::Option::None,
|
6832 - | httpdate_timestamp: ::std::option::Option::None,
|
6833 - | integer: ::std::option::Option::None,
|
6834 - | iso8601_timestamp: ::std::option::Option::None,
|
6835 - | json_value: ::std::option::Option::None,
|
6836 - | list_of_lists: ::std::option::Option::None,
|
6837 - | list_of_maps_of_strings: ::std::option::Option::None,
|
6838 - | list_of_strings: ::std::option::Option::None,
|
6839 - | list_of_structs: ::std::option::Option::None,
|
6840 - | long: ::std::option::Option::None,
|
6841 - | map_of_lists_of_strings: ::std::option::Option::None,
|
6842 - | map_of_maps: ::std::option::Option::None,
|
6843 - | map_of_strings: ::std::option::Option::None,
|
6844 - | map_of_structs: ::std::option::Option::None,
|
6845 - | recursive_list: ::std::option::Option::None,
|
6846 - | recursive_map: ::std::option::Option::None,
|
6847 - | recursive_struct: ::std::option::Option::None,
|
6848 - | simple_struct: ::std::option::Option::None,
|
6849 - | string: ::std::option::Option::None,
|
6850 - | struct_with_json_name: ::std::option::Option::None,
|
6851 - | timestamp: ::std::option::Option::None,
|
6852 - | unix_timestamp: ::std::option::Option::None,
|
6853 - | };
|
6854 - | Ok(response)
|
6855 - | };
|
6856 - | sender.send(()).await.expect("receiver dropped early");
|
6857 - | result
|
6858 - | }
|
6859 - | })
|
6860 - | .build_unchecked();
|
6861 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6862 - | .await
|
6863 - | .expect("unable to make an HTTP request");
|
6864 - | assert!(receiver.recv().await.is_some());
|
6865 - | }
|
6866 - | /// Serializes structure members with locationName traits
|
6867 - | /// Test ID: serializes_structure_members_with_locationname_traits
|
6868 - | #[::tokio::test]
|
6869 - | async fn serializes_structure_members_with_locationname_traits_request() {
|
6870 - | #[allow(unused_mut)]
|
6871 - | let mut http_request = http::Request::builder()
|
6872 - | .uri("/")
|
6873 - | .method("POST")
|
6874 - | .header("Content-Type", "application/x-amz-json-1.1")
|
6875 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
6876 - | .body(::aws_smithy_http_server::body::Body::from(
|
6877 - | ::bytes::Bytes::from_static(
|
6878 - | "{\"StructWithJsonName\":{\"Value\":\"some-value\"}}".as_bytes(),
|
6879 - | ),
|
6880 - | ))
|
6881 - | .unwrap();
|
6882 - | #[allow(unused_mut)]
|
6883 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6884 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
6885 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
6886 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
6887 - | let sender = sender.clone();
|
6888 - | async move {
|
6889 - | let result = {
|
6890 - | use ::aws_smithy_protocol_test::FloatEquals;
|
6891 - | let expected = crate::input::KitchenSinkOperationInput {
|
6892 - | struct_with_json_name: ::std::option::Option::Some(
|
6893 - | crate::model::StructWithJsonName {
|
6894 - | value: ::std::option::Option::Some("some-value".to_owned()),
|
6895 - | },
|
6896 - | ),
|
6897 - | blob: ::std::option::Option::None,
|
6898 - | boolean: ::std::option::Option::None,
|
6899 - | double: ::std::option::Option::None,
|
6900 - | empty_struct: ::std::option::Option::None,
|
6901 - | float: ::std::option::Option::None,
|
6902 - | httpdate_timestamp: ::std::option::Option::None,
|
6903 - | integer: ::std::option::Option::None,
|
6904 - | iso8601_timestamp: ::std::option::Option::None,
|
6905 - | json_value: ::std::option::Option::None,
|
6906 - | list_of_lists: ::std::option::Option::None,
|
6907 - | list_of_maps_of_strings: ::std::option::Option::None,
|
6908 - | list_of_strings: ::std::option::Option::None,
|
6909 - | list_of_structs: ::std::option::Option::None,
|
6910 - | long: ::std::option::Option::None,
|
6911 - | map_of_lists_of_strings: ::std::option::Option::None,
|
6912 - | map_of_maps: ::std::option::Option::None,
|
6913 - | map_of_strings: ::std::option::Option::None,
|
6914 - | map_of_structs: ::std::option::Option::None,
|
6915 - | recursive_list: ::std::option::Option::None,
|
6916 - | recursive_map: ::std::option::Option::None,
|
6917 - | recursive_struct: ::std::option::Option::None,
|
6918 - | simple_struct: ::std::option::Option::None,
|
6919 - | string: ::std::option::Option::None,
|
6920 - | timestamp: ::std::option::Option::None,
|
6921 - | unix_timestamp: ::std::option::Option::None,
|
6922 - | };
|
6923 - | ::pretty_assertions::assert_eq!(
|
6924 - | input.blob,
|
6925 - | expected.blob,
|
6926 - | "Unexpected value for `blob`"
|
6927 - | );
|
6928 - | ::pretty_assertions::assert_eq!(
|
6929 - | input.boolean,
|
6930 - | expected.boolean,
|
6931 - | "Unexpected value for `boolean`"
|
6932 - | );
|
6933 - | assert!(
|
6934 - | input.double.float_equals(&expected.double),
|
6935 - | "Unexpected value for `double` {:?} vs. {:?}",
|
6936 - | expected.double,
|
6937 - | input.double
|
6938 - | );
|
6939 - | ::pretty_assertions::assert_eq!(
|
6940 - | input.empty_struct,
|
6941 - | expected.empty_struct,
|
6942 - | "Unexpected value for `empty_struct`"
|
6943 - | );
|
6944 - | assert!(
|
6945 - | input.float.float_equals(&expected.float),
|
6946 - | "Unexpected value for `float` {:?} vs. {:?}",
|
6947 - | expected.float,
|
6948 - | input.float
|
6949 - | );
|
6950 - | ::pretty_assertions::assert_eq!(
|
6951 - | input.httpdate_timestamp,
|
6952 - | expected.httpdate_timestamp,
|
6953 - | "Unexpected value for `httpdate_timestamp`"
|
6954 - | );
|
6955 - | ::pretty_assertions::assert_eq!(
|
6956 - | input.integer,
|
6957 - | expected.integer,
|
6958 - | "Unexpected value for `integer`"
|
6959 - | );
|
6960 - | ::pretty_assertions::assert_eq!(
|
6961 - | input.iso8601_timestamp,
|
6962 - | expected.iso8601_timestamp,
|
6963 - | "Unexpected value for `iso8601_timestamp`"
|
6964 - | );
|
6965 - | ::pretty_assertions::assert_eq!(
|
6966 - | input.json_value,
|
6967 - | expected.json_value,
|
6968 - | "Unexpected value for `json_value`"
|
6969 - | );
|
6970 - | ::pretty_assertions::assert_eq!(
|
6971 - | input.list_of_lists,
|
6972 - | expected.list_of_lists,
|
6973 - | "Unexpected value for `list_of_lists`"
|
6974 - | );
|
6975 - | ::pretty_assertions::assert_eq!(
|
6976 - | input.list_of_maps_of_strings,
|
6977 - | expected.list_of_maps_of_strings,
|
6978 - | "Unexpected value for `list_of_maps_of_strings`"
|
6979 - | );
|
6980 - | ::pretty_assertions::assert_eq!(
|
6981 - | input.list_of_strings,
|
6982 - | expected.list_of_strings,
|
6983 - | "Unexpected value for `list_of_strings`"
|
6984 - | );
|
6985 - | ::pretty_assertions::assert_eq!(
|
6986 - | input.list_of_structs,
|
6987 - | expected.list_of_structs,
|
6988 - | "Unexpected value for `list_of_structs`"
|
6989 - | );
|
6990 - | ::pretty_assertions::assert_eq!(
|
6991 - | input.long,
|
6992 - | expected.long,
|
6993 - | "Unexpected value for `long`"
|
6994 - | );
|
6995 - | ::pretty_assertions::assert_eq!(
|
6996 - | input.map_of_lists_of_strings,
|
6997 - | expected.map_of_lists_of_strings,
|
6998 - | "Unexpected value for `map_of_lists_of_strings`"
|
6999 - | );
|
7000 - | ::pretty_assertions::assert_eq!(
|
7001 - | input.map_of_maps,
|
7002 - | expected.map_of_maps,
|
7003 - | "Unexpected value for `map_of_maps`"
|
7004 - | );
|
7005 - | ::pretty_assertions::assert_eq!(
|
7006 - | input.map_of_strings,
|
7007 - | expected.map_of_strings,
|
7008 - | "Unexpected value for `map_of_strings`"
|
7009 - | );
|
7010 - | ::pretty_assertions::assert_eq!(
|
7011 - | input.map_of_structs,
|
7012 - | expected.map_of_structs,
|
7013 - | "Unexpected value for `map_of_structs`"
|
7014 - | );
|
7015 - | ::pretty_assertions::assert_eq!(
|
7016 - | input.recursive_list,
|
7017 - | expected.recursive_list,
|
7018 - | "Unexpected value for `recursive_list`"
|
7019 - | );
|
7020 - | ::pretty_assertions::assert_eq!(
|
7021 - | input.recursive_map,
|
7022 - | expected.recursive_map,
|
7023 - | "Unexpected value for `recursive_map`"
|
7024 - | );
|
7025 - | ::pretty_assertions::assert_eq!(
|
7026 - | input.recursive_struct,
|
7027 - | expected.recursive_struct,
|
7028 - | "Unexpected value for `recursive_struct`"
|
7029 - | );
|
7030 - | ::pretty_assertions::assert_eq!(
|
7031 - | input.simple_struct,
|
7032 - | expected.simple_struct,
|
7033 - | "Unexpected value for `simple_struct`"
|
7034 - | );
|
7035 - | ::pretty_assertions::assert_eq!(
|
7036 - | input.string,
|
7037 - | expected.string,
|
7038 - | "Unexpected value for `string`"
|
7039 - | );
|
7040 - | ::pretty_assertions::assert_eq!(
|
7041 - | input.struct_with_json_name,
|
7042 - | expected.struct_with_json_name,
|
7043 - | "Unexpected value for `struct_with_json_name`"
|
7044 - | );
|
7045 - | ::pretty_assertions::assert_eq!(
|
7046 - | input.timestamp,
|
7047 - | expected.timestamp,
|
7048 - | "Unexpected value for `timestamp`"
|
7049 - | );
|
7050 - | ::pretty_assertions::assert_eq!(
|
7051 - | input.unix_timestamp,
|
7052 - | expected.unix_timestamp,
|
7053 - | "Unexpected value for `unix_timestamp`"
|
7054 - | );
|
7055 - | let response = crate::output::KitchenSinkOperationOutput {
|
7056 - | blob: ::std::option::Option::None,
|
7057 - | boolean: ::std::option::Option::None,
|
7058 - | double: ::std::option::Option::None,
|
7059 - | empty_struct: ::std::option::Option::None,
|
7060 - | float: ::std::option::Option::None,
|
7061 - | httpdate_timestamp: ::std::option::Option::None,
|
7062 - | integer: ::std::option::Option::None,
|
7063 - | iso8601_timestamp: ::std::option::Option::None,
|
7064 - | json_value: ::std::option::Option::None,
|
7065 - | list_of_lists: ::std::option::Option::None,
|
7066 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7067 - | list_of_strings: ::std::option::Option::None,
|
7068 - | list_of_structs: ::std::option::Option::None,
|
7069 - | long: ::std::option::Option::None,
|
7070 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7071 - | map_of_maps: ::std::option::Option::None,
|
7072 - | map_of_strings: ::std::option::Option::None,
|
7073 - | map_of_structs: ::std::option::Option::None,
|
7074 - | recursive_list: ::std::option::Option::None,
|
7075 - | recursive_map: ::std::option::Option::None,
|
7076 - | recursive_struct: ::std::option::Option::None,
|
7077 - | simple_struct: ::std::option::Option::None,
|
7078 - | string: ::std::option::Option::None,
|
7079 - | struct_with_json_name: ::std::option::Option::None,
|
7080 - | timestamp: ::std::option::Option::None,
|
7081 - | unix_timestamp: ::std::option::Option::None,
|
7082 - | };
|
7083 - | Ok(response)
|
7084 - | };
|
7085 - | sender.send(()).await.expect("receiver dropped early");
|
7086 - | result
|
7087 - | }
|
7088 - | })
|
7089 - | .build_unchecked();
|
7090 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7091 - | .await
|
7092 - | .expect("unable to make an HTTP request");
|
7093 - | assert!(receiver.recv().await.is_some());
|
7094 - | }
|
7095 - | /// Serializes empty structure shapes
|
7096 - | /// Test ID: serializes_empty_structure_shapes
|
7097 - | #[::tokio::test]
|
7098 - | async fn serializes_empty_structure_shapes_request() {
|
7099 - | #[allow(unused_mut)]
|
7100 - | let mut http_request = http::Request::builder()
|
7101 - | .uri("/")
|
7102 - | .method("POST")
|
7103 - | .header("Content-Type", "application/x-amz-json-1.1")
|
7104 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
7105 - | .body(::aws_smithy_http_server::body::Body::from(
|
7106 - | ::bytes::Bytes::from_static("{\"SimpleStruct\":{}}".as_bytes()),
|
7107 - | ))
|
7108 - | .unwrap();
|
7109 - | #[allow(unused_mut)]
|
7110 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7111 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
7112 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
7113 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
7114 - | let sender = sender.clone();
|
7115 - | async move {
|
7116 - | let result = {
|
7117 - | use ::aws_smithy_protocol_test::FloatEquals;
|
7118 - | let expected = crate::input::KitchenSinkOperationInput {
|
7119 - | simple_struct: ::std::option::Option::Some(
|
7120 - | crate::model::SimpleStruct {
|
7121 - | value: ::std::option::Option::None,
|
7122 - | },
|
7123 - | ),
|
7124 - | blob: ::std::option::Option::None,
|
7125 - | boolean: ::std::option::Option::None,
|
7126 - | double: ::std::option::Option::None,
|
7127 - | empty_struct: ::std::option::Option::None,
|
7128 - | float: ::std::option::Option::None,
|
7129 - | httpdate_timestamp: ::std::option::Option::None,
|
7130 - | integer: ::std::option::Option::None,
|
7131 - | iso8601_timestamp: ::std::option::Option::None,
|
7132 - | json_value: ::std::option::Option::None,
|
7133 - | list_of_lists: ::std::option::Option::None,
|
7134 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7135 - | list_of_strings: ::std::option::Option::None,
|
7136 - | list_of_structs: ::std::option::Option::None,
|
7137 - | long: ::std::option::Option::None,
|
7138 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7139 - | map_of_maps: ::std::option::Option::None,
|
7140 - | map_of_strings: ::std::option::Option::None,
|
7141 - | map_of_structs: ::std::option::Option::None,
|
7142 - | recursive_list: ::std::option::Option::None,
|
7143 - | recursive_map: ::std::option::Option::None,
|
7144 - | recursive_struct: ::std::option::Option::None,
|
7145 - | string: ::std::option::Option::None,
|
7146 - | struct_with_json_name: ::std::option::Option::None,
|
7147 - | timestamp: ::std::option::Option::None,
|
7148 - | unix_timestamp: ::std::option::Option::None,
|
7149 - | };
|
7150 - | ::pretty_assertions::assert_eq!(
|
7151 - | input.blob,
|
7152 - | expected.blob,
|
7153 - | "Unexpected value for `blob`"
|
7154 - | );
|
7155 - | ::pretty_assertions::assert_eq!(
|
7156 - | input.boolean,
|
7157 - | expected.boolean,
|
7158 - | "Unexpected value for `boolean`"
|
7159 - | );
|
7160 - | assert!(
|
7161 - | input.double.float_equals(&expected.double),
|
7162 - | "Unexpected value for `double` {:?} vs. {:?}",
|
7163 - | expected.double,
|
7164 - | input.double
|
7165 - | );
|
7166 - | ::pretty_assertions::assert_eq!(
|
7167 - | input.empty_struct,
|
7168 - | expected.empty_struct,
|
7169 - | "Unexpected value for `empty_struct`"
|
7170 - | );
|
7171 - | assert!(
|
7172 - | input.float.float_equals(&expected.float),
|
7173 - | "Unexpected value for `float` {:?} vs. {:?}",
|
7174 - | expected.float,
|
7175 - | input.float
|
7176 - | );
|
7177 - | ::pretty_assertions::assert_eq!(
|
7178 - | input.httpdate_timestamp,
|
7179 - | expected.httpdate_timestamp,
|
7180 - | "Unexpected value for `httpdate_timestamp`"
|
7181 - | );
|
7182 - | ::pretty_assertions::assert_eq!(
|
7183 - | input.integer,
|
7184 - | expected.integer,
|
7185 - | "Unexpected value for `integer`"
|
7186 - | );
|
7187 - | ::pretty_assertions::assert_eq!(
|
7188 - | input.iso8601_timestamp,
|
7189 - | expected.iso8601_timestamp,
|
7190 - | "Unexpected value for `iso8601_timestamp`"
|
7191 - | );
|
7192 - | ::pretty_assertions::assert_eq!(
|
7193 - | input.json_value,
|
7194 - | expected.json_value,
|
7195 - | "Unexpected value for `json_value`"
|
7196 - | );
|
7197 - | ::pretty_assertions::assert_eq!(
|
7198 - | input.list_of_lists,
|
7199 - | expected.list_of_lists,
|
7200 - | "Unexpected value for `list_of_lists`"
|
7201 - | );
|
7202 - | ::pretty_assertions::assert_eq!(
|
7203 - | input.list_of_maps_of_strings,
|
7204 - | expected.list_of_maps_of_strings,
|
7205 - | "Unexpected value for `list_of_maps_of_strings`"
|
7206 - | );
|
7207 - | ::pretty_assertions::assert_eq!(
|
7208 - | input.list_of_strings,
|
7209 - | expected.list_of_strings,
|
7210 - | "Unexpected value for `list_of_strings`"
|
7211 - | );
|
7212 - | ::pretty_assertions::assert_eq!(
|
7213 - | input.list_of_structs,
|
7214 - | expected.list_of_structs,
|
7215 - | "Unexpected value for `list_of_structs`"
|
7216 - | );
|
7217 - | ::pretty_assertions::assert_eq!(
|
7218 - | input.long,
|
7219 - | expected.long,
|
7220 - | "Unexpected value for `long`"
|
7221 - | );
|
7222 - | ::pretty_assertions::assert_eq!(
|
7223 - | input.map_of_lists_of_strings,
|
7224 - | expected.map_of_lists_of_strings,
|
7225 - | "Unexpected value for `map_of_lists_of_strings`"
|
7226 - | );
|
7227 - | ::pretty_assertions::assert_eq!(
|
7228 - | input.map_of_maps,
|
7229 - | expected.map_of_maps,
|
7230 - | "Unexpected value for `map_of_maps`"
|
7231 - | );
|
7232 - | ::pretty_assertions::assert_eq!(
|
7233 - | input.map_of_strings,
|
7234 - | expected.map_of_strings,
|
7235 - | "Unexpected value for `map_of_strings`"
|
7236 - | );
|
7237 - | ::pretty_assertions::assert_eq!(
|
7238 - | input.map_of_structs,
|
7239 - | expected.map_of_structs,
|
7240 - | "Unexpected value for `map_of_structs`"
|
7241 - | );
|
7242 - | ::pretty_assertions::assert_eq!(
|
7243 - | input.recursive_list,
|
7244 - | expected.recursive_list,
|
7245 - | "Unexpected value for `recursive_list`"
|
7246 - | );
|
7247 - | ::pretty_assertions::assert_eq!(
|
7248 - | input.recursive_map,
|
7249 - | expected.recursive_map,
|
7250 - | "Unexpected value for `recursive_map`"
|
7251 - | );
|
7252 - | ::pretty_assertions::assert_eq!(
|
7253 - | input.recursive_struct,
|
7254 - | expected.recursive_struct,
|
7255 - | "Unexpected value for `recursive_struct`"
|
7256 - | );
|
7257 - | ::pretty_assertions::assert_eq!(
|
7258 - | input.simple_struct,
|
7259 - | expected.simple_struct,
|
7260 - | "Unexpected value for `simple_struct`"
|
7261 - | );
|
7262 - | ::pretty_assertions::assert_eq!(
|
7263 - | input.string,
|
7264 - | expected.string,
|
7265 - | "Unexpected value for `string`"
|
7266 - | );
|
7267 - | ::pretty_assertions::assert_eq!(
|
7268 - | input.struct_with_json_name,
|
7269 - | expected.struct_with_json_name,
|
7270 - | "Unexpected value for `struct_with_json_name`"
|
7271 - | );
|
7272 - | ::pretty_assertions::assert_eq!(
|
7273 - | input.timestamp,
|
7274 - | expected.timestamp,
|
7275 - | "Unexpected value for `timestamp`"
|
7276 - | );
|
7277 - | ::pretty_assertions::assert_eq!(
|
7278 - | input.unix_timestamp,
|
7279 - | expected.unix_timestamp,
|
7280 - | "Unexpected value for `unix_timestamp`"
|
7281 - | );
|
7282 - | let response = crate::output::KitchenSinkOperationOutput {
|
7283 - | blob: ::std::option::Option::None,
|
7284 - | boolean: ::std::option::Option::None,
|
7285 - | double: ::std::option::Option::None,
|
7286 - | empty_struct: ::std::option::Option::None,
|
7287 - | float: ::std::option::Option::None,
|
7288 - | httpdate_timestamp: ::std::option::Option::None,
|
7289 - | integer: ::std::option::Option::None,
|
7290 - | iso8601_timestamp: ::std::option::Option::None,
|
7291 - | json_value: ::std::option::Option::None,
|
7292 - | list_of_lists: ::std::option::Option::None,
|
7293 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7294 - | list_of_strings: ::std::option::Option::None,
|
7295 - | list_of_structs: ::std::option::Option::None,
|
7296 - | long: ::std::option::Option::None,
|
7297 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7298 - | map_of_maps: ::std::option::Option::None,
|
7299 - | map_of_strings: ::std::option::Option::None,
|
7300 - | map_of_structs: ::std::option::Option::None,
|
7301 - | recursive_list: ::std::option::Option::None,
|
7302 - | recursive_map: ::std::option::Option::None,
|
7303 - | recursive_struct: ::std::option::Option::None,
|
7304 - | simple_struct: ::std::option::Option::None,
|
7305 - | string: ::std::option::Option::None,
|
7306 - | struct_with_json_name: ::std::option::Option::None,
|
7307 - | timestamp: ::std::option::Option::None,
|
7308 - | unix_timestamp: ::std::option::Option::None,
|
7309 - | };
|
7310 - | Ok(response)
|
7311 - | };
|
7312 - | sender.send(()).await.expect("receiver dropped early");
|
7313 - | result
|
7314 - | }
|
7315 - | })
|
7316 - | .build_unchecked();
|
7317 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7318 - | .await
|
7319 - | .expect("unable to make an HTTP request");
|
7320 - | assert!(receiver.recv().await.is_some());
|
7321 - | }
|
7322 - | /// Serializes structure which have no members
|
7323 - | /// Test ID: serializes_structure_which_have_no_members
|
7324 - | #[::tokio::test]
|
7325 - | async fn serializes_structure_which_have_no_members_request() {
|
7326 - | #[allow(unused_mut)]
|
7327 - | let mut http_request = http::Request::builder()
|
7328 - | .uri("/")
|
7329 - | .method("POST")
|
7330 - | .header("Content-Type", "application/x-amz-json-1.1")
|
7331 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
7332 - | .body(::aws_smithy_http_server::body::Body::from(
|
7333 - | ::bytes::Bytes::from_static("{\"EmptyStruct\":{}}".as_bytes()),
|
7334 - | ))
|
7335 - | .unwrap();
|
7336 - | #[allow(unused_mut)]
|
7337 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7338 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
7339 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
7340 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
7341 - | let sender = sender.clone();
|
7342 - | async move {
|
7343 - | let result = {
|
7344 - | use ::aws_smithy_protocol_test::FloatEquals;
|
7345 - | let expected = crate::input::KitchenSinkOperationInput {
|
7346 - | empty_struct: ::std::option::Option::Some(crate::model::EmptyStruct {}),
|
7347 - | blob: ::std::option::Option::None,
|
7348 - | boolean: ::std::option::Option::None,
|
7349 - | double: ::std::option::Option::None,
|
7350 - | float: ::std::option::Option::None,
|
7351 - | httpdate_timestamp: ::std::option::Option::None,
|
7352 - | integer: ::std::option::Option::None,
|
7353 - | iso8601_timestamp: ::std::option::Option::None,
|
7354 - | json_value: ::std::option::Option::None,
|
7355 - | list_of_lists: ::std::option::Option::None,
|
7356 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7357 - | list_of_strings: ::std::option::Option::None,
|
7358 - | list_of_structs: ::std::option::Option::None,
|
7359 - | long: ::std::option::Option::None,
|
7360 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7361 - | map_of_maps: ::std::option::Option::None,
|
7362 - | map_of_strings: ::std::option::Option::None,
|
7363 - | map_of_structs: ::std::option::Option::None,
|
7364 - | recursive_list: ::std::option::Option::None,
|
7365 - | recursive_map: ::std::option::Option::None,
|
7366 - | recursive_struct: ::std::option::Option::None,
|
7367 - | simple_struct: ::std::option::Option::None,
|
7368 - | string: ::std::option::Option::None,
|
7369 - | struct_with_json_name: ::std::option::Option::None,
|
7370 - | timestamp: ::std::option::Option::None,
|
7371 - | unix_timestamp: ::std::option::Option::None,
|
7372 - | };
|
7373 - | ::pretty_assertions::assert_eq!(
|
7374 - | input.blob,
|
7375 - | expected.blob,
|
7376 - | "Unexpected value for `blob`"
|
7377 - | );
|
7378 - | ::pretty_assertions::assert_eq!(
|
7379 - | input.boolean,
|
7380 - | expected.boolean,
|
7381 - | "Unexpected value for `boolean`"
|
7382 - | );
|
7383 - | assert!(
|
7384 - | input.double.float_equals(&expected.double),
|
7385 - | "Unexpected value for `double` {:?} vs. {:?}",
|
7386 - | expected.double,
|
7387 - | input.double
|
7388 - | );
|
7389 - | ::pretty_assertions::assert_eq!(
|
7390 - | input.empty_struct,
|
7391 - | expected.empty_struct,
|
7392 - | "Unexpected value for `empty_struct`"
|
7393 - | );
|
7394 - | assert!(
|
7395 - | input.float.float_equals(&expected.float),
|
7396 - | "Unexpected value for `float` {:?} vs. {:?}",
|
7397 - | expected.float,
|
7398 - | input.float
|
7399 - | );
|
7400 - | ::pretty_assertions::assert_eq!(
|
7401 - | input.httpdate_timestamp,
|
7402 - | expected.httpdate_timestamp,
|
7403 - | "Unexpected value for `httpdate_timestamp`"
|
7404 - | );
|
7405 - | ::pretty_assertions::assert_eq!(
|
7406 - | input.integer,
|
7407 - | expected.integer,
|
7408 - | "Unexpected value for `integer`"
|
7409 - | );
|
7410 - | ::pretty_assertions::assert_eq!(
|
7411 - | input.iso8601_timestamp,
|
7412 - | expected.iso8601_timestamp,
|
7413 - | "Unexpected value for `iso8601_timestamp`"
|
7414 - | );
|
7415 - | ::pretty_assertions::assert_eq!(
|
7416 - | input.json_value,
|
7417 - | expected.json_value,
|
7418 - | "Unexpected value for `json_value`"
|
7419 - | );
|
7420 - | ::pretty_assertions::assert_eq!(
|
7421 - | input.list_of_lists,
|
7422 - | expected.list_of_lists,
|
7423 - | "Unexpected value for `list_of_lists`"
|
7424 - | );
|
7425 - | ::pretty_assertions::assert_eq!(
|
7426 - | input.list_of_maps_of_strings,
|
7427 - | expected.list_of_maps_of_strings,
|
7428 - | "Unexpected value for `list_of_maps_of_strings`"
|
7429 - | );
|
7430 - | ::pretty_assertions::assert_eq!(
|
7431 - | input.list_of_strings,
|
7432 - | expected.list_of_strings,
|
7433 - | "Unexpected value for `list_of_strings`"
|
7434 - | );
|
7435 - | ::pretty_assertions::assert_eq!(
|
7436 - | input.list_of_structs,
|
7437 - | expected.list_of_structs,
|
7438 - | "Unexpected value for `list_of_structs`"
|
7439 - | );
|
7440 - | ::pretty_assertions::assert_eq!(
|
7441 - | input.long,
|
7442 - | expected.long,
|
7443 - | "Unexpected value for `long`"
|
7444 - | );
|
7445 - | ::pretty_assertions::assert_eq!(
|
7446 - | input.map_of_lists_of_strings,
|
7447 - | expected.map_of_lists_of_strings,
|
7448 - | "Unexpected value for `map_of_lists_of_strings`"
|
7449 - | );
|
7450 - | ::pretty_assertions::assert_eq!(
|
7451 - | input.map_of_maps,
|
7452 - | expected.map_of_maps,
|
7453 - | "Unexpected value for `map_of_maps`"
|
7454 - | );
|
7455 - | ::pretty_assertions::assert_eq!(
|
7456 - | input.map_of_strings,
|
7457 - | expected.map_of_strings,
|
7458 - | "Unexpected value for `map_of_strings`"
|
7459 - | );
|
7460 - | ::pretty_assertions::assert_eq!(
|
7461 - | input.map_of_structs,
|
7462 - | expected.map_of_structs,
|
7463 - | "Unexpected value for `map_of_structs`"
|
7464 - | );
|
7465 - | ::pretty_assertions::assert_eq!(
|
7466 - | input.recursive_list,
|
7467 - | expected.recursive_list,
|
7468 - | "Unexpected value for `recursive_list`"
|
7469 - | );
|
7470 - | ::pretty_assertions::assert_eq!(
|
7471 - | input.recursive_map,
|
7472 - | expected.recursive_map,
|
7473 - | "Unexpected value for `recursive_map`"
|
7474 - | );
|
7475 - | ::pretty_assertions::assert_eq!(
|
7476 - | input.recursive_struct,
|
7477 - | expected.recursive_struct,
|
7478 - | "Unexpected value for `recursive_struct`"
|
7479 - | );
|
7480 - | ::pretty_assertions::assert_eq!(
|
7481 - | input.simple_struct,
|
7482 - | expected.simple_struct,
|
7483 - | "Unexpected value for `simple_struct`"
|
7484 - | );
|
7485 - | ::pretty_assertions::assert_eq!(
|
7486 - | input.string,
|
7487 - | expected.string,
|
7488 - | "Unexpected value for `string`"
|
7489 - | );
|
7490 - | ::pretty_assertions::assert_eq!(
|
7491 - | input.struct_with_json_name,
|
7492 - | expected.struct_with_json_name,
|
7493 - | "Unexpected value for `struct_with_json_name`"
|
7494 - | );
|
7495 - | ::pretty_assertions::assert_eq!(
|
7496 - | input.timestamp,
|
7497 - | expected.timestamp,
|
7498 - | "Unexpected value for `timestamp`"
|
7499 - | );
|
7500 - | ::pretty_assertions::assert_eq!(
|
7501 - | input.unix_timestamp,
|
7502 - | expected.unix_timestamp,
|
7503 - | "Unexpected value for `unix_timestamp`"
|
7504 - | );
|
7505 - | let response = crate::output::KitchenSinkOperationOutput {
|
7506 - | blob: ::std::option::Option::None,
|
7507 - | boolean: ::std::option::Option::None,
|
7508 - | double: ::std::option::Option::None,
|
7509 - | empty_struct: ::std::option::Option::None,
|
7510 - | float: ::std::option::Option::None,
|
7511 - | httpdate_timestamp: ::std::option::Option::None,
|
7512 - | integer: ::std::option::Option::None,
|
7513 - | iso8601_timestamp: ::std::option::Option::None,
|
7514 - | json_value: ::std::option::Option::None,
|
7515 - | list_of_lists: ::std::option::Option::None,
|
7516 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7517 - | list_of_strings: ::std::option::Option::None,
|
7518 - | list_of_structs: ::std::option::Option::None,
|
7519 - | long: ::std::option::Option::None,
|
7520 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7521 - | map_of_maps: ::std::option::Option::None,
|
7522 - | map_of_strings: ::std::option::Option::None,
|
7523 - | map_of_structs: ::std::option::Option::None,
|
7524 - | recursive_list: ::std::option::Option::None,
|
7525 - | recursive_map: ::std::option::Option::None,
|
7526 - | recursive_struct: ::std::option::Option::None,
|
7527 - | simple_struct: ::std::option::Option::None,
|
7528 - | string: ::std::option::Option::None,
|
7529 - | struct_with_json_name: ::std::option::Option::None,
|
7530 - | timestamp: ::std::option::Option::None,
|
7531 - | unix_timestamp: ::std::option::Option::None,
|
7532 - | };
|
7533 - | Ok(response)
|
7534 - | };
|
7535 - | sender.send(()).await.expect("receiver dropped early");
|
7536 - | result
|
7537 - | }
|
7538 - | })
|
7539 - | .build_unchecked();
|
7540 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7541 - | .await
|
7542 - | .expect("unable to make an HTTP request");
|
7543 - | assert!(receiver.recv().await.is_some());
|
7544 - | }
|
7545 - | /// Serializes recursive structure shapes
|
7546 - | /// Test ID: serializes_recursive_structure_shapes
|
7547 - | #[::tokio::test]
|
7548 - | async fn serializes_recursive_structure_shapes_request() {
|
7549 - | #[allow(unused_mut)]
|
7550 - | let mut http_request = http::Request::builder()
|
7551 - | .uri("/")
|
7552 - | .method("POST")
|
7553 - | .header("Content-Type", "application/x-amz-json-1.1")
|
7554 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
7555 - | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{\"String\":\"top-value\",\"Boolean\":false,\"RecursiveStruct\":{\"String\":\"nested-value\",\"Boolean\":true,\"RecursiveList\":[{\"String\":\"string-only\"},{\"RecursiveStruct\":{\"MapOfStrings\":{\"color\":\"red\",\"size\":\"large\"}}}]}}".as_bytes()))).unwrap();
|
7556 - | #[allow(unused_mut)]
|
7557 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7558 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
7559 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
7560 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
7561 - | let sender = sender.clone();
|
7562 - | async move {
|
7563 - | let result = {
|
7564 - | use ::aws_smithy_protocol_test::FloatEquals;
|
7565 - | let expected = crate::input::KitchenSinkOperationInput {
|
7566 - | string: ::std::option::Option::Some("top-value".to_owned()),
|
7567 - | boolean: ::std::option::Option::Some(false),
|
7568 - | recursive_struct: ::std::option::Option::Some(::std::boxed::Box::new(
|
7569 - | crate::model::KitchenSink {
|
7570 - | string: ::std::option::Option::Some("nested-value".to_owned()),
|
7571 - | boolean: ::std::option::Option::Some(true),
|
7572 - | recursive_list: ::std::option::Option::Some(vec![
|
7573 - | crate::model::KitchenSink {
|
7574 - | string: ::std::option::Option::Some(
|
7575 - | "string-only".to_owned(),
|
7576 - | ),
|
7577 - | blob: ::std::option::Option::None,
|
7578 - | boolean: ::std::option::Option::None,
|
7579 - | double: ::std::option::Option::None,
|
7580 - | empty_struct: ::std::option::Option::None,
|
7581 - | float: ::std::option::Option::None,
|
7582 - | httpdate_timestamp: ::std::option::Option::None,
|
7583 - | integer: ::std::option::Option::None,
|
7584 - | iso8601_timestamp: ::std::option::Option::None,
|
7585 - | json_value: ::std::option::Option::None,
|
7586 - | list_of_lists: ::std::option::Option::None,
|
7587 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7588 - | list_of_strings: ::std::option::Option::None,
|
7589 - | list_of_structs: ::std::option::Option::None,
|
7590 - | long: ::std::option::Option::None,
|
7591 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7592 - | map_of_maps: ::std::option::Option::None,
|
7593 - | map_of_strings: ::std::option::Option::None,
|
7594 - | map_of_structs: ::std::option::Option::None,
|
7595 - | recursive_list: ::std::option::Option::None,
|
7596 - | recursive_map: ::std::option::Option::None,
|
7597 - | recursive_struct: ::std::option::Option::None,
|
7598 - | simple_struct: ::std::option::Option::None,
|
7599 - | struct_with_json_name: ::std::option::Option::None,
|
7600 - | timestamp: ::std::option::Option::None,
|
7601 - | unix_timestamp: ::std::option::Option::None,
|
7602 - | },
|
7603 - | crate::model::KitchenSink {
|
7604 - | recursive_struct: ::std::option::Option::Some(
|
7605 - | ::std::boxed::Box::new(crate::model::KitchenSink {
|
7606 - | map_of_strings: ::std::option::Option::Some({
|
7607 - | let mut ret =
|
7608 - | ::std::collections::HashMap::new();
|
7609 - | ret.insert(
|
7610 - | "color".to_owned(),
|
7611 - | "red".to_owned(),
|
7612 - | );
|
7613 - | ret.insert(
|
7614 - | "size".to_owned(),
|
7615 - | "large".to_owned(),
|
7616 - | );
|
7617 - | ret
|
7618 - | }),
|
7619 - | blob: ::std::option::Option::None,
|
7620 - | boolean: ::std::option::Option::None,
|
7621 - | double: ::std::option::Option::None,
|
7622 - | empty_struct: ::std::option::Option::None,
|
7623 - | float: ::std::option::Option::None,
|
7624 - | httpdate_timestamp: ::std::option::Option::None,
|
7625 - | integer: ::std::option::Option::None,
|
7626 - | iso8601_timestamp: ::std::option::Option::None,
|
7627 - | json_value: ::std::option::Option::None,
|
7628 - | list_of_lists: ::std::option::Option::None,
|
7629 - | list_of_maps_of_strings:
|
7630 - | ::std::option::Option::None,
|
7631 - | list_of_strings: ::std::option::Option::None,
|
7632 - | list_of_structs: ::std::option::Option::None,
|
7633 - | long: ::std::option::Option::None,
|
7634 - | map_of_lists_of_strings:
|
7635 - | ::std::option::Option::None,
|
7636 - | map_of_maps: ::std::option::Option::None,
|
7637 - | map_of_structs: ::std::option::Option::None,
|
7638 - | recursive_list: ::std::option::Option::None,
|
7639 - | recursive_map: ::std::option::Option::None,
|
7640 - | recursive_struct: ::std::option::Option::None,
|
7641 - | simple_struct: ::std::option::Option::None,
|
7642 - | string: ::std::option::Option::None,
|
7643 - | struct_with_json_name:
|
7644 - | ::std::option::Option::None,
|
7645 - | timestamp: ::std::option::Option::None,
|
7646 - | unix_timestamp: ::std::option::Option::None,
|
7647 - | }),
|
7648 - | ),
|
7649 - | blob: ::std::option::Option::None,
|
7650 - | boolean: ::std::option::Option::None,
|
7651 - | double: ::std::option::Option::None,
|
7652 - | empty_struct: ::std::option::Option::None,
|
7653 - | float: ::std::option::Option::None,
|
7654 - | httpdate_timestamp: ::std::option::Option::None,
|
7655 - | integer: ::std::option::Option::None,
|
7656 - | iso8601_timestamp: ::std::option::Option::None,
|
7657 - | json_value: ::std::option::Option::None,
|
7658 - | list_of_lists: ::std::option::Option::None,
|
7659 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7660 - | list_of_strings: ::std::option::Option::None,
|
7661 - | list_of_structs: ::std::option::Option::None,
|
7662 - | long: ::std::option::Option::None,
|
7663 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7664 - | map_of_maps: ::std::option::Option::None,
|
7665 - | map_of_strings: ::std::option::Option::None,
|
7666 - | map_of_structs: ::std::option::Option::None,
|
7667 - | recursive_list: ::std::option::Option::None,
|
7668 - | recursive_map: ::std::option::Option::None,
|
7669 - | simple_struct: ::std::option::Option::None,
|
7670 - | string: ::std::option::Option::None,
|
7671 - | struct_with_json_name: ::std::option::Option::None,
|
7672 - | timestamp: ::std::option::Option::None,
|
7673 - | unix_timestamp: ::std::option::Option::None,
|
7674 - | },
|
7675 - | ]),
|
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_map: ::std::option::Option::None,
|
7694 - | recursive_struct: ::std::option::Option::None,
|
7695 - | simple_struct: ::std::option::Option::None,
|
7696 - | struct_with_json_name: ::std::option::Option::None,
|
7697 - | timestamp: ::std::option::Option::None,
|
7698 - | unix_timestamp: ::std::option::Option::None,
|
7699 - | },
|
7700 - | )),
|
7701 - | blob: ::std::option::Option::None,
|
7702 - | double: ::std::option::Option::None,
|
7703 - | empty_struct: ::std::option::Option::None,
|
7704 - | float: ::std::option::Option::None,
|
7705 - | httpdate_timestamp: ::std::option::Option::None,
|
7706 - | integer: ::std::option::Option::None,
|
7707 - | iso8601_timestamp: ::std::option::Option::None,
|
7708 - | json_value: ::std::option::Option::None,
|
7709 - | list_of_lists: ::std::option::Option::None,
|
7710 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7711 - | list_of_strings: ::std::option::Option::None,
|
7712 - | list_of_structs: ::std::option::Option::None,
|
7713 - | long: ::std::option::Option::None,
|
7714 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7715 - | map_of_maps: ::std::option::Option::None,
|
7716 - | map_of_strings: ::std::option::Option::None,
|
7717 - | map_of_structs: ::std::option::Option::None,
|
7718 - | recursive_list: ::std::option::Option::None,
|
7719 - | recursive_map: ::std::option::Option::None,
|
7720 - | simple_struct: ::std::option::Option::None,
|
7721 - | struct_with_json_name: ::std::option::Option::None,
|
7722 - | timestamp: ::std::option::Option::None,
|
7723 - | unix_timestamp: ::std::option::Option::None,
|
7724 - | };
|
7725 - | ::pretty_assertions::assert_eq!(
|
7726 - | input.blob,
|
7727 - | expected.blob,
|
7728 - | "Unexpected value for `blob`"
|
7729 - | );
|
7730 - | ::pretty_assertions::assert_eq!(
|
7731 - | input.boolean,
|
7732 - | expected.boolean,
|
7733 - | "Unexpected value for `boolean`"
|
7734 - | );
|
7735 - | assert!(
|
7736 - | input.double.float_equals(&expected.double),
|
7737 - | "Unexpected value for `double` {:?} vs. {:?}",
|
7738 - | expected.double,
|
7739 - | input.double
|
7740 - | );
|
7741 - | ::pretty_assertions::assert_eq!(
|
7742 - | input.empty_struct,
|
7743 - | expected.empty_struct,
|
7744 - | "Unexpected value for `empty_struct`"
|
7745 - | );
|
7746 - | assert!(
|
7747 - | input.float.float_equals(&expected.float),
|
7748 - | "Unexpected value for `float` {:?} vs. {:?}",
|
7749 - | expected.float,
|
7750 - | input.float
|
7751 - | );
|
7752 - | ::pretty_assertions::assert_eq!(
|
7753 - | input.httpdate_timestamp,
|
7754 - | expected.httpdate_timestamp,
|
7755 - | "Unexpected value for `httpdate_timestamp`"
|
7756 - | );
|
7757 - | ::pretty_assertions::assert_eq!(
|
7758 - | input.integer,
|
7759 - | expected.integer,
|
7760 - | "Unexpected value for `integer`"
|
7761 - | );
|
7762 - | ::pretty_assertions::assert_eq!(
|
7763 - | input.iso8601_timestamp,
|
7764 - | expected.iso8601_timestamp,
|
7765 - | "Unexpected value for `iso8601_timestamp`"
|
7766 - | );
|
7767 - | ::pretty_assertions::assert_eq!(
|
7768 - | input.json_value,
|
7769 - | expected.json_value,
|
7770 - | "Unexpected value for `json_value`"
|
7771 - | );
|
7772 - | ::pretty_assertions::assert_eq!(
|
7773 - | input.list_of_lists,
|
7774 - | expected.list_of_lists,
|
7775 - | "Unexpected value for `list_of_lists`"
|
7776 - | );
|
7777 - | ::pretty_assertions::assert_eq!(
|
7778 - | input.list_of_maps_of_strings,
|
7779 - | expected.list_of_maps_of_strings,
|
7780 - | "Unexpected value for `list_of_maps_of_strings`"
|
7781 - | );
|
7782 - | ::pretty_assertions::assert_eq!(
|
7783 - | input.list_of_strings,
|
7784 - | expected.list_of_strings,
|
7785 - | "Unexpected value for `list_of_strings`"
|
7786 - | );
|
7787 - | ::pretty_assertions::assert_eq!(
|
7788 - | input.list_of_structs,
|
7789 - | expected.list_of_structs,
|
7790 - | "Unexpected value for `list_of_structs`"
|
7791 - | );
|
7792 - | ::pretty_assertions::assert_eq!(
|
7793 - | input.long,
|
7794 - | expected.long,
|
7795 - | "Unexpected value for `long`"
|
7796 - | );
|
7797 - | ::pretty_assertions::assert_eq!(
|
7798 - | input.map_of_lists_of_strings,
|
7799 - | expected.map_of_lists_of_strings,
|
7800 - | "Unexpected value for `map_of_lists_of_strings`"
|
7801 - | );
|
7802 - | ::pretty_assertions::assert_eq!(
|
7803 - | input.map_of_maps,
|
7804 - | expected.map_of_maps,
|
7805 - | "Unexpected value for `map_of_maps`"
|
7806 - | );
|
7807 - | ::pretty_assertions::assert_eq!(
|
7808 - | input.map_of_strings,
|
7809 - | expected.map_of_strings,
|
7810 - | "Unexpected value for `map_of_strings`"
|
7811 - | );
|
7812 - | ::pretty_assertions::assert_eq!(
|
7813 - | input.map_of_structs,
|
7814 - | expected.map_of_structs,
|
7815 - | "Unexpected value for `map_of_structs`"
|
7816 - | );
|
7817 - | ::pretty_assertions::assert_eq!(
|
7818 - | input.recursive_list,
|
7819 - | expected.recursive_list,
|
7820 - | "Unexpected value for `recursive_list`"
|
7821 - | );
|
7822 - | ::pretty_assertions::assert_eq!(
|
7823 - | input.recursive_map,
|
7824 - | expected.recursive_map,
|
7825 - | "Unexpected value for `recursive_map`"
|
7826 - | );
|
7827 - | ::pretty_assertions::assert_eq!(
|
7828 - | input.recursive_struct,
|
7829 - | expected.recursive_struct,
|
7830 - | "Unexpected value for `recursive_struct`"
|
7831 - | );
|
7832 - | ::pretty_assertions::assert_eq!(
|
7833 - | input.simple_struct,
|
7834 - | expected.simple_struct,
|
7835 - | "Unexpected value for `simple_struct`"
|
7836 - | );
|
7837 - | ::pretty_assertions::assert_eq!(
|
7838 - | input.string,
|
7839 - | expected.string,
|
7840 - | "Unexpected value for `string`"
|
7841 - | );
|
7842 - | ::pretty_assertions::assert_eq!(
|
7843 - | input.struct_with_json_name,
|
7844 - | expected.struct_with_json_name,
|
7845 - | "Unexpected value for `struct_with_json_name`"
|
7846 - | );
|
7847 - | ::pretty_assertions::assert_eq!(
|
7848 - | input.timestamp,
|
7849 - | expected.timestamp,
|
7850 - | "Unexpected value for `timestamp`"
|
7851 - | );
|
7852 - | ::pretty_assertions::assert_eq!(
|
7853 - | input.unix_timestamp,
|
7854 - | expected.unix_timestamp,
|
7855 - | "Unexpected value for `unix_timestamp`"
|
7856 - | );
|
7857 - | let response = crate::output::KitchenSinkOperationOutput {
|
7858 - | blob: ::std::option::Option::None,
|
7859 - | boolean: ::std::option::Option::None,
|
7860 - | double: ::std::option::Option::None,
|
7861 - | empty_struct: ::std::option::Option::None,
|
7862 - | float: ::std::option::Option::None,
|
7863 - | httpdate_timestamp: ::std::option::Option::None,
|
7864 - | integer: ::std::option::Option::None,
|
7865 - | iso8601_timestamp: ::std::option::Option::None,
|
7866 - | json_value: ::std::option::Option::None,
|
7867 - | list_of_lists: ::std::option::Option::None,
|
7868 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7869 - | list_of_strings: ::std::option::Option::None,
|
7870 - | list_of_structs: ::std::option::Option::None,
|
7871 - | long: ::std::option::Option::None,
|
7872 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7873 - | map_of_maps: ::std::option::Option::None,
|
7874 - | map_of_strings: ::std::option::Option::None,
|
7875 - | map_of_structs: ::std::option::Option::None,
|
7876 - | recursive_list: ::std::option::Option::None,
|
7877 - | recursive_map: ::std::option::Option::None,
|
7878 - | recursive_struct: ::std::option::Option::None,
|
7879 - | simple_struct: ::std::option::Option::None,
|
7880 - | string: ::std::option::Option::None,
|
7881 - | struct_with_json_name: ::std::option::Option::None,
|
7882 - | timestamp: ::std::option::Option::None,
|
7883 - | unix_timestamp: ::std::option::Option::None,
|
7884 - | };
|
7885 - | Ok(response)
|
7886 - | };
|
7887 - | sender.send(()).await.expect("receiver dropped early");
|
7888 - | result
|
7889 - | }
|
7890 - | })
|
7891 - | .build_unchecked();
|
7892 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7893 - | .await
|
7894 - | .expect("unable to make an HTTP request");
|
7895 - | assert!(receiver.recv().await.is_some());
|
7896 - | }
|
7897 - | /// Parses operations with empty JSON bodies
|
7898 - | /// Test ID: parses_operations_with_empty_json_bodies
|
7899 - | #[::tokio::test]
|
7900 - | async fn parses_operations_with_empty_json_bodies_response() {
|
7901 - | let output = crate::output::KitchenSinkOperationOutput {
|
7902 - | blob: ::std::option::Option::None,
|
7903 - | boolean: ::std::option::Option::None,
|
7904 - | double: ::std::option::Option::None,
|
7905 - | empty_struct: ::std::option::Option::None,
|
7906 - | float: ::std::option::Option::None,
|
7907 - | httpdate_timestamp: ::std::option::Option::None,
|
7908 - | integer: ::std::option::Option::None,
|
7909 - | iso8601_timestamp: ::std::option::Option::None,
|
7910 - | json_value: ::std::option::Option::None,
|
7911 - | list_of_lists: ::std::option::Option::None,
|
7912 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7913 - | list_of_strings: ::std::option::Option::None,
|
7914 - | list_of_structs: ::std::option::Option::None,
|
7915 - | long: ::std::option::Option::None,
|
7916 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7917 - | map_of_maps: ::std::option::Option::None,
|
7918 - | map_of_strings: ::std::option::Option::None,
|
7919 - | map_of_structs: ::std::option::Option::None,
|
7920 - | recursive_list: ::std::option::Option::None,
|
7921 - | recursive_map: ::std::option::Option::None,
|
7922 - | recursive_struct: ::std::option::Option::None,
|
7923 - | simple_struct: ::std::option::Option::None,
|
7924 - | string: ::std::option::Option::None,
|
7925 - | struct_with_json_name: ::std::option::Option::None,
|
7926 - | timestamp: ::std::option::Option::None,
|
7927 - | unix_timestamp: ::std::option::Option::None,
|
7928 - | };
|
7929 - | use ::aws_smithy_http_server::response::IntoResponse;
|
7930 - | let http_response = output.into_response();
|
7931 - | ::pretty_assertions::assert_eq!(
|
7932 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
7933 - | http_response.status()
|
7934 - | );
|
7935 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
7936 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7937 - | http_response.headers(),
|
7938 - | expected_headers,
|
7939 - | ));
|
7940 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7941 - | .await
|
7942 - | .expect("unable to extract body to bytes");
|
7943 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
7944 - | &body,
|
7945 - | "{}",
|
7946 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
7947 - | ));
|
7948 - | }
|
7949 - | /// Parses string shapes
|
7950 - | /// Test ID: parses_string_shapes
|
7951 - | #[::tokio::test]
|
7952 - | async fn parses_string_shapes_response() {
|
7953 - | let output = crate::output::KitchenSinkOperationOutput {
|
7954 - | string: ::std::option::Option::Some("string-value".to_owned()),
|
7955 - | blob: ::std::option::Option::None,
|
7956 - | boolean: ::std::option::Option::None,
|
7957 - | double: ::std::option::Option::None,
|
7958 - | empty_struct: ::std::option::Option::None,
|
7959 - | float: ::std::option::Option::None,
|
7960 - | httpdate_timestamp: ::std::option::Option::None,
|
7961 - | integer: ::std::option::Option::None,
|
7962 - | iso8601_timestamp: ::std::option::Option::None,
|
7963 - | json_value: ::std::option::Option::None,
|
7964 - | list_of_lists: ::std::option::Option::None,
|
7965 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7966 - | list_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 - | struct_with_json_name: ::std::option::Option::None,
|
7978 - | timestamp: ::std::option::Option::None,
|
7979 - | unix_timestamp: ::std::option::Option::None,
|
7980 - | };
|
7981 - | use ::aws_smithy_http_server::response::IntoResponse;
|
7982 - | let http_response = output.into_response();
|
7983 - | ::pretty_assertions::assert_eq!(
|
7984 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
7985 - | http_response.status()
|
7986 - | );
|
7987 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
7988 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7989 - | http_response.headers(),
|
7990 - | expected_headers,
|
7991 - | ));
|
7992 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7993 - | .await
|
7994 - | .expect("unable to extract body to bytes");
|
7995 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
7996 - | &body,
|
7997 - | "{\"String\":\"string-value\"}",
|
7998 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
7999 - | ));
|
8000 - | }
|
8001 - | /// Parses integer shapes
|
8002 - | /// Test ID: parses_integer_shapes
|
8003 - | #[::tokio::test]
|
8004 - | async fn parses_integer_shapes_response() {
|
8005 - | let output = crate::output::KitchenSinkOperationOutput {
|
8006 - | integer: ::std::option::Option::Some(1234),
|
8007 - | blob: ::std::option::Option::None,
|
8008 - | boolean: ::std::option::Option::None,
|
8009 - | double: ::std::option::Option::None,
|
8010 - | empty_struct: ::std::option::Option::None,
|
8011 - | float: ::std::option::Option::None,
|
8012 - | httpdate_timestamp: ::std::option::Option::None,
|
8013 - | iso8601_timestamp: ::std::option::Option::None,
|
8014 - | json_value: ::std::option::Option::None,
|
8015 - | list_of_lists: ::std::option::Option::None,
|
8016 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8017 - | list_of_strings: ::std::option::Option::None,
|
8018 - | list_of_structs: ::std::option::Option::None,
|
8019 - | long: ::std::option::Option::None,
|
8020 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8021 - | map_of_maps: ::std::option::Option::None,
|
8022 - | map_of_strings: ::std::option::Option::None,
|
8023 - | map_of_structs: ::std::option::Option::None,
|
8024 - | recursive_list: ::std::option::Option::None,
|
8025 - | recursive_map: ::std::option::Option::None,
|
8026 - | recursive_struct: ::std::option::Option::None,
|
8027 - | simple_struct: ::std::option::Option::None,
|
8028 - | string: ::std::option::Option::None,
|
8029 - | struct_with_json_name: ::std::option::Option::None,
|
8030 - | timestamp: ::std::option::Option::None,
|
8031 - | unix_timestamp: ::std::option::Option::None,
|
8032 - | };
|
8033 - | use ::aws_smithy_http_server::response::IntoResponse;
|
8034 - | let http_response = output.into_response();
|
8035 - | ::pretty_assertions::assert_eq!(
|
8036 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8037 - | http_response.status()
|
8038 - | );
|
8039 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8040 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8041 - | http_response.headers(),
|
8042 - | expected_headers,
|
8043 - | ));
|
8044 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8045 - | .await
|
8046 - | .expect("unable to extract body to bytes");
|
8047 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8048 - | &body,
|
8049 - | "{\"Integer\":1234}",
|
8050 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8051 - | ));
|
8052 - | }
|
8053 - | /// Parses long shapes
|
8054 - | /// Test ID: parses_long_shapes
|
8055 - | #[::tokio::test]
|
8056 - | async fn parses_long_shapes_response() {
|
8057 - | let output = crate::output::KitchenSinkOperationOutput {
|
8058 - | long: ::std::option::Option::Some(1234567890123456789),
|
8059 - | blob: ::std::option::Option::None,
|
8060 - | boolean: ::std::option::Option::None,
|
8061 - | double: ::std::option::Option::None,
|
8062 - | empty_struct: ::std::option::Option::None,
|
8063 - | float: ::std::option::Option::None,
|
8064 - | httpdate_timestamp: ::std::option::Option::None,
|
8065 - | integer: ::std::option::Option::None,
|
8066 - | iso8601_timestamp: ::std::option::Option::None,
|
8067 - | json_value: ::std::option::Option::None,
|
8068 - | list_of_lists: ::std::option::Option::None,
|
8069 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8070 - | list_of_strings: ::std::option::Option::None,
|
8071 - | list_of_structs: ::std::option::Option::None,
|
8072 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8073 - | map_of_maps: ::std::option::Option::None,
|
8074 - | map_of_strings: ::std::option::Option::None,
|
8075 - | map_of_structs: ::std::option::Option::None,
|
8076 - | recursive_list: ::std::option::Option::None,
|
8077 - | recursive_map: ::std::option::Option::None,
|
8078 - | recursive_struct: ::std::option::Option::None,
|
8079 - | simple_struct: ::std::option::Option::None,
|
8080 - | string: ::std::option::Option::None,
|
8081 - | struct_with_json_name: ::std::option::Option::None,
|
8082 - | timestamp: ::std::option::Option::None,
|
8083 - | unix_timestamp: ::std::option::Option::None,
|
8084 - | };
|
8085 - | use ::aws_smithy_http_server::response::IntoResponse;
|
8086 - | let http_response = output.into_response();
|
8087 - | ::pretty_assertions::assert_eq!(
|
8088 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8089 - | http_response.status()
|
8090 - | );
|
8091 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8092 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8093 - | http_response.headers(),
|
8094 - | expected_headers,
|
8095 - | ));
|
8096 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8097 - | .await
|
8098 - | .expect("unable to extract body to bytes");
|
8099 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8100 - | &body,
|
8101 - | "{\"Long\":1234567890123456789}",
|
8102 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8103 - | ));
|
8104 - | }
|
8105 - | /// Parses float shapes
|
8106 - | /// Test ID: parses_float_shapes
|
8107 - | #[::tokio::test]
|
8108 - | async fn parses_float_shapes_response() {
|
8109 - | let output = crate::output::KitchenSinkOperationOutput {
|
8110 - | float: ::std::option::Option::Some(1234.5_f32),
|
8111 - | blob: ::std::option::Option::None,
|
8112 - | boolean: ::std::option::Option::None,
|
8113 - | double: ::std::option::Option::None,
|
8114 - | empty_struct: ::std::option::Option::None,
|
8115 - | httpdate_timestamp: ::std::option::Option::None,
|
8116 - | integer: ::std::option::Option::None,
|
8117 - | iso8601_timestamp: ::std::option::Option::None,
|
8118 - | json_value: ::std::option::Option::None,
|
8119 - | list_of_lists: ::std::option::Option::None,
|
8120 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8121 - | list_of_strings: ::std::option::Option::None,
|
8122 - | list_of_structs: ::std::option::Option::None,
|
8123 - | long: ::std::option::Option::None,
|
8124 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8125 - | map_of_maps: ::std::option::Option::None,
|
8126 - | map_of_strings: ::std::option::Option::None,
|
8127 - | map_of_structs: ::std::option::Option::None,
|
8128 - | recursive_list: ::std::option::Option::None,
|
8129 - | recursive_map: ::std::option::Option::None,
|
8130 - | recursive_struct: ::std::option::Option::None,
|
8131 - | simple_struct: ::std::option::Option::None,
|
8132 - | string: ::std::option::Option::None,
|
8133 - | struct_with_json_name: ::std::option::Option::None,
|
8134 - | timestamp: ::std::option::Option::None,
|
8135 - | unix_timestamp: ::std::option::Option::None,
|
8136 - | };
|
8137 - | use ::aws_smithy_http_server::response::IntoResponse;
|
8138 - | let http_response = output.into_response();
|
8139 - | ::pretty_assertions::assert_eq!(
|
8140 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8141 - | http_response.status()
|
8142 - | );
|
8143 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8144 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8145 - | http_response.headers(),
|
8146 - | expected_headers,
|
8147 - | ));
|
8148 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8149 - | .await
|
8150 - | .expect("unable to extract body to bytes");
|
8151 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8152 - | &body,
|
8153 - | "{\"Float\":1234.5}",
|
8154 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8155 - | ));
|
8156 - | }
|
8157 - | /// Parses double shapes
|
8158 - | /// Test ID: parses_double_shapes
|
8159 - | #[::tokio::test]
|
8160 - | async fn parses_double_shapes_response() {
|
8161 - | let output = crate::output::KitchenSinkOperationOutput {
|
8162 - | double: ::std::option::Option::Some(1.2345678912345679E8_f64),
|
8163 - | blob: ::std::option::Option::None,
|
8164 - | boolean: ::std::option::Option::None,
|
8165 - | empty_struct: ::std::option::Option::None,
|
8166 - | float: ::std::option::Option::None,
|
8167 - | httpdate_timestamp: ::std::option::Option::None,
|
8168 - | integer: ::std::option::Option::None,
|
8169 - | iso8601_timestamp: ::std::option::Option::None,
|
8170 - | json_value: ::std::option::Option::None,
|
8171 - | list_of_lists: ::std::option::Option::None,
|
8172 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8173 - | list_of_strings: ::std::option::Option::None,
|
8174 - | list_of_structs: ::std::option::Option::None,
|
8175 - | long: ::std::option::Option::None,
|
8176 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8177 - | map_of_maps: ::std::option::Option::None,
|
8178 - | map_of_strings: ::std::option::Option::None,
|
8179 - | map_of_structs: ::std::option::Option::None,
|
8180 - | recursive_list: ::std::option::Option::None,
|
8181 - | recursive_map: ::std::option::Option::None,
|
8182 - | recursive_struct: ::std::option::Option::None,
|
8183 - | simple_struct: ::std::option::Option::None,
|
8184 - | string: ::std::option::Option::None,
|
8185 - | struct_with_json_name: ::std::option::Option::None,
|
8186 - | timestamp: ::std::option::Option::None,
|
8187 - | unix_timestamp: ::std::option::Option::None,
|
8188 - | };
|
8189 - | use ::aws_smithy_http_server::response::IntoResponse;
|
8190 - | let http_response = output.into_response();
|
8191 - | ::pretty_assertions::assert_eq!(
|
8192 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8193 - | http_response.status()
|
8194 - | );
|
8195 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8196 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8197 - | http_response.headers(),
|
8198 - | expected_headers,
|
8199 - | ));
|
8200 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8201 - | .await
|
8202 - | .expect("unable to extract body to bytes");
|
8203 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8204 - | &body,
|
8205 - | "{\"Double\":123456789.12345679}",
|
8206 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8207 - | ));
|
8208 - | }
|
8209 - | /// Parses boolean shapes (true)
|
8210 - | /// Test ID: parses_boolean_shapes_true
|
8211 - | #[::tokio::test]
|
8212 - | async fn parses_boolean_shapes_true_response() {
|
8213 - | let output = crate::output::KitchenSinkOperationOutput {
|
8214 - | boolean: ::std::option::Option::Some(true),
|
8215 - | blob: ::std::option::Option::None,
|
8216 - | double: ::std::option::Option::None,
|
8217 - | empty_struct: ::std::option::Option::None,
|
8218 - | float: ::std::option::Option::None,
|
8219 - | httpdate_timestamp: ::std::option::Option::None,
|
8220 - | integer: ::std::option::Option::None,
|
8221 - | iso8601_timestamp: ::std::option::Option::None,
|
8222 - | json_value: ::std::option::Option::None,
|
8223 - | list_of_lists: ::std::option::Option::None,
|
8224 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8225 - | list_of_strings: ::std::option::Option::None,
|
8226 - | list_of_structs: ::std::option::Option::None,
|
8227 - | long: ::std::option::Option::None,
|
8228 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8229 - | map_of_maps: ::std::option::Option::None,
|
8230 - | map_of_strings: ::std::option::Option::None,
|
8231 - | map_of_structs: ::std::option::Option::None,
|
8232 - | recursive_list: ::std::option::Option::None,
|
8233 - | recursive_map: ::std::option::Option::None,
|
8234 - | recursive_struct: ::std::option::Option::None,
|
8235 - | simple_struct: ::std::option::Option::None,
|
8236 - | string: ::std::option::Option::None,
|
8237 - | struct_with_json_name: ::std::option::Option::None,
|
8238 - | timestamp: ::std::option::Option::None,
|
8239 - | unix_timestamp: ::std::option::Option::None,
|
8240 - | };
|
8241 - | use ::aws_smithy_http_server::response::IntoResponse;
|
8242 - | let http_response = output.into_response();
|
8243 - | ::pretty_assertions::assert_eq!(
|
8244 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8245 - | http_response.status()
|
8246 - | );
|
8247 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8248 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8249 - | http_response.headers(),
|
8250 - | expected_headers,
|
8251 - | ));
|
8252 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8253 - | .await
|
8254 - | .expect("unable to extract body to bytes");
|
8255 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8256 - | &body,
|
8257 - | "{\"Boolean\":true}",
|
8258 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8259 - | ));
|
8260 - | }
|
8261 - | /// Parses boolean (false)
|
8262 - | /// Test ID: parses_boolean_false
|
8263 - | #[::tokio::test]
|
8264 - | async fn parses_boolean_false_response() {
|
8265 - | let output = crate::output::KitchenSinkOperationOutput {
|
8266 - | boolean: ::std::option::Option::Some(false),
|
8267 - | blob: ::std::option::Option::None,
|
8268 - | double: ::std::option::Option::None,
|
8269 - | empty_struct: ::std::option::Option::None,
|
8270 - | float: ::std::option::Option::None,
|
8271 - | httpdate_timestamp: ::std::option::Option::None,
|
8272 - | integer: ::std::option::Option::None,
|
8273 - | iso8601_timestamp: ::std::option::Option::None,
|
8274 - | json_value: ::std::option::Option::None,
|
8275 - | list_of_lists: ::std::option::Option::None,
|
8276 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8277 - | list_of_strings: ::std::option::Option::None,
|
8278 - | list_of_structs: ::std::option::Option::None,
|
8279 - | long: ::std::option::Option::None,
|
8280 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8281 - | map_of_maps: ::std::option::Option::None,
|
8282 - | map_of_strings: ::std::option::Option::None,
|
8283 - | map_of_structs: ::std::option::Option::None,
|
8284 - | recursive_list: ::std::option::Option::None,
|
8285 - | recursive_map: ::std::option::Option::None,
|
8286 - | recursive_struct: ::std::option::Option::None,
|
8287 - | simple_struct: ::std::option::Option::None,
|
8288 - | string: ::std::option::Option::None,
|
8289 - | struct_with_json_name: ::std::option::Option::None,
|
8290 - | timestamp: ::std::option::Option::None,
|
8291 - | unix_timestamp: ::std::option::Option::None,
|
8292 - | };
|
8293 - | use ::aws_smithy_http_server::response::IntoResponse;
|
8294 - | let http_response = output.into_response();
|
8295 - | ::pretty_assertions::assert_eq!(
|
8296 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8297 - | http_response.status()
|
8298 - | );
|
8299 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8300 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8301 - | http_response.headers(),
|
8302 - | expected_headers,
|
8303 - | ));
|
8304 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8305 - | .await
|
8306 - | .expect("unable to extract body to bytes");
|
8307 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8308 - | &body,
|
8309 - | "{\"Boolean\":false}",
|
8310 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8311 - | ));
|
8312 - | }
|
8313 - | /// Parses blob shapes
|
8314 - | /// Test ID: parses_blob_shapes
|
8315 - | #[::tokio::test]
|
8316 - | async fn parses_blob_shapes_response() {
|
8317 - | let output = crate::output::KitchenSinkOperationOutput {
|
8318 - | blob: ::std::option::Option::Some(::aws_smithy_types::Blob::new("binary-value")),
|
8319 - | boolean: ::std::option::Option::None,
|
8320 - | double: ::std::option::Option::None,
|
8321 - | empty_struct: ::std::option::Option::None,
|
8322 - | float: ::std::option::Option::None,
|
8323 - | httpdate_timestamp: ::std::option::Option::None,
|
8324 - | integer: ::std::option::Option::None,
|
8325 - | iso8601_timestamp: ::std::option::Option::None,
|
8326 - | json_value: ::std::option::Option::None,
|
8327 - | list_of_lists: ::std::option::Option::None,
|
8328 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8329 - | list_of_strings: ::std::option::Option::None,
|
8330 - | list_of_structs: ::std::option::Option::None,
|
8331 - | long: ::std::option::Option::None,
|
8332 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8333 - | map_of_maps: ::std::option::Option::None,
|
8334 - | map_of_strings: ::std::option::Option::None,
|
8335 - | map_of_structs: ::std::option::Option::None,
|
8336 - | recursive_list: ::std::option::Option::None,
|
8337 - | recursive_map: ::std::option::Option::None,
|
8338 - | recursive_struct: ::std::option::Option::None,
|
8339 - | simple_struct: ::std::option::Option::None,
|
8340 - | string: ::std::option::Option::None,
|
8341 - | struct_with_json_name: ::std::option::Option::None,
|
8342 - | timestamp: ::std::option::Option::None,
|
8343 - | unix_timestamp: ::std::option::Option::None,
|
8344 - | };
|
8345 - | use ::aws_smithy_http_server::response::IntoResponse;
|
8346 - | let http_response = output.into_response();
|
8347 - | ::pretty_assertions::assert_eq!(
|
8348 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8349 - | http_response.status()
|
8350 - | );
|
8351 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8352 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8353 - | http_response.headers(),
|
8354 - | expected_headers,
|
8355 - | ));
|
8356 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8357 - | .await
|
8358 - | .expect("unable to extract body to bytes");
|
8359 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8360 - | &body,
|
8361 - | "{\"Blob\":\"YmluYXJ5LXZhbHVl\"}",
|
8362 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8363 - | ));
|
8364 - | }
|
8365 - | /// Parses timestamp shapes
|
8366 - | /// Test ID: parses_timestamp_shapes
|
8367 - | #[::tokio::test]
|
8368 - | async fn parses_timestamp_shapes_response() {
|
8369 - | let output = crate::output::KitchenSinkOperationOutput {
|
8370 - | timestamp: ::std::option::Option::Some(
|
8371 - | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
8372 - | ),
|
8373 - | blob: ::std::option::Option::None,
|
8374 - | boolean: ::std::option::Option::None,
|
8375 - | double: ::std::option::Option::None,
|
8376 - | empty_struct: ::std::option::Option::None,
|
8377 - | float: ::std::option::Option::None,
|
8378 - | httpdate_timestamp: ::std::option::Option::None,
|
8379 - | integer: ::std::option::Option::None,
|
8380 - | iso8601_timestamp: ::std::option::Option::None,
|
8381 - | json_value: ::std::option::Option::None,
|
8382 - | list_of_lists: ::std::option::Option::None,
|
8383 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8384 - | list_of_strings: ::std::option::Option::None,
|
8385 - | list_of_structs: ::std::option::Option::None,
|
8386 - | long: ::std::option::Option::None,
|
8387 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8388 - | map_of_maps: ::std::option::Option::None,
|
8389 - | map_of_strings: ::std::option::Option::None,
|
8390 - | map_of_structs: ::std::option::Option::None,
|
8391 - | recursive_list: ::std::option::Option::None,
|
8392 - | recursive_map: ::std::option::Option::None,
|
8393 - | recursive_struct: ::std::option::Option::None,
|
8394 - | simple_struct: ::std::option::Option::None,
|
8395 - | string: ::std::option::Option::None,
|
8396 - | struct_with_json_name: ::std::option::Option::None,
|
8397 - | unix_timestamp: ::std::option::Option::None,
|
8398 - | };
|
8399 - | use ::aws_smithy_http_server::response::IntoResponse;
|
8400 - | let http_response = output.into_response();
|
8401 - | ::pretty_assertions::assert_eq!(
|
8402 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8403 - | http_response.status()
|
8404 - | );
|
8405 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8406 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8407 - | http_response.headers(),
|
8408 - | expected_headers,
|
8409 - | ));
|
8410 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2918 + | let mut http_request = http::Request::builder()
|
2919 + | .uri("/")
|
2920 + | .method("POST")
|
2921 + | .header("Content-Type", "application/x-amz-json-1.1")
|
2922 + | .header("X-Amz-Target", "JsonProtocol.SimpleScalarProperties")
|
2923 + | .body(::aws_smithy_http_server::body::Body::from(
|
2924 + | ::bytes::Bytes::from_static(
|
2925 + | "{\n \"floatValue\": \"NaN\",\n \"doubleValue\": \"NaN\"\n}".as_bytes(),
|
2926 + | ),
|
2927 + | ))
|
2928 + | .unwrap();
|
2929 + | #[allow(unused_mut)]
|
2930 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2931 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
2932 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2933 + | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
2934 + | let sender = sender.clone();
|
2935 + | async move {
|
2936 + | let result = { use ::aws_smithy_protocol_test::FloatEquals;
|
2937 + | let expected =
|
2938 + | crate::input::SimpleScalarPropertiesInput {
|
2939 + | float_value:
|
2940 + | ::std::option::Option::Some(
|
2941 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number")
|
2942 + | )
|
2943 + | ,
|
2944 + | double_value:
|
2945 + | ::std::option::Option::Some(
|
2946 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number")
|
2947 + | )
|
2948 + | ,
|
2949 + | }
|
2950 + | ;
|
2951 + | assert!(input.float_value.float_equals(&expected.float_value),
|
2952 + | "Unexpected value for `float_value` {:?} vs. {:?}", expected.float_value, input.float_value);
|
2953 + | assert!(input.double_value.float_equals(&expected.double_value),
|
2954 + | "Unexpected value for `double_value` {:?} vs. {:?}", expected.double_value, input.double_value);
|
2955 + | let response =
|
2956 + | crate::output::SimpleScalarPropertiesOutput {
|
2957 + | float_value:
|
2958 + | ::std::option::Option::None
|
2959 + | ,
|
2960 + | double_value:
|
2961 + | ::std::option::Option::None
|
2962 + | ,
|
2963 + | }
|
2964 + | ;
|
2965 + | response };
|
2966 + | sender.send(()).await.expect("receiver dropped early");
|
2967 + | result
|
2968 + | }
|
2969 + | })
|
2970 + | .build_unchecked();
|
2971 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8411 2972 | .await
|
8412 - | .expect("unable to extract body to bytes");
|
8413 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8414 - | &body,
|
8415 - | "{\"Timestamp\":946845296}",
|
8416 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8417 - | ));
|
8418 - | }
|
8419 - | /// Parses iso8601 timestamps
|
8420 - | /// Test ID: parses_iso8601_timestamps
|
8421 - | #[::tokio::test]
|
8422 - | async fn parses_iso8601_timestamps_response() {
|
8423 - | let output = crate::output::KitchenSinkOperationOutput {
|
8424 - | iso8601_timestamp: ::std::option::Option::Some(
|
8425 - | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
8426 - | ),
|
8427 - | blob: ::std::option::Option::None,
|
8428 - | boolean: ::std::option::Option::None,
|
8429 - | double: ::std::option::Option::None,
|
8430 - | empty_struct: ::std::option::Option::None,
|
8431 - | float: ::std::option::Option::None,
|
8432 - | httpdate_timestamp: ::std::option::Option::None,
|
8433 - | integer: ::std::option::Option::None,
|
8434 - | json_value: ::std::option::Option::None,
|
8435 - | list_of_lists: ::std::option::Option::None,
|
8436 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8437 - | list_of_strings: ::std::option::Option::None,
|
8438 - | list_of_structs: ::std::option::Option::None,
|
8439 - | long: ::std::option::Option::None,
|
8440 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8441 - | map_of_maps: ::std::option::Option::None,
|
8442 - | map_of_strings: ::std::option::Option::None,
|
8443 - | map_of_structs: ::std::option::Option::None,
|
8444 - | recursive_list: ::std::option::Option::None,
|
8445 - | recursive_map: ::std::option::Option::None,
|
8446 - | recursive_struct: ::std::option::Option::None,
|
8447 - | simple_struct: ::std::option::Option::None,
|
8448 - | string: ::std::option::Option::None,
|
8449 - | struct_with_json_name: ::std::option::Option::None,
|
8450 - | timestamp: ::std::option::Option::None,
|
8451 - | unix_timestamp: ::std::option::Option::None,
|
8452 - | };
|
8453 - | use ::aws_smithy_http_server::response::IntoResponse;
|
8454 - | let http_response = output.into_response();
|
8455 - | ::pretty_assertions::assert_eq!(
|
8456 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8457 - | http_response.status()
|
2973 + | .expect("unable to make an HTTP request");
|
2974 + | assert!(
|
2975 + | receiver.recv().await.is_some(),
|
2976 + | "we expected operation handler to be invoked but it was not entered"
|
8458 2977 | );
|
8459 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8460 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8461 - | http_response.headers(),
|
8462 - | expected_headers,
|
8463 - | ));
|
8464 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8465 - | .await
|
8466 - | .expect("unable to extract body to bytes");
|
8467 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8468 - | &body,
|
8469 - | "{\"Iso8601Timestamp\":\"2000-01-02T20:34:56Z\"}",
|
8470 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8471 - | ));
|
8472 2978 | }
|
8473 - | /// Parses httpdate timestamps
|
8474 - | /// Test ID: parses_httpdate_timestamps
|
2979 + | /// Supports handling Infinity float values.
|
2980 + | /// Test ID: AwsJson11SupportsInfinityFloatInputs
|
8475 2981 | #[::tokio::test]
|
8476 - | async fn parses_httpdate_timestamps_response() {
|
8477 - | let output = crate::output::KitchenSinkOperationOutput {
|
8478 - | httpdate_timestamp: ::std::option::Option::Some(
|
8479 - | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
8480 - | ),
|
8481 - | blob: ::std::option::Option::None,
|
8482 - | boolean: ::std::option::Option::None,
|
8483 - | double: ::std::option::Option::None,
|
8484 - | empty_struct: ::std::option::Option::None,
|
8485 - | float: ::std::option::Option::None,
|
8486 - | integer: ::std::option::Option::None,
|
8487 - | iso8601_timestamp: ::std::option::Option::None,
|
8488 - | json_value: ::std::option::Option::None,
|
8489 - | list_of_lists: ::std::option::Option::None,
|
8490 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8491 - | list_of_strings: ::std::option::Option::None,
|
8492 - | list_of_structs: ::std::option::Option::None,
|
8493 - | long: ::std::option::Option::None,
|
8494 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8495 - | map_of_maps: ::std::option::Option::None,
|
8496 - | map_of_strings: ::std::option::Option::None,
|
8497 - | map_of_structs: ::std::option::Option::None,
|
8498 - | recursive_list: ::std::option::Option::None,
|
8499 - | recursive_map: ::std::option::Option::None,
|
8500 - | recursive_struct: ::std::option::Option::None,
|
8501 - | simple_struct: ::std::option::Option::None,
|
8502 - | string: ::std::option::Option::None,
|
8503 - | struct_with_json_name: ::std::option::Option::None,
|
8504 - | timestamp: ::std::option::Option::None,
|
8505 - | unix_timestamp: ::std::option::Option::None,
|
8506 - | };
|
8507 - | use ::aws_smithy_http_server::response::IntoResponse;
|
8508 - | let http_response = output.into_response();
|
8509 - | ::pretty_assertions::assert_eq!(
|
8510 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8511 - | http_response.status()
|
8512 - | );
|
8513 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8514 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8515 - | http_response.headers(),
|
8516 - | expected_headers,
|
8517 - | ));
|
8518 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2982 + | #[::tracing_test::traced_test]
|
2983 + | async fn aws_json11_supports_infinity_float_inputs_request() {
|
2984 + | #[allow(unused_mut)]
|
2985 + | let mut http_request = http::Request::builder()
|
2986 + | .uri("/")
|
2987 + | .method("POST")
|
2988 + | .header("Content-Type", "application/x-amz-json-1.1")
|
2989 + | .header("X-Amz-Target", "JsonProtocol.SimpleScalarProperties")
|
2990 + | .body(::aws_smithy_http_server::body::Body::from(
|
2991 + | ::bytes::Bytes::from_static(
|
2992 + | "{\n \"floatValue\": \"Infinity\",\n \"doubleValue\": \"Infinity\"\n}"
|
2993 + | .as_bytes(),
|
2994 + | ),
|
2995 + | ))
|
2996 + | .unwrap();
|
2997 + | #[allow(unused_mut)]
|
2998 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2999 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
3000 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3001 + | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
3002 + | let sender = sender.clone();
|
3003 + | async move {
|
3004 + | let result = { use ::aws_smithy_protocol_test::FloatEquals;
|
3005 + | let expected =
|
3006 + | crate::input::SimpleScalarPropertiesInput {
|
3007 + | float_value:
|
3008 + | ::std::option::Option::Some(
|
3009 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number")
|
3010 + | )
|
3011 + | ,
|
3012 + | double_value:
|
3013 + | ::std::option::Option::Some(
|
3014 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number")
|
3015 + | )
|
3016 + | ,
|
3017 + | }
|
3018 + | ;
|
3019 + | assert!(input.float_value.float_equals(&expected.float_value),
|
3020 + | "Unexpected value for `float_value` {:?} vs. {:?}", expected.float_value, input.float_value);
|
3021 + | assert!(input.double_value.float_equals(&expected.double_value),
|
3022 + | "Unexpected value for `double_value` {:?} vs. {:?}", expected.double_value, input.double_value);
|
3023 + | let response =
|
3024 + | crate::output::SimpleScalarPropertiesOutput {
|
3025 + | float_value:
|
3026 + | ::std::option::Option::None
|
3027 + | ,
|
3028 + | double_value:
|
3029 + | ::std::option::Option::None
|
3030 + | ,
|
3031 + | }
|
3032 + | ;
|
3033 + | response };
|
3034 + | sender.send(()).await.expect("receiver dropped early");
|
3035 + | result
|
3036 + | }
|
3037 + | })
|
3038 + | .build_unchecked();
|
3039 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8519 3040 | .await
|
8520 - | .expect("unable to extract body to bytes");
|
8521 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8522 - | &body,
|
8523 - | "{\"HttpdateTimestamp\":\"Sun, 02 Jan 2000 20:34:56 GMT\"}",
|
8524 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8525 - | ));
|
3041 + | .expect("unable to make an HTTP request");
|
3042 + | assert!(
|
3043 + | receiver.recv().await.is_some(),
|
3044 + | "we expected operation handler to be invoked but it was not entered"
|
3045 + | );
|
8526 3046 | }
|
8527 - | /// Parses list shapes
|
8528 - | /// Test ID: parses_list_shapes
|
3047 + | /// Supports handling -Infinity float values.
|
3048 + | /// Test ID: AwsJson11SupportsNegativeInfinityFloatInputs
|
8529 3049 | #[::tokio::test]
|
8530 - | async fn parses_list_shapes_response() {
|
8531 - | let output = crate::output::KitchenSinkOperationOutput {
|
8532 - | list_of_strings: ::std::option::Option::Some(vec![
|
8533 - | "abc".to_owned(),
|
8534 - | "mno".to_owned(),
|
8535 - | "xyz".to_owned(),
|
8536 - | ]),
|
8537 - | blob: ::std::option::Option::None,
|
8538 - | boolean: ::std::option::Option::None,
|
8539 - | double: ::std::option::Option::None,
|
8540 - | empty_struct: ::std::option::Option::None,
|
8541 - | float: ::std::option::Option::None,
|
8542 - | httpdate_timestamp: ::std::option::Option::None,
|
8543 - | integer: ::std::option::Option::None,
|
8544 - | iso8601_timestamp: ::std::option::Option::None,
|
8545 - | json_value: ::std::option::Option::None,
|
8546 - | list_of_lists: ::std::option::Option::None,
|
8547 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8548 - | list_of_structs: ::std::option::Option::None,
|
8549 - | long: ::std::option::Option::None,
|
8550 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8551 - | map_of_maps: ::std::option::Option::None,
|
8552 - | map_of_strings: ::std::option::Option::None,
|
8553 - | map_of_structs: ::std::option::Option::None,
|
8554 - | recursive_list: ::std::option::Option::None,
|
8555 - | recursive_map: ::std::option::Option::None,
|
8556 - | recursive_struct: ::std::option::Option::None,
|
8557 - | simple_struct: ::std::option::Option::None,
|
8558 - | string: ::std::option::Option::None,
|
8559 - | struct_with_json_name: ::std::option::Option::None,
|
8560 - | timestamp: ::std::option::Option::None,
|
8561 - | unix_timestamp: ::std::option::Option::None,
|
3050 + | #[::tracing_test::traced_test]
|
3051 + | async fn aws_json11_supports_negative_infinity_float_inputs_request() {
|
3052 + | #[allow(unused_mut)]
|
3053 + | let mut http_request = http::Request::builder()
|
3054 + | .uri("/")
|
3055 + | .method("POST")
|
3056 + | .header("Content-Type", "application/x-amz-json-1.1")
|
3057 + | .header("X-Amz-Target", "JsonProtocol.SimpleScalarProperties")
|
3058 + | .body(::aws_smithy_http_server::body::Body::from(
|
3059 + | ::bytes::Bytes::from_static(
|
3060 + | "{\n \"floatValue\": \"-Infinity\",\n \"doubleValue\": \"-Infinity\"\n}"
|
3061 + | .as_bytes(),
|
3062 + | ),
|
3063 + | ))
|
3064 + | .unwrap();
|
3065 + | #[allow(unused_mut)]
|
3066 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3067 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
3068 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3069 + | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
3070 + | let sender = sender.clone();
|
3071 + | async move {
|
3072 + | let result = { use ::aws_smithy_protocol_test::FloatEquals;
|
3073 + | let expected =
|
3074 + | crate::input::SimpleScalarPropertiesInput {
|
3075 + | float_value:
|
3076 + | ::std::option::Option::Some(
|
3077 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number")
|
3078 + | )
|
3079 + | ,
|
3080 + | double_value:
|
3081 + | ::std::option::Option::Some(
|
3082 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number")
|
3083 + | )
|
3084 + | ,
|
3085 + | }
|
3086 + | ;
|
3087 + | assert!(input.float_value.float_equals(&expected.float_value),
|
3088 + | "Unexpected value for `float_value` {:?} vs. {:?}", expected.float_value, input.float_value);
|
3089 + | assert!(input.double_value.float_equals(&expected.double_value),
|
3090 + | "Unexpected value for `double_value` {:?} vs. {:?}", expected.double_value, input.double_value);
|
3091 + | let response =
|
3092 + | crate::output::SimpleScalarPropertiesOutput {
|
3093 + | float_value:
|
3094 + | ::std::option::Option::None
|
3095 + | ,
|
3096 + | double_value:
|
3097 + | ::std::option::Option::None
|
3098 + | ,
|
3099 + | }
|
3100 + | ;
|
3101 + | response };
|
3102 + | sender.send(()).await.expect("receiver dropped early");
|
3103 + | result
|
3104 + | }
|
3105 + | })
|
3106 + | .build_unchecked();
|
3107 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3108 + | .await
|
3109 + | .expect("unable to make an HTTP request");
|
3110 + | assert!(
|
3111 + | receiver.recv().await.is_some(),
|
3112 + | "we expected operation handler to be invoked but it was not entered"
|
3113 + | );
|
3114 + | }
|
3115 + | /// Supports handling NaN float values.
|
3116 + | /// Test ID: AwsJson11SupportsNaNFloatInputs
|
3117 + | #[::tokio::test]
|
3118 + | #[::tracing_test::traced_test]
|
3119 + | async fn aws_json11_supports_na_n_float_inputs_response() {
|
3120 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
3121 + | float_value: ::std::option::Option::Some(
|
3122 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN")
|
3123 + | .expect("invalid string for number"),
|
3124 + | ),
|
3125 + | double_value: ::std::option::Option::Some(
|
3126 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN")
|
3127 + | .expect("invalid string for number"),
|
3128 + | ),
|
8562 3129 | };
|
8563 3130 | use ::aws_smithy_http_server::response::IntoResponse;
|
8564 3131 | let http_response = output.into_response();
|
8565 3132 | ::pretty_assertions::assert_eq!(
|
8566 3133 | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8567 3134 | http_response.status()
|
8568 3135 | );
|
8569 3136 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8570 3137 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8571 3138 | http_response.headers(),
|
8572 3139 | expected_headers,
|
8573 3140 | ));
|
8574 3141 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8575 3142 | .await
|
8576 3143 | .expect("unable to extract body to bytes");
|
8577 3144 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8578 3145 | &body,
|
8579 - | "{\"ListOfStrings\":[\"abc\",\"mno\",\"xyz\"]}",
|
3146 + | "{\n \"floatValue\": \"NaN\",\n \"doubleValue\": \"NaN\"\n}",
|
8580 3147 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8581 3148 | ));
|
8582 3149 | }
|
8583 - | /// Parses list of map shapes
|
8584 - | /// Test ID: parses_list_of_map_shapes
|
3150 + | /// Supports handling Infinity float values.
|
3151 + | /// Test ID: AwsJson11SupportsInfinityFloatInputs
|
8585 3152 | #[::tokio::test]
|
8586 - | async fn parses_list_of_map_shapes_response() {
|
8587 - | let output = crate::output::KitchenSinkOperationOutput {
|
8588 - | list_of_maps_of_strings: ::std::option::Option::Some(vec![
|
8589 - | {
|
8590 - | let mut ret = ::std::collections::HashMap::new();
|
8591 - | ret.insert("size".to_owned(), "large".to_owned());
|
8592 - | ret
|
8593 - | },
|
8594 - | {
|
8595 - | let mut ret = ::std::collections::HashMap::new();
|
8596 - | ret.insert("color".to_owned(), "red".to_owned());
|
8597 - | ret
|
8598 - | },
|
8599 - | ]),
|
8600 - | blob: ::std::option::Option::None,
|
8601 - | boolean: ::std::option::Option::None,
|
8602 - | double: ::std::option::Option::None,
|
8603 - | empty_struct: ::std::option::Option::None,
|
8604 - | float: ::std::option::Option::None,
|
8605 - | httpdate_timestamp: ::std::option::Option::None,
|
8606 - | integer: ::std::option::Option::None,
|
8607 - | iso8601_timestamp: ::std::option::Option::None,
|
8608 - | json_value: ::std::option::Option::None,
|
8609 - | list_of_lists: ::std::option::Option::None,
|
8610 - | list_of_strings: ::std::option::Option::None,
|
8611 - | list_of_structs: ::std::option::Option::None,
|
8612 - | long: ::std::option::Option::None,
|
8613 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8614 - | map_of_maps: ::std::option::Option::None,
|
8615 - | map_of_strings: ::std::option::Option::None,
|
8616 - | map_of_structs: ::std::option::Option::None,
|
8617 - | recursive_list: ::std::option::Option::None,
|
8618 - | recursive_map: ::std::option::Option::None,
|
8619 - | recursive_struct: ::std::option::Option::None,
|
8620 - | simple_struct: ::std::option::Option::None,
|
8621 - | string: ::std::option::Option::None,
|
8622 - | struct_with_json_name: ::std::option::Option::None,
|
8623 - | timestamp: ::std::option::Option::None,
|
8624 - | unix_timestamp: ::std::option::Option::None,
|
3153 + | #[::tracing_test::traced_test]
|
3154 + | async fn aws_json11_supports_infinity_float_inputs_response() {
|
3155 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
3156 + | float_value: ::std::option::Option::Some(
|
3157 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity")
|
3158 + | .expect("invalid string for number"),
|
3159 + | ),
|
3160 + | double_value: ::std::option::Option::Some(
|
3161 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity")
|
3162 + | .expect("invalid string for number"),
|
3163 + | ),
|
8625 3164 | };
|
8626 3165 | use ::aws_smithy_http_server::response::IntoResponse;
|
8627 3166 | let http_response = output.into_response();
|
8628 3167 | ::pretty_assertions::assert_eq!(
|
8629 3168 | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8630 3169 | http_response.status()
|
8631 3170 | );
|
8632 3171 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8633 3172 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8634 3173 | http_response.headers(),
|
8635 3174 | expected_headers,
|
8636 3175 | ));
|
8637 3176 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8638 3177 | .await
|
8639 3178 | .expect("unable to extract body to bytes");
|
8640 3179 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8641 3180 | &body,
|
8642 - | "{\"ListOfMapsOfStrings\":[{\"size\":\"large\"},{\"color\":\"red\"}]}",
|
3181 + | "{\n \"floatValue\": \"Infinity\",\n \"doubleValue\": \"Infinity\"\n}",
|
8643 3182 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8644 3183 | ));
|
8645 3184 | }
|
8646 - | /// Parses list of list shapes
|
8647 - | /// Test ID: parses_list_of_list_shapes
|
3185 + | /// Supports handling -Infinity float values.
|
3186 + | /// Test ID: AwsJson11SupportsNegativeInfinityFloatInputs
|
8648 3187 | #[::tokio::test]
|
8649 - | async fn parses_list_of_list_shapes_response() {
|
8650 - | let output = crate::output::KitchenSinkOperationOutput {
|
8651 - | list_of_lists: ::std::option::Option::Some(vec![
|
8652 - | vec!["abc".to_owned(), "mno".to_owned(), "xyz".to_owned()],
|
8653 - | vec!["hjk".to_owned(), "qrs".to_owned(), "tuv".to_owned()],
|
8654 - | ]),
|
8655 - | blob: ::std::option::Option::None,
|
8656 - | boolean: ::std::option::Option::None,
|
8657 - | double: ::std::option::Option::None,
|
8658 - | empty_struct: ::std::option::Option::None,
|
8659 - | float: ::std::option::Option::None,
|
8660 - | httpdate_timestamp: ::std::option::Option::None,
|
8661 - | integer: ::std::option::Option::None,
|
8662 - | iso8601_timestamp: ::std::option::Option::None,
|
8663 - | json_value: ::std::option::Option::None,
|
8664 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8665 - | list_of_strings: ::std::option::Option::None,
|
8666 - | list_of_structs: ::std::option::Option::None,
|
8667 - | long: ::std::option::Option::None,
|
8668 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8669 - | map_of_maps: ::std::option::Option::None,
|
8670 - | map_of_strings: ::std::option::Option::None,
|
8671 - | map_of_structs: ::std::option::Option::None,
|
8672 - | recursive_list: ::std::option::Option::None,
|
8673 - | recursive_map: ::std::option::Option::None,
|
8674 - | recursive_struct: ::std::option::Option::None,
|
8675 - | simple_struct: ::std::option::Option::None,
|
8676 - | string: ::std::option::Option::None,
|
8677 - | struct_with_json_name: ::std::option::Option::None,
|
8678 - | timestamp: ::std::option::Option::None,
|
8679 - | unix_timestamp: ::std::option::Option::None,
|
3188 + | #[::tracing_test::traced_test]
|
3189 + | async fn aws_json11_supports_negative_infinity_float_inputs_response() {
|
3190 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
3191 + | float_value: ::std::option::Option::Some(
|
3192 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity")
|
3193 + | .expect("invalid string for number"),
|
3194 + | ),
|
3195 + | double_value: ::std::option::Option::Some(
|
3196 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity")
|
3197 + | .expect("invalid string for number"),
|
3198 + | ),
|
8680 3199 | };
|
8681 3200 | use ::aws_smithy_http_server::response::IntoResponse;
|
8682 3201 | let http_response = output.into_response();
|
8683 3202 | ::pretty_assertions::assert_eq!(
|
8684 3203 | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8685 3204 | http_response.status()
|
8686 3205 | );
|
8687 3206 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8688 3207 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8689 3208 | http_response.headers(),
|
8690 3209 | expected_headers,
|
8691 3210 | ));
|
8692 3211 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8693 3212 | .await
|
8694 3213 | .expect("unable to extract body to bytes");
|
8695 3214 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8696 3215 | &body,
|
8697 - | "{\"ListOfLists\":[[\"abc\",\"mno\",\"xyz\"],[\"hjk\",\"qrs\",\"tuv\"]]}",
|
3216 + | "{\n \"floatValue\": \"-Infinity\",\n \"doubleValue\": \"-Infinity\"\n}",
|
8698 3217 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8699 3218 | ));
|
8700 3219 | }
|
8701 - | /// Parses list of structure shapes
|
8702 - | /// Test ID: parses_list_of_structure_shapes
|
8703 - | #[::tokio::test]
|
8704 - | async fn parses_list_of_structure_shapes_response() {
|
8705 - | let output = crate::output::KitchenSinkOperationOutput {
|
8706 - | list_of_structs: ::std::option::Option::Some(vec![
|
8707 - | crate::model::SimpleStruct {
|
8708 - | value: ::std::option::Option::Some("value-1".to_owned()),
|
8709 - | },
|
8710 - | crate::model::SimpleStruct {
|
8711 - | value: ::std::option::Option::Some("value-2".to_owned()),
|
8712 - | },
|
8713 - | ]),
|
8714 - | blob: ::std::option::Option::None,
|
8715 - | boolean: ::std::option::Option::None,
|
8716 - | double: ::std::option::Option::None,
|
8717 - | empty_struct: ::std::option::Option::None,
|
8718 - | float: ::std::option::Option::None,
|
8719 - | httpdate_timestamp: ::std::option::Option::None,
|
8720 - | integer: ::std::option::Option::None,
|
8721 - | iso8601_timestamp: ::std::option::Option::None,
|
8722 - | json_value: ::std::option::Option::None,
|
8723 - | list_of_lists: ::std::option::Option::None,
|
8724 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8725 - | list_of_strings: ::std::option::Option::None,
|
8726 - | long: ::std::option::Option::None,
|
8727 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8728 - | map_of_maps: ::std::option::Option::None,
|
8729 - | map_of_strings: ::std::option::Option::None,
|
8730 - | map_of_structs: ::std::option::Option::None,
|
8731 - | recursive_list: ::std::option::Option::None,
|
8732 - | recursive_map: ::std::option::Option::None,
|
8733 - | recursive_struct: ::std::option::Option::None,
|
8734 - | simple_struct: ::std::option::Option::None,
|
8735 - | string: ::std::option::Option::None,
|
8736 - | struct_with_json_name: ::std::option::Option::None,
|
8737 - | timestamp: ::std::option::Option::None,
|
8738 - | unix_timestamp: ::std::option::Option::None,
|
3220 + | }
|
3221 + |
|
3222 + | static CONTENT_TYPE_KITCHENSINKOPERATION: ::once_cell::sync::Lazy<::mime::Mime> =
|
3223 + | ::once_cell::sync::Lazy::new(|| {
|
3224 + | "application/x-amz-json-1.1"
|
3225 + | .parse::<::mime::Mime>()
|
3226 + | .expect("BUG: MIME parsing failed, content_type is not valid")
|
3227 + | });
|
3228 + | ::pin_project_lite::pin_project! {
|
3229 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
3230 + | /// [`KitchenSinkOperationInput`](crate::input::KitchenSinkOperationInput) using modelled bindings.
|
3231 + | pub struct KitchenSinkOperationInputFuture {
|
3232 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::KitchenSinkOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
3233 + | }
|
3234 + | }
|
3235 + |
|
3236 + | impl std::future::Future for KitchenSinkOperationInputFuture {
|
3237 + | type Output = Result<
|
3238 + | crate::input::KitchenSinkOperationInput,
|
3239 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
3240 + | >;
|
3241 + |
|
3242 + | fn poll(
|
3243 + | self: std::pin::Pin<&mut Self>,
|
3244 + | cx: &mut std::task::Context<'_>,
|
3245 + | ) -> std::task::Poll<Self::Output> {
|
3246 + | let this = self.project();
|
3247 + | this.inner.as_mut().poll(cx)
|
3248 + | }
|
3249 + | }
|
3250 + |
|
3251 + | impl<B>
|
3252 + | ::aws_smithy_http_server::request::FromRequest<
|
3253 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
3254 + | B,
|
3255 + | > for crate::input::KitchenSinkOperationInput
|
3256 + | where
|
3257 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
3258 + | B: 'static,
|
3259 + |
|
3260 + | B::Data: Send,
|
3261 + | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
3262 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
3263 + | {
|
3264 + | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
3265 + | type Future = KitchenSinkOperationInputFuture;
|
3266 + |
|
3267 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
3268 + | let fut = async move {
|
3269 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
3270 + | request.headers(),
|
3271 + | &CONTENT_TYPE_KITCHENSINKOPERATION,
|
3272 + | ) {
|
3273 + | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
3274 + | }
|
3275 + | crate::protocol_serde::shape_kitchen_sink_operation::de_kitchen_sink_operation_http_request(request)
|
3276 + | .await
|
3277 + | .map_err(Into::into)
|
8739 3278 | };
|
8740 - | use ::aws_smithy_http_server::response::IntoResponse;
|
8741 - | let http_response = output.into_response();
|
8742 - | ::pretty_assertions::assert_eq!(
|
8743 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8744 - | http_response.status()
|
3279 + | use ::futures_util::future::TryFutureExt;
|
3280 + | let fut = fut.map_err(
|
3281 + | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
3282 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
3283 + | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
3284 + | },
|
8745 3285 | );
|
8746 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8747 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8748 - | http_response.headers(),
|
8749 - | expected_headers,
|
8750 - | ));
|
8751 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3286 + | KitchenSinkOperationInputFuture {
|
3287 + | inner: Box::pin(fut),
|
3288 + | }
|
3289 + | }
|
3290 + | }
|
3291 + | impl
|
3292 + | ::aws_smithy_http_server::response::IntoResponse<
|
3293 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
3294 + | > for crate::output::KitchenSinkOperationOutput
|
3295 + | {
|
3296 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
3297 + | match crate::protocol_serde::shape_kitchen_sink_operation::ser_kitchen_sink_operation_http_response(self) {
|
3298 + | Ok(response) => response,
|
3299 + | Err(e) => {
|
3300 + | ::tracing::error!(error = %e, "failed to serialize response");
|
3301 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
3302 + | }
|
3303 + | }
|
3304 + | }
|
3305 + | }
|
3306 + | impl
|
3307 + | ::aws_smithy_http_server::response::IntoResponse<
|
3308 + | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
3309 + | > for crate::error::KitchenSinkOperationError
|
3310 + | {
|
3311 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
3312 + | match crate::protocol_serde::shape_kitchen_sink_operation::ser_kitchen_sink_operation_http_error(&self) {
|
3313 + | Ok(mut response) => {
|
3314 + | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
3315 + | response
|
3316 + | },
|
3317 + | Err(e) => {
|
3318 + | ::tracing::error!(error = %e, "failed to serialize response");
|
3319 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
3320 + | }
|
3321 + | }
|
3322 + | }
|
3323 + | }
|
3324 + |
|
3325 + | #[allow(unreachable_code, unused_variables)]
|
3326 + | #[cfg(test)]
|
3327 + | mod kitchen_sink_operation_test {
|
3328 + |
|
3329 + | /// Serializes string shapes
|
3330 + | /// Test ID: serializes_string_shapes
|
3331 + | #[::tokio::test]
|
3332 + | #[::tracing_test::traced_test]
|
3333 + | async fn serializes_string_shapes_request() {
|
3334 + | #[allow(unused_mut)]
|
3335 + | let mut http_request = http::Request::builder()
|
3336 + | .uri("/")
|
3337 + | .method("POST")
|
3338 + | .header("Content-Type", "application/x-amz-json-1.1")
|
3339 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
3340 + | .body(::aws_smithy_http_server::body::Body::from(
|
3341 + | ::bytes::Bytes::from_static("{\"String\":\"abc xyz\"}".as_bytes()),
|
3342 + | ))
|
3343 + | .unwrap();
|
3344 + | #[allow(unused_mut)]
|
3345 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3346 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
3347 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3348 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
3349 + | let sender = sender.clone();
|
3350 + | async move {
|
3351 + | let result = {
|
3352 + | use ::aws_smithy_protocol_test::FloatEquals;
|
3353 + | let expected = crate::input::KitchenSinkOperationInput {
|
3354 + | string: ::std::option::Option::Some("abc xyz".to_owned()),
|
3355 + | blob: ::std::option::Option::None,
|
3356 + | boolean: ::std::option::Option::None,
|
3357 + | double: ::std::option::Option::None,
|
3358 + | empty_struct: ::std::option::Option::None,
|
3359 + | float: ::std::option::Option::None,
|
3360 + | httpdate_timestamp: ::std::option::Option::None,
|
3361 + | integer: ::std::option::Option::None,
|
3362 + | iso8601_timestamp: ::std::option::Option::None,
|
3363 + | json_value: ::std::option::Option::None,
|
3364 + | list_of_lists: ::std::option::Option::None,
|
3365 + | list_of_maps_of_strings: ::std::option::Option::None,
|
3366 + | list_of_strings: ::std::option::Option::None,
|
3367 + | list_of_structs: ::std::option::Option::None,
|
3368 + | long: ::std::option::Option::None,
|
3369 + | map_of_lists_of_strings: ::std::option::Option::None,
|
3370 + | map_of_maps: ::std::option::Option::None,
|
3371 + | map_of_strings: ::std::option::Option::None,
|
3372 + | map_of_structs: ::std::option::Option::None,
|
3373 + | recursive_list: ::std::option::Option::None,
|
3374 + | recursive_map: ::std::option::Option::None,
|
3375 + | recursive_struct: ::std::option::Option::None,
|
3376 + | simple_struct: ::std::option::Option::None,
|
3377 + | struct_with_json_name: ::std::option::Option::None,
|
3378 + | timestamp: ::std::option::Option::None,
|
3379 + | unix_timestamp: ::std::option::Option::None,
|
3380 + | };
|
3381 + | ::pretty_assertions::assert_eq!(
|
3382 + | input.blob,
|
3383 + | expected.blob,
|
3384 + | "Unexpected value for `blob`"
|
3385 + | );
|
3386 + | ::pretty_assertions::assert_eq!(
|
3387 + | input.boolean,
|
3388 + | expected.boolean,
|
3389 + | "Unexpected value for `boolean`"
|
3390 + | );
|
3391 + | assert!(
|
3392 + | input.double.float_equals(&expected.double),
|
3393 + | "Unexpected value for `double` {:?} vs. {:?}",
|
3394 + | expected.double,
|
3395 + | input.double
|
3396 + | );
|
3397 + | ::pretty_assertions::assert_eq!(
|
3398 + | input.empty_struct,
|
3399 + | expected.empty_struct,
|
3400 + | "Unexpected value for `empty_struct`"
|
3401 + | );
|
3402 + | assert!(
|
3403 + | input.float.float_equals(&expected.float),
|
3404 + | "Unexpected value for `float` {:?} vs. {:?}",
|
3405 + | expected.float,
|
3406 + | input.float
|
3407 + | );
|
3408 + | ::pretty_assertions::assert_eq!(
|
3409 + | input.httpdate_timestamp,
|
3410 + | expected.httpdate_timestamp,
|
3411 + | "Unexpected value for `httpdate_timestamp`"
|
3412 + | );
|
3413 + | ::pretty_assertions::assert_eq!(
|
3414 + | input.integer,
|
3415 + | expected.integer,
|
3416 + | "Unexpected value for `integer`"
|
3417 + | );
|
3418 + | ::pretty_assertions::assert_eq!(
|
3419 + | input.iso8601_timestamp,
|
3420 + | expected.iso8601_timestamp,
|
3421 + | "Unexpected value for `iso8601_timestamp`"
|
3422 + | );
|
3423 + | ::pretty_assertions::assert_eq!(
|
3424 + | input.json_value,
|
3425 + | expected.json_value,
|
3426 + | "Unexpected value for `json_value`"
|
3427 + | );
|
3428 + | ::pretty_assertions::assert_eq!(
|
3429 + | input.list_of_lists,
|
3430 + | expected.list_of_lists,
|
3431 + | "Unexpected value for `list_of_lists`"
|
3432 + | );
|
3433 + | ::pretty_assertions::assert_eq!(
|
3434 + | input.list_of_maps_of_strings,
|
3435 + | expected.list_of_maps_of_strings,
|
3436 + | "Unexpected value for `list_of_maps_of_strings`"
|
3437 + | );
|
3438 + | ::pretty_assertions::assert_eq!(
|
3439 + | input.list_of_strings,
|
3440 + | expected.list_of_strings,
|
3441 + | "Unexpected value for `list_of_strings`"
|
3442 + | );
|
3443 + | ::pretty_assertions::assert_eq!(
|
3444 + | input.list_of_structs,
|
3445 + | expected.list_of_structs,
|
3446 + | "Unexpected value for `list_of_structs`"
|
3447 + | );
|
3448 + | ::pretty_assertions::assert_eq!(
|
3449 + | input.long,
|
3450 + | expected.long,
|
3451 + | "Unexpected value for `long`"
|
3452 + | );
|
3453 + | ::pretty_assertions::assert_eq!(
|
3454 + | input.map_of_lists_of_strings,
|
3455 + | expected.map_of_lists_of_strings,
|
3456 + | "Unexpected value for `map_of_lists_of_strings`"
|
3457 + | );
|
3458 + | ::pretty_assertions::assert_eq!(
|
3459 + | input.map_of_maps,
|
3460 + | expected.map_of_maps,
|
3461 + | "Unexpected value for `map_of_maps`"
|
3462 + | );
|
3463 + | ::pretty_assertions::assert_eq!(
|
3464 + | input.map_of_strings,
|
3465 + | expected.map_of_strings,
|
3466 + | "Unexpected value for `map_of_strings`"
|
3467 + | );
|
3468 + | ::pretty_assertions::assert_eq!(
|
3469 + | input.map_of_structs,
|
3470 + | expected.map_of_structs,
|
3471 + | "Unexpected value for `map_of_structs`"
|
3472 + | );
|
3473 + | ::pretty_assertions::assert_eq!(
|
3474 + | input.recursive_list,
|
3475 + | expected.recursive_list,
|
3476 + | "Unexpected value for `recursive_list`"
|
3477 + | );
|
3478 + | ::pretty_assertions::assert_eq!(
|
3479 + | input.recursive_map,
|
3480 + | expected.recursive_map,
|
3481 + | "Unexpected value for `recursive_map`"
|
3482 + | );
|
3483 + | ::pretty_assertions::assert_eq!(
|
3484 + | input.recursive_struct,
|
3485 + | expected.recursive_struct,
|
3486 + | "Unexpected value for `recursive_struct`"
|
3487 + | );
|
3488 + | ::pretty_assertions::assert_eq!(
|
3489 + | input.simple_struct,
|
3490 + | expected.simple_struct,
|
3491 + | "Unexpected value for `simple_struct`"
|
3492 + | );
|
3493 + | ::pretty_assertions::assert_eq!(
|
3494 + | input.string,
|
3495 + | expected.string,
|
3496 + | "Unexpected value for `string`"
|
3497 + | );
|
3498 + | ::pretty_assertions::assert_eq!(
|
3499 + | input.struct_with_json_name,
|
3500 + | expected.struct_with_json_name,
|
3501 + | "Unexpected value for `struct_with_json_name`"
|
3502 + | );
|
3503 + | ::pretty_assertions::assert_eq!(
|
3504 + | input.timestamp,
|
3505 + | expected.timestamp,
|
3506 + | "Unexpected value for `timestamp`"
|
3507 + | );
|
3508 + | ::pretty_assertions::assert_eq!(
|
3509 + | input.unix_timestamp,
|
3510 + | expected.unix_timestamp,
|
3511 + | "Unexpected value for `unix_timestamp`"
|
3512 + | );
|
3513 + | let response = crate::output::KitchenSinkOperationOutput {
|
3514 + | blob: ::std::option::Option::None,
|
3515 + | boolean: ::std::option::Option::None,
|
3516 + | double: ::std::option::Option::None,
|
3517 + | empty_struct: ::std::option::Option::None,
|
3518 + | float: ::std::option::Option::None,
|
3519 + | httpdate_timestamp: ::std::option::Option::None,
|
3520 + | integer: ::std::option::Option::None,
|
3521 + | iso8601_timestamp: ::std::option::Option::None,
|
3522 + | json_value: ::std::option::Option::None,
|
3523 + | list_of_lists: ::std::option::Option::None,
|
3524 + | list_of_maps_of_strings: ::std::option::Option::None,
|
3525 + | list_of_strings: ::std::option::Option::None,
|
3526 + | list_of_structs: ::std::option::Option::None,
|
3527 + | long: ::std::option::Option::None,
|
3528 + | map_of_lists_of_strings: ::std::option::Option::None,
|
3529 + | map_of_maps: ::std::option::Option::None,
|
3530 + | map_of_strings: ::std::option::Option::None,
|
3531 + | map_of_structs: ::std::option::Option::None,
|
3532 + | recursive_list: ::std::option::Option::None,
|
3533 + | recursive_map: ::std::option::Option::None,
|
3534 + | recursive_struct: ::std::option::Option::None,
|
3535 + | simple_struct: ::std::option::Option::None,
|
3536 + | string: ::std::option::Option::None,
|
3537 + | struct_with_json_name: ::std::option::Option::None,
|
3538 + | timestamp: ::std::option::Option::None,
|
3539 + | unix_timestamp: ::std::option::Option::None,
|
3540 + | };
|
3541 + | Ok(response)
|
3542 + | };
|
3543 + | sender.send(()).await.expect("receiver dropped early");
|
3544 + | result
|
3545 + | }
|
3546 + | })
|
3547 + | .build_unchecked();
|
3548 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8752 3549 | .await
|
8753 - | .expect("unable to extract body to bytes");
|
8754 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8755 - | &body,
|
8756 - | "{\"ListOfStructs\":[{\"Value\":\"value-1\"},{\"Value\":\"value-2\"}]}",
|
8757 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8758 - | ));
|
3550 + | .expect("unable to make an HTTP request");
|
3551 + | assert!(
|
3552 + | receiver.recv().await.is_some(),
|
3553 + | "we expected operation handler to be invoked but it was not entered"
|
3554 + | );
|
8759 3555 | }
|
8760 - | /// Parses list of recursive structure shapes
|
8761 - | /// Test ID: parses_list_of_recursive_structure_shapes
|
3556 + | /// Serializes string shapes with jsonvalue trait
|
3557 + | /// Test ID: serializes_string_shapes_with_jsonvalue_trait
|
8762 3558 | #[::tokio::test]
|
8763 - | async fn parses_list_of_recursive_structure_shapes_response() {
|
8764 - | let output = crate::output::KitchenSinkOperationOutput {
|
8765 - | recursive_list: ::std::option::Option::Some(vec![crate::model::KitchenSink {
|
8766 - | recursive_list: ::std::option::Option::Some(vec![crate::model::KitchenSink {
|
8767 - | recursive_list: ::std::option::Option::Some(vec![crate::model::KitchenSink {
|
8768 - | string: ::std::option::Option::Some("value".to_owned()),
|
8769 - | blob: ::std::option::Option::None,
|
8770 - | boolean: ::std::option::Option::None,
|
8771 - | double: ::std::option::Option::None,
|
8772 - | empty_struct: ::std::option::Option::None,
|
8773 - | float: ::std::option::Option::None,
|
8774 - | httpdate_timestamp: ::std::option::Option::None,
|
8775 - | integer: ::std::option::Option::None,
|
8776 - | iso8601_timestamp: ::std::option::Option::None,
|
8777 - | json_value: ::std::option::Option::None,
|
8778 - | list_of_lists: ::std::option::Option::None,
|
8779 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8780 - | list_of_strings: ::std::option::Option::None,
|
8781 - | list_of_structs: ::std::option::Option::None,
|
8782 - | long: ::std::option::Option::None,
|
8783 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8784 - | map_of_maps: ::std::option::Option::None,
|
8785 - | map_of_strings: ::std::option::Option::None,
|
8786 - | map_of_structs: ::std::option::Option::None,
|
8787 - | recursive_list: ::std::option::Option::None,
|
8788 - | recursive_map: ::std::option::Option::None,
|
8789 - | recursive_struct: ::std::option::Option::None,
|
8790 - | simple_struct: ::std::option::Option::None,
|
8791 - | struct_with_json_name: ::std::option::Option::None,
|
8792 - | timestamp: ::std::option::Option::None,
|
8793 - | unix_timestamp: ::std::option::Option::None,
|
8794 - | }]),
|
8795 - | blob: ::std::option::Option::None,
|
8796 - | boolean: ::std::option::Option::None,
|
8797 - | double: ::std::option::Option::None,
|
8798 - | empty_struct: ::std::option::Option::None,
|
8799 - | float: ::std::option::Option::None,
|
8800 - | httpdate_timestamp: ::std::option::Option::None,
|
8801 - | integer: ::std::option::Option::None,
|
8802 - | iso8601_timestamp: ::std::option::Option::None,
|
8803 - | json_value: ::std::option::Option::None,
|
8804 - | list_of_lists: ::std::option::Option::None,
|
8805 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8806 - | list_of_strings: ::std::option::Option::None,
|
8807 - | list_of_structs: ::std::option::Option::None,
|
8808 - | long: ::std::option::Option::None,
|
8809 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8810 - | map_of_maps: ::std::option::Option::None,
|
8811 - | map_of_strings: ::std::option::Option::None,
|
8812 - | map_of_structs: ::std::option::Option::None,
|
8813 - | recursive_map: ::std::option::Option::None,
|
8814 - | recursive_struct: ::std::option::Option::None,
|
8815 - | simple_struct: ::std::option::Option::None,
|
8816 - | string: ::std::option::Option::None,
|
8817 - | struct_with_json_name: ::std::option::Option::None,
|
8818 - | timestamp: ::std::option::Option::None,
|
8819 - | unix_timestamp: ::std::option::Option::None,
|
8820 - | }]),
|
8821 - | blob: ::std::option::Option::None,
|
8822 - | boolean: ::std::option::Option::None,
|
8823 - | double: ::std::option::Option::None,
|
8824 - | empty_struct: ::std::option::Option::None,
|
8825 - | float: ::std::option::Option::None,
|
8826 - | httpdate_timestamp: ::std::option::Option::None,
|
8827 - | integer: ::std::option::Option::None,
|
8828 - | iso8601_timestamp: ::std::option::Option::None,
|
8829 - | json_value: ::std::option::Option::None,
|
8830 - | list_of_lists: ::std::option::Option::None,
|
8831 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8832 - | list_of_strings: ::std::option::Option::None,
|
8833 - | list_of_structs: ::std::option::Option::None,
|
8834 - | long: ::std::option::Option::None,
|
8835 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8836 - | map_of_maps: ::std::option::Option::None,
|
8837 - | map_of_strings: ::std::option::Option::None,
|
8838 - | map_of_structs: ::std::option::Option::None,
|
8839 - | recursive_map: ::std::option::Option::None,
|
8840 - | recursive_struct: ::std::option::Option::None,
|
8841 - | simple_struct: ::std::option::Option::None,
|
8842 - | string: ::std::option::Option::None,
|
8843 - | struct_with_json_name: ::std::option::Option::None,
|
8844 - | timestamp: ::std::option::Option::None,
|
8845 - | unix_timestamp: ::std::option::Option::None,
|
8846 - | }]),
|
8847 - | blob: ::std::option::Option::None,
|
8848 - | boolean: ::std::option::Option::None,
|
8849 - | double: ::std::option::Option::None,
|
8850 - | empty_struct: ::std::option::Option::None,
|
8851 - | float: ::std::option::Option::None,
|
8852 - | httpdate_timestamp: ::std::option::Option::None,
|
8853 - | integer: ::std::option::Option::None,
|
8854 - | iso8601_timestamp: ::std::option::Option::None,
|
8855 - | json_value: ::std::option::Option::None,
|
8856 - | list_of_lists: ::std::option::Option::None,
|
8857 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8858 - | list_of_strings: ::std::option::Option::None,
|
8859 - | list_of_structs: ::std::option::Option::None,
|
8860 - | long: ::std::option::Option::None,
|
8861 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8862 - | map_of_maps: ::std::option::Option::None,
|
8863 - | map_of_strings: ::std::option::Option::None,
|
8864 - | map_of_structs: ::std::option::Option::None,
|
8865 - | recursive_map: ::std::option::Option::None,
|
8866 - | recursive_struct: ::std::option::Option::None,
|
8867 - | simple_struct: ::std::option::Option::None,
|
8868 - | string: ::std::option::Option::None,
|
8869 - | struct_with_json_name: ::std::option::Option::None,
|
8870 - | timestamp: ::std::option::Option::None,
|
8871 - | unix_timestamp: ::std::option::Option::None,
|
8872 - | };
|
8873 - | use ::aws_smithy_http_server::response::IntoResponse;
|
8874 - | let http_response = output.into_response();
|
8875 - | ::pretty_assertions::assert_eq!(
|
8876 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8877 - | http_response.status()
|
3559 + | #[::tracing_test::traced_test]
|
3560 + | async fn serializes_string_shapes_with_jsonvalue_trait_request() {
|
3561 + | #[allow(unused_mut)]
|
3562 + | let mut http_request = http::Request::builder()
|
3563 + | .uri("/")
|
3564 + | .method("POST")
|
3565 + | .header("Content-Type", "application/x-amz-json-1.1")
|
3566 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
3567 + | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{\"JsonValue\":\"{\\\"string\\\":\\\"value\\\",\\\"number\\\":1234.5,\\\"boolTrue\\\":true,\\\"boolFalse\\\":false,\\\"array\\\":[1,2,3,4],\\\"object\\\":{\\\"key\\\":\\\"value\\\"},\\\"null\\\":null}\"}".as_bytes()))).unwrap();
|
3568 + | #[allow(unused_mut)]
|
3569 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3570 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
3571 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3572 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
3573 + | let sender = sender.clone();
|
3574 + | async move {
|
3575 + | let result = { use ::aws_smithy_protocol_test::FloatEquals;
|
3576 + | let expected =
|
3577 + | crate::input::KitchenSinkOperationInput {
|
3578 + | json_value:
|
3579 + | ::std::option::Option::Some(
|
3580 + | "{\"string\":\"value\",\"number\":1234.5,\"boolTrue\":true,\"boolFalse\":false,\"array\":[1,2,3,4],\"object\":{\"key\":\"value\"},\"null\":null}".to_owned()
|
3581 + | )
|
3582 + | ,
|
3583 + | blob:
|
3584 + | ::std::option::Option::None
|
3585 + | ,
|
3586 + | boolean:
|
3587 + | ::std::option::Option::None
|
3588 + | ,
|
3589 + | double:
|
3590 + | ::std::option::Option::None
|
3591 + | ,
|
3592 + | empty_struct:
|
3593 + | ::std::option::Option::None
|
3594 + | ,
|
3595 + | float:
|
3596 + | ::std::option::Option::None
|
3597 + | ,
|
3598 + | httpdate_timestamp:
|
3599 + | ::std::option::Option::None
|
3600 + | ,
|
3601 + | integer:
|
3602 + | ::std::option::Option::None
|
3603 + | ,
|
3604 + | iso8601_timestamp:
|
3605 + | ::std::option::Option::None
|
3606 + | ,
|
3607 + | list_of_lists:
|
3608 + | ::std::option::Option::None
|
3609 + | ,
|
3610 + | list_of_maps_of_strings:
|
3611 + | ::std::option::Option::None
|
3612 + | ,
|
3613 + | list_of_strings:
|
3614 + | ::std::option::Option::None
|
3615 + | ,
|
3616 + | list_of_structs:
|
3617 + | ::std::option::Option::None
|
3618 + | ,
|
3619 + | long:
|
3620 + | ::std::option::Option::None
|
3621 + | ,
|
3622 + | map_of_lists_of_strings:
|
3623 + | ::std::option::Option::None
|
3624 + | ,
|
3625 + | map_of_maps:
|
3626 + | ::std::option::Option::None
|
3627 + | ,
|
3628 + | map_of_strings:
|
3629 + | ::std::option::Option::None
|
3630 + | ,
|
3631 + | map_of_structs:
|
3632 + | ::std::option::Option::None
|
3633 + | ,
|
3634 + | recursive_list:
|
3635 + | ::std::option::Option::None
|
3636 + | ,
|
3637 + | recursive_map:
|
3638 + | ::std::option::Option::None
|
3639 + | ,
|
3640 + | recursive_struct:
|
3641 + | ::std::option::Option::None
|
3642 + | ,
|
3643 + | simple_struct:
|
3644 + | ::std::option::Option::None
|
3645 + | ,
|
3646 + | string:
|
3647 + | ::std::option::Option::None
|
3648 + | ,
|
3649 + | struct_with_json_name:
|
3650 + | ::std::option::Option::None
|
3651 + | ,
|
3652 + | timestamp:
|
3653 + | ::std::option::Option::None
|
3654 + | ,
|
3655 + | unix_timestamp:
|
3656 + | ::std::option::Option::None
|
3657 + | ,
|
3658 + | }
|
3659 + | ;
|
3660 + | ::pretty_assertions::assert_eq!(input.blob, expected.blob, "Unexpected value for `blob`");
|
3661 + | ::pretty_assertions::assert_eq!(input.boolean, expected.boolean, "Unexpected value for `boolean`");
|
3662 + | assert!(input.double.float_equals(&expected.double),
|
3663 + | "Unexpected value for `double` {:?} vs. {:?}", expected.double, input.double);
|
3664 + | ::pretty_assertions::assert_eq!(input.empty_struct, expected.empty_struct, "Unexpected value for `empty_struct`");
|
3665 + | assert!(input.float.float_equals(&expected.float),
|
3666 + | "Unexpected value for `float` {:?} vs. {:?}", expected.float, input.float);
|
3667 + | ::pretty_assertions::assert_eq!(input.httpdate_timestamp, expected.httpdate_timestamp, "Unexpected value for `httpdate_timestamp`");
|
3668 + | ::pretty_assertions::assert_eq!(input.integer, expected.integer, "Unexpected value for `integer`");
|
3669 + | ::pretty_assertions::assert_eq!(input.iso8601_timestamp, expected.iso8601_timestamp, "Unexpected value for `iso8601_timestamp`");
|
3670 + | ::pretty_assertions::assert_eq!(input.json_value, expected.json_value, "Unexpected value for `json_value`");
|
3671 + | ::pretty_assertions::assert_eq!(input.list_of_lists, expected.list_of_lists, "Unexpected value for `list_of_lists`");
|
3672 + | ::pretty_assertions::assert_eq!(input.list_of_maps_of_strings, expected.list_of_maps_of_strings, "Unexpected value for `list_of_maps_of_strings`");
|
3673 + | ::pretty_assertions::assert_eq!(input.list_of_strings, expected.list_of_strings, "Unexpected value for `list_of_strings`");
|
3674 + | ::pretty_assertions::assert_eq!(input.list_of_structs, expected.list_of_structs, "Unexpected value for `list_of_structs`");
|
3675 + | ::pretty_assertions::assert_eq!(input.long, expected.long, "Unexpected value for `long`");
|
3676 + | ::pretty_assertions::assert_eq!(input.map_of_lists_of_strings, expected.map_of_lists_of_strings, "Unexpected value for `map_of_lists_of_strings`");
|
3677 + | ::pretty_assertions::assert_eq!(input.map_of_maps, expected.map_of_maps, "Unexpected value for `map_of_maps`");
|
3678 + | ::pretty_assertions::assert_eq!(input.map_of_strings, expected.map_of_strings, "Unexpected value for `map_of_strings`");
|
3679 + | ::pretty_assertions::assert_eq!(input.map_of_structs, expected.map_of_structs, "Unexpected value for `map_of_structs`");
|
3680 + | ::pretty_assertions::assert_eq!(input.recursive_list, expected.recursive_list, "Unexpected value for `recursive_list`");
|
3681 + | ::pretty_assertions::assert_eq!(input.recursive_map, expected.recursive_map, "Unexpected value for `recursive_map`");
|
3682 + | ::pretty_assertions::assert_eq!(input.recursive_struct, expected.recursive_struct, "Unexpected value for `recursive_struct`");
|
3683 + | ::pretty_assertions::assert_eq!(input.simple_struct, expected.simple_struct, "Unexpected value for `simple_struct`");
|
3684 + | ::pretty_assertions::assert_eq!(input.string, expected.string, "Unexpected value for `string`");
|
3685 + | ::pretty_assertions::assert_eq!(input.struct_with_json_name, expected.struct_with_json_name, "Unexpected value for `struct_with_json_name`");
|
3686 + | ::pretty_assertions::assert_eq!(input.timestamp, expected.timestamp, "Unexpected value for `timestamp`");
|
3687 + | ::pretty_assertions::assert_eq!(input.unix_timestamp, expected.unix_timestamp, "Unexpected value for `unix_timestamp`");
|
3688 + | let response =
|
3689 + | crate::output::KitchenSinkOperationOutput {
|
3690 + | blob:
|
3691 + | ::std::option::Option::None
|
3692 + | ,
|
3693 + | boolean:
|
3694 + | ::std::option::Option::None
|
3695 + | ,
|
3696 + | double:
|
3697 + | ::std::option::Option::None
|
3698 + | ,
|
3699 + | empty_struct:
|
3700 + | ::std::option::Option::None
|
3701 + | ,
|
3702 + | float:
|
3703 + | ::std::option::Option::None
|
3704 + | ,
|
3705 + | httpdate_timestamp:
|
3706 + | ::std::option::Option::None
|
3707 + | ,
|
3708 + | integer:
|
3709 + | ::std::option::Option::None
|
3710 + | ,
|
3711 + | iso8601_timestamp:
|
3712 + | ::std::option::Option::None
|
3713 + | ,
|
3714 + | json_value:
|
3715 + | ::std::option::Option::None
|
3716 + | ,
|
3717 + | list_of_lists:
|
3718 + | ::std::option::Option::None
|
3719 + | ,
|
3720 + | list_of_maps_of_strings:
|
3721 + | ::std::option::Option::None
|
3722 + | ,
|
3723 + | list_of_strings:
|
3724 + | ::std::option::Option::None
|
3725 + | ,
|
3726 + | list_of_structs:
|
3727 + | ::std::option::Option::None
|
3728 + | ,
|
3729 + | long:
|
3730 + | ::std::option::Option::None
|
3731 + | ,
|
3732 + | map_of_lists_of_strings:
|
3733 + | ::std::option::Option::None
|
3734 + | ,
|
3735 + | map_of_maps:
|
3736 + | ::std::option::Option::None
|
3737 + | ,
|
3738 + | map_of_strings:
|
3739 + | ::std::option::Option::None
|
3740 + | ,
|
3741 + | map_of_structs:
|
3742 + | ::std::option::Option::None
|
3743 + | ,
|
3744 + | recursive_list:
|
3745 + | ::std::option::Option::None
|
3746 + | ,
|
3747 + | recursive_map:
|
3748 + | ::std::option::Option::None
|
3749 + | ,
|
3750 + | recursive_struct:
|
3751 + | ::std::option::Option::None
|
3752 + | ,
|
3753 + | simple_struct:
|
3754 + | ::std::option::Option::None
|
3755 + | ,
|
3756 + | string:
|
3757 + | ::std::option::Option::None
|
3758 + | ,
|
3759 + | struct_with_json_name:
|
3760 + | ::std::option::Option::None
|
3761 + | ,
|
3762 + | timestamp:
|
3763 + | ::std::option::Option::None
|
3764 + | ,
|
3765 + | unix_timestamp:
|
3766 + | ::std::option::Option::None
|
3767 + | ,
|
3768 + | }
|
3769 + | ;
|
3770 + | Ok(response) };
|
3771 + | sender.send(()).await.expect("receiver dropped early");
|
3772 + | result
|
3773 + | }
|
3774 + | })
|
3775 + | .build_unchecked();
|
3776 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3777 + | .await
|
3778 + | .expect("unable to make an HTTP request");
|
3779 + | assert!(
|
3780 + | receiver.recv().await.is_some(),
|
3781 + | "we expected operation handler to be invoked but it was not entered"
|
3782 + | );
|
3783 + | }
|
3784 + | /// Serializes integer shapes
|
3785 + | /// Test ID: serializes_integer_shapes
|
3786 + | #[::tokio::test]
|
3787 + | #[::tracing_test::traced_test]
|
3788 + | async fn serializes_integer_shapes_request() {
|
3789 + | #[allow(unused_mut)]
|
3790 + | let mut http_request = http::Request::builder()
|
3791 + | .uri("/")
|
3792 + | .method("POST")
|
3793 + | .header("Content-Type", "application/x-amz-json-1.1")
|
3794 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
3795 + | .body(::aws_smithy_http_server::body::Body::from(
|
3796 + | ::bytes::Bytes::from_static("{\"Integer\":1234}".as_bytes()),
|
3797 + | ))
|
3798 + | .unwrap();
|
3799 + | #[allow(unused_mut)]
|
3800 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3801 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
3802 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3803 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
3804 + | let sender = sender.clone();
|
3805 + | async move {
|
3806 + | let result = {
|
3807 + | use ::aws_smithy_protocol_test::FloatEquals;
|
3808 + | let expected = crate::input::KitchenSinkOperationInput {
|
3809 + | integer: ::std::option::Option::Some(1234),
|
3810 + | blob: ::std::option::Option::None,
|
3811 + | boolean: ::std::option::Option::None,
|
3812 + | double: ::std::option::Option::None,
|
3813 + | empty_struct: ::std::option::Option::None,
|
3814 + | float: ::std::option::Option::None,
|
3815 + | httpdate_timestamp: ::std::option::Option::None,
|
3816 + | iso8601_timestamp: ::std::option::Option::None,
|
3817 + | json_value: ::std::option::Option::None,
|
3818 + | list_of_lists: ::std::option::Option::None,
|
3819 + | list_of_maps_of_strings: ::std::option::Option::None,
|
3820 + | list_of_strings: ::std::option::Option::None,
|
3821 + | list_of_structs: ::std::option::Option::None,
|
3822 + | long: ::std::option::Option::None,
|
3823 + | map_of_lists_of_strings: ::std::option::Option::None,
|
3824 + | map_of_maps: ::std::option::Option::None,
|
3825 + | map_of_strings: ::std::option::Option::None,
|
3826 + | map_of_structs: ::std::option::Option::None,
|
3827 + | recursive_list: ::std::option::Option::None,
|
3828 + | recursive_map: ::std::option::Option::None,
|
3829 + | recursive_struct: ::std::option::Option::None,
|
3830 + | simple_struct: ::std::option::Option::None,
|
3831 + | string: ::std::option::Option::None,
|
3832 + | struct_with_json_name: ::std::option::Option::None,
|
3833 + | timestamp: ::std::option::Option::None,
|
3834 + | unix_timestamp: ::std::option::Option::None,
|
3835 + | };
|
3836 + | ::pretty_assertions::assert_eq!(
|
3837 + | input.blob,
|
3838 + | expected.blob,
|
3839 + | "Unexpected value for `blob`"
|
3840 + | );
|
3841 + | ::pretty_assertions::assert_eq!(
|
3842 + | input.boolean,
|
3843 + | expected.boolean,
|
3844 + | "Unexpected value for `boolean`"
|
3845 + | );
|
3846 + | assert!(
|
3847 + | input.double.float_equals(&expected.double),
|
3848 + | "Unexpected value for `double` {:?} vs. {:?}",
|
3849 + | expected.double,
|
3850 + | input.double
|
3851 + | );
|
3852 + | ::pretty_assertions::assert_eq!(
|
3853 + | input.empty_struct,
|
3854 + | expected.empty_struct,
|
3855 + | "Unexpected value for `empty_struct`"
|
3856 + | );
|
3857 + | assert!(
|
3858 + | input.float.float_equals(&expected.float),
|
3859 + | "Unexpected value for `float` {:?} vs. {:?}",
|
3860 + | expected.float,
|
3861 + | input.float
|
3862 + | );
|
3863 + | ::pretty_assertions::assert_eq!(
|
3864 + | input.httpdate_timestamp,
|
3865 + | expected.httpdate_timestamp,
|
3866 + | "Unexpected value for `httpdate_timestamp`"
|
3867 + | );
|
3868 + | ::pretty_assertions::assert_eq!(
|
3869 + | input.integer,
|
3870 + | expected.integer,
|
3871 + | "Unexpected value for `integer`"
|
3872 + | );
|
3873 + | ::pretty_assertions::assert_eq!(
|
3874 + | input.iso8601_timestamp,
|
3875 + | expected.iso8601_timestamp,
|
3876 + | "Unexpected value for `iso8601_timestamp`"
|
3877 + | );
|
3878 + | ::pretty_assertions::assert_eq!(
|
3879 + | input.json_value,
|
3880 + | expected.json_value,
|
3881 + | "Unexpected value for `json_value`"
|
3882 + | );
|
3883 + | ::pretty_assertions::assert_eq!(
|
3884 + | input.list_of_lists,
|
3885 + | expected.list_of_lists,
|
3886 + | "Unexpected value for `list_of_lists`"
|
3887 + | );
|
3888 + | ::pretty_assertions::assert_eq!(
|
3889 + | input.list_of_maps_of_strings,
|
3890 + | expected.list_of_maps_of_strings,
|
3891 + | "Unexpected value for `list_of_maps_of_strings`"
|
3892 + | );
|
3893 + | ::pretty_assertions::assert_eq!(
|
3894 + | input.list_of_strings,
|
3895 + | expected.list_of_strings,
|
3896 + | "Unexpected value for `list_of_strings`"
|
3897 + | );
|
3898 + | ::pretty_assertions::assert_eq!(
|
3899 + | input.list_of_structs,
|
3900 + | expected.list_of_structs,
|
3901 + | "Unexpected value for `list_of_structs`"
|
3902 + | );
|
3903 + | ::pretty_assertions::assert_eq!(
|
3904 + | input.long,
|
3905 + | expected.long,
|
3906 + | "Unexpected value for `long`"
|
3907 + | );
|
3908 + | ::pretty_assertions::assert_eq!(
|
3909 + | input.map_of_lists_of_strings,
|
3910 + | expected.map_of_lists_of_strings,
|
3911 + | "Unexpected value for `map_of_lists_of_strings`"
|
3912 + | );
|
3913 + | ::pretty_assertions::assert_eq!(
|
3914 + | input.map_of_maps,
|
3915 + | expected.map_of_maps,
|
3916 + | "Unexpected value for `map_of_maps`"
|
3917 + | );
|
3918 + | ::pretty_assertions::assert_eq!(
|
3919 + | input.map_of_strings,
|
3920 + | expected.map_of_strings,
|
3921 + | "Unexpected value for `map_of_strings`"
|
3922 + | );
|
3923 + | ::pretty_assertions::assert_eq!(
|
3924 + | input.map_of_structs,
|
3925 + | expected.map_of_structs,
|
3926 + | "Unexpected value for `map_of_structs`"
|
3927 + | );
|
3928 + | ::pretty_assertions::assert_eq!(
|
3929 + | input.recursive_list,
|
3930 + | expected.recursive_list,
|
3931 + | "Unexpected value for `recursive_list`"
|
3932 + | );
|
3933 + | ::pretty_assertions::assert_eq!(
|
3934 + | input.recursive_map,
|
3935 + | expected.recursive_map,
|
3936 + | "Unexpected value for `recursive_map`"
|
3937 + | );
|
3938 + | ::pretty_assertions::assert_eq!(
|
3939 + | input.recursive_struct,
|
3940 + | expected.recursive_struct,
|
3941 + | "Unexpected value for `recursive_struct`"
|
3942 + | );
|
3943 + | ::pretty_assertions::assert_eq!(
|
3944 + | input.simple_struct,
|
3945 + | expected.simple_struct,
|
3946 + | "Unexpected value for `simple_struct`"
|
3947 + | );
|
3948 + | ::pretty_assertions::assert_eq!(
|
3949 + | input.string,
|
3950 + | expected.string,
|
3951 + | "Unexpected value for `string`"
|
3952 + | );
|
3953 + | ::pretty_assertions::assert_eq!(
|
3954 + | input.struct_with_json_name,
|
3955 + | expected.struct_with_json_name,
|
3956 + | "Unexpected value for `struct_with_json_name`"
|
3957 + | );
|
3958 + | ::pretty_assertions::assert_eq!(
|
3959 + | input.timestamp,
|
3960 + | expected.timestamp,
|
3961 + | "Unexpected value for `timestamp`"
|
3962 + | );
|
3963 + | ::pretty_assertions::assert_eq!(
|
3964 + | input.unix_timestamp,
|
3965 + | expected.unix_timestamp,
|
3966 + | "Unexpected value for `unix_timestamp`"
|
3967 + | );
|
3968 + | let response = crate::output::KitchenSinkOperationOutput {
|
3969 + | blob: ::std::option::Option::None,
|
3970 + | boolean: ::std::option::Option::None,
|
3971 + | double: ::std::option::Option::None,
|
3972 + | empty_struct: ::std::option::Option::None,
|
3973 + | float: ::std::option::Option::None,
|
3974 + | httpdate_timestamp: ::std::option::Option::None,
|
3975 + | integer: ::std::option::Option::None,
|
3976 + | iso8601_timestamp: ::std::option::Option::None,
|
3977 + | json_value: ::std::option::Option::None,
|
3978 + | list_of_lists: ::std::option::Option::None,
|
3979 + | list_of_maps_of_strings: ::std::option::Option::None,
|
3980 + | list_of_strings: ::std::option::Option::None,
|
3981 + | list_of_structs: ::std::option::Option::None,
|
3982 + | long: ::std::option::Option::None,
|
3983 + | map_of_lists_of_strings: ::std::option::Option::None,
|
3984 + | map_of_maps: ::std::option::Option::None,
|
3985 + | map_of_strings: ::std::option::Option::None,
|
3986 + | map_of_structs: ::std::option::Option::None,
|
3987 + | recursive_list: ::std::option::Option::None,
|
3988 + | recursive_map: ::std::option::Option::None,
|
3989 + | recursive_struct: ::std::option::Option::None,
|
3990 + | simple_struct: ::std::option::Option::None,
|
3991 + | string: ::std::option::Option::None,
|
3992 + | struct_with_json_name: ::std::option::Option::None,
|
3993 + | timestamp: ::std::option::Option::None,
|
3994 + | unix_timestamp: ::std::option::Option::None,
|
3995 + | };
|
3996 + | Ok(response)
|
3997 + | };
|
3998 + | sender.send(()).await.expect("receiver dropped early");
|
3999 + | result
|
4000 + | }
|
4001 + | })
|
4002 + | .build_unchecked();
|
4003 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4004 + | .await
|
4005 + | .expect("unable to make an HTTP request");
|
4006 + | assert!(
|
4007 + | receiver.recv().await.is_some(),
|
4008 + | "we expected operation handler to be invoked but it was not entered"
|
8878 4009 | );
|
8879 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8880 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8881 - | http_response.headers(),
|
8882 - | expected_headers,
|
8883 - | ));
|
8884 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4010 + | }
|
4011 + | /// Serializes long shapes
|
4012 + | /// Test ID: serializes_long_shapes
|
4013 + | #[::tokio::test]
|
4014 + | #[::tracing_test::traced_test]
|
4015 + | async fn serializes_long_shapes_request() {
|
4016 + | #[allow(unused_mut)]
|
4017 + | let mut http_request = http::Request::builder()
|
4018 + | .uri("/")
|
4019 + | .method("POST")
|
4020 + | .header("Content-Type", "application/x-amz-json-1.1")
|
4021 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
4022 + | .body(::aws_smithy_http_server::body::Body::from(
|
4023 + | ::bytes::Bytes::from_static("{\"Long\":999999999999}".as_bytes()),
|
4024 + | ))
|
4025 + | .unwrap();
|
4026 + | #[allow(unused_mut)]
|
4027 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4028 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
4029 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
4030 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
4031 + | let sender = sender.clone();
|
4032 + | async move {
|
4033 + | let result = {
|
4034 + | use ::aws_smithy_protocol_test::FloatEquals;
|
4035 + | let expected = crate::input::KitchenSinkOperationInput {
|
4036 + | long: ::std::option::Option::Some(999999999999),
|
4037 + | blob: ::std::option::Option::None,
|
4038 + | boolean: ::std::option::Option::None,
|
4039 + | double: ::std::option::Option::None,
|
4040 + | empty_struct: ::std::option::Option::None,
|
4041 + | float: ::std::option::Option::None,
|
4042 + | httpdate_timestamp: ::std::option::Option::None,
|
4043 + | integer: ::std::option::Option::None,
|
4044 + | iso8601_timestamp: ::std::option::Option::None,
|
4045 + | json_value: ::std::option::Option::None,
|
4046 + | list_of_lists: ::std::option::Option::None,
|
4047 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4048 + | list_of_strings: ::std::option::Option::None,
|
4049 + | list_of_structs: ::std::option::Option::None,
|
4050 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4051 + | map_of_maps: ::std::option::Option::None,
|
4052 + | map_of_strings: ::std::option::Option::None,
|
4053 + | map_of_structs: ::std::option::Option::None,
|
4054 + | recursive_list: ::std::option::Option::None,
|
4055 + | recursive_map: ::std::option::Option::None,
|
4056 + | recursive_struct: ::std::option::Option::None,
|
4057 + | simple_struct: ::std::option::Option::None,
|
4058 + | string: ::std::option::Option::None,
|
4059 + | struct_with_json_name: ::std::option::Option::None,
|
4060 + | timestamp: ::std::option::Option::None,
|
4061 + | unix_timestamp: ::std::option::Option::None,
|
4062 + | };
|
4063 + | ::pretty_assertions::assert_eq!(
|
4064 + | input.blob,
|
4065 + | expected.blob,
|
4066 + | "Unexpected value for `blob`"
|
4067 + | );
|
4068 + | ::pretty_assertions::assert_eq!(
|
4069 + | input.boolean,
|
4070 + | expected.boolean,
|
4071 + | "Unexpected value for `boolean`"
|
4072 + | );
|
4073 + | assert!(
|
4074 + | input.double.float_equals(&expected.double),
|
4075 + | "Unexpected value for `double` {:?} vs. {:?}",
|
4076 + | expected.double,
|
4077 + | input.double
|
4078 + | );
|
4079 + | ::pretty_assertions::assert_eq!(
|
4080 + | input.empty_struct,
|
4081 + | expected.empty_struct,
|
4082 + | "Unexpected value for `empty_struct`"
|
4083 + | );
|
4084 + | assert!(
|
4085 + | input.float.float_equals(&expected.float),
|
4086 + | "Unexpected value for `float` {:?} vs. {:?}",
|
4087 + | expected.float,
|
4088 + | input.float
|
4089 + | );
|
4090 + | ::pretty_assertions::assert_eq!(
|
4091 + | input.httpdate_timestamp,
|
4092 + | expected.httpdate_timestamp,
|
4093 + | "Unexpected value for `httpdate_timestamp`"
|
4094 + | );
|
4095 + | ::pretty_assertions::assert_eq!(
|
4096 + | input.integer,
|
4097 + | expected.integer,
|
4098 + | "Unexpected value for `integer`"
|
4099 + | );
|
4100 + | ::pretty_assertions::assert_eq!(
|
4101 + | input.iso8601_timestamp,
|
4102 + | expected.iso8601_timestamp,
|
4103 + | "Unexpected value for `iso8601_timestamp`"
|
4104 + | );
|
4105 + | ::pretty_assertions::assert_eq!(
|
4106 + | input.json_value,
|
4107 + | expected.json_value,
|
4108 + | "Unexpected value for `json_value`"
|
4109 + | );
|
4110 + | ::pretty_assertions::assert_eq!(
|
4111 + | input.list_of_lists,
|
4112 + | expected.list_of_lists,
|
4113 + | "Unexpected value for `list_of_lists`"
|
4114 + | );
|
4115 + | ::pretty_assertions::assert_eq!(
|
4116 + | input.list_of_maps_of_strings,
|
4117 + | expected.list_of_maps_of_strings,
|
4118 + | "Unexpected value for `list_of_maps_of_strings`"
|
4119 + | );
|
4120 + | ::pretty_assertions::assert_eq!(
|
4121 + | input.list_of_strings,
|
4122 + | expected.list_of_strings,
|
4123 + | "Unexpected value for `list_of_strings`"
|
4124 + | );
|
4125 + | ::pretty_assertions::assert_eq!(
|
4126 + | input.list_of_structs,
|
4127 + | expected.list_of_structs,
|
4128 + | "Unexpected value for `list_of_structs`"
|
4129 + | );
|
4130 + | ::pretty_assertions::assert_eq!(
|
4131 + | input.long,
|
4132 + | expected.long,
|
4133 + | "Unexpected value for `long`"
|
4134 + | );
|
4135 + | ::pretty_assertions::assert_eq!(
|
4136 + | input.map_of_lists_of_strings,
|
4137 + | expected.map_of_lists_of_strings,
|
4138 + | "Unexpected value for `map_of_lists_of_strings`"
|
4139 + | );
|
4140 + | ::pretty_assertions::assert_eq!(
|
4141 + | input.map_of_maps,
|
4142 + | expected.map_of_maps,
|
4143 + | "Unexpected value for `map_of_maps`"
|
4144 + | );
|
4145 + | ::pretty_assertions::assert_eq!(
|
4146 + | input.map_of_strings,
|
4147 + | expected.map_of_strings,
|
4148 + | "Unexpected value for `map_of_strings`"
|
4149 + | );
|
4150 + | ::pretty_assertions::assert_eq!(
|
4151 + | input.map_of_structs,
|
4152 + | expected.map_of_structs,
|
4153 + | "Unexpected value for `map_of_structs`"
|
4154 + | );
|
4155 + | ::pretty_assertions::assert_eq!(
|
4156 + | input.recursive_list,
|
4157 + | expected.recursive_list,
|
4158 + | "Unexpected value for `recursive_list`"
|
4159 + | );
|
4160 + | ::pretty_assertions::assert_eq!(
|
4161 + | input.recursive_map,
|
4162 + | expected.recursive_map,
|
4163 + | "Unexpected value for `recursive_map`"
|
4164 + | );
|
4165 + | ::pretty_assertions::assert_eq!(
|
4166 + | input.recursive_struct,
|
4167 + | expected.recursive_struct,
|
4168 + | "Unexpected value for `recursive_struct`"
|
4169 + | );
|
4170 + | ::pretty_assertions::assert_eq!(
|
4171 + | input.simple_struct,
|
4172 + | expected.simple_struct,
|
4173 + | "Unexpected value for `simple_struct`"
|
4174 + | );
|
4175 + | ::pretty_assertions::assert_eq!(
|
4176 + | input.string,
|
4177 + | expected.string,
|
4178 + | "Unexpected value for `string`"
|
4179 + | );
|
4180 + | ::pretty_assertions::assert_eq!(
|
4181 + | input.struct_with_json_name,
|
4182 + | expected.struct_with_json_name,
|
4183 + | "Unexpected value for `struct_with_json_name`"
|
4184 + | );
|
4185 + | ::pretty_assertions::assert_eq!(
|
4186 + | input.timestamp,
|
4187 + | expected.timestamp,
|
4188 + | "Unexpected value for `timestamp`"
|
4189 + | );
|
4190 + | ::pretty_assertions::assert_eq!(
|
4191 + | input.unix_timestamp,
|
4192 + | expected.unix_timestamp,
|
4193 + | "Unexpected value for `unix_timestamp`"
|
4194 + | );
|
4195 + | let response = crate::output::KitchenSinkOperationOutput {
|
4196 + | blob: ::std::option::Option::None,
|
4197 + | boolean: ::std::option::Option::None,
|
4198 + | double: ::std::option::Option::None,
|
4199 + | empty_struct: ::std::option::Option::None,
|
4200 + | float: ::std::option::Option::None,
|
4201 + | httpdate_timestamp: ::std::option::Option::None,
|
4202 + | integer: ::std::option::Option::None,
|
4203 + | iso8601_timestamp: ::std::option::Option::None,
|
4204 + | json_value: ::std::option::Option::None,
|
4205 + | list_of_lists: ::std::option::Option::None,
|
4206 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4207 + | list_of_strings: ::std::option::Option::None,
|
4208 + | list_of_structs: ::std::option::Option::None,
|
4209 + | long: ::std::option::Option::None,
|
4210 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4211 + | map_of_maps: ::std::option::Option::None,
|
4212 + | map_of_strings: ::std::option::Option::None,
|
4213 + | map_of_structs: ::std::option::Option::None,
|
4214 + | recursive_list: ::std::option::Option::None,
|
4215 + | recursive_map: ::std::option::Option::None,
|
4216 + | recursive_struct: ::std::option::Option::None,
|
4217 + | simple_struct: ::std::option::Option::None,
|
4218 + | string: ::std::option::Option::None,
|
4219 + | struct_with_json_name: ::std::option::Option::None,
|
4220 + | timestamp: ::std::option::Option::None,
|
4221 + | unix_timestamp: ::std::option::Option::None,
|
4222 + | };
|
4223 + | Ok(response)
|
4224 + | };
|
4225 + | sender.send(()).await.expect("receiver dropped early");
|
4226 + | result
|
4227 + | }
|
4228 + | })
|
4229 + | .build_unchecked();
|
4230 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8885 4231 | .await
|
8886 - | .expect("unable to extract body to bytes");
|
8887 - | ::aws_smithy_protocol_test::assert_ok(
|
8888 - | ::aws_smithy_protocol_test::validate_body(&body, "{\"RecursiveList\":[{\"RecursiveList\":[{\"RecursiveList\":[{\"String\":\"value\"}]}]}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4232 + | .expect("unable to make an HTTP request");
|
4233 + | assert!(
|
4234 + | receiver.recv().await.is_some(),
|
4235 + | "we expected operation handler to be invoked but it was not entered"
|
8889 4236 | );
|
8890 4237 | }
|
8891 - | /// Parses map shapes
|
8892 - | /// Test ID: parses_map_shapes
|
4238 + | /// Serializes float shapes
|
4239 + | /// Test ID: serializes_float_shapes
|
8893 4240 | #[::tokio::test]
|
8894 - | async fn parses_map_shapes_response() {
|
8895 - | let output = crate::output::KitchenSinkOperationOutput {
|
8896 - | map_of_strings: ::std::option::Option::Some({
|
8897 - | let mut ret = ::std::collections::HashMap::new();
|
8898 - | ret.insert("size".to_owned(), "large".to_owned());
|
8899 - | ret.insert("color".to_owned(), "red".to_owned());
|
8900 - | ret
|
8901 - | }),
|
8902 - | blob: ::std::option::Option::None,
|
8903 - | boolean: ::std::option::Option::None,
|
8904 - | double: ::std::option::Option::None,
|
8905 - | empty_struct: ::std::option::Option::None,
|
8906 - | float: ::std::option::Option::None,
|
8907 - | httpdate_timestamp: ::std::option::Option::None,
|
8908 - | integer: ::std::option::Option::None,
|
8909 - | iso8601_timestamp: ::std::option::Option::None,
|
8910 - | json_value: ::std::option::Option::None,
|
8911 - | list_of_lists: ::std::option::Option::None,
|
8912 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8913 - | list_of_strings: ::std::option::Option::None,
|
8914 - | list_of_structs: ::std::option::Option::None,
|
8915 - | long: ::std::option::Option::None,
|
8916 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8917 - | map_of_maps: ::std::option::Option::None,
|
8918 - | map_of_structs: ::std::option::Option::None,
|
8919 - | recursive_list: ::std::option::Option::None,
|
8920 - | recursive_map: ::std::option::Option::None,
|
8921 - | recursive_struct: ::std::option::Option::None,
|
8922 - | simple_struct: ::std::option::Option::None,
|
8923 - | string: ::std::option::Option::None,
|
8924 - | struct_with_json_name: ::std::option::Option::None,
|
8925 - | timestamp: ::std::option::Option::None,
|
8926 - | unix_timestamp: ::std::option::Option::None,
|
8927 - | };
|
8928 - | use ::aws_smithy_http_server::response::IntoResponse;
|
8929 - | let http_response = output.into_response();
|
8930 - | ::pretty_assertions::assert_eq!(
|
8931 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8932 - | http_response.status()
|
4241 + | #[::tracing_test::traced_test]
|
4242 + | async fn serializes_float_shapes_request() {
|
4243 + | #[allow(unused_mut)]
|
4244 + | let mut http_request = http::Request::builder()
|
4245 + | .uri("/")
|
4246 + | .method("POST")
|
4247 + | .header("Content-Type", "application/x-amz-json-1.1")
|
4248 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
4249 + | .body(::aws_smithy_http_server::body::Body::from(
|
4250 + | ::bytes::Bytes::from_static("{\"Float\":1234.5}".as_bytes()),
|
4251 + | ))
|
4252 + | .unwrap();
|
4253 + | #[allow(unused_mut)]
|
4254 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4255 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
4256 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
4257 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
4258 + | let sender = sender.clone();
|
4259 + | async move {
|
4260 + | let result = {
|
4261 + | use ::aws_smithy_protocol_test::FloatEquals;
|
4262 + | let expected = crate::input::KitchenSinkOperationInput {
|
4263 + | float: ::std::option::Option::Some(1234.5_f32),
|
4264 + | blob: ::std::option::Option::None,
|
4265 + | boolean: ::std::option::Option::None,
|
4266 + | double: ::std::option::Option::None,
|
4267 + | empty_struct: ::std::option::Option::None,
|
4268 + | httpdate_timestamp: ::std::option::Option::None,
|
4269 + | integer: ::std::option::Option::None,
|
4270 + | iso8601_timestamp: ::std::option::Option::None,
|
4271 + | json_value: ::std::option::Option::None,
|
4272 + | list_of_lists: ::std::option::Option::None,
|
4273 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4274 + | list_of_strings: ::std::option::Option::None,
|
4275 + | list_of_structs: ::std::option::Option::None,
|
4276 + | long: ::std::option::Option::None,
|
4277 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4278 + | map_of_maps: ::std::option::Option::None,
|
4279 + | map_of_strings: ::std::option::Option::None,
|
4280 + | map_of_structs: ::std::option::Option::None,
|
4281 + | recursive_list: ::std::option::Option::None,
|
4282 + | recursive_map: ::std::option::Option::None,
|
4283 + | recursive_struct: ::std::option::Option::None,
|
4284 + | simple_struct: ::std::option::Option::None,
|
4285 + | string: ::std::option::Option::None,
|
4286 + | struct_with_json_name: ::std::option::Option::None,
|
4287 + | timestamp: ::std::option::Option::None,
|
4288 + | unix_timestamp: ::std::option::Option::None,
|
4289 + | };
|
4290 + | ::pretty_assertions::assert_eq!(
|
4291 + | input.blob,
|
4292 + | expected.blob,
|
4293 + | "Unexpected value for `blob`"
|
4294 + | );
|
4295 + | ::pretty_assertions::assert_eq!(
|
4296 + | input.boolean,
|
4297 + | expected.boolean,
|
4298 + | "Unexpected value for `boolean`"
|
4299 + | );
|
4300 + | assert!(
|
4301 + | input.double.float_equals(&expected.double),
|
4302 + | "Unexpected value for `double` {:?} vs. {:?}",
|
4303 + | expected.double,
|
4304 + | input.double
|
4305 + | );
|
4306 + | ::pretty_assertions::assert_eq!(
|
4307 + | input.empty_struct,
|
4308 + | expected.empty_struct,
|
4309 + | "Unexpected value for `empty_struct`"
|
4310 + | );
|
4311 + | assert!(
|
4312 + | input.float.float_equals(&expected.float),
|
4313 + | "Unexpected value for `float` {:?} vs. {:?}",
|
4314 + | expected.float,
|
4315 + | input.float
|
4316 + | );
|
4317 + | ::pretty_assertions::assert_eq!(
|
4318 + | input.httpdate_timestamp,
|
4319 + | expected.httpdate_timestamp,
|
4320 + | "Unexpected value for `httpdate_timestamp`"
|
4321 + | );
|
4322 + | ::pretty_assertions::assert_eq!(
|
4323 + | input.integer,
|
4324 + | expected.integer,
|
4325 + | "Unexpected value for `integer`"
|
4326 + | );
|
4327 + | ::pretty_assertions::assert_eq!(
|
4328 + | input.iso8601_timestamp,
|
4329 + | expected.iso8601_timestamp,
|
4330 + | "Unexpected value for `iso8601_timestamp`"
|
4331 + | );
|
4332 + | ::pretty_assertions::assert_eq!(
|
4333 + | input.json_value,
|
4334 + | expected.json_value,
|
4335 + | "Unexpected value for `json_value`"
|
4336 + | );
|
4337 + | ::pretty_assertions::assert_eq!(
|
4338 + | input.list_of_lists,
|
4339 + | expected.list_of_lists,
|
4340 + | "Unexpected value for `list_of_lists`"
|
4341 + | );
|
4342 + | ::pretty_assertions::assert_eq!(
|
4343 + | input.list_of_maps_of_strings,
|
4344 + | expected.list_of_maps_of_strings,
|
4345 + | "Unexpected value for `list_of_maps_of_strings`"
|
4346 + | );
|
4347 + | ::pretty_assertions::assert_eq!(
|
4348 + | input.list_of_strings,
|
4349 + | expected.list_of_strings,
|
4350 + | "Unexpected value for `list_of_strings`"
|
4351 + | );
|
4352 + | ::pretty_assertions::assert_eq!(
|
4353 + | input.list_of_structs,
|
4354 + | expected.list_of_structs,
|
4355 + | "Unexpected value for `list_of_structs`"
|
4356 + | );
|
4357 + | ::pretty_assertions::assert_eq!(
|
4358 + | input.long,
|
4359 + | expected.long,
|
4360 + | "Unexpected value for `long`"
|
4361 + | );
|
4362 + | ::pretty_assertions::assert_eq!(
|
4363 + | input.map_of_lists_of_strings,
|
4364 + | expected.map_of_lists_of_strings,
|
4365 + | "Unexpected value for `map_of_lists_of_strings`"
|
4366 + | );
|
4367 + | ::pretty_assertions::assert_eq!(
|
4368 + | input.map_of_maps,
|
4369 + | expected.map_of_maps,
|
4370 + | "Unexpected value for `map_of_maps`"
|
4371 + | );
|
4372 + | ::pretty_assertions::assert_eq!(
|
4373 + | input.map_of_strings,
|
4374 + | expected.map_of_strings,
|
4375 + | "Unexpected value for `map_of_strings`"
|
4376 + | );
|
4377 + | ::pretty_assertions::assert_eq!(
|
4378 + | input.map_of_structs,
|
4379 + | expected.map_of_structs,
|
4380 + | "Unexpected value for `map_of_structs`"
|
4381 + | );
|
4382 + | ::pretty_assertions::assert_eq!(
|
4383 + | input.recursive_list,
|
4384 + | expected.recursive_list,
|
4385 + | "Unexpected value for `recursive_list`"
|
4386 + | );
|
4387 + | ::pretty_assertions::assert_eq!(
|
4388 + | input.recursive_map,
|
4389 + | expected.recursive_map,
|
4390 + | "Unexpected value for `recursive_map`"
|
4391 + | );
|
4392 + | ::pretty_assertions::assert_eq!(
|
4393 + | input.recursive_struct,
|
4394 + | expected.recursive_struct,
|
4395 + | "Unexpected value for `recursive_struct`"
|
4396 + | );
|
4397 + | ::pretty_assertions::assert_eq!(
|
4398 + | input.simple_struct,
|
4399 + | expected.simple_struct,
|
4400 + | "Unexpected value for `simple_struct`"
|
4401 + | );
|
4402 + | ::pretty_assertions::assert_eq!(
|
4403 + | input.string,
|
4404 + | expected.string,
|
4405 + | "Unexpected value for `string`"
|
4406 + | );
|
4407 + | ::pretty_assertions::assert_eq!(
|
4408 + | input.struct_with_json_name,
|
4409 + | expected.struct_with_json_name,
|
4410 + | "Unexpected value for `struct_with_json_name`"
|
4411 + | );
|
4412 + | ::pretty_assertions::assert_eq!(
|
4413 + | input.timestamp,
|
4414 + | expected.timestamp,
|
4415 + | "Unexpected value for `timestamp`"
|
4416 + | );
|
4417 + | ::pretty_assertions::assert_eq!(
|
4418 + | input.unix_timestamp,
|
4419 + | expected.unix_timestamp,
|
4420 + | "Unexpected value for `unix_timestamp`"
|
4421 + | );
|
4422 + | let response = crate::output::KitchenSinkOperationOutput {
|
4423 + | blob: ::std::option::Option::None,
|
4424 + | boolean: ::std::option::Option::None,
|
4425 + | double: ::std::option::Option::None,
|
4426 + | empty_struct: ::std::option::Option::None,
|
4427 + | float: ::std::option::Option::None,
|
4428 + | httpdate_timestamp: ::std::option::Option::None,
|
4429 + | integer: ::std::option::Option::None,
|
4430 + | iso8601_timestamp: ::std::option::Option::None,
|
4431 + | json_value: ::std::option::Option::None,
|
4432 + | list_of_lists: ::std::option::Option::None,
|
4433 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4434 + | list_of_strings: ::std::option::Option::None,
|
4435 + | list_of_structs: ::std::option::Option::None,
|
4436 + | long: ::std::option::Option::None,
|
4437 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4438 + | map_of_maps: ::std::option::Option::None,
|
4439 + | map_of_strings: ::std::option::Option::None,
|
4440 + | map_of_structs: ::std::option::Option::None,
|
4441 + | recursive_list: ::std::option::Option::None,
|
4442 + | recursive_map: ::std::option::Option::None,
|
4443 + | recursive_struct: ::std::option::Option::None,
|
4444 + | simple_struct: ::std::option::Option::None,
|
4445 + | string: ::std::option::Option::None,
|
4446 + | struct_with_json_name: ::std::option::Option::None,
|
4447 + | timestamp: ::std::option::Option::None,
|
4448 + | unix_timestamp: ::std::option::Option::None,
|
4449 + | };
|
4450 + | Ok(response)
|
4451 + | };
|
4452 + | sender.send(()).await.expect("receiver dropped early");
|
4453 + | result
|
4454 + | }
|
4455 + | })
|
4456 + | .build_unchecked();
|
4457 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4458 + | .await
|
4459 + | .expect("unable to make an HTTP request");
|
4460 + | assert!(
|
4461 + | receiver.recv().await.is_some(),
|
4462 + | "we expected operation handler to be invoked but it was not entered"
|
8933 4463 | );
|
8934 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8935 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8936 - | http_response.headers(),
|
8937 - | expected_headers,
|
8938 - | ));
|
8939 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4464 + | }
|
4465 + | /// Serializes double shapes
|
4466 + | /// Test ID: serializes_double_shapes
|
4467 + | #[::tokio::test]
|
4468 + | #[::tracing_test::traced_test]
|
4469 + | async fn serializes_double_shapes_request() {
|
4470 + | #[allow(unused_mut)]
|
4471 + | let mut http_request = http::Request::builder()
|
4472 + | .uri("/")
|
4473 + | .method("POST")
|
4474 + | .header("Content-Type", "application/x-amz-json-1.1")
|
4475 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
4476 + | .body(::aws_smithy_http_server::body::Body::from(
|
4477 + | ::bytes::Bytes::from_static("{\"Double\":1234.5}".as_bytes()),
|
4478 + | ))
|
4479 + | .unwrap();
|
4480 + | #[allow(unused_mut)]
|
4481 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4482 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
4483 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
4484 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
4485 + | let sender = sender.clone();
|
4486 + | async move {
|
4487 + | let result = {
|
4488 + | use ::aws_smithy_protocol_test::FloatEquals;
|
4489 + | let expected = crate::input::KitchenSinkOperationInput {
|
4490 + | double: ::std::option::Option::Some(1234.5_f64),
|
4491 + | blob: ::std::option::Option::None,
|
4492 + | boolean: ::std::option::Option::None,
|
4493 + | empty_struct: ::std::option::Option::None,
|
4494 + | float: ::std::option::Option::None,
|
4495 + | httpdate_timestamp: ::std::option::Option::None,
|
4496 + | integer: ::std::option::Option::None,
|
4497 + | iso8601_timestamp: ::std::option::Option::None,
|
4498 + | json_value: ::std::option::Option::None,
|
4499 + | list_of_lists: ::std::option::Option::None,
|
4500 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4501 + | list_of_strings: ::std::option::Option::None,
|
4502 + | list_of_structs: ::std::option::Option::None,
|
4503 + | long: ::std::option::Option::None,
|
4504 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4505 + | map_of_maps: ::std::option::Option::None,
|
4506 + | map_of_strings: ::std::option::Option::None,
|
4507 + | map_of_structs: ::std::option::Option::None,
|
4508 + | recursive_list: ::std::option::Option::None,
|
4509 + | recursive_map: ::std::option::Option::None,
|
4510 + | recursive_struct: ::std::option::Option::None,
|
4511 + | simple_struct: ::std::option::Option::None,
|
4512 + | string: ::std::option::Option::None,
|
4513 + | struct_with_json_name: ::std::option::Option::None,
|
4514 + | timestamp: ::std::option::Option::None,
|
4515 + | unix_timestamp: ::std::option::Option::None,
|
4516 + | };
|
4517 + | ::pretty_assertions::assert_eq!(
|
4518 + | input.blob,
|
4519 + | expected.blob,
|
4520 + | "Unexpected value for `blob`"
|
4521 + | );
|
4522 + | ::pretty_assertions::assert_eq!(
|
4523 + | input.boolean,
|
4524 + | expected.boolean,
|
4525 + | "Unexpected value for `boolean`"
|
4526 + | );
|
4527 + | assert!(
|
4528 + | input.double.float_equals(&expected.double),
|
4529 + | "Unexpected value for `double` {:?} vs. {:?}",
|
4530 + | expected.double,
|
4531 + | input.double
|
4532 + | );
|
4533 + | ::pretty_assertions::assert_eq!(
|
4534 + | input.empty_struct,
|
4535 + | expected.empty_struct,
|
4536 + | "Unexpected value for `empty_struct`"
|
4537 + | );
|
4538 + | assert!(
|
4539 + | input.float.float_equals(&expected.float),
|
4540 + | "Unexpected value for `float` {:?} vs. {:?}",
|
4541 + | expected.float,
|
4542 + | input.float
|
4543 + | );
|
4544 + | ::pretty_assertions::assert_eq!(
|
4545 + | input.httpdate_timestamp,
|
4546 + | expected.httpdate_timestamp,
|
4547 + | "Unexpected value for `httpdate_timestamp`"
|
4548 + | );
|
4549 + | ::pretty_assertions::assert_eq!(
|
4550 + | input.integer,
|
4551 + | expected.integer,
|
4552 + | "Unexpected value for `integer`"
|
4553 + | );
|
4554 + | ::pretty_assertions::assert_eq!(
|
4555 + | input.iso8601_timestamp,
|
4556 + | expected.iso8601_timestamp,
|
4557 + | "Unexpected value for `iso8601_timestamp`"
|
4558 + | );
|
4559 + | ::pretty_assertions::assert_eq!(
|
4560 + | input.json_value,
|
4561 + | expected.json_value,
|
4562 + | "Unexpected value for `json_value`"
|
4563 + | );
|
4564 + | ::pretty_assertions::assert_eq!(
|
4565 + | input.list_of_lists,
|
4566 + | expected.list_of_lists,
|
4567 + | "Unexpected value for `list_of_lists`"
|
4568 + | );
|
4569 + | ::pretty_assertions::assert_eq!(
|
4570 + | input.list_of_maps_of_strings,
|
4571 + | expected.list_of_maps_of_strings,
|
4572 + | "Unexpected value for `list_of_maps_of_strings`"
|
4573 + | );
|
4574 + | ::pretty_assertions::assert_eq!(
|
4575 + | input.list_of_strings,
|
4576 + | expected.list_of_strings,
|
4577 + | "Unexpected value for `list_of_strings`"
|
4578 + | );
|
4579 + | ::pretty_assertions::assert_eq!(
|
4580 + | input.list_of_structs,
|
4581 + | expected.list_of_structs,
|
4582 + | "Unexpected value for `list_of_structs`"
|
4583 + | );
|
4584 + | ::pretty_assertions::assert_eq!(
|
4585 + | input.long,
|
4586 + | expected.long,
|
4587 + | "Unexpected value for `long`"
|
4588 + | );
|
4589 + | ::pretty_assertions::assert_eq!(
|
4590 + | input.map_of_lists_of_strings,
|
4591 + | expected.map_of_lists_of_strings,
|
4592 + | "Unexpected value for `map_of_lists_of_strings`"
|
4593 + | );
|
4594 + | ::pretty_assertions::assert_eq!(
|
4595 + | input.map_of_maps,
|
4596 + | expected.map_of_maps,
|
4597 + | "Unexpected value for `map_of_maps`"
|
4598 + | );
|
4599 + | ::pretty_assertions::assert_eq!(
|
4600 + | input.map_of_strings,
|
4601 + | expected.map_of_strings,
|
4602 + | "Unexpected value for `map_of_strings`"
|
4603 + | );
|
4604 + | ::pretty_assertions::assert_eq!(
|
4605 + | input.map_of_structs,
|
4606 + | expected.map_of_structs,
|
4607 + | "Unexpected value for `map_of_structs`"
|
4608 + | );
|
4609 + | ::pretty_assertions::assert_eq!(
|
4610 + | input.recursive_list,
|
4611 + | expected.recursive_list,
|
4612 + | "Unexpected value for `recursive_list`"
|
4613 + | );
|
4614 + | ::pretty_assertions::assert_eq!(
|
4615 + | input.recursive_map,
|
4616 + | expected.recursive_map,
|
4617 + | "Unexpected value for `recursive_map`"
|
4618 + | );
|
4619 + | ::pretty_assertions::assert_eq!(
|
4620 + | input.recursive_struct,
|
4621 + | expected.recursive_struct,
|
4622 + | "Unexpected value for `recursive_struct`"
|
4623 + | );
|
4624 + | ::pretty_assertions::assert_eq!(
|
4625 + | input.simple_struct,
|
4626 + | expected.simple_struct,
|
4627 + | "Unexpected value for `simple_struct`"
|
4628 + | );
|
4629 + | ::pretty_assertions::assert_eq!(
|
4630 + | input.string,
|
4631 + | expected.string,
|
4632 + | "Unexpected value for `string`"
|
4633 + | );
|
4634 + | ::pretty_assertions::assert_eq!(
|
4635 + | input.struct_with_json_name,
|
4636 + | expected.struct_with_json_name,
|
4637 + | "Unexpected value for `struct_with_json_name`"
|
4638 + | );
|
4639 + | ::pretty_assertions::assert_eq!(
|
4640 + | input.timestamp,
|
4641 + | expected.timestamp,
|
4642 + | "Unexpected value for `timestamp`"
|
4643 + | );
|
4644 + | ::pretty_assertions::assert_eq!(
|
4645 + | input.unix_timestamp,
|
4646 + | expected.unix_timestamp,
|
4647 + | "Unexpected value for `unix_timestamp`"
|
4648 + | );
|
4649 + | let response = crate::output::KitchenSinkOperationOutput {
|
4650 + | blob: ::std::option::Option::None,
|
4651 + | boolean: ::std::option::Option::None,
|
4652 + | double: ::std::option::Option::None,
|
4653 + | empty_struct: ::std::option::Option::None,
|
4654 + | float: ::std::option::Option::None,
|
4655 + | httpdate_timestamp: ::std::option::Option::None,
|
4656 + | integer: ::std::option::Option::None,
|
4657 + | iso8601_timestamp: ::std::option::Option::None,
|
4658 + | json_value: ::std::option::Option::None,
|
4659 + | list_of_lists: ::std::option::Option::None,
|
4660 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4661 + | list_of_strings: ::std::option::Option::None,
|
4662 + | list_of_structs: ::std::option::Option::None,
|
4663 + | long: ::std::option::Option::None,
|
4664 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4665 + | map_of_maps: ::std::option::Option::None,
|
4666 + | map_of_strings: ::std::option::Option::None,
|
4667 + | map_of_structs: ::std::option::Option::None,
|
4668 + | recursive_list: ::std::option::Option::None,
|
4669 + | recursive_map: ::std::option::Option::None,
|
4670 + | recursive_struct: ::std::option::Option::None,
|
4671 + | simple_struct: ::std::option::Option::None,
|
4672 + | string: ::std::option::Option::None,
|
4673 + | struct_with_json_name: ::std::option::Option::None,
|
4674 + | timestamp: ::std::option::Option::None,
|
4675 + | unix_timestamp: ::std::option::Option::None,
|
4676 + | };
|
4677 + | Ok(response)
|
4678 + | };
|
4679 + | sender.send(()).await.expect("receiver dropped early");
|
4680 + | result
|
4681 + | }
|
4682 + | })
|
4683 + | .build_unchecked();
|
4684 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8940 4685 | .await
|
8941 - | .expect("unable to extract body to bytes");
|
8942 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8943 - | &body,
|
8944 - | "{\"MapOfStrings\":{\"size\":\"large\",\"color\":\"red\"}}",
|
8945 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8946 - | ));
|
4686 + | .expect("unable to make an HTTP request");
|
4687 + | assert!(
|
4688 + | receiver.recv().await.is_some(),
|
4689 + | "we expected operation handler to be invoked but it was not entered"
|
4690 + | );
|
8947 4691 | }
|
8948 - | /// Parses map of list shapes
|
8949 - | /// Test ID: parses_map_of_list_shapes
|
4692 + | /// Serializes blob shapes
|
4693 + | /// Test ID: serializes_blob_shapes
|
8950 4694 | #[::tokio::test]
|
8951 - | async fn parses_map_of_list_shapes_response() {
|
8952 - | let output = crate::output::KitchenSinkOperationOutput {
|
8953 - | map_of_lists_of_strings: ::std::option::Option::Some({
|
8954 - | let mut ret = ::std::collections::HashMap::new();
|
8955 - | ret.insert(
|
8956 - | "sizes".to_owned(),
|
8957 - | vec!["large".to_owned(), "small".to_owned()],
|
8958 - | );
|
8959 - | ret.insert(
|
8960 - | "colors".to_owned(),
|
8961 - | vec!["red".to_owned(), "green".to_owned()],
|
8962 - | );
|
8963 - | ret
|
8964 - | }),
|
8965 - | blob: ::std::option::Option::None,
|
8966 - | boolean: ::std::option::Option::None,
|
8967 - | double: ::std::option::Option::None,
|
8968 - | empty_struct: ::std::option::Option::None,
|
8969 - | float: ::std::option::Option::None,
|
8970 - | httpdate_timestamp: ::std::option::Option::None,
|
8971 - | integer: ::std::option::Option::None,
|
8972 - | iso8601_timestamp: ::std::option::Option::None,
|
8973 - | json_value: ::std::option::Option::None,
|
8974 - | list_of_lists: ::std::option::Option::None,
|
8975 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8976 - | list_of_strings: ::std::option::Option::None,
|
8977 - | list_of_structs: ::std::option::Option::None,
|
8978 - | long: ::std::option::Option::None,
|
8979 - | map_of_maps: ::std::option::Option::None,
|
8980 - | map_of_strings: ::std::option::Option::None,
|
8981 - | map_of_structs: ::std::option::Option::None,
|
8982 - | recursive_list: ::std::option::Option::None,
|
8983 - | recursive_map: ::std::option::Option::None,
|
8984 - | recursive_struct: ::std::option::Option::None,
|
8985 - | simple_struct: ::std::option::Option::None,
|
8986 - | string: ::std::option::Option::None,
|
8987 - | struct_with_json_name: ::std::option::Option::None,
|
8988 - | timestamp: ::std::option::Option::None,
|
8989 - | unix_timestamp: ::std::option::Option::None,
|
8990 - | };
|
8991 - | use ::aws_smithy_http_server::response::IntoResponse;
|
8992 - | let http_response = output.into_response();
|
8993 - | ::pretty_assertions::assert_eq!(
|
8994 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8995 - | http_response.status()
|
8996 - | );
|
8997 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8998 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8999 - | http_response.headers(),
|
9000 - | expected_headers,
|
9001 - | ));
|
9002 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4695 + | #[::tracing_test::traced_test]
|
4696 + | async fn serializes_blob_shapes_request() {
|
4697 + | #[allow(unused_mut)]
|
4698 + | let mut http_request = http::Request::builder()
|
4699 + | .uri("/")
|
4700 + | .method("POST")
|
4701 + | .header("Content-Type", "application/x-amz-json-1.1")
|
4702 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
4703 + | .body(::aws_smithy_http_server::body::Body::from(
|
4704 + | ::bytes::Bytes::from_static("{\"Blob\":\"YmluYXJ5LXZhbHVl\"}".as_bytes()),
|
4705 + | ))
|
4706 + | .unwrap();
|
4707 + | #[allow(unused_mut)]
|
4708 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4709 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
4710 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
4711 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
4712 + | let sender = sender.clone();
|
4713 + | async move {
|
4714 + | let result = {
|
4715 + | use ::aws_smithy_protocol_test::FloatEquals;
|
4716 + | let expected = crate::input::KitchenSinkOperationInput {
|
4717 + | blob: ::std::option::Option::Some(::aws_smithy_types::Blob::new(
|
4718 + | "binary-value",
|
4719 + | )),
|
4720 + | boolean: ::std::option::Option::None,
|
4721 + | double: ::std::option::Option::None,
|
4722 + | empty_struct: ::std::option::Option::None,
|
4723 + | float: ::std::option::Option::None,
|
4724 + | httpdate_timestamp: ::std::option::Option::None,
|
4725 + | integer: ::std::option::Option::None,
|
4726 + | iso8601_timestamp: ::std::option::Option::None,
|
4727 + | json_value: ::std::option::Option::None,
|
4728 + | list_of_lists: ::std::option::Option::None,
|
4729 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4730 + | list_of_strings: ::std::option::Option::None,
|
4731 + | list_of_structs: ::std::option::Option::None,
|
4732 + | long: ::std::option::Option::None,
|
4733 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4734 + | map_of_maps: ::std::option::Option::None,
|
4735 + | map_of_strings: ::std::option::Option::None,
|
4736 + | map_of_structs: ::std::option::Option::None,
|
4737 + | recursive_list: ::std::option::Option::None,
|
4738 + | recursive_map: ::std::option::Option::None,
|
4739 + | recursive_struct: ::std::option::Option::None,
|
4740 + | simple_struct: ::std::option::Option::None,
|
4741 + | string: ::std::option::Option::None,
|
4742 + | struct_with_json_name: ::std::option::Option::None,
|
4743 + | timestamp: ::std::option::Option::None,
|
4744 + | unix_timestamp: ::std::option::Option::None,
|
4745 + | };
|
4746 + | ::pretty_assertions::assert_eq!(
|
4747 + | input.blob,
|
4748 + | expected.blob,
|
4749 + | "Unexpected value for `blob`"
|
4750 + | );
|
4751 + | ::pretty_assertions::assert_eq!(
|
4752 + | input.boolean,
|
4753 + | expected.boolean,
|
4754 + | "Unexpected value for `boolean`"
|
4755 + | );
|
4756 + | assert!(
|
4757 + | input.double.float_equals(&expected.double),
|
4758 + | "Unexpected value for `double` {:?} vs. {:?}",
|
4759 + | expected.double,
|
4760 + | input.double
|
4761 + | );
|
4762 + | ::pretty_assertions::assert_eq!(
|
4763 + | input.empty_struct,
|
4764 + | expected.empty_struct,
|
4765 + | "Unexpected value for `empty_struct`"
|
4766 + | );
|
4767 + | assert!(
|
4768 + | input.float.float_equals(&expected.float),
|
4769 + | "Unexpected value for `float` {:?} vs. {:?}",
|
4770 + | expected.float,
|
4771 + | input.float
|
4772 + | );
|
4773 + | ::pretty_assertions::assert_eq!(
|
4774 + | input.httpdate_timestamp,
|
4775 + | expected.httpdate_timestamp,
|
4776 + | "Unexpected value for `httpdate_timestamp`"
|
4777 + | );
|
4778 + | ::pretty_assertions::assert_eq!(
|
4779 + | input.integer,
|
4780 + | expected.integer,
|
4781 + | "Unexpected value for `integer`"
|
4782 + | );
|
4783 + | ::pretty_assertions::assert_eq!(
|
4784 + | input.iso8601_timestamp,
|
4785 + | expected.iso8601_timestamp,
|
4786 + | "Unexpected value for `iso8601_timestamp`"
|
4787 + | );
|
4788 + | ::pretty_assertions::assert_eq!(
|
4789 + | input.json_value,
|
4790 + | expected.json_value,
|
4791 + | "Unexpected value for `json_value`"
|
4792 + | );
|
4793 + | ::pretty_assertions::assert_eq!(
|
4794 + | input.list_of_lists,
|
4795 + | expected.list_of_lists,
|
4796 + | "Unexpected value for `list_of_lists`"
|
4797 + | );
|
4798 + | ::pretty_assertions::assert_eq!(
|
4799 + | input.list_of_maps_of_strings,
|
4800 + | expected.list_of_maps_of_strings,
|
4801 + | "Unexpected value for `list_of_maps_of_strings`"
|
4802 + | );
|
4803 + | ::pretty_assertions::assert_eq!(
|
4804 + | input.list_of_strings,
|
4805 + | expected.list_of_strings,
|
4806 + | "Unexpected value for `list_of_strings`"
|
4807 + | );
|
4808 + | ::pretty_assertions::assert_eq!(
|
4809 + | input.list_of_structs,
|
4810 + | expected.list_of_structs,
|
4811 + | "Unexpected value for `list_of_structs`"
|
4812 + | );
|
4813 + | ::pretty_assertions::assert_eq!(
|
4814 + | input.long,
|
4815 + | expected.long,
|
4816 + | "Unexpected value for `long`"
|
4817 + | );
|
4818 + | ::pretty_assertions::assert_eq!(
|
4819 + | input.map_of_lists_of_strings,
|
4820 + | expected.map_of_lists_of_strings,
|
4821 + | "Unexpected value for `map_of_lists_of_strings`"
|
4822 + | );
|
4823 + | ::pretty_assertions::assert_eq!(
|
4824 + | input.map_of_maps,
|
4825 + | expected.map_of_maps,
|
4826 + | "Unexpected value for `map_of_maps`"
|
4827 + | );
|
4828 + | ::pretty_assertions::assert_eq!(
|
4829 + | input.map_of_strings,
|
4830 + | expected.map_of_strings,
|
4831 + | "Unexpected value for `map_of_strings`"
|
4832 + | );
|
4833 + | ::pretty_assertions::assert_eq!(
|
4834 + | input.map_of_structs,
|
4835 + | expected.map_of_structs,
|
4836 + | "Unexpected value for `map_of_structs`"
|
4837 + | );
|
4838 + | ::pretty_assertions::assert_eq!(
|
4839 + | input.recursive_list,
|
4840 + | expected.recursive_list,
|
4841 + | "Unexpected value for `recursive_list`"
|
4842 + | );
|
4843 + | ::pretty_assertions::assert_eq!(
|
4844 + | input.recursive_map,
|
4845 + | expected.recursive_map,
|
4846 + | "Unexpected value for `recursive_map`"
|
4847 + | );
|
4848 + | ::pretty_assertions::assert_eq!(
|
4849 + | input.recursive_struct,
|
4850 + | expected.recursive_struct,
|
4851 + | "Unexpected value for `recursive_struct`"
|
4852 + | );
|
4853 + | ::pretty_assertions::assert_eq!(
|
4854 + | input.simple_struct,
|
4855 + | expected.simple_struct,
|
4856 + | "Unexpected value for `simple_struct`"
|
4857 + | );
|
4858 + | ::pretty_assertions::assert_eq!(
|
4859 + | input.string,
|
4860 + | expected.string,
|
4861 + | "Unexpected value for `string`"
|
4862 + | );
|
4863 + | ::pretty_assertions::assert_eq!(
|
4864 + | input.struct_with_json_name,
|
4865 + | expected.struct_with_json_name,
|
4866 + | "Unexpected value for `struct_with_json_name`"
|
4867 + | );
|
4868 + | ::pretty_assertions::assert_eq!(
|
4869 + | input.timestamp,
|
4870 + | expected.timestamp,
|
4871 + | "Unexpected value for `timestamp`"
|
4872 + | );
|
4873 + | ::pretty_assertions::assert_eq!(
|
4874 + | input.unix_timestamp,
|
4875 + | expected.unix_timestamp,
|
4876 + | "Unexpected value for `unix_timestamp`"
|
4877 + | );
|
4878 + | let response = crate::output::KitchenSinkOperationOutput {
|
4879 + | blob: ::std::option::Option::None,
|
4880 + | boolean: ::std::option::Option::None,
|
4881 + | double: ::std::option::Option::None,
|
4882 + | empty_struct: ::std::option::Option::None,
|
4883 + | float: ::std::option::Option::None,
|
4884 + | httpdate_timestamp: ::std::option::Option::None,
|
4885 + | integer: ::std::option::Option::None,
|
4886 + | iso8601_timestamp: ::std::option::Option::None,
|
4887 + | json_value: ::std::option::Option::None,
|
4888 + | list_of_lists: ::std::option::Option::None,
|
4889 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4890 + | list_of_strings: ::std::option::Option::None,
|
4891 + | list_of_structs: ::std::option::Option::None,
|
4892 + | long: ::std::option::Option::None,
|
4893 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4894 + | map_of_maps: ::std::option::Option::None,
|
4895 + | map_of_strings: ::std::option::Option::None,
|
4896 + | map_of_structs: ::std::option::Option::None,
|
4897 + | recursive_list: ::std::option::Option::None,
|
4898 + | recursive_map: ::std::option::Option::None,
|
4899 + | recursive_struct: ::std::option::Option::None,
|
4900 + | simple_struct: ::std::option::Option::None,
|
4901 + | string: ::std::option::Option::None,
|
4902 + | struct_with_json_name: ::std::option::Option::None,
|
4903 + | timestamp: ::std::option::Option::None,
|
4904 + | unix_timestamp: ::std::option::Option::None,
|
4905 + | };
|
4906 + | Ok(response)
|
4907 + | };
|
4908 + | sender.send(()).await.expect("receiver dropped early");
|
4909 + | result
|
4910 + | }
|
4911 + | })
|
4912 + | .build_unchecked();
|
4913 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9003 4914 | .await
|
9004 - | .expect("unable to extract body to bytes");
|
9005 - | ::aws_smithy_protocol_test::assert_ok(
|
9006 - | ::aws_smithy_protocol_test::validate_body(&body, "{\"MapOfListsOfStrings\":{\"sizes\":[\"large\",\"small\"],\"colors\":[\"red\",\"green\"]}}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4915 + | .expect("unable to make an HTTP request");
|
4916 + | assert!(
|
4917 + | receiver.recv().await.is_some(),
|
4918 + | "we expected operation handler to be invoked but it was not entered"
|
9007 4919 | );
|
9008 4920 | }
|
9009 - | /// Parses map of map shapes
|
9010 - | /// Test ID: parses_map_of_map_shapes
|
4921 + | /// Serializes boolean shapes (true)
|
4922 + | /// Test ID: serializes_boolean_shapes_true
|
9011 4923 | #[::tokio::test]
|
9012 - | async fn parses_map_of_map_shapes_response() {
|
9013 - | let output = crate::output::KitchenSinkOperationOutput {
|
9014 - | map_of_maps: ::std::option::Option::Some({
|
9015 - | let mut ret = ::std::collections::HashMap::new();
|
9016 - | ret.insert("sizes".to_owned(), {
|
9017 - | let mut ret = ::std::collections::HashMap::new();
|
9018 - | ret.insert("large".to_owned(), "L".to_owned());
|
9019 - | ret.insert("medium".to_owned(), "M".to_owned());
|
9020 - | ret
|
9021 - | });
|
9022 - | ret.insert("colors".to_owned(), {
|
9023 - | let mut ret = ::std::collections::HashMap::new();
|
9024 - | ret.insert("red".to_owned(), "R".to_owned());
|
9025 - | ret.insert("blue".to_owned(), "B".to_owned());
|
9026 - | ret
|
9027 - | });
|
9028 - | ret
|
9029 - | }),
|
9030 - | blob: ::std::option::Option::None,
|
9031 - | boolean: ::std::option::Option::None,
|
9032 - | double: ::std::option::Option::None,
|
9033 - | empty_struct: ::std::option::Option::None,
|
9034 - | float: ::std::option::Option::None,
|
9035 - | httpdate_timestamp: ::std::option::Option::None,
|
9036 - | integer: ::std::option::Option::None,
|
9037 - | iso8601_timestamp: ::std::option::Option::None,
|
9038 - | json_value: ::std::option::Option::None,
|
9039 - | list_of_lists: ::std::option::Option::None,
|
9040 - | list_of_maps_of_strings: ::std::option::Option::None,
|
9041 - | list_of_strings: ::std::option::Option::None,
|
9042 - | list_of_structs: ::std::option::Option::None,
|
9043 - | long: ::std::option::Option::None,
|
9044 - | map_of_lists_of_strings: ::std::option::Option::None,
|
9045 - | map_of_strings: ::std::option::Option::None,
|
9046 - | map_of_structs: ::std::option::Option::None,
|
9047 - | recursive_list: ::std::option::Option::None,
|
9048 - | recursive_map: ::std::option::Option::None,
|
9049 - | recursive_struct: ::std::option::Option::None,
|
9050 - | simple_struct: ::std::option::Option::None,
|
9051 - | string: ::std::option::Option::None,
|
9052 - | struct_with_json_name: ::std::option::Option::None,
|
9053 - | timestamp: ::std::option::Option::None,
|
9054 - | unix_timestamp: ::std::option::Option::None,
|
9055 - | };
|
9056 - | use ::aws_smithy_http_server::response::IntoResponse;
|
9057 - | let http_response = output.into_response();
|
9058 - | ::pretty_assertions::assert_eq!(
|
9059 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
9060 - | http_response.status()
|
4924 + | #[::tracing_test::traced_test]
|
4925 + | async fn serializes_boolean_shapes_true_request() {
|
4926 + | #[allow(unused_mut)]
|
4927 + | let mut http_request = http::Request::builder()
|
4928 + | .uri("/")
|
4929 + | .method("POST")
|
4930 + | .header("Content-Type", "application/x-amz-json-1.1")
|
4931 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
4932 + | .body(::aws_smithy_http_server::body::Body::from(
|
4933 + | ::bytes::Bytes::from_static("{\"Boolean\":true}".as_bytes()),
|
4934 + | ))
|
4935 + | .unwrap();
|
4936 + | #[allow(unused_mut)]
|
4937 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4938 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
4939 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
4940 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
4941 + | let sender = sender.clone();
|
4942 + | async move {
|
4943 + | let result = {
|
4944 + | use ::aws_smithy_protocol_test::FloatEquals;
|
4945 + | let expected = crate::input::KitchenSinkOperationInput {
|
4946 + | boolean: ::std::option::Option::Some(true),
|
4947 + | blob: ::std::option::Option::None,
|
4948 + | double: ::std::option::Option::None,
|
4949 + | empty_struct: ::std::option::Option::None,
|
4950 + | float: ::std::option::Option::None,
|
4951 + | httpdate_timestamp: ::std::option::Option::None,
|
4952 + | integer: ::std::option::Option::None,
|
4953 + | iso8601_timestamp: ::std::option::Option::None,
|
4954 + | json_value: ::std::option::Option::None,
|
4955 + | list_of_lists: ::std::option::Option::None,
|
4956 + | list_of_maps_of_strings: ::std::option::Option::None,
|
4957 + | list_of_strings: ::std::option::Option::None,
|
4958 + | list_of_structs: ::std::option::Option::None,
|
4959 + | long: ::std::option::Option::None,
|
4960 + | map_of_lists_of_strings: ::std::option::Option::None,
|
4961 + | map_of_maps: ::std::option::Option::None,
|
4962 + | map_of_strings: ::std::option::Option::None,
|
4963 + | map_of_structs: ::std::option::Option::None,
|
4964 + | recursive_list: ::std::option::Option::None,
|
4965 + | recursive_map: ::std::option::Option::None,
|
4966 + | recursive_struct: ::std::option::Option::None,
|
4967 + | simple_struct: ::std::option::Option::None,
|
4968 + | string: ::std::option::Option::None,
|
4969 + | struct_with_json_name: ::std::option::Option::None,
|
4970 + | timestamp: ::std::option::Option::None,
|
4971 + | unix_timestamp: ::std::option::Option::None,
|
4972 + | };
|
4973 + | ::pretty_assertions::assert_eq!(
|
4974 + | input.blob,
|
4975 + | expected.blob,
|
4976 + | "Unexpected value for `blob`"
|
4977 + | );
|
4978 + | ::pretty_assertions::assert_eq!(
|
4979 + | input.boolean,
|
4980 + | expected.boolean,
|
4981 + | "Unexpected value for `boolean`"
|
4982 + | );
|
4983 + | assert!(
|
4984 + | input.double.float_equals(&expected.double),
|
4985 + | "Unexpected value for `double` {:?} vs. {:?}",
|
4986 + | expected.double,
|
4987 + | input.double
|
4988 + | );
|
4989 + | ::pretty_assertions::assert_eq!(
|
4990 + | input.empty_struct,
|
4991 + | expected.empty_struct,
|
4992 + | "Unexpected value for `empty_struct`"
|
4993 + | );
|
4994 + | assert!(
|
4995 + | input.float.float_equals(&expected.float),
|
4996 + | "Unexpected value for `float` {:?} vs. {:?}",
|
4997 + | expected.float,
|
4998 + | input.float
|
4999 + | );
|
5000 + | ::pretty_assertions::assert_eq!(
|
5001 + | input.httpdate_timestamp,
|
5002 + | expected.httpdate_timestamp,
|
5003 + | "Unexpected value for `httpdate_timestamp`"
|
5004 + | );
|
5005 + | ::pretty_assertions::assert_eq!(
|
5006 + | input.integer,
|
5007 + | expected.integer,
|
5008 + | "Unexpected value for `integer`"
|
5009 + | );
|
5010 + | ::pretty_assertions::assert_eq!(
|
5011 + | input.iso8601_timestamp,
|
5012 + | expected.iso8601_timestamp,
|
5013 + | "Unexpected value for `iso8601_timestamp`"
|
5014 + | );
|
5015 + | ::pretty_assertions::assert_eq!(
|
5016 + | input.json_value,
|
5017 + | expected.json_value,
|
5018 + | "Unexpected value for `json_value`"
|
5019 + | );
|
5020 + | ::pretty_assertions::assert_eq!(
|
5021 + | input.list_of_lists,
|
5022 + | expected.list_of_lists,
|
5023 + | "Unexpected value for `list_of_lists`"
|
5024 + | );
|
5025 + | ::pretty_assertions::assert_eq!(
|
5026 + | input.list_of_maps_of_strings,
|
5027 + | expected.list_of_maps_of_strings,
|
5028 + | "Unexpected value for `list_of_maps_of_strings`"
|
5029 + | );
|
5030 + | ::pretty_assertions::assert_eq!(
|
5031 + | input.list_of_strings,
|
5032 + | expected.list_of_strings,
|
5033 + | "Unexpected value for `list_of_strings`"
|
5034 + | );
|
5035 + | ::pretty_assertions::assert_eq!(
|
5036 + | input.list_of_structs,
|
5037 + | expected.list_of_structs,
|
5038 + | "Unexpected value for `list_of_structs`"
|
5039 + | );
|
5040 + | ::pretty_assertions::assert_eq!(
|
5041 + | input.long,
|
5042 + | expected.long,
|
5043 + | "Unexpected value for `long`"
|
5044 + | );
|
5045 + | ::pretty_assertions::assert_eq!(
|
5046 + | input.map_of_lists_of_strings,
|
5047 + | expected.map_of_lists_of_strings,
|
5048 + | "Unexpected value for `map_of_lists_of_strings`"
|
5049 + | );
|
5050 + | ::pretty_assertions::assert_eq!(
|
5051 + | input.map_of_maps,
|
5052 + | expected.map_of_maps,
|
5053 + | "Unexpected value for `map_of_maps`"
|
5054 + | );
|
5055 + | ::pretty_assertions::assert_eq!(
|
5056 + | input.map_of_strings,
|
5057 + | expected.map_of_strings,
|
5058 + | "Unexpected value for `map_of_strings`"
|
5059 + | );
|
5060 + | ::pretty_assertions::assert_eq!(
|
5061 + | input.map_of_structs,
|
5062 + | expected.map_of_structs,
|
5063 + | "Unexpected value for `map_of_structs`"
|
5064 + | );
|
5065 + | ::pretty_assertions::assert_eq!(
|
5066 + | input.recursive_list,
|
5067 + | expected.recursive_list,
|
5068 + | "Unexpected value for `recursive_list`"
|
5069 + | );
|
5070 + | ::pretty_assertions::assert_eq!(
|
5071 + | input.recursive_map,
|
5072 + | expected.recursive_map,
|
5073 + | "Unexpected value for `recursive_map`"
|
5074 + | );
|
5075 + | ::pretty_assertions::assert_eq!(
|
5076 + | input.recursive_struct,
|
5077 + | expected.recursive_struct,
|
5078 + | "Unexpected value for `recursive_struct`"
|
5079 + | );
|
5080 + | ::pretty_assertions::assert_eq!(
|
5081 + | input.simple_struct,
|
5082 + | expected.simple_struct,
|
5083 + | "Unexpected value for `simple_struct`"
|
5084 + | );
|
5085 + | ::pretty_assertions::assert_eq!(
|
5086 + | input.string,
|
5087 + | expected.string,
|
5088 + | "Unexpected value for `string`"
|
5089 + | );
|
5090 + | ::pretty_assertions::assert_eq!(
|
5091 + | input.struct_with_json_name,
|
5092 + | expected.struct_with_json_name,
|
5093 + | "Unexpected value for `struct_with_json_name`"
|
5094 + | );
|
5095 + | ::pretty_assertions::assert_eq!(
|
5096 + | input.timestamp,
|
5097 + | expected.timestamp,
|
5098 + | "Unexpected value for `timestamp`"
|
5099 + | );
|
5100 + | ::pretty_assertions::assert_eq!(
|
5101 + | input.unix_timestamp,
|
5102 + | expected.unix_timestamp,
|
5103 + | "Unexpected value for `unix_timestamp`"
|
5104 + | );
|
5105 + | let response = crate::output::KitchenSinkOperationOutput {
|
5106 + | blob: ::std::option::Option::None,
|
5107 + | boolean: ::std::option::Option::None,
|
5108 + | double: ::std::option::Option::None,
|
5109 + | empty_struct: ::std::option::Option::None,
|
5110 + | float: ::std::option::Option::None,
|
5111 + | httpdate_timestamp: ::std::option::Option::None,
|
5112 + | integer: ::std::option::Option::None,
|
5113 + | iso8601_timestamp: ::std::option::Option::None,
|
5114 + | json_value: ::std::option::Option::None,
|
5115 + | list_of_lists: ::std::option::Option::None,
|
5116 + | list_of_maps_of_strings: ::std::option::Option::None,
|
5117 + | list_of_strings: ::std::option::Option::None,
|
5118 + | list_of_structs: ::std::option::Option::None,
|
5119 + | long: ::std::option::Option::None,
|
5120 + | map_of_lists_of_strings: ::std::option::Option::None,
|
5121 + | map_of_maps: ::std::option::Option::None,
|
5122 + | map_of_strings: ::std::option::Option::None,
|
5123 + | map_of_structs: ::std::option::Option::None,
|
5124 + | recursive_list: ::std::option::Option::None,
|
5125 + | recursive_map: ::std::option::Option::None,
|
5126 + | recursive_struct: ::std::option::Option::None,
|
5127 + | simple_struct: ::std::option::Option::None,
|
5128 + | string: ::std::option::Option::None,
|
5129 + | struct_with_json_name: ::std::option::Option::None,
|
5130 + | timestamp: ::std::option::Option::None,
|
5131 + | unix_timestamp: ::std::option::Option::None,
|
5132 + | };
|
5133 + | Ok(response)
|
5134 + | };
|
5135 + | sender.send(()).await.expect("receiver dropped early");
|
5136 + | result
|
5137 + | }
|
5138 + | })
|
5139 + | .build_unchecked();
|
5140 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5141 + | .await
|
5142 + | .expect("unable to make an HTTP request");
|
5143 + | assert!(
|
5144 + | receiver.recv().await.is_some(),
|
5145 + | "we expected operation handler to be invoked but it was not entered"
|
9061 5146 | );
|
9062 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
9063 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9064 - | http_response.headers(),
|
9065 - | expected_headers,
|
9066 - | ));
|
9067 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5147 + | }
|
5148 + | /// Serializes boolean shapes (false)
|
5149 + | /// Test ID: serializes_boolean_shapes_false
|
5150 + | #[::tokio::test]
|
5151 + | #[::tracing_test::traced_test]
|
5152 + | async fn serializes_boolean_shapes_false_request() {
|
5153 + | #[allow(unused_mut)]
|
5154 + | let mut http_request = http::Request::builder()
|
5155 + | .uri("/")
|
5156 + | .method("POST")
|
5157 + | .header("Content-Type", "application/x-amz-json-1.1")
|
5158 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
5159 + | .body(::aws_smithy_http_server::body::Body::from(
|
5160 + | ::bytes::Bytes::from_static("{\"Boolean\":false}".as_bytes()),
|
5161 + | ))
|
5162 + | .unwrap();
|
5163 + | #[allow(unused_mut)]
|
5164 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5165 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
5166 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
5167 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
5168 + | let sender = sender.clone();
|
5169 + | async move {
|
5170 + | let result = {
|
5171 + | use ::aws_smithy_protocol_test::FloatEquals;
|
5172 + | let expected = crate::input::KitchenSinkOperationInput {
|
5173 + | boolean: ::std::option::Option::Some(false),
|
5174 + | blob: ::std::option::Option::None,
|
5175 + | double: ::std::option::Option::None,
|
5176 + | empty_struct: ::std::option::Option::None,
|
5177 + | float: ::std::option::Option::None,
|
5178 + | httpdate_timestamp: ::std::option::Option::None,
|
5179 + | integer: ::std::option::Option::None,
|
5180 + | iso8601_timestamp: ::std::option::Option::None,
|
5181 + | json_value: ::std::option::Option::None,
|
5182 + | list_of_lists: ::std::option::Option::None,
|
5183 + | list_of_maps_of_strings: ::std::option::Option::None,
|
5184 + | list_of_strings: ::std::option::Option::None,
|
5185 + | list_of_structs: ::std::option::Option::None,
|
5186 + | long: ::std::option::Option::None,
|
5187 + | map_of_lists_of_strings: ::std::option::Option::None,
|
5188 + | map_of_maps: ::std::option::Option::None,
|
5189 + | map_of_strings: ::std::option::Option::None,
|
5190 + | map_of_structs: ::std::option::Option::None,
|
5191 + | recursive_list: ::std::option::Option::None,
|
5192 + | recursive_map: ::std::option::Option::None,
|
5193 + | recursive_struct: ::std::option::Option::None,
|
5194 + | simple_struct: ::std::option::Option::None,
|
5195 + | string: ::std::option::Option::None,
|
5196 + | struct_with_json_name: ::std::option::Option::None,
|
5197 + | timestamp: ::std::option::Option::None,
|
5198 + | unix_timestamp: ::std::option::Option::None,
|
5199 + | };
|
5200 + | ::pretty_assertions::assert_eq!(
|
5201 + | input.blob,
|
5202 + | expected.blob,
|
5203 + | "Unexpected value for `blob`"
|
5204 + | );
|
5205 + | ::pretty_assertions::assert_eq!(
|
5206 + | input.boolean,
|
5207 + | expected.boolean,
|
5208 + | "Unexpected value for `boolean`"
|
5209 + | );
|
5210 + | assert!(
|
5211 + | input.double.float_equals(&expected.double),
|
5212 + | "Unexpected value for `double` {:?} vs. {:?}",
|
5213 + | expected.double,
|
5214 + | input.double
|
5215 + | );
|
5216 + | ::pretty_assertions::assert_eq!(
|
5217 + | input.empty_struct,
|
5218 + | expected.empty_struct,
|
5219 + | "Unexpected value for `empty_struct`"
|
5220 + | );
|
5221 + | assert!(
|
5222 + | input.float.float_equals(&expected.float),
|
5223 + | "Unexpected value for `float` {:?} vs. {:?}",
|
5224 + | expected.float,
|
5225 + | input.float
|
5226 + | );
|
5227 + | ::pretty_assertions::assert_eq!(
|
5228 + | input.httpdate_timestamp,
|
5229 + | expected.httpdate_timestamp,
|
5230 + | "Unexpected value for `httpdate_timestamp`"
|
5231 + | );
|
5232 + | ::pretty_assertions::assert_eq!(
|
5233 + | input.integer,
|
5234 + | expected.integer,
|
5235 + | "Unexpected value for `integer`"
|
5236 + | );
|
5237 + | ::pretty_assertions::assert_eq!(
|
5238 + | input.iso8601_timestamp,
|
5239 + | expected.iso8601_timestamp,
|
5240 + | "Unexpected value for `iso8601_timestamp`"
|
5241 + | );
|
5242 + | ::pretty_assertions::assert_eq!(
|
5243 + | input.json_value,
|
5244 + | expected.json_value,
|
5245 + | "Unexpected value for `json_value`"
|
5246 + | );
|
5247 + | ::pretty_assertions::assert_eq!(
|
5248 + | input.list_of_lists,
|
5249 + | expected.list_of_lists,
|
5250 + | "Unexpected value for `list_of_lists`"
|
5251 + | );
|
5252 + | ::pretty_assertions::assert_eq!(
|
5253 + | input.list_of_maps_of_strings,
|
5254 + | expected.list_of_maps_of_strings,
|
5255 + | "Unexpected value for `list_of_maps_of_strings`"
|
5256 + | );
|
5257 + | ::pretty_assertions::assert_eq!(
|
5258 + | input.list_of_strings,
|
5259 + | expected.list_of_strings,
|
5260 + | "Unexpected value for `list_of_strings`"
|
5261 + | );
|
5262 + | ::pretty_assertions::assert_eq!(
|
5263 + | input.list_of_structs,
|
5264 + | expected.list_of_structs,
|
5265 + | "Unexpected value for `list_of_structs`"
|
5266 + | );
|
5267 + | ::pretty_assertions::assert_eq!(
|
5268 + | input.long,
|
5269 + | expected.long,
|
5270 + | "Unexpected value for `long`"
|
5271 + | );
|
5272 + | ::pretty_assertions::assert_eq!(
|
5273 + | input.map_of_lists_of_strings,
|
5274 + | expected.map_of_lists_of_strings,
|
5275 + | "Unexpected value for `map_of_lists_of_strings`"
|
5276 + | );
|
5277 + | ::pretty_assertions::assert_eq!(
|
5278 + | input.map_of_maps,
|
5279 + | expected.map_of_maps,
|
5280 + | "Unexpected value for `map_of_maps`"
|
5281 + | );
|
5282 + | ::pretty_assertions::assert_eq!(
|
5283 + | input.map_of_strings,
|
5284 + | expected.map_of_strings,
|
5285 + | "Unexpected value for `map_of_strings`"
|
5286 + | );
|
5287 + | ::pretty_assertions::assert_eq!(
|
5288 + | input.map_of_structs,
|
5289 + | expected.map_of_structs,
|
5290 + | "Unexpected value for `map_of_structs`"
|
5291 + | );
|
5292 + | ::pretty_assertions::assert_eq!(
|
5293 + | input.recursive_list,
|
5294 + | expected.recursive_list,
|
5295 + | "Unexpected value for `recursive_list`"
|
5296 + | );
|
5297 + | ::pretty_assertions::assert_eq!(
|
5298 + | input.recursive_map,
|
5299 + | expected.recursive_map,
|
5300 + | "Unexpected value for `recursive_map`"
|
5301 + | );
|
5302 + | ::pretty_assertions::assert_eq!(
|
5303 + | input.recursive_struct,
|
5304 + | expected.recursive_struct,
|
5305 + | "Unexpected value for `recursive_struct`"
|
5306 + | );
|
5307 + | ::pretty_assertions::assert_eq!(
|
5308 + | input.simple_struct,
|
5309 + | expected.simple_struct,
|
5310 + | "Unexpected value for `simple_struct`"
|
5311 + | );
|
5312 + | ::pretty_assertions::assert_eq!(
|
5313 + | input.string,
|
5314 + | expected.string,
|
5315 + | "Unexpected value for `string`"
|
5316 + | );
|
5317 + | ::pretty_assertions::assert_eq!(
|
5318 + | input.struct_with_json_name,
|
5319 + | expected.struct_with_json_name,
|
5320 + | "Unexpected value for `struct_with_json_name`"
|
5321 + | );
|
5322 + | ::pretty_assertions::assert_eq!(
|
5323 + | input.timestamp,
|
5324 + | expected.timestamp,
|
5325 + | "Unexpected value for `timestamp`"
|
5326 + | );
|
5327 + | ::pretty_assertions::assert_eq!(
|
5328 + | input.unix_timestamp,
|
5329 + | expected.unix_timestamp,
|
5330 + | "Unexpected value for `unix_timestamp`"
|
5331 + | );
|
5332 + | let response = crate::output::KitchenSinkOperationOutput {
|
5333 + | blob: ::std::option::Option::None,
|
5334 + | boolean: ::std::option::Option::None,
|
5335 + | double: ::std::option::Option::None,
|
5336 + | empty_struct: ::std::option::Option::None,
|
5337 + | float: ::std::option::Option::None,
|
5338 + | httpdate_timestamp: ::std::option::Option::None,
|
5339 + | integer: ::std::option::Option::None,
|
5340 + | iso8601_timestamp: ::std::option::Option::None,
|
5341 + | json_value: ::std::option::Option::None,
|
5342 + | list_of_lists: ::std::option::Option::None,
|
5343 + | list_of_maps_of_strings: ::std::option::Option::None,
|
5344 + | list_of_strings: ::std::option::Option::None,
|
5345 + | list_of_structs: ::std::option::Option::None,
|
5346 + | long: ::std::option::Option::None,
|
5347 + | map_of_lists_of_strings: ::std::option::Option::None,
|
5348 + | map_of_maps: ::std::option::Option::None,
|
5349 + | map_of_strings: ::std::option::Option::None,
|
5350 + | map_of_structs: ::std::option::Option::None,
|
5351 + | recursive_list: ::std::option::Option::None,
|
5352 + | recursive_map: ::std::option::Option::None,
|
5353 + | recursive_struct: ::std::option::Option::None,
|
5354 + | simple_struct: ::std::option::Option::None,
|
5355 + | string: ::std::option::Option::None,
|
5356 + | struct_with_json_name: ::std::option::Option::None,
|
5357 + | timestamp: ::std::option::Option::None,
|
5358 + | unix_timestamp: ::std::option::Option::None,
|
5359 + | };
|
5360 + | Ok(response)
|
5361 + | };
|
5362 + | sender.send(()).await.expect("receiver dropped early");
|
5363 + | result
|
5364 + | }
|
5365 + | })
|
5366 + | .build_unchecked();
|
5367 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9068 5368 | .await
|
9069 - | .expect("unable to extract body to bytes");
|
9070 - | ::aws_smithy_protocol_test::assert_ok(
|
9071 - | ::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"))
|
5369 + | .expect("unable to make an HTTP request");
|
5370 + | assert!(
|
5371 + | receiver.recv().await.is_some(),
|
5372 + | "we expected operation handler to be invoked but it was not entered"
|
9072 5373 | );
|
9073 5374 | }
|
9074 - | /// Parses map of structure shapes
|
9075 - | /// Test ID: parses_map_of_structure_shapes
|
5375 + | /// Serializes timestamp shapes
|
5376 + | /// Test ID: serializes_timestamp_shapes
|
9076 5377 | #[::tokio::test]
|
9077 - | async fn parses_map_of_structure_shapes_response() {
|
9078 - | let output = crate::output::KitchenSinkOperationOutput {
|
9079 - | map_of_structs: ::std::option::Option::Some({
|
9080 - | let mut ret = ::std::collections::HashMap::new();
|
9081 - | ret.insert(
|
9082 - | "size".to_owned(),
|
9083 - | crate::model::SimpleStruct {
|
9084 - | value: ::std::option::Option::Some("small".to_owned()),
|
9085 - | },
|
9086 - | );
|
9087 - | ret.insert(
|
9088 - | "color".to_owned(),
|
9089 - | crate::model::SimpleStruct {
|
9090 - | value: ::std::option::Option::Some("red".to_owned()),
|
9091 - | },
|
9092 - | );
|
9093 - | ret
|
9094 - | }),
|
9095 - | blob: ::std::option::Option::None,
|
9096 - | boolean: ::std::option::Option::None,
|
9097 - | double: ::std::option::Option::None,
|
9098 - | empty_struct: ::std::option::Option::None,
|
9099 - | float: ::std::option::Option::None,
|
9100 - | httpdate_timestamp: ::std::option::Option::None,
|
9101 - | integer: ::std::option::Option::None,
|
9102 - | iso8601_timestamp: ::std::option::Option::None,
|
9103 - | json_value: ::std::option::Option::None,
|
9104 - | list_of_lists: ::std::option::Option::None,
|
9105 - | list_of_maps_of_strings: ::std::option::Option::None,
|
9106 - | list_of_strings: ::std::option::Option::None,
|
9107 - | list_of_structs: ::std::option::Option::None,
|
9108 - | long: ::std::option::Option::None,
|
9109 - | map_of_lists_of_strings: ::std::option::Option::None,
|
9110 - | map_of_maps: ::std::option::Option::None,
|
9111 - | map_of_strings: ::std::option::Option::None,
|
9112 - | recursive_list: ::std::option::Option::None,
|
9113 - | recursive_map: ::std::option::Option::None,
|
9114 - | recursive_struct: ::std::option::Option::None,
|
9115 - | simple_struct: ::std::option::Option::None,
|
9116 - | string: ::std::option::Option::None,
|
9117 - | struct_with_json_name: ::std::option::Option::None,
|
9118 - | timestamp: ::std::option::Option::None,
|
9119 - | unix_timestamp: ::std::option::Option::None,
|
9120 - | };
|
9121 - | use ::aws_smithy_http_server::response::IntoResponse;
|
9122 - | let http_response = output.into_response();
|
9123 - | ::pretty_assertions::assert_eq!(
|
9124 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
9125 - | http_response.status()
|
5378 + | #[::tracing_test::traced_test]
|
5379 + | async fn serializes_timestamp_shapes_request() {
|
5380 + | #[allow(unused_mut)]
|
5381 + | let mut http_request = http::Request::builder()
|
5382 + | .uri("/")
|
5383 + | .method("POST")
|
5384 + | .header("Content-Type", "application/x-amz-json-1.1")
|
5385 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
5386 + | .body(::aws_smithy_http_server::body::Body::from(
|
5387 + | ::bytes::Bytes::from_static("{\"Timestamp\":946845296}".as_bytes()),
|
5388 + | ))
|
5389 + | .unwrap();
|
5390 + | #[allow(unused_mut)]
|
5391 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5392 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
5393 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
5394 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
5395 + | let sender = sender.clone();
|
5396 + | async move {
|
5397 + | let result = {
|
5398 + | use ::aws_smithy_protocol_test::FloatEquals;
|
5399 + | let expected = crate::input::KitchenSinkOperationInput {
|
5400 + | timestamp: ::std::option::Option::Some(
|
5401 + | ::aws_smithy_types::DateTime::from_fractional_secs(
|
5402 + | 946845296, 0_f64,
|
5403 + | ),
|
5404 + | ),
|
5405 + | blob: ::std::option::Option::None,
|
5406 + | boolean: ::std::option::Option::None,
|
5407 + | double: ::std::option::Option::None,
|
5408 + | empty_struct: ::std::option::Option::None,
|
5409 + | float: ::std::option::Option::None,
|
5410 + | httpdate_timestamp: ::std::option::Option::None,
|
5411 + | integer: ::std::option::Option::None,
|
5412 + | iso8601_timestamp: ::std::option::Option::None,
|
5413 + | json_value: ::std::option::Option::None,
|
5414 + | list_of_lists: ::std::option::Option::None,
|
5415 + | list_of_maps_of_strings: ::std::option::Option::None,
|
5416 + | list_of_strings: ::std::option::Option::None,
|
5417 + | list_of_structs: ::std::option::Option::None,
|
5418 + | long: ::std::option::Option::None,
|
5419 + | map_of_lists_of_strings: ::std::option::Option::None,
|
5420 + | map_of_maps: ::std::option::Option::None,
|
5421 + | map_of_strings: ::std::option::Option::None,
|
5422 + | map_of_structs: ::std::option::Option::None,
|
5423 + | recursive_list: ::std::option::Option::None,
|
5424 + | recursive_map: ::std::option::Option::None,
|
5425 + | recursive_struct: ::std::option::Option::None,
|
5426 + | simple_struct: ::std::option::Option::None,
|
5427 + | string: ::std::option::Option::None,
|
5428 + | struct_with_json_name: ::std::option::Option::None,
|
5429 + | unix_timestamp: ::std::option::Option::None,
|
5430 + | };
|
5431 + | ::pretty_assertions::assert_eq!(
|
5432 + | input.blob,
|
5433 + | expected.blob,
|
5434 + | "Unexpected value for `blob`"
|
5435 + | );
|
5436 + | ::pretty_assertions::assert_eq!(
|
5437 + | input.boolean,
|
5438 + | expected.boolean,
|
5439 + | "Unexpected value for `boolean`"
|
5440 + | );
|
5441 + | assert!(
|
5442 + | input.double.float_equals(&expected.double),
|
5443 + | "Unexpected value for `double` {:?} vs. {:?}",
|
5444 + | expected.double,
|
5445 + | input.double
|
5446 + | );
|
5447 + | ::pretty_assertions::assert_eq!(
|
5448 + | input.empty_struct,
|
5449 + | expected.empty_struct,
|
5450 + | "Unexpected value for `empty_struct`"
|
5451 + | );
|
5452 + | assert!(
|
5453 + | input.float.float_equals(&expected.float),
|
5454 + | "Unexpected value for `float` {:?} vs. {:?}",
|
5455 + | expected.float,
|
5456 + | input.float
|
5457 + | );
|
5458 + | ::pretty_assertions::assert_eq!(
|
5459 + | input.httpdate_timestamp,
|
5460 + | expected.httpdate_timestamp,
|
5461 + | "Unexpected value for `httpdate_timestamp`"
|
5462 + | );
|
5463 + | ::pretty_assertions::assert_eq!(
|
5464 + | input.integer,
|
5465 + | expected.integer,
|
5466 + | "Unexpected value for `integer`"
|
5467 + | );
|
5468 + | ::pretty_assertions::assert_eq!(
|
5469 + | input.iso8601_timestamp,
|
5470 + | expected.iso8601_timestamp,
|
5471 + | "Unexpected value for `iso8601_timestamp`"
|
5472 + | );
|
5473 + | ::pretty_assertions::assert_eq!(
|
5474 + | input.json_value,
|
5475 + | expected.json_value,
|
5476 + | "Unexpected value for `json_value`"
|
5477 + | );
|
5478 + | ::pretty_assertions::assert_eq!(
|
5479 + | input.list_of_lists,
|
5480 + | expected.list_of_lists,
|
5481 + | "Unexpected value for `list_of_lists`"
|
5482 + | );
|
5483 + | ::pretty_assertions::assert_eq!(
|
5484 + | input.list_of_maps_of_strings,
|
5485 + | expected.list_of_maps_of_strings,
|
5486 + | "Unexpected value for `list_of_maps_of_strings`"
|
5487 + | );
|
5488 + | ::pretty_assertions::assert_eq!(
|
5489 + | input.list_of_strings,
|
5490 + | expected.list_of_strings,
|
5491 + | "Unexpected value for `list_of_strings`"
|
5492 + | );
|
5493 + | ::pretty_assertions::assert_eq!(
|
5494 + | input.list_of_structs,
|
5495 + | expected.list_of_structs,
|
5496 + | "Unexpected value for `list_of_structs`"
|
5497 + | );
|
5498 + | ::pretty_assertions::assert_eq!(
|
5499 + | input.long,
|
5500 + | expected.long,
|
5501 + | "Unexpected value for `long`"
|
5502 + | );
|
5503 + | ::pretty_assertions::assert_eq!(
|
5504 + | input.map_of_lists_of_strings,
|
5505 + | expected.map_of_lists_of_strings,
|
5506 + | "Unexpected value for `map_of_lists_of_strings`"
|
5507 + | );
|
5508 + | ::pretty_assertions::assert_eq!(
|
5509 + | input.map_of_maps,
|
5510 + | expected.map_of_maps,
|
5511 + | "Unexpected value for `map_of_maps`"
|
5512 + | );
|
5513 + | ::pretty_assertions::assert_eq!(
|
5514 + | input.map_of_strings,
|
5515 + | expected.map_of_strings,
|
5516 + | "Unexpected value for `map_of_strings`"
|
5517 + | );
|
5518 + | ::pretty_assertions::assert_eq!(
|
5519 + | input.map_of_structs,
|
5520 + | expected.map_of_structs,
|
5521 + | "Unexpected value for `map_of_structs`"
|
5522 + | );
|
5523 + | ::pretty_assertions::assert_eq!(
|
5524 + | input.recursive_list,
|
5525 + | expected.recursive_list,
|
5526 + | "Unexpected value for `recursive_list`"
|
5527 + | );
|
5528 + | ::pretty_assertions::assert_eq!(
|
5529 + | input.recursive_map,
|
5530 + | expected.recursive_map,
|
5531 + | "Unexpected value for `recursive_map`"
|
5532 + | );
|
5533 + | ::pretty_assertions::assert_eq!(
|
5534 + | input.recursive_struct,
|
5535 + | expected.recursive_struct,
|
5536 + | "Unexpected value for `recursive_struct`"
|
5537 + | );
|
5538 + | ::pretty_assertions::assert_eq!(
|
5539 + | input.simple_struct,
|
5540 + | expected.simple_struct,
|
5541 + | "Unexpected value for `simple_struct`"
|
5542 + | );
|
5543 + | ::pretty_assertions::assert_eq!(
|
5544 + | input.string,
|
5545 + | expected.string,
|
5546 + | "Unexpected value for `string`"
|
5547 + | );
|
5548 + | ::pretty_assertions::assert_eq!(
|
5549 + | input.struct_with_json_name,
|
5550 + | expected.struct_with_json_name,
|
5551 + | "Unexpected value for `struct_with_json_name`"
|
5552 + | );
|
5553 + | ::pretty_assertions::assert_eq!(
|
5554 + | input.timestamp,
|
5555 + | expected.timestamp,
|
5556 + | "Unexpected value for `timestamp`"
|
5557 + | );
|
5558 + | ::pretty_assertions::assert_eq!(
|
5559 + | input.unix_timestamp,
|
5560 + | expected.unix_timestamp,
|
5561 + | "Unexpected value for `unix_timestamp`"
|
5562 + | );
|
5563 + | let response = crate::output::KitchenSinkOperationOutput {
|
5564 + | blob: ::std::option::Option::None,
|
5565 + | boolean: ::std::option::Option::None,
|
5566 + | double: ::std::option::Option::None,
|
5567 + | empty_struct: ::std::option::Option::None,
|
5568 + | float: ::std::option::Option::None,
|
5569 + | httpdate_timestamp: ::std::option::Option::None,
|
5570 + | integer: ::std::option::Option::None,
|
5571 + | iso8601_timestamp: ::std::option::Option::None,
|
5572 + | json_value: ::std::option::Option::None,
|
5573 + | list_of_lists: ::std::option::Option::None,
|
5574 + | list_of_maps_of_strings: ::std::option::Option::None,
|
5575 + | list_of_strings: ::std::option::Option::None,
|
5576 + | list_of_structs: ::std::option::Option::None,
|
5577 + | long: ::std::option::Option::None,
|
5578 + | map_of_lists_of_strings: ::std::option::Option::None,
|
5579 + | map_of_maps: ::std::option::Option::None,
|
5580 + | map_of_strings: ::std::option::Option::None,
|
5581 + | map_of_structs: ::std::option::Option::None,
|
5582 + | recursive_list: ::std::option::Option::None,
|
5583 + | recursive_map: ::std::option::Option::None,
|
5584 + | recursive_struct: ::std::option::Option::None,
|
5585 + | simple_struct: ::std::option::Option::None,
|
5586 + | string: ::std::option::Option::None,
|
5587 + | struct_with_json_name: ::std::option::Option::None,
|
5588 + | timestamp: ::std::option::Option::None,
|
5589 + | unix_timestamp: ::std::option::Option::None,
|
5590 + | };
|
5591 + | Ok(response)
|
5592 + | };
|
5593 + | sender.send(()).await.expect("receiver dropped early");
|
5594 + | result
|
5595 + | }
|
5596 + | })
|
5597 + | .build_unchecked();
|
5598 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5599 + | .await
|
5600 + | .expect("unable to make an HTTP request");
|
5601 + | assert!(
|
5602 + | receiver.recv().await.is_some(),
|
5603 + | "we expected operation handler to be invoked but it was not entered"
|
9126 5604 | );
|
9127 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
9128 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9129 - | http_response.headers(),
|
9130 - | expected_headers,
|
9131 - | ));
|
9132 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5605 + | }
|
5606 + | /// Serializes timestamp shapes with iso8601 timestampFormat
|
5607 + | /// Test ID: serializes_timestamp_shapes_with_iso8601_timestampformat
|
5608 + | #[::tokio::test]
|
5609 + | #[::tracing_test::traced_test]
|
5610 + | async fn serializes_timestamp_shapes_with_iso8601_timestampformat_request() {
|
5611 + | #[allow(unused_mut)]
|
5612 + | let mut http_request = http::Request::builder()
|
5613 + | .uri("/")
|
5614 + | .method("POST")
|
5615 + | .header("Content-Type", "application/x-amz-json-1.1")
|
5616 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
5617 + | .body(::aws_smithy_http_server::body::Body::from(
|
5618 + | ::bytes::Bytes::from_static(
|
5619 + | "{\"Iso8601Timestamp\":\"2000-01-02T20:34:56Z\"}".as_bytes(),
|
5620 + | ),
|
5621 + | ))
|
5622 + | .unwrap();
|
5623 + | #[allow(unused_mut)]
|
5624 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5625 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
5626 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
5627 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
5628 + | let sender = sender.clone();
|
5629 + | async move {
|
5630 + | let result = {
|
5631 + | use ::aws_smithy_protocol_test::FloatEquals;
|
5632 + | let expected = crate::input::KitchenSinkOperationInput {
|
5633 + | iso8601_timestamp: ::std::option::Option::Some(
|
5634 + | ::aws_smithy_types::DateTime::from_fractional_secs(
|
5635 + | 946845296, 0_f64,
|
5636 + | ),
|
5637 + | ),
|
5638 + | blob: ::std::option::Option::None,
|
5639 + | boolean: ::std::option::Option::None,
|
5640 + | double: ::std::option::Option::None,
|
5641 + | empty_struct: ::std::option::Option::None,
|
5642 + | float: ::std::option::Option::None,
|
5643 + | httpdate_timestamp: ::std::option::Option::None,
|
5644 + | integer: ::std::option::Option::None,
|
5645 + | json_value: ::std::option::Option::None,
|
5646 + | list_of_lists: ::std::option::Option::None,
|
5647 + | list_of_maps_of_strings: ::std::option::Option::None,
|
5648 + | list_of_strings: ::std::option::Option::None,
|
5649 + | list_of_structs: ::std::option::Option::None,
|
5650 + | long: ::std::option::Option::None,
|
5651 + | map_of_lists_of_strings: ::std::option::Option::None,
|
5652 + | map_of_maps: ::std::option::Option::None,
|
5653 + | map_of_strings: ::std::option::Option::None,
|
5654 + | map_of_structs: ::std::option::Option::None,
|
5655 + | recursive_list: ::std::option::Option::None,
|
5656 + | recursive_map: ::std::option::Option::None,
|
5657 + | recursive_struct: ::std::option::Option::None,
|
5658 + | simple_struct: ::std::option::Option::None,
|
5659 + | string: ::std::option::Option::None,
|
5660 + | struct_with_json_name: ::std::option::Option::None,
|
5661 + | timestamp: ::std::option::Option::None,
|
5662 + | unix_timestamp: ::std::option::Option::None,
|
5663 + | };
|
5664 + | ::pretty_assertions::assert_eq!(
|
5665 + | input.blob,
|
5666 + | expected.blob,
|
5667 + | "Unexpected value for `blob`"
|
5668 + | );
|
5669 + | ::pretty_assertions::assert_eq!(
|
5670 + | input.boolean,
|
5671 + | expected.boolean,
|
5672 + | "Unexpected value for `boolean`"
|
5673 + | );
|
5674 + | assert!(
|
5675 + | input.double.float_equals(&expected.double),
|
5676 + | "Unexpected value for `double` {:?} vs. {:?}",
|
5677 + | expected.double,
|
5678 + | input.double
|
5679 + | );
|
5680 + | ::pretty_assertions::assert_eq!(
|
5681 + | input.empty_struct,
|
5682 + | expected.empty_struct,
|
5683 + | "Unexpected value for `empty_struct`"
|
5684 + | );
|
5685 + | assert!(
|
5686 + | input.float.float_equals(&expected.float),
|
5687 + | "Unexpected value for `float` {:?} vs. {:?}",
|
5688 + | expected.float,
|
5689 + | input.float
|
5690 + | );
|
5691 + | ::pretty_assertions::assert_eq!(
|
5692 + | input.httpdate_timestamp,
|
5693 + | expected.httpdate_timestamp,
|
5694 + | "Unexpected value for `httpdate_timestamp`"
|
5695 + | );
|
5696 + | ::pretty_assertions::assert_eq!(
|
5697 + | input.integer,
|
5698 + | expected.integer,
|
5699 + | "Unexpected value for `integer`"
|
5700 + | );
|
5701 + | ::pretty_assertions::assert_eq!(
|
5702 + | input.iso8601_timestamp,
|
5703 + | expected.iso8601_timestamp,
|
5704 + | "Unexpected value for `iso8601_timestamp`"
|
5705 + | );
|
5706 + | ::pretty_assertions::assert_eq!(
|
5707 + | input.json_value,
|
5708 + | expected.json_value,
|
5709 + | "Unexpected value for `json_value`"
|
5710 + | );
|
5711 + | ::pretty_assertions::assert_eq!(
|
5712 + | input.list_of_lists,
|
5713 + | expected.list_of_lists,
|
5714 + | "Unexpected value for `list_of_lists`"
|
5715 + | );
|
5716 + | ::pretty_assertions::assert_eq!(
|
5717 + | input.list_of_maps_of_strings,
|
5718 + | expected.list_of_maps_of_strings,
|
5719 + | "Unexpected value for `list_of_maps_of_strings`"
|
5720 + | );
|
5721 + | ::pretty_assertions::assert_eq!(
|
5722 + | input.list_of_strings,
|
5723 + | expected.list_of_strings,
|
5724 + | "Unexpected value for `list_of_strings`"
|
5725 + | );
|
5726 + | ::pretty_assertions::assert_eq!(
|
5727 + | input.list_of_structs,
|
5728 + | expected.list_of_structs,
|
5729 + | "Unexpected value for `list_of_structs`"
|
5730 + | );
|
5731 + | ::pretty_assertions::assert_eq!(
|
5732 + | input.long,
|
5733 + | expected.long,
|
5734 + | "Unexpected value for `long`"
|
5735 + | );
|
5736 + | ::pretty_assertions::assert_eq!(
|
5737 + | input.map_of_lists_of_strings,
|
5738 + | expected.map_of_lists_of_strings,
|
5739 + | "Unexpected value for `map_of_lists_of_strings`"
|
5740 + | );
|
5741 + | ::pretty_assertions::assert_eq!(
|
5742 + | input.map_of_maps,
|
5743 + | expected.map_of_maps,
|
5744 + | "Unexpected value for `map_of_maps`"
|
5745 + | );
|
5746 + | ::pretty_assertions::assert_eq!(
|
5747 + | input.map_of_strings,
|
5748 + | expected.map_of_strings,
|
5749 + | "Unexpected value for `map_of_strings`"
|
5750 + | );
|
5751 + | ::pretty_assertions::assert_eq!(
|
5752 + | input.map_of_structs,
|
5753 + | expected.map_of_structs,
|
5754 + | "Unexpected value for `map_of_structs`"
|
5755 + | );
|
5756 + | ::pretty_assertions::assert_eq!(
|
5757 + | input.recursive_list,
|
5758 + | expected.recursive_list,
|
5759 + | "Unexpected value for `recursive_list`"
|
5760 + | );
|
5761 + | ::pretty_assertions::assert_eq!(
|
5762 + | input.recursive_map,
|
5763 + | expected.recursive_map,
|
5764 + | "Unexpected value for `recursive_map`"
|
5765 + | );
|
5766 + | ::pretty_assertions::assert_eq!(
|
5767 + | input.recursive_struct,
|
5768 + | expected.recursive_struct,
|
5769 + | "Unexpected value for `recursive_struct`"
|
5770 + | );
|
5771 + | ::pretty_assertions::assert_eq!(
|
5772 + | input.simple_struct,
|
5773 + | expected.simple_struct,
|
5774 + | "Unexpected value for `simple_struct`"
|
5775 + | );
|
5776 + | ::pretty_assertions::assert_eq!(
|
5777 + | input.string,
|
5778 + | expected.string,
|
5779 + | "Unexpected value for `string`"
|
5780 + | );
|
5781 + | ::pretty_assertions::assert_eq!(
|
5782 + | input.struct_with_json_name,
|
5783 + | expected.struct_with_json_name,
|
5784 + | "Unexpected value for `struct_with_json_name`"
|
5785 + | );
|
5786 + | ::pretty_assertions::assert_eq!(
|
5787 + | input.timestamp,
|
5788 + | expected.timestamp,
|
5789 + | "Unexpected value for `timestamp`"
|
5790 + | );
|
5791 + | ::pretty_assertions::assert_eq!(
|
5792 + | input.unix_timestamp,
|
5793 + | expected.unix_timestamp,
|
5794 + | "Unexpected value for `unix_timestamp`"
|
5795 + | );
|
5796 + | let response = crate::output::KitchenSinkOperationOutput {
|
5797 + | blob: ::std::option::Option::None,
|
5798 + | boolean: ::std::option::Option::None,
|
5799 + | double: ::std::option::Option::None,
|
5800 + | empty_struct: ::std::option::Option::None,
|
5801 + | float: ::std::option::Option::None,
|
5802 + | httpdate_timestamp: ::std::option::Option::None,
|
5803 + | integer: ::std::option::Option::None,
|
5804 + | iso8601_timestamp: ::std::option::Option::None,
|
5805 + | json_value: ::std::option::Option::None,
|
5806 + | list_of_lists: ::std::option::Option::None,
|
5807 + | list_of_maps_of_strings: ::std::option::Option::None,
|
5808 + | list_of_strings: ::std::option::Option::None,
|
5809 + | list_of_structs: ::std::option::Option::None,
|
5810 + | long: ::std::option::Option::None,
|
5811 + | map_of_lists_of_strings: ::std::option::Option::None,
|
5812 + | map_of_maps: ::std::option::Option::None,
|
5813 + | map_of_strings: ::std::option::Option::None,
|
5814 + | map_of_structs: ::std::option::Option::None,
|
5815 + | recursive_list: ::std::option::Option::None,
|
5816 + | recursive_map: ::std::option::Option::None,
|
5817 + | recursive_struct: ::std::option::Option::None,
|
5818 + | simple_struct: ::std::option::Option::None,
|
5819 + | string: ::std::option::Option::None,
|
5820 + | struct_with_json_name: ::std::option::Option::None,
|
5821 + | timestamp: ::std::option::Option::None,
|
5822 + | unix_timestamp: ::std::option::Option::None,
|
5823 + | };
|
5824 + | Ok(response)
|
5825 + | };
|
5826 + | sender.send(()).await.expect("receiver dropped early");
|
5827 + | result
|
5828 + | }
|
5829 + | })
|
5830 + | .build_unchecked();
|
5831 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9133 5832 | .await
|
9134 - | .expect("unable to extract body to bytes");
|
9135 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
9136 - | &body,
|
9137 - | "{\"MapOfStructs\":{\"size\":{\"Value\":\"small\"},\"color\":{\"Value\":\"red\"}}}",
|
9138 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9139 - | ));
|
5833 + | .expect("unable to make an HTTP request");
|
5834 + | assert!(
|
5835 + | receiver.recv().await.is_some(),
|
5836 + | "we expected operation handler to be invoked but it was not entered"
|
5837 + | );
|
9140 5838 | }
|
9141 - | /// Parses map of recursive structure shapes
|
9142 - | /// Test ID: parses_map_of_recursive_structure_shapes
|
5839 + | /// Serializes timestamp shapes with httpdate timestampFormat
|
5840 + | /// Test ID: serializes_timestamp_shapes_with_httpdate_timestampformat
|
9143 5841 | #[::tokio::test]
|
9144 - | async fn parses_map_of_recursive_structure_shapes_response() {
|
9145 - | let output = crate::output::KitchenSinkOperationOutput {
|
9146 - | recursive_map: ::std::option::Option::Some({
|
9147 - | let mut ret = ::std::collections::HashMap::new();
|
9148 - | ret.insert(
|
9149 - | "key-1".to_owned(),
|
9150 - | crate::model::KitchenSink {
|
9151 - | recursive_map: ::std::option::Option::Some({
|
9152 - | let mut ret = ::std::collections::HashMap::new();
|
9153 - | ret.insert(
|
9154 - | "key-2".to_owned(),
|
9155 - | crate::model::KitchenSink {
|
9156 - | recursive_map: ::std::option::Option::Some({
|
9157 - | let mut ret = ::std::collections::HashMap::new();
|
9158 - | ret.insert(
|
9159 - | "key-3".to_owned(),
|
9160 - | crate::model::KitchenSink {
|
9161 - | string: ::std::option::Option::Some(
|
9162 - | "value".to_owned(),
|
9163 - | ),
|
9164 - | blob: ::std::option::Option::None,
|
9165 - | boolean: ::std::option::Option::None,
|
9166 - | double: ::std::option::Option::None,
|
9167 - | empty_struct: ::std::option::Option::None,
|
9168 - | float: ::std::option::Option::None,
|
9169 - | httpdate_timestamp: ::std::option::Option::None,
|
9170 - | integer: ::std::option::Option::None,
|
9171 - | iso8601_timestamp: ::std::option::Option::None,
|
9172 - | json_value: ::std::option::Option::None,
|
9173 - | list_of_lists: ::std::option::Option::None,
|
9174 - | list_of_maps_of_strings:
|
9175 - | ::std::option::Option::None,
|
9176 - | list_of_strings: ::std::option::Option::None,
|
9177 - | list_of_structs: ::std::option::Option::None,
|
9178 - | long: ::std::option::Option::None,
|
9179 - | map_of_lists_of_strings:
|
9180 - | ::std::option::Option::None,
|
9181 - | map_of_maps: ::std::option::Option::None,
|
9182 - | map_of_strings: ::std::option::Option::None,
|
9183 - | map_of_structs: ::std::option::Option::None,
|
9184 - | recursive_list: ::std::option::Option::None,
|
9185 - | recursive_map: ::std::option::Option::None,
|
9186 - | recursive_struct: ::std::option::Option::None,
|
9187 - | simple_struct: ::std::option::Option::None,
|
9188 - | struct_with_json_name: ::std::option::Option::None,
|
9189 - | timestamp: ::std::option::Option::None,
|
9190 - | unix_timestamp: ::std::option::Option::None,
|
9191 - | },
|
9192 - | );
|
9193 - | ret
|
9194 - | }),
|
9195 - | blob: ::std::option::Option::None,
|
9196 - | boolean: ::std::option::Option::None,
|
9197 - | double: ::std::option::Option::None,
|
9198 - | empty_struct: ::std::option::Option::None,
|
9199 - | float: ::std::option::Option::None,
|
9200 - | httpdate_timestamp: ::std::option::Option::None,
|
9201 - | integer: ::std::option::Option::None,
|
9202 - | iso8601_timestamp: ::std::option::Option::None,
|
9203 - | json_value: ::std::option::Option::None,
|
9204 - | list_of_lists: ::std::option::Option::None,
|
9205 - | list_of_maps_of_strings: ::std::option::Option::None,
|
9206 - | list_of_strings: ::std::option::Option::None,
|
9207 - | list_of_structs: ::std::option::Option::None,
|
9208 - | long: ::std::option::Option::None,
|
9209 - | map_of_lists_of_strings: ::std::option::Option::None,
|
9210 - | map_of_maps: ::std::option::Option::None,
|
9211 - | map_of_strings: ::std::option::Option::None,
|
9212 - | map_of_structs: ::std::option::Option::None,
|
9213 - | recursive_list: ::std::option::Option::None,
|
9214 - | recursive_struct: ::std::option::Option::None,
|
9215 - | simple_struct: ::std::option::Option::None,
|
9216 - | string: ::std::option::Option::None,
|
9217 - | struct_with_json_name: ::std::option::Option::None,
|
9218 - | timestamp: ::std::option::Option::None,
|
9219 - | unix_timestamp: ::std::option::Option::None,
|
9220 - | },
|
9221 - | );
|
9222 - | ret
|
9223 - | }),
|
9224 - | blob: ::std::option::Option::None,
|
9225 - | boolean: ::std::option::Option::None,
|
9226 - | double: ::std::option::Option::None,
|
9227 - | empty_struct: ::std::option::Option::None,
|
9228 - | float: ::std::option::Option::None,
|
9229 - | httpdate_timestamp: ::std::option::Option::None,
|
9230 - | integer: ::std::option::Option::None,
|
9231 - | iso8601_timestamp: ::std::option::Option::None,
|
9232 - | json_value: ::std::option::Option::None,
|
9233 - | list_of_lists: ::std::option::Option::None,
|
9234 - | list_of_maps_of_strings: ::std::option::Option::None,
|
9235 - | list_of_strings: ::std::option::Option::None,
|
9236 - | list_of_structs: ::std::option::Option::None,
|
9237 - | long: ::std::option::Option::None,
|
9238 - | map_of_lists_of_strings: ::std::option::Option::None,
|
9239 - | map_of_maps: ::std::option::Option::None,
|
9240 - | map_of_strings: ::std::option::Option::None,
|
9241 - | map_of_structs: ::std::option::Option::None,
|
9242 - | recursive_list: ::std::option::Option::None,
|
9243 - | recursive_struct: ::std::option::Option::None,
|
9244 - | simple_struct: ::std::option::Option::None,
|
9245 - | string: ::std::option::Option::None,
|
9246 - | struct_with_json_name: ::std::option::Option::None,
|
9247 - | timestamp: ::std::option::Option::None,
|
9248 - | unix_timestamp: ::std::option::Option::None,
|
9249 - | },
|
9250 - | );
|
9251 - | ret
|
9252 - | }),
|
9253 - | blob: ::std::option::Option::None,
|
9254 - | boolean: ::std::option::Option::None,
|
9255 - | double: ::std::option::Option::None,
|
9256 - | empty_struct: ::std::option::Option::None,
|
9257 - | float: ::std::option::Option::None,
|
9258 - | httpdate_timestamp: ::std::option::Option::None,
|
9259 - | integer: ::std::option::Option::None,
|
9260 - | iso8601_timestamp: ::std::option::Option::None,
|
9261 - | json_value: ::std::option::Option::None,
|
9262 - | list_of_lists: ::std::option::Option::None,
|
9263 - | list_of_maps_of_strings: ::std::option::Option::None,
|
9264 - | list_of_strings: ::std::option::Option::None,
|
9265 - | list_of_structs: ::std::option::Option::None,
|
9266 - | long: ::std::option::Option::None,
|
9267 - | map_of_lists_of_strings: ::std::option::Option::None,
|
9268 - | map_of_maps: ::std::option::Option::None,
|
9269 - | map_of_strings: ::std::option::Option::None,
|
9270 - | map_of_structs: ::std::option::Option::None,
|
9271 - | recursive_list: ::std::option::Option::None,
|
9272 - | recursive_struct: ::std::option::Option::None,
|
9273 - | simple_struct: ::std::option::Option::None,
|
9274 - | string: ::std::option::Option::None,
|
9275 - | struct_with_json_name: ::std::option::Option::None,
|
9276 - | timestamp: ::std::option::Option::None,
|
9277 - | unix_timestamp: ::std::option::Option::None,
|
9278 - | };
|
9279 - | use ::aws_smithy_http_server::response::IntoResponse;
|
9280 - | let http_response = output.into_response();
|
9281 - | ::pretty_assertions::assert_eq!(
|
9282 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
9283 - | http_response.status()
|
5842 + | #[::tracing_test::traced_test]
|
5843 + | async fn serializes_timestamp_shapes_with_httpdate_timestampformat_request() {
|
5844 + | #[allow(unused_mut)]
|
5845 + | let mut http_request = http::Request::builder()
|
5846 + | .uri("/")
|
5847 + | .method("POST")
|
5848 + | .header("Content-Type", "application/x-amz-json-1.1")
|
5849 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
5850 + | .body(::aws_smithy_http_server::body::Body::from(
|
5851 + | ::bytes::Bytes::from_static(
|
5852 + | "{\"HttpdateTimestamp\":\"Sun, 02 Jan 2000 20:34:56 GMT\"}".as_bytes(),
|
5853 + | ),
|
5854 + | ))
|
5855 + | .unwrap();
|
5856 + | #[allow(unused_mut)]
|
5857 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5858 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
5859 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
5860 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
5861 + | let sender = sender.clone();
|
5862 + | async move {
|
5863 + | let result = {
|
5864 + | use ::aws_smithy_protocol_test::FloatEquals;
|
5865 + | let expected = crate::input::KitchenSinkOperationInput {
|
5866 + | httpdate_timestamp: ::std::option::Option::Some(
|
5867 + | ::aws_smithy_types::DateTime::from_fractional_secs(
|
5868 + | 946845296, 0_f64,
|
5869 + | ),
|
5870 + | ),
|
5871 + | blob: ::std::option::Option::None,
|
5872 + | boolean: ::std::option::Option::None,
|
5873 + | double: ::std::option::Option::None,
|
5874 + | empty_struct: ::std::option::Option::None,
|
5875 + | float: ::std::option::Option::None,
|
5876 + | integer: ::std::option::Option::None,
|
5877 + | iso8601_timestamp: ::std::option::Option::None,
|
5878 + | json_value: ::std::option::Option::None,
|
5879 + | list_of_lists: ::std::option::Option::None,
|
5880 + | list_of_maps_of_strings: ::std::option::Option::None,
|
5881 + | list_of_strings: ::std::option::Option::None,
|
5882 + | list_of_structs: ::std::option::Option::None,
|
5883 + | long: ::std::option::Option::None,
|
5884 + | map_of_lists_of_strings: ::std::option::Option::None,
|
5885 + | map_of_maps: ::std::option::Option::None,
|
5886 + | map_of_strings: ::std::option::Option::None,
|
5887 + | map_of_structs: ::std::option::Option::None,
|
5888 + | recursive_list: ::std::option::Option::None,
|
5889 + | recursive_map: ::std::option::Option::None,
|
5890 + | recursive_struct: ::std::option::Option::None,
|
5891 + | simple_struct: ::std::option::Option::None,
|
5892 + | string: ::std::option::Option::None,
|
5893 + | struct_with_json_name: ::std::option::Option::None,
|
5894 + | timestamp: ::std::option::Option::None,
|
5895 + | unix_timestamp: ::std::option::Option::None,
|
5896 + | };
|
5897 + | ::pretty_assertions::assert_eq!(
|
5898 + | input.blob,
|
5899 + | expected.blob,
|
5900 + | "Unexpected value for `blob`"
|
5901 + | );
|
5902 + | ::pretty_assertions::assert_eq!(
|
5903 + | input.boolean,
|
5904 + | expected.boolean,
|
5905 + | "Unexpected value for `boolean`"
|
5906 + | );
|
5907 + | assert!(
|
5908 + | input.double.float_equals(&expected.double),
|
5909 + | "Unexpected value for `double` {:?} vs. {:?}",
|
5910 + | expected.double,
|
5911 + | input.double
|
5912 + | );
|
5913 + | ::pretty_assertions::assert_eq!(
|
5914 + | input.empty_struct,
|
5915 + | expected.empty_struct,
|
5916 + | "Unexpected value for `empty_struct`"
|
5917 + | );
|
5918 + | assert!(
|
5919 + | input.float.float_equals(&expected.float),
|
5920 + | "Unexpected value for `float` {:?} vs. {:?}",
|
5921 + | expected.float,
|
5922 + | input.float
|
5923 + | );
|
5924 + | ::pretty_assertions::assert_eq!(
|
5925 + | input.httpdate_timestamp,
|
5926 + | expected.httpdate_timestamp,
|
5927 + | "Unexpected value for `httpdate_timestamp`"
|
5928 + | );
|
5929 + | ::pretty_assertions::assert_eq!(
|
5930 + | input.integer,
|
5931 + | expected.integer,
|
5932 + | "Unexpected value for `integer`"
|
5933 + | );
|
5934 + | ::pretty_assertions::assert_eq!(
|
5935 + | input.iso8601_timestamp,
|
5936 + | expected.iso8601_timestamp,
|
5937 + | "Unexpected value for `iso8601_timestamp`"
|
5938 + | );
|
5939 + | ::pretty_assertions::assert_eq!(
|
5940 + | input.json_value,
|
5941 + | expected.json_value,
|
5942 + | "Unexpected value for `json_value`"
|
5943 + | );
|
5944 + | ::pretty_assertions::assert_eq!(
|
5945 + | input.list_of_lists,
|
5946 + | expected.list_of_lists,
|
5947 + | "Unexpected value for `list_of_lists`"
|
5948 + | );
|
5949 + | ::pretty_assertions::assert_eq!(
|
5950 + | input.list_of_maps_of_strings,
|
5951 + | expected.list_of_maps_of_strings,
|
5952 + | "Unexpected value for `list_of_maps_of_strings`"
|
5953 + | );
|
5954 + | ::pretty_assertions::assert_eq!(
|
5955 + | input.list_of_strings,
|
5956 + | expected.list_of_strings,
|
5957 + | "Unexpected value for `list_of_strings`"
|
5958 + | );
|
5959 + | ::pretty_assertions::assert_eq!(
|
5960 + | input.list_of_structs,
|
5961 + | expected.list_of_structs,
|
5962 + | "Unexpected value for `list_of_structs`"
|
5963 + | );
|
5964 + | ::pretty_assertions::assert_eq!(
|
5965 + | input.long,
|
5966 + | expected.long,
|
5967 + | "Unexpected value for `long`"
|
5968 + | );
|
5969 + | ::pretty_assertions::assert_eq!(
|
5970 + | input.map_of_lists_of_strings,
|
5971 + | expected.map_of_lists_of_strings,
|
5972 + | "Unexpected value for `map_of_lists_of_strings`"
|
5973 + | );
|
5974 + | ::pretty_assertions::assert_eq!(
|
5975 + | input.map_of_maps,
|
5976 + | expected.map_of_maps,
|
5977 + | "Unexpected value for `map_of_maps`"
|
5978 + | );
|
5979 + | ::pretty_assertions::assert_eq!(
|
5980 + | input.map_of_strings,
|
5981 + | expected.map_of_strings,
|
5982 + | "Unexpected value for `map_of_strings`"
|
5983 + | );
|
5984 + | ::pretty_assertions::assert_eq!(
|
5985 + | input.map_of_structs,
|
5986 + | expected.map_of_structs,
|
5987 + | "Unexpected value for `map_of_structs`"
|
5988 + | );
|
5989 + | ::pretty_assertions::assert_eq!(
|
5990 + | input.recursive_list,
|
5991 + | expected.recursive_list,
|
5992 + | "Unexpected value for `recursive_list`"
|
5993 + | );
|
5994 + | ::pretty_assertions::assert_eq!(
|
5995 + | input.recursive_map,
|
5996 + | expected.recursive_map,
|
5997 + | "Unexpected value for `recursive_map`"
|
5998 + | );
|
5999 + | ::pretty_assertions::assert_eq!(
|
6000 + | input.recursive_struct,
|
6001 + | expected.recursive_struct,
|
6002 + | "Unexpected value for `recursive_struct`"
|
6003 + | );
|
6004 + | ::pretty_assertions::assert_eq!(
|
6005 + | input.simple_struct,
|
6006 + | expected.simple_struct,
|
6007 + | "Unexpected value for `simple_struct`"
|
6008 + | );
|
6009 + | ::pretty_assertions::assert_eq!(
|
6010 + | input.string,
|
6011 + | expected.string,
|
6012 + | "Unexpected value for `string`"
|
6013 + | );
|
6014 + | ::pretty_assertions::assert_eq!(
|
6015 + | input.struct_with_json_name,
|
6016 + | expected.struct_with_json_name,
|
6017 + | "Unexpected value for `struct_with_json_name`"
|
6018 + | );
|
6019 + | ::pretty_assertions::assert_eq!(
|
6020 + | input.timestamp,
|
6021 + | expected.timestamp,
|
6022 + | "Unexpected value for `timestamp`"
|
6023 + | );
|
6024 + | ::pretty_assertions::assert_eq!(
|
6025 + | input.unix_timestamp,
|
6026 + | expected.unix_timestamp,
|
6027 + | "Unexpected value for `unix_timestamp`"
|
6028 + | );
|
6029 + | let response = crate::output::KitchenSinkOperationOutput {
|
6030 + | blob: ::std::option::Option::None,
|
6031 + | boolean: ::std::option::Option::None,
|
6032 + | double: ::std::option::Option::None,
|
6033 + | empty_struct: ::std::option::Option::None,
|
6034 + | float: ::std::option::Option::None,
|
6035 + | httpdate_timestamp: ::std::option::Option::None,
|
6036 + | integer: ::std::option::Option::None,
|
6037 + | iso8601_timestamp: ::std::option::Option::None,
|
6038 + | json_value: ::std::option::Option::None,
|
6039 + | list_of_lists: ::std::option::Option::None,
|
6040 + | list_of_maps_of_strings: ::std::option::Option::None,
|
6041 + | list_of_strings: ::std::option::Option::None,
|
6042 + | list_of_structs: ::std::option::Option::None,
|
6043 + | long: ::std::option::Option::None,
|
6044 + | map_of_lists_of_strings: ::std::option::Option::None,
|
6045 + | map_of_maps: ::std::option::Option::None,
|
6046 + | map_of_strings: ::std::option::Option::None,
|
6047 + | map_of_structs: ::std::option::Option::None,
|
6048 + | recursive_list: ::std::option::Option::None,
|
6049 + | recursive_map: ::std::option::Option::None,
|
6050 + | recursive_struct: ::std::option::Option::None,
|
6051 + | simple_struct: ::std::option::Option::None,
|
6052 + | string: ::std::option::Option::None,
|
6053 + | struct_with_json_name: ::std::option::Option::None,
|
6054 + | timestamp: ::std::option::Option::None,
|
6055 + | unix_timestamp: ::std::option::Option::None,
|
6056 + | };
|
6057 + | Ok(response)
|
6058 + | };
|
6059 + | sender.send(()).await.expect("receiver dropped early");
|
6060 + | result
|
6061 + | }
|
6062 + | })
|
6063 + | .build_unchecked();
|
6064 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6065 + | .await
|
6066 + | .expect("unable to make an HTTP request");
|
6067 + | assert!(
|
6068 + | receiver.recv().await.is_some(),
|
6069 + | "we expected operation handler to be invoked but it was not entered"
|
6070 + | );
|
6071 + | }
|
6072 + | /// Serializes timestamp shapes with unixTimestamp timestampFormat
|
6073 + | /// Test ID: serializes_timestamp_shapes_with_unixtimestamp_timestampformat
|
6074 + | #[::tokio::test]
|
6075 + | #[::tracing_test::traced_test]
|
6076 + | async fn serializes_timestamp_shapes_with_unixtimestamp_timestampformat_request() {
|
6077 + | #[allow(unused_mut)]
|
6078 + | let mut http_request = http::Request::builder()
|
6079 + | .uri("/")
|
6080 + | .method("POST")
|
6081 + | .header("Content-Type", "application/x-amz-json-1.1")
|
6082 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
6083 + | .body(::aws_smithy_http_server::body::Body::from(
|
6084 + | ::bytes::Bytes::from_static("{\"UnixTimestamp\":946845296}".as_bytes()),
|
6085 + | ))
|
6086 + | .unwrap();
|
6087 + | #[allow(unused_mut)]
|
6088 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6089 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
6090 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
6091 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
6092 + | let sender = sender.clone();
|
6093 + | async move {
|
6094 + | let result = {
|
6095 + | use ::aws_smithy_protocol_test::FloatEquals;
|
6096 + | let expected = crate::input::KitchenSinkOperationInput {
|
6097 + | unix_timestamp: ::std::option::Option::Some(
|
6098 + | ::aws_smithy_types::DateTime::from_fractional_secs(
|
6099 + | 946845296, 0_f64,
|
6100 + | ),
|
6101 + | ),
|
6102 + | blob: ::std::option::Option::None,
|
6103 + | boolean: ::std::option::Option::None,
|
6104 + | double: ::std::option::Option::None,
|
6105 + | empty_struct: ::std::option::Option::None,
|
6106 + | float: ::std::option::Option::None,
|
6107 + | httpdate_timestamp: ::std::option::Option::None,
|
6108 + | integer: ::std::option::Option::None,
|
6109 + | iso8601_timestamp: ::std::option::Option::None,
|
6110 + | json_value: ::std::option::Option::None,
|
6111 + | list_of_lists: ::std::option::Option::None,
|
6112 + | list_of_maps_of_strings: ::std::option::Option::None,
|
6113 + | list_of_strings: ::std::option::Option::None,
|
6114 + | list_of_structs: ::std::option::Option::None,
|
6115 + | long: ::std::option::Option::None,
|
6116 + | map_of_lists_of_strings: ::std::option::Option::None,
|
6117 + | map_of_maps: ::std::option::Option::None,
|
6118 + | map_of_strings: ::std::option::Option::None,
|
6119 + | map_of_structs: ::std::option::Option::None,
|
6120 + | recursive_list: ::std::option::Option::None,
|
6121 + | recursive_map: ::std::option::Option::None,
|
6122 + | recursive_struct: ::std::option::Option::None,
|
6123 + | simple_struct: ::std::option::Option::None,
|
6124 + | string: ::std::option::Option::None,
|
6125 + | struct_with_json_name: ::std::option::Option::None,
|
6126 + | timestamp: ::std::option::Option::None,
|
6127 + | };
|
6128 + | ::pretty_assertions::assert_eq!(
|
6129 + | input.blob,
|
6130 + | expected.blob,
|
6131 + | "Unexpected value for `blob`"
|
6132 + | );
|
6133 + | ::pretty_assertions::assert_eq!(
|
6134 + | input.boolean,
|
6135 + | expected.boolean,
|
6136 + | "Unexpected value for `boolean`"
|
6137 + | );
|
6138 + | assert!(
|
6139 + | input.double.float_equals(&expected.double),
|
6140 + | "Unexpected value for `double` {:?} vs. {:?}",
|
6141 + | expected.double,
|
6142 + | input.double
|
6143 + | );
|
6144 + | ::pretty_assertions::assert_eq!(
|
6145 + | input.empty_struct,
|
6146 + | expected.empty_struct,
|
6147 + | "Unexpected value for `empty_struct`"
|
6148 + | );
|
6149 + | assert!(
|
6150 + | input.float.float_equals(&expected.float),
|
6151 + | "Unexpected value for `float` {:?} vs. {:?}",
|
6152 + | expected.float,
|
6153 + | input.float
|
6154 + | );
|
6155 + | ::pretty_assertions::assert_eq!(
|
6156 + | input.httpdate_timestamp,
|
6157 + | expected.httpdate_timestamp,
|
6158 + | "Unexpected value for `httpdate_timestamp`"
|
6159 + | );
|
6160 + | ::pretty_assertions::assert_eq!(
|
6161 + | input.integer,
|
6162 + | expected.integer,
|
6163 + | "Unexpected value for `integer`"
|
6164 + | );
|
6165 + | ::pretty_assertions::assert_eq!(
|
6166 + | input.iso8601_timestamp,
|
6167 + | expected.iso8601_timestamp,
|
6168 + | "Unexpected value for `iso8601_timestamp`"
|
6169 + | );
|
6170 + | ::pretty_assertions::assert_eq!(
|
6171 + | input.json_value,
|
6172 + | expected.json_value,
|
6173 + | "Unexpected value for `json_value`"
|
6174 + | );
|
6175 + | ::pretty_assertions::assert_eq!(
|
6176 + | input.list_of_lists,
|
6177 + | expected.list_of_lists,
|
6178 + | "Unexpected value for `list_of_lists`"
|
6179 + | );
|
6180 + | ::pretty_assertions::assert_eq!(
|
6181 + | input.list_of_maps_of_strings,
|
6182 + | expected.list_of_maps_of_strings,
|
6183 + | "Unexpected value for `list_of_maps_of_strings`"
|
6184 + | );
|
6185 + | ::pretty_assertions::assert_eq!(
|
6186 + | input.list_of_strings,
|
6187 + | expected.list_of_strings,
|
6188 + | "Unexpected value for `list_of_strings`"
|
6189 + | );
|
6190 + | ::pretty_assertions::assert_eq!(
|
6191 + | input.list_of_structs,
|
6192 + | expected.list_of_structs,
|
6193 + | "Unexpected value for `list_of_structs`"
|
6194 + | );
|
6195 + | ::pretty_assertions::assert_eq!(
|
6196 + | input.long,
|
6197 + | expected.long,
|
6198 + | "Unexpected value for `long`"
|
6199 + | );
|
6200 + | ::pretty_assertions::assert_eq!(
|
6201 + | input.map_of_lists_of_strings,
|
6202 + | expected.map_of_lists_of_strings,
|
6203 + | "Unexpected value for `map_of_lists_of_strings`"
|
6204 + | );
|
6205 + | ::pretty_assertions::assert_eq!(
|
6206 + | input.map_of_maps,
|
6207 + | expected.map_of_maps,
|
6208 + | "Unexpected value for `map_of_maps`"
|
6209 + | );
|
6210 + | ::pretty_assertions::assert_eq!(
|
6211 + | input.map_of_strings,
|
6212 + | expected.map_of_strings,
|
6213 + | "Unexpected value for `map_of_strings`"
|
6214 + | );
|
6215 + | ::pretty_assertions::assert_eq!(
|
6216 + | input.map_of_structs,
|
6217 + | expected.map_of_structs,
|
6218 + | "Unexpected value for `map_of_structs`"
|
6219 + | );
|
6220 + | ::pretty_assertions::assert_eq!(
|
6221 + | input.recursive_list,
|
6222 + | expected.recursive_list,
|
6223 + | "Unexpected value for `recursive_list`"
|
6224 + | );
|
6225 + | ::pretty_assertions::assert_eq!(
|
6226 + | input.recursive_map,
|
6227 + | expected.recursive_map,
|
6228 + | "Unexpected value for `recursive_map`"
|
6229 + | );
|
6230 + | ::pretty_assertions::assert_eq!(
|
6231 + | input.recursive_struct,
|
6232 + | expected.recursive_struct,
|
6233 + | "Unexpected value for `recursive_struct`"
|
6234 + | );
|
6235 + | ::pretty_assertions::assert_eq!(
|
6236 + | input.simple_struct,
|
6237 + | expected.simple_struct,
|
6238 + | "Unexpected value for `simple_struct`"
|
6239 + | );
|
6240 + | ::pretty_assertions::assert_eq!(
|
6241 + | input.string,
|
6242 + | expected.string,
|
6243 + | "Unexpected value for `string`"
|
6244 + | );
|
6245 + | ::pretty_assertions::assert_eq!(
|
6246 + | input.struct_with_json_name,
|
6247 + | expected.struct_with_json_name,
|
6248 + | "Unexpected value for `struct_with_json_name`"
|
6249 + | );
|
6250 + | ::pretty_assertions::assert_eq!(
|
6251 + | input.timestamp,
|
6252 + | expected.timestamp,
|
6253 + | "Unexpected value for `timestamp`"
|
6254 + | );
|
6255 + | ::pretty_assertions::assert_eq!(
|
6256 + | input.unix_timestamp,
|
6257 + | expected.unix_timestamp,
|
6258 + | "Unexpected value for `unix_timestamp`"
|
6259 + | );
|
6260 + | let response = crate::output::KitchenSinkOperationOutput {
|
6261 + | blob: ::std::option::Option::None,
|
6262 + | boolean: ::std::option::Option::None,
|
6263 + | double: ::std::option::Option::None,
|
6264 + | empty_struct: ::std::option::Option::None,
|
6265 + | float: ::std::option::Option::None,
|
6266 + | httpdate_timestamp: ::std::option::Option::None,
|
6267 + | integer: ::std::option::Option::None,
|
6268 + | iso8601_timestamp: ::std::option::Option::None,
|
6269 + | json_value: ::std::option::Option::None,
|
6270 + | list_of_lists: ::std::option::Option::None,
|
6271 + | list_of_maps_of_strings: ::std::option::Option::None,
|
6272 + | list_of_strings: ::std::option::Option::None,
|
6273 + | list_of_structs: ::std::option::Option::None,
|
6274 + | long: ::std::option::Option::None,
|
6275 + | map_of_lists_of_strings: ::std::option::Option::None,
|
6276 + | map_of_maps: ::std::option::Option::None,
|
6277 + | map_of_strings: ::std::option::Option::None,
|
6278 + | map_of_structs: ::std::option::Option::None,
|
6279 + | recursive_list: ::std::option::Option::None,
|
6280 + | recursive_map: ::std::option::Option::None,
|
6281 + | recursive_struct: ::std::option::Option::None,
|
6282 + | simple_struct: ::std::option::Option::None,
|
6283 + | string: ::std::option::Option::None,
|
6284 + | struct_with_json_name: ::std::option::Option::None,
|
6285 + | timestamp: ::std::option::Option::None,
|
6286 + | unix_timestamp: ::std::option::Option::None,
|
6287 + | };
|
6288 + | Ok(response)
|
6289 + | };
|
6290 + | sender.send(()).await.expect("receiver dropped early");
|
6291 + | result
|
6292 + | }
|
6293 + | })
|
6294 + | .build_unchecked();
|
6295 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6296 + | .await
|
6297 + | .expect("unable to make an HTTP request");
|
6298 + | assert!(
|
6299 + | receiver.recv().await.is_some(),
|
6300 + | "we expected operation handler to be invoked but it was not entered"
|
6301 + | );
|
6302 + | }
|
6303 + | /// Serializes list shapes
|
6304 + | /// Test ID: serializes_list_shapes
|
6305 + | #[::tokio::test]
|
6306 + | #[::tracing_test::traced_test]
|
6307 + | async fn serializes_list_shapes_request() {
|
6308 + | #[allow(unused_mut)]
|
6309 + | let mut http_request = http::Request::builder()
|
6310 + | .uri("/")
|
6311 + | .method("POST")
|
6312 + | .header("Content-Type", "application/x-amz-json-1.1")
|
6313 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
6314 + | .body(::aws_smithy_http_server::body::Body::from(
|
6315 + | ::bytes::Bytes::from_static(
|
6316 + | "{\"ListOfStrings\":[\"abc\",\"mno\",\"xyz\"]}".as_bytes(),
|
6317 + | ),
|
6318 + | ))
|
6319 + | .unwrap();
|
6320 + | #[allow(unused_mut)]
|
6321 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6322 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
6323 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
6324 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
6325 + | let sender = sender.clone();
|
6326 + | async move {
|
6327 + | let result = {
|
6328 + | use ::aws_smithy_protocol_test::FloatEquals;
|
6329 + | let expected = crate::input::KitchenSinkOperationInput {
|
6330 + | list_of_strings: ::std::option::Option::Some(vec![
|
6331 + | "abc".to_owned(),
|
6332 + | "mno".to_owned(),
|
6333 + | "xyz".to_owned(),
|
6334 + | ]),
|
6335 + | blob: ::std::option::Option::None,
|
6336 + | boolean: ::std::option::Option::None,
|
6337 + | double: ::std::option::Option::None,
|
6338 + | empty_struct: ::std::option::Option::None,
|
6339 + | float: ::std::option::Option::None,
|
6340 + | httpdate_timestamp: ::std::option::Option::None,
|
6341 + | integer: ::std::option::Option::None,
|
6342 + | iso8601_timestamp: ::std::option::Option::None,
|
6343 + | json_value: ::std::option::Option::None,
|
6344 + | list_of_lists: ::std::option::Option::None,
|
6345 + | list_of_maps_of_strings: ::std::option::Option::None,
|
6346 + | list_of_structs: ::std::option::Option::None,
|
6347 + | long: ::std::option::Option::None,
|
6348 + | map_of_lists_of_strings: ::std::option::Option::None,
|
6349 + | map_of_maps: ::std::option::Option::None,
|
6350 + | map_of_strings: ::std::option::Option::None,
|
6351 + | map_of_structs: ::std::option::Option::None,
|
6352 + | recursive_list: ::std::option::Option::None,
|
6353 + | recursive_map: ::std::option::Option::None,
|
6354 + | recursive_struct: ::std::option::Option::None,
|
6355 + | simple_struct: ::std::option::Option::None,
|
6356 + | string: ::std::option::Option::None,
|
6357 + | struct_with_json_name: ::std::option::Option::None,
|
6358 + | timestamp: ::std::option::Option::None,
|
6359 + | unix_timestamp: ::std::option::Option::None,
|
6360 + | };
|
6361 + | ::pretty_assertions::assert_eq!(
|
6362 + | input.blob,
|
6363 + | expected.blob,
|
6364 + | "Unexpected value for `blob`"
|
6365 + | );
|
6366 + | ::pretty_assertions::assert_eq!(
|
6367 + | input.boolean,
|
6368 + | expected.boolean,
|
6369 + | "Unexpected value for `boolean`"
|
6370 + | );
|
6371 + | assert!(
|
6372 + | input.double.float_equals(&expected.double),
|
6373 + | "Unexpected value for `double` {:?} vs. {:?}",
|
6374 + | expected.double,
|
6375 + | input.double
|
6376 + | );
|
6377 + | ::pretty_assertions::assert_eq!(
|
6378 + | input.empty_struct,
|
6379 + | expected.empty_struct,
|
6380 + | "Unexpected value for `empty_struct`"
|
6381 + | );
|
6382 + | assert!(
|
6383 + | input.float.float_equals(&expected.float),
|
6384 + | "Unexpected value for `float` {:?} vs. {:?}",
|
6385 + | expected.float,
|
6386 + | input.float
|
6387 + | );
|
6388 + | ::pretty_assertions::assert_eq!(
|
6389 + | input.httpdate_timestamp,
|
6390 + | expected.httpdate_timestamp,
|
6391 + | "Unexpected value for `httpdate_timestamp`"
|
6392 + | );
|
6393 + | ::pretty_assertions::assert_eq!(
|
6394 + | input.integer,
|
6395 + | expected.integer,
|
6396 + | "Unexpected value for `integer`"
|
6397 + | );
|
6398 + | ::pretty_assertions::assert_eq!(
|
6399 + | input.iso8601_timestamp,
|
6400 + | expected.iso8601_timestamp,
|
6401 + | "Unexpected value for `iso8601_timestamp`"
|
6402 + | );
|
6403 + | ::pretty_assertions::assert_eq!(
|
6404 + | input.json_value,
|
6405 + | expected.json_value,
|
6406 + | "Unexpected value for `json_value`"
|
6407 + | );
|
6408 + | ::pretty_assertions::assert_eq!(
|
6409 + | input.list_of_lists,
|
6410 + | expected.list_of_lists,
|
6411 + | "Unexpected value for `list_of_lists`"
|
6412 + | );
|
6413 + | ::pretty_assertions::assert_eq!(
|
6414 + | input.list_of_maps_of_strings,
|
6415 + | expected.list_of_maps_of_strings,
|
6416 + | "Unexpected value for `list_of_maps_of_strings`"
|
6417 + | );
|
6418 + | ::pretty_assertions::assert_eq!(
|
6419 + | input.list_of_strings,
|
6420 + | expected.list_of_strings,
|
6421 + | "Unexpected value for `list_of_strings`"
|
6422 + | );
|
6423 + | ::pretty_assertions::assert_eq!(
|
6424 + | input.list_of_structs,
|
6425 + | expected.list_of_structs,
|
6426 + | "Unexpected value for `list_of_structs`"
|
6427 + | );
|
6428 + | ::pretty_assertions::assert_eq!(
|
6429 + | input.long,
|
6430 + | expected.long,
|
6431 + | "Unexpected value for `long`"
|
6432 + | );
|
6433 + | ::pretty_assertions::assert_eq!(
|
6434 + | input.map_of_lists_of_strings,
|
6435 + | expected.map_of_lists_of_strings,
|
6436 + | "Unexpected value for `map_of_lists_of_strings`"
|
6437 + | );
|
6438 + | ::pretty_assertions::assert_eq!(
|
6439 + | input.map_of_maps,
|
6440 + | expected.map_of_maps,
|
6441 + | "Unexpected value for `map_of_maps`"
|
6442 + | );
|
6443 + | ::pretty_assertions::assert_eq!(
|
6444 + | input.map_of_strings,
|
6445 + | expected.map_of_strings,
|
6446 + | "Unexpected value for `map_of_strings`"
|
6447 + | );
|
6448 + | ::pretty_assertions::assert_eq!(
|
6449 + | input.map_of_structs,
|
6450 + | expected.map_of_structs,
|
6451 + | "Unexpected value for `map_of_structs`"
|
6452 + | );
|
6453 + | ::pretty_assertions::assert_eq!(
|
6454 + | input.recursive_list,
|
6455 + | expected.recursive_list,
|
6456 + | "Unexpected value for `recursive_list`"
|
6457 + | );
|
6458 + | ::pretty_assertions::assert_eq!(
|
6459 + | input.recursive_map,
|
6460 + | expected.recursive_map,
|
6461 + | "Unexpected value for `recursive_map`"
|
6462 + | );
|
6463 + | ::pretty_assertions::assert_eq!(
|
6464 + | input.recursive_struct,
|
6465 + | expected.recursive_struct,
|
6466 + | "Unexpected value for `recursive_struct`"
|
6467 + | );
|
6468 + | ::pretty_assertions::assert_eq!(
|
6469 + | input.simple_struct,
|
6470 + | expected.simple_struct,
|
6471 + | "Unexpected value for `simple_struct`"
|
6472 + | );
|
6473 + | ::pretty_assertions::assert_eq!(
|
6474 + | input.string,
|
6475 + | expected.string,
|
6476 + | "Unexpected value for `string`"
|
6477 + | );
|
6478 + | ::pretty_assertions::assert_eq!(
|
6479 + | input.struct_with_json_name,
|
6480 + | expected.struct_with_json_name,
|
6481 + | "Unexpected value for `struct_with_json_name`"
|
6482 + | );
|
6483 + | ::pretty_assertions::assert_eq!(
|
6484 + | input.timestamp,
|
6485 + | expected.timestamp,
|
6486 + | "Unexpected value for `timestamp`"
|
6487 + | );
|
6488 + | ::pretty_assertions::assert_eq!(
|
6489 + | input.unix_timestamp,
|
6490 + | expected.unix_timestamp,
|
6491 + | "Unexpected value for `unix_timestamp`"
|
6492 + | );
|
6493 + | let response = crate::output::KitchenSinkOperationOutput {
|
6494 + | blob: ::std::option::Option::None,
|
6495 + | boolean: ::std::option::Option::None,
|
6496 + | double: ::std::option::Option::None,
|
6497 + | empty_struct: ::std::option::Option::None,
|
6498 + | float: ::std::option::Option::None,
|
6499 + | httpdate_timestamp: ::std::option::Option::None,
|
6500 + | integer: ::std::option::Option::None,
|
6501 + | iso8601_timestamp: ::std::option::Option::None,
|
6502 + | json_value: ::std::option::Option::None,
|
6503 + | list_of_lists: ::std::option::Option::None,
|
6504 + | list_of_maps_of_strings: ::std::option::Option::None,
|
6505 + | list_of_strings: ::std::option::Option::None,
|
6506 + | list_of_structs: ::std::option::Option::None,
|
6507 + | long: ::std::option::Option::None,
|
6508 + | map_of_lists_of_strings: ::std::option::Option::None,
|
6509 + | map_of_maps: ::std::option::Option::None,
|
6510 + | map_of_strings: ::std::option::Option::None,
|
6511 + | map_of_structs: ::std::option::Option::None,
|
6512 + | recursive_list: ::std::option::Option::None,
|
6513 + | recursive_map: ::std::option::Option::None,
|
6514 + | recursive_struct: ::std::option::Option::None,
|
6515 + | simple_struct: ::std::option::Option::None,
|
6516 + | string: ::std::option::Option::None,
|
6517 + | struct_with_json_name: ::std::option::Option::None,
|
6518 + | timestamp: ::std::option::Option::None,
|
6519 + | unix_timestamp: ::std::option::Option::None,
|
6520 + | };
|
6521 + | Ok(response)
|
6522 + | };
|
6523 + | sender.send(()).await.expect("receiver dropped early");
|
6524 + | result
|
6525 + | }
|
6526 + | })
|
6527 + | .build_unchecked();
|
6528 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6529 + | .await
|
6530 + | .expect("unable to make an HTTP request");
|
6531 + | assert!(
|
6532 + | receiver.recv().await.is_some(),
|
6533 + | "we expected operation handler to be invoked but it was not entered"
|
6534 + | );
|
6535 + | }
|
6536 + | /// Serializes empty list shapes
|
6537 + | /// Test ID: serializes_empty_list_shapes
|
6538 + | #[::tokio::test]
|
6539 + | #[::tracing_test::traced_test]
|
6540 + | async fn serializes_empty_list_shapes_request() {
|
6541 + | #[allow(unused_mut)]
|
6542 + | let mut http_request = http::Request::builder()
|
6543 + | .uri("/")
|
6544 + | .method("POST")
|
6545 + | .header("Content-Type", "application/x-amz-json-1.1")
|
6546 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
6547 + | .body(::aws_smithy_http_server::body::Body::from(
|
6548 + | ::bytes::Bytes::from_static("{\"ListOfStrings\":[]}".as_bytes()),
|
6549 + | ))
|
6550 + | .unwrap();
|
6551 + | #[allow(unused_mut)]
|
6552 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6553 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
6554 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
6555 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
6556 + | let sender = sender.clone();
|
6557 + | async move {
|
6558 + | let result = {
|
6559 + | use ::aws_smithy_protocol_test::FloatEquals;
|
6560 + | let expected = crate::input::KitchenSinkOperationInput {
|
6561 + | list_of_strings: ::std::option::Option::Some(vec![]),
|
6562 + | blob: ::std::option::Option::None,
|
6563 + | boolean: ::std::option::Option::None,
|
6564 + | double: ::std::option::Option::None,
|
6565 + | empty_struct: ::std::option::Option::None,
|
6566 + | float: ::std::option::Option::None,
|
6567 + | httpdate_timestamp: ::std::option::Option::None,
|
6568 + | integer: ::std::option::Option::None,
|
6569 + | iso8601_timestamp: ::std::option::Option::None,
|
6570 + | json_value: ::std::option::Option::None,
|
6571 + | list_of_lists: ::std::option::Option::None,
|
6572 + | list_of_maps_of_strings: ::std::option::Option::None,
|
6573 + | list_of_structs: ::std::option::Option::None,
|
6574 + | long: ::std::option::Option::None,
|
6575 + | map_of_lists_of_strings: ::std::option::Option::None,
|
6576 + | map_of_maps: ::std::option::Option::None,
|
6577 + | map_of_strings: ::std::option::Option::None,
|
6578 + | map_of_structs: ::std::option::Option::None,
|
6579 + | recursive_list: ::std::option::Option::None,
|
6580 + | recursive_map: ::std::option::Option::None,
|
6581 + | recursive_struct: ::std::option::Option::None,
|
6582 + | simple_struct: ::std::option::Option::None,
|
6583 + | string: ::std::option::Option::None,
|
6584 + | struct_with_json_name: ::std::option::Option::None,
|
6585 + | timestamp: ::std::option::Option::None,
|
6586 + | unix_timestamp: ::std::option::Option::None,
|
6587 + | };
|
6588 + | ::pretty_assertions::assert_eq!(
|
6589 + | input.blob,
|
6590 + | expected.blob,
|
6591 + | "Unexpected value for `blob`"
|
6592 + | );
|
6593 + | ::pretty_assertions::assert_eq!(
|
6594 + | input.boolean,
|
6595 + | expected.boolean,
|
6596 + | "Unexpected value for `boolean`"
|
6597 + | );
|
6598 + | assert!(
|
6599 + | input.double.float_equals(&expected.double),
|
6600 + | "Unexpected value for `double` {:?} vs. {:?}",
|
6601 + | expected.double,
|
6602 + | input.double
|
6603 + | );
|
6604 + | ::pretty_assertions::assert_eq!(
|
6605 + | input.empty_struct,
|
6606 + | expected.empty_struct,
|
6607 + | "Unexpected value for `empty_struct`"
|
6608 + | );
|
6609 + | assert!(
|
6610 + | input.float.float_equals(&expected.float),
|
6611 + | "Unexpected value for `float` {:?} vs. {:?}",
|
6612 + | expected.float,
|
6613 + | input.float
|
6614 + | );
|
6615 + | ::pretty_assertions::assert_eq!(
|
6616 + | input.httpdate_timestamp,
|
6617 + | expected.httpdate_timestamp,
|
6618 + | "Unexpected value for `httpdate_timestamp`"
|
6619 + | );
|
6620 + | ::pretty_assertions::assert_eq!(
|
6621 + | input.integer,
|
6622 + | expected.integer,
|
6623 + | "Unexpected value for `integer`"
|
6624 + | );
|
6625 + | ::pretty_assertions::assert_eq!(
|
6626 + | input.iso8601_timestamp,
|
6627 + | expected.iso8601_timestamp,
|
6628 + | "Unexpected value for `iso8601_timestamp`"
|
6629 + | );
|
6630 + | ::pretty_assertions::assert_eq!(
|
6631 + | input.json_value,
|
6632 + | expected.json_value,
|
6633 + | "Unexpected value for `json_value`"
|
6634 + | );
|
6635 + | ::pretty_assertions::assert_eq!(
|
6636 + | input.list_of_lists,
|
6637 + | expected.list_of_lists,
|
6638 + | "Unexpected value for `list_of_lists`"
|
6639 + | );
|
6640 + | ::pretty_assertions::assert_eq!(
|
6641 + | input.list_of_maps_of_strings,
|
6642 + | expected.list_of_maps_of_strings,
|
6643 + | "Unexpected value for `list_of_maps_of_strings`"
|
6644 + | );
|
6645 + | ::pretty_assertions::assert_eq!(
|
6646 + | input.list_of_strings,
|
6647 + | expected.list_of_strings,
|
6648 + | "Unexpected value for `list_of_strings`"
|
6649 + | );
|
6650 + | ::pretty_assertions::assert_eq!(
|
6651 + | input.list_of_structs,
|
6652 + | expected.list_of_structs,
|
6653 + | "Unexpected value for `list_of_structs`"
|
6654 + | );
|
6655 + | ::pretty_assertions::assert_eq!(
|
6656 + | input.long,
|
6657 + | expected.long,
|
6658 + | "Unexpected value for `long`"
|
6659 + | );
|
6660 + | ::pretty_assertions::assert_eq!(
|
6661 + | input.map_of_lists_of_strings,
|
6662 + | expected.map_of_lists_of_strings,
|
6663 + | "Unexpected value for `map_of_lists_of_strings`"
|
6664 + | );
|
6665 + | ::pretty_assertions::assert_eq!(
|
6666 + | input.map_of_maps,
|
6667 + | expected.map_of_maps,
|
6668 + | "Unexpected value for `map_of_maps`"
|
6669 + | );
|
6670 + | ::pretty_assertions::assert_eq!(
|
6671 + | input.map_of_strings,
|
6672 + | expected.map_of_strings,
|
6673 + | "Unexpected value for `map_of_strings`"
|
6674 + | );
|
6675 + | ::pretty_assertions::assert_eq!(
|
6676 + | input.map_of_structs,
|
6677 + | expected.map_of_structs,
|
6678 + | "Unexpected value for `map_of_structs`"
|
6679 + | );
|
6680 + | ::pretty_assertions::assert_eq!(
|
6681 + | input.recursive_list,
|
6682 + | expected.recursive_list,
|
6683 + | "Unexpected value for `recursive_list`"
|
6684 + | );
|
6685 + | ::pretty_assertions::assert_eq!(
|
6686 + | input.recursive_map,
|
6687 + | expected.recursive_map,
|
6688 + | "Unexpected value for `recursive_map`"
|
6689 + | );
|
6690 + | ::pretty_assertions::assert_eq!(
|
6691 + | input.recursive_struct,
|
6692 + | expected.recursive_struct,
|
6693 + | "Unexpected value for `recursive_struct`"
|
6694 + | );
|
6695 + | ::pretty_assertions::assert_eq!(
|
6696 + | input.simple_struct,
|
6697 + | expected.simple_struct,
|
6698 + | "Unexpected value for `simple_struct`"
|
6699 + | );
|
6700 + | ::pretty_assertions::assert_eq!(
|
6701 + | input.string,
|
6702 + | expected.string,
|
6703 + | "Unexpected value for `string`"
|
6704 + | );
|
6705 + | ::pretty_assertions::assert_eq!(
|
6706 + | input.struct_with_json_name,
|
6707 + | expected.struct_with_json_name,
|
6708 + | "Unexpected value for `struct_with_json_name`"
|
6709 + | );
|
6710 + | ::pretty_assertions::assert_eq!(
|
6711 + | input.timestamp,
|
6712 + | expected.timestamp,
|
6713 + | "Unexpected value for `timestamp`"
|
6714 + | );
|
6715 + | ::pretty_assertions::assert_eq!(
|
6716 + | input.unix_timestamp,
|
6717 + | expected.unix_timestamp,
|
6718 + | "Unexpected value for `unix_timestamp`"
|
6719 + | );
|
6720 + | let response = crate::output::KitchenSinkOperationOutput {
|
6721 + | blob: ::std::option::Option::None,
|
6722 + | boolean: ::std::option::Option::None,
|
6723 + | double: ::std::option::Option::None,
|
6724 + | empty_struct: ::std::option::Option::None,
|
6725 + | float: ::std::option::Option::None,
|
6726 + | httpdate_timestamp: ::std::option::Option::None,
|
6727 + | integer: ::std::option::Option::None,
|
6728 + | iso8601_timestamp: ::std::option::Option::None,
|
6729 + | json_value: ::std::option::Option::None,
|
6730 + | list_of_lists: ::std::option::Option::None,
|
6731 + | list_of_maps_of_strings: ::std::option::Option::None,
|
6732 + | list_of_strings: ::std::option::Option::None,
|
6733 + | list_of_structs: ::std::option::Option::None,
|
6734 + | long: ::std::option::Option::None,
|
6735 + | map_of_lists_of_strings: ::std::option::Option::None,
|
6736 + | map_of_maps: ::std::option::Option::None,
|
6737 + | map_of_strings: ::std::option::Option::None,
|
6738 + | map_of_structs: ::std::option::Option::None,
|
6739 + | recursive_list: ::std::option::Option::None,
|
6740 + | recursive_map: ::std::option::Option::None,
|
6741 + | recursive_struct: ::std::option::Option::None,
|
6742 + | simple_struct: ::std::option::Option::None,
|
6743 + | string: ::std::option::Option::None,
|
6744 + | struct_with_json_name: ::std::option::Option::None,
|
6745 + | timestamp: ::std::option::Option::None,
|
6746 + | unix_timestamp: ::std::option::Option::None,
|
6747 + | };
|
6748 + | Ok(response)
|
6749 + | };
|
6750 + | sender.send(()).await.expect("receiver dropped early");
|
6751 + | result
|
6752 + | }
|
6753 + | })
|
6754 + | .build_unchecked();
|
6755 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6756 + | .await
|
6757 + | .expect("unable to make an HTTP request");
|
6758 + | assert!(
|
6759 + | receiver.recv().await.is_some(),
|
6760 + | "we expected operation handler to be invoked but it was not entered"
|
9284 6761 | );
|
9285 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
9286 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9287 - | http_response.headers(),
|
9288 - | expected_headers,
|
9289 - | ));
|
9290 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6762 + | }
|
6763 + | /// Serializes list of map shapes
|
6764 + | /// Test ID: serializes_list_of_map_shapes
|
6765 + | #[::tokio::test]
|
6766 + | #[::tracing_test::traced_test]
|
6767 + | async fn serializes_list_of_map_shapes_request() {
|
6768 + | #[allow(unused_mut)]
|
6769 + | let mut http_request = http::Request::builder()
|
6770 + | .uri("/")
|
6771 + | .method("POST")
|
6772 + | .header("Content-Type", "application/x-amz-json-1.1")
|
6773 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
6774 + | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{\"ListOfMapsOfStrings\":[{\"foo\":\"bar\"},{\"abc\":\"xyz\"},{\"red\":\"blue\"}]}".as_bytes()))).unwrap();
|
6775 + | #[allow(unused_mut)]
|
6776 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6777 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
6778 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
6779 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
6780 + | let sender = sender.clone();
|
6781 + | async move {
|
6782 + | let result = {
|
6783 + | use ::aws_smithy_protocol_test::FloatEquals;
|
6784 + | let expected = crate::input::KitchenSinkOperationInput {
|
6785 + | list_of_maps_of_strings: ::std::option::Option::Some(vec![
|
6786 + | {
|
6787 + | let mut ret = ::std::collections::HashMap::new();
|
6788 + | ret.insert("foo".to_owned(), "bar".to_owned());
|
6789 + | ret
|
6790 + | },
|
6791 + | {
|
6792 + | let mut ret = ::std::collections::HashMap::new();
|
6793 + | ret.insert("abc".to_owned(), "xyz".to_owned());
|
6794 + | ret
|
6795 + | },
|
6796 + | {
|
6797 + | let mut ret = ::std::collections::HashMap::new();
|
6798 + | ret.insert("red".to_owned(), "blue".to_owned());
|
6799 + | ret
|
6800 + | },
|
6801 + | ]),
|
6802 + | blob: ::std::option::Option::None,
|
6803 + | boolean: ::std::option::Option::None,
|
6804 + | double: ::std::option::Option::None,
|
6805 + | empty_struct: ::std::option::Option::None,
|
6806 + | float: ::std::option::Option::None,
|
6807 + | httpdate_timestamp: ::std::option::Option::None,
|
6808 + | integer: ::std::option::Option::None,
|
6809 + | iso8601_timestamp: ::std::option::Option::None,
|
6810 + | json_value: ::std::option::Option::None,
|
6811 + | list_of_lists: ::std::option::Option::None,
|
6812 + | list_of_strings: ::std::option::Option::None,
|
6813 + | list_of_structs: ::std::option::Option::None,
|
6814 + | long: ::std::option::Option::None,
|
6815 + | map_of_lists_of_strings: ::std::option::Option::None,
|
6816 + | map_of_maps: ::std::option::Option::None,
|
6817 + | map_of_strings: ::std::option::Option::None,
|
6818 + | map_of_structs: ::std::option::Option::None,
|
6819 + | recursive_list: ::std::option::Option::None,
|
6820 + | recursive_map: ::std::option::Option::None,
|
6821 + | recursive_struct: ::std::option::Option::None,
|
6822 + | simple_struct: ::std::option::Option::None,
|
6823 + | string: ::std::option::Option::None,
|
6824 + | struct_with_json_name: ::std::option::Option::None,
|
6825 + | timestamp: ::std::option::Option::None,
|
6826 + | unix_timestamp: ::std::option::Option::None,
|
6827 + | };
|
6828 + | ::pretty_assertions::assert_eq!(
|
6829 + | input.blob,
|
6830 + | expected.blob,
|
6831 + | "Unexpected value for `blob`"
|
6832 + | );
|
6833 + | ::pretty_assertions::assert_eq!(
|
6834 + | input.boolean,
|
6835 + | expected.boolean,
|
6836 + | "Unexpected value for `boolean`"
|
6837 + | );
|
6838 + | assert!(
|
6839 + | input.double.float_equals(&expected.double),
|
6840 + | "Unexpected value for `double` {:?} vs. {:?}",
|
6841 + | expected.double,
|
6842 + | input.double
|
6843 + | );
|
6844 + | ::pretty_assertions::assert_eq!(
|
6845 + | input.empty_struct,
|
6846 + | expected.empty_struct,
|
6847 + | "Unexpected value for `empty_struct`"
|
6848 + | );
|
6849 + | assert!(
|
6850 + | input.float.float_equals(&expected.float),
|
6851 + | "Unexpected value for `float` {:?} vs. {:?}",
|
6852 + | expected.float,
|
6853 + | input.float
|
6854 + | );
|
6855 + | ::pretty_assertions::assert_eq!(
|
6856 + | input.httpdate_timestamp,
|
6857 + | expected.httpdate_timestamp,
|
6858 + | "Unexpected value for `httpdate_timestamp`"
|
6859 + | );
|
6860 + | ::pretty_assertions::assert_eq!(
|
6861 + | input.integer,
|
6862 + | expected.integer,
|
6863 + | "Unexpected value for `integer`"
|
6864 + | );
|
6865 + | ::pretty_assertions::assert_eq!(
|
6866 + | input.iso8601_timestamp,
|
6867 + | expected.iso8601_timestamp,
|
6868 + | "Unexpected value for `iso8601_timestamp`"
|
6869 + | );
|
6870 + | ::pretty_assertions::assert_eq!(
|
6871 + | input.json_value,
|
6872 + | expected.json_value,
|
6873 + | "Unexpected value for `json_value`"
|
6874 + | );
|
6875 + | ::pretty_assertions::assert_eq!(
|
6876 + | input.list_of_lists,
|
6877 + | expected.list_of_lists,
|
6878 + | "Unexpected value for `list_of_lists`"
|
6879 + | );
|
6880 + | ::pretty_assertions::assert_eq!(
|
6881 + | input.list_of_maps_of_strings,
|
6882 + | expected.list_of_maps_of_strings,
|
6883 + | "Unexpected value for `list_of_maps_of_strings`"
|
6884 + | );
|
6885 + | ::pretty_assertions::assert_eq!(
|
6886 + | input.list_of_strings,
|
6887 + | expected.list_of_strings,
|
6888 + | "Unexpected value for `list_of_strings`"
|
6889 + | );
|
6890 + | ::pretty_assertions::assert_eq!(
|
6891 + | input.list_of_structs,
|
6892 + | expected.list_of_structs,
|
6893 + | "Unexpected value for `list_of_structs`"
|
6894 + | );
|
6895 + | ::pretty_assertions::assert_eq!(
|
6896 + | input.long,
|
6897 + | expected.long,
|
6898 + | "Unexpected value for `long`"
|
6899 + | );
|
6900 + | ::pretty_assertions::assert_eq!(
|
6901 + | input.map_of_lists_of_strings,
|
6902 + | expected.map_of_lists_of_strings,
|
6903 + | "Unexpected value for `map_of_lists_of_strings`"
|
6904 + | );
|
6905 + | ::pretty_assertions::assert_eq!(
|
6906 + | input.map_of_maps,
|
6907 + | expected.map_of_maps,
|
6908 + | "Unexpected value for `map_of_maps`"
|
6909 + | );
|
6910 + | ::pretty_assertions::assert_eq!(
|
6911 + | input.map_of_strings,
|
6912 + | expected.map_of_strings,
|
6913 + | "Unexpected value for `map_of_strings`"
|
6914 + | );
|
6915 + | ::pretty_assertions::assert_eq!(
|
6916 + | input.map_of_structs,
|
6917 + | expected.map_of_structs,
|
6918 + | "Unexpected value for `map_of_structs`"
|
6919 + | );
|
6920 + | ::pretty_assertions::assert_eq!(
|
6921 + | input.recursive_list,
|
6922 + | expected.recursive_list,
|
6923 + | "Unexpected value for `recursive_list`"
|
6924 + | );
|
6925 + | ::pretty_assertions::assert_eq!(
|
6926 + | input.recursive_map,
|
6927 + | expected.recursive_map,
|
6928 + | "Unexpected value for `recursive_map`"
|
6929 + | );
|
6930 + | ::pretty_assertions::assert_eq!(
|
6931 + | input.recursive_struct,
|
6932 + | expected.recursive_struct,
|
6933 + | "Unexpected value for `recursive_struct`"
|
6934 + | );
|
6935 + | ::pretty_assertions::assert_eq!(
|
6936 + | input.simple_struct,
|
6937 + | expected.simple_struct,
|
6938 + | "Unexpected value for `simple_struct`"
|
6939 + | );
|
6940 + | ::pretty_assertions::assert_eq!(
|
6941 + | input.string,
|
6942 + | expected.string,
|
6943 + | "Unexpected value for `string`"
|
6944 + | );
|
6945 + | ::pretty_assertions::assert_eq!(
|
6946 + | input.struct_with_json_name,
|
6947 + | expected.struct_with_json_name,
|
6948 + | "Unexpected value for `struct_with_json_name`"
|
6949 + | );
|
6950 + | ::pretty_assertions::assert_eq!(
|
6951 + | input.timestamp,
|
6952 + | expected.timestamp,
|
6953 + | "Unexpected value for `timestamp`"
|
6954 + | );
|
6955 + | ::pretty_assertions::assert_eq!(
|
6956 + | input.unix_timestamp,
|
6957 + | expected.unix_timestamp,
|
6958 + | "Unexpected value for `unix_timestamp`"
|
6959 + | );
|
6960 + | let response = crate::output::KitchenSinkOperationOutput {
|
6961 + | blob: ::std::option::Option::None,
|
6962 + | boolean: ::std::option::Option::None,
|
6963 + | double: ::std::option::Option::None,
|
6964 + | empty_struct: ::std::option::Option::None,
|
6965 + | float: ::std::option::Option::None,
|
6966 + | httpdate_timestamp: ::std::option::Option::None,
|
6967 + | integer: ::std::option::Option::None,
|
6968 + | iso8601_timestamp: ::std::option::Option::None,
|
6969 + | json_value: ::std::option::Option::None,
|
6970 + | list_of_lists: ::std::option::Option::None,
|
6971 + | list_of_maps_of_strings: ::std::option::Option::None,
|
6972 + | list_of_strings: ::std::option::Option::None,
|
6973 + | list_of_structs: ::std::option::Option::None,
|
6974 + | long: ::std::option::Option::None,
|
6975 + | map_of_lists_of_strings: ::std::option::Option::None,
|
6976 + | map_of_maps: ::std::option::Option::None,
|
6977 + | map_of_strings: ::std::option::Option::None,
|
6978 + | map_of_structs: ::std::option::Option::None,
|
6979 + | recursive_list: ::std::option::Option::None,
|
6980 + | recursive_map: ::std::option::Option::None,
|
6981 + | recursive_struct: ::std::option::Option::None,
|
6982 + | simple_struct: ::std::option::Option::None,
|
6983 + | string: ::std::option::Option::None,
|
6984 + | struct_with_json_name: ::std::option::Option::None,
|
6985 + | timestamp: ::std::option::Option::None,
|
6986 + | unix_timestamp: ::std::option::Option::None,
|
6987 + | };
|
6988 + | Ok(response)
|
6989 + | };
|
6990 + | sender.send(()).await.expect("receiver dropped early");
|
6991 + | result
|
6992 + | }
|
6993 + | })
|
6994 + | .build_unchecked();
|
6995 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9291 6996 | .await
|
9292 - | .expect("unable to extract body to bytes");
|
9293 - | ::aws_smithy_protocol_test::assert_ok(
|
9294 - | ::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"))
|
9295 - | );
|
9296 - | }
|
9297 - | /// Parses the request id from the response
|
9298 - | /// Test ID: parses_the_request_id_from_the_response
|
9299 - | #[::tokio::test]
|
9300 - | #[should_panic]
|
9301 - | async fn parses_the_request_id_from_the_response_response() {
|
9302 - | let output = crate::output::KitchenSinkOperationOutput {
|
9303 - | blob: ::std::option::Option::None,
|
9304 - | boolean: ::std::option::Option::None,
|
9305 - | double: ::std::option::Option::None,
|
9306 - | empty_struct: ::std::option::Option::None,
|
9307 - | float: ::std::option::Option::None,
|
9308 - | httpdate_timestamp: ::std::option::Option::None,
|
9309 - | integer: ::std::option::Option::None,
|
9310 - | iso8601_timestamp: ::std::option::Option::None,
|
9311 - | json_value: ::std::option::Option::None,
|
9312 - | list_of_lists: ::std::option::Option::None,
|
9313 - | list_of_maps_of_strings: ::std::option::Option::None,
|
9314 - | list_of_strings: ::std::option::Option::None,
|
9315 - | list_of_structs: ::std::option::Option::None,
|
9316 - | long: ::std::option::Option::None,
|
9317 - | map_of_lists_of_strings: ::std::option::Option::None,
|
9318 - | map_of_maps: ::std::option::Option::None,
|
9319 - | map_of_strings: ::std::option::Option::None,
|
9320 - | map_of_structs: ::std::option::Option::None,
|
9321 - | recursive_list: ::std::option::Option::None,
|
9322 - | recursive_map: ::std::option::Option::None,
|
9323 - | recursive_struct: ::std::option::Option::None,
|
9324 - | simple_struct: ::std::option::Option::None,
|
9325 - | string: ::std::option::Option::None,
|
9326 - | struct_with_json_name: ::std::option::Option::None,
|
9327 - | timestamp: ::std::option::Option::None,
|
9328 - | unix_timestamp: ::std::option::Option::None,
|
9329 - | };
|
9330 - | use ::aws_smithy_http_server::response::IntoResponse;
|
9331 - | let http_response = output.into_response();
|
9332 - | ::pretty_assertions::assert_eq!(
|
9333 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
9334 - | http_response.status()
|
6997 + | .expect("unable to make an HTTP request");
|
6998 + | assert!(
|
6999 + | receiver.recv().await.is_some(),
|
7000 + | "we expected operation handler to be invoked but it was not entered"
|
9335 7001 | );
|
9336 - | let expected_headers = [
|
9337 - | ("Content-Type", "application/x-amz-json-1.1"),
|
9338 - | ("X-Amzn-Requestid", "amazon-uniq-request-id"),
|
9339 - | ];
|
9340 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9341 - | http_response.headers(),
|
9342 - | expected_headers,
|
9343 - | ));
|
9344 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
9345 - | .await
|
9346 - | .expect("unable to extract body to bytes");
|
9347 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
9348 - | &body,
|
9349 - | "{}",
|
9350 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9351 - | ));
|
9352 7002 | }
|
9353 - | }
|
9354 - | #[cfg(test)]
|
9355 - | #[allow(unreachable_code, unused_variables)]
|
9356 - | mod server_null_operation_test {
|
9357 - | /// Null structure values are dropped
|
9358 - | /// Test ID: AwsJson11ServersDontDeserializeNullStructureValues
|
7003 + | /// Serializes list of structure shapes
|
7004 + | /// Test ID: serializes_list_of_structure_shapes
|
9359 7005 | #[::tokio::test]
|
9360 - | async fn aws_json11_servers_dont_deserialize_null_structure_values_request() {
|
7006 + | #[::tracing_test::traced_test]
|
7007 + | async fn serializes_list_of_structure_shapes_request() {
|
9361 7008 | #[allow(unused_mut)]
|
9362 - | let mut http_request = http::Request::builder()
|
9363 - | .uri("/")
|
9364 - | .method("POST")
|
9365 - | .header("Content-Type", "application/x-amz-json-1.1")
|
9366 - | .header("X-Amz-Target", "JsonProtocol.NullOperation")
|
9367 - | .body(::aws_smithy_http_server::body::Body::from(
|
9368 - | ::bytes::Bytes::from_static("{\n \"string\": null\n}".as_bytes()),
|
9369 - | ))
|
9370 - | .unwrap();
|
7009 + | let mut http_request = http::Request::builder()
|
7010 + | .uri("/")
|
7011 + | .method("POST")
|
7012 + | .header("Content-Type", "application/x-amz-json-1.1")
|
7013 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
7014 + | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{\"ListOfStructs\":[{\"Value\":\"abc\"},{\"Value\":\"mno\"},{\"Value\":\"xyz\"}]}".as_bytes()))).unwrap();
|
9371 7015 | #[allow(unused_mut)]
|
9372 7016 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9373 7017 | let config = crate::service::JsonProtocolConfig::builder().build();
|
9374 7018 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9375 - | .null_operation(move |input: crate::input::NullOperationInput| {
|
7019 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
9376 7020 | let sender = sender.clone();
|
9377 7021 | async move {
|
9378 7022 | let result = {
|
9379 - | let expected = crate::input::NullOperationInput {
|
7023 + | use ::aws_smithy_protocol_test::FloatEquals;
|
7024 + | let expected = crate::input::KitchenSinkOperationInput {
|
7025 + | list_of_structs: ::std::option::Option::Some(vec![
|
7026 + | crate::model::SimpleStruct {
|
7027 + | value: ::std::option::Option::Some("abc".to_owned()),
|
7028 + | },
|
7029 + | crate::model::SimpleStruct {
|
7030 + | value: ::std::option::Option::Some("mno".to_owned()),
|
7031 + | },
|
7032 + | crate::model::SimpleStruct {
|
7033 + | value: ::std::option::Option::Some("xyz".to_owned()),
|
7034 + | },
|
7035 + | ]),
|
7036 + | blob: ::std::option::Option::None,
|
7037 + | boolean: ::std::option::Option::None,
|
7038 + | double: ::std::option::Option::None,
|
7039 + | empty_struct: ::std::option::Option::None,
|
7040 + | float: ::std::option::Option::None,
|
7041 + | httpdate_timestamp: ::std::option::Option::None,
|
7042 + | integer: ::std::option::Option::None,
|
7043 + | iso8601_timestamp: ::std::option::Option::None,
|
7044 + | json_value: ::std::option::Option::None,
|
7045 + | list_of_lists: ::std::option::Option::None,
|
7046 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7047 + | list_of_strings: ::std::option::Option::None,
|
7048 + | long: ::std::option::Option::None,
|
7049 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7050 + | map_of_maps: ::std::option::Option::None,
|
7051 + | map_of_strings: ::std::option::Option::None,
|
7052 + | map_of_structs: ::std::option::Option::None,
|
7053 + | recursive_list: ::std::option::Option::None,
|
7054 + | recursive_map: ::std::option::Option::None,
|
7055 + | recursive_struct: ::std::option::Option::None,
|
7056 + | simple_struct: ::std::option::Option::None,
|
9380 7057 | string: ::std::option::Option::None,
|
7058 + | struct_with_json_name: ::std::option::Option::None,
|
7059 + | timestamp: ::std::option::Option::None,
|
7060 + | unix_timestamp: ::std::option::Option::None,
|
9381 7061 | };
|
9382 - | ::pretty_assertions::assert_eq!(input, expected);
|
9383 - | let response = crate::output::NullOperationOutput {
|
7062 + | ::pretty_assertions::assert_eq!(
|
7063 + | input.blob,
|
7064 + | expected.blob,
|
7065 + | "Unexpected value for `blob`"
|
7066 + | );
|
7067 + | ::pretty_assertions::assert_eq!(
|
7068 + | input.boolean,
|
7069 + | expected.boolean,
|
7070 + | "Unexpected value for `boolean`"
|
7071 + | );
|
7072 + | assert!(
|
7073 + | input.double.float_equals(&expected.double),
|
7074 + | "Unexpected value for `double` {:?} vs. {:?}",
|
7075 + | expected.double,
|
7076 + | input.double
|
7077 + | );
|
7078 + | ::pretty_assertions::assert_eq!(
|
7079 + | input.empty_struct,
|
7080 + | expected.empty_struct,
|
7081 + | "Unexpected value for `empty_struct`"
|
7082 + | );
|
7083 + | assert!(
|
7084 + | input.float.float_equals(&expected.float),
|
7085 + | "Unexpected value for `float` {:?} vs. {:?}",
|
7086 + | expected.float,
|
7087 + | input.float
|
7088 + | );
|
7089 + | ::pretty_assertions::assert_eq!(
|
7090 + | input.httpdate_timestamp,
|
7091 + | expected.httpdate_timestamp,
|
7092 + | "Unexpected value for `httpdate_timestamp`"
|
7093 + | );
|
7094 + | ::pretty_assertions::assert_eq!(
|
7095 + | input.integer,
|
7096 + | expected.integer,
|
7097 + | "Unexpected value for `integer`"
|
7098 + | );
|
7099 + | ::pretty_assertions::assert_eq!(
|
7100 + | input.iso8601_timestamp,
|
7101 + | expected.iso8601_timestamp,
|
7102 + | "Unexpected value for `iso8601_timestamp`"
|
7103 + | );
|
7104 + | ::pretty_assertions::assert_eq!(
|
7105 + | input.json_value,
|
7106 + | expected.json_value,
|
7107 + | "Unexpected value for `json_value`"
|
7108 + | );
|
7109 + | ::pretty_assertions::assert_eq!(
|
7110 + | input.list_of_lists,
|
7111 + | expected.list_of_lists,
|
7112 + | "Unexpected value for `list_of_lists`"
|
7113 + | );
|
7114 + | ::pretty_assertions::assert_eq!(
|
7115 + | input.list_of_maps_of_strings,
|
7116 + | expected.list_of_maps_of_strings,
|
7117 + | "Unexpected value for `list_of_maps_of_strings`"
|
7118 + | );
|
7119 + | ::pretty_assertions::assert_eq!(
|
7120 + | input.list_of_strings,
|
7121 + | expected.list_of_strings,
|
7122 + | "Unexpected value for `list_of_strings`"
|
7123 + | );
|
7124 + | ::pretty_assertions::assert_eq!(
|
7125 + | input.list_of_structs,
|
7126 + | expected.list_of_structs,
|
7127 + | "Unexpected value for `list_of_structs`"
|
7128 + | );
|
7129 + | ::pretty_assertions::assert_eq!(
|
7130 + | input.long,
|
7131 + | expected.long,
|
7132 + | "Unexpected value for `long`"
|
7133 + | );
|
7134 + | ::pretty_assertions::assert_eq!(
|
7135 + | input.map_of_lists_of_strings,
|
7136 + | expected.map_of_lists_of_strings,
|
7137 + | "Unexpected value for `map_of_lists_of_strings`"
|
7138 + | );
|
7139 + | ::pretty_assertions::assert_eq!(
|
7140 + | input.map_of_maps,
|
7141 + | expected.map_of_maps,
|
7142 + | "Unexpected value for `map_of_maps`"
|
7143 + | );
|
7144 + | ::pretty_assertions::assert_eq!(
|
7145 + | input.map_of_strings,
|
7146 + | expected.map_of_strings,
|
7147 + | "Unexpected value for `map_of_strings`"
|
7148 + | );
|
7149 + | ::pretty_assertions::assert_eq!(
|
7150 + | input.map_of_structs,
|
7151 + | expected.map_of_structs,
|
7152 + | "Unexpected value for `map_of_structs`"
|
7153 + | );
|
7154 + | ::pretty_assertions::assert_eq!(
|
7155 + | input.recursive_list,
|
7156 + | expected.recursive_list,
|
7157 + | "Unexpected value for `recursive_list`"
|
7158 + | );
|
7159 + | ::pretty_assertions::assert_eq!(
|
7160 + | input.recursive_map,
|
7161 + | expected.recursive_map,
|
7162 + | "Unexpected value for `recursive_map`"
|
7163 + | );
|
7164 + | ::pretty_assertions::assert_eq!(
|
7165 + | input.recursive_struct,
|
7166 + | expected.recursive_struct,
|
7167 + | "Unexpected value for `recursive_struct`"
|
7168 + | );
|
7169 + | ::pretty_assertions::assert_eq!(
|
7170 + | input.simple_struct,
|
7171 + | expected.simple_struct,
|
7172 + | "Unexpected value for `simple_struct`"
|
7173 + | );
|
7174 + | ::pretty_assertions::assert_eq!(
|
7175 + | input.string,
|
7176 + | expected.string,
|
7177 + | "Unexpected value for `string`"
|
7178 + | );
|
7179 + | ::pretty_assertions::assert_eq!(
|
7180 + | input.struct_with_json_name,
|
7181 + | expected.struct_with_json_name,
|
7182 + | "Unexpected value for `struct_with_json_name`"
|
7183 + | );
|
7184 + | ::pretty_assertions::assert_eq!(
|
7185 + | input.timestamp,
|
7186 + | expected.timestamp,
|
7187 + | "Unexpected value for `timestamp`"
|
7188 + | );
|
7189 + | ::pretty_assertions::assert_eq!(
|
7190 + | input.unix_timestamp,
|
7191 + | expected.unix_timestamp,
|
7192 + | "Unexpected value for `unix_timestamp`"
|
7193 + | );
|
7194 + | let response = crate::output::KitchenSinkOperationOutput {
|
7195 + | blob: ::std::option::Option::None,
|
7196 + | boolean: ::std::option::Option::None,
|
7197 + | double: ::std::option::Option::None,
|
7198 + | empty_struct: ::std::option::Option::None,
|
7199 + | float: ::std::option::Option::None,
|
7200 + | httpdate_timestamp: ::std::option::Option::None,
|
7201 + | integer: ::std::option::Option::None,
|
7202 + | iso8601_timestamp: ::std::option::Option::None,
|
7203 + | json_value: ::std::option::Option::None,
|
7204 + | list_of_lists: ::std::option::Option::None,
|
7205 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7206 + | list_of_strings: ::std::option::Option::None,
|
7207 + | list_of_structs: ::std::option::Option::None,
|
7208 + | long: ::std::option::Option::None,
|
7209 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7210 + | map_of_maps: ::std::option::Option::None,
|
7211 + | map_of_strings: ::std::option::Option::None,
|
7212 + | map_of_structs: ::std::option::Option::None,
|
7213 + | recursive_list: ::std::option::Option::None,
|
7214 + | recursive_map: ::std::option::Option::None,
|
7215 + | recursive_struct: ::std::option::Option::None,
|
7216 + | simple_struct: ::std::option::Option::None,
|
9384 7217 | string: ::std::option::Option::None,
|
7218 + | struct_with_json_name: ::std::option::Option::None,
|
7219 + | timestamp: ::std::option::Option::None,
|
7220 + | unix_timestamp: ::std::option::Option::None,
|
9385 7221 | };
|
9386 - | response
|
7222 + | Ok(response)
|
9387 7223 | };
|
9388 7224 | sender.send(()).await.expect("receiver dropped early");
|
9389 7225 | result
|
9390 7226 | }
|
9391 7227 | })
|
9392 7228 | .build_unchecked();
|
9393 7229 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9394 7230 | .await
|
9395 7231 | .expect("unable to make an HTTP request");
|
9396 - | assert!(receiver.recv().await.is_some());
|
9397 - | }
|
9398 - | /// Null structure values are dropped
|
9399 - | /// Test ID: AwsJson11ServersDontSerializeNullStructureValues
|
9400 - | #[::tokio::test]
|
9401 - | async fn aws_json11_servers_dont_serialize_null_structure_values_response() {
|
9402 - | let output = crate::output::NullOperationOutput {
|
9403 - | string: ::std::option::Option::None,
|
9404 - | };
|
9405 - | use ::aws_smithy_http_server::response::IntoResponse;
|
9406 - | let http_response = output.into_response();
|
9407 - | ::pretty_assertions::assert_eq!(
|
9408 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
9409 - | http_response.status()
|
7232 + | assert!(
|
7233 + | receiver.recv().await.is_some(),
|
7234 + | "we expected operation handler to be invoked but it was not entered"
|
9410 7235 | );
|
9411 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
9412 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9413 - | http_response.headers(),
|
9414 - | expected_headers,
|
9415 - | ));
|
9416 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
9417 - | .await
|
9418 - | .expect("unable to extract body to bytes");
|
9419 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
9420 - | &body,
|
9421 - | "{}",
|
9422 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9423 - | ));
|
9424 - | }
|
9425 - | }
|
9426 - | #[cfg(test)]
|
9427 - | #[allow(unreachable_code, unused_variables)]
|
9428 - | mod server_operation_with_optional_input_output_test {
|
9429 - | /// Can call operations with no input or output
|
9430 - | /// Test ID: can_call_operation_with_no_input_or_output
|
9431 - | #[::tokio::test]
|
9432 - | async fn can_call_operation_with_no_input_or_output_request() {
|
9433 - | #[allow(unused_mut)]
|
9434 - | let mut http_request = http::Request::builder()
|
9435 - | .uri("/")
|
9436 - | .method("POST")
|
9437 - | .header("Content-Type", "application/x-amz-json-1.1")
|
9438 - | .header(
|
9439 - | "X-Amz-Target",
|
9440 - | "JsonProtocol.OperationWithOptionalInputOutput",
|
9441 - | )
|
9442 - | .body(::aws_smithy_http_server::body::Body::from(
|
9443 - | ::bytes::Bytes::from_static("{}".as_bytes()),
|
9444 - | ))
|
9445 - | .unwrap();
|
9446 - | #[allow(unused_mut)]
|
9447 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9448 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
9449 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9450 - | .operation_with_optional_input_output(
|
9451 - | move |input: crate::input::OperationWithOptionalInputOutputInput| {
|
9452 - | let sender = sender.clone();
|
9453 - | async move {
|
9454 - | let result = {
|
9455 - | let expected = crate::input::OperationWithOptionalInputOutputInput {
|
9456 - | value: ::std::option::Option::None,
|
9457 - | };
|
9458 - | ::pretty_assertions::assert_eq!(input, expected);
|
9459 - | let response = crate::output::OperationWithOptionalInputOutputOutput {
|
9460 - | value: ::std::option::Option::None,
|
9461 - | };
|
9462 - | response
|
9463 - | };
|
9464 - | sender.send(()).await.expect("receiver dropped early");
|
9465 - | result
|
9466 - | }
|
9467 - | },
|
9468 - | )
|
9469 - | .build_unchecked();
|
9470 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9471 - | .await
|
9472 - | .expect("unable to make an HTTP request");
|
9473 - | assert!(receiver.recv().await.is_some());
|
9474 7236 | }
|
9475 - | /// Can invoke operations with optional input
|
9476 - | /// Test ID: can_call_operation_with_optional_input
|
7237 + | /// Serializes list of recursive structure shapes
|
7238 + | /// Test ID: serializes_list_of_recursive_structure_shapes
|
9477 7239 | #[::tokio::test]
|
9478 - | async fn can_call_operation_with_optional_input_request() {
|
7240 + | #[::tracing_test::traced_test]
|
7241 + | async fn serializes_list_of_recursive_structure_shapes_request() {
|
9479 7242 | #[allow(unused_mut)]
|
9480 - | let mut http_request = http::Request::builder()
|
9481 - | .uri("/")
|
9482 - | .method("POST")
|
9483 - | .header("Content-Type", "application/x-amz-json-1.1")
|
9484 - | .header(
|
9485 - | "X-Amz-Target",
|
9486 - | "JsonProtocol.OperationWithOptionalInputOutput",
|
9487 - | )
|
9488 - | .body(::aws_smithy_http_server::body::Body::from(
|
9489 - | ::bytes::Bytes::from_static("{\"Value\":\"Hi\"}".as_bytes()),
|
9490 - | ))
|
9491 - | .unwrap();
|
7243 + | let mut http_request = http::Request::builder()
|
7244 + | .uri("/")
|
7245 + | .method("POST")
|
7246 + | .header("Content-Type", "application/x-amz-json-1.1")
|
7247 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
7248 + | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{\"RecursiveList\":[{\"RecursiveList\":[{\"RecursiveList\":[{\"Integer\":123}]}]}]}".as_bytes()))).unwrap();
|
9492 7249 | #[allow(unused_mut)]
|
9493 7250 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9494 7251 | let config = crate::service::JsonProtocolConfig::builder().build();
|
9495 7252 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9496 - | .operation_with_optional_input_output(
|
9497 - | move |input: crate::input::OperationWithOptionalInputOutputInput| {
|
9498 - | let sender = sender.clone();
|
9499 - | async move {
|
9500 - | let result = {
|
9501 - | let expected = crate::input::OperationWithOptionalInputOutputInput {
|
9502 - | value: ::std::option::Option::Some("Hi".to_owned()),
|
9503 - | };
|
9504 - | ::pretty_assertions::assert_eq!(input, expected);
|
9505 - | let response = crate::output::OperationWithOptionalInputOutputOutput {
|
9506 - | value: ::std::option::Option::None,
|
9507 - | };
|
9508 - | response
|
7253 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
7254 + | let sender = sender.clone();
|
7255 + | async move {
|
7256 + | let result = {
|
7257 + | use ::aws_smithy_protocol_test::FloatEquals;
|
7258 + | let expected = crate::input::KitchenSinkOperationInput {
|
7259 + | recursive_list: ::std::option::Option::Some(vec![
|
7260 + | crate::model::KitchenSink {
|
7261 + | recursive_list: ::std::option::Option::Some(vec![
|
7262 + | crate::model::KitchenSink {
|
7263 + | recursive_list: ::std::option::Option::Some(vec![
|
7264 + | crate::model::KitchenSink {
|
7265 + | integer: ::std::option::Option::Some(123),
|
7266 + | blob: ::std::option::Option::None,
|
7267 + | boolean: ::std::option::Option::None,
|
7268 + | double: ::std::option::Option::None,
|
7269 + | empty_struct: ::std::option::Option::None,
|
7270 + | float: ::std::option::Option::None,
|
7271 + | httpdate_timestamp: ::std::option::Option::None,
|
7272 + | iso8601_timestamp: ::std::option::Option::None,
|
7273 + | json_value: ::std::option::Option::None,
|
7274 + | list_of_lists: ::std::option::Option::None,
|
7275 + | list_of_maps_of_strings:
|
7276 + | ::std::option::Option::None,
|
7277 + | list_of_strings: ::std::option::Option::None,
|
7278 + | list_of_structs: ::std::option::Option::None,
|
7279 + | long: ::std::option::Option::None,
|
7280 + | map_of_lists_of_strings:
|
7281 + | ::std::option::Option::None,
|
7282 + | map_of_maps: ::std::option::Option::None,
|
7283 + | map_of_strings: ::std::option::Option::None,
|
7284 + | map_of_structs: ::std::option::Option::None,
|
7285 + | recursive_list: ::std::option::Option::None,
|
7286 + | recursive_map: ::std::option::Option::None,
|
7287 + | recursive_struct: ::std::option::Option::None,
|
7288 + | simple_struct: ::std::option::Option::None,
|
7289 + | string: ::std::option::Option::None,
|
7290 + | struct_with_json_name:
|
7291 + | ::std::option::Option::None,
|
7292 + | timestamp: ::std::option::Option::None,
|
7293 + | unix_timestamp: ::std::option::Option::None,
|
7294 + | },
|
7295 + | ]),
|
7296 + | blob: ::std::option::Option::None,
|
7297 + | boolean: ::std::option::Option::None,
|
7298 + | double: ::std::option::Option::None,
|
7299 + | empty_struct: ::std::option::Option::None,
|
7300 + | float: ::std::option::Option::None,
|
7301 + | httpdate_timestamp: ::std::option::Option::None,
|
7302 + | integer: ::std::option::Option::None,
|
7303 + | iso8601_timestamp: ::std::option::Option::None,
|
7304 + | json_value: ::std::option::Option::None,
|
7305 + | list_of_lists: ::std::option::Option::None,
|
7306 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7307 + | list_of_strings: ::std::option::Option::None,
|
7308 + | list_of_structs: ::std::option::Option::None,
|
7309 + | long: ::std::option::Option::None,
|
7310 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7311 + | map_of_maps: ::std::option::Option::None,
|
7312 + | map_of_strings: ::std::option::Option::None,
|
7313 + | map_of_structs: ::std::option::Option::None,
|
7314 + | recursive_map: ::std::option::Option::None,
|
7315 + | recursive_struct: ::std::option::Option::None,
|
7316 + | simple_struct: ::std::option::Option::None,
|
7317 + | string: ::std::option::Option::None,
|
7318 + | struct_with_json_name: ::std::option::Option::None,
|
7319 + | timestamp: ::std::option::Option::None,
|
7320 + | unix_timestamp: ::std::option::Option::None,
|
7321 + | },
|
7322 + | ]),
|
7323 + | blob: ::std::option::Option::None,
|
7324 + | boolean: ::std::option::Option::None,
|
7325 + | double: ::std::option::Option::None,
|
7326 + | empty_struct: ::std::option::Option::None,
|
7327 + | float: ::std::option::Option::None,
|
7328 + | httpdate_timestamp: ::std::option::Option::None,
|
7329 + | integer: ::std::option::Option::None,
|
7330 + | iso8601_timestamp: ::std::option::Option::None,
|
7331 + | json_value: ::std::option::Option::None,
|
7332 + | list_of_lists: ::std::option::Option::None,
|
7333 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7334 + | list_of_strings: ::std::option::Option::None,
|
7335 + | list_of_structs: ::std::option::Option::None,
|
7336 + | long: ::std::option::Option::None,
|
7337 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7338 + | map_of_maps: ::std::option::Option::None,
|
7339 + | map_of_strings: ::std::option::Option::None,
|
7340 + | map_of_structs: ::std::option::Option::None,
|
7341 + | recursive_map: ::std::option::Option::None,
|
7342 + | recursive_struct: ::std::option::Option::None,
|
7343 + | simple_struct: ::std::option::Option::None,
|
7344 + | string: ::std::option::Option::None,
|
7345 + | struct_with_json_name: ::std::option::Option::None,
|
7346 + | timestamp: ::std::option::Option::None,
|
7347 + | unix_timestamp: ::std::option::Option::None,
|
7348 + | },
|
7349 + | ]),
|
7350 + | blob: ::std::option::Option::None,
|
7351 + | boolean: ::std::option::Option::None,
|
7352 + | double: ::std::option::Option::None,
|
7353 + | empty_struct: ::std::option::Option::None,
|
7354 + | float: ::std::option::Option::None,
|
7355 + | httpdate_timestamp: ::std::option::Option::None,
|
7356 + | integer: ::std::option::Option::None,
|
7357 + | iso8601_timestamp: ::std::option::Option::None,
|
7358 + | json_value: ::std::option::Option::None,
|
7359 + | list_of_lists: ::std::option::Option::None,
|
7360 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7361 + | list_of_strings: ::std::option::Option::None,
|
7362 + | list_of_structs: ::std::option::Option::None,
|
7363 + | long: ::std::option::Option::None,
|
7364 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7365 + | map_of_maps: ::std::option::Option::None,
|
7366 + | map_of_strings: ::std::option::Option::None,
|
7367 + | map_of_structs: ::std::option::Option::None,
|
7368 + | recursive_map: ::std::option::Option::None,
|
7369 + | recursive_struct: ::std::option::Option::None,
|
7370 + | simple_struct: ::std::option::Option::None,
|
7371 + | string: ::std::option::Option::None,
|
7372 + | struct_with_json_name: ::std::option::Option::None,
|
7373 + | timestamp: ::std::option::Option::None,
|
7374 + | unix_timestamp: ::std::option::Option::None,
|
9509 7375 | };
|
9510 - | sender.send(()).await.expect("receiver dropped early");
|
9511 - | result
|
9512 - | }
|
9513 - | },
|
9514 - | )
|
9515 - | .build_unchecked();
|
9516 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9517 - | .await
|
9518 - | .expect("unable to make an HTTP request");
|
9519 - | assert!(receiver.recv().await.is_some());
|
9520 - | }
|
9521 - | }
|
9522 - | #[cfg(test)]
|
9523 - | #[allow(unreachable_code, unused_variables)]
|
9524 - | mod server_put_and_get_inline_documents_test {
|
9525 - | /// Serializes inline documents in a JSON request.
|
9526 - | /// Test ID: PutAndGetInlineDocumentsInput
|
9527 - | #[::tokio::test]
|
9528 - | async fn put_and_get_inline_documents_input_request() {
|
9529 - | #[allow(unused_mut)]
|
9530 - | let mut http_request = http::Request::builder()
|
9531 - | .uri("/")
|
9532 - | .method("POST")
|
9533 - | .header("Content-Type", "application/x-amz-json-1.1")
|
9534 - | .header("X-Amz-Target", "JsonProtocol.PutAndGetInlineDocuments")
|
9535 - | .body(::aws_smithy_http_server::body::Body::from(
|
9536 - | ::bytes::Bytes::from_static(
|
9537 - | "{\n \"inlineDocument\": {\"foo\": \"bar\"}\n}".as_bytes(),
|
9538 - | ),
|
9539 - | ))
|
9540 - | .unwrap();
|
9541 - | #[allow(unused_mut)]
|
9542 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9543 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
9544 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9545 - | .put_and_get_inline_documents(
|
9546 - | move |input: crate::input::PutAndGetInlineDocumentsInput| {
|
9547 - | let sender = sender.clone();
|
9548 - | async move {
|
9549 - | let result = {
|
9550 - | let expected = crate::input::PutAndGetInlineDocumentsInput {
|
9551 - | inline_document: ::std::option::Option::Some({
|
9552 - | let json_bytes = br#"{
|
9553 - | "foo": "bar"
|
9554 - | }"#;
|
9555 - | let mut tokens =
|
9556 - | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
9557 - | .peekable();
|
9558 - | ::aws_smithy_json::deserialize::token::expect_document(
|
9559 - | &mut tokens,
|
9560 - | )
|
9561 - | .expect("well formed json")
|
9562 - | }),
|
9563 - | };
|
9564 - | ::pretty_assertions::assert_eq!(input, expected);
|
9565 - | let response = crate::output::PutAndGetInlineDocumentsOutput {
|
9566 - | inline_document: ::std::option::Option::Some({
|
9567 - | let json_bytes = br#"null"#;
|
9568 - | let mut tokens =
|
9569 - | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
9570 - | .peekable();
|
9571 - | ::aws_smithy_json::deserialize::token::expect_document(
|
9572 - | &mut tokens,
|
9573 - | )
|
9574 - | .expect("well formed json")
|
9575 - | }),
|
9576 - | };
|
9577 - | response
|
7376 + | ::pretty_assertions::assert_eq!(
|
7377 + | input.blob,
|
7378 + | expected.blob,
|
7379 + | "Unexpected value for `blob`"
|
7380 + | );
|
7381 + | ::pretty_assertions::assert_eq!(
|
7382 + | input.boolean,
|
7383 + | expected.boolean,
|
7384 + | "Unexpected value for `boolean`"
|
7385 + | );
|
7386 + | assert!(
|
7387 + | input.double.float_equals(&expected.double),
|
7388 + | "Unexpected value for `double` {:?} vs. {:?}",
|
7389 + | expected.double,
|
7390 + | input.double
|
7391 + | );
|
7392 + | ::pretty_assertions::assert_eq!(
|
7393 + | input.empty_struct,
|
7394 + | expected.empty_struct,
|
7395 + | "Unexpected value for `empty_struct`"
|
7396 + | );
|
7397 + | assert!(
|
7398 + | input.float.float_equals(&expected.float),
|
7399 + | "Unexpected value for `float` {:?} vs. {:?}",
|
7400 + | expected.float,
|
7401 + | input.float
|
7402 + | );
|
7403 + | ::pretty_assertions::assert_eq!(
|
7404 + | input.httpdate_timestamp,
|
7405 + | expected.httpdate_timestamp,
|
7406 + | "Unexpected value for `httpdate_timestamp`"
|
7407 + | );
|
7408 + | ::pretty_assertions::assert_eq!(
|
7409 + | input.integer,
|
7410 + | expected.integer,
|
7411 + | "Unexpected value for `integer`"
|
7412 + | );
|
7413 + | ::pretty_assertions::assert_eq!(
|
7414 + | input.iso8601_timestamp,
|
7415 + | expected.iso8601_timestamp,
|
7416 + | "Unexpected value for `iso8601_timestamp`"
|
7417 + | );
|
7418 + | ::pretty_assertions::assert_eq!(
|
7419 + | input.json_value,
|
7420 + | expected.json_value,
|
7421 + | "Unexpected value for `json_value`"
|
7422 + | );
|
7423 + | ::pretty_assertions::assert_eq!(
|
7424 + | input.list_of_lists,
|
7425 + | expected.list_of_lists,
|
7426 + | "Unexpected value for `list_of_lists`"
|
7427 + | );
|
7428 + | ::pretty_assertions::assert_eq!(
|
7429 + | input.list_of_maps_of_strings,
|
7430 + | expected.list_of_maps_of_strings,
|
7431 + | "Unexpected value for `list_of_maps_of_strings`"
|
7432 + | );
|
7433 + | ::pretty_assertions::assert_eq!(
|
7434 + | input.list_of_strings,
|
7435 + | expected.list_of_strings,
|
7436 + | "Unexpected value for `list_of_strings`"
|
7437 + | );
|
7438 + | ::pretty_assertions::assert_eq!(
|
7439 + | input.list_of_structs,
|
7440 + | expected.list_of_structs,
|
7441 + | "Unexpected value for `list_of_structs`"
|
7442 + | );
|
7443 + | ::pretty_assertions::assert_eq!(
|
7444 + | input.long,
|
7445 + | expected.long,
|
7446 + | "Unexpected value for `long`"
|
7447 + | );
|
7448 + | ::pretty_assertions::assert_eq!(
|
7449 + | input.map_of_lists_of_strings,
|
7450 + | expected.map_of_lists_of_strings,
|
7451 + | "Unexpected value for `map_of_lists_of_strings`"
|
7452 + | );
|
7453 + | ::pretty_assertions::assert_eq!(
|
7454 + | input.map_of_maps,
|
7455 + | expected.map_of_maps,
|
7456 + | "Unexpected value for `map_of_maps`"
|
7457 + | );
|
7458 + | ::pretty_assertions::assert_eq!(
|
7459 + | input.map_of_strings,
|
7460 + | expected.map_of_strings,
|
7461 + | "Unexpected value for `map_of_strings`"
|
7462 + | );
|
7463 + | ::pretty_assertions::assert_eq!(
|
7464 + | input.map_of_structs,
|
7465 + | expected.map_of_structs,
|
7466 + | "Unexpected value for `map_of_structs`"
|
7467 + | );
|
7468 + | ::pretty_assertions::assert_eq!(
|
7469 + | input.recursive_list,
|
7470 + | expected.recursive_list,
|
7471 + | "Unexpected value for `recursive_list`"
|
7472 + | );
|
7473 + | ::pretty_assertions::assert_eq!(
|
7474 + | input.recursive_map,
|
7475 + | expected.recursive_map,
|
7476 + | "Unexpected value for `recursive_map`"
|
7477 + | );
|
7478 + | ::pretty_assertions::assert_eq!(
|
7479 + | input.recursive_struct,
|
7480 + | expected.recursive_struct,
|
7481 + | "Unexpected value for `recursive_struct`"
|
7482 + | );
|
7483 + | ::pretty_assertions::assert_eq!(
|
7484 + | input.simple_struct,
|
7485 + | expected.simple_struct,
|
7486 + | "Unexpected value for `simple_struct`"
|
7487 + | );
|
7488 + | ::pretty_assertions::assert_eq!(
|
7489 + | input.string,
|
7490 + | expected.string,
|
7491 + | "Unexpected value for `string`"
|
7492 + | );
|
7493 + | ::pretty_assertions::assert_eq!(
|
7494 + | input.struct_with_json_name,
|
7495 + | expected.struct_with_json_name,
|
7496 + | "Unexpected value for `struct_with_json_name`"
|
7497 + | );
|
7498 + | ::pretty_assertions::assert_eq!(
|
7499 + | input.timestamp,
|
7500 + | expected.timestamp,
|
7501 + | "Unexpected value for `timestamp`"
|
7502 + | );
|
7503 + | ::pretty_assertions::assert_eq!(
|
7504 + | input.unix_timestamp,
|
7505 + | expected.unix_timestamp,
|
7506 + | "Unexpected value for `unix_timestamp`"
|
7507 + | );
|
7508 + | let response = crate::output::KitchenSinkOperationOutput {
|
7509 + | blob: ::std::option::Option::None,
|
7510 + | boolean: ::std::option::Option::None,
|
7511 + | double: ::std::option::Option::None,
|
7512 + | empty_struct: ::std::option::Option::None,
|
7513 + | float: ::std::option::Option::None,
|
7514 + | httpdate_timestamp: ::std::option::Option::None,
|
7515 + | integer: ::std::option::Option::None,
|
7516 + | iso8601_timestamp: ::std::option::Option::None,
|
7517 + | json_value: ::std::option::Option::None,
|
7518 + | list_of_lists: ::std::option::Option::None,
|
7519 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7520 + | list_of_strings: ::std::option::Option::None,
|
7521 + | list_of_structs: ::std::option::Option::None,
|
7522 + | long: ::std::option::Option::None,
|
7523 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7524 + | map_of_maps: ::std::option::Option::None,
|
7525 + | map_of_strings: ::std::option::Option::None,
|
7526 + | map_of_structs: ::std::option::Option::None,
|
7527 + | recursive_list: ::std::option::Option::None,
|
7528 + | recursive_map: ::std::option::Option::None,
|
7529 + | recursive_struct: ::std::option::Option::None,
|
7530 + | simple_struct: ::std::option::Option::None,
|
7531 + | string: ::std::option::Option::None,
|
7532 + | struct_with_json_name: ::std::option::Option::None,
|
7533 + | timestamp: ::std::option::Option::None,
|
7534 + | unix_timestamp: ::std::option::Option::None,
|
9578 7535 | };
|
9579 - | sender.send(()).await.expect("receiver dropped early");
|
9580 - | result
|
9581 - | }
|
9582 - | },
|
9583 - | )
|
7536 + | Ok(response)
|
7537 + | };
|
7538 + | sender.send(()).await.expect("receiver dropped early");
|
7539 + | result
|
7540 + | }
|
7541 + | })
|
9584 7542 | .build_unchecked();
|
9585 7543 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9586 7544 | .await
|
9587 7545 | .expect("unable to make an HTTP request");
|
9588 - | assert!(receiver.recv().await.is_some());
|
7546 + | assert!(
|
7547 + | receiver.recv().await.is_some(),
|
7548 + | "we expected operation handler to be invoked but it was not entered"
|
7549 + | );
|
9589 7550 | }
|
9590 - | /// Serializes inline documents in a JSON response.
|
9591 - | /// Test ID: PutAndGetInlineDocumentsInput
|
7551 + | /// Serializes map shapes
|
7552 + | /// Test ID: serializes_map_shapes
|
9592 7553 | #[::tokio::test]
|
9593 - | async fn put_and_get_inline_documents_input_response() {
|
9594 - | let output = crate::output::PutAndGetInlineDocumentsOutput {
|
9595 - | inline_document: ::std::option::Option::Some({
|
9596 - | let json_bytes = br#"{
|
9597 - | "foo": "bar"
|
9598 - | }"#;
|
9599 - | let mut tokens =
|
9600 - | ::aws_smithy_json::deserialize::json_token_iter(json_bytes).peekable();
|
9601 - | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
9602 - | .expect("well formed json")
|
9603 - | }),
|
9604 - | };
|
9605 - | use ::aws_smithy_http_server::response::IntoResponse;
|
9606 - | let http_response = output.into_response();
|
9607 - | ::pretty_assertions::assert_eq!(
|
9608 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
9609 - | http_response.status()
|
9610 - | );
|
9611 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
9612 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9613 - | http_response.headers(),
|
9614 - | expected_headers,
|
9615 - | ));
|
9616 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7554 + | #[::tracing_test::traced_test]
|
7555 + | async fn serializes_map_shapes_request() {
|
7556 + | #[allow(unused_mut)]
|
7557 + | let mut http_request = http::Request::builder()
|
7558 + | .uri("/")
|
7559 + | .method("POST")
|
7560 + | .header("Content-Type", "application/x-amz-json-1.1")
|
7561 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
7562 + | .body(::aws_smithy_http_server::body::Body::from(
|
7563 + | ::bytes::Bytes::from_static(
|
7564 + | "{\"MapOfStrings\":{\"abc\":\"xyz\",\"mno\":\"hjk\"}}".as_bytes(),
|
7565 + | ),
|
7566 + | ))
|
7567 + | .unwrap();
|
7568 + | #[allow(unused_mut)]
|
7569 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7570 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
7571 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
7572 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
7573 + | let sender = sender.clone();
|
7574 + | async move {
|
7575 + | let result = {
|
7576 + | use ::aws_smithy_protocol_test::FloatEquals;
|
7577 + | let expected = crate::input::KitchenSinkOperationInput {
|
7578 + | map_of_strings: ::std::option::Option::Some({
|
7579 + | let mut ret = ::std::collections::HashMap::new();
|
7580 + | ret.insert("abc".to_owned(), "xyz".to_owned());
|
7581 + | ret.insert("mno".to_owned(), "hjk".to_owned());
|
7582 + | ret
|
7583 + | }),
|
7584 + | blob: ::std::option::Option::None,
|
7585 + | boolean: ::std::option::Option::None,
|
7586 + | double: ::std::option::Option::None,
|
7587 + | empty_struct: ::std::option::Option::None,
|
7588 + | float: ::std::option::Option::None,
|
7589 + | httpdate_timestamp: ::std::option::Option::None,
|
7590 + | integer: ::std::option::Option::None,
|
7591 + | iso8601_timestamp: ::std::option::Option::None,
|
7592 + | json_value: ::std::option::Option::None,
|
7593 + | list_of_lists: ::std::option::Option::None,
|
7594 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7595 + | list_of_strings: ::std::option::Option::None,
|
7596 + | list_of_structs: ::std::option::Option::None,
|
7597 + | long: ::std::option::Option::None,
|
7598 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7599 + | map_of_maps: ::std::option::Option::None,
|
7600 + | map_of_structs: ::std::option::Option::None,
|
7601 + | recursive_list: ::std::option::Option::None,
|
7602 + | recursive_map: ::std::option::Option::None,
|
7603 + | recursive_struct: ::std::option::Option::None,
|
7604 + | simple_struct: ::std::option::Option::None,
|
7605 + | string: ::std::option::Option::None,
|
7606 + | struct_with_json_name: ::std::option::Option::None,
|
7607 + | timestamp: ::std::option::Option::None,
|
7608 + | unix_timestamp: ::std::option::Option::None,
|
7609 + | };
|
7610 + | ::pretty_assertions::assert_eq!(
|
7611 + | input.blob,
|
7612 + | expected.blob,
|
7613 + | "Unexpected value for `blob`"
|
7614 + | );
|
7615 + | ::pretty_assertions::assert_eq!(
|
7616 + | input.boolean,
|
7617 + | expected.boolean,
|
7618 + | "Unexpected value for `boolean`"
|
7619 + | );
|
7620 + | assert!(
|
7621 + | input.double.float_equals(&expected.double),
|
7622 + | "Unexpected value for `double` {:?} vs. {:?}",
|
7623 + | expected.double,
|
7624 + | input.double
|
7625 + | );
|
7626 + | ::pretty_assertions::assert_eq!(
|
7627 + | input.empty_struct,
|
7628 + | expected.empty_struct,
|
7629 + | "Unexpected value for `empty_struct`"
|
7630 + | );
|
7631 + | assert!(
|
7632 + | input.float.float_equals(&expected.float),
|
7633 + | "Unexpected value for `float` {:?} vs. {:?}",
|
7634 + | expected.float,
|
7635 + | input.float
|
7636 + | );
|
7637 + | ::pretty_assertions::assert_eq!(
|
7638 + | input.httpdate_timestamp,
|
7639 + | expected.httpdate_timestamp,
|
7640 + | "Unexpected value for `httpdate_timestamp`"
|
7641 + | );
|
7642 + | ::pretty_assertions::assert_eq!(
|
7643 + | input.integer,
|
7644 + | expected.integer,
|
7645 + | "Unexpected value for `integer`"
|
7646 + | );
|
7647 + | ::pretty_assertions::assert_eq!(
|
7648 + | input.iso8601_timestamp,
|
7649 + | expected.iso8601_timestamp,
|
7650 + | "Unexpected value for `iso8601_timestamp`"
|
7651 + | );
|
7652 + | ::pretty_assertions::assert_eq!(
|
7653 + | input.json_value,
|
7654 + | expected.json_value,
|
7655 + | "Unexpected value for `json_value`"
|
7656 + | );
|
7657 + | ::pretty_assertions::assert_eq!(
|
7658 + | input.list_of_lists,
|
7659 + | expected.list_of_lists,
|
7660 + | "Unexpected value for `list_of_lists`"
|
7661 + | );
|
7662 + | ::pretty_assertions::assert_eq!(
|
7663 + | input.list_of_maps_of_strings,
|
7664 + | expected.list_of_maps_of_strings,
|
7665 + | "Unexpected value for `list_of_maps_of_strings`"
|
7666 + | );
|
7667 + | ::pretty_assertions::assert_eq!(
|
7668 + | input.list_of_strings,
|
7669 + | expected.list_of_strings,
|
7670 + | "Unexpected value for `list_of_strings`"
|
7671 + | );
|
7672 + | ::pretty_assertions::assert_eq!(
|
7673 + | input.list_of_structs,
|
7674 + | expected.list_of_structs,
|
7675 + | "Unexpected value for `list_of_structs`"
|
7676 + | );
|
7677 + | ::pretty_assertions::assert_eq!(
|
7678 + | input.long,
|
7679 + | expected.long,
|
7680 + | "Unexpected value for `long`"
|
7681 + | );
|
7682 + | ::pretty_assertions::assert_eq!(
|
7683 + | input.map_of_lists_of_strings,
|
7684 + | expected.map_of_lists_of_strings,
|
7685 + | "Unexpected value for `map_of_lists_of_strings`"
|
7686 + | );
|
7687 + | ::pretty_assertions::assert_eq!(
|
7688 + | input.map_of_maps,
|
7689 + | expected.map_of_maps,
|
7690 + | "Unexpected value for `map_of_maps`"
|
7691 + | );
|
7692 + | ::pretty_assertions::assert_eq!(
|
7693 + | input.map_of_strings,
|
7694 + | expected.map_of_strings,
|
7695 + | "Unexpected value for `map_of_strings`"
|
7696 + | );
|
7697 + | ::pretty_assertions::assert_eq!(
|
7698 + | input.map_of_structs,
|
7699 + | expected.map_of_structs,
|
7700 + | "Unexpected value for `map_of_structs`"
|
7701 + | );
|
7702 + | ::pretty_assertions::assert_eq!(
|
7703 + | input.recursive_list,
|
7704 + | expected.recursive_list,
|
7705 + | "Unexpected value for `recursive_list`"
|
7706 + | );
|
7707 + | ::pretty_assertions::assert_eq!(
|
7708 + | input.recursive_map,
|
7709 + | expected.recursive_map,
|
7710 + | "Unexpected value for `recursive_map`"
|
7711 + | );
|
7712 + | ::pretty_assertions::assert_eq!(
|
7713 + | input.recursive_struct,
|
7714 + | expected.recursive_struct,
|
7715 + | "Unexpected value for `recursive_struct`"
|
7716 + | );
|
7717 + | ::pretty_assertions::assert_eq!(
|
7718 + | input.simple_struct,
|
7719 + | expected.simple_struct,
|
7720 + | "Unexpected value for `simple_struct`"
|
7721 + | );
|
7722 + | ::pretty_assertions::assert_eq!(
|
7723 + | input.string,
|
7724 + | expected.string,
|
7725 + | "Unexpected value for `string`"
|
7726 + | );
|
7727 + | ::pretty_assertions::assert_eq!(
|
7728 + | input.struct_with_json_name,
|
7729 + | expected.struct_with_json_name,
|
7730 + | "Unexpected value for `struct_with_json_name`"
|
7731 + | );
|
7732 + | ::pretty_assertions::assert_eq!(
|
7733 + | input.timestamp,
|
7734 + | expected.timestamp,
|
7735 + | "Unexpected value for `timestamp`"
|
7736 + | );
|
7737 + | ::pretty_assertions::assert_eq!(
|
7738 + | input.unix_timestamp,
|
7739 + | expected.unix_timestamp,
|
7740 + | "Unexpected value for `unix_timestamp`"
|
7741 + | );
|
7742 + | let response = crate::output::KitchenSinkOperationOutput {
|
7743 + | blob: ::std::option::Option::None,
|
7744 + | boolean: ::std::option::Option::None,
|
7745 + | double: ::std::option::Option::None,
|
7746 + | empty_struct: ::std::option::Option::None,
|
7747 + | float: ::std::option::Option::None,
|
7748 + | httpdate_timestamp: ::std::option::Option::None,
|
7749 + | integer: ::std::option::Option::None,
|
7750 + | iso8601_timestamp: ::std::option::Option::None,
|
7751 + | json_value: ::std::option::Option::None,
|
7752 + | list_of_lists: ::std::option::Option::None,
|
7753 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7754 + | list_of_strings: ::std::option::Option::None,
|
7755 + | list_of_structs: ::std::option::Option::None,
|
7756 + | long: ::std::option::Option::None,
|
7757 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7758 + | map_of_maps: ::std::option::Option::None,
|
7759 + | map_of_strings: ::std::option::Option::None,
|
7760 + | map_of_structs: ::std::option::Option::None,
|
7761 + | recursive_list: ::std::option::Option::None,
|
7762 + | recursive_map: ::std::option::Option::None,
|
7763 + | recursive_struct: ::std::option::Option::None,
|
7764 + | simple_struct: ::std::option::Option::None,
|
7765 + | string: ::std::option::Option::None,
|
7766 + | struct_with_json_name: ::std::option::Option::None,
|
7767 + | timestamp: ::std::option::Option::None,
|
7768 + | unix_timestamp: ::std::option::Option::None,
|
7769 + | };
|
7770 + | Ok(response)
|
7771 + | };
|
7772 + | sender.send(()).await.expect("receiver dropped early");
|
7773 + | result
|
7774 + | }
|
7775 + | })
|
7776 + | .build_unchecked();
|
7777 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9617 7778 | .await
|
9618 - | .expect("unable to extract body to bytes");
|
9619 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
9620 - | &body,
|
9621 - | "{\n \"inlineDocument\": {\"foo\": \"bar\"}\n}",
|
9622 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9623 - | ));
|
7779 + | .expect("unable to make an HTTP request");
|
7780 + | assert!(
|
7781 + | receiver.recv().await.is_some(),
|
7782 + | "we expected operation handler to be invoked but it was not entered"
|
7783 + | );
|
9624 7784 | }
|
9625 - | }
|
9626 - | #[cfg(test)]
|
9627 - | #[allow(unreachable_code, unused_variables)]
|
9628 - | mod server_simple_scalar_properties_test {
|
9629 - | /// Supports handling NaN float values.
|
9630 - | /// Test ID: AwsJson11SupportsNaNFloatInputs
|
7785 + | /// Serializes empty map shapes
|
7786 + | /// Test ID: serializes_empty_map_shapes
|
9631 7787 | #[::tokio::test]
|
9632 - | async fn aws_json11_supports_na_n_float_inputs_request() {
|
7788 + | #[::tracing_test::traced_test]
|
7789 + | async fn serializes_empty_map_shapes_request() {
|
9633 7790 | #[allow(unused_mut)]
|
9634 7791 | let mut http_request = http::Request::builder()
|
9635 7792 | .uri("/")
|
9636 7793 | .method("POST")
|
9637 7794 | .header("Content-Type", "application/x-amz-json-1.1")
|
9638 - | .header("X-Amz-Target", "JsonProtocol.SimpleScalarProperties")
|
7795 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
9639 7796 | .body(::aws_smithy_http_server::body::Body::from(
|
9640 - | ::bytes::Bytes::from_static(
|
9641 - | "{\n \"floatValue\": \"NaN\",\n \"doubleValue\": \"NaN\"\n}".as_bytes(),
|
9642 - | ),
|
7797 + | ::bytes::Bytes::from_static("{\"MapOfStrings\":{}}".as_bytes()),
|
9643 7798 | ))
|
9644 7799 | .unwrap();
|
9645 7800 | #[allow(unused_mut)]
|
9646 7801 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9647 7802 | let config = crate::service::JsonProtocolConfig::builder().build();
|
9648 7803 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9649 - | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
9650 - | let sender = sender.clone();
|
9651 - | async move {
|
9652 - | let result = { use ::aws_smithy_protocol_test::FloatEquals;
|
9653 - | let expected =
|
9654 - | crate::input::SimpleScalarPropertiesInput {
|
9655 - | float_value:
|
9656 - | ::std::option::Option::Some(
|
9657 - | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number")
|
9658 - | )
|
9659 - | ,
|
9660 - | double_value:
|
9661 - | ::std::option::Option::Some(
|
9662 - | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number")
|
9663 - | )
|
9664 - | ,
|
9665 - | }
|
9666 - | ;
|
9667 - | assert!(input.float_value.float_equals(&expected.float_value),
|
9668 - | "Unexpected value for `float_value` {:?} vs. {:?}", expected.float_value, input.float_value);
|
9669 - | assert!(input.double_value.float_equals(&expected.double_value),
|
9670 - | "Unexpected value for `double_value` {:?} vs. {:?}", expected.double_value, input.double_value);
|
9671 - | let response =
|
9672 - | crate::output::SimpleScalarPropertiesOutput {
|
9673 - | float_value:
|
9674 - | ::std::option::Option::None
|
9675 - | ,
|
9676 - | double_value:
|
9677 - | ::std::option::Option::None
|
9678 - | ,
|
9679 - | }
|
9680 - | ;
|
9681 - | response };
|
9682 - | sender.send(()).await.expect("receiver dropped early");
|
9683 - | result
|
9684 - | }
|
9685 - | })
|
9686 - | .build_unchecked();
|
7804 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
7805 + | let sender = sender.clone();
|
7806 + | async move {
|
7807 + | let result = {
|
7808 + | use ::aws_smithy_protocol_test::FloatEquals;
|
7809 + | let expected = crate::input::KitchenSinkOperationInput {
|
7810 + | map_of_strings: ::std::option::Option::Some(
|
7811 + | ::std::collections::HashMap::new(),
|
7812 + | ),
|
7813 + | blob: ::std::option::Option::None,
|
7814 + | boolean: ::std::option::Option::None,
|
7815 + | double: ::std::option::Option::None,
|
7816 + | empty_struct: ::std::option::Option::None,
|
7817 + | float: ::std::option::Option::None,
|
7818 + | httpdate_timestamp: ::std::option::Option::None,
|
7819 + | integer: ::std::option::Option::None,
|
7820 + | iso8601_timestamp: ::std::option::Option::None,
|
7821 + | json_value: ::std::option::Option::None,
|
7822 + | list_of_lists: ::std::option::Option::None,
|
7823 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7824 + | list_of_strings: ::std::option::Option::None,
|
7825 + | list_of_structs: ::std::option::Option::None,
|
7826 + | long: ::std::option::Option::None,
|
7827 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7828 + | map_of_maps: ::std::option::Option::None,
|
7829 + | map_of_structs: ::std::option::Option::None,
|
7830 + | recursive_list: ::std::option::Option::None,
|
7831 + | recursive_map: ::std::option::Option::None,
|
7832 + | recursive_struct: ::std::option::Option::None,
|
7833 + | simple_struct: ::std::option::Option::None,
|
7834 + | string: ::std::option::Option::None,
|
7835 + | struct_with_json_name: ::std::option::Option::None,
|
7836 + | timestamp: ::std::option::Option::None,
|
7837 + | unix_timestamp: ::std::option::Option::None,
|
7838 + | };
|
7839 + | ::pretty_assertions::assert_eq!(
|
7840 + | input.blob,
|
7841 + | expected.blob,
|
7842 + | "Unexpected value for `blob`"
|
7843 + | );
|
7844 + | ::pretty_assertions::assert_eq!(
|
7845 + | input.boolean,
|
7846 + | expected.boolean,
|
7847 + | "Unexpected value for `boolean`"
|
7848 + | );
|
7849 + | assert!(
|
7850 + | input.double.float_equals(&expected.double),
|
7851 + | "Unexpected value for `double` {:?} vs. {:?}",
|
7852 + | expected.double,
|
7853 + | input.double
|
7854 + | );
|
7855 + | ::pretty_assertions::assert_eq!(
|
7856 + | input.empty_struct,
|
7857 + | expected.empty_struct,
|
7858 + | "Unexpected value for `empty_struct`"
|
7859 + | );
|
7860 + | assert!(
|
7861 + | input.float.float_equals(&expected.float),
|
7862 + | "Unexpected value for `float` {:?} vs. {:?}",
|
7863 + | expected.float,
|
7864 + | input.float
|
7865 + | );
|
7866 + | ::pretty_assertions::assert_eq!(
|
7867 + | input.httpdate_timestamp,
|
7868 + | expected.httpdate_timestamp,
|
7869 + | "Unexpected value for `httpdate_timestamp`"
|
7870 + | );
|
7871 + | ::pretty_assertions::assert_eq!(
|
7872 + | input.integer,
|
7873 + | expected.integer,
|
7874 + | "Unexpected value for `integer`"
|
7875 + | );
|
7876 + | ::pretty_assertions::assert_eq!(
|
7877 + | input.iso8601_timestamp,
|
7878 + | expected.iso8601_timestamp,
|
7879 + | "Unexpected value for `iso8601_timestamp`"
|
7880 + | );
|
7881 + | ::pretty_assertions::assert_eq!(
|
7882 + | input.json_value,
|
7883 + | expected.json_value,
|
7884 + | "Unexpected value for `json_value`"
|
7885 + | );
|
7886 + | ::pretty_assertions::assert_eq!(
|
7887 + | input.list_of_lists,
|
7888 + | expected.list_of_lists,
|
7889 + | "Unexpected value for `list_of_lists`"
|
7890 + | );
|
7891 + | ::pretty_assertions::assert_eq!(
|
7892 + | input.list_of_maps_of_strings,
|
7893 + | expected.list_of_maps_of_strings,
|
7894 + | "Unexpected value for `list_of_maps_of_strings`"
|
7895 + | );
|
7896 + | ::pretty_assertions::assert_eq!(
|
7897 + | input.list_of_strings,
|
7898 + | expected.list_of_strings,
|
7899 + | "Unexpected value for `list_of_strings`"
|
7900 + | );
|
7901 + | ::pretty_assertions::assert_eq!(
|
7902 + | input.list_of_structs,
|
7903 + | expected.list_of_structs,
|
7904 + | "Unexpected value for `list_of_structs`"
|
7905 + | );
|
7906 + | ::pretty_assertions::assert_eq!(
|
7907 + | input.long,
|
7908 + | expected.long,
|
7909 + | "Unexpected value for `long`"
|
7910 + | );
|
7911 + | ::pretty_assertions::assert_eq!(
|
7912 + | input.map_of_lists_of_strings,
|
7913 + | expected.map_of_lists_of_strings,
|
7914 + | "Unexpected value for `map_of_lists_of_strings`"
|
7915 + | );
|
7916 + | ::pretty_assertions::assert_eq!(
|
7917 + | input.map_of_maps,
|
7918 + | expected.map_of_maps,
|
7919 + | "Unexpected value for `map_of_maps`"
|
7920 + | );
|
7921 + | ::pretty_assertions::assert_eq!(
|
7922 + | input.map_of_strings,
|
7923 + | expected.map_of_strings,
|
7924 + | "Unexpected value for `map_of_strings`"
|
7925 + | );
|
7926 + | ::pretty_assertions::assert_eq!(
|
7927 + | input.map_of_structs,
|
7928 + | expected.map_of_structs,
|
7929 + | "Unexpected value for `map_of_structs`"
|
7930 + | );
|
7931 + | ::pretty_assertions::assert_eq!(
|
7932 + | input.recursive_list,
|
7933 + | expected.recursive_list,
|
7934 + | "Unexpected value for `recursive_list`"
|
7935 + | );
|
7936 + | ::pretty_assertions::assert_eq!(
|
7937 + | input.recursive_map,
|
7938 + | expected.recursive_map,
|
7939 + | "Unexpected value for `recursive_map`"
|
7940 + | );
|
7941 + | ::pretty_assertions::assert_eq!(
|
7942 + | input.recursive_struct,
|
7943 + | expected.recursive_struct,
|
7944 + | "Unexpected value for `recursive_struct`"
|
7945 + | );
|
7946 + | ::pretty_assertions::assert_eq!(
|
7947 + | input.simple_struct,
|
7948 + | expected.simple_struct,
|
7949 + | "Unexpected value for `simple_struct`"
|
7950 + | );
|
7951 + | ::pretty_assertions::assert_eq!(
|
7952 + | input.string,
|
7953 + | expected.string,
|
7954 + | "Unexpected value for `string`"
|
7955 + | );
|
7956 + | ::pretty_assertions::assert_eq!(
|
7957 + | input.struct_with_json_name,
|
7958 + | expected.struct_with_json_name,
|
7959 + | "Unexpected value for `struct_with_json_name`"
|
7960 + | );
|
7961 + | ::pretty_assertions::assert_eq!(
|
7962 + | input.timestamp,
|
7963 + | expected.timestamp,
|
7964 + | "Unexpected value for `timestamp`"
|
7965 + | );
|
7966 + | ::pretty_assertions::assert_eq!(
|
7967 + | input.unix_timestamp,
|
7968 + | expected.unix_timestamp,
|
7969 + | "Unexpected value for `unix_timestamp`"
|
7970 + | );
|
7971 + | let response = crate::output::KitchenSinkOperationOutput {
|
7972 + | blob: ::std::option::Option::None,
|
7973 + | boolean: ::std::option::Option::None,
|
7974 + | double: ::std::option::Option::None,
|
7975 + | empty_struct: ::std::option::Option::None,
|
7976 + | float: ::std::option::Option::None,
|
7977 + | httpdate_timestamp: ::std::option::Option::None,
|
7978 + | integer: ::std::option::Option::None,
|
7979 + | iso8601_timestamp: ::std::option::Option::None,
|
7980 + | json_value: ::std::option::Option::None,
|
7981 + | list_of_lists: ::std::option::Option::None,
|
7982 + | list_of_maps_of_strings: ::std::option::Option::None,
|
7983 + | list_of_strings: ::std::option::Option::None,
|
7984 + | list_of_structs: ::std::option::Option::None,
|
7985 + | long: ::std::option::Option::None,
|
7986 + | map_of_lists_of_strings: ::std::option::Option::None,
|
7987 + | map_of_maps: ::std::option::Option::None,
|
7988 + | map_of_strings: ::std::option::Option::None,
|
7989 + | map_of_structs: ::std::option::Option::None,
|
7990 + | recursive_list: ::std::option::Option::None,
|
7991 + | recursive_map: ::std::option::Option::None,
|
7992 + | recursive_struct: ::std::option::Option::None,
|
7993 + | simple_struct: ::std::option::Option::None,
|
7994 + | string: ::std::option::Option::None,
|
7995 + | struct_with_json_name: ::std::option::Option::None,
|
7996 + | timestamp: ::std::option::Option::None,
|
7997 + | unix_timestamp: ::std::option::Option::None,
|
7998 + | };
|
7999 + | Ok(response)
|
8000 + | };
|
8001 + | sender.send(()).await.expect("receiver dropped early");
|
8002 + | result
|
8003 + | }
|
8004 + | })
|
8005 + | .build_unchecked();
|
9687 8006 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9688 8007 | .await
|
9689 8008 | .expect("unable to make an HTTP request");
|
9690 - | assert!(receiver.recv().await.is_some());
|
8009 + | assert!(
|
8010 + | receiver.recv().await.is_some(),
|
8011 + | "we expected operation handler to be invoked but it was not entered"
|
8012 + | );
|
9691 8013 | }
|
9692 - | /// Supports handling Infinity float values.
|
9693 - | /// Test ID: AwsJson11SupportsInfinityFloatInputs
|
8014 + | /// Serializes map of list shapes
|
8015 + | /// Test ID: serializes_map_of_list_shapes
|
9694 8016 | #[::tokio::test]
|
9695 - | async fn aws_json11_supports_infinity_float_inputs_request() {
|
8017 + | #[::tracing_test::traced_test]
|
8018 + | async fn serializes_map_of_list_shapes_request() {
|
9696 8019 | #[allow(unused_mut)]
|
9697 - | let mut http_request = http::Request::builder()
|
9698 - | .uri("/")
|
9699 - | .method("POST")
|
9700 - | .header("Content-Type", "application/x-amz-json-1.1")
|
9701 - | .header("X-Amz-Target", "JsonProtocol.SimpleScalarProperties")
|
9702 - | .body(::aws_smithy_http_server::body::Body::from(
|
9703 - | ::bytes::Bytes::from_static(
|
9704 - | "{\n \"floatValue\": \"Infinity\",\n \"doubleValue\": \"Infinity\"\n}"
|
9705 - | .as_bytes(),
|
9706 - | ),
|
9707 - | ))
|
9708 - | .unwrap();
|
8020 + | let mut http_request = http::Request::builder()
|
8021 + | .uri("/")
|
8022 + | .method("POST")
|
8023 + | .header("Content-Type", "application/x-amz-json-1.1")
|
8024 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
8025 + | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{\"MapOfListsOfStrings\":{\"abc\":[\"abc\",\"xyz\"],\"mno\":[\"xyz\",\"abc\"]}}".as_bytes()))).unwrap();
|
9709 8026 | #[allow(unused_mut)]
|
9710 8027 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9711 8028 | let config = crate::service::JsonProtocolConfig::builder().build();
|
9712 8029 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9713 - | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
9714 - | let sender = sender.clone();
|
9715 - | async move {
|
9716 - | let result = { use ::aws_smithy_protocol_test::FloatEquals;
|
9717 - | let expected =
|
9718 - | crate::input::SimpleScalarPropertiesInput {
|
9719 - | float_value:
|
9720 - | ::std::option::Option::Some(
|
9721 - | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number")
|
9722 - | )
|
9723 - | ,
|
9724 - | double_value:
|
9725 - | ::std::option::Option::Some(
|
9726 - | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number")
|
9727 - | )
|
9728 - | ,
|
9729 - | }
|
9730 - | ;
|
9731 - | assert!(input.float_value.float_equals(&expected.float_value),
|
9732 - | "Unexpected value for `float_value` {:?} vs. {:?}", expected.float_value, input.float_value);
|
9733 - | assert!(input.double_value.float_equals(&expected.double_value),
|
9734 - | "Unexpected value for `double_value` {:?} vs. {:?}", expected.double_value, input.double_value);
|
9735 - | let response =
|
9736 - | crate::output::SimpleScalarPropertiesOutput {
|
9737 - | float_value:
|
9738 - | ::std::option::Option::None
|
9739 - | ,
|
9740 - | double_value:
|
9741 - | ::std::option::Option::None
|
9742 - | ,
|
9743 - | }
|
9744 - | ;
|
9745 - | response };
|
9746 - | sender.send(()).await.expect("receiver dropped early");
|
9747 - | result
|
9748 - | }
|
9749 - | })
|
9750 - | .build_unchecked();
|
8030 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
8031 + | let sender = sender.clone();
|
8032 + | async move {
|
8033 + | let result = {
|
8034 + | use ::aws_smithy_protocol_test::FloatEquals;
|
8035 + | let expected = crate::input::KitchenSinkOperationInput {
|
8036 + | map_of_lists_of_strings: ::std::option::Option::Some({
|
8037 + | let mut ret = ::std::collections::HashMap::new();
|
8038 + | ret.insert(
|
8039 + | "abc".to_owned(),
|
8040 + | vec!["abc".to_owned(), "xyz".to_owned()],
|
8041 + | );
|
8042 + | ret.insert(
|
8043 + | "mno".to_owned(),
|
8044 + | vec!["xyz".to_owned(), "abc".to_owned()],
|
8045 + | );
|
8046 + | ret
|
8047 + | }),
|
8048 + | blob: ::std::option::Option::None,
|
8049 + | boolean: ::std::option::Option::None,
|
8050 + | double: ::std::option::Option::None,
|
8051 + | empty_struct: ::std::option::Option::None,
|
8052 + | float: ::std::option::Option::None,
|
8053 + | httpdate_timestamp: ::std::option::Option::None,
|
8054 + | integer: ::std::option::Option::None,
|
8055 + | iso8601_timestamp: ::std::option::Option::None,
|
8056 + | json_value: ::std::option::Option::None,
|
8057 + | list_of_lists: ::std::option::Option::None,
|
8058 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8059 + | list_of_strings: ::std::option::Option::None,
|
8060 + | list_of_structs: ::std::option::Option::None,
|
8061 + | long: ::std::option::Option::None,
|
8062 + | map_of_maps: ::std::option::Option::None,
|
8063 + | map_of_strings: ::std::option::Option::None,
|
8064 + | map_of_structs: ::std::option::Option::None,
|
8065 + | recursive_list: ::std::option::Option::None,
|
8066 + | recursive_map: ::std::option::Option::None,
|
8067 + | recursive_struct: ::std::option::Option::None,
|
8068 + | simple_struct: ::std::option::Option::None,
|
8069 + | string: ::std::option::Option::None,
|
8070 + | struct_with_json_name: ::std::option::Option::None,
|
8071 + | timestamp: ::std::option::Option::None,
|
8072 + | unix_timestamp: ::std::option::Option::None,
|
8073 + | };
|
8074 + | ::pretty_assertions::assert_eq!(
|
8075 + | input.blob,
|
8076 + | expected.blob,
|
8077 + | "Unexpected value for `blob`"
|
8078 + | );
|
8079 + | ::pretty_assertions::assert_eq!(
|
8080 + | input.boolean,
|
8081 + | expected.boolean,
|
8082 + | "Unexpected value for `boolean`"
|
8083 + | );
|
8084 + | assert!(
|
8085 + | input.double.float_equals(&expected.double),
|
8086 + | "Unexpected value for `double` {:?} vs. {:?}",
|
8087 + | expected.double,
|
8088 + | input.double
|
8089 + | );
|
8090 + | ::pretty_assertions::assert_eq!(
|
8091 + | input.empty_struct,
|
8092 + | expected.empty_struct,
|
8093 + | "Unexpected value for `empty_struct`"
|
8094 + | );
|
8095 + | assert!(
|
8096 + | input.float.float_equals(&expected.float),
|
8097 + | "Unexpected value for `float` {:?} vs. {:?}",
|
8098 + | expected.float,
|
8099 + | input.float
|
8100 + | );
|
8101 + | ::pretty_assertions::assert_eq!(
|
8102 + | input.httpdate_timestamp,
|
8103 + | expected.httpdate_timestamp,
|
8104 + | "Unexpected value for `httpdate_timestamp`"
|
8105 + | );
|
8106 + | ::pretty_assertions::assert_eq!(
|
8107 + | input.integer,
|
8108 + | expected.integer,
|
8109 + | "Unexpected value for `integer`"
|
8110 + | );
|
8111 + | ::pretty_assertions::assert_eq!(
|
8112 + | input.iso8601_timestamp,
|
8113 + | expected.iso8601_timestamp,
|
8114 + | "Unexpected value for `iso8601_timestamp`"
|
8115 + | );
|
8116 + | ::pretty_assertions::assert_eq!(
|
8117 + | input.json_value,
|
8118 + | expected.json_value,
|
8119 + | "Unexpected value for `json_value`"
|
8120 + | );
|
8121 + | ::pretty_assertions::assert_eq!(
|
8122 + | input.list_of_lists,
|
8123 + | expected.list_of_lists,
|
8124 + | "Unexpected value for `list_of_lists`"
|
8125 + | );
|
8126 + | ::pretty_assertions::assert_eq!(
|
8127 + | input.list_of_maps_of_strings,
|
8128 + | expected.list_of_maps_of_strings,
|
8129 + | "Unexpected value for `list_of_maps_of_strings`"
|
8130 + | );
|
8131 + | ::pretty_assertions::assert_eq!(
|
8132 + | input.list_of_strings,
|
8133 + | expected.list_of_strings,
|
8134 + | "Unexpected value for `list_of_strings`"
|
8135 + | );
|
8136 + | ::pretty_assertions::assert_eq!(
|
8137 + | input.list_of_structs,
|
8138 + | expected.list_of_structs,
|
8139 + | "Unexpected value for `list_of_structs`"
|
8140 + | );
|
8141 + | ::pretty_assertions::assert_eq!(
|
8142 + | input.long,
|
8143 + | expected.long,
|
8144 + | "Unexpected value for `long`"
|
8145 + | );
|
8146 + | ::pretty_assertions::assert_eq!(
|
8147 + | input.map_of_lists_of_strings,
|
8148 + | expected.map_of_lists_of_strings,
|
8149 + | "Unexpected value for `map_of_lists_of_strings`"
|
8150 + | );
|
8151 + | ::pretty_assertions::assert_eq!(
|
8152 + | input.map_of_maps,
|
8153 + | expected.map_of_maps,
|
8154 + | "Unexpected value for `map_of_maps`"
|
8155 + | );
|
8156 + | ::pretty_assertions::assert_eq!(
|
8157 + | input.map_of_strings,
|
8158 + | expected.map_of_strings,
|
8159 + | "Unexpected value for `map_of_strings`"
|
8160 + | );
|
8161 + | ::pretty_assertions::assert_eq!(
|
8162 + | input.map_of_structs,
|
8163 + | expected.map_of_structs,
|
8164 + | "Unexpected value for `map_of_structs`"
|
8165 + | );
|
8166 + | ::pretty_assertions::assert_eq!(
|
8167 + | input.recursive_list,
|
8168 + | expected.recursive_list,
|
8169 + | "Unexpected value for `recursive_list`"
|
8170 + | );
|
8171 + | ::pretty_assertions::assert_eq!(
|
8172 + | input.recursive_map,
|
8173 + | expected.recursive_map,
|
8174 + | "Unexpected value for `recursive_map`"
|
8175 + | );
|
8176 + | ::pretty_assertions::assert_eq!(
|
8177 + | input.recursive_struct,
|
8178 + | expected.recursive_struct,
|
8179 + | "Unexpected value for `recursive_struct`"
|
8180 + | );
|
8181 + | ::pretty_assertions::assert_eq!(
|
8182 + | input.simple_struct,
|
8183 + | expected.simple_struct,
|
8184 + | "Unexpected value for `simple_struct`"
|
8185 + | );
|
8186 + | ::pretty_assertions::assert_eq!(
|
8187 + | input.string,
|
8188 + | expected.string,
|
8189 + | "Unexpected value for `string`"
|
8190 + | );
|
8191 + | ::pretty_assertions::assert_eq!(
|
8192 + | input.struct_with_json_name,
|
8193 + | expected.struct_with_json_name,
|
8194 + | "Unexpected value for `struct_with_json_name`"
|
8195 + | );
|
8196 + | ::pretty_assertions::assert_eq!(
|
8197 + | input.timestamp,
|
8198 + | expected.timestamp,
|
8199 + | "Unexpected value for `timestamp`"
|
8200 + | );
|
8201 + | ::pretty_assertions::assert_eq!(
|
8202 + | input.unix_timestamp,
|
8203 + | expected.unix_timestamp,
|
8204 + | "Unexpected value for `unix_timestamp`"
|
8205 + | );
|
8206 + | let response = crate::output::KitchenSinkOperationOutput {
|
8207 + | blob: ::std::option::Option::None,
|
8208 + | boolean: ::std::option::Option::None,
|
8209 + | double: ::std::option::Option::None,
|
8210 + | empty_struct: ::std::option::Option::None,
|
8211 + | float: ::std::option::Option::None,
|
8212 + | httpdate_timestamp: ::std::option::Option::None,
|
8213 + | integer: ::std::option::Option::None,
|
8214 + | iso8601_timestamp: ::std::option::Option::None,
|
8215 + | json_value: ::std::option::Option::None,
|
8216 + | list_of_lists: ::std::option::Option::None,
|
8217 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8218 + | list_of_strings: ::std::option::Option::None,
|
8219 + | list_of_structs: ::std::option::Option::None,
|
8220 + | long: ::std::option::Option::None,
|
8221 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8222 + | map_of_maps: ::std::option::Option::None,
|
8223 + | map_of_strings: ::std::option::Option::None,
|
8224 + | map_of_structs: ::std::option::Option::None,
|
8225 + | recursive_list: ::std::option::Option::None,
|
8226 + | recursive_map: ::std::option::Option::None,
|
8227 + | recursive_struct: ::std::option::Option::None,
|
8228 + | simple_struct: ::std::option::Option::None,
|
8229 + | string: ::std::option::Option::None,
|
8230 + | struct_with_json_name: ::std::option::Option::None,
|
8231 + | timestamp: ::std::option::Option::None,
|
8232 + | unix_timestamp: ::std::option::Option::None,
|
8233 + | };
|
8234 + | Ok(response)
|
8235 + | };
|
8236 + | sender.send(()).await.expect("receiver dropped early");
|
8237 + | result
|
8238 + | }
|
8239 + | })
|
8240 + | .build_unchecked();
|
9751 8241 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9752 8242 | .await
|
9753 8243 | .expect("unable to make an HTTP request");
|
9754 - | assert!(receiver.recv().await.is_some());
|
8244 + | assert!(
|
8245 + | receiver.recv().await.is_some(),
|
8246 + | "we expected operation handler to be invoked but it was not entered"
|
8247 + | );
|
9755 8248 | }
|
9756 - | /// Supports handling -Infinity float values.
|
9757 - | /// Test ID: AwsJson11SupportsNegativeInfinityFloatInputs
|
8249 + | /// Serializes map of structure shapes
|
8250 + | /// Test ID: serializes_map_of_structure_shapes
|
9758 8251 | #[::tokio::test]
|
9759 - | async fn aws_json11_supports_negative_infinity_float_inputs_request() {
|
8252 + | #[::tracing_test::traced_test]
|
8253 + | async fn serializes_map_of_structure_shapes_request() {
|
9760 8254 | #[allow(unused_mut)]
|
9761 - | let mut http_request = http::Request::builder()
|
9762 - | .uri("/")
|
9763 - | .method("POST")
|
9764 - | .header("Content-Type", "application/x-amz-json-1.1")
|
9765 - | .header("X-Amz-Target", "JsonProtocol.SimpleScalarProperties")
|
9766 - | .body(::aws_smithy_http_server::body::Body::from(
|
9767 - | ::bytes::Bytes::from_static(
|
9768 - | "{\n \"floatValue\": \"-Infinity\",\n \"doubleValue\": \"-Infinity\"\n}"
|
9769 - | .as_bytes(),
|
9770 - | ),
|
9771 - | ))
|
9772 - | .unwrap();
|
8255 + | let mut http_request = http::Request::builder()
|
8256 + | .uri("/")
|
8257 + | .method("POST")
|
8258 + | .header("Content-Type", "application/x-amz-json-1.1")
|
8259 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
8260 + | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{\"MapOfStructs\":{\"key1\":{\"Value\":\"value-1\"},\"key2\":{\"Value\":\"value-2\"}}}".as_bytes()))).unwrap();
|
9773 8261 | #[allow(unused_mut)]
|
9774 8262 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9775 8263 | let config = crate::service::JsonProtocolConfig::builder().build();
|
9776 8264 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9777 - | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
9778 - | let sender = sender.clone();
|
9779 - | async move {
|
9780 - | let result = { use ::aws_smithy_protocol_test::FloatEquals;
|
9781 - | let expected =
|
9782 - | crate::input::SimpleScalarPropertiesInput {
|
9783 - | float_value:
|
9784 - | ::std::option::Option::Some(
|
9785 - | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number")
|
9786 - | )
|
9787 - | ,
|
9788 - | double_value:
|
9789 - | ::std::option::Option::Some(
|
9790 - | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number")
|
9791 - | )
|
9792 - | ,
|
9793 - | }
|
9794 - | ;
|
9795 - | assert!(input.float_value.float_equals(&expected.float_value),
|
9796 - | "Unexpected value for `float_value` {:?} vs. {:?}", expected.float_value, input.float_value);
|
9797 - | assert!(input.double_value.float_equals(&expected.double_value),
|
9798 - | "Unexpected value for `double_value` {:?} vs. {:?}", expected.double_value, input.double_value);
|
9799 - | let response =
|
9800 - | crate::output::SimpleScalarPropertiesOutput {
|
9801 - | float_value:
|
9802 - | ::std::option::Option::None
|
9803 - | ,
|
9804 - | double_value:
|
9805 - | ::std::option::Option::None
|
9806 - | ,
|
9807 - | }
|
9808 - | ;
|
9809 - | response };
|
9810 - | sender.send(()).await.expect("receiver dropped early");
|
9811 - | result
|
9812 - | }
|
9813 - | })
|
9814 - | .build_unchecked();
|
8265 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
8266 + | let sender = sender.clone();
|
8267 + | async move {
|
8268 + | let result = {
|
8269 + | use ::aws_smithy_protocol_test::FloatEquals;
|
8270 + | let expected = crate::input::KitchenSinkOperationInput {
|
8271 + | map_of_structs: ::std::option::Option::Some({
|
8272 + | let mut ret = ::std::collections::HashMap::new();
|
8273 + | ret.insert(
|
8274 + | "key1".to_owned(),
|
8275 + | crate::model::SimpleStruct {
|
8276 + | value: ::std::option::Option::Some("value-1".to_owned()),
|
8277 + | },
|
8278 + | );
|
8279 + | ret.insert(
|
8280 + | "key2".to_owned(),
|
8281 + | crate::model::SimpleStruct {
|
8282 + | value: ::std::option::Option::Some("value-2".to_owned()),
|
8283 + | },
|
8284 + | );
|
8285 + | ret
|
8286 + | }),
|
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 + | recursive_list: ::std::option::Option::None,
|
8305 + | recursive_map: ::std::option::Option::None,
|
8306 + | recursive_struct: ::std::option::Option::None,
|
8307 + | simple_struct: ::std::option::Option::None,
|
8308 + | string: ::std::option::Option::None,
|
8309 + | struct_with_json_name: ::std::option::Option::None,
|
8310 + | timestamp: ::std::option::Option::None,
|
8311 + | unix_timestamp: ::std::option::Option::None,
|
8312 + | };
|
8313 + | ::pretty_assertions::assert_eq!(
|
8314 + | input.blob,
|
8315 + | expected.blob,
|
8316 + | "Unexpected value for `blob`"
|
8317 + | );
|
8318 + | ::pretty_assertions::assert_eq!(
|
8319 + | input.boolean,
|
8320 + | expected.boolean,
|
8321 + | "Unexpected value for `boolean`"
|
8322 + | );
|
8323 + | assert!(
|
8324 + | input.double.float_equals(&expected.double),
|
8325 + | "Unexpected value for `double` {:?} vs. {:?}",
|
8326 + | expected.double,
|
8327 + | input.double
|
8328 + | );
|
8329 + | ::pretty_assertions::assert_eq!(
|
8330 + | input.empty_struct,
|
8331 + | expected.empty_struct,
|
8332 + | "Unexpected value for `empty_struct`"
|
8333 + | );
|
8334 + | assert!(
|
8335 + | input.float.float_equals(&expected.float),
|
8336 + | "Unexpected value for `float` {:?} vs. {:?}",
|
8337 + | expected.float,
|
8338 + | input.float
|
8339 + | );
|
8340 + | ::pretty_assertions::assert_eq!(
|
8341 + | input.httpdate_timestamp,
|
8342 + | expected.httpdate_timestamp,
|
8343 + | "Unexpected value for `httpdate_timestamp`"
|
8344 + | );
|
8345 + | ::pretty_assertions::assert_eq!(
|
8346 + | input.integer,
|
8347 + | expected.integer,
|
8348 + | "Unexpected value for `integer`"
|
8349 + | );
|
8350 + | ::pretty_assertions::assert_eq!(
|
8351 + | input.iso8601_timestamp,
|
8352 + | expected.iso8601_timestamp,
|
8353 + | "Unexpected value for `iso8601_timestamp`"
|
8354 + | );
|
8355 + | ::pretty_assertions::assert_eq!(
|
8356 + | input.json_value,
|
8357 + | expected.json_value,
|
8358 + | "Unexpected value for `json_value`"
|
8359 + | );
|
8360 + | ::pretty_assertions::assert_eq!(
|
8361 + | input.list_of_lists,
|
8362 + | expected.list_of_lists,
|
8363 + | "Unexpected value for `list_of_lists`"
|
8364 + | );
|
8365 + | ::pretty_assertions::assert_eq!(
|
8366 + | input.list_of_maps_of_strings,
|
8367 + | expected.list_of_maps_of_strings,
|
8368 + | "Unexpected value for `list_of_maps_of_strings`"
|
8369 + | );
|
8370 + | ::pretty_assertions::assert_eq!(
|
8371 + | input.list_of_strings,
|
8372 + | expected.list_of_strings,
|
8373 + | "Unexpected value for `list_of_strings`"
|
8374 + | );
|
8375 + | ::pretty_assertions::assert_eq!(
|
8376 + | input.list_of_structs,
|
8377 + | expected.list_of_structs,
|
8378 + | "Unexpected value for `list_of_structs`"
|
8379 + | );
|
8380 + | ::pretty_assertions::assert_eq!(
|
8381 + | input.long,
|
8382 + | expected.long,
|
8383 + | "Unexpected value for `long`"
|
8384 + | );
|
8385 + | ::pretty_assertions::assert_eq!(
|
8386 + | input.map_of_lists_of_strings,
|
8387 + | expected.map_of_lists_of_strings,
|
8388 + | "Unexpected value for `map_of_lists_of_strings`"
|
8389 + | );
|
8390 + | ::pretty_assertions::assert_eq!(
|
8391 + | input.map_of_maps,
|
8392 + | expected.map_of_maps,
|
8393 + | "Unexpected value for `map_of_maps`"
|
8394 + | );
|
8395 + | ::pretty_assertions::assert_eq!(
|
8396 + | input.map_of_strings,
|
8397 + | expected.map_of_strings,
|
8398 + | "Unexpected value for `map_of_strings`"
|
8399 + | );
|
8400 + | ::pretty_assertions::assert_eq!(
|
8401 + | input.map_of_structs,
|
8402 + | expected.map_of_structs,
|
8403 + | "Unexpected value for `map_of_structs`"
|
8404 + | );
|
8405 + | ::pretty_assertions::assert_eq!(
|
8406 + | input.recursive_list,
|
8407 + | expected.recursive_list,
|
8408 + | "Unexpected value for `recursive_list`"
|
8409 + | );
|
8410 + | ::pretty_assertions::assert_eq!(
|
8411 + | input.recursive_map,
|
8412 + | expected.recursive_map,
|
8413 + | "Unexpected value for `recursive_map`"
|
8414 + | );
|
8415 + | ::pretty_assertions::assert_eq!(
|
8416 + | input.recursive_struct,
|
8417 + | expected.recursive_struct,
|
8418 + | "Unexpected value for `recursive_struct`"
|
8419 + | );
|
8420 + | ::pretty_assertions::assert_eq!(
|
8421 + | input.simple_struct,
|
8422 + | expected.simple_struct,
|
8423 + | "Unexpected value for `simple_struct`"
|
8424 + | );
|
8425 + | ::pretty_assertions::assert_eq!(
|
8426 + | input.string,
|
8427 + | expected.string,
|
8428 + | "Unexpected value for `string`"
|
8429 + | );
|
8430 + | ::pretty_assertions::assert_eq!(
|
8431 + | input.struct_with_json_name,
|
8432 + | expected.struct_with_json_name,
|
8433 + | "Unexpected value for `struct_with_json_name`"
|
8434 + | );
|
8435 + | ::pretty_assertions::assert_eq!(
|
8436 + | input.timestamp,
|
8437 + | expected.timestamp,
|
8438 + | "Unexpected value for `timestamp`"
|
8439 + | );
|
8440 + | ::pretty_assertions::assert_eq!(
|
8441 + | input.unix_timestamp,
|
8442 + | expected.unix_timestamp,
|
8443 + | "Unexpected value for `unix_timestamp`"
|
8444 + | );
|
8445 + | let response = crate::output::KitchenSinkOperationOutput {
|
8446 + | blob: ::std::option::Option::None,
|
8447 + | boolean: ::std::option::Option::None,
|
8448 + | double: ::std::option::Option::None,
|
8449 + | empty_struct: ::std::option::Option::None,
|
8450 + | float: ::std::option::Option::None,
|
8451 + | httpdate_timestamp: ::std::option::Option::None,
|
8452 + | integer: ::std::option::Option::None,
|
8453 + | iso8601_timestamp: ::std::option::Option::None,
|
8454 + | json_value: ::std::option::Option::None,
|
8455 + | list_of_lists: ::std::option::Option::None,
|
8456 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8457 + | list_of_strings: ::std::option::Option::None,
|
8458 + | list_of_structs: ::std::option::Option::None,
|
8459 + | long: ::std::option::Option::None,
|
8460 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8461 + | map_of_maps: ::std::option::Option::None,
|
8462 + | map_of_strings: ::std::option::Option::None,
|
8463 + | map_of_structs: ::std::option::Option::None,
|
8464 + | recursive_list: ::std::option::Option::None,
|
8465 + | recursive_map: ::std::option::Option::None,
|
8466 + | recursive_struct: ::std::option::Option::None,
|
8467 + | simple_struct: ::std::option::Option::None,
|
8468 + | string: ::std::option::Option::None,
|
8469 + | struct_with_json_name: ::std::option::Option::None,
|
8470 + | timestamp: ::std::option::Option::None,
|
8471 + | unix_timestamp: ::std::option::Option::None,
|
8472 + | };
|
8473 + | Ok(response)
|
8474 + | };
|
8475 + | sender.send(()).await.expect("receiver dropped early");
|
8476 + | result
|
8477 + | }
|
8478 + | })
|
8479 + | .build_unchecked();
|
9815 8480 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9816 8481 | .await
|
9817 8482 | .expect("unable to make an HTTP request");
|
9818 - | assert!(receiver.recv().await.is_some());
|
9819 - | }
|
9820 - | /// Supports handling NaN float values.
|
9821 - | /// Test ID: AwsJson11SupportsNaNFloatInputs
|
9822 - | #[::tokio::test]
|
9823 - | async fn aws_json11_supports_na_n_float_inputs_response() {
|
9824 - | let output = crate::output::SimpleScalarPropertiesOutput {
|
9825 - | float_value: ::std::option::Option::Some(
|
9826 - | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN")
|
9827 - | .expect("invalid string for number"),
|
9828 - | ),
|
9829 - | double_value: ::std::option::Option::Some(
|
9830 - | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN")
|
9831 - | .expect("invalid string for number"),
|
9832 - | ),
|
9833 - | };
|
9834 - | use ::aws_smithy_http_server::response::IntoResponse;
|
9835 - | let http_response = output.into_response();
|
9836 - | ::pretty_assertions::assert_eq!(
|
9837 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
9838 - | http_response.status()
|
9839 - | );
|
9840 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
9841 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9842 - | http_response.headers(),
|
9843 - | expected_headers,
|
9844 - | ));
|
9845 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
9846 - | .await
|
9847 - | .expect("unable to extract body to bytes");
|
9848 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
9849 - | &body,
|
9850 - | "{\n \"floatValue\": \"NaN\",\n \"doubleValue\": \"NaN\"\n}",
|
9851 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9852 - | ));
|
9853 - | }
|
9854 - | /// Supports handling Infinity float values.
|
9855 - | /// Test ID: AwsJson11SupportsInfinityFloatInputs
|
9856 - | #[::tokio::test]
|
9857 - | async fn aws_json11_supports_infinity_float_inputs_response() {
|
9858 - | let output = crate::output::SimpleScalarPropertiesOutput {
|
9859 - | float_value: ::std::option::Option::Some(
|
9860 - | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity")
|
9861 - | .expect("invalid string for number"),
|
9862 - | ),
|
9863 - | double_value: ::std::option::Option::Some(
|
9864 - | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity")
|
9865 - | .expect("invalid string for number"),
|
9866 - | ),
|
9867 - | };
|
9868 - | use ::aws_smithy_http_server::response::IntoResponse;
|
9869 - | let http_response = output.into_response();
|
9870 - | ::pretty_assertions::assert_eq!(
|
9871 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
9872 - | http_response.status()
|
9873 - | );
|
9874 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
9875 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9876 - | http_response.headers(),
|
9877 - | expected_headers,
|
9878 - | ));
|
9879 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
9880 - | .await
|
9881 - | .expect("unable to extract body to bytes");
|
9882 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
9883 - | &body,
|
9884 - | "{\n \"floatValue\": \"Infinity\",\n \"doubleValue\": \"Infinity\"\n}",
|
9885 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9886 - | ));
|
9887 - | }
|
9888 - | /// Supports handling -Infinity float values.
|
9889 - | /// Test ID: AwsJson11SupportsNegativeInfinityFloatInputs
|
9890 - | #[::tokio::test]
|
9891 - | async fn aws_json11_supports_negative_infinity_float_inputs_response() {
|
9892 - | let output = crate::output::SimpleScalarPropertiesOutput {
|
9893 - | float_value: ::std::option::Option::Some(
|
9894 - | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity")
|
9895 - | .expect("invalid string for number"),
|
9896 - | ),
|
9897 - | double_value: ::std::option::Option::Some(
|
9898 - | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity")
|
9899 - | .expect("invalid string for number"),
|
9900 - | ),
|
9901 - | };
|
9902 - | use ::aws_smithy_http_server::response::IntoResponse;
|
9903 - | let http_response = output.into_response();
|
9904 - | ::pretty_assertions::assert_eq!(
|
9905 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
9906 - | http_response.status()
|
8483 + | assert!(
|
8484 + | receiver.recv().await.is_some(),
|
8485 + | "we expected operation handler to be invoked but it was not entered"
|
9907 8486 | );
|
9908 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
9909 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9910 - | http_response.headers(),
|
9911 - | expected_headers,
|
9912 - | ));
|
9913 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
9914 - | .await
|
9915 - | .expect("unable to extract body to bytes");
|
9916 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
9917 - | &body,
|
9918 - | "{\n \"floatValue\": \"-Infinity\",\n \"doubleValue\": \"-Infinity\"\n}",
|
9919 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
9920 - | ));
|
9921 8487 | }
|
9922 - | }
|
9923 - | #[cfg(test)]
|
9924 - | #[allow(unreachable_code, unused_variables)]
|
9925 - | mod server_sparse_nulls_operation_test {
|
9926 - | /// Serializes null values in maps
|
9927 - | /// Test ID: AwsJson11SparseMapsSerializeNullValues
|
8488 + | /// Serializes map of recursive structure shapes
|
8489 + | /// Test ID: serializes_map_of_recursive_structure_shapes
|
9928 8490 | #[::tokio::test]
|
9929 - | async fn aws_json11_sparse_maps_serialize_null_values_request() {
|
8491 + | #[::tracing_test::traced_test]
|
8492 + | async fn serializes_map_of_recursive_structure_shapes_request() {
|
9930 8493 | #[allow(unused_mut)]
|
9931 - | let mut http_request = http::Request::builder()
|
9932 - | .uri("/")
|
9933 - | .method("POST")
|
9934 - | .header("Content-Type", "application/x-amz-json-1.1")
|
9935 - | .header("X-Amz-Target", "JsonProtocol.SparseNullsOperation")
|
9936 - | .body(::aws_smithy_http_server::body::Body::from(
|
9937 - | ::bytes::Bytes::from_static(
|
9938 - | "{\n \"sparseStringMap\": {\n \"foo\": null\n }\n}".as_bytes(),
|
9939 - | ),
|
9940 - | ))
|
9941 - | .unwrap();
|
8494 + | let mut http_request = http::Request::builder()
|
8495 + | .uri("/")
|
8496 + | .method("POST")
|
8497 + | .header("Content-Type", "application/x-amz-json-1.1")
|
8498 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
8499 + | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{\"RecursiveMap\":{\"key1\":{\"RecursiveMap\":{\"key2\":{\"RecursiveMap\":{\"key3\":{\"Boolean\":false}}}}}}}".as_bytes()))).unwrap();
|
9942 8500 | #[allow(unused_mut)]
|
9943 8501 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9944 8502 | let config = crate::service::JsonProtocolConfig::builder().build();
|
9945 8503 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9946 - | .sparse_nulls_operation(move |input: crate::input::SparseNullsOperationInput| {
|
8504 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
9947 8505 | let sender = sender.clone();
|
9948 8506 | async move {
|
9949 8507 | let result = {
|
9950 - | let expected = crate::input::SparseNullsOperationInput {
|
9951 - | sparse_string_map: ::std::option::Option::Some({
|
8508 + | use ::aws_smithy_protocol_test::FloatEquals;
|
8509 + | let expected = crate::input::KitchenSinkOperationInput {
|
8510 + | recursive_map: ::std::option::Option::Some({
|
9952 8511 | let mut ret = ::std::collections::HashMap::new();
|
9953 - | ret.insert("foo".to_owned(), ::std::option::Option::None);
|
8512 + | ret.insert(
|
8513 + | "key1".to_owned(),
|
8514 + | crate::model::KitchenSink {
|
8515 + | recursive_map: ::std::option::Option::Some({
|
8516 + | let mut ret = ::std::collections::HashMap::new();
|
8517 + | ret.insert(
|
8518 + | "key2".to_owned(),
|
8519 + | crate::model::KitchenSink {
|
8520 + | recursive_map: ::std::option::Option::Some({
|
8521 + | let mut ret =
|
8522 + | ::std::collections::HashMap::new();
|
8523 + | ret.insert(
|
8524 + | "key3".to_owned(),
|
8525 + | crate::model::KitchenSink {
|
8526 + | boolean:
|
8527 + | ::std::option::Option::Some(
|
8528 + | false,
|
8529 + | ),
|
8530 + | blob: ::std::option::Option::None,
|
8531 + | double: ::std::option::Option::None,
|
8532 + | empty_struct:
|
8533 + | ::std::option::Option::None,
|
8534 + | float: ::std::option::Option::None,
|
8535 + | httpdate_timestamp:
|
8536 + | ::std::option::Option::None,
|
8537 + | integer:
|
8538 + | ::std::option::Option::None,
|
8539 + | iso8601_timestamp:
|
8540 + | ::std::option::Option::None,
|
8541 + | json_value:
|
8542 + | ::std::option::Option::None,
|
8543 + | list_of_lists:
|
8544 + | ::std::option::Option::None,
|
8545 + | list_of_maps_of_strings:
|
8546 + | ::std::option::Option::None,
|
8547 + | list_of_strings:
|
8548 + | ::std::option::Option::None,
|
8549 + | list_of_structs:
|
8550 + | ::std::option::Option::None,
|
8551 + | long: ::std::option::Option::None,
|
8552 + | map_of_lists_of_strings:
|
8553 + | ::std::option::Option::None,
|
8554 + | map_of_maps:
|
8555 + | ::std::option::Option::None,
|
8556 + | map_of_strings:
|
8557 + | ::std::option::Option::None,
|
8558 + | map_of_structs:
|
8559 + | ::std::option::Option::None,
|
8560 + | recursive_list:
|
8561 + | ::std::option::Option::None,
|
8562 + | recursive_map:
|
8563 + | ::std::option::Option::None,
|
8564 + | recursive_struct:
|
8565 + | ::std::option::Option::None,
|
8566 + | simple_struct:
|
8567 + | ::std::option::Option::None,
|
8568 + | string: ::std::option::Option::None,
|
8569 + | struct_with_json_name:
|
8570 + | ::std::option::Option::None,
|
8571 + | timestamp:
|
8572 + | ::std::option::Option::None,
|
8573 + | unix_timestamp:
|
8574 + | ::std::option::Option::None,
|
8575 + | },
|
8576 + | );
|
8577 + | ret
|
8578 + | }),
|
8579 + | blob: ::std::option::Option::None,
|
8580 + | boolean: ::std::option::Option::None,
|
8581 + | double: ::std::option::Option::None,
|
8582 + | empty_struct: ::std::option::Option::None,
|
8583 + | float: ::std::option::Option::None,
|
8584 + | httpdate_timestamp: ::std::option::Option::None,
|
8585 + | integer: ::std::option::Option::None,
|
8586 + | iso8601_timestamp: ::std::option::Option::None,
|
8587 + | json_value: ::std::option::Option::None,
|
8588 + | list_of_lists: ::std::option::Option::None,
|
8589 + | list_of_maps_of_strings:
|
8590 + | ::std::option::Option::None,
|
8591 + | list_of_strings: ::std::option::Option::None,
|
8592 + | list_of_structs: ::std::option::Option::None,
|
8593 + | long: ::std::option::Option::None,
|
8594 + | map_of_lists_of_strings:
|
8595 + | ::std::option::Option::None,
|
8596 + | map_of_maps: ::std::option::Option::None,
|
8597 + | map_of_strings: ::std::option::Option::None,
|
8598 + | map_of_structs: ::std::option::Option::None,
|
8599 + | recursive_list: ::std::option::Option::None,
|
8600 + | recursive_struct: ::std::option::Option::None,
|
8601 + | simple_struct: ::std::option::Option::None,
|
8602 + | string: ::std::option::Option::None,
|
8603 + | struct_with_json_name:
|
8604 + | ::std::option::Option::None,
|
8605 + | timestamp: ::std::option::Option::None,
|
8606 + | unix_timestamp: ::std::option::Option::None,
|
8607 + | },
|
8608 + | );
|
8609 + | ret
|
8610 + | }),
|
8611 + | blob: ::std::option::Option::None,
|
8612 + | boolean: ::std::option::Option::None,
|
8613 + | double: ::std::option::Option::None,
|
8614 + | empty_struct: ::std::option::Option::None,
|
8615 + | float: ::std::option::Option::None,
|
8616 + | httpdate_timestamp: ::std::option::Option::None,
|
8617 + | integer: ::std::option::Option::None,
|
8618 + | iso8601_timestamp: ::std::option::Option::None,
|
8619 + | json_value: ::std::option::Option::None,
|
8620 + | list_of_lists: ::std::option::Option::None,
|
8621 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8622 + | list_of_strings: ::std::option::Option::None,
|
8623 + | list_of_structs: ::std::option::Option::None,
|
8624 + | long: ::std::option::Option::None,
|
8625 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8626 + | map_of_maps: ::std::option::Option::None,
|
8627 + | map_of_strings: ::std::option::Option::None,
|
8628 + | map_of_structs: ::std::option::Option::None,
|
8629 + | recursive_list: ::std::option::Option::None,
|
8630 + | recursive_struct: ::std::option::Option::None,
|
8631 + | simple_struct: ::std::option::Option::None,
|
8632 + | string: ::std::option::Option::None,
|
8633 + | struct_with_json_name: ::std::option::Option::None,
|
8634 + | timestamp: ::std::option::Option::None,
|
8635 + | unix_timestamp: ::std::option::Option::None,
|
8636 + | },
|
8637 + | );
|
9954 8638 | ret
|
9955 8639 | }),
|
9956 - | sparse_string_list: ::std::option::Option::None,
|
9957 - | };
|
9958 - | ::pretty_assertions::assert_eq!(input, expected);
|
9959 - | let response = crate::output::SparseNullsOperationOutput {
|
9960 - | sparse_string_list: ::std::option::Option::None,
|
9961 - | sparse_string_map: ::std::option::Option::None,
|
9962 - | };
|
9963 - | response
|
9964 - | };
|
9965 - | sender.send(()).await.expect("receiver dropped early");
|
9966 - | result
|
9967 - | }
|
9968 - | })
|
9969 - | .build_unchecked();
|
9970 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9971 - | .await
|
9972 - | .expect("unable to make an HTTP request");
|
9973 - | assert!(receiver.recv().await.is_some());
|
9974 - | }
|
9975 - | /// Serializes null values in lists
|
9976 - | /// Test ID: AwsJson11SparseListsSerializeNull
|
9977 - | #[::tokio::test]
|
9978 - | async fn aws_json11_sparse_lists_serialize_null_request() {
|
9979 - | #[allow(unused_mut)]
|
9980 - | let mut http_request = http::Request::builder()
|
9981 - | .uri("/")
|
9982 - | .method("POST")
|
9983 - | .header("Content-Type", "application/x-amz-json-1.1")
|
9984 - | .header("X-Amz-Target", "JsonProtocol.SparseNullsOperation")
|
9985 - | .body(::aws_smithy_http_server::body::Body::from(
|
9986 - | ::bytes::Bytes::from_static(
|
9987 - | "{\n \"sparseStringList\": [\n null\n ]\n}".as_bytes(),
|
9988 - | ),
|
9989 - | ))
|
9990 - | .unwrap();
|
9991 - | #[allow(unused_mut)]
|
9992 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9993 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
9994 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9995 - | .sparse_nulls_operation(move |input: crate::input::SparseNullsOperationInput| {
|
9996 - | let sender = sender.clone();
|
9997 - | async move {
|
9998 - | let result = {
|
9999 - | let expected = crate::input::SparseNullsOperationInput {
|
10000 - | sparse_string_list: ::std::option::Option::Some(vec![
|
10001 - | ::std::option::Option::None,
|
10002 - | ]),
|
10003 - | sparse_string_map: ::std::option::Option::None,
|
8640 + | blob: ::std::option::Option::None,
|
8641 + | boolean: ::std::option::Option::None,
|
8642 + | double: ::std::option::Option::None,
|
8643 + | empty_struct: ::std::option::Option::None,
|
8644 + | float: ::std::option::Option::None,
|
8645 + | httpdate_timestamp: ::std::option::Option::None,
|
8646 + | integer: ::std::option::Option::None,
|
8647 + | iso8601_timestamp: ::std::option::Option::None,
|
8648 + | json_value: ::std::option::Option::None,
|
8649 + | list_of_lists: ::std::option::Option::None,
|
8650 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8651 + | list_of_strings: ::std::option::Option::None,
|
8652 + | list_of_structs: ::std::option::Option::None,
|
8653 + | long: ::std::option::Option::None,
|
8654 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8655 + | map_of_maps: ::std::option::Option::None,
|
8656 + | map_of_strings: ::std::option::Option::None,
|
8657 + | map_of_structs: ::std::option::Option::None,
|
8658 + | recursive_list: ::std::option::Option::None,
|
8659 + | recursive_struct: ::std::option::Option::None,
|
8660 + | simple_struct: ::std::option::Option::None,
|
8661 + | string: ::std::option::Option::None,
|
8662 + | struct_with_json_name: ::std::option::Option::None,
|
8663 + | timestamp: ::std::option::Option::None,
|
8664 + | unix_timestamp: ::std::option::Option::None,
|
10004 8665 | };
|
10005 - | ::pretty_assertions::assert_eq!(input, expected);
|
10006 - | let response = crate::output::SparseNullsOperationOutput {
|
10007 - | sparse_string_list: ::std::option::Option::None,
|
10008 - | sparse_string_map: ::std::option::Option::None,
|
8666 + | ::pretty_assertions::assert_eq!(
|
8667 + | input.blob,
|
8668 + | expected.blob,
|
8669 + | "Unexpected value for `blob`"
|
8670 + | );
|
8671 + | ::pretty_assertions::assert_eq!(
|
8672 + | input.boolean,
|
8673 + | expected.boolean,
|
8674 + | "Unexpected value for `boolean`"
|
8675 + | );
|
8676 + | assert!(
|
8677 + | input.double.float_equals(&expected.double),
|
8678 + | "Unexpected value for `double` {:?} vs. {:?}",
|
8679 + | expected.double,
|
8680 + | input.double
|
8681 + | );
|
8682 + | ::pretty_assertions::assert_eq!(
|
8683 + | input.empty_struct,
|
8684 + | expected.empty_struct,
|
8685 + | "Unexpected value for `empty_struct`"
|
8686 + | );
|
8687 + | assert!(
|
8688 + | input.float.float_equals(&expected.float),
|
8689 + | "Unexpected value for `float` {:?} vs. {:?}",
|
8690 + | expected.float,
|
8691 + | input.float
|
8692 + | );
|
8693 + | ::pretty_assertions::assert_eq!(
|
8694 + | input.httpdate_timestamp,
|
8695 + | expected.httpdate_timestamp,
|
8696 + | "Unexpected value for `httpdate_timestamp`"
|
8697 + | );
|
8698 + | ::pretty_assertions::assert_eq!(
|
8699 + | input.integer,
|
8700 + | expected.integer,
|
8701 + | "Unexpected value for `integer`"
|
8702 + | );
|
8703 + | ::pretty_assertions::assert_eq!(
|
8704 + | input.iso8601_timestamp,
|
8705 + | expected.iso8601_timestamp,
|
8706 + | "Unexpected value for `iso8601_timestamp`"
|
8707 + | );
|
8708 + | ::pretty_assertions::assert_eq!(
|
8709 + | input.json_value,
|
8710 + | expected.json_value,
|
8711 + | "Unexpected value for `json_value`"
|
8712 + | );
|
8713 + | ::pretty_assertions::assert_eq!(
|
8714 + | input.list_of_lists,
|
8715 + | expected.list_of_lists,
|
8716 + | "Unexpected value for `list_of_lists`"
|
8717 + | );
|
8718 + | ::pretty_assertions::assert_eq!(
|
8719 + | input.list_of_maps_of_strings,
|
8720 + | expected.list_of_maps_of_strings,
|
8721 + | "Unexpected value for `list_of_maps_of_strings`"
|
8722 + | );
|
8723 + | ::pretty_assertions::assert_eq!(
|
8724 + | input.list_of_strings,
|
8725 + | expected.list_of_strings,
|
8726 + | "Unexpected value for `list_of_strings`"
|
8727 + | );
|
8728 + | ::pretty_assertions::assert_eq!(
|
8729 + | input.list_of_structs,
|
8730 + | expected.list_of_structs,
|
8731 + | "Unexpected value for `list_of_structs`"
|
8732 + | );
|
8733 + | ::pretty_assertions::assert_eq!(
|
8734 + | input.long,
|
8735 + | expected.long,
|
8736 + | "Unexpected value for `long`"
|
8737 + | );
|
8738 + | ::pretty_assertions::assert_eq!(
|
8739 + | input.map_of_lists_of_strings,
|
8740 + | expected.map_of_lists_of_strings,
|
8741 + | "Unexpected value for `map_of_lists_of_strings`"
|
8742 + | );
|
8743 + | ::pretty_assertions::assert_eq!(
|
8744 + | input.map_of_maps,
|
8745 + | expected.map_of_maps,
|
8746 + | "Unexpected value for `map_of_maps`"
|
8747 + | );
|
8748 + | ::pretty_assertions::assert_eq!(
|
8749 + | input.map_of_strings,
|
8750 + | expected.map_of_strings,
|
8751 + | "Unexpected value for `map_of_strings`"
|
8752 + | );
|
8753 + | ::pretty_assertions::assert_eq!(
|
8754 + | input.map_of_structs,
|
8755 + | expected.map_of_structs,
|
8756 + | "Unexpected value for `map_of_structs`"
|
8757 + | );
|
8758 + | ::pretty_assertions::assert_eq!(
|
8759 + | input.recursive_list,
|
8760 + | expected.recursive_list,
|
8761 + | "Unexpected value for `recursive_list`"
|
8762 + | );
|
8763 + | ::pretty_assertions::assert_eq!(
|
8764 + | input.recursive_map,
|
8765 + | expected.recursive_map,
|
8766 + | "Unexpected value for `recursive_map`"
|
8767 + | );
|
8768 + | ::pretty_assertions::assert_eq!(
|
8769 + | input.recursive_struct,
|
8770 + | expected.recursive_struct,
|
8771 + | "Unexpected value for `recursive_struct`"
|
8772 + | );
|
8773 + | ::pretty_assertions::assert_eq!(
|
8774 + | input.simple_struct,
|
8775 + | expected.simple_struct,
|
8776 + | "Unexpected value for `simple_struct`"
|
8777 + | );
|
8778 + | ::pretty_assertions::assert_eq!(
|
8779 + | input.string,
|
8780 + | expected.string,
|
8781 + | "Unexpected value for `string`"
|
8782 + | );
|
8783 + | ::pretty_assertions::assert_eq!(
|
8784 + | input.struct_with_json_name,
|
8785 + | expected.struct_with_json_name,
|
8786 + | "Unexpected value for `struct_with_json_name`"
|
8787 + | );
|
8788 + | ::pretty_assertions::assert_eq!(
|
8789 + | input.timestamp,
|
8790 + | expected.timestamp,
|
8791 + | "Unexpected value for `timestamp`"
|
8792 + | );
|
8793 + | ::pretty_assertions::assert_eq!(
|
8794 + | input.unix_timestamp,
|
8795 + | expected.unix_timestamp,
|
8796 + | "Unexpected value for `unix_timestamp`"
|
8797 + | );
|
8798 + | let response = crate::output::KitchenSinkOperationOutput {
|
8799 + | blob: ::std::option::Option::None,
|
8800 + | boolean: ::std::option::Option::None,
|
8801 + | double: ::std::option::Option::None,
|
8802 + | empty_struct: ::std::option::Option::None,
|
8803 + | float: ::std::option::Option::None,
|
8804 + | httpdate_timestamp: ::std::option::Option::None,
|
8805 + | integer: ::std::option::Option::None,
|
8806 + | iso8601_timestamp: ::std::option::Option::None,
|
8807 + | json_value: ::std::option::Option::None,
|
8808 + | list_of_lists: ::std::option::Option::None,
|
8809 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8810 + | list_of_strings: ::std::option::Option::None,
|
8811 + | list_of_structs: ::std::option::Option::None,
|
8812 + | long: ::std::option::Option::None,
|
8813 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8814 + | map_of_maps: ::std::option::Option::None,
|
8815 + | map_of_strings: ::std::option::Option::None,
|
8816 + | map_of_structs: ::std::option::Option::None,
|
8817 + | recursive_list: ::std::option::Option::None,
|
8818 + | recursive_map: ::std::option::Option::None,
|
8819 + | recursive_struct: ::std::option::Option::None,
|
8820 + | simple_struct: ::std::option::Option::None,
|
8821 + | string: ::std::option::Option::None,
|
8822 + | struct_with_json_name: ::std::option::Option::None,
|
8823 + | timestamp: ::std::option::Option::None,
|
8824 + | unix_timestamp: ::std::option::Option::None,
|
10009 8825 | };
|
10010 - | response
|
10011 - | };
|
10012 - | sender.send(()).await.expect("receiver dropped early");
|
10013 - | result
|
10014 - | }
|
10015 - | })
|
10016 - | .build_unchecked();
|
10017 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10018 - | .await
|
10019 - | .expect("unable to make an HTTP request");
|
10020 - | assert!(receiver.recv().await.is_some());
|
10021 - | }
|
10022 - | /// Deserializes null values in maps
|
10023 - | /// Test ID: AwsJson11SparseMapsDeserializeNullValues
|
10024 - | #[::tokio::test]
|
10025 - | async fn aws_json11_sparse_maps_deserialize_null_values_response() {
|
10026 - | let output = crate::output::SparseNullsOperationOutput {
|
10027 - | sparse_string_map: ::std::option::Option::Some({
|
10028 - | let mut ret = ::std::collections::HashMap::new();
|
10029 - | ret.insert("foo".to_owned(), ::std::option::Option::None);
|
10030 - | ret
|
10031 - | }),
|
10032 - | sparse_string_list: ::std::option::Option::None,
|
10033 - | };
|
10034 - | use ::aws_smithy_http_server::response::IntoResponse;
|
10035 - | let http_response = output.into_response();
|
10036 - | ::pretty_assertions::assert_eq!(
|
10037 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10038 - | http_response.status()
|
10039 - | );
|
10040 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10041 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10042 - | http_response.headers(),
|
10043 - | expected_headers,
|
10044 - | ));
|
10045 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10046 - | .await
|
10047 - | .expect("unable to extract body to bytes");
|
10048 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10049 - | &body,
|
10050 - | "{\n \"sparseStringMap\": {\n \"foo\": null\n }\n}",
|
10051 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10052 - | ));
|
10053 - | }
|
10054 - | /// Deserializes null values in lists
|
10055 - | /// Test ID: AwsJson11SparseListsDeserializeNull
|
10056 - | #[::tokio::test]
|
10057 - | async fn aws_json11_sparse_lists_deserialize_null_response() {
|
10058 - | let output = crate::output::SparseNullsOperationOutput {
|
10059 - | sparse_string_list: ::std::option::Option::Some(vec![::std::option::Option::None]),
|
10060 - | sparse_string_map: ::std::option::Option::None,
|
10061 - | };
|
10062 - | use ::aws_smithy_http_server::response::IntoResponse;
|
10063 - | let http_response = output.into_response();
|
10064 - | ::pretty_assertions::assert_eq!(
|
10065 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10066 - | http_response.status()
|
10067 - | );
|
10068 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10069 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10070 - | http_response.headers(),
|
10071 - | expected_headers,
|
10072 - | ));
|
10073 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10074 - | .await
|
10075 - | .expect("unable to extract body to bytes");
|
10076 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10077 - | &body,
|
10078 - | "{\n \"sparseStringList\": [\n null\n ]\n}",
|
10079 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10080 - | ));
|
10081 - | }
|
10082 - | }
|
10083 - |
|
10084 - | static CONTENT_TYPE_PUTWITHCONTENTENCODING: ::once_cell::sync::Lazy<::mime::Mime> =
|
10085 - | ::once_cell::sync::Lazy::new(|| {
|
10086 - | "application/x-amz-json-1.1"
|
10087 - | .parse::<::mime::Mime>()
|
10088 - | .expect("BUG: MIME parsing failed, content_type is not valid")
|
10089 - | });
|
10090 - | ::pin_project_lite::pin_project! {
|
10091 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
10092 - | /// [`PutWithContentEncodingInput`](crate::input::PutWithContentEncodingInput) using modelled bindings.
|
10093 - | pub struct PutWithContentEncodingInputFuture {
|
10094 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::PutWithContentEncodingInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
10095 - | }
|
10096 - | }
|
10097 - |
|
10098 - | impl std::future::Future for PutWithContentEncodingInputFuture {
|
10099 - | type Output = Result<
|
10100 - | crate::input::PutWithContentEncodingInput,
|
10101 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
10102 - | >;
|
10103 - |
|
10104 - | fn poll(
|
10105 - | self: std::pin::Pin<&mut Self>,
|
10106 - | cx: &mut std::task::Context<'_>,
|
10107 - | ) -> std::task::Poll<Self::Output> {
|
10108 - | let this = self.project();
|
10109 - | this.inner.as_mut().poll(cx)
|
10110 - | }
|
10111 - | }
|
10112 - |
|
10113 - | impl<B>
|
10114 - | ::aws_smithy_http_server::request::FromRequest<
|
10115 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10116 - | B,
|
10117 - | > for crate::input::PutWithContentEncodingInput
|
10118 - | where
|
10119 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
10120 - | B: 'static,
|
10121 - |
|
10122 - | B::Data: Send,
|
10123 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
10124 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
10125 - | {
|
10126 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
10127 - | type Future = PutWithContentEncodingInputFuture;
|
10128 - |
|
10129 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
10130 - | let fut = async move {
|
10131 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
10132 - | request.headers(),
|
10133 - | &CONTENT_TYPE_PUTWITHCONTENTENCODING,
|
10134 - | ) {
|
10135 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
10136 - | }
|
10137 - | crate::protocol_serde::shape_put_with_content_encoding::de_put_with_content_encoding_http_request(request)
|
10138 - | .await
|
10139 - | .map_err(Into::into)
|
10140 - | };
|
10141 - | use ::futures_util::future::TryFutureExt;
|
10142 - | let fut = fut.map_err(
|
10143 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
10144 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
10145 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
10146 - | },
|
10147 - | );
|
10148 - | PutWithContentEncodingInputFuture {
|
10149 - | inner: Box::pin(fut),
|
10150 - | }
|
10151 - | }
|
10152 - | }
|
10153 - | impl
|
10154 - | ::aws_smithy_http_server::response::IntoResponse<
|
10155 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10156 - | > for crate::output::PutWithContentEncodingOutput
|
10157 - | {
|
10158 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
10159 - | match crate::protocol_serde::shape_put_with_content_encoding::ser_put_with_content_encoding_http_response(self) {
|
10160 - | Ok(response) => response,
|
10161 - | Err(e) => {
|
10162 - | ::tracing::error!(error = %e, "failed to serialize response");
|
10163 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
10164 - | }
|
10165 - | }
|
10166 - | }
|
10167 - | }
|
10168 - |
|
10169 - | static CONTENT_TYPE_FRACTIONALSECONDS: ::once_cell::sync::Lazy<::mime::Mime> =
|
10170 - | ::once_cell::sync::Lazy::new(|| {
|
10171 - | "application/x-amz-json-1.1"
|
10172 - | .parse::<::mime::Mime>()
|
10173 - | .expect("BUG: MIME parsing failed, content_type is not valid")
|
10174 - | });
|
10175 - | ::pin_project_lite::pin_project! {
|
10176 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
10177 - | /// [`FractionalSecondsInput`](crate::input::FractionalSecondsInput) using modelled bindings.
|
10178 - | pub struct FractionalSecondsInputFuture {
|
10179 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::FractionalSecondsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
10180 - | }
|
10181 - | }
|
10182 - |
|
10183 - | impl std::future::Future for FractionalSecondsInputFuture {
|
10184 - | type Output = Result<
|
10185 - | crate::input::FractionalSecondsInput,
|
10186 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
10187 - | >;
|
10188 - |
|
10189 - | fn poll(
|
10190 - | self: std::pin::Pin<&mut Self>,
|
10191 - | cx: &mut std::task::Context<'_>,
|
10192 - | ) -> std::task::Poll<Self::Output> {
|
10193 - | let this = self.project();
|
10194 - | this.inner.as_mut().poll(cx)
|
10195 - | }
|
10196 - | }
|
10197 - |
|
10198 - | impl<B>
|
10199 - | ::aws_smithy_http_server::request::FromRequest<
|
10200 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10201 - | B,
|
10202 - | > for crate::input::FractionalSecondsInput
|
10203 - | where
|
10204 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
10205 - | B: 'static,
|
10206 - |
|
10207 - | B::Data: Send,
|
10208 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
10209 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
10210 - | {
|
10211 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
10212 - | type Future = FractionalSecondsInputFuture;
|
10213 - |
|
10214 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
10215 - | let fut = async move {
|
10216 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
10217 - | request.headers(),
|
10218 - | &CONTENT_TYPE_FRACTIONALSECONDS,
|
10219 - | ) {
|
10220 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
10221 - | }
|
10222 - | crate::protocol_serde::shape_fractional_seconds::de_fractional_seconds_http_request(
|
10223 - | request,
|
10224 - | )
|
8826 + | Ok(response)
|
8827 + | };
|
8828 + | sender.send(()).await.expect("receiver dropped early");
|
8829 + | result
|
8830 + | }
|
8831 + | })
|
8832 + | .build_unchecked();
|
8833 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10225 8834 | .await
|
10226 - | .map_err(Into::into)
|
10227 - | };
|
10228 - | use ::futures_util::future::TryFutureExt;
|
10229 - | let fut = fut.map_err(
|
10230 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
10231 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
10232 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
10233 - | },
|
8835 + | .expect("unable to make an HTTP request");
|
8836 + | assert!(
|
8837 + | receiver.recv().await.is_some(),
|
8838 + | "we expected operation handler to be invoked but it was not entered"
|
10234 8839 | );
|
10235 - | FractionalSecondsInputFuture {
|
10236 - | inner: Box::pin(fut),
|
10237 - | }
|
10238 - | }
|
10239 - | }
|
10240 - | impl
|
10241 - | ::aws_smithy_http_server::response::IntoResponse<
|
10242 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10243 - | > for crate::output::FractionalSecondsOutput
|
10244 - | {
|
10245 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
10246 - | match crate::protocol_serde::shape_fractional_seconds::ser_fractional_seconds_http_response(
|
10247 - | self,
|
10248 - | ) {
|
10249 - | Ok(response) => response,
|
10250 - | Err(e) => {
|
10251 - | ::tracing::error!(error = %e, "failed to serialize response");
|
10252 - | ::aws_smithy_http_server::response::IntoResponse::<
|
10253 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10254 - | >::into_response(
|
10255 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
10256 - | e,
|
10257 - | ),
|
10258 - | )
|
10259 - | }
|
10260 - | }
|
10261 8840 | }
|
10262 - | }
|
10263 - |
|
10264 - | static CONTENT_TYPE_DATETIMEOFFSETS: ::once_cell::sync::Lazy<::mime::Mime> =
|
10265 - | ::once_cell::sync::Lazy::new(|| {
|
10266 - | "application/x-amz-json-1.1"
|
10267 - | .parse::<::mime::Mime>()
|
10268 - | .expect("BUG: MIME parsing failed, content_type is not valid")
|
10269 - | });
|
10270 - | ::pin_project_lite::pin_project! {
|
10271 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
10272 - | /// [`DatetimeOffsetsInput`](crate::input::DatetimeOffsetsInput) using modelled bindings.
|
10273 - | pub struct DatetimeOffsetsInputFuture {
|
10274 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::DatetimeOffsetsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
8841 + | /// Serializes structure shapes
|
8842 + | /// Test ID: serializes_structure_shapes
|
8843 + | #[::tokio::test]
|
8844 + | #[::tracing_test::traced_test]
|
8845 + | async fn serializes_structure_shapes_request() {
|
8846 + | #[allow(unused_mut)]
|
8847 + | let mut http_request = http::Request::builder()
|
8848 + | .uri("/")
|
8849 + | .method("POST")
|
8850 + | .header("Content-Type", "application/x-amz-json-1.1")
|
8851 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
8852 + | .body(::aws_smithy_http_server::body::Body::from(
|
8853 + | ::bytes::Bytes::from_static("{\"SimpleStruct\":{\"Value\":\"abc\"}}".as_bytes()),
|
8854 + | ))
|
8855 + | .unwrap();
|
8856 + | #[allow(unused_mut)]
|
8857 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8858 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
8859 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
8860 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
8861 + | let sender = sender.clone();
|
8862 + | async move {
|
8863 + | let result = {
|
8864 + | use ::aws_smithy_protocol_test::FloatEquals;
|
8865 + | let expected = crate::input::KitchenSinkOperationInput {
|
8866 + | simple_struct: ::std::option::Option::Some(
|
8867 + | crate::model::SimpleStruct {
|
8868 + | value: ::std::option::Option::Some("abc".to_owned()),
|
8869 + | },
|
8870 + | ),
|
8871 + | blob: ::std::option::Option::None,
|
8872 + | boolean: ::std::option::Option::None,
|
8873 + | double: ::std::option::Option::None,
|
8874 + | empty_struct: ::std::option::Option::None,
|
8875 + | float: ::std::option::Option::None,
|
8876 + | httpdate_timestamp: ::std::option::Option::None,
|
8877 + | integer: ::std::option::Option::None,
|
8878 + | iso8601_timestamp: ::std::option::Option::None,
|
8879 + | json_value: ::std::option::Option::None,
|
8880 + | list_of_lists: ::std::option::Option::None,
|
8881 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8882 + | list_of_strings: ::std::option::Option::None,
|
8883 + | list_of_structs: ::std::option::Option::None,
|
8884 + | long: ::std::option::Option::None,
|
8885 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8886 + | map_of_maps: ::std::option::Option::None,
|
8887 + | map_of_strings: ::std::option::Option::None,
|
8888 + | map_of_structs: ::std::option::Option::None,
|
8889 + | recursive_list: ::std::option::Option::None,
|
8890 + | recursive_map: ::std::option::Option::None,
|
8891 + | recursive_struct: ::std::option::Option::None,
|
8892 + | string: ::std::option::Option::None,
|
8893 + | struct_with_json_name: ::std::option::Option::None,
|
8894 + | timestamp: ::std::option::Option::None,
|
8895 + | unix_timestamp: ::std::option::Option::None,
|
8896 + | };
|
8897 + | ::pretty_assertions::assert_eq!(
|
8898 + | input.blob,
|
8899 + | expected.blob,
|
8900 + | "Unexpected value for `blob`"
|
8901 + | );
|
8902 + | ::pretty_assertions::assert_eq!(
|
8903 + | input.boolean,
|
8904 + | expected.boolean,
|
8905 + | "Unexpected value for `boolean`"
|
8906 + | );
|
8907 + | assert!(
|
8908 + | input.double.float_equals(&expected.double),
|
8909 + | "Unexpected value for `double` {:?} vs. {:?}",
|
8910 + | expected.double,
|
8911 + | input.double
|
8912 + | );
|
8913 + | ::pretty_assertions::assert_eq!(
|
8914 + | input.empty_struct,
|
8915 + | expected.empty_struct,
|
8916 + | "Unexpected value for `empty_struct`"
|
8917 + | );
|
8918 + | assert!(
|
8919 + | input.float.float_equals(&expected.float),
|
8920 + | "Unexpected value for `float` {:?} vs. {:?}",
|
8921 + | expected.float,
|
8922 + | input.float
|
8923 + | );
|
8924 + | ::pretty_assertions::assert_eq!(
|
8925 + | input.httpdate_timestamp,
|
8926 + | expected.httpdate_timestamp,
|
8927 + | "Unexpected value for `httpdate_timestamp`"
|
8928 + | );
|
8929 + | ::pretty_assertions::assert_eq!(
|
8930 + | input.integer,
|
8931 + | expected.integer,
|
8932 + | "Unexpected value for `integer`"
|
8933 + | );
|
8934 + | ::pretty_assertions::assert_eq!(
|
8935 + | input.iso8601_timestamp,
|
8936 + | expected.iso8601_timestamp,
|
8937 + | "Unexpected value for `iso8601_timestamp`"
|
8938 + | );
|
8939 + | ::pretty_assertions::assert_eq!(
|
8940 + | input.json_value,
|
8941 + | expected.json_value,
|
8942 + | "Unexpected value for `json_value`"
|
8943 + | );
|
8944 + | ::pretty_assertions::assert_eq!(
|
8945 + | input.list_of_lists,
|
8946 + | expected.list_of_lists,
|
8947 + | "Unexpected value for `list_of_lists`"
|
8948 + | );
|
8949 + | ::pretty_assertions::assert_eq!(
|
8950 + | input.list_of_maps_of_strings,
|
8951 + | expected.list_of_maps_of_strings,
|
8952 + | "Unexpected value for `list_of_maps_of_strings`"
|
8953 + | );
|
8954 + | ::pretty_assertions::assert_eq!(
|
8955 + | input.list_of_strings,
|
8956 + | expected.list_of_strings,
|
8957 + | "Unexpected value for `list_of_strings`"
|
8958 + | );
|
8959 + | ::pretty_assertions::assert_eq!(
|
8960 + | input.list_of_structs,
|
8961 + | expected.list_of_structs,
|
8962 + | "Unexpected value for `list_of_structs`"
|
8963 + | );
|
8964 + | ::pretty_assertions::assert_eq!(
|
8965 + | input.long,
|
8966 + | expected.long,
|
8967 + | "Unexpected value for `long`"
|
8968 + | );
|
8969 + | ::pretty_assertions::assert_eq!(
|
8970 + | input.map_of_lists_of_strings,
|
8971 + | expected.map_of_lists_of_strings,
|
8972 + | "Unexpected value for `map_of_lists_of_strings`"
|
8973 + | );
|
8974 + | ::pretty_assertions::assert_eq!(
|
8975 + | input.map_of_maps,
|
8976 + | expected.map_of_maps,
|
8977 + | "Unexpected value for `map_of_maps`"
|
8978 + | );
|
8979 + | ::pretty_assertions::assert_eq!(
|
8980 + | input.map_of_strings,
|
8981 + | expected.map_of_strings,
|
8982 + | "Unexpected value for `map_of_strings`"
|
8983 + | );
|
8984 + | ::pretty_assertions::assert_eq!(
|
8985 + | input.map_of_structs,
|
8986 + | expected.map_of_structs,
|
8987 + | "Unexpected value for `map_of_structs`"
|
8988 + | );
|
8989 + | ::pretty_assertions::assert_eq!(
|
8990 + | input.recursive_list,
|
8991 + | expected.recursive_list,
|
8992 + | "Unexpected value for `recursive_list`"
|
8993 + | );
|
8994 + | ::pretty_assertions::assert_eq!(
|
8995 + | input.recursive_map,
|
8996 + | expected.recursive_map,
|
8997 + | "Unexpected value for `recursive_map`"
|
8998 + | );
|
8999 + | ::pretty_assertions::assert_eq!(
|
9000 + | input.recursive_struct,
|
9001 + | expected.recursive_struct,
|
9002 + | "Unexpected value for `recursive_struct`"
|
9003 + | );
|
9004 + | ::pretty_assertions::assert_eq!(
|
9005 + | input.simple_struct,
|
9006 + | expected.simple_struct,
|
9007 + | "Unexpected value for `simple_struct`"
|
9008 + | );
|
9009 + | ::pretty_assertions::assert_eq!(
|
9010 + | input.string,
|
9011 + | expected.string,
|
9012 + | "Unexpected value for `string`"
|
9013 + | );
|
9014 + | ::pretty_assertions::assert_eq!(
|
9015 + | input.struct_with_json_name,
|
9016 + | expected.struct_with_json_name,
|
9017 + | "Unexpected value for `struct_with_json_name`"
|
9018 + | );
|
9019 + | ::pretty_assertions::assert_eq!(
|
9020 + | input.timestamp,
|
9021 + | expected.timestamp,
|
9022 + | "Unexpected value for `timestamp`"
|
9023 + | );
|
9024 + | ::pretty_assertions::assert_eq!(
|
9025 + | input.unix_timestamp,
|
9026 + | expected.unix_timestamp,
|
9027 + | "Unexpected value for `unix_timestamp`"
|
9028 + | );
|
9029 + | let response = crate::output::KitchenSinkOperationOutput {
|
9030 + | blob: ::std::option::Option::None,
|
9031 + | boolean: ::std::option::Option::None,
|
9032 + | double: ::std::option::Option::None,
|
9033 + | empty_struct: ::std::option::Option::None,
|
9034 + | float: ::std::option::Option::None,
|
9035 + | httpdate_timestamp: ::std::option::Option::None,
|
9036 + | integer: ::std::option::Option::None,
|
9037 + | iso8601_timestamp: ::std::option::Option::None,
|
9038 + | json_value: ::std::option::Option::None,
|
9039 + | list_of_lists: ::std::option::Option::None,
|
9040 + | list_of_maps_of_strings: ::std::option::Option::None,
|
9041 + | list_of_strings: ::std::option::Option::None,
|
9042 + | list_of_structs: ::std::option::Option::None,
|
9043 + | long: ::std::option::Option::None,
|
9044 + | map_of_lists_of_strings: ::std::option::Option::None,
|
9045 + | map_of_maps: ::std::option::Option::None,
|
9046 + | map_of_strings: ::std::option::Option::None,
|
9047 + | map_of_structs: ::std::option::Option::None,
|
9048 + | recursive_list: ::std::option::Option::None,
|
9049 + | recursive_map: ::std::option::Option::None,
|
9050 + | recursive_struct: ::std::option::Option::None,
|
9051 + | simple_struct: ::std::option::Option::None,
|
9052 + | string: ::std::option::Option::None,
|
9053 + | struct_with_json_name: ::std::option::Option::None,
|
9054 + | timestamp: ::std::option::Option::None,
|
9055 + | unix_timestamp: ::std::option::Option::None,
|
9056 + | };
|
9057 + | Ok(response)
|
9058 + | };
|
9059 + | sender.send(()).await.expect("receiver dropped early");
|
9060 + | result
|
9061 + | }
|
9062 + | })
|
9063 + | .build_unchecked();
|
9064 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9065 + | .await
|
9066 + | .expect("unable to make an HTTP request");
|
9067 + | assert!(
|
9068 + | receiver.recv().await.is_some(),
|
9069 + | "we expected operation handler to be invoked but it was not entered"
|
9070 + | );
|
10275 9071 | }
|
10276 - | }
|
10277 - |
|
10278 - | impl std::future::Future for DatetimeOffsetsInputFuture {
|
10279 - | type Output = Result<
|
10280 - | crate::input::DatetimeOffsetsInput,
|
10281 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
10282 - | >;
|
10283 - |
|
10284 - | fn poll(
|
10285 - | self: std::pin::Pin<&mut Self>,
|
10286 - | cx: &mut std::task::Context<'_>,
|
10287 - | ) -> std::task::Poll<Self::Output> {
|
10288 - | let this = self.project();
|
10289 - | this.inner.as_mut().poll(cx)
|
9072 + | /// Serializes structure members with locationName traits
|
9073 + | /// Test ID: serializes_structure_members_with_locationname_traits
|
9074 + | #[::tokio::test]
|
9075 + | #[::tracing_test::traced_test]
|
9076 + | async fn serializes_structure_members_with_locationname_traits_request() {
|
9077 + | #[allow(unused_mut)]
|
9078 + | let mut http_request = http::Request::builder()
|
9079 + | .uri("/")
|
9080 + | .method("POST")
|
9081 + | .header("Content-Type", "application/x-amz-json-1.1")
|
9082 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
9083 + | .body(::aws_smithy_http_server::body::Body::from(
|
9084 + | ::bytes::Bytes::from_static(
|
9085 + | "{\"StructWithJsonName\":{\"Value\":\"some-value\"}}".as_bytes(),
|
9086 + | ),
|
9087 + | ))
|
9088 + | .unwrap();
|
9089 + | #[allow(unused_mut)]
|
9090 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9091 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
9092 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9093 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
9094 + | let sender = sender.clone();
|
9095 + | async move {
|
9096 + | let result = {
|
9097 + | use ::aws_smithy_protocol_test::FloatEquals;
|
9098 + | let expected = crate::input::KitchenSinkOperationInput {
|
9099 + | struct_with_json_name: ::std::option::Option::Some(
|
9100 + | crate::model::StructWithJsonName {
|
9101 + | value: ::std::option::Option::Some("some-value".to_owned()),
|
9102 + | },
|
9103 + | ),
|
9104 + | blob: ::std::option::Option::None,
|
9105 + | boolean: ::std::option::Option::None,
|
9106 + | double: ::std::option::Option::None,
|
9107 + | empty_struct: ::std::option::Option::None,
|
9108 + | float: ::std::option::Option::None,
|
9109 + | httpdate_timestamp: ::std::option::Option::None,
|
9110 + | integer: ::std::option::Option::None,
|
9111 + | iso8601_timestamp: ::std::option::Option::None,
|
9112 + | json_value: ::std::option::Option::None,
|
9113 + | list_of_lists: ::std::option::Option::None,
|
9114 + | list_of_maps_of_strings: ::std::option::Option::None,
|
9115 + | list_of_strings: ::std::option::Option::None,
|
9116 + | list_of_structs: ::std::option::Option::None,
|
9117 + | long: ::std::option::Option::None,
|
9118 + | map_of_lists_of_strings: ::std::option::Option::None,
|
9119 + | map_of_maps: ::std::option::Option::None,
|
9120 + | map_of_strings: ::std::option::Option::None,
|
9121 + | map_of_structs: ::std::option::Option::None,
|
9122 + | recursive_list: ::std::option::Option::None,
|
9123 + | recursive_map: ::std::option::Option::None,
|
9124 + | recursive_struct: ::std::option::Option::None,
|
9125 + | simple_struct: ::std::option::Option::None,
|
9126 + | string: ::std::option::Option::None,
|
9127 + | timestamp: ::std::option::Option::None,
|
9128 + | unix_timestamp: ::std::option::Option::None,
|
9129 + | };
|
9130 + | ::pretty_assertions::assert_eq!(
|
9131 + | input.blob,
|
9132 + | expected.blob,
|
9133 + | "Unexpected value for `blob`"
|
9134 + | );
|
9135 + | ::pretty_assertions::assert_eq!(
|
9136 + | input.boolean,
|
9137 + | expected.boolean,
|
9138 + | "Unexpected value for `boolean`"
|
9139 + | );
|
9140 + | assert!(
|
9141 + | input.double.float_equals(&expected.double),
|
9142 + | "Unexpected value for `double` {:?} vs. {:?}",
|
9143 + | expected.double,
|
9144 + | input.double
|
9145 + | );
|
9146 + | ::pretty_assertions::assert_eq!(
|
9147 + | input.empty_struct,
|
9148 + | expected.empty_struct,
|
9149 + | "Unexpected value for `empty_struct`"
|
9150 + | );
|
9151 + | assert!(
|
9152 + | input.float.float_equals(&expected.float),
|
9153 + | "Unexpected value for `float` {:?} vs. {:?}",
|
9154 + | expected.float,
|
9155 + | input.float
|
9156 + | );
|
9157 + | ::pretty_assertions::assert_eq!(
|
9158 + | input.httpdate_timestamp,
|
9159 + | expected.httpdate_timestamp,
|
9160 + | "Unexpected value for `httpdate_timestamp`"
|
9161 + | );
|
9162 + | ::pretty_assertions::assert_eq!(
|
9163 + | input.integer,
|
9164 + | expected.integer,
|
9165 + | "Unexpected value for `integer`"
|
9166 + | );
|
9167 + | ::pretty_assertions::assert_eq!(
|
9168 + | input.iso8601_timestamp,
|
9169 + | expected.iso8601_timestamp,
|
9170 + | "Unexpected value for `iso8601_timestamp`"
|
9171 + | );
|
9172 + | ::pretty_assertions::assert_eq!(
|
9173 + | input.json_value,
|
9174 + | expected.json_value,
|
9175 + | "Unexpected value for `json_value`"
|
9176 + | );
|
9177 + | ::pretty_assertions::assert_eq!(
|
9178 + | input.list_of_lists,
|
9179 + | expected.list_of_lists,
|
9180 + | "Unexpected value for `list_of_lists`"
|
9181 + | );
|
9182 + | ::pretty_assertions::assert_eq!(
|
9183 + | input.list_of_maps_of_strings,
|
9184 + | expected.list_of_maps_of_strings,
|
9185 + | "Unexpected value for `list_of_maps_of_strings`"
|
9186 + | );
|
9187 + | ::pretty_assertions::assert_eq!(
|
9188 + | input.list_of_strings,
|
9189 + | expected.list_of_strings,
|
9190 + | "Unexpected value for `list_of_strings`"
|
9191 + | );
|
9192 + | ::pretty_assertions::assert_eq!(
|
9193 + | input.list_of_structs,
|
9194 + | expected.list_of_structs,
|
9195 + | "Unexpected value for `list_of_structs`"
|
9196 + | );
|
9197 + | ::pretty_assertions::assert_eq!(
|
9198 + | input.long,
|
9199 + | expected.long,
|
9200 + | "Unexpected value for `long`"
|
9201 + | );
|
9202 + | ::pretty_assertions::assert_eq!(
|
9203 + | input.map_of_lists_of_strings,
|
9204 + | expected.map_of_lists_of_strings,
|
9205 + | "Unexpected value for `map_of_lists_of_strings`"
|
9206 + | );
|
9207 + | ::pretty_assertions::assert_eq!(
|
9208 + | input.map_of_maps,
|
9209 + | expected.map_of_maps,
|
9210 + | "Unexpected value for `map_of_maps`"
|
9211 + | );
|
9212 + | ::pretty_assertions::assert_eq!(
|
9213 + | input.map_of_strings,
|
9214 + | expected.map_of_strings,
|
9215 + | "Unexpected value for `map_of_strings`"
|
9216 + | );
|
9217 + | ::pretty_assertions::assert_eq!(
|
9218 + | input.map_of_structs,
|
9219 + | expected.map_of_structs,
|
9220 + | "Unexpected value for `map_of_structs`"
|
9221 + | );
|
9222 + | ::pretty_assertions::assert_eq!(
|
9223 + | input.recursive_list,
|
9224 + | expected.recursive_list,
|
9225 + | "Unexpected value for `recursive_list`"
|
9226 + | );
|
9227 + | ::pretty_assertions::assert_eq!(
|
9228 + | input.recursive_map,
|
9229 + | expected.recursive_map,
|
9230 + | "Unexpected value for `recursive_map`"
|
9231 + | );
|
9232 + | ::pretty_assertions::assert_eq!(
|
9233 + | input.recursive_struct,
|
9234 + | expected.recursive_struct,
|
9235 + | "Unexpected value for `recursive_struct`"
|
9236 + | );
|
9237 + | ::pretty_assertions::assert_eq!(
|
9238 + | input.simple_struct,
|
9239 + | expected.simple_struct,
|
9240 + | "Unexpected value for `simple_struct`"
|
9241 + | );
|
9242 + | ::pretty_assertions::assert_eq!(
|
9243 + | input.string,
|
9244 + | expected.string,
|
9245 + | "Unexpected value for `string`"
|
9246 + | );
|
9247 + | ::pretty_assertions::assert_eq!(
|
9248 + | input.struct_with_json_name,
|
9249 + | expected.struct_with_json_name,
|
9250 + | "Unexpected value for `struct_with_json_name`"
|
9251 + | );
|
9252 + | ::pretty_assertions::assert_eq!(
|
9253 + | input.timestamp,
|
9254 + | expected.timestamp,
|
9255 + | "Unexpected value for `timestamp`"
|
9256 + | );
|
9257 + | ::pretty_assertions::assert_eq!(
|
9258 + | input.unix_timestamp,
|
9259 + | expected.unix_timestamp,
|
9260 + | "Unexpected value for `unix_timestamp`"
|
9261 + | );
|
9262 + | let response = crate::output::KitchenSinkOperationOutput {
|
9263 + | blob: ::std::option::Option::None,
|
9264 + | boolean: ::std::option::Option::None,
|
9265 + | double: ::std::option::Option::None,
|
9266 + | empty_struct: ::std::option::Option::None,
|
9267 + | float: ::std::option::Option::None,
|
9268 + | httpdate_timestamp: ::std::option::Option::None,
|
9269 + | integer: ::std::option::Option::None,
|
9270 + | iso8601_timestamp: ::std::option::Option::None,
|
9271 + | json_value: ::std::option::Option::None,
|
9272 + | list_of_lists: ::std::option::Option::None,
|
9273 + | list_of_maps_of_strings: ::std::option::Option::None,
|
9274 + | list_of_strings: ::std::option::Option::None,
|
9275 + | list_of_structs: ::std::option::Option::None,
|
9276 + | long: ::std::option::Option::None,
|
9277 + | map_of_lists_of_strings: ::std::option::Option::None,
|
9278 + | map_of_maps: ::std::option::Option::None,
|
9279 + | map_of_strings: ::std::option::Option::None,
|
9280 + | map_of_structs: ::std::option::Option::None,
|
9281 + | recursive_list: ::std::option::Option::None,
|
9282 + | recursive_map: ::std::option::Option::None,
|
9283 + | recursive_struct: ::std::option::Option::None,
|
9284 + | simple_struct: ::std::option::Option::None,
|
9285 + | string: ::std::option::Option::None,
|
9286 + | struct_with_json_name: ::std::option::Option::None,
|
9287 + | timestamp: ::std::option::Option::None,
|
9288 + | unix_timestamp: ::std::option::Option::None,
|
9289 + | };
|
9290 + | Ok(response)
|
9291 + | };
|
9292 + | sender.send(()).await.expect("receiver dropped early");
|
9293 + | result
|
9294 + | }
|
9295 + | })
|
9296 + | .build_unchecked();
|
9297 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9298 + | .await
|
9299 + | .expect("unable to make an HTTP request");
|
9300 + | assert!(
|
9301 + | receiver.recv().await.is_some(),
|
9302 + | "we expected operation handler to be invoked but it was not entered"
|
9303 + | );
|
10290 9304 | }
|
10291 - | }
|
10292 - |
|
10293 - | impl<B>
|
10294 - | ::aws_smithy_http_server::request::FromRequest<
|
10295 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10296 - | B,
|
10297 - | > for crate::input::DatetimeOffsetsInput
|
10298 - | where
|
10299 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
10300 - | B: 'static,
|
10301 - |
|
10302 - | B::Data: Send,
|
10303 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
10304 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
10305 - | {
|
10306 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
10307 - | type Future = DatetimeOffsetsInputFuture;
|
10308 - |
|
10309 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
10310 - | let fut = async move {
|
10311 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
10312 - | request.headers(),
|
10313 - | &CONTENT_TYPE_DATETIMEOFFSETS,
|
10314 - | ) {
|
10315 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
10316 - | }
|
10317 - | crate::protocol_serde::shape_datetime_offsets::de_datetime_offsets_http_request(request)
|
10318 - | .await
|
10319 - | .map_err(Into::into)
|
10320 - | };
|
10321 - | use ::futures_util::future::TryFutureExt;
|
10322 - | let fut = fut.map_err(
|
10323 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
10324 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
10325 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
10326 - | },
|
9305 + | /// Serializes empty structure shapes
|
9306 + | /// Test ID: serializes_empty_structure_shapes
|
9307 + | #[::tokio::test]
|
9308 + | #[::tracing_test::traced_test]
|
9309 + | async fn serializes_empty_structure_shapes_request() {
|
9310 + | #[allow(unused_mut)]
|
9311 + | let mut http_request = http::Request::builder()
|
9312 + | .uri("/")
|
9313 + | .method("POST")
|
9314 + | .header("Content-Type", "application/x-amz-json-1.1")
|
9315 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
9316 + | .body(::aws_smithy_http_server::body::Body::from(
|
9317 + | ::bytes::Bytes::from_static("{\"SimpleStruct\":{}}".as_bytes()),
|
9318 + | ))
|
9319 + | .unwrap();
|
9320 + | #[allow(unused_mut)]
|
9321 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9322 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
9323 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9324 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
9325 + | let sender = sender.clone();
|
9326 + | async move {
|
9327 + | let result = {
|
9328 + | use ::aws_smithy_protocol_test::FloatEquals;
|
9329 + | let expected = crate::input::KitchenSinkOperationInput {
|
9330 + | simple_struct: ::std::option::Option::Some(
|
9331 + | crate::model::SimpleStruct {
|
9332 + | value: ::std::option::Option::None,
|
9333 + | },
|
9334 + | ),
|
9335 + | blob: ::std::option::Option::None,
|
9336 + | boolean: ::std::option::Option::None,
|
9337 + | double: ::std::option::Option::None,
|
9338 + | empty_struct: ::std::option::Option::None,
|
9339 + | float: ::std::option::Option::None,
|
9340 + | httpdate_timestamp: ::std::option::Option::None,
|
9341 + | integer: ::std::option::Option::None,
|
9342 + | iso8601_timestamp: ::std::option::Option::None,
|
9343 + | json_value: ::std::option::Option::None,
|
9344 + | list_of_lists: ::std::option::Option::None,
|
9345 + | list_of_maps_of_strings: ::std::option::Option::None,
|
9346 + | list_of_strings: ::std::option::Option::None,
|
9347 + | list_of_structs: ::std::option::Option::None,
|
9348 + | long: ::std::option::Option::None,
|
9349 + | map_of_lists_of_strings: ::std::option::Option::None,
|
9350 + | map_of_maps: ::std::option::Option::None,
|
9351 + | map_of_strings: ::std::option::Option::None,
|
9352 + | map_of_structs: ::std::option::Option::None,
|
9353 + | recursive_list: ::std::option::Option::None,
|
9354 + | recursive_map: ::std::option::Option::None,
|
9355 + | recursive_struct: ::std::option::Option::None,
|
9356 + | string: ::std::option::Option::None,
|
9357 + | struct_with_json_name: ::std::option::Option::None,
|
9358 + | timestamp: ::std::option::Option::None,
|
9359 + | unix_timestamp: ::std::option::Option::None,
|
9360 + | };
|
9361 + | ::pretty_assertions::assert_eq!(
|
9362 + | input.blob,
|
9363 + | expected.blob,
|
9364 + | "Unexpected value for `blob`"
|
9365 + | );
|
9366 + | ::pretty_assertions::assert_eq!(
|
9367 + | input.boolean,
|
9368 + | expected.boolean,
|
9369 + | "Unexpected value for `boolean`"
|
9370 + | );
|
9371 + | assert!(
|
9372 + | input.double.float_equals(&expected.double),
|
9373 + | "Unexpected value for `double` {:?} vs. {:?}",
|
9374 + | expected.double,
|
9375 + | input.double
|
9376 + | );
|
9377 + | ::pretty_assertions::assert_eq!(
|
9378 + | input.empty_struct,
|
9379 + | expected.empty_struct,
|
9380 + | "Unexpected value for `empty_struct`"
|
9381 + | );
|
9382 + | assert!(
|
9383 + | input.float.float_equals(&expected.float),
|
9384 + | "Unexpected value for `float` {:?} vs. {:?}",
|
9385 + | expected.float,
|
9386 + | input.float
|
9387 + | );
|
9388 + | ::pretty_assertions::assert_eq!(
|
9389 + | input.httpdate_timestamp,
|
9390 + | expected.httpdate_timestamp,
|
9391 + | "Unexpected value for `httpdate_timestamp`"
|
9392 + | );
|
9393 + | ::pretty_assertions::assert_eq!(
|
9394 + | input.integer,
|
9395 + | expected.integer,
|
9396 + | "Unexpected value for `integer`"
|
9397 + | );
|
9398 + | ::pretty_assertions::assert_eq!(
|
9399 + | input.iso8601_timestamp,
|
9400 + | expected.iso8601_timestamp,
|
9401 + | "Unexpected value for `iso8601_timestamp`"
|
9402 + | );
|
9403 + | ::pretty_assertions::assert_eq!(
|
9404 + | input.json_value,
|
9405 + | expected.json_value,
|
9406 + | "Unexpected value for `json_value`"
|
9407 + | );
|
9408 + | ::pretty_assertions::assert_eq!(
|
9409 + | input.list_of_lists,
|
9410 + | expected.list_of_lists,
|
9411 + | "Unexpected value for `list_of_lists`"
|
9412 + | );
|
9413 + | ::pretty_assertions::assert_eq!(
|
9414 + | input.list_of_maps_of_strings,
|
9415 + | expected.list_of_maps_of_strings,
|
9416 + | "Unexpected value for `list_of_maps_of_strings`"
|
9417 + | );
|
9418 + | ::pretty_assertions::assert_eq!(
|
9419 + | input.list_of_strings,
|
9420 + | expected.list_of_strings,
|
9421 + | "Unexpected value for `list_of_strings`"
|
9422 + | );
|
9423 + | ::pretty_assertions::assert_eq!(
|
9424 + | input.list_of_structs,
|
9425 + | expected.list_of_structs,
|
9426 + | "Unexpected value for `list_of_structs`"
|
9427 + | );
|
9428 + | ::pretty_assertions::assert_eq!(
|
9429 + | input.long,
|
9430 + | expected.long,
|
9431 + | "Unexpected value for `long`"
|
9432 + | );
|
9433 + | ::pretty_assertions::assert_eq!(
|
9434 + | input.map_of_lists_of_strings,
|
9435 + | expected.map_of_lists_of_strings,
|
9436 + | "Unexpected value for `map_of_lists_of_strings`"
|
9437 + | );
|
9438 + | ::pretty_assertions::assert_eq!(
|
9439 + | input.map_of_maps,
|
9440 + | expected.map_of_maps,
|
9441 + | "Unexpected value for `map_of_maps`"
|
9442 + | );
|
9443 + | ::pretty_assertions::assert_eq!(
|
9444 + | input.map_of_strings,
|
9445 + | expected.map_of_strings,
|
9446 + | "Unexpected value for `map_of_strings`"
|
9447 + | );
|
9448 + | ::pretty_assertions::assert_eq!(
|
9449 + | input.map_of_structs,
|
9450 + | expected.map_of_structs,
|
9451 + | "Unexpected value for `map_of_structs`"
|
9452 + | );
|
9453 + | ::pretty_assertions::assert_eq!(
|
9454 + | input.recursive_list,
|
9455 + | expected.recursive_list,
|
9456 + | "Unexpected value for `recursive_list`"
|
9457 + | );
|
9458 + | ::pretty_assertions::assert_eq!(
|
9459 + | input.recursive_map,
|
9460 + | expected.recursive_map,
|
9461 + | "Unexpected value for `recursive_map`"
|
9462 + | );
|
9463 + | ::pretty_assertions::assert_eq!(
|
9464 + | input.recursive_struct,
|
9465 + | expected.recursive_struct,
|
9466 + | "Unexpected value for `recursive_struct`"
|
9467 + | );
|
9468 + | ::pretty_assertions::assert_eq!(
|
9469 + | input.simple_struct,
|
9470 + | expected.simple_struct,
|
9471 + | "Unexpected value for `simple_struct`"
|
9472 + | );
|
9473 + | ::pretty_assertions::assert_eq!(
|
9474 + | input.string,
|
9475 + | expected.string,
|
9476 + | "Unexpected value for `string`"
|
9477 + | );
|
9478 + | ::pretty_assertions::assert_eq!(
|
9479 + | input.struct_with_json_name,
|
9480 + | expected.struct_with_json_name,
|
9481 + | "Unexpected value for `struct_with_json_name`"
|
9482 + | );
|
9483 + | ::pretty_assertions::assert_eq!(
|
9484 + | input.timestamp,
|
9485 + | expected.timestamp,
|
9486 + | "Unexpected value for `timestamp`"
|
9487 + | );
|
9488 + | ::pretty_assertions::assert_eq!(
|
9489 + | input.unix_timestamp,
|
9490 + | expected.unix_timestamp,
|
9491 + | "Unexpected value for `unix_timestamp`"
|
9492 + | );
|
9493 + | let response = crate::output::KitchenSinkOperationOutput {
|
9494 + | blob: ::std::option::Option::None,
|
9495 + | boolean: ::std::option::Option::None,
|
9496 + | double: ::std::option::Option::None,
|
9497 + | empty_struct: ::std::option::Option::None,
|
9498 + | float: ::std::option::Option::None,
|
9499 + | httpdate_timestamp: ::std::option::Option::None,
|
9500 + | integer: ::std::option::Option::None,
|
9501 + | iso8601_timestamp: ::std::option::Option::None,
|
9502 + | json_value: ::std::option::Option::None,
|
9503 + | list_of_lists: ::std::option::Option::None,
|
9504 + | list_of_maps_of_strings: ::std::option::Option::None,
|
9505 + | list_of_strings: ::std::option::Option::None,
|
9506 + | list_of_structs: ::std::option::Option::None,
|
9507 + | long: ::std::option::Option::None,
|
9508 + | map_of_lists_of_strings: ::std::option::Option::None,
|
9509 + | map_of_maps: ::std::option::Option::None,
|
9510 + | map_of_strings: ::std::option::Option::None,
|
9511 + | map_of_structs: ::std::option::Option::None,
|
9512 + | recursive_list: ::std::option::Option::None,
|
9513 + | recursive_map: ::std::option::Option::None,
|
9514 + | recursive_struct: ::std::option::Option::None,
|
9515 + | simple_struct: ::std::option::Option::None,
|
9516 + | string: ::std::option::Option::None,
|
9517 + | struct_with_json_name: ::std::option::Option::None,
|
9518 + | timestamp: ::std::option::Option::None,
|
9519 + | unix_timestamp: ::std::option::Option::None,
|
9520 + | };
|
9521 + | Ok(response)
|
9522 + | };
|
9523 + | sender.send(()).await.expect("receiver dropped early");
|
9524 + | result
|
9525 + | }
|
9526 + | })
|
9527 + | .build_unchecked();
|
9528 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9529 + | .await
|
9530 + | .expect("unable to make an HTTP request");
|
9531 + | assert!(
|
9532 + | receiver.recv().await.is_some(),
|
9533 + | "we expected operation handler to be invoked but it was not entered"
|
10327 9534 | );
|
10328 - | DatetimeOffsetsInputFuture {
|
10329 - | inner: Box::pin(fut),
|
10330 - | }
|
10331 - | }
|
10332 - | }
|
10333 - | impl
|
10334 - | ::aws_smithy_http_server::response::IntoResponse<
|
10335 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10336 - | > for crate::output::DatetimeOffsetsOutput
|
10337 - | {
|
10338 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
10339 - | match crate::protocol_serde::shape_datetime_offsets::ser_datetime_offsets_http_response(
|
10340 - | self,
|
10341 - | ) {
|
10342 - | Ok(response) => response,
|
10343 - | Err(e) => {
|
10344 - | ::tracing::error!(error = %e, "failed to serialize response");
|
10345 - | ::aws_smithy_http_server::response::IntoResponse::<
|
10346 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10347 - | >::into_response(
|
10348 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
10349 - | e,
|
10350 - | ),
|
10351 - | )
|
10352 - | }
|
10353 - | }
|
10354 - | }
|
10355 - | }
|
10356 - |
|
10357 - | static CONTENT_TYPE_HOSTWITHPATHOPERATION: ::once_cell::sync::Lazy<::mime::Mime> =
|
10358 - | ::once_cell::sync::Lazy::new(|| {
|
10359 - | "application/x-amz-json-1.1"
|
10360 - | .parse::<::mime::Mime>()
|
10361 - | .expect("BUG: MIME parsing failed, content_type is not valid")
|
10362 - | });
|
10363 - | ::pin_project_lite::pin_project! {
|
10364 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
10365 - | /// [`HostWithPathOperationInput`](crate::input::HostWithPathOperationInput) using modelled bindings.
|
10366 - | pub struct HostWithPathOperationInputFuture {
|
10367 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::HostWithPathOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
10368 9535 | }
|
10369 - | }
|
10370 - |
|
10371 - | impl std::future::Future for HostWithPathOperationInputFuture {
|
10372 - | type Output = Result<
|
10373 - | crate::input::HostWithPathOperationInput,
|
10374 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
10375 - | >;
|
10376 - |
|
10377 - | fn poll(
|
10378 - | self: std::pin::Pin<&mut Self>,
|
10379 - | cx: &mut std::task::Context<'_>,
|
10380 - | ) -> std::task::Poll<Self::Output> {
|
10381 - | let this = self.project();
|
10382 - | this.inner.as_mut().poll(cx)
|
9536 + | /// Serializes structure which have no members
|
9537 + | /// Test ID: serializes_structure_which_have_no_members
|
9538 + | #[::tokio::test]
|
9539 + | #[::tracing_test::traced_test]
|
9540 + | async fn serializes_structure_which_have_no_members_request() {
|
9541 + | #[allow(unused_mut)]
|
9542 + | let mut http_request = http::Request::builder()
|
9543 + | .uri("/")
|
9544 + | .method("POST")
|
9545 + | .header("Content-Type", "application/x-amz-json-1.1")
|
9546 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
9547 + | .body(::aws_smithy_http_server::body::Body::from(
|
9548 + | ::bytes::Bytes::from_static("{\"EmptyStruct\":{}}".as_bytes()),
|
9549 + | ))
|
9550 + | .unwrap();
|
9551 + | #[allow(unused_mut)]
|
9552 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9553 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
9554 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9555 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
9556 + | let sender = sender.clone();
|
9557 + | async move {
|
9558 + | let result = {
|
9559 + | use ::aws_smithy_protocol_test::FloatEquals;
|
9560 + | let expected = crate::input::KitchenSinkOperationInput {
|
9561 + | empty_struct: ::std::option::Option::Some(crate::model::EmptyStruct {}),
|
9562 + | blob: ::std::option::Option::None,
|
9563 + | boolean: ::std::option::Option::None,
|
9564 + | double: ::std::option::Option::None,
|
9565 + | float: ::std::option::Option::None,
|
9566 + | httpdate_timestamp: ::std::option::Option::None,
|
9567 + | integer: ::std::option::Option::None,
|
9568 + | iso8601_timestamp: ::std::option::Option::None,
|
9569 + | json_value: ::std::option::Option::None,
|
9570 + | list_of_lists: ::std::option::Option::None,
|
9571 + | list_of_maps_of_strings: ::std::option::Option::None,
|
9572 + | list_of_strings: ::std::option::Option::None,
|
9573 + | list_of_structs: ::std::option::Option::None,
|
9574 + | long: ::std::option::Option::None,
|
9575 + | map_of_lists_of_strings: ::std::option::Option::None,
|
9576 + | map_of_maps: ::std::option::Option::None,
|
9577 + | map_of_strings: ::std::option::Option::None,
|
9578 + | map_of_structs: ::std::option::Option::None,
|
9579 + | recursive_list: ::std::option::Option::None,
|
9580 + | recursive_map: ::std::option::Option::None,
|
9581 + | recursive_struct: ::std::option::Option::None,
|
9582 + | simple_struct: ::std::option::Option::None,
|
9583 + | string: ::std::option::Option::None,
|
9584 + | struct_with_json_name: ::std::option::Option::None,
|
9585 + | timestamp: ::std::option::Option::None,
|
9586 + | unix_timestamp: ::std::option::Option::None,
|
9587 + | };
|
9588 + | ::pretty_assertions::assert_eq!(
|
9589 + | input.blob,
|
9590 + | expected.blob,
|
9591 + | "Unexpected value for `blob`"
|
9592 + | );
|
9593 + | ::pretty_assertions::assert_eq!(
|
9594 + | input.boolean,
|
9595 + | expected.boolean,
|
9596 + | "Unexpected value for `boolean`"
|
9597 + | );
|
9598 + | assert!(
|
9599 + | input.double.float_equals(&expected.double),
|
9600 + | "Unexpected value for `double` {:?} vs. {:?}",
|
9601 + | expected.double,
|
9602 + | input.double
|
9603 + | );
|
9604 + | ::pretty_assertions::assert_eq!(
|
9605 + | input.empty_struct,
|
9606 + | expected.empty_struct,
|
9607 + | "Unexpected value for `empty_struct`"
|
9608 + | );
|
9609 + | assert!(
|
9610 + | input.float.float_equals(&expected.float),
|
9611 + | "Unexpected value for `float` {:?} vs. {:?}",
|
9612 + | expected.float,
|
9613 + | input.float
|
9614 + | );
|
9615 + | ::pretty_assertions::assert_eq!(
|
9616 + | input.httpdate_timestamp,
|
9617 + | expected.httpdate_timestamp,
|
9618 + | "Unexpected value for `httpdate_timestamp`"
|
9619 + | );
|
9620 + | ::pretty_assertions::assert_eq!(
|
9621 + | input.integer,
|
9622 + | expected.integer,
|
9623 + | "Unexpected value for `integer`"
|
9624 + | );
|
9625 + | ::pretty_assertions::assert_eq!(
|
9626 + | input.iso8601_timestamp,
|
9627 + | expected.iso8601_timestamp,
|
9628 + | "Unexpected value for `iso8601_timestamp`"
|
9629 + | );
|
9630 + | ::pretty_assertions::assert_eq!(
|
9631 + | input.json_value,
|
9632 + | expected.json_value,
|
9633 + | "Unexpected value for `json_value`"
|
9634 + | );
|
9635 + | ::pretty_assertions::assert_eq!(
|
9636 + | input.list_of_lists,
|
9637 + | expected.list_of_lists,
|
9638 + | "Unexpected value for `list_of_lists`"
|
9639 + | );
|
9640 + | ::pretty_assertions::assert_eq!(
|
9641 + | input.list_of_maps_of_strings,
|
9642 + | expected.list_of_maps_of_strings,
|
9643 + | "Unexpected value for `list_of_maps_of_strings`"
|
9644 + | );
|
9645 + | ::pretty_assertions::assert_eq!(
|
9646 + | input.list_of_strings,
|
9647 + | expected.list_of_strings,
|
9648 + | "Unexpected value for `list_of_strings`"
|
9649 + | );
|
9650 + | ::pretty_assertions::assert_eq!(
|
9651 + | input.list_of_structs,
|
9652 + | expected.list_of_structs,
|
9653 + | "Unexpected value for `list_of_structs`"
|
9654 + | );
|
9655 + | ::pretty_assertions::assert_eq!(
|
9656 + | input.long,
|
9657 + | expected.long,
|
9658 + | "Unexpected value for `long`"
|
9659 + | );
|
9660 + | ::pretty_assertions::assert_eq!(
|
9661 + | input.map_of_lists_of_strings,
|
9662 + | expected.map_of_lists_of_strings,
|
9663 + | "Unexpected value for `map_of_lists_of_strings`"
|
9664 + | );
|
9665 + | ::pretty_assertions::assert_eq!(
|
9666 + | input.map_of_maps,
|
9667 + | expected.map_of_maps,
|
9668 + | "Unexpected value for `map_of_maps`"
|
9669 + | );
|
9670 + | ::pretty_assertions::assert_eq!(
|
9671 + | input.map_of_strings,
|
9672 + | expected.map_of_strings,
|
9673 + | "Unexpected value for `map_of_strings`"
|
9674 + | );
|
9675 + | ::pretty_assertions::assert_eq!(
|
9676 + | input.map_of_structs,
|
9677 + | expected.map_of_structs,
|
9678 + | "Unexpected value for `map_of_structs`"
|
9679 + | );
|
9680 + | ::pretty_assertions::assert_eq!(
|
9681 + | input.recursive_list,
|
9682 + | expected.recursive_list,
|
9683 + | "Unexpected value for `recursive_list`"
|
9684 + | );
|
9685 + | ::pretty_assertions::assert_eq!(
|
9686 + | input.recursive_map,
|
9687 + | expected.recursive_map,
|
9688 + | "Unexpected value for `recursive_map`"
|
9689 + | );
|
9690 + | ::pretty_assertions::assert_eq!(
|
9691 + | input.recursive_struct,
|
9692 + | expected.recursive_struct,
|
9693 + | "Unexpected value for `recursive_struct`"
|
9694 + | );
|
9695 + | ::pretty_assertions::assert_eq!(
|
9696 + | input.simple_struct,
|
9697 + | expected.simple_struct,
|
9698 + | "Unexpected value for `simple_struct`"
|
9699 + | );
|
9700 + | ::pretty_assertions::assert_eq!(
|
9701 + | input.string,
|
9702 + | expected.string,
|
9703 + | "Unexpected value for `string`"
|
9704 + | );
|
9705 + | ::pretty_assertions::assert_eq!(
|
9706 + | input.struct_with_json_name,
|
9707 + | expected.struct_with_json_name,
|
9708 + | "Unexpected value for `struct_with_json_name`"
|
9709 + | );
|
9710 + | ::pretty_assertions::assert_eq!(
|
9711 + | input.timestamp,
|
9712 + | expected.timestamp,
|
9713 + | "Unexpected value for `timestamp`"
|
9714 + | );
|
9715 + | ::pretty_assertions::assert_eq!(
|
9716 + | input.unix_timestamp,
|
9717 + | expected.unix_timestamp,
|
9718 + | "Unexpected value for `unix_timestamp`"
|
9719 + | );
|
9720 + | let response = crate::output::KitchenSinkOperationOutput {
|
9721 + | blob: ::std::option::Option::None,
|
9722 + | boolean: ::std::option::Option::None,
|
9723 + | double: ::std::option::Option::None,
|
9724 + | empty_struct: ::std::option::Option::None,
|
9725 + | float: ::std::option::Option::None,
|
9726 + | httpdate_timestamp: ::std::option::Option::None,
|
9727 + | integer: ::std::option::Option::None,
|
9728 + | iso8601_timestamp: ::std::option::Option::None,
|
9729 + | json_value: ::std::option::Option::None,
|
9730 + | list_of_lists: ::std::option::Option::None,
|
9731 + | list_of_maps_of_strings: ::std::option::Option::None,
|
9732 + | list_of_strings: ::std::option::Option::None,
|
9733 + | list_of_structs: ::std::option::Option::None,
|
9734 + | long: ::std::option::Option::None,
|
9735 + | map_of_lists_of_strings: ::std::option::Option::None,
|
9736 + | map_of_maps: ::std::option::Option::None,
|
9737 + | map_of_strings: ::std::option::Option::None,
|
9738 + | map_of_structs: ::std::option::Option::None,
|
9739 + | recursive_list: ::std::option::Option::None,
|
9740 + | recursive_map: ::std::option::Option::None,
|
9741 + | recursive_struct: ::std::option::Option::None,
|
9742 + | simple_struct: ::std::option::Option::None,
|
9743 + | string: ::std::option::Option::None,
|
9744 + | struct_with_json_name: ::std::option::Option::None,
|
9745 + | timestamp: ::std::option::Option::None,
|
9746 + | unix_timestamp: ::std::option::Option::None,
|
9747 + | };
|
9748 + | Ok(response)
|
9749 + | };
|
9750 + | sender.send(()).await.expect("receiver dropped early");
|
9751 + | result
|
9752 + | }
|
9753 + | })
|
9754 + | .build_unchecked();
|
9755 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9756 + | .await
|
9757 + | .expect("unable to make an HTTP request");
|
9758 + | assert!(
|
9759 + | receiver.recv().await.is_some(),
|
9760 + | "we expected operation handler to be invoked but it was not entered"
|
9761 + | );
|
10383 9762 | }
|
10384 - | }
|
10385 - |
|
10386 - | impl<B>
|
10387 - | ::aws_smithy_http_server::request::FromRequest<
|
10388 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10389 - | B,
|
10390 - | > for crate::input::HostWithPathOperationInput
|
10391 - | where
|
10392 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
10393 - | B: 'static,
|
10394 - |
|
10395 - | B::Data: Send,
|
10396 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
10397 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
10398 - | {
|
10399 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
10400 - | type Future = HostWithPathOperationInputFuture;
|
10401 - |
|
10402 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
10403 - | let fut = async move {
|
10404 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
10405 - | request.headers(),
|
10406 - | &CONTENT_TYPE_HOSTWITHPATHOPERATION,
|
10407 - | ) {
|
10408 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
10409 - | }
|
10410 - | crate::protocol_serde::shape_host_with_path_operation::de_host_with_path_operation_http_request(request)
|
10411 - | .await
|
10412 - | .map_err(Into::into)
|
10413 - | };
|
10414 - | use ::futures_util::future::TryFutureExt;
|
10415 - | let fut = fut.map_err(
|
10416 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
10417 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
10418 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
10419 - | },
|
9763 + | /// Serializes recursive structure shapes
|
9764 + | /// Test ID: serializes_recursive_structure_shapes
|
9765 + | #[::tokio::test]
|
9766 + | #[::tracing_test::traced_test]
|
9767 + | async fn serializes_recursive_structure_shapes_request() {
|
9768 + | #[allow(unused_mut)]
|
9769 + | let mut http_request = http::Request::builder()
|
9770 + | .uri("/")
|
9771 + | .method("POST")
|
9772 + | .header("Content-Type", "application/x-amz-json-1.1")
|
9773 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
9774 + | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{\"String\":\"top-value\",\"Boolean\":false,\"RecursiveStruct\":{\"String\":\"nested-value\",\"Boolean\":true,\"RecursiveList\":[{\"String\":\"string-only\"},{\"RecursiveStruct\":{\"MapOfStrings\":{\"color\":\"red\",\"size\":\"large\"}}}]}}".as_bytes()))).unwrap();
|
9775 + | #[allow(unused_mut)]
|
9776 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9777 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
9778 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9779 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
9780 + | let sender = sender.clone();
|
9781 + | async move {
|
9782 + | let result = {
|
9783 + | use ::aws_smithy_protocol_test::FloatEquals;
|
9784 + | let expected = crate::input::KitchenSinkOperationInput {
|
9785 + | string: ::std::option::Option::Some("top-value".to_owned()),
|
9786 + | boolean: ::std::option::Option::Some(false),
|
9787 + | recursive_struct: ::std::option::Option::Some(::std::boxed::Box::new(
|
9788 + | crate::model::KitchenSink {
|
9789 + | string: ::std::option::Option::Some("nested-value".to_owned()),
|
9790 + | boolean: ::std::option::Option::Some(true),
|
9791 + | recursive_list: ::std::option::Option::Some(vec![
|
9792 + | crate::model::KitchenSink {
|
9793 + | string: ::std::option::Option::Some(
|
9794 + | "string-only".to_owned(),
|
9795 + | ),
|
9796 + | blob: ::std::option::Option::None,
|
9797 + | boolean: ::std::option::Option::None,
|
9798 + | double: ::std::option::Option::None,
|
9799 + | empty_struct: ::std::option::Option::None,
|
9800 + | float: ::std::option::Option::None,
|
9801 + | httpdate_timestamp: ::std::option::Option::None,
|
9802 + | integer: ::std::option::Option::None,
|
9803 + | iso8601_timestamp: ::std::option::Option::None,
|
9804 + | json_value: ::std::option::Option::None,
|
9805 + | list_of_lists: ::std::option::Option::None,
|
9806 + | list_of_maps_of_strings: ::std::option::Option::None,
|
9807 + | list_of_strings: ::std::option::Option::None,
|
9808 + | list_of_structs: ::std::option::Option::None,
|
9809 + | long: ::std::option::Option::None,
|
9810 + | map_of_lists_of_strings: ::std::option::Option::None,
|
9811 + | map_of_maps: ::std::option::Option::None,
|
9812 + | map_of_strings: ::std::option::Option::None,
|
9813 + | map_of_structs: ::std::option::Option::None,
|
9814 + | recursive_list: ::std::option::Option::None,
|
9815 + | recursive_map: ::std::option::Option::None,
|
9816 + | recursive_struct: ::std::option::Option::None,
|
9817 + | simple_struct: ::std::option::Option::None,
|
9818 + | struct_with_json_name: ::std::option::Option::None,
|
9819 + | timestamp: ::std::option::Option::None,
|
9820 + | unix_timestamp: ::std::option::Option::None,
|
9821 + | },
|
9822 + | crate::model::KitchenSink {
|
9823 + | recursive_struct: ::std::option::Option::Some(
|
9824 + | ::std::boxed::Box::new(crate::model::KitchenSink {
|
9825 + | map_of_strings: ::std::option::Option::Some({
|
9826 + | let mut ret =
|
9827 + | ::std::collections::HashMap::new();
|
9828 + | ret.insert(
|
9829 + | "color".to_owned(),
|
9830 + | "red".to_owned(),
|
9831 + | );
|
9832 + | ret.insert(
|
9833 + | "size".to_owned(),
|
9834 + | "large".to_owned(),
|
9835 + | );
|
9836 + | ret
|
9837 + | }),
|
9838 + | blob: ::std::option::Option::None,
|
9839 + | boolean: ::std::option::Option::None,
|
9840 + | double: ::std::option::Option::None,
|
9841 + | empty_struct: ::std::option::Option::None,
|
9842 + | float: ::std::option::Option::None,
|
9843 + | httpdate_timestamp: ::std::option::Option::None,
|
9844 + | integer: ::std::option::Option::None,
|
9845 + | iso8601_timestamp: ::std::option::Option::None,
|
9846 + | json_value: ::std::option::Option::None,
|
9847 + | list_of_lists: ::std::option::Option::None,
|
9848 + | list_of_maps_of_strings:
|
9849 + | ::std::option::Option::None,
|
9850 + | list_of_strings: ::std::option::Option::None,
|
9851 + | list_of_structs: ::std::option::Option::None,
|
9852 + | long: ::std::option::Option::None,
|
9853 + | map_of_lists_of_strings:
|
9854 + | ::std::option::Option::None,
|
9855 + | map_of_maps: ::std::option::Option::None,
|
9856 + | map_of_structs: ::std::option::Option::None,
|
9857 + | recursive_list: ::std::option::Option::None,
|
9858 + | recursive_map: ::std::option::Option::None,
|
9859 + | recursive_struct: ::std::option::Option::None,
|
9860 + | simple_struct: ::std::option::Option::None,
|
9861 + | string: ::std::option::Option::None,
|
9862 + | struct_with_json_name:
|
9863 + | ::std::option::Option::None,
|
9864 + | timestamp: ::std::option::Option::None,
|
9865 + | unix_timestamp: ::std::option::Option::None,
|
9866 + | }),
|
9867 + | ),
|
9868 + | blob: ::std::option::Option::None,
|
9869 + | boolean: ::std::option::Option::None,
|
9870 + | double: ::std::option::Option::None,
|
9871 + | empty_struct: ::std::option::Option::None,
|
9872 + | float: ::std::option::Option::None,
|
9873 + | httpdate_timestamp: ::std::option::Option::None,
|
9874 + | integer: ::std::option::Option::None,
|
9875 + | iso8601_timestamp: ::std::option::Option::None,
|
9876 + | json_value: ::std::option::Option::None,
|
9877 + | list_of_lists: ::std::option::Option::None,
|
9878 + | list_of_maps_of_strings: ::std::option::Option::None,
|
9879 + | list_of_strings: ::std::option::Option::None,
|
9880 + | list_of_structs: ::std::option::Option::None,
|
9881 + | long: ::std::option::Option::None,
|
9882 + | map_of_lists_of_strings: ::std::option::Option::None,
|
9883 + | map_of_maps: ::std::option::Option::None,
|
9884 + | map_of_strings: ::std::option::Option::None,
|
9885 + | map_of_structs: ::std::option::Option::None,
|
9886 + | recursive_list: ::std::option::Option::None,
|
9887 + | recursive_map: ::std::option::Option::None,
|
9888 + | simple_struct: ::std::option::Option::None,
|
9889 + | string: ::std::option::Option::None,
|
9890 + | struct_with_json_name: ::std::option::Option::None,
|
9891 + | timestamp: ::std::option::Option::None,
|
9892 + | unix_timestamp: ::std::option::Option::None,
|
9893 + | },
|
9894 + | ]),
|
9895 + | blob: ::std::option::Option::None,
|
9896 + | double: ::std::option::Option::None,
|
9897 + | empty_struct: ::std::option::Option::None,
|
9898 + | float: ::std::option::Option::None,
|
9899 + | httpdate_timestamp: ::std::option::Option::None,
|
9900 + | integer: ::std::option::Option::None,
|
9901 + | iso8601_timestamp: ::std::option::Option::None,
|
9902 + | json_value: ::std::option::Option::None,
|
9903 + | list_of_lists: ::std::option::Option::None,
|
9904 + | list_of_maps_of_strings: ::std::option::Option::None,
|
9905 + | list_of_strings: ::std::option::Option::None,
|
9906 + | list_of_structs: ::std::option::Option::None,
|
9907 + | long: ::std::option::Option::None,
|
9908 + | map_of_lists_of_strings: ::std::option::Option::None,
|
9909 + | map_of_maps: ::std::option::Option::None,
|
9910 + | map_of_strings: ::std::option::Option::None,
|
9911 + | map_of_structs: ::std::option::Option::None,
|
9912 + | recursive_map: ::std::option::Option::None,
|
9913 + | recursive_struct: ::std::option::Option::None,
|
9914 + | simple_struct: ::std::option::Option::None,
|
9915 + | struct_with_json_name: ::std::option::Option::None,
|
9916 + | timestamp: ::std::option::Option::None,
|
9917 + | unix_timestamp: ::std::option::Option::None,
|
9918 + | },
|
9919 + | )),
|
9920 + | blob: ::std::option::Option::None,
|
9921 + | double: ::std::option::Option::None,
|
9922 + | empty_struct: ::std::option::Option::None,
|
9923 + | float: ::std::option::Option::None,
|
9924 + | httpdate_timestamp: ::std::option::Option::None,
|
9925 + | integer: ::std::option::Option::None,
|
9926 + | iso8601_timestamp: ::std::option::Option::None,
|
9927 + | json_value: ::std::option::Option::None,
|
9928 + | list_of_lists: ::std::option::Option::None,
|
9929 + | list_of_maps_of_strings: ::std::option::Option::None,
|
9930 + | list_of_strings: ::std::option::Option::None,
|
9931 + | list_of_structs: ::std::option::Option::None,
|
9932 + | long: ::std::option::Option::None,
|
9933 + | map_of_lists_of_strings: ::std::option::Option::None,
|
9934 + | map_of_maps: ::std::option::Option::None,
|
9935 + | map_of_strings: ::std::option::Option::None,
|
9936 + | map_of_structs: ::std::option::Option::None,
|
9937 + | recursive_list: ::std::option::Option::None,
|
9938 + | recursive_map: ::std::option::Option::None,
|
9939 + | simple_struct: ::std::option::Option::None,
|
9940 + | struct_with_json_name: ::std::option::Option::None,
|
9941 + | timestamp: ::std::option::Option::None,
|
9942 + | unix_timestamp: ::std::option::Option::None,
|
9943 + | };
|
9944 + | ::pretty_assertions::assert_eq!(
|
9945 + | input.blob,
|
9946 + | expected.blob,
|
9947 + | "Unexpected value for `blob`"
|
9948 + | );
|
9949 + | ::pretty_assertions::assert_eq!(
|
9950 + | input.boolean,
|
9951 + | expected.boolean,
|
9952 + | "Unexpected value for `boolean`"
|
9953 + | );
|
9954 + | assert!(
|
9955 + | input.double.float_equals(&expected.double),
|
9956 + | "Unexpected value for `double` {:?} vs. {:?}",
|
9957 + | expected.double,
|
9958 + | input.double
|
9959 + | );
|
9960 + | ::pretty_assertions::assert_eq!(
|
9961 + | input.empty_struct,
|
9962 + | expected.empty_struct,
|
9963 + | "Unexpected value for `empty_struct`"
|
9964 + | );
|
9965 + | assert!(
|
9966 + | input.float.float_equals(&expected.float),
|
9967 + | "Unexpected value for `float` {:?} vs. {:?}",
|
9968 + | expected.float,
|
9969 + | input.float
|
9970 + | );
|
9971 + | ::pretty_assertions::assert_eq!(
|
9972 + | input.httpdate_timestamp,
|
9973 + | expected.httpdate_timestamp,
|
9974 + | "Unexpected value for `httpdate_timestamp`"
|
9975 + | );
|
9976 + | ::pretty_assertions::assert_eq!(
|
9977 + | input.integer,
|
9978 + | expected.integer,
|
9979 + | "Unexpected value for `integer`"
|
9980 + | );
|
9981 + | ::pretty_assertions::assert_eq!(
|
9982 + | input.iso8601_timestamp,
|
9983 + | expected.iso8601_timestamp,
|
9984 + | "Unexpected value for `iso8601_timestamp`"
|
9985 + | );
|
9986 + | ::pretty_assertions::assert_eq!(
|
9987 + | input.json_value,
|
9988 + | expected.json_value,
|
9989 + | "Unexpected value for `json_value`"
|
9990 + | );
|
9991 + | ::pretty_assertions::assert_eq!(
|
9992 + | input.list_of_lists,
|
9993 + | expected.list_of_lists,
|
9994 + | "Unexpected value for `list_of_lists`"
|
9995 + | );
|
9996 + | ::pretty_assertions::assert_eq!(
|
9997 + | input.list_of_maps_of_strings,
|
9998 + | expected.list_of_maps_of_strings,
|
9999 + | "Unexpected value for `list_of_maps_of_strings`"
|
10000 + | );
|
10001 + | ::pretty_assertions::assert_eq!(
|
10002 + | input.list_of_strings,
|
10003 + | expected.list_of_strings,
|
10004 + | "Unexpected value for `list_of_strings`"
|
10005 + | );
|
10006 + | ::pretty_assertions::assert_eq!(
|
10007 + | input.list_of_structs,
|
10008 + | expected.list_of_structs,
|
10009 + | "Unexpected value for `list_of_structs`"
|
10010 + | );
|
10011 + | ::pretty_assertions::assert_eq!(
|
10012 + | input.long,
|
10013 + | expected.long,
|
10014 + | "Unexpected value for `long`"
|
10015 + | );
|
10016 + | ::pretty_assertions::assert_eq!(
|
10017 + | input.map_of_lists_of_strings,
|
10018 + | expected.map_of_lists_of_strings,
|
10019 + | "Unexpected value for `map_of_lists_of_strings`"
|
10020 + | );
|
10021 + | ::pretty_assertions::assert_eq!(
|
10022 + | input.map_of_maps,
|
10023 + | expected.map_of_maps,
|
10024 + | "Unexpected value for `map_of_maps`"
|
10025 + | );
|
10026 + | ::pretty_assertions::assert_eq!(
|
10027 + | input.map_of_strings,
|
10028 + | expected.map_of_strings,
|
10029 + | "Unexpected value for `map_of_strings`"
|
10030 + | );
|
10031 + | ::pretty_assertions::assert_eq!(
|
10032 + | input.map_of_structs,
|
10033 + | expected.map_of_structs,
|
10034 + | "Unexpected value for `map_of_structs`"
|
10035 + | );
|
10036 + | ::pretty_assertions::assert_eq!(
|
10037 + | input.recursive_list,
|
10038 + | expected.recursive_list,
|
10039 + | "Unexpected value for `recursive_list`"
|
10040 + | );
|
10041 + | ::pretty_assertions::assert_eq!(
|
10042 + | input.recursive_map,
|
10043 + | expected.recursive_map,
|
10044 + | "Unexpected value for `recursive_map`"
|
10045 + | );
|
10046 + | ::pretty_assertions::assert_eq!(
|
10047 + | input.recursive_struct,
|
10048 + | expected.recursive_struct,
|
10049 + | "Unexpected value for `recursive_struct`"
|
10050 + | );
|
10051 + | ::pretty_assertions::assert_eq!(
|
10052 + | input.simple_struct,
|
10053 + | expected.simple_struct,
|
10054 + | "Unexpected value for `simple_struct`"
|
10055 + | );
|
10056 + | ::pretty_assertions::assert_eq!(
|
10057 + | input.string,
|
10058 + | expected.string,
|
10059 + | "Unexpected value for `string`"
|
10060 + | );
|
10061 + | ::pretty_assertions::assert_eq!(
|
10062 + | input.struct_with_json_name,
|
10063 + | expected.struct_with_json_name,
|
10064 + | "Unexpected value for `struct_with_json_name`"
|
10065 + | );
|
10066 + | ::pretty_assertions::assert_eq!(
|
10067 + | input.timestamp,
|
10068 + | expected.timestamp,
|
10069 + | "Unexpected value for `timestamp`"
|
10070 + | );
|
10071 + | ::pretty_assertions::assert_eq!(
|
10072 + | input.unix_timestamp,
|
10073 + | expected.unix_timestamp,
|
10074 + | "Unexpected value for `unix_timestamp`"
|
10075 + | );
|
10076 + | let response = crate::output::KitchenSinkOperationOutput {
|
10077 + | blob: ::std::option::Option::None,
|
10078 + | boolean: ::std::option::Option::None,
|
10079 + | double: ::std::option::Option::None,
|
10080 + | empty_struct: ::std::option::Option::None,
|
10081 + | float: ::std::option::Option::None,
|
10082 + | httpdate_timestamp: ::std::option::Option::None,
|
10083 + | integer: ::std::option::Option::None,
|
10084 + | iso8601_timestamp: ::std::option::Option::None,
|
10085 + | json_value: ::std::option::Option::None,
|
10086 + | list_of_lists: ::std::option::Option::None,
|
10087 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10088 + | list_of_strings: ::std::option::Option::None,
|
10089 + | list_of_structs: ::std::option::Option::None,
|
10090 + | long: ::std::option::Option::None,
|
10091 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10092 + | map_of_maps: ::std::option::Option::None,
|
10093 + | map_of_strings: ::std::option::Option::None,
|
10094 + | map_of_structs: ::std::option::Option::None,
|
10095 + | recursive_list: ::std::option::Option::None,
|
10096 + | recursive_map: ::std::option::Option::None,
|
10097 + | recursive_struct: ::std::option::Option::None,
|
10098 + | simple_struct: ::std::option::Option::None,
|
10099 + | string: ::std::option::Option::None,
|
10100 + | struct_with_json_name: ::std::option::Option::None,
|
10101 + | timestamp: ::std::option::Option::None,
|
10102 + | unix_timestamp: ::std::option::Option::None,
|
10103 + | };
|
10104 + | Ok(response)
|
10105 + | };
|
10106 + | sender.send(()).await.expect("receiver dropped early");
|
10107 + | result
|
10108 + | }
|
10109 + | })
|
10110 + | .build_unchecked();
|
10111 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10112 + | .await
|
10113 + | .expect("unable to make an HTTP request");
|
10114 + | assert!(
|
10115 + | receiver.recv().await.is_some(),
|
10116 + | "we expected operation handler to be invoked but it was not entered"
|
10420 10117 | );
|
10421 - | HostWithPathOperationInputFuture {
|
10422 - | inner: Box::pin(fut),
|
10423 - | }
|
10424 - | }
|
10425 - | }
|
10426 - | impl
|
10427 - | ::aws_smithy_http_server::response::IntoResponse<
|
10428 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10429 - | > for crate::output::HostWithPathOperationOutput
|
10430 - | {
|
10431 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
10432 - | match crate::protocol_serde::shape_host_with_path_operation::ser_host_with_path_operation_http_response(self) {
|
10433 - | Ok(response) => response,
|
10434 - | Err(e) => {
|
10435 - | ::tracing::error!(error = %e, "failed to serialize response");
|
10436 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
10437 - | }
|
10438 - | }
|
10439 - | }
|
10440 - | }
|
10441 - |
|
10442 - | static CONTENT_TYPE_ENDPOINTWITHHOSTLABELOPERATION: ::once_cell::sync::Lazy<::mime::Mime> =
|
10443 - | ::once_cell::sync::Lazy::new(|| {
|
10444 - | "application/x-amz-json-1.1"
|
10445 - | .parse::<::mime::Mime>()
|
10446 - | .expect("BUG: MIME parsing failed, content_type is not valid")
|
10447 - | });
|
10448 - | ::pin_project_lite::pin_project! {
|
10449 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
10450 - | /// [`EndpointWithHostLabelOperationInput`](crate::input::EndpointWithHostLabelOperationInput) using modelled bindings.
|
10451 - | pub struct EndpointWithHostLabelOperationInputFuture {
|
10452 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EndpointWithHostLabelOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
10453 - | }
|
10454 - | }
|
10455 - |
|
10456 - | impl std::future::Future for EndpointWithHostLabelOperationInputFuture {
|
10457 - | type Output = Result<
|
10458 - | crate::input::EndpointWithHostLabelOperationInput,
|
10459 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
10460 - | >;
|
10461 - |
|
10462 - | fn poll(
|
10463 - | self: std::pin::Pin<&mut Self>,
|
10464 - | cx: &mut std::task::Context<'_>,
|
10465 - | ) -> std::task::Poll<Self::Output> {
|
10466 - | let this = self.project();
|
10467 - | this.inner.as_mut().poll(cx)
|
10468 10118 | }
|
10469 - | }
|
10470 - |
|
10471 - | impl<B>
|
10472 - | ::aws_smithy_http_server::request::FromRequest<
|
10473 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10474 - | B,
|
10475 - | > for crate::input::EndpointWithHostLabelOperationInput
|
10476 - | where
|
10477 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
10478 - | B: 'static,
|
10479 - |
|
10480 - | B::Data: Send,
|
10481 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
10482 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
10483 - | {
|
10484 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
10485 - | type Future = EndpointWithHostLabelOperationInputFuture;
|
10486 - |
|
10487 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
10488 - | let fut = async move {
|
10489 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
10490 - | request.headers(),
|
10491 - | &CONTENT_TYPE_ENDPOINTWITHHOSTLABELOPERATION,
|
10492 - | ) {
|
10493 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
10494 - | }
|
10495 - | crate::protocol_serde::shape_endpoint_with_host_label_operation::de_endpoint_with_host_label_operation_http_request(request)
|
10496 - | .await
|
10497 - | .map_err(Into::into)
|
10119 + | /// Parses operations with empty JSON bodies
|
10120 + | /// Test ID: parses_operations_with_empty_json_bodies
|
10121 + | #[::tokio::test]
|
10122 + | #[::tracing_test::traced_test]
|
10123 + | async fn parses_operations_with_empty_json_bodies_response() {
|
10124 + | let output = crate::output::KitchenSinkOperationOutput {
|
10125 + | blob: ::std::option::Option::None,
|
10126 + | boolean: ::std::option::Option::None,
|
10127 + | double: ::std::option::Option::None,
|
10128 + | empty_struct: ::std::option::Option::None,
|
10129 + | float: ::std::option::Option::None,
|
10130 + | httpdate_timestamp: ::std::option::Option::None,
|
10131 + | integer: ::std::option::Option::None,
|
10132 + | iso8601_timestamp: ::std::option::Option::None,
|
10133 + | json_value: ::std::option::Option::None,
|
10134 + | list_of_lists: ::std::option::Option::None,
|
10135 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10136 + | list_of_strings: ::std::option::Option::None,
|
10137 + | list_of_structs: ::std::option::Option::None,
|
10138 + | long: ::std::option::Option::None,
|
10139 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10140 + | map_of_maps: ::std::option::Option::None,
|
10141 + | map_of_strings: ::std::option::Option::None,
|
10142 + | map_of_structs: ::std::option::Option::None,
|
10143 + | recursive_list: ::std::option::Option::None,
|
10144 + | recursive_map: ::std::option::Option::None,
|
10145 + | recursive_struct: ::std::option::Option::None,
|
10146 + | simple_struct: ::std::option::Option::None,
|
10147 + | string: ::std::option::Option::None,
|
10148 + | struct_with_json_name: ::std::option::Option::None,
|
10149 + | timestamp: ::std::option::Option::None,
|
10150 + | unix_timestamp: ::std::option::Option::None,
|
10498 10151 | };
|
10499 - | use ::futures_util::future::TryFutureExt;
|
10500 - | let fut = fut.map_err(
|
10501 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
10502 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
10503 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
10504 - | },
|
10152 + | use ::aws_smithy_http_server::response::IntoResponse;
|
10153 + | let http_response = output.into_response();
|
10154 + | ::pretty_assertions::assert_eq!(
|
10155 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10156 + | http_response.status()
|
10505 10157 | );
|
10506 - | EndpointWithHostLabelOperationInputFuture {
|
10507 - | inner: Box::pin(fut),
|
10508 - | }
|
10509 - | }
|
10510 - | }
|
10511 - | impl
|
10512 - | ::aws_smithy_http_server::response::IntoResponse<
|
10513 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10514 - | > for crate::output::EndpointWithHostLabelOperationOutput
|
10515 - | {
|
10516 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
10517 - | match crate::protocol_serde::shape_endpoint_with_host_label_operation::ser_endpoint_with_host_label_operation_http_response(self) {
|
10518 - | Ok(response) => response,
|
10519 - | Err(e) => {
|
10520 - | ::tracing::error!(error = %e, "failed to serialize response");
|
10521 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
10522 - | }
|
10523 - | }
|
10524 - | }
|
10525 - | }
|
10526 - | impl
|
10527 - | ::aws_smithy_http_server::response::IntoResponse<
|
10528 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10529 - | > for crate::error::EndpointWithHostLabelOperationError
|
10530 - | {
|
10531 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
10532 - | match crate::protocol_serde::shape_endpoint_with_host_label_operation::ser_endpoint_with_host_label_operation_http_error(&self) {
|
10533 - | Ok(mut response) => {
|
10534 - | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
10535 - | response
|
10536 - | },
|
10537 - | Err(e) => {
|
10538 - | ::tracing::error!(error = %e, "failed to serialize response");
|
10539 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
10540 - | }
|
10541 - | }
|
10542 - | }
|
10543 - | }
|
10544 - |
|
10545 - | static CONTENT_TYPE_ENDPOINTOPERATION: ::once_cell::sync::Lazy<::mime::Mime> =
|
10546 - | ::once_cell::sync::Lazy::new(|| {
|
10547 - | "application/x-amz-json-1.1"
|
10548 - | .parse::<::mime::Mime>()
|
10549 - | .expect("BUG: MIME parsing failed, content_type is not valid")
|
10550 - | });
|
10551 - | ::pin_project_lite::pin_project! {
|
10552 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
10553 - | /// [`EndpointOperationInput`](crate::input::EndpointOperationInput) using modelled bindings.
|
10554 - | pub struct EndpointOperationInputFuture {
|
10555 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EndpointOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
10158 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10159 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10160 + | http_response.headers(),
|
10161 + | expected_headers,
|
10162 + | ));
|
10163 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10164 + | .await
|
10165 + | .expect("unable to extract body to bytes");
|
10166 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10167 + | &body,
|
10168 + | "{}",
|
10169 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10170 + | ));
|
10556 10171 | }
|
10557 - | }
|
10558 - |
|
10559 - | impl std::future::Future for EndpointOperationInputFuture {
|
10560 - | type Output = Result<
|
10561 - | crate::input::EndpointOperationInput,
|
10562 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
10563 - | >;
|
10564 - |
|
10565 - | fn poll(
|
10566 - | self: std::pin::Pin<&mut Self>,
|
10567 - | cx: &mut std::task::Context<'_>,
|
10568 - | ) -> std::task::Poll<Self::Output> {
|
10569 - | let this = self.project();
|
10570 - | this.inner.as_mut().poll(cx)
|
10172 + | /// Parses string shapes
|
10173 + | /// Test ID: parses_string_shapes
|
10174 + | #[::tokio::test]
|
10175 + | #[::tracing_test::traced_test]
|
10176 + | async fn parses_string_shapes_response() {
|
10177 + | let output = crate::output::KitchenSinkOperationOutput {
|
10178 + | string: ::std::option::Option::Some("string-value".to_owned()),
|
10179 + | blob: ::std::option::Option::None,
|
10180 + | boolean: ::std::option::Option::None,
|
10181 + | double: ::std::option::Option::None,
|
10182 + | empty_struct: ::std::option::Option::None,
|
10183 + | float: ::std::option::Option::None,
|
10184 + | httpdate_timestamp: ::std::option::Option::None,
|
10185 + | integer: ::std::option::Option::None,
|
10186 + | iso8601_timestamp: ::std::option::Option::None,
|
10187 + | json_value: ::std::option::Option::None,
|
10188 + | list_of_lists: ::std::option::Option::None,
|
10189 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10190 + | list_of_strings: ::std::option::Option::None,
|
10191 + | list_of_structs: ::std::option::Option::None,
|
10192 + | long: ::std::option::Option::None,
|
10193 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10194 + | map_of_maps: ::std::option::Option::None,
|
10195 + | map_of_strings: ::std::option::Option::None,
|
10196 + | map_of_structs: ::std::option::Option::None,
|
10197 + | recursive_list: ::std::option::Option::None,
|
10198 + | recursive_map: ::std::option::Option::None,
|
10199 + | recursive_struct: ::std::option::Option::None,
|
10200 + | simple_struct: ::std::option::Option::None,
|
10201 + | struct_with_json_name: ::std::option::Option::None,
|
10202 + | timestamp: ::std::option::Option::None,
|
10203 + | unix_timestamp: ::std::option::Option::None,
|
10204 + | };
|
10205 + | use ::aws_smithy_http_server::response::IntoResponse;
|
10206 + | let http_response = output.into_response();
|
10207 + | ::pretty_assertions::assert_eq!(
|
10208 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10209 + | http_response.status()
|
10210 + | );
|
10211 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10212 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10213 + | http_response.headers(),
|
10214 + | expected_headers,
|
10215 + | ));
|
10216 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10217 + | .await
|
10218 + | .expect("unable to extract body to bytes");
|
10219 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10220 + | &body,
|
10221 + | "{\"String\":\"string-value\"}",
|
10222 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10223 + | ));
|
10571 10224 | }
|
10572 - | }
|
10573 - |
|
10574 - | impl<B>
|
10575 - | ::aws_smithy_http_server::request::FromRequest<
|
10576 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10577 - | B,
|
10578 - | > for crate::input::EndpointOperationInput
|
10579 - | where
|
10580 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
10581 - | B: 'static,
|
10582 - |
|
10583 - | B::Data: Send,
|
10584 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
10585 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
10586 - | {
|
10587 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
10588 - | type Future = EndpointOperationInputFuture;
|
10589 - |
|
10590 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
10591 - | let fut = async move {
|
10592 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
10593 - | request.headers(),
|
10594 - | &CONTENT_TYPE_ENDPOINTOPERATION,
|
10595 - | ) {
|
10596 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
10597 - | }
|
10598 - | crate::protocol_serde::shape_endpoint_operation::de_endpoint_operation_http_request(
|
10599 - | request,
|
10600 - | )
|
10225 + | /// Parses integer shapes
|
10226 + | /// Test ID: parses_integer_shapes
|
10227 + | #[::tokio::test]
|
10228 + | #[::tracing_test::traced_test]
|
10229 + | async fn parses_integer_shapes_response() {
|
10230 + | let output = crate::output::KitchenSinkOperationOutput {
|
10231 + | integer: ::std::option::Option::Some(1234),
|
10232 + | blob: ::std::option::Option::None,
|
10233 + | boolean: ::std::option::Option::None,
|
10234 + | double: ::std::option::Option::None,
|
10235 + | empty_struct: ::std::option::Option::None,
|
10236 + | float: ::std::option::Option::None,
|
10237 + | httpdate_timestamp: ::std::option::Option::None,
|
10238 + | iso8601_timestamp: ::std::option::Option::None,
|
10239 + | json_value: ::std::option::Option::None,
|
10240 + | list_of_lists: ::std::option::Option::None,
|
10241 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10242 + | list_of_strings: ::std::option::Option::None,
|
10243 + | list_of_structs: ::std::option::Option::None,
|
10244 + | long: ::std::option::Option::None,
|
10245 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10246 + | map_of_maps: ::std::option::Option::None,
|
10247 + | map_of_strings: ::std::option::Option::None,
|
10248 + | map_of_structs: ::std::option::Option::None,
|
10249 + | recursive_list: ::std::option::Option::None,
|
10250 + | recursive_map: ::std::option::Option::None,
|
10251 + | recursive_struct: ::std::option::Option::None,
|
10252 + | simple_struct: ::std::option::Option::None,
|
10253 + | string: ::std::option::Option::None,
|
10254 + | struct_with_json_name: ::std::option::Option::None,
|
10255 + | timestamp: ::std::option::Option::None,
|
10256 + | unix_timestamp: ::std::option::Option::None,
|
10257 + | };
|
10258 + | use ::aws_smithy_http_server::response::IntoResponse;
|
10259 + | let http_response = output.into_response();
|
10260 + | ::pretty_assertions::assert_eq!(
|
10261 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10262 + | http_response.status()
|
10263 + | );
|
10264 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10265 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10266 + | http_response.headers(),
|
10267 + | expected_headers,
|
10268 + | ));
|
10269 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10601 10270 | .await
|
10602 - | .map_err(Into::into)
|
10271 + | .expect("unable to extract body to bytes");
|
10272 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10273 + | &body,
|
10274 + | "{\"Integer\":1234}",
|
10275 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10276 + | ));
|
10277 + | }
|
10278 + | /// Parses long shapes
|
10279 + | /// Test ID: parses_long_shapes
|
10280 + | #[::tokio::test]
|
10281 + | #[::tracing_test::traced_test]
|
10282 + | async fn parses_long_shapes_response() {
|
10283 + | let output = crate::output::KitchenSinkOperationOutput {
|
10284 + | long: ::std::option::Option::Some(1234567890123456789),
|
10285 + | blob: ::std::option::Option::None,
|
10286 + | boolean: ::std::option::Option::None,
|
10287 + | double: ::std::option::Option::None,
|
10288 + | empty_struct: ::std::option::Option::None,
|
10289 + | float: ::std::option::Option::None,
|
10290 + | httpdate_timestamp: ::std::option::Option::None,
|
10291 + | integer: ::std::option::Option::None,
|
10292 + | iso8601_timestamp: ::std::option::Option::None,
|
10293 + | json_value: ::std::option::Option::None,
|
10294 + | list_of_lists: ::std::option::Option::None,
|
10295 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10296 + | list_of_strings: ::std::option::Option::None,
|
10297 + | list_of_structs: ::std::option::Option::None,
|
10298 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10299 + | map_of_maps: ::std::option::Option::None,
|
10300 + | map_of_strings: ::std::option::Option::None,
|
10301 + | map_of_structs: ::std::option::Option::None,
|
10302 + | recursive_list: ::std::option::Option::None,
|
10303 + | recursive_map: ::std::option::Option::None,
|
10304 + | recursive_struct: ::std::option::Option::None,
|
10305 + | simple_struct: ::std::option::Option::None,
|
10306 + | string: ::std::option::Option::None,
|
10307 + | struct_with_json_name: ::std::option::Option::None,
|
10308 + | timestamp: ::std::option::Option::None,
|
10309 + | unix_timestamp: ::std::option::Option::None,
|
10603 10310 | };
|
10604 - | use ::futures_util::future::TryFutureExt;
|
10605 - | let fut = fut.map_err(
|
10606 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
10607 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
10608 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
10609 - | },
|
10311 + | use ::aws_smithy_http_server::response::IntoResponse;
|
10312 + | let http_response = output.into_response();
|
10313 + | ::pretty_assertions::assert_eq!(
|
10314 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10315 + | http_response.status()
|
10610 10316 | );
|
10611 - | EndpointOperationInputFuture {
|
10612 - | inner: Box::pin(fut),
|
10613 - | }
|
10614 - | }
|
10615 - | }
|
10616 - | impl
|
10617 - | ::aws_smithy_http_server::response::IntoResponse<
|
10618 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10619 - | > for crate::output::EndpointOperationOutput
|
10620 - | {
|
10621 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
10622 - | match crate::protocol_serde::shape_endpoint_operation::ser_endpoint_operation_http_response(
|
10623 - | self,
|
10624 - | ) {
|
10625 - | Ok(response) => response,
|
10626 - | Err(e) => {
|
10627 - | ::tracing::error!(error = %e, "failed to serialize response");
|
10628 - | ::aws_smithy_http_server::response::IntoResponse::<
|
10629 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10630 - | >::into_response(
|
10631 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
10632 - | e,
|
10633 - | ),
|
10634 - | )
|
10635 - | }
|
10636 - | }
|
10637 - | }
|
10638 - | }
|
10639 - |
|
10640 - | static CONTENT_TYPE_JSONUNIONS: ::once_cell::sync::Lazy<::mime::Mime> =
|
10641 - | ::once_cell::sync::Lazy::new(|| {
|
10642 - | "application/x-amz-json-1.1"
|
10643 - | .parse::<::mime::Mime>()
|
10644 - | .expect("BUG: MIME parsing failed, content_type is not valid")
|
10645 - | });
|
10646 - | ::pin_project_lite::pin_project! {
|
10647 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
10648 - | /// [`JsonUnionsInput`](crate::input::JsonUnionsInput) using modelled bindings.
|
10649 - | pub struct JsonUnionsInputFuture {
|
10650 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::JsonUnionsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
10651 - | }
|
10652 - | }
|
10653 - |
|
10654 - | impl std::future::Future for JsonUnionsInputFuture {
|
10655 - | type Output = Result<
|
10656 - | crate::input::JsonUnionsInput,
|
10657 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
10658 - | >;
|
10659 - |
|
10660 - | fn poll(
|
10661 - | self: std::pin::Pin<&mut Self>,
|
10662 - | cx: &mut std::task::Context<'_>,
|
10663 - | ) -> std::task::Poll<Self::Output> {
|
10664 - | let this = self.project();
|
10665 - | this.inner.as_mut().poll(cx)
|
10317 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10318 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10319 + | http_response.headers(),
|
10320 + | expected_headers,
|
10321 + | ));
|
10322 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10323 + | .await
|
10324 + | .expect("unable to extract body to bytes");
|
10325 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10326 + | &body,
|
10327 + | "{\"Long\":1234567890123456789}",
|
10328 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10329 + | ));
|
10666 10330 | }
|
10667 - | }
|
10668 - |
|
10669 - | impl<B>
|
10670 - | ::aws_smithy_http_server::request::FromRequest<
|
10671 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10672 - | B,
|
10673 - | > for crate::input::JsonUnionsInput
|
10674 - | where
|
10675 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
10676 - | B: 'static,
|
10677 - |
|
10678 - | B::Data: Send,
|
10679 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
10680 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
10681 - | {
|
10682 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
10683 - | type Future = JsonUnionsInputFuture;
|
10684 - |
|
10685 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
10686 - | let fut = async move {
|
10687 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
10688 - | request.headers(),
|
10689 - | &CONTENT_TYPE_JSONUNIONS,
|
10690 - | ) {
|
10691 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
10692 - | }
|
10693 - | crate::protocol_serde::shape_json_unions::de_json_unions_http_request(request)
|
10694 - | .await
|
10695 - | .map_err(Into::into)
|
10331 + | /// Parses float shapes
|
10332 + | /// Test ID: parses_float_shapes
|
10333 + | #[::tokio::test]
|
10334 + | #[::tracing_test::traced_test]
|
10335 + | async fn parses_float_shapes_response() {
|
10336 + | let output = crate::output::KitchenSinkOperationOutput {
|
10337 + | float: ::std::option::Option::Some(1234.5_f32),
|
10338 + | blob: ::std::option::Option::None,
|
10339 + | boolean: ::std::option::Option::None,
|
10340 + | double: ::std::option::Option::None,
|
10341 + | empty_struct: ::std::option::Option::None,
|
10342 + | httpdate_timestamp: ::std::option::Option::None,
|
10343 + | integer: ::std::option::Option::None,
|
10344 + | iso8601_timestamp: ::std::option::Option::None,
|
10345 + | json_value: ::std::option::Option::None,
|
10346 + | list_of_lists: ::std::option::Option::None,
|
10347 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10348 + | list_of_strings: ::std::option::Option::None,
|
10349 + | list_of_structs: ::std::option::Option::None,
|
10350 + | long: ::std::option::Option::None,
|
10351 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10352 + | map_of_maps: ::std::option::Option::None,
|
10353 + | map_of_strings: ::std::option::Option::None,
|
10354 + | map_of_structs: ::std::option::Option::None,
|
10355 + | recursive_list: ::std::option::Option::None,
|
10356 + | recursive_map: ::std::option::Option::None,
|
10357 + | recursive_struct: ::std::option::Option::None,
|
10358 + | simple_struct: ::std::option::Option::None,
|
10359 + | string: ::std::option::Option::None,
|
10360 + | struct_with_json_name: ::std::option::Option::None,
|
10361 + | timestamp: ::std::option::Option::None,
|
10362 + | unix_timestamp: ::std::option::Option::None,
|
10696 10363 | };
|
10697 - | use ::futures_util::future::TryFutureExt;
|
10698 - | let fut = fut.map_err(
|
10699 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
10700 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
10701 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
10702 - | },
|
10364 + | use ::aws_smithy_http_server::response::IntoResponse;
|
10365 + | let http_response = output.into_response();
|
10366 + | ::pretty_assertions::assert_eq!(
|
10367 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10368 + | http_response.status()
|
10703 10369 | );
|
10704 - | JsonUnionsInputFuture {
|
10705 - | inner: Box::pin(fut),
|
10706 - | }
|
10707 - | }
|
10708 - | }
|
10709 - | impl
|
10710 - | ::aws_smithy_http_server::response::IntoResponse<
|
10711 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10712 - | > for crate::output::JsonUnionsOutput
|
10713 - | {
|
10714 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
10715 - | match crate::protocol_serde::shape_json_unions::ser_json_unions_http_response(self) {
|
10716 - | Ok(response) => response,
|
10717 - | Err(e) => {
|
10718 - | ::tracing::error!(error = %e, "failed to serialize response");
|
10719 - | ::aws_smithy_http_server::response::IntoResponse::<
|
10720 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10721 - | >::into_response(
|
10722 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
10723 - | e,
|
10724 - | ),
|
10725 - | )
|
10726 - | }
|
10727 - | }
|
10370 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10371 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10372 + | http_response.headers(),
|
10373 + | expected_headers,
|
10374 + | ));
|
10375 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10376 + | .await
|
10377 + | .expect("unable to extract body to bytes");
|
10378 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10379 + | &body,
|
10380 + | "{\"Float\":1234.5}",
|
10381 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10382 + | ));
|
10728 10383 | }
|
10729 - | }
|
10730 - | impl
|
10731 - | ::aws_smithy_http_server::response::IntoResponse<
|
10732 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10733 - | > for crate::error::JsonUnionsError
|
10734 - | {
|
10735 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
10736 - | match crate::protocol_serde::shape_json_unions::ser_json_unions_http_error(&self) {
|
10737 - | Ok(mut response) => {
|
10738 - | response.extensions_mut().insert(
|
10739 - | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
10740 - | );
|
10741 - | response
|
10742 - | }
|
10743 - | Err(e) => {
|
10744 - | ::tracing::error!(error = %e, "failed to serialize response");
|
10745 - | ::aws_smithy_http_server::response::IntoResponse::<
|
10746 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10747 - | >::into_response(
|
10748 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
10749 - | e,
|
10750 - | ),
|
10751 - | )
|
10752 - | }
|
10753 - | }
|
10384 + | /// Parses double shapes
|
10385 + | /// Test ID: parses_double_shapes
|
10386 + | #[::tokio::test]
|
10387 + | #[::tracing_test::traced_test]
|
10388 + | async fn parses_double_shapes_response() {
|
10389 + | let output = crate::output::KitchenSinkOperationOutput {
|
10390 + | double: ::std::option::Option::Some(1.2345678912345679E8_f64),
|
10391 + | blob: ::std::option::Option::None,
|
10392 + | boolean: ::std::option::Option::None,
|
10393 + | empty_struct: ::std::option::Option::None,
|
10394 + | float: ::std::option::Option::None,
|
10395 + | httpdate_timestamp: ::std::option::Option::None,
|
10396 + | integer: ::std::option::Option::None,
|
10397 + | iso8601_timestamp: ::std::option::Option::None,
|
10398 + | json_value: ::std::option::Option::None,
|
10399 + | list_of_lists: ::std::option::Option::None,
|
10400 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10401 + | list_of_strings: ::std::option::Option::None,
|
10402 + | list_of_structs: ::std::option::Option::None,
|
10403 + | long: ::std::option::Option::None,
|
10404 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10405 + | map_of_maps: ::std::option::Option::None,
|
10406 + | map_of_strings: ::std::option::Option::None,
|
10407 + | map_of_structs: ::std::option::Option::None,
|
10408 + | recursive_list: ::std::option::Option::None,
|
10409 + | recursive_map: ::std::option::Option::None,
|
10410 + | recursive_struct: ::std::option::Option::None,
|
10411 + | simple_struct: ::std::option::Option::None,
|
10412 + | string: ::std::option::Option::None,
|
10413 + | struct_with_json_name: ::std::option::Option::None,
|
10414 + | timestamp: ::std::option::Option::None,
|
10415 + | unix_timestamp: ::std::option::Option::None,
|
10416 + | };
|
10417 + | use ::aws_smithy_http_server::response::IntoResponse;
|
10418 + | let http_response = output.into_response();
|
10419 + | ::pretty_assertions::assert_eq!(
|
10420 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10421 + | http_response.status()
|
10422 + | );
|
10423 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10424 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10425 + | http_response.headers(),
|
10426 + | expected_headers,
|
10427 + | ));
|
10428 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10429 + | .await
|
10430 + | .expect("unable to extract body to bytes");
|
10431 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10432 + | &body,
|
10433 + | "{\"Double\":123456789.12345679}",
|
10434 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10435 + | ));
|
10754 10436 | }
|
10755 - | }
|
10756 - |
|
10757 - | static CONTENT_TYPE_GREETINGWITHERRORS: ::once_cell::sync::Lazy<::mime::Mime> =
|
10758 - | ::once_cell::sync::Lazy::new(|| {
|
10759 - | "application/x-amz-json-1.1"
|
10760 - | .parse::<::mime::Mime>()
|
10761 - | .expect("BUG: MIME parsing failed, content_type is not valid")
|
10762 - | });
|
10763 - | ::pin_project_lite::pin_project! {
|
10764 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
10765 - | /// [`GreetingWithErrorsInput`](crate::input::GreetingWithErrorsInput) using modelled bindings.
|
10766 - | pub struct GreetingWithErrorsInputFuture {
|
10767 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::GreetingWithErrorsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
10437 + | /// Parses boolean shapes (true)
|
10438 + | /// Test ID: parses_boolean_shapes_true
|
10439 + | #[::tokio::test]
|
10440 + | #[::tracing_test::traced_test]
|
10441 + | async fn parses_boolean_shapes_true_response() {
|
10442 + | let output = crate::output::KitchenSinkOperationOutput {
|
10443 + | boolean: ::std::option::Option::Some(true),
|
10444 + | blob: ::std::option::Option::None,
|
10445 + | double: ::std::option::Option::None,
|
10446 + | empty_struct: ::std::option::Option::None,
|
10447 + | float: ::std::option::Option::None,
|
10448 + | httpdate_timestamp: ::std::option::Option::None,
|
10449 + | integer: ::std::option::Option::None,
|
10450 + | iso8601_timestamp: ::std::option::Option::None,
|
10451 + | json_value: ::std::option::Option::None,
|
10452 + | list_of_lists: ::std::option::Option::None,
|
10453 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10454 + | list_of_strings: ::std::option::Option::None,
|
10455 + | list_of_structs: ::std::option::Option::None,
|
10456 + | long: ::std::option::Option::None,
|
10457 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10458 + | map_of_maps: ::std::option::Option::None,
|
10459 + | map_of_strings: ::std::option::Option::None,
|
10460 + | map_of_structs: ::std::option::Option::None,
|
10461 + | recursive_list: ::std::option::Option::None,
|
10462 + | recursive_map: ::std::option::Option::None,
|
10463 + | recursive_struct: ::std::option::Option::None,
|
10464 + | simple_struct: ::std::option::Option::None,
|
10465 + | string: ::std::option::Option::None,
|
10466 + | struct_with_json_name: ::std::option::Option::None,
|
10467 + | timestamp: ::std::option::Option::None,
|
10468 + | unix_timestamp: ::std::option::Option::None,
|
10469 + | };
|
10470 + | use ::aws_smithy_http_server::response::IntoResponse;
|
10471 + | let http_response = output.into_response();
|
10472 + | ::pretty_assertions::assert_eq!(
|
10473 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10474 + | http_response.status()
|
10475 + | );
|
10476 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10477 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10478 + | http_response.headers(),
|
10479 + | expected_headers,
|
10480 + | ));
|
10481 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10482 + | .await
|
10483 + | .expect("unable to extract body to bytes");
|
10484 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10485 + | &body,
|
10486 + | "{\"Boolean\":true}",
|
10487 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10488 + | ));
|
10768 10489 | }
|
10769 - | }
|
10770 - |
|
10771 - | impl std::future::Future for GreetingWithErrorsInputFuture {
|
10772 - | type Output = Result<
|
10773 - | crate::input::GreetingWithErrorsInput,
|
10774 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
10775 - | >;
|
10776 - |
|
10777 - | fn poll(
|
10778 - | self: std::pin::Pin<&mut Self>,
|
10779 - | cx: &mut std::task::Context<'_>,
|
10780 - | ) -> std::task::Poll<Self::Output> {
|
10781 - | let this = self.project();
|
10782 - | this.inner.as_mut().poll(cx)
|
10490 + | /// Parses boolean (false)
|
10491 + | /// Test ID: parses_boolean_false
|
10492 + | #[::tokio::test]
|
10493 + | #[::tracing_test::traced_test]
|
10494 + | async fn parses_boolean_false_response() {
|
10495 + | let output = crate::output::KitchenSinkOperationOutput {
|
10496 + | boolean: ::std::option::Option::Some(false),
|
10497 + | blob: ::std::option::Option::None,
|
10498 + | double: ::std::option::Option::None,
|
10499 + | empty_struct: ::std::option::Option::None,
|
10500 + | float: ::std::option::Option::None,
|
10501 + | httpdate_timestamp: ::std::option::Option::None,
|
10502 + | integer: ::std::option::Option::None,
|
10503 + | iso8601_timestamp: ::std::option::Option::None,
|
10504 + | json_value: ::std::option::Option::None,
|
10505 + | list_of_lists: ::std::option::Option::None,
|
10506 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10507 + | list_of_strings: ::std::option::Option::None,
|
10508 + | list_of_structs: ::std::option::Option::None,
|
10509 + | long: ::std::option::Option::None,
|
10510 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10511 + | map_of_maps: ::std::option::Option::None,
|
10512 + | map_of_strings: ::std::option::Option::None,
|
10513 + | map_of_structs: ::std::option::Option::None,
|
10514 + | recursive_list: ::std::option::Option::None,
|
10515 + | recursive_map: ::std::option::Option::None,
|
10516 + | recursive_struct: ::std::option::Option::None,
|
10517 + | simple_struct: ::std::option::Option::None,
|
10518 + | string: ::std::option::Option::None,
|
10519 + | struct_with_json_name: ::std::option::Option::None,
|
10520 + | timestamp: ::std::option::Option::None,
|
10521 + | unix_timestamp: ::std::option::Option::None,
|
10522 + | };
|
10523 + | use ::aws_smithy_http_server::response::IntoResponse;
|
10524 + | let http_response = output.into_response();
|
10525 + | ::pretty_assertions::assert_eq!(
|
10526 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10527 + | http_response.status()
|
10528 + | );
|
10529 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10530 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10531 + | http_response.headers(),
|
10532 + | expected_headers,
|
10533 + | ));
|
10534 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10535 + | .await
|
10536 + | .expect("unable to extract body to bytes");
|
10537 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10538 + | &body,
|
10539 + | "{\"Boolean\":false}",
|
10540 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10541 + | ));
|
10783 10542 | }
|
10784 - | }
|
10785 - |
|
10786 - | impl<B>
|
10787 - | ::aws_smithy_http_server::request::FromRequest<
|
10788 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10789 - | B,
|
10790 - | > for crate::input::GreetingWithErrorsInput
|
10791 - | where
|
10792 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
10793 - | B: 'static,
|
10794 - |
|
10795 - | B::Data: Send,
|
10796 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
10797 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
10798 - | {
|
10799 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
10800 - | type Future = GreetingWithErrorsInputFuture;
|
10801 - |
|
10802 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
10803 - | let fut = async move {
|
10804 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
10805 - | request.headers(),
|
10806 - | &CONTENT_TYPE_GREETINGWITHERRORS,
|
10807 - | ) {
|
10808 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
10809 - | }
|
10810 - | crate::protocol_serde::shape_greeting_with_errors::de_greeting_with_errors_http_request(
|
10811 - | request,
|
10812 - | )
|
10543 + | /// Parses blob shapes
|
10544 + | /// Test ID: parses_blob_shapes
|
10545 + | #[::tokio::test]
|
10546 + | #[::tracing_test::traced_test]
|
10547 + | async fn parses_blob_shapes_response() {
|
10548 + | let output = crate::output::KitchenSinkOperationOutput {
|
10549 + | blob: ::std::option::Option::Some(::aws_smithy_types::Blob::new("binary-value")),
|
10550 + | boolean: ::std::option::Option::None,
|
10551 + | double: ::std::option::Option::None,
|
10552 + | empty_struct: ::std::option::Option::None,
|
10553 + | float: ::std::option::Option::None,
|
10554 + | httpdate_timestamp: ::std::option::Option::None,
|
10555 + | integer: ::std::option::Option::None,
|
10556 + | iso8601_timestamp: ::std::option::Option::None,
|
10557 + | json_value: ::std::option::Option::None,
|
10558 + | list_of_lists: ::std::option::Option::None,
|
10559 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10560 + | list_of_strings: ::std::option::Option::None,
|
10561 + | list_of_structs: ::std::option::Option::None,
|
10562 + | long: ::std::option::Option::None,
|
10563 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10564 + | map_of_maps: ::std::option::Option::None,
|
10565 + | map_of_strings: ::std::option::Option::None,
|
10566 + | map_of_structs: ::std::option::Option::None,
|
10567 + | recursive_list: ::std::option::Option::None,
|
10568 + | recursive_map: ::std::option::Option::None,
|
10569 + | recursive_struct: ::std::option::Option::None,
|
10570 + | simple_struct: ::std::option::Option::None,
|
10571 + | string: ::std::option::Option::None,
|
10572 + | struct_with_json_name: ::std::option::Option::None,
|
10573 + | timestamp: ::std::option::Option::None,
|
10574 + | unix_timestamp: ::std::option::Option::None,
|
10575 + | };
|
10576 + | use ::aws_smithy_http_server::response::IntoResponse;
|
10577 + | let http_response = output.into_response();
|
10578 + | ::pretty_assertions::assert_eq!(
|
10579 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10580 + | http_response.status()
|
10581 + | );
|
10582 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10583 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10584 + | http_response.headers(),
|
10585 + | expected_headers,
|
10586 + | ));
|
10587 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10813 10588 | .await
|
10814 - | .map_err(Into::into)
|
10589 + | .expect("unable to extract body to bytes");
|
10590 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10591 + | &body,
|
10592 + | "{\"Blob\":\"YmluYXJ5LXZhbHVl\"}",
|
10593 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10594 + | ));
|
10595 + | }
|
10596 + | /// Parses timestamp shapes
|
10597 + | /// Test ID: parses_timestamp_shapes
|
10598 + | #[::tokio::test]
|
10599 + | #[::tracing_test::traced_test]
|
10600 + | async fn parses_timestamp_shapes_response() {
|
10601 + | let output = crate::output::KitchenSinkOperationOutput {
|
10602 + | timestamp: ::std::option::Option::Some(
|
10603 + | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
10604 + | ),
|
10605 + | blob: ::std::option::Option::None,
|
10606 + | boolean: ::std::option::Option::None,
|
10607 + | double: ::std::option::Option::None,
|
10608 + | empty_struct: ::std::option::Option::None,
|
10609 + | float: ::std::option::Option::None,
|
10610 + | httpdate_timestamp: ::std::option::Option::None,
|
10611 + | integer: ::std::option::Option::None,
|
10612 + | iso8601_timestamp: ::std::option::Option::None,
|
10613 + | json_value: ::std::option::Option::None,
|
10614 + | list_of_lists: ::std::option::Option::None,
|
10615 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10616 + | list_of_strings: ::std::option::Option::None,
|
10617 + | list_of_structs: ::std::option::Option::None,
|
10618 + | long: ::std::option::Option::None,
|
10619 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10620 + | map_of_maps: ::std::option::Option::None,
|
10621 + | map_of_strings: ::std::option::Option::None,
|
10622 + | map_of_structs: ::std::option::Option::None,
|
10623 + | recursive_list: ::std::option::Option::None,
|
10624 + | recursive_map: ::std::option::Option::None,
|
10625 + | recursive_struct: ::std::option::Option::None,
|
10626 + | simple_struct: ::std::option::Option::None,
|
10627 + | string: ::std::option::Option::None,
|
10628 + | struct_with_json_name: ::std::option::Option::None,
|
10629 + | unix_timestamp: ::std::option::Option::None,
|
10815 10630 | };
|
10816 - | use ::futures_util::future::TryFutureExt;
|
10817 - | let fut = fut.map_err(
|
10818 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
10819 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
10820 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
10821 - | },
|
10631 + | use ::aws_smithy_http_server::response::IntoResponse;
|
10632 + | let http_response = output.into_response();
|
10633 + | ::pretty_assertions::assert_eq!(
|
10634 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10635 + | http_response.status()
|
10822 10636 | );
|
10823 - | GreetingWithErrorsInputFuture {
|
10824 - | inner: Box::pin(fut),
|
10825 - | }
|
10826 - | }
|
10827 - | }
|
10828 - | impl
|
10829 - | ::aws_smithy_http_server::response::IntoResponse<
|
10830 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10831 - | > for crate::output::GreetingWithErrorsOutput
|
10832 - | {
|
10833 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
10834 - | match crate::protocol_serde::shape_greeting_with_errors::ser_greeting_with_errors_http_response(self) {
|
10835 - | Ok(response) => response,
|
10836 - | Err(e) => {
|
10837 - | ::tracing::error!(error = %e, "failed to serialize response");
|
10838 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
10839 - | }
|
10840 - | }
|
10841 - | }
|
10842 - | }
|
10843 - | impl
|
10844 - | ::aws_smithy_http_server::response::IntoResponse<
|
10845 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10846 - | > for crate::error::GreetingWithErrorsError
|
10847 - | {
|
10848 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
10849 - | match crate::protocol_serde::shape_greeting_with_errors::ser_greeting_with_errors_http_error(
|
10850 - | &self,
|
10851 - | ) {
|
10852 - | Ok(mut response) => {
|
10853 - | response.extensions_mut().insert(
|
10854 - | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
10855 - | );
|
10856 - | response
|
10857 - | }
|
10858 - | Err(e) => {
|
10859 - | ::tracing::error!(error = %e, "failed to serialize response");
|
10860 - | ::aws_smithy_http_server::response::IntoResponse::<
|
10861 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10862 - | >::into_response(
|
10863 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
10864 - | e,
|
10865 - | ),
|
10866 - | )
|
10867 - | }
|
10868 - | }
|
10637 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10638 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10639 + | http_response.headers(),
|
10640 + | expected_headers,
|
10641 + | ));
|
10642 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10643 + | .await
|
10644 + | .expect("unable to extract body to bytes");
|
10645 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10646 + | &body,
|
10647 + | "{\"Timestamp\":946845296}",
|
10648 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10649 + | ));
|
10869 10650 | }
|
10870 - | }
|
10871 - |
|
10872 - | static CONTENT_TYPE_SPARSENULLSOPERATION: ::once_cell::sync::Lazy<::mime::Mime> =
|
10873 - | ::once_cell::sync::Lazy::new(|| {
|
10874 - | "application/x-amz-json-1.1"
|
10875 - | .parse::<::mime::Mime>()
|
10876 - | .expect("BUG: MIME parsing failed, content_type is not valid")
|
10877 - | });
|
10878 - | ::pin_project_lite::pin_project! {
|
10879 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
10880 - | /// [`SparseNullsOperationInput`](crate::input::SparseNullsOperationInput) using modelled bindings.
|
10881 - | pub struct SparseNullsOperationInputFuture {
|
10882 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SparseNullsOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
10651 + | /// Parses iso8601 timestamps
|
10652 + | /// Test ID: parses_iso8601_timestamps
|
10653 + | #[::tokio::test]
|
10654 + | #[::tracing_test::traced_test]
|
10655 + | async fn parses_iso8601_timestamps_response() {
|
10656 + | let output = crate::output::KitchenSinkOperationOutput {
|
10657 + | iso8601_timestamp: ::std::option::Option::Some(
|
10658 + | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
10659 + | ),
|
10660 + | blob: ::std::option::Option::None,
|
10661 + | boolean: ::std::option::Option::None,
|
10662 + | double: ::std::option::Option::None,
|
10663 + | empty_struct: ::std::option::Option::None,
|
10664 + | float: ::std::option::Option::None,
|
10665 + | httpdate_timestamp: ::std::option::Option::None,
|
10666 + | integer: ::std::option::Option::None,
|
10667 + | json_value: ::std::option::Option::None,
|
10668 + | list_of_lists: ::std::option::Option::None,
|
10669 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10670 + | list_of_strings: ::std::option::Option::None,
|
10671 + | list_of_structs: ::std::option::Option::None,
|
10672 + | long: ::std::option::Option::None,
|
10673 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10674 + | map_of_maps: ::std::option::Option::None,
|
10675 + | map_of_strings: ::std::option::Option::None,
|
10676 + | map_of_structs: ::std::option::Option::None,
|
10677 + | recursive_list: ::std::option::Option::None,
|
10678 + | recursive_map: ::std::option::Option::None,
|
10679 + | recursive_struct: ::std::option::Option::None,
|
10680 + | simple_struct: ::std::option::Option::None,
|
10681 + | string: ::std::option::Option::None,
|
10682 + | struct_with_json_name: ::std::option::Option::None,
|
10683 + | timestamp: ::std::option::Option::None,
|
10684 + | unix_timestamp: ::std::option::Option::None,
|
10685 + | };
|
10686 + | use ::aws_smithy_http_server::response::IntoResponse;
|
10687 + | let http_response = output.into_response();
|
10688 + | ::pretty_assertions::assert_eq!(
|
10689 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10690 + | http_response.status()
|
10691 + | );
|
10692 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10693 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10694 + | http_response.headers(),
|
10695 + | expected_headers,
|
10696 + | ));
|
10697 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10698 + | .await
|
10699 + | .expect("unable to extract body to bytes");
|
10700 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10701 + | &body,
|
10702 + | "{\"Iso8601Timestamp\":\"2000-01-02T20:34:56Z\"}",
|
10703 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10704 + | ));
|
10883 10705 | }
|
10884 - | }
|
10885 - |
|
10886 - | impl std::future::Future for SparseNullsOperationInputFuture {
|
10887 - | type Output = Result<
|
10888 - | crate::input::SparseNullsOperationInput,
|
10889 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
10890 - | >;
|
10891 - |
|
10892 - | fn poll(
|
10893 - | self: std::pin::Pin<&mut Self>,
|
10894 - | cx: &mut std::task::Context<'_>,
|
10895 - | ) -> std::task::Poll<Self::Output> {
|
10896 - | let this = self.project();
|
10897 - | this.inner.as_mut().poll(cx)
|
10706 + | /// Parses httpdate timestamps
|
10707 + | /// Test ID: parses_httpdate_timestamps
|
10708 + | #[::tokio::test]
|
10709 + | #[::tracing_test::traced_test]
|
10710 + | async fn parses_httpdate_timestamps_response() {
|
10711 + | let output = crate::output::KitchenSinkOperationOutput {
|
10712 + | httpdate_timestamp: ::std::option::Option::Some(
|
10713 + | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
10714 + | ),
|
10715 + | blob: ::std::option::Option::None,
|
10716 + | boolean: ::std::option::Option::None,
|
10717 + | double: ::std::option::Option::None,
|
10718 + | empty_struct: ::std::option::Option::None,
|
10719 + | float: ::std::option::Option::None,
|
10720 + | integer: ::std::option::Option::None,
|
10721 + | iso8601_timestamp: ::std::option::Option::None,
|
10722 + | json_value: ::std::option::Option::None,
|
10723 + | list_of_lists: ::std::option::Option::None,
|
10724 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10725 + | list_of_strings: ::std::option::Option::None,
|
10726 + | list_of_structs: ::std::option::Option::None,
|
10727 + | long: ::std::option::Option::None,
|
10728 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10729 + | map_of_maps: ::std::option::Option::None,
|
10730 + | map_of_strings: ::std::option::Option::None,
|
10731 + | map_of_structs: ::std::option::Option::None,
|
10732 + | recursive_list: ::std::option::Option::None,
|
10733 + | recursive_map: ::std::option::Option::None,
|
10734 + | recursive_struct: ::std::option::Option::None,
|
10735 + | simple_struct: ::std::option::Option::None,
|
10736 + | string: ::std::option::Option::None,
|
10737 + | struct_with_json_name: ::std::option::Option::None,
|
10738 + | timestamp: ::std::option::Option::None,
|
10739 + | unix_timestamp: ::std::option::Option::None,
|
10740 + | };
|
10741 + | use ::aws_smithy_http_server::response::IntoResponse;
|
10742 + | let http_response = output.into_response();
|
10743 + | ::pretty_assertions::assert_eq!(
|
10744 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10745 + | http_response.status()
|
10746 + | );
|
10747 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10748 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10749 + | http_response.headers(),
|
10750 + | expected_headers,
|
10751 + | ));
|
10752 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10753 + | .await
|
10754 + | .expect("unable to extract body to bytes");
|
10755 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10756 + | &body,
|
10757 + | "{\"HttpdateTimestamp\":\"Sun, 02 Jan 2000 20:34:56 GMT\"}",
|
10758 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10759 + | ));
|
10898 10760 | }
|
10899 - | }
|
10900 - |
|
10901 - | impl<B>
|
10902 - | ::aws_smithy_http_server::request::FromRequest<
|
10903 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10904 - | B,
|
10905 - | > for crate::input::SparseNullsOperationInput
|
10906 - | where
|
10907 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
10908 - | B: 'static,
|
10909 - |
|
10910 - | B::Data: Send,
|
10911 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
10912 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
10913 - | {
|
10914 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
10915 - | type Future = SparseNullsOperationInputFuture;
|
10916 - |
|
10917 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
10918 - | let fut = async move {
|
10919 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
10920 - | request.headers(),
|
10921 - | &CONTENT_TYPE_SPARSENULLSOPERATION,
|
10922 - | ) {
|
10923 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
10924 - | }
|
10925 - | crate::protocol_serde::shape_sparse_nulls_operation::de_sparse_nulls_operation_http_request(request)
|
10926 - | .await
|
10927 - | .map_err(Into::into)
|
10761 + | /// Parses list shapes
|
10762 + | /// Test ID: parses_list_shapes
|
10763 + | #[::tokio::test]
|
10764 + | #[::tracing_test::traced_test]
|
10765 + | async fn parses_list_shapes_response() {
|
10766 + | let output = crate::output::KitchenSinkOperationOutput {
|
10767 + | list_of_strings: ::std::option::Option::Some(vec![
|
10768 + | "abc".to_owned(),
|
10769 + | "mno".to_owned(),
|
10770 + | "xyz".to_owned(),
|
10771 + | ]),
|
10772 + | blob: ::std::option::Option::None,
|
10773 + | boolean: ::std::option::Option::None,
|
10774 + | double: ::std::option::Option::None,
|
10775 + | empty_struct: ::std::option::Option::None,
|
10776 + | float: ::std::option::Option::None,
|
10777 + | httpdate_timestamp: ::std::option::Option::None,
|
10778 + | integer: ::std::option::Option::None,
|
10779 + | iso8601_timestamp: ::std::option::Option::None,
|
10780 + | json_value: ::std::option::Option::None,
|
10781 + | list_of_lists: ::std::option::Option::None,
|
10782 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10783 + | list_of_structs: ::std::option::Option::None,
|
10784 + | long: ::std::option::Option::None,
|
10785 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10786 + | map_of_maps: ::std::option::Option::None,
|
10787 + | map_of_strings: ::std::option::Option::None,
|
10788 + | map_of_structs: ::std::option::Option::None,
|
10789 + | recursive_list: ::std::option::Option::None,
|
10790 + | recursive_map: ::std::option::Option::None,
|
10791 + | recursive_struct: ::std::option::Option::None,
|
10792 + | simple_struct: ::std::option::Option::None,
|
10793 + | string: ::std::option::Option::None,
|
10794 + | struct_with_json_name: ::std::option::Option::None,
|
10795 + | timestamp: ::std::option::Option::None,
|
10796 + | unix_timestamp: ::std::option::Option::None,
|
10928 10797 | };
|
10929 - | use ::futures_util::future::TryFutureExt;
|
10930 - | let fut = fut.map_err(
|
10931 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
10932 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
10933 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
10934 - | },
|
10798 + | use ::aws_smithy_http_server::response::IntoResponse;
|
10799 + | let http_response = output.into_response();
|
10800 + | ::pretty_assertions::assert_eq!(
|
10801 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10802 + | http_response.status()
|
10935 10803 | );
|
10936 - | SparseNullsOperationInputFuture {
|
10937 - | inner: Box::pin(fut),
|
10938 - | }
|
10939 - | }
|
10940 - | }
|
10941 - | impl
|
10942 - | ::aws_smithy_http_server::response::IntoResponse<
|
10943 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10944 - | > for crate::output::SparseNullsOperationOutput
|
10945 - | {
|
10946 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
10947 - | match crate::protocol_serde::shape_sparse_nulls_operation::ser_sparse_nulls_operation_http_response(self) {
|
10948 - | Ok(response) => response,
|
10949 - | Err(e) => {
|
10950 - | ::tracing::error!(error = %e, "failed to serialize response");
|
10951 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
10952 - | }
|
10953 - | }
|
10804 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10805 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10806 + | http_response.headers(),
|
10807 + | expected_headers,
|
10808 + | ));
|
10809 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10810 + | .await
|
10811 + | .expect("unable to extract body to bytes");
|
10812 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10813 + | &body,
|
10814 + | "{\"ListOfStrings\":[\"abc\",\"mno\",\"xyz\"]}",
|
10815 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10816 + | ));
|
10954 10817 | }
|
10955 - | }
|
10956 - |
|
10957 - | static CONTENT_TYPE_NULLOPERATION: ::once_cell::sync::Lazy<::mime::Mime> =
|
10958 - | ::once_cell::sync::Lazy::new(|| {
|
10959 - | "application/x-amz-json-1.1"
|
10960 - | .parse::<::mime::Mime>()
|
10961 - | .expect("BUG: MIME parsing failed, content_type is not valid")
|
10962 - | });
|
10963 - | ::pin_project_lite::pin_project! {
|
10964 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
10965 - | /// [`NullOperationInput`](crate::input::NullOperationInput) using modelled bindings.
|
10966 - | pub struct NullOperationInputFuture {
|
10967 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::NullOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
10818 + | /// Parses list of map shapes
|
10819 + | /// Test ID: parses_list_of_map_shapes
|
10820 + | #[::tokio::test]
|
10821 + | #[::tracing_test::traced_test]
|
10822 + | async fn parses_list_of_map_shapes_response() {
|
10823 + | let output = crate::output::KitchenSinkOperationOutput {
|
10824 + | list_of_maps_of_strings: ::std::option::Option::Some(vec![
|
10825 + | {
|
10826 + | let mut ret = ::std::collections::HashMap::new();
|
10827 + | ret.insert("size".to_owned(), "large".to_owned());
|
10828 + | ret
|
10829 + | },
|
10830 + | {
|
10831 + | let mut ret = ::std::collections::HashMap::new();
|
10832 + | ret.insert("color".to_owned(), "red".to_owned());
|
10833 + | ret
|
10834 + | },
|
10835 + | ]),
|
10836 + | blob: ::std::option::Option::None,
|
10837 + | boolean: ::std::option::Option::None,
|
10838 + | double: ::std::option::Option::None,
|
10839 + | empty_struct: ::std::option::Option::None,
|
10840 + | float: ::std::option::Option::None,
|
10841 + | httpdate_timestamp: ::std::option::Option::None,
|
10842 + | integer: ::std::option::Option::None,
|
10843 + | iso8601_timestamp: ::std::option::Option::None,
|
10844 + | json_value: ::std::option::Option::None,
|
10845 + | list_of_lists: ::std::option::Option::None,
|
10846 + | list_of_strings: ::std::option::Option::None,
|
10847 + | list_of_structs: ::std::option::Option::None,
|
10848 + | long: ::std::option::Option::None,
|
10849 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10850 + | map_of_maps: ::std::option::Option::None,
|
10851 + | map_of_strings: ::std::option::Option::None,
|
10852 + | map_of_structs: ::std::option::Option::None,
|
10853 + | recursive_list: ::std::option::Option::None,
|
10854 + | recursive_map: ::std::option::Option::None,
|
10855 + | recursive_struct: ::std::option::Option::None,
|
10856 + | simple_struct: ::std::option::Option::None,
|
10857 + | string: ::std::option::Option::None,
|
10858 + | struct_with_json_name: ::std::option::Option::None,
|
10859 + | timestamp: ::std::option::Option::None,
|
10860 + | unix_timestamp: ::std::option::Option::None,
|
10861 + | };
|
10862 + | use ::aws_smithy_http_server::response::IntoResponse;
|
10863 + | let http_response = output.into_response();
|
10864 + | ::pretty_assertions::assert_eq!(
|
10865 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10866 + | http_response.status()
|
10867 + | );
|
10868 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10869 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10870 + | http_response.headers(),
|
10871 + | expected_headers,
|
10872 + | ));
|
10873 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10874 + | .await
|
10875 + | .expect("unable to extract body to bytes");
|
10876 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10877 + | &body,
|
10878 + | "{\"ListOfMapsOfStrings\":[{\"size\":\"large\"},{\"color\":\"red\"}]}",
|
10879 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10880 + | ));
|
10968 10881 | }
|
10969 - | }
|
10970 - |
|
10971 - | impl std::future::Future for NullOperationInputFuture {
|
10972 - | type Output = Result<
|
10973 - | crate::input::NullOperationInput,
|
10974 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
10975 - | >;
|
10976 - |
|
10977 - | fn poll(
|
10978 - | self: std::pin::Pin<&mut Self>,
|
10979 - | cx: &mut std::task::Context<'_>,
|
10980 - | ) -> std::task::Poll<Self::Output> {
|
10981 - | let this = self.project();
|
10982 - | this.inner.as_mut().poll(cx)
|
10882 + | /// Parses list of list shapes
|
10883 + | /// Test ID: parses_list_of_list_shapes
|
10884 + | #[::tokio::test]
|
10885 + | #[::tracing_test::traced_test]
|
10886 + | async fn parses_list_of_list_shapes_response() {
|
10887 + | let output = crate::output::KitchenSinkOperationOutput {
|
10888 + | list_of_lists: ::std::option::Option::Some(vec![
|
10889 + | vec!["abc".to_owned(), "mno".to_owned(), "xyz".to_owned()],
|
10890 + | vec!["hjk".to_owned(), "qrs".to_owned(), "tuv".to_owned()],
|
10891 + | ]),
|
10892 + | blob: ::std::option::Option::None,
|
10893 + | boolean: ::std::option::Option::None,
|
10894 + | double: ::std::option::Option::None,
|
10895 + | empty_struct: ::std::option::Option::None,
|
10896 + | float: ::std::option::Option::None,
|
10897 + | httpdate_timestamp: ::std::option::Option::None,
|
10898 + | integer: ::std::option::Option::None,
|
10899 + | iso8601_timestamp: ::std::option::Option::None,
|
10900 + | json_value: ::std::option::Option::None,
|
10901 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10902 + | list_of_strings: ::std::option::Option::None,
|
10903 + | list_of_structs: ::std::option::Option::None,
|
10904 + | long: ::std::option::Option::None,
|
10905 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10906 + | map_of_maps: ::std::option::Option::None,
|
10907 + | map_of_strings: ::std::option::Option::None,
|
10908 + | map_of_structs: ::std::option::Option::None,
|
10909 + | recursive_list: ::std::option::Option::None,
|
10910 + | recursive_map: ::std::option::Option::None,
|
10911 + | recursive_struct: ::std::option::Option::None,
|
10912 + | simple_struct: ::std::option::Option::None,
|
10913 + | string: ::std::option::Option::None,
|
10914 + | struct_with_json_name: ::std::option::Option::None,
|
10915 + | timestamp: ::std::option::Option::None,
|
10916 + | unix_timestamp: ::std::option::Option::None,
|
10917 + | };
|
10918 + | use ::aws_smithy_http_server::response::IntoResponse;
|
10919 + | let http_response = output.into_response();
|
10920 + | ::pretty_assertions::assert_eq!(
|
10921 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10922 + | http_response.status()
|
10923 + | );
|
10924 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10925 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10926 + | http_response.headers(),
|
10927 + | expected_headers,
|
10928 + | ));
|
10929 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10930 + | .await
|
10931 + | .expect("unable to extract body to bytes");
|
10932 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10933 + | &body,
|
10934 + | "{\"ListOfLists\":[[\"abc\",\"mno\",\"xyz\"],[\"hjk\",\"qrs\",\"tuv\"]]}",
|
10935 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10936 + | ));
|
10983 10937 | }
|
10984 - | }
|
10985 - |
|
10986 - | impl<B>
|
10987 - | ::aws_smithy_http_server::request::FromRequest<
|
10988 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
10989 - | B,
|
10990 - | > for crate::input::NullOperationInput
|
10991 - | where
|
10992 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
10993 - | B: 'static,
|
10994 - |
|
10995 - | B::Data: Send,
|
10996 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
10997 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
10998 - | {
|
10999 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
11000 - | type Future = NullOperationInputFuture;
|
11001 - |
|
11002 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
11003 - | let fut = async move {
|
11004 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
11005 - | request.headers(),
|
11006 - | &CONTENT_TYPE_NULLOPERATION,
|
11007 - | ) {
|
11008 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
11009 - | }
|
11010 - | crate::protocol_serde::shape_null_operation::de_null_operation_http_request(request)
|
11011 - | .await
|
11012 - | .map_err(Into::into)
|
10938 + | /// Parses list of structure shapes
|
10939 + | /// Test ID: parses_list_of_structure_shapes
|
10940 + | #[::tokio::test]
|
10941 + | #[::tracing_test::traced_test]
|
10942 + | async fn parses_list_of_structure_shapes_response() {
|
10943 + | let output = crate::output::KitchenSinkOperationOutput {
|
10944 + | list_of_structs: ::std::option::Option::Some(vec![
|
10945 + | crate::model::SimpleStruct {
|
10946 + | value: ::std::option::Option::Some("value-1".to_owned()),
|
10947 + | },
|
10948 + | crate::model::SimpleStruct {
|
10949 + | value: ::std::option::Option::Some("value-2".to_owned()),
|
10950 + | },
|
10951 + | ]),
|
10952 + | blob: ::std::option::Option::None,
|
10953 + | boolean: ::std::option::Option::None,
|
10954 + | double: ::std::option::Option::None,
|
10955 + | empty_struct: ::std::option::Option::None,
|
10956 + | float: ::std::option::Option::None,
|
10957 + | httpdate_timestamp: ::std::option::Option::None,
|
10958 + | integer: ::std::option::Option::None,
|
10959 + | iso8601_timestamp: ::std::option::Option::None,
|
10960 + | json_value: ::std::option::Option::None,
|
10961 + | list_of_lists: ::std::option::Option::None,
|
10962 + | list_of_maps_of_strings: ::std::option::Option::None,
|
10963 + | list_of_strings: ::std::option::Option::None,
|
10964 + | long: ::std::option::Option::None,
|
10965 + | map_of_lists_of_strings: ::std::option::Option::None,
|
10966 + | map_of_maps: ::std::option::Option::None,
|
10967 + | map_of_strings: ::std::option::Option::None,
|
10968 + | map_of_structs: ::std::option::Option::None,
|
10969 + | recursive_list: ::std::option::Option::None,
|
10970 + | recursive_map: ::std::option::Option::None,
|
10971 + | recursive_struct: ::std::option::Option::None,
|
10972 + | simple_struct: ::std::option::Option::None,
|
10973 + | string: ::std::option::Option::None,
|
10974 + | struct_with_json_name: ::std::option::Option::None,
|
10975 + | timestamp: ::std::option::Option::None,
|
10976 + | unix_timestamp: ::std::option::Option::None,
|
11013 10977 | };
|
11014 - | use ::futures_util::future::TryFutureExt;
|
11015 - | let fut = fut.map_err(
|
11016 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
11017 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
11018 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
11019 - | },
|
10978 + | use ::aws_smithy_http_server::response::IntoResponse;
|
10979 + | let http_response = output.into_response();
|
10980 + | ::pretty_assertions::assert_eq!(
|
10981 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10982 + | http_response.status()
|
11020 10983 | );
|
11021 - | NullOperationInputFuture {
|
11022 - | inner: Box::pin(fut),
|
11023 - | }
|
11024 - | }
|
11025 - | }
|
11026 - | impl
|
11027 - | ::aws_smithy_http_server::response::IntoResponse<
|
11028 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11029 - | > for crate::output::NullOperationOutput
|
11030 - | {
|
11031 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
11032 - | match crate::protocol_serde::shape_null_operation::ser_null_operation_http_response(self) {
|
11033 - | Ok(response) => response,
|
11034 - | Err(e) => {
|
11035 - | ::tracing::error!(error = %e, "failed to serialize response");
|
11036 - | ::aws_smithy_http_server::response::IntoResponse::<
|
11037 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11038 - | >::into_response(
|
11039 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
11040 - | e,
|
11041 - | ),
|
11042 - | )
|
11043 - | }
|
11044 - | }
|
11045 - | }
|
11046 - | }
|
11047 - |
|
11048 - | static CONTENT_TYPE_JSONENUMS: ::once_cell::sync::Lazy<::mime::Mime> =
|
11049 - | ::once_cell::sync::Lazy::new(|| {
|
11050 - | "application/x-amz-json-1.1"
|
11051 - | .parse::<::mime::Mime>()
|
11052 - | .expect("BUG: MIME parsing failed, content_type is not valid")
|
11053 - | });
|
11054 - | ::pin_project_lite::pin_project! {
|
11055 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
11056 - | /// [`JsonEnumsInput`](crate::input::JsonEnumsInput) using modelled bindings.
|
11057 - | pub struct JsonEnumsInputFuture {
|
11058 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::JsonEnumsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
10984 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10985 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10986 + | http_response.headers(),
|
10987 + | expected_headers,
|
10988 + | ));
|
10989 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10990 + | .await
|
10991 + | .expect("unable to extract body to bytes");
|
10992 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10993 + | &body,
|
10994 + | "{\"ListOfStructs\":[{\"Value\":\"value-1\"},{\"Value\":\"value-2\"}]}",
|
10995 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10996 + | ));
|
11059 10997 | }
|
11060 - | }
|
11061 - |
|
11062 - | impl std::future::Future for JsonEnumsInputFuture {
|
11063 - | type Output = Result<
|
11064 - | crate::input::JsonEnumsInput,
|
11065 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
11066 - | >;
|
11067 - |
|
11068 - | fn poll(
|
11069 - | self: std::pin::Pin<&mut Self>,
|
11070 - | cx: &mut std::task::Context<'_>,
|
11071 - | ) -> std::task::Poll<Self::Output> {
|
11072 - | let this = self.project();
|
11073 - | this.inner.as_mut().poll(cx)
|
10998 + | /// Parses list of recursive structure shapes
|
10999 + | /// Test ID: parses_list_of_recursive_structure_shapes
|
11000 + | #[::tokio::test]
|
11001 + | #[::tracing_test::traced_test]
|
11002 + | async fn parses_list_of_recursive_structure_shapes_response() {
|
11003 + | let output = crate::output::KitchenSinkOperationOutput {
|
11004 + | recursive_list: ::std::option::Option::Some(vec![crate::model::KitchenSink {
|
11005 + | recursive_list: ::std::option::Option::Some(vec![crate::model::KitchenSink {
|
11006 + | recursive_list: ::std::option::Option::Some(vec![crate::model::KitchenSink {
|
11007 + | string: ::std::option::Option::Some("value".to_owned()),
|
11008 + | blob: ::std::option::Option::None,
|
11009 + | boolean: ::std::option::Option::None,
|
11010 + | double: ::std::option::Option::None,
|
11011 + | empty_struct: ::std::option::Option::None,
|
11012 + | float: ::std::option::Option::None,
|
11013 + | httpdate_timestamp: ::std::option::Option::None,
|
11014 + | integer: ::std::option::Option::None,
|
11015 + | iso8601_timestamp: ::std::option::Option::None,
|
11016 + | json_value: ::std::option::Option::None,
|
11017 + | list_of_lists: ::std::option::Option::None,
|
11018 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11019 + | list_of_strings: ::std::option::Option::None,
|
11020 + | list_of_structs: ::std::option::Option::None,
|
11021 + | long: ::std::option::Option::None,
|
11022 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11023 + | map_of_maps: ::std::option::Option::None,
|
11024 + | map_of_strings: ::std::option::Option::None,
|
11025 + | map_of_structs: ::std::option::Option::None,
|
11026 + | recursive_list: ::std::option::Option::None,
|
11027 + | recursive_map: ::std::option::Option::None,
|
11028 + | recursive_struct: ::std::option::Option::None,
|
11029 + | simple_struct: ::std::option::Option::None,
|
11030 + | struct_with_json_name: ::std::option::Option::None,
|
11031 + | timestamp: ::std::option::Option::None,
|
11032 + | unix_timestamp: ::std::option::Option::None,
|
11033 + | }]),
|
11034 + | blob: ::std::option::Option::None,
|
11035 + | boolean: ::std::option::Option::None,
|
11036 + | double: ::std::option::Option::None,
|
11037 + | empty_struct: ::std::option::Option::None,
|
11038 + | float: ::std::option::Option::None,
|
11039 + | httpdate_timestamp: ::std::option::Option::None,
|
11040 + | integer: ::std::option::Option::None,
|
11041 + | iso8601_timestamp: ::std::option::Option::None,
|
11042 + | json_value: ::std::option::Option::None,
|
11043 + | list_of_lists: ::std::option::Option::None,
|
11044 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11045 + | list_of_strings: ::std::option::Option::None,
|
11046 + | list_of_structs: ::std::option::Option::None,
|
11047 + | long: ::std::option::Option::None,
|
11048 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11049 + | map_of_maps: ::std::option::Option::None,
|
11050 + | map_of_strings: ::std::option::Option::None,
|
11051 + | map_of_structs: ::std::option::Option::None,
|
11052 + | recursive_map: ::std::option::Option::None,
|
11053 + | recursive_struct: ::std::option::Option::None,
|
11054 + | simple_struct: ::std::option::Option::None,
|
11055 + | string: ::std::option::Option::None,
|
11056 + | struct_with_json_name: ::std::option::Option::None,
|
11057 + | timestamp: ::std::option::Option::None,
|
11058 + | unix_timestamp: ::std::option::Option::None,
|
11059 + | }]),
|
11060 + | blob: ::std::option::Option::None,
|
11061 + | boolean: ::std::option::Option::None,
|
11062 + | double: ::std::option::Option::None,
|
11063 + | empty_struct: ::std::option::Option::None,
|
11064 + | float: ::std::option::Option::None,
|
11065 + | httpdate_timestamp: ::std::option::Option::None,
|
11066 + | integer: ::std::option::Option::None,
|
11067 + | iso8601_timestamp: ::std::option::Option::None,
|
11068 + | json_value: ::std::option::Option::None,
|
11069 + | list_of_lists: ::std::option::Option::None,
|
11070 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11071 + | list_of_strings: ::std::option::Option::None,
|
11072 + | list_of_structs: ::std::option::Option::None,
|
11073 + | long: ::std::option::Option::None,
|
11074 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11075 + | map_of_maps: ::std::option::Option::None,
|
11076 + | map_of_strings: ::std::option::Option::None,
|
11077 + | map_of_structs: ::std::option::Option::None,
|
11078 + | recursive_map: ::std::option::Option::None,
|
11079 + | recursive_struct: ::std::option::Option::None,
|
11080 + | simple_struct: ::std::option::Option::None,
|
11081 + | string: ::std::option::Option::None,
|
11082 + | struct_with_json_name: ::std::option::Option::None,
|
11083 + | timestamp: ::std::option::Option::None,
|
11084 + | unix_timestamp: ::std::option::Option::None,
|
11085 + | }]),
|
11086 + | blob: ::std::option::Option::None,
|
11087 + | boolean: ::std::option::Option::None,
|
11088 + | double: ::std::option::Option::None,
|
11089 + | empty_struct: ::std::option::Option::None,
|
11090 + | float: ::std::option::Option::None,
|
11091 + | httpdate_timestamp: ::std::option::Option::None,
|
11092 + | integer: ::std::option::Option::None,
|
11093 + | iso8601_timestamp: ::std::option::Option::None,
|
11094 + | json_value: ::std::option::Option::None,
|
11095 + | list_of_lists: ::std::option::Option::None,
|
11096 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11097 + | list_of_strings: ::std::option::Option::None,
|
11098 + | list_of_structs: ::std::option::Option::None,
|
11099 + | long: ::std::option::Option::None,
|
11100 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11101 + | map_of_maps: ::std::option::Option::None,
|
11102 + | map_of_strings: ::std::option::Option::None,
|
11103 + | map_of_structs: ::std::option::Option::None,
|
11104 + | recursive_map: ::std::option::Option::None,
|
11105 + | recursive_struct: ::std::option::Option::None,
|
11106 + | simple_struct: ::std::option::Option::None,
|
11107 + | string: ::std::option::Option::None,
|
11108 + | struct_with_json_name: ::std::option::Option::None,
|
11109 + | timestamp: ::std::option::Option::None,
|
11110 + | unix_timestamp: ::std::option::Option::None,
|
11111 + | };
|
11112 + | use ::aws_smithy_http_server::response::IntoResponse;
|
11113 + | let http_response = output.into_response();
|
11114 + | ::pretty_assertions::assert_eq!(
|
11115 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11116 + | http_response.status()
|
11117 + | );
|
11118 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11119 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11120 + | http_response.headers(),
|
11121 + | expected_headers,
|
11122 + | ));
|
11123 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11124 + | .await
|
11125 + | .expect("unable to extract body to bytes");
|
11126 + | ::aws_smithy_protocol_test::assert_ok(
|
11127 + | ::aws_smithy_protocol_test::validate_body(&body, "{\"RecursiveList\":[{\"RecursiveList\":[{\"RecursiveList\":[{\"String\":\"value\"}]}]}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
11128 + | );
|
11074 11129 | }
|
11075 - | }
|
11076 - |
|
11077 - | impl<B>
|
11078 - | ::aws_smithy_http_server::request::FromRequest<
|
11079 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11080 - | B,
|
11081 - | > for crate::input::JsonEnumsInput
|
11082 - | where
|
11083 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
11084 - | B: 'static,
|
11085 - |
|
11086 - | B::Data: Send,
|
11087 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
11088 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
11089 - | {
|
11090 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
11091 - | type Future = JsonEnumsInputFuture;
|
11092 - |
|
11093 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
11094 - | let fut = async move {
|
11095 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
11096 - | request.headers(),
|
11097 - | &CONTENT_TYPE_JSONENUMS,
|
11098 - | ) {
|
11099 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
11100 - | }
|
11101 - | crate::protocol_serde::shape_json_enums::de_json_enums_http_request(request)
|
11102 - | .await
|
11103 - | .map_err(Into::into)
|
11130 + | /// Parses map shapes
|
11131 + | /// Test ID: parses_map_shapes
|
11132 + | #[::tokio::test]
|
11133 + | #[::tracing_test::traced_test]
|
11134 + | async fn parses_map_shapes_response() {
|
11135 + | let output = crate::output::KitchenSinkOperationOutput {
|
11136 + | map_of_strings: ::std::option::Option::Some({
|
11137 + | let mut ret = ::std::collections::HashMap::new();
|
11138 + | ret.insert("size".to_owned(), "large".to_owned());
|
11139 + | ret.insert("color".to_owned(), "red".to_owned());
|
11140 + | ret
|
11141 + | }),
|
11142 + | blob: ::std::option::Option::None,
|
11143 + | boolean: ::std::option::Option::None,
|
11144 + | double: ::std::option::Option::None,
|
11145 + | empty_struct: ::std::option::Option::None,
|
11146 + | float: ::std::option::Option::None,
|
11147 + | httpdate_timestamp: ::std::option::Option::None,
|
11148 + | integer: ::std::option::Option::None,
|
11149 + | iso8601_timestamp: ::std::option::Option::None,
|
11150 + | json_value: ::std::option::Option::None,
|
11151 + | list_of_lists: ::std::option::Option::None,
|
11152 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11153 + | list_of_strings: ::std::option::Option::None,
|
11154 + | list_of_structs: ::std::option::Option::None,
|
11155 + | long: ::std::option::Option::None,
|
11156 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11157 + | map_of_maps: ::std::option::Option::None,
|
11158 + | map_of_structs: ::std::option::Option::None,
|
11159 + | recursive_list: ::std::option::Option::None,
|
11160 + | recursive_map: ::std::option::Option::None,
|
11161 + | recursive_struct: ::std::option::Option::None,
|
11162 + | simple_struct: ::std::option::Option::None,
|
11163 + | string: ::std::option::Option::None,
|
11164 + | struct_with_json_name: ::std::option::Option::None,
|
11165 + | timestamp: ::std::option::Option::None,
|
11166 + | unix_timestamp: ::std::option::Option::None,
|
11104 11167 | };
|
11105 - | use ::futures_util::future::TryFutureExt;
|
11106 - | let fut = fut.map_err(
|
11107 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
11108 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
11109 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
11110 - | },
|
11168 + | use ::aws_smithy_http_server::response::IntoResponse;
|
11169 + | let http_response = output.into_response();
|
11170 + | ::pretty_assertions::assert_eq!(
|
11171 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11172 + | http_response.status()
|
11111 11173 | );
|
11112 - | JsonEnumsInputFuture {
|
11113 - | inner: Box::pin(fut),
|
11114 - | }
|
11115 - | }
|
11116 - | }
|
11117 - | impl
|
11118 - | ::aws_smithy_http_server::response::IntoResponse<
|
11119 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11120 - | > for crate::output::JsonEnumsOutput
|
11121 - | {
|
11122 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
11123 - | match crate::protocol_serde::shape_json_enums::ser_json_enums_http_response(self) {
|
11124 - | Ok(response) => response,
|
11125 - | Err(e) => {
|
11126 - | ::tracing::error!(error = %e, "failed to serialize response");
|
11127 - | ::aws_smithy_http_server::response::IntoResponse::<
|
11128 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11129 - | >::into_response(
|
11130 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
11131 - | e,
|
11132 - | ),
|
11133 - | )
|
11134 - | }
|
11135 - | }
|
11174 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11175 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11176 + | http_response.headers(),
|
11177 + | expected_headers,
|
11178 + | ));
|
11179 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11180 + | .await
|
11181 + | .expect("unable to extract body to bytes");
|
11182 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11183 + | &body,
|
11184 + | "{\"MapOfStrings\":{\"size\":\"large\",\"color\":\"red\"}}",
|
11185 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11186 + | ));
|
11136 11187 | }
|
11137 - | }
|
11138 - | impl
|
11139 - | ::aws_smithy_http_server::response::IntoResponse<
|
11140 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11141 - | > for crate::error::JsonEnumsError
|
11142 - | {
|
11143 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
11144 - | match crate::protocol_serde::shape_json_enums::ser_json_enums_http_error(&self) {
|
11145 - | Ok(mut response) => {
|
11146 - | response.extensions_mut().insert(
|
11147 - | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
11188 + | /// Parses map of list shapes
|
11189 + | /// Test ID: parses_map_of_list_shapes
|
11190 + | #[::tokio::test]
|
11191 + | #[::tracing_test::traced_test]
|
11192 + | async fn parses_map_of_list_shapes_response() {
|
11193 + | let output = crate::output::KitchenSinkOperationOutput {
|
11194 + | map_of_lists_of_strings: ::std::option::Option::Some({
|
11195 + | let mut ret = ::std::collections::HashMap::new();
|
11196 + | ret.insert(
|
11197 + | "sizes".to_owned(),
|
11198 + | vec!["large".to_owned(), "small".to_owned()],
|
11148 11199 | );
|
11149 - | response
|
11150 - | }
|
11151 - | Err(e) => {
|
11152 - | ::tracing::error!(error = %e, "failed to serialize response");
|
11153 - | ::aws_smithy_http_server::response::IntoResponse::<
|
11154 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11155 - | >::into_response(
|
11156 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
11157 - | e,
|
11158 - | ),
|
11159 - | )
|
11160 - | }
|
11161 - | }
|
11162 - | }
|
11163 - | }
|
11164 - |
|
11165 - | static CONTENT_TYPE_PUTANDGETINLINEDOCUMENTS: ::once_cell::sync::Lazy<::mime::Mime> =
|
11166 - | ::once_cell::sync::Lazy::new(|| {
|
11167 - | "application/x-amz-json-1.1"
|
11168 - | .parse::<::mime::Mime>()
|
11169 - | .expect("BUG: MIME parsing failed, content_type is not valid")
|
11170 - | });
|
11171 - | ::pin_project_lite::pin_project! {
|
11172 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
11173 - | /// [`PutAndGetInlineDocumentsInput`](crate::input::PutAndGetInlineDocumentsInput) using modelled bindings.
|
11174 - | pub struct PutAndGetInlineDocumentsInputFuture {
|
11175 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::PutAndGetInlineDocumentsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
11176 - | }
|
11177 - | }
|
11178 - |
|
11179 - | impl std::future::Future for PutAndGetInlineDocumentsInputFuture {
|
11180 - | type Output = Result<
|
11181 - | crate::input::PutAndGetInlineDocumentsInput,
|
11182 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
11183 - | >;
|
11184 - |
|
11185 - | fn poll(
|
11186 - | self: std::pin::Pin<&mut Self>,
|
11187 - | cx: &mut std::task::Context<'_>,
|
11188 - | ) -> std::task::Poll<Self::Output> {
|
11189 - | let this = self.project();
|
11190 - | this.inner.as_mut().poll(cx)
|
11200 + | ret.insert(
|
11201 + | "colors".to_owned(),
|
11202 + | vec!["red".to_owned(), "green".to_owned()],
|
11203 + | );
|
11204 + | ret
|
11205 + | }),
|
11206 + | blob: ::std::option::Option::None,
|
11207 + | boolean: ::std::option::Option::None,
|
11208 + | double: ::std::option::Option::None,
|
11209 + | empty_struct: ::std::option::Option::None,
|
11210 + | float: ::std::option::Option::None,
|
11211 + | httpdate_timestamp: ::std::option::Option::None,
|
11212 + | integer: ::std::option::Option::None,
|
11213 + | iso8601_timestamp: ::std::option::Option::None,
|
11214 + | json_value: ::std::option::Option::None,
|
11215 + | list_of_lists: ::std::option::Option::None,
|
11216 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11217 + | list_of_strings: ::std::option::Option::None,
|
11218 + | list_of_structs: ::std::option::Option::None,
|
11219 + | long: ::std::option::Option::None,
|
11220 + | map_of_maps: ::std::option::Option::None,
|
11221 + | map_of_strings: ::std::option::Option::None,
|
11222 + | map_of_structs: ::std::option::Option::None,
|
11223 + | recursive_list: ::std::option::Option::None,
|
11224 + | recursive_map: ::std::option::Option::None,
|
11225 + | recursive_struct: ::std::option::Option::None,
|
11226 + | simple_struct: ::std::option::Option::None,
|
11227 + | string: ::std::option::Option::None,
|
11228 + | struct_with_json_name: ::std::option::Option::None,
|
11229 + | timestamp: ::std::option::Option::None,
|
11230 + | unix_timestamp: ::std::option::Option::None,
|
11231 + | };
|
11232 + | use ::aws_smithy_http_server::response::IntoResponse;
|
11233 + | let http_response = output.into_response();
|
11234 + | ::pretty_assertions::assert_eq!(
|
11235 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11236 + | http_response.status()
|
11237 + | );
|
11238 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11239 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11240 + | http_response.headers(),
|
11241 + | expected_headers,
|
11242 + | ));
|
11243 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11244 + | .await
|
11245 + | .expect("unable to extract body to bytes");
|
11246 + | ::aws_smithy_protocol_test::assert_ok(
|
11247 + | ::aws_smithy_protocol_test::validate_body(&body, "{\"MapOfListsOfStrings\":{\"sizes\":[\"large\",\"small\"],\"colors\":[\"red\",\"green\"]}}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
11248 + | );
|
11191 11249 | }
|
11192 - | }
|
11193 - |
|
11194 - | impl<B>
|
11195 - | ::aws_smithy_http_server::request::FromRequest<
|
11196 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11197 - | B,
|
11198 - | > for crate::input::PutAndGetInlineDocumentsInput
|
11199 - | where
|
11200 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
11201 - | B: 'static,
|
11202 - |
|
11203 - | B::Data: Send,
|
11204 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
11205 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
11206 - | {
|
11207 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
11208 - | type Future = PutAndGetInlineDocumentsInputFuture;
|
11209 - |
|
11210 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
11211 - | let fut = async move {
|
11212 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
11213 - | request.headers(),
|
11214 - | &CONTENT_TYPE_PUTANDGETINLINEDOCUMENTS,
|
11215 - | ) {
|
11216 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
11217 - | }
|
11218 - | crate::protocol_serde::shape_put_and_get_inline_documents::de_put_and_get_inline_documents_http_request(request)
|
11219 - | .await
|
11220 - | .map_err(Into::into)
|
11250 + | /// Parses map of map shapes
|
11251 + | /// Test ID: parses_map_of_map_shapes
|
11252 + | #[::tokio::test]
|
11253 + | #[::tracing_test::traced_test]
|
11254 + | async fn parses_map_of_map_shapes_response() {
|
11255 + | let output = crate::output::KitchenSinkOperationOutput {
|
11256 + | map_of_maps: ::std::option::Option::Some({
|
11257 + | let mut ret = ::std::collections::HashMap::new();
|
11258 + | ret.insert("sizes".to_owned(), {
|
11259 + | let mut ret = ::std::collections::HashMap::new();
|
11260 + | ret.insert("large".to_owned(), "L".to_owned());
|
11261 + | ret.insert("medium".to_owned(), "M".to_owned());
|
11262 + | ret
|
11263 + | });
|
11264 + | ret.insert("colors".to_owned(), {
|
11265 + | let mut ret = ::std::collections::HashMap::new();
|
11266 + | ret.insert("red".to_owned(), "R".to_owned());
|
11267 + | ret.insert("blue".to_owned(), "B".to_owned());
|
11268 + | ret
|
11269 + | });
|
11270 + | ret
|
11271 + | }),
|
11272 + | blob: ::std::option::Option::None,
|
11273 + | boolean: ::std::option::Option::None,
|
11274 + | double: ::std::option::Option::None,
|
11275 + | empty_struct: ::std::option::Option::None,
|
11276 + | float: ::std::option::Option::None,
|
11277 + | httpdate_timestamp: ::std::option::Option::None,
|
11278 + | integer: ::std::option::Option::None,
|
11279 + | iso8601_timestamp: ::std::option::Option::None,
|
11280 + | json_value: ::std::option::Option::None,
|
11281 + | list_of_lists: ::std::option::Option::None,
|
11282 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11283 + | list_of_strings: ::std::option::Option::None,
|
11284 + | list_of_structs: ::std::option::Option::None,
|
11285 + | long: ::std::option::Option::None,
|
11286 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11287 + | map_of_strings: ::std::option::Option::None,
|
11288 + | map_of_structs: ::std::option::Option::None,
|
11289 + | recursive_list: ::std::option::Option::None,
|
11290 + | recursive_map: ::std::option::Option::None,
|
11291 + | recursive_struct: ::std::option::Option::None,
|
11292 + | simple_struct: ::std::option::Option::None,
|
11293 + | string: ::std::option::Option::None,
|
11294 + | struct_with_json_name: ::std::option::Option::None,
|
11295 + | timestamp: ::std::option::Option::None,
|
11296 + | unix_timestamp: ::std::option::Option::None,
|
11221 11297 | };
|
11222 - | use ::futures_util::future::TryFutureExt;
|
11223 - | let fut = fut.map_err(
|
11224 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
11225 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
11226 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
11227 - | },
|
11298 + | use ::aws_smithy_http_server::response::IntoResponse;
|
11299 + | let http_response = output.into_response();
|
11300 + | ::pretty_assertions::assert_eq!(
|
11301 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11302 + | http_response.status()
|
11303 + | );
|
11304 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11305 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11306 + | http_response.headers(),
|
11307 + | expected_headers,
|
11308 + | ));
|
11309 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11310 + | .await
|
11311 + | .expect("unable to extract body to bytes");
|
11312 + | ::aws_smithy_protocol_test::assert_ok(
|
11313 + | ::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"))
|
11228 11314 | );
|
11229 - | PutAndGetInlineDocumentsInputFuture {
|
11230 - | inner: Box::pin(fut),
|
11231 - | }
|
11232 - | }
|
11233 - | }
|
11234 - | impl
|
11235 - | ::aws_smithy_http_server::response::IntoResponse<
|
11236 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11237 - | > for crate::output::PutAndGetInlineDocumentsOutput
|
11238 - | {
|
11239 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
11240 - | match crate::protocol_serde::shape_put_and_get_inline_documents::ser_put_and_get_inline_documents_http_response(self) {
|
11241 - | Ok(response) => response,
|
11242 - | Err(e) => {
|
11243 - | ::tracing::error!(error = %e, "failed to serialize response");
|
11244 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
11245 - | }
|
11246 - | }
|
11247 - | }
|
11248 - | }
|
11249 - |
|
11250 - | static CONTENT_TYPE_OPERATIONWITHOPTIONALINPUTOUTPUT: ::once_cell::sync::Lazy<::mime::Mime> =
|
11251 - | ::once_cell::sync::Lazy::new(|| {
|
11252 - | "application/x-amz-json-1.1"
|
11253 - | .parse::<::mime::Mime>()
|
11254 - | .expect("BUG: MIME parsing failed, content_type is not valid")
|
11255 - | });
|
11256 - | ::pin_project_lite::pin_project! {
|
11257 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
11258 - | /// [`OperationWithOptionalInputOutputInput`](crate::input::OperationWithOptionalInputOutputInput) using modelled bindings.
|
11259 - | pub struct OperationWithOptionalInputOutputInputFuture {
|
11260 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::OperationWithOptionalInputOutputInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
11261 11315 | }
|
11262 - | }
|
11263 - |
|
11264 - | impl std::future::Future for OperationWithOptionalInputOutputInputFuture {
|
11265 - | type Output = Result<
|
11266 - | crate::input::OperationWithOptionalInputOutputInput,
|
11267 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
11268 - | >;
|
11269 - |
|
11270 - | fn poll(
|
11271 - | self: std::pin::Pin<&mut Self>,
|
11272 - | cx: &mut std::task::Context<'_>,
|
11273 - | ) -> std::task::Poll<Self::Output> {
|
11274 - | let this = self.project();
|
11275 - | this.inner.as_mut().poll(cx)
|
11316 + | /// Parses map of structure shapes
|
11317 + | /// Test ID: parses_map_of_structure_shapes
|
11318 + | #[::tokio::test]
|
11319 + | #[::tracing_test::traced_test]
|
11320 + | async fn parses_map_of_structure_shapes_response() {
|
11321 + | let output = crate::output::KitchenSinkOperationOutput {
|
11322 + | map_of_structs: ::std::option::Option::Some({
|
11323 + | let mut ret = ::std::collections::HashMap::new();
|
11324 + | ret.insert(
|
11325 + | "size".to_owned(),
|
11326 + | crate::model::SimpleStruct {
|
11327 + | value: ::std::option::Option::Some("small".to_owned()),
|
11328 + | },
|
11329 + | );
|
11330 + | ret.insert(
|
11331 + | "color".to_owned(),
|
11332 + | crate::model::SimpleStruct {
|
11333 + | value: ::std::option::Option::Some("red".to_owned()),
|
11334 + | },
|
11335 + | );
|
11336 + | ret
|
11337 + | }),
|
11338 + | blob: ::std::option::Option::None,
|
11339 + | boolean: ::std::option::Option::None,
|
11340 + | double: ::std::option::Option::None,
|
11341 + | empty_struct: ::std::option::Option::None,
|
11342 + | float: ::std::option::Option::None,
|
11343 + | httpdate_timestamp: ::std::option::Option::None,
|
11344 + | integer: ::std::option::Option::None,
|
11345 + | iso8601_timestamp: ::std::option::Option::None,
|
11346 + | json_value: ::std::option::Option::None,
|
11347 + | list_of_lists: ::std::option::Option::None,
|
11348 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11349 + | list_of_strings: ::std::option::Option::None,
|
11350 + | list_of_structs: ::std::option::Option::None,
|
11351 + | long: ::std::option::Option::None,
|
11352 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11353 + | map_of_maps: ::std::option::Option::None,
|
11354 + | map_of_strings: ::std::option::Option::None,
|
11355 + | recursive_list: ::std::option::Option::None,
|
11356 + | recursive_map: ::std::option::Option::None,
|
11357 + | recursive_struct: ::std::option::Option::None,
|
11358 + | simple_struct: ::std::option::Option::None,
|
11359 + | string: ::std::option::Option::None,
|
11360 + | struct_with_json_name: ::std::option::Option::None,
|
11361 + | timestamp: ::std::option::Option::None,
|
11362 + | unix_timestamp: ::std::option::Option::None,
|
11363 + | };
|
11364 + | use ::aws_smithy_http_server::response::IntoResponse;
|
11365 + | let http_response = output.into_response();
|
11366 + | ::pretty_assertions::assert_eq!(
|
11367 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11368 + | http_response.status()
|
11369 + | );
|
11370 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11371 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11372 + | http_response.headers(),
|
11373 + | expected_headers,
|
11374 + | ));
|
11375 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11376 + | .await
|
11377 + | .expect("unable to extract body to bytes");
|
11378 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11379 + | &body,
|
11380 + | "{\"MapOfStructs\":{\"size\":{\"Value\":\"small\"},\"color\":{\"Value\":\"red\"}}}",
|
11381 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11382 + | ));
|
11276 11383 | }
|
11277 - | }
|
11278 - |
|
11279 - | impl<B>
|
11280 - | ::aws_smithy_http_server::request::FromRequest<
|
11281 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11282 - | B,
|
11283 - | > for crate::input::OperationWithOptionalInputOutputInput
|
11284 - | where
|
11285 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
11286 - | B: 'static,
|
11287 - |
|
11288 - | B::Data: Send,
|
11289 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
11290 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
11291 - | {
|
11292 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
11293 - | type Future = OperationWithOptionalInputOutputInputFuture;
|
11294 - |
|
11295 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
11296 - | let fut = async move {
|
11297 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
11298 - | request.headers(),
|
11299 - | &CONTENT_TYPE_OPERATIONWITHOPTIONALINPUTOUTPUT,
|
11300 - | ) {
|
11301 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
11302 - | }
|
11303 - | crate::protocol_serde::shape_operation_with_optional_input_output::de_operation_with_optional_input_output_http_request(request)
|
11304 - | .await
|
11305 - | .map_err(Into::into)
|
11384 + | /// Parses map of recursive structure shapes
|
11385 + | /// Test ID: parses_map_of_recursive_structure_shapes
|
11386 + | #[::tokio::test]
|
11387 + | #[::tracing_test::traced_test]
|
11388 + | async fn parses_map_of_recursive_structure_shapes_response() {
|
11389 + | let output = crate::output::KitchenSinkOperationOutput {
|
11390 + | recursive_map: ::std::option::Option::Some({
|
11391 + | let mut ret = ::std::collections::HashMap::new();
|
11392 + | ret.insert(
|
11393 + | "key-1".to_owned(),
|
11394 + | crate::model::KitchenSink {
|
11395 + | recursive_map: ::std::option::Option::Some({
|
11396 + | let mut ret = ::std::collections::HashMap::new();
|
11397 + | ret.insert(
|
11398 + | "key-2".to_owned(),
|
11399 + | crate::model::KitchenSink {
|
11400 + | recursive_map: ::std::option::Option::Some({
|
11401 + | let mut ret = ::std::collections::HashMap::new();
|
11402 + | ret.insert(
|
11403 + | "key-3".to_owned(),
|
11404 + | crate::model::KitchenSink {
|
11405 + | string: ::std::option::Option::Some(
|
11406 + | "value".to_owned(),
|
11407 + | ),
|
11408 + | blob: ::std::option::Option::None,
|
11409 + | boolean: ::std::option::Option::None,
|
11410 + | double: ::std::option::Option::None,
|
11411 + | empty_struct: ::std::option::Option::None,
|
11412 + | float: ::std::option::Option::None,
|
11413 + | httpdate_timestamp: ::std::option::Option::None,
|
11414 + | integer: ::std::option::Option::None,
|
11415 + | iso8601_timestamp: ::std::option::Option::None,
|
11416 + | json_value: ::std::option::Option::None,
|
11417 + | list_of_lists: ::std::option::Option::None,
|
11418 + | list_of_maps_of_strings:
|
11419 + | ::std::option::Option::None,
|
11420 + | list_of_strings: ::std::option::Option::None,
|
11421 + | list_of_structs: ::std::option::Option::None,
|
11422 + | long: ::std::option::Option::None,
|
11423 + | map_of_lists_of_strings:
|
11424 + | ::std::option::Option::None,
|
11425 + | map_of_maps: ::std::option::Option::None,
|
11426 + | map_of_strings: ::std::option::Option::None,
|
11427 + | map_of_structs: ::std::option::Option::None,
|
11428 + | recursive_list: ::std::option::Option::None,
|
11429 + | recursive_map: ::std::option::Option::None,
|
11430 + | recursive_struct: ::std::option::Option::None,
|
11431 + | simple_struct: ::std::option::Option::None,
|
11432 + | struct_with_json_name: ::std::option::Option::None,
|
11433 + | timestamp: ::std::option::Option::None,
|
11434 + | unix_timestamp: ::std::option::Option::None,
|
11435 + | },
|
11436 + | );
|
11437 + | ret
|
11438 + | }),
|
11439 + | blob: ::std::option::Option::None,
|
11440 + | boolean: ::std::option::Option::None,
|
11441 + | double: ::std::option::Option::None,
|
11442 + | empty_struct: ::std::option::Option::None,
|
11443 + | float: ::std::option::Option::None,
|
11444 + | httpdate_timestamp: ::std::option::Option::None,
|
11445 + | integer: ::std::option::Option::None,
|
11446 + | iso8601_timestamp: ::std::option::Option::None,
|
11447 + | json_value: ::std::option::Option::None,
|
11448 + | list_of_lists: ::std::option::Option::None,
|
11449 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11450 + | list_of_strings: ::std::option::Option::None,
|
11451 + | list_of_structs: ::std::option::Option::None,
|
11452 + | long: ::std::option::Option::None,
|
11453 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11454 + | map_of_maps: ::std::option::Option::None,
|
11455 + | map_of_strings: ::std::option::Option::None,
|
11456 + | map_of_structs: ::std::option::Option::None,
|
11457 + | recursive_list: ::std::option::Option::None,
|
11458 + | recursive_struct: ::std::option::Option::None,
|
11459 + | simple_struct: ::std::option::Option::None,
|
11460 + | string: ::std::option::Option::None,
|
11461 + | struct_with_json_name: ::std::option::Option::None,
|
11462 + | timestamp: ::std::option::Option::None,
|
11463 + | unix_timestamp: ::std::option::Option::None,
|
11464 + | },
|
11465 + | );
|
11466 + | ret
|
11467 + | }),
|
11468 + | blob: ::std::option::Option::None,
|
11469 + | boolean: ::std::option::Option::None,
|
11470 + | double: ::std::option::Option::None,
|
11471 + | empty_struct: ::std::option::Option::None,
|
11472 + | float: ::std::option::Option::None,
|
11473 + | httpdate_timestamp: ::std::option::Option::None,
|
11474 + | integer: ::std::option::Option::None,
|
11475 + | iso8601_timestamp: ::std::option::Option::None,
|
11476 + | json_value: ::std::option::Option::None,
|
11477 + | list_of_lists: ::std::option::Option::None,
|
11478 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11479 + | list_of_strings: ::std::option::Option::None,
|
11480 + | list_of_structs: ::std::option::Option::None,
|
11481 + | long: ::std::option::Option::None,
|
11482 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11483 + | map_of_maps: ::std::option::Option::None,
|
11484 + | map_of_strings: ::std::option::Option::None,
|
11485 + | map_of_structs: ::std::option::Option::None,
|
11486 + | recursive_list: ::std::option::Option::None,
|
11487 + | recursive_struct: ::std::option::Option::None,
|
11488 + | simple_struct: ::std::option::Option::None,
|
11489 + | string: ::std::option::Option::None,
|
11490 + | struct_with_json_name: ::std::option::Option::None,
|
11491 + | timestamp: ::std::option::Option::None,
|
11492 + | unix_timestamp: ::std::option::Option::None,
|
11493 + | },
|
11494 + | );
|
11495 + | ret
|
11496 + | }),
|
11497 + | blob: ::std::option::Option::None,
|
11498 + | boolean: ::std::option::Option::None,
|
11499 + | double: ::std::option::Option::None,
|
11500 + | empty_struct: ::std::option::Option::None,
|
11501 + | float: ::std::option::Option::None,
|
11502 + | httpdate_timestamp: ::std::option::Option::None,
|
11503 + | integer: ::std::option::Option::None,
|
11504 + | iso8601_timestamp: ::std::option::Option::None,
|
11505 + | json_value: ::std::option::Option::None,
|
11506 + | list_of_lists: ::std::option::Option::None,
|
11507 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11508 + | list_of_strings: ::std::option::Option::None,
|
11509 + | list_of_structs: ::std::option::Option::None,
|
11510 + | long: ::std::option::Option::None,
|
11511 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11512 + | map_of_maps: ::std::option::Option::None,
|
11513 + | map_of_strings: ::std::option::Option::None,
|
11514 + | map_of_structs: ::std::option::Option::None,
|
11515 + | recursive_list: ::std::option::Option::None,
|
11516 + | recursive_struct: ::std::option::Option::None,
|
11517 + | simple_struct: ::std::option::Option::None,
|
11518 + | string: ::std::option::Option::None,
|
11519 + | struct_with_json_name: ::std::option::Option::None,
|
11520 + | timestamp: ::std::option::Option::None,
|
11521 + | unix_timestamp: ::std::option::Option::None,
|
11306 11522 | };
|
11307 - | use ::futures_util::future::TryFutureExt;
|
11308 - | let fut = fut.map_err(
|
11309 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
11310 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
11311 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
11312 - | },
|
11523 + | use ::aws_smithy_http_server::response::IntoResponse;
|
11524 + | let http_response = output.into_response();
|
11525 + | ::pretty_assertions::assert_eq!(
|
11526 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11527 + | http_response.status()
|
11313 11528 | );
|
11314 - | OperationWithOptionalInputOutputInputFuture {
|
11315 - | inner: Box::pin(fut),
|
11316 - | }
|
11317 - | }
|
11318 - | }
|
11319 - | impl
|
11320 - | ::aws_smithy_http_server::response::IntoResponse<
|
11321 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11322 - | > for crate::output::OperationWithOptionalInputOutputOutput
|
11323 - | {
|
11324 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
11325 - | match crate::protocol_serde::shape_operation_with_optional_input_output::ser_operation_with_optional_input_output_http_response(self) {
|
11326 - | Ok(response) => response,
|
11327 - | Err(e) => {
|
11328 - | ::tracing::error!(error = %e, "failed to serialize response");
|
11329 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
11330 - | }
|
11331 - | }
|
11332 - | }
|
11333 - | }
|
11334 - |
|
11335 - | static CONTENT_TYPE_SIMPLESCALARPROPERTIES: ::once_cell::sync::Lazy<::mime::Mime> =
|
11336 - | ::once_cell::sync::Lazy::new(|| {
|
11337 - | "application/x-amz-json-1.1"
|
11338 - | .parse::<::mime::Mime>()
|
11339 - | .expect("BUG: MIME parsing failed, content_type is not valid")
|
11340 - | });
|
11341 - | ::pin_project_lite::pin_project! {
|
11342 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
11343 - | /// [`SimpleScalarPropertiesInput`](crate::input::SimpleScalarPropertiesInput) using modelled bindings.
|
11344 - | pub struct SimpleScalarPropertiesInputFuture {
|
11345 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SimpleScalarPropertiesInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
11346 - | }
|
11347 - | }
|
11348 - |
|
11349 - | impl std::future::Future for SimpleScalarPropertiesInputFuture {
|
11350 - | type Output = Result<
|
11351 - | crate::input::SimpleScalarPropertiesInput,
|
11352 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
11353 - | >;
|
11354 - |
|
11355 - | fn poll(
|
11356 - | self: std::pin::Pin<&mut Self>,
|
11357 - | cx: &mut std::task::Context<'_>,
|
11358 - | ) -> std::task::Poll<Self::Output> {
|
11359 - | let this = self.project();
|
11360 - | this.inner.as_mut().poll(cx)
|
11361 - | }
|
11362 - | }
|
11363 - |
|
11364 - | impl<B>
|
11365 - | ::aws_smithy_http_server::request::FromRequest<
|
11366 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11367 - | B,
|
11368 - | > for crate::input::SimpleScalarPropertiesInput
|
11369 - | where
|
11370 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
11371 - | B: 'static,
|
11372 - |
|
11373 - | B::Data: Send,
|
11374 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
11375 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
11376 - | {
|
11377 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
11378 - | type Future = SimpleScalarPropertiesInputFuture;
|
11379 - |
|
11380 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
11381 - | let fut = async move {
|
11382 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
11383 - | request.headers(),
|
11384 - | &CONTENT_TYPE_SIMPLESCALARPROPERTIES,
|
11385 - | ) {
|
11386 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
11387 - | }
|
11388 - | crate::protocol_serde::shape_simple_scalar_properties::de_simple_scalar_properties_http_request(request)
|
11389 - | .await
|
11390 - | .map_err(Into::into)
|
11391 - | };
|
11392 - | use ::futures_util::future::TryFutureExt;
|
11393 - | let fut = fut.map_err(
|
11394 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
11395 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
11396 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
11397 - | },
|
11529 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11530 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11531 + | http_response.headers(),
|
11532 + | expected_headers,
|
11533 + | ));
|
11534 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11535 + | .await
|
11536 + | .expect("unable to extract body to bytes");
|
11537 + | ::aws_smithy_protocol_test::assert_ok(
|
11538 + | ::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"))
|
11398 11539 | );
|
11399 - | SimpleScalarPropertiesInputFuture {
|
11400 - | inner: Box::pin(fut),
|
11401 - | }
|
11402 - | }
|
11403 - | }
|
11404 - | impl
|
11405 - | ::aws_smithy_http_server::response::IntoResponse<
|
11406 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11407 - | > for crate::output::SimpleScalarPropertiesOutput
|
11408 - | {
|
11409 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
11410 - | match crate::protocol_serde::shape_simple_scalar_properties::ser_simple_scalar_properties_http_response(self) {
|
11411 - | Ok(response) => response,
|
11412 - | Err(e) => {
|
11413 - | ::tracing::error!(error = %e, "failed to serialize response");
|
11414 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
11415 - | }
|
11416 - | }
|
11417 - | }
|
11418 - | }
|
11419 - |
|
11420 - | static CONTENT_TYPE_KITCHENSINKOPERATION: ::once_cell::sync::Lazy<::mime::Mime> =
|
11421 - | ::once_cell::sync::Lazy::new(|| {
|
11422 - | "application/x-amz-json-1.1"
|
11423 - | .parse::<::mime::Mime>()
|
11424 - | .expect("BUG: MIME parsing failed, content_type is not valid")
|
11425 - | });
|
11426 - | ::pin_project_lite::pin_project! {
|
11427 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
11428 - | /// [`KitchenSinkOperationInput`](crate::input::KitchenSinkOperationInput) using modelled bindings.
|
11429 - | pub struct KitchenSinkOperationInputFuture {
|
11430 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::KitchenSinkOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
11431 - | }
|
11432 - | }
|
11433 - |
|
11434 - | impl std::future::Future for KitchenSinkOperationInputFuture {
|
11435 - | type Output = Result<
|
11436 - | crate::input::KitchenSinkOperationInput,
|
11437 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
11438 - | >;
|
11439 - |
|
11440 - | fn poll(
|
11441 - | self: std::pin::Pin<&mut Self>,
|
11442 - | cx: &mut std::task::Context<'_>,
|
11443 - | ) -> std::task::Poll<Self::Output> {
|
11444 - | let this = self.project();
|
11445 - | this.inner.as_mut().poll(cx)
|
11446 11540 | }
|
11447 - | }
|
11448 - |
|
11449 - | impl<B>
|
11450 - | ::aws_smithy_http_server::request::FromRequest<
|
11451 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11452 - | B,
|
11453 - | > for crate::input::KitchenSinkOperationInput
|
11454 - | where
|
11455 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
11456 - | B: 'static,
|
11457 - |
|
11458 - | B::Data: Send,
|
11459 - | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
11460 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
11461 - | {
|
11462 - | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
11463 - | type Future = KitchenSinkOperationInputFuture;
|
11464 - |
|
11465 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
11466 - | let fut = async move {
|
11467 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
11468 - | request.headers(),
|
11469 - | &CONTENT_TYPE_KITCHENSINKOPERATION,
|
11470 - | ) {
|
11471 - | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
11472 - | }
|
11473 - | crate::protocol_serde::shape_kitchen_sink_operation::de_kitchen_sink_operation_http_request(request)
|
11474 - | .await
|
11475 - | .map_err(Into::into)
|
11541 + | /// Parses the request id from the response
|
11542 + | /// Test ID: parses_the_request_id_from_the_response
|
11543 + | #[::tokio::test]
|
11544 + | #[::tracing_test::traced_test]
|
11545 + | #[should_panic]
|
11546 + | async fn parses_the_request_id_from_the_response_response() {
|
11547 + | let output = crate::output::KitchenSinkOperationOutput {
|
11548 + | blob: ::std::option::Option::None,
|
11549 + | boolean: ::std::option::Option::None,
|
11550 + | double: ::std::option::Option::None,
|
11551 + | empty_struct: ::std::option::Option::None,
|
11552 + | float: ::std::option::Option::None,
|
11553 + | httpdate_timestamp: ::std::option::Option::None,
|
11554 + | integer: ::std::option::Option::None,
|
11555 + | iso8601_timestamp: ::std::option::Option::None,
|
11556 + | json_value: ::std::option::Option::None,
|
11557 + | list_of_lists: ::std::option::Option::None,
|
11558 + | list_of_maps_of_strings: ::std::option::Option::None,
|
11559 + | list_of_strings: ::std::option::Option::None,
|
11560 + | list_of_structs: ::std::option::Option::None,
|
11561 + | long: ::std::option::Option::None,
|
11562 + | map_of_lists_of_strings: ::std::option::Option::None,
|
11563 + | map_of_maps: ::std::option::Option::None,
|
11564 + | map_of_strings: ::std::option::Option::None,
|
11565 + | map_of_structs: ::std::option::Option::None,
|
11566 + | recursive_list: ::std::option::Option::None,
|
11567 + | recursive_map: ::std::option::Option::None,
|
11568 + | recursive_struct: ::std::option::Option::None,
|
11569 + | simple_struct: ::std::option::Option::None,
|
11570 + | string: ::std::option::Option::None,
|
11571 + | struct_with_json_name: ::std::option::Option::None,
|
11572 + | timestamp: ::std::option::Option::None,
|
11573 + | unix_timestamp: ::std::option::Option::None,
|
11476 11574 | };
|
11477 - | use ::futures_util::future::TryFutureExt;
|
11478 - | let fut = fut.map_err(
|
11479 - | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
11480 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
11481 - | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
11482 - | },
|
11575 + | use ::aws_smithy_http_server::response::IntoResponse;
|
11576 + | let http_response = output.into_response();
|
11577 + | ::pretty_assertions::assert_eq!(
|
11578 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11579 + | http_response.status()
|
11483 11580 | );
|
11484 - | KitchenSinkOperationInputFuture {
|
11485 - | inner: Box::pin(fut),
|
11486 - | }
|
11487 - | }
|
11488 - | }
|
11489 - | impl
|
11490 - | ::aws_smithy_http_server::response::IntoResponse<
|
11491 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11492 - | > for crate::output::KitchenSinkOperationOutput
|
11493 - | {
|
11494 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
11495 - | match crate::protocol_serde::shape_kitchen_sink_operation::ser_kitchen_sink_operation_http_response(self) {
|
11496 - | Ok(response) => response,
|
11497 - | Err(e) => {
|
11498 - | ::tracing::error!(error = %e, "failed to serialize response");
|
11499 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
11500 - | }
|
11501 - | }
|
11502 - | }
|
11503 - | }
|
11504 - | impl
|
11505 - | ::aws_smithy_http_server::response::IntoResponse<
|
11506 - | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
11507 - | > for crate::error::KitchenSinkOperationError
|
11508 - | {
|
11509 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
11510 - | match crate::protocol_serde::shape_kitchen_sink_operation::ser_kitchen_sink_operation_http_error(&self) {
|
11511 - | Ok(mut response) => {
|
11512 - | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
11513 - | response
|
11514 - | },
|
11515 - | Err(e) => {
|
11516 - | ::tracing::error!(error = %e, "failed to serialize response");
|
11517 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
11518 - | }
|
11519 - | }
|
11581 + | let expected_headers = [
|
11582 + | ("Content-Type", "application/x-amz-json-1.1"),
|
11583 + | ("X-Amzn-Requestid", "amazon-uniq-request-id"),
|
11584 + | ];
|
11585 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11586 + | http_response.headers(),
|
11587 + | expected_headers,
|
11588 + | ));
|
11589 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11590 + | .await
|
11591 + | .expect("unable to extract body to bytes");
|
11592 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11593 + | &body,
|
11594 + | "{}",
|
11595 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11596 + | ));
|
11520 11597 | }
|
11521 11598 | }
|
11522 11599 |
|
11523 11600 | static CONTENT_TYPE_EMPTYOPERATION: ::once_cell::sync::Lazy<::mime::Mime> =
|
11524 11601 | ::once_cell::sync::Lazy::new(|| {
|
11525 11602 | "application/x-amz-json-1.1"
|
11526 11603 | .parse::<::mime::Mime>()
|
11527 11604 | .expect("BUG: MIME parsing failed, content_type is not valid")
|
11528 11605 | });
|
11529 11606 | ::pin_project_lite::pin_project! {
|