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
|
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>>
|
32 13 | }
|
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());
|
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)
|
39 28 | }
|
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
|
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);
|
67 54 | }
|
68 - | })
|
69 - | .build_unchecked();
|
70 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
55 + | crate::protocol_serde::shape_put_with_content_encoding::de_put_with_content_encoding_http_request(request)
|
71 56 | .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
|
57 + | .map_err(Into::into)
|
106 58 | };
|
107 - | sender.send(()).await.expect("receiver dropped early");
|
108 - | result
|
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 + | },
|
65 + | );
|
66 + | PutWithContentEncodingInputFuture {
|
67 + | inner: Box::pin(fut),
|
109 68 | }
|
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());
|
116 69 | }
|
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
|
70 + | }
|
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))
|
150 82 | }
|
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());
|
157 83 | }
|
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()
|
172 - | );
|
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(), "");
|
183 84 | }
|
184 85 | }
|
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
|
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>>
|
220 98 | }
|
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());
|
99 + | }
|
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)
|
227 113 | }
|
228 114 | }
|
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
|
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);
|
271 139 | }
|
272 - | },
|
140 + | crate::protocol_serde::shape_fractional_seconds::de_fractional_seconds_http_request(
|
141 + | request,
|
273 142 | )
|
274 - | .build_unchecked();
|
275 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
276 143 | .await
|
277 - | .expect("unable to make an HTTP request");
|
278 - | assert!(receiver.recv().await.is_some());
|
279 - | }
|
280 - | }
|
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()),
|
144 + | .map_err(Into::into)
|
290 145 | };
|
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()
|
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 + | },
|
297 152 | );
|
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 - | ));
|
153 + | FractionalSecondsInputFuture {
|
154 + | inner: Box::pin(fut),
|
155 + | }
|
156 + | }
|
157 + | }
|
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 + | )
|
311 177 | }
|
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())
|
335 - | .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 178 | }
|
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,
|
347 - | };
|
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()
|
354 - | );
|
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 - | ));
|
368 179 | }
|
369 180 | }
|
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
|
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>>
|
453 193 | }
|
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());
|
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)
|
460 208 | }
|
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 - | }),
|
512 - | };
|
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())
|
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)
|
525 236 | .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"))
|
237 + | .map_err(Into::into)
|
238 + | };
|
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()),
|
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,
|
562 268 | ),
|
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
|
269 + | )
|
572 270 | }
|
573 - | })
|
574 - | .build_unchecked();
|
575 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
271 + | }
|
272 + | }
|
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)
|
576 329 | .await
|
577 - | .expect("unable to make an HTTP request");
|
578 - | assert!(receiver.recv().await.is_some());
|
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),
|
579 341 | }
|
580 - | /// Serializes a boolean union value
|
581 - | /// Test ID: AwsJson11SerializeBooleanUnionValue
|
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| {
|
493 + | .endpoint_with_host_label_operation(
|
494 + | move |input: crate::input::EndpointWithHostLabelOperationInput| {
|
601 495 | let sender = sender.clone();
|
602 496 | async move {
|
603 497 | let result = {
|
604 - | let expected = crate::input::JsonUnionsInput {
|
605 - | contents: ::std::option::Option::Some(
|
606 - | crate::model::MyUnion::BooleanValue(true),
|
607 - | ),
|
498 + | let expected = crate::input::EndpointWithHostLabelOperationInput {
|
499 + | label: "bar".to_owned(),
|
608 500 | };
|
609 501 | ::pretty_assertions::assert_eq!(input, expected);
|
610 - | let response = crate::output::JsonUnionsOutput {
|
611 - | contents: ::std::option::Option::None,
|
612 - | };
|
502 + | let response = crate::output::EndpointWithHostLabelOperationOutput {};
|
613 503 | Ok(response)
|
614 504 | };
|
615 505 | sender.send(()).await.expect("receiver dropped early");
|
616 506 | result
|
617 507 | }
|
618 - | })
|
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
|
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>>
|
662 532 | }
|
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());
|
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)
|
669 547 | }
|
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
|
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);
|
709 573 | }
|
710 - | })
|
711 - | .build_unchecked();
|
712 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
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),
|
716 589 | }
|
717 - | /// Serializes a timestamp union value
|
718 - | /// Test ID: AwsJson11SerializeTimestampUnionValue
|
719 - | #[::tokio::test]
|
720 - | async fn aws_json11_serialize_timestamp_union_value_request() {
|
721 - | #[allow(unused_mut)]
|
722 - | let mut http_request = http::Request::builder()
|
723 - | .uri("/")
|
724 - | .method("POST")
|
725 - | .header("Content-Type", "application/x-amz-json-1.1")
|
726 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
727 - | .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 - | ),
|
732 - | ))
|
733 - | .unwrap();
|
734 - | #[allow(unused_mut)]
|
735 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
736 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
737 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
738 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
739 - | let sender = sender.clone();
|
740 - | async move {
|
741 - | 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 - | ),
|
590 + | }
|
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,
|
749 609 | ),
|
750 - | };
|
751 - | ::pretty_assertions::assert_eq!(input, expected);
|
752 - | let response = crate::output::JsonUnionsOutput {
|
753 - | contents: ::std::option::Option::None,
|
754 - | };
|
755 - | Ok(response)
|
756 - | };
|
757 - | sender.send(()).await.expect("receiver dropped early");
|
758 - | result
|
610 + | )
|
759 611 | }
|
760 - | })
|
761 - | .build_unchecked();
|
762 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
763 - | .await
|
764 - | .expect("unable to make an HTTP request");
|
765 - | assert!(receiver.recv().await.is_some());
|
766 612 | }
|
767 - | /// Serializes an enum union value
|
768 - | /// Test ID: AwsJson11SerializeEnumUnionValue
|
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
|
769 623 | #[::tokio::test]
|
770 - | async fn aws_json11_serialize_enum_union_value_request() {
|
624 + | #[::tracing_test::traced_test]
|
625 + | #[should_panic]
|
626 + | async fn aws_json11_endpoint_trait_request() {
|
771 627 | #[allow(unused_mut)]
|
772 628 | let mut http_request = http::Request::builder()
|
773 629 | .uri("/")
|
774 630 | .method("POST")
|
775 631 | .header("Content-Type", "application/x-amz-json-1.1")
|
776 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
632 + | .header("X-Amz-Target", "JsonProtocol.EndpointOperation")
|
777 633 | .body(::aws_smithy_http_server::body::Body::from(
|
778 - | ::bytes::Bytes::from_static(
|
779 - | "{\n \"contents\": {\n \"enumValue\": \"Foo\"\n }\n}".as_bytes(),
|
780 - | ),
|
634 + | ::bytes::Bytes::from_static("{}".as_bytes()),
|
781 635 | ))
|
782 636 | .unwrap();
|
637 + | todo!("endpoint trait not supported yet");
|
783 638 | #[allow(unused_mut)]
|
784 639 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
785 640 | let config = crate::service::JsonProtocolConfig::builder().build();
|
786 641 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
787 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
642 + | .endpoint_operation(move |input: crate::input::EndpointOperationInput| {
|
788 643 | let sender = sender.clone();
|
789 644 | async move {
|
790 645 | let result = {
|
791 - | let expected = crate::input::JsonUnionsInput {
|
792 - | 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 - | ),
|
798 - | ),
|
799 - | };
|
646 + | let expected = crate::input::EndpointOperationInput {};
|
800 647 | ::pretty_assertions::assert_eq!(input, expected);
|
801 - | let response = crate::output::JsonUnionsOutput {
|
802 - | contents: ::std::option::Option::None,
|
803 - | };
|
804 - | Ok(response)
|
648 + | let response = crate::output::EndpointOperationOutput {};
|
649 + | response
|
805 650 | };
|
806 651 | sender.send(()).await.expect("receiver dropped early");
|
807 652 | result
|
808 653 | }
|
809 654 | })
|
810 655 | .build_unchecked();
|
811 656 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
812 657 | .await
|
813 658 | .expect("unable to make an HTTP request");
|
814 - | 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 + | );
|
815 663 | }
|
816 - | /// Serializes a list union value
|
817 - | /// Test ID: AwsJson11SerializeListUnionValue
|
818 - | #[::tokio::test]
|
819 - | async fn aws_json11_serialize_list_union_value_request() {
|
820 - | #[allow(unused_mut)]
|
821 - | let mut http_request = http::Request::builder()
|
822 - | .uri("/")
|
823 - | .method("POST")
|
824 - | .header("Content-Type", "application/x-amz-json-1.1")
|
825 - | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
826 - | .body(::aws_smithy_http_server::body::Body::from(
|
827 - | ::bytes::Bytes::from_static(
|
828 - | "{\n \"contents\": {\n \"listValue\": [\"foo\", \"bar\"]\n }\n}"
|
829 - | .as_bytes(),
|
830 - | ),
|
831 - | ))
|
832 - | .unwrap();
|
833 - | #[allow(unused_mut)]
|
834 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
835 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
836 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
837 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
838 - | let sender = sender.clone();
|
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| {
|
809 + | let sender = sender.clone();
|
839 810 | async move {
|
840 811 | let result = {
|
841 812 | let expected = crate::input::JsonUnionsInput {
|
842 813 | contents: ::std::option::Option::Some(
|
843 - | crate::model::MyUnion::ListValue(vec![
|
844 - | "foo".to_owned(),
|
845 - | "bar".to_owned(),
|
846 - | ]),
|
814 + | crate::model::MyUnion::StringValue("foo".to_owned()),
|
847 815 | ),
|
848 816 | };
|
849 817 | ::pretty_assertions::assert_eq!(input, expected);
|
850 818 | let response = crate::output::JsonUnionsOutput {
|
851 819 | contents: ::std::option::Option::None,
|
852 820 | };
|
853 821 | Ok(response)
|
854 822 | };
|
855 823 | sender.send(()).await.expect("receiver dropped early");
|
856 824 | result
|
857 825 | }
|
858 826 | })
|
859 827 | .build_unchecked();
|
860 828 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
861 829 | .await
|
862 830 | .expect("unable to make an HTTP request");
|
863 - | 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 + | );
|
864 835 | }
|
865 - | /// Serializes a map union value
|
866 - | /// Test ID: AwsJson11SerializeMapUnionValue
|
836 + | /// Serializes a boolean union value
|
837 + | /// Test ID: AwsJson11SerializeBooleanUnionValue
|
867 838 | #[::tokio::test]
|
868 - | async fn aws_json11_serialize_map_union_value_request() {
|
839 + | #[::tracing_test::traced_test]
|
840 + | async fn aws_json11_serialize_boolean_union_value_request() {
|
869 841 | #[allow(unused_mut)]
|
870 842 | let mut http_request = http::Request::builder()
|
871 843 | .uri("/")
|
872 844 | .method("POST")
|
873 845 | .header("Content-Type", "application/x-amz-json-1.1")
|
874 846 | .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();
|
847 + | .body(::aws_smithy_http_server::body::Body::from(
|
848 + | ::bytes::Bytes::from_static(
|
849 + | "{\n \"contents\": {\n \"booleanValue\": true\n }\n}".as_bytes(),
|
850 + | ),
|
851 + | ))
|
852 + | .unwrap();
|
876 853 | #[allow(unused_mut)]
|
877 854 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
878 855 | let config = crate::service::JsonProtocolConfig::builder().build();
|
879 856 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
880 857 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
881 858 | let sender = sender.clone();
|
882 859 | async move {
|
883 860 | let result = {
|
884 861 | 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 - | )),
|
862 + | contents: ::std::option::Option::Some(
|
863 + | crate::model::MyUnion::BooleanValue(true),
|
864 + | ),
|
893 865 | };
|
894 866 | ::pretty_assertions::assert_eq!(input, expected);
|
895 867 | let response = crate::output::JsonUnionsOutput {
|
896 868 | contents: ::std::option::Option::None,
|
897 869 | };
|
898 870 | Ok(response)
|
899 871 | };
|
900 872 | sender.send(()).await.expect("receiver dropped early");
|
901 873 | result
|
902 874 | }
|
903 875 | })
|
904 876 | .build_unchecked();
|
905 877 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
906 878 | .await
|
907 879 | .expect("unable to make an HTTP request");
|
908 - | 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 + | );
|
909 884 | }
|
910 - | /// Serializes a structure union value
|
911 - | /// Test ID: AwsJson11SerializeStructureUnionValue
|
885 + | /// Serializes a number union value
|
886 + | /// Test ID: AwsJson11SerializeNumberUnionValue
|
912 887 | #[::tokio::test]
|
913 - | async fn aws_json11_serialize_structure_union_value_request() {
|
888 + | #[::tracing_test::traced_test]
|
889 + | async fn aws_json11_serialize_number_union_value_request() {
|
914 890 | #[allow(unused_mut)]
|
915 891 | let mut http_request = http::Request::builder()
|
916 892 | .uri("/")
|
917 893 | .method("POST")
|
918 894 | .header("Content-Type", "application/x-amz-json-1.1")
|
919 895 | .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();
|
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();
|
921 902 | #[allow(unused_mut)]
|
922 903 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
923 904 | let config = crate::service::JsonProtocolConfig::builder().build();
|
924 905 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
925 906 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
926 907 | let sender = sender.clone();
|
927 908 | async move {
|
928 909 | let result = {
|
929 910 | let expected = crate::input::JsonUnionsInput {
|
930 911 | 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 - | ),
|
912 + | crate::model::MyUnion::NumberValue(1),
|
936 913 | ),
|
937 914 | };
|
938 915 | ::pretty_assertions::assert_eq!(input, expected);
|
939 916 | let response = crate::output::JsonUnionsOutput {
|
940 917 | contents: ::std::option::Option::None,
|
941 918 | };
|
942 919 | Ok(response)
|
943 920 | };
|
944 921 | sender.send(()).await.expect("receiver dropped early");
|
945 922 | result
|
946 923 | }
|
947 924 | })
|
948 925 | .build_unchecked();
|
949 926 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
950 927 | .await
|
951 928 | .expect("unable to make an HTTP request");
|
952 - | 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 + | );
|
953 933 | }
|
954 - | /// Deserializes a string union value
|
955 - | /// Test ID: AwsJson11DeserializeStringUnionValue
|
934 + | /// Serializes a blob union value
|
935 + | /// Test ID: AwsJson11SerializeBlobUnionValue
|
956 936 | #[::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(),
|
937 + | #[::tracing_test::traced_test]
|
938 + | async fn aws_json11_serialize_blob_union_value_request() {
|
939 + | #[allow(unused_mut)]
|
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();
|
951 + | #[allow(unused_mut)]
|
952 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
953 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
954 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
955 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
956 + | let sender = sender.clone();
|
957 + | async move {
|
958 + | let result = {
|
959 + | let expected = crate::input::JsonUnionsInput {
|
960 + | contents: ::std::option::Option::Some(
|
961 + | crate::model::MyUnion::BlobValue(::aws_smithy_types::Blob::new(
|
962 + | "foo",
|
961 963 | )),
|
964 + | ),
|
962 965 | };
|
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())
|
966 + | ::pretty_assertions::assert_eq!(input, expected);
|
967 + | let response = crate::output::JsonUnionsOutput {
|
968 + | contents: ::std::option::Option::None,
|
969 + | };
|
970 + | Ok(response)
|
971 + | };
|
972 + | sender.send(()).await.expect("receiver dropped early");
|
973 + | result
|
974 + | }
|
975 + | })
|
976 + | .build_unchecked();
|
977 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
975 978 | .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 - | ));
|
982 - | }
|
983 - | /// Deserializes a boolean union value
|
984 - | /// Test ID: AwsJson11DeserializeBooleanUnionValue
|
985 - | #[::tokio::test]
|
986 - | async fn aws_json11_deserialize_boolean_union_value_response() {
|
987 - | let output = crate::output::JsonUnionsOutput {
|
988 - | contents: ::std::option::Option::Some(crate::model::MyUnion::BooleanValue(true)),
|
989 - | };
|
990 - | use ::aws_smithy_http_server::response::IntoResponse;
|
991 - | let http_response = output.into_response();
|
992 - | ::pretty_assertions::assert_eq!(
|
993 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
994 - | http_response.status()
|
979 + | .expect("unable to make an HTTP request");
|
980 + | assert!(
|
981 + | receiver.recv().await.is_some(),
|
982 + | "we expected operation handler to be invoked but it was not entered"
|
995 983 | );
|
996 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
997 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
998 - | http_response.headers(),
|
999 - | expected_headers,
|
1000 - | ));
|
1001 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1002 - | .await
|
1003 - | .expect("unable to extract body to bytes");
|
1004 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1005 - | &body,
|
1006 - | "{\n \"contents\": {\n \"booleanValue\": true\n }\n}",
|
1007 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1008 - | ));
|
1009 984 | }
|
1010 - | /// Deserializes a number union value
|
1011 - | /// Test ID: AwsJson11DeserializeNumberUnionValue
|
985 + | /// Serializes a timestamp union value
|
986 + | /// Test ID: AwsJson11SerializeTimestampUnionValue
|
1012 987 | #[::tokio::test]
|
1013 - | async fn aws_json11_deserialize_number_union_value_response() {
|
1014 - | let output = crate::output::JsonUnionsOutput {
|
1015 - | contents: ::std::option::Option::Some(crate::model::MyUnion::NumberValue(1)),
|
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 + | ),
|
1016 1019 | };
|
1017 - | use ::aws_smithy_http_server::response::IntoResponse;
|
1018 - | let http_response = output.into_response();
|
1019 - | ::pretty_assertions::assert_eq!(
|
1020 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1021 - | http_response.status()
|
1022 - | );
|
1023 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1024 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1025 - | http_response.headers(),
|
1026 - | expected_headers,
|
1027 - | ));
|
1028 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1029 - | .await
|
1030 - | .expect("unable to extract body to bytes");
|
1031 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1032 - | &body,
|
1033 - | "{\n \"contents\": {\n \"numberValue\": 1\n }\n}",
|
1034 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1035 - | ));
|
1036 - | }
|
1037 - | /// Deserializes a blob union value
|
1038 - | /// Test ID: AwsJson11DeserializeBlobUnionValue
|
1039 - | #[::tokio::test]
|
1040 - | async fn aws_json11_deserialize_blob_union_value_response() {
|
1041 - | let output = crate::output::JsonUnionsOutput {
|
1042 - | contents: ::std::option::Option::Some(crate::model::MyUnion::BlobValue(
|
1043 - | ::aws_smithy_types::Blob::new("foo"),
|
1044 - | )),
|
1020 + | ::pretty_assertions::assert_eq!(input, expected);
|
1021 + | let response = crate::output::JsonUnionsOutput {
|
1022 + | contents: ::std::option::Option::None,
|
1045 1023 | };
|
1046 - | use ::aws_smithy_http_server::response::IntoResponse;
|
1047 - | let http_response = output.into_response();
|
1048 - | ::pretty_assertions::assert_eq!(
|
1049 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1050 - | http_response.status()
|
1051 - | );
|
1052 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1053 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1054 - | http_response.headers(),
|
1055 - | expected_headers,
|
1056 - | ));
|
1057 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1058 - | .await
|
1059 - | .expect("unable to extract body to bytes");
|
1060 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1061 - | &body,
|
1062 - | "{\n \"contents\": {\n \"blobValue\": \"Zm9v\"\n }\n}",
|
1063 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1064 - | ));
|
1065 - | }
|
1066 - | /// Deserializes a timestamp union value
|
1067 - | /// Test ID: AwsJson11DeserializeTimestampUnionValue
|
1068 - | #[::tokio::test]
|
1069 - | async fn aws_json11_deserialize_timestamp_union_value_response() {
|
1070 - | let output = crate::output::JsonUnionsOutput {
|
1071 - | contents: ::std::option::Option::Some(crate::model::MyUnion::TimestampValue(
|
1072 - | ::aws_smithy_types::DateTime::from_fractional_secs(1398796238, 0_f64),
|
1073 - | )),
|
1024 + | Ok(response)
|
1074 1025 | };
|
1075 - | use ::aws_smithy_http_server::response::IntoResponse;
|
1076 - | let http_response = output.into_response();
|
1077 - | ::pretty_assertions::assert_eq!(
|
1078 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1079 - | http_response.status()
|
1080 - | );
|
1081 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1082 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1083 - | http_response.headers(),
|
1084 - | expected_headers,
|
1085 - | ));
|
1086 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
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)
|
1087 1032 | .await
|
1088 - | .expect("unable to extract body to bytes");
|
1089 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1090 - | &body,
|
1091 - | "{\n \"contents\": {\n \"timestampValue\": 1398796238\n }\n}",
|
1092 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1093 - | ));
|
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 + | );
|
1094 1038 | }
|
1095 - | /// Deserializes an enum union value
|
1096 - | /// Test ID: AwsJson11DeserializeEnumUnionValue
|
1039 + | /// Serializes an enum union value
|
1040 + | /// Test ID: AwsJson11SerializeEnumUnionValue
|
1097 1041 | #[::tokio::test]
|
1098 - | async fn aws_json11_deserialize_enum_union_value_response() {
|
1099 - | let output = crate::output::JsonUnionsOutput {
|
1100 - | contents: ::std::option::Option::Some(crate::model::MyUnion::EnumValue(
|
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(
|
1101 1067 | "Foo"
|
1102 1068 | .parse::<crate::model::FooEnum>()
|
1103 1069 | .expect("static value validated to member"),
|
1104 - | )),
|
1070 + | ),
|
1071 + | ),
|
1105 1072 | };
|
1106 - | use ::aws_smithy_http_server::response::IntoResponse;
|
1107 - | let http_response = output.into_response();
|
1108 - | ::pretty_assertions::assert_eq!(
|
1109 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1110 - | http_response.status()
|
1111 - | );
|
1112 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1113 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1114 - | http_response.headers(),
|
1115 - | expected_headers,
|
1116 - | ));
|
1117 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1118 - | .await
|
1119 - | .expect("unable to extract body to bytes");
|
1120 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1121 - | &body,
|
1122 - | "{\n \"contents\": {\n \"enumValue\": \"Foo\"\n }\n}",
|
1123 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1124 - | ));
|
1125 - | }
|
1126 - | /// Deserializes a list union value
|
1127 - | /// Test ID: AwsJson11DeserializeListUnionValue
|
1128 - | #[::tokio::test]
|
1129 - | async fn aws_json11_deserialize_list_union_value_response() {
|
1130 - | let output = crate::output::JsonUnionsOutput {
|
1131 - | contents: ::std::option::Option::Some(crate::model::MyUnion::ListValue(vec![
|
1132 - | "foo".to_owned(),
|
1133 - | "bar".to_owned(),
|
1134 - | ])),
|
1073 + | ::pretty_assertions::assert_eq!(input, expected);
|
1074 + | let response = crate::output::JsonUnionsOutput {
|
1075 + | contents: ::std::option::Option::None,
|
1135 1076 | };
|
1136 - | use ::aws_smithy_http_server::response::IntoResponse;
|
1137 - | let http_response = output.into_response();
|
1138 - | ::pretty_assertions::assert_eq!(
|
1139 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1140 - | http_response.status()
|
1141 - | );
|
1142 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1143 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1144 - | http_response.headers(),
|
1145 - | expected_headers,
|
1146 - | ));
|
1147 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
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)
|
1148 1085 | .await
|
1149 - | .expect("unable to extract body to bytes");
|
1150 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1151 - | &body,
|
1152 - | "{\n \"contents\": {\n \"listValue\": [\"foo\", \"bar\"]\n }\n}",
|
1153 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1154 - | ));
|
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 + | );
|
1155 1091 | }
|
1156 - | /// Deserializes a map union value
|
1157 - | /// Test ID: AwsJson11DeserializeMapUnionValue
|
1158 - | #[::tokio::test]
|
1159 - | async fn aws_json11_deserialize_map_union_value_response() {
|
1160 - | let output = crate::output::JsonUnionsOutput {
|
1161 - | contents: ::std::option::Option::Some(crate::model::MyUnion::MapValue({
|
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 + | {
|
1162 1168 | let mut ret = ::std::collections::HashMap::new();
|
1163 1169 | ret.insert("foo".to_owned(), "bar".to_owned());
|
1164 1170 | ret.insert("spam".to_owned(), "eggs".to_owned());
|
1165 1171 | ret
|
1166 - | })),
|
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() {
|
1247 + | let output = crate::output::JsonUnionsOutput {
|
1248 + | contents: ::std::option::Option::Some(crate::model::MyUnion::StringValue(
|
1249 + | "foo".to_owned(),
|
1250 + | )),
|
1167 1251 | };
|
1168 1252 | use ::aws_smithy_http_server::response::IntoResponse;
|
1169 1253 | let http_response = output.into_response();
|
1170 1254 | ::pretty_assertions::assert_eq!(
|
1171 1255 | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1172 1256 | http_response.status()
|
1173 1257 | );
|
1174 1258 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1175 1259 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1176 1260 | http_response.headers(),
|
1177 1261 | expected_headers,
|
1178 1262 | ));
|
1179 1263 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1180 1264 | .await
|
1181 1265 | .expect("unable to extract body to bytes");
|
1182 - | ::aws_smithy_protocol_test::assert_ok(
|
1183 - | ::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 - | );
|
1266 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1267 + | &body,
|
1268 + | "{\n \"contents\": {\n \"stringValue\": \"foo\"\n }\n}",
|
1269 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1270 + | ));
|
1185 1271 | }
|
1186 - | /// Deserializes a structure union value
|
1187 - | /// Test ID: AwsJson11DeserializeStructureUnionValue
|
1272 + | /// Deserializes a boolean union value
|
1273 + | /// Test ID: AwsJson11DeserializeBooleanUnionValue
|
1188 1274 | #[::tokio::test]
|
1189 - | async fn aws_json11_deserialize_structure_union_value_response() {
|
1275 + | #[::tracing_test::traced_test]
|
1276 + | async fn aws_json11_deserialize_boolean_union_value_response() {
|
1190 1277 | let output = crate::output::JsonUnionsOutput {
|
1191 - | contents: ::std::option::Option::Some(crate::model::MyUnion::StructureValue(
|
1192 - | crate::model::GreetingStruct {
|
1193 - | hi: ::std::option::Option::Some("hello".to_owned()),
|
1194 - | },
|
1195 - | )),
|
1278 + | contents: ::std::option::Option::Some(crate::model::MyUnion::BooleanValue(true)),
|
1196 1279 | };
|
1197 1280 | use ::aws_smithy_http_server::response::IntoResponse;
|
1198 1281 | let http_response = output.into_response();
|
1199 1282 | ::pretty_assertions::assert_eq!(
|
1200 1283 | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1201 1284 | http_response.status()
|
1202 1285 | );
|
1203 1286 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1204 1287 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1205 1288 | http_response.headers(),
|
1206 1289 | expected_headers,
|
1207 1290 | ));
|
1208 1291 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1209 1292 | .await
|
1210 1293 | .expect("unable to extract body to bytes");
|
1211 - | ::aws_smithy_protocol_test::assert_ok(
|
1212 - | ::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 - | );
|
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 + | ));
|
1214 1299 | }
|
1215 - | }
|
1216 - | #[cfg(test)]
|
1217 - | #[allow(unreachable_code, unused_variables)]
|
1218 - | mod server_kitchen_sink_operation_test {
|
1219 - | /// Serializes string shapes
|
1220 - | /// Test ID: serializes_string_shapes
|
1300 + | /// Deserializes a number union value
|
1301 + | /// Test ID: AwsJson11DeserializeNumberUnionValue
|
1221 1302 | #[::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,
|
1303 + | #[::tracing_test::traced_test]
|
1304 + | async fn aws_json11_deserialize_number_union_value_response() {
|
1305 + | let output = crate::output::JsonUnionsOutput {
|
1306 + | contents: ::std::option::Option::Some(crate::model::MyUnion::NumberValue(1)),
|
1269 1307 | };
|
1308 + | use ::aws_smithy_http_server::response::IntoResponse;
|
1309 + | let http_response = output.into_response();
|
1270 1310 | ::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`"
|
1311 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1312 + | http_response.status()
|
1341 1313 | );
|
1314 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1315 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1316 + | http_response.headers(),
|
1317 + | expected_headers,
|
1318 + | ));
|
1319 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1320 + | .await
|
1321 + | .expect("unable to extract body to bytes");
|
1322 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1323 + | &body,
|
1324 + | "{\n \"contents\": {\n \"numberValue\": 1\n }\n}",
|
1325 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1326 + | ));
|
1327 + | }
|
1328 + | /// Deserializes a blob union value
|
1329 + | /// Test ID: AwsJson11DeserializeBlobUnionValue
|
1330 + | #[::tokio::test]
|
1331 + | #[::tracing_test::traced_test]
|
1332 + | async fn aws_json11_deserialize_blob_union_value_response() {
|
1333 + | let output = crate::output::JsonUnionsOutput {
|
1334 + | contents: ::std::option::Option::Some(crate::model::MyUnion::BlobValue(
|
1335 + | ::aws_smithy_types::Blob::new("foo"),
|
1336 + | )),
|
1337 + | };
|
1338 + | use ::aws_smithy_http_server::response::IntoResponse;
|
1339 + | let http_response = output.into_response();
|
1342 1340 | ::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`"
|
1341 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1342 + | http_response.status()
|
1346 1343 | );
|
1344 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1345 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1346 + | http_response.headers(),
|
1347 + | expected_headers,
|
1348 + | ));
|
1349 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1350 + | .await
|
1351 + | .expect("unable to extract body to bytes");
|
1352 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1353 + | &body,
|
1354 + | "{\n \"contents\": {\n \"blobValue\": \"Zm9v\"\n }\n}",
|
1355 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1356 + | ));
|
1357 + | }
|
1358 + | /// Deserializes a timestamp union value
|
1359 + | /// Test ID: AwsJson11DeserializeTimestampUnionValue
|
1360 + | #[::tokio::test]
|
1361 + | #[::tracing_test::traced_test]
|
1362 + | async fn aws_json11_deserialize_timestamp_union_value_response() {
|
1363 + | let output = crate::output::JsonUnionsOutput {
|
1364 + | contents: ::std::option::Option::Some(crate::model::MyUnion::TimestampValue(
|
1365 + | ::aws_smithy_types::DateTime::from_fractional_secs(1398796238, 0_f64),
|
1366 + | )),
|
1367 + | };
|
1368 + | use ::aws_smithy_http_server::response::IntoResponse;
|
1369 + | let http_response = output.into_response();
|
1347 1370 | ::pretty_assertions::assert_eq!(
|
1348 - | input.map_of_maps,
|
1349 - | expected.map_of_maps,
|
1350 - | "Unexpected value for `map_of_maps`"
|
1371 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1372 + | http_response.status()
|
1351 1373 | );
|
1374 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1375 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1376 + | http_response.headers(),
|
1377 + | expected_headers,
|
1378 + | ));
|
1379 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1380 + | .await
|
1381 + | .expect("unable to extract body to bytes");
|
1382 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1383 + | &body,
|
1384 + | "{\n \"contents\": {\n \"timestampValue\": 1398796238\n }\n}",
|
1385 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1386 + | ));
|
1387 + | }
|
1388 + | /// Deserializes an enum union value
|
1389 + | /// Test ID: AwsJson11DeserializeEnumUnionValue
|
1390 + | #[::tokio::test]
|
1391 + | #[::tracing_test::traced_test]
|
1392 + | async fn aws_json11_deserialize_enum_union_value_response() {
|
1393 + | let output = crate::output::JsonUnionsOutput {
|
1394 + | contents: ::std::option::Option::Some(crate::model::MyUnion::EnumValue(
|
1395 + | "Foo"
|
1396 + | .parse::<crate::model::FooEnum>()
|
1397 + | .expect("static value validated to member"),
|
1398 + | )),
|
1399 + | };
|
1400 + | use ::aws_smithy_http_server::response::IntoResponse;
|
1401 + | let http_response = output.into_response();
|
1352 1402 | ::pretty_assertions::assert_eq!(
|
1353 - | input.map_of_strings,
|
1354 - | expected.map_of_strings,
|
1355 - | "Unexpected value for `map_of_strings`"
|
1403 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1404 + | http_response.status()
|
1356 1405 | );
|
1406 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1407 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1408 + | http_response.headers(),
|
1409 + | expected_headers,
|
1410 + | ));
|
1411 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1412 + | .await
|
1413 + | .expect("unable to extract body to bytes");
|
1414 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1415 + | &body,
|
1416 + | "{\n \"contents\": {\n \"enumValue\": \"Foo\"\n }\n}",
|
1417 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1418 + | ));
|
1419 + | }
|
1420 + | /// Deserializes a list union value
|
1421 + | /// Test ID: AwsJson11DeserializeListUnionValue
|
1422 + | #[::tokio::test]
|
1423 + | #[::tracing_test::traced_test]
|
1424 + | async fn aws_json11_deserialize_list_union_value_response() {
|
1425 + | let output = crate::output::JsonUnionsOutput {
|
1426 + | contents: ::std::option::Option::Some(crate::model::MyUnion::ListValue(vec![
|
1427 + | "foo".to_owned(),
|
1428 + | "bar".to_owned(),
|
1429 + | ])),
|
1430 + | };
|
1431 + | use ::aws_smithy_http_server::response::IntoResponse;
|
1432 + | let http_response = output.into_response();
|
1357 1433 | ::pretty_assertions::assert_eq!(
|
1358 - | input.map_of_structs,
|
1359 - | expected.map_of_structs,
|
1360 - | "Unexpected value for `map_of_structs`"
|
1434 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1435 + | http_response.status()
|
1361 1436 | );
|
1437 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1438 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1439 + | http_response.headers(),
|
1440 + | expected_headers,
|
1441 + | ));
|
1442 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1443 + | .await
|
1444 + | .expect("unable to extract body to bytes");
|
1445 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1446 + | &body,
|
1447 + | "{\n \"contents\": {\n \"listValue\": [\"foo\", \"bar\"]\n }\n}",
|
1448 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1449 + | ));
|
1450 + | }
|
1451 + | /// Deserializes a map union value
|
1452 + | /// Test ID: AwsJson11DeserializeMapUnionValue
|
1453 + | #[::tokio::test]
|
1454 + | #[::tracing_test::traced_test]
|
1455 + | async fn aws_json11_deserialize_map_union_value_response() {
|
1456 + | let output = crate::output::JsonUnionsOutput {
|
1457 + | contents: ::std::option::Option::Some(crate::model::MyUnion::MapValue({
|
1458 + | let mut ret = ::std::collections::HashMap::new();
|
1459 + | ret.insert("foo".to_owned(), "bar".to_owned());
|
1460 + | ret.insert("spam".to_owned(), "eggs".to_owned());
|
1461 + | ret
|
1462 + | })),
|
1463 + | };
|
1464 + | use ::aws_smithy_http_server::response::IntoResponse;
|
1465 + | let http_response = output.into_response();
|
1362 1466 | ::pretty_assertions::assert_eq!(
|
1363 - | input.recursive_list,
|
1364 - | expected.recursive_list,
|
1365 - | "Unexpected value for `recursive_list`"
|
1467 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1468 + | http_response.status()
|
1366 1469 | );
|
1367 - | ::pretty_assertions::assert_eq!(
|
1368 - | input.recursive_map,
|
1369 - | expected.recursive_map,
|
1370 - | "Unexpected value for `recursive_map`"
|
1470 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1471 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1472 + | http_response.headers(),
|
1473 + | expected_headers,
|
1474 + | ));
|
1475 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1476 + | .await
|
1477 + | .expect("unable to extract body to bytes");
|
1478 + | ::aws_smithy_protocol_test::assert_ok(
|
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"))
|
1371 1480 | );
|
1481 + | }
|
1482 + | /// Deserializes a structure union value
|
1483 + | /// Test ID: AwsJson11DeserializeStructureUnionValue
|
1484 + | #[::tokio::test]
|
1485 + | #[::tracing_test::traced_test]
|
1486 + | async fn aws_json11_deserialize_structure_union_value_response() {
|
1487 + | let output = crate::output::JsonUnionsOutput {
|
1488 + | contents: ::std::option::Option::Some(crate::model::MyUnion::StructureValue(
|
1489 + | crate::model::GreetingStruct {
|
1490 + | hi: ::std::option::Option::Some("hello".to_owned()),
|
1491 + | },
|
1492 + | )),
|
1493 + | };
|
1494 + | use ::aws_smithy_http_server::response::IntoResponse;
|
1495 + | let http_response = output.into_response();
|
1372 1496 | ::pretty_assertions::assert_eq!(
|
1373 - | input.recursive_struct,
|
1374 - | expected.recursive_struct,
|
1375 - | "Unexpected value for `recursive_struct`"
|
1497 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1498 + | http_response.status()
|
1376 1499 | );
|
1377 - | ::pretty_assertions::assert_eq!(
|
1378 - | input.simple_struct,
|
1379 - | expected.simple_struct,
|
1380 - | "Unexpected value for `simple_struct`"
|
1500 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1501 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1502 + | http_response.headers(),
|
1503 + | expected_headers,
|
1504 + | ));
|
1505 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1506 + | .await
|
1507 + | .expect("unable to extract body to bytes");
|
1508 + | ::aws_smithy_protocol_test::assert_ok(
|
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"))
|
1381 1510 | );
|
1382 - | ::pretty_assertions::assert_eq!(
|
1383 - | input.string,
|
1384 - | expected.string,
|
1385 - | "Unexpected value for `string`"
|
1511 + | }
|
1512 + | }
|
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 + | },
|
1386 1579 | );
|
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`"
|
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()),
|
1391 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 + |
|
1629 + | #[allow(unreachable_code, unused_variables)]
|
1630 + | #[cfg(test)]
|
1631 + | mod greeting_with_errors_test {
|
1632 + |
|
1633 + | /// Parses simple JSON errors
|
1634 + | /// Test ID: AwsJson11InvalidGreetingError
|
1635 + | #[::tokio::test]
|
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();
|
1392 1644 | ::pretty_assertions::assert_eq!(
|
1393 - | input.timestamp,
|
1394 - | expected.timestamp,
|
1395 - | "Unexpected value for `timestamp`"
|
1645 + | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1646 + | http_response.status()
|
1396 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())
|
1654 + | .await
|
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 + | ));
|
1661 + | }
|
1662 + | /// Parses a complex error with no message member
|
1663 + | /// Test ID: AwsJson11ComplexError
|
1664 + | #[::tokio::test]
|
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();
|
1397 1676 | ::pretty_assertions::assert_eq!(
|
1398 - | input.unix_timestamp,
|
1399 - | expected.unix_timestamp,
|
1400 - | "Unexpected value for `unix_timestamp`"
|
1677 + | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1678 + | http_response.status()
|
1401 1679 | );
|
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)
|
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())
|
1438 1686 | .await
|
1439 - | .expect("unable to make an HTTP request");
|
1440 - | 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 + | );
|
1441 1691 | }
|
1442 - | /// Serializes string shapes with jsonvalue trait
|
1443 - | /// Test ID: serializes_string_shapes_with_jsonvalue_trait
|
1692 + | /// Test ID: AwsJson11EmptyComplexError
|
1444 1693 | #[::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)
|
1662 - | .await
|
1663 - | .expect("unable to make an HTTP request");
|
1664 - | assert!(receiver.recv().await.is_some());
|
1665 - | }
|
1666 - | /// Serializes integer shapes
|
1667 - | /// Test ID: serializes_integer_shapes
|
1668 - | #[::tokio::test]
|
1669 - | async fn serializes_integer_shapes_request() {
|
1670 - | #[allow(unused_mut)]
|
1671 - | let mut http_request = http::Request::builder()
|
1672 - | .uri("/")
|
1673 - | .method("POST")
|
1674 - | .header("Content-Type", "application/x-amz-json-1.1")
|
1675 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
1676 - | .body(::aws_smithy_http_server::body::Body::from(
|
1677 - | ::bytes::Bytes::from_static("{\"Integer\":1234}".as_bytes()),
|
1678 - | ))
|
1679 - | .unwrap();
|
1680 - | #[allow(unused_mut)]
|
1681 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1682 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
1683 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1684 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
1685 - | let sender = sender.clone();
|
1686 - | async move {
|
1687 - | 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,
|
1716 - | };
|
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,
|
1876 - | };
|
1877 - | Ok(response)
|
1878 - | };
|
1879 - | sender.send(()).await.expect("receiver dropped early");
|
1880 - | result
|
1881 - | }
|
1882 - | })
|
1883 - | .build_unchecked();
|
1884 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1885 - | .await
|
1886 - | .expect("unable to make an HTTP request");
|
1887 - | assert!(receiver.recv().await.is_some());
|
1888 - | }
|
1889 - | /// Serializes long shapes
|
1890 - | /// Test ID: serializes_long_shapes
|
1891 - | #[::tokio::test]
|
1892 - | async fn serializes_long_shapes_request() {
|
1893 - | #[allow(unused_mut)]
|
1894 - | let mut http_request = http::Request::builder()
|
1895 - | .uri("/")
|
1896 - | .method("POST")
|
1897 - | .header("Content-Type", "application/x-amz-json-1.1")
|
1898 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
1899 - | .body(::aws_smithy_http_server::body::Body::from(
|
1900 - | ::bytes::Bytes::from_static("{\"Long\":999999999999}".as_bytes()),
|
1901 - | ))
|
1902 - | .unwrap();
|
1903 - | #[allow(unused_mut)]
|
1904 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1905 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
1906 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1907 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
1908 - | let sender = sender.clone();
|
1909 - | async move {
|
1910 - | 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,
|
1939 - | };
|
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,
|
2099 - | };
|
2100 - | Ok(response)
|
2101 - | };
|
2102 - | sender.send(()).await.expect("receiver dropped early");
|
2103 - | result
|
2104 - | }
|
2105 - | })
|
2106 - | .build_unchecked();
|
2107 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2108 - | .await
|
2109 - | .expect("unable to make an HTTP request");
|
2110 - | assert!(receiver.recv().await.is_some());
|
2111 - | }
|
2112 - | /// Serializes float shapes
|
2113 - | /// Test ID: serializes_float_shapes
|
2114 - | #[::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)
|
2331 - | .await
|
2332 - | .expect("unable to make an HTTP request");
|
2333 - | assert!(receiver.recv().await.is_some());
|
2334 - | }
|
2335 - | /// Serializes double shapes
|
2336 - | /// Test ID: serializes_double_shapes
|
2337 - | #[::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)
|
2554 - | .await
|
2555 - | .expect("unable to make an HTTP request");
|
2556 - | assert!(receiver.recv().await.is_some());
|
2557 - | }
|
2558 - | /// Serializes blob shapes
|
2559 - | /// Test ID: serializes_blob_shapes
|
2560 - | #[::tokio::test]
|
2561 - | async fn serializes_blob_shapes_request() {
|
2562 - | #[allow(unused_mut)]
|
2563 - | let mut http_request = http::Request::builder()
|
2564 - | .uri("/")
|
2565 - | .method("POST")
|
2566 - | .header("Content-Type", "application/x-amz-json-1.1")
|
2567 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
2568 - | .body(::aws_smithy_http_server::body::Body::from(
|
2569 - | ::bytes::Bytes::from_static("{\"Blob\":\"YmluYXJ5LXZhbHVl\"}".as_bytes()),
|
2570 - | ))
|
2571 - | .unwrap();
|
2572 - | #[allow(unused_mut)]
|
2573 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2574 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
2575 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2576 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
2577 - | let sender = sender.clone();
|
2578 - | async move {
|
2579 - | 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,
|
2606 - | 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 - | };
|
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,
|
2766 - | 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 - | };
|
2771 - | Ok(response)
|
2772 - | };
|
2773 - | sender.send(()).await.expect("receiver dropped early");
|
2774 - | result
|
2775 - | }
|
2776 - | })
|
2777 - | .build_unchecked();
|
2778 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2779 - | .await
|
2780 - | .expect("unable to make an HTTP request");
|
2781 - | assert!(receiver.recv().await.is_some());
|
2782 - | }
|
2783 - | /// Serializes boolean shapes (true)
|
2784 - | /// Test ID: serializes_boolean_shapes_true
|
2785 - | #[::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,
|
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,
|
2833 1699 | };
|
1700 + | let output = crate::error::GreetingWithErrorsError::ComplexError(output);
|
1701 + | use ::aws_smithy_http_server::response::IntoResponse;
|
1702 + | let http_response = output.into_response();
|
2834 1703 | ::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`"
|
1704 + | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1705 + | http_response.status()
|
2965 1706 | );
|
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
|
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);
|
2998 1775 | }
|
2999 - | })
|
3000 - | .build_unchecked();
|
3001 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1776 + | crate::protocol_serde::shape_sparse_nulls_operation::de_sparse_nulls_operation_http_request(request)
|
3002 1777 | .await
|
3003 - | .expect("unable to make an HTTP request");
|
3004 - | assert!(receiver.recv().await.is_some());
|
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),
|
3005 1789 | }
|
3006 - | /// Serializes boolean shapes (false)
|
3007 - | /// Test ID: serializes_boolean_shapes_false
|
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
|
3008 1814 | #[::tokio::test]
|
3009 - | async fn serializes_boolean_shapes_false_request() {
|
1815 + | #[::tracing_test::traced_test]
|
1816 + | async fn aws_json11_sparse_maps_serialize_null_values_request() {
|
3010 1817 | #[allow(unused_mut)]
|
3011 1818 | let mut http_request = http::Request::builder()
|
3012 1819 | .uri("/")
|
3013 1820 | .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,
|
1821 + | .header("Content-Type", "application/x-amz-json-1.1")
|
1822 + | .header("X-Amz-Target", "JsonProtocol.SparseNullsOperation")
|
1823 + | .body(::aws_smithy_http_server::body::Body::from(
|
1824 + | ::bytes::Bytes::from_static(
|
1825 + | "{\n \"sparseStringMap\": {\n \"foo\": null\n }\n}".as_bytes(),
|
1826 + | ),
|
1827 + | ))
|
1828 + | .unwrap();
|
1829 + | #[allow(unused_mut)]
|
1830 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1831 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
1832 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1833 + | .sparse_nulls_operation(move |input: crate::input::SparseNullsOperationInput| {
|
1834 + | let sender = sender.clone();
|
1835 + | async move {
|
1836 + | let result = {
|
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,
|
3216 1844 | };
|
3217 - | Ok(response)
|
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,
|
1849 + | };
|
1850 + | response
|
3218 1851 | };
|
3219 1852 | sender.send(()).await.expect("receiver dropped early");
|
3220 1853 | result
|
3221 1854 | }
|
3222 1855 | })
|
3223 1856 | .build_unchecked();
|
3224 1857 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3225 1858 | .await
|
3226 1859 | .expect("unable to make an HTTP request");
|
3227 - | 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 + | );
|
3228 1864 | }
|
3229 - | /// Serializes timestamp shapes
|
3230 - | /// Test ID: serializes_timestamp_shapes
|
1865 + | /// Serializes null values in lists
|
1866 + | /// Test ID: AwsJson11SparseListsSerializeNull
|
3231 1867 | #[::tokio::test]
|
3232 - | async fn serializes_timestamp_shapes_request() {
|
1868 + | #[::tracing_test::traced_test]
|
1869 + | async fn aws_json11_sparse_lists_serialize_null_request() {
|
3233 1870 | #[allow(unused_mut)]
|
3234 1871 | let mut http_request = http::Request::builder()
|
3235 1872 | .uri("/")
|
3236 1873 | .method("POST")
|
3237 1874 | .header("Content-Type", "application/x-amz-json-1.1")
|
3238 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
1875 + | .header("X-Amz-Target", "JsonProtocol.SparseNullsOperation")
|
3239 1876 | .body(::aws_smithy_http_server::body::Body::from(
|
3240 - | ::bytes::Bytes::from_static("{\"Timestamp\":946845296}".as_bytes()),
|
1877 + | ::bytes::Bytes::from_static(
|
1878 + | "{\n \"sparseStringList\": [\n null\n ]\n}".as_bytes(),
|
1879 + | ),
|
3241 1880 | ))
|
3242 1881 | .unwrap();
|
3243 1882 | #[allow(unused_mut)]
|
3244 1883 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3245 1884 | let config = crate::service::JsonProtocolConfig::builder().build();
|
3246 1885 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3247 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
1886 + | .sparse_nulls_operation(move |input: crate::input::SparseNullsOperationInput| {
|
3248 1887 | let sender = sender.clone();
|
3249 1888 | async move {
|
3250 1889 | 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,
|
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,
|
3283 1895 | };
|
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 - | );
|
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,
|
1900 + | };
|
1901 + | response
|
1902 + | };
|
1903 + | sender.send(()).await.expect("receiver dropped early");
|
1904 + | result
|
1905 + | }
|
1906 + | })
|
1907 + | .build_unchecked();
|
1908 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1909 + | .await
|
1910 + | .expect("unable to make an HTTP request");
|
3305 1911 | 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`"
|
1912 + | receiver.recv().await.is_some(),
|
1913 + | "we expected operation handler to be invoked but it was not entered"
|
3400 1914 | );
|
1915 + | }
|
1916 + | /// Deserializes null values in maps
|
1917 + | /// Test ID: AwsJson11SparseMapsDeserializeNullValues
|
1918 + | #[::tokio::test]
|
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();
|
3401 1931 | ::pretty_assertions::assert_eq!(
|
3402 - | input.struct_with_json_name,
|
3403 - | expected.struct_with_json_name,
|
3404 - | "Unexpected value for `struct_with_json_name`"
|
1932 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1933 + | http_response.status()
|
3405 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())
|
1941 + | .await
|
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 + | ));
|
1948 + | }
|
1949 + | /// Deserializes null values in lists
|
1950 + | /// Test ID: AwsJson11SparseListsDeserializeNull
|
1951 + | #[::tokio::test]
|
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();
|
3406 1960 | ::pretty_assertions::assert_eq!(
|
3407 - | input.timestamp,
|
3408 - | expected.timestamp,
|
3409 - | "Unexpected value for `timestamp`"
|
1961 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1962 + | http_response.status()
|
3410 1963 | );
|
3411 - | ::pretty_assertions::assert_eq!(
|
3412 - | input.unix_timestamp,
|
3413 - | expected.unix_timestamp,
|
3414 - | "Unexpected value for `unix_timestamp`"
|
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())
|
1970 + | .await
|
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 + | ));
|
1977 + | }
|
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 + | },
|
3415 2043 | );
|
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,
|
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
|
2077 + | #[::tokio::test]
|
2078 + | #[::tracing_test::traced_test]
|
2079 + | async fn aws_json11_servers_dont_deserialize_null_structure_values_request() {
|
2080 + | #[allow(unused_mut)]
|
2081 + | let mut http_request = http::Request::builder()
|
2082 + | .uri("/")
|
2083 + | .method("POST")
|
2084 + | .header("Content-Type", "application/x-amz-json-1.1")
|
2085 + | .header("X-Amz-Target", "JsonProtocol.NullOperation")
|
2086 + | .body(::aws_smithy_http_server::body::Body::from(
|
2087 + | ::bytes::Bytes::from_static("{\n \"string\": null\n}".as_bytes()),
|
2088 + | ))
|
2089 + | .unwrap();
|
2090 + | #[allow(unused_mut)]
|
2091 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2092 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
2093 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2094 + | .null_operation(move |input: crate::input::NullOperationInput| {
|
2095 + | let sender = sender.clone();
|
2096 + | async move {
|
2097 + | let result = {
|
2098 + | let expected = crate::input::NullOperationInput {
|
3439 2099 | 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 2100 | };
|
3444 - | Ok(response)
|
2101 + | ::pretty_assertions::assert_eq!(input, expected);
|
2102 + | let response = crate::output::NullOperationOutput {
|
2103 + | string: ::std::option::Option::None,
|
2104 + | };
|
2105 + | response
|
3445 2106 | };
|
3446 2107 | sender.send(()).await.expect("receiver dropped early");
|
3447 2108 | result
|
3448 2109 | }
|
3449 - | })
|
3450 - | .build_unchecked();
|
3451 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2110 + | })
|
2111 + | .build_unchecked();
|
2112 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2113 + | .await
|
2114 + | .expect("unable to make an HTTP request");
|
2115 + | assert!(
|
2116 + | receiver.recv().await.is_some(),
|
2117 + | "we expected operation handler to be invoked but it was not entered"
|
2118 + | );
|
2119 + | }
|
2120 + | /// Null structure values are dropped
|
2121 + | /// Test ID: AwsJson11ServersDontSerializeNullStructureValues
|
2122 + | #[::tokio::test]
|
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())
|
2140 + | .await
|
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 + | ));
|
2147 + | }
|
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>>
|
2161 + | }
|
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)
|
2176 + | }
|
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)
|
3452 2204 | .await
|
3453 - | .expect("unable to make an HTTP request");
|
3454 - | assert!(receiver.recv().await.is_some());
|
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),
|
3455 2216 | }
|
3456 - | /// Serializes timestamp shapes with iso8601 timestampFormat
|
3457 - | /// Test ID: serializes_timestamp_shapes_with_iso8601_timestampformat
|
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 2277 | let mut http_request = http::Request::builder()
|
3462 2278 | .uri("/")
|
3463 2279 | .method("POST")
|
3464 2280 | .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();
|
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 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3476 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
3477 - | let sender = sender.clone();
|
3478 - | async move {
|
3479 - | 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,
|
3512 - | };
|
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`"
|
2286 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2287 + | .json_enums(move |input: crate::input::JsonEnumsInput| {
|
2288 + | let sender = sender.clone();
|
2289 + | async move {
|
2290 + | let result = {
|
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"),
|
3639 2330 | );
|
3640 - | ::pretty_assertions::assert_eq!(
|
3641 - | input.unix_timestamp,
|
3642 - | expected.unix_timestamp,
|
3643 - | "Unexpected value for `unix_timestamp`"
|
2331 + | ret.insert(
|
2332 + | "zero".to_owned(),
|
2333 + | "0".parse::<crate::model::FooEnum>()
|
2334 + | .expect("static value validated to member"),
|
3644 2335 | );
|
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,
|
2336 + | ret
|
2337 + | }),
|
2338 + | };
|
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
|
2365 + | #[::tokio::test]
|
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
|
3687 2527 | #[::tokio::test]
|
3688 - | async fn serializes_timestamp_shapes_with_httpdate_timestampformat_request() {
|
2528 + | #[::tracing_test::traced_test]
|
2529 + | async fn put_and_get_inline_documents_input_request() {
|
3689 2530 | #[allow(unused_mut)]
|
3690 2531 | let mut http_request = http::Request::builder()
|
3691 2532 | .uri("/")
|
3692 2533 | .method("POST")
|
3693 2534 | .header("Content-Type", "application/x-amz-json-1.1")
|
3694 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
2535 + | .header("X-Amz-Target", "JsonProtocol.PutAndGetInlineDocuments")
|
3695 2536 | .body(::aws_smithy_http_server::body::Body::from(
|
3696 2537 | ::bytes::Bytes::from_static(
|
3697 - | "{\"HttpdateTimestamp\":\"Sun, 02 Jan 2000 20:34:56 GMT\"}".as_bytes(),
|
2538 + | "{\n \"inlineDocument\": {\"foo\": \"bar\"}\n}".as_bytes(),
|
3698 2539 | ),
|
3699 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| {
|
2546 + | .put_and_get_inline_documents(
|
2547 + | move |input: crate::input::PutAndGetInlineDocumentsInput| {
|
3706 2548 | let sender = sender.clone();
|
3707 2549 | async move {
|
3708 2550 | 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,
|
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 + | }),
|
3741 2564 | };
|
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 - | );
|
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
|
2579 + | };
|
2580 + | sender.send(()).await.expect("receiver dropped early");
|
2581 + | result
|
2582 + | }
|
2583 + | },
|
2584 + | )
|
2585 + | .build_unchecked();
|
2586 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2587 + | .await
|
2588 + | .expect("unable to make an HTTP request");
|
3763 2589 | 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`"
|
2590 + | receiver.recv().await.is_some(),
|
2591 + | "we expected operation handler to be invoked but it was not entered"
|
3858 2592 | );
|
2593 + | }
|
2594 + | /// Serializes inline documents in a JSON response.
|
2595 + | /// Test ID: PutAndGetInlineDocumentsInput
|
2596 + | #[::tokio::test]
|
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();
|
3859 2612 | ::pretty_assertions::assert_eq!(
|
3860 - | input.struct_with_json_name,
|
3861 - | expected.struct_with_json_name,
|
3862 - | "Unexpected value for `struct_with_json_name`"
|
2613 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2614 + | http_response.status()
|
3863 2615 | );
|
3864 - | ::pretty_assertions::assert_eq!(
|
3865 - | input.timestamp,
|
3866 - | expected.timestamp,
|
3867 - | "Unexpected value for `timestamp`"
|
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())
|
2622 + | .await
|
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 + | ));
|
2629 + | }
|
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 + | },
|
3868 2695 | );
|
3869 - | ::pretty_assertions::assert_eq!(
|
3870 - | input.unix_timestamp,
|
3871 - | expected.unix_timestamp,
|
3872 - | "Unexpected value for `unix_timestamp`"
|
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
|
2723 + | #[::tokio::test]
|
2724 + | #[::tracing_test::traced_test]
|
2725 + | async fn can_call_operation_with_no_input_or_output_request() {
|
2726 + | #[allow(unused_mut)]
|
2727 + | let mut http_request = http::Request::builder()
|
2728 + | .uri("/")
|
2729 + | .method("POST")
|
2730 + | .header("Content-Type", "application/x-amz-json-1.1")
|
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()),
|
2737 + | ))
|
2738 + | .unwrap();
|
2739 + | #[allow(unused_mut)]
|
2740 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2741 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
2742 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
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
|
2756 + | };
|
2757 + | sender.send(()).await.expect("receiver dropped early");
|
2758 + | result
|
2759 + | }
|
2760 + | },
|
2761 + | )
|
2762 + | .build_unchecked();
|
2763 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2764 + | .await
|
2765 + | .expect("unable to make an HTTP request");
|
2766 + | assert!(
|
2767 + | receiver.recv().await.is_some(),
|
2768 + | "we expected operation handler to be invoked but it was not entered"
|
3873 2769 | );
|
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,
|
2770 + | }
|
2771 + | /// Can invoke operations with optional input
|
2772 + | /// Test ID: can_call_operation_with_optional_input
|
2773 + | #[::tokio::test]
|
2774 + | #[::tracing_test::traced_test]
|
2775 + | async fn can_call_operation_with_optional_input_request() {
|
2776 + | #[allow(unused_mut)]
|
2777 + | let mut http_request = http::Request::builder()
|
2778 + | .uri("/")
|
2779 + | .method("POST")
|
2780 + | .header("Content-Type", "application/x-amz-json-1.1")
|
2781 + | .header(
|
2782 + | "X-Amz-Target",
|
2783 + | "JsonProtocol.OperationWithOptionalInputOutput",
|
2784 + | )
|
2785 + | .body(::aws_smithy_http_server::body::Body::from(
|
2786 + | ::bytes::Bytes::from_static("{\"Value\":\"Hi\"}".as_bytes()),
|
2787 + | ))
|
2788 + | .unwrap();
|
2789 + | #[allow(unused_mut)]
|
2790 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2791 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
2792 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
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()),
|
3901 2800 | };
|
3902 - | Ok(response)
|
2801 + | ::pretty_assertions::assert_eq!(input, expected);
|
2802 + | let response = crate::output::OperationWithOptionalInputOutputOutput {
|
2803 + | value: ::std::option::Option::None,
|
2804 + | };
|
2805 + | response
|
2806 + | };
|
2807 + | sender.send(()).await.expect("receiver dropped early");
|
2808 + | result
|
2809 + | }
|
2810 + | },
|
2811 + | )
|
2812 + | .build_unchecked();
|
2813 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2814 + | .await
|
2815 + | .expect("unable to make an HTTP request");
|
2816 + | assert!(
|
2817 + | receiver.recv().await.is_some(),
|
2818 + | "we expected operation handler to be invoked but it was not entered"
|
2819 + | );
|
2820 + | }
|
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>>
|
2834 + | }
|
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)
|
2849 + | }
|
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)
|
3903 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
|
2914 + | #[::tokio::test]
|
2915 + | #[::tracing_test::traced_test]
|
2916 + | async fn aws_json11_supports_na_n_float_inputs_request() {
|
2917 + | #[allow(unused_mut)]
|
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 };
|
3904 2966 | sender.send(()).await.expect("receiver dropped early");
|
3905 2967 | result
|
3906 2968 | }
|
3907 2969 | })
|
3908 2970 | .build_unchecked();
|
3909 2971 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3910 2972 | .await
|
3911 2973 | .expect("unable to make an HTTP request");
|
3912 - | assert!(receiver.recv().await.is_some());
|
2974 + | assert!(
|
2975 + | receiver.recv().await.is_some(),
|
2976 + | "we expected operation handler to be invoked but it was not entered"
|
2977 + | );
|
3913 2978 | }
|
3914 - | /// Serializes timestamp shapes with unixTimestamp timestampFormat
|
3915 - | /// Test ID: serializes_timestamp_shapes_with_unixtimestamp_timestampformat
|
2979 + | /// Supports handling Infinity float values.
|
2980 + | /// Test ID: AwsJson11SupportsInfinityFloatInputs
|
3916 2981 | #[::tokio::test]
|
3917 - | async fn serializes_timestamp_shapes_with_unixtimestamp_timestampformat_request() {
|
2982 + | #[::tracing_test::traced_test]
|
2983 + | async fn aws_json11_supports_infinity_float_inputs_request() {
|
3918 2984 | #[allow(unused_mut)]
|
3919 2985 | let mut http_request = http::Request::builder()
|
3920 2986 | .uri("/")
|
3921 2987 | .method("POST")
|
3922 2988 | .header("Content-Type", "application/x-amz-json-1.1")
|
3923 - | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
2989 + | .header("X-Amz-Target", "JsonProtocol.SimpleScalarProperties")
|
3924 2990 | .body(::aws_smithy_http_server::body::Body::from(
|
3925 - | ::bytes::Bytes::from_static("{\"UnixTimestamp\":946845296}".as_bytes()),
|
2991 + | ::bytes::Bytes::from_static(
|
2992 + | "{\n \"floatValue\": \"Infinity\",\n \"doubleValue\": \"Infinity\"\n}"
|
2993 + | .as_bytes(),
|
2994 + | ),
|
3926 2995 | ))
|
3927 2996 | .unwrap();
|
3928 2997 | #[allow(unused_mut)]
|
3929 2998 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3930 2999 | let config = crate::service::JsonProtocolConfig::builder().build();
|
3931 3000 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3932 - | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
3001 + | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
3933 3002 | let sender = sender.clone();
|
3934 3003 | 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`"
|
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)
|
3040 + | .await
|
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"
|
4080 3045 | );
|
4081 - | ::pretty_assertions::assert_eq!(
|
4082 - | input.string,
|
4083 - | expected.string,
|
4084 - | "Unexpected value for `string`"
|
3046 + | }
|
3047 + | /// Supports handling -Infinity float values.
|
3048 + | /// Test ID: AwsJson11SupportsNegativeInfinityFloatInputs
|
3049 + | #[::tokio::test]
|
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"
|
4085 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 + | ),
|
3129 + | };
|
3130 + | use ::aws_smithy_http_server::response::IntoResponse;
|
3131 + | let http_response = output.into_response();
|
4086 3132 | ::pretty_assertions::assert_eq!(
|
4087 - | input.struct_with_json_name,
|
4088 - | expected.struct_with_json_name,
|
4089 - | "Unexpected value for `struct_with_json_name`"
|
3133 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3134 + | http_response.status()
|
4090 3135 | );
|
3136 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
3137 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3138 + | http_response.headers(),
|
3139 + | expected_headers,
|
3140 + | ));
|
3141 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3142 + | .await
|
3143 + | .expect("unable to extract body to bytes");
|
3144 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
3145 + | &body,
|
3146 + | "{\n \"floatValue\": \"NaN\",\n \"doubleValue\": \"NaN\"\n}",
|
3147 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3148 + | ));
|
3149 + | }
|
3150 + | /// Supports handling Infinity float values.
|
3151 + | /// Test ID: AwsJson11SupportsInfinityFloatInputs
|
3152 + | #[::tokio::test]
|
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 + | ),
|
3164 + | };
|
3165 + | use ::aws_smithy_http_server::response::IntoResponse;
|
3166 + | let http_response = output.into_response();
|
4091 3167 | ::pretty_assertions::assert_eq!(
|
4092 - | input.timestamp,
|
4093 - | expected.timestamp,
|
4094 - | "Unexpected value for `timestamp`"
|
3168 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3169 + | http_response.status()
|
4095 3170 | );
|
3171 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
3172 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3173 + | http_response.headers(),
|
3174 + | expected_headers,
|
3175 + | ));
|
3176 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3177 + | .await
|
3178 + | .expect("unable to extract body to bytes");
|
3179 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
3180 + | &body,
|
3181 + | "{\n \"floatValue\": \"Infinity\",\n \"doubleValue\": \"Infinity\"\n}",
|
3182 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3183 + | ));
|
3184 + | }
|
3185 + | /// Supports handling -Infinity float values.
|
3186 + | /// Test ID: AwsJson11SupportsNegativeInfinityFloatInputs
|
3187 + | #[::tokio::test]
|
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 + | ),
|
3199 + | };
|
3200 + | use ::aws_smithy_http_server::response::IntoResponse;
|
3201 + | let http_response = output.into_response();
|
4096 3202 | ::pretty_assertions::assert_eq!(
|
4097 - | input.unix_timestamp,
|
4098 - | expected.unix_timestamp,
|
4099 - | "Unexpected value for `unix_timestamp`"
|
3203 + | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3204 + | http_response.status()
|
4100 3205 | );
|
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
|
3206 + | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
3207 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3208 + | http_response.headers(),
|
3209 + | expected_headers,
|
3210 + | ));
|
3211 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3212 + | .await
|
3213 + | .expect("unable to extract body to bytes");
|
3214 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
3215 + | &body,
|
3216 + | "{\n \"floatValue\": \"-Infinity\",\n \"doubleValue\": \"-Infinity\"\n}",
|
3217 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3218 + | ));
|
3219 + | }
|
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)
|
4133 3248 | }
|
4134 - | })
|
4135 - | .build_unchecked();
|
4136 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
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)
|
4137 3276 | .await
|
4138 - | .expect("unable to make an HTTP request");
|
4139 - | assert!(receiver.recv().await.is_some());
|
3277 + | .map_err(Into::into)
|
3278 + | };
|
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 + | },
|
3285 + | );
|
3286 + | KitchenSinkOperationInputFuture {
|
3287 + | inner: Box::pin(fut),
|
4140 3288 | }
|
4141 - | /// Serializes list shapes
|
4142 - | /// Test ID: serializes_list_shapes
|
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
|
4143 3331 | #[::tokio::test]
|
4144 - | async fn serializes_list_shapes_request() {
|
3332 + | #[::tracing_test::traced_test]
|
3333 + | async fn serializes_string_shapes_request() {
|
4145 3334 | #[allow(unused_mut)]
|
4146 3335 | let mut http_request = http::Request::builder()
|
4147 3336 | .uri("/")
|
4148 3337 | .method("POST")
|
4149 3338 | .header("Content-Type", "application/x-amz-json-1.1")
|
4150 3339 | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
4151 3340 | .body(::aws_smithy_http_server::body::Body::from(
|
4152 - | ::bytes::Bytes::from_static(
|
4153 - | "{\"ListOfStrings\":[\"abc\",\"mno\",\"xyz\"]}".as_bytes(),
|
4154 - | ),
|
3341 + | ::bytes::Bytes::from_static("{\"String\":\"abc xyz\"}".as_bytes()),
|
4155 3342 | ))
|
4156 3343 | .unwrap();
|
4157 3344 | #[allow(unused_mut)]
|
4158 3345 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4159 3346 | let config = crate::service::JsonProtocolConfig::builder().build();
|
4160 3347 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
4161 3348 | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
4162 3349 | let sender = sender.clone();
|
4163 3350 | async move {
|
4164 3351 | let result = {
|
4165 3352 | use ::aws_smithy_protocol_test::FloatEquals;
|
4166 3353 | 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 - | ]),
|
3354 + | string: ::std::option::Option::Some("abc xyz".to_owned()),
|
4172 3355 | blob: ::std::option::Option::None,
|
4173 3356 | boolean: ::std::option::Option::None,
|
4174 3357 | double: ::std::option::Option::None,
|
4175 3358 | empty_struct: ::std::option::Option::None,
|
4176 3359 | float: ::std::option::Option::None,
|
4177 3360 | httpdate_timestamp: ::std::option::Option::None,
|
4178 3361 | integer: ::std::option::Option::None,
|
4179 3362 | iso8601_timestamp: ::std::option::Option::None,
|
4180 3363 | json_value: ::std::option::Option::None,
|
4181 3364 | list_of_lists: ::std::option::Option::None,
|
4182 3365 | list_of_maps_of_strings: ::std::option::Option::None,
|
3366 + | list_of_strings: ::std::option::Option::None,
|
4183 3367 | list_of_structs: ::std::option::Option::None,
|
4184 3368 | long: ::std::option::Option::None,
|
4185 3369 | map_of_lists_of_strings: ::std::option::Option::None,
|
4186 3370 | map_of_maps: ::std::option::Option::None,
|
4187 3371 | map_of_strings: ::std::option::Option::None,
|
4188 3372 | map_of_structs: ::std::option::Option::None,
|
4189 3373 | recursive_list: ::std::option::Option::None,
|
4190 3374 | recursive_map: ::std::option::Option::None,
|
4191 3375 | recursive_struct: ::std::option::Option::None,
|
4192 3376 | simple_struct: ::std::option::Option::None,
|
4193 - | string: ::std::option::Option::None,
|
4194 3377 | struct_with_json_name: ::std::option::Option::None,
|
4195 3378 | timestamp: ::std::option::Option::None,
|
4196 3379 | unix_timestamp: ::std::option::Option::None,
|
4197 3380 | };
|
4198 3381 | ::pretty_assertions::assert_eq!(
|
4199 3382 | input.blob,
|
4200 3383 | expected.blob,
|
4201 3384 | "Unexpected value for `blob`"
|
4202 3385 | );
|
4203 3386 | ::pretty_assertions::assert_eq!(
|
7885 6988 | Ok(response)
|
7886 6989 | };
|
7887 6990 | sender.send(()).await.expect("receiver dropped early");
|
7888 6991 | result
|
7889 6992 | }
|
7890 6993 | })
|
7891 6994 | .build_unchecked();
|
7892 6995 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7893 6996 | .await
|
7894 6997 | .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()
|
6998 + | assert!(
|
6999 + | receiver.recv().await.is_some(),
|
7000 + | "we expected operation handler to be invoked but it was not entered"
|
8090 7001 | );
|
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 7002 | }
|
8105 - | /// Parses float shapes
|
8106 - | /// Test ID: parses_float_shapes
|
7003 + | /// Serializes list of structure shapes
|
7004 + | /// Test ID: serializes_list_of_structure_shapes
|
8107 7005 | #[::tokio::test]
|
8108 - | async fn parses_float_shapes_response() {
|
8109 - | let output = crate::output::KitchenSinkOperationOutput {
|
8110 - | float: ::std::option::Option::Some(1234.5_f32),
|
7006 + | #[::tracing_test::traced_test]
|
7007 + | async fn serializes_list_of_structure_shapes_request() {
|
7008 + | #[allow(unused_mut)]
|
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();
|
7015 + | #[allow(unused_mut)]
|
7016 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7017 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
7018 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
7019 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
7020 + | let sender = sender.clone();
|
7021 + | async move {
|
7022 + | let result = {
|
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 + | ]),
|
8111 7036 | blob: ::std::option::Option::None,
|
8112 7037 | boolean: ::std::option::Option::None,
|
8113 7038 | double: ::std::option::Option::None,
|
8114 7039 | empty_struct: ::std::option::Option::None,
|
7040 + | float: ::std::option::Option::None,
|
8115 7041 | httpdate_timestamp: ::std::option::Option::None,
|
8116 7042 | integer: ::std::option::Option::None,
|
8117 7043 | iso8601_timestamp: ::std::option::Option::None,
|
8118 7044 | json_value: ::std::option::Option::None,
|
8119 7045 | list_of_lists: ::std::option::Option::None,
|
8120 7046 | list_of_maps_of_strings: ::std::option::Option::None,
|
8121 7047 | list_of_strings: ::std::option::Option::None,
|
8122 - | list_of_structs: ::std::option::Option::None,
|
8123 7048 | long: ::std::option::Option::None,
|
8124 7049 | map_of_lists_of_strings: ::std::option::Option::None,
|
8125 7050 | map_of_maps: ::std::option::Option::None,
|
8126 7051 | map_of_strings: ::std::option::Option::None,
|
8127 7052 | map_of_structs: ::std::option::Option::None,
|
8128 7053 | recursive_list: ::std::option::Option::None,
|
8129 7054 | recursive_map: ::std::option::Option::None,
|
8130 7055 | recursive_struct: ::std::option::Option::None,
|
8131 7056 | simple_struct: ::std::option::Option::None,
|
8132 7057 | string: ::std::option::Option::None,
|
8133 7058 | struct_with_json_name: ::std::option::Option::None,
|
8134 7059 | timestamp: ::std::option::Option::None,
|
8135 7060 | unix_timestamp: ::std::option::Option::None,
|
8136 7061 | };
|
8137 - | use ::aws_smithy_http_server::response::IntoResponse;
|
8138 - | let http_response = output.into_response();
|
8139 7062 | ::pretty_assertions::assert_eq!(
|
8140 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8141 - | http_response.status()
|
7063 + | input.blob,
|
7064 + | expected.blob,
|
7065 + | "Unexpected value for `blob`"
|
8142 7066 | );
|
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),
|
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 {
|
8163 7195 | blob: ::std::option::Option::None,
|
8164 7196 | boolean: ::std::option::Option::None,
|
7197 + | double: ::std::option::Option::None,
|
8165 7198 | empty_struct: ::std::option::Option::None,
|
8166 7199 | float: ::std::option::Option::None,
|
8167 7200 | httpdate_timestamp: ::std::option::Option::None,
|
8168 7201 | integer: ::std::option::Option::None,
|
8169 7202 | iso8601_timestamp: ::std::option::Option::None,
|
8170 7203 | json_value: ::std::option::Option::None,
|
8171 7204 | list_of_lists: ::std::option::Option::None,
|
8172 7205 | list_of_maps_of_strings: ::std::option::Option::None,
|
8173 7206 | list_of_strings: ::std::option::Option::None,
|
8174 7207 | list_of_structs: ::std::option::Option::None,
|
8175 7208 | long: ::std::option::Option::None,
|
8176 7209 | map_of_lists_of_strings: ::std::option::Option::None,
|
8177 7210 | map_of_maps: ::std::option::Option::None,
|
8178 7211 | map_of_strings: ::std::option::Option::None,
|
8179 7212 | map_of_structs: ::std::option::Option::None,
|
8180 7213 | recursive_list: ::std::option::Option::None,
|
8181 7214 | recursive_map: ::std::option::Option::None,
|
8182 7215 | recursive_struct: ::std::option::Option::None,
|
8183 7216 | simple_struct: ::std::option::Option::None,
|
8184 7217 | string: ::std::option::Option::None,
|
8185 7218 | struct_with_json_name: ::std::option::Option::None,
|
8186 7219 | timestamp: ::std::option::Option::None,
|
8187 7220 | unix_timestamp: ::std::option::Option::None,
|
8188 7221 | };
|
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())
|
7222 + | Ok(response)
|
7223 + | };
|
7224 + | sender.send(()).await.expect("receiver dropped early");
|
7225 + | result
|
7226 + | }
|
7227 + | })
|
7228 + | .build_unchecked();
|
7229 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8201 7230 | .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 - | ));
|
7231 + | .expect("unable to make an HTTP request");
|
7232 + | assert!(
|
7233 + | receiver.recv().await.is_some(),
|
7234 + | "we expected operation handler to be invoked but it was not entered"
|
7235 + | );
|
8208 7236 | }
|
8209 - | /// Parses boolean shapes (true)
|
8210 - | /// Test ID: parses_boolean_shapes_true
|
7237 + | /// Serializes list of recursive structure shapes
|
7238 + | /// Test ID: serializes_list_of_recursive_structure_shapes
|
8211 7239 | #[::tokio::test]
|
8212 - | async fn parses_boolean_shapes_true_response() {
|
8213 - | let output = crate::output::KitchenSinkOperationOutput {
|
8214 - | boolean: ::std::option::Option::Some(true),
|
7240 + | #[::tracing_test::traced_test]
|
7241 + | async fn serializes_list_of_recursive_structure_shapes_request() {
|
7242 + | #[allow(unused_mut)]
|
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();
|
7249 + | #[allow(unused_mut)]
|
7250 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7251 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
7252 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
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),
|
8215 7266 | blob: ::std::option::Option::None,
|
7267 + | boolean: ::std::option::Option::None,
|
8216 7268 | double: ::std::option::Option::None,
|
8217 7269 | empty_struct: ::std::option::Option::None,
|
8218 7270 | float: ::std::option::Option::None,
|
8219 7271 | httpdate_timestamp: ::std::option::Option::None,
|
8220 - | integer: ::std::option::Option::None,
|
8221 7272 | iso8601_timestamp: ::std::option::Option::None,
|
8222 7273 | json_value: ::std::option::Option::None,
|
8223 7274 | list_of_lists: ::std::option::Option::None,
|
8224 - | list_of_maps_of_strings: ::std::option::Option::None,
|
7275 + | list_of_maps_of_strings:
|
7276 + | ::std::option::Option::None,
|
8225 7277 | list_of_strings: ::std::option::Option::None,
|
8226 7278 | list_of_structs: ::std::option::Option::None,
|
8227 7279 | long: ::std::option::Option::None,
|
8228 - | map_of_lists_of_strings: ::std::option::Option::None,
|
7280 + | map_of_lists_of_strings:
|
7281 + | ::std::option::Option::None,
|
8229 7282 | map_of_maps: ::std::option::Option::None,
|
8230 7283 | map_of_strings: ::std::option::Option::None,
|
8231 7284 | map_of_structs: ::std::option::Option::None,
|
8232 7285 | recursive_list: ::std::option::Option::None,
|
8233 7286 | recursive_map: ::std::option::Option::None,
|
8234 7287 | recursive_struct: ::std::option::Option::None,
|
8235 7288 | simple_struct: ::std::option::Option::None,
|
8236 7289 | string: ::std::option::Option::None,
|
8237 - | struct_with_json_name: ::std::option::Option::None,
|
7290 + | struct_with_json_name:
|
7291 + | ::std::option::Option::None,
|
8238 7292 | timestamp: ::std::option::Option::None,
|
8239 7293 | 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),
|
7294 + | },
|
7295 + | ]),
|
8267 7296 | blob: ::std::option::Option::None,
|
7297 + | boolean: ::std::option::Option::None,
|
8268 7298 | double: ::std::option::Option::None,
|
8269 7299 | empty_struct: ::std::option::Option::None,
|
8270 7300 | float: ::std::option::Option::None,
|
8271 7301 | httpdate_timestamp: ::std::option::Option::None,
|
8272 7302 | integer: ::std::option::Option::None,
|
8273 7303 | iso8601_timestamp: ::std::option::Option::None,
|
8274 7304 | json_value: ::std::option::Option::None,
|
8275 7305 | list_of_lists: ::std::option::Option::None,
|
8276 7306 | list_of_maps_of_strings: ::std::option::Option::None,
|
8277 7307 | list_of_strings: ::std::option::Option::None,
|
8278 7308 | list_of_structs: ::std::option::Option::None,
|
8279 7309 | long: ::std::option::Option::None,
|
8280 7310 | map_of_lists_of_strings: ::std::option::Option::None,
|
8281 7311 | map_of_maps: ::std::option::Option::None,
|
8282 7312 | map_of_strings: ::std::option::Option::None,
|
8283 7313 | map_of_structs: ::std::option::Option::None,
|
8284 - | recursive_list: ::std::option::Option::None,
|
8285 7314 | recursive_map: ::std::option::Option::None,
|
8286 7315 | recursive_struct: ::std::option::Option::None,
|
8287 7316 | simple_struct: ::std::option::Option::None,
|
8288 7317 | string: ::std::option::Option::None,
|
8289 7318 | struct_with_json_name: ::std::option::Option::None,
|
8290 7319 | timestamp: ::std::option::Option::None,
|
8291 7320 | 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")),
|
7321 + | },
|
7322 + | ]),
|
7323 + | blob: ::std::option::Option::None,
|
8319 7324 | boolean: ::std::option::Option::None,
|
8320 7325 | double: ::std::option::Option::None,
|
8321 7326 | empty_struct: ::std::option::Option::None,
|
8322 7327 | float: ::std::option::Option::None,
|
8323 7328 | httpdate_timestamp: ::std::option::Option::None,
|
8324 7329 | integer: ::std::option::Option::None,
|
8325 7330 | iso8601_timestamp: ::std::option::Option::None,
|
8326 7331 | json_value: ::std::option::Option::None,
|
8327 7332 | list_of_lists: ::std::option::Option::None,
|
8328 7333 | list_of_maps_of_strings: ::std::option::Option::None,
|
8329 7334 | list_of_strings: ::std::option::Option::None,
|
8330 7335 | list_of_structs: ::std::option::Option::None,
|
8331 7336 | long: ::std::option::Option::None,
|
8332 7337 | map_of_lists_of_strings: ::std::option::Option::None,
|
8333 7338 | map_of_maps: ::std::option::Option::None,
|
8334 7339 | map_of_strings: ::std::option::Option::None,
|
8335 7340 | map_of_structs: ::std::option::Option::None,
|
8336 - | recursive_list: ::std::option::Option::None,
|
8337 7341 | recursive_map: ::std::option::Option::None,
|
8338 7342 | recursive_struct: ::std::option::Option::None,
|
8339 7343 | simple_struct: ::std::option::Option::None,
|
8340 7344 | string: ::std::option::Option::None,
|
8341 7345 | struct_with_json_name: ::std::option::Option::None,
|
8342 7346 | timestamp: ::std::option::Option::None,
|
8343 7347 | 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 - | ),
|
7348 + | },
|
7349 + | ]),
|
8373 7350 | blob: ::std::option::Option::None,
|
8374 7351 | boolean: ::std::option::Option::None,
|
8375 7352 | double: ::std::option::Option::None,
|
8376 7353 | empty_struct: ::std::option::Option::None,
|
8377 7354 | float: ::std::option::Option::None,
|
8378 7355 | httpdate_timestamp: ::std::option::Option::None,
|
8379 7356 | integer: ::std::option::Option::None,
|
8380 7357 | iso8601_timestamp: ::std::option::Option::None,
|
8381 7358 | json_value: ::std::option::Option::None,
|
8382 7359 | list_of_lists: ::std::option::Option::None,
|
8383 7360 | list_of_maps_of_strings: ::std::option::Option::None,
|
8384 7361 | list_of_strings: ::std::option::Option::None,
|
8385 7362 | list_of_structs: ::std::option::Option::None,
|
8386 7363 | long: ::std::option::Option::None,
|
8387 7364 | map_of_lists_of_strings: ::std::option::Option::None,
|
8388 7365 | map_of_maps: ::std::option::Option::None,
|
8389 7366 | map_of_strings: ::std::option::Option::None,
|
8390 7367 | map_of_structs: ::std::option::Option::None,
|
8391 - | recursive_list: ::std::option::Option::None,
|
8392 7368 | recursive_map: ::std::option::Option::None,
|
8393 7369 | recursive_struct: ::std::option::Option::None,
|
8394 7370 | simple_struct: ::std::option::Option::None,
|
8395 7371 | string: ::std::option::Option::None,
|
8396 7372 | struct_with_json_name: ::std::option::Option::None,
|
7373 + | timestamp: ::std::option::Option::None,
|
8397 7374 | unix_timestamp: ::std::option::Option::None,
|
8398 7375 | };
|
8399 - | use ::aws_smithy_http_server::response::IntoResponse;
|
8400 - | let http_response = output.into_response();
|
8401 7376 | ::pretty_assertions::assert_eq!(
|
8402 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8403 - | http_response.status()
|
7377 + | input.blob,
|
7378 + | expected.blob,
|
7379 + | "Unexpected value for `blob`"
|
8404 7380 | );
|
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())
|
8411 - | .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 - | ),
|
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 {
|
8427 7509 | blob: ::std::option::Option::None,
|
8428 7510 | boolean: ::std::option::Option::None,
|
8429 7511 | double: ::std::option::Option::None,
|
8430 7512 | empty_struct: ::std::option::Option::None,
|
8431 7513 | float: ::std::option::Option::None,
|
8432 7514 | httpdate_timestamp: ::std::option::Option::None,
|
8433 7515 | integer: ::std::option::Option::None,
|
7516 + | iso8601_timestamp: ::std::option::Option::None,
|
8434 7517 | json_value: ::std::option::Option::None,
|
8435 7518 | list_of_lists: ::std::option::Option::None,
|
8436 7519 | list_of_maps_of_strings: ::std::option::Option::None,
|
8437 7520 | list_of_strings: ::std::option::Option::None,
|
8438 7521 | list_of_structs: ::std::option::Option::None,
|
8439 7522 | long: ::std::option::Option::None,
|
8440 7523 | map_of_lists_of_strings: ::std::option::Option::None,
|
8441 7524 | map_of_maps: ::std::option::Option::None,
|
8442 7525 | map_of_strings: ::std::option::Option::None,
|
8443 7526 | map_of_structs: ::std::option::Option::None,
|
8444 7527 | recursive_list: ::std::option::Option::None,
|
8445 7528 | recursive_map: ::std::option::Option::None,
|
8446 7529 | recursive_struct: ::std::option::Option::None,
|
8447 7530 | simple_struct: ::std::option::Option::None,
|
8448 7531 | string: ::std::option::Option::None,
|
8449 7532 | struct_with_json_name: ::std::option::Option::None,
|
8450 7533 | timestamp: ::std::option::Option::None,
|
8451 7534 | unix_timestamp: ::std::option::Option::None,
|
8452 7535 | };
|
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()
|
8458 - | );
|
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())
|
7536 + | Ok(response)
|
7537 + | };
|
7538 + | sender.send(()).await.expect("receiver dropped early");
|
7539 + | result
|
7540 + | }
|
7541 + | })
|
7542 + | .build_unchecked();
|
7543 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8465 7544 | .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 - | ));
|
7545 + | .expect("unable to make an HTTP request");
|
7546 + | assert!(
|
7547 + | receiver.recv().await.is_some(),
|
7548 + | "we expected operation handler to be invoked but it was not entered"
|
7549 + | );
|
8472 7550 | }
|
8473 - | /// Parses httpdate timestamps
|
8474 - | /// Test ID: parses_httpdate_timestamps
|
7551 + | /// Serializes map shapes
|
7552 + | /// Test ID: serializes_map_shapes
|
8475 7553 | #[::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),
|
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(),
|
8480 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 + | }),
|
8481 7584 | blob: ::std::option::Option::None,
|
8482 7585 | boolean: ::std::option::Option::None,
|
8483 7586 | double: ::std::option::Option::None,
|
8484 7587 | empty_struct: ::std::option::Option::None,
|
8485 7588 | float: ::std::option::Option::None,
|
7589 + | httpdate_timestamp: ::std::option::Option::None,
|
8486 7590 | integer: ::std::option::Option::None,
|
8487 7591 | iso8601_timestamp: ::std::option::Option::None,
|
8488 7592 | json_value: ::std::option::Option::None,
|
8489 7593 | list_of_lists: ::std::option::Option::None,
|
8490 7594 | list_of_maps_of_strings: ::std::option::Option::None,
|
8491 7595 | list_of_strings: ::std::option::Option::None,
|
8492 7596 | list_of_structs: ::std::option::Option::None,
|
8493 7597 | long: ::std::option::Option::None,
|
8494 7598 | map_of_lists_of_strings: ::std::option::Option::None,
|
8495 7599 | map_of_maps: ::std::option::Option::None,
|
8496 - | map_of_strings: ::std::option::Option::None,
|
8497 7600 | map_of_structs: ::std::option::Option::None,
|
8498 7601 | recursive_list: ::std::option::Option::None,
|
8499 7602 | recursive_map: ::std::option::Option::None,
|
8500 7603 | recursive_struct: ::std::option::Option::None,
|
8501 7604 | simple_struct: ::std::option::Option::None,
|
8502 7605 | string: ::std::option::Option::None,
|
8503 7606 | struct_with_json_name: ::std::option::Option::None,
|
8504 7607 | timestamp: ::std::option::Option::None,
|
8505 7608 | unix_timestamp: ::std::option::Option::None,
|
8506 7609 | };
|
8507 - | use ::aws_smithy_http_server::response::IntoResponse;
|
8508 - | let http_response = output.into_response();
|
8509 7610 | ::pretty_assertions::assert_eq!(
|
8510 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8511 - | http_response.status()
|
7611 + | input.blob,
|
7612 + | expected.blob,
|
7613 + | "Unexpected value for `blob`"
|
8512 7614 | );
|
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())
|
8519 - | .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 - | ));
|
8526 - | }
|
8527 - | /// Parses list shapes
|
8528 - | /// Test ID: parses_list_shapes
|
8529 - | #[::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,
|
8562 - | };
|
8563 - | use ::aws_smithy_http_server::response::IntoResponse;
|
8564 - | let http_response = output.into_response();
|
8565 7615 | ::pretty_assertions::assert_eq!(
|
8566 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8567 - | http_response.status()
|
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`"
|
8568 7741 | );
|
8569 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8570 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8571 - | http_response.headers(),
|
8572 - | expected_headers,
|
8573 - | ));
|
8574 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8575 - | .await
|
8576 - | .expect("unable to extract body to bytes");
|
8577 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8578 - | &body,
|
8579 - | "{\"ListOfStrings\":[\"abc\",\"mno\",\"xyz\"]}",
|
8580 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8581 - | ));
|
8582 - | }
|
8583 - | /// Parses list of map shapes
|
8584 - | /// Test ID: parses_list_of_map_shapes
|
8585 - | #[::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 - | ]),
|
7742 + | let response = crate::output::KitchenSinkOperationOutput {
|
8600 7743 | blob: ::std::option::Option::None,
|
8601 7744 | boolean: ::std::option::Option::None,
|
8602 7745 | double: ::std::option::Option::None,
|
8603 7746 | empty_struct: ::std::option::Option::None,
|
8604 7747 | float: ::std::option::Option::None,
|
8605 7748 | httpdate_timestamp: ::std::option::Option::None,
|
8606 7749 | integer: ::std::option::Option::None,
|
8607 7750 | iso8601_timestamp: ::std::option::Option::None,
|
8608 7751 | json_value: ::std::option::Option::None,
|
8609 7752 | list_of_lists: ::std::option::Option::None,
|
7753 + | list_of_maps_of_strings: ::std::option::Option::None,
|
8610 7754 | list_of_strings: ::std::option::Option::None,
|
8611 7755 | list_of_structs: ::std::option::Option::None,
|
8612 7756 | long: ::std::option::Option::None,
|
8613 7757 | map_of_lists_of_strings: ::std::option::Option::None,
|
8614 7758 | map_of_maps: ::std::option::Option::None,
|
8615 7759 | map_of_strings: ::std::option::Option::None,
|
8616 7760 | map_of_structs: ::std::option::Option::None,
|
8617 7761 | recursive_list: ::std::option::Option::None,
|
8618 7762 | recursive_map: ::std::option::Option::None,
|
8619 7763 | recursive_struct: ::std::option::Option::None,
|
8620 7764 | simple_struct: ::std::option::Option::None,
|
8621 7765 | string: ::std::option::Option::None,
|
8622 7766 | struct_with_json_name: ::std::option::Option::None,
|
8623 7767 | timestamp: ::std::option::Option::None,
|
8624 7768 | unix_timestamp: ::std::option::Option::None,
|
8625 7769 | };
|
8626 - | use ::aws_smithy_http_server::response::IntoResponse;
|
8627 - | let http_response = output.into_response();
|
8628 - | ::pretty_assertions::assert_eq!(
|
8629 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8630 - | http_response.status()
|
8631 - | );
|
8632 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8633 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8634 - | http_response.headers(),
|
8635 - | expected_headers,
|
8636 - | ));
|
8637 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
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)
|
8638 7778 | .await
|
8639 - | .expect("unable to extract body to bytes");
|
8640 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8641 - | &body,
|
8642 - | "{\"ListOfMapsOfStrings\":[{\"size\":\"large\"},{\"color\":\"red\"}]}",
|
8643 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8644 - | ));
|
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 + | );
|
8645 7784 | }
|
8646 - | /// Parses list of list shapes
|
8647 - | /// Test ID: parses_list_of_list_shapes
|
7785 + | /// Serializes empty map shapes
|
7786 + | /// Test ID: serializes_empty_map_shapes
|
8648 7787 | #[::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 - | ]),
|
7788 + | #[::tracing_test::traced_test]
|
7789 + | async fn serializes_empty_map_shapes_request() {
|
7790 + | #[allow(unused_mut)]
|
7791 + | let mut http_request = http::Request::builder()
|
7792 + | .uri("/")
|
7793 + | .method("POST")
|
7794 + | .header("Content-Type", "application/x-amz-json-1.1")
|
7795 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
7796 + | .body(::aws_smithy_http_server::body::Body::from(
|
7797 + | ::bytes::Bytes::from_static("{\"MapOfStrings\":{}}".as_bytes()),
|
7798 + | ))
|
7799 + | .unwrap();
|
7800 + | #[allow(unused_mut)]
|
7801 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7802 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
7803 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
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 + | ),
|
8655 7813 | blob: ::std::option::Option::None,
|
8656 7814 | boolean: ::std::option::Option::None,
|
8657 7815 | double: ::std::option::Option::None,
|
8658 7816 | empty_struct: ::std::option::Option::None,
|
8659 7817 | float: ::std::option::Option::None,
|
8660 7818 | httpdate_timestamp: ::std::option::Option::None,
|
8661 7819 | integer: ::std::option::Option::None,
|
8662 7820 | iso8601_timestamp: ::std::option::Option::None,
|
8663 7821 | json_value: ::std::option::Option::None,
|
7822 + | list_of_lists: ::std::option::Option::None,
|
8664 7823 | list_of_maps_of_strings: ::std::option::Option::None,
|
8665 7824 | list_of_strings: ::std::option::Option::None,
|
8666 7825 | list_of_structs: ::std::option::Option::None,
|
8667 7826 | long: ::std::option::Option::None,
|
8668 7827 | map_of_lists_of_strings: ::std::option::Option::None,
|
8669 7828 | map_of_maps: ::std::option::Option::None,
|
8670 - | map_of_strings: ::std::option::Option::None,
|
8671 7829 | map_of_structs: ::std::option::Option::None,
|
8672 7830 | recursive_list: ::std::option::Option::None,
|
8673 7831 | recursive_map: ::std::option::Option::None,
|
8674 7832 | recursive_struct: ::std::option::Option::None,
|
8675 7833 | simple_struct: ::std::option::Option::None,
|
8676 7834 | string: ::std::option::Option::None,
|
8677 7835 | struct_with_json_name: ::std::option::Option::None,
|
8678 7836 | timestamp: ::std::option::Option::None,
|
8679 7837 | unix_timestamp: ::std::option::Option::None,
|
8680 7838 | };
|
8681 - | use ::aws_smithy_http_server::response::IntoResponse;
|
8682 - | let http_response = output.into_response();
|
8683 7839 | ::pretty_assertions::assert_eq!(
|
8684 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
8685 - | http_response.status()
|
7840 + | input.blob,
|
7841 + | expected.blob,
|
7842 + | "Unexpected value for `blob`"
|
8686 7843 | );
|
8687 - | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
8688 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8689 - | http_response.headers(),
|
8690 - | expected_headers,
|
8691 - | ));
|
8692 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8693 - | .await
|
8694 - | .expect("unable to extract body to bytes");
|
8695 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
8696 - | &body,
|
8697 - | "{\"ListOfLists\":[[\"abc\",\"mno\",\"xyz\"],[\"hjk\",\"qrs\",\"tuv\"]]}",
|
8698 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
8699 - | ));
|
8700 - | }
|
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 - | ]),
|
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 {
|
8714 7972 | blob: ::std::option::Option::None,
|
8715 7973 | boolean: ::std::option::Option::None,
|
8716 7974 | double: ::std::option::Option::None,
|
8717 7975 | empty_struct: ::std::option::Option::None,
|
8718 7976 | float: ::std::option::Option::None,
|
8719 7977 | httpdate_timestamp: ::std::option::Option::None,
|
8720 7978 | integer: ::std::option::Option::None,
|
8721 7979 | iso8601_timestamp: ::std::option::Option::None,
|
8722 7980 | json_value: ::std::option::Option::None,
|
8723 7981 | list_of_lists: ::std::option::Option::None,
|
8724 7982 | list_of_maps_of_strings: ::std::option::Option::None,
|
8725 7983 | list_of_strings: ::std::option::Option::None,
|
7984 + | list_of_structs: ::std::option::Option::None,
|
8726 7985 | long: ::std::option::Option::None,
|
8727 7986 | map_of_lists_of_strings: ::std::option::Option::None,
|
8728 7987 | map_of_maps: ::std::option::Option::None,
|
8729 7988 | map_of_strings: ::std::option::Option::None,
|
8730 7989 | map_of_structs: ::std::option::Option::None,
|
8731 7990 | recursive_list: ::std::option::Option::None,
|
8732 7991 | recursive_map: ::std::option::Option::None,
|
8733 7992 | recursive_struct: ::std::option::Option::None,
|
8734 7993 | simple_struct: ::std::option::Option::None,
|
8735 7994 | string: ::std::option::Option::None,
|
8736 7995 | struct_with_json_name: ::std::option::Option::None,
|
8737 7996 | timestamp: ::std::option::Option::None,
|
8738 7997 | unix_timestamp: ::std::option::Option::None,
|
8739 7998 | };
|
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()
|
8745 - | );
|
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())
|
7999 + | Ok(response)
|
8000 + | };
|
8001 + | sender.send(()).await.expect("receiver dropped early");
|
8002 + | result
|
8003 + | }
|
8004 + | })
|
8005 + | .build_unchecked();
|
8006 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8752 8007 | .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 - | ));
|
8008 + | .expect("unable to make an HTTP request");
|
8009 + | assert!(
|
8010 + | receiver.recv().await.is_some(),
|
8011 + | "we expected operation handler to be invoked but it was not entered"
|
8012 + | );
|
8759 8013 | }
|
8760 - | /// Parses list of recursive structure shapes
|
8761 - | /// Test ID: parses_list_of_recursive_structure_shapes
|
8014 + | /// Serializes map of list shapes
|
8015 + | /// Test ID: serializes_map_of_list_shapes
|
8762 8016 | #[::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()),
|
8017 + | #[::tracing_test::traced_test]
|
8018 + | async fn serializes_map_of_list_shapes_request() {
|
8019 + | #[allow(unused_mut)]
|
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();
|
8026 + | #[allow(unused_mut)]
|
8027 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8028 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
8029 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
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 + | }),
|
8769 8048 | blob: ::std::option::Option::None,
|
8770 8049 | boolean: ::std::option::Option::None,
|
8771 8050 | double: ::std::option::Option::None,
|
8772 8051 | empty_struct: ::std::option::Option::None,
|
8773 8052 | float: ::std::option::Option::None,
|
8774 8053 | httpdate_timestamp: ::std::option::Option::None,
|
8775 8054 | integer: ::std::option::Option::None,
|
8776 8055 | iso8601_timestamp: ::std::option::Option::None,
|
8777 8056 | json_value: ::std::option::Option::None,
|
8778 8057 | list_of_lists: ::std::option::Option::None,
|
8779 8058 | list_of_maps_of_strings: ::std::option::Option::None,
|
8780 8059 | list_of_strings: ::std::option::Option::None,
|
8781 8060 | list_of_structs: ::std::option::Option::None,
|
8782 8061 | long: ::std::option::Option::None,
|
8783 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8784 8062 | map_of_maps: ::std::option::Option::None,
|
8785 8063 | map_of_strings: ::std::option::Option::None,
|
8786 8064 | map_of_structs: ::std::option::Option::None,
|
8787 8065 | recursive_list: ::std::option::Option::None,
|
8788 8066 | recursive_map: ::std::option::Option::None,
|
8789 8067 | recursive_struct: ::std::option::Option::None,
|
8790 8068 | simple_struct: ::std::option::Option::None,
|
8069 + | string: ::std::option::Option::None,
|
8791 8070 | struct_with_json_name: ::std::option::Option::None,
|
8792 8071 | timestamp: ::std::option::Option::None,
|
8793 8072 | unix_timestamp: ::std::option::Option::None,
|
8794 - | }]),
|
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 {
|
8795 8207 | blob: ::std::option::Option::None,
|
8796 8208 | boolean: ::std::option::Option::None,
|
8797 8209 | double: ::std::option::Option::None,
|
8798 8210 | empty_struct: ::std::option::Option::None,
|
8799 8211 | float: ::std::option::Option::None,
|
8800 8212 | httpdate_timestamp: ::std::option::Option::None,
|
8801 8213 | integer: ::std::option::Option::None,
|
8802 8214 | iso8601_timestamp: ::std::option::Option::None,
|
8803 8215 | json_value: ::std::option::Option::None,
|
8804 8216 | list_of_lists: ::std::option::Option::None,
|
8805 8217 | list_of_maps_of_strings: ::std::option::Option::None,
|
8806 8218 | list_of_strings: ::std::option::Option::None,
|
8807 8219 | list_of_structs: ::std::option::Option::None,
|
8808 8220 | long: ::std::option::Option::None,
|
8809 8221 | map_of_lists_of_strings: ::std::option::Option::None,
|
8810 8222 | map_of_maps: ::std::option::Option::None,
|
8811 8223 | map_of_strings: ::std::option::Option::None,
|
8812 8224 | map_of_structs: ::std::option::Option::None,
|
8225 + | recursive_list: ::std::option::Option::None,
|
8813 8226 | recursive_map: ::std::option::Option::None,
|
8814 8227 | recursive_struct: ::std::option::Option::None,
|
8815 8228 | simple_struct: ::std::option::Option::None,
|
8816 8229 | string: ::std::option::Option::None,
|
8817 8230 | struct_with_json_name: ::std::option::Option::None,
|
8818 8231 | timestamp: ::std::option::Option::None,
|
8819 8232 | unix_timestamp: ::std::option::Option::None,
|
8820 - | }]),
|
8233 + | };
|
8234 + | Ok(response)
|
8235 + | };
|
8236 + | sender.send(()).await.expect("receiver dropped early");
|
8237 + | result
|
8238 + | }
|
8239 + | })
|
8240 + | .build_unchecked();
|
8241 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8242 + | .await
|
8243 + | .expect("unable to make an HTTP request");
|
8244 + | assert!(
|
8245 + | receiver.recv().await.is_some(),
|
8246 + | "we expected operation handler to be invoked but it was not entered"
|
8247 + | );
|
8248 + | }
|
8249 + | /// Serializes map of structure shapes
|
8250 + | /// Test ID: serializes_map_of_structure_shapes
|
8251 + | #[::tokio::test]
|
8252 + | #[::tracing_test::traced_test]
|
8253 + | async fn serializes_map_of_structure_shapes_request() {
|
8254 + | #[allow(unused_mut)]
|
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();
|
8261 + | #[allow(unused_mut)]
|
8262 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8263 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
8264 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
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 + | }),
|
8821 8287 | blob: ::std::option::Option::None,
|
8822 8288 | boolean: ::std::option::Option::None,
|
8823 8289 | double: ::std::option::Option::None,
|
8824 8290 | empty_struct: ::std::option::Option::None,
|
8825 8291 | float: ::std::option::Option::None,
|
8826 8292 | httpdate_timestamp: ::std::option::Option::None,
|
8827 8293 | integer: ::std::option::Option::None,
|
8828 8294 | iso8601_timestamp: ::std::option::Option::None,
|
8829 8295 | json_value: ::std::option::Option::None,
|
8830 8296 | list_of_lists: ::std::option::Option::None,
|
8831 8297 | list_of_maps_of_strings: ::std::option::Option::None,
|
8832 8298 | list_of_strings: ::std::option::Option::None,
|
8833 8299 | list_of_structs: ::std::option::Option::None,
|
8834 8300 | long: ::std::option::Option::None,
|
8835 8301 | map_of_lists_of_strings: ::std::option::Option::None,
|
8836 8302 | map_of_maps: ::std::option::Option::None,
|
8837 8303 | map_of_strings: ::std::option::Option::None,
|
8838 - | map_of_structs: ::std::option::Option::None,
|
8304 + | recursive_list: ::std::option::Option::None,
|
8839 8305 | recursive_map: ::std::option::Option::None,
|
8840 8306 | recursive_struct: ::std::option::Option::None,
|
8841 8307 | simple_struct: ::std::option::Option::None,
|
8842 8308 | string: ::std::option::Option::None,
|
8843 8309 | struct_with_json_name: ::std::option::Option::None,
|
8844 8310 | timestamp: ::std::option::Option::None,
|
8845 8311 | unix_timestamp: ::std::option::Option::None,
|
8846 - | }]),
|
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 {
|
8847 8446 | blob: ::std::option::Option::None,
|
8848 8447 | boolean: ::std::option::Option::None,
|
8849 8448 | double: ::std::option::Option::None,
|
8850 8449 | empty_struct: ::std::option::Option::None,
|
8851 8450 | float: ::std::option::Option::None,
|
8852 8451 | httpdate_timestamp: ::std::option::Option::None,
|
8853 8452 | integer: ::std::option::Option::None,
|
8854 8453 | iso8601_timestamp: ::std::option::Option::None,
|
8855 8454 | json_value: ::std::option::Option::None,
|
8856 8455 | list_of_lists: ::std::option::Option::None,
|
8857 8456 | list_of_maps_of_strings: ::std::option::Option::None,
|
8858 8457 | list_of_strings: ::std::option::Option::None,
|
8859 8458 | list_of_structs: ::std::option::Option::None,
|
8860 8459 | long: ::std::option::Option::None,
|
8861 8460 | map_of_lists_of_strings: ::std::option::Option::None,
|
8862 8461 | map_of_maps: ::std::option::Option::None,
|
8863 8462 | map_of_strings: ::std::option::Option::None,
|
8864 8463 | map_of_structs: ::std::option::Option::None,
|
8464 + | recursive_list: ::std::option::Option::None,
|
8865 8465 | recursive_map: ::std::option::Option::None,
|
8866 8466 | recursive_struct: ::std::option::Option::None,
|
8867 8467 | simple_struct: ::std::option::Option::None,
|
8868 8468 | string: ::std::option::Option::None,
|
8869 8469 | struct_with_json_name: ::std::option::Option::None,
|
8870 8470 | timestamp: ::std::option::Option::None,
|
8871 8471 | unix_timestamp: ::std::option::Option::None,
|
8872 8472 | };
|
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()
|
8878 - | );
|
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())
|
8473 + | Ok(response)
|
8474 + | };
|
8475 + | sender.send(()).await.expect("receiver dropped early");
|
8476 + | result
|
8477 + | }
|
8478 + | })
|
8479 + | .build_unchecked();
|
8480 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8885 8481 | .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"))
|
8482 + | .expect("unable to make an HTTP request");
|
8483 + | assert!(
|
8484 + | receiver.recv().await.is_some(),
|
8485 + | "we expected operation handler to be invoked but it was not entered"
|
8486 + | );
|
8487 + | }
|
8488 + | /// Serializes map of recursive structure shapes
|
8489 + | /// Test ID: serializes_map_of_recursive_structure_shapes
|
8490 + | #[::tokio::test]
|
8491 + | #[::tracing_test::traced_test]
|
8492 + | async fn serializes_map_of_recursive_structure_shapes_request() {
|
8493 + | #[allow(unused_mut)]
|
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();
|
8500 + | #[allow(unused_mut)]
|
8501 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8502 + | let config = crate::service::JsonProtocolConfig::builder().build();
|
8503 + | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
8504 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
8505 + | let sender = sender.clone();
|
8506 + | async move {
|
8507 + | let result = {
|
8508 + | use ::aws_smithy_protocol_test::FloatEquals;
|
8509 + | let expected = crate::input::KitchenSinkOperationInput {
|
8510 + | recursive_map: ::std::option::Option::Some({
|
8511 + | let mut ret = ::std::collections::HashMap::new();
|
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 + | },
|
8889 8576 | );
|
8890 - | }
|
8891 - | /// Parses map shapes
|
8892 - | /// Test ID: parses_map_shapes
|
8893 - | #[::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 8577 | ret
|
8901 8578 | }),
|
8902 8579 | blob: ::std::option::Option::None,
|
8903 8580 | boolean: ::std::option::Option::None,
|
8904 8581 | double: ::std::option::Option::None,
|
8905 8582 | empty_struct: ::std::option::Option::None,
|
8906 8583 | float: ::std::option::Option::None,
|
8907 8584 | httpdate_timestamp: ::std::option::Option::None,
|
8908 8585 | integer: ::std::option::Option::None,
|
8909 8586 | iso8601_timestamp: ::std::option::Option::None,
|
8910 8587 | json_value: ::std::option::Option::None,
|
8911 8588 | list_of_lists: ::std::option::Option::None,
|
8912 - | list_of_maps_of_strings: ::std::option::Option::None,
|
8589 + | list_of_maps_of_strings:
|
8590 + | ::std::option::Option::None,
|
8913 8591 | list_of_strings: ::std::option::Option::None,
|
8914 8592 | list_of_structs: ::std::option::Option::None,
|
8915 8593 | long: ::std::option::Option::None,
|
8916 - | map_of_lists_of_strings: ::std::option::Option::None,
|
8594 + | map_of_lists_of_strings:
|
8595 + | ::std::option::Option::None,
|
8917 8596 | map_of_maps: ::std::option::Option::None,
|
8597 + | map_of_strings: ::std::option::Option::None,
|
8918 8598 | map_of_structs: ::std::option::Option::None,
|
8919 8599 | recursive_list: ::std::option::Option::None,
|
8920 - | recursive_map: ::std::option::Option::None,
|
8921 8600 | recursive_struct: ::std::option::Option::None,
|
8922 8601 | simple_struct: ::std::option::Option::None,
|
8923 8602 | string: ::std::option::Option::None,
|
8924 - | struct_with_json_name: ::std::option::Option::None,
|
8603 + | struct_with_json_name:
|
8604 + | ::std::option::Option::None,
|
8925 8605 | timestamp: ::std::option::Option::None,
|
8926 8606 | 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()
|
8933 - | );
|
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())
|
8940 - | .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 - | ));
|
8947 - | }
|
8948 - | /// Parses map of list shapes
|
8949 - | /// Test ID: parses_map_of_list_shapes
|
8950 - | #[::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()],
|
8607 + | },
|
8962 8608 | );
|
8963 8609 | ret
|
8964 8610 | }),
|
8965 8611 | blob: ::std::option::Option::None,
|
8966 8612 | boolean: ::std::option::Option::None,
|
8967 8613 | double: ::std::option::Option::None,
|
8968 8614 | empty_struct: ::std::option::Option::None,
|
8969 8615 | float: ::std::option::Option::None,
|
8970 8616 | httpdate_timestamp: ::std::option::Option::None,
|
8971 8617 | integer: ::std::option::Option::None,
|
8972 8618 | iso8601_timestamp: ::std::option::Option::None,
|
8973 8619 | json_value: ::std::option::Option::None,
|
8974 8620 | list_of_lists: ::std::option::Option::None,
|
8975 8621 | list_of_maps_of_strings: ::std::option::Option::None,
|
8976 8622 | list_of_strings: ::std::option::Option::None,
|
8977 8623 | list_of_structs: ::std::option::Option::None,
|
8978 8624 | long: ::std::option::Option::None,
|
8625 + | map_of_lists_of_strings: ::std::option::Option::None,
|
8979 8626 | map_of_maps: ::std::option::Option::None,
|
8980 8627 | map_of_strings: ::std::option::Option::None,
|
8981 8628 | map_of_structs: ::std::option::Option::None,
|
8982 8629 | recursive_list: ::std::option::Option::None,
|
8983 - | recursive_map: ::std::option::Option::None,
|
8984 8630 | recursive_struct: ::std::option::Option::None,
|
8985 8631 | simple_struct: ::std::option::Option::None,
|
8986 8632 | string: ::std::option::Option::None,
|
8987 8633 | struct_with_json_name: ::std::option::Option::None,
|
8988 8634 | timestamp: ::std::option::Option::None,
|
8989 8635 | 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())
|
9003 - | .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"))
|
8636 + | },
|
9007 8637 | );
|
9008 - | }
|
9009 - | /// Parses map of map shapes
|
9010 - | /// Test ID: parses_map_of_map_shapes
|
9011 - | #[::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 8638 | ret
|
9029 8639 | }),
|
9030 8640 | blob: ::std::option::Option::None,
|
9031 8641 | boolean: ::std::option::Option::None,
|
9032 8642 | double: ::std::option::Option::None,
|
9033 8643 | empty_struct: ::std::option::Option::None,
|
9034 8644 | float: ::std::option::Option::None,
|
9035 8645 | httpdate_timestamp: ::std::option::Option::None,
|
9036 8646 | integer: ::std::option::Option::None,
|
9037 8647 | iso8601_timestamp: ::std::option::Option::None,
|
9038 8648 | json_value: ::std::option::Option::None,
|
9039 8649 | list_of_lists: ::std::option::Option::None,
|
9040 8650 | list_of_maps_of_strings: ::std::option::Option::None,
|
9041 8651 | list_of_strings: ::std::option::Option::None,
|
9042 8652 | list_of_structs: ::std::option::Option::None,
|
9043 8653 | long: ::std::option::Option::None,
|
9044 8654 | map_of_lists_of_strings: ::std::option::Option::None,
|
8655 + | map_of_maps: ::std::option::Option::None,
|
9045 8656 | map_of_strings: ::std::option::Option::None,
|
9046 8657 | map_of_structs: ::std::option::Option::None,
|
9047 8658 | recursive_list: ::std::option::Option::None,
|
9048 - | recursive_map: ::std::option::Option::None,
|
9049 8659 | recursive_struct: ::std::option::Option::None,
|
9050 8660 | simple_struct: ::std::option::Option::None,
|
9051 8661 | string: ::std::option::Option::None,
|
9052 8662 | struct_with_json_name: ::std::option::Option::None,
|
9053 8663 | timestamp: ::std::option::Option::None,
|
9054 8664 | unix_timestamp: ::std::option::Option::None,
|
9055 8665 | };
|
9056 - | use ::aws_smithy_http_server::response::IntoResponse;
|
9057 - | let http_response = output.into_response();
|
9058 8666 | ::pretty_assertions::assert_eq!(
|
9059 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
9060 - | http_response.status()
|
8667 + | input.blob,
|
8668 + | expected.blob,
|
8669 + | "Unexpected value for `blob`"
|
9061 8670 | );
|
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())
|
9068 - | .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"))
|
8671 + | ::pretty_assertions::assert_eq!(
|
8672 + | input.boolean,
|
8673 + | expected.boolean,
|
8674 + | "Unexpected value for `boolean`"
|
9072 8675 | );
|
9073 - | }
|
9074 - | /// Parses map of structure shapes
|
9075 - | /// Test ID: parses_map_of_structure_shapes
|
9076 - | #[::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 - | },
|
8676 + | assert!(
|
8677 + | input.double.float_equals(&expected.double),
|
8678 + | "Unexpected value for `double` {:?} vs. {:?}",
|
8679 + | expected.double,
|
8680 + | input.double
|
9086 8681 | );
|
9087 - | ret.insert(
|
9088 - | "color".to_owned(),
|
9089 - | crate::model::SimpleStruct {
|
9090 - | value: ::std::option::Option::Some("red".to_owned()),
|
9091 - | },
|
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`"
|
9092 8792 | );
|
9093 - | ret
|
9094 - | }),
|
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 {
|
9095 8799 | blob: ::std::option::Option::None,
|
9096 8800 | boolean: ::std::option::Option::None,
|
9097 8801 | double: ::std::option::Option::None,
|
9098 8802 | empty_struct: ::std::option::Option::None,
|
9099 8803 | float: ::std::option::Option::None,
|
9100 8804 | httpdate_timestamp: ::std::option::Option::None,
|
9101 8805 | integer: ::std::option::Option::None,
|
9102 8806 | iso8601_timestamp: ::std::option::Option::None,
|
9103 8807 | json_value: ::std::option::Option::None,
|
9104 8808 | list_of_lists: ::std::option::Option::None,
|
9105 8809 | list_of_maps_of_strings: ::std::option::Option::None,
|
9106 8810 | list_of_strings: ::std::option::Option::None,
|
9107 8811 | list_of_structs: ::std::option::Option::None,
|
9108 8812 | long: ::std::option::Option::None,
|
9109 8813 | map_of_lists_of_strings: ::std::option::Option::None,
|
9110 8814 | map_of_maps: ::std::option::Option::None,
|
9111 8815 | map_of_strings: ::std::option::Option::None,
|
8816 + | map_of_structs: ::std::option::Option::None,
|
9112 8817 | recursive_list: ::std::option::Option::None,
|
9113 8818 | recursive_map: ::std::option::Option::None,
|
9114 8819 | recursive_struct: ::std::option::Option::None,
|
9115 8820 | simple_struct: ::std::option::Option::None,
|
9116 8821 | string: ::std::option::Option::None,
|
9117 8822 | struct_with_json_name: ::std::option::Option::None,
|
9118 8823 | timestamp: ::std::option::Option::None,
|
9119 8824 | unix_timestamp: ::std::option::Option::None,
|
9120 8825 | };
|
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()
|
9126 - | );
|
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())
|
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)
|
9133 8834 | .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 - | ));
|
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"
|
8839 + | );
|
9140 8840 | }
|
9141 - | /// Parses map of recursive structure shapes
|
9142 - | /// Test ID: parses_map_of_recursive_structure_shapes
|
8841 + | /// Serializes structure shapes
|
8842 + | /// Test ID: serializes_structure_shapes
|
9143 8843 | #[::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,
|
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()),
|
9191 8869 | },
|
9192 - | );
|
9193 - | ret
|
9194 - | }),
|
8870 + | ),
|
9195 8871 | blob: ::std::option::Option::None,
|
9196 8872 | boolean: ::std::option::Option::None,
|
9197 8873 | double: ::std::option::Option::None,
|
9198 8874 | empty_struct: ::std::option::Option::None,
|
9199 8875 | float: ::std::option::Option::None,
|
9200 8876 | httpdate_timestamp: ::std::option::Option::None,
|
9201 8877 | integer: ::std::option::Option::None,
|
9202 8878 | iso8601_timestamp: ::std::option::Option::None,
|
9203 8879 | json_value: ::std::option::Option::None,
|
9204 8880 | list_of_lists: ::std::option::Option::None,
|
9205 8881 | list_of_maps_of_strings: ::std::option::Option::None,
|
9206 8882 | list_of_strings: ::std::option::Option::None,
|
9207 8883 | list_of_structs: ::std::option::Option::None,
|
9208 8884 | long: ::std::option::Option::None,
|
9209 8885 | map_of_lists_of_strings: ::std::option::Option::None,
|
9210 8886 | map_of_maps: ::std::option::Option::None,
|
9211 8887 | map_of_strings: ::std::option::Option::None,
|
9212 8888 | map_of_structs: ::std::option::Option::None,
|
9213 8889 | recursive_list: ::std::option::Option::None,
|
8890 + | recursive_map: ::std::option::Option::None,
|
9214 8891 | recursive_struct: ::std::option::Option::None,
|
9215 - | simple_struct: ::std::option::Option::None,
|
9216 8892 | string: ::std::option::Option::None,
|
9217 8893 | struct_with_json_name: ::std::option::Option::None,
|
9218 8894 | timestamp: ::std::option::Option::None,
|
9219 8895 | unix_timestamp: ::std::option::Option::None,
|
9220 - | },
|
8896 + | };
|
8897 + | ::pretty_assertions::assert_eq!(
|
8898 + | input.blob,
|
8899 + | expected.blob,
|
8900 + | "Unexpected value for `blob`"
|
9221 8901 | );
|
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 - | },
|
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`"
|
9250 9003 | );
|
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 9004 | ::pretty_assertions::assert_eq!(
|
9282 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
9283 - | http_response.status()
|
9005 + | input.simple_struct,
|
9006 + | expected.simple_struct,
|
9007 + | "Unexpected value for `simple_struct`"
|
9284 9008 | );
|
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())
|
9291 - | .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"))
|
9009 + | ::pretty_assertions::assert_eq!(
|
9010 + | input.string,
|
9011 + | expected.string,
|
9012 + | "Unexpected value for `string`"
|
9295 9013 | );
|
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 {
|
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 {
|
9303 9030 | blob: ::std::option::Option::None,
|
9304 9031 | boolean: ::std::option::Option::None,
|
9305 9032 | double: ::std::option::Option::None,
|
9306 9033 | empty_struct: ::std::option::Option::None,
|
9307 9034 | float: ::std::option::Option::None,
|
9308 9035 | httpdate_timestamp: ::std::option::Option::None,
|
9309 9036 | integer: ::std::option::Option::None,
|
9310 9037 | iso8601_timestamp: ::std::option::Option::None,
|
9311 9038 | json_value: ::std::option::Option::None,
|
9312 9039 | list_of_lists: ::std::option::Option::None,
|
9313 9040 | list_of_maps_of_strings: ::std::option::Option::None,
|
9314 9041 | list_of_strings: ::std::option::Option::None,
|
9315 9042 | list_of_structs: ::std::option::Option::None,
|
9316 9043 | long: ::std::option::Option::None,
|
9317 9044 | map_of_lists_of_strings: ::std::option::Option::None,
|
9318 9045 | map_of_maps: ::std::option::Option::None,
|
9319 9046 | map_of_strings: ::std::option::Option::None,
|
9320 9047 | map_of_structs: ::std::option::Option::None,
|
9321 9048 | recursive_list: ::std::option::Option::None,
|
9322 9049 | recursive_map: ::std::option::Option::None,
|
9323 9050 | recursive_struct: ::std::option::Option::None,
|
9324 9051 | simple_struct: ::std::option::Option::None,
|
9325 9052 | string: ::std::option::Option::None,
|
9326 9053 | struct_with_json_name: ::std::option::Option::None,
|
9327 9054 | timestamp: ::std::option::Option::None,
|
9328 9055 | unix_timestamp: ::std::option::Option::None,
|
9329 9056 | };
|
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()
|
9335 - | );
|
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 - | }
|
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
|
9359 - | #[::tokio::test]
|
9360 - | async fn aws_json11_servers_dont_deserialize_null_structure_values_request() {
|
9361 - | #[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();
|
9371 - | #[allow(unused_mut)]
|
9372 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9373 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
9374 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9375 - | .null_operation(move |input: crate::input::NullOperationInput| {
|
9376 - | let sender = sender.clone();
|
9377 - | async move {
|
9378 - | let result = {
|
9379 - | let expected = crate::input::NullOperationInput {
|
9380 - | string: ::std::option::Option::None,
|
9381 - | };
|
9382 - | ::pretty_assertions::assert_eq!(input, expected);
|
9383 - | let response = crate::output::NullOperationOutput {
|
9384 - | string: ::std::option::Option::None,
|
9385 - | };
|
9386 - | response
|
9057 + | Ok(response)
|
9387 9058 | };
|
9388 9059 | sender.send(()).await.expect("receiver dropped early");
|
9389 9060 | result
|
9390 9061 | }
|
9391 9062 | })
|
9392 9063 | .build_unchecked();
|
9393 9064 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9394 9065 | .await
|
9395 9066 | .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()
|
9067 + | assert!(
|
9068 + | receiver.recv().await.is_some(),
|
9069 + | "we expected operation handler to be invoked but it was not entered"
|
9410 9070 | );
|
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 - | }
|
9475 - | /// Can invoke operations with optional input
|
9476 - | /// Test ID: can_call_operation_with_optional_input
|
9477 - | #[::tokio::test]
|
9478 - | async fn can_call_operation_with_optional_input_request() {
|
9479 - | #[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();
|
9492 - | #[allow(unused_mut)]
|
9493 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9494 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
9495 - | 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
|
9509 - | };
|
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 9071 | }
|
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
|
9072 + | /// Serializes structure members with locationName traits
|
9073 + | /// Test ID: serializes_structure_members_with_locationname_traits
|
9527 9074 | #[::tokio::test]
|
9528 - | async fn put_and_get_inline_documents_input_request() {
|
9075 + | #[::tracing_test::traced_test]
|
9076 + | async fn serializes_structure_members_with_locationname_traits_request() {
|
9529 9077 | #[allow(unused_mut)]
|
9530 9078 | let mut http_request = http::Request::builder()
|
9531 9079 | .uri("/")
|
9532 9080 | .method("POST")
|
9533 9081 | .header("Content-Type", "application/x-amz-json-1.1")
|
9534 - | .header("X-Amz-Target", "JsonProtocol.PutAndGetInlineDocuments")
|
9082 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
9535 9083 | .body(::aws_smithy_http_server::body::Body::from(
|
9536 9084 | ::bytes::Bytes::from_static(
|
9537 - | "{\n \"inlineDocument\": {\"foo\": \"bar\"}\n}".as_bytes(),
|
9085 + | "{\"StructWithJsonName\":{\"Value\":\"some-value\"}}".as_bytes(),
|
9538 9086 | ),
|
9539 9087 | ))
|
9540 9088 | .unwrap();
|
9541 9089 | #[allow(unused_mut)]
|
9542 9090 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9543 9091 | let config = crate::service::JsonProtocolConfig::builder().build();
|
9544 9092 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9545 - | .put_and_get_inline_documents(
|
9546 - | move |input: crate::input::PutAndGetInlineDocumentsInput| {
|
9093 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
9547 9094 | let sender = sender.clone();
|
9548 9095 | async move {
|
9549 9096 | 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
|
9578 - | };
|
9579 - | sender.send(()).await.expect("receiver dropped early");
|
9580 - | result
|
9581 - | }
|
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()),
|
9582 9102 | },
|
9583 - | )
|
9584 - | .build_unchecked();
|
9585 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9586 - | .await
|
9587 - | .expect("unable to make an HTTP request");
|
9588 - | assert!(receiver.recv().await.is_some());
|
9589 - | }
|
9590 - | /// Serializes inline documents in a JSON response.
|
9591 - | /// Test ID: PutAndGetInlineDocumentsInput
|
9592 - | #[::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 - | }),
|
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,
|
9604 9129 | };
|
9605 - | use ::aws_smithy_http_server::response::IntoResponse;
|
9606 - | let http_response = output.into_response();
|
9607 9130 | ::pretty_assertions::assert_eq!(
|
9608 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
9609 - | http_response.status()
|
9131 + | input.blob,
|
9132 + | expected.blob,
|
9133 + | "Unexpected value for `blob`"
|
9610 9134 | );
|
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())
|
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)
|
9617 9298 | .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 - | ));
|
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 + | );
|
9624 9304 | }
|
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
|
9305 + | /// Serializes empty structure shapes
|
9306 + | /// Test ID: serializes_empty_structure_shapes
|
9631 9307 | #[::tokio::test]
|
9632 - | async fn aws_json11_supports_na_n_float_inputs_request() {
|
9308 + | #[::tracing_test::traced_test]
|
9309 + | async fn serializes_empty_structure_shapes_request() {
|
9633 9310 | #[allow(unused_mut)]
|
9634 9311 | let mut http_request = http::Request::builder()
|
9635 9312 | .uri("/")
|
9636 9313 | .method("POST")
|
9637 9314 | .header("Content-Type", "application/x-amz-json-1.1")
|
9638 - | .header("X-Amz-Target", "JsonProtocol.SimpleScalarProperties")
|
9315 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
9639 9316 | .body(::aws_smithy_http_server::body::Body::from(
|
9640 - | ::bytes::Bytes::from_static(
|
9641 - | "{\n \"floatValue\": \"NaN\",\n \"doubleValue\": \"NaN\"\n}".as_bytes(),
|
9642 - | ),
|
9317 + | ::bytes::Bytes::from_static("{\"SimpleStruct\":{}}".as_bytes()),
|
9643 9318 | ))
|
9644 9319 | .unwrap();
|
9645 9320 | #[allow(unused_mut)]
|
9646 9321 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9647 9322 | let config = crate::service::JsonProtocolConfig::builder().build();
|
9648 9323 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9649 - | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
9324 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
9650 9325 | let sender = sender.clone();
|
9651 9326 | 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 };
|
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 + | };
|
9682 9523 | sender.send(()).await.expect("receiver dropped early");
|
9683 9524 | result
|
9684 9525 | }
|
9685 9526 | })
|
9686 9527 | .build_unchecked();
|
9687 9528 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9688 9529 | .await
|
9689 9530 | .expect("unable to make an HTTP request");
|
9690 - | assert!(receiver.recv().await.is_some());
|
9531 + | assert!(
|
9532 + | receiver.recv().await.is_some(),
|
9533 + | "we expected operation handler to be invoked but it was not entered"
|
9534 + | );
|
9691 9535 | }
|
9692 - | /// Supports handling Infinity float values.
|
9693 - | /// Test ID: AwsJson11SupportsInfinityFloatInputs
|
9536 + | /// Serializes structure which have no members
|
9537 + | /// Test ID: serializes_structure_which_have_no_members
|
9694 9538 | #[::tokio::test]
|
9695 - | async fn aws_json11_supports_infinity_float_inputs_request() {
|
9539 + | #[::tracing_test::traced_test]
|
9540 + | async fn serializes_structure_which_have_no_members_request() {
|
9696 9541 | #[allow(unused_mut)]
|
9697 9542 | let mut http_request = http::Request::builder()
|
9698 9543 | .uri("/")
|
9699 9544 | .method("POST")
|
9700 9545 | .header("Content-Type", "application/x-amz-json-1.1")
|
9701 - | .header("X-Amz-Target", "JsonProtocol.SimpleScalarProperties")
|
9546 + | .header("X-Amz-Target", "JsonProtocol.KitchenSinkOperation")
|
9702 9547 | .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 - | ),
|
9548 + | ::bytes::Bytes::from_static("{\"EmptyStruct\":{}}".as_bytes()),
|
9707 9549 | ))
|
9708 9550 | .unwrap();
|
9709 9551 | #[allow(unused_mut)]
|
9710 9552 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9711 9553 | let config = crate::service::JsonProtocolConfig::builder().build();
|
9712 9554 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9713 - | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
9555 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
9714 9556 | let sender = sender.clone();
|
9715 9557 | 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 };
|
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 + | };
|
9746 9750 | sender.send(()).await.expect("receiver dropped early");
|
9747 9751 | result
|
9748 9752 | }
|
9749 9753 | })
|
9750 9754 | .build_unchecked();
|
9751 9755 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9752 9756 | .await
|
9753 9757 | .expect("unable to make an HTTP request");
|
9754 - | assert!(receiver.recv().await.is_some());
|
9758 + | assert!(
|
9759 + | receiver.recv().await.is_some(),
|
9760 + | "we expected operation handler to be invoked but it was not entered"
|
9761 + | );
|
9755 9762 | }
|
9756 - | /// Supports handling -Infinity float values.
|
9757 - | /// Test ID: AwsJson11SupportsNegativeInfinityFloatInputs
|
9763 + | /// Serializes recursive structure shapes
|
9764 + | /// Test ID: serializes_recursive_structure_shapes
|
9758 9765 | #[::tokio::test]
|
9759 - | async fn aws_json11_supports_negative_infinity_float_inputs_request() {
|
9766 + | #[::tracing_test::traced_test]
|
9767 + | async fn serializes_recursive_structure_shapes_request() {
|
9760 9768 | #[allow(unused_mut)]
|
9761 9769 | let mut http_request = http::Request::builder()
|
9762 9770 | .uri("/")
|
9763 9771 | .method("POST")
|
9764 9772 | .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();
|
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();
|
9773 9775 | #[allow(unused_mut)]
|
9774 9776 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9775 9777 | let config = crate::service::JsonProtocolConfig::builder().build();
|
9776 9778 | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9777 - | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
9779 + | .kitchen_sink_operation(move |input: crate::input::KitchenSinkOperationInput| {
|
9778 9780 | let sender = sender.clone();
|
9779 9781 | 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();
|
9815 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9816 - | .await
|
9817 - | .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"),
|
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(),
|
9828 9795 | ),
|
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"),
|
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 + | }),
|
9832 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,
|
9833 9943 | };
|
9834 - | use ::aws_smithy_http_server::response::IntoResponse;
|
9835 - | let http_response = output.into_response();
|
9836 9944 | ::pretty_assertions::assert_eq!(
|
9837 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
9838 - | http_response.status()
|
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`"
|
9839 9985 | );
|
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 9986 | ::pretty_assertions::assert_eq!(
|
9871 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
9872 - | http_response.status()
|
9987 + | input.json_value,
|
9988 + | expected.json_value,
|
9989 + | "Unexpected value for `json_value`"
|
9873 9990 | );
|
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 9991 | ::pretty_assertions::assert_eq!(
|
9905 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
9906 - | http_response.status()
|
9992 + | input.list_of_lists,
|
9993 + | expected.list_of_lists,
|
9994 + | "Unexpected value for `list_of_lists`"
|
9907 9995 | );
|
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 - | }
|
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
|
9928 - | #[::tokio::test]
|
9929 - | async fn aws_json11_sparse_maps_serialize_null_values_request() {
|
9930 - | #[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();
|
9942 - | #[allow(unused_mut)]
|
9943 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9944 - | let config = crate::service::JsonProtocolConfig::builder().build();
|
9945 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
9946 - | .sparse_nulls_operation(move |input: crate::input::SparseNullsOperationInput| {
|
9947 - | let sender = sender.clone();
|
9948 - | async move {
|
9949 - | let result = {
|
9950 - | let expected = crate::input::SparseNullsOperationInput {
|
9951 - | sparse_string_map: ::std::option::Option::Some({
|
9952 - | let mut ret = ::std::collections::HashMap::new();
|
9953 - | ret.insert("foo".to_owned(), ::std::option::Option::None);
|
9954 - | ret
|
9955 - | }),
|
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,
|
10004 - | };
|
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,
|
10009 - | };
|
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 9996 | ::pretty_assertions::assert_eq!(
|
10037 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10038 - | http_response.status()
|
9997 + | input.list_of_maps_of_strings,
|
9998 + | expected.list_of_maps_of_strings,
|
9999 + | "Unexpected value for `list_of_maps_of_strings`"
|
10039 10000 | );
|
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 10001 | ::pretty_assertions::assert_eq!(
|
10065 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10066 - | http_response.status()
|
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`"
|
10067 10025 | );
|
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 - | },
|
10026 + | ::pretty_assertions::assert_eq!(
|
10027 + | input.map_of_strings,
|
10028 + | expected.map_of_strings,
|
10029 + | "Unexpected value for `map_of_strings`"
|
10147 10030 | );
|
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 - | )
|
10225 - | .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 - | },
|
10031 + | ::pretty_assertions::assert_eq!(
|
10032 + | input.map_of_structs,
|
10033 + | expected.map_of_structs,
|
10034 + | "Unexpected value for `map_of_structs`"
|
10234 10035 | );
|
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 - | }
|
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>>
|
10275 - | }
|
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)
|
10290 - | }
|
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);
|
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
|
10316 10108 | }
|
10317 - | crate::protocol_serde::shape_datetime_offsets::de_datetime_offsets_http_request(request)
|
10109 + | })
|
10110 + | .build_unchecked();
|
10111 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10318 10112 | .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 - | },
|
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"
|
10327 10117 | );
|
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 - | }
|
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)
|
10383 10118 | }
|
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);
|
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,
|
10151 + | };
|
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()
|
10157 + | );
|
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 + | ));
|
10409 10171 | }
|
10410 - | crate::protocol_serde::shape_host_with_path_operation::de_host_with_path_operation_http_request(request)
|
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())
|
10411 10217 | .await
|
10412 - | .map_err(Into::into)
|
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 + | ));
|
10224 + | }
|
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,
|
10413 10257 | };
|
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 - | },
|
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()
|
10420 10263 | );
|
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)
|
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())
|
10270 + | .await
|
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 + | ));
|
10468 10277 | }
|
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);
|
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,
|
10310 + | };
|
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()
|
10316 + | );
|
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 + | ));
|
10494 10330 | }
|
10495 - | crate::protocol_serde::shape_endpoint_with_host_label_operation::de_endpoint_with_host_label_operation_http_request(request)
|
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,
|
10363 + | };
|
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()
|
10369 + | );
|
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())
|
10496 10376 | .await
|
10497 - | .map_err(Into::into)
|
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 + | ));
|
10383 + | }
|
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,
|
10498 10416 | };
|
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 - | },
|
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()
|
10505 10422 | );
|
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>>
|
10556 - | }
|
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)
|
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 + | ));
|
10571 10436 | }
|
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);
|
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 + | ));
|
10597 10489 | }
|
10598 - | crate::protocol_serde::shape_endpoint_operation::de_endpoint_operation_http_request(
|
10599 - | request,
|
10600 - | )
|
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())
|
10601 10535 | .await
|
10602 - | .map_err(Into::into)
|
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 + | ));
|
10542 + | }
|
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,
|
10603 10575 | };
|
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 - | },
|
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()
|
10610 10581 | );
|
10611 - | EndpointOperationInputFuture {
|
10612 - | inner: Box::pin(fut),
|
10613 - | }
|
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())
|
10588 + | .await
|
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 + | ));
|
10614 10595 | }
|
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,
|
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),
|
10633 10604 | ),
|
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)
|
10666 - | }
|
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);
|
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,
|
10630 + | };
|
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()
|
10636 + | );
|
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 + | ));
|
10692 10650 | }
|
10693 - | crate::protocol_serde::shape_json_unions::de_json_unions_http_request(request)
|
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())
|
10694 10698 | .await
|
10695 - | .map_err(Into::into)
|
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 + | ));
|
10705 + | }
|
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,
|
10696 10740 | };
|
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 - | },
|
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()
|
10703 10746 | );
|
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 - | }
|
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 + | ));
|
10728 10760 | }
|
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()),
|
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,
|
10797 + | };
|
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()
|
10740 10803 | );
|
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 - | }
|
10754 - | }
|
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>>
|
10768 - | }
|
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)
|
10783 - | }
|
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);
|
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 + | ));
|
10809 10817 | }
|
10810 - | crate::protocol_serde::shape_greeting_with_errors::de_greeting_with_errors_http_request(
|
10811 - | request,
|
10812 - | )
|
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())
|
10813 10874 | .await
|
10814 - | .map_err(Into::into)
|
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 + | ));
|
10881 + | }
|
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,
|
10815 10917 | };
|
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 - | },
|
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()
|
10822 10923 | );
|
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 - | }
|
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 + | ));
|
10840 10937 | }
|
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,
|
10977 + | };
|
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()
|
10983 + | );
|
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 + | ));
|
10841 10997 | }
|
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()),
|
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()
|
10855 11117 | );
|
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 - | }
|
10869 - | }
|
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>>
|
10883 - | }
|
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)
|
10898 - | }
|
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)
|
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())
|
10926 11124 | .await
|
10927 - | .map_err(Into::into)
|
10928 - | };
|
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 - | },
|
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"))
|
10935 11128 | );
|
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 - | }
|
10954 - | }
|
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>>
|
10968 - | }
|
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)
|
10983 - | }
|
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 11129 | }
|
11010 - | crate::protocol_serde::shape_null_operation::de_null_operation_http_request(request)
|
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,
|
11167 + | };
|
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()
|
11173 + | );
|
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())
|
11011 11180 | .await
|
11012 - | .map_err(Into::into)
|
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 + | ));
|
11187 + | }
|
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()],
|
11199 + | );
|
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,
|
11013 11231 | };
|
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 - | },
|
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"))
|
11020 11248 | );
|
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 11249 | }
|
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")
|
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
|
11053 11263 | });
|
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>>
|
11059 - | }
|
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)
|
11074 - | }
|
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)
|
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,
|
11104 11297 | };
|
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 - | },
|
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"))
|
11111 11314 | );
|
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 - | }
|
11136 11315 | }
|
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()),
|
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()
|
11148 11369 | );
|
11149 - | response
|
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 + | ));
|
11150 11383 | }
|
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,
|
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(),
|
11158 11407 | ),
|
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)
|
11191 - | }
|
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)
|
11221 - | };
|
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)
|
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,
|
11227 11435 | },
|
11228 11436 | );
|
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 - | }
|
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)
|
11276 - | }
|
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)
|
11306 - | };
|
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)
|
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,
|
11312 11493 | },
|
11313 11494 | );
|
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)
|
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,
|
11391 11522 | };
|
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 - | },
|
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()
|
11398 11528 | );
|
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 - | }
|
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)
|
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())
|
11474 11535 | .await
|
11475 - | .map_err(Into::into)
|
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"))
|
11539 + | );
|
11540 + | }
|
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! {
|