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_malformed_enum_test {
|
5 - | /// When a string member does not contain a valid enum value,
|
6 - | /// the response should be a 400 ValidationException. Internal-only
|
7 - | /// enum values are excluded from the response message.
|
8 - | /// Test ID: RestJsonMalformedEnumString_case0
|
9 - | #[::tokio::test]
|
10 - | #[should_panic]
|
11 - | async fn rest_json_malformed_enum_string_case0_malformed_request() {
|
12 - | {
|
13 - | #[allow(unused_mut)]
|
14 - | let mut http_request = http::Request::builder()
|
15 - | .uri("/MalformedEnum")
|
16 - | .method("POST")
|
17 - | .header("content-type", "application/json")
|
18 - | .body(::aws_smithy_http_server::body::Body::from(
|
19 - | ::bytes::Bytes::from_static("{ \"string\" : \"ABC\" }".as_bytes()),
|
20 - | ))
|
21 - | .unwrap();
|
22 - | #[allow(unused_mut)]
|
23 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
24 - | let config = crate::service::RestJsonValidationConfig::builder().build();
|
25 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
26 - | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
27 - | let sender = sender.clone();
|
28 - | async move {
|
29 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
30 - | sender.send(()).await.expect("receiver dropped early");
|
31 - | result
|
32 - | }
|
33 - | })
|
34 - | .build_unchecked();
|
35 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
36 - | .await
|
37 - | .expect("unable to make an HTTP request");
|
38 - | ::pretty_assertions::assert_eq!(
|
39 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
40 - | http_response.status()
|
41 - | );
|
42 - | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
43 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
44 - | http_response.headers(),
|
45 - | expected_headers,
|
46 - | ));
|
47 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
48 - | .await
|
49 - | .expect("unable to extract body to bytes");
|
50 - | ::aws_smithy_protocol_test::assert_ok(
|
51 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/string' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/string' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
52 - | );
|
2 + | const CONTENT_TYPE_SENSITIVEVALIDATION: ::mime::Mime = ::mime::APPLICATION_JSON;
|
3 + | ::pin_project_lite::pin_project! {
|
4 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
5 + | /// [`SensitiveValidationInput`](crate::input::SensitiveValidationInput) using modelled bindings.
|
6 + | pub struct SensitiveValidationInputFuture {
|
7 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SensitiveValidationInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
8 + | }
|
9 + | }
|
10 + |
|
11 + | impl std::future::Future for SensitiveValidationInputFuture {
|
12 + | type Output = Result<
|
13 + | crate::input::SensitiveValidationInput,
|
14 + | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
15 + | >;
|
16 + |
|
17 + | fn poll(
|
18 + | self: std::pin::Pin<&mut Self>,
|
19 + | cx: &mut std::task::Context<'_>,
|
20 + | ) -> std::task::Poll<Self::Output> {
|
21 + | let this = self.project();
|
22 + | this.inner.as_mut().poll(cx)
|
23 + | }
|
24 + | }
|
25 + |
|
26 + | impl<B>
|
27 + | ::aws_smithy_http_server::request::FromRequest<
|
28 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
29 + | B,
|
30 + | > for crate::input::SensitiveValidationInput
|
31 + | where
|
32 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
33 + | B: 'static,
|
34 + |
|
35 + | B::Data: Send,
|
36 + | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
37 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
38 + | {
|
39 + | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
40 + | type Future = SensitiveValidationInputFuture;
|
41 + |
|
42 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
43 + | let fut = async move {
|
44 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
45 + | request.headers(),
|
46 + | &CONTENT_TYPE_SENSITIVEVALIDATION,
|
47 + | ) {
|
48 + | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
49 + | }
|
50 + | crate::protocol_serde::shape_sensitive_validation::de_sensitive_validation_http_request(
|
51 + | request,
|
52 + | )
|
53 + | .await
|
54 + | .map_err(Into::into)
|
55 + | };
|
56 + | use ::futures_util::future::TryFutureExt;
|
57 + | let fut = fut.map_err(
|
58 + | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
59 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
60 + | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
61 + | e,
|
62 + | )
|
63 + | },
|
64 + | );
|
65 + | SensitiveValidationInputFuture {
|
66 + | inner: Box::pin(fut),
|
53 67 | }
|
54 68 | }
|
55 - | /// When a string member does not contain a valid enum value,
|
56 - | /// the response should be a 400 ValidationException. Internal-only
|
57 - | /// enum values are excluded from the response message.
|
58 - | /// Test ID: RestJsonMalformedEnumString_case1
|
59 - | #[::tokio::test]
|
60 - | #[should_panic]
|
61 - | async fn rest_json_malformed_enum_string_case1_malformed_request() {
|
62 - | {
|
63 - | #[allow(unused_mut)]
|
64 - | let mut http_request = http::Request::builder()
|
65 - | .uri("/MalformedEnum")
|
66 - | .method("POST")
|
67 - | .header("content-type", "application/json")
|
68 - | .body(::aws_smithy_http_server::body::Body::from(
|
69 - | ::bytes::Bytes::from_static("{ \"string\" : \"XYZ\" }".as_bytes()),
|
70 - | ))
|
71 - | .unwrap();
|
72 - | #[allow(unused_mut)]
|
73 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
74 - | let config = crate::service::RestJsonValidationConfig::builder().build();
|
75 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
76 - | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
77 - | let sender = sender.clone();
|
78 - | async move {
|
79 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
80 - | sender.send(()).await.expect("receiver dropped early");
|
81 - | result
|
82 - | }
|
83 - | })
|
84 - | .build_unchecked();
|
85 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
86 - | .await
|
87 - | .expect("unable to make an HTTP request");
|
88 - | ::pretty_assertions::assert_eq!(
|
89 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
90 - | http_response.status()
|
91 - | );
|
92 - | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
93 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
94 - | http_response.headers(),
|
95 - | expected_headers,
|
96 - | ));
|
97 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
98 - | .await
|
99 - | .expect("unable to extract body to bytes");
|
100 - | ::aws_smithy_protocol_test::assert_ok(
|
101 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/string' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/string' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
102 - | );
|
69 + | }
|
70 + | impl
|
71 + | ::aws_smithy_http_server::response::IntoResponse<
|
72 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
73 + | > for crate::output::SensitiveValidationOutput
|
74 + | {
|
75 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
76 + | match crate::protocol_serde::shape_sensitive_validation::ser_sensitive_validation_http_response(self) {
|
77 + | Ok(response) => response,
|
78 + | Err(e) => {
|
79 + | ::tracing::error!(error = %e, "failed to serialize response");
|
80 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
81 + | }
|
82 + | }
|
83 + | }
|
84 + | }
|
85 + | impl
|
86 + | ::aws_smithy_http_server::response::IntoResponse<
|
87 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
88 + | > for crate::error::SensitiveValidationError
|
89 + | {
|
90 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
91 + | match crate::protocol_serde::shape_sensitive_validation::ser_sensitive_validation_http_error(
|
92 + | &self,
|
93 + | ) {
|
94 + | Ok(mut response) => {
|
95 + | response.extensions_mut().insert(
|
96 + | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
97 + | );
|
98 + | response
|
99 + | }
|
100 + | Err(e) => {
|
101 + | ::tracing::error!(error = %e, "failed to serialize response");
|
102 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
103 + | }
|
103 104 | }
|
104 105 | }
|
105 - | /// When a string member does not contain a valid enum value,
|
106 - | /// the response should be a 400 ValidationException. Internal-only
|
107 - | /// enum values are excluded from the response message.
|
108 - | /// Test ID: RestJsonMalformedEnumTraitString_case0
|
106 + | }
|
107 + |
|
108 + | #[allow(unreachable_code, unused_variables)]
|
109 + | #[cfg(test)]
|
110 + | mod sensitive_validation_test {
|
111 + |
|
112 + | /// When a sensitive member fails validation, the resultant
|
113 + | /// ValidationException will omit the value of the input.
|
114 + | /// Test ID: RestJsonMalformedPatternSensitiveString
|
109 115 | #[::tokio::test]
|
110 - | #[should_panic]
|
111 - | async fn rest_json_malformed_enum_trait_string_case0_malformed_request() {
|
116 + | #[::tracing_test::traced_test]
|
117 + | async fn rest_json_malformed_pattern_sensitive_string_malformed_request() {
|
112 118 | {
|
113 119 | #[allow(unused_mut)]
|
114 120 | let mut http_request = http::Request::builder()
|
115 - | .uri("/MalformedEnum")
|
121 + | .uri("/SensitiveValidation")
|
116 122 | .method("POST")
|
117 123 | .header("content-type", "application/json")
|
118 124 | .body(::aws_smithy_http_server::body::Body::from(
|
119 - | ::bytes::Bytes::from_static("{ \"stringWithEnumTrait\" : \"ABC\" }".as_bytes()),
|
125 + | ::bytes::Bytes::from_static("{ \"string\" : \"ABC\" }".as_bytes()),
|
120 126 | ))
|
121 127 | .unwrap();
|
122 128 | #[allow(unused_mut)]
|
123 129 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
124 130 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
125 131 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
126 - | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
132 + | .sensitive_validation(move |input: crate::input::SensitiveValidationInput| {
|
127 133 | let sender = sender.clone();
|
128 134 | async move {
|
129 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
135 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::SensitiveValidationOutput, crate::error::SensitiveValidationError> };
|
130 136 | sender.send(()).await.expect("receiver dropped early");
|
131 137 | result
|
132 138 | }
|
133 139 | })
|
134 140 | .build_unchecked();
|
135 141 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
136 142 | .await
|
137 143 | .expect("unable to make an HTTP request");
|
138 144 | ::pretty_assertions::assert_eq!(
|
139 145 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
140 146 | http_response.status()
|
141 147 | );
|
142 148 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
143 149 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
144 150 | http_response.headers(),
|
145 151 | expected_headers,
|
146 152 | ));
|
147 153 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
148 154 | .await
|
149 155 | .expect("unable to extract body to bytes");
|
150 156 | ::aws_smithy_protocol_test::assert_ok(
|
151 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/stringWithEnumTrait' failed to satisfy constraint: Member must satisfy enum value set: [abc, def]\",\n \"fieldList\" : [{\"message\": \"Value at '/stringWithEnumTrait' failed to satisfy constraint: Member must satisfy enum value set: [abc, def]\", \"path\": \"/stringWithEnumTrait\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
157 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
152 158 | );
|
153 159 | }
|
154 160 | }
|
155 - | /// When a string member does not contain a valid enum value,
|
156 - | /// the response should be a 400 ValidationException. Internal-only
|
157 - | /// enum values are excluded from the response message.
|
158 - | /// Test ID: RestJsonMalformedEnumTraitString_case1
|
159 - | #[::tokio::test]
|
160 - | #[should_panic]
|
161 - | async fn rest_json_malformed_enum_trait_string_case1_malformed_request() {
|
162 - | {
|
163 - | #[allow(unused_mut)]
|
164 - | let mut http_request = http::Request::builder()
|
165 - | .uri("/MalformedEnum")
|
166 - | .method("POST")
|
167 - | .header("content-type", "application/json")
|
168 - | .body(::aws_smithy_http_server::body::Body::from(
|
169 - | ::bytes::Bytes::from_static("{ \"stringWithEnumTrait\" : \"XYZ\" }".as_bytes()),
|
170 - | ))
|
171 - | .unwrap();
|
172 - | #[allow(unused_mut)]
|
173 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
174 - | let config = crate::service::RestJsonValidationConfig::builder().build();
|
175 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
176 - | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
177 - | let sender = sender.clone();
|
178 - | async move {
|
179 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
180 - | sender.send(()).await.expect("receiver dropped early");
|
181 - | result
|
182 - | }
|
183 - | })
|
184 - | .build_unchecked();
|
185 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
186 - | .await
|
187 - | .expect("unable to make an HTTP request");
|
188 - | ::pretty_assertions::assert_eq!(
|
189 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
190 - | http_response.status()
|
191 - | );
|
192 - | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
193 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
194 - | http_response.headers(),
|
195 - | expected_headers,
|
196 - | ));
|
197 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
198 - | .await
|
199 - | .expect("unable to extract body to bytes");
|
200 - | ::aws_smithy_protocol_test::assert_ok(
|
201 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/stringWithEnumTrait' failed to satisfy constraint: Member must satisfy enum value set: [abc, def]\",\n \"fieldList\" : [{\"message\": \"Value at '/stringWithEnumTrait' failed to satisfy constraint: Member must satisfy enum value set: [abc, def]\", \"path\": \"/stringWithEnumTrait\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
202 - | );
|
161 + | }
|
162 + |
|
163 + | const CONTENT_TYPE_RECURSIVESTRUCTURES: ::mime::Mime = ::mime::APPLICATION_JSON;
|
164 + | ::pin_project_lite::pin_project! {
|
165 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
166 + | /// [`RecursiveStructuresInput`](crate::input::RecursiveStructuresInput) using modelled bindings.
|
167 + | pub struct RecursiveStructuresInputFuture {
|
168 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::RecursiveStructuresInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
169 + | }
|
170 + | }
|
171 + |
|
172 + | impl std::future::Future for RecursiveStructuresInputFuture {
|
173 + | type Output = Result<
|
174 + | crate::input::RecursiveStructuresInput,
|
175 + | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
176 + | >;
|
177 + |
|
178 + | fn poll(
|
179 + | self: std::pin::Pin<&mut Self>,
|
180 + | cx: &mut std::task::Context<'_>,
|
181 + | ) -> std::task::Poll<Self::Output> {
|
182 + | let this = self.project();
|
183 + | this.inner.as_mut().poll(cx)
|
184 + | }
|
185 + | }
|
186 + |
|
187 + | impl<B>
|
188 + | ::aws_smithy_http_server::request::FromRequest<
|
189 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
190 + | B,
|
191 + | > for crate::input::RecursiveStructuresInput
|
192 + | where
|
193 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
194 + | B: 'static,
|
195 + |
|
196 + | B::Data: Send,
|
197 + | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
198 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
199 + | {
|
200 + | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
201 + | type Future = RecursiveStructuresInputFuture;
|
202 + |
|
203 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
204 + | let fut = async move {
|
205 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
206 + | request.headers(),
|
207 + | &CONTENT_TYPE_RECURSIVESTRUCTURES,
|
208 + | ) {
|
209 + | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
210 + | }
|
211 + | crate::protocol_serde::shape_recursive_structures::de_recursive_structures_http_request(
|
212 + | request,
|
213 + | )
|
214 + | .await
|
215 + | .map_err(Into::into)
|
216 + | };
|
217 + | use ::futures_util::future::TryFutureExt;
|
218 + | let fut = fut.map_err(
|
219 + | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
220 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
221 + | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
222 + | e,
|
223 + | )
|
224 + | },
|
225 + | );
|
226 + | RecursiveStructuresInputFuture {
|
227 + | inner: Box::pin(fut),
|
203 228 | }
|
204 229 | }
|
205 - | /// When a list member value does not contain a valid enum value,
|
206 - | /// the response should be a 400 ValidationException. Internal-only
|
207 - | /// enum values are excluded from the response message.
|
208 - | /// Test ID: RestJsonMalformedEnumList_case0
|
209 - | #[::tokio::test]
|
210 - | #[should_panic]
|
211 - | async fn rest_json_malformed_enum_list_case0_malformed_request() {
|
212 - | {
|
213 - | #[allow(unused_mut)]
|
214 - | let mut http_request = http::Request::builder()
|
215 - | .uri("/MalformedEnum")
|
216 - | .method("POST")
|
217 - | .header("content-type", "application/json")
|
218 - | .body(::aws_smithy_http_server::body::Body::from(
|
219 - | ::bytes::Bytes::from_static("{ \"list\" : [\"ABC\"] }".as_bytes()),
|
220 - | ))
|
221 - | .unwrap();
|
222 - | #[allow(unused_mut)]
|
223 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
224 - | let config = crate::service::RestJsonValidationConfig::builder().build();
|
225 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
226 - | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
227 - | let sender = sender.clone();
|
228 - | async move {
|
229 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
230 - | sender.send(()).await.expect("receiver dropped early");
|
231 - | result
|
232 - | }
|
233 - | })
|
234 - | .build_unchecked();
|
235 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
236 - | .await
|
237 - | .expect("unable to make an HTTP request");
|
238 - | ::pretty_assertions::assert_eq!(
|
239 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
240 - | http_response.status()
|
241 - | );
|
242 - | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
243 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
244 - | http_response.headers(),
|
245 - | expected_headers,
|
246 - | ));
|
247 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
248 - | .await
|
249 - | .expect("unable to extract body to bytes");
|
250 - | ::aws_smithy_protocol_test::assert_ok(
|
251 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/list/0' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/list/0' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/list/0\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
252 - | );
|
230 + | }
|
231 + | impl
|
232 + | ::aws_smithy_http_server::response::IntoResponse<
|
233 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
234 + | > for crate::output::RecursiveStructuresOutput
|
235 + | {
|
236 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
237 + | match crate::protocol_serde::shape_recursive_structures::ser_recursive_structures_http_response(self) {
|
238 + | Ok(response) => response,
|
239 + | Err(e) => {
|
240 + | ::tracing::error!(error = %e, "failed to serialize response");
|
241 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
242 + | }
|
243 + | }
|
244 + | }
|
245 + | }
|
246 + | impl
|
247 + | ::aws_smithy_http_server::response::IntoResponse<
|
248 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
249 + | > for crate::error::RecursiveStructuresError
|
250 + | {
|
251 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
252 + | match crate::protocol_serde::shape_recursive_structures::ser_recursive_structures_http_error(
|
253 + | &self,
|
254 + | ) {
|
255 + | Ok(mut response) => {
|
256 + | response.extensions_mut().insert(
|
257 + | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
258 + | );
|
259 + | response
|
260 + | }
|
261 + | Err(e) => {
|
262 + | ::tracing::error!(error = %e, "failed to serialize response");
|
263 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
264 + | }
|
253 265 | }
|
254 266 | }
|
255 - | /// When a list member value does not contain a valid enum value,
|
256 - | /// the response should be a 400 ValidationException. Internal-only
|
257 - | /// enum values are excluded from the response message.
|
258 - | /// Test ID: RestJsonMalformedEnumList_case1
|
267 + | }
|
268 + |
|
269 + | #[allow(unreachable_code, unused_variables)]
|
270 + | #[cfg(test)]
|
271 + | mod recursive_structures_test {
|
272 + |
|
273 + | /// Validation should work with recursive structures.
|
274 + | /// Test ID: RestJsonRecursiveStructuresValidate
|
259 275 | #[::tokio::test]
|
260 - | #[should_panic]
|
261 - | async fn rest_json_malformed_enum_list_case1_malformed_request() {
|
276 + | #[::tracing_test::traced_test]
|
277 + | async fn rest_json_recursive_structures_validate_request() {
|
278 + | #[allow(unused_mut)]
|
279 + | let mut http_request = http::Request::builder()
|
280 + | .uri("/RecursiveStructures")
|
281 + | .method("POST")
|
282 + | .header("content-type", "application/json")
|
283 + | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"union\" : {\n \"union\" : {\n \"union\" : { \"string\" : \"abc\" }\n }\n }\n}".as_bytes()))).unwrap();
|
284 + | #[allow(unused_mut)]
|
285 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
286 + | let config = crate::service::RestJsonValidationConfig::builder().build();
|
287 + | let service =
|
288 + | crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
289 + | .recursive_structures(move |input: crate::input::RecursiveStructuresInput| {
|
290 + | let sender = sender.clone();
|
291 + | async move {
|
292 + | let result = {
|
293 + | let expected = crate::input::RecursiveStructuresInput {
|
294 + | union: ::std::option::Option::Some(
|
295 + | crate::model::RecursiveUnionOne::Union(::std::boxed::Box::new(
|
296 + | crate::model::RecursiveUnionTwo::Union(
|
297 + | crate::model::RecursiveUnionOne::String(
|
298 + | "abc"
|
299 + | .parse::<crate::model::RecursiveEnumString>()
|
300 + | .expect("static value validated to member"),
|
301 + | ),
|
302 + | ),
|
303 + | )),
|
304 + | ),
|
305 + | };
|
306 + | ::pretty_assertions::assert_eq!(input, expected);
|
307 + | let response = crate::output::RecursiveStructuresOutput {};
|
308 + | Ok(response)
|
309 + | };
|
310 + | sender.send(()).await.expect("receiver dropped early");
|
311 + | result
|
312 + | }
|
313 + | })
|
314 + | .build_unchecked();
|
315 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
316 + | .await
|
317 + | .expect("unable to make an HTTP request");
|
318 + | assert!(
|
319 + | receiver.recv().await.is_some(),
|
320 + | "we expected operation handler to be invoked but it was not entered"
|
321 + | );
|
322 + | }
|
323 + | /// When a value deeply nested in a recursive structure does not meet constraints,
|
324 + | /// a 400 ValidationException is returned.
|
325 + | /// Test ID: RestJsonMalformedRecursiveStructures
|
326 + | #[::tokio::test]
|
327 + | #[::tracing_test::traced_test]
|
328 + | async fn rest_json_malformed_recursive_structures_malformed_request() {
|
262 329 | {
|
263 330 | #[allow(unused_mut)]
|
264 - | let mut http_request = http::Request::builder()
|
265 - | .uri("/MalformedEnum")
|
266 - | .method("POST")
|
267 - | .header("content-type", "application/json")
|
268 - | .body(::aws_smithy_http_server::body::Body::from(
|
269 - | ::bytes::Bytes::from_static("{ \"list\" : [\"XYZ\"] }".as_bytes()),
|
270 - | ))
|
271 - | .unwrap();
|
331 + | let mut http_request = http::Request::builder()
|
332 + | .uri("/RecursiveStructures")
|
333 + | .method("POST")
|
334 + | .header("content-type", "application/json")
|
335 + | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"union\" : {\n \"union\" : {\n \"union\" : { \"string\" : \"XYZ\" }\n }\n }\n}".as_bytes()))).unwrap();
|
272 336 | #[allow(unused_mut)]
|
273 337 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
274 338 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
275 339 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
276 - | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
340 + | .recursive_structures(move |input: crate::input::RecursiveStructuresInput| {
|
277 341 | let sender = sender.clone();
|
278 342 | async move {
|
279 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
343 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::RecursiveStructuresOutput, crate::error::RecursiveStructuresError> };
|
280 344 | sender.send(()).await.expect("receiver dropped early");
|
281 345 | result
|
282 346 | }
|
283 347 | })
|
284 348 | .build_unchecked();
|
285 349 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
286 350 | .await
|
287 351 | .expect("unable to make an HTTP request");
|
288 352 | ::pretty_assertions::assert_eq!(
|
289 353 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
290 354 | http_response.status()
|
291 355 | );
|
292 356 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
293 357 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
294 358 | http_response.headers(),
|
295 359 | expected_headers,
|
296 360 | ));
|
297 361 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
298 362 | .await
|
299 363 | .expect("unable to extract body to bytes");
|
300 364 | ::aws_smithy_protocol_test::assert_ok(
|
301 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/list/0' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/list/0' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/list/0\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
365 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/union/union/union/string' failed to satisfy constraint: Member must satisfy enum value set: [abc, def]\",\n \"fieldList\" : [{\"message\": \"Value at '/union/union/union/string' failed to satisfy constraint: Member must satisfy enum value set: [abc, def]\", \"path\": \"/union/union/union/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
302 366 | );
|
303 367 | }
|
304 368 | }
|
305 - | /// When a map member's key does not contain a valid enum value,
|
306 - | /// the response should be a 400 ValidationException. Internal-only
|
307 - | /// enum values are excluded from the response message.
|
308 - | /// Test ID: RestJsonMalformedEnumMapKey_case0
|
309 - | #[::tokio::test]
|
310 - | #[should_panic]
|
311 - | async fn rest_json_malformed_enum_map_key_case0_malformed_request() {
|
312 - | {
|
313 - | #[allow(unused_mut)]
|
314 - | let mut http_request = http::Request::builder()
|
315 - | .uri("/MalformedEnum")
|
369 + | }
|
370 + |
|
371 + | const CONTENT_TYPE_MALFORMEDUNIQUEITEMS: ::mime::Mime = ::mime::APPLICATION_JSON;
|
372 + | ::pin_project_lite::pin_project! {
|
373 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
374 + | /// [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput) using modelled bindings.
|
375 + | pub struct MalformedUniqueItemsInputFuture {
|
376 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedUniqueItemsInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
377 + | }
|
378 + | }
|
379 + |
|
380 + | impl std::future::Future for MalformedUniqueItemsInputFuture {
|
381 + | type Output = Result<
|
382 + | crate::input::MalformedUniqueItemsInput,
|
383 + | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
384 + | >;
|
385 + |
|
386 + | fn poll(
|
387 + | self: std::pin::Pin<&mut Self>,
|
388 + | cx: &mut std::task::Context<'_>,
|
389 + | ) -> std::task::Poll<Self::Output> {
|
390 + | let this = self.project();
|
391 + | this.inner.as_mut().poll(cx)
|
392 + | }
|
393 + | }
|
394 + |
|
395 + | impl<B>
|
396 + | ::aws_smithy_http_server::request::FromRequest<
|
397 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
398 + | B,
|
399 + | > for crate::input::MalformedUniqueItemsInput
|
400 + | where
|
401 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
402 + | B: 'static,
|
403 + |
|
404 + | B::Data: Send,
|
405 + | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
406 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
407 + | {
|
408 + | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
409 + | type Future = MalformedUniqueItemsInputFuture;
|
410 + |
|
411 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
412 + | let fut = async move {
|
413 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
414 + | request.headers(),
|
415 + | &CONTENT_TYPE_MALFORMEDUNIQUEITEMS,
|
416 + | ) {
|
417 + | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
418 + | }
|
419 + | crate::protocol_serde::shape_malformed_unique_items::de_malformed_unique_items_http_request(request)
|
420 + | .await
|
421 + | .map_err(Into::into)
|
422 + | };
|
423 + | use ::futures_util::future::TryFutureExt;
|
424 + | let fut = fut.map_err(
|
425 + | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
426 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
427 + | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
428 + | e,
|
429 + | )
|
430 + | },
|
431 + | );
|
432 + | MalformedUniqueItemsInputFuture {
|
433 + | inner: Box::pin(fut),
|
434 + | }
|
435 + | }
|
436 + | }
|
437 + | impl
|
438 + | ::aws_smithy_http_server::response::IntoResponse<
|
439 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
440 + | > for crate::output::MalformedUniqueItemsOutput
|
441 + | {
|
442 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
443 + | match crate::protocol_serde::shape_malformed_unique_items::ser_malformed_unique_items_http_response(self) {
|
444 + | Ok(response) => response,
|
445 + | Err(e) => {
|
446 + | ::tracing::error!(error = %e, "failed to serialize response");
|
447 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
448 + | }
|
449 + | }
|
450 + | }
|
451 + | }
|
452 + | impl
|
453 + | ::aws_smithy_http_server::response::IntoResponse<
|
454 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
455 + | > for crate::error::MalformedUniqueItemsError
|
456 + | {
|
457 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
458 + | match crate::protocol_serde::shape_malformed_unique_items::ser_malformed_unique_items_http_error(&self) {
|
459 + | Ok(mut response) => {
|
460 + | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
461 + | response
|
462 + | },
|
463 + | Err(e) => {
|
464 + | ::tracing::error!(error = %e, "failed to serialize response");
|
465 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
466 + | }
|
467 + | }
|
468 + | }
|
469 + | }
|
470 + |
|
471 + | #[allow(unreachable_code, unused_variables)]
|
472 + | #[cfg(test)]
|
473 + | mod malformed_unique_items_test {
|
474 + |
|
475 + | /// When a blob list contains non-unique values,
|
476 + | /// the response should be a 400 ValidationException.
|
477 + | /// Test ID: RestJsonMalformedUniqueItemsBlobList
|
478 + | #[::tokio::test]
|
479 + | #[::tracing_test::traced_test]
|
480 + | #[should_panic]
|
481 + | async fn rest_json_malformed_unique_items_blob_list_malformed_request() {
|
482 + | {
|
483 + | #[allow(unused_mut)]
|
484 + | let mut http_request = http::Request::builder()
|
485 + | .uri("/MalformedUniqueItems")
|
316 486 | .method("POST")
|
317 487 | .header("content-type", "application/json")
|
318 488 | .body(::aws_smithy_http_server::body::Body::from(
|
319 - | ::bytes::Bytes::from_static("{ \"map\" : { \"ABC\" : \"abc\" } }".as_bytes()),
|
489 + | ::bytes::Bytes::from_static(
|
490 + | "{ \"blobList\" : [\"YQ==\", \"YQ==\"] }".as_bytes(),
|
491 + | ),
|
320 492 | ))
|
321 493 | .unwrap();
|
322 494 | #[allow(unused_mut)]
|
323 495 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
324 496 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
325 497 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
326 - | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
498 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
327 499 | let sender = sender.clone();
|
328 500 | async move {
|
329 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
501 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
330 502 | sender.send(()).await.expect("receiver dropped early");
|
331 503 | result
|
332 504 | }
|
333 505 | })
|
334 506 | .build_unchecked();
|
335 507 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
336 508 | .await
|
337 509 | .expect("unable to make an HTTP request");
|
338 510 | ::pretty_assertions::assert_eq!(
|
339 511 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
340 512 | http_response.status()
|
341 513 | );
|
342 514 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
343 515 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
344 516 | http_response.headers(),
|
345 517 | expected_headers,
|
346 518 | ));
|
347 519 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
348 520 | .await
|
349 521 | .expect("unable to extract body to bytes");
|
350 522 | ::aws_smithy_protocol_test::assert_ok(
|
351 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/map' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
523 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/blobList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/blobList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/blobList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
352 524 | );
|
353 525 | }
|
354 526 | }
|
355 - | /// When a map member's key does not contain a valid enum value,
|
356 - | /// the response should be a 400 ValidationException. Internal-only
|
357 - | /// enum values are excluded from the response message.
|
358 - | /// Test ID: RestJsonMalformedEnumMapKey_case1
|
527 + | /// When a boolean list contains non-unique values,
|
528 + | /// the response should be a 400 ValidationException.
|
529 + | /// Test ID: RestJsonMalformedUniqueItemsBooleanList_case0
|
359 530 | #[::tokio::test]
|
531 + | #[::tracing_test::traced_test]
|
360 532 | #[should_panic]
|
361 - | async fn rest_json_malformed_enum_map_key_case1_malformed_request() {
|
533 + | async fn rest_json_malformed_unique_items_boolean_list_case0_malformed_request() {
|
362 534 | {
|
363 535 | #[allow(unused_mut)]
|
364 536 | let mut http_request = http::Request::builder()
|
365 - | .uri("/MalformedEnum")
|
537 + | .uri("/MalformedUniqueItems")
|
366 538 | .method("POST")
|
367 539 | .header("content-type", "application/json")
|
368 540 | .body(::aws_smithy_http_server::body::Body::from(
|
369 - | ::bytes::Bytes::from_static("{ \"map\" : { \"XYZ\" : \"abc\" } }".as_bytes()),
|
541 + | ::bytes::Bytes::from_static("{ \"booleanList\" : [true, true] }".as_bytes()),
|
370 542 | ))
|
371 543 | .unwrap();
|
372 544 | #[allow(unused_mut)]
|
373 545 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
374 546 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
375 547 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
376 - | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
548 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
377 549 | let sender = sender.clone();
|
378 550 | async move {
|
379 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
551 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
380 552 | sender.send(()).await.expect("receiver dropped early");
|
381 553 | result
|
382 554 | }
|
383 555 | })
|
384 556 | .build_unchecked();
|
385 557 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
386 558 | .await
|
387 559 | .expect("unable to make an HTTP request");
|
388 560 | ::pretty_assertions::assert_eq!(
|
389 561 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
390 562 | http_response.status()
|
391 563 | );
|
392 564 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
393 565 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
394 566 | http_response.headers(),
|
395 567 | expected_headers,
|
396 568 | ));
|
397 569 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
398 570 | .await
|
399 571 | .expect("unable to extract body to bytes");
|
400 572 | ::aws_smithy_protocol_test::assert_ok(
|
401 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/map' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
573 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/booleanList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/booleanList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/booleanList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
402 574 | );
|
403 575 | }
|
404 576 | }
|
405 - | /// When a map member's value does not contain a valid enum value,
|
406 - | /// the response should be a 400 ValidationException. Internal-only
|
407 - | /// enum values are excluded from the response message.
|
408 - | /// Test ID: RestJsonMalformedEnumMapValue_case0
|
577 + | /// When a boolean list contains non-unique values,
|
578 + | /// the response should be a 400 ValidationException.
|
579 + | /// Test ID: RestJsonMalformedUniqueItemsBooleanList_case1
|
409 580 | #[::tokio::test]
|
581 + | #[::tracing_test::traced_test]
|
410 582 | #[should_panic]
|
411 - | async fn rest_json_malformed_enum_map_value_case0_malformed_request() {
|
583 + | async fn rest_json_malformed_unique_items_boolean_list_case1_malformed_request() {
|
412 584 | {
|
413 585 | #[allow(unused_mut)]
|
414 586 | let mut http_request = http::Request::builder()
|
415 - | .uri("/MalformedEnum")
|
587 + | .uri("/MalformedUniqueItems")
|
416 588 | .method("POST")
|
417 589 | .header("content-type", "application/json")
|
418 590 | .body(::aws_smithy_http_server::body::Body::from(
|
419 - | ::bytes::Bytes::from_static("{ \"map\" : { \"abc\": \"ABC\" } }".as_bytes()),
|
591 + | ::bytes::Bytes::from_static("{ \"booleanList\" : [false, false] }".as_bytes()),
|
420 592 | ))
|
421 593 | .unwrap();
|
422 594 | #[allow(unused_mut)]
|
423 595 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
424 596 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
425 597 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
426 - | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
598 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
427 599 | let sender = sender.clone();
|
428 600 | async move {
|
429 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
601 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
430 602 | sender.send(()).await.expect("receiver dropped early");
|
431 603 | result
|
432 604 | }
|
433 605 | })
|
434 606 | .build_unchecked();
|
435 607 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
436 608 | .await
|
437 609 | .expect("unable to make an HTTP request");
|
438 610 | ::pretty_assertions::assert_eq!(
|
439 611 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
440 612 | http_response.status()
|
441 613 | );
|
442 614 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
443 615 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
444 616 | http_response.headers(),
|
445 617 | expected_headers,
|
446 618 | ));
|
447 619 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
448 620 | .await
|
449 621 | .expect("unable to extract body to bytes");
|
450 622 | ::aws_smithy_protocol_test::assert_ok(
|
451 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map/abc' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/map/abc' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/map/abc\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
623 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/booleanList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/booleanList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/booleanList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
452 624 | );
|
453 625 | }
|
454 626 | }
|
455 - | /// When a map member's value does not contain a valid enum value,
|
456 - | /// the response should be a 400 ValidationException. Internal-only
|
457 - | /// enum values are excluded from the response message.
|
458 - | /// Test ID: RestJsonMalformedEnumMapValue_case1
|
627 + | /// When a string list contains non-unique values,
|
628 + | /// the response should be a 400 ValidationException.
|
629 + | /// Test ID: RestJsonMalformedUniqueItemsStringList
|
459 630 | #[::tokio::test]
|
631 + | #[::tracing_test::traced_test]
|
460 632 | #[should_panic]
|
461 - | async fn rest_json_malformed_enum_map_value_case1_malformed_request() {
|
633 + | async fn rest_json_malformed_unique_items_string_list_malformed_request() {
|
462 634 | {
|
463 635 | #[allow(unused_mut)]
|
464 636 | let mut http_request = http::Request::builder()
|
465 - | .uri("/MalformedEnum")
|
637 + | .uri("/MalformedUniqueItems")
|
466 638 | .method("POST")
|
467 639 | .header("content-type", "application/json")
|
468 640 | .body(::aws_smithy_http_server::body::Body::from(
|
469 - | ::bytes::Bytes::from_static("{ \"map\" : { \"abc\": \"XYZ\" } }".as_bytes()),
|
641 + | ::bytes::Bytes::from_static(
|
642 + | "{ \"stringList\" : [\"abc\", \"abc\"] }".as_bytes(),
|
643 + | ),
|
470 644 | ))
|
471 645 | .unwrap();
|
472 646 | #[allow(unused_mut)]
|
473 647 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
474 648 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
475 649 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
476 - | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
650 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
477 651 | let sender = sender.clone();
|
478 652 | async move {
|
479 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
653 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
480 654 | sender.send(()).await.expect("receiver dropped early");
|
481 655 | result
|
482 656 | }
|
483 657 | })
|
484 658 | .build_unchecked();
|
485 659 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
486 660 | .await
|
487 661 | .expect("unable to make an HTTP request");
|
488 662 | ::pretty_assertions::assert_eq!(
|
489 663 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
490 664 | http_response.status()
|
491 665 | );
|
492 666 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
493 667 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
494 668 | http_response.headers(),
|
495 669 | expected_headers,
|
496 670 | ));
|
497 671 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
498 672 | .await
|
499 673 | .expect("unable to extract body to bytes");
|
500 674 | ::aws_smithy_protocol_test::assert_ok(
|
501 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map/abc' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/map/abc' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/map/abc\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
675 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/stringList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/stringList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/stringList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
502 676 | );
|
503 677 | }
|
504 678 | }
|
505 - | /// When a union member's value does not contain a valid enum value,
|
506 - | /// the response should be a 400 ValidationException. Internal-only
|
507 - | /// enum values are excluded from the response message.
|
508 - | /// Test ID: RestJsonMalformedEnumUnion_case0
|
679 + | /// When a byte list contains non-unique values,
|
680 + | /// the response should be a 400 ValidationException.
|
681 + | /// Test ID: RestJsonMalformedUniqueItemsByteList
|
509 682 | #[::tokio::test]
|
683 + | #[::tracing_test::traced_test]
|
510 684 | #[should_panic]
|
511 - | async fn rest_json_malformed_enum_union_case0_malformed_request() {
|
685 + | async fn rest_json_malformed_unique_items_byte_list_malformed_request() {
|
512 686 | {
|
513 687 | #[allow(unused_mut)]
|
514 688 | let mut http_request = http::Request::builder()
|
515 - | .uri("/MalformedEnum")
|
689 + | .uri("/MalformedUniqueItems")
|
516 690 | .method("POST")
|
517 691 | .header("content-type", "application/json")
|
518 692 | .body(::aws_smithy_http_server::body::Body::from(
|
519 - | ::bytes::Bytes::from_static(
|
520 - | "{ \"union\" : { \"first\": \"ABC\" } }".as_bytes(),
|
521 - | ),
|
693 + | ::bytes::Bytes::from_static("{ \"byteList\" : [1, 1] }".as_bytes()),
|
522 694 | ))
|
523 695 | .unwrap();
|
524 696 | #[allow(unused_mut)]
|
525 697 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
526 698 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
527 699 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
528 - | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
700 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
529 701 | let sender = sender.clone();
|
530 702 | async move {
|
531 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
703 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
532 704 | sender.send(()).await.expect("receiver dropped early");
|
533 705 | result
|
534 706 | }
|
535 707 | })
|
536 708 | .build_unchecked();
|
537 709 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
538 710 | .await
|
539 711 | .expect("unable to make an HTTP request");
|
540 712 | ::pretty_assertions::assert_eq!(
|
541 713 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
542 714 | http_response.status()
|
543 715 | );
|
544 716 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
545 717 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
546 718 | http_response.headers(),
|
547 719 | expected_headers,
|
548 720 | ));
|
549 721 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
550 722 | .await
|
551 723 | .expect("unable to extract body to bytes");
|
552 724 | ::aws_smithy_protocol_test::assert_ok(
|
553 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/union/first' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/union/first' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/union/first\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
725 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/byteList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/byteList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/byteList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
554 726 | );
|
555 727 | }
|
556 728 | }
|
557 - | /// When a union member's value does not contain a valid enum value,
|
558 - | /// the response should be a 400 ValidationException. Internal-only
|
559 - | /// enum values are excluded from the response message.
|
560 - | /// Test ID: RestJsonMalformedEnumUnion_case1
|
729 + | /// When a short list contains non-unique values,
|
730 + | /// the response should be a 400 ValidationException.
|
731 + | /// Test ID: RestJsonMalformedUniqueItemsShortList
|
561 732 | #[::tokio::test]
|
733 + | #[::tracing_test::traced_test]
|
562 734 | #[should_panic]
|
563 - | async fn rest_json_malformed_enum_union_case1_malformed_request() {
|
735 + | async fn rest_json_malformed_unique_items_short_list_malformed_request() {
|
564 736 | {
|
565 737 | #[allow(unused_mut)]
|
566 738 | let mut http_request = http::Request::builder()
|
567 - | .uri("/MalformedEnum")
|
739 + | .uri("/MalformedUniqueItems")
|
568 740 | .method("POST")
|
569 741 | .header("content-type", "application/json")
|
570 742 | .body(::aws_smithy_http_server::body::Body::from(
|
571 - | ::bytes::Bytes::from_static(
|
572 - | "{ \"union\" : { \"first\": \"XYZ\" } }".as_bytes(),
|
573 - | ),
|
743 + | ::bytes::Bytes::from_static("{ \"shortList\" : [2, 2] }".as_bytes()),
|
574 744 | ))
|
575 745 | .unwrap();
|
576 746 | #[allow(unused_mut)]
|
577 747 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
578 748 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
579 749 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
580 - | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
750 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
581 751 | let sender = sender.clone();
|
582 752 | async move {
|
583 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
753 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
584 754 | sender.send(()).await.expect("receiver dropped early");
|
585 755 | result
|
586 756 | }
|
587 757 | })
|
588 758 | .build_unchecked();
|
589 759 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
590 760 | .await
|
591 761 | .expect("unable to make an HTTP request");
|
592 762 | ::pretty_assertions::assert_eq!(
|
593 763 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
594 764 | http_response.status()
|
595 765 | );
|
596 766 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
597 767 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
598 768 | http_response.headers(),
|
599 769 | expected_headers,
|
600 770 | ));
|
601 771 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
602 772 | .await
|
603 773 | .expect("unable to extract body to bytes");
|
604 774 | ::aws_smithy_protocol_test::assert_ok(
|
605 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/union/first' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/union/first' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/union/first\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
775 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/shortList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/shortList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/shortList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
606 776 | );
|
607 777 | }
|
608 778 | }
|
609 - | }
|
610 - | #[cfg(test)]
|
611 - | #[allow(unreachable_code, unused_variables)]
|
612 - | mod server_malformed_length_test {
|
613 - | /// When a blob member does not fit within length bounds,
|
779 + | /// When an integer list contains non-unique values,
|
614 780 | /// the response should be a 400 ValidationException.
|
615 - | /// Test ID: RestJsonMalformedLengthBlob_case0
|
781 + | /// Test ID: RestJsonMalformedUniqueItemsIntegerList
|
616 782 | #[::tokio::test]
|
617 - | async fn rest_json_malformed_length_blob_case0_malformed_request() {
|
783 + | #[::tracing_test::traced_test]
|
784 + | #[should_panic]
|
785 + | async fn rest_json_malformed_unique_items_integer_list_malformed_request() {
|
618 786 | {
|
619 787 | #[allow(unused_mut)]
|
620 788 | let mut http_request = http::Request::builder()
|
621 - | .uri("/MalformedLength")
|
789 + | .uri("/MalformedUniqueItems")
|
622 790 | .method("POST")
|
623 791 | .header("content-type", "application/json")
|
624 792 | .body(::aws_smithy_http_server::body::Body::from(
|
625 - | ::bytes::Bytes::from_static("{ \"blob\" : \"YQ==\" }".as_bytes()),
|
793 + | ::bytes::Bytes::from_static("{ \"integerList\" : [3, 3] }".as_bytes()),
|
626 794 | ))
|
627 795 | .unwrap();
|
628 796 | #[allow(unused_mut)]
|
629 797 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
630 798 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
631 799 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
632 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
800 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
633 801 | let sender = sender.clone();
|
634 802 | async move {
|
635 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
803 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
636 804 | sender.send(()).await.expect("receiver dropped early");
|
637 805 | result
|
638 806 | }
|
639 807 | })
|
640 808 | .build_unchecked();
|
641 809 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
642 810 | .await
|
643 811 | .expect("unable to make an HTTP request");
|
644 812 | ::pretty_assertions::assert_eq!(
|
645 813 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
646 814 | http_response.status()
|
647 815 | );
|
648 816 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
649 817 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
650 818 | http_response.headers(),
|
651 819 | expected_headers,
|
652 820 | ));
|
653 821 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
654 822 | .await
|
655 823 | .expect("unable to extract body to bytes");
|
656 824 | ::aws_smithy_protocol_test::assert_ok(
|
657 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 1 at '/blob' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 1 at '/blob' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/blob\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
825 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/integerList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/integerList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/integerList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
658 826 | );
|
659 827 | }
|
660 828 | }
|
661 - | /// When a blob member does not fit within length bounds,
|
829 + | /// When an integer list contains non-unique values,
|
662 830 | /// the response should be a 400 ValidationException.
|
663 - | /// Test ID: RestJsonMalformedLengthBlob_case1
|
831 + | /// Test ID: RestJsonMalformedUniqueItemsLongList
|
664 832 | #[::tokio::test]
|
665 - | async fn rest_json_malformed_length_blob_case1_malformed_request() {
|
833 + | #[::tracing_test::traced_test]
|
834 + | #[should_panic]
|
835 + | async fn rest_json_malformed_unique_items_long_list_malformed_request() {
|
666 836 | {
|
667 837 | #[allow(unused_mut)]
|
668 838 | let mut http_request = http::Request::builder()
|
669 - | .uri("/MalformedLength")
|
839 + | .uri("/MalformedUniqueItems")
|
670 840 | .method("POST")
|
671 841 | .header("content-type", "application/json")
|
672 842 | .body(::aws_smithy_http_server::body::Body::from(
|
673 - | ::bytes::Bytes::from_static(
|
674 - | "{ \"blob\" : \"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXo=\" }".as_bytes(),
|
675 - | ),
|
843 + | ::bytes::Bytes::from_static("{ \"longList\" : [4, 4] }".as_bytes()),
|
676 844 | ))
|
677 845 | .unwrap();
|
678 846 | #[allow(unused_mut)]
|
679 847 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
680 848 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
681 849 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
682 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
850 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
683 851 | let sender = sender.clone();
|
684 852 | async move {
|
685 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
853 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
686 854 | sender.send(()).await.expect("receiver dropped early");
|
687 855 | result
|
688 856 | }
|
689 857 | })
|
690 858 | .build_unchecked();
|
691 859 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
692 860 | .await
|
693 861 | .expect("unable to make an HTTP request");
|
694 862 | ::pretty_assertions::assert_eq!(
|
695 863 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
696 864 | http_response.status()
|
697 865 | );
|
698 866 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
699 867 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
700 868 | http_response.headers(),
|
701 869 | expected_headers,
|
702 870 | ));
|
703 871 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
704 872 | .await
|
705 873 | .expect("unable to extract body to bytes");
|
706 874 | ::aws_smithy_protocol_test::assert_ok(
|
707 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 26 at '/blob' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 26 at '/blob' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/blob\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
875 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/longList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/longList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/longList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
708 876 | );
|
709 877 | }
|
710 878 | }
|
711 - | /// When a string member does not fit within length bounds,
|
879 + | /// When a timestamp list contains non-unique values,
|
712 880 | /// the response should be a 400 ValidationException.
|
713 - | /// Test ID: RestJsonMalformedLengthString_case0
|
881 + | /// Test ID: RestJsonMalformedUniqueItemsTimestampList
|
714 882 | #[::tokio::test]
|
715 - | async fn rest_json_malformed_length_string_case0_malformed_request() {
|
883 + | #[::tracing_test::traced_test]
|
884 + | #[should_panic]
|
885 + | async fn rest_json_malformed_unique_items_timestamp_list_malformed_request() {
|
716 886 | {
|
717 887 | #[allow(unused_mut)]
|
718 888 | let mut http_request = http::Request::builder()
|
719 - | .uri("/MalformedLength")
|
889 + | .uri("/MalformedUniqueItems")
|
720 890 | .method("POST")
|
721 891 | .header("content-type", "application/json")
|
722 892 | .body(::aws_smithy_http_server::body::Body::from(
|
723 - | ::bytes::Bytes::from_static("{ \"string\" : \"a\" }".as_bytes()),
|
893 + | ::bytes::Bytes::from_static(
|
894 + | "{ \"timestampList\" : [1676660607, 1676660607] }".as_bytes(),
|
895 + | ),
|
724 896 | ))
|
725 897 | .unwrap();
|
726 898 | #[allow(unused_mut)]
|
727 899 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
728 900 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
729 901 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
730 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
902 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
731 903 | let sender = sender.clone();
|
732 904 | async move {
|
733 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
905 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
734 906 | sender.send(()).await.expect("receiver dropped early");
|
735 907 | result
|
736 908 | }
|
737 909 | })
|
738 910 | .build_unchecked();
|
739 911 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
740 912 | .await
|
741 913 | .expect("unable to make an HTTP request");
|
742 914 | ::pretty_assertions::assert_eq!(
|
743 915 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
744 916 | http_response.status()
|
745 917 | );
|
746 918 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
747 919 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
748 920 | http_response.headers(),
|
749 921 | expected_headers,
|
750 922 | ));
|
751 923 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
752 924 | .await
|
753 925 | .expect("unable to extract body to bytes");
|
754 926 | ::aws_smithy_protocol_test::assert_ok(
|
755 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 1 at '/string' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 1 at '/string' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
927 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/timestampList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/timestampList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/timestampList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
756 928 | );
|
757 929 | }
|
758 930 | }
|
759 - | /// When a string member does not fit within length bounds,
|
931 + | /// When a date-time timestamp list contains non-unique values,
|
760 932 | /// the response should be a 400 ValidationException.
|
761 - | /// Test ID: RestJsonMalformedLengthString_case1
|
933 + | /// Test ID: RestJsonMalformedUniqueItemsDateTimeList
|
762 934 | #[::tokio::test]
|
763 - | async fn rest_json_malformed_length_string_case1_malformed_request() {
|
935 + | #[::tracing_test::traced_test]
|
936 + | #[should_panic]
|
937 + | async fn rest_json_malformed_unique_items_date_time_list_malformed_request() {
|
764 938 | {
|
765 939 | #[allow(unused_mut)]
|
766 - | let mut http_request = http::Request::builder()
|
767 - | .uri("/MalformedLength")
|
768 - | .method("POST")
|
769 - | .header("content-type", "application/json")
|
770 - | .body(::aws_smithy_http_server::body::Body::from(
|
771 - | ::bytes::Bytes::from_static(
|
772 - | "{ \"string\" : \"abcdefghijklmnopqrstuvwxyz\" }".as_bytes(),
|
773 - | ),
|
774 - | ))
|
775 - | .unwrap();
|
940 + | let mut http_request = http::Request::builder()
|
941 + | .uri("/MalformedUniqueItems")
|
942 + | .method("POST")
|
943 + | .header("content-type", "application/json")
|
944 + | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"dateTimeList\" : [\"1985-04-12T23:20:50.52Z\", \"1985-04-12T23:20:50.52Z\"] }".as_bytes()))).unwrap();
|
776 945 | #[allow(unused_mut)]
|
777 946 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
778 947 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
779 948 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
780 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
949 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
781 950 | let sender = sender.clone();
|
782 951 | async move {
|
783 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
952 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
784 953 | sender.send(()).await.expect("receiver dropped early");
|
785 954 | result
|
786 955 | }
|
787 956 | })
|
788 957 | .build_unchecked();
|
789 958 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
790 959 | .await
|
791 960 | .expect("unable to make an HTTP request");
|
792 961 | ::pretty_assertions::assert_eq!(
|
793 962 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
794 963 | http_response.status()
|
795 964 | );
|
796 965 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
797 966 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
798 967 | http_response.headers(),
|
799 968 | expected_headers,
|
800 969 | ));
|
801 970 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
802 971 | .await
|
803 972 | .expect("unable to extract body to bytes");
|
804 973 | ::aws_smithy_protocol_test::assert_ok(
|
805 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 26 at '/string' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 26 at '/string' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
974 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/dateTimeList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/dateTimeList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/dateTimeList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
806 975 | );
|
807 976 | }
|
808 977 | }
|
809 - | /// When a string member does not fit within length bounds,
|
978 + | /// When a http-date timestamp list contains non-unique values,
|
810 979 | /// the response should be a 400 ValidationException.
|
811 - | /// Test ID: RestJsonMalformedLengthString_case2
|
980 + | /// Test ID: RestJsonMalformedUniqueItemsHttpDateList_case0
|
812 981 | #[::tokio::test]
|
813 - | async fn rest_json_malformed_length_string_case2_malformed_request() {
|
982 + | #[::tracing_test::traced_test]
|
983 + | #[should_panic]
|
984 + | async fn rest_json_malformed_unique_items_http_date_list_case0_malformed_request() {
|
814 985 | {
|
815 986 | #[allow(unused_mut)]
|
816 - | let mut http_request = http::Request::builder()
|
817 - | .uri("/MalformedLength")
|
818 - | .method("POST")
|
819 - | .header("content-type", "application/json")
|
820 - | .body(::aws_smithy_http_server::body::Body::from(
|
821 - | ::bytes::Bytes::from_static("{ \"string\" : \"👍\" }".as_bytes()),
|
822 - | ))
|
823 - | .unwrap();
|
987 + | let mut http_request = http::Request::builder()
|
988 + | .uri("/MalformedUniqueItems")
|
989 + | .method("POST")
|
990 + | .header("content-type", "application/json")
|
991 + | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"httpDateList\" : [\"Tue, 29 Apr 2014 18:30:38 GMT\", \"Tue, 29 Apr 2014 18:30:38 GMT\"] }".as_bytes()))).unwrap();
|
824 992 | #[allow(unused_mut)]
|
825 993 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
826 994 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
827 995 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
828 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
996 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
829 997 | let sender = sender.clone();
|
830 998 | async move {
|
831 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
999 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
832 1000 | sender.send(()).await.expect("receiver dropped early");
|
833 1001 | result
|
834 1002 | }
|
835 1003 | })
|
836 1004 | .build_unchecked();
|
837 1005 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
838 1006 | .await
|
839 1007 | .expect("unable to make an HTTP request");
|
840 1008 | ::pretty_assertions::assert_eq!(
|
841 1009 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
842 1010 | http_response.status()
|
843 1011 | );
|
844 1012 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
845 1013 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
846 1014 | http_response.headers(),
|
847 1015 | expected_headers,
|
848 1016 | ));
|
849 1017 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
850 1018 | .await
|
851 1019 | .expect("unable to extract body to bytes");
|
852 1020 | ::aws_smithy_protocol_test::assert_ok(
|
853 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 1 at '/string' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 1 at '/string' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1021 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/httpDateList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/httpDateList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/httpDateList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
854 1022 | );
|
855 1023 | }
|
856 1024 | }
|
857 - | /// When a string member does not fit within length bounds,
|
1025 + | /// When an enum list contains non-unique values,
|
858 1026 | /// the response should be a 400 ValidationException.
|
859 - | /// Test ID: RestJsonMalformedLengthMinString
|
1027 + | /// Test ID: RestJsonMalformedUniqueItemsEnumList
|
860 1028 | #[::tokio::test]
|
861 - | async fn rest_json_malformed_length_min_string_malformed_request() {
|
1029 + | #[::tracing_test::traced_test]
|
1030 + | #[should_panic]
|
1031 + | async fn rest_json_malformed_unique_items_enum_list_malformed_request() {
|
862 1032 | {
|
863 1033 | #[allow(unused_mut)]
|
864 1034 | let mut http_request = http::Request::builder()
|
865 - | .uri("/MalformedLength")
|
1035 + | .uri("/MalformedUniqueItems")
|
866 1036 | .method("POST")
|
867 1037 | .header("content-type", "application/json")
|
868 1038 | .body(::aws_smithy_http_server::body::Body::from(
|
869 - | ::bytes::Bytes::from_static("{ \"minString\" : \"a\" }".as_bytes()),
|
1039 + | ::bytes::Bytes::from_static("{ \"enumList\" : [\"Foo\", \"Foo\"] }".as_bytes()),
|
870 1040 | ))
|
871 1041 | .unwrap();
|
872 1042 | #[allow(unused_mut)]
|
873 1043 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
874 1044 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
875 1045 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
876 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
1046 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
877 1047 | let sender = sender.clone();
|
878 1048 | async move {
|
879 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
1049 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
880 1050 | sender.send(()).await.expect("receiver dropped early");
|
881 1051 | result
|
882 1052 | }
|
883 1053 | })
|
884 1054 | .build_unchecked();
|
885 1055 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
886 1056 | .await
|
887 1057 | .expect("unable to make an HTTP request");
|
888 1058 | ::pretty_assertions::assert_eq!(
|
889 1059 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
890 1060 | http_response.status()
|
891 1061 | );
|
892 1062 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
893 1063 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
894 1064 | http_response.headers(),
|
895 1065 | expected_headers,
|
896 1066 | ));
|
897 1067 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
898 1068 | .await
|
899 1069 | .expect("unable to extract body to bytes");
|
900 1070 | ::aws_smithy_protocol_test::assert_ok(
|
901 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 1 at '/minString' failed to satisfy constraint: Member must have length greater than or equal to 2\",\n \"fieldList\" : [{\"message\": \"Value with length 1 at '/minString' failed to satisfy constraint: Member must have length greater than or equal to 2\", \"path\": \"/minString\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1071 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/enumList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/enumList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/enumList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
902 1072 | );
|
903 1073 | }
|
904 1074 | }
|
905 - | /// When a string member does not fit within length bounds,
|
1075 + | /// When an intEnum list contains non-unique values,
|
906 1076 | /// the response should be a 400 ValidationException.
|
907 - | /// Test ID: RestJsonMalformedLengthMaxString
|
1077 + | /// Test ID: RestJsonMalformedUniqueItemsIntEnumList
|
908 1078 | #[::tokio::test]
|
909 - | async fn rest_json_malformed_length_max_string_malformed_request() {
|
1079 + | #[::tracing_test::traced_test]
|
1080 + | #[should_panic]
|
1081 + | async fn rest_json_malformed_unique_items_int_enum_list_malformed_request() {
|
910 1082 | {
|
911 1083 | #[allow(unused_mut)]
|
912 1084 | let mut http_request = http::Request::builder()
|
913 - | .uri("/MalformedLength")
|
1085 + | .uri("/MalformedUniqueItems")
|
914 1086 | .method("POST")
|
915 1087 | .header("content-type", "application/json")
|
916 1088 | .body(::aws_smithy_http_server::body::Body::from(
|
917 - | ::bytes::Bytes::from_static(
|
918 - | "{ \"maxString\" : \"abcdefghijklmnopqrstuvwxyz\" }".as_bytes(),
|
919 - | ),
|
1089 + | ::bytes::Bytes::from_static("{ \"intEnumList\" : [3, 3] }".as_bytes()),
|
920 1090 | ))
|
921 1091 | .unwrap();
|
922 1092 | #[allow(unused_mut)]
|
923 1093 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
924 1094 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
925 1095 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
926 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
1096 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
927 1097 | let sender = sender.clone();
|
928 1098 | async move {
|
929 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
1099 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
930 1100 | sender.send(()).await.expect("receiver dropped early");
|
931 1101 | result
|
932 1102 | }
|
933 1103 | })
|
934 1104 | .build_unchecked();
|
935 1105 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
936 1106 | .await
|
937 1107 | .expect("unable to make an HTTP request");
|
938 1108 | ::pretty_assertions::assert_eq!(
|
939 1109 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
940 1110 | http_response.status()
|
941 1111 | );
|
942 1112 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
943 1113 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
944 1114 | http_response.headers(),
|
945 1115 | expected_headers,
|
946 1116 | ));
|
947 1117 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
948 1118 | .await
|
949 1119 | .expect("unable to extract body to bytes");
|
950 1120 | ::aws_smithy_protocol_test::assert_ok(
|
951 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 26 at '/maxString' failed to satisfy constraint: Member must have length less than or equal to 8\",\n \"fieldList\" : [{\"message\": \"Value with length 26 at '/maxString' failed to satisfy constraint: Member must have length less than or equal to 8\", \"path\": \"/maxString\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1121 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/intEnumList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/intEnumList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/intEnumList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
952 1122 | );
|
953 1123 | }
|
954 1124 | }
|
955 - | /// When a list member does not fit within length bounds,
|
1125 + | /// When an list of lists contains non-unique values,
|
956 1126 | /// the response should be a 400 ValidationException.
|
957 - | /// Test ID: RestJsonMalformedLengthList_case0
|
1127 + | /// Test ID: RestJsonMalformedUniqueItemsListList
|
958 1128 | #[::tokio::test]
|
959 - | async fn rest_json_malformed_length_list_case0_malformed_request() {
|
1129 + | #[::tracing_test::traced_test]
|
1130 + | #[should_panic]
|
1131 + | async fn rest_json_malformed_unique_items_list_list_malformed_request() {
|
960 1132 | {
|
961 1133 | #[allow(unused_mut)]
|
962 1134 | let mut http_request = http::Request::builder()
|
963 - | .uri("/MalformedLength")
|
1135 + | .uri("/MalformedUniqueItems")
|
964 1136 | .method("POST")
|
965 1137 | .header("content-type", "application/json")
|
966 1138 | .body(::aws_smithy_http_server::body::Body::from(
|
967 - | ::bytes::Bytes::from_static("{ \"list\" : [\"abc\"] }".as_bytes()),
|
1139 + | ::bytes::Bytes::from_static(
|
1140 + | "{ \"listList\" : [[\"foo\",\"bar\"], [\"foo\",\"bar\"]] }".as_bytes(),
|
1141 + | ),
|
968 1142 | ))
|
969 1143 | .unwrap();
|
970 1144 | #[allow(unused_mut)]
|
971 1145 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
972 1146 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
973 1147 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
974 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
1148 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
975 1149 | let sender = sender.clone();
|
976 1150 | async move {
|
977 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
1151 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
978 1152 | sender.send(()).await.expect("receiver dropped early");
|
979 1153 | result
|
980 1154 | }
|
981 1155 | })
|
982 1156 | .build_unchecked();
|
983 1157 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
984 1158 | .await
|
985 1159 | .expect("unable to make an HTTP request");
|
986 1160 | ::pretty_assertions::assert_eq!(
|
987 1161 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
988 1162 | http_response.status()
|
989 1163 | );
|
990 1164 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
991 1165 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
992 1166 | http_response.headers(),
|
993 1167 | expected_headers,
|
994 1168 | ));
|
995 1169 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
996 1170 | .await
|
997 1171 | .expect("unable to extract body to bytes");
|
998 1172 | ::aws_smithy_protocol_test::assert_ok(
|
999 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 1 at '/list' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 1 at '/list' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/list\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1173 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/listList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/listList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/listList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1000 1174 | );
|
1001 1175 | }
|
1002 1176 | }
|
1003 - | /// When a list member does not fit within length bounds,
|
1177 + | /// When an list of structures contains non-unique values,
|
1004 1178 | /// the response should be a 400 ValidationException.
|
1005 - | /// Test ID: RestJsonMalformedLengthList_case1
|
1179 + | /// Test ID: RestJsonMalformedUniqueItemsStructureList
|
1006 1180 | #[::tokio::test]
|
1007 - | async fn rest_json_malformed_length_list_case1_malformed_request() {
|
1181 + | #[::tracing_test::traced_test]
|
1182 + | #[should_panic]
|
1183 + | async fn rest_json_malformed_unique_items_structure_list_malformed_request() {
|
1008 1184 | {
|
1009 1185 | #[allow(unused_mut)]
|
1010 - | let mut http_request = http::Request::builder()
|
1011 - | .uri("/MalformedLength")
|
1012 - | .method("POST")
|
1013 - | .header("content-type", "application/json")
|
1014 - | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"list\" : [\"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\"] }".as_bytes()))).unwrap();
|
1186 + | let mut http_request = http::Request::builder()
|
1187 + | .uri("/MalformedUniqueItems")
|
1188 + | .method("POST")
|
1189 + | .header("content-type", "application/json")
|
1190 + | .body(::aws_smithy_http_server::body::Body::from(
|
1191 + | ::bytes::Bytes::from_static(
|
1192 + | "{ \"structureList\" : [{\"hi\": \"hello\"}, {\"hi\": \"hello\"}] }"
|
1193 + | .as_bytes(),
|
1194 + | ),
|
1195 + | ))
|
1196 + | .unwrap();
|
1015 1197 | #[allow(unused_mut)]
|
1016 1198 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1017 1199 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1018 1200 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1019 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
1201 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
1020 1202 | let sender = sender.clone();
|
1021 1203 | async move {
|
1022 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
1204 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
1023 1205 | sender.send(()).await.expect("receiver dropped early");
|
1024 1206 | result
|
1025 1207 | }
|
1026 1208 | })
|
1027 1209 | .build_unchecked();
|
1028 1210 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1029 1211 | .await
|
1030 1212 | .expect("unable to make an HTTP request");
|
1031 1213 | ::pretty_assertions::assert_eq!(
|
1032 1214 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1033 1215 | http_response.status()
|
1034 1216 | );
|
1035 1217 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1036 1218 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1037 1219 | http_response.headers(),
|
1038 1220 | expected_headers,
|
1039 1221 | ));
|
1040 1222 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1041 1223 | .await
|
1042 1224 | .expect("unable to extract body to bytes");
|
1043 1225 | ::aws_smithy_protocol_test::assert_ok(
|
1044 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 10 at '/list' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 10 at '/list' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/list\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1226 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/structureList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/structureList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/structureList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1045 1227 | );
|
1046 1228 | }
|
1047 1229 | }
|
1048 - | /// When a list member's value does not fit within length bounds,
|
1049 - | /// the response should be a 400 ValidationException.
|
1050 - | /// Test ID: RestJsonMalformedLengthListValue_case0
|
1230 + | /// When a list of structures does not contain required keys,
|
1231 + | /// the response should be a 400 ValidationException and not
|
1232 + | /// a 500 error.
|
1233 + | /// Test ID: RestJsonMalformedUniqueItemsStructureMissingKeyList
|
1051 1234 | #[::tokio::test]
|
1052 - | async fn rest_json_malformed_length_list_value_case0_malformed_request() {
|
1235 + | #[::tracing_test::traced_test]
|
1236 + | async fn rest_json_malformed_unique_items_structure_missing_key_list_malformed_request() {
|
1053 1237 | {
|
1054 1238 | #[allow(unused_mut)]
|
1055 1239 | let mut http_request = http::Request::builder()
|
1056 - | .uri("/MalformedLength")
|
1240 + | .uri("/MalformedUniqueItems")
|
1057 1241 | .method("POST")
|
1058 1242 | .header("content-type", "application/json")
|
1059 1243 | .body(::aws_smithy_http_server::body::Body::from(
|
1060 - | ::bytes::Bytes::from_static("{ \"list\" : [\"a\", \"abc\"] }".as_bytes()),
|
1244 + | ::bytes::Bytes::from_static(
|
1245 + | "{ \"structureListWithNoKey\" : [{\"hi2\": \"bar\"}] }".as_bytes(),
|
1246 + | ),
|
1061 1247 | ))
|
1062 1248 | .unwrap();
|
1063 1249 | #[allow(unused_mut)]
|
1064 1250 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1065 1251 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1066 1252 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1067 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
1253 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
1068 1254 | let sender = sender.clone();
|
1069 1255 | async move {
|
1070 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
1256 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
1071 1257 | sender.send(()).await.expect("receiver dropped early");
|
1072 1258 | result
|
1073 1259 | }
|
1074 1260 | })
|
1075 1261 | .build_unchecked();
|
1076 1262 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1077 1263 | .await
|
1078 1264 | .expect("unable to make an HTTP request");
|
1079 1265 | ::pretty_assertions::assert_eq!(
|
1080 1266 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1081 1267 | http_response.status()
|
1082 1268 | );
|
1083 1269 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1084 1270 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1085 1271 | http_response.headers(),
|
1086 1272 | expected_headers,
|
1087 1273 | ));
|
1088 1274 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1089 1275 | .await
|
1090 1276 | .expect("unable to extract body to bytes");
|
1091 1277 | ::aws_smithy_protocol_test::assert_ok(
|
1092 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 1 at '/list/0' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 1 at '/list/0' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/list/0\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1278 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/structureListWithNoKey/0/hi' failed to satisfy constraint: Member must not be null\",\n \"fieldList\" : [{\"message\": \"Value at '/structureListWithNoKey/0/hi' failed to satisfy constraint: Member must not be null\", \"path\": \"/structureListWithNoKey/0/hi\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1093 1279 | );
|
1094 1280 | }
|
1095 1281 | }
|
1096 - | /// When a list member's value does not fit within length bounds,
|
1282 + | /// When an list of unions contains non-unique values,
|
1097 1283 | /// the response should be a 400 ValidationException.
|
1098 - | /// Test ID: RestJsonMalformedLengthListValue_case1
|
1284 + | /// Test ID: RestJsonMalformedUniqueItemsUnionList_case0
|
1099 1285 | #[::tokio::test]
|
1100 - | async fn rest_json_malformed_length_list_value_case1_malformed_request() {
|
1286 + | #[::tracing_test::traced_test]
|
1287 + | #[should_panic]
|
1288 + | async fn rest_json_malformed_unique_items_union_list_case0_malformed_request() {
|
1101 1289 | {
|
1102 1290 | #[allow(unused_mut)]
|
1103 1291 | let mut http_request = http::Request::builder()
|
1104 - | .uri("/MalformedLength")
|
1292 + | .uri("/MalformedUniqueItems")
|
1105 1293 | .method("POST")
|
1106 1294 | .header("content-type", "application/json")
|
1107 1295 | .body(::aws_smithy_http_server::body::Body::from(
|
1108 1296 | ::bytes::Bytes::from_static(
|
1109 - | "{ \"list\" : [\"abcdefghijklmnopqrstuvwxyz\", \"abc\"] }".as_bytes(),
|
1297 + | "{ \"unionList\" : [{\"string\": \"foo\"}, {\"string\": \"foo\"}] }"
|
1298 + | .as_bytes(),
|
1110 1299 | ),
|
1111 1300 | ))
|
1112 1301 | .unwrap();
|
1113 1302 | #[allow(unused_mut)]
|
1114 1303 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1115 1304 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1116 1305 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1117 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
1306 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
1118 1307 | let sender = sender.clone();
|
1119 1308 | async move {
|
1120 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
1309 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
1121 1310 | sender.send(()).await.expect("receiver dropped early");
|
1122 1311 | result
|
1123 1312 | }
|
1124 1313 | })
|
1125 1314 | .build_unchecked();
|
1126 1315 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1127 1316 | .await
|
1128 1317 | .expect("unable to make an HTTP request");
|
1129 1318 | ::pretty_assertions::assert_eq!(
|
1130 1319 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1131 1320 | http_response.status()
|
1132 1321 | );
|
1133 1322 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1134 1323 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1135 1324 | http_response.headers(),
|
1136 1325 | expected_headers,
|
1137 1326 | ));
|
1138 1327 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1139 1328 | .await
|
1140 1329 | .expect("unable to extract body to bytes");
|
1141 1330 | ::aws_smithy_protocol_test::assert_ok(
|
1142 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 26 at '/list/0' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 26 at '/list/0' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/list/0\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1331 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/unionList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/unionList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/unionList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1143 1332 | );
|
1144 1333 | }
|
1145 1334 | }
|
1146 - | /// When a map member does not fit within length bounds,
|
1335 + | /// When an list of unions contains non-unique values,
|
1147 1336 | /// the response should be a 400 ValidationException.
|
1148 - | /// Test ID: RestJsonMalformedLengthMap_case0
|
1337 + | /// Test ID: RestJsonMalformedUniqueItemsUnionList_case1
|
1149 1338 | #[::tokio::test]
|
1150 - | async fn rest_json_malformed_length_map_case0_malformed_request() {
|
1339 + | #[::tracing_test::traced_test]
|
1340 + | #[should_panic]
|
1341 + | async fn rest_json_malformed_unique_items_union_list_case1_malformed_request() {
|
1151 1342 | {
|
1152 1343 | #[allow(unused_mut)]
|
1153 1344 | let mut http_request = http::Request::builder()
|
1154 - | .uri("/MalformedLength")
|
1345 + | .uri("/MalformedUniqueItems")
|
1155 1346 | .method("POST")
|
1156 1347 | .header("content-type", "application/json")
|
1157 1348 | .body(::aws_smithy_http_server::body::Body::from(
|
1158 1349 | ::bytes::Bytes::from_static(
|
1159 - | "{ \"map\" : {\"abc\": [\"def\", \"efg\", \"fgh\"]} }".as_bytes(),
|
1350 + | "{ \"unionList\" : [{\"integer\": 1}, {\"integer\": 1}] }".as_bytes(),
|
1160 1351 | ),
|
1161 1352 | ))
|
1162 1353 | .unwrap();
|
1163 1354 | #[allow(unused_mut)]
|
1164 1355 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1165 1356 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1166 1357 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1167 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
1358 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
1168 1359 | let sender = sender.clone();
|
1169 1360 | async move {
|
1170 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
1361 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
1171 1362 | sender.send(()).await.expect("receiver dropped early");
|
1172 1363 | result
|
1173 1364 | }
|
1174 1365 | })
|
1175 1366 | .build_unchecked();
|
1176 1367 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1177 1368 | .await
|
1178 1369 | .expect("unable to make an HTTP request");
|
1179 1370 | ::pretty_assertions::assert_eq!(
|
1180 1371 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1181 1372 | http_response.status()
|
1182 1373 | );
|
1183 1374 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1184 1375 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1185 1376 | http_response.headers(),
|
1186 1377 | expected_headers,
|
1187 1378 | ));
|
1188 1379 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1189 1380 | .await
|
1190 1381 | .expect("unable to extract body to bytes");
|
1191 1382 | ::aws_smithy_protocol_test::assert_ok(
|
1192 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 1 at '/map' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 1 at '/map' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1383 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/unionList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/unionList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/unionList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1193 1384 | );
|
1194 1385 | }
|
1195 1386 | }
|
1196 - | /// When a map member does not fit within length bounds,
|
1197 - | /// the response should be a 400 ValidationException.
|
1198 - | /// Test ID: RestJsonMalformedLengthMap_case1
|
1199 - | #[::tokio::test]
|
1200 - | async fn rest_json_malformed_length_map_case1_malformed_request() {
|
1201 - | {
|
1202 - | #[allow(unused_mut)]
|
1203 - | let mut http_request = http::Request::builder()
|
1204 - | .uri("/MalformedLength")
|
1205 - | .method("POST")
|
1206 - | .header("content-type", "application/json")
|
1207 - | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"map\" : {\"abc\": [\"abc\", \"def\", \"efg\"], \"bcd\": [\"abc\", \"def\", \"efg\"],\n \"cde\": [\"abc\", \"def\", \"efg\"], \"def\": [\"abc\", \"def\", \"efg\"],\n \"efg\": [\"abc\", \"def\", \"efg\"], \"fgh\": [\"abc\", \"def\", \"efg\"],\n \"ghi\": [\"abc\", \"def\", \"efg\"], \"jkl\": [\"abc\", \"def\", \"efg\"],\n \"klm\": [\"abc\", \"def\", \"efg\"], \"lmn\": [\"abc\", \"def\", \"efg\"] } }".as_bytes()))).unwrap();
|
1208 - | #[allow(unused_mut)]
|
1209 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1210 - | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1211 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1212 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
1213 - | let sender = sender.clone();
|
1214 - | async move {
|
1215 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
1216 - | sender.send(()).await.expect("receiver dropped early");
|
1217 - | result
|
1218 - | }
|
1219 - | })
|
1220 - | .build_unchecked();
|
1221 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1222 - | .await
|
1223 - | .expect("unable to make an HTTP request");
|
1224 - | ::pretty_assertions::assert_eq!(
|
1225 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1226 - | http_response.status()
|
1227 - | );
|
1228 - | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1229 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1230 - | http_response.headers(),
|
1231 - | expected_headers,
|
1232 - | ));
|
1233 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1234 - | .await
|
1235 - | .expect("unable to extract body to bytes");
|
1236 - | ::aws_smithy_protocol_test::assert_ok(
|
1237 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 10 at '/map' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 10 at '/map' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1238 - | );
|
1387 + | }
|
1388 + |
|
1389 + | const CONTENT_TYPE_MALFORMEDREQUIRED: ::mime::Mime = ::mime::APPLICATION_JSON;
|
1390 + | ::pin_project_lite::pin_project! {
|
1391 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
1392 + | /// [`MalformedRequiredInput`](crate::input::MalformedRequiredInput) using modelled bindings.
|
1393 + | pub struct MalformedRequiredInputFuture {
|
1394 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedRequiredInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
1395 + | }
|
1396 + | }
|
1397 + |
|
1398 + | impl std::future::Future for MalformedRequiredInputFuture {
|
1399 + | type Output = Result<
|
1400 + | crate::input::MalformedRequiredInput,
|
1401 + | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
1402 + | >;
|
1403 + |
|
1404 + | fn poll(
|
1405 + | self: std::pin::Pin<&mut Self>,
|
1406 + | cx: &mut std::task::Context<'_>,
|
1407 + | ) -> std::task::Poll<Self::Output> {
|
1408 + | let this = self.project();
|
1409 + | this.inner.as_mut().poll(cx)
|
1410 + | }
|
1411 + | }
|
1412 + |
|
1413 + | impl<B>
|
1414 + | ::aws_smithy_http_server::request::FromRequest<
|
1415 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
1416 + | B,
|
1417 + | > for crate::input::MalformedRequiredInput
|
1418 + | where
|
1419 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
1420 + | B: 'static,
|
1421 + |
|
1422 + | B::Data: Send,
|
1423 + | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
1424 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
1425 + | {
|
1426 + | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
1427 + | type Future = MalformedRequiredInputFuture;
|
1428 + |
|
1429 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
1430 + | let fut = async move {
|
1431 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
1432 + | request.headers(),
|
1433 + | &CONTENT_TYPE_MALFORMEDREQUIRED,
|
1434 + | ) {
|
1435 + | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
1436 + | }
|
1437 + | crate::protocol_serde::shape_malformed_required::de_malformed_required_http_request(
|
1438 + | request,
|
1439 + | )
|
1440 + | .await
|
1441 + | .map_err(Into::into)
|
1442 + | };
|
1443 + | use ::futures_util::future::TryFutureExt;
|
1444 + | let fut = fut.map_err(
|
1445 + | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
1446 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
1447 + | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
1448 + | e,
|
1449 + | )
|
1450 + | },
|
1451 + | );
|
1452 + | MalformedRequiredInputFuture {
|
1453 + | inner: Box::pin(fut),
|
1239 1454 | }
|
1240 1455 | }
|
1241 - | /// When a map member's key does not fit within length bounds,
|
1242 - | /// the response should be a 400 ValidationException.
|
1243 - | /// Test ID: RestJsonMalformedLengthMapKey_case0
|
1244 - | #[::tokio::test]
|
1245 - | async fn rest_json_malformed_length_map_key_case0_malformed_request() {
|
1246 - | {
|
1247 - | #[allow(unused_mut)]
|
1248 - | let mut http_request = http::Request::builder()
|
1249 - | .uri("/MalformedLength")
|
1250 - | .method("POST")
|
1251 - | .header("content-type", "application/json")
|
1252 - | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"map\" : {\"a\": [\"abc\", \"def\", \"efg\"], \"bcd\": [\"abc\", \"def\", \"efg\"], \"cde\": [\"abc\", \"def\", \"efg\"]} }".as_bytes()))).unwrap();
|
1253 - | #[allow(unused_mut)]
|
1254 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1255 - | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1256 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1257 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
1258 - | let sender = sender.clone();
|
1259 - | async move {
|
1260 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
1261 - | sender.send(()).await.expect("receiver dropped early");
|
1262 - | result
|
1263 - | }
|
1264 - | })
|
1265 - | .build_unchecked();
|
1266 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1267 - | .await
|
1268 - | .expect("unable to make an HTTP request");
|
1269 - | ::pretty_assertions::assert_eq!(
|
1270 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1271 - | http_response.status()
|
1272 - | );
|
1273 - | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1274 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1275 - | http_response.headers(),
|
1276 - | expected_headers,
|
1277 - | ));
|
1278 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1279 - | .await
|
1280 - | .expect("unable to extract body to bytes");
|
1281 - | ::aws_smithy_protocol_test::assert_ok(
|
1282 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 1 at '/map' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 1 at '/map' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1283 - | );
|
1456 + | }
|
1457 + | impl
|
1458 + | ::aws_smithy_http_server::response::IntoResponse<
|
1459 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
1460 + | > for crate::output::MalformedRequiredOutput
|
1461 + | {
|
1462 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
1463 + | match crate::protocol_serde::shape_malformed_required::ser_malformed_required_http_response(
|
1464 + | self,
|
1465 + | ) {
|
1466 + | Ok(response) => response,
|
1467 + | Err(e) => {
|
1468 + | ::tracing::error!(error = %e, "failed to serialize response");
|
1469 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
1470 + | }
|
1284 1471 | }
|
1285 1472 | }
|
1286 - | /// When a map member's key does not fit within length bounds,
|
1473 + | }
|
1474 + | impl
|
1475 + | ::aws_smithy_http_server::response::IntoResponse<
|
1476 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
1477 + | > for crate::error::MalformedRequiredError
|
1478 + | {
|
1479 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
1480 + | match crate::protocol_serde::shape_malformed_required::ser_malformed_required_http_error(
|
1481 + | &self,
|
1482 + | ) {
|
1483 + | Ok(mut response) => {
|
1484 + | response.extensions_mut().insert(
|
1485 + | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
1486 + | );
|
1487 + | response
|
1488 + | }
|
1489 + | Err(e) => {
|
1490 + | ::tracing::error!(error = %e, "failed to serialize response");
|
1491 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
1492 + | }
|
1493 + | }
|
1494 + | }
|
1495 + | }
|
1496 + |
|
1497 + | #[allow(unreachable_code, unused_variables)]
|
1498 + | #[cfg(test)]
|
1499 + | mod malformed_required_test {
|
1500 + |
|
1501 + | /// When a required member is not set in the message body,
|
1287 1502 | /// the response should be a 400 ValidationException.
|
1288 - | /// Test ID: RestJsonMalformedLengthMapKey_case1
|
1503 + | /// Test ID: RestJsonMalformedRequiredBodyUnset
|
1289 1504 | #[::tokio::test]
|
1290 - | async fn rest_json_malformed_length_map_key_case1_malformed_request() {
|
1505 + | #[::tracing_test::traced_test]
|
1506 + | async fn rest_json_malformed_required_body_unset_malformed_request() {
|
1291 1507 | {
|
1292 1508 | #[allow(unused_mut)]
|
1293 - | let mut http_request = http::Request::builder()
|
1294 - | .uri("/MalformedLength")
|
1295 - | .method("POST")
|
1296 - | .header("content-type", "application/json")
|
1297 - | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"map\" : {\"abcdefghijklmnopqrstuvwxyz\": [\"abc\", \"def\", \"efg\"], \"bcd\": [\"abc\", \"def\", \"efg\"], \"cde\": [\"abc\", \"def\", \"efg\"]} }".as_bytes()))).unwrap();
|
1509 + | let mut http_request = http::Request::builder()
|
1510 + | .uri("/MalformedRequired")
|
1511 + | .method("POST")
|
1512 + | .header("content-type", "application/json")
|
1513 + | .header("string-in-headers", "abc")
|
1514 + | .body(::aws_smithy_http_server::body::Body::from(
|
1515 + | ::bytes::Bytes::from_static("{ }".as_bytes()),
|
1516 + | ))
|
1517 + | .unwrap();
|
1518 + | *http_request.uri_mut() = "/MalformedRequired?stringInQuery=abc".parse().unwrap();
|
1298 1519 | #[allow(unused_mut)]
|
1299 1520 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1300 1521 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1301 1522 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1302 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
1523 + | .malformed_required(move |input: crate::input::MalformedRequiredInput| {
|
1303 1524 | let sender = sender.clone();
|
1304 1525 | async move {
|
1305 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
1526 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRequiredOutput, crate::error::MalformedRequiredError> };
|
1306 1527 | sender.send(()).await.expect("receiver dropped early");
|
1307 1528 | result
|
1308 1529 | }
|
1309 1530 | })
|
1310 1531 | .build_unchecked();
|
1311 1532 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1312 1533 | .await
|
1313 1534 | .expect("unable to make an HTTP request");
|
1314 1535 | ::pretty_assertions::assert_eq!(
|
1315 1536 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1316 1537 | http_response.status()
|
1317 1538 | );
|
1318 1539 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1319 1540 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1320 1541 | http_response.headers(),
|
1321 1542 | expected_headers,
|
1322 1543 | ));
|
1323 1544 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1324 1545 | .await
|
1325 1546 | .expect("unable to extract body to bytes");
|
1326 1547 | ::aws_smithy_protocol_test::assert_ok(
|
1327 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 26 at '/map' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 26 at '/map' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1548 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/string' failed to satisfy constraint: Member must not be null\",\n \"fieldList\" : [{\"message\": \"Value at '/string' failed to satisfy constraint: Member must not be null\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1328 1549 | );
|
1329 1550 | }
|
1330 1551 | }
|
1331 - | /// When a map member's value does not fit within length bounds,
|
1552 + | /// When a required member is set to null in the message body,
|
1332 1553 | /// the response should be a 400 ValidationException.
|
1333 - | /// Test ID: RestJsonMalformedLengthMapValue_case0
|
1554 + | /// Test ID: RestJsonMalformedRequiredBodyExplicitNull
|
1334 1555 | #[::tokio::test]
|
1335 - | async fn rest_json_malformed_length_map_value_case0_malformed_request() {
|
1556 + | #[::tracing_test::traced_test]
|
1557 + | async fn rest_json_malformed_required_body_explicit_null_malformed_request() {
|
1336 1558 | {
|
1337 1559 | #[allow(unused_mut)]
|
1338 - | let mut http_request = http::Request::builder()
|
1339 - | .uri("/MalformedLength")
|
1340 - | .method("POST")
|
1341 - | .header("content-type", "application/json")
|
1342 - | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"map\" : {\"abc\": [\"def\"], \"bcd\": [\"abc\", \"def\", \"efg\"], \"cde\": [\"abc\", \"def\", \"efg\"]} }".as_bytes()))).unwrap();
|
1560 + | let mut http_request = http::Request::builder()
|
1561 + | .uri("/MalformedRequired")
|
1562 + | .method("POST")
|
1563 + | .header("content-type", "application/json")
|
1564 + | .header("string-in-headers", "abc")
|
1565 + | .body(::aws_smithy_http_server::body::Body::from(
|
1566 + | ::bytes::Bytes::from_static("{ \"string\": null }".as_bytes()),
|
1567 + | ))
|
1568 + | .unwrap();
|
1569 + | *http_request.uri_mut() = "/MalformedRequired?stringInQuery=abc".parse().unwrap();
|
1343 1570 | #[allow(unused_mut)]
|
1344 1571 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1345 1572 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1346 1573 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1347 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
1574 + | .malformed_required(move |input: crate::input::MalformedRequiredInput| {
|
1348 1575 | let sender = sender.clone();
|
1349 1576 | async move {
|
1350 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
1577 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRequiredOutput, crate::error::MalformedRequiredError> };
|
1351 1578 | sender.send(()).await.expect("receiver dropped early");
|
1352 1579 | result
|
1353 1580 | }
|
1354 1581 | })
|
1355 1582 | .build_unchecked();
|
1356 1583 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1357 1584 | .await
|
1358 1585 | .expect("unable to make an HTTP request");
|
1359 1586 | ::pretty_assertions::assert_eq!(
|
1360 1587 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1361 1588 | http_response.status()
|
1362 1589 | );
|
1363 1590 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1364 1591 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1365 1592 | http_response.headers(),
|
1366 1593 | expected_headers,
|
1367 1594 | ));
|
1368 1595 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1369 1596 | .await
|
1370 1597 | .expect("unable to extract body to bytes");
|
1371 1598 | ::aws_smithy_protocol_test::assert_ok(
|
1372 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 1 at '/map/abc' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 1 at '/map/abc' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/map/abc\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1599 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/string' failed to satisfy constraint: Member must not be null\",\n \"fieldList\" : [{\"message\": \"Value at '/string' failed to satisfy constraint: Member must not be null\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1373 1600 | );
|
1374 1601 | }
|
1375 1602 | }
|
1376 - | /// When a map member's value does not fit within length bounds,
|
1603 + | /// When a required member is not set in headers,
|
1377 1604 | /// the response should be a 400 ValidationException.
|
1378 - | /// Test ID: RestJsonMalformedLengthMapValue_case1
|
1605 + | /// Test ID: RestJsonMalformedRequiredHeaderUnset
|
1379 1606 | #[::tokio::test]
|
1380 - | async fn rest_json_malformed_length_map_value_case1_malformed_request() {
|
1607 + | #[::tracing_test::traced_test]
|
1608 + | async fn rest_json_malformed_required_header_unset_malformed_request() {
|
1381 1609 | {
|
1382 1610 | #[allow(unused_mut)]
|
1383 - | let mut http_request = http::Request::builder()
|
1384 - | .uri("/MalformedLength")
|
1385 - | .method("POST")
|
1386 - | .header("content-type", "application/json")
|
1387 - | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"map\" : {\"abc\": [\"def\", \"efg\", \"fgh\", \"def\", \"efg\", \"fgh\", \"def\", \"efg\", \"fgh\", \"def\"],\n \"bcd\": [\"abc\", \"def\", \"efg\"],\n \"cde\": [\"abc\", \"def\", \"efg\"]} }".as_bytes()))).unwrap();
|
1611 + | let mut http_request = http::Request::builder()
|
1612 + | .uri("/MalformedRequired")
|
1613 + | .method("POST")
|
1614 + | .header("content-type", "application/json")
|
1615 + | .body(::aws_smithy_http_server::body::Body::from(
|
1616 + | ::bytes::Bytes::from_static("{ \"string\": \"abc\" }".as_bytes()),
|
1617 + | ))
|
1618 + | .unwrap();
|
1619 + | *http_request.uri_mut() = "/MalformedRequired?stringInQuery=abc".parse().unwrap();
|
1388 1620 | #[allow(unused_mut)]
|
1389 1621 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1390 1622 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1391 1623 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1392 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
1624 + | .malformed_required(move |input: crate::input::MalformedRequiredInput| {
|
1393 1625 | let sender = sender.clone();
|
1394 1626 | async move {
|
1395 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
1627 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRequiredOutput, crate::error::MalformedRequiredError> };
|
1396 1628 | sender.send(()).await.expect("receiver dropped early");
|
1397 1629 | result
|
1398 1630 | }
|
1399 1631 | })
|
1400 1632 | .build_unchecked();
|
1401 1633 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1402 1634 | .await
|
1403 1635 | .expect("unable to make an HTTP request");
|
1404 1636 | ::pretty_assertions::assert_eq!(
|
1405 1637 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1406 1638 | http_response.status()
|
1407 1639 | );
|
1408 1640 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1409 1641 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1410 1642 | http_response.headers(),
|
1411 1643 | expected_headers,
|
1412 1644 | ));
|
1413 1645 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1414 1646 | .await
|
1415 1647 | .expect("unable to extract body to bytes");
|
1416 1648 | ::aws_smithy_protocol_test::assert_ok(
|
1417 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 10 at '/map/abc' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 10 at '/map/abc' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/map/abc\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1649 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/stringInHeader' failed to satisfy constraint: Member must not be null\",\n \"fieldList\" : [{\"message\": \"Value at '/stringInHeader' failed to satisfy constraint: Member must not be null\", \"path\": \"/stringInHeader\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1418 1650 | );
|
1419 1651 | }
|
1420 1652 | }
|
1421 1653 | }
|
1422 - | #[cfg(test)]
|
1423 - | #[allow(unreachable_code, unused_variables)]
|
1424 - | mod server_malformed_length_override_test {
|
1425 - | /// When a blob member does not fit within length bounds,
|
1426 - | /// the response should be a 400 ValidationException.
|
1427 - | /// Test ID: RestJsonMalformedLengthBlobOverride_case0
|
1428 - | #[::tokio::test]
|
1429 - | async fn rest_json_malformed_length_blob_override_case0_malformed_request() {
|
1430 - | {
|
1431 - | #[allow(unused_mut)]
|
1432 - | let mut http_request = http::Request::builder()
|
1433 - | .uri("/MalformedLengthOverride")
|
1434 - | .method("POST")
|
1435 - | .header("content-type", "application/json")
|
1436 - | .body(::aws_smithy_http_server::body::Body::from(
|
1437 - | ::bytes::Bytes::from_static("{ \"blob\" : \"YWJj\" }".as_bytes()),
|
1654 + |
|
1655 + | const CONTENT_TYPE_MALFORMEDRANGEOVERRIDE: ::mime::Mime = ::mime::APPLICATION_JSON;
|
1656 + | ::pin_project_lite::pin_project! {
|
1657 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
1658 + | /// [`MalformedRangeOverrideInput`](crate::input::MalformedRangeOverrideInput) using modelled bindings.
|
1659 + | pub struct MalformedRangeOverrideInputFuture {
|
1660 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedRangeOverrideInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
1661 + | }
|
1662 + | }
|
1663 + |
|
1664 + | impl std::future::Future for MalformedRangeOverrideInputFuture {
|
1665 + | type Output = Result<
|
1666 + | crate::input::MalformedRangeOverrideInput,
|
1667 + | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
1668 + | >;
|
1669 + |
|
1670 + | fn poll(
|
1671 + | self: std::pin::Pin<&mut Self>,
|
1672 + | cx: &mut std::task::Context<'_>,
|
1673 + | ) -> std::task::Poll<Self::Output> {
|
1674 + | let this = self.project();
|
1675 + | this.inner.as_mut().poll(cx)
|
1676 + | }
|
1677 + | }
|
1678 + |
|
1679 + | impl<B>
|
1680 + | ::aws_smithy_http_server::request::FromRequest<
|
1681 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
1682 + | B,
|
1683 + | > for crate::input::MalformedRangeOverrideInput
|
1684 + | where
|
1685 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
1686 + | B: 'static,
|
1687 + |
|
1688 + | B::Data: Send,
|
1689 + | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
1690 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
1691 + | {
|
1692 + | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
1693 + | type Future = MalformedRangeOverrideInputFuture;
|
1694 + |
|
1695 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
1696 + | let fut = async move {
|
1697 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
1698 + | request.headers(),
|
1699 + | &CONTENT_TYPE_MALFORMEDRANGEOVERRIDE,
|
1700 + | ) {
|
1701 + | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
1702 + | }
|
1703 + | crate::protocol_serde::shape_malformed_range_override::de_malformed_range_override_http_request(request)
|
1704 + | .await
|
1705 + | .map_err(Into::into)
|
1706 + | };
|
1707 + | use ::futures_util::future::TryFutureExt;
|
1708 + | let fut = fut.map_err(
|
1709 + | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
1710 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
1711 + | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
1712 + | e,
|
1713 + | )
|
1714 + | },
|
1715 + | );
|
1716 + | MalformedRangeOverrideInputFuture {
|
1717 + | inner: Box::pin(fut),
|
1718 + | }
|
1719 + | }
|
1720 + | }
|
1721 + | impl
|
1722 + | ::aws_smithy_http_server::response::IntoResponse<
|
1723 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
1724 + | > for crate::output::MalformedRangeOverrideOutput
|
1725 + | {
|
1726 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
1727 + | match crate::protocol_serde::shape_malformed_range_override::ser_malformed_range_override_http_response(self) {
|
1728 + | Ok(response) => response,
|
1729 + | Err(e) => {
|
1730 + | ::tracing::error!(error = %e, "failed to serialize response");
|
1731 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
1732 + | }
|
1733 + | }
|
1734 + | }
|
1735 + | }
|
1736 + | impl
|
1737 + | ::aws_smithy_http_server::response::IntoResponse<
|
1738 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
1739 + | > for crate::error::MalformedRangeOverrideError
|
1740 + | {
|
1741 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
1742 + | match crate::protocol_serde::shape_malformed_range_override::ser_malformed_range_override_http_error(&self) {
|
1743 + | Ok(mut response) => {
|
1744 + | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
1745 + | response
|
1746 + | },
|
1747 + | Err(e) => {
|
1748 + | ::tracing::error!(error = %e, "failed to serialize response");
|
1749 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
1750 + | }
|
1751 + | }
|
1752 + | }
|
1753 + | }
|
1754 + |
|
1755 + | #[allow(unreachable_code, unused_variables)]
|
1756 + | #[cfg(test)]
|
1757 + | mod malformed_range_override_test {
|
1758 + |
|
1759 + | /// When a byte member does not fit within range bounds,
|
1760 + | /// the response should be a 400 ValidationException.
|
1761 + | /// Test ID: RestJsonMalformedRangeByteOverride_case0
|
1762 + | #[::tokio::test]
|
1763 + | #[::tracing_test::traced_test]
|
1764 + | async fn rest_json_malformed_range_byte_override_case0_malformed_request() {
|
1765 + | {
|
1766 + | #[allow(unused_mut)]
|
1767 + | let mut http_request = http::Request::builder()
|
1768 + | .uri("/MalformedRangeOverride")
|
1769 + | .method("POST")
|
1770 + | .header("content-type", "application/json")
|
1771 + | .body(::aws_smithy_http_server::body::Body::from(
|
1772 + | ::bytes::Bytes::from_static("{ \"byte\" : 3 }".as_bytes()),
|
1438 1773 | ))
|
1439 1774 | .unwrap();
|
1440 1775 | #[allow(unused_mut)]
|
1441 1776 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1442 1777 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1443 1778 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1444 - | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
1779 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
1445 1780 | let sender = sender.clone();
|
1446 1781 | async move {
|
1447 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
1782 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
1448 1783 | sender.send(()).await.expect("receiver dropped early");
|
1449 1784 | result
|
1450 1785 | }
|
1451 1786 | })
|
1452 1787 | .build_unchecked();
|
1453 1788 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1454 1789 | .await
|
1455 1790 | .expect("unable to make an HTTP request");
|
1456 1791 | ::pretty_assertions::assert_eq!(
|
1457 1792 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1458 1793 | http_response.status()
|
1459 1794 | );
|
1460 1795 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1461 1796 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1462 1797 | http_response.headers(),
|
1463 1798 | expected_headers,
|
1464 1799 | ));
|
1465 1800 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1466 1801 | .await
|
1467 1802 | .expect("unable to extract body to bytes");
|
1468 1803 | ::aws_smithy_protocol_test::assert_ok(
|
1469 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 3 at '/blob' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 3 at '/blob' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\", \"path\": \"/blob\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1804 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/byte' failed to satisfy constraint: Member must be between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/byte' failed to satisfy constraint: Member must be between 4 and 6, inclusive\", \"path\": \"/byte\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1470 1805 | );
|
1471 1806 | }
|
1472 1807 | }
|
1473 - | /// When a blob member does not fit within length bounds,
|
1808 + | /// When a byte member does not fit within range bounds,
|
1474 1809 | /// the response should be a 400 ValidationException.
|
1475 - | /// Test ID: RestJsonMalformedLengthBlobOverride_case1
|
1810 + | /// Test ID: RestJsonMalformedRangeByteOverride_case1
|
1476 1811 | #[::tokio::test]
|
1477 - | async fn rest_json_malformed_length_blob_override_case1_malformed_request() {
|
1812 + | #[::tracing_test::traced_test]
|
1813 + | async fn rest_json_malformed_range_byte_override_case1_malformed_request() {
|
1478 1814 | {
|
1479 1815 | #[allow(unused_mut)]
|
1480 1816 | let mut http_request = http::Request::builder()
|
1481 - | .uri("/MalformedLengthOverride")
|
1817 + | .uri("/MalformedRangeOverride")
|
1482 1818 | .method("POST")
|
1483 1819 | .header("content-type", "application/json")
|
1484 1820 | .body(::aws_smithy_http_server::body::Body::from(
|
1485 - | ::bytes::Bytes::from_static("{ \"blob\" : \"YWJjZGVmZw==\" }".as_bytes()),
|
1821 + | ::bytes::Bytes::from_static("{ \"byte\" : 7 }".as_bytes()),
|
1486 1822 | ))
|
1487 1823 | .unwrap();
|
1488 1824 | #[allow(unused_mut)]
|
1489 1825 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1490 1826 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1491 1827 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1492 - | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
1828 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
1493 1829 | let sender = sender.clone();
|
1494 1830 | async move {
|
1495 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
1831 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
1496 1832 | sender.send(()).await.expect("receiver dropped early");
|
1497 1833 | result
|
1498 1834 | }
|
1499 1835 | })
|
1500 1836 | .build_unchecked();
|
1501 1837 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1502 1838 | .await
|
1503 1839 | .expect("unable to make an HTTP request");
|
1504 1840 | ::pretty_assertions::assert_eq!(
|
1505 1841 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1506 1842 | http_response.status()
|
1507 1843 | );
|
1508 1844 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1509 1845 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1510 1846 | http_response.headers(),
|
1511 1847 | expected_headers,
|
1512 1848 | ));
|
1513 1849 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1514 1850 | .await
|
1515 1851 | .expect("unable to extract body to bytes");
|
1516 1852 | ::aws_smithy_protocol_test::assert_ok(
|
1517 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 7 at '/blob' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 7 at '/blob' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\", \"path\": \"/blob\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1853 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/byte' failed to satisfy constraint: Member must be between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/byte' failed to satisfy constraint: Member must be between 4 and 6, inclusive\", \"path\": \"/byte\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1518 1854 | );
|
1519 1855 | }
|
1520 1856 | }
|
1521 - | /// When a string member does not fit within length bounds,
|
1857 + | /// When a byte member does not fit within range bounds,
|
1522 1858 | /// the response should be a 400 ValidationException.
|
1523 - | /// Test ID: RestJsonMalformedLengthStringOverride_case0
|
1859 + | /// Test ID: RestJsonMalformedRangeMinByteOverride
|
1524 1860 | #[::tokio::test]
|
1525 - | async fn rest_json_malformed_length_string_override_case0_malformed_request() {
|
1861 + | #[::tracing_test::traced_test]
|
1862 + | async fn rest_json_malformed_range_min_byte_override_malformed_request() {
|
1526 1863 | {
|
1527 1864 | #[allow(unused_mut)]
|
1528 1865 | let mut http_request = http::Request::builder()
|
1529 - | .uri("/MalformedLengthOverride")
|
1866 + | .uri("/MalformedRangeOverride")
|
1530 1867 | .method("POST")
|
1531 1868 | .header("content-type", "application/json")
|
1532 1869 | .body(::aws_smithy_http_server::body::Body::from(
|
1533 - | ::bytes::Bytes::from_static("{ \"string\" : \"abc\" }".as_bytes()),
|
1870 + | ::bytes::Bytes::from_static("{ \"minByte\" : 3 }".as_bytes()),
|
1534 1871 | ))
|
1535 1872 | .unwrap();
|
1536 1873 | #[allow(unused_mut)]
|
1537 1874 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1538 1875 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1539 1876 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1540 - | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
1877 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
1541 1878 | let sender = sender.clone();
|
1542 1879 | async move {
|
1543 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
1880 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
1544 1881 | sender.send(()).await.expect("receiver dropped early");
|
1545 1882 | result
|
1546 1883 | }
|
1547 1884 | })
|
1548 1885 | .build_unchecked();
|
1549 1886 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1550 1887 | .await
|
1551 1888 | .expect("unable to make an HTTP request");
|
1552 1889 | ::pretty_assertions::assert_eq!(
|
1553 1890 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1554 1891 | http_response.status()
|
1555 1892 | );
|
1556 1893 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1557 1894 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1558 1895 | http_response.headers(),
|
1559 1896 | expected_headers,
|
1560 1897 | ));
|
1561 1898 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1562 1899 | .await
|
1563 1900 | .expect("unable to extract body to bytes");
|
1564 1901 | ::aws_smithy_protocol_test::assert_ok(
|
1565 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 3 at '/string' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 3 at '/string' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1902 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minByte' failed to satisfy constraint: Member must be greater than or equal to 4\",\n \"fieldList\" : [{\"message\": \"Value at '/minByte' failed to satisfy constraint: Member must be greater than or equal to 4\", \"path\": \"/minByte\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1566 1903 | );
|
1567 1904 | }
|
1568 1905 | }
|
1569 - | /// When a string member does not fit within length bounds,
|
1906 + | /// When a byte member does not fit within range bounds,
|
1570 1907 | /// the response should be a 400 ValidationException.
|
1571 - | /// Test ID: RestJsonMalformedLengthStringOverride_case1
|
1908 + | /// Test ID: RestJsonMalformedRangeMaxByteOverride
|
1572 1909 | #[::tokio::test]
|
1573 - | async fn rest_json_malformed_length_string_override_case1_malformed_request() {
|
1910 + | #[::tracing_test::traced_test]
|
1911 + | async fn rest_json_malformed_range_max_byte_override_malformed_request() {
|
1574 1912 | {
|
1575 1913 | #[allow(unused_mut)]
|
1576 1914 | let mut http_request = http::Request::builder()
|
1577 - | .uri("/MalformedLengthOverride")
|
1915 + | .uri("/MalformedRangeOverride")
|
1578 1916 | .method("POST")
|
1579 1917 | .header("content-type", "application/json")
|
1580 1918 | .body(::aws_smithy_http_server::body::Body::from(
|
1581 - | ::bytes::Bytes::from_static("{ \"string\" : \"abcdefg\" }".as_bytes()),
|
1919 + | ::bytes::Bytes::from_static("{ \"maxByte\" : 7 }".as_bytes()),
|
1582 1920 | ))
|
1583 1921 | .unwrap();
|
1584 1922 | #[allow(unused_mut)]
|
1585 1923 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1586 1924 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1587 1925 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1588 - | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
1926 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
1589 1927 | let sender = sender.clone();
|
1590 1928 | async move {
|
1591 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
1929 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
1592 1930 | sender.send(()).await.expect("receiver dropped early");
|
1593 1931 | result
|
1594 1932 | }
|
1595 1933 | })
|
1596 1934 | .build_unchecked();
|
1597 1935 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1598 1936 | .await
|
1599 1937 | .expect("unable to make an HTTP request");
|
1600 1938 | ::pretty_assertions::assert_eq!(
|
1601 1939 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1602 1940 | http_response.status()
|
1603 1941 | );
|
1604 1942 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1605 1943 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1606 1944 | http_response.headers(),
|
1607 1945 | expected_headers,
|
1608 1946 | ));
|
1609 1947 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1610 1948 | .await
|
1611 1949 | .expect("unable to extract body to bytes");
|
1612 1950 | ::aws_smithy_protocol_test::assert_ok(
|
1613 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 7 at '/string' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 7 at '/string' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1951 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxByte' failed to satisfy constraint: Member must be less than or equal to 6\",\n \"fieldList\" : [{\"message\": \"Value at '/maxByte' failed to satisfy constraint: Member must be less than or equal to 6\", \"path\": \"/maxByte\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1614 1952 | );
|
1615 1953 | }
|
1616 1954 | }
|
1617 - | /// When a string member does not fit within length bounds,
|
1955 + | /// When a float member does not fit within range bounds,
|
1618 1956 | /// the response should be a 400 ValidationException.
|
1619 - | /// Test ID: RestJsonMalformedLengthStringOverride_case2
|
1957 + | /// Test ID: RestJsonMalformedRangeFloatOverride_case0
|
1620 1958 | #[::tokio::test]
|
1621 - | async fn rest_json_malformed_length_string_override_case2_malformed_request() {
|
1959 + | #[::tracing_test::traced_test]
|
1960 + | #[should_panic]
|
1961 + | async fn rest_json_malformed_range_float_override_case0_malformed_request() {
|
1622 1962 | {
|
1623 1963 | #[allow(unused_mut)]
|
1624 1964 | let mut http_request = http::Request::builder()
|
1625 - | .uri("/MalformedLengthOverride")
|
1965 + | .uri("/MalformedRangeOverride")
|
1626 1966 | .method("POST")
|
1627 1967 | .header("content-type", "application/json")
|
1628 1968 | .body(::aws_smithy_http_server::body::Body::from(
|
1629 - | ::bytes::Bytes::from_static("{ \"string\" : \"👍👍👍\" }".as_bytes()),
|
1969 + | ::bytes::Bytes::from_static("{ \"float\" : 4.3 }".as_bytes()),
|
1630 1970 | ))
|
1631 1971 | .unwrap();
|
1632 1972 | #[allow(unused_mut)]
|
1633 1973 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1634 1974 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1635 1975 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1636 - | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
1976 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
1637 1977 | let sender = sender.clone();
|
1638 1978 | async move {
|
1639 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
1979 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
1640 1980 | sender.send(()).await.expect("receiver dropped early");
|
1641 1981 | result
|
1642 1982 | }
|
1643 1983 | })
|
1644 1984 | .build_unchecked();
|
1645 1985 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1646 1986 | .await
|
1647 1987 | .expect("unable to make an HTTP request");
|
1648 1988 | ::pretty_assertions::assert_eq!(
|
1649 1989 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1650 1990 | http_response.status()
|
1651 1991 | );
|
1652 1992 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1653 1993 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1654 1994 | http_response.headers(),
|
1655 1995 | expected_headers,
|
1656 1996 | ));
|
1657 1997 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1658 1998 | .await
|
1659 1999 | .expect("unable to extract body to bytes");
|
1660 2000 | ::aws_smithy_protocol_test::assert_ok(
|
1661 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 3 at '/string' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 3 at '/string' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2001 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/float' failed to satisfy constraint: Member must be between 4.4 and 6.6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/float' failed to satisfy constraint: Member must be between 4.4 and 6.6, inclusive\", \"path\": \"/float\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1662 2002 | );
|
1663 2003 | }
|
1664 2004 | }
|
1665 - | /// When a string member does not fit within length bounds,
|
2005 + | /// When a float member does not fit within range bounds,
|
1666 2006 | /// the response should be a 400 ValidationException.
|
1667 - | /// Test ID: RestJsonMalformedLengthMinStringOverride
|
2007 + | /// Test ID: RestJsonMalformedRangeFloatOverride_case1
|
1668 2008 | #[::tokio::test]
|
1669 - | async fn rest_json_malformed_length_min_string_override_malformed_request() {
|
2009 + | #[::tracing_test::traced_test]
|
2010 + | #[should_panic]
|
2011 + | async fn rest_json_malformed_range_float_override_case1_malformed_request() {
|
1670 2012 | {
|
1671 2013 | #[allow(unused_mut)]
|
1672 2014 | let mut http_request = http::Request::builder()
|
1673 - | .uri("/MalformedLengthOverride")
|
2015 + | .uri("/MalformedRangeOverride")
|
1674 2016 | .method("POST")
|
1675 2017 | .header("content-type", "application/json")
|
1676 2018 | .body(::aws_smithy_http_server::body::Body::from(
|
1677 - | ::bytes::Bytes::from_static("{ \"minString\" : \"abc\" }".as_bytes()),
|
2019 + | ::bytes::Bytes::from_static("{ \"float\" : 6.7 }".as_bytes()),
|
1678 2020 | ))
|
1679 2021 | .unwrap();
|
1680 2022 | #[allow(unused_mut)]
|
1681 2023 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1682 2024 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1683 2025 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1684 - | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
2026 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
1685 2027 | let sender = sender.clone();
|
1686 2028 | async move {
|
1687 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
2029 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
1688 2030 | sender.send(()).await.expect("receiver dropped early");
|
1689 2031 | result
|
1690 2032 | }
|
1691 2033 | })
|
1692 2034 | .build_unchecked();
|
1693 2035 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1694 2036 | .await
|
1695 2037 | .expect("unable to make an HTTP request");
|
1696 2038 | ::pretty_assertions::assert_eq!(
|
1697 2039 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1698 2040 | http_response.status()
|
1699 2041 | );
|
1700 2042 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1701 2043 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1702 2044 | http_response.headers(),
|
1703 2045 | expected_headers,
|
1704 2046 | ));
|
1705 2047 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1706 2048 | .await
|
1707 2049 | .expect("unable to extract body to bytes");
|
1708 2050 | ::aws_smithy_protocol_test::assert_ok(
|
1709 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 3 at '/minString' failed to satisfy constraint: Member must have length greater than or equal to 4\",\n \"fieldList\" : [{\"message\": \"Value with length 3 at '/minString' failed to satisfy constraint: Member must have length greater than or equal to 4\", \"path\": \"/minString\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2051 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/float' failed to satisfy constraint: Member must be between 4.4 and 6.6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/float' failed to satisfy constraint: Member must be between 4.4 and 6.6, inclusive\", \"path\": \"/float\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1710 2052 | );
|
1711 2053 | }
|
1712 2054 | }
|
1713 - | /// When a string member does not fit within length bounds,
|
2055 + | /// When a float member does not fit within range bounds,
|
1714 2056 | /// the response should be a 400 ValidationException.
|
1715 - | /// Test ID: RestJsonMalformedLengthMaxStringOverride
|
2057 + | /// Test ID: RestJsonMalformedRangeMinFloatOverride
|
1716 2058 | #[::tokio::test]
|
1717 - | async fn rest_json_malformed_length_max_string_override_malformed_request() {
|
2059 + | #[::tracing_test::traced_test]
|
2060 + | #[should_panic]
|
2061 + | async fn rest_json_malformed_range_min_float_override_malformed_request() {
|
1718 2062 | {
|
1719 2063 | #[allow(unused_mut)]
|
1720 2064 | let mut http_request = http::Request::builder()
|
1721 - | .uri("/MalformedLengthOverride")
|
2065 + | .uri("/MalformedRangeOverride")
|
1722 2066 | .method("POST")
|
1723 2067 | .header("content-type", "application/json")
|
1724 2068 | .body(::aws_smithy_http_server::body::Body::from(
|
1725 - | ::bytes::Bytes::from_static("{ \"maxString\" : \"abcdefg\" }".as_bytes()),
|
2069 + | ::bytes::Bytes::from_static("{ \"minFloat\" : 4.3 }".as_bytes()),
|
1726 2070 | ))
|
1727 2071 | .unwrap();
|
1728 2072 | #[allow(unused_mut)]
|
1729 2073 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1730 2074 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1731 2075 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1732 - | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
2076 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
1733 2077 | let sender = sender.clone();
|
1734 2078 | async move {
|
1735 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
2079 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
1736 2080 | sender.send(()).await.expect("receiver dropped early");
|
1737 2081 | result
|
1738 2082 | }
|
1739 2083 | })
|
1740 2084 | .build_unchecked();
|
1741 2085 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1742 2086 | .await
|
1743 2087 | .expect("unable to make an HTTP request");
|
1744 2088 | ::pretty_assertions::assert_eq!(
|
1745 2089 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1746 2090 | http_response.status()
|
1747 2091 | );
|
1748 2092 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1749 2093 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1750 2094 | http_response.headers(),
|
1751 2095 | expected_headers,
|
1752 2096 | ));
|
1753 2097 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1754 2098 | .await
|
1755 2099 | .expect("unable to extract body to bytes");
|
1756 2100 | ::aws_smithy_protocol_test::assert_ok(
|
1757 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 7 at '/maxString' failed to satisfy constraint: Member must have length less than or equal to 6\",\n \"fieldList\" : [{\"message\": \"Value with length 7 at '/maxString' failed to satisfy constraint: Member must have length less than or equal to 6\", \"path\": \"/maxString\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2101 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minFloat' failed to satisfy constraint: Member must be greater than or equal to 4.4\",\n \"fieldList\" : [{\"message\": \"Value at '/minFloat' failed to satisfy constraint: Member must be greater than or equal to 4.4\", \"path\": \"/minFloat\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1758 2102 | );
|
1759 2103 | }
|
1760 2104 | }
|
1761 - | /// When a list member does not fit within length bounds,
|
2105 + | /// When a float member does not fit within range bounds,
|
1762 2106 | /// the response should be a 400 ValidationException.
|
1763 - | /// Test ID: RestJsonMalformedLengthListOverride_case0
|
2107 + | /// Test ID: RestJsonMalformedRangeMaxFloatOverride
|
1764 2108 | #[::tokio::test]
|
1765 - | async fn rest_json_malformed_length_list_override_case0_malformed_request() {
|
2109 + | #[::tracing_test::traced_test]
|
2110 + | #[should_panic]
|
2111 + | async fn rest_json_malformed_range_max_float_override_malformed_request() {
|
1766 2112 | {
|
1767 2113 | #[allow(unused_mut)]
|
1768 2114 | let mut http_request = http::Request::builder()
|
1769 - | .uri("/MalformedLengthOverride")
|
2115 + | .uri("/MalformedRangeOverride")
|
1770 2116 | .method("POST")
|
1771 2117 | .header("content-type", "application/json")
|
1772 2118 | .body(::aws_smithy_http_server::body::Body::from(
|
1773 - | ::bytes::Bytes::from_static(
|
1774 - | "{ \"list\" : [\"abc\", \"def\", \"ghi\"] }".as_bytes(),
|
1775 - | ),
|
2119 + | ::bytes::Bytes::from_static("{ \"maxFloat\" : 6.7 }".as_bytes()),
|
1776 2120 | ))
|
1777 2121 | .unwrap();
|
1778 2122 | #[allow(unused_mut)]
|
1779 2123 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1780 2124 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1781 2125 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1782 - | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
2126 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
1783 2127 | let sender = sender.clone();
|
1784 2128 | async move {
|
1785 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
2129 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
1786 2130 | sender.send(()).await.expect("receiver dropped early");
|
1787 2131 | result
|
1788 2132 | }
|
1789 2133 | })
|
1790 2134 | .build_unchecked();
|
1791 2135 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1792 2136 | .await
|
1793 2137 | .expect("unable to make an HTTP request");
|
1794 2138 | ::pretty_assertions::assert_eq!(
|
1795 2139 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1796 2140 | http_response.status()
|
1797 2141 | );
|
1798 2142 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1799 2143 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1800 2144 | http_response.headers(),
|
1801 2145 | expected_headers,
|
1802 2146 | ));
|
1803 2147 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1804 2148 | .await
|
1805 2149 | .expect("unable to extract body to bytes");
|
1806 2150 | ::aws_smithy_protocol_test::assert_ok(
|
1807 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 3 at '/list' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 3 at '/list' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\", \"path\": \"/list\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2151 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxFloat' failed to satisfy constraint: Member must be less than or equal to 6.6\",\n \"fieldList\" : [{\"message\": \"Value at '/maxFloat' failed to satisfy constraint: Member must be less than or equal to 6.6\", \"path\": \"/maxFloat\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1808 2152 | );
|
1809 2153 | }
|
1810 2154 | }
|
1811 - | /// When a list member does not fit within length bounds,
|
2155 + | /// When a short member does not fit within range bounds,
|
1812 2156 | /// the response should be a 400 ValidationException.
|
1813 - | /// Test ID: RestJsonMalformedLengthListOverride_case1
|
2157 + | /// Test ID: RestJsonMalformedRangeShortOverride_case0
|
1814 2158 | #[::tokio::test]
|
1815 - | async fn rest_json_malformed_length_list_override_case1_malformed_request() {
|
2159 + | #[::tracing_test::traced_test]
|
2160 + | async fn rest_json_malformed_range_short_override_case0_malformed_request() {
|
1816 2161 | {
|
1817 2162 | #[allow(unused_mut)]
|
1818 - | let mut http_request = http::Request::builder()
|
1819 - | .uri("/MalformedLengthOverride")
|
1820 - | .method("POST")
|
1821 - | .header("content-type", "application/json")
|
1822 - | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"list\" : [\"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\"] }".as_bytes()))).unwrap();
|
1823 - | #[allow(unused_mut)]
|
1824 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1825 - | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1826 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1827 - | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
1828 - | let sender = sender.clone();
|
1829 - | async move {
|
1830 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
1831 - | sender.send(()).await.expect("receiver dropped early");
|
1832 - | result
|
1833 - | }
|
1834 - | })
|
1835 - | .build_unchecked();
|
1836 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1837 - | .await
|
1838 - | .expect("unable to make an HTTP request");
|
1839 - | ::pretty_assertions::assert_eq!(
|
1840 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1841 - | http_response.status()
|
1842 - | );
|
1843 - | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1844 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1845 - | http_response.headers(),
|
1846 - | expected_headers,
|
1847 - | ));
|
1848 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1849 - | .await
|
1850 - | .expect("unable to extract body to bytes");
|
1851 - | ::aws_smithy_protocol_test::assert_ok(
|
1852 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 7 at '/list' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 7 at '/list' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\", \"path\": \"/list\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1853 - | );
|
1854 - | }
|
1855 - | }
|
1856 - | /// When a map member does not fit within length bounds,
|
1857 - | /// the response should be a 400 ValidationException.
|
1858 - | /// Test ID: RestJsonMalformedLengthMapOverride_case0
|
1859 - | #[::tokio::test]
|
1860 - | async fn rest_json_malformed_length_map_override_case0_malformed_request() {
|
1861 - | {
|
1862 - | #[allow(unused_mut)]
|
1863 - | let mut http_request = http::Request::builder()
|
1864 - | .uri("/MalformedLengthOverride")
|
1865 - | .method("POST")
|
1866 - | .header("content-type", "application/json")
|
1867 - | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"map\" : {\"abc\": [\"def\", \"efg\", \"fgh\"], \"bcd\": [\"abc\", \"def\", \"efg\"], \"def\": [\"abc\", \"def\", \"efg\"]} }".as_bytes()))).unwrap();
|
2163 + | let mut http_request = http::Request::builder()
|
2164 + | .uri("/MalformedRangeOverride")
|
2165 + | .method("POST")
|
2166 + | .header("content-type", "application/json")
|
2167 + | .body(::aws_smithy_http_server::body::Body::from(
|
2168 + | ::bytes::Bytes::from_static("{ \"short\" : 3 }".as_bytes()),
|
2169 + | ))
|
2170 + | .unwrap();
|
1868 2171 | #[allow(unused_mut)]
|
1869 2172 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1870 2173 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1871 2174 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1872 - | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
2175 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
1873 2176 | let sender = sender.clone();
|
1874 2177 | async move {
|
1875 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
2178 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
1876 2179 | sender.send(()).await.expect("receiver dropped early");
|
1877 2180 | result
|
1878 2181 | }
|
1879 2182 | })
|
1880 2183 | .build_unchecked();
|
1881 2184 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1882 2185 | .await
|
1883 2186 | .expect("unable to make an HTTP request");
|
1884 2187 | ::pretty_assertions::assert_eq!(
|
1885 2188 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1886 2189 | http_response.status()
|
1887 2190 | );
|
1888 2191 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1889 2192 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1890 2193 | http_response.headers(),
|
1891 2194 | expected_headers,
|
1892 2195 | ));
|
1893 2196 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1894 2197 | .await
|
1895 2198 | .expect("unable to extract body to bytes");
|
1896 2199 | ::aws_smithy_protocol_test::assert_ok(
|
1897 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 3 at '/map' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 3 at '/map' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2200 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/short' failed to satisfy constraint: Member must be between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/short' failed to satisfy constraint: Member must be between 4 and 6, inclusive\", \"path\": \"/short\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1898 2201 | );
|
1899 2202 | }
|
1900 2203 | }
|
1901 - | /// When a map member does not fit within length bounds,
|
2204 + | /// When a short member does not fit within range bounds,
|
1902 2205 | /// the response should be a 400 ValidationException.
|
1903 - | /// Test ID: RestJsonMalformedLengthMapOverride_case1
|
2206 + | /// Test ID: RestJsonMalformedRangeShortOverride_case1
|
1904 2207 | #[::tokio::test]
|
1905 - | async fn rest_json_malformed_length_map_override_case1_malformed_request() {
|
2208 + | #[::tracing_test::traced_test]
|
2209 + | async fn rest_json_malformed_range_short_override_case1_malformed_request() {
|
1906 2210 | {
|
1907 2211 | #[allow(unused_mut)]
|
1908 - | let mut http_request = http::Request::builder()
|
1909 - | .uri("/MalformedLengthOverride")
|
1910 - | .method("POST")
|
1911 - | .header("content-type", "application/json")
|
1912 - | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"map\" : {\"abc\": [\"abc\", \"def\", \"efg\"], \"bcd\": [\"abc\", \"def\", \"efg\"],\n \"cde\": [\"abc\", \"def\", \"efg\"], \"def\": [\"abc\", \"def\", \"efg\"],\n \"efg\": [\"abc\", \"def\", \"efg\"], \"fgh\": [\"abc\", \"def\", \"efg\"],\n \"ghi\": [\"abc\", \"def\", \"efg\"] } }".as_bytes()))).unwrap();
|
2212 + | let mut http_request = http::Request::builder()
|
2213 + | .uri("/MalformedRangeOverride")
|
2214 + | .method("POST")
|
2215 + | .header("content-type", "application/json")
|
2216 + | .body(::aws_smithy_http_server::body::Body::from(
|
2217 + | ::bytes::Bytes::from_static("{ \"short\" : 7 }".as_bytes()),
|
2218 + | ))
|
2219 + | .unwrap();
|
1913 2220 | #[allow(unused_mut)]
|
1914 2221 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1915 2222 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1916 2223 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1917 - | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
2224 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
1918 2225 | let sender = sender.clone();
|
1919 2226 | async move {
|
1920 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
2227 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
1921 2228 | sender.send(()).await.expect("receiver dropped early");
|
1922 2229 | result
|
1923 2230 | }
|
1924 2231 | })
|
1925 2232 | .build_unchecked();
|
1926 2233 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1927 2234 | .await
|
1928 2235 | .expect("unable to make an HTTP request");
|
1929 2236 | ::pretty_assertions::assert_eq!(
|
1930 2237 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1931 2238 | http_response.status()
|
1932 2239 | );
|
1933 2240 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1934 2241 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1935 2242 | http_response.headers(),
|
1936 2243 | expected_headers,
|
1937 2244 | ));
|
1938 2245 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1939 2246 | .await
|
1940 2247 | .expect("unable to extract body to bytes");
|
1941 2248 | ::aws_smithy_protocol_test::assert_ok(
|
1942 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 7 at '/map' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 7 at '/map' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2249 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/short' failed to satisfy constraint: Member must be between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/short' failed to satisfy constraint: Member must be between 4 and 6, inclusive\", \"path\": \"/short\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1943 2250 | );
|
1944 2251 | }
|
1945 2252 | }
|
1946 - | }
|
1947 - | #[cfg(test)]
|
1948 - | #[allow(unreachable_code, unused_variables)]
|
1949 - | mod server_malformed_length_query_string_test {
|
1950 - | /// When a required member has no value in the query string,
|
2253 + | /// When a short member does not fit within range bounds,
|
1951 2254 | /// the response should be a 400 ValidationException.
|
1952 - | /// Test ID: RestJsonMalformedLengthQueryStringNoValue
|
2255 + | /// Test ID: RestJsonMalformedRangeMinShortOverride
|
1953 2256 | #[::tokio::test]
|
1954 - | async fn rest_json_malformed_length_query_string_no_value_malformed_request() {
|
2257 + | #[::tracing_test::traced_test]
|
2258 + | async fn rest_json_malformed_range_min_short_override_malformed_request() {
|
1955 2259 | {
|
1956 2260 | #[allow(unused_mut)]
|
1957 2261 | let mut http_request = http::Request::builder()
|
1958 - | .uri("/MalformedLengthQueryString")
|
2262 + | .uri("/MalformedRangeOverride")
|
1959 2263 | .method("POST")
|
1960 2264 | .header("content-type", "application/json")
|
1961 2265 | .body(::aws_smithy_http_server::body::Body::from(
|
1962 - | ::bytes::Bytes::from_static("{}".as_bytes()),
|
2266 + | ::bytes::Bytes::from_static("{ \"minShort\" : 3 }".as_bytes()),
|
1963 2267 | ))
|
1964 2268 | .unwrap();
|
1965 - | *http_request.uri_mut() = "/MalformedLengthQueryString?string".parse().unwrap();
|
1966 2269 | #[allow(unused_mut)]
|
1967 2270 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1968 2271 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1969 2272 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1970 - | .malformed_length_query_string(move |input: crate::input::MalformedLengthQueryStringInput| {
|
2273 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
1971 2274 | let sender = sender.clone();
|
1972 2275 | async move {
|
1973 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthQueryStringOutput, crate::error::MalformedLengthQueryStringError> };
|
2276 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
1974 2277 | sender.send(()).await.expect("receiver dropped early");
|
1975 2278 | result
|
1976 2279 | }
|
1977 2280 | })
|
1978 2281 | .build_unchecked();
|
1979 2282 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1980 2283 | .await
|
1981 2284 | .expect("unable to make an HTTP request");
|
1982 2285 | ::pretty_assertions::assert_eq!(
|
1983 2286 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1984 2287 | http_response.status()
|
1985 2288 | );
|
1986 2289 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1987 2290 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1988 2291 | http_response.headers(),
|
1989 2292 | expected_headers,
|
1990 2293 | ));
|
1991 2294 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1992 2295 | .await
|
1993 2296 | .expect("unable to extract body to bytes");
|
1994 2297 | ::aws_smithy_protocol_test::assert_ok(
|
1995 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 0 at '/string' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 0 at '/string' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2298 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minShort' failed to satisfy constraint: Member must be greater than or equal to 4\",\n \"fieldList\" : [{\"message\": \"Value at '/minShort' failed to satisfy constraint: Member must be greater than or equal to 4\", \"path\": \"/minShort\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1996 2299 | );
|
1997 2300 | }
|
1998 2301 | }
|
1999 - | }
|
2000 - | #[cfg(test)]
|
2001 - | #[allow(unreachable_code, unused_variables)]
|
2002 - | mod server_malformed_pattern_test {
|
2003 - | /// When a string member does not match the specified pattern,
|
2302 + | /// When a short member does not fit within range bounds,
|
2004 2303 | /// the response should be a 400 ValidationException.
|
2005 - | /// Test ID: RestJsonMalformedPatternString_case0
|
2304 + | /// Test ID: RestJsonMalformedRangeMaxShortOverride
|
2006 2305 | #[::tokio::test]
|
2007 - | async fn rest_json_malformed_pattern_string_case0_malformed_request() {
|
2306 + | #[::tracing_test::traced_test]
|
2307 + | async fn rest_json_malformed_range_max_short_override_malformed_request() {
|
2008 2308 | {
|
2009 2309 | #[allow(unused_mut)]
|
2010 2310 | let mut http_request = http::Request::builder()
|
2011 - | .uri("/MalformedPattern")
|
2311 + | .uri("/MalformedRangeOverride")
|
2012 2312 | .method("POST")
|
2013 2313 | .header("content-type", "application/json")
|
2014 2314 | .body(::aws_smithy_http_server::body::Body::from(
|
2015 - | ::bytes::Bytes::from_static("{ \"string\" : \"ABC\" }".as_bytes()),
|
2315 + | ::bytes::Bytes::from_static("{ \"maxShort\" : 7 }".as_bytes()),
|
2016 2316 | ))
|
2017 2317 | .unwrap();
|
2018 2318 | #[allow(unused_mut)]
|
2019 2319 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2020 2320 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2021 2321 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2022 - | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
2322 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2023 2323 | let sender = sender.clone();
|
2024 2324 | async move {
|
2025 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
2325 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
2026 2326 | sender.send(()).await.expect("receiver dropped early");
|
2027 2327 | result
|
2028 2328 | }
|
2029 2329 | })
|
2030 2330 | .build_unchecked();
|
2031 2331 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2032 2332 | .await
|
2033 2333 | .expect("unable to make an HTTP request");
|
2034 2334 | ::pretty_assertions::assert_eq!(
|
2035 2335 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2036 2336 | http_response.status()
|
2037 2337 | );
|
2038 2338 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2039 2339 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2040 2340 | http_response.headers(),
|
2041 2341 | expected_headers,
|
2042 2342 | ));
|
2043 2343 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2044 2344 | .await
|
2045 2345 | .expect("unable to extract body to bytes");
|
2046 2346 | ::aws_smithy_protocol_test::assert_ok(
|
2047 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2347 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxShort' failed to satisfy constraint: Member must be less than or equal to 6\",\n \"fieldList\" : [{\"message\": \"Value at '/maxShort' failed to satisfy constraint: Member must be less than or equal to 6\", \"path\": \"/maxShort\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2048 2348 | );
|
2049 2349 | }
|
2050 2350 | }
|
2051 - | /// When a string member does not match the specified pattern,
|
2351 + | /// When a integer member does not fit within range bounds,
|
2052 2352 | /// the response should be a 400 ValidationException.
|
2053 - | /// Test ID: RestJsonMalformedPatternString_case1
|
2353 + | /// Test ID: RestJsonMalformedRangeIntegerOverride_case0
|
2054 2354 | #[::tokio::test]
|
2055 - | async fn rest_json_malformed_pattern_string_case1_malformed_request() {
|
2355 + | #[::tracing_test::traced_test]
|
2356 + | async fn rest_json_malformed_range_integer_override_case0_malformed_request() {
|
2056 2357 | {
|
2057 2358 | #[allow(unused_mut)]
|
2058 2359 | let mut http_request = http::Request::builder()
|
2059 - | .uri("/MalformedPattern")
|
2360 + | .uri("/MalformedRangeOverride")
|
2060 2361 | .method("POST")
|
2061 2362 | .header("content-type", "application/json")
|
2062 2363 | .body(::aws_smithy_http_server::body::Body::from(
|
2063 - | ::bytes::Bytes::from_static("{ \"string\" : \"xyz\" }".as_bytes()),
|
2364 + | ::bytes::Bytes::from_static("{ \"integer\" : 3 }".as_bytes()),
|
2064 2365 | ))
|
2065 2366 | .unwrap();
|
2066 2367 | #[allow(unused_mut)]
|
2067 2368 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2068 2369 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2069 2370 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2070 - | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
2371 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2071 2372 | let sender = sender.clone();
|
2072 2373 | async move {
|
2073 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
2374 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
2074 2375 | sender.send(()).await.expect("receiver dropped early");
|
2075 2376 | result
|
2076 2377 | }
|
2077 2378 | })
|
2078 2379 | .build_unchecked();
|
2079 2380 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2080 2381 | .await
|
2081 2382 | .expect("unable to make an HTTP request");
|
2082 2383 | ::pretty_assertions::assert_eq!(
|
2083 2384 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2084 2385 | http_response.status()
|
2085 2386 | );
|
2086 2387 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2087 2388 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2088 2389 | http_response.headers(),
|
2089 2390 | expected_headers,
|
2090 2391 | ));
|
2091 2392 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2092 2393 | .await
|
2093 2394 | .expect("unable to extract body to bytes");
|
2094 2395 | ::aws_smithy_protocol_test::assert_ok(
|
2095 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2396 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/integer' failed to satisfy constraint: Member must be between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/integer' failed to satisfy constraint: Member must be between 4 and 6, inclusive\", \"path\": \"/integer\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2096 2397 | );
|
2097 2398 | }
|
2098 2399 | }
|
2099 - | /// When the specified pattern is susceptible to ReDOS, the service will not
|
2100 - | /// hang indefinitely while evaluating the pattern
|
2101 - | /// Test ID: RestJsonMalformedPatternReDOSString
|
2400 + | /// When a integer member does not fit within range bounds,
|
2401 + | /// the response should be a 400 ValidationException.
|
2402 + | /// Test ID: RestJsonMalformedRangeIntegerOverride_case1
|
2102 2403 | #[::tokio::test]
|
2103 - | async fn rest_json_malformed_pattern_re_dos_string_malformed_request() {
|
2404 + | #[::tracing_test::traced_test]
|
2405 + | async fn rest_json_malformed_range_integer_override_case1_malformed_request() {
|
2104 2406 | {
|
2105 2407 | #[allow(unused_mut)]
|
2106 - | let mut http_request = http::Request::builder()
|
2107 - | .uri("/MalformedPattern")
|
2108 - | .method("POST")
|
2109 - | .header("content-type", "application/json")
|
2110 - | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"evilString\" : \"000000000000000000000000000000000000000000000000000000000000000000000000000000000000!\" }".as_bytes()))).unwrap();
|
2408 + | let mut http_request = http::Request::builder()
|
2409 + | .uri("/MalformedRangeOverride")
|
2410 + | .method("POST")
|
2411 + | .header("content-type", "application/json")
|
2412 + | .body(::aws_smithy_http_server::body::Body::from(
|
2413 + | ::bytes::Bytes::from_static("{ \"integer\" : 7 }".as_bytes()),
|
2414 + | ))
|
2415 + | .unwrap();
|
2111 2416 | #[allow(unused_mut)]
|
2112 2417 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2113 2418 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2114 2419 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2115 - | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
2420 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2116 2421 | let sender = sender.clone();
|
2117 2422 | async move {
|
2118 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
2423 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
2119 2424 | sender.send(()).await.expect("receiver dropped early");
|
2120 2425 | result
|
2121 2426 | }
|
2122 2427 | })
|
2123 2428 | .build_unchecked();
|
2124 2429 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2125 2430 | .await
|
2126 2431 | .expect("unable to make an HTTP request");
|
2127 2432 | ::pretty_assertions::assert_eq!(
|
2128 2433 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2129 2434 | http_response.status()
|
2130 2435 | );
|
2131 2436 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2132 2437 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2133 2438 | http_response.headers(),
|
2134 2439 | expected_headers,
|
2135 2440 | ));
|
2136 2441 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2137 2442 | .await
|
2138 2443 | .expect("unable to extract body to bytes");
|
2139 2444 | ::aws_smithy_protocol_test::assert_ok(
|
2140 - | ::aws_smithy_protocol_test::validate_body(&body, "{\n \"message\" : \"1 validation error detected. Value at '/evilString' failed to satisfy constraint: Member must satisfy regular expression pattern: ^([0-9]+)+$\",\n \"fieldList\" : [{\"message\": \"Value at '/evilString' failed to satisfy constraint: Member must satisfy regular expression pattern: ^([0-9]+)+$\", \"path\": \"/evilString\"}]\n}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2445 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/integer' failed to satisfy constraint: Member must be between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/integer' failed to satisfy constraint: Member must be between 4 and 6, inclusive\", \"path\": \"/integer\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2141 2446 | );
|
2142 2447 | }
|
2143 2448 | }
|
2144 - | /// When a list member value does not match the specified pattern,
|
2449 + | /// When a integer member does not fit within range bounds,
|
2145 2450 | /// the response should be a 400 ValidationException.
|
2146 - | /// Test ID: RestJsonMalformedPatternList_case0
|
2451 + | /// Test ID: RestJsonMalformedRangeMinIntegerOverride
|
2147 2452 | #[::tokio::test]
|
2148 - | async fn rest_json_malformed_pattern_list_case0_malformed_request() {
|
2453 + | #[::tracing_test::traced_test]
|
2454 + | async fn rest_json_malformed_range_min_integer_override_malformed_request() {
|
2149 2455 | {
|
2150 2456 | #[allow(unused_mut)]
|
2151 2457 | let mut http_request = http::Request::builder()
|
2152 - | .uri("/MalformedPattern")
|
2458 + | .uri("/MalformedRangeOverride")
|
2153 2459 | .method("POST")
|
2154 2460 | .header("content-type", "application/json")
|
2155 2461 | .body(::aws_smithy_http_server::body::Body::from(
|
2156 - | ::bytes::Bytes::from_static("{ \"list\" : [\"ABC\"] }".as_bytes()),
|
2462 + | ::bytes::Bytes::from_static("{ \"minInteger\" : 3 }".as_bytes()),
|
2157 2463 | ))
|
2158 2464 | .unwrap();
|
2159 2465 | #[allow(unused_mut)]
|
2160 2466 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2161 2467 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2162 2468 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2163 - | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
2469 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2164 2470 | let sender = sender.clone();
|
2165 2471 | async move {
|
2166 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
2472 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
2167 2473 | sender.send(()).await.expect("receiver dropped early");
|
2168 2474 | result
|
2169 2475 | }
|
2170 2476 | })
|
2171 2477 | .build_unchecked();
|
2172 2478 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2173 2479 | .await
|
2174 2480 | .expect("unable to make an HTTP request");
|
2175 2481 | ::pretty_assertions::assert_eq!(
|
2176 2482 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2177 2483 | http_response.status()
|
2178 2484 | );
|
2179 2485 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2180 2486 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2181 2487 | http_response.headers(),
|
2182 2488 | expected_headers,
|
2183 2489 | ));
|
2184 2490 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2185 2491 | .await
|
2186 2492 | .expect("unable to extract body to bytes");
|
2187 2493 | ::aws_smithy_protocol_test::assert_ok(
|
2188 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/list/0' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/list/0' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/list/0\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2494 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minInteger' failed to satisfy constraint: Member must be greater than or equal to 4\",\n \"fieldList\" : [{\"message\": \"Value at '/minInteger' failed to satisfy constraint: Member must be greater than or equal to 4\", \"path\": \"/minInteger\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2189 2495 | );
|
2190 2496 | }
|
2191 2497 | }
|
2192 - | /// When a list member value does not match the specified pattern,
|
2498 + | /// When a integer member does not fit within range bounds,
|
2193 2499 | /// the response should be a 400 ValidationException.
|
2194 - | /// Test ID: RestJsonMalformedPatternList_case1
|
2500 + | /// Test ID: RestJsonMalformedRangeMaxIntegerOverride
|
2195 2501 | #[::tokio::test]
|
2196 - | async fn rest_json_malformed_pattern_list_case1_malformed_request() {
|
2502 + | #[::tracing_test::traced_test]
|
2503 + | async fn rest_json_malformed_range_max_integer_override_malformed_request() {
|
2197 2504 | {
|
2198 2505 | #[allow(unused_mut)]
|
2199 2506 | let mut http_request = http::Request::builder()
|
2200 - | .uri("/MalformedPattern")
|
2507 + | .uri("/MalformedRangeOverride")
|
2201 2508 | .method("POST")
|
2202 2509 | .header("content-type", "application/json")
|
2203 2510 | .body(::aws_smithy_http_server::body::Body::from(
|
2204 - | ::bytes::Bytes::from_static("{ \"list\" : [\"xyz\"] }".as_bytes()),
|
2511 + | ::bytes::Bytes::from_static("{ \"maxInteger\" : 7 }".as_bytes()),
|
2205 2512 | ))
|
2206 2513 | .unwrap();
|
2207 2514 | #[allow(unused_mut)]
|
2208 2515 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2209 2516 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2210 2517 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2211 - | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
2518 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2212 2519 | let sender = sender.clone();
|
2213 2520 | async move {
|
2214 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
2521 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
2215 2522 | sender.send(()).await.expect("receiver dropped early");
|
2216 2523 | result
|
2217 2524 | }
|
2218 2525 | })
|
2219 2526 | .build_unchecked();
|
2220 2527 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2221 2528 | .await
|
2222 2529 | .expect("unable to make an HTTP request");
|
2223 2530 | ::pretty_assertions::assert_eq!(
|
2224 2531 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2225 2532 | http_response.status()
|
2226 2533 | );
|
2227 2534 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2228 2535 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2229 2536 | http_response.headers(),
|
2230 2537 | expected_headers,
|
2231 2538 | ));
|
2232 2539 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2233 2540 | .await
|
2234 2541 | .expect("unable to extract body to bytes");
|
2235 2542 | ::aws_smithy_protocol_test::assert_ok(
|
2236 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/list/0' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/list/0' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/list/0\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2543 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxInteger' failed to satisfy constraint: Member must be less than or equal to 6\",\n \"fieldList\" : [{\"message\": \"Value at '/maxInteger' failed to satisfy constraint: Member must be less than or equal to 6\", \"path\": \"/maxInteger\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2237 2544 | );
|
2238 2545 | }
|
2239 2546 | }
|
2240 - | /// When a map member's key does not match the specified pattern,
|
2547 + | /// When a long member does not fit within range bounds,
|
2241 2548 | /// the response should be a 400 ValidationException.
|
2242 - | /// Test ID: RestJsonMalformedPatternMapKey_case0
|
2549 + | /// Test ID: RestJsonMalformedRangeLongOverride_case0
|
2243 2550 | #[::tokio::test]
|
2244 - | async fn rest_json_malformed_pattern_map_key_case0_malformed_request() {
|
2551 + | #[::tracing_test::traced_test]
|
2552 + | async fn rest_json_malformed_range_long_override_case0_malformed_request() {
|
2245 2553 | {
|
2246 2554 | #[allow(unused_mut)]
|
2247 2555 | let mut http_request = http::Request::builder()
|
2248 - | .uri("/MalformedPattern")
|
2556 + | .uri("/MalformedRangeOverride")
|
2249 2557 | .method("POST")
|
2250 2558 | .header("content-type", "application/json")
|
2251 2559 | .body(::aws_smithy_http_server::body::Body::from(
|
2252 - | ::bytes::Bytes::from_static("{ \"map\" : { \"ABC\" : \"abc\" } }".as_bytes()),
|
2560 + | ::bytes::Bytes::from_static("{ \"long\" : 3 }".as_bytes()),
|
2253 2561 | ))
|
2254 2562 | .unwrap();
|
2255 2563 | #[allow(unused_mut)]
|
2256 2564 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2257 2565 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2258 2566 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2259 - | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
2567 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2260 2568 | let sender = sender.clone();
|
2261 2569 | async move {
|
2262 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
2570 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
2263 2571 | sender.send(()).await.expect("receiver dropped early");
|
2264 2572 | result
|
2265 2573 | }
|
2266 2574 | })
|
2267 2575 | .build_unchecked();
|
2268 2576 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2269 2577 | .await
|
2270 2578 | .expect("unable to make an HTTP request");
|
2271 2579 | ::pretty_assertions::assert_eq!(
|
2272 2580 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2273 2581 | http_response.status()
|
2274 2582 | );
|
2275 2583 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2276 2584 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2277 2585 | http_response.headers(),
|
2278 2586 | expected_headers,
|
2279 2587 | ));
|
2280 2588 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2281 2589 | .await
|
2282 2590 | .expect("unable to extract body to bytes");
|
2283 2591 | ::aws_smithy_protocol_test::assert_ok(
|
2284 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/map' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2592 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/long' failed to satisfy constraint: Member must be between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/long' failed to satisfy constraint: Member must be between 4 and 6, inclusive\", \"path\": \"/long\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2285 2593 | );
|
2286 2594 | }
|
2287 2595 | }
|
2288 - | /// When a map member's key does not match the specified pattern,
|
2596 + | /// When a long member does not fit within range bounds,
|
2289 2597 | /// the response should be a 400 ValidationException.
|
2290 - | /// Test ID: RestJsonMalformedPatternMapKey_case1
|
2598 + | /// Test ID: RestJsonMalformedRangeLongOverride_case1
|
2291 2599 | #[::tokio::test]
|
2292 - | async fn rest_json_malformed_pattern_map_key_case1_malformed_request() {
|
2600 + | #[::tracing_test::traced_test]
|
2601 + | async fn rest_json_malformed_range_long_override_case1_malformed_request() {
|
2293 2602 | {
|
2294 2603 | #[allow(unused_mut)]
|
2295 2604 | let mut http_request = http::Request::builder()
|
2296 - | .uri("/MalformedPattern")
|
2605 + | .uri("/MalformedRangeOverride")
|
2297 2606 | .method("POST")
|
2298 2607 | .header("content-type", "application/json")
|
2299 2608 | .body(::aws_smithy_http_server::body::Body::from(
|
2300 - | ::bytes::Bytes::from_static("{ \"map\" : { \"xyz\" : \"abc\" } }".as_bytes()),
|
2609 + | ::bytes::Bytes::from_static("{ \"long\" : 7 }".as_bytes()),
|
2301 2610 | ))
|
2302 2611 | .unwrap();
|
2303 2612 | #[allow(unused_mut)]
|
2304 2613 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2305 2614 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2306 2615 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2307 - | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
2616 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2308 2617 | let sender = sender.clone();
|
2309 2618 | async move {
|
2310 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
2619 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
2311 2620 | sender.send(()).await.expect("receiver dropped early");
|
2312 2621 | result
|
2313 2622 | }
|
2314 2623 | })
|
2315 2624 | .build_unchecked();
|
2316 2625 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2317 2626 | .await
|
2318 2627 | .expect("unable to make an HTTP request");
|
2319 2628 | ::pretty_assertions::assert_eq!(
|
2320 2629 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2321 2630 | http_response.status()
|
2322 2631 | );
|
2323 2632 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2324 2633 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2325 2634 | http_response.headers(),
|
2326 2635 | expected_headers,
|
2327 2636 | ));
|
2328 2637 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2329 2638 | .await
|
2330 2639 | .expect("unable to extract body to bytes");
|
2331 2640 | ::aws_smithy_protocol_test::assert_ok(
|
2332 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/map' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2641 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/long' failed to satisfy constraint: Member must be between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/long' failed to satisfy constraint: Member must be between 4 and 6, inclusive\", \"path\": \"/long\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2333 2642 | );
|
2334 2643 | }
|
2335 2644 | }
|
2336 - | /// When a map member's value does not match the specified pattern,
|
2645 + | /// When a long member does not fit within range bounds,
|
2337 2646 | /// the response should be a 400 ValidationException.
|
2338 - | /// Test ID: RestJsonMalformedPatternMapValue_case0
|
2647 + | /// Test ID: RestJsonMalformedRangeMinLongOverride
|
2339 2648 | #[::tokio::test]
|
2340 - | async fn rest_json_malformed_pattern_map_value_case0_malformed_request() {
|
2649 + | #[::tracing_test::traced_test]
|
2650 + | async fn rest_json_malformed_range_min_long_override_malformed_request() {
|
2341 2651 | {
|
2342 2652 | #[allow(unused_mut)]
|
2343 2653 | let mut http_request = http::Request::builder()
|
2344 - | .uri("/MalformedPattern")
|
2654 + | .uri("/MalformedRangeOverride")
|
2345 2655 | .method("POST")
|
2346 2656 | .header("content-type", "application/json")
|
2347 2657 | .body(::aws_smithy_http_server::body::Body::from(
|
2348 - | ::bytes::Bytes::from_static("{ \"map\" : { \"abc\": \"ABC\" } }".as_bytes()),
|
2658 + | ::bytes::Bytes::from_static("{ \"minLong\" : 3 }".as_bytes()),
|
2349 2659 | ))
|
2350 2660 | .unwrap();
|
2351 2661 | #[allow(unused_mut)]
|
2352 2662 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2353 2663 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2354 2664 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2355 - | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
2665 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2356 2666 | let sender = sender.clone();
|
2357 2667 | async move {
|
2358 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
2668 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
2359 2669 | sender.send(()).await.expect("receiver dropped early");
|
2360 2670 | result
|
2361 2671 | }
|
2362 2672 | })
|
2363 2673 | .build_unchecked();
|
2364 2674 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2365 2675 | .await
|
2366 2676 | .expect("unable to make an HTTP request");
|
2367 2677 | ::pretty_assertions::assert_eq!(
|
2368 2678 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2369 2679 | http_response.status()
|
2370 2680 | );
|
2371 2681 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2372 2682 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2373 2683 | http_response.headers(),
|
2374 2684 | expected_headers,
|
2375 2685 | ));
|
2376 2686 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2377 2687 | .await
|
2378 2688 | .expect("unable to extract body to bytes");
|
2379 2689 | ::aws_smithy_protocol_test::assert_ok(
|
2380 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map/abc' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/map/abc' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/map/abc\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2690 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minLong' failed to satisfy constraint: Member must be greater than or equal to 4\",\n \"fieldList\" : [{\"message\": \"Value at '/minLong' failed to satisfy constraint: Member must be greater than or equal to 4\", \"path\": \"/minLong\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2381 2691 | );
|
2382 2692 | }
|
2383 2693 | }
|
2384 - | /// When a map member's value does not match the specified pattern,
|
2694 + | /// When a long member does not fit within range bounds,
|
2385 2695 | /// the response should be a 400 ValidationException.
|
2386 - | /// Test ID: RestJsonMalformedPatternMapValue_case1
|
2696 + | /// Test ID: RestJsonMalformedRangeMaxLongOverride
|
2387 2697 | #[::tokio::test]
|
2388 - | async fn rest_json_malformed_pattern_map_value_case1_malformed_request() {
|
2698 + | #[::tracing_test::traced_test]
|
2699 + | async fn rest_json_malformed_range_max_long_override_malformed_request() {
|
2389 2700 | {
|
2390 2701 | #[allow(unused_mut)]
|
2391 2702 | let mut http_request = http::Request::builder()
|
2392 - | .uri("/MalformedPattern")
|
2703 + | .uri("/MalformedRangeOverride")
|
2393 2704 | .method("POST")
|
2394 2705 | .header("content-type", "application/json")
|
2395 2706 | .body(::aws_smithy_http_server::body::Body::from(
|
2396 - | ::bytes::Bytes::from_static("{ \"map\" : { \"abc\": \"xyz\" } }".as_bytes()),
|
2707 + | ::bytes::Bytes::from_static("{ \"maxLong\" : 7 }".as_bytes()),
|
2397 2708 | ))
|
2398 2709 | .unwrap();
|
2399 2710 | #[allow(unused_mut)]
|
2400 2711 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2401 2712 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2402 2713 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2403 - | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
2714 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2404 2715 | let sender = sender.clone();
|
2405 2716 | async move {
|
2406 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
2717 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
2407 2718 | sender.send(()).await.expect("receiver dropped early");
|
2408 2719 | result
|
2409 2720 | }
|
2410 2721 | })
|
2411 2722 | .build_unchecked();
|
2412 2723 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2413 2724 | .await
|
2414 2725 | .expect("unable to make an HTTP request");
|
2415 2726 | ::pretty_assertions::assert_eq!(
|
2416 2727 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2417 2728 | http_response.status()
|
2418 2729 | );
|
2419 2730 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2420 2731 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2421 2732 | http_response.headers(),
|
2422 2733 | expected_headers,
|
2423 2734 | ));
|
2424 2735 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2425 2736 | .await
|
2426 2737 | .expect("unable to extract body to bytes");
|
2427 2738 | ::aws_smithy_protocol_test::assert_ok(
|
2428 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map/abc' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/map/abc' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/map/abc\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2739 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxLong' failed to satisfy constraint: Member must be less than or equal to 6\",\n \"fieldList\" : [{\"message\": \"Value at '/maxLong' failed to satisfy constraint: Member must be less than or equal to 6\", \"path\": \"/maxLong\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2429 2740 | );
|
2430 2741 | }
|
2431 2742 | }
|
2432 - | /// When a union member's value does not match the specified pattern,
|
2743 + | }
|
2744 + |
|
2745 + | const CONTENT_TYPE_MALFORMEDRANGE: ::mime::Mime = ::mime::APPLICATION_JSON;
|
2746 + | ::pin_project_lite::pin_project! {
|
2747 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2748 + | /// [`MalformedRangeInput`](crate::input::MalformedRangeInput) using modelled bindings.
|
2749 + | pub struct MalformedRangeInputFuture {
|
2750 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedRangeInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
2751 + | }
|
2752 + | }
|
2753 + |
|
2754 + | impl std::future::Future for MalformedRangeInputFuture {
|
2755 + | type Output = Result<
|
2756 + | crate::input::MalformedRangeInput,
|
2757 + | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
2758 + | >;
|
2759 + |
|
2760 + | fn poll(
|
2761 + | self: std::pin::Pin<&mut Self>,
|
2762 + | cx: &mut std::task::Context<'_>,
|
2763 + | ) -> std::task::Poll<Self::Output> {
|
2764 + | let this = self.project();
|
2765 + | this.inner.as_mut().poll(cx)
|
2766 + | }
|
2767 + | }
|
2768 + |
|
2769 + | impl<B>
|
2770 + | ::aws_smithy_http_server::request::FromRequest<
|
2771 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
2772 + | B,
|
2773 + | > for crate::input::MalformedRangeInput
|
2774 + | where
|
2775 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
2776 + | B: 'static,
|
2777 + |
|
2778 + | B::Data: Send,
|
2779 + | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
2780 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
2781 + | {
|
2782 + | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
2783 + | type Future = MalformedRangeInputFuture;
|
2784 + |
|
2785 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2786 + | let fut = async move {
|
2787 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
2788 + | request.headers(),
|
2789 + | &CONTENT_TYPE_MALFORMEDRANGE,
|
2790 + | ) {
|
2791 + | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
2792 + | }
|
2793 + | crate::protocol_serde::shape_malformed_range::de_malformed_range_http_request(request)
|
2794 + | .await
|
2795 + | .map_err(Into::into)
|
2796 + | };
|
2797 + | use ::futures_util::future::TryFutureExt;
|
2798 + | let fut = fut.map_err(
|
2799 + | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
2800 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2801 + | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
2802 + | e,
|
2803 + | )
|
2804 + | },
|
2805 + | );
|
2806 + | MalformedRangeInputFuture {
|
2807 + | inner: Box::pin(fut),
|
2808 + | }
|
2809 + | }
|
2810 + | }
|
2811 + | impl
|
2812 + | ::aws_smithy_http_server::response::IntoResponse<
|
2813 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
2814 + | > for crate::output::MalformedRangeOutput
|
2815 + | {
|
2816 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
2817 + | match crate::protocol_serde::shape_malformed_range::ser_malformed_range_http_response(self)
|
2818 + | {
|
2819 + | Ok(response) => response,
|
2820 + | Err(e) => {
|
2821 + | ::tracing::error!(error = %e, "failed to serialize response");
|
2822 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
2823 + | }
|
2824 + | }
|
2825 + | }
|
2826 + | }
|
2827 + | impl
|
2828 + | ::aws_smithy_http_server::response::IntoResponse<
|
2829 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
2830 + | > for crate::error::MalformedRangeError
|
2831 + | {
|
2832 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
2833 + | match crate::protocol_serde::shape_malformed_range::ser_malformed_range_http_error(&self) {
|
2834 + | Ok(mut response) => {
|
2835 + | response.extensions_mut().insert(
|
2836 + | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
2837 + | );
|
2838 + | response
|
2839 + | }
|
2840 + | Err(e) => {
|
2841 + | ::tracing::error!(error = %e, "failed to serialize response");
|
2842 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
2843 + | }
|
2844 + | }
|
2845 + | }
|
2846 + | }
|
2847 + |
|
2848 + | #[allow(unreachable_code, unused_variables)]
|
2849 + | #[cfg(test)]
|
2850 + | mod malformed_range_test {
|
2851 + |
|
2852 + | /// When a byte member does not fit within range bounds,
|
2433 2853 | /// the response should be a 400 ValidationException.
|
2434 - | /// Test ID: RestJsonMalformedPatternUnion_case0
|
2854 + | /// Test ID: RestJsonMalformedRangeByte_case0
|
2435 2855 | #[::tokio::test]
|
2436 - | async fn rest_json_malformed_pattern_union_case0_malformed_request() {
|
2856 + | #[::tracing_test::traced_test]
|
2857 + | async fn rest_json_malformed_range_byte_case0_malformed_request() {
|
2437 2858 | {
|
2438 2859 | #[allow(unused_mut)]
|
2439 2860 | let mut http_request = http::Request::builder()
|
2440 - | .uri("/MalformedPattern")
|
2861 + | .uri("/MalformedRange")
|
2441 2862 | .method("POST")
|
2442 2863 | .header("content-type", "application/json")
|
2443 2864 | .body(::aws_smithy_http_server::body::Body::from(
|
2444 - | ::bytes::Bytes::from_static(
|
2445 - | "{ \"union\" : { \"first\": \"ABC\" } }".as_bytes(),
|
2446 - | ),
|
2865 + | ::bytes::Bytes::from_static("{ \"byte\" : 1 }".as_bytes()),
|
2447 2866 | ))
|
2448 2867 | .unwrap();
|
2449 2868 | #[allow(unused_mut)]
|
2450 2869 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2451 2870 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2452 2871 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2453 - | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
2872 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
2454 2873 | let sender = sender.clone();
|
2455 2874 | async move {
|
2456 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
2875 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
2457 2876 | sender.send(()).await.expect("receiver dropped early");
|
2458 2877 | result
|
2459 2878 | }
|
2460 2879 | })
|
2461 2880 | .build_unchecked();
|
2462 2881 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2463 2882 | .await
|
2464 2883 | .expect("unable to make an HTTP request");
|
2465 2884 | ::pretty_assertions::assert_eq!(
|
2466 2885 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2467 2886 | http_response.status()
|
2468 2887 | );
|
2469 2888 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2470 2889 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2471 2890 | http_response.headers(),
|
2472 2891 | expected_headers,
|
2473 2892 | ));
|
2474 2893 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2475 2894 | .await
|
2476 2895 | .expect("unable to extract body to bytes");
|
2477 2896 | ::aws_smithy_protocol_test::assert_ok(
|
2478 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/union/first' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/union/first' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/union/first\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2897 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/byte' failed to satisfy constraint: Member must be between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/byte' failed to satisfy constraint: Member must be between 2 and 8, inclusive\", \"path\": \"/byte\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2479 2898 | );
|
2480 2899 | }
|
2481 2900 | }
|
2482 - | /// When a union member's value does not match the specified pattern,
|
2901 + | /// When a byte member does not fit within range bounds,
|
2483 2902 | /// the response should be a 400 ValidationException.
|
2484 - | /// Test ID: RestJsonMalformedPatternUnion_case1
|
2903 + | /// Test ID: RestJsonMalformedRangeByte_case1
|
2485 2904 | #[::tokio::test]
|
2486 - | async fn rest_json_malformed_pattern_union_case1_malformed_request() {
|
2905 + | #[::tracing_test::traced_test]
|
2906 + | async fn rest_json_malformed_range_byte_case1_malformed_request() {
|
2487 2907 | {
|
2488 2908 | #[allow(unused_mut)]
|
2489 2909 | let mut http_request = http::Request::builder()
|
2490 - | .uri("/MalformedPattern")
|
2910 + | .uri("/MalformedRange")
|
2491 2911 | .method("POST")
|
2492 2912 | .header("content-type", "application/json")
|
2493 2913 | .body(::aws_smithy_http_server::body::Body::from(
|
2494 - | ::bytes::Bytes::from_static(
|
2495 - | "{ \"union\" : { \"first\": \"xyz\" } }".as_bytes(),
|
2496 - | ),
|
2914 + | ::bytes::Bytes::from_static("{ \"byte\" : 9 }".as_bytes()),
|
2497 2915 | ))
|
2498 2916 | .unwrap();
|
2499 2917 | #[allow(unused_mut)]
|
2500 2918 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2501 2919 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2502 2920 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2503 - | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
2921 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
2504 2922 | let sender = sender.clone();
|
2505 2923 | async move {
|
2506 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
2924 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
2507 2925 | sender.send(()).await.expect("receiver dropped early");
|
2508 2926 | result
|
2509 2927 | }
|
2510 2928 | })
|
2511 2929 | .build_unchecked();
|
2512 2930 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2513 2931 | .await
|
2514 2932 | .expect("unable to make an HTTP request");
|
2515 2933 | ::pretty_assertions::assert_eq!(
|
2516 2934 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2517 2935 | http_response.status()
|
2518 2936 | );
|
2519 2937 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2520 2938 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2521 2939 | http_response.headers(),
|
2522 2940 | expected_headers,
|
2523 2941 | ));
|
2524 2942 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2525 2943 | .await
|
2526 2944 | .expect("unable to extract body to bytes");
|
2527 2945 | ::aws_smithy_protocol_test::assert_ok(
|
2528 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/union/first' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/union/first' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/union/first\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2946 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/byte' failed to satisfy constraint: Member must be between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/byte' failed to satisfy constraint: Member must be between 2 and 8, inclusive\", \"path\": \"/byte\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2529 2947 | );
|
2530 2948 | }
|
2531 2949 | }
|
2532 - | }
|
2533 - | #[cfg(test)]
|
2534 - | #[allow(unreachable_code, unused_variables)]
|
2535 - | mod server_malformed_pattern_override_test {
|
2536 - | /// When a string member does not match the specified pattern,
|
2950 + | /// When a byte member does not fit within range bounds,
|
2537 2951 | /// the response should be a 400 ValidationException.
|
2538 - | /// Test ID: RestJsonMalformedPatternStringOverride_case0
|
2952 + | /// Test ID: RestJsonMalformedRangeMinByte
|
2539 2953 | #[::tokio::test]
|
2540 - | async fn rest_json_malformed_pattern_string_override_case0_malformed_request() {
|
2954 + | #[::tracing_test::traced_test]
|
2955 + | async fn rest_json_malformed_range_min_byte_malformed_request() {
|
2541 2956 | {
|
2542 2957 | #[allow(unused_mut)]
|
2543 2958 | let mut http_request = http::Request::builder()
|
2544 - | .uri("/MalformedPatternOverride")
|
2959 + | .uri("/MalformedRange")
|
2545 2960 | .method("POST")
|
2546 2961 | .header("content-type", "application/json")
|
2547 2962 | .body(::aws_smithy_http_server::body::Body::from(
|
2548 - | ::bytes::Bytes::from_static("{ \"string\" : \"abc\" }".as_bytes()),
|
2963 + | ::bytes::Bytes::from_static("{ \"minByte\" : 1 }".as_bytes()),
|
2549 2964 | ))
|
2550 2965 | .unwrap();
|
2551 2966 | #[allow(unused_mut)]
|
2552 2967 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2553 2968 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2554 2969 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2555 - | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
2970 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
2556 2971 | let sender = sender.clone();
|
2557 2972 | async move {
|
2558 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
2973 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
2559 2974 | sender.send(()).await.expect("receiver dropped early");
|
2560 2975 | result
|
2561 2976 | }
|
2562 2977 | })
|
2563 2978 | .build_unchecked();
|
2564 2979 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2565 2980 | .await
|
2566 2981 | .expect("unable to make an HTTP request");
|
2567 2982 | ::pretty_assertions::assert_eq!(
|
2568 2983 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2569 2984 | http_response.status()
|
2570 2985 | );
|
2571 2986 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2572 2987 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2573 2988 | http_response.headers(),
|
2574 2989 | expected_headers,
|
2575 2990 | ));
|
2576 2991 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2577 2992 | .await
|
2578 2993 | .expect("unable to extract body to bytes");
|
2579 2994 | ::aws_smithy_protocol_test::assert_ok(
|
2580 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2995 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minByte' failed to satisfy constraint: Member must be greater than or equal to 2\",\n \"fieldList\" : [{\"message\": \"Value at '/minByte' failed to satisfy constraint: Member must be greater than or equal to 2\", \"path\": \"/minByte\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2581 2996 | );
|
2582 2997 | }
|
2583 2998 | }
|
2584 - | /// When a string member does not match the specified pattern,
|
2999 + | /// When a byte member does not fit within range bounds,
|
2585 3000 | /// the response should be a 400 ValidationException.
|
2586 - | /// Test ID: RestJsonMalformedPatternStringOverride_case1
|
3001 + | /// Test ID: RestJsonMalformedRangeMaxByte
|
2587 3002 | #[::tokio::test]
|
2588 - | async fn rest_json_malformed_pattern_string_override_case1_malformed_request() {
|
3003 + | #[::tracing_test::traced_test]
|
3004 + | async fn rest_json_malformed_range_max_byte_malformed_request() {
|
2589 3005 | {
|
2590 3006 | #[allow(unused_mut)]
|
2591 3007 | let mut http_request = http::Request::builder()
|
2592 - | .uri("/MalformedPatternOverride")
|
3008 + | .uri("/MalformedRange")
|
2593 3009 | .method("POST")
|
2594 3010 | .header("content-type", "application/json")
|
2595 3011 | .body(::aws_smithy_http_server::body::Body::from(
|
2596 - | ::bytes::Bytes::from_static("{ \"string\" : \"xyz\" }".as_bytes()),
|
3012 + | ::bytes::Bytes::from_static("{ \"maxByte\" : 9 }".as_bytes()),
|
2597 3013 | ))
|
2598 3014 | .unwrap();
|
2599 3015 | #[allow(unused_mut)]
|
2600 3016 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2601 3017 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2602 3018 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2603 - | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
3019 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
2604 3020 | let sender = sender.clone();
|
2605 3021 | async move {
|
2606 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
3022 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
2607 3023 | sender.send(()).await.expect("receiver dropped early");
|
2608 3024 | result
|
2609 3025 | }
|
2610 3026 | })
|
2611 3027 | .build_unchecked();
|
2612 3028 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2613 3029 | .await
|
2614 3030 | .expect("unable to make an HTTP request");
|
2615 3031 | ::pretty_assertions::assert_eq!(
|
2616 3032 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2617 3033 | http_response.status()
|
2618 3034 | );
|
2619 3035 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2620 3036 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2621 3037 | http_response.headers(),
|
2622 3038 | expected_headers,
|
2623 3039 | ));
|
2624 3040 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2625 3041 | .await
|
2626 3042 | .expect("unable to extract body to bytes");
|
2627 3043 | ::aws_smithy_protocol_test::assert_ok(
|
2628 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3044 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxByte' failed to satisfy constraint: Member must be less than or equal to 8\",\n \"fieldList\" : [{\"message\": \"Value at '/maxByte' failed to satisfy constraint: Member must be less than or equal to 8\", \"path\": \"/maxByte\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2629 3045 | );
|
2630 3046 | }
|
2631 3047 | }
|
2632 - | /// When a list member value does not match the specified pattern,
|
3048 + | /// When a float member does not fit within range bounds,
|
2633 3049 | /// the response should be a 400 ValidationException.
|
2634 - | /// Test ID: RestJsonMalformedPatternListOverride_case0
|
3050 + | /// Test ID: RestJsonMalformedRangeFloat_case0
|
2635 3051 | #[::tokio::test]
|
2636 - | async fn rest_json_malformed_pattern_list_override_case0_malformed_request() {
|
3052 + | #[::tracing_test::traced_test]
|
3053 + | #[should_panic]
|
3054 + | async fn rest_json_malformed_range_float_case0_malformed_request() {
|
2637 3055 | {
|
2638 3056 | #[allow(unused_mut)]
|
2639 3057 | let mut http_request = http::Request::builder()
|
2640 - | .uri("/MalformedPatternOverride")
|
3058 + | .uri("/MalformedRange")
|
2641 3059 | .method("POST")
|
2642 3060 | .header("content-type", "application/json")
|
2643 3061 | .body(::aws_smithy_http_server::body::Body::from(
|
2644 - | ::bytes::Bytes::from_static("{ \"list\" : [\"abc\"] }".as_bytes()),
|
3062 + | ::bytes::Bytes::from_static("{ \"float\" : 2.1 }".as_bytes()),
|
2645 3063 | ))
|
2646 3064 | .unwrap();
|
2647 3065 | #[allow(unused_mut)]
|
2648 3066 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2649 3067 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2650 3068 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2651 - | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
3069 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
2652 3070 | let sender = sender.clone();
|
2653 3071 | async move {
|
2654 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
3072 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
2655 3073 | sender.send(()).await.expect("receiver dropped early");
|
2656 3074 | result
|
2657 3075 | }
|
2658 3076 | })
|
2659 3077 | .build_unchecked();
|
2660 3078 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2661 3079 | .await
|
2662 3080 | .expect("unable to make an HTTP request");
|
2663 3081 | ::pretty_assertions::assert_eq!(
|
2664 3082 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2665 3083 | http_response.status()
|
2666 3084 | );
|
2667 3085 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2668 3086 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2669 3087 | http_response.headers(),
|
2670 3088 | expected_headers,
|
2671 3089 | ));
|
2672 3090 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2673 3091 | .await
|
2674 3092 | .expect("unable to extract body to bytes");
|
2675 3093 | ::aws_smithy_protocol_test::assert_ok(
|
2676 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/list/0' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/list/0' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/list/0\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3094 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/float' failed to satisfy constraint: Member must be between 2.2 and 8.8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/float' failed to satisfy constraint: Member must be between 2.2 and 8.8, inclusive\", \"path\": \"/float\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2677 3095 | );
|
2678 3096 | }
|
2679 3097 | }
|
2680 - | /// When a list member value does not match the specified pattern,
|
3098 + | /// When a float member does not fit within range bounds,
|
2681 3099 | /// the response should be a 400 ValidationException.
|
2682 - | /// Test ID: RestJsonMalformedPatternListOverride_case1
|
3100 + | /// Test ID: RestJsonMalformedRangeFloat_case1
|
2683 3101 | #[::tokio::test]
|
2684 - | async fn rest_json_malformed_pattern_list_override_case1_malformed_request() {
|
3102 + | #[::tracing_test::traced_test]
|
3103 + | #[should_panic]
|
3104 + | async fn rest_json_malformed_range_float_case1_malformed_request() {
|
2685 3105 | {
|
2686 3106 | #[allow(unused_mut)]
|
2687 3107 | let mut http_request = http::Request::builder()
|
2688 - | .uri("/MalformedPatternOverride")
|
3108 + | .uri("/MalformedRange")
|
2689 3109 | .method("POST")
|
2690 3110 | .header("content-type", "application/json")
|
2691 3111 | .body(::aws_smithy_http_server::body::Body::from(
|
2692 - | ::bytes::Bytes::from_static("{ \"list\" : [\"xyz\"] }".as_bytes()),
|
3112 + | ::bytes::Bytes::from_static("{ \"float\" : 8.9 }".as_bytes()),
|
2693 3113 | ))
|
2694 3114 | .unwrap();
|
2695 3115 | #[allow(unused_mut)]
|
2696 3116 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2697 3117 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2698 3118 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2699 - | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
3119 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
2700 3120 | let sender = sender.clone();
|
2701 3121 | async move {
|
2702 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
3122 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
2703 3123 | sender.send(()).await.expect("receiver dropped early");
|
2704 3124 | result
|
2705 3125 | }
|
2706 3126 | })
|
2707 3127 | .build_unchecked();
|
2708 3128 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2709 3129 | .await
|
2710 3130 | .expect("unable to make an HTTP request");
|
2711 3131 | ::pretty_assertions::assert_eq!(
|
2712 3132 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2713 3133 | http_response.status()
|
2714 3134 | );
|
2715 3135 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2716 3136 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2717 3137 | http_response.headers(),
|
2718 3138 | expected_headers,
|
2719 3139 | ));
|
2720 3140 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2721 3141 | .await
|
2722 3142 | .expect("unable to extract body to bytes");
|
2723 3143 | ::aws_smithy_protocol_test::assert_ok(
|
2724 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/list/0' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/list/0' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/list/0\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3144 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/float' failed to satisfy constraint: Member must be between 2.2 and 8.8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/float' failed to satisfy constraint: Member must be between 2.2 and 8.8, inclusive\", \"path\": \"/float\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2725 3145 | );
|
2726 3146 | }
|
2727 3147 | }
|
2728 - | /// When a map member's key does not match the specified pattern,
|
3148 + | /// When a float member does not fit within range bounds,
|
2729 3149 | /// the response should be a 400 ValidationException.
|
2730 - | /// Test ID: RestJsonMalformedPatternMapKeyOverride_case0
|
3150 + | /// Test ID: RestJsonMalformedRangeMinFloat
|
2731 3151 | #[::tokio::test]
|
2732 - | async fn rest_json_malformed_pattern_map_key_override_case0_malformed_request() {
|
3152 + | #[::tracing_test::traced_test]
|
3153 + | #[should_panic]
|
3154 + | async fn rest_json_malformed_range_min_float_malformed_request() {
|
2733 3155 | {
|
2734 3156 | #[allow(unused_mut)]
|
2735 3157 | let mut http_request = http::Request::builder()
|
2736 - | .uri("/MalformedPatternOverride")
|
3158 + | .uri("/MalformedRange")
|
2737 3159 | .method("POST")
|
2738 3160 | .header("content-type", "application/json")
|
2739 3161 | .body(::aws_smithy_http_server::body::Body::from(
|
2740 - | ::bytes::Bytes::from_static("{ \"map\" : { \"abc\" : \"ghi\" } }".as_bytes()),
|
3162 + | ::bytes::Bytes::from_static("{ \"minFloat\" : 2.1 }".as_bytes()),
|
2741 3163 | ))
|
2742 3164 | .unwrap();
|
2743 3165 | #[allow(unused_mut)]
|
2744 3166 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2745 3167 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2746 3168 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2747 - | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
3169 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
2748 3170 | let sender = sender.clone();
|
2749 3171 | async move {
|
2750 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
3172 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
2751 3173 | sender.send(()).await.expect("receiver dropped early");
|
2752 3174 | result
|
2753 3175 | }
|
2754 3176 | })
|
2755 3177 | .build_unchecked();
|
2756 3178 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2757 3179 | .await
|
2758 3180 | .expect("unable to make an HTTP request");
|
2759 3181 | ::pretty_assertions::assert_eq!(
|
2760 3182 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2761 3183 | http_response.status()
|
2762 3184 | );
|
2763 3185 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2764 3186 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2765 3187 | http_response.headers(),
|
2766 3188 | expected_headers,
|
2767 3189 | ));
|
2768 3190 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2769 3191 | .await
|
2770 3192 | .expect("unable to extract body to bytes");
|
2771 3193 | ::aws_smithy_protocol_test::assert_ok(
|
2772 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/map' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3194 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minFloat' failed to satisfy constraint: Member must be greater than or equal to 2.2\",\n \"fieldList\" : [{\"message\": \"Value at '/minFloat' failed to satisfy constraint: Member must be greater than or equal to 2.2\", \"path\": \"/minFloat\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2773 3195 | );
|
2774 3196 | }
|
2775 3197 | }
|
2776 - | /// When a map member's key does not match the specified pattern,
|
3198 + | /// When a float member does not fit within range bounds,
|
2777 3199 | /// the response should be a 400 ValidationException.
|
2778 - | /// Test ID: RestJsonMalformedPatternMapKeyOverride_case1
|
3200 + | /// Test ID: RestJsonMalformedRangeMaxFloat
|
2779 3201 | #[::tokio::test]
|
2780 - | async fn rest_json_malformed_pattern_map_key_override_case1_malformed_request() {
|
3202 + | #[::tracing_test::traced_test]
|
3203 + | #[should_panic]
|
3204 + | async fn rest_json_malformed_range_max_float_malformed_request() {
|
2781 3205 | {
|
2782 3206 | #[allow(unused_mut)]
|
2783 3207 | let mut http_request = http::Request::builder()
|
2784 - | .uri("/MalformedPatternOverride")
|
3208 + | .uri("/MalformedRange")
|
2785 3209 | .method("POST")
|
2786 3210 | .header("content-type", "application/json")
|
2787 3211 | .body(::aws_smithy_http_server::body::Body::from(
|
2788 - | ::bytes::Bytes::from_static("{ \"map\" : { \"xyz\" : \"ghi\" } }".as_bytes()),
|
3212 + | ::bytes::Bytes::from_static("{ \"maxFloat\" : 8.9 }".as_bytes()),
|
2789 3213 | ))
|
2790 3214 | .unwrap();
|
2791 3215 | #[allow(unused_mut)]
|
2792 3216 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2793 3217 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2794 3218 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2795 - | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
3219 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
2796 3220 | let sender = sender.clone();
|
2797 3221 | async move {
|
2798 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
3222 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
2799 3223 | sender.send(()).await.expect("receiver dropped early");
|
2800 3224 | result
|
2801 3225 | }
|
2802 3226 | })
|
2803 3227 | .build_unchecked();
|
2804 3228 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2805 3229 | .await
|
2806 3230 | .expect("unable to make an HTTP request");
|
2807 3231 | ::pretty_assertions::assert_eq!(
|
2808 3232 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2809 3233 | http_response.status()
|
2810 3234 | );
|
2811 3235 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2812 3236 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2813 3237 | http_response.headers(),
|
2814 3238 | expected_headers,
|
2815 3239 | ));
|
2816 3240 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2817 3241 | .await
|
2818 3242 | .expect("unable to extract body to bytes");
|
2819 3243 | ::aws_smithy_protocol_test::assert_ok(
|
2820 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/map' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3244 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxFloat' failed to satisfy constraint: Member must be less than or equal to 8.8\",\n \"fieldList\" : [{\"message\": \"Value at '/maxFloat' failed to satisfy constraint: Member must be less than or equal to 8.8\", \"path\": \"/maxFloat\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2821 3245 | );
|
2822 3246 | }
|
2823 3247 | }
|
2824 - | /// When a map member's value does not match the specified pattern,
|
3248 + | /// When a short member does not fit within range bounds,
|
2825 3249 | /// the response should be a 400 ValidationException.
|
2826 - | /// Test ID: RestJsonMalformedPatternMapValueOverride_case0
|
3250 + | /// Test ID: RestJsonMalformedRangeShort_case0
|
2827 3251 | #[::tokio::test]
|
2828 - | async fn rest_json_malformed_pattern_map_value_override_case0_malformed_request() {
|
3252 + | #[::tracing_test::traced_test]
|
3253 + | async fn rest_json_malformed_range_short_case0_malformed_request() {
|
2829 3254 | {
|
2830 3255 | #[allow(unused_mut)]
|
2831 3256 | let mut http_request = http::Request::builder()
|
2832 - | .uri("/MalformedPatternOverride")
|
2833 - | .method("POST")
|
2834 - | .header("content-type", "application/json")
|
2835 - | .body(::aws_smithy_http_server::body::Body::from(
|
2836 - | ::bytes::Bytes::from_static("{ \"map\" : { \"ghi\": \"abc\" } }".as_bytes()),
|
2837 - | ))
|
2838 - | .unwrap();
|
2839 - | #[allow(unused_mut)]
|
2840 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2841 - | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2842 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2843 - | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
2844 - | let sender = sender.clone();
|
2845 - | async move {
|
2846 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
2847 - | sender.send(()).await.expect("receiver dropped early");
|
2848 - | result
|
2849 - | }
|
2850 - | })
|
2851 - | .build_unchecked();
|
2852 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2853 - | .await
|
2854 - | .expect("unable to make an HTTP request");
|
2855 - | ::pretty_assertions::assert_eq!(
|
2856 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2857 - | http_response.status()
|
2858 - | );
|
2859 - | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2860 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2861 - | http_response.headers(),
|
2862 - | expected_headers,
|
2863 - | ));
|
2864 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2865 - | .await
|
2866 - | .expect("unable to extract body to bytes");
|
2867 - | ::aws_smithy_protocol_test::assert_ok(
|
2868 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map/ghi' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/map/ghi' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/map/ghi\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2869 - | );
|
2870 - | }
|
2871 - | }
|
2872 - | /// When a map member's value does not match the specified pattern,
|
2873 - | /// the response should be a 400 ValidationException.
|
2874 - | /// Test ID: RestJsonMalformedPatternMapValueOverride_case1
|
2875 - | #[::tokio::test]
|
2876 - | async fn rest_json_malformed_pattern_map_value_override_case1_malformed_request() {
|
2877 - | {
|
2878 - | #[allow(unused_mut)]
|
2879 - | let mut http_request = http::Request::builder()
|
2880 - | .uri("/MalformedPatternOverride")
|
2881 - | .method("POST")
|
2882 - | .header("content-type", "application/json")
|
2883 - | .body(::aws_smithy_http_server::body::Body::from(
|
2884 - | ::bytes::Bytes::from_static("{ \"map\" : { \"ghi\": \"xyz\" } }".as_bytes()),
|
2885 - | ))
|
2886 - | .unwrap();
|
2887 - | #[allow(unused_mut)]
|
2888 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2889 - | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2890 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2891 - | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
2892 - | let sender = sender.clone();
|
2893 - | async move {
|
2894 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
2895 - | sender.send(()).await.expect("receiver dropped early");
|
2896 - | result
|
2897 - | }
|
2898 - | })
|
2899 - | .build_unchecked();
|
2900 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2901 - | .await
|
2902 - | .expect("unable to make an HTTP request");
|
2903 - | ::pretty_assertions::assert_eq!(
|
2904 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2905 - | http_response.status()
|
2906 - | );
|
2907 - | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2908 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2909 - | http_response.headers(),
|
2910 - | expected_headers,
|
2911 - | ));
|
2912 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2913 - | .await
|
2914 - | .expect("unable to extract body to bytes");
|
2915 - | ::aws_smithy_protocol_test::assert_ok(
|
2916 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map/ghi' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/map/ghi' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/map/ghi\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2917 - | );
|
2918 - | }
|
2919 - | }
|
2920 - | /// When a union member's value does not match the specified pattern,
|
2921 - | /// the response should be a 400 ValidationException.
|
2922 - | /// Test ID: RestJsonMalformedPatternUnionOverride_case0
|
2923 - | #[::tokio::test]
|
2924 - | async fn rest_json_malformed_pattern_union_override_case0_malformed_request() {
|
2925 - | {
|
2926 - | #[allow(unused_mut)]
|
2927 - | let mut http_request = http::Request::builder()
|
2928 - | .uri("/MalformedPatternOverride")
|
3257 + | .uri("/MalformedRange")
|
2929 3258 | .method("POST")
|
2930 3259 | .header("content-type", "application/json")
|
2931 3260 | .body(::aws_smithy_http_server::body::Body::from(
|
2932 - | ::bytes::Bytes::from_static(
|
2933 - | "{ \"union\" : { \"first\": \"abc\" } }".as_bytes(),
|
2934 - | ),
|
3261 + | ::bytes::Bytes::from_static("{ \"short\" : 1 }".as_bytes()),
|
2935 3262 | ))
|
2936 3263 | .unwrap();
|
2937 3264 | #[allow(unused_mut)]
|
2938 3265 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2939 3266 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2940 3267 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2941 - | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
3268 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
2942 3269 | let sender = sender.clone();
|
2943 3270 | async move {
|
2944 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
3271 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
2945 3272 | sender.send(()).await.expect("receiver dropped early");
|
2946 3273 | result
|
2947 3274 | }
|
2948 3275 | })
|
2949 3276 | .build_unchecked();
|
2950 3277 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2951 3278 | .await
|
2952 3279 | .expect("unable to make an HTTP request");
|
2953 3280 | ::pretty_assertions::assert_eq!(
|
2954 3281 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2955 3282 | http_response.status()
|
2956 3283 | );
|
2957 3284 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2958 3285 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2959 3286 | http_response.headers(),
|
2960 3287 | expected_headers,
|
2961 3288 | ));
|
2962 3289 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2963 3290 | .await
|
2964 3291 | .expect("unable to extract body to bytes");
|
2965 3292 | ::aws_smithy_protocol_test::assert_ok(
|
2966 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/union/first' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/union/first' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/union/first\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3293 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/short' failed to satisfy constraint: Member must be between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/short' failed to satisfy constraint: Member must be between 2 and 8, inclusive\", \"path\": \"/short\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2967 3294 | );
|
2968 3295 | }
|
2969 3296 | }
|
2970 - | /// When a union member's value does not match the specified pattern,
|
3297 + | /// When a short member does not fit within range bounds,
|
2971 3298 | /// the response should be a 400 ValidationException.
|
2972 - | /// Test ID: RestJsonMalformedPatternUnionOverride_case1
|
3299 + | /// Test ID: RestJsonMalformedRangeShort_case1
|
2973 3300 | #[::tokio::test]
|
2974 - | async fn rest_json_malformed_pattern_union_override_case1_malformed_request() {
|
3301 + | #[::tracing_test::traced_test]
|
3302 + | async fn rest_json_malformed_range_short_case1_malformed_request() {
|
2975 3303 | {
|
2976 3304 | #[allow(unused_mut)]
|
2977 3305 | let mut http_request = http::Request::builder()
|
2978 - | .uri("/MalformedPatternOverride")
|
3306 + | .uri("/MalformedRange")
|
2979 3307 | .method("POST")
|
2980 3308 | .header("content-type", "application/json")
|
2981 3309 | .body(::aws_smithy_http_server::body::Body::from(
|
2982 - | ::bytes::Bytes::from_static(
|
2983 - | "{ \"union\" : { \"first\": \"xyz\" } }".as_bytes(),
|
2984 - | ),
|
3310 + | ::bytes::Bytes::from_static("{ \"short\" : 9 }".as_bytes()),
|
2985 3311 | ))
|
2986 3312 | .unwrap();
|
2987 3313 | #[allow(unused_mut)]
|
2988 3314 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2989 3315 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2990 3316 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2991 - | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
3317 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
2992 3318 | let sender = sender.clone();
|
2993 3319 | async move {
|
2994 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
3320 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
2995 3321 | sender.send(()).await.expect("receiver dropped early");
|
2996 3322 | result
|
2997 3323 | }
|
2998 3324 | })
|
2999 3325 | .build_unchecked();
|
3000 3326 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3001 3327 | .await
|
3002 3328 | .expect("unable to make an HTTP request");
|
3003 3329 | ::pretty_assertions::assert_eq!(
|
3004 3330 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3005 3331 | http_response.status()
|
3006 3332 | );
|
3007 3333 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3008 3334 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3009 3335 | http_response.headers(),
|
3010 3336 | expected_headers,
|
3011 3337 | ));
|
3012 3338 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3013 3339 | .await
|
3014 3340 | .expect("unable to extract body to bytes");
|
3015 3341 | ::aws_smithy_protocol_test::assert_ok(
|
3016 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/union/first' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/union/first' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/union/first\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3342 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/short' failed to satisfy constraint: Member must be between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/short' failed to satisfy constraint: Member must be between 2 and 8, inclusive\", \"path\": \"/short\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3017 3343 | );
|
3018 3344 | }
|
3019 3345 | }
|
3020 - | }
|
3021 - | #[cfg(test)]
|
3022 - | #[allow(unreachable_code, unused_variables)]
|
3023 - | mod server_malformed_range_test {
|
3024 - | /// When a byte member does not fit within range bounds,
|
3346 + | /// When a short member does not fit within range bounds,
|
3025 3347 | /// the response should be a 400 ValidationException.
|
3026 - | /// Test ID: RestJsonMalformedRangeByte_case0
|
3348 + | /// Test ID: RestJsonMalformedRangeMinShort
|
3027 3349 | #[::tokio::test]
|
3028 - | async fn rest_json_malformed_range_byte_case0_malformed_request() {
|
3350 + | #[::tracing_test::traced_test]
|
3351 + | async fn rest_json_malformed_range_min_short_malformed_request() {
|
3029 3352 | {
|
3030 3353 | #[allow(unused_mut)]
|
3031 3354 | let mut http_request = http::Request::builder()
|
3032 3355 | .uri("/MalformedRange")
|
3033 3356 | .method("POST")
|
3034 3357 | .header("content-type", "application/json")
|
3035 3358 | .body(::aws_smithy_http_server::body::Body::from(
|
3036 - | ::bytes::Bytes::from_static("{ \"byte\" : 1 }".as_bytes()),
|
3359 + | ::bytes::Bytes::from_static("{ \"minShort\" : 1 }".as_bytes()),
|
3037 3360 | ))
|
3038 3361 | .unwrap();
|
3039 3362 | #[allow(unused_mut)]
|
3040 3363 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3041 3364 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3042 3365 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3043 3366 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3044 3367 | let sender = sender.clone();
|
3045 3368 | async move {
|
3046 3369 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3047 3370 | sender.send(()).await.expect("receiver dropped early");
|
3048 3371 | result
|
3049 3372 | }
|
3050 3373 | })
|
3051 3374 | .build_unchecked();
|
3052 3375 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3053 3376 | .await
|
3054 3377 | .expect("unable to make an HTTP request");
|
3055 3378 | ::pretty_assertions::assert_eq!(
|
3056 3379 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3057 3380 | http_response.status()
|
3058 3381 | );
|
3059 3382 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3060 3383 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3061 3384 | http_response.headers(),
|
3062 3385 | expected_headers,
|
3063 3386 | ));
|
3064 3387 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3065 3388 | .await
|
3066 3389 | .expect("unable to extract body to bytes");
|
3067 3390 | ::aws_smithy_protocol_test::assert_ok(
|
3068 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/byte' failed to satisfy constraint: Member must be between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/byte' failed to satisfy constraint: Member must be between 2 and 8, inclusive\", \"path\": \"/byte\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3391 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minShort' failed to satisfy constraint: Member must be greater than or equal to 2\",\n \"fieldList\" : [{\"message\": \"Value at '/minShort' failed to satisfy constraint: Member must be greater than or equal to 2\", \"path\": \"/minShort\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3069 3392 | );
|
3070 3393 | }
|
3071 3394 | }
|
3072 - | /// When a byte member does not fit within range bounds,
|
3395 + | /// When a short member does not fit within range bounds,
|
3073 3396 | /// the response should be a 400 ValidationException.
|
3074 - | /// Test ID: RestJsonMalformedRangeByte_case1
|
3397 + | /// Test ID: RestJsonMalformedRangeMaxShort
|
3075 3398 | #[::tokio::test]
|
3076 - | async fn rest_json_malformed_range_byte_case1_malformed_request() {
|
3399 + | #[::tracing_test::traced_test]
|
3400 + | async fn rest_json_malformed_range_max_short_malformed_request() {
|
3077 3401 | {
|
3078 3402 | #[allow(unused_mut)]
|
3079 3403 | let mut http_request = http::Request::builder()
|
3080 3404 | .uri("/MalformedRange")
|
3081 3405 | .method("POST")
|
3082 3406 | .header("content-type", "application/json")
|
3083 3407 | .body(::aws_smithy_http_server::body::Body::from(
|
3084 - | ::bytes::Bytes::from_static("{ \"byte\" : 9 }".as_bytes()),
|
3408 + | ::bytes::Bytes::from_static("{ \"maxShort\" : 9 }".as_bytes()),
|
3085 3409 | ))
|
3086 3410 | .unwrap();
|
3087 3411 | #[allow(unused_mut)]
|
3088 3412 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3089 3413 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3090 3414 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3091 3415 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3092 3416 | let sender = sender.clone();
|
3093 3417 | async move {
|
3094 3418 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3095 3419 | sender.send(()).await.expect("receiver dropped early");
|
3096 3420 | result
|
3097 3421 | }
|
3098 3422 | })
|
3099 3423 | .build_unchecked();
|
3100 3424 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3101 3425 | .await
|
3102 3426 | .expect("unable to make an HTTP request");
|
3103 3427 | ::pretty_assertions::assert_eq!(
|
3104 3428 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3105 3429 | http_response.status()
|
3106 3430 | );
|
3107 3431 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3108 3432 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3109 3433 | http_response.headers(),
|
3110 3434 | expected_headers,
|
3111 3435 | ));
|
3112 3436 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3113 3437 | .await
|
3114 3438 | .expect("unable to extract body to bytes");
|
3115 3439 | ::aws_smithy_protocol_test::assert_ok(
|
3116 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/byte' failed to satisfy constraint: Member must be between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/byte' failed to satisfy constraint: Member must be between 2 and 8, inclusive\", \"path\": \"/byte\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3440 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxShort' failed to satisfy constraint: Member must be less than or equal to 8\",\n \"fieldList\" : [{\"message\": \"Value at '/maxShort' failed to satisfy constraint: Member must be less than or equal to 8\", \"path\": \"/maxShort\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3117 3441 | );
|
3118 3442 | }
|
3119 3443 | }
|
3120 - | /// When a byte member does not fit within range bounds,
|
3444 + | /// When a integer member does not fit within range bounds,
|
3121 3445 | /// the response should be a 400 ValidationException.
|
3122 - | /// Test ID: RestJsonMalformedRangeMinByte
|
3446 + | /// Test ID: RestJsonMalformedRangeInteger_case0
|
3123 3447 | #[::tokio::test]
|
3124 - | async fn rest_json_malformed_range_min_byte_malformed_request() {
|
3448 + | #[::tracing_test::traced_test]
|
3449 + | async fn rest_json_malformed_range_integer_case0_malformed_request() {
|
3125 3450 | {
|
3126 3451 | #[allow(unused_mut)]
|
3127 3452 | let mut http_request = http::Request::builder()
|
3128 3453 | .uri("/MalformedRange")
|
3129 3454 | .method("POST")
|
3130 3455 | .header("content-type", "application/json")
|
3131 3456 | .body(::aws_smithy_http_server::body::Body::from(
|
3132 - | ::bytes::Bytes::from_static("{ \"minByte\" : 1 }".as_bytes()),
|
3457 + | ::bytes::Bytes::from_static("{ \"integer\" : 1 }".as_bytes()),
|
3133 3458 | ))
|
3134 3459 | .unwrap();
|
3135 3460 | #[allow(unused_mut)]
|
3136 3461 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3137 3462 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3138 3463 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3139 3464 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3140 3465 | let sender = sender.clone();
|
3141 3466 | async move {
|
3142 3467 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3143 3468 | sender.send(()).await.expect("receiver dropped early");
|
3144 3469 | result
|
3145 3470 | }
|
3146 3471 | })
|
3147 3472 | .build_unchecked();
|
3148 3473 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3149 3474 | .await
|
3150 3475 | .expect("unable to make an HTTP request");
|
3151 3476 | ::pretty_assertions::assert_eq!(
|
3152 3477 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3153 3478 | http_response.status()
|
3154 3479 | );
|
3155 3480 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3156 3481 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3157 3482 | http_response.headers(),
|
3158 3483 | expected_headers,
|
3159 3484 | ));
|
3160 3485 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3161 3486 | .await
|
3162 3487 | .expect("unable to extract body to bytes");
|
3163 3488 | ::aws_smithy_protocol_test::assert_ok(
|
3164 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minByte' failed to satisfy constraint: Member must be greater than or equal to 2\",\n \"fieldList\" : [{\"message\": \"Value at '/minByte' failed to satisfy constraint: Member must be greater than or equal to 2\", \"path\": \"/minByte\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3489 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/integer' failed to satisfy constraint: Member must be between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/integer' failed to satisfy constraint: Member must be between 2 and 8, inclusive\", \"path\": \"/integer\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3165 3490 | );
|
3166 3491 | }
|
3167 3492 | }
|
3168 - | /// When a byte member does not fit within range bounds,
|
3493 + | /// When a integer member does not fit within range bounds,
|
3169 3494 | /// the response should be a 400 ValidationException.
|
3170 - | /// Test ID: RestJsonMalformedRangeMaxByte
|
3495 + | /// Test ID: RestJsonMalformedRangeInteger_case1
|
3171 3496 | #[::tokio::test]
|
3172 - | async fn rest_json_malformed_range_max_byte_malformed_request() {
|
3497 + | #[::tracing_test::traced_test]
|
3498 + | async fn rest_json_malformed_range_integer_case1_malformed_request() {
|
3173 3499 | {
|
3174 3500 | #[allow(unused_mut)]
|
3175 3501 | let mut http_request = http::Request::builder()
|
3176 3502 | .uri("/MalformedRange")
|
3177 3503 | .method("POST")
|
3178 3504 | .header("content-type", "application/json")
|
3179 3505 | .body(::aws_smithy_http_server::body::Body::from(
|
3180 - | ::bytes::Bytes::from_static("{ \"maxByte\" : 9 }".as_bytes()),
|
3506 + | ::bytes::Bytes::from_static("{ \"integer\" : 9 }".as_bytes()),
|
3181 3507 | ))
|
3182 3508 | .unwrap();
|
3183 3509 | #[allow(unused_mut)]
|
3184 3510 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3185 3511 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3186 3512 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3187 3513 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3188 3514 | let sender = sender.clone();
|
3189 3515 | async move {
|
3190 3516 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3191 3517 | sender.send(()).await.expect("receiver dropped early");
|
3192 3518 | result
|
3193 3519 | }
|
3194 3520 | })
|
3195 3521 | .build_unchecked();
|
3196 3522 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3197 3523 | .await
|
3198 3524 | .expect("unable to make an HTTP request");
|
3199 3525 | ::pretty_assertions::assert_eq!(
|
3200 3526 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3201 3527 | http_response.status()
|
3202 3528 | );
|
3203 3529 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3204 3530 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3205 3531 | http_response.headers(),
|
3206 3532 | expected_headers,
|
3207 3533 | ));
|
3208 3534 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3209 3535 | .await
|
3210 3536 | .expect("unable to extract body to bytes");
|
3211 3537 | ::aws_smithy_protocol_test::assert_ok(
|
3212 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxByte' failed to satisfy constraint: Member must be less than or equal to 8\",\n \"fieldList\" : [{\"message\": \"Value at '/maxByte' failed to satisfy constraint: Member must be less than or equal to 8\", \"path\": \"/maxByte\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3538 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/integer' failed to satisfy constraint: Member must be between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/integer' failed to satisfy constraint: Member must be between 2 and 8, inclusive\", \"path\": \"/integer\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3213 3539 | );
|
3214 3540 | }
|
3215 3541 | }
|
3216 - | /// When a float member does not fit within range bounds,
|
3542 + | /// When a integer member does not fit within range bounds,
|
3217 3543 | /// the response should be a 400 ValidationException.
|
3218 - | /// Test ID: RestJsonMalformedRangeFloat_case0
|
3544 + | /// Test ID: RestJsonMalformedRangeMinInteger
|
3219 3545 | #[::tokio::test]
|
3220 - | #[should_panic]
|
3221 - | async fn rest_json_malformed_range_float_case0_malformed_request() {
|
3546 + | #[::tracing_test::traced_test]
|
3547 + | async fn rest_json_malformed_range_min_integer_malformed_request() {
|
3222 3548 | {
|
3223 3549 | #[allow(unused_mut)]
|
3224 3550 | let mut http_request = http::Request::builder()
|
3225 3551 | .uri("/MalformedRange")
|
3226 3552 | .method("POST")
|
3227 3553 | .header("content-type", "application/json")
|
3228 3554 | .body(::aws_smithy_http_server::body::Body::from(
|
3229 - | ::bytes::Bytes::from_static("{ \"float\" : 2.1 }".as_bytes()),
|
3555 + | ::bytes::Bytes::from_static("{ \"minInteger\" : 1 }".as_bytes()),
|
3230 3556 | ))
|
3231 3557 | .unwrap();
|
3232 3558 | #[allow(unused_mut)]
|
3233 3559 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3234 3560 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3235 3561 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3236 3562 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3237 3563 | let sender = sender.clone();
|
3238 3564 | async move {
|
3239 3565 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3240 3566 | sender.send(()).await.expect("receiver dropped early");
|
3241 3567 | result
|
3242 3568 | }
|
3243 3569 | })
|
3244 3570 | .build_unchecked();
|
3245 3571 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3246 3572 | .await
|
3247 3573 | .expect("unable to make an HTTP request");
|
3248 3574 | ::pretty_assertions::assert_eq!(
|
3249 3575 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3250 3576 | http_response.status()
|
3251 3577 | );
|
3252 3578 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3253 3579 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3254 3580 | http_response.headers(),
|
3255 3581 | expected_headers,
|
3256 3582 | ));
|
3257 3583 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3258 3584 | .await
|
3259 3585 | .expect("unable to extract body to bytes");
|
3260 3586 | ::aws_smithy_protocol_test::assert_ok(
|
3261 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/float' failed to satisfy constraint: Member must be between 2.2 and 8.8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/float' failed to satisfy constraint: Member must be between 2.2 and 8.8, inclusive\", \"path\": \"/float\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3587 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minInteger' failed to satisfy constraint: Member must be greater than or equal to 2\",\n \"fieldList\" : [{\"message\": \"Value at '/minInteger' failed to satisfy constraint: Member must be greater than or equal to 2\", \"path\": \"/minInteger\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3262 3588 | );
|
3263 3589 | }
|
3264 3590 | }
|
3265 - | /// When a float member does not fit within range bounds,
|
3591 + | /// When a integer member does not fit within range bounds,
|
3266 3592 | /// the response should be a 400 ValidationException.
|
3267 - | /// Test ID: RestJsonMalformedRangeFloat_case1
|
3593 + | /// Test ID: RestJsonMalformedRangeMaxInteger
|
3268 3594 | #[::tokio::test]
|
3269 - | #[should_panic]
|
3270 - | async fn rest_json_malformed_range_float_case1_malformed_request() {
|
3595 + | #[::tracing_test::traced_test]
|
3596 + | async fn rest_json_malformed_range_max_integer_malformed_request() {
|
3271 3597 | {
|
3272 3598 | #[allow(unused_mut)]
|
3273 3599 | let mut http_request = http::Request::builder()
|
3274 3600 | .uri("/MalformedRange")
|
3275 3601 | .method("POST")
|
3276 3602 | .header("content-type", "application/json")
|
3277 3603 | .body(::aws_smithy_http_server::body::Body::from(
|
3278 - | ::bytes::Bytes::from_static("{ \"float\" : 8.9 }".as_bytes()),
|
3604 + | ::bytes::Bytes::from_static("{ \"maxInteger\" : 9 }".as_bytes()),
|
3279 3605 | ))
|
3280 3606 | .unwrap();
|
3281 3607 | #[allow(unused_mut)]
|
3282 3608 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3283 3609 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3284 3610 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3285 3611 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3286 3612 | let sender = sender.clone();
|
3287 3613 | async move {
|
3288 3614 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3289 3615 | sender.send(()).await.expect("receiver dropped early");
|
3290 3616 | result
|
3291 3617 | }
|
3292 3618 | })
|
3293 3619 | .build_unchecked();
|
3294 3620 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3295 3621 | .await
|
3296 3622 | .expect("unable to make an HTTP request");
|
3297 3623 | ::pretty_assertions::assert_eq!(
|
3298 3624 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3299 3625 | http_response.status()
|
3300 3626 | );
|
3301 3627 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3302 3628 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3303 3629 | http_response.headers(),
|
3304 3630 | expected_headers,
|
3305 3631 | ));
|
3306 3632 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3307 3633 | .await
|
3308 3634 | .expect("unable to extract body to bytes");
|
3309 3635 | ::aws_smithy_protocol_test::assert_ok(
|
3310 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/float' failed to satisfy constraint: Member must be between 2.2 and 8.8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/float' failed to satisfy constraint: Member must be between 2.2 and 8.8, inclusive\", \"path\": \"/float\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3636 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxInteger' failed to satisfy constraint: Member must be less than or equal to 8\",\n \"fieldList\" : [{\"message\": \"Value at '/maxInteger' failed to satisfy constraint: Member must be less than or equal to 8\", \"path\": \"/maxInteger\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3311 3637 | );
|
3312 3638 | }
|
3313 3639 | }
|
3314 - | /// When a float member does not fit within range bounds,
|
3640 + | /// When a long member does not fit within range bounds,
|
3315 3641 | /// the response should be a 400 ValidationException.
|
3316 - | /// Test ID: RestJsonMalformedRangeMinFloat
|
3642 + | /// Test ID: RestJsonMalformedRangeLong_case0
|
3317 3643 | #[::tokio::test]
|
3318 - | #[should_panic]
|
3319 - | async fn rest_json_malformed_range_min_float_malformed_request() {
|
3644 + | #[::tracing_test::traced_test]
|
3645 + | async fn rest_json_malformed_range_long_case0_malformed_request() {
|
3320 3646 | {
|
3321 3647 | #[allow(unused_mut)]
|
3322 3648 | let mut http_request = http::Request::builder()
|
3323 3649 | .uri("/MalformedRange")
|
3324 3650 | .method("POST")
|
3325 3651 | .header("content-type", "application/json")
|
3326 3652 | .body(::aws_smithy_http_server::body::Body::from(
|
3327 - | ::bytes::Bytes::from_static("{ \"minFloat\" : 2.1 }".as_bytes()),
|
3653 + | ::bytes::Bytes::from_static("{ \"long\" : 1 }".as_bytes()),
|
3328 3654 | ))
|
3329 3655 | .unwrap();
|
3330 3656 | #[allow(unused_mut)]
|
3331 3657 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3332 3658 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3333 3659 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3334 3660 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3335 3661 | let sender = sender.clone();
|
3336 3662 | async move {
|
3337 3663 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3338 3664 | sender.send(()).await.expect("receiver dropped early");
|
3339 3665 | result
|
3340 3666 | }
|
3341 3667 | })
|
3342 3668 | .build_unchecked();
|
3343 3669 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3344 3670 | .await
|
3345 3671 | .expect("unable to make an HTTP request");
|
3346 3672 | ::pretty_assertions::assert_eq!(
|
3347 3673 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3348 3674 | http_response.status()
|
3349 3675 | );
|
3350 3676 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3351 3677 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3352 3678 | http_response.headers(),
|
3353 3679 | expected_headers,
|
3354 3680 | ));
|
3355 3681 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3356 3682 | .await
|
3357 3683 | .expect("unable to extract body to bytes");
|
3358 3684 | ::aws_smithy_protocol_test::assert_ok(
|
3359 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minFloat' failed to satisfy constraint: Member must be greater than or equal to 2.2\",\n \"fieldList\" : [{\"message\": \"Value at '/minFloat' failed to satisfy constraint: Member must be greater than or equal to 2.2\", \"path\": \"/minFloat\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3685 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/long' failed to satisfy constraint: Member must be between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/long' failed to satisfy constraint: Member must be between 2 and 8, inclusive\", \"path\": \"/long\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3360 3686 | );
|
3361 3687 | }
|
3362 3688 | }
|
3363 - | /// When a float member does not fit within range bounds,
|
3689 + | /// When a long member does not fit within range bounds,
|
3364 3690 | /// the response should be a 400 ValidationException.
|
3365 - | /// Test ID: RestJsonMalformedRangeMaxFloat
|
3691 + | /// Test ID: RestJsonMalformedRangeLong_case1
|
3366 3692 | #[::tokio::test]
|
3367 - | #[should_panic]
|
3368 - | async fn rest_json_malformed_range_max_float_malformed_request() {
|
3693 + | #[::tracing_test::traced_test]
|
3694 + | async fn rest_json_malformed_range_long_case1_malformed_request() {
|
3369 3695 | {
|
3370 3696 | #[allow(unused_mut)]
|
3371 3697 | let mut http_request = http::Request::builder()
|
3372 3698 | .uri("/MalformedRange")
|
3373 3699 | .method("POST")
|
3374 3700 | .header("content-type", "application/json")
|
3375 3701 | .body(::aws_smithy_http_server::body::Body::from(
|
3376 - | ::bytes::Bytes::from_static("{ \"maxFloat\" : 8.9 }".as_bytes()),
|
3702 + | ::bytes::Bytes::from_static("{ \"long\" : 9 }".as_bytes()),
|
3377 3703 | ))
|
3378 3704 | .unwrap();
|
3379 3705 | #[allow(unused_mut)]
|
3380 3706 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3381 3707 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3382 3708 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3383 3709 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3384 3710 | let sender = sender.clone();
|
3385 3711 | async move {
|
3386 3712 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3387 3713 | sender.send(()).await.expect("receiver dropped early");
|
3388 3714 | result
|
3389 3715 | }
|
3390 3716 | })
|
3391 3717 | .build_unchecked();
|
3392 3718 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3393 3719 | .await
|
3394 3720 | .expect("unable to make an HTTP request");
|
3395 3721 | ::pretty_assertions::assert_eq!(
|
3396 3722 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3397 3723 | http_response.status()
|
3398 3724 | );
|
3399 3725 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3400 3726 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3401 3727 | http_response.headers(),
|
3402 3728 | expected_headers,
|
3403 3729 | ));
|
3404 3730 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3405 3731 | .await
|
3406 3732 | .expect("unable to extract body to bytes");
|
3407 3733 | ::aws_smithy_protocol_test::assert_ok(
|
3408 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxFloat' failed to satisfy constraint: Member must be less than or equal to 8.8\",\n \"fieldList\" : [{\"message\": \"Value at '/maxFloat' failed to satisfy constraint: Member must be less than or equal to 8.8\", \"path\": \"/maxFloat\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3734 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/long' failed to satisfy constraint: Member must be between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/long' failed to satisfy constraint: Member must be between 2 and 8, inclusive\", \"path\": \"/long\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3409 3735 | );
|
3410 3736 | }
|
3411 3737 | }
|
3412 - | /// When a short member does not fit within range bounds,
|
3738 + | /// When a long member does not fit within range bounds,
|
3413 3739 | /// the response should be a 400 ValidationException.
|
3414 - | /// Test ID: RestJsonMalformedRangeShort_case0
|
3740 + | /// Test ID: RestJsonMalformedRangeMinLong
|
3415 3741 | #[::tokio::test]
|
3416 - | async fn rest_json_malformed_range_short_case0_malformed_request() {
|
3742 + | #[::tracing_test::traced_test]
|
3743 + | async fn rest_json_malformed_range_min_long_malformed_request() {
|
3417 3744 | {
|
3418 3745 | #[allow(unused_mut)]
|
3419 3746 | let mut http_request = http::Request::builder()
|
3420 3747 | .uri("/MalformedRange")
|
3421 3748 | .method("POST")
|
3422 3749 | .header("content-type", "application/json")
|
3423 3750 | .body(::aws_smithy_http_server::body::Body::from(
|
3424 - | ::bytes::Bytes::from_static("{ \"short\" : 1 }".as_bytes()),
|
3751 + | ::bytes::Bytes::from_static("{ \"minLong\" : 1 }".as_bytes()),
|
3425 3752 | ))
|
3426 3753 | .unwrap();
|
3427 3754 | #[allow(unused_mut)]
|
3428 3755 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3429 3756 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3430 3757 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3431 3758 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3432 3759 | let sender = sender.clone();
|
3433 3760 | async move {
|
3434 3761 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3435 3762 | sender.send(()).await.expect("receiver dropped early");
|
3436 3763 | result
|
3437 3764 | }
|
3438 3765 | })
|
3439 3766 | .build_unchecked();
|
3440 3767 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3441 3768 | .await
|
3442 3769 | .expect("unable to make an HTTP request");
|
3443 3770 | ::pretty_assertions::assert_eq!(
|
3444 3771 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3445 3772 | http_response.status()
|
3446 3773 | );
|
3447 3774 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3448 3775 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3449 3776 | http_response.headers(),
|
3450 3777 | expected_headers,
|
3451 3778 | ));
|
3452 3779 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3453 3780 | .await
|
3454 3781 | .expect("unable to extract body to bytes");
|
3455 3782 | ::aws_smithy_protocol_test::assert_ok(
|
3456 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/short' failed to satisfy constraint: Member must be between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/short' failed to satisfy constraint: Member must be between 2 and 8, inclusive\", \"path\": \"/short\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3783 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minLong' failed to satisfy constraint: Member must be greater than or equal to 2\",\n \"fieldList\" : [{\"message\": \"Value at '/minLong' failed to satisfy constraint: Member must be greater than or equal to 2\", \"path\": \"/minLong\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3457 3784 | );
|
3458 3785 | }
|
3459 3786 | }
|
3460 - | /// When a short member does not fit within range bounds,
|
3787 + | /// When a long member does not fit within range bounds,
|
3461 3788 | /// the response should be a 400 ValidationException.
|
3462 - | /// Test ID: RestJsonMalformedRangeShort_case1
|
3789 + | /// Test ID: RestJsonMalformedRangeMaxLong
|
3463 3790 | #[::tokio::test]
|
3464 - | async fn rest_json_malformed_range_short_case1_malformed_request() {
|
3791 + | #[::tracing_test::traced_test]
|
3792 + | async fn rest_json_malformed_range_max_long_malformed_request() {
|
3465 3793 | {
|
3466 3794 | #[allow(unused_mut)]
|
3467 3795 | let mut http_request = http::Request::builder()
|
3468 3796 | .uri("/MalformedRange")
|
3469 3797 | .method("POST")
|
3470 3798 | .header("content-type", "application/json")
|
3471 3799 | .body(::aws_smithy_http_server::body::Body::from(
|
3472 - | ::bytes::Bytes::from_static("{ \"short\" : 9 }".as_bytes()),
|
3800 + | ::bytes::Bytes::from_static("{ \"maxLong\" : 9 }".as_bytes()),
|
3473 3801 | ))
|
3474 3802 | .unwrap();
|
3475 3803 | #[allow(unused_mut)]
|
3476 3804 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3477 3805 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3478 3806 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3479 3807 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3480 3808 | let sender = sender.clone();
|
3481 3809 | async move {
|
3482 3810 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3483 3811 | sender.send(()).await.expect("receiver dropped early");
|
3484 3812 | result
|
3485 3813 | }
|
3486 3814 | })
|
3487 3815 | .build_unchecked();
|
3488 3816 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3489 3817 | .await
|
3490 3818 | .expect("unable to make an HTTP request");
|
3491 3819 | ::pretty_assertions::assert_eq!(
|
3492 3820 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3493 3821 | http_response.status()
|
3494 3822 | );
|
3495 3823 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3496 3824 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3497 3825 | http_response.headers(),
|
3498 3826 | expected_headers,
|
3499 3827 | ));
|
3500 3828 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3501 3829 | .await
|
3502 3830 | .expect("unable to extract body to bytes");
|
3503 3831 | ::aws_smithy_protocol_test::assert_ok(
|
3504 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/short' failed to satisfy constraint: Member must be between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/short' failed to satisfy constraint: Member must be between 2 and 8, inclusive\", \"path\": \"/short\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3832 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxLong' failed to satisfy constraint: Member must be less than or equal to 8\",\n \"fieldList\" : [{\"message\": \"Value at '/maxLong' failed to satisfy constraint: Member must be less than or equal to 8\", \"path\": \"/maxLong\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3505 3833 | );
|
3506 3834 | }
|
3507 3835 | }
|
3508 - | /// When a short member does not fit within range bounds,
|
3509 - | /// the response should be a 400 ValidationException.
|
3510 - | /// Test ID: RestJsonMalformedRangeMinShort
|
3511 - | #[::tokio::test]
|
3512 - | async fn rest_json_malformed_range_min_short_malformed_request() {
|
3513 - | {
|
3514 - | #[allow(unused_mut)]
|
3515 - | let mut http_request = http::Request::builder()
|
3516 - | .uri("/MalformedRange")
|
3517 - | .method("POST")
|
3518 - | .header("content-type", "application/json")
|
3519 - | .body(::aws_smithy_http_server::body::Body::from(
|
3520 - | ::bytes::Bytes::from_static("{ \"minShort\" : 1 }".as_bytes()),
|
3521 - | ))
|
3522 - | .unwrap();
|
3523 - | #[allow(unused_mut)]
|
3524 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3525 - | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3526 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3527 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3528 - | let sender = sender.clone();
|
3529 - | async move {
|
3530 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3531 - | sender.send(()).await.expect("receiver dropped early");
|
3532 - | result
|
3533 - | }
|
3534 - | })
|
3535 - | .build_unchecked();
|
3536 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3537 - | .await
|
3538 - | .expect("unable to make an HTTP request");
|
3539 - | ::pretty_assertions::assert_eq!(
|
3540 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3541 - | http_response.status()
|
3542 - | );
|
3543 - | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3544 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3545 - | http_response.headers(),
|
3546 - | expected_headers,
|
3547 - | ));
|
3548 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3549 - | .await
|
3550 - | .expect("unable to extract body to bytes");
|
3551 - | ::aws_smithy_protocol_test::assert_ok(
|
3552 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minShort' failed to satisfy constraint: Member must be greater than or equal to 2\",\n \"fieldList\" : [{\"message\": \"Value at '/minShort' failed to satisfy constraint: Member must be greater than or equal to 2\", \"path\": \"/minShort\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3553 - | );
|
3836 + | }
|
3837 + |
|
3838 + | const CONTENT_TYPE_MALFORMEDPATTERNOVERRIDE: ::mime::Mime = ::mime::APPLICATION_JSON;
|
3839 + | ::pin_project_lite::pin_project! {
|
3840 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
3841 + | /// [`MalformedPatternOverrideInput`](crate::input::MalformedPatternOverrideInput) using modelled bindings.
|
3842 + | pub struct MalformedPatternOverrideInputFuture {
|
3843 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedPatternOverrideInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
3844 + | }
|
3845 + | }
|
3846 + |
|
3847 + | impl std::future::Future for MalformedPatternOverrideInputFuture {
|
3848 + | type Output = Result<
|
3849 + | crate::input::MalformedPatternOverrideInput,
|
3850 + | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
3851 + | >;
|
3852 + |
|
3853 + | fn poll(
|
3854 + | self: std::pin::Pin<&mut Self>,
|
3855 + | cx: &mut std::task::Context<'_>,
|
3856 + | ) -> std::task::Poll<Self::Output> {
|
3857 + | let this = self.project();
|
3858 + | this.inner.as_mut().poll(cx)
|
3859 + | }
|
3860 + | }
|
3861 + |
|
3862 + | impl<B>
|
3863 + | ::aws_smithy_http_server::request::FromRequest<
|
3864 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
3865 + | B,
|
3866 + | > for crate::input::MalformedPatternOverrideInput
|
3867 + | where
|
3868 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
3869 + | B: 'static,
|
3870 + |
|
3871 + | B::Data: Send,
|
3872 + | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
3873 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
3874 + | {
|
3875 + | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
3876 + | type Future = MalformedPatternOverrideInputFuture;
|
3877 + |
|
3878 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
3879 + | let fut = async move {
|
3880 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
3881 + | request.headers(),
|
3882 + | &CONTENT_TYPE_MALFORMEDPATTERNOVERRIDE,
|
3883 + | ) {
|
3884 + | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
3885 + | }
|
3886 + | crate::protocol_serde::shape_malformed_pattern_override::de_malformed_pattern_override_http_request(request)
|
3887 + | .await
|
3888 + | .map_err(Into::into)
|
3889 + | };
|
3890 + | use ::futures_util::future::TryFutureExt;
|
3891 + | let fut = fut.map_err(
|
3892 + | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
3893 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
3894 + | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
3895 + | e,
|
3896 + | )
|
3897 + | },
|
3898 + | );
|
3899 + | MalformedPatternOverrideInputFuture {
|
3900 + | inner: Box::pin(fut),
|
3554 3901 | }
|
3555 3902 | }
|
3556 - | /// When a short member does not fit within range bounds,
|
3903 + | }
|
3904 + | impl
|
3905 + | ::aws_smithy_http_server::response::IntoResponse<
|
3906 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
3907 + | > for crate::output::MalformedPatternOverrideOutput
|
3908 + | {
|
3909 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
3910 + | match crate::protocol_serde::shape_malformed_pattern_override::ser_malformed_pattern_override_http_response(self) {
|
3911 + | Ok(response) => response,
|
3912 + | Err(e) => {
|
3913 + | ::tracing::error!(error = %e, "failed to serialize response");
|
3914 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
3915 + | }
|
3916 + | }
|
3917 + | }
|
3918 + | }
|
3919 + | impl
|
3920 + | ::aws_smithy_http_server::response::IntoResponse<
|
3921 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
3922 + | > for crate::error::MalformedPatternOverrideError
|
3923 + | {
|
3924 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
3925 + | match crate::protocol_serde::shape_malformed_pattern_override::ser_malformed_pattern_override_http_error(&self) {
|
3926 + | Ok(mut response) => {
|
3927 + | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
3928 + | response
|
3929 + | },
|
3930 + | Err(e) => {
|
3931 + | ::tracing::error!(error = %e, "failed to serialize response");
|
3932 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
3933 + | }
|
3934 + | }
|
3935 + | }
|
3936 + | }
|
3937 + |
|
3938 + | #[allow(unreachable_code, unused_variables)]
|
3939 + | #[cfg(test)]
|
3940 + | mod malformed_pattern_override_test {
|
3941 + |
|
3942 + | /// When a string member does not match the specified pattern,
|
3557 3943 | /// the response should be a 400 ValidationException.
|
3558 - | /// Test ID: RestJsonMalformedRangeMaxShort
|
3944 + | /// Test ID: RestJsonMalformedPatternStringOverride_case0
|
3559 3945 | #[::tokio::test]
|
3560 - | async fn rest_json_malformed_range_max_short_malformed_request() {
|
3946 + | #[::tracing_test::traced_test]
|
3947 + | async fn rest_json_malformed_pattern_string_override_case0_malformed_request() {
|
3561 3948 | {
|
3562 3949 | #[allow(unused_mut)]
|
3563 3950 | let mut http_request = http::Request::builder()
|
3564 - | .uri("/MalformedRange")
|
3951 + | .uri("/MalformedPatternOverride")
|
3565 3952 | .method("POST")
|
3566 3953 | .header("content-type", "application/json")
|
3567 3954 | .body(::aws_smithy_http_server::body::Body::from(
|
3568 - | ::bytes::Bytes::from_static("{ \"maxShort\" : 9 }".as_bytes()),
|
3955 + | ::bytes::Bytes::from_static("{ \"string\" : \"abc\" }".as_bytes()),
|
3569 3956 | ))
|
3570 3957 | .unwrap();
|
3571 3958 | #[allow(unused_mut)]
|
3572 3959 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3573 3960 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3574 3961 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3575 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3962 + | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
3576 3963 | let sender = sender.clone();
|
3577 3964 | async move {
|
3578 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3965 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
3579 3966 | sender.send(()).await.expect("receiver dropped early");
|
3580 3967 | result
|
3581 3968 | }
|
3582 3969 | })
|
3583 3970 | .build_unchecked();
|
3584 3971 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3585 3972 | .await
|
3586 3973 | .expect("unable to make an HTTP request");
|
3587 3974 | ::pretty_assertions::assert_eq!(
|
3588 3975 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3589 3976 | http_response.status()
|
3590 3977 | );
|
3591 3978 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3592 3979 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3593 3980 | http_response.headers(),
|
3594 3981 | expected_headers,
|
3595 3982 | ));
|
3596 3983 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3597 3984 | .await
|
3598 3985 | .expect("unable to extract body to bytes");
|
3599 3986 | ::aws_smithy_protocol_test::assert_ok(
|
3600 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxShort' failed to satisfy constraint: Member must be less than or equal to 8\",\n \"fieldList\" : [{\"message\": \"Value at '/maxShort' failed to satisfy constraint: Member must be less than or equal to 8\", \"path\": \"/maxShort\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3987 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3601 3988 | );
|
3602 3989 | }
|
3603 3990 | }
|
3604 - | /// When a integer member does not fit within range bounds,
|
3991 + | /// When a string member does not match the specified pattern,
|
3605 3992 | /// the response should be a 400 ValidationException.
|
3606 - | /// Test ID: RestJsonMalformedRangeInteger_case0
|
3993 + | /// Test ID: RestJsonMalformedPatternStringOverride_case1
|
3607 3994 | #[::tokio::test]
|
3608 - | async fn rest_json_malformed_range_integer_case0_malformed_request() {
|
3995 + | #[::tracing_test::traced_test]
|
3996 + | async fn rest_json_malformed_pattern_string_override_case1_malformed_request() {
|
3609 3997 | {
|
3610 3998 | #[allow(unused_mut)]
|
3611 3999 | let mut http_request = http::Request::builder()
|
3612 - | .uri("/MalformedRange")
|
4000 + | .uri("/MalformedPatternOverride")
|
3613 4001 | .method("POST")
|
3614 4002 | .header("content-type", "application/json")
|
3615 4003 | .body(::aws_smithy_http_server::body::Body::from(
|
3616 - | ::bytes::Bytes::from_static("{ \"integer\" : 1 }".as_bytes()),
|
4004 + | ::bytes::Bytes::from_static("{ \"string\" : \"xyz\" }".as_bytes()),
|
3617 4005 | ))
|
3618 4006 | .unwrap();
|
3619 4007 | #[allow(unused_mut)]
|
3620 4008 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3621 4009 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3622 4010 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3623 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
4011 + | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
3624 4012 | let sender = sender.clone();
|
3625 4013 | async move {
|
3626 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
4014 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
3627 4015 | sender.send(()).await.expect("receiver dropped early");
|
3628 4016 | result
|
3629 4017 | }
|
3630 4018 | })
|
3631 4019 | .build_unchecked();
|
3632 4020 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3633 4021 | .await
|
3634 4022 | .expect("unable to make an HTTP request");
|
3635 4023 | ::pretty_assertions::assert_eq!(
|
3636 4024 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3637 4025 | http_response.status()
|
3638 4026 | );
|
3639 4027 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3640 4028 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3641 4029 | http_response.headers(),
|
3642 4030 | expected_headers,
|
3643 4031 | ));
|
3644 4032 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3645 4033 | .await
|
3646 4034 | .expect("unable to extract body to bytes");
|
3647 4035 | ::aws_smithy_protocol_test::assert_ok(
|
3648 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/integer' failed to satisfy constraint: Member must be between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/integer' failed to satisfy constraint: Member must be between 2 and 8, inclusive\", \"path\": \"/integer\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4036 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3649 4037 | );
|
3650 4038 | }
|
3651 4039 | }
|
3652 - | /// When a integer member does not fit within range bounds,
|
4040 + | /// When a list member value does not match the specified pattern,
|
3653 4041 | /// the response should be a 400 ValidationException.
|
3654 - | /// Test ID: RestJsonMalformedRangeInteger_case1
|
4042 + | /// Test ID: RestJsonMalformedPatternListOverride_case0
|
3655 4043 | #[::tokio::test]
|
3656 - | async fn rest_json_malformed_range_integer_case1_malformed_request() {
|
4044 + | #[::tracing_test::traced_test]
|
4045 + | async fn rest_json_malformed_pattern_list_override_case0_malformed_request() {
|
3657 4046 | {
|
3658 4047 | #[allow(unused_mut)]
|
3659 4048 | let mut http_request = http::Request::builder()
|
3660 - | .uri("/MalformedRange")
|
4049 + | .uri("/MalformedPatternOverride")
|
3661 4050 | .method("POST")
|
3662 4051 | .header("content-type", "application/json")
|
3663 4052 | .body(::aws_smithy_http_server::body::Body::from(
|
3664 - | ::bytes::Bytes::from_static("{ \"integer\" : 9 }".as_bytes()),
|
4053 + | ::bytes::Bytes::from_static("{ \"list\" : [\"abc\"] }".as_bytes()),
|
3665 4054 | ))
|
3666 4055 | .unwrap();
|
3667 4056 | #[allow(unused_mut)]
|
3668 4057 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3669 4058 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3670 4059 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3671 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
4060 + | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
3672 4061 | let sender = sender.clone();
|
3673 4062 | async move {
|
3674 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
4063 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
3675 4064 | sender.send(()).await.expect("receiver dropped early");
|
3676 4065 | result
|
3677 4066 | }
|
3678 4067 | })
|
3679 4068 | .build_unchecked();
|
3680 4069 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3681 4070 | .await
|
3682 4071 | .expect("unable to make an HTTP request");
|
3683 4072 | ::pretty_assertions::assert_eq!(
|
3684 4073 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3685 4074 | http_response.status()
|
3686 4075 | );
|
3687 4076 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3688 4077 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3689 4078 | http_response.headers(),
|
3690 4079 | expected_headers,
|
3691 4080 | ));
|
3692 4081 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3693 4082 | .await
|
3694 4083 | .expect("unable to extract body to bytes");
|
3695 4084 | ::aws_smithy_protocol_test::assert_ok(
|
3696 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/integer' failed to satisfy constraint: Member must be between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/integer' failed to satisfy constraint: Member must be between 2 and 8, inclusive\", \"path\": \"/integer\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4085 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/list/0' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/list/0' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/list/0\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3697 4086 | );
|
3698 4087 | }
|
3699 4088 | }
|
3700 - | /// When a integer member does not fit within range bounds,
|
4089 + | /// When a list member value does not match the specified pattern,
|
3701 4090 | /// the response should be a 400 ValidationException.
|
3702 - | /// Test ID: RestJsonMalformedRangeMinInteger
|
4091 + | /// Test ID: RestJsonMalformedPatternListOverride_case1
|
3703 4092 | #[::tokio::test]
|
3704 - | async fn rest_json_malformed_range_min_integer_malformed_request() {
|
4093 + | #[::tracing_test::traced_test]
|
4094 + | async fn rest_json_malformed_pattern_list_override_case1_malformed_request() {
|
3705 4095 | {
|
3706 4096 | #[allow(unused_mut)]
|
3707 4097 | let mut http_request = http::Request::builder()
|
3708 - | .uri("/MalformedRange")
|
4098 + | .uri("/MalformedPatternOverride")
|
3709 4099 | .method("POST")
|
3710 4100 | .header("content-type", "application/json")
|
3711 4101 | .body(::aws_smithy_http_server::body::Body::from(
|
3712 - | ::bytes::Bytes::from_static("{ \"minInteger\" : 1 }".as_bytes()),
|
4102 + | ::bytes::Bytes::from_static("{ \"list\" : [\"xyz\"] }".as_bytes()),
|
3713 4103 | ))
|
3714 4104 | .unwrap();
|
3715 4105 | #[allow(unused_mut)]
|
3716 4106 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3717 4107 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3718 4108 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3719 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
4109 + | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
3720 4110 | let sender = sender.clone();
|
3721 4111 | async move {
|
3722 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
4112 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
3723 4113 | sender.send(()).await.expect("receiver dropped early");
|
3724 4114 | result
|
3725 4115 | }
|
3726 4116 | })
|
3727 4117 | .build_unchecked();
|
3728 4118 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3729 4119 | .await
|
3730 4120 | .expect("unable to make an HTTP request");
|
3731 4121 | ::pretty_assertions::assert_eq!(
|
3732 4122 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3733 4123 | http_response.status()
|
3734 4124 | );
|
3735 4125 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3736 4126 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3737 4127 | http_response.headers(),
|
3738 4128 | expected_headers,
|
3739 4129 | ));
|
3740 4130 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3741 4131 | .await
|
3742 4132 | .expect("unable to extract body to bytes");
|
3743 4133 | ::aws_smithy_protocol_test::assert_ok(
|
3744 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minInteger' failed to satisfy constraint: Member must be greater than or equal to 2\",\n \"fieldList\" : [{\"message\": \"Value at '/minInteger' failed to satisfy constraint: Member must be greater than or equal to 2\", \"path\": \"/minInteger\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4134 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/list/0' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/list/0' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/list/0\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3745 4135 | );
|
3746 4136 | }
|
3747 4137 | }
|
3748 - | /// When a integer member does not fit within range bounds,
|
4138 + | /// When a map member's key does not match the specified pattern,
|
3749 4139 | /// the response should be a 400 ValidationException.
|
3750 - | /// Test ID: RestJsonMalformedRangeMaxInteger
|
4140 + | /// Test ID: RestJsonMalformedPatternMapKeyOverride_case0
|
3751 4141 | #[::tokio::test]
|
3752 - | async fn rest_json_malformed_range_max_integer_malformed_request() {
|
4142 + | #[::tracing_test::traced_test]
|
4143 + | async fn rest_json_malformed_pattern_map_key_override_case0_malformed_request() {
|
3753 4144 | {
|
3754 4145 | #[allow(unused_mut)]
|
3755 4146 | let mut http_request = http::Request::builder()
|
3756 - | .uri("/MalformedRange")
|
4147 + | .uri("/MalformedPatternOverride")
|
3757 4148 | .method("POST")
|
3758 4149 | .header("content-type", "application/json")
|
3759 4150 | .body(::aws_smithy_http_server::body::Body::from(
|
3760 - | ::bytes::Bytes::from_static("{ \"maxInteger\" : 9 }".as_bytes()),
|
4151 + | ::bytes::Bytes::from_static("{ \"map\" : { \"abc\" : \"ghi\" } }".as_bytes()),
|
3761 4152 | ))
|
3762 4153 | .unwrap();
|
3763 4154 | #[allow(unused_mut)]
|
3764 4155 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3765 4156 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3766 4157 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3767 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
4158 + | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
3768 4159 | let sender = sender.clone();
|
3769 4160 | async move {
|
3770 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
4161 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
3771 4162 | sender.send(()).await.expect("receiver dropped early");
|
3772 4163 | result
|
3773 4164 | }
|
3774 4165 | })
|
3775 4166 | .build_unchecked();
|
3776 4167 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3777 4168 | .await
|
3778 4169 | .expect("unable to make an HTTP request");
|
3779 4170 | ::pretty_assertions::assert_eq!(
|
3780 4171 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3781 4172 | http_response.status()
|
3782 4173 | );
|
3783 4174 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3784 4175 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3785 4176 | http_response.headers(),
|
3786 4177 | expected_headers,
|
3787 4178 | ));
|
3788 4179 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3789 4180 | .await
|
3790 4181 | .expect("unable to extract body to bytes");
|
3791 4182 | ::aws_smithy_protocol_test::assert_ok(
|
3792 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxInteger' failed to satisfy constraint: Member must be less than or equal to 8\",\n \"fieldList\" : [{\"message\": \"Value at '/maxInteger' failed to satisfy constraint: Member must be less than or equal to 8\", \"path\": \"/maxInteger\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4183 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/map' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3793 4184 | );
|
3794 4185 | }
|
3795 4186 | }
|
3796 - | /// When a long member does not fit within range bounds,
|
4187 + | /// When a map member's key does not match the specified pattern,
|
3797 4188 | /// the response should be a 400 ValidationException.
|
3798 - | /// Test ID: RestJsonMalformedRangeLong_case0
|
4189 + | /// Test ID: RestJsonMalformedPatternMapKeyOverride_case1
|
3799 4190 | #[::tokio::test]
|
3800 - | async fn rest_json_malformed_range_long_case0_malformed_request() {
|
4191 + | #[::tracing_test::traced_test]
|
4192 + | async fn rest_json_malformed_pattern_map_key_override_case1_malformed_request() {
|
3801 4193 | {
|
3802 4194 | #[allow(unused_mut)]
|
3803 4195 | let mut http_request = http::Request::builder()
|
3804 - | .uri("/MalformedRange")
|
4196 + | .uri("/MalformedPatternOverride")
|
3805 4197 | .method("POST")
|
3806 4198 | .header("content-type", "application/json")
|
3807 4199 | .body(::aws_smithy_http_server::body::Body::from(
|
3808 - | ::bytes::Bytes::from_static("{ \"long\" : 1 }".as_bytes()),
|
4200 + | ::bytes::Bytes::from_static("{ \"map\" : { \"xyz\" : \"ghi\" } }".as_bytes()),
|
3809 4201 | ))
|
3810 4202 | .unwrap();
|
3811 4203 | #[allow(unused_mut)]
|
3812 4204 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3813 4205 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3814 4206 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3815 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
4207 + | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
3816 4208 | let sender = sender.clone();
|
3817 4209 | async move {
|
3818 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
4210 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
3819 4211 | sender.send(()).await.expect("receiver dropped early");
|
3820 4212 | result
|
3821 4213 | }
|
3822 4214 | })
|
3823 4215 | .build_unchecked();
|
3824 4216 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3825 4217 | .await
|
3826 4218 | .expect("unable to make an HTTP request");
|
3827 4219 | ::pretty_assertions::assert_eq!(
|
3828 4220 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3829 4221 | http_response.status()
|
3830 4222 | );
|
3831 4223 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3832 4224 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3833 4225 | http_response.headers(),
|
3834 4226 | expected_headers,
|
3835 4227 | ));
|
3836 4228 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3837 4229 | .await
|
3838 4230 | .expect("unable to extract body to bytes");
|
3839 4231 | ::aws_smithy_protocol_test::assert_ok(
|
3840 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/long' failed to satisfy constraint: Member must be between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/long' failed to satisfy constraint: Member must be between 2 and 8, inclusive\", \"path\": \"/long\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4232 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/map' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3841 4233 | );
|
3842 4234 | }
|
3843 4235 | }
|
3844 - | /// When a long member does not fit within range bounds,
|
4236 + | /// When a map member's value does not match the specified pattern,
|
3845 4237 | /// the response should be a 400 ValidationException.
|
3846 - | /// Test ID: RestJsonMalformedRangeLong_case1
|
4238 + | /// Test ID: RestJsonMalformedPatternMapValueOverride_case0
|
3847 4239 | #[::tokio::test]
|
3848 - | async fn rest_json_malformed_range_long_case1_malformed_request() {
|
4240 + | #[::tracing_test::traced_test]
|
4241 + | async fn rest_json_malformed_pattern_map_value_override_case0_malformed_request() {
|
3849 4242 | {
|
3850 4243 | #[allow(unused_mut)]
|
3851 4244 | let mut http_request = http::Request::builder()
|
3852 - | .uri("/MalformedRange")
|
4245 + | .uri("/MalformedPatternOverride")
|
3853 4246 | .method("POST")
|
3854 4247 | .header("content-type", "application/json")
|
3855 4248 | .body(::aws_smithy_http_server::body::Body::from(
|
3856 - | ::bytes::Bytes::from_static("{ \"long\" : 9 }".as_bytes()),
|
4249 + | ::bytes::Bytes::from_static("{ \"map\" : { \"ghi\": \"abc\" } }".as_bytes()),
|
3857 4250 | ))
|
3858 4251 | .unwrap();
|
3859 4252 | #[allow(unused_mut)]
|
3860 4253 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3861 4254 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3862 4255 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3863 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
4256 + | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
3864 4257 | let sender = sender.clone();
|
3865 4258 | async move {
|
3866 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
4259 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
3867 4260 | sender.send(()).await.expect("receiver dropped early");
|
3868 4261 | result
|
3869 4262 | }
|
3870 4263 | })
|
3871 4264 | .build_unchecked();
|
3872 4265 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3873 4266 | .await
|
3874 4267 | .expect("unable to make an HTTP request");
|
3875 4268 | ::pretty_assertions::assert_eq!(
|
3876 4269 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3877 4270 | http_response.status()
|
3878 4271 | );
|
3879 4272 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3880 4273 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3881 4274 | http_response.headers(),
|
3882 4275 | expected_headers,
|
3883 4276 | ));
|
3884 4277 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3885 4278 | .await
|
3886 4279 | .expect("unable to extract body to bytes");
|
3887 4280 | ::aws_smithy_protocol_test::assert_ok(
|
3888 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/long' failed to satisfy constraint: Member must be between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/long' failed to satisfy constraint: Member must be between 2 and 8, inclusive\", \"path\": \"/long\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4281 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map/ghi' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/map/ghi' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/map/ghi\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3889 4282 | );
|
3890 4283 | }
|
3891 4284 | }
|
3892 - | /// When a long member does not fit within range bounds,
|
4285 + | /// When a map member's value does not match the specified pattern,
|
3893 4286 | /// the response should be a 400 ValidationException.
|
3894 - | /// Test ID: RestJsonMalformedRangeMinLong
|
4287 + | /// Test ID: RestJsonMalformedPatternMapValueOverride_case1
|
3895 4288 | #[::tokio::test]
|
3896 - | async fn rest_json_malformed_range_min_long_malformed_request() {
|
4289 + | #[::tracing_test::traced_test]
|
4290 + | async fn rest_json_malformed_pattern_map_value_override_case1_malformed_request() {
|
3897 4291 | {
|
3898 4292 | #[allow(unused_mut)]
|
3899 4293 | let mut http_request = http::Request::builder()
|
3900 - | .uri("/MalformedRange")
|
4294 + | .uri("/MalformedPatternOverride")
|
3901 4295 | .method("POST")
|
3902 4296 | .header("content-type", "application/json")
|
3903 4297 | .body(::aws_smithy_http_server::body::Body::from(
|
3904 - | ::bytes::Bytes::from_static("{ \"minLong\" : 1 }".as_bytes()),
|
4298 + | ::bytes::Bytes::from_static("{ \"map\" : { \"ghi\": \"xyz\" } }".as_bytes()),
|
3905 4299 | ))
|
3906 4300 | .unwrap();
|
3907 4301 | #[allow(unused_mut)]
|
3908 4302 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3909 4303 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3910 4304 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3911 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
4305 + | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
3912 4306 | let sender = sender.clone();
|
3913 4307 | async move {
|
3914 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
4308 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
3915 4309 | sender.send(()).await.expect("receiver dropped early");
|
3916 4310 | result
|
3917 4311 | }
|
3918 4312 | })
|
3919 4313 | .build_unchecked();
|
3920 4314 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3921 4315 | .await
|
3922 4316 | .expect("unable to make an HTTP request");
|
3923 4317 | ::pretty_assertions::assert_eq!(
|
3924 4318 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3925 4319 | http_response.status()
|
3926 4320 | );
|
3927 4321 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3928 4322 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3929 4323 | http_response.headers(),
|
3930 4324 | expected_headers,
|
3931 4325 | ));
|
3932 4326 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3933 4327 | .await
|
3934 4328 | .expect("unable to extract body to bytes");
|
3935 4329 | ::aws_smithy_protocol_test::assert_ok(
|
3936 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minLong' failed to satisfy constraint: Member must be greater than or equal to 2\",\n \"fieldList\" : [{\"message\": \"Value at '/minLong' failed to satisfy constraint: Member must be greater than or equal to 2\", \"path\": \"/minLong\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4330 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map/ghi' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/map/ghi' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/map/ghi\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3937 4331 | );
|
3938 4332 | }
|
3939 4333 | }
|
3940 - | /// When a long member does not fit within range bounds,
|
4334 + | /// When a union member's value does not match the specified pattern,
|
3941 4335 | /// the response should be a 400 ValidationException.
|
3942 - | /// Test ID: RestJsonMalformedRangeMaxLong
|
4336 + | /// Test ID: RestJsonMalformedPatternUnionOverride_case0
|
3943 4337 | #[::tokio::test]
|
3944 - | async fn rest_json_malformed_range_max_long_malformed_request() {
|
4338 + | #[::tracing_test::traced_test]
|
4339 + | async fn rest_json_malformed_pattern_union_override_case0_malformed_request() {
|
3945 4340 | {
|
3946 4341 | #[allow(unused_mut)]
|
3947 4342 | let mut http_request = http::Request::builder()
|
3948 - | .uri("/MalformedRange")
|
4343 + | .uri("/MalformedPatternOverride")
|
3949 4344 | .method("POST")
|
3950 4345 | .header("content-type", "application/json")
|
3951 4346 | .body(::aws_smithy_http_server::body::Body::from(
|
3952 - | ::bytes::Bytes::from_static("{ \"maxLong\" : 9 }".as_bytes()),
|
4347 + | ::bytes::Bytes::from_static(
|
4348 + | "{ \"union\" : { \"first\": \"abc\" } }".as_bytes(),
|
4349 + | ),
|
3953 4350 | ))
|
3954 4351 | .unwrap();
|
3955 4352 | #[allow(unused_mut)]
|
3956 4353 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3957 4354 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3958 4355 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3959 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
4356 + | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
3960 4357 | let sender = sender.clone();
|
3961 4358 | async move {
|
3962 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
4359 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
3963 4360 | sender.send(()).await.expect("receiver dropped early");
|
3964 4361 | result
|
3965 4362 | }
|
3966 4363 | })
|
3967 4364 | .build_unchecked();
|
3968 4365 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3969 4366 | .await
|
3970 4367 | .expect("unable to make an HTTP request");
|
3971 4368 | ::pretty_assertions::assert_eq!(
|
3972 4369 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3973 4370 | http_response.status()
|
3974 4371 | );
|
3975 4372 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3976 4373 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3977 4374 | http_response.headers(),
|
3978 4375 | expected_headers,
|
3979 4376 | ));
|
3980 4377 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3981 4378 | .await
|
3982 4379 | .expect("unable to extract body to bytes");
|
3983 4380 | ::aws_smithy_protocol_test::assert_ok(
|
3984 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxLong' failed to satisfy constraint: Member must be less than or equal to 8\",\n \"fieldList\" : [{\"message\": \"Value at '/maxLong' failed to satisfy constraint: Member must be less than or equal to 8\", \"path\": \"/maxLong\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4381 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/union/first' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/union/first' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/union/first\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3985 4382 | );
|
3986 4383 | }
|
3987 4384 | }
|
3988 - | }
|
3989 - | #[cfg(test)]
|
3990 - | #[allow(unreachable_code, unused_variables)]
|
3991 - | mod server_malformed_range_override_test {
|
3992 - | /// When a byte member does not fit within range bounds,
|
4385 + | /// When a union member's value does not match the specified pattern,
|
3993 4386 | /// the response should be a 400 ValidationException.
|
3994 - | /// Test ID: RestJsonMalformedRangeByteOverride_case0
|
4387 + | /// Test ID: RestJsonMalformedPatternUnionOverride_case1
|
3995 4388 | #[::tokio::test]
|
3996 - | async fn rest_json_malformed_range_byte_override_case0_malformed_request() {
|
4389 + | #[::tracing_test::traced_test]
|
4390 + | async fn rest_json_malformed_pattern_union_override_case1_malformed_request() {
|
3997 4391 | {
|
3998 4392 | #[allow(unused_mut)]
|
3999 4393 | let mut http_request = http::Request::builder()
|
4000 - | .uri("/MalformedRangeOverride")
|
4394 + | .uri("/MalformedPatternOverride")
|
4001 4395 | .method("POST")
|
4002 4396 | .header("content-type", "application/json")
|
4003 4397 | .body(::aws_smithy_http_server::body::Body::from(
|
4004 - | ::bytes::Bytes::from_static("{ \"byte\" : 3 }".as_bytes()),
|
4398 + | ::bytes::Bytes::from_static(
|
4399 + | "{ \"union\" : { \"first\": \"xyz\" } }".as_bytes(),
|
4400 + | ),
|
4005 4401 | ))
|
4006 4402 | .unwrap();
|
4007 4403 | #[allow(unused_mut)]
|
4008 4404 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4009 4405 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4010 4406 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4011 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
4407 + | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
4012 4408 | let sender = sender.clone();
|
4013 4409 | async move {
|
4014 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
4410 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
4015 4411 | sender.send(()).await.expect("receiver dropped early");
|
4016 4412 | result
|
4017 4413 | }
|
4018 4414 | })
|
4019 4415 | .build_unchecked();
|
4020 4416 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4021 4417 | .await
|
4022 4418 | .expect("unable to make an HTTP request");
|
4023 4419 | ::pretty_assertions::assert_eq!(
|
4024 4420 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4025 4421 | http_response.status()
|
4026 4422 | );
|
4027 4423 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4028 4424 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4029 4425 | http_response.headers(),
|
4030 4426 | expected_headers,
|
4031 4427 | ));
|
4032 4428 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4033 4429 | .await
|
4034 4430 | .expect("unable to extract body to bytes");
|
4035 4431 | ::aws_smithy_protocol_test::assert_ok(
|
4036 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/byte' failed to satisfy constraint: Member must be between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/byte' failed to satisfy constraint: Member must be between 4 and 6, inclusive\", \"path\": \"/byte\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4432 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/union/first' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/union/first' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/union/first\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4037 4433 | );
|
4038 4434 | }
|
4039 4435 | }
|
4040 - | /// When a byte member does not fit within range bounds,
|
4436 + | }
|
4437 + |
|
4438 + | const CONTENT_TYPE_MALFORMEDPATTERN: ::mime::Mime = ::mime::APPLICATION_JSON;
|
4439 + | ::pin_project_lite::pin_project! {
|
4440 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
4441 + | /// [`MalformedPatternInput`](crate::input::MalformedPatternInput) using modelled bindings.
|
4442 + | pub struct MalformedPatternInputFuture {
|
4443 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedPatternInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
4444 + | }
|
4445 + | }
|
4446 + |
|
4447 + | impl std::future::Future for MalformedPatternInputFuture {
|
4448 + | type Output = Result<
|
4449 + | crate::input::MalformedPatternInput,
|
4450 + | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
4451 + | >;
|
4452 + |
|
4453 + | fn poll(
|
4454 + | self: std::pin::Pin<&mut Self>,
|
4455 + | cx: &mut std::task::Context<'_>,
|
4456 + | ) -> std::task::Poll<Self::Output> {
|
4457 + | let this = self.project();
|
4458 + | this.inner.as_mut().poll(cx)
|
4459 + | }
|
4460 + | }
|
4461 + |
|
4462 + | impl<B>
|
4463 + | ::aws_smithy_http_server::request::FromRequest<
|
4464 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
4465 + | B,
|
4466 + | > for crate::input::MalformedPatternInput
|
4467 + | where
|
4468 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
4469 + | B: 'static,
|
4470 + |
|
4471 + | B::Data: Send,
|
4472 + | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
4473 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
4474 + | {
|
4475 + | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
4476 + | type Future = MalformedPatternInputFuture;
|
4477 + |
|
4478 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
4479 + | let fut = async move {
|
4480 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
4481 + | request.headers(),
|
4482 + | &CONTENT_TYPE_MALFORMEDPATTERN,
|
4483 + | ) {
|
4484 + | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
4485 + | }
|
4486 + | crate::protocol_serde::shape_malformed_pattern::de_malformed_pattern_http_request(
|
4487 + | request,
|
4488 + | )
|
4489 + | .await
|
4490 + | .map_err(Into::into)
|
4491 + | };
|
4492 + | use ::futures_util::future::TryFutureExt;
|
4493 + | let fut = fut.map_err(
|
4494 + | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
4495 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
4496 + | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
4497 + | e,
|
4498 + | )
|
4499 + | },
|
4500 + | );
|
4501 + | MalformedPatternInputFuture {
|
4502 + | inner: Box::pin(fut),
|
4503 + | }
|
4504 + | }
|
4505 + | }
|
4506 + | impl
|
4507 + | ::aws_smithy_http_server::response::IntoResponse<
|
4508 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
4509 + | > for crate::output::MalformedPatternOutput
|
4510 + | {
|
4511 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
4512 + | match crate::protocol_serde::shape_malformed_pattern::ser_malformed_pattern_http_response(
|
4513 + | self,
|
4514 + | ) {
|
4515 + | Ok(response) => response,
|
4516 + | Err(e) => {
|
4517 + | ::tracing::error!(error = %e, "failed to serialize response");
|
4518 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
4519 + | }
|
4520 + | }
|
4521 + | }
|
4522 + | }
|
4523 + | impl
|
4524 + | ::aws_smithy_http_server::response::IntoResponse<
|
4525 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
4526 + | > for crate::error::MalformedPatternError
|
4527 + | {
|
4528 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
4529 + | match crate::protocol_serde::shape_malformed_pattern::ser_malformed_pattern_http_error(
|
4530 + | &self,
|
4531 + | ) {
|
4532 + | Ok(mut response) => {
|
4533 + | response.extensions_mut().insert(
|
4534 + | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
4535 + | );
|
4536 + | response
|
4537 + | }
|
4538 + | Err(e) => {
|
4539 + | ::tracing::error!(error = %e, "failed to serialize response");
|
4540 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
4541 + | }
|
4542 + | }
|
4543 + | }
|
4544 + | }
|
4545 + |
|
4546 + | #[allow(unreachable_code, unused_variables)]
|
4547 + | #[cfg(test)]
|
4548 + | mod malformed_pattern_test {
|
4549 + |
|
4550 + | /// When a string member does not match the specified pattern,
|
4041 4551 | /// the response should be a 400 ValidationException.
|
4042 - | /// Test ID: RestJsonMalformedRangeByteOverride_case1
|
4552 + | /// Test ID: RestJsonMalformedPatternString_case0
|
4043 4553 | #[::tokio::test]
|
4044 - | async fn rest_json_malformed_range_byte_override_case1_malformed_request() {
|
4554 + | #[::tracing_test::traced_test]
|
4555 + | async fn rest_json_malformed_pattern_string_case0_malformed_request() {
|
4045 4556 | {
|
4046 4557 | #[allow(unused_mut)]
|
4047 4558 | let mut http_request = http::Request::builder()
|
4048 - | .uri("/MalformedRangeOverride")
|
4559 + | .uri("/MalformedPattern")
|
4049 4560 | .method("POST")
|
4050 4561 | .header("content-type", "application/json")
|
4051 4562 | .body(::aws_smithy_http_server::body::Body::from(
|
4052 - | ::bytes::Bytes::from_static("{ \"byte\" : 7 }".as_bytes()),
|
4563 + | ::bytes::Bytes::from_static("{ \"string\" : \"ABC\" }".as_bytes()),
|
4053 4564 | ))
|
4054 4565 | .unwrap();
|
4055 4566 | #[allow(unused_mut)]
|
4056 4567 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4057 4568 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4058 4569 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4059 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
4570 + | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
4060 4571 | let sender = sender.clone();
|
4061 4572 | async move {
|
4062 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
4573 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
4063 4574 | sender.send(()).await.expect("receiver dropped early");
|
4064 4575 | result
|
4065 4576 | }
|
4066 4577 | })
|
4067 4578 | .build_unchecked();
|
4068 4579 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4069 4580 | .await
|
4070 4581 | .expect("unable to make an HTTP request");
|
4071 4582 | ::pretty_assertions::assert_eq!(
|
4072 4583 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4073 4584 | http_response.status()
|
4074 4585 | );
|
4075 4586 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4076 4587 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4077 4588 | http_response.headers(),
|
4078 4589 | expected_headers,
|
4079 4590 | ));
|
4080 4591 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4081 4592 | .await
|
4082 4593 | .expect("unable to extract body to bytes");
|
4083 4594 | ::aws_smithy_protocol_test::assert_ok(
|
4084 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/byte' failed to satisfy constraint: Member must be between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/byte' failed to satisfy constraint: Member must be between 4 and 6, inclusive\", \"path\": \"/byte\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4595 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4085 4596 | );
|
4086 4597 | }
|
4087 4598 | }
|
4088 - | /// When a byte member does not fit within range bounds,
|
4599 + | /// When a string member does not match the specified pattern,
|
4089 4600 | /// the response should be a 400 ValidationException.
|
4090 - | /// Test ID: RestJsonMalformedRangeMinByteOverride
|
4601 + | /// Test ID: RestJsonMalformedPatternString_case1
|
4091 4602 | #[::tokio::test]
|
4092 - | async fn rest_json_malformed_range_min_byte_override_malformed_request() {
|
4603 + | #[::tracing_test::traced_test]
|
4604 + | async fn rest_json_malformed_pattern_string_case1_malformed_request() {
|
4093 4605 | {
|
4094 4606 | #[allow(unused_mut)]
|
4095 4607 | let mut http_request = http::Request::builder()
|
4096 - | .uri("/MalformedRangeOverride")
|
4608 + | .uri("/MalformedPattern")
|
4097 4609 | .method("POST")
|
4098 4610 | .header("content-type", "application/json")
|
4099 4611 | .body(::aws_smithy_http_server::body::Body::from(
|
4100 - | ::bytes::Bytes::from_static("{ \"minByte\" : 3 }".as_bytes()),
|
4612 + | ::bytes::Bytes::from_static("{ \"string\" : \"xyz\" }".as_bytes()),
|
4101 4613 | ))
|
4102 4614 | .unwrap();
|
4103 4615 | #[allow(unused_mut)]
|
4104 4616 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4105 4617 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4106 4618 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4107 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
4619 + | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
4108 4620 | let sender = sender.clone();
|
4109 4621 | async move {
|
4110 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
4622 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
4111 4623 | sender.send(()).await.expect("receiver dropped early");
|
4112 4624 | result
|
4113 4625 | }
|
4114 4626 | })
|
4115 4627 | .build_unchecked();
|
4116 4628 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4117 4629 | .await
|
4118 4630 | .expect("unable to make an HTTP request");
|
4119 4631 | ::pretty_assertions::assert_eq!(
|
4120 4632 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4121 4633 | http_response.status()
|
4122 4634 | );
|
4123 4635 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4124 4636 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4125 4637 | http_response.headers(),
|
4126 4638 | expected_headers,
|
4127 4639 | ));
|
4128 4640 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4129 4641 | .await
|
4130 4642 | .expect("unable to extract body to bytes");
|
4131 4643 | ::aws_smithy_protocol_test::assert_ok(
|
4132 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minByte' failed to satisfy constraint: Member must be greater than or equal to 4\",\n \"fieldList\" : [{\"message\": \"Value at '/minByte' failed to satisfy constraint: Member must be greater than or equal to 4\", \"path\": \"/minByte\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4644 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4133 4645 | );
|
4134 4646 | }
|
4135 4647 | }
|
4136 - | /// When a byte member does not fit within range bounds,
|
4137 - | /// the response should be a 400 ValidationException.
|
4138 - | /// Test ID: RestJsonMalformedRangeMaxByteOverride
|
4648 + | /// When the specified pattern is susceptible to ReDOS, the service will not
|
4649 + | /// hang indefinitely while evaluating the pattern
|
4650 + | /// Test ID: RestJsonMalformedPatternReDOSString
|
4139 4651 | #[::tokio::test]
|
4140 - | async fn rest_json_malformed_range_max_byte_override_malformed_request() {
|
4652 + | #[::tracing_test::traced_test]
|
4653 + | async fn rest_json_malformed_pattern_re_dos_string_malformed_request() {
|
4141 4654 | {
|
4142 4655 | #[allow(unused_mut)]
|
4143 - | let mut http_request = http::Request::builder()
|
4144 - | .uri("/MalformedRangeOverride")
|
4145 - | .method("POST")
|
4146 - | .header("content-type", "application/json")
|
4147 - | .body(::aws_smithy_http_server::body::Body::from(
|
4148 - | ::bytes::Bytes::from_static("{ \"maxByte\" : 7 }".as_bytes()),
|
4149 - | ))
|
4150 - | .unwrap();
|
4656 + | let mut http_request = http::Request::builder()
|
4657 + | .uri("/MalformedPattern")
|
4658 + | .method("POST")
|
4659 + | .header("content-type", "application/json")
|
4660 + | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"evilString\" : \"000000000000000000000000000000000000000000000000000000000000000000000000000000000000!\" }".as_bytes()))).unwrap();
|
4151 4661 | #[allow(unused_mut)]
|
4152 4662 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4153 4663 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4154 4664 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4155 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
4665 + | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
4156 4666 | let sender = sender.clone();
|
4157 4667 | async move {
|
4158 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
4668 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
4159 4669 | sender.send(()).await.expect("receiver dropped early");
|
4160 4670 | result
|
4161 4671 | }
|
4162 4672 | })
|
4163 4673 | .build_unchecked();
|
4164 4674 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4165 4675 | .await
|
4166 4676 | .expect("unable to make an HTTP request");
|
4167 4677 | ::pretty_assertions::assert_eq!(
|
4168 4678 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4169 4679 | http_response.status()
|
4170 4680 | );
|
4171 4681 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4172 4682 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4173 4683 | http_response.headers(),
|
4174 4684 | expected_headers,
|
4175 4685 | ));
|
4176 4686 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4177 4687 | .await
|
4178 4688 | .expect("unable to extract body to bytes");
|
4179 4689 | ::aws_smithy_protocol_test::assert_ok(
|
4180 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxByte' failed to satisfy constraint: Member must be less than or equal to 6\",\n \"fieldList\" : [{\"message\": \"Value at '/maxByte' failed to satisfy constraint: Member must be less than or equal to 6\", \"path\": \"/maxByte\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4690 + | ::aws_smithy_protocol_test::validate_body(&body, "{\n \"message\" : \"1 validation error detected. Value at '/evilString' failed to satisfy constraint: Member must satisfy regular expression pattern: ^([0-9]+)+$\",\n \"fieldList\" : [{\"message\": \"Value at '/evilString' failed to satisfy constraint: Member must satisfy regular expression pattern: ^([0-9]+)+$\", \"path\": \"/evilString\"}]\n}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4181 4691 | );
|
4182 4692 | }
|
4183 4693 | }
|
4184 - | /// When a float member does not fit within range bounds,
|
4694 + | /// When a list member value does not match the specified pattern,
|
4185 4695 | /// the response should be a 400 ValidationException.
|
4186 - | /// Test ID: RestJsonMalformedRangeFloatOverride_case0
|
4696 + | /// Test ID: RestJsonMalformedPatternList_case0
|
4187 4697 | #[::tokio::test]
|
4188 - | #[should_panic]
|
4189 - | async fn rest_json_malformed_range_float_override_case0_malformed_request() {
|
4698 + | #[::tracing_test::traced_test]
|
4699 + | async fn rest_json_malformed_pattern_list_case0_malformed_request() {
|
4190 4700 | {
|
4191 4701 | #[allow(unused_mut)]
|
4192 4702 | let mut http_request = http::Request::builder()
|
4193 - | .uri("/MalformedRangeOverride")
|
4703 + | .uri("/MalformedPattern")
|
4194 4704 | .method("POST")
|
4195 4705 | .header("content-type", "application/json")
|
4196 4706 | .body(::aws_smithy_http_server::body::Body::from(
|
4197 - | ::bytes::Bytes::from_static("{ \"float\" : 4.3 }".as_bytes()),
|
4707 + | ::bytes::Bytes::from_static("{ \"list\" : [\"ABC\"] }".as_bytes()),
|
4198 4708 | ))
|
4199 4709 | .unwrap();
|
4200 4710 | #[allow(unused_mut)]
|
4201 4711 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4202 4712 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4203 4713 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4204 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
4714 + | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
4205 4715 | let sender = sender.clone();
|
4206 4716 | async move {
|
4207 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
4717 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
4208 4718 | sender.send(()).await.expect("receiver dropped early");
|
4209 4719 | result
|
4210 4720 | }
|
4211 4721 | })
|
4212 4722 | .build_unchecked();
|
4213 4723 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4214 4724 | .await
|
4215 4725 | .expect("unable to make an HTTP request");
|
4216 4726 | ::pretty_assertions::assert_eq!(
|
4217 4727 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4218 4728 | http_response.status()
|
4219 4729 | );
|
4220 4730 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4221 4731 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4222 4732 | http_response.headers(),
|
4223 4733 | expected_headers,
|
4224 4734 | ));
|
4225 4735 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4226 4736 | .await
|
4227 4737 | .expect("unable to extract body to bytes");
|
4228 4738 | ::aws_smithy_protocol_test::assert_ok(
|
4229 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/float' failed to satisfy constraint: Member must be between 4.4 and 6.6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/float' failed to satisfy constraint: Member must be between 4.4 and 6.6, inclusive\", \"path\": \"/float\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4739 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/list/0' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/list/0' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/list/0\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4230 4740 | );
|
4231 4741 | }
|
4232 4742 | }
|
4233 - | /// When a float member does not fit within range bounds,
|
4743 + | /// When a list member value does not match the specified pattern,
|
4234 4744 | /// the response should be a 400 ValidationException.
|
4235 - | /// Test ID: RestJsonMalformedRangeFloatOverride_case1
|
4745 + | /// Test ID: RestJsonMalformedPatternList_case1
|
4236 4746 | #[::tokio::test]
|
4237 - | #[should_panic]
|
4238 - | async fn rest_json_malformed_range_float_override_case1_malformed_request() {
|
4747 + | #[::tracing_test::traced_test]
|
4748 + | async fn rest_json_malformed_pattern_list_case1_malformed_request() {
|
4239 4749 | {
|
4240 4750 | #[allow(unused_mut)]
|
4241 4751 | let mut http_request = http::Request::builder()
|
4242 - | .uri("/MalformedRangeOverride")
|
4752 + | .uri("/MalformedPattern")
|
4243 4753 | .method("POST")
|
4244 4754 | .header("content-type", "application/json")
|
4245 4755 | .body(::aws_smithy_http_server::body::Body::from(
|
4246 - | ::bytes::Bytes::from_static("{ \"float\" : 6.7 }".as_bytes()),
|
4756 + | ::bytes::Bytes::from_static("{ \"list\" : [\"xyz\"] }".as_bytes()),
|
4247 4757 | ))
|
4248 4758 | .unwrap();
|
4249 4759 | #[allow(unused_mut)]
|
4250 4760 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4251 4761 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4252 4762 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4253 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
4763 + | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
4254 4764 | let sender = sender.clone();
|
4255 4765 | async move {
|
4256 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
4766 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
4257 4767 | sender.send(()).await.expect("receiver dropped early");
|
4258 4768 | result
|
4259 4769 | }
|
4260 4770 | })
|
4261 4771 | .build_unchecked();
|
4262 4772 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4263 4773 | .await
|
4264 4774 | .expect("unable to make an HTTP request");
|
4265 4775 | ::pretty_assertions::assert_eq!(
|
4266 4776 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4267 4777 | http_response.status()
|
4268 4778 | );
|
4269 4779 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4270 4780 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4271 4781 | http_response.headers(),
|
4272 4782 | expected_headers,
|
4273 4783 | ));
|
4274 4784 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4275 4785 | .await
|
4276 4786 | .expect("unable to extract body to bytes");
|
4277 4787 | ::aws_smithy_protocol_test::assert_ok(
|
4278 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/float' failed to satisfy constraint: Member must be between 4.4 and 6.6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/float' failed to satisfy constraint: Member must be between 4.4 and 6.6, inclusive\", \"path\": \"/float\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4788 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/list/0' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/list/0' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/list/0\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4279 4789 | );
|
4280 4790 | }
|
4281 4791 | }
|
4282 - | /// When a float member does not fit within range bounds,
|
4792 + | /// When a map member's key does not match the specified pattern,
|
4283 4793 | /// the response should be a 400 ValidationException.
|
4284 - | /// Test ID: RestJsonMalformedRangeMinFloatOverride
|
4794 + | /// Test ID: RestJsonMalformedPatternMapKey_case0
|
4285 4795 | #[::tokio::test]
|
4286 - | #[should_panic]
|
4287 - | async fn rest_json_malformed_range_min_float_override_malformed_request() {
|
4796 + | #[::tracing_test::traced_test]
|
4797 + | async fn rest_json_malformed_pattern_map_key_case0_malformed_request() {
|
4288 4798 | {
|
4289 4799 | #[allow(unused_mut)]
|
4290 4800 | let mut http_request = http::Request::builder()
|
4291 - | .uri("/MalformedRangeOverride")
|
4801 + | .uri("/MalformedPattern")
|
4292 4802 | .method("POST")
|
4293 4803 | .header("content-type", "application/json")
|
4294 4804 | .body(::aws_smithy_http_server::body::Body::from(
|
4295 - | ::bytes::Bytes::from_static("{ \"minFloat\" : 4.3 }".as_bytes()),
|
4805 + | ::bytes::Bytes::from_static("{ \"map\" : { \"ABC\" : \"abc\" } }".as_bytes()),
|
4296 4806 | ))
|
4297 4807 | .unwrap();
|
4298 4808 | #[allow(unused_mut)]
|
4299 4809 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4300 4810 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4301 4811 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4302 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
4812 + | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
4303 4813 | let sender = sender.clone();
|
4304 4814 | async move {
|
4305 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
4815 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
4306 4816 | sender.send(()).await.expect("receiver dropped early");
|
4307 4817 | result
|
4308 4818 | }
|
4309 4819 | })
|
4310 4820 | .build_unchecked();
|
4311 4821 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4312 4822 | .await
|
4313 4823 | .expect("unable to make an HTTP request");
|
4314 4824 | ::pretty_assertions::assert_eq!(
|
4315 4825 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4316 4826 | http_response.status()
|
4317 4827 | );
|
4318 4828 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4319 4829 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4320 4830 | http_response.headers(),
|
4321 4831 | expected_headers,
|
4322 4832 | ));
|
4323 4833 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4324 4834 | .await
|
4325 4835 | .expect("unable to extract body to bytes");
|
4326 4836 | ::aws_smithy_protocol_test::assert_ok(
|
4327 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minFloat' failed to satisfy constraint: Member must be greater than or equal to 4.4\",\n \"fieldList\" : [{\"message\": \"Value at '/minFloat' failed to satisfy constraint: Member must be greater than or equal to 4.4\", \"path\": \"/minFloat\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4837 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/map' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4328 4838 | );
|
4329 4839 | }
|
4330 4840 | }
|
4331 - | /// When a float member does not fit within range bounds,
|
4841 + | /// When a map member's key does not match the specified pattern,
|
4332 4842 | /// the response should be a 400 ValidationException.
|
4333 - | /// Test ID: RestJsonMalformedRangeMaxFloatOverride
|
4843 + | /// Test ID: RestJsonMalformedPatternMapKey_case1
|
4334 4844 | #[::tokio::test]
|
4335 - | #[should_panic]
|
4336 - | async fn rest_json_malformed_range_max_float_override_malformed_request() {
|
4845 + | #[::tracing_test::traced_test]
|
4846 + | async fn rest_json_malformed_pattern_map_key_case1_malformed_request() {
|
4337 4847 | {
|
4338 4848 | #[allow(unused_mut)]
|
4339 4849 | let mut http_request = http::Request::builder()
|
4340 - | .uri("/MalformedRangeOverride")
|
4850 + | .uri("/MalformedPattern")
|
4341 4851 | .method("POST")
|
4342 4852 | .header("content-type", "application/json")
|
4343 4853 | .body(::aws_smithy_http_server::body::Body::from(
|
4344 - | ::bytes::Bytes::from_static("{ \"maxFloat\" : 6.7 }".as_bytes()),
|
4854 + | ::bytes::Bytes::from_static("{ \"map\" : { \"xyz\" : \"abc\" } }".as_bytes()),
|
4345 4855 | ))
|
4346 4856 | .unwrap();
|
4347 4857 | #[allow(unused_mut)]
|
4348 4858 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4349 4859 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4350 4860 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4351 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
4861 + | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
4352 4862 | let sender = sender.clone();
|
4353 4863 | async move {
|
4354 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
4864 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
4355 4865 | sender.send(()).await.expect("receiver dropped early");
|
4356 4866 | result
|
4357 4867 | }
|
4358 4868 | })
|
4359 4869 | .build_unchecked();
|
4360 4870 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4361 4871 | .await
|
4362 4872 | .expect("unable to make an HTTP request");
|
4363 4873 | ::pretty_assertions::assert_eq!(
|
4364 4874 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4365 4875 | http_response.status()
|
4366 4876 | );
|
4367 4877 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4368 4878 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4369 4879 | http_response.headers(),
|
4370 4880 | expected_headers,
|
4371 4881 | ));
|
4372 4882 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4373 4883 | .await
|
4374 4884 | .expect("unable to extract body to bytes");
|
4375 4885 | ::aws_smithy_protocol_test::assert_ok(
|
4376 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxFloat' failed to satisfy constraint: Member must be less than or equal to 6.6\",\n \"fieldList\" : [{\"message\": \"Value at '/maxFloat' failed to satisfy constraint: Member must be less than or equal to 6.6\", \"path\": \"/maxFloat\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4886 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/map' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4377 4887 | );
|
4378 4888 | }
|
4379 4889 | }
|
4380 - | /// When a short member does not fit within range bounds,
|
4890 + | /// When a map member's value does not match the specified pattern,
|
4381 4891 | /// the response should be a 400 ValidationException.
|
4382 - | /// Test ID: RestJsonMalformedRangeShortOverride_case0
|
4892 + | /// Test ID: RestJsonMalformedPatternMapValue_case0
|
4383 4893 | #[::tokio::test]
|
4384 - | async fn rest_json_malformed_range_short_override_case0_malformed_request() {
|
4894 + | #[::tracing_test::traced_test]
|
4895 + | async fn rest_json_malformed_pattern_map_value_case0_malformed_request() {
|
4385 4896 | {
|
4386 4897 | #[allow(unused_mut)]
|
4387 4898 | let mut http_request = http::Request::builder()
|
4388 - | .uri("/MalformedRangeOverride")
|
4899 + | .uri("/MalformedPattern")
|
4389 4900 | .method("POST")
|
4390 4901 | .header("content-type", "application/json")
|
4391 4902 | .body(::aws_smithy_http_server::body::Body::from(
|
4392 - | ::bytes::Bytes::from_static("{ \"short\" : 3 }".as_bytes()),
|
4903 + | ::bytes::Bytes::from_static("{ \"map\" : { \"abc\": \"ABC\" } }".as_bytes()),
|
4393 4904 | ))
|
4394 4905 | .unwrap();
|
4395 4906 | #[allow(unused_mut)]
|
4396 4907 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4397 4908 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4398 4909 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4399 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
4910 + | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
4400 4911 | let sender = sender.clone();
|
4401 4912 | async move {
|
4402 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
4913 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
4403 4914 | sender.send(()).await.expect("receiver dropped early");
|
4404 4915 | result
|
4405 4916 | }
|
4406 4917 | })
|
4407 4918 | .build_unchecked();
|
4408 4919 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4409 4920 | .await
|
4410 4921 | .expect("unable to make an HTTP request");
|
4411 4922 | ::pretty_assertions::assert_eq!(
|
4412 4923 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4413 4924 | http_response.status()
|
4414 4925 | );
|
4415 4926 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4416 4927 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4417 4928 | http_response.headers(),
|
4418 4929 | expected_headers,
|
4419 4930 | ));
|
4420 4931 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4421 4932 | .await
|
4422 4933 | .expect("unable to extract body to bytes");
|
4423 4934 | ::aws_smithy_protocol_test::assert_ok(
|
4424 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/short' failed to satisfy constraint: Member must be between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/short' failed to satisfy constraint: Member must be between 4 and 6, inclusive\", \"path\": \"/short\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4935 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map/abc' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/map/abc' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/map/abc\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4425 4936 | );
|
4426 4937 | }
|
4427 4938 | }
|
4428 - | /// When a short member does not fit within range bounds,
|
4939 + | /// When a map member's value does not match the specified pattern,
|
4429 4940 | /// the response should be a 400 ValidationException.
|
4430 - | /// Test ID: RestJsonMalformedRangeShortOverride_case1
|
4941 + | /// Test ID: RestJsonMalformedPatternMapValue_case1
|
4431 4942 | #[::tokio::test]
|
4432 - | async fn rest_json_malformed_range_short_override_case1_malformed_request() {
|
4943 + | #[::tracing_test::traced_test]
|
4944 + | async fn rest_json_malformed_pattern_map_value_case1_malformed_request() {
|
4433 4945 | {
|
4434 4946 | #[allow(unused_mut)]
|
4435 4947 | let mut http_request = http::Request::builder()
|
4436 - | .uri("/MalformedRangeOverride")
|
4948 + | .uri("/MalformedPattern")
|
4437 4949 | .method("POST")
|
4438 4950 | .header("content-type", "application/json")
|
4439 4951 | .body(::aws_smithy_http_server::body::Body::from(
|
4440 - | ::bytes::Bytes::from_static("{ \"short\" : 7 }".as_bytes()),
|
4952 + | ::bytes::Bytes::from_static("{ \"map\" : { \"abc\": \"xyz\" } }".as_bytes()),
|
4441 4953 | ))
|
4442 4954 | .unwrap();
|
4443 4955 | #[allow(unused_mut)]
|
4444 4956 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4445 4957 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4446 4958 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4447 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
4959 + | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
4448 4960 | let sender = sender.clone();
|
4449 4961 | async move {
|
4450 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
4962 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
4451 4963 | sender.send(()).await.expect("receiver dropped early");
|
4452 4964 | result
|
4453 4965 | }
|
4454 4966 | })
|
4455 4967 | .build_unchecked();
|
4456 4968 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4457 4969 | .await
|
4458 4970 | .expect("unable to make an HTTP request");
|
4459 4971 | ::pretty_assertions::assert_eq!(
|
4460 4972 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4461 4973 | http_response.status()
|
4462 4974 | );
|
4463 4975 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4464 4976 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4465 4977 | http_response.headers(),
|
4466 4978 | expected_headers,
|
4467 4979 | ));
|
4468 4980 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4469 4981 | .await
|
4470 4982 | .expect("unable to extract body to bytes");
|
4471 4983 | ::aws_smithy_protocol_test::assert_ok(
|
4472 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/short' failed to satisfy constraint: Member must be between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/short' failed to satisfy constraint: Member must be between 4 and 6, inclusive\", \"path\": \"/short\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4984 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map/abc' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/map/abc' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/map/abc\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4473 4985 | );
|
4474 4986 | }
|
4475 4987 | }
|
4476 - | /// When a short member does not fit within range bounds,
|
4988 + | /// When a union member's value does not match the specified pattern,
|
4477 4989 | /// the response should be a 400 ValidationException.
|
4478 - | /// Test ID: RestJsonMalformedRangeMinShortOverride
|
4990 + | /// Test ID: RestJsonMalformedPatternUnion_case0
|
4479 4991 | #[::tokio::test]
|
4480 - | async fn rest_json_malformed_range_min_short_override_malformed_request() {
|
4992 + | #[::tracing_test::traced_test]
|
4993 + | async fn rest_json_malformed_pattern_union_case0_malformed_request() {
|
4481 4994 | {
|
4482 4995 | #[allow(unused_mut)]
|
4483 4996 | let mut http_request = http::Request::builder()
|
4484 - | .uri("/MalformedRangeOverride")
|
4997 + | .uri("/MalformedPattern")
|
4485 4998 | .method("POST")
|
4486 4999 | .header("content-type", "application/json")
|
4487 5000 | .body(::aws_smithy_http_server::body::Body::from(
|
4488 - | ::bytes::Bytes::from_static("{ \"minShort\" : 3 }".as_bytes()),
|
5001 + | ::bytes::Bytes::from_static(
|
5002 + | "{ \"union\" : { \"first\": \"ABC\" } }".as_bytes(),
|
5003 + | ),
|
4489 5004 | ))
|
4490 5005 | .unwrap();
|
4491 5006 | #[allow(unused_mut)]
|
4492 5007 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4493 5008 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4494 5009 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4495 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
5010 + | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
4496 5011 | let sender = sender.clone();
|
4497 5012 | async move {
|
4498 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
5013 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
4499 5014 | sender.send(()).await.expect("receiver dropped early");
|
4500 5015 | result
|
4501 5016 | }
|
4502 5017 | })
|
4503 5018 | .build_unchecked();
|
4504 5019 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4505 5020 | .await
|
4506 5021 | .expect("unable to make an HTTP request");
|
4507 5022 | ::pretty_assertions::assert_eq!(
|
4508 5023 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4509 5024 | http_response.status()
|
4510 5025 | );
|
4511 5026 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4512 5027 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4513 5028 | http_response.headers(),
|
4514 5029 | expected_headers,
|
4515 5030 | ));
|
4516 5031 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4517 5032 | .await
|
4518 5033 | .expect("unable to extract body to bytes");
|
4519 5034 | ::aws_smithy_protocol_test::assert_ok(
|
4520 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minShort' failed to satisfy constraint: Member must be greater than or equal to 4\",\n \"fieldList\" : [{\"message\": \"Value at '/minShort' failed to satisfy constraint: Member must be greater than or equal to 4\", \"path\": \"/minShort\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5035 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/union/first' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/union/first' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/union/first\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4521 5036 | );
|
4522 5037 | }
|
4523 5038 | }
|
4524 - | /// When a short member does not fit within range bounds,
|
5039 + | /// When a union member's value does not match the specified pattern,
|
4525 5040 | /// the response should be a 400 ValidationException.
|
4526 - | /// Test ID: RestJsonMalformedRangeMaxShortOverride
|
5041 + | /// Test ID: RestJsonMalformedPatternUnion_case1
|
4527 5042 | #[::tokio::test]
|
4528 - | async fn rest_json_malformed_range_max_short_override_malformed_request() {
|
5043 + | #[::tracing_test::traced_test]
|
5044 + | async fn rest_json_malformed_pattern_union_case1_malformed_request() {
|
4529 5045 | {
|
4530 5046 | #[allow(unused_mut)]
|
4531 5047 | let mut http_request = http::Request::builder()
|
4532 - | .uri("/MalformedRangeOverride")
|
5048 + | .uri("/MalformedPattern")
|
4533 5049 | .method("POST")
|
4534 5050 | .header("content-type", "application/json")
|
4535 5051 | .body(::aws_smithy_http_server::body::Body::from(
|
4536 - | ::bytes::Bytes::from_static("{ \"maxShort\" : 7 }".as_bytes()),
|
5052 + | ::bytes::Bytes::from_static(
|
5053 + | "{ \"union\" : { \"first\": \"xyz\" } }".as_bytes(),
|
5054 + | ),
|
4537 5055 | ))
|
4538 5056 | .unwrap();
|
4539 5057 | #[allow(unused_mut)]
|
4540 5058 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4541 5059 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4542 5060 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4543 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
5061 + | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
4544 5062 | let sender = sender.clone();
|
4545 5063 | async move {
|
4546 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
5064 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
4547 5065 | sender.send(()).await.expect("receiver dropped early");
|
4548 5066 | result
|
4549 5067 | }
|
4550 5068 | })
|
4551 5069 | .build_unchecked();
|
4552 5070 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4553 5071 | .await
|
4554 5072 | .expect("unable to make an HTTP request");
|
4555 5073 | ::pretty_assertions::assert_eq!(
|
4556 5074 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4557 5075 | http_response.status()
|
4558 5076 | );
|
4559 5077 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4560 5078 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4561 5079 | http_response.headers(),
|
4562 5080 | expected_headers,
|
4563 5081 | ));
|
4564 5082 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4565 5083 | .await
|
4566 5084 | .expect("unable to extract body to bytes");
|
4567 5085 | ::aws_smithy_protocol_test::assert_ok(
|
4568 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxShort' failed to satisfy constraint: Member must be less than or equal to 6\",\n \"fieldList\" : [{\"message\": \"Value at '/maxShort' failed to satisfy constraint: Member must be less than or equal to 6\", \"path\": \"/maxShort\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5086 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/union/first' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/union/first' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/union/first\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4569 5087 | );
|
4570 5088 | }
|
4571 5089 | }
|
4572 - | /// When a integer member does not fit within range bounds,
|
4573 - | /// the response should be a 400 ValidationException.
|
4574 - | /// Test ID: RestJsonMalformedRangeIntegerOverride_case0
|
4575 - | #[::tokio::test]
|
4576 - | async fn rest_json_malformed_range_integer_override_case0_malformed_request() {
|
4577 - | {
|
4578 - | #[allow(unused_mut)]
|
4579 - | let mut http_request = http::Request::builder()
|
4580 - | .uri("/MalformedRangeOverride")
|
4581 - | .method("POST")
|
4582 - | .header("content-type", "application/json")
|
4583 - | .body(::aws_smithy_http_server::body::Body::from(
|
4584 - | ::bytes::Bytes::from_static("{ \"integer\" : 3 }".as_bytes()),
|
4585 - | ))
|
4586 - | .unwrap();
|
4587 - | #[allow(unused_mut)]
|
4588 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4589 - | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4590 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4591 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
4592 - | let sender = sender.clone();
|
4593 - | async move {
|
4594 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
4595 - | sender.send(()).await.expect("receiver dropped early");
|
4596 - | result
|
4597 - | }
|
4598 - | })
|
4599 - | .build_unchecked();
|
4600 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4601 - | .await
|
4602 - | .expect("unable to make an HTTP request");
|
4603 - | ::pretty_assertions::assert_eq!(
|
4604 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4605 - | http_response.status()
|
4606 - | );
|
4607 - | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4608 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4609 - | http_response.headers(),
|
4610 - | expected_headers,
|
4611 - | ));
|
4612 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4613 - | .await
|
4614 - | .expect("unable to extract body to bytes");
|
4615 - | ::aws_smithy_protocol_test::assert_ok(
|
4616 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/integer' failed to satisfy constraint: Member must be between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/integer' failed to satisfy constraint: Member must be between 4 and 6, inclusive\", \"path\": \"/integer\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4617 - | );
|
5090 + | }
|
5091 + |
|
5092 + | const CONTENT_TYPE_MALFORMEDLENGTHQUERYSTRING: ::mime::Mime = ::mime::APPLICATION_JSON;
|
5093 + | ::pin_project_lite::pin_project! {
|
5094 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
5095 + | /// [`MalformedLengthQueryStringInput`](crate::input::MalformedLengthQueryStringInput) using modelled bindings.
|
5096 + | pub struct MalformedLengthQueryStringInputFuture {
|
5097 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedLengthQueryStringInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
5098 + | }
|
5099 + | }
|
5100 + |
|
5101 + | impl std::future::Future for MalformedLengthQueryStringInputFuture {
|
5102 + | type Output = Result<
|
5103 + | crate::input::MalformedLengthQueryStringInput,
|
5104 + | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
5105 + | >;
|
5106 + |
|
5107 + | fn poll(
|
5108 + | self: std::pin::Pin<&mut Self>,
|
5109 + | cx: &mut std::task::Context<'_>,
|
5110 + | ) -> std::task::Poll<Self::Output> {
|
5111 + | let this = self.project();
|
5112 + | this.inner.as_mut().poll(cx)
|
5113 + | }
|
5114 + | }
|
5115 + |
|
5116 + | impl<B>
|
5117 + | ::aws_smithy_http_server::request::FromRequest<
|
5118 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
5119 + | B,
|
5120 + | > for crate::input::MalformedLengthQueryStringInput
|
5121 + | where
|
5122 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
5123 + | B: 'static,
|
5124 + |
|
5125 + | B::Data: Send,
|
5126 + | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
5127 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
5128 + | {
|
5129 + | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
5130 + | type Future = MalformedLengthQueryStringInputFuture;
|
5131 + |
|
5132 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
5133 + | let fut = async move {
|
5134 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
5135 + | request.headers(),
|
5136 + | &CONTENT_TYPE_MALFORMEDLENGTHQUERYSTRING,
|
5137 + | ) {
|
5138 + | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
5139 + | }
|
5140 + | crate::protocol_serde::shape_malformed_length_query_string::de_malformed_length_query_string_http_request(request)
|
5141 + | .await
|
5142 + | .map_err(Into::into)
|
5143 + | };
|
5144 + | use ::futures_util::future::TryFutureExt;
|
5145 + | let fut = fut.map_err(
|
5146 + | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
5147 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
5148 + | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
5149 + | e,
|
5150 + | )
|
5151 + | },
|
5152 + | );
|
5153 + | MalformedLengthQueryStringInputFuture {
|
5154 + | inner: Box::pin(fut),
|
4618 5155 | }
|
4619 5156 | }
|
4620 - | /// When a integer member does not fit within range bounds,
|
5157 + | }
|
5158 + | impl
|
5159 + | ::aws_smithy_http_server::response::IntoResponse<
|
5160 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
5161 + | > for crate::output::MalformedLengthQueryStringOutput
|
5162 + | {
|
5163 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
5164 + | match crate::protocol_serde::shape_malformed_length_query_string::ser_malformed_length_query_string_http_response(self) {
|
5165 + | Ok(response) => response,
|
5166 + | Err(e) => {
|
5167 + | ::tracing::error!(error = %e, "failed to serialize response");
|
5168 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
5169 + | }
|
5170 + | }
|
5171 + | }
|
5172 + | }
|
5173 + | impl
|
5174 + | ::aws_smithy_http_server::response::IntoResponse<
|
5175 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
5176 + | > for crate::error::MalformedLengthQueryStringError
|
5177 + | {
|
5178 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
5179 + | match crate::protocol_serde::shape_malformed_length_query_string::ser_malformed_length_query_string_http_error(&self) {
|
5180 + | Ok(mut response) => {
|
5181 + | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
5182 + | response
|
5183 + | },
|
5184 + | Err(e) => {
|
5185 + | ::tracing::error!(error = %e, "failed to serialize response");
|
5186 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
5187 + | }
|
5188 + | }
|
5189 + | }
|
5190 + | }
|
5191 + |
|
5192 + | #[allow(unreachable_code, unused_variables)]
|
5193 + | #[cfg(test)]
|
5194 + | mod malformed_length_query_string_test {
|
5195 + |
|
5196 + | /// When a required member has no value in the query string,
|
4621 5197 | /// the response should be a 400 ValidationException.
|
4622 - | /// Test ID: RestJsonMalformedRangeIntegerOverride_case1
|
5198 + | /// Test ID: RestJsonMalformedLengthQueryStringNoValue
|
4623 5199 | #[::tokio::test]
|
4624 - | async fn rest_json_malformed_range_integer_override_case1_malformed_request() {
|
5200 + | #[::tracing_test::traced_test]
|
5201 + | async fn rest_json_malformed_length_query_string_no_value_malformed_request() {
|
4625 5202 | {
|
4626 5203 | #[allow(unused_mut)]
|
4627 5204 | let mut http_request = http::Request::builder()
|
4628 - | .uri("/MalformedRangeOverride")
|
5205 + | .uri("/MalformedLengthQueryString")
|
4629 5206 | .method("POST")
|
4630 5207 | .header("content-type", "application/json")
|
4631 5208 | .body(::aws_smithy_http_server::body::Body::from(
|
4632 - | ::bytes::Bytes::from_static("{ \"integer\" : 7 }".as_bytes()),
|
5209 + | ::bytes::Bytes::from_static("{}".as_bytes()),
|
4633 5210 | ))
|
4634 5211 | .unwrap();
|
5212 + | *http_request.uri_mut() = "/MalformedLengthQueryString?string".parse().unwrap();
|
4635 5213 | #[allow(unused_mut)]
|
4636 5214 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4637 5215 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4638 5216 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4639 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
5217 + | .malformed_length_query_string(move |input: crate::input::MalformedLengthQueryStringInput| {
|
4640 5218 | let sender = sender.clone();
|
4641 5219 | async move {
|
4642 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
5220 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthQueryStringOutput, crate::error::MalformedLengthQueryStringError> };
|
4643 5221 | sender.send(()).await.expect("receiver dropped early");
|
4644 5222 | result
|
4645 5223 | }
|
4646 5224 | })
|
4647 5225 | .build_unchecked();
|
4648 5226 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4649 5227 | .await
|
4650 5228 | .expect("unable to make an HTTP request");
|
4651 5229 | ::pretty_assertions::assert_eq!(
|
4652 5230 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4653 5231 | http_response.status()
|
4654 5232 | );
|
4655 5233 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4656 5234 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4657 5235 | http_response.headers(),
|
4658 5236 | expected_headers,
|
4659 5237 | ));
|
4660 5238 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4661 5239 | .await
|
4662 5240 | .expect("unable to extract body to bytes");
|
4663 5241 | ::aws_smithy_protocol_test::assert_ok(
|
4664 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/integer' failed to satisfy constraint: Member must be between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/integer' failed to satisfy constraint: Member must be between 4 and 6, inclusive\", \"path\": \"/integer\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5242 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 0 at '/string' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 0 at '/string' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4665 5243 | );
|
4666 5244 | }
|
4667 5245 | }
|
4668 - | /// When a integer member does not fit within range bounds,
|
4669 - | /// the response should be a 400 ValidationException.
|
4670 - | /// Test ID: RestJsonMalformedRangeMinIntegerOverride
|
5246 + | }
|
5247 + |
|
5248 + | const CONTENT_TYPE_MALFORMEDLENGTHOVERRIDE: ::mime::Mime = ::mime::APPLICATION_JSON;
|
5249 + | ::pin_project_lite::pin_project! {
|
5250 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
5251 + | /// [`MalformedLengthOverrideInput`](crate::input::MalformedLengthOverrideInput) using modelled bindings.
|
5252 + | pub struct MalformedLengthOverrideInputFuture {
|
5253 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedLengthOverrideInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
5254 + | }
|
5255 + | }
|
5256 + |
|
5257 + | impl std::future::Future for MalformedLengthOverrideInputFuture {
|
5258 + | type Output = Result<
|
5259 + | crate::input::MalformedLengthOverrideInput,
|
5260 + | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
5261 + | >;
|
5262 + |
|
5263 + | fn poll(
|
5264 + | self: std::pin::Pin<&mut Self>,
|
5265 + | cx: &mut std::task::Context<'_>,
|
5266 + | ) -> std::task::Poll<Self::Output> {
|
5267 + | let this = self.project();
|
5268 + | this.inner.as_mut().poll(cx)
|
5269 + | }
|
5270 + | }
|
5271 + |
|
5272 + | impl<B>
|
5273 + | ::aws_smithy_http_server::request::FromRequest<
|
5274 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
5275 + | B,
|
5276 + | > for crate::input::MalformedLengthOverrideInput
|
5277 + | where
|
5278 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
5279 + | B: 'static,
|
5280 + |
|
5281 + | B::Data: Send,
|
5282 + | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
5283 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
5284 + | {
|
5285 + | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
5286 + | type Future = MalformedLengthOverrideInputFuture;
|
5287 + |
|
5288 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
5289 + | let fut = async move {
|
5290 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
5291 + | request.headers(),
|
5292 + | &CONTENT_TYPE_MALFORMEDLENGTHOVERRIDE,
|
5293 + | ) {
|
5294 + | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
5295 + | }
|
5296 + | crate::protocol_serde::shape_malformed_length_override::de_malformed_length_override_http_request(request)
|
5297 + | .await
|
5298 + | .map_err(Into::into)
|
5299 + | };
|
5300 + | use ::futures_util::future::TryFutureExt;
|
5301 + | let fut = fut.map_err(
|
5302 + | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
5303 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
5304 + | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
5305 + | e,
|
5306 + | )
|
5307 + | },
|
5308 + | );
|
5309 + | MalformedLengthOverrideInputFuture {
|
5310 + | inner: Box::pin(fut),
|
5311 + | }
|
5312 + | }
|
5313 + | }
|
5314 + | impl
|
5315 + | ::aws_smithy_http_server::response::IntoResponse<
|
5316 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
5317 + | > for crate::output::MalformedLengthOverrideOutput
|
5318 + | {
|
5319 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
5320 + | match crate::protocol_serde::shape_malformed_length_override::ser_malformed_length_override_http_response(self) {
|
5321 + | Ok(response) => response,
|
5322 + | Err(e) => {
|
5323 + | ::tracing::error!(error = %e, "failed to serialize response");
|
5324 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
5325 + | }
|
5326 + | }
|
5327 + | }
|
5328 + | }
|
5329 + | impl
|
5330 + | ::aws_smithy_http_server::response::IntoResponse<
|
5331 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
5332 + | > for crate::error::MalformedLengthOverrideError
|
5333 + | {
|
5334 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
5335 + | match crate::protocol_serde::shape_malformed_length_override::ser_malformed_length_override_http_error(&self) {
|
5336 + | Ok(mut response) => {
|
5337 + | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
5338 + | response
|
5339 + | },
|
5340 + | Err(e) => {
|
5341 + | ::tracing::error!(error = %e, "failed to serialize response");
|
5342 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
5343 + | }
|
5344 + | }
|
5345 + | }
|
5346 + | }
|
5347 + |
|
5348 + | #[allow(unreachable_code, unused_variables)]
|
5349 + | #[cfg(test)]
|
5350 + | mod malformed_length_override_test {
|
5351 + |
|
5352 + | /// When a blob member does not fit within length bounds,
|
5353 + | /// the response should be a 400 ValidationException.
|
5354 + | /// Test ID: RestJsonMalformedLengthBlobOverride_case0
|
4671 5355 | #[::tokio::test]
|
4672 - | async fn rest_json_malformed_range_min_integer_override_malformed_request() {
|
5356 + | #[::tracing_test::traced_test]
|
5357 + | async fn rest_json_malformed_length_blob_override_case0_malformed_request() {
|
4673 5358 | {
|
4674 5359 | #[allow(unused_mut)]
|
4675 5360 | let mut http_request = http::Request::builder()
|
4676 - | .uri("/MalformedRangeOverride")
|
5361 + | .uri("/MalformedLengthOverride")
|
4677 5362 | .method("POST")
|
4678 5363 | .header("content-type", "application/json")
|
4679 5364 | .body(::aws_smithy_http_server::body::Body::from(
|
4680 - | ::bytes::Bytes::from_static("{ \"minInteger\" : 3 }".as_bytes()),
|
5365 + | ::bytes::Bytes::from_static("{ \"blob\" : \"YWJj\" }".as_bytes()),
|
4681 5366 | ))
|
4682 5367 | .unwrap();
|
4683 5368 | #[allow(unused_mut)]
|
4684 5369 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4685 5370 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4686 5371 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4687 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
5372 + | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
4688 5373 | let sender = sender.clone();
|
4689 5374 | async move {
|
4690 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
5375 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
4691 5376 | sender.send(()).await.expect("receiver dropped early");
|
4692 5377 | result
|
4693 5378 | }
|
4694 5379 | })
|
4695 5380 | .build_unchecked();
|
4696 5381 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4697 5382 | .await
|
4698 5383 | .expect("unable to make an HTTP request");
|
4699 5384 | ::pretty_assertions::assert_eq!(
|
4700 5385 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4701 5386 | http_response.status()
|
4702 5387 | );
|
4703 5388 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4704 5389 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4705 5390 | http_response.headers(),
|
4706 5391 | expected_headers,
|
4707 5392 | ));
|
4708 5393 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4709 5394 | .await
|
4710 5395 | .expect("unable to extract body to bytes");
|
4711 5396 | ::aws_smithy_protocol_test::assert_ok(
|
4712 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minInteger' failed to satisfy constraint: Member must be greater than or equal to 4\",\n \"fieldList\" : [{\"message\": \"Value at '/minInteger' failed to satisfy constraint: Member must be greater than or equal to 4\", \"path\": \"/minInteger\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5397 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 3 at '/blob' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 3 at '/blob' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\", \"path\": \"/blob\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4713 5398 | );
|
4714 5399 | }
|
4715 5400 | }
|
4716 - | /// When a integer member does not fit within range bounds,
|
5401 + | /// When a blob member does not fit within length bounds,
|
4717 5402 | /// the response should be a 400 ValidationException.
|
4718 - | /// Test ID: RestJsonMalformedRangeMaxIntegerOverride
|
5403 + | /// Test ID: RestJsonMalformedLengthBlobOverride_case1
|
4719 5404 | #[::tokio::test]
|
4720 - | async fn rest_json_malformed_range_max_integer_override_malformed_request() {
|
5405 + | #[::tracing_test::traced_test]
|
5406 + | async fn rest_json_malformed_length_blob_override_case1_malformed_request() {
|
4721 5407 | {
|
4722 5408 | #[allow(unused_mut)]
|
4723 5409 | let mut http_request = http::Request::builder()
|
4724 - | .uri("/MalformedRangeOverride")
|
5410 + | .uri("/MalformedLengthOverride")
|
4725 5411 | .method("POST")
|
4726 5412 | .header("content-type", "application/json")
|
4727 5413 | .body(::aws_smithy_http_server::body::Body::from(
|
4728 - | ::bytes::Bytes::from_static("{ \"maxInteger\" : 7 }".as_bytes()),
|
5414 + | ::bytes::Bytes::from_static("{ \"blob\" : \"YWJjZGVmZw==\" }".as_bytes()),
|
4729 5415 | ))
|
4730 5416 | .unwrap();
|
4731 5417 | #[allow(unused_mut)]
|
4732 5418 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4733 5419 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4734 5420 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4735 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
5421 + | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
4736 5422 | let sender = sender.clone();
|
4737 5423 | async move {
|
4738 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
5424 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
4739 5425 | sender.send(()).await.expect("receiver dropped early");
|
4740 5426 | result
|
4741 5427 | }
|
4742 5428 | })
|
4743 5429 | .build_unchecked();
|
4744 5430 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4745 5431 | .await
|
4746 5432 | .expect("unable to make an HTTP request");
|
4747 5433 | ::pretty_assertions::assert_eq!(
|
4748 5434 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4749 5435 | http_response.status()
|
4750 5436 | );
|
4751 5437 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4752 5438 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4753 5439 | http_response.headers(),
|
4754 5440 | expected_headers,
|
4755 5441 | ));
|
4756 5442 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4757 5443 | .await
|
4758 5444 | .expect("unable to extract body to bytes");
|
4759 5445 | ::aws_smithy_protocol_test::assert_ok(
|
4760 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxInteger' failed to satisfy constraint: Member must be less than or equal to 6\",\n \"fieldList\" : [{\"message\": \"Value at '/maxInteger' failed to satisfy constraint: Member must be less than or equal to 6\", \"path\": \"/maxInteger\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5446 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 7 at '/blob' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 7 at '/blob' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\", \"path\": \"/blob\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4761 5447 | );
|
4762 5448 | }
|
4763 5449 | }
|
4764 - | /// When a long member does not fit within range bounds,
|
5450 + | /// When a string member does not fit within length bounds,
|
4765 5451 | /// the response should be a 400 ValidationException.
|
4766 - | /// Test ID: RestJsonMalformedRangeLongOverride_case0
|
5452 + | /// Test ID: RestJsonMalformedLengthStringOverride_case0
|
4767 5453 | #[::tokio::test]
|
4768 - | async fn rest_json_malformed_range_long_override_case0_malformed_request() {
|
5454 + | #[::tracing_test::traced_test]
|
5455 + | async fn rest_json_malformed_length_string_override_case0_malformed_request() {
|
4769 5456 | {
|
4770 5457 | #[allow(unused_mut)]
|
4771 5458 | let mut http_request = http::Request::builder()
|
4772 - | .uri("/MalformedRangeOverride")
|
5459 + | .uri("/MalformedLengthOverride")
|
4773 5460 | .method("POST")
|
4774 5461 | .header("content-type", "application/json")
|
4775 5462 | .body(::aws_smithy_http_server::body::Body::from(
|
4776 - | ::bytes::Bytes::from_static("{ \"long\" : 3 }".as_bytes()),
|
5463 + | ::bytes::Bytes::from_static("{ \"string\" : \"abc\" }".as_bytes()),
|
4777 5464 | ))
|
4778 5465 | .unwrap();
|
4779 5466 | #[allow(unused_mut)]
|
4780 5467 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4781 5468 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4782 5469 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4783 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
5470 + | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
4784 5471 | let sender = sender.clone();
|
4785 5472 | async move {
|
4786 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
5473 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
4787 5474 | sender.send(()).await.expect("receiver dropped early");
|
4788 5475 | result
|
4789 5476 | }
|
4790 5477 | })
|
4791 5478 | .build_unchecked();
|
4792 5479 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4793 5480 | .await
|
4794 5481 | .expect("unable to make an HTTP request");
|
4795 5482 | ::pretty_assertions::assert_eq!(
|
4796 5483 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4797 5484 | http_response.status()
|
4798 5485 | );
|
4799 5486 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4800 5487 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4801 5488 | http_response.headers(),
|
4802 5489 | expected_headers,
|
4803 5490 | ));
|
4804 5491 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4805 5492 | .await
|
4806 5493 | .expect("unable to extract body to bytes");
|
4807 5494 | ::aws_smithy_protocol_test::assert_ok(
|
4808 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/long' failed to satisfy constraint: Member must be between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/long' failed to satisfy constraint: Member must be between 4 and 6, inclusive\", \"path\": \"/long\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5495 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 3 at '/string' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 3 at '/string' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4809 5496 | );
|
4810 5497 | }
|
4811 5498 | }
|
4812 - | /// When a long member does not fit within range bounds,
|
5499 + | /// When a string member does not fit within length bounds,
|
4813 5500 | /// the response should be a 400 ValidationException.
|
4814 - | /// Test ID: RestJsonMalformedRangeLongOverride_case1
|
5501 + | /// Test ID: RestJsonMalformedLengthStringOverride_case1
|
4815 5502 | #[::tokio::test]
|
4816 - | async fn rest_json_malformed_range_long_override_case1_malformed_request() {
|
5503 + | #[::tracing_test::traced_test]
|
5504 + | async fn rest_json_malformed_length_string_override_case1_malformed_request() {
|
4817 5505 | {
|
4818 5506 | #[allow(unused_mut)]
|
4819 5507 | let mut http_request = http::Request::builder()
|
4820 - | .uri("/MalformedRangeOverride")
|
5508 + | .uri("/MalformedLengthOverride")
|
4821 5509 | .method("POST")
|
4822 5510 | .header("content-type", "application/json")
|
4823 5511 | .body(::aws_smithy_http_server::body::Body::from(
|
4824 - | ::bytes::Bytes::from_static("{ \"long\" : 7 }".as_bytes()),
|
5512 + | ::bytes::Bytes::from_static("{ \"string\" : \"abcdefg\" }".as_bytes()),
|
4825 5513 | ))
|
4826 5514 | .unwrap();
|
4827 5515 | #[allow(unused_mut)]
|
4828 5516 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4829 5517 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4830 5518 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4831 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
5519 + | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
4832 5520 | let sender = sender.clone();
|
4833 5521 | async move {
|
4834 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
5522 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
4835 5523 | sender.send(()).await.expect("receiver dropped early");
|
4836 5524 | result
|
4837 5525 | }
|
4838 5526 | })
|
4839 5527 | .build_unchecked();
|
4840 5528 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4841 5529 | .await
|
4842 5530 | .expect("unable to make an HTTP request");
|
4843 5531 | ::pretty_assertions::assert_eq!(
|
4844 5532 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4845 5533 | http_response.status()
|
4846 5534 | );
|
4847 5535 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4848 5536 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4849 5537 | http_response.headers(),
|
4850 5538 | expected_headers,
|
4851 5539 | ));
|
4852 5540 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4853 5541 | .await
|
4854 5542 | .expect("unable to extract body to bytes");
|
4855 5543 | ::aws_smithy_protocol_test::assert_ok(
|
4856 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/long' failed to satisfy constraint: Member must be between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/long' failed to satisfy constraint: Member must be between 4 and 6, inclusive\", \"path\": \"/long\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5544 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 7 at '/string' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 7 at '/string' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4857 5545 | );
|
4858 5546 | }
|
4859 5547 | }
|
4860 - | /// When a long member does not fit within range bounds,
|
5548 + | /// When a string member does not fit within length bounds,
|
4861 5549 | /// the response should be a 400 ValidationException.
|
4862 - | /// Test ID: RestJsonMalformedRangeMinLongOverride
|
5550 + | /// Test ID: RestJsonMalformedLengthStringOverride_case2
|
4863 5551 | #[::tokio::test]
|
4864 - | async fn rest_json_malformed_range_min_long_override_malformed_request() {
|
5552 + | #[::tracing_test::traced_test]
|
5553 + | async fn rest_json_malformed_length_string_override_case2_malformed_request() {
|
4865 5554 | {
|
4866 5555 | #[allow(unused_mut)]
|
4867 5556 | let mut http_request = http::Request::builder()
|
4868 - | .uri("/MalformedRangeOverride")
|
5557 + | .uri("/MalformedLengthOverride")
|
4869 5558 | .method("POST")
|
4870 5559 | .header("content-type", "application/json")
|
4871 5560 | .body(::aws_smithy_http_server::body::Body::from(
|
4872 - | ::bytes::Bytes::from_static("{ \"minLong\" : 3 }".as_bytes()),
|
5561 + | ::bytes::Bytes::from_static("{ \"string\" : \"👍👍👍\" }".as_bytes()),
|
4873 5562 | ))
|
4874 5563 | .unwrap();
|
4875 5564 | #[allow(unused_mut)]
|
4876 5565 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4877 5566 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4878 5567 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4879 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
5568 + | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
4880 5569 | let sender = sender.clone();
|
4881 5570 | async move {
|
4882 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
5571 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
4883 5572 | sender.send(()).await.expect("receiver dropped early");
|
4884 5573 | result
|
4885 5574 | }
|
4886 5575 | })
|
4887 5576 | .build_unchecked();
|
4888 5577 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4889 5578 | .await
|
4890 5579 | .expect("unable to make an HTTP request");
|
4891 5580 | ::pretty_assertions::assert_eq!(
|
4892 5581 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4893 5582 | http_response.status()
|
4894 5583 | );
|
4895 5584 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4896 5585 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4897 5586 | http_response.headers(),
|
4898 5587 | expected_headers,
|
4899 5588 | ));
|
4900 5589 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4901 5590 | .await
|
4902 5591 | .expect("unable to extract body to bytes");
|
4903 5592 | ::aws_smithy_protocol_test::assert_ok(
|
4904 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minLong' failed to satisfy constraint: Member must be greater than or equal to 4\",\n \"fieldList\" : [{\"message\": \"Value at '/minLong' failed to satisfy constraint: Member must be greater than or equal to 4\", \"path\": \"/minLong\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5593 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 3 at '/string' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 3 at '/string' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4905 5594 | );
|
4906 5595 | }
|
4907 5596 | }
|
4908 - | /// When a long member does not fit within range bounds,
|
5597 + | /// When a string member does not fit within length bounds,
|
4909 5598 | /// the response should be a 400 ValidationException.
|
4910 - | /// Test ID: RestJsonMalformedRangeMaxLongOverride
|
5599 + | /// Test ID: RestJsonMalformedLengthMinStringOverride
|
4911 5600 | #[::tokio::test]
|
4912 - | async fn rest_json_malformed_range_max_long_override_malformed_request() {
|
5601 + | #[::tracing_test::traced_test]
|
5602 + | async fn rest_json_malformed_length_min_string_override_malformed_request() {
|
4913 5603 | {
|
4914 5604 | #[allow(unused_mut)]
|
4915 5605 | let mut http_request = http::Request::builder()
|
4916 - | .uri("/MalformedRangeOverride")
|
5606 + | .uri("/MalformedLengthOverride")
|
4917 5607 | .method("POST")
|
4918 5608 | .header("content-type", "application/json")
|
4919 5609 | .body(::aws_smithy_http_server::body::Body::from(
|
4920 - | ::bytes::Bytes::from_static("{ \"maxLong\" : 7 }".as_bytes()),
|
5610 + | ::bytes::Bytes::from_static("{ \"minString\" : \"abc\" }".as_bytes()),
|
4921 5611 | ))
|
4922 5612 | .unwrap();
|
4923 5613 | #[allow(unused_mut)]
|
4924 5614 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4925 5615 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4926 5616 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4927 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
5617 + | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
4928 5618 | let sender = sender.clone();
|
4929 5619 | async move {
|
4930 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
5620 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
4931 5621 | sender.send(()).await.expect("receiver dropped early");
|
4932 5622 | result
|
4933 5623 | }
|
4934 5624 | })
|
4935 5625 | .build_unchecked();
|
4936 5626 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4937 5627 | .await
|
4938 5628 | .expect("unable to make an HTTP request");
|
4939 5629 | ::pretty_assertions::assert_eq!(
|
4940 5630 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4941 5631 | http_response.status()
|
4942 5632 | );
|
4943 5633 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4944 5634 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4945 5635 | http_response.headers(),
|
4946 5636 | expected_headers,
|
4947 5637 | ));
|
4948 5638 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4949 5639 | .await
|
4950 5640 | .expect("unable to extract body to bytes");
|
4951 5641 | ::aws_smithy_protocol_test::assert_ok(
|
4952 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxLong' failed to satisfy constraint: Member must be less than or equal to 6\",\n \"fieldList\" : [{\"message\": \"Value at '/maxLong' failed to satisfy constraint: Member must be less than or equal to 6\", \"path\": \"/maxLong\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5642 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 3 at '/minString' failed to satisfy constraint: Member must have length greater than or equal to 4\",\n \"fieldList\" : [{\"message\": \"Value with length 3 at '/minString' failed to satisfy constraint: Member must have length greater than or equal to 4\", \"path\": \"/minString\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4953 5643 | );
|
4954 5644 | }
|
4955 5645 | }
|
4956 - | }
|
4957 - | #[cfg(test)]
|
4958 - | #[allow(unreachable_code, unused_variables)]
|
4959 - | mod server_malformed_required_test {
|
4960 - | /// When a required member is not set in the message body,
|
5646 + | /// When a string member does not fit within length bounds,
|
4961 5647 | /// the response should be a 400 ValidationException.
|
4962 - | /// Test ID: RestJsonMalformedRequiredBodyUnset
|
5648 + | /// Test ID: RestJsonMalformedLengthMaxStringOverride
|
4963 5649 | #[::tokio::test]
|
4964 - | async fn rest_json_malformed_required_body_unset_malformed_request() {
|
5650 + | #[::tracing_test::traced_test]
|
5651 + | async fn rest_json_malformed_length_max_string_override_malformed_request() {
|
4965 5652 | {
|
4966 5653 | #[allow(unused_mut)]
|
4967 5654 | let mut http_request = http::Request::builder()
|
4968 - | .uri("/MalformedRequired")
|
5655 + | .uri("/MalformedLengthOverride")
|
4969 5656 | .method("POST")
|
4970 5657 | .header("content-type", "application/json")
|
4971 - | .header("string-in-headers", "abc")
|
4972 5658 | .body(::aws_smithy_http_server::body::Body::from(
|
4973 - | ::bytes::Bytes::from_static("{ }".as_bytes()),
|
5659 + | ::bytes::Bytes::from_static("{ \"maxString\" : \"abcdefg\" }".as_bytes()),
|
4974 5660 | ))
|
4975 5661 | .unwrap();
|
4976 - | *http_request.uri_mut() = "/MalformedRequired?stringInQuery=abc".parse().unwrap();
|
4977 5662 | #[allow(unused_mut)]
|
4978 5663 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4979 5664 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4980 5665 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4981 - | .malformed_required(move |input: crate::input::MalformedRequiredInput| {
|
5666 + | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
4982 5667 | let sender = sender.clone();
|
4983 5668 | async move {
|
4984 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRequiredOutput, crate::error::MalformedRequiredError> };
|
5669 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
4985 5670 | sender.send(()).await.expect("receiver dropped early");
|
4986 5671 | result
|
4987 5672 | }
|
4988 5673 | })
|
4989 5674 | .build_unchecked();
|
4990 5675 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4991 5676 | .await
|
4992 5677 | .expect("unable to make an HTTP request");
|
4993 5678 | ::pretty_assertions::assert_eq!(
|
4994 5679 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4995 5680 | http_response.status()
|
4996 5681 | );
|
4997 5682 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4998 5683 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4999 5684 | http_response.headers(),
|
5000 5685 | expected_headers,
|
5001 5686 | ));
|
5002 5687 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5003 5688 | .await
|
5004 5689 | .expect("unable to extract body to bytes");
|
5005 5690 | ::aws_smithy_protocol_test::assert_ok(
|
5006 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/string' failed to satisfy constraint: Member must not be null\",\n \"fieldList\" : [{\"message\": \"Value at '/string' failed to satisfy constraint: Member must not be null\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5691 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 7 at '/maxString' failed to satisfy constraint: Member must have length less than or equal to 6\",\n \"fieldList\" : [{\"message\": \"Value with length 7 at '/maxString' failed to satisfy constraint: Member must have length less than or equal to 6\", \"path\": \"/maxString\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5007 5692 | );
|
5008 5693 | }
|
5009 5694 | }
|
5010 - | /// When a required member is set to null in the message body,
|
5695 + | /// When a list member does not fit within length bounds,
|
5011 5696 | /// the response should be a 400 ValidationException.
|
5012 - | /// Test ID: RestJsonMalformedRequiredBodyExplicitNull
|
5697 + | /// Test ID: RestJsonMalformedLengthListOverride_case0
|
5013 5698 | #[::tokio::test]
|
5014 - | async fn rest_json_malformed_required_body_explicit_null_malformed_request() {
|
5699 + | #[::tracing_test::traced_test]
|
5700 + | async fn rest_json_malformed_length_list_override_case0_malformed_request() {
|
5015 5701 | {
|
5016 5702 | #[allow(unused_mut)]
|
5017 5703 | let mut http_request = http::Request::builder()
|
5018 - | .uri("/MalformedRequired")
|
5704 + | .uri("/MalformedLengthOverride")
|
5019 5705 | .method("POST")
|
5020 5706 | .header("content-type", "application/json")
|
5021 - | .header("string-in-headers", "abc")
|
5022 5707 | .body(::aws_smithy_http_server::body::Body::from(
|
5023 - | ::bytes::Bytes::from_static("{ \"string\": null }".as_bytes()),
|
5708 + | ::bytes::Bytes::from_static(
|
5709 + | "{ \"list\" : [\"abc\", \"def\", \"ghi\"] }".as_bytes(),
|
5710 + | ),
|
5024 5711 | ))
|
5025 5712 | .unwrap();
|
5026 - | *http_request.uri_mut() = "/MalformedRequired?stringInQuery=abc".parse().unwrap();
|
5027 5713 | #[allow(unused_mut)]
|
5028 5714 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5029 5715 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5030 5716 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5031 - | .malformed_required(move |input: crate::input::MalformedRequiredInput| {
|
5717 + | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
5032 5718 | let sender = sender.clone();
|
5033 5719 | async move {
|
5034 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRequiredOutput, crate::error::MalformedRequiredError> };
|
5720 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
5035 5721 | sender.send(()).await.expect("receiver dropped early");
|
5036 5722 | result
|
5037 5723 | }
|
5038 5724 | })
|
5039 5725 | .build_unchecked();
|
5040 5726 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5041 5727 | .await
|
5042 5728 | .expect("unable to make an HTTP request");
|
5043 5729 | ::pretty_assertions::assert_eq!(
|
5044 5730 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5045 5731 | http_response.status()
|
5046 5732 | );
|
5047 5733 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5048 5734 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5049 5735 | http_response.headers(),
|
5050 5736 | expected_headers,
|
5051 5737 | ));
|
5052 5738 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5053 5739 | .await
|
5054 5740 | .expect("unable to extract body to bytes");
|
5055 5741 | ::aws_smithy_protocol_test::assert_ok(
|
5056 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/string' failed to satisfy constraint: Member must not be null\",\n \"fieldList\" : [{\"message\": \"Value at '/string' failed to satisfy constraint: Member must not be null\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5742 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 3 at '/list' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 3 at '/list' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\", \"path\": \"/list\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5057 5743 | );
|
5058 5744 | }
|
5059 5745 | }
|
5060 - | /// When a required member is not set in headers,
|
5746 + | /// When a list member does not fit within length bounds,
|
5061 5747 | /// the response should be a 400 ValidationException.
|
5062 - | /// Test ID: RestJsonMalformedRequiredHeaderUnset
|
5748 + | /// Test ID: RestJsonMalformedLengthListOverride_case1
|
5063 5749 | #[::tokio::test]
|
5064 - | async fn rest_json_malformed_required_header_unset_malformed_request() {
|
5750 + | #[::tracing_test::traced_test]
|
5751 + | async fn rest_json_malformed_length_list_override_case1_malformed_request() {
|
5065 5752 | {
|
5066 5753 | #[allow(unused_mut)]
|
5067 - | let mut http_request = http::Request::builder()
|
5068 - | .uri("/MalformedRequired")
|
5069 - | .method("POST")
|
5070 - | .header("content-type", "application/json")
|
5071 - | .body(::aws_smithy_http_server::body::Body::from(
|
5072 - | ::bytes::Bytes::from_static("{ \"string\": \"abc\" }".as_bytes()),
|
5073 - | ))
|
5074 - | .unwrap();
|
5075 - | *http_request.uri_mut() = "/MalformedRequired?stringInQuery=abc".parse().unwrap();
|
5754 + | let mut http_request = http::Request::builder()
|
5755 + | .uri("/MalformedLengthOverride")
|
5756 + | .method("POST")
|
5757 + | .header("content-type", "application/json")
|
5758 + | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"list\" : [\"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\"] }".as_bytes()))).unwrap();
|
5076 5759 | #[allow(unused_mut)]
|
5077 5760 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5078 5761 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5079 5762 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5080 - | .malformed_required(move |input: crate::input::MalformedRequiredInput| {
|
5763 + | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
5081 5764 | let sender = sender.clone();
|
5082 5765 | async move {
|
5083 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRequiredOutput, crate::error::MalformedRequiredError> };
|
5766 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
5084 5767 | sender.send(()).await.expect("receiver dropped early");
|
5085 5768 | result
|
5086 5769 | }
|
5087 5770 | })
|
5088 5771 | .build_unchecked();
|
5089 5772 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5090 5773 | .await
|
5091 5774 | .expect("unable to make an HTTP request");
|
5092 5775 | ::pretty_assertions::assert_eq!(
|
5093 5776 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5094 5777 | http_response.status()
|
5095 5778 | );
|
5096 5779 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5097 5780 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5098 5781 | http_response.headers(),
|
5099 5782 | expected_headers,
|
5100 5783 | ));
|
5101 5784 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5102 5785 | .await
|
5103 5786 | .expect("unable to extract body to bytes");
|
5104 5787 | ::aws_smithy_protocol_test::assert_ok(
|
5105 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/stringInHeader' failed to satisfy constraint: Member must not be null\",\n \"fieldList\" : [{\"message\": \"Value at '/stringInHeader' failed to satisfy constraint: Member must not be null\", \"path\": \"/stringInHeader\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5788 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 7 at '/list' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 7 at '/list' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\", \"path\": \"/list\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5106 5789 | );
|
5107 5790 | }
|
5108 5791 | }
|
5109 - | }
|
5110 - | #[cfg(test)]
|
5111 - | #[allow(unreachable_code, unused_variables)]
|
5112 - | mod server_malformed_unique_items_test {
|
5113 - | /// When a blob list contains non-unique values,
|
5792 + | /// When a map member does not fit within length bounds,
|
5114 5793 | /// the response should be a 400 ValidationException.
|
5115 - | /// Test ID: RestJsonMalformedUniqueItemsBlobList
|
5794 + | /// Test ID: RestJsonMalformedLengthMapOverride_case0
|
5116 5795 | #[::tokio::test]
|
5117 - | #[should_panic]
|
5118 - | async fn rest_json_malformed_unique_items_blob_list_malformed_request() {
|
5796 + | #[::tracing_test::traced_test]
|
5797 + | async fn rest_json_malformed_length_map_override_case0_malformed_request() {
|
5119 5798 | {
|
5120 5799 | #[allow(unused_mut)]
|
5121 - | let mut http_request = http::Request::builder()
|
5122 - | .uri("/MalformedUniqueItems")
|
5123 - | .method("POST")
|
5124 - | .header("content-type", "application/json")
|
5125 - | .body(::aws_smithy_http_server::body::Body::from(
|
5126 - | ::bytes::Bytes::from_static(
|
5127 - | "{ \"blobList\" : [\"YQ==\", \"YQ==\"] }".as_bytes(),
|
5128 - | ),
|
5129 - | ))
|
5130 - | .unwrap();
|
5800 + | let mut http_request = http::Request::builder()
|
5801 + | .uri("/MalformedLengthOverride")
|
5802 + | .method("POST")
|
5803 + | .header("content-type", "application/json")
|
5804 + | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"map\" : {\"abc\": [\"def\", \"efg\", \"fgh\"], \"bcd\": [\"abc\", \"def\", \"efg\"], \"def\": [\"abc\", \"def\", \"efg\"]} }".as_bytes()))).unwrap();
|
5131 5805 | #[allow(unused_mut)]
|
5132 5806 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5133 5807 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5134 5808 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5135 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
5809 + | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
5136 5810 | let sender = sender.clone();
|
5137 5811 | async move {
|
5138 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
5812 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
5139 5813 | sender.send(()).await.expect("receiver dropped early");
|
5140 5814 | result
|
5141 5815 | }
|
5142 5816 | })
|
5143 5817 | .build_unchecked();
|
5144 5818 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5145 5819 | .await
|
5146 5820 | .expect("unable to make an HTTP request");
|
5147 5821 | ::pretty_assertions::assert_eq!(
|
5148 5822 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5149 5823 | http_response.status()
|
5150 5824 | );
|
5151 5825 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5152 5826 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5153 5827 | http_response.headers(),
|
5154 5828 | expected_headers,
|
5155 5829 | ));
|
5156 5830 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5157 5831 | .await
|
5158 5832 | .expect("unable to extract body to bytes");
|
5159 5833 | ::aws_smithy_protocol_test::assert_ok(
|
5160 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/blobList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/blobList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/blobList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5834 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 3 at '/map' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 3 at '/map' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5161 5835 | );
|
5162 5836 | }
|
5163 5837 | }
|
5164 - | /// When a boolean list contains non-unique values,
|
5838 + | /// When a map member does not fit within length bounds,
|
5165 5839 | /// the response should be a 400 ValidationException.
|
5166 - | /// Test ID: RestJsonMalformedUniqueItemsBooleanList_case0
|
5840 + | /// Test ID: RestJsonMalformedLengthMapOverride_case1
|
5167 5841 | #[::tokio::test]
|
5168 - | #[should_panic]
|
5169 - | async fn rest_json_malformed_unique_items_boolean_list_case0_malformed_request() {
|
5842 + | #[::tracing_test::traced_test]
|
5843 + | async fn rest_json_malformed_length_map_override_case1_malformed_request() {
|
5170 5844 | {
|
5171 5845 | #[allow(unused_mut)]
|
5172 - | let mut http_request = http::Request::builder()
|
5173 - | .uri("/MalformedUniqueItems")
|
5174 - | .method("POST")
|
5175 - | .header("content-type", "application/json")
|
5176 - | .body(::aws_smithy_http_server::body::Body::from(
|
5177 - | ::bytes::Bytes::from_static("{ \"booleanList\" : [true, true] }".as_bytes()),
|
5178 - | ))
|
5179 - | .unwrap();
|
5846 + | let mut http_request = http::Request::builder()
|
5847 + | .uri("/MalformedLengthOverride")
|
5848 + | .method("POST")
|
5849 + | .header("content-type", "application/json")
|
5850 + | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"map\" : {\"abc\": [\"abc\", \"def\", \"efg\"], \"bcd\": [\"abc\", \"def\", \"efg\"],\n \"cde\": [\"abc\", \"def\", \"efg\"], \"def\": [\"abc\", \"def\", \"efg\"],\n \"efg\": [\"abc\", \"def\", \"efg\"], \"fgh\": [\"abc\", \"def\", \"efg\"],\n \"ghi\": [\"abc\", \"def\", \"efg\"] } }".as_bytes()))).unwrap();
|
5180 5851 | #[allow(unused_mut)]
|
5181 5852 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5182 5853 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5183 5854 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5184 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
5855 + | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
5185 5856 | let sender = sender.clone();
|
5186 5857 | async move {
|
5187 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
5858 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
5188 5859 | sender.send(()).await.expect("receiver dropped early");
|
5189 5860 | result
|
5190 5861 | }
|
5191 5862 | })
|
5192 5863 | .build_unchecked();
|
5193 5864 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5194 5865 | .await
|
5195 5866 | .expect("unable to make an HTTP request");
|
5196 5867 | ::pretty_assertions::assert_eq!(
|
5197 5868 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5198 5869 | http_response.status()
|
5199 5870 | );
|
5200 5871 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5201 5872 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5202 5873 | http_response.headers(),
|
5203 5874 | expected_headers,
|
5204 5875 | ));
|
5205 5876 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5206 5877 | .await
|
5207 5878 | .expect("unable to extract body to bytes");
|
5208 5879 | ::aws_smithy_protocol_test::assert_ok(
|
5209 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/booleanList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/booleanList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/booleanList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5880 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 7 at '/map' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 7 at '/map' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5210 5881 | );
|
5211 5882 | }
|
5212 5883 | }
|
5213 - | /// When a boolean list contains non-unique values,
|
5884 + | }
|
5885 + |
|
5886 + | const CONTENT_TYPE_MALFORMEDLENGTH: ::mime::Mime = ::mime::APPLICATION_JSON;
|
5887 + | ::pin_project_lite::pin_project! {
|
5888 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
5889 + | /// [`MalformedLengthInput`](crate::input::MalformedLengthInput) using modelled bindings.
|
5890 + | pub struct MalformedLengthInputFuture {
|
5891 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedLengthInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
5892 + | }
|
5893 + | }
|
5894 + |
|
5895 + | impl std::future::Future for MalformedLengthInputFuture {
|
5896 + | type Output = Result<
|
5897 + | crate::input::MalformedLengthInput,
|
5898 + | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
5899 + | >;
|
5900 + |
|
5901 + | fn poll(
|
5902 + | self: std::pin::Pin<&mut Self>,
|
5903 + | cx: &mut std::task::Context<'_>,
|
5904 + | ) -> std::task::Poll<Self::Output> {
|
5905 + | let this = self.project();
|
5906 + | this.inner.as_mut().poll(cx)
|
5907 + | }
|
5908 + | }
|
5909 + |
|
5910 + | impl<B>
|
5911 + | ::aws_smithy_http_server::request::FromRequest<
|
5912 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
5913 + | B,
|
5914 + | > for crate::input::MalformedLengthInput
|
5915 + | where
|
5916 + | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
5917 + | B: 'static,
|
5918 + |
|
5919 + | B::Data: Send,
|
5920 + | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
5921 + | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
5922 + | {
|
5923 + | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
5924 + | type Future = MalformedLengthInputFuture;
|
5925 + |
|
5926 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
5927 + | let fut = async move {
|
5928 + | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
5929 + | request.headers(),
|
5930 + | &CONTENT_TYPE_MALFORMEDLENGTH,
|
5931 + | ) {
|
5932 + | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
5933 + | }
|
5934 + | crate::protocol_serde::shape_malformed_length::de_malformed_length_http_request(request)
|
5935 + | .await
|
5936 + | .map_err(Into::into)
|
5937 + | };
|
5938 + | use ::futures_util::future::TryFutureExt;
|
5939 + | let fut = fut.map_err(
|
5940 + | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
5941 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
5942 + | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
5943 + | e,
|
5944 + | )
|
5945 + | },
|
5946 + | );
|
5947 + | MalformedLengthInputFuture {
|
5948 + | inner: Box::pin(fut),
|
5949 + | }
|
5950 + | }
|
5951 + | }
|
5952 + | impl
|
5953 + | ::aws_smithy_http_server::response::IntoResponse<
|
5954 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
5955 + | > for crate::output::MalformedLengthOutput
|
5956 + | {
|
5957 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
5958 + | match crate::protocol_serde::shape_malformed_length::ser_malformed_length_http_response(
|
5959 + | self,
|
5960 + | ) {
|
5961 + | Ok(response) => response,
|
5962 + | Err(e) => {
|
5963 + | ::tracing::error!(error = %e, "failed to serialize response");
|
5964 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
5965 + | }
|
5966 + | }
|
5967 + | }
|
5968 + | }
|
5969 + | impl
|
5970 + | ::aws_smithy_http_server::response::IntoResponse<
|
5971 + | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
5972 + | > for crate::error::MalformedLengthError
|
5973 + | {
|
5974 + | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
5975 + | match crate::protocol_serde::shape_malformed_length::ser_malformed_length_http_error(&self)
|
5976 + | {
|
5977 + | Ok(mut response) => {
|
5978 + | response.extensions_mut().insert(
|
5979 + | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
5980 + | );
|
5981 + | response
|
5982 + | }
|
5983 + | Err(e) => {
|
5984 + | ::tracing::error!(error = %e, "failed to serialize response");
|
5985 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
5986 + | }
|
5987 + | }
|
5988 + | }
|
5989 + | }
|
5990 + |
|
5991 + | #[allow(unreachable_code, unused_variables)]
|
5992 + | #[cfg(test)]
|
5993 + | mod malformed_length_test {
|
5994 + |
|
5995 + | /// When a blob member does not fit within length bounds,
|
5214 5996 | /// the response should be a 400 ValidationException.
|
5215 - | /// Test ID: RestJsonMalformedUniqueItemsBooleanList_case1
|
5997 + | /// Test ID: RestJsonMalformedLengthBlob_case0
|
5216 5998 | #[::tokio::test]
|
5217 - | #[should_panic]
|
5218 - | async fn rest_json_malformed_unique_items_boolean_list_case1_malformed_request() {
|
5999 + | #[::tracing_test::traced_test]
|
6000 + | async fn rest_json_malformed_length_blob_case0_malformed_request() {
|
5219 6001 | {
|
5220 6002 | #[allow(unused_mut)]
|
5221 6003 | let mut http_request = http::Request::builder()
|
5222 - | .uri("/MalformedUniqueItems")
|
6004 + | .uri("/MalformedLength")
|
5223 6005 | .method("POST")
|
5224 6006 | .header("content-type", "application/json")
|
5225 6007 | .body(::aws_smithy_http_server::body::Body::from(
|
5226 - | ::bytes::Bytes::from_static("{ \"booleanList\" : [false, false] }".as_bytes()),
|
6008 + | ::bytes::Bytes::from_static("{ \"blob\" : \"YQ==\" }".as_bytes()),
|
5227 6009 | ))
|
5228 6010 | .unwrap();
|
5229 6011 | #[allow(unused_mut)]
|
5230 6012 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5231 6013 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5232 6014 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5233 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
6015 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
5234 6016 | let sender = sender.clone();
|
5235 6017 | async move {
|
5236 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
6018 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
5237 6019 | sender.send(()).await.expect("receiver dropped early");
|
5238 6020 | result
|
5239 6021 | }
|
5240 6022 | })
|
5241 6023 | .build_unchecked();
|
5242 6024 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5243 6025 | .await
|
5244 6026 | .expect("unable to make an HTTP request");
|
5245 6027 | ::pretty_assertions::assert_eq!(
|
5246 6028 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5247 6029 | http_response.status()
|
5248 6030 | );
|
5249 6031 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5250 6032 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5251 6033 | http_response.headers(),
|
5252 6034 | expected_headers,
|
5253 6035 | ));
|
5254 6036 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5255 6037 | .await
|
5256 6038 | .expect("unable to extract body to bytes");
|
5257 6039 | ::aws_smithy_protocol_test::assert_ok(
|
5258 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/booleanList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/booleanList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/booleanList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6040 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 1 at '/blob' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 1 at '/blob' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/blob\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5259 6041 | );
|
5260 6042 | }
|
5261 6043 | }
|
5262 - | /// When a string list contains non-unique values,
|
6044 + | /// When a blob member does not fit within length bounds,
|
5263 6045 | /// the response should be a 400 ValidationException.
|
5264 - | /// Test ID: RestJsonMalformedUniqueItemsStringList
|
6046 + | /// Test ID: RestJsonMalformedLengthBlob_case1
|
5265 6047 | #[::tokio::test]
|
5266 - | #[should_panic]
|
5267 - | async fn rest_json_malformed_unique_items_string_list_malformed_request() {
|
6048 + | #[::tracing_test::traced_test]
|
6049 + | async fn rest_json_malformed_length_blob_case1_malformed_request() {
|
5268 6050 | {
|
5269 6051 | #[allow(unused_mut)]
|
5270 6052 | let mut http_request = http::Request::builder()
|
5271 - | .uri("/MalformedUniqueItems")
|
6053 + | .uri("/MalformedLength")
|
5272 6054 | .method("POST")
|
5273 6055 | .header("content-type", "application/json")
|
5274 6056 | .body(::aws_smithy_http_server::body::Body::from(
|
5275 6057 | ::bytes::Bytes::from_static(
|
5276 - | "{ \"stringList\" : [\"abc\", \"abc\"] }".as_bytes(),
|
6058 + | "{ \"blob\" : \"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXo=\" }".as_bytes(),
|
5277 6059 | ),
|
5278 6060 | ))
|
5279 6061 | .unwrap();
|
5280 6062 | #[allow(unused_mut)]
|
5281 6063 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5282 6064 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5283 6065 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5284 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
6066 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
5285 6067 | let sender = sender.clone();
|
5286 6068 | async move {
|
5287 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
6069 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
5288 6070 | sender.send(()).await.expect("receiver dropped early");
|
5289 6071 | result
|
5290 6072 | }
|
5291 6073 | })
|
5292 6074 | .build_unchecked();
|
5293 6075 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5294 6076 | .await
|
5295 6077 | .expect("unable to make an HTTP request");
|
5296 6078 | ::pretty_assertions::assert_eq!(
|
5297 6079 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5298 6080 | http_response.status()
|
5299 6081 | );
|
5300 6082 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5301 6083 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5302 6084 | http_response.headers(),
|
5303 6085 | expected_headers,
|
5304 6086 | ));
|
5305 6087 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5306 6088 | .await
|
5307 6089 | .expect("unable to extract body to bytes");
|
5308 6090 | ::aws_smithy_protocol_test::assert_ok(
|
5309 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/stringList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/stringList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/stringList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6091 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 26 at '/blob' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 26 at '/blob' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/blob\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5310 6092 | );
|
5311 6093 | }
|
5312 6094 | }
|
5313 - | /// When a byte list contains non-unique values,
|
6095 + | /// When a string member does not fit within length bounds,
|
5314 6096 | /// the response should be a 400 ValidationException.
|
5315 - | /// Test ID: RestJsonMalformedUniqueItemsByteList
|
6097 + | /// Test ID: RestJsonMalformedLengthString_case0
|
5316 6098 | #[::tokio::test]
|
5317 - | #[should_panic]
|
5318 - | async fn rest_json_malformed_unique_items_byte_list_malformed_request() {
|
6099 + | #[::tracing_test::traced_test]
|
6100 + | async fn rest_json_malformed_length_string_case0_malformed_request() {
|
5319 6101 | {
|
5320 6102 | #[allow(unused_mut)]
|
5321 6103 | let mut http_request = http::Request::builder()
|
5322 - | .uri("/MalformedUniqueItems")
|
6104 + | .uri("/MalformedLength")
|
5323 6105 | .method("POST")
|
5324 6106 | .header("content-type", "application/json")
|
5325 6107 | .body(::aws_smithy_http_server::body::Body::from(
|
5326 - | ::bytes::Bytes::from_static("{ \"byteList\" : [1, 1] }".as_bytes()),
|
6108 + | ::bytes::Bytes::from_static("{ \"string\" : \"a\" }".as_bytes()),
|
5327 6109 | ))
|
5328 6110 | .unwrap();
|
5329 6111 | #[allow(unused_mut)]
|
5330 6112 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5331 6113 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5332 6114 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5333 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
6115 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
5334 6116 | let sender = sender.clone();
|
5335 6117 | async move {
|
5336 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
6118 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
5337 6119 | sender.send(()).await.expect("receiver dropped early");
|
5338 6120 | result
|
5339 6121 | }
|
5340 6122 | })
|
5341 6123 | .build_unchecked();
|
5342 6124 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5343 6125 | .await
|
5344 6126 | .expect("unable to make an HTTP request");
|
5345 6127 | ::pretty_assertions::assert_eq!(
|
5346 6128 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5347 6129 | http_response.status()
|
5348 6130 | );
|
5349 6131 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5350 6132 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5351 6133 | http_response.headers(),
|
5352 6134 | expected_headers,
|
5353 6135 | ));
|
5354 6136 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5355 6137 | .await
|
5356 6138 | .expect("unable to extract body to bytes");
|
5357 6139 | ::aws_smithy_protocol_test::assert_ok(
|
5358 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/byteList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/byteList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/byteList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6140 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 1 at '/string' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 1 at '/string' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5359 6141 | );
|
5360 6142 | }
|
5361 6143 | }
|
5362 - | /// When a short list contains non-unique values,
|
6144 + | /// When a string member does not fit within length bounds,
|
5363 6145 | /// the response should be a 400 ValidationException.
|
5364 - | /// Test ID: RestJsonMalformedUniqueItemsShortList
|
6146 + | /// Test ID: RestJsonMalformedLengthString_case1
|
5365 6147 | #[::tokio::test]
|
5366 - | #[should_panic]
|
5367 - | async fn rest_json_malformed_unique_items_short_list_malformed_request() {
|
6148 + | #[::tracing_test::traced_test]
|
6149 + | async fn rest_json_malformed_length_string_case1_malformed_request() {
|
5368 6150 | {
|
5369 6151 | #[allow(unused_mut)]
|
5370 6152 | let mut http_request = http::Request::builder()
|
5371 - | .uri("/MalformedUniqueItems")
|
6153 + | .uri("/MalformedLength")
|
5372 6154 | .method("POST")
|
5373 6155 | .header("content-type", "application/json")
|
5374 6156 | .body(::aws_smithy_http_server::body::Body::from(
|
5375 - | ::bytes::Bytes::from_static("{ \"shortList\" : [2, 2] }".as_bytes()),
|
6157 + | ::bytes::Bytes::from_static(
|
6158 + | "{ \"string\" : \"abcdefghijklmnopqrstuvwxyz\" }".as_bytes(),
|
6159 + | ),
|
5376 6160 | ))
|
5377 6161 | .unwrap();
|
5378 6162 | #[allow(unused_mut)]
|
5379 6163 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5380 6164 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5381 6165 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5382 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
6166 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
5383 6167 | let sender = sender.clone();
|
5384 6168 | async move {
|
5385 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
6169 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
5386 6170 | sender.send(()).await.expect("receiver dropped early");
|
5387 6171 | result
|
5388 6172 | }
|
5389 6173 | })
|
5390 6174 | .build_unchecked();
|
5391 6175 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5392 6176 | .await
|
5393 6177 | .expect("unable to make an HTTP request");
|
5394 6178 | ::pretty_assertions::assert_eq!(
|
5395 6179 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5396 6180 | http_response.status()
|
5397 6181 | );
|
5398 6182 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5399 6183 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5400 6184 | http_response.headers(),
|
5401 6185 | expected_headers,
|
5402 6186 | ));
|
5403 6187 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5404 6188 | .await
|
5405 6189 | .expect("unable to extract body to bytes");
|
5406 6190 | ::aws_smithy_protocol_test::assert_ok(
|
5407 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/shortList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/shortList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/shortList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6191 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 26 at '/string' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 26 at '/string' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5408 6192 | );
|
5409 6193 | }
|
5410 6194 | }
|
5411 - | /// When an integer list contains non-unique values,
|
6195 + | /// When a string member does not fit within length bounds,
|
5412 6196 | /// the response should be a 400 ValidationException.
|
5413 - | /// Test ID: RestJsonMalformedUniqueItemsIntegerList
|
6197 + | /// Test ID: RestJsonMalformedLengthString_case2
|
5414 6198 | #[::tokio::test]
|
5415 - | #[should_panic]
|
5416 - | async fn rest_json_malformed_unique_items_integer_list_malformed_request() {
|
6199 + | #[::tracing_test::traced_test]
|
6200 + | async fn rest_json_malformed_length_string_case2_malformed_request() {
|
5417 6201 | {
|
5418 6202 | #[allow(unused_mut)]
|
5419 6203 | let mut http_request = http::Request::builder()
|
5420 - | .uri("/MalformedUniqueItems")
|
6204 + | .uri("/MalformedLength")
|
5421 6205 | .method("POST")
|
5422 6206 | .header("content-type", "application/json")
|
5423 6207 | .body(::aws_smithy_http_server::body::Body::from(
|
5424 - | ::bytes::Bytes::from_static("{ \"integerList\" : [3, 3] }".as_bytes()),
|
6208 + | ::bytes::Bytes::from_static("{ \"string\" : \"👍\" }".as_bytes()),
|
5425 6209 | ))
|
5426 6210 | .unwrap();
|
5427 6211 | #[allow(unused_mut)]
|
5428 6212 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5429 6213 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5430 6214 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5431 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
6215 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
5432 6216 | let sender = sender.clone();
|
5433 6217 | async move {
|
5434 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
6218 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
5435 6219 | sender.send(()).await.expect("receiver dropped early");
|
5436 6220 | result
|
5437 6221 | }
|
5438 6222 | })
|
5439 6223 | .build_unchecked();
|
5440 6224 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5441 6225 | .await
|
5442 6226 | .expect("unable to make an HTTP request");
|
5443 6227 | ::pretty_assertions::assert_eq!(
|
5444 6228 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5445 6229 | http_response.status()
|
5446 6230 | );
|
5447 6231 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5448 6232 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5449 6233 | http_response.headers(),
|
5450 6234 | expected_headers,
|
5451 6235 | ));
|
5452 6236 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5453 6237 | .await
|
5454 6238 | .expect("unable to extract body to bytes");
|
5455 6239 | ::aws_smithy_protocol_test::assert_ok(
|
5456 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/integerList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/integerList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/integerList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6240 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 1 at '/string' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 1 at '/string' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5457 6241 | );
|
5458 6242 | }
|
5459 6243 | }
|
5460 - | /// When an integer list contains non-unique values,
|
6244 + | /// When a string member does not fit within length bounds,
|
5461 6245 | /// the response should be a 400 ValidationException.
|
5462 - | /// Test ID: RestJsonMalformedUniqueItemsLongList
|
6246 + | /// Test ID: RestJsonMalformedLengthMinString
|
5463 6247 | #[::tokio::test]
|
5464 - | #[should_panic]
|
5465 - | async fn rest_json_malformed_unique_items_long_list_malformed_request() {
|
6248 + | #[::tracing_test::traced_test]
|
6249 + | async fn rest_json_malformed_length_min_string_malformed_request() {
|
5466 6250 | {
|
5467 6251 | #[allow(unused_mut)]
|
5468 6252 | let mut http_request = http::Request::builder()
|
5469 - | .uri("/MalformedUniqueItems")
|
6253 + | .uri("/MalformedLength")
|
5470 6254 | .method("POST")
|
5471 6255 | .header("content-type", "application/json")
|
5472 6256 | .body(::aws_smithy_http_server::body::Body::from(
|
5473 - | ::bytes::Bytes::from_static("{ \"longList\" : [4, 4] }".as_bytes()),
|
6257 + | ::bytes::Bytes::from_static("{ \"minString\" : \"a\" }".as_bytes()),
|
5474 6258 | ))
|
5475 6259 | .unwrap();
|
5476 6260 | #[allow(unused_mut)]
|
5477 6261 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5478 6262 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5479 6263 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5480 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
6264 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
5481 6265 | let sender = sender.clone();
|
5482 6266 | async move {
|
5483 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
6267 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
5484 6268 | sender.send(()).await.expect("receiver dropped early");
|
5485 6269 | result
|
5486 6270 | }
|
5487 6271 | })
|
5488 6272 | .build_unchecked();
|
5489 6273 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5490 6274 | .await
|
5491 6275 | .expect("unable to make an HTTP request");
|
5492 6276 | ::pretty_assertions::assert_eq!(
|
5493 6277 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5494 6278 | http_response.status()
|
5495 6279 | );
|
5496 6280 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5497 6281 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5498 6282 | http_response.headers(),
|
5499 6283 | expected_headers,
|
5500 6284 | ));
|
5501 6285 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5502 6286 | .await
|
5503 6287 | .expect("unable to extract body to bytes");
|
5504 6288 | ::aws_smithy_protocol_test::assert_ok(
|
5505 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/longList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/longList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/longList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6289 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 1 at '/minString' failed to satisfy constraint: Member must have length greater than or equal to 2\",\n \"fieldList\" : [{\"message\": \"Value with length 1 at '/minString' failed to satisfy constraint: Member must have length greater than or equal to 2\", \"path\": \"/minString\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5506 6290 | );
|
5507 6291 | }
|
5508 6292 | }
|
5509 - | /// When a timestamp list contains non-unique values,
|
6293 + | /// When a string member does not fit within length bounds,
|
5510 6294 | /// the response should be a 400 ValidationException.
|
5511 - | /// Test ID: RestJsonMalformedUniqueItemsTimestampList
|
6295 + | /// Test ID: RestJsonMalformedLengthMaxString
|
5512 6296 | #[::tokio::test]
|
5513 - | #[should_panic]
|
5514 - | async fn rest_json_malformed_unique_items_timestamp_list_malformed_request() {
|
6297 + | #[::tracing_test::traced_test]
|
6298 + | async fn rest_json_malformed_length_max_string_malformed_request() {
|
5515 6299 | {
|
5516 6300 | #[allow(unused_mut)]
|
5517 6301 | let mut http_request = http::Request::builder()
|
5518 - | .uri("/MalformedUniqueItems")
|
6302 + | .uri("/MalformedLength")
|
5519 6303 | .method("POST")
|
5520 6304 | .header("content-type", "application/json")
|
5521 6305 | .body(::aws_smithy_http_server::body::Body::from(
|
5522 6306 | ::bytes::Bytes::from_static(
|
5523 - | "{ \"timestampList\" : [1676660607, 1676660607] }".as_bytes(),
|
6307 + | "{ \"maxString\" : \"abcdefghijklmnopqrstuvwxyz\" }".as_bytes(),
|
5524 6308 | ),
|
5525 6309 | ))
|
5526 6310 | .unwrap();
|
5527 6311 | #[allow(unused_mut)]
|
5528 6312 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5529 6313 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5530 6314 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5531 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
6315 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
5532 6316 | let sender = sender.clone();
|
5533 6317 | async move {
|
5534 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
6318 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
5535 6319 | sender.send(()).await.expect("receiver dropped early");
|
5536 6320 | result
|
5537 6321 | }
|
5538 6322 | })
|
5539 6323 | .build_unchecked();
|
5540 6324 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5541 6325 | .await
|
5542 6326 | .expect("unable to make an HTTP request");
|
5543 6327 | ::pretty_assertions::assert_eq!(
|
5544 6328 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5545 6329 | http_response.status()
|
5546 6330 | );
|
5547 6331 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5548 6332 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5549 6333 | http_response.headers(),
|
5550 6334 | expected_headers,
|
5551 6335 | ));
|
5552 6336 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5553 6337 | .await
|
5554 6338 | .expect("unable to extract body to bytes");
|
5555 6339 | ::aws_smithy_protocol_test::assert_ok(
|
5556 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/timestampList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/timestampList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/timestampList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6340 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 26 at '/maxString' failed to satisfy constraint: Member must have length less than or equal to 8\",\n \"fieldList\" : [{\"message\": \"Value with length 26 at '/maxString' failed to satisfy constraint: Member must have length less than or equal to 8\", \"path\": \"/maxString\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5557 6341 | );
|
5558 6342 | }
|
5559 6343 | }
|
5560 - | /// When a date-time timestamp list contains non-unique values,
|
6344 + | /// When a list member does not fit within length bounds,
|
5561 6345 | /// the response should be a 400 ValidationException.
|
5562 - | /// Test ID: RestJsonMalformedUniqueItemsDateTimeList
|
6346 + | /// Test ID: RestJsonMalformedLengthList_case0
|
5563 6347 | #[::tokio::test]
|
5564 - | #[should_panic]
|
5565 - | async fn rest_json_malformed_unique_items_date_time_list_malformed_request() {
|
6348 + | #[::tracing_test::traced_test]
|
6349 + | async fn rest_json_malformed_length_list_case0_malformed_request() {
|
5566 6350 | {
|
5567 6351 | #[allow(unused_mut)]
|
5568 - | let mut http_request = http::Request::builder()
|
5569 - | .uri("/MalformedUniqueItems")
|
5570 - | .method("POST")
|
5571 - | .header("content-type", "application/json")
|
5572 - | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"dateTimeList\" : [\"1985-04-12T23:20:50.52Z\", \"1985-04-12T23:20:50.52Z\"] }".as_bytes()))).unwrap();
|
6352 + | let mut http_request = http::Request::builder()
|
6353 + | .uri("/MalformedLength")
|
6354 + | .method("POST")
|
6355 + | .header("content-type", "application/json")
|
6356 + | .body(::aws_smithy_http_server::body::Body::from(
|
6357 + | ::bytes::Bytes::from_static("{ \"list\" : [\"abc\"] }".as_bytes()),
|
6358 + | ))
|
6359 + | .unwrap();
|
5573 6360 | #[allow(unused_mut)]
|
5574 6361 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5575 6362 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5576 6363 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5577 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
6364 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
5578 6365 | let sender = sender.clone();
|
5579 6366 | async move {
|
5580 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
6367 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
5581 6368 | sender.send(()).await.expect("receiver dropped early");
|
5582 6369 | result
|
5583 6370 | }
|
5584 6371 | })
|
5585 6372 | .build_unchecked();
|
5586 6373 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5587 6374 | .await
|
5588 6375 | .expect("unable to make an HTTP request");
|
5589 6376 | ::pretty_assertions::assert_eq!(
|
5590 6377 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5591 6378 | http_response.status()
|
5592 6379 | );
|
5593 6380 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5594 6381 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5595 6382 | http_response.headers(),
|
5596 6383 | expected_headers,
|
5597 6384 | ));
|
5598 6385 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5599 6386 | .await
|
5600 6387 | .expect("unable to extract body to bytes");
|
5601 6388 | ::aws_smithy_protocol_test::assert_ok(
|
5602 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/dateTimeList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/dateTimeList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/dateTimeList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6389 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 1 at '/list' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 1 at '/list' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/list\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5603 6390 | );
|
5604 6391 | }
|
5605 6392 | }
|
5606 - | /// When a http-date timestamp list contains non-unique values,
|
6393 + | /// When a list member does not fit within length bounds,
|
5607 6394 | /// the response should be a 400 ValidationException.
|
5608 - | /// Test ID: RestJsonMalformedUniqueItemsHttpDateList_case0
|
6395 + | /// Test ID: RestJsonMalformedLengthList_case1
|
5609 6396 | #[::tokio::test]
|
5610 - | #[should_panic]
|
5611 - | async fn rest_json_malformed_unique_items_http_date_list_case0_malformed_request() {
|
6397 + | #[::tracing_test::traced_test]
|
6398 + | async fn rest_json_malformed_length_list_case1_malformed_request() {
|
5612 6399 | {
|
5613 6400 | #[allow(unused_mut)]
|
5614 6401 | let mut http_request = http::Request::builder()
|
5615 - | .uri("/MalformedUniqueItems")
|
6402 + | .uri("/MalformedLength")
|
5616 6403 | .method("POST")
|
5617 6404 | .header("content-type", "application/json")
|
5618 - | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"httpDateList\" : [\"Tue, 29 Apr 2014 18:30:38 GMT\", \"Tue, 29 Apr 2014 18:30:38 GMT\"] }".as_bytes()))).unwrap();
|
6405 + | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"list\" : [\"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\"] }".as_bytes()))).unwrap();
|
5619 6406 | #[allow(unused_mut)]
|
5620 6407 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5621 6408 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5622 6409 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5623 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
6410 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
5624 6411 | let sender = sender.clone();
|
5625 6412 | async move {
|
5626 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
6413 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
5627 6414 | sender.send(()).await.expect("receiver dropped early");
|
5628 6415 | result
|
5629 6416 | }
|
5630 6417 | })
|
5631 6418 | .build_unchecked();
|
5632 6419 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5633 6420 | .await
|
5634 6421 | .expect("unable to make an HTTP request");
|
5635 6422 | ::pretty_assertions::assert_eq!(
|
5636 6423 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5637 6424 | http_response.status()
|
5638 6425 | );
|
5639 6426 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5640 6427 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5641 6428 | http_response.headers(),
|
5642 6429 | expected_headers,
|
5643 6430 | ));
|
5644 6431 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5645 6432 | .await
|
5646 6433 | .expect("unable to extract body to bytes");
|
5647 6434 | ::aws_smithy_protocol_test::assert_ok(
|
5648 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/httpDateList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/httpDateList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/httpDateList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6435 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 10 at '/list' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 10 at '/list' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/list\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5649 6436 | );
|
5650 6437 | }
|
5651 6438 | }
|
5652 - | /// When an enum list contains non-unique values,
|
6439 + | /// When a list member's value does not fit within length bounds,
|
5653 6440 | /// the response should be a 400 ValidationException.
|
5654 - | /// Test ID: RestJsonMalformedUniqueItemsEnumList
|
6441 + | /// Test ID: RestJsonMalformedLengthListValue_case0
|
5655 6442 | #[::tokio::test]
|
5656 - | #[should_panic]
|
5657 - | async fn rest_json_malformed_unique_items_enum_list_malformed_request() {
|
6443 + | #[::tracing_test::traced_test]
|
6444 + | async fn rest_json_malformed_length_list_value_case0_malformed_request() {
|
5658 6445 | {
|
5659 6446 | #[allow(unused_mut)]
|
5660 6447 | let mut http_request = http::Request::builder()
|
5661 - | .uri("/MalformedUniqueItems")
|
6448 + | .uri("/MalformedLength")
|
5662 6449 | .method("POST")
|
5663 6450 | .header("content-type", "application/json")
|
5664 6451 | .body(::aws_smithy_http_server::body::Body::from(
|
5665 - | ::bytes::Bytes::from_static("{ \"enumList\" : [\"Foo\", \"Foo\"] }".as_bytes()),
|
6452 + | ::bytes::Bytes::from_static("{ \"list\" : [\"a\", \"abc\"] }".as_bytes()),
|
5666 6453 | ))
|
5667 6454 | .unwrap();
|
5668 6455 | #[allow(unused_mut)]
|
5669 6456 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5670 6457 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5671 6458 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5672 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
6459 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
5673 6460 | let sender = sender.clone();
|
5674 6461 | async move {
|
5675 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
6462 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
5676 6463 | sender.send(()).await.expect("receiver dropped early");
|
5677 6464 | result
|
5678 6465 | }
|
5679 6466 | })
|
5680 6467 | .build_unchecked();
|
5681 6468 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5682 6469 | .await
|
5683 6470 | .expect("unable to make an HTTP request");
|
5684 6471 | ::pretty_assertions::assert_eq!(
|
5685 6472 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5686 6473 | http_response.status()
|
5687 6474 | );
|
5688 6475 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5689 6476 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5690 6477 | http_response.headers(),
|
5691 6478 | expected_headers,
|
5692 6479 | ));
|
5693 6480 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5694 6481 | .await
|
5695 6482 | .expect("unable to extract body to bytes");
|
5696 6483 | ::aws_smithy_protocol_test::assert_ok(
|
5697 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/enumList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/enumList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/enumList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6484 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 1 at '/list/0' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 1 at '/list/0' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/list/0\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5698 6485 | );
|
5699 6486 | }
|
5700 6487 | }
|
5701 - | /// When an intEnum list contains non-unique values,
|
6488 + | /// When a list member's value does not fit within length bounds,
|
5702 6489 | /// the response should be a 400 ValidationException.
|
5703 - | /// Test ID: RestJsonMalformedUniqueItemsIntEnumList
|
6490 + | /// Test ID: RestJsonMalformedLengthListValue_case1
|
5704 6491 | #[::tokio::test]
|
5705 - | #[should_panic]
|
5706 - | async fn rest_json_malformed_unique_items_int_enum_list_malformed_request() {
|
6492 + | #[::tracing_test::traced_test]
|
6493 + | async fn rest_json_malformed_length_list_value_case1_malformed_request() {
|
5707 6494 | {
|
5708 6495 | #[allow(unused_mut)]
|
5709 6496 | let mut http_request = http::Request::builder()
|
5710 - | .uri("/MalformedUniqueItems")
|
6497 + | .uri("/MalformedLength")
|
5711 6498 | .method("POST")
|
5712 6499 | .header("content-type", "application/json")
|
5713 6500 | .body(::aws_smithy_http_server::body::Body::from(
|
5714 - | ::bytes::Bytes::from_static("{ \"intEnumList\" : [3, 3] }".as_bytes()),
|
6501 + | ::bytes::Bytes::from_static(
|
6502 + | "{ \"list\" : [\"abcdefghijklmnopqrstuvwxyz\", \"abc\"] }".as_bytes(),
|
6503 + | ),
|
5715 6504 | ))
|
5716 6505 | .unwrap();
|
5717 6506 | #[allow(unused_mut)]
|
5718 6507 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5719 6508 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5720 6509 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5721 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
6510 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
5722 6511 | let sender = sender.clone();
|
5723 6512 | async move {
|
5724 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
6513 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
5725 6514 | sender.send(()).await.expect("receiver dropped early");
|
5726 6515 | result
|
5727 6516 | }
|
5728 6517 | })
|
5729 6518 | .build_unchecked();
|
5730 6519 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5731 6520 | .await
|
5732 6521 | .expect("unable to make an HTTP request");
|
5733 6522 | ::pretty_assertions::assert_eq!(
|
5734 6523 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5735 6524 | http_response.status()
|
5736 6525 | );
|
5737 6526 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5738 6527 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5739 6528 | http_response.headers(),
|
5740 6529 | expected_headers,
|
5741 6530 | ));
|
5742 6531 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5743 6532 | .await
|
5744 6533 | .expect("unable to extract body to bytes");
|
5745 6534 | ::aws_smithy_protocol_test::assert_ok(
|
5746 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/intEnumList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/intEnumList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/intEnumList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6535 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 26 at '/list/0' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 26 at '/list/0' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/list/0\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5747 6536 | );
|
5748 6537 | }
|
5749 6538 | }
|
5750 - | /// When an list of lists contains non-unique values,
|
6539 + | /// When a map member does not fit within length bounds,
|
5751 6540 | /// the response should be a 400 ValidationException.
|
5752 - | /// Test ID: RestJsonMalformedUniqueItemsListList
|
6541 + | /// Test ID: RestJsonMalformedLengthMap_case0
|
5753 6542 | #[::tokio::test]
|
5754 - | #[should_panic]
|
5755 - | async fn rest_json_malformed_unique_items_list_list_malformed_request() {
|
6543 + | #[::tracing_test::traced_test]
|
6544 + | async fn rest_json_malformed_length_map_case0_malformed_request() {
|
5756 6545 | {
|
5757 6546 | #[allow(unused_mut)]
|
5758 6547 | let mut http_request = http::Request::builder()
|
5759 - | .uri("/MalformedUniqueItems")
|
6548 + | .uri("/MalformedLength")
|
5760 6549 | .method("POST")
|
5761 6550 | .header("content-type", "application/json")
|
5762 6551 | .body(::aws_smithy_http_server::body::Body::from(
|
5763 6552 | ::bytes::Bytes::from_static(
|
5764 - | "{ \"listList\" : [[\"foo\",\"bar\"], [\"foo\",\"bar\"]] }".as_bytes(),
|
6553 + | "{ \"map\" : {\"abc\": [\"def\", \"efg\", \"fgh\"]} }".as_bytes(),
|
5765 6554 | ),
|
5766 6555 | ))
|
5767 6556 | .unwrap();
|
5768 6557 | #[allow(unused_mut)]
|
5769 6558 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5770 6559 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5771 6560 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5772 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
6561 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
5773 6562 | let sender = sender.clone();
|
5774 6563 | async move {
|
5775 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
6564 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
5776 6565 | sender.send(()).await.expect("receiver dropped early");
|
5777 6566 | result
|
5778 6567 | }
|
5779 6568 | })
|
5780 6569 | .build_unchecked();
|
5781 6570 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5782 6571 | .await
|
5783 6572 | .expect("unable to make an HTTP request");
|
5784 6573 | ::pretty_assertions::assert_eq!(
|
5785 6574 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5786 6575 | http_response.status()
|
5787 6576 | );
|
5788 6577 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5789 6578 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5790 6579 | http_response.headers(),
|
5791 6580 | expected_headers,
|
5792 6581 | ));
|
5793 6582 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5794 6583 | .await
|
5795 6584 | .expect("unable to extract body to bytes");
|
5796 6585 | ::aws_smithy_protocol_test::assert_ok(
|
5797 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/listList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/listList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/listList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6586 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 1 at '/map' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 1 at '/map' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5798 6587 | );
|
5799 6588 | }
|
5800 6589 | }
|
5801 - | /// When an list of structures contains non-unique values,
|
6590 + | /// When a map member does not fit within length bounds,
|
5802 6591 | /// the response should be a 400 ValidationException.
|
5803 - | /// Test ID: RestJsonMalformedUniqueItemsStructureList
|
6592 + | /// Test ID: RestJsonMalformedLengthMap_case1
|
5804 6593 | #[::tokio::test]
|
5805 - | #[should_panic]
|
5806 - | async fn rest_json_malformed_unique_items_structure_list_malformed_request() {
|
6594 + | #[::tracing_test::traced_test]
|
6595 + | async fn rest_json_malformed_length_map_case1_malformed_request() {
|
5807 6596 | {
|
5808 6597 | #[allow(unused_mut)]
|
5809 - | let mut http_request = http::Request::builder()
|
5810 - | .uri("/MalformedUniqueItems")
|
5811 - | .method("POST")
|
5812 - | .header("content-type", "application/json")
|
5813 - | .body(::aws_smithy_http_server::body::Body::from(
|
5814 - | ::bytes::Bytes::from_static(
|
5815 - | "{ \"structureList\" : [{\"hi\": \"hello\"}, {\"hi\": \"hello\"}] }"
|
5816 - | .as_bytes(),
|
5817 - | ),
|
5818 - | ))
|
5819 - | .unwrap();
|
6598 + | let mut http_request = http::Request::builder()
|
6599 + | .uri("/MalformedLength")
|
6600 + | .method("POST")
|
6601 + | .header("content-type", "application/json")
|
6602 + | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"map\" : {\"abc\": [\"abc\", \"def\", \"efg\"], \"bcd\": [\"abc\", \"def\", \"efg\"],\n \"cde\": [\"abc\", \"def\", \"efg\"], \"def\": [\"abc\", \"def\", \"efg\"],\n \"efg\": [\"abc\", \"def\", \"efg\"], \"fgh\": [\"abc\", \"def\", \"efg\"],\n \"ghi\": [\"abc\", \"def\", \"efg\"], \"jkl\": [\"abc\", \"def\", \"efg\"],\n \"klm\": [\"abc\", \"def\", \"efg\"], \"lmn\": [\"abc\", \"def\", \"efg\"] } }".as_bytes()))).unwrap();
|
5820 6603 | #[allow(unused_mut)]
|
5821 6604 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5822 6605 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5823 6606 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5824 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
6607 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
5825 6608 | let sender = sender.clone();
|
5826 6609 | async move {
|
5827 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
6610 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
5828 6611 | sender.send(()).await.expect("receiver dropped early");
|
5829 6612 | result
|
5830 6613 | }
|
5831 6614 | })
|
5832 6615 | .build_unchecked();
|
5833 6616 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5834 6617 | .await
|
5835 6618 | .expect("unable to make an HTTP request");
|
5836 6619 | ::pretty_assertions::assert_eq!(
|
5837 6620 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5838 6621 | http_response.status()
|
5839 6622 | );
|
5840 6623 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5841 6624 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5842 6625 | http_response.headers(),
|
5843 6626 | expected_headers,
|
5844 6627 | ));
|
5845 6628 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5846 6629 | .await
|
5847 6630 | .expect("unable to extract body to bytes");
|
5848 6631 | ::aws_smithy_protocol_test::assert_ok(
|
5849 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/structureList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/structureList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/structureList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6632 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 10 at '/map' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 10 at '/map' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5850 6633 | );
|
5851 6634 | }
|
5852 6635 | }
|
5853 - | /// When a list of structures does not contain required keys,
|
5854 - | /// the response should be a 400 ValidationException and not
|
5855 - | /// a 500 error.
|
5856 - | /// Test ID: RestJsonMalformedUniqueItemsStructureMissingKeyList
|
6636 + | /// When a map member's key does not fit within length bounds,
|
6637 + | /// the response should be a 400 ValidationException.
|
6638 + | /// Test ID: RestJsonMalformedLengthMapKey_case0
|
5857 6639 | #[::tokio::test]
|
5858 - | async fn rest_json_malformed_unique_items_structure_missing_key_list_malformed_request() {
|
6640 + | #[::tracing_test::traced_test]
|
6641 + | async fn rest_json_malformed_length_map_key_case0_malformed_request() {
|
5859 6642 | {
|
5860 6643 | #[allow(unused_mut)]
|
5861 - | let mut http_request = http::Request::builder()
|
5862 - | .uri("/MalformedUniqueItems")
|
5863 - | .method("POST")
|
5864 - | .header("content-type", "application/json")
|
5865 - | .body(::aws_smithy_http_server::body::Body::from(
|
5866 - | ::bytes::Bytes::from_static(
|
5867 - | "{ \"structureListWithNoKey\" : [{\"hi2\": \"bar\"}] }".as_bytes(),
|
5868 - | ),
|
5869 - | ))
|
5870 - | .unwrap();
|
6644 + | let mut http_request = http::Request::builder()
|
6645 + | .uri("/MalformedLength")
|
6646 + | .method("POST")
|
6647 + | .header("content-type", "application/json")
|
6648 + | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"map\" : {\"a\": [\"abc\", \"def\", \"efg\"], \"bcd\": [\"abc\", \"def\", \"efg\"], \"cde\": [\"abc\", \"def\", \"efg\"]} }".as_bytes()))).unwrap();
|
5871 6649 | #[allow(unused_mut)]
|
5872 6650 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5873 6651 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5874 6652 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5875 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
6653 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
5876 6654 | let sender = sender.clone();
|
5877 6655 | async move {
|
5878 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
6656 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
5879 6657 | sender.send(()).await.expect("receiver dropped early");
|
5880 6658 | result
|
5881 6659 | }
|
5882 6660 | })
|
5883 6661 | .build_unchecked();
|
5884 6662 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5885 6663 | .await
|
5886 6664 | .expect("unable to make an HTTP request");
|
5887 6665 | ::pretty_assertions::assert_eq!(
|
5888 6666 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5889 6667 | http_response.status()
|
5890 6668 | );
|
5891 6669 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5892 6670 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5893 6671 | http_response.headers(),
|
5894 6672 | expected_headers,
|
5895 6673 | ));
|
5896 6674 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5897 6675 | .await
|
5898 6676 | .expect("unable to extract body to bytes");
|
5899 6677 | ::aws_smithy_protocol_test::assert_ok(
|
5900 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/structureListWithNoKey/0/hi' failed to satisfy constraint: Member must not be null\",\n \"fieldList\" : [{\"message\": \"Value at '/structureListWithNoKey/0/hi' failed to satisfy constraint: Member must not be null\", \"path\": \"/structureListWithNoKey/0/hi\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6678 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 1 at '/map' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 1 at '/map' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5901 6679 | );
|
5902 6680 | }
|
5903 6681 | }
|
5904 - | /// When an list of unions contains non-unique values,
|
6682 + | /// When a map member's key does not fit within length bounds,
|
5905 6683 | /// the response should be a 400 ValidationException.
|
5906 - | /// Test ID: RestJsonMalformedUniqueItemsUnionList_case0
|
6684 + | /// Test ID: RestJsonMalformedLengthMapKey_case1
|
5907 6685 | #[::tokio::test]
|
5908 - | #[should_panic]
|
5909 - | async fn rest_json_malformed_unique_items_union_list_case0_malformed_request() {
|
6686 + | #[::tracing_test::traced_test]
|
6687 + | async fn rest_json_malformed_length_map_key_case1_malformed_request() {
|
5910 6688 | {
|
5911 6689 | #[allow(unused_mut)]
|
5912 - | let mut http_request = http::Request::builder()
|
5913 - | .uri("/MalformedUniqueItems")
|
5914 - | .method("POST")
|
5915 - | .header("content-type", "application/json")
|
5916 - | .body(::aws_smithy_http_server::body::Body::from(
|
5917 - | ::bytes::Bytes::from_static(
|
5918 - | "{ \"unionList\" : [{\"string\": \"foo\"}, {\"string\": \"foo\"}] }"
|
5919 - | .as_bytes(),
|
5920 - | ),
|
5921 - | ))
|
5922 - | .unwrap();
|
6690 + | let mut http_request = http::Request::builder()
|
6691 + | .uri("/MalformedLength")
|
6692 + | .method("POST")
|
6693 + | .header("content-type", "application/json")
|
6694 + | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"map\" : {\"abcdefghijklmnopqrstuvwxyz\": [\"abc\", \"def\", \"efg\"], \"bcd\": [\"abc\", \"def\", \"efg\"], \"cde\": [\"abc\", \"def\", \"efg\"]} }".as_bytes()))).unwrap();
|
5923 6695 | #[allow(unused_mut)]
|
5924 6696 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5925 6697 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5926 6698 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5927 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
6699 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
5928 6700 | let sender = sender.clone();
|
5929 6701 | async move {
|
5930 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
6702 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
5931 6703 | sender.send(()).await.expect("receiver dropped early");
|
5932 6704 | result
|
5933 6705 | }
|
5934 6706 | })
|
5935 6707 | .build_unchecked();
|
5936 6708 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5937 6709 | .await
|
5938 6710 | .expect("unable to make an HTTP request");
|
5939 6711 | ::pretty_assertions::assert_eq!(
|
5940 6712 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5941 6713 | http_response.status()
|
5942 6714 | );
|
5943 6715 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5944 6716 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5945 6717 | http_response.headers(),
|
5946 6718 | expected_headers,
|
5947 6719 | ));
|
5948 6720 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5949 6721 | .await
|
5950 6722 | .expect("unable to extract body to bytes");
|
5951 6723 | ::aws_smithy_protocol_test::assert_ok(
|
5952 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/unionList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/unionList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/unionList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6724 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 26 at '/map' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 26 at '/map' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5953 6725 | );
|
5954 6726 | }
|
5955 6727 | }
|
5956 - | /// When an list of unions contains non-unique values,
|
6728 + | /// When a map member's value does not fit within length bounds,
|
5957 6729 | /// the response should be a 400 ValidationException.
|
5958 - | /// Test ID: RestJsonMalformedUniqueItemsUnionList_case1
|
6730 + | /// Test ID: RestJsonMalformedLengthMapValue_case0
|
5959 6731 | #[::tokio::test]
|
5960 - | #[should_panic]
|
5961 - | async fn rest_json_malformed_unique_items_union_list_case1_malformed_request() {
|
6732 + | #[::tracing_test::traced_test]
|
6733 + | async fn rest_json_malformed_length_map_value_case0_malformed_request() {
|
5962 6734 | {
|
5963 6735 | #[allow(unused_mut)]
|
5964 - | let mut http_request = http::Request::builder()
|
5965 - | .uri("/MalformedUniqueItems")
|
5966 - | .method("POST")
|
5967 - | .header("content-type", "application/json")
|
5968 - | .body(::aws_smithy_http_server::body::Body::from(
|
5969 - | ::bytes::Bytes::from_static(
|
5970 - | "{ \"unionList\" : [{\"integer\": 1}, {\"integer\": 1}] }".as_bytes(),
|
5971 - | ),
|
5972 - | ))
|
5973 - | .unwrap();
|
6736 + | let mut http_request = http::Request::builder()
|
6737 + | .uri("/MalformedLength")
|
6738 + | .method("POST")
|
6739 + | .header("content-type", "application/json")
|
6740 + | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"map\" : {\"abc\": [\"def\"], \"bcd\": [\"abc\", \"def\", \"efg\"], \"cde\": [\"abc\", \"def\", \"efg\"]} }".as_bytes()))).unwrap();
|
5974 6741 | #[allow(unused_mut)]
|
5975 6742 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5976 6743 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5977 6744 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5978 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
6745 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
5979 6746 | let sender = sender.clone();
|
5980 6747 | async move {
|
5981 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
6748 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
5982 6749 | sender.send(()).await.expect("receiver dropped early");
|
5983 6750 | result
|
5984 6751 | }
|
5985 6752 | })
|
5986 6753 | .build_unchecked();
|
5987 6754 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5988 6755 | .await
|
5989 6756 | .expect("unable to make an HTTP request");
|
5990 6757 | ::pretty_assertions::assert_eq!(
|
5991 6758 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5992 6759 | http_response.status()
|
5993 6760 | );
|
5994 6761 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5995 6762 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5996 6763 | http_response.headers(),
|
5997 6764 | expected_headers,
|
5998 6765 | ));
|
5999 6766 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6000 6767 | .await
|
6001 6768 | .expect("unable to extract body to bytes");
|
6002 6769 | ::aws_smithy_protocol_test::assert_ok(
|
6003 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/unionList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/unionList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/unionList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6770 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 1 at '/map/abc' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 1 at '/map/abc' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/map/abc\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6004 6771 | );
|
6005 6772 | }
|
6006 6773 | }
|
6007 - | }
|
6008 - | #[cfg(test)]
|
6009 - | #[allow(unreachable_code, unused_variables)]
|
6010 - | mod server_recursive_structures_test {
|
6011 - | /// Validation should work with recursive structures.
|
6012 - | /// Test ID: RestJsonRecursiveStructuresValidate
|
6013 - | #[::tokio::test]
|
6014 - | async fn rest_json_recursive_structures_validate_request() {
|
6015 - | #[allow(unused_mut)]
|
6016 - | let mut http_request = http::Request::builder()
|
6017 - | .uri("/RecursiveStructures")
|
6018 - | .method("POST")
|
6019 - | .header("content-type", "application/json")
|
6020 - | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"union\" : {\n \"union\" : {\n \"union\" : { \"string\" : \"abc\" }\n }\n }\n}".as_bytes()))).unwrap();
|
6021 - | #[allow(unused_mut)]
|
6022 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6023 - | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6024 - | let service =
|
6025 - | crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6026 - | .recursive_structures(move |input: crate::input::RecursiveStructuresInput| {
|
6027 - | let sender = sender.clone();
|
6028 - | async move {
|
6029 - | let result = {
|
6030 - | let expected = crate::input::RecursiveStructuresInput {
|
6031 - | union: ::std::option::Option::Some(
|
6032 - | crate::model::RecursiveUnionOne::Union(::std::boxed::Box::new(
|
6033 - | crate::model::RecursiveUnionTwo::Union(
|
6034 - | crate::model::RecursiveUnionOne::String(
|
6035 - | "abc"
|
6036 - | .parse::<crate::model::RecursiveEnumString>()
|
6037 - | .expect("static value validated to member"),
|
6038 - | ),
|
6039 - | ),
|
6040 - | )),
|
6041 - | ),
|
6042 - | };
|
6043 - | ::pretty_assertions::assert_eq!(input, expected);
|
6044 - | let response = crate::output::RecursiveStructuresOutput {};
|
6045 - | Ok(response)
|
6046 - | };
|
6047 - | sender.send(()).await.expect("receiver dropped early");
|
6048 - | result
|
6049 - | }
|
6050 - | })
|
6051 - | .build_unchecked();
|
6052 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6053 - | .await
|
6054 - | .expect("unable to make an HTTP request");
|
6055 - | assert!(receiver.recv().await.is_some());
|
6056 - | }
|
6057 - | /// When a value deeply nested in a recursive structure does not meet constraints,
|
6058 - | /// a 400 ValidationException is returned.
|
6059 - | /// Test ID: RestJsonMalformedRecursiveStructures
|
6774 + | /// When a map member's value does not fit within length bounds,
|
6775 + | /// the response should be a 400 ValidationException.
|
6776 + | /// Test ID: RestJsonMalformedLengthMapValue_case1
|
6060 6777 | #[::tokio::test]
|
6061 - | async fn rest_json_malformed_recursive_structures_malformed_request() {
|
6778 + | #[::tracing_test::traced_test]
|
6779 + | async fn rest_json_malformed_length_map_value_case1_malformed_request() {
|
6062 6780 | {
|
6063 6781 | #[allow(unused_mut)]
|
6064 6782 | let mut http_request = http::Request::builder()
|
6065 - | .uri("/RecursiveStructures")
|
6783 + | .uri("/MalformedLength")
|
6066 6784 | .method("POST")
|
6067 6785 | .header("content-type", "application/json")
|
6068 - | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"union\" : {\n \"union\" : {\n \"union\" : { \"string\" : \"XYZ\" }\n }\n }\n}".as_bytes()))).unwrap();
|
6069 - | #[allow(unused_mut)]
|
6070 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6071 - | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6072 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6073 - | .recursive_structures(move |input: crate::input::RecursiveStructuresInput| {
|
6074 - | let sender = sender.clone();
|
6075 - | async move {
|
6076 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::RecursiveStructuresOutput, crate::error::RecursiveStructuresError> };
|
6077 - | sender.send(()).await.expect("receiver dropped early");
|
6078 - | result
|
6079 - | }
|
6080 - | })
|
6081 - | .build_unchecked();
|
6082 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6083 - | .await
|
6084 - | .expect("unable to make an HTTP request");
|
6085 - | ::pretty_assertions::assert_eq!(
|
6086 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6087 - | http_response.status()
|
6088 - | );
|
6089 - | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6090 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6091 - | http_response.headers(),
|
6092 - | expected_headers,
|
6093 - | ));
|
6094 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6095 - | .await
|
6096 - | .expect("unable to extract body to bytes");
|
6097 - | ::aws_smithy_protocol_test::assert_ok(
|
6098 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/union/union/union/string' failed to satisfy constraint: Member must satisfy enum value set: [abc, def]\",\n \"fieldList\" : [{\"message\": \"Value at '/union/union/union/string' failed to satisfy constraint: Member must satisfy enum value set: [abc, def]\", \"path\": \"/union/union/union/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6099 - | );
|
6100 - | }
|
6101 - | }
|
6102 - | }
|
6103 - | #[cfg(test)]
|
6104 - | #[allow(unreachable_code, unused_variables)]
|
6105 - | mod server_sensitive_validation_test {
|
6106 - | /// When a sensitive member fails validation, the resultant
|
6107 - | /// ValidationException will omit the value of the input.
|
6108 - | /// Test ID: RestJsonMalformedPatternSensitiveString
|
6109 - | #[::tokio::test]
|
6110 - | async fn rest_json_malformed_pattern_sensitive_string_malformed_request() {
|
6111 - | {
|
6112 - | #[allow(unused_mut)]
|
6113 - | let mut http_request = http::Request::builder()
|
6114 - | .uri("/SensitiveValidation")
|
6115 - | .method("POST")
|
6116 - | .header("content-type", "application/json")
|
6117 - | .body(::aws_smithy_http_server::body::Body::from(
|
6118 - | ::bytes::Bytes::from_static("{ \"string\" : \"ABC\" }".as_bytes()),
|
6119 - | ))
|
6120 - | .unwrap();
|
6786 + | .body(::aws_smithy_http_server::body::Body::from(::bytes::Bytes::from_static("{ \"map\" : {\"abc\": [\"def\", \"efg\", \"fgh\", \"def\", \"efg\", \"fgh\", \"def\", \"efg\", \"fgh\", \"def\"],\n \"bcd\": [\"abc\", \"def\", \"efg\"],\n \"cde\": [\"abc\", \"def\", \"efg\"]} }".as_bytes()))).unwrap();
|
6121 6787 | #[allow(unused_mut)]
|
6122 6788 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6123 6789 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6124 6790 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6125 - | .sensitive_validation(move |input: crate::input::SensitiveValidationInput| {
|
6791 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6126 6792 | let sender = sender.clone();
|
6127 6793 | async move {
|
6128 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::SensitiveValidationOutput, crate::error::SensitiveValidationError> };
|
6794 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
6129 6795 | sender.send(()).await.expect("receiver dropped early");
|
6130 6796 | result
|
6131 6797 | }
|
6132 6798 | })
|
6133 6799 | .build_unchecked();
|
6134 6800 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6135 6801 | .await
|
6136 6802 | .expect("unable to make an HTTP request");
|
6137 6803 | ::pretty_assertions::assert_eq!(
|
6138 6804 | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6139 6805 | http_response.status()
|
6140 6806 | );
|
6141 6807 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6142 6808 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6143 6809 | http_response.headers(),
|
6144 6810 | expected_headers,
|
6145 6811 | ));
|
6146 6812 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6147 6813 | .await
|
6148 6814 | .expect("unable to extract body to bytes");
|
6149 6815 | ::aws_smithy_protocol_test::assert_ok(
|
6150 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6816 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 10 at '/map/abc' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 10 at '/map/abc' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/map/abc\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6151 6817 | );
|
6152 6818 | }
|
6153 6819 | }
|
6154 6820 | }
|
6155 6821 |
|
6156 - | const CONTENT_TYPE_SENSITIVEVALIDATION: ::mime::Mime = ::mime::APPLICATION_JSON;
|
6822 + | const CONTENT_TYPE_MALFORMEDENUM: ::mime::Mime = ::mime::APPLICATION_JSON;
|
6157 6823 | ::pin_project_lite::pin_project! {
|
6158 6824 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
6159 - | /// [`SensitiveValidationInput`](crate::input::SensitiveValidationInput) using modelled bindings.
|
6160 - | pub struct SensitiveValidationInputFuture {
|
6161 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SensitiveValidationInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
6825 + | /// [`MalformedEnumInput`](crate::input::MalformedEnumInput) using modelled bindings.
|
6826 + | pub struct MalformedEnumInputFuture {
|
6827 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedEnumInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
6162 6828 | }
|
6163 6829 | }
|
6164 6830 |
|
6165 - | impl std::future::Future for SensitiveValidationInputFuture {
|
6831 + | impl std::future::Future for MalformedEnumInputFuture {
|
6166 6832 | type Output = Result<
|
6167 - | crate::input::SensitiveValidationInput,
|
6833 + | crate::input::MalformedEnumInput,
|
6168 6834 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
6169 6835 | >;
|
6170 6836 |
|
6171 6837 | fn poll(
|
6172 6838 | self: std::pin::Pin<&mut Self>,
|
6173 6839 | cx: &mut std::task::Context<'_>,
|
6174 6840 | ) -> std::task::Poll<Self::Output> {
|
6175 6841 | let this = self.project();
|
6176 6842 | this.inner.as_mut().poll(cx)
|
6177 6843 | }
|
6178 6844 | }
|
6179 6845 |
|
6180 6846 | impl<B>
|
6181 6847 | ::aws_smithy_http_server::request::FromRequest<
|
6182 6848 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6183 6849 | B,
|
6184 - | > for crate::input::SensitiveValidationInput
|
6850 + | > for crate::input::MalformedEnumInput
|
6185 6851 | where
|
6186 6852 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
6187 6853 | B: 'static,
|
6188 6854 |
|
6189 6855 | B::Data: Send,
|
6190 6856 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
6191 6857 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
6192 6858 | {
|
6193 6859 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
6194 - | type Future = SensitiveValidationInputFuture;
|
6860 + | type Future = MalformedEnumInputFuture;
|
6195 6861 |
|
6196 6862 | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
6197 6863 | let fut = async move {
|
6198 6864 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
6199 6865 | request.headers(),
|
6200 - | &CONTENT_TYPE_SENSITIVEVALIDATION,
|
6866 + | &CONTENT_TYPE_MALFORMEDENUM,
|
6201 6867 | ) {
|
6202 6868 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
6203 6869 | }
|
6204 - | crate::protocol_serde::shape_sensitive_validation::de_sensitive_validation_http_request(
|
6205 - | request,
|
6206 - | )
|
6207 - | .await
|
6208 - | .map_err(Into::into)
|
6870 + | crate::protocol_serde::shape_malformed_enum::de_malformed_enum_http_request(request)
|
6871 + | .await
|
6872 + | .map_err(Into::into)
|
6209 6873 | };
|
6210 6874 | use ::futures_util::future::TryFutureExt;
|
6211 6875 | let fut = fut.map_err(
|
6212 6876 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
6213 6877 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
6214 6878 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
6215 6879 | e,
|
6216 6880 | )
|
6217 6881 | },
|
6218 6882 | );
|
6219 - | SensitiveValidationInputFuture {
|
6883 + | MalformedEnumInputFuture {
|
6220 6884 | inner: Box::pin(fut),
|
6221 6885 | }
|
6222 6886 | }
|
6223 6887 | }
|
6224 6888 | impl
|
6225 6889 | ::aws_smithy_http_server::response::IntoResponse<
|
6226 6890 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6227 - | > for crate::output::SensitiveValidationOutput
|
6891 + | > for crate::output::MalformedEnumOutput
|
6228 6892 | {
|
6229 6893 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
6230 - | match crate::protocol_serde::shape_sensitive_validation::ser_sensitive_validation_http_response(self) {
|
6231 - | Ok(response) => response,
|
6232 - | Err(e) => {
|
6233 - | ::tracing::error!(error = %e, "failed to serialize response");
|
6234 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
6235 - | }
|
6236 - | }
|
6894 + | match crate::protocol_serde::shape_malformed_enum::ser_malformed_enum_http_response(self) {
|
6895 + | Ok(response) => response,
|
6896 + | Err(e) => {
|
6897 + | ::tracing::error!(error = %e, "failed to serialize response");
|
6898 + | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
6899 + | }
|
6900 + | }
|
6237 6901 | }
|
6238 6902 | }
|
6239 6903 | impl
|
6240 6904 | ::aws_smithy_http_server::response::IntoResponse<
|
6241 6905 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6242 - | > for crate::error::SensitiveValidationError
|
6906 + | > for crate::error::MalformedEnumError
|
6243 6907 | {
|
6244 6908 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
6245 - | match crate::protocol_serde::shape_sensitive_validation::ser_sensitive_validation_http_error(
|
6246 - | &self,
|
6247 - | ) {
|
6909 + | match crate::protocol_serde::shape_malformed_enum::ser_malformed_enum_http_error(&self) {
|
6248 6910 | Ok(mut response) => {
|
6249 6911 | response.extensions_mut().insert(
|
6250 6912 | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
6251 6913 | );
|
6252 6914 | response
|
6253 6915 | }
|
6254 6916 | Err(e) => {
|
6255 6917 | ::tracing::error!(error = %e, "failed to serialize response");
|
6256 6918 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
6257 6919 | }
|
6258 6920 | }
|
6259 6921 | }
|
6260 6922 | }
|
6261 6923 |
|
6262 - | const CONTENT_TYPE_RECURSIVESTRUCTURES: ::mime::Mime = ::mime::APPLICATION_JSON;
|
6263 - | ::pin_project_lite::pin_project! {
|
6264 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
6265 - | /// [`RecursiveStructuresInput`](crate::input::RecursiveStructuresInput) using modelled bindings.
|
6266 - | pub struct RecursiveStructuresInputFuture {
|
6267 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::RecursiveStructuresInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
6268 - | }
|
6269 - | }
|
6270 - |
|
6271 - | impl std::future::Future for RecursiveStructuresInputFuture {
|
6272 - | type Output = Result<
|
6273 - | crate::input::RecursiveStructuresInput,
|
6274 - | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
6275 - | >;
|
6924 + | #[allow(unreachable_code, unused_variables)]
|
6925 + | #[cfg(test)]
|
6926 + | mod malformed_enum_test {
|
6276 6927 |
|
6277 - | fn poll(
|
6278 - | self: std::pin::Pin<&mut Self>,
|
6279 - | cx: &mut std::task::Context<'_>,
|
6280 - | ) -> std::task::Poll<Self::Output> {
|
6281 - | let this = self.project();
|
6282 - | this.inner.as_mut().poll(cx)
|
6928 + | /// When a string member does not contain a valid enum value,
|
6929 + | /// the response should be a 400 ValidationException. Internal-only
|
6930 + | /// enum values are excluded from the response message.
|
6931 + | /// Test ID: RestJsonMalformedEnumString_case0
|
6932 + | #[::tokio::test]
|
6933 + | #[::tracing_test::traced_test]
|
6934 + | #[should_panic]
|
6935 + | async fn rest_json_malformed_enum_string_case0_malformed_request() {
|
6936 + | {
|
6937 + | #[allow(unused_mut)]
|
6938 + | let mut http_request = http::Request::builder()
|
6939 + | .uri("/MalformedEnum")
|
6940 + | .method("POST")
|
6941 + | .header("content-type", "application/json")
|
6942 + | .body(::aws_smithy_http_server::body::Body::from(
|
6943 + | ::bytes::Bytes::from_static("{ \"string\" : \"ABC\" }".as_bytes()),
|
6944 + | ))
|
6945 + | .unwrap();
|
6946 + | #[allow(unused_mut)]
|
6947 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6948 + | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6949 + | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6950 + | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
6951 + | let sender = sender.clone();
|
6952 + | async move {
|
6953 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
6954 + | sender.send(()).await.expect("receiver dropped early");
|
6955 + | result
|
6956 + | }
|
6957 + | })
|
6958 + | .build_unchecked();
|
6959 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6960 + | .await
|
6961 + | .expect("unable to make an HTTP request");
|
6962 + | ::pretty_assertions::assert_eq!(
|
6963 + | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6964 + | http_response.status()
|
6965 + | );
|
6966 + | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6967 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6968 + | http_response.headers(),
|
6969 + | expected_headers,
|
6970 + | ));
|
6971 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6972 + | .await
|
6973 + | .expect("unable to extract body to bytes");
|
6974 + | ::aws_smithy_protocol_test::assert_ok(
|
6975 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/string' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/string' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6976 + | );
|
6977 + | }
|
6283 6978 | }
|
6284 - | }
|
6285 - |
|
6286 - | impl<B>
|
6287 - | ::aws_smithy_http_server::request::FromRequest<
|
6288 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6289 - | B,
|
6290 - | > for crate::input::RecursiveStructuresInput
|
6291 - | where
|
6292 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
6293 - | B: 'static,
|
6294 - |
|
6295 - | B::Data: Send,
|
6296 - | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
6297 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
6298 - | {
|
6299 - | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
6300 - | type Future = RecursiveStructuresInputFuture;
|
6301 - |
|
6302 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
6303 - | let fut = async move {
|
6304 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
6305 - | request.headers(),
|
6306 - | &CONTENT_TYPE_RECURSIVESTRUCTURES,
|
6307 - | ) {
|
6308 - | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
6309 - | }
|
6310 - | crate::protocol_serde::shape_recursive_structures::de_recursive_structures_http_request(
|
6311 - | request,
|
6312 - | )
|
6313 - | .await
|
6314 - | .map_err(Into::into)
|
6315 - | };
|
6316 - | use ::futures_util::future::TryFutureExt;
|
6317 - | let fut = fut.map_err(
|
6318 - | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
6319 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
6320 - | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
6321 - | e,
|
6322 - | )
|
6323 - | },
|
6324 - | );
|
6325 - | RecursiveStructuresInputFuture {
|
6326 - | inner: Box::pin(fut),
|
6327 - | }
|
6328 - | }
|
6329 - | }
|
6330 - | impl
|
6331 - | ::aws_smithy_http_server::response::IntoResponse<
|
6332 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6333 - | > for crate::output::RecursiveStructuresOutput
|
6334 - | {
|
6335 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
6336 - | match crate::protocol_serde::shape_recursive_structures::ser_recursive_structures_http_response(self) {
|
6337 - | Ok(response) => response,
|
6338 - | Err(e) => {
|
6339 - | ::tracing::error!(error = %e, "failed to serialize response");
|
6340 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
6341 - | }
|
6342 - | }
|
6343 - | }
|
6344 - | }
|
6345 - | impl
|
6346 - | ::aws_smithy_http_server::response::IntoResponse<
|
6347 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6348 - | > for crate::error::RecursiveStructuresError
|
6349 - | {
|
6350 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
6351 - | match crate::protocol_serde::shape_recursive_structures::ser_recursive_structures_http_error(
|
6352 - | &self,
|
6353 - | ) {
|
6354 - | Ok(mut response) => {
|
6355 - | response.extensions_mut().insert(
|
6356 - | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
6357 - | );
|
6358 - | response
|
6359 - | }
|
6360 - | Err(e) => {
|
6361 - | ::tracing::error!(error = %e, "failed to serialize response");
|
6362 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
6363 - | }
|
6364 - | }
|
6365 - | }
|
6366 - | }
|
6367 - |
|
6368 - | const CONTENT_TYPE_MALFORMEDUNIQUEITEMS: ::mime::Mime = ::mime::APPLICATION_JSON;
|
6369 - | ::pin_project_lite::pin_project! {
|
6370 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
6371 - | /// [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput) using modelled bindings.
|
6372 - | pub struct MalformedUniqueItemsInputFuture {
|
6373 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedUniqueItemsInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
6374 - | }
|
6375 - | }
|
6376 - |
|
6377 - | impl std::future::Future for MalformedUniqueItemsInputFuture {
|
6378 - | type Output = Result<
|
6379 - | crate::input::MalformedUniqueItemsInput,
|
6380 - | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
6381 - | >;
|
6382 - |
|
6383 - | fn poll(
|
6384 - | self: std::pin::Pin<&mut Self>,
|
6385 - | cx: &mut std::task::Context<'_>,
|
6386 - | ) -> std::task::Poll<Self::Output> {
|
6387 - | let this = self.project();
|
6388 - | this.inner.as_mut().poll(cx)
|
6389 - | }
|
6390 - | }
|
6391 - |
|
6392 - | impl<B>
|
6393 - | ::aws_smithy_http_server::request::FromRequest<
|
6394 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6395 - | B,
|
6396 - | > for crate::input::MalformedUniqueItemsInput
|
6397 - | where
|
6398 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
6399 - | B: 'static,
|
6400 - |
|
6401 - | B::Data: Send,
|
6402 - | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
6403 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
6404 - | {
|
6405 - | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
6406 - | type Future = MalformedUniqueItemsInputFuture;
|
6407 - |
|
6408 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
6409 - | let fut = async move {
|
6410 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
6411 - | request.headers(),
|
6412 - | &CONTENT_TYPE_MALFORMEDUNIQUEITEMS,
|
6413 - | ) {
|
6414 - | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
6415 - | }
|
6416 - | crate::protocol_serde::shape_malformed_unique_items::de_malformed_unique_items_http_request(request)
|
6417 - | .await
|
6418 - | .map_err(Into::into)
|
6419 - | };
|
6420 - | use ::futures_util::future::TryFutureExt;
|
6421 - | let fut = fut.map_err(
|
6422 - | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
6423 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
6424 - | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
6425 - | e,
|
6426 - | )
|
6427 - | },
|
6428 - | );
|
6429 - | MalformedUniqueItemsInputFuture {
|
6430 - | inner: Box::pin(fut),
|
6431 - | }
|
6432 - | }
|
6433 - | }
|
6434 - | impl
|
6435 - | ::aws_smithy_http_server::response::IntoResponse<
|
6436 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6437 - | > for crate::output::MalformedUniqueItemsOutput
|
6438 - | {
|
6439 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
6440 - | match crate::protocol_serde::shape_malformed_unique_items::ser_malformed_unique_items_http_response(self) {
|
6441 - | Ok(response) => response,
|
6442 - | Err(e) => {
|
6443 - | ::tracing::error!(error = %e, "failed to serialize response");
|
6444 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
6445 - | }
|
6446 - | }
|
6447 - | }
|
6448 - | }
|
6449 - | impl
|
6450 - | ::aws_smithy_http_server::response::IntoResponse<
|
6451 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6452 - | > for crate::error::MalformedUniqueItemsError
|
6453 - | {
|
6454 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
6455 - | match crate::protocol_serde::shape_malformed_unique_items::ser_malformed_unique_items_http_error(&self) {
|
6456 - | Ok(mut response) => {
|
6457 - | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
6458 - | response
|
6459 - | },
|
6460 - | Err(e) => {
|
6461 - | ::tracing::error!(error = %e, "failed to serialize response");
|
6462 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
6463 - | }
|
6464 - | }
|
6465 - | }
|
6466 - | }
|
6467 - |
|
6468 - | const CONTENT_TYPE_MALFORMEDREQUIRED: ::mime::Mime = ::mime::APPLICATION_JSON;
|
6469 - | ::pin_project_lite::pin_project! {
|
6470 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
6471 - | /// [`MalformedRequiredInput`](crate::input::MalformedRequiredInput) using modelled bindings.
|
6472 - | pub struct MalformedRequiredInputFuture {
|
6473 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedRequiredInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
6474 - | }
|
6475 - | }
|
6476 - |
|
6477 - | impl std::future::Future for MalformedRequiredInputFuture {
|
6478 - | type Output = Result<
|
6479 - | crate::input::MalformedRequiredInput,
|
6480 - | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
6481 - | >;
|
6482 - |
|
6483 - | fn poll(
|
6484 - | self: std::pin::Pin<&mut Self>,
|
6485 - | cx: &mut std::task::Context<'_>,
|
6486 - | ) -> std::task::Poll<Self::Output> {
|
6487 - | let this = self.project();
|
6488 - | this.inner.as_mut().poll(cx)
|
6489 - | }
|
6490 - | }
|
6491 - |
|
6492 - | impl<B>
|
6493 - | ::aws_smithy_http_server::request::FromRequest<
|
6494 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6495 - | B,
|
6496 - | > for crate::input::MalformedRequiredInput
|
6497 - | where
|
6498 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
6499 - | B: 'static,
|
6500 - |
|
6501 - | B::Data: Send,
|
6502 - | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
6503 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
6504 - | {
|
6505 - | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
6506 - | type Future = MalformedRequiredInputFuture;
|
6507 - |
|
6508 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
6509 - | let fut = async move {
|
6510 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
6511 - | request.headers(),
|
6512 - | &CONTENT_TYPE_MALFORMEDREQUIRED,
|
6513 - | ) {
|
6514 - | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
6515 - | }
|
6516 - | crate::protocol_serde::shape_malformed_required::de_malformed_required_http_request(
|
6517 - | request,
|
6518 - | )
|
6519 - | .await
|
6520 - | .map_err(Into::into)
|
6521 - | };
|
6522 - | use ::futures_util::future::TryFutureExt;
|
6523 - | let fut = fut.map_err(
|
6524 - | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
6525 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
6526 - | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
6527 - | e,
|
6528 - | )
|
6529 - | },
|
6530 - | );
|
6531 - | MalformedRequiredInputFuture {
|
6532 - | inner: Box::pin(fut),
|
6533 - | }
|
6534 - | }
|
6535 - | }
|
6536 - | impl
|
6537 - | ::aws_smithy_http_server::response::IntoResponse<
|
6538 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6539 - | > for crate::output::MalformedRequiredOutput
|
6540 - | {
|
6541 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
6542 - | match crate::protocol_serde::shape_malformed_required::ser_malformed_required_http_response(
|
6543 - | self,
|
6544 - | ) {
|
6545 - | Ok(response) => response,
|
6546 - | Err(e) => {
|
6547 - | ::tracing::error!(error = %e, "failed to serialize response");
|
6548 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
6549 - | }
|
6550 - | }
|
6551 - | }
|
6552 - | }
|
6553 - | impl
|
6554 - | ::aws_smithy_http_server::response::IntoResponse<
|
6555 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6556 - | > for crate::error::MalformedRequiredError
|
6557 - | {
|
6558 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
6559 - | match crate::protocol_serde::shape_malformed_required::ser_malformed_required_http_error(
|
6560 - | &self,
|
6561 - | ) {
|
6562 - | Ok(mut response) => {
|
6563 - | response.extensions_mut().insert(
|
6564 - | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
6565 - | );
|
6566 - | response
|
6567 - | }
|
6568 - | Err(e) => {
|
6569 - | ::tracing::error!(error = %e, "failed to serialize response");
|
6570 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
6571 - | }
|
6572 - | }
|
6573 - | }
|
6574 - | }
|
6575 - |
|
6576 - | const CONTENT_TYPE_MALFORMEDRANGEOVERRIDE: ::mime::Mime = ::mime::APPLICATION_JSON;
|
6577 - | ::pin_project_lite::pin_project! {
|
6578 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
6579 - | /// [`MalformedRangeOverrideInput`](crate::input::MalformedRangeOverrideInput) using modelled bindings.
|
6580 - | pub struct MalformedRangeOverrideInputFuture {
|
6581 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedRangeOverrideInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
6582 - | }
|
6583 - | }
|
6584 - |
|
6585 - | impl std::future::Future for MalformedRangeOverrideInputFuture {
|
6586 - | type Output = Result<
|
6587 - | crate::input::MalformedRangeOverrideInput,
|
6588 - | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
6589 - | >;
|
6590 - |
|
6591 - | fn poll(
|
6592 - | self: std::pin::Pin<&mut Self>,
|
6593 - | cx: &mut std::task::Context<'_>,
|
6594 - | ) -> std::task::Poll<Self::Output> {
|
6595 - | let this = self.project();
|
6596 - | this.inner.as_mut().poll(cx)
|
6597 - | }
|
6598 - | }
|
6599 - |
|
6600 - | impl<B>
|
6601 - | ::aws_smithy_http_server::request::FromRequest<
|
6602 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6603 - | B,
|
6604 - | > for crate::input::MalformedRangeOverrideInput
|
6605 - | where
|
6606 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
6607 - | B: 'static,
|
6608 - |
|
6609 - | B::Data: Send,
|
6610 - | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
6611 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
6612 - | {
|
6613 - | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
6614 - | type Future = MalformedRangeOverrideInputFuture;
|
6615 - |
|
6616 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
6617 - | let fut = async move {
|
6618 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
6619 - | request.headers(),
|
6620 - | &CONTENT_TYPE_MALFORMEDRANGEOVERRIDE,
|
6621 - | ) {
|
6622 - | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
6623 - | }
|
6624 - | crate::protocol_serde::shape_malformed_range_override::de_malformed_range_override_http_request(request)
|
6625 - | .await
|
6626 - | .map_err(Into::into)
|
6627 - | };
|
6628 - | use ::futures_util::future::TryFutureExt;
|
6629 - | let fut = fut.map_err(
|
6630 - | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
6631 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
6632 - | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
6633 - | e,
|
6634 - | )
|
6635 - | },
|
6636 - | );
|
6637 - | MalformedRangeOverrideInputFuture {
|
6638 - | inner: Box::pin(fut),
|
6639 - | }
|
6640 - | }
|
6641 - | }
|
6642 - | impl
|
6643 - | ::aws_smithy_http_server::response::IntoResponse<
|
6644 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6645 - | > for crate::output::MalformedRangeOverrideOutput
|
6646 - | {
|
6647 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
6648 - | match crate::protocol_serde::shape_malformed_range_override::ser_malformed_range_override_http_response(self) {
|
6649 - | Ok(response) => response,
|
6650 - | Err(e) => {
|
6651 - | ::tracing::error!(error = %e, "failed to serialize response");
|
6652 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
6653 - | }
|
6654 - | }
|
6655 - | }
|
6656 - | }
|
6657 - | impl
|
6658 - | ::aws_smithy_http_server::response::IntoResponse<
|
6659 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6660 - | > for crate::error::MalformedRangeOverrideError
|
6661 - | {
|
6662 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
6663 - | match crate::protocol_serde::shape_malformed_range_override::ser_malformed_range_override_http_error(&self) {
|
6664 - | Ok(mut response) => {
|
6665 - | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
6666 - | response
|
6667 - | },
|
6668 - | Err(e) => {
|
6669 - | ::tracing::error!(error = %e, "failed to serialize response");
|
6670 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
6671 - | }
|
6672 - | }
|
6673 - | }
|
6674 - | }
|
6675 - |
|
6676 - | const CONTENT_TYPE_MALFORMEDRANGE: ::mime::Mime = ::mime::APPLICATION_JSON;
|
6677 - | ::pin_project_lite::pin_project! {
|
6678 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
6679 - | /// [`MalformedRangeInput`](crate::input::MalformedRangeInput) using modelled bindings.
|
6680 - | pub struct MalformedRangeInputFuture {
|
6681 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedRangeInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
6682 - | }
|
6683 - | }
|
6684 - |
|
6685 - | impl std::future::Future for MalformedRangeInputFuture {
|
6686 - | type Output = Result<
|
6687 - | crate::input::MalformedRangeInput,
|
6688 - | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
6689 - | >;
|
6690 - |
|
6691 - | fn poll(
|
6692 - | self: std::pin::Pin<&mut Self>,
|
6693 - | cx: &mut std::task::Context<'_>,
|
6694 - | ) -> std::task::Poll<Self::Output> {
|
6695 - | let this = self.project();
|
6696 - | this.inner.as_mut().poll(cx)
|
6697 - | }
|
6698 - | }
|
6699 - |
|
6700 - | impl<B>
|
6701 - | ::aws_smithy_http_server::request::FromRequest<
|
6702 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6703 - | B,
|
6704 - | > for crate::input::MalformedRangeInput
|
6705 - | where
|
6706 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
6707 - | B: 'static,
|
6708 - |
|
6709 - | B::Data: Send,
|
6710 - | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
6711 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
6712 - | {
|
6713 - | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
6714 - | type Future = MalformedRangeInputFuture;
|
6715 - |
|
6716 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
6717 - | let fut = async move {
|
6718 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
6719 - | request.headers(),
|
6720 - | &CONTENT_TYPE_MALFORMEDRANGE,
|
6721 - | ) {
|
6722 - | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
6723 - | }
|
6724 - | crate::protocol_serde::shape_malformed_range::de_malformed_range_http_request(request)
|
6725 - | .await
|
6726 - | .map_err(Into::into)
|
6727 - | };
|
6728 - | use ::futures_util::future::TryFutureExt;
|
6729 - | let fut = fut.map_err(
|
6730 - | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
6731 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
6732 - | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
6733 - | e,
|
6734 - | )
|
6735 - | },
|
6736 - | );
|
6737 - | MalformedRangeInputFuture {
|
6738 - | inner: Box::pin(fut),
|
6739 - | }
|
6740 - | }
|
6741 - | }
|
6742 - | impl
|
6743 - | ::aws_smithy_http_server::response::IntoResponse<
|
6744 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6745 - | > for crate::output::MalformedRangeOutput
|
6746 - | {
|
6747 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
6748 - | match crate::protocol_serde::shape_malformed_range::ser_malformed_range_http_response(self)
|
6749 - | {
|
6750 - | Ok(response) => response,
|
6751 - | Err(e) => {
|
6752 - | ::tracing::error!(error = %e, "failed to serialize response");
|
6753 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
6754 - | }
|
6755 - | }
|
6756 - | }
|
6757 - | }
|
6758 - | impl
|
6759 - | ::aws_smithy_http_server::response::IntoResponse<
|
6760 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6761 - | > for crate::error::MalformedRangeError
|
6762 - | {
|
6763 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
6764 - | match crate::protocol_serde::shape_malformed_range::ser_malformed_range_http_error(&self) {
|
6765 - | Ok(mut response) => {
|
6766 - | response.extensions_mut().insert(
|
6767 - | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
6768 - | );
|
6769 - | response
|
6770 - | }
|
6771 - | Err(e) => {
|
6772 - | ::tracing::error!(error = %e, "failed to serialize response");
|
6773 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
6774 - | }
|
6775 - | }
|
6776 - | }
|
6777 - | }
|
6778 - |
|
6779 - | const CONTENT_TYPE_MALFORMEDPATTERNOVERRIDE: ::mime::Mime = ::mime::APPLICATION_JSON;
|
6780 - | ::pin_project_lite::pin_project! {
|
6781 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
6782 - | /// [`MalformedPatternOverrideInput`](crate::input::MalformedPatternOverrideInput) using modelled bindings.
|
6783 - | pub struct MalformedPatternOverrideInputFuture {
|
6784 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedPatternOverrideInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
6785 - | }
|
6786 - | }
|
6787 - |
|
6788 - | impl std::future::Future for MalformedPatternOverrideInputFuture {
|
6789 - | type Output = Result<
|
6790 - | crate::input::MalformedPatternOverrideInput,
|
6791 - | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
6792 - | >;
|
6793 - |
|
6794 - | fn poll(
|
6795 - | self: std::pin::Pin<&mut Self>,
|
6796 - | cx: &mut std::task::Context<'_>,
|
6797 - | ) -> std::task::Poll<Self::Output> {
|
6798 - | let this = self.project();
|
6799 - | this.inner.as_mut().poll(cx)
|
6800 - | }
|
6801 - | }
|
6802 - |
|
6803 - | impl<B>
|
6804 - | ::aws_smithy_http_server::request::FromRequest<
|
6805 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6806 - | B,
|
6807 - | > for crate::input::MalformedPatternOverrideInput
|
6808 - | where
|
6809 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
6810 - | B: 'static,
|
6811 - |
|
6812 - | B::Data: Send,
|
6813 - | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
6814 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
6815 - | {
|
6816 - | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
6817 - | type Future = MalformedPatternOverrideInputFuture;
|
6818 - |
|
6819 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
6820 - | let fut = async move {
|
6821 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
6822 - | request.headers(),
|
6823 - | &CONTENT_TYPE_MALFORMEDPATTERNOVERRIDE,
|
6824 - | ) {
|
6825 - | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
6826 - | }
|
6827 - | crate::protocol_serde::shape_malformed_pattern_override::de_malformed_pattern_override_http_request(request)
|
6828 - | .await
|
6829 - | .map_err(Into::into)
|
6830 - | };
|
6831 - | use ::futures_util::future::TryFutureExt;
|
6832 - | let fut = fut.map_err(
|
6833 - | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
6834 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
6835 - | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
6836 - | e,
|
6837 - | )
|
6838 - | },
|
6839 - | );
|
6840 - | MalformedPatternOverrideInputFuture {
|
6841 - | inner: Box::pin(fut),
|
6842 - | }
|
6843 - | }
|
6844 - | }
|
6845 - | impl
|
6846 - | ::aws_smithy_http_server::response::IntoResponse<
|
6847 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6848 - | > for crate::output::MalformedPatternOverrideOutput
|
6849 - | {
|
6850 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
6851 - | match crate::protocol_serde::shape_malformed_pattern_override::ser_malformed_pattern_override_http_response(self) {
|
6852 - | Ok(response) => response,
|
6853 - | Err(e) => {
|
6854 - | ::tracing::error!(error = %e, "failed to serialize response");
|
6855 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
6856 - | }
|
6857 - | }
|
6858 - | }
|
6859 - | }
|
6860 - | impl
|
6861 - | ::aws_smithy_http_server::response::IntoResponse<
|
6862 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6863 - | > for crate::error::MalformedPatternOverrideError
|
6864 - | {
|
6865 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
6866 - | match crate::protocol_serde::shape_malformed_pattern_override::ser_malformed_pattern_override_http_error(&self) {
|
6867 - | Ok(mut response) => {
|
6868 - | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
6869 - | response
|
6870 - | },
|
6871 - | Err(e) => {
|
6872 - | ::tracing::error!(error = %e, "failed to serialize response");
|
6873 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
6874 - | }
|
6875 - | }
|
6876 - | }
|
6877 - | }
|
6878 - |
|
6879 - | const CONTENT_TYPE_MALFORMEDPATTERN: ::mime::Mime = ::mime::APPLICATION_JSON;
|
6880 - | ::pin_project_lite::pin_project! {
|
6881 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
6882 - | /// [`MalformedPatternInput`](crate::input::MalformedPatternInput) using modelled bindings.
|
6883 - | pub struct MalformedPatternInputFuture {
|
6884 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedPatternInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
6885 - | }
|
6886 - | }
|
6887 - |
|
6888 - | impl std::future::Future for MalformedPatternInputFuture {
|
6889 - | type Output = Result<
|
6890 - | crate::input::MalformedPatternInput,
|
6891 - | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
6892 - | >;
|
6893 - |
|
6894 - | fn poll(
|
6895 - | self: std::pin::Pin<&mut Self>,
|
6896 - | cx: &mut std::task::Context<'_>,
|
6897 - | ) -> std::task::Poll<Self::Output> {
|
6898 - | let this = self.project();
|
6899 - | this.inner.as_mut().poll(cx)
|
6900 - | }
|
6901 - | }
|
6902 - |
|
6903 - | impl<B>
|
6904 - | ::aws_smithy_http_server::request::FromRequest<
|
6905 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6906 - | B,
|
6907 - | > for crate::input::MalformedPatternInput
|
6908 - | where
|
6909 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
6910 - | B: 'static,
|
6911 - |
|
6912 - | B::Data: Send,
|
6913 - | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
6914 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
6915 - | {
|
6916 - | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
6917 - | type Future = MalformedPatternInputFuture;
|
6918 - |
|
6919 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
6920 - | let fut = async move {
|
6921 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
6922 - | request.headers(),
|
6923 - | &CONTENT_TYPE_MALFORMEDPATTERN,
|
6924 - | ) {
|
6925 - | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
6926 - | }
|
6927 - | crate::protocol_serde::shape_malformed_pattern::de_malformed_pattern_http_request(
|
6928 - | request,
|
6929 - | )
|
6930 - | .await
|
6931 - | .map_err(Into::into)
|
6932 - | };
|
6933 - | use ::futures_util::future::TryFutureExt;
|
6934 - | let fut = fut.map_err(
|
6935 - | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
6936 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
6937 - | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
6938 - | e,
|
6939 - | )
|
6940 - | },
|
6941 - | );
|
6942 - | MalformedPatternInputFuture {
|
6943 - | inner: Box::pin(fut),
|
6944 - | }
|
6945 - | }
|
6946 - | }
|
6947 - | impl
|
6948 - | ::aws_smithy_http_server::response::IntoResponse<
|
6949 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6950 - | > for crate::output::MalformedPatternOutput
|
6951 - | {
|
6952 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
6953 - | match crate::protocol_serde::shape_malformed_pattern::ser_malformed_pattern_http_response(
|
6954 - | self,
|
6955 - | ) {
|
6956 - | Ok(response) => response,
|
6957 - | Err(e) => {
|
6958 - | ::tracing::error!(error = %e, "failed to serialize response");
|
6959 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
6960 - | }
|
6961 - | }
|
6962 - | }
|
6963 - | }
|
6964 - | impl
|
6965 - | ::aws_smithy_http_server::response::IntoResponse<
|
6966 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6967 - | > for crate::error::MalformedPatternError
|
6968 - | {
|
6969 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
6970 - | match crate::protocol_serde::shape_malformed_pattern::ser_malformed_pattern_http_error(
|
6971 - | &self,
|
6972 - | ) {
|
6973 - | Ok(mut response) => {
|
6974 - | response.extensions_mut().insert(
|
6975 - | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
6976 - | );
|
6977 - | response
|
6978 - | }
|
6979 - | Err(e) => {
|
6980 - | ::tracing::error!(error = %e, "failed to serialize response");
|
6981 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
6982 - | }
|
6979 + | /// When a string member does not contain a valid enum value,
|
6980 + | /// the response should be a 400 ValidationException. Internal-only
|
6981 + | /// enum values are excluded from the response message.
|
6982 + | /// Test ID: RestJsonMalformedEnumString_case1
|
6983 + | #[::tokio::test]
|
6984 + | #[::tracing_test::traced_test]
|
6985 + | #[should_panic]
|
6986 + | async fn rest_json_malformed_enum_string_case1_malformed_request() {
|
6987 + | {
|
6988 + | #[allow(unused_mut)]
|
6989 + | let mut http_request = http::Request::builder()
|
6990 + | .uri("/MalformedEnum")
|
6991 + | .method("POST")
|
6992 + | .header("content-type", "application/json")
|
6993 + | .body(::aws_smithy_http_server::body::Body::from(
|
6994 + | ::bytes::Bytes::from_static("{ \"string\" : \"XYZ\" }".as_bytes()),
|
6995 + | ))
|
6996 + | .unwrap();
|
6997 + | #[allow(unused_mut)]
|
6998 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6999 + | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7000 + | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7001 + | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7002 + | let sender = sender.clone();
|
7003 + | async move {
|
7004 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
7005 + | sender.send(()).await.expect("receiver dropped early");
|
7006 + | result
|
7007 + | }
|
7008 + | })
|
7009 + | .build_unchecked();
|
7010 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7011 + | .await
|
7012 + | .expect("unable to make an HTTP request");
|
7013 + | ::pretty_assertions::assert_eq!(
|
7014 + | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7015 + | http_response.status()
|
7016 + | );
|
7017 + | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7018 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7019 + | http_response.headers(),
|
7020 + | expected_headers,
|
7021 + | ));
|
7022 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7023 + | .await
|
7024 + | .expect("unable to extract body to bytes");
|
7025 + | ::aws_smithy_protocol_test::assert_ok(
|
7026 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/string' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/string' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7027 + | );
|
6983 7028 | }
|
6984 7029 | }
|
6985 - | }
|
6986 - |
|
6987 - | const CONTENT_TYPE_MALFORMEDLENGTHQUERYSTRING: ::mime::Mime = ::mime::APPLICATION_JSON;
|
6988 - | ::pin_project_lite::pin_project! {
|
6989 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
6990 - | /// [`MalformedLengthQueryStringInput`](crate::input::MalformedLengthQueryStringInput) using modelled bindings.
|
6991 - | pub struct MalformedLengthQueryStringInputFuture {
|
6992 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedLengthQueryStringInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
6993 - | }
|
6994 - | }
|
6995 - |
|
6996 - | impl std::future::Future for MalformedLengthQueryStringInputFuture {
|
6997 - | type Output = Result<
|
6998 - | crate::input::MalformedLengthQueryStringInput,
|
6999 - | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
7000 - | >;
|
7001 - |
|
7002 - | fn poll(
|
7003 - | self: std::pin::Pin<&mut Self>,
|
7004 - | cx: &mut std::task::Context<'_>,
|
7005 - | ) -> std::task::Poll<Self::Output> {
|
7006 - | let this = self.project();
|
7007 - | this.inner.as_mut().poll(cx)
|
7008 - | }
|
7009 - | }
|
7010 - |
|
7011 - | impl<B>
|
7012 - | ::aws_smithy_http_server::request::FromRequest<
|
7013 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
7014 - | B,
|
7015 - | > for crate::input::MalformedLengthQueryStringInput
|
7016 - | where
|
7017 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
7018 - | B: 'static,
|
7019 - |
|
7020 - | B::Data: Send,
|
7021 - | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
7022 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
7023 - | {
|
7024 - | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
7025 - | type Future = MalformedLengthQueryStringInputFuture;
|
7026 - |
|
7027 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
7028 - | let fut = async move {
|
7029 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
7030 - | request.headers(),
|
7031 - | &CONTENT_TYPE_MALFORMEDLENGTHQUERYSTRING,
|
7032 - | ) {
|
7033 - | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
7034 - | }
|
7035 - | crate::protocol_serde::shape_malformed_length_query_string::de_malformed_length_query_string_http_request(request)
|
7036 - | .await
|
7037 - | .map_err(Into::into)
|
7038 - | };
|
7039 - | use ::futures_util::future::TryFutureExt;
|
7040 - | let fut = fut.map_err(
|
7041 - | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
7042 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
7043 - | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
7044 - | e,
|
7045 - | )
|
7046 - | },
|
7047 - | );
|
7048 - | MalformedLengthQueryStringInputFuture {
|
7049 - | inner: Box::pin(fut),
|
7030 + | /// When a string member does not contain a valid enum value,
|
7031 + | /// the response should be a 400 ValidationException. Internal-only
|
7032 + | /// enum values are excluded from the response message.
|
7033 + | /// Test ID: RestJsonMalformedEnumTraitString_case0
|
7034 + | #[::tokio::test]
|
7035 + | #[::tracing_test::traced_test]
|
7036 + | #[should_panic]
|
7037 + | async fn rest_json_malformed_enum_trait_string_case0_malformed_request() {
|
7038 + | {
|
7039 + | #[allow(unused_mut)]
|
7040 + | let mut http_request = http::Request::builder()
|
7041 + | .uri("/MalformedEnum")
|
7042 + | .method("POST")
|
7043 + | .header("content-type", "application/json")
|
7044 + | .body(::aws_smithy_http_server::body::Body::from(
|
7045 + | ::bytes::Bytes::from_static("{ \"stringWithEnumTrait\" : \"ABC\" }".as_bytes()),
|
7046 + | ))
|
7047 + | .unwrap();
|
7048 + | #[allow(unused_mut)]
|
7049 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7050 + | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7051 + | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7052 + | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7053 + | let sender = sender.clone();
|
7054 + | async move {
|
7055 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
7056 + | sender.send(()).await.expect("receiver dropped early");
|
7057 + | result
|
7058 + | }
|
7059 + | })
|
7060 + | .build_unchecked();
|
7061 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7062 + | .await
|
7063 + | .expect("unable to make an HTTP request");
|
7064 + | ::pretty_assertions::assert_eq!(
|
7065 + | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7066 + | http_response.status()
|
7067 + | );
|
7068 + | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7069 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7070 + | http_response.headers(),
|
7071 + | expected_headers,
|
7072 + | ));
|
7073 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7074 + | .await
|
7075 + | .expect("unable to extract body to bytes");
|
7076 + | ::aws_smithy_protocol_test::assert_ok(
|
7077 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/stringWithEnumTrait' failed to satisfy constraint: Member must satisfy enum value set: [abc, def]\",\n \"fieldList\" : [{\"message\": \"Value at '/stringWithEnumTrait' failed to satisfy constraint: Member must satisfy enum value set: [abc, def]\", \"path\": \"/stringWithEnumTrait\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7078 + | );
|
7050 7079 | }
|
7051 7080 | }
|
7052 - | }
|
7053 - | impl
|
7054 - | ::aws_smithy_http_server::response::IntoResponse<
|
7055 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
7056 - | > for crate::output::MalformedLengthQueryStringOutput
|
7057 - | {
|
7058 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
7059 - | match crate::protocol_serde::shape_malformed_length_query_string::ser_malformed_length_query_string_http_response(self) {
|
7060 - | Ok(response) => response,
|
7061 - | Err(e) => {
|
7062 - | ::tracing::error!(error = %e, "failed to serialize response");
|
7063 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
7064 - | }
|
7065 - | }
|
7066 - | }
|
7067 - | }
|
7068 - | impl
|
7069 - | ::aws_smithy_http_server::response::IntoResponse<
|
7070 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
7071 - | > for crate::error::MalformedLengthQueryStringError
|
7072 - | {
|
7073 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
7074 - | match crate::protocol_serde::shape_malformed_length_query_string::ser_malformed_length_query_string_http_error(&self) {
|
7075 - | Ok(mut response) => {
|
7076 - | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
7077 - | response
|
7078 - | },
|
7079 - | Err(e) => {
|
7080 - | ::tracing::error!(error = %e, "failed to serialize response");
|
7081 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
7082 - | }
|
7081 + | /// When a string member does not contain a valid enum value,
|
7082 + | /// the response should be a 400 ValidationException. Internal-only
|
7083 + | /// enum values are excluded from the response message.
|
7084 + | /// Test ID: RestJsonMalformedEnumTraitString_case1
|
7085 + | #[::tokio::test]
|
7086 + | #[::tracing_test::traced_test]
|
7087 + | #[should_panic]
|
7088 + | async fn rest_json_malformed_enum_trait_string_case1_malformed_request() {
|
7089 + | {
|
7090 + | #[allow(unused_mut)]
|
7091 + | let mut http_request = http::Request::builder()
|
7092 + | .uri("/MalformedEnum")
|
7093 + | .method("POST")
|
7094 + | .header("content-type", "application/json")
|
7095 + | .body(::aws_smithy_http_server::body::Body::from(
|
7096 + | ::bytes::Bytes::from_static("{ \"stringWithEnumTrait\" : \"XYZ\" }".as_bytes()),
|
7097 + | ))
|
7098 + | .unwrap();
|
7099 + | #[allow(unused_mut)]
|
7100 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7101 + | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7102 + | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7103 + | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7104 + | let sender = sender.clone();
|
7105 + | async move {
|
7106 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
7107 + | sender.send(()).await.expect("receiver dropped early");
|
7108 + | result
|
7109 + | }
|
7110 + | })
|
7111 + | .build_unchecked();
|
7112 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7113 + | .await
|
7114 + | .expect("unable to make an HTTP request");
|
7115 + | ::pretty_assertions::assert_eq!(
|
7116 + | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7117 + | http_response.status()
|
7118 + | );
|
7119 + | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7120 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7121 + | http_response.headers(),
|
7122 + | expected_headers,
|
7123 + | ));
|
7124 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7125 + | .await
|
7126 + | .expect("unable to extract body to bytes");
|
7127 + | ::aws_smithy_protocol_test::assert_ok(
|
7128 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/stringWithEnumTrait' failed to satisfy constraint: Member must satisfy enum value set: [abc, def]\",\n \"fieldList\" : [{\"message\": \"Value at '/stringWithEnumTrait' failed to satisfy constraint: Member must satisfy enum value set: [abc, def]\", \"path\": \"/stringWithEnumTrait\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7129 + | );
|
7083 7130 | }
|
7084 7131 | }
|
7085 - | }
|
7086 - |
|
7087 - | const CONTENT_TYPE_MALFORMEDLENGTHOVERRIDE: ::mime::Mime = ::mime::APPLICATION_JSON;
|
7088 - | ::pin_project_lite::pin_project! {
|
7089 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
7090 - | /// [`MalformedLengthOverrideInput`](crate::input::MalformedLengthOverrideInput) using modelled bindings.
|
7091 - | pub struct MalformedLengthOverrideInputFuture {
|
7092 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedLengthOverrideInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
7093 - | }
|
7094 - | }
|
7095 - |
|
7096 - | impl std::future::Future for MalformedLengthOverrideInputFuture {
|
7097 - | type Output = Result<
|
7098 - | crate::input::MalformedLengthOverrideInput,
|
7099 - | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
7100 - | >;
|
7101 - |
|
7102 - | fn poll(
|
7103 - | self: std::pin::Pin<&mut Self>,
|
7104 - | cx: &mut std::task::Context<'_>,
|
7105 - | ) -> std::task::Poll<Self::Output> {
|
7106 - | let this = self.project();
|
7107 - | this.inner.as_mut().poll(cx)
|
7108 - | }
|
7109 - | }
|
7110 - |
|
7111 - | impl<B>
|
7112 - | ::aws_smithy_http_server::request::FromRequest<
|
7113 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
7114 - | B,
|
7115 - | > for crate::input::MalformedLengthOverrideInput
|
7116 - | where
|
7117 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
7118 - | B: 'static,
|
7119 - |
|
7120 - | B::Data: Send,
|
7121 - | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
7122 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
7123 - | {
|
7124 - | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
7125 - | type Future = MalformedLengthOverrideInputFuture;
|
7126 - |
|
7127 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
7128 - | let fut = async move {
|
7129 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
7130 - | request.headers(),
|
7131 - | &CONTENT_TYPE_MALFORMEDLENGTHOVERRIDE,
|
7132 - | ) {
|
7133 - | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
7134 - | }
|
7135 - | crate::protocol_serde::shape_malformed_length_override::de_malformed_length_override_http_request(request)
|
7136 - | .await
|
7137 - | .map_err(Into::into)
|
7138 - | };
|
7139 - | use ::futures_util::future::TryFutureExt;
|
7140 - | let fut = fut.map_err(
|
7141 - | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
7142 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
7143 - | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
7144 - | e,
|
7145 - | )
|
7146 - | },
|
7147 - | );
|
7148 - | MalformedLengthOverrideInputFuture {
|
7149 - | inner: Box::pin(fut),
|
7132 + | /// When a list member value does not contain a valid enum value,
|
7133 + | /// the response should be a 400 ValidationException. Internal-only
|
7134 + | /// enum values are excluded from the response message.
|
7135 + | /// Test ID: RestJsonMalformedEnumList_case0
|
7136 + | #[::tokio::test]
|
7137 + | #[::tracing_test::traced_test]
|
7138 + | #[should_panic]
|
7139 + | async fn rest_json_malformed_enum_list_case0_malformed_request() {
|
7140 + | {
|
7141 + | #[allow(unused_mut)]
|
7142 + | let mut http_request = http::Request::builder()
|
7143 + | .uri("/MalformedEnum")
|
7144 + | .method("POST")
|
7145 + | .header("content-type", "application/json")
|
7146 + | .body(::aws_smithy_http_server::body::Body::from(
|
7147 + | ::bytes::Bytes::from_static("{ \"list\" : [\"ABC\"] }".as_bytes()),
|
7148 + | ))
|
7149 + | .unwrap();
|
7150 + | #[allow(unused_mut)]
|
7151 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7152 + | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7153 + | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7154 + | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7155 + | let sender = sender.clone();
|
7156 + | async move {
|
7157 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
7158 + | sender.send(()).await.expect("receiver dropped early");
|
7159 + | result
|
7160 + | }
|
7161 + | })
|
7162 + | .build_unchecked();
|
7163 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7164 + | .await
|
7165 + | .expect("unable to make an HTTP request");
|
7166 + | ::pretty_assertions::assert_eq!(
|
7167 + | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7168 + | http_response.status()
|
7169 + | );
|
7170 + | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7171 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7172 + | http_response.headers(),
|
7173 + | expected_headers,
|
7174 + | ));
|
7175 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7176 + | .await
|
7177 + | .expect("unable to extract body to bytes");
|
7178 + | ::aws_smithy_protocol_test::assert_ok(
|
7179 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/list/0' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/list/0' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/list/0\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7180 + | );
|
7150 7181 | }
|
7151 7182 | }
|
7152 - | }
|
7153 - | impl
|
7154 - | ::aws_smithy_http_server::response::IntoResponse<
|
7155 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
7156 - | > for crate::output::MalformedLengthOverrideOutput
|
7157 - | {
|
7158 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
7159 - | match crate::protocol_serde::shape_malformed_length_override::ser_malformed_length_override_http_response(self) {
|
7160 - | Ok(response) => response,
|
7161 - | Err(e) => {
|
7162 - | ::tracing::error!(error = %e, "failed to serialize response");
|
7163 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
7164 - | }
|
7165 - | }
|
7166 - | }
|
7167 - | }
|
7168 - | impl
|
7169 - | ::aws_smithy_http_server::response::IntoResponse<
|
7170 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
7171 - | > for crate::error::MalformedLengthOverrideError
|
7172 - | {
|
7173 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
7174 - | match crate::protocol_serde::shape_malformed_length_override::ser_malformed_length_override_http_error(&self) {
|
7175 - | Ok(mut response) => {
|
7176 - | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
7177 - | response
|
7178 - | },
|
7179 - | Err(e) => {
|
7180 - | ::tracing::error!(error = %e, "failed to serialize response");
|
7181 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
7182 - | }
|
7183 + | /// When a list member value does not contain a valid enum value,
|
7184 + | /// the response should be a 400 ValidationException. Internal-only
|
7185 + | /// enum values are excluded from the response message.
|
7186 + | /// Test ID: RestJsonMalformedEnumList_case1
|
7187 + | #[::tokio::test]
|
7188 + | #[::tracing_test::traced_test]
|
7189 + | #[should_panic]
|
7190 + | async fn rest_json_malformed_enum_list_case1_malformed_request() {
|
7191 + | {
|
7192 + | #[allow(unused_mut)]
|
7193 + | let mut http_request = http::Request::builder()
|
7194 + | .uri("/MalformedEnum")
|
7195 + | .method("POST")
|
7196 + | .header("content-type", "application/json")
|
7197 + | .body(::aws_smithy_http_server::body::Body::from(
|
7198 + | ::bytes::Bytes::from_static("{ \"list\" : [\"XYZ\"] }".as_bytes()),
|
7199 + | ))
|
7200 + | .unwrap();
|
7201 + | #[allow(unused_mut)]
|
7202 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7203 + | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7204 + | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7205 + | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7206 + | let sender = sender.clone();
|
7207 + | async move {
|
7208 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
7209 + | sender.send(()).await.expect("receiver dropped early");
|
7210 + | result
|
7211 + | }
|
7212 + | })
|
7213 + | .build_unchecked();
|
7214 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7215 + | .await
|
7216 + | .expect("unable to make an HTTP request");
|
7217 + | ::pretty_assertions::assert_eq!(
|
7218 + | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7219 + | http_response.status()
|
7220 + | );
|
7221 + | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7222 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7223 + | http_response.headers(),
|
7224 + | expected_headers,
|
7225 + | ));
|
7226 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7227 + | .await
|
7228 + | .expect("unable to extract body to bytes");
|
7229 + | ::aws_smithy_protocol_test::assert_ok(
|
7230 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/list/0' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/list/0' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/list/0\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7231 + | );
|
7183 7232 | }
|
7184 7233 | }
|
7185 - | }
|
7186 - |
|
7187 - | const CONTENT_TYPE_MALFORMEDLENGTH: ::mime::Mime = ::mime::APPLICATION_JSON;
|
7188 - | ::pin_project_lite::pin_project! {
|
7189 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
7190 - | /// [`MalformedLengthInput`](crate::input::MalformedLengthInput) using modelled bindings.
|
7191 - | pub struct MalformedLengthInputFuture {
|
7192 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedLengthInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
7193 - | }
|
7194 - | }
|
7195 - |
|
7196 - | impl std::future::Future for MalformedLengthInputFuture {
|
7197 - | type Output = Result<
|
7198 - | crate::input::MalformedLengthInput,
|
7199 - | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
7200 - | >;
|
7201 - |
|
7202 - | fn poll(
|
7203 - | self: std::pin::Pin<&mut Self>,
|
7204 - | cx: &mut std::task::Context<'_>,
|
7205 - | ) -> std::task::Poll<Self::Output> {
|
7206 - | let this = self.project();
|
7207 - | this.inner.as_mut().poll(cx)
|
7208 - | }
|
7209 - | }
|
7210 - |
|
7211 - | impl<B>
|
7212 - | ::aws_smithy_http_server::request::FromRequest<
|
7213 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
7214 - | B,
|
7215 - | > for crate::input::MalformedLengthInput
|
7216 - | where
|
7217 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
7218 - | B: 'static,
|
7219 - |
|
7220 - | B::Data: Send,
|
7221 - | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
7222 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
7223 - | {
|
7224 - | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
7225 - | type Future = MalformedLengthInputFuture;
|
7226 - |
|
7227 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
7228 - | let fut = async move {
|
7229 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
7230 - | request.headers(),
|
7231 - | &CONTENT_TYPE_MALFORMEDLENGTH,
|
7232 - | ) {
|
7233 - | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
7234 - | }
|
7235 - | crate::protocol_serde::shape_malformed_length::de_malformed_length_http_request(request)
|
7234 + | /// When a map member's key does not contain a valid enum value,
|
7235 + | /// the response should be a 400 ValidationException. Internal-only
|
7236 + | /// enum values are excluded from the response message.
|
7237 + | /// Test ID: RestJsonMalformedEnumMapKey_case0
|
7238 + | #[::tokio::test]
|
7239 + | #[::tracing_test::traced_test]
|
7240 + | #[should_panic]
|
7241 + | async fn rest_json_malformed_enum_map_key_case0_malformed_request() {
|
7242 + | {
|
7243 + | #[allow(unused_mut)]
|
7244 + | let mut http_request = http::Request::builder()
|
7245 + | .uri("/MalformedEnum")
|
7246 + | .method("POST")
|
7247 + | .header("content-type", "application/json")
|
7248 + | .body(::aws_smithy_http_server::body::Body::from(
|
7249 + | ::bytes::Bytes::from_static("{ \"map\" : { \"ABC\" : \"abc\" } }".as_bytes()),
|
7250 + | ))
|
7251 + | .unwrap();
|
7252 + | #[allow(unused_mut)]
|
7253 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7254 + | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7255 + | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7256 + | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7257 + | let sender = sender.clone();
|
7258 + | async move {
|
7259 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
7260 + | sender.send(()).await.expect("receiver dropped early");
|
7261 + | result
|
7262 + | }
|
7263 + | })
|
7264 + | .build_unchecked();
|
7265 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7236 7266 | .await
|
7237 - | .map_err(Into::into)
|
7238 - | };
|
7239 - | use ::futures_util::future::TryFutureExt;
|
7240 - | let fut = fut.map_err(
|
7241 - | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
7242 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
7243 - | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
7244 - | e,
|
7245 - | )
|
7246 - | },
|
7247 - | );
|
7248 - | MalformedLengthInputFuture {
|
7249 - | inner: Box::pin(fut),
|
7267 + | .expect("unable to make an HTTP request");
|
7268 + | ::pretty_assertions::assert_eq!(
|
7269 + | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7270 + | http_response.status()
|
7271 + | );
|
7272 + | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7273 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7274 + | http_response.headers(),
|
7275 + | expected_headers,
|
7276 + | ));
|
7277 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7278 + | .await
|
7279 + | .expect("unable to extract body to bytes");
|
7280 + | ::aws_smithy_protocol_test::assert_ok(
|
7281 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/map' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7282 + | );
|
7250 7283 | }
|
7251 7284 | }
|
7252 - | }
|
7253 - | impl
|
7254 - | ::aws_smithy_http_server::response::IntoResponse<
|
7255 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
7256 - | > for crate::output::MalformedLengthOutput
|
7257 - | {
|
7258 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
7259 - | match crate::protocol_serde::shape_malformed_length::ser_malformed_length_http_response(
|
7260 - | self,
|
7261 - | ) {
|
7262 - | Ok(response) => response,
|
7263 - | Err(e) => {
|
7264 - | ::tracing::error!(error = %e, "failed to serialize response");
|
7265 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
7266 - | }
|
7285 + | /// When a map member's key does not contain a valid enum value,
|
7286 + | /// the response should be a 400 ValidationException. Internal-only
|
7287 + | /// enum values are excluded from the response message.
|
7288 + | /// Test ID: RestJsonMalformedEnumMapKey_case1
|
7289 + | #[::tokio::test]
|
7290 + | #[::tracing_test::traced_test]
|
7291 + | #[should_panic]
|
7292 + | async fn rest_json_malformed_enum_map_key_case1_malformed_request() {
|
7293 + | {
|
7294 + | #[allow(unused_mut)]
|
7295 + | let mut http_request = http::Request::builder()
|
7296 + | .uri("/MalformedEnum")
|
7297 + | .method("POST")
|
7298 + | .header("content-type", "application/json")
|
7299 + | .body(::aws_smithy_http_server::body::Body::from(
|
7300 + | ::bytes::Bytes::from_static("{ \"map\" : { \"XYZ\" : \"abc\" } }".as_bytes()),
|
7301 + | ))
|
7302 + | .unwrap();
|
7303 + | #[allow(unused_mut)]
|
7304 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7305 + | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7306 + | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7307 + | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7308 + | let sender = sender.clone();
|
7309 + | async move {
|
7310 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
7311 + | sender.send(()).await.expect("receiver dropped early");
|
7312 + | result
|
7313 + | }
|
7314 + | })
|
7315 + | .build_unchecked();
|
7316 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7317 + | .await
|
7318 + | .expect("unable to make an HTTP request");
|
7319 + | ::pretty_assertions::assert_eq!(
|
7320 + | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7321 + | http_response.status()
|
7322 + | );
|
7323 + | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7324 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7325 + | http_response.headers(),
|
7326 + | expected_headers,
|
7327 + | ));
|
7328 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7329 + | .await
|
7330 + | .expect("unable to extract body to bytes");
|
7331 + | ::aws_smithy_protocol_test::assert_ok(
|
7332 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/map' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7333 + | );
|
7267 7334 | }
|
7268 7335 | }
|
7269 - | }
|
7270 - | impl
|
7271 - | ::aws_smithy_http_server::response::IntoResponse<
|
7272 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
7273 - | > for crate::error::MalformedLengthError
|
7274 - | {
|
7275 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
7276 - | match crate::protocol_serde::shape_malformed_length::ser_malformed_length_http_error(&self)
|
7336 + | /// When a map member's value does not contain a valid enum value,
|
7337 + | /// the response should be a 400 ValidationException. Internal-only
|
7338 + | /// enum values are excluded from the response message.
|
7339 + | /// Test ID: RestJsonMalformedEnumMapValue_case0
|
7340 + | #[::tokio::test]
|
7341 + | #[::tracing_test::traced_test]
|
7342 + | #[should_panic]
|
7343 + | async fn rest_json_malformed_enum_map_value_case0_malformed_request() {
|
7277 7344 | {
|
7278 - | Ok(mut response) => {
|
7279 - | response.extensions_mut().insert(
|
7280 - | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
7281 - | );
|
7282 - | response
|
7283 - | }
|
7284 - | Err(e) => {
|
7285 - | ::tracing::error!(error = %e, "failed to serialize response");
|
7286 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
7287 - | }
|
7345 + | #[allow(unused_mut)]
|
7346 + | let mut http_request = http::Request::builder()
|
7347 + | .uri("/MalformedEnum")
|
7348 + | .method("POST")
|
7349 + | .header("content-type", "application/json")
|
7350 + | .body(::aws_smithy_http_server::body::Body::from(
|
7351 + | ::bytes::Bytes::from_static("{ \"map\" : { \"abc\": \"ABC\" } }".as_bytes()),
|
7352 + | ))
|
7353 + | .unwrap();
|
7354 + | #[allow(unused_mut)]
|
7355 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7356 + | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7357 + | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7358 + | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7359 + | let sender = sender.clone();
|
7360 + | async move {
|
7361 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
7362 + | sender.send(()).await.expect("receiver dropped early");
|
7363 + | result
|
7364 + | }
|
7365 + | })
|
7366 + | .build_unchecked();
|
7367 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7368 + | .await
|
7369 + | .expect("unable to make an HTTP request");
|
7370 + | ::pretty_assertions::assert_eq!(
|
7371 + | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7372 + | http_response.status()
|
7373 + | );
|
7374 + | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7375 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7376 + | http_response.headers(),
|
7377 + | expected_headers,
|
7378 + | ));
|
7379 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7380 + | .await
|
7381 + | .expect("unable to extract body to bytes");
|
7382 + | ::aws_smithy_protocol_test::assert_ok(
|
7383 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map/abc' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/map/abc' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/map/abc\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7384 + | );
|
7288 7385 | }
|
7289 7386 | }
|
7290 - | }
|
7291 - |
|
7292 - | const CONTENT_TYPE_MALFORMEDENUM: ::mime::Mime = ::mime::APPLICATION_JSON;
|
7293 - | ::pin_project_lite::pin_project! {
|
7294 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
7295 - | /// [`MalformedEnumInput`](crate::input::MalformedEnumInput) using modelled bindings.
|
7296 - | pub struct MalformedEnumInputFuture {
|
7297 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedEnumInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
7298 - | }
|
7299 - | }
|
7300 - |
|
7301 - | impl std::future::Future for MalformedEnumInputFuture {
|
7302 - | type Output = Result<
|
7303 - | crate::input::MalformedEnumInput,
|
7304 - | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
7305 - | >;
|
7306 - |
|
7307 - | fn poll(
|
7308 - | self: std::pin::Pin<&mut Self>,
|
7309 - | cx: &mut std::task::Context<'_>,
|
7310 - | ) -> std::task::Poll<Self::Output> {
|
7311 - | let this = self.project();
|
7312 - | this.inner.as_mut().poll(cx)
|
7313 - | }
|
7314 - | }
|
7315 - |
|
7316 - | impl<B>
|
7317 - | ::aws_smithy_http_server::request::FromRequest<
|
7318 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
7319 - | B,
|
7320 - | > for crate::input::MalformedEnumInput
|
7321 - | where
|
7322 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
7323 - | B: 'static,
|
7324 - |
|
7325 - | B::Data: Send,
|
7326 - | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
7327 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
7328 - | {
|
7329 - | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
7330 - | type Future = MalformedEnumInputFuture;
|
7331 - |
|
7332 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
7333 - | let fut = async move {
|
7334 - | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
7335 - | request.headers(),
|
7336 - | &CONTENT_TYPE_MALFORMEDENUM,
|
7337 - | ) {
|
7338 - | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
7339 - | }
|
7340 - | crate::protocol_serde::shape_malformed_enum::de_malformed_enum_http_request(request)
|
7387 + | /// When a map member's value does not contain a valid enum value,
|
7388 + | /// the response should be a 400 ValidationException. Internal-only
|
7389 + | /// enum values are excluded from the response message.
|
7390 + | /// Test ID: RestJsonMalformedEnumMapValue_case1
|
7391 + | #[::tokio::test]
|
7392 + | #[::tracing_test::traced_test]
|
7393 + | #[should_panic]
|
7394 + | async fn rest_json_malformed_enum_map_value_case1_malformed_request() {
|
7395 + | {
|
7396 + | #[allow(unused_mut)]
|
7397 + | let mut http_request = http::Request::builder()
|
7398 + | .uri("/MalformedEnum")
|
7399 + | .method("POST")
|
7400 + | .header("content-type", "application/json")
|
7401 + | .body(::aws_smithy_http_server::body::Body::from(
|
7402 + | ::bytes::Bytes::from_static("{ \"map\" : { \"abc\": \"XYZ\" } }".as_bytes()),
|
7403 + | ))
|
7404 + | .unwrap();
|
7405 + | #[allow(unused_mut)]
|
7406 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7407 + | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7408 + | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7409 + | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7410 + | let sender = sender.clone();
|
7411 + | async move {
|
7412 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
7413 + | sender.send(()).await.expect("receiver dropped early");
|
7414 + | result
|
7415 + | }
|
7416 + | })
|
7417 + | .build_unchecked();
|
7418 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7341 7419 | .await
|
7342 - | .map_err(Into::into)
|
7343 - | };
|
7344 - | use ::futures_util::future::TryFutureExt;
|
7345 - | let fut = fut.map_err(
|
7346 - | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
7347 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
7348 - | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
7349 - | e,
|
7350 - | )
|
7351 - | },
|
7352 - | );
|
7353 - | MalformedEnumInputFuture {
|
7354 - | inner: Box::pin(fut),
|
7420 + | .expect("unable to make an HTTP request");
|
7421 + | ::pretty_assertions::assert_eq!(
|
7422 + | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7423 + | http_response.status()
|
7424 + | );
|
7425 + | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7426 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7427 + | http_response.headers(),
|
7428 + | expected_headers,
|
7429 + | ));
|
7430 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7431 + | .await
|
7432 + | .expect("unable to extract body to bytes");
|
7433 + | ::aws_smithy_protocol_test::assert_ok(
|
7434 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map/abc' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/map/abc' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/map/abc\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7435 + | );
|
7355 7436 | }
|
7356 7437 | }
|
7357 - | }
|
7358 - | impl
|
7359 - | ::aws_smithy_http_server::response::IntoResponse<
|
7360 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
7361 - | > for crate::output::MalformedEnumOutput
|
7362 - | {
|
7363 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
7364 - | match crate::protocol_serde::shape_malformed_enum::ser_malformed_enum_http_response(self) {
|
7365 - | Ok(response) => response,
|
7366 - | Err(e) => {
|
7367 - | ::tracing::error!(error = %e, "failed to serialize response");
|
7368 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
7369 - | }
|
7438 + | /// When a union member's value does not contain a valid enum value,
|
7439 + | /// the response should be a 400 ValidationException. Internal-only
|
7440 + | /// enum values are excluded from the response message.
|
7441 + | /// Test ID: RestJsonMalformedEnumUnion_case0
|
7442 + | #[::tokio::test]
|
7443 + | #[::tracing_test::traced_test]
|
7444 + | #[should_panic]
|
7445 + | async fn rest_json_malformed_enum_union_case0_malformed_request() {
|
7446 + | {
|
7447 + | #[allow(unused_mut)]
|
7448 + | let mut http_request = http::Request::builder()
|
7449 + | .uri("/MalformedEnum")
|
7450 + | .method("POST")
|
7451 + | .header("content-type", "application/json")
|
7452 + | .body(::aws_smithy_http_server::body::Body::from(
|
7453 + | ::bytes::Bytes::from_static(
|
7454 + | "{ \"union\" : { \"first\": \"ABC\" } }".as_bytes(),
|
7455 + | ),
|
7456 + | ))
|
7457 + | .unwrap();
|
7458 + | #[allow(unused_mut)]
|
7459 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7460 + | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7461 + | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7462 + | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7463 + | let sender = sender.clone();
|
7464 + | async move {
|
7465 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
7466 + | sender.send(()).await.expect("receiver dropped early");
|
7467 + | result
|
7468 + | }
|
7469 + | })
|
7470 + | .build_unchecked();
|
7471 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7472 + | .await
|
7473 + | .expect("unable to make an HTTP request");
|
7474 + | ::pretty_assertions::assert_eq!(
|
7475 + | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7476 + | http_response.status()
|
7477 + | );
|
7478 + | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7479 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7480 + | http_response.headers(),
|
7481 + | expected_headers,
|
7482 + | ));
|
7483 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7484 + | .await
|
7485 + | .expect("unable to extract body to bytes");
|
7486 + | ::aws_smithy_protocol_test::assert_ok(
|
7487 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/union/first' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/union/first' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/union/first\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7488 + | );
|
7370 7489 | }
|
7371 7490 | }
|
7372 - | }
|
7373 - | impl
|
7374 - | ::aws_smithy_http_server::response::IntoResponse<
|
7375 - | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
7376 - | > for crate::error::MalformedEnumError
|
7377 - | {
|
7378 - | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
7379 - | match crate::protocol_serde::shape_malformed_enum::ser_malformed_enum_http_error(&self) {
|
7380 - | Ok(mut response) => {
|
7381 - | response.extensions_mut().insert(
|
7382 - | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
7383 - | );
|
7384 - | response
|
7385 - | }
|
7386 - | Err(e) => {
|
7387 - | ::tracing::error!(error = %e, "failed to serialize response");
|
7388 - | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
7389 - | }
|
7491 + | /// When a union member's value does not contain a valid enum value,
|
7492 + | /// the response should be a 400 ValidationException. Internal-only
|
7493 + | /// enum values are excluded from the response message.
|
7494 + | /// Test ID: RestJsonMalformedEnumUnion_case1
|
7495 + | #[::tokio::test]
|
7496 + | #[::tracing_test::traced_test]
|
7497 + | #[should_panic]
|
7498 + | async fn rest_json_malformed_enum_union_case1_malformed_request() {
|
7499 + | {
|
7500 + | #[allow(unused_mut)]
|
7501 + | let mut http_request = http::Request::builder()
|
7502 + | .uri("/MalformedEnum")
|
7503 + | .method("POST")
|
7504 + | .header("content-type", "application/json")
|
7505 + | .body(::aws_smithy_http_server::body::Body::from(
|
7506 + | ::bytes::Bytes::from_static(
|
7507 + | "{ \"union\" : { \"first\": \"XYZ\" } }".as_bytes(),
|
7508 + | ),
|
7509 + | ))
|
7510 + | .unwrap();
|
7511 + | #[allow(unused_mut)]
|
7512 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7513 + | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7514 + | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7515 + | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7516 + | let sender = sender.clone();
|
7517 + | async move {
|
7518 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
7519 + | sender.send(()).await.expect("receiver dropped early");
|
7520 + | result
|
7521 + | }
|
7522 + | })
|
7523 + | .build_unchecked();
|
7524 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7525 + | .await
|
7526 + | .expect("unable to make an HTTP request");
|
7527 + | ::pretty_assertions::assert_eq!(
|
7528 + | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7529 + | http_response.status()
|
7530 + | );
|
7531 + | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7532 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7533 + | http_response.headers(),
|
7534 + | expected_headers,
|
7535 + | ));
|
7536 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7537 + | .await
|
7538 + | .expect("unable to extract body to bytes");
|
7539 + | ::aws_smithy_protocol_test::assert_ok(
|
7540 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/union/first' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/union/first' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/union/first\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7541 + | );
|
7390 7542 | }
|
7391 7543 | }
|
7392 7544 | }
|