1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 2 | ::pin_project_lite::pin_project! {
|
3 3 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
4 - | /// [`SensitiveValidationInput`](crate::input::SensitiveValidationInput) using modelled bindings.
|
5 - | pub struct SensitiveValidationInputFuture {
|
6 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SensitiveValidationInput, ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
4 + | /// [`MalformedEnumInput`](crate::input::MalformedEnumInput) using modelled bindings.
|
5 + | pub struct MalformedEnumInputFuture {
|
6 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedEnumInput, ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
7 7 | }
|
8 8 | }
|
9 9 |
|
10 - | impl std::future::Future for SensitiveValidationInputFuture {
|
10 + | impl std::future::Future for MalformedEnumInputFuture {
|
11 11 | type Output = Result<
|
12 - | crate::input::SensitiveValidationInput,
|
12 + | crate::input::MalformedEnumInput,
|
13 13 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
14 14 | >;
|
15 15 |
|
16 16 | fn poll(
|
17 17 | self: std::pin::Pin<&mut Self>,
|
18 18 | cx: &mut std::task::Context<'_>,
|
19 19 | ) -> std::task::Poll<Self::Output> {
|
20 20 | let this = self.project();
|
21 21 | this.inner.as_mut().poll(cx)
|
22 22 | }
|
23 23 | }
|
24 24 |
|
25 25 | impl<B>
|
26 26 | ::aws_smithy_legacy_http_server::request::FromRequest<
|
27 27 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
28 28 | B,
|
29 - | > for crate::input::SensitiveValidationInput
|
29 + | > for crate::input::MalformedEnumInput
|
30 30 | where
|
31 31 | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
32 32 | B: 'static,
|
33 33 |
|
34 34 | B::Data: Send,
|
35 35 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
36 36 | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
37 37 | {
|
38 38 | type Rejection =
|
39 39 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
40 - | type Future = SensitiveValidationInputFuture;
|
40 + | type Future = MalformedEnumInputFuture;
|
41 41 |
|
42 42 | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
43 43 | let fut = async move {
|
44 44 | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
45 45 | request.headers(),
|
46 46 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
47 47 | ) {
|
48 48 | return Err(::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
49 49 | }
|
50 - | crate::protocol_serde::shape_sensitive_validation::de_sensitive_validation_http_request(
|
51 - | request,
|
52 - | )
|
50 + | crate::protocol_serde::shape_malformed_enum::de_malformed_enum_http_request(request)
|
53 51 | .await
|
54 52 | };
|
55 53 | use ::futures_util::future::TryFutureExt;
|
56 54 | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
57 55 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
58 56 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e)
|
59 57 | });
|
60 - | SensitiveValidationInputFuture {
|
58 + | MalformedEnumInputFuture {
|
61 59 | inner: Box::pin(fut),
|
62 60 | }
|
63 61 | }
|
64 62 | }
|
65 63 | impl
|
66 64 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
67 65 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
68 - | > for crate::output::SensitiveValidationOutput
|
66 + | > for crate::output::MalformedEnumOutput
|
69 67 | {
|
70 68 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
71 - | match crate::protocol_serde::shape_sensitive_validation::ser_sensitive_validation_http_response(self) {
|
69 + | match crate::protocol_serde::shape_malformed_enum::ser_malformed_enum_http_response(self) {
|
72 70 | Ok(response) => response,
|
73 71 | Err(e) => {
|
74 72 | ::tracing::error!(error = %e, "failed to serialize response");
|
75 73 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
76 74 | }
|
77 75 | }
|
78 76 | }
|
79 77 | }
|
80 78 | impl
|
81 79 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
82 80 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
83 - | > for crate::error::SensitiveValidationError
|
81 + | > for crate::error::MalformedEnumError
|
84 82 | {
|
85 83 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
86 - | match crate::protocol_serde::shape_sensitive_validation::ser_sensitive_validation_http_error(
|
87 - | &self,
|
88 - | ) {
|
84 + | match crate::protocol_serde::shape_malformed_enum::ser_malformed_enum_http_error(&self) {
|
89 85 | Ok(mut response) => {
|
90 86 | response.extensions_mut().insert(
|
91 87 | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
92 88 | self.name(),
|
93 89 | ),
|
94 90 | );
|
95 91 | response
|
96 92 | }
|
97 93 | Err(e) => {
|
98 94 | ::tracing::error!(error = %e, "failed to serialize response");
|
99 95 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
100 96 | }
|
101 97 | }
|
102 98 | }
|
103 99 | }
|
104 100 |
|
105 101 | #[allow(unreachable_code, unused_variables)]
|
106 102 | #[cfg(test)]
|
107 - | mod sensitive_validation_test {
|
103 + | mod malformed_enum_test {
|
108 104 |
|
109 - | /// When a sensitive member fails validation, the resultant
|
110 - | /// ValidationException will omit the value of the input.
|
111 - | /// Test ID: RestJsonMalformedPatternSensitiveString
|
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: RestJsonMalformedEnumString_case0
|
112 109 | #[::tokio::test]
|
113 110 | #[::tracing_test::traced_test]
|
114 - | async fn rest_json_malformed_pattern_sensitive_string_malformed_request() {
|
111 + | #[should_panic]
|
112 + | async fn rest_json_malformed_enum_string_case0_malformed_request() {
|
115 113 | {
|
116 114 | #[allow(unused_mut)]
|
117 115 | let mut http_request = ::http::Request::builder()
|
118 - | .uri("/SensitiveValidation")
|
116 + | .uri("/MalformedEnum")
|
119 117 | .method("POST")
|
120 118 | .header("content-type", "application/json")
|
121 119 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
122 120 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
123 121 | "{ \"string\" : \"ABC\" }".as_bytes(),
|
124 122 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
125 123 | )),
|
126 124 | ))
|
127 125 | .unwrap();
|
128 126 | #[allow(unused_mut)]
|
129 127 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
130 128 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
131 129 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
132 - | .sensitive_validation(move |input: crate::input::SensitiveValidationInput| {
|
130 + | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
133 131 | let sender = sender.clone();
|
134 132 | async move {
|
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> };
|
133 + | 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> };
|
136 134 | sender.send(()).await.expect("receiver dropped early");
|
137 135 | result
|
138 136 | }
|
139 137 | })
|
140 138 | .build_unchecked();
|
141 139 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
142 140 | .await
|
143 141 | .expect("unable to make an HTTP request");
|
144 142 | ::pretty_assertions::assert_eq!(
|
145 143 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
146 144 | http_response.status()
|
147 145 | );
|
148 146 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
149 147 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
150 148 | http_response.headers(),
|
151 149 | expected_headers,
|
152 150 | ));
|
153 151 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
154 152 | .await
|
155 153 | .expect("unable to extract body to bytes");
|
156 154 | ::aws_smithy_protocol_test::assert_ok(
|
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"))
|
158 - | );
|
159 - | }
|
160 - | }
|
161 - | }
|
162 - |
|
163 - | ::pin_project_lite::pin_project! {
|
164 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
165 - | /// [`RecursiveStructuresInput`](crate::input::RecursiveStructuresInput) using modelled bindings.
|
166 - | pub struct RecursiveStructuresInputFuture {
|
167 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::RecursiveStructuresInput, ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
168 - | }
|
169 - | }
|
170 - |
|
171 - | impl std::future::Future for RecursiveStructuresInputFuture {
|
172 - | type Output = Result<
|
173 - | crate::input::RecursiveStructuresInput,
|
174 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
175 - | >;
|
176 - |
|
177 - | fn poll(
|
178 - | self: std::pin::Pin<&mut Self>,
|
179 - | cx: &mut std::task::Context<'_>,
|
180 - | ) -> std::task::Poll<Self::Output> {
|
181 - | let this = self.project();
|
182 - | this.inner.as_mut().poll(cx)
|
183 - | }
|
184 - | }
|
185 - |
|
186 - | impl<B>
|
187 - | ::aws_smithy_legacy_http_server::request::FromRequest<
|
188 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
189 - | B,
|
190 - | > for crate::input::RecursiveStructuresInput
|
191 - | where
|
192 - | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
193 - | B: 'static,
|
194 - |
|
195 - | B::Data: Send,
|
196 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
197 - | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
198 - | {
|
199 - | type Rejection =
|
200 - | ::aws_smithy_legacy_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_legacy_http_server::protocol::accept_header_classifier(
|
206 - | request.headers(),
|
207 - | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
208 - | ) {
|
209 - | return Err(::aws_smithy_legacy_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 - | };
|
216 - | use ::futures_util::future::TryFutureExt;
|
217 - | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
218 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
219 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e)
|
220 - | });
|
221 - | RecursiveStructuresInputFuture {
|
222 - | inner: Box::pin(fut),
|
223 - | }
|
224 - | }
|
225 - | }
|
226 - | impl
|
227 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
228 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
229 - | > for crate::output::RecursiveStructuresOutput
|
230 - | {
|
231 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
232 - | match crate::protocol_serde::shape_recursive_structures::ser_recursive_structures_http_response(self) {
|
233 - | Ok(response) => response,
|
234 - | Err(e) => {
|
235 - | ::tracing::error!(error = %e, "failed to serialize response");
|
236 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
237 - | }
|
238 - | }
|
239 - | }
|
240 - | }
|
241 - | impl
|
242 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
243 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
244 - | > for crate::error::RecursiveStructuresError
|
245 - | {
|
246 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
247 - | match crate::protocol_serde::shape_recursive_structures::ser_recursive_structures_http_error(
|
248 - | &self,
|
249 - | ) {
|
250 - | Ok(mut response) => {
|
251 - | response.extensions_mut().insert(
|
252 - | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
253 - | self.name(),
|
254 - | ),
|
155 + | ::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"))
|
255 156 | );
|
256 - | response
|
257 - | }
|
258 - | Err(e) => {
|
259 - | ::tracing::error!(error = %e, "failed to serialize response");
|
260 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
261 157 | }
|
262 158 | }
|
263 - | }
|
264 - | }
|
265 - |
|
266 - | #[allow(unreachable_code, unused_variables)]
|
267 - | #[cfg(test)]
|
268 - | mod recursive_structures_test {
|
269 159 |
|
270 - | /// Validation should work with recursive structures.
|
271 - | /// Test ID: RestJsonRecursiveStructuresValidate
|
160 + | /// When a string member does not contain a valid enum value,
|
161 + | /// the response should be a 400 ValidationException. Internal-only
|
162 + | /// enum values are excluded from the response message.
|
163 + | /// Test ID: RestJsonMalformedEnumString_case1
|
272 164 | #[::tokio::test]
|
273 165 | #[::tracing_test::traced_test]
|
274 - | async fn rest_json_recursive_structures_validate_request() {
|
166 + | #[should_panic]
|
167 + | async fn rest_json_malformed_enum_string_case1_malformed_request() {
|
168 + | {
|
275 169 | #[allow(unused_mut)]
|
276 170 | let mut http_request = ::http::Request::builder()
|
277 - | .uri("/RecursiveStructures")
|
171 + | .uri("/MalformedEnum")
|
278 172 | .method("POST")
|
279 173 | .header("content-type", "application/json")
|
280 174 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
281 - | ::bytes::Bytes::copy_from_slice(
|
282 - | &::aws_smithy_protocol_test::decode_body_data("{ \"union\" : {\n \"union\" : {\n \"union\" : { \"string\" : \"abc\" }\n }\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
283 - | )
|
284 - | )).unwrap();
|
175 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
176 + | "{ \"string\" : \"XYZ\" }".as_bytes(),
|
177 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
178 + | )),
|
179 + | ))
|
180 + | .unwrap();
|
285 181 | #[allow(unused_mut)]
|
286 182 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
287 183 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
288 - | let service =
|
289 - | crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
290 - | .recursive_structures(move |input: crate::input::RecursiveStructuresInput| {
|
184 + | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
185 + | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
291 186 | let sender = sender.clone();
|
292 187 | async move {
|
293 - | let result = {
|
294 - | let expected = crate::input::RecursiveStructuresInput {
|
295 - | union: ::std::option::Option::Some(
|
296 - | crate::model::RecursiveUnionOne::Union(::std::boxed::Box::new(
|
297 - | crate::model::RecursiveUnionTwo::Union(
|
298 - | crate::model::RecursiveUnionOne::String(
|
299 - | "abc"
|
300 - | .parse::<crate::model::RecursiveEnumString>()
|
301 - | .expect("static value validated to member"),
|
302 - | ),
|
303 - | ),
|
304 - | )),
|
305 - | ),
|
306 - | };
|
307 - | ::pretty_assertions::assert_eq!(input, expected);
|
308 - | let output = crate::output::RecursiveStructuresOutput {};
|
309 - | Ok(output)
|
310 - | };
|
188 + | 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> };
|
311 189 | sender.send(()).await.expect("receiver dropped early");
|
312 190 | result
|
313 191 | }
|
314 192 | })
|
315 193 | .build_unchecked();
|
316 194 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
317 195 | .await
|
318 196 | .expect("unable to make an HTTP request");
|
319 - | assert!(
|
320 - | receiver.recv().await.is_some(),
|
321 - | "we expected operation handler to be invoked but it was not entered"
|
197 + | ::pretty_assertions::assert_eq!(
|
198 + | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
199 + | http_response.status()
|
200 + | );
|
201 + | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
202 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
203 + | http_response.headers(),
|
204 + | expected_headers,
|
205 + | ));
|
206 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
207 + | .await
|
208 + | .expect("unable to extract body to bytes");
|
209 + | ::aws_smithy_protocol_test::assert_ok(
|
210 + | ::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"))
|
322 211 | );
|
323 212 | }
|
213 + | }
|
324 214 |
|
325 - | /// When a value deeply nested in a recursive structure does not meet constraints,
|
326 - | /// a 400 ValidationException is returned.
|
327 - | /// Test ID: RestJsonMalformedRecursiveStructures
|
215 + | /// When a string member does not contain a valid enum value,
|
216 + | /// the response should be a 400 ValidationException. Internal-only
|
217 + | /// enum values are excluded from the response message.
|
218 + | /// Test ID: RestJsonMalformedEnumTraitString_case0
|
328 219 | #[::tokio::test]
|
329 220 | #[::tracing_test::traced_test]
|
330 - | async fn rest_json_malformed_recursive_structures_malformed_request() {
|
221 + | #[should_panic]
|
222 + | async fn rest_json_malformed_enum_trait_string_case0_malformed_request() {
|
331 223 | {
|
332 224 | #[allow(unused_mut)]
|
333 225 | let mut http_request = ::http::Request::builder()
|
334 - | .uri("/RecursiveStructures")
|
226 + | .uri("/MalformedEnum")
|
335 227 | .method("POST")
|
336 228 | .header("content-type", "application/json")
|
337 229 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
338 - | ::bytes::Bytes::copy_from_slice(
|
339 - | &::aws_smithy_protocol_test::decode_body_data("{ \"union\" : {\n \"union\" : {\n \"union\" : { \"string\" : \"XYZ\" }\n }\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
340 - | )
|
341 - | )).unwrap();
|
230 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
231 + | "{ \"stringWithEnumTrait\" : \"ABC\" }".as_bytes(),
|
232 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
233 + | )),
|
234 + | ))
|
235 + | .unwrap();
|
342 236 | #[allow(unused_mut)]
|
343 237 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
344 238 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
345 239 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
346 - | .recursive_structures(move |input: crate::input::RecursiveStructuresInput| {
|
240 + | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
347 241 | let sender = sender.clone();
|
348 242 | async move {
|
349 - | 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> };
|
243 + | 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> };
|
350 244 | sender.send(()).await.expect("receiver dropped early");
|
351 245 | result
|
352 246 | }
|
353 247 | })
|
354 248 | .build_unchecked();
|
355 249 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
356 250 | .await
|
357 251 | .expect("unable to make an HTTP request");
|
358 252 | ::pretty_assertions::assert_eq!(
|
359 253 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
360 254 | http_response.status()
|
361 255 | );
|
362 256 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
363 257 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
364 258 | http_response.headers(),
|
365 259 | expected_headers,
|
366 260 | ));
|
367 261 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
368 262 | .await
|
369 263 | .expect("unable to extract body to bytes");
|
370 264 | ::aws_smithy_protocol_test::assert_ok(
|
371 - | ::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"))
|
265 + | ::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"))
|
372 266 | );
|
373 267 | }
|
374 268 | }
|
375 - | }
|
376 269 |
|
377 - | ::pin_project_lite::pin_project! {
|
378 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
379 - | /// [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput) using modelled bindings.
|
380 - | pub struct MalformedUniqueItemsInputFuture {
|
381 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedUniqueItemsInput, ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
382 - | }
|
383 - | }
|
384 - |
|
385 - | impl std::future::Future for MalformedUniqueItemsInputFuture {
|
386 - | type Output = Result<
|
387 - | crate::input::MalformedUniqueItemsInput,
|
388 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
389 - | >;
|
390 - |
|
391 - | fn poll(
|
392 - | self: std::pin::Pin<&mut Self>,
|
393 - | cx: &mut std::task::Context<'_>,
|
394 - | ) -> std::task::Poll<Self::Output> {
|
395 - | let this = self.project();
|
396 - | this.inner.as_mut().poll(cx)
|
397 - | }
|
398 - | }
|
399 - |
|
400 - | impl<B>
|
401 - | ::aws_smithy_legacy_http_server::request::FromRequest<
|
402 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
403 - | B,
|
404 - | > for crate::input::MalformedUniqueItemsInput
|
405 - | where
|
406 - | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
407 - | B: 'static,
|
408 - |
|
409 - | B::Data: Send,
|
410 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
411 - | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
412 - | {
|
413 - | type Rejection =
|
414 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
415 - | type Future = MalformedUniqueItemsInputFuture;
|
416 - |
|
417 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
418 - | let fut = async move {
|
419 - | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
420 - | request.headers(),
|
421 - | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
422 - | ) {
|
423 - | return Err(::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
424 - | }
|
425 - | crate::protocol_serde::shape_malformed_unique_items::de_malformed_unique_items_http_request(request)
|
426 - | .await
|
427 - | };
|
428 - | use ::futures_util::future::TryFutureExt;
|
429 - | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
430 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
431 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e)
|
432 - | });
|
433 - | MalformedUniqueItemsInputFuture {
|
434 - | inner: Box::pin(fut),
|
435 - | }
|
436 - | }
|
437 - | }
|
438 - | impl
|
439 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
440 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
441 - | > for crate::output::MalformedUniqueItemsOutput
|
442 - | {
|
443 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
444 - | match crate::protocol_serde::shape_malformed_unique_items::ser_malformed_unique_items_http_response(self) {
|
445 - | Ok(response) => response,
|
446 - | Err(e) => {
|
447 - | ::tracing::error!(error = %e, "failed to serialize response");
|
448 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
449 - | }
|
450 - | }
|
451 - | }
|
452 - | }
|
453 - | impl
|
454 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
455 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
456 - | > for crate::error::MalformedUniqueItemsError
|
457 - | {
|
458 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
459 - | match crate::protocol_serde::shape_malformed_unique_items::ser_malformed_unique_items_http_error(&self) {
|
460 - | Ok(mut response) => {
|
461 - | response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
462 - | response
|
463 - | },
|
464 - | Err(e) => {
|
465 - | ::tracing::error!(error = %e, "failed to serialize response");
|
466 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
467 - | }
|
468 - | }
|
469 - | }
|
470 - | }
|
471 - |
|
472 - | #[allow(unreachable_code, unused_variables)]
|
473 - | #[cfg(test)]
|
474 - | mod malformed_unique_items_test {
|
475 - |
|
476 - | /// When a blob list contains non-unique values,
|
477 - | /// the response should be a 400 ValidationException.
|
478 - | /// Test ID: RestJsonMalformedUniqueItemsBlobList
|
270 + | /// When a string member does not contain a valid enum value,
|
271 + | /// the response should be a 400 ValidationException. Internal-only
|
272 + | /// enum values are excluded from the response message.
|
273 + | /// Test ID: RestJsonMalformedEnumTraitString_case1
|
479 274 | #[::tokio::test]
|
480 275 | #[::tracing_test::traced_test]
|
481 276 | #[should_panic]
|
482 - | async fn rest_json_malformed_unique_items_blob_list_malformed_request() {
|
277 + | async fn rest_json_malformed_enum_trait_string_case1_malformed_request() {
|
483 278 | {
|
484 279 | #[allow(unused_mut)]
|
485 280 | let mut http_request = ::http::Request::builder()
|
486 - | .uri("/MalformedUniqueItems")
|
281 + | .uri("/MalformedEnum")
|
487 282 | .method("POST")
|
488 283 | .header("content-type", "application/json")
|
489 284 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
490 285 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
491 - | "{ \"blobList\" : [\"YQ==\", \"YQ==\"] }".as_bytes(),
|
286 + | "{ \"stringWithEnumTrait\" : \"XYZ\" }".as_bytes(),
|
492 287 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
493 288 | )),
|
494 289 | ))
|
495 290 | .unwrap();
|
496 291 | #[allow(unused_mut)]
|
497 292 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
498 293 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
499 294 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
500 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
295 + | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
501 296 | let sender = sender.clone();
|
502 297 | async move {
|
503 - | 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> };
|
298 + | 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> };
|
504 299 | sender.send(()).await.expect("receiver dropped early");
|
505 300 | result
|
506 301 | }
|
507 302 | })
|
508 303 | .build_unchecked();
|
509 304 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
510 305 | .await
|
511 306 | .expect("unable to make an HTTP request");
|
512 307 | ::pretty_assertions::assert_eq!(
|
513 308 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
514 309 | http_response.status()
|
515 310 | );
|
516 311 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
517 312 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
518 313 | http_response.headers(),
|
519 314 | expected_headers,
|
520 315 | ));
|
521 316 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
522 317 | .await
|
523 318 | .expect("unable to extract body to bytes");
|
524 319 | ::aws_smithy_protocol_test::assert_ok(
|
525 - | ::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"))
|
320 + | ::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"))
|
526 321 | );
|
527 322 | }
|
528 323 | }
|
529 324 |
|
530 - | /// When a boolean list contains non-unique values,
|
531 - | /// the response should be a 400 ValidationException.
|
532 - | /// Test ID: RestJsonMalformedUniqueItemsBooleanList_case0
|
325 + | /// When a list member value does not contain a valid enum value,
|
326 + | /// the response should be a 400 ValidationException. Internal-only
|
327 + | /// enum values are excluded from the response message.
|
328 + | /// Test ID: RestJsonMalformedEnumList_case0
|
533 329 | #[::tokio::test]
|
534 330 | #[::tracing_test::traced_test]
|
535 331 | #[should_panic]
|
536 - | async fn rest_json_malformed_unique_items_boolean_list_case0_malformed_request() {
|
332 + | async fn rest_json_malformed_enum_list_case0_malformed_request() {
|
537 333 | {
|
538 334 | #[allow(unused_mut)]
|
539 335 | let mut http_request = ::http::Request::builder()
|
540 - | .uri("/MalformedUniqueItems")
|
336 + | .uri("/MalformedEnum")
|
541 337 | .method("POST")
|
542 338 | .header("content-type", "application/json")
|
543 339 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
544 340 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
545 - | "{ \"booleanList\" : [true, true] }".as_bytes(),
|
341 + | "{ \"list\" : [\"ABC\"] }".as_bytes(),
|
546 342 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
547 343 | )),
|
548 344 | ))
|
549 345 | .unwrap();
|
550 346 | #[allow(unused_mut)]
|
551 347 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
552 348 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
553 349 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
554 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
350 + | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
555 351 | let sender = sender.clone();
|
556 352 | async move {
|
557 - | 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> };
|
353 + | 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> };
|
558 354 | sender.send(()).await.expect("receiver dropped early");
|
559 355 | result
|
560 356 | }
|
561 357 | })
|
562 358 | .build_unchecked();
|
563 359 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
564 360 | .await
|
565 361 | .expect("unable to make an HTTP request");
|
566 362 | ::pretty_assertions::assert_eq!(
|
567 363 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
568 364 | http_response.status()
|
569 365 | );
|
570 366 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
571 367 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
572 368 | http_response.headers(),
|
573 369 | expected_headers,
|
574 370 | ));
|
575 371 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
576 372 | .await
|
577 373 | .expect("unable to extract body to bytes");
|
578 374 | ::aws_smithy_protocol_test::assert_ok(
|
579 - | ::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"))
|
375 + | ::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"))
|
580 376 | );
|
581 377 | }
|
582 378 | }
|
583 379 |
|
584 - | /// When a boolean list contains non-unique values,
|
585 - | /// the response should be a 400 ValidationException.
|
586 - | /// Test ID: RestJsonMalformedUniqueItemsBooleanList_case1
|
380 + | /// When a list member value does not contain a valid enum value,
|
381 + | /// the response should be a 400 ValidationException. Internal-only
|
382 + | /// enum values are excluded from the response message.
|
383 + | /// Test ID: RestJsonMalformedEnumList_case1
|
587 384 | #[::tokio::test]
|
588 385 | #[::tracing_test::traced_test]
|
589 386 | #[should_panic]
|
590 - | async fn rest_json_malformed_unique_items_boolean_list_case1_malformed_request() {
|
387 + | async fn rest_json_malformed_enum_list_case1_malformed_request() {
|
591 388 | {
|
592 389 | #[allow(unused_mut)]
|
593 390 | let mut http_request = ::http::Request::builder()
|
594 - | .uri("/MalformedUniqueItems")
|
391 + | .uri("/MalformedEnum")
|
595 392 | .method("POST")
|
596 393 | .header("content-type", "application/json")
|
597 394 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
598 395 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
599 - | "{ \"booleanList\" : [false, false] }".as_bytes(),
|
396 + | "{ \"list\" : [\"XYZ\"] }".as_bytes(),
|
600 397 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
601 398 | )),
|
602 399 | ))
|
603 400 | .unwrap();
|
604 401 | #[allow(unused_mut)]
|
605 402 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
606 403 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
607 404 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
608 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
405 + | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
609 406 | let sender = sender.clone();
|
610 407 | async move {
|
611 - | 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> };
|
408 + | 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> };
|
612 409 | sender.send(()).await.expect("receiver dropped early");
|
613 410 | result
|
614 411 | }
|
615 412 | })
|
616 413 | .build_unchecked();
|
617 414 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
618 415 | .await
|
619 416 | .expect("unable to make an HTTP request");
|
620 417 | ::pretty_assertions::assert_eq!(
|
621 418 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
622 419 | http_response.status()
|
623 420 | );
|
624 421 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
625 422 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
626 423 | http_response.headers(),
|
627 424 | expected_headers,
|
628 425 | ));
|
629 426 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
630 427 | .await
|
631 428 | .expect("unable to extract body to bytes");
|
632 429 | ::aws_smithy_protocol_test::assert_ok(
|
633 - | ::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"))
|
430 + | ::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"))
|
634 431 | );
|
635 432 | }
|
636 433 | }
|
637 434 |
|
638 - | /// When a string list contains non-unique values,
|
639 - | /// the response should be a 400 ValidationException.
|
640 - | /// Test ID: RestJsonMalformedUniqueItemsStringList
|
435 + | /// When a map member's key does not contain a valid enum value,
|
436 + | /// the response should be a 400 ValidationException. Internal-only
|
437 + | /// enum values are excluded from the response message.
|
438 + | /// Test ID: RestJsonMalformedEnumMapKey_case0
|
641 439 | #[::tokio::test]
|
642 440 | #[::tracing_test::traced_test]
|
643 441 | #[should_panic]
|
644 - | async fn rest_json_malformed_unique_items_string_list_malformed_request() {
|
442 + | async fn rest_json_malformed_enum_map_key_case0_malformed_request() {
|
645 443 | {
|
646 444 | #[allow(unused_mut)]
|
647 445 | let mut http_request = ::http::Request::builder()
|
648 - | .uri("/MalformedUniqueItems")
|
446 + | .uri("/MalformedEnum")
|
649 447 | .method("POST")
|
650 448 | .header("content-type", "application/json")
|
651 449 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
652 450 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
653 - | "{ \"stringList\" : [\"abc\", \"abc\"] }".as_bytes(),
|
451 + | "{ \"map\" : { \"ABC\" : \"abc\" } }".as_bytes(),
|
654 452 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
655 453 | )),
|
656 454 | ))
|
657 455 | .unwrap();
|
658 456 | #[allow(unused_mut)]
|
659 457 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
660 458 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
661 459 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
662 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
460 + | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
663 461 | let sender = sender.clone();
|
664 462 | async move {
|
665 - | 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> };
|
463 + | 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> };
|
666 464 | sender.send(()).await.expect("receiver dropped early");
|
667 465 | result
|
668 466 | }
|
669 467 | })
|
670 468 | .build_unchecked();
|
671 469 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
672 470 | .await
|
673 471 | .expect("unable to make an HTTP request");
|
674 472 | ::pretty_assertions::assert_eq!(
|
675 473 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
676 474 | http_response.status()
|
677 475 | );
|
678 476 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
679 477 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
680 478 | http_response.headers(),
|
681 479 | expected_headers,
|
682 480 | ));
|
683 481 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
684 482 | .await
|
685 483 | .expect("unable to extract body to bytes");
|
686 484 | ::aws_smithy_protocol_test::assert_ok(
|
687 - | ::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"))
|
485 + | ::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"))
|
688 486 | );
|
689 487 | }
|
690 488 | }
|
691 489 |
|
692 - | /// When a byte list contains non-unique values,
|
693 - | /// the response should be a 400 ValidationException.
|
694 - | /// Test ID: RestJsonMalformedUniqueItemsByteList
|
490 + | /// When a map member's key does not contain a valid enum value,
|
491 + | /// the response should be a 400 ValidationException. Internal-only
|
492 + | /// enum values are excluded from the response message.
|
493 + | /// Test ID: RestJsonMalformedEnumMapKey_case1
|
695 494 | #[::tokio::test]
|
696 495 | #[::tracing_test::traced_test]
|
697 496 | #[should_panic]
|
698 - | async fn rest_json_malformed_unique_items_byte_list_malformed_request() {
|
497 + | async fn rest_json_malformed_enum_map_key_case1_malformed_request() {
|
699 498 | {
|
700 499 | #[allow(unused_mut)]
|
701 500 | let mut http_request = ::http::Request::builder()
|
702 - | .uri("/MalformedUniqueItems")
|
501 + | .uri("/MalformedEnum")
|
703 502 | .method("POST")
|
704 503 | .header("content-type", "application/json")
|
705 504 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
706 505 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
707 - | "{ \"byteList\" : [1, 1] }".as_bytes(),
|
506 + | "{ \"map\" : { \"XYZ\" : \"abc\" } }".as_bytes(),
|
708 507 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
709 508 | )),
|
710 509 | ))
|
711 510 | .unwrap();
|
712 511 | #[allow(unused_mut)]
|
713 512 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
714 513 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
715 514 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
716 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
515 + | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
717 516 | let sender = sender.clone();
|
718 517 | async move {
|
719 - | 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> };
|
518 + | 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> };
|
720 519 | sender.send(()).await.expect("receiver dropped early");
|
721 520 | result
|
722 521 | }
|
723 522 | })
|
724 523 | .build_unchecked();
|
725 524 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
726 525 | .await
|
727 526 | .expect("unable to make an HTTP request");
|
728 527 | ::pretty_assertions::assert_eq!(
|
729 528 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
730 529 | http_response.status()
|
731 530 | );
|
732 531 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
733 532 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
734 533 | http_response.headers(),
|
735 534 | expected_headers,
|
736 535 | ));
|
737 536 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
738 537 | .await
|
739 538 | .expect("unable to extract body to bytes");
|
740 539 | ::aws_smithy_protocol_test::assert_ok(
|
741 - | ::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"))
|
540 + | ::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"))
|
742 541 | );
|
743 542 | }
|
744 543 | }
|
745 544 |
|
746 - | /// When a short list contains non-unique values,
|
747 - | /// the response should be a 400 ValidationException.
|
748 - | /// Test ID: RestJsonMalformedUniqueItemsShortList
|
545 + | /// When a map member's value does not contain a valid enum value,
|
546 + | /// the response should be a 400 ValidationException. Internal-only
|
547 + | /// enum values are excluded from the response message.
|
548 + | /// Test ID: RestJsonMalformedEnumMapValue_case0
|
749 549 | #[::tokio::test]
|
750 550 | #[::tracing_test::traced_test]
|
751 551 | #[should_panic]
|
752 - | async fn rest_json_malformed_unique_items_short_list_malformed_request() {
|
552 + | async fn rest_json_malformed_enum_map_value_case0_malformed_request() {
|
753 553 | {
|
754 554 | #[allow(unused_mut)]
|
755 555 | let mut http_request = ::http::Request::builder()
|
756 - | .uri("/MalformedUniqueItems")
|
556 + | .uri("/MalformedEnum")
|
757 557 | .method("POST")
|
758 558 | .header("content-type", "application/json")
|
759 559 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
760 560 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
761 - | "{ \"shortList\" : [2, 2] }".as_bytes(),
|
561 + | "{ \"map\" : { \"abc\": \"ABC\" } }".as_bytes(),
|
762 562 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
763 563 | )),
|
764 564 | ))
|
765 565 | .unwrap();
|
766 566 | #[allow(unused_mut)]
|
767 567 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
768 568 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
769 569 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
770 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
570 + | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
771 571 | let sender = sender.clone();
|
772 572 | async move {
|
773 - | 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> };
|
573 + | 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> };
|
774 574 | sender.send(()).await.expect("receiver dropped early");
|
775 575 | result
|
776 576 | }
|
777 577 | })
|
778 578 | .build_unchecked();
|
779 579 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
780 580 | .await
|
781 581 | .expect("unable to make an HTTP request");
|
782 582 | ::pretty_assertions::assert_eq!(
|
783 583 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
784 584 | http_response.status()
|
785 585 | );
|
786 586 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
787 587 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
788 588 | http_response.headers(),
|
789 589 | expected_headers,
|
790 590 | ));
|
791 591 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
792 592 | .await
|
793 593 | .expect("unable to extract body to bytes");
|
794 594 | ::aws_smithy_protocol_test::assert_ok(
|
795 - | ::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"))
|
595 + | ::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"))
|
796 596 | );
|
797 597 | }
|
798 598 | }
|
799 599 |
|
800 - | /// When an integer list contains non-unique values,
|
801 - | /// the response should be a 400 ValidationException.
|
802 - | /// Test ID: RestJsonMalformedUniqueItemsIntegerList
|
600 + | /// When a map member's value does not contain a valid enum value,
|
601 + | /// the response should be a 400 ValidationException. Internal-only
|
602 + | /// enum values are excluded from the response message.
|
603 + | /// Test ID: RestJsonMalformedEnumMapValue_case1
|
803 604 | #[::tokio::test]
|
804 605 | #[::tracing_test::traced_test]
|
805 606 | #[should_panic]
|
806 - | async fn rest_json_malformed_unique_items_integer_list_malformed_request() {
|
607 + | async fn rest_json_malformed_enum_map_value_case1_malformed_request() {
|
807 608 | {
|
808 609 | #[allow(unused_mut)]
|
809 610 | let mut http_request = ::http::Request::builder()
|
810 - | .uri("/MalformedUniqueItems")
|
611 + | .uri("/MalformedEnum")
|
811 612 | .method("POST")
|
812 613 | .header("content-type", "application/json")
|
813 614 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
814 615 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
815 - | "{ \"integerList\" : [3, 3] }".as_bytes(),
|
616 + | "{ \"map\" : { \"abc\": \"XYZ\" } }".as_bytes(),
|
816 617 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
817 618 | )),
|
818 619 | ))
|
819 620 | .unwrap();
|
820 621 | #[allow(unused_mut)]
|
821 622 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
822 623 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
823 624 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
824 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
625 + | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
825 626 | let sender = sender.clone();
|
826 627 | async move {
|
827 - | 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> };
|
628 + | 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> };
|
828 629 | sender.send(()).await.expect("receiver dropped early");
|
829 630 | result
|
830 631 | }
|
831 632 | })
|
832 633 | .build_unchecked();
|
833 634 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
834 635 | .await
|
835 636 | .expect("unable to make an HTTP request");
|
836 637 | ::pretty_assertions::assert_eq!(
|
837 638 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
838 639 | http_response.status()
|
839 640 | );
|
840 641 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
841 642 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
842 643 | http_response.headers(),
|
843 644 | expected_headers,
|
844 645 | ));
|
845 646 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
846 647 | .await
|
847 648 | .expect("unable to extract body to bytes");
|
848 649 | ::aws_smithy_protocol_test::assert_ok(
|
849 - | ::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"))
|
650 + | ::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"))
|
850 651 | );
|
851 652 | }
|
852 653 | }
|
853 654 |
|
854 - | /// When an integer list contains non-unique values,
|
855 - | /// the response should be a 400 ValidationException.
|
856 - | /// Test ID: RestJsonMalformedUniqueItemsLongList
|
655 + | /// When a union member's value does not contain a valid enum value,
|
656 + | /// the response should be a 400 ValidationException. Internal-only
|
657 + | /// enum values are excluded from the response message.
|
658 + | /// Test ID: RestJsonMalformedEnumUnion_case0
|
857 659 | #[::tokio::test]
|
858 660 | #[::tracing_test::traced_test]
|
859 661 | #[should_panic]
|
860 - | async fn rest_json_malformed_unique_items_long_list_malformed_request() {
|
662 + | async fn rest_json_malformed_enum_union_case0_malformed_request() {
|
861 663 | {
|
862 664 | #[allow(unused_mut)]
|
863 665 | let mut http_request = ::http::Request::builder()
|
864 - | .uri("/MalformedUniqueItems")
|
666 + | .uri("/MalformedEnum")
|
865 667 | .method("POST")
|
866 668 | .header("content-type", "application/json")
|
867 669 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
868 670 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
869 - | "{ \"longList\" : [4, 4] }".as_bytes(),
|
671 + | "{ \"union\" : { \"first\": \"ABC\" } }".as_bytes(),
|
870 672 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
871 673 | )),
|
872 674 | ))
|
873 675 | .unwrap();
|
874 676 | #[allow(unused_mut)]
|
875 677 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
876 678 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
877 679 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
878 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
680 + | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
879 681 | let sender = sender.clone();
|
880 682 | async move {
|
881 - | 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> };
|
683 + | 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> };
|
882 684 | sender.send(()).await.expect("receiver dropped early");
|
883 685 | result
|
884 686 | }
|
885 687 | })
|
886 688 | .build_unchecked();
|
887 689 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
888 690 | .await
|
889 691 | .expect("unable to make an HTTP request");
|
890 692 | ::pretty_assertions::assert_eq!(
|
891 693 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
892 694 | http_response.status()
|
893 695 | );
|
894 696 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
895 697 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
896 698 | http_response.headers(),
|
897 699 | expected_headers,
|
898 700 | ));
|
899 701 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
900 702 | .await
|
901 703 | .expect("unable to extract body to bytes");
|
902 704 | ::aws_smithy_protocol_test::assert_ok(
|
903 - | ::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"))
|
705 + | ::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"))
|
904 706 | );
|
905 707 | }
|
906 708 | }
|
907 709 |
|
908 - | /// When a timestamp list contains non-unique values,
|
909 - | /// the response should be a 400 ValidationException.
|
910 - | /// Test ID: RestJsonMalformedUniqueItemsTimestampList
|
710 + | /// When a union member's value does not contain a valid enum value,
|
711 + | /// the response should be a 400 ValidationException. Internal-only
|
712 + | /// enum values are excluded from the response message.
|
713 + | /// Test ID: RestJsonMalformedEnumUnion_case1
|
911 714 | #[::tokio::test]
|
912 715 | #[::tracing_test::traced_test]
|
913 716 | #[should_panic]
|
914 - | async fn rest_json_malformed_unique_items_timestamp_list_malformed_request() {
|
717 + | async fn rest_json_malformed_enum_union_case1_malformed_request() {
|
915 718 | {
|
916 719 | #[allow(unused_mut)]
|
917 720 | let mut http_request = ::http::Request::builder()
|
918 - | .uri("/MalformedUniqueItems")
|
721 + | .uri("/MalformedEnum")
|
919 722 | .method("POST")
|
920 723 | .header("content-type", "application/json")
|
921 724 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
922 725 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
923 - | "{ \"timestampList\" : [1676660607, 1676660607] }".as_bytes(),
|
726 + | "{ \"union\" : { \"first\": \"XYZ\" } }".as_bytes(),
|
924 727 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
925 728 | )),
|
926 729 | ))
|
927 730 | .unwrap();
|
928 731 | #[allow(unused_mut)]
|
929 732 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
930 733 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
931 734 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
932 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
735 + | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
933 736 | let sender = sender.clone();
|
934 737 | async move {
|
935 - | 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> };
|
738 + | 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> };
|
936 739 | sender.send(()).await.expect("receiver dropped early");
|
937 740 | result
|
938 741 | }
|
939 742 | })
|
940 743 | .build_unchecked();
|
941 744 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
942 745 | .await
|
943 746 | .expect("unable to make an HTTP request");
|
944 747 | ::pretty_assertions::assert_eq!(
|
945 748 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
946 749 | http_response.status()
|
947 750 | );
|
948 751 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
949 752 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
950 753 | http_response.headers(),
|
951 754 | expected_headers,
|
952 755 | ));
|
953 756 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
954 757 | .await
|
955 758 | .expect("unable to extract body to bytes");
|
956 759 | ::aws_smithy_protocol_test::assert_ok(
|
957 - | ::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"))
|
760 + | ::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"))
|
958 761 | );
|
959 762 | }
|
960 763 | }
|
764 + | }
|
961 765 |
|
962 - | /// When a date-time timestamp list contains non-unique values,
|
766 + | ::pin_project_lite::pin_project! {
|
767 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
768 + | /// [`MalformedLengthInput`](crate::input::MalformedLengthInput) using modelled bindings.
|
769 + | pub struct MalformedLengthInputFuture {
|
770 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedLengthInput, ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
771 + | }
|
772 + | }
|
773 + |
|
774 + | impl std::future::Future for MalformedLengthInputFuture {
|
775 + | type Output = Result<
|
776 + | crate::input::MalformedLengthInput,
|
777 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
778 + | >;
|
779 + |
|
780 + | fn poll(
|
781 + | self: std::pin::Pin<&mut Self>,
|
782 + | cx: &mut std::task::Context<'_>,
|
783 + | ) -> std::task::Poll<Self::Output> {
|
784 + | let this = self.project();
|
785 + | this.inner.as_mut().poll(cx)
|
786 + | }
|
787 + | }
|
788 + |
|
789 + | impl<B>
|
790 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
791 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
792 + | B,
|
793 + | > for crate::input::MalformedLengthInput
|
794 + | where
|
795 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
796 + | B: 'static,
|
797 + |
|
798 + | B::Data: Send,
|
799 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
800 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
801 + | {
|
802 + | type Rejection =
|
803 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
804 + | type Future = MalformedLengthInputFuture;
|
805 + |
|
806 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
807 + | let fut = async move {
|
808 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
809 + | request.headers(),
|
810 + | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
811 + | ) {
|
812 + | return Err(::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
813 + | }
|
814 + | crate::protocol_serde::shape_malformed_length::de_malformed_length_http_request(request)
|
815 + | .await
|
816 + | };
|
817 + | use ::futures_util::future::TryFutureExt;
|
818 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
819 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
820 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e)
|
821 + | });
|
822 + | MalformedLengthInputFuture {
|
823 + | inner: Box::pin(fut),
|
824 + | }
|
825 + | }
|
826 + | }
|
827 + | impl
|
828 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
829 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
830 + | > for crate::output::MalformedLengthOutput
|
831 + | {
|
832 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
833 + | match crate::protocol_serde::shape_malformed_length::ser_malformed_length_http_response(
|
834 + | self,
|
835 + | ) {
|
836 + | Ok(response) => response,
|
837 + | Err(e) => {
|
838 + | ::tracing::error!(error = %e, "failed to serialize response");
|
839 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
840 + | }
|
841 + | }
|
842 + | }
|
843 + | }
|
844 + | impl
|
845 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
846 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
847 + | > for crate::error::MalformedLengthError
|
848 + | {
|
849 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
850 + | match crate::protocol_serde::shape_malformed_length::ser_malformed_length_http_error(&self)
|
851 + | {
|
852 + | Ok(mut response) => {
|
853 + | response.extensions_mut().insert(
|
854 + | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
855 + | self.name(),
|
856 + | ),
|
857 + | );
|
858 + | response
|
859 + | }
|
860 + | Err(e) => {
|
861 + | ::tracing::error!(error = %e, "failed to serialize response");
|
862 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
863 + | }
|
864 + | }
|
865 + | }
|
866 + | }
|
867 + |
|
868 + | #[allow(unreachable_code, unused_variables)]
|
869 + | #[cfg(test)]
|
870 + | mod malformed_length_test {
|
871 + |
|
872 + | /// When a blob member does not fit within length bounds,
|
963 873 | /// the response should be a 400 ValidationException.
|
964 - | /// Test ID: RestJsonMalformedUniqueItemsDateTimeList
|
874 + | /// Test ID: RestJsonMalformedLengthBlob_case0
|
965 875 | #[::tokio::test]
|
966 876 | #[::tracing_test::traced_test]
|
967 - | #[should_panic]
|
968 - | async fn rest_json_malformed_unique_items_date_time_list_malformed_request() {
|
877 + | async fn rest_json_malformed_length_blob_case0_malformed_request() {
|
969 878 | {
|
970 879 | #[allow(unused_mut)]
|
971 880 | let mut http_request = ::http::Request::builder()
|
972 - | .uri("/MalformedUniqueItems")
|
881 + | .uri("/MalformedLength")
|
973 882 | .method("POST")
|
974 883 | .header("content-type", "application/json")
|
975 884 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
976 - | ::bytes::Bytes::copy_from_slice(
|
977 - | &::aws_smithy_protocol_test::decode_body_data("{ \"dateTimeList\" : [\"1985-04-12T23:20:50.52Z\", \"1985-04-12T23:20:50.52Z\"] }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
978 - | )
|
979 - | )).unwrap();
|
885 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
886 + | "{ \"blob\" : \"YQ==\" }".as_bytes(),
|
887 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
888 + | )),
|
889 + | ))
|
890 + | .unwrap();
|
980 891 | #[allow(unused_mut)]
|
981 892 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
982 893 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
983 894 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
984 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
895 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
985 896 | let sender = sender.clone();
|
986 897 | async move {
|
987 - | 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> };
|
898 + | 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> };
|
988 899 | sender.send(()).await.expect("receiver dropped early");
|
989 900 | result
|
990 901 | }
|
991 902 | })
|
992 903 | .build_unchecked();
|
993 904 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
994 905 | .await
|
995 906 | .expect("unable to make an HTTP request");
|
996 907 | ::pretty_assertions::assert_eq!(
|
997 908 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
998 909 | http_response.status()
|
999 910 | );
|
1000 911 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1001 912 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1002 913 | http_response.headers(),
|
1003 914 | expected_headers,
|
1004 915 | ));
|
1005 916 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1006 917 | .await
|
1007 918 | .expect("unable to extract body to bytes");
|
1008 919 | ::aws_smithy_protocol_test::assert_ok(
|
1009 - | ::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"))
|
920 + | ::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"))
|
1010 921 | );
|
1011 922 | }
|
1012 923 | }
|
1013 924 |
|
1014 - | /// When a http-date timestamp list contains non-unique values,
|
925 + | /// When a blob member does not fit within length bounds,
|
1015 926 | /// the response should be a 400 ValidationException.
|
1016 - | /// Test ID: RestJsonMalformedUniqueItemsHttpDateList_case0
|
927 + | /// Test ID: RestJsonMalformedLengthBlob_case1
|
1017 928 | #[::tokio::test]
|
1018 929 | #[::tracing_test::traced_test]
|
1019 - | #[should_panic]
|
1020 - | async fn rest_json_malformed_unique_items_http_date_list_case0_malformed_request() {
|
930 + | async fn rest_json_malformed_length_blob_case1_malformed_request() {
|
1021 931 | {
|
1022 932 | #[allow(unused_mut)]
|
1023 933 | let mut http_request = ::http::Request::builder()
|
1024 - | .uri("/MalformedUniqueItems")
|
934 + | .uri("/MalformedLength")
|
1025 935 | .method("POST")
|
1026 936 | .header("content-type", "application/json")
|
1027 937 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1028 - | ::bytes::Bytes::copy_from_slice(
|
1029 - | &::aws_smithy_protocol_test::decode_body_data("{ \"httpDateList\" : [\"Tue, 29 Apr 2014 18:30:38 GMT\", \"Tue, 29 Apr 2014 18:30:38 GMT\"] }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
1030 - | )
|
1031 - | )).unwrap();
|
938 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
939 + | "{ \"blob\" : \"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXo=\" }".as_bytes(),
|
940 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
941 + | )),
|
942 + | ))
|
943 + | .unwrap();
|
1032 944 | #[allow(unused_mut)]
|
1033 945 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1034 946 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1035 947 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1036 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
948 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
1037 949 | let sender = sender.clone();
|
1038 950 | async move {
|
1039 - | 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> };
|
951 + | 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> };
|
1040 952 | sender.send(()).await.expect("receiver dropped early");
|
1041 953 | result
|
1042 954 | }
|
1043 955 | })
|
1044 956 | .build_unchecked();
|
1045 957 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1046 958 | .await
|
1047 959 | .expect("unable to make an HTTP request");
|
1048 960 | ::pretty_assertions::assert_eq!(
|
1049 961 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1050 962 | http_response.status()
|
1051 963 | );
|
1052 964 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1053 965 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1054 966 | http_response.headers(),
|
1055 967 | expected_headers,
|
1056 968 | ));
|
1057 969 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1058 970 | .await
|
1059 971 | .expect("unable to extract body to bytes");
|
1060 972 | ::aws_smithy_protocol_test::assert_ok(
|
1061 - | ::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"))
|
973 + | ::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"))
|
1062 974 | );
|
1063 975 | }
|
1064 976 | }
|
1065 977 |
|
1066 - | /// When an enum list contains non-unique values,
|
978 + | /// When a string member does not fit within length bounds,
|
1067 979 | /// the response should be a 400 ValidationException.
|
1068 - | /// Test ID: RestJsonMalformedUniqueItemsEnumList
|
980 + | /// Test ID: RestJsonMalformedLengthString_case0
|
1069 981 | #[::tokio::test]
|
1070 982 | #[::tracing_test::traced_test]
|
1071 - | #[should_panic]
|
1072 - | async fn rest_json_malformed_unique_items_enum_list_malformed_request() {
|
983 + | async fn rest_json_malformed_length_string_case0_malformed_request() {
|
1073 984 | {
|
1074 985 | #[allow(unused_mut)]
|
1075 986 | let mut http_request = ::http::Request::builder()
|
1076 - | .uri("/MalformedUniqueItems")
|
987 + | .uri("/MalformedLength")
|
1077 988 | .method("POST")
|
1078 989 | .header("content-type", "application/json")
|
1079 990 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1080 991 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1081 - | "{ \"enumList\" : [\"Foo\", \"Foo\"] }".as_bytes(),
|
992 + | "{ \"string\" : \"a\" }".as_bytes(),
|
1082 993 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1083 994 | )),
|
1084 995 | ))
|
1085 996 | .unwrap();
|
1086 997 | #[allow(unused_mut)]
|
1087 998 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1088 999 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1089 1000 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1090 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
1001 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
1091 1002 | let sender = sender.clone();
|
1092 1003 | async move {
|
1093 - | 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> };
|
1004 + | 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> };
|
1094 1005 | sender.send(()).await.expect("receiver dropped early");
|
1095 1006 | result
|
1096 1007 | }
|
1097 1008 | })
|
1098 1009 | .build_unchecked();
|
1099 1010 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1100 1011 | .await
|
1101 1012 | .expect("unable to make an HTTP request");
|
1102 1013 | ::pretty_assertions::assert_eq!(
|
1103 1014 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1104 1015 | http_response.status()
|
1105 1016 | );
|
1106 1017 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1107 1018 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1108 1019 | http_response.headers(),
|
1109 1020 | expected_headers,
|
1110 1021 | ));
|
1111 1022 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1112 1023 | .await
|
1113 1024 | .expect("unable to extract body to bytes");
|
1114 1025 | ::aws_smithy_protocol_test::assert_ok(
|
1115 - | ::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"))
|
1026 + | ::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"))
|
1116 1027 | );
|
1117 1028 | }
|
1118 1029 | }
|
1119 1030 |
|
1120 - | /// When an intEnum list contains non-unique values,
|
1031 + | /// When a string member does not fit within length bounds,
|
1121 1032 | /// the response should be a 400 ValidationException.
|
1122 - | /// Test ID: RestJsonMalformedUniqueItemsIntEnumList
|
1033 + | /// Test ID: RestJsonMalformedLengthString_case1
|
1123 1034 | #[::tokio::test]
|
1124 1035 | #[::tracing_test::traced_test]
|
1125 - | #[should_panic]
|
1126 - | async fn rest_json_malformed_unique_items_int_enum_list_malformed_request() {
|
1036 + | async fn rest_json_malformed_length_string_case1_malformed_request() {
|
1127 1037 | {
|
1128 1038 | #[allow(unused_mut)]
|
1129 1039 | let mut http_request = ::http::Request::builder()
|
1130 - | .uri("/MalformedUniqueItems")
|
1040 + | .uri("/MalformedLength")
|
1131 1041 | .method("POST")
|
1132 1042 | .header("content-type", "application/json")
|
1133 1043 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1134 1044 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1135 - | "{ \"intEnumList\" : [3, 3] }".as_bytes(),
|
1045 + | "{ \"string\" : \"abcdefghijklmnopqrstuvwxyz\" }".as_bytes(),
|
1136 1046 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1137 1047 | )),
|
1138 1048 | ))
|
1139 1049 | .unwrap();
|
1140 1050 | #[allow(unused_mut)]
|
1141 1051 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1142 1052 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1143 1053 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1144 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
1054 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
1145 1055 | let sender = sender.clone();
|
1146 1056 | async move {
|
1147 - | 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> };
|
1057 + | 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> };
|
1148 1058 | sender.send(()).await.expect("receiver dropped early");
|
1149 1059 | result
|
1150 1060 | }
|
1151 1061 | })
|
1152 1062 | .build_unchecked();
|
1153 1063 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1154 1064 | .await
|
1155 1065 | .expect("unable to make an HTTP request");
|
1156 1066 | ::pretty_assertions::assert_eq!(
|
1157 1067 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1158 1068 | http_response.status()
|
1159 1069 | );
|
1160 1070 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1161 1071 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1162 1072 | http_response.headers(),
|
1163 1073 | expected_headers,
|
1164 1074 | ));
|
1165 1075 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1166 1076 | .await
|
1167 1077 | .expect("unable to extract body to bytes");
|
1168 1078 | ::aws_smithy_protocol_test::assert_ok(
|
1169 - | ::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"))
|
1079 + | ::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"))
|
1170 1080 | );
|
1171 1081 | }
|
1172 1082 | }
|
1173 1083 |
|
1174 - | /// When an list of lists contains non-unique values,
|
1084 + | /// When a string member does not fit within length bounds,
|
1175 1085 | /// the response should be a 400 ValidationException.
|
1176 - | /// Test ID: RestJsonMalformedUniqueItemsListList
|
1086 + | /// Test ID: RestJsonMalformedLengthString_case2
|
1177 1087 | #[::tokio::test]
|
1178 1088 | #[::tracing_test::traced_test]
|
1179 - | #[should_panic]
|
1180 - | async fn rest_json_malformed_unique_items_list_list_malformed_request() {
|
1089 + | async fn rest_json_malformed_length_string_case2_malformed_request() {
|
1181 1090 | {
|
1182 1091 | #[allow(unused_mut)]
|
1183 1092 | let mut http_request = ::http::Request::builder()
|
1184 - | .uri("/MalformedUniqueItems")
|
1093 + | .uri("/MalformedLength")
|
1185 1094 | .method("POST")
|
1186 1095 | .header("content-type", "application/json")
|
1187 1096 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1188 1097 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1189 - | "{ \"listList\" : [[\"foo\",\"bar\"], [\"foo\",\"bar\"]] }".as_bytes(),
|
1098 + | "{ \"string\" : \"👍\" }".as_bytes(),
|
1190 1099 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1191 1100 | )),
|
1192 1101 | ))
|
1193 1102 | .unwrap();
|
1194 1103 | #[allow(unused_mut)]
|
1195 1104 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1196 1105 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1197 1106 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1198 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
1107 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
1199 1108 | let sender = sender.clone();
|
1200 1109 | async move {
|
1201 - | 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> };
|
1110 + | 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> };
|
1202 1111 | sender.send(()).await.expect("receiver dropped early");
|
1203 1112 | result
|
1204 1113 | }
|
1205 1114 | })
|
1206 1115 | .build_unchecked();
|
1207 1116 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1208 1117 | .await
|
1209 1118 | .expect("unable to make an HTTP request");
|
1210 1119 | ::pretty_assertions::assert_eq!(
|
1211 1120 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1212 1121 | http_response.status()
|
1213 1122 | );
|
1214 1123 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1215 1124 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1216 1125 | http_response.headers(),
|
1217 1126 | expected_headers,
|
1218 1127 | ));
|
1219 1128 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1220 1129 | .await
|
1221 1130 | .expect("unable to extract body to bytes");
|
1222 1131 | ::aws_smithy_protocol_test::assert_ok(
|
1223 - | ::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"))
|
1132 + | ::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"))
|
1224 1133 | );
|
1225 1134 | }
|
1226 1135 | }
|
1227 1136 |
|
1228 - | /// When an list of structures contains non-unique values,
|
1137 + | /// When a string member does not fit within length bounds,
|
1229 1138 | /// the response should be a 400 ValidationException.
|
1230 - | /// Test ID: RestJsonMalformedUniqueItemsStructureList
|
1139 + | /// Test ID: RestJsonMalformedLengthMinString
|
1231 1140 | #[::tokio::test]
|
1232 1141 | #[::tracing_test::traced_test]
|
1233 - | #[should_panic]
|
1234 - | async fn rest_json_malformed_unique_items_structure_list_malformed_request() {
|
1142 + | async fn rest_json_malformed_length_min_string_malformed_request() {
|
1235 1143 | {
|
1236 1144 | #[allow(unused_mut)]
|
1237 1145 | let mut http_request = ::http::Request::builder()
|
1238 - | .uri("/MalformedUniqueItems")
|
1146 + | .uri("/MalformedLength")
|
1239 1147 | .method("POST")
|
1240 1148 | .header("content-type", "application/json")
|
1241 1149 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1242 1150 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1243 - | "{ \"structureList\" : [{\"hi\": \"hello\"}, {\"hi\": \"hello\"}] }"
|
1244 - | .as_bytes(),
|
1151 + | "{ \"minString\" : \"a\" }".as_bytes(),
|
1245 1152 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1246 1153 | )),
|
1247 1154 | ))
|
1248 1155 | .unwrap();
|
1249 1156 | #[allow(unused_mut)]
|
1250 1157 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1251 1158 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1252 1159 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1253 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
1160 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
1254 1161 | let sender = sender.clone();
|
1255 1162 | async move {
|
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> };
|
1163 + | 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> };
|
1257 1164 | sender.send(()).await.expect("receiver dropped early");
|
1258 1165 | result
|
1259 1166 | }
|
1260 1167 | })
|
1261 1168 | .build_unchecked();
|
1262 1169 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1263 1170 | .await
|
1264 1171 | .expect("unable to make an HTTP request");
|
1265 1172 | ::pretty_assertions::assert_eq!(
|
1266 1173 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1267 1174 | http_response.status()
|
1268 1175 | );
|
1269 1176 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1270 1177 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1271 1178 | http_response.headers(),
|
1272 1179 | expected_headers,
|
1273 1180 | ));
|
1274 1181 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1275 1182 | .await
|
1276 1183 | .expect("unable to extract body to bytes");
|
1277 1184 | ::aws_smithy_protocol_test::assert_ok(
|
1278 - | ::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"))
|
1185 + | ::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"))
|
1279 1186 | );
|
1280 1187 | }
|
1281 1188 | }
|
1282 1189 |
|
1283 - | /// When a list of structures does not contain required keys,
|
1284 - | /// the response should be a 400 ValidationException and not
|
1285 - | /// a 500 error.
|
1286 - | /// Test ID: RestJsonMalformedUniqueItemsStructureMissingKeyList
|
1190 + | /// When a string member does not fit within length bounds,
|
1191 + | /// the response should be a 400 ValidationException.
|
1192 + | /// Test ID: RestJsonMalformedLengthMaxString
|
1287 1193 | #[::tokio::test]
|
1288 1194 | #[::tracing_test::traced_test]
|
1289 - | async fn rest_json_malformed_unique_items_structure_missing_key_list_malformed_request() {
|
1195 + | async fn rest_json_malformed_length_max_string_malformed_request() {
|
1290 1196 | {
|
1291 1197 | #[allow(unused_mut)]
|
1292 1198 | let mut http_request = ::http::Request::builder()
|
1293 - | .uri("/MalformedUniqueItems")
|
1199 + | .uri("/MalformedLength")
|
1294 1200 | .method("POST")
|
1295 1201 | .header("content-type", "application/json")
|
1296 1202 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1297 1203 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1298 - | "{ \"structureListWithNoKey\" : [{\"hi2\": \"bar\"}] }".as_bytes(),
|
1204 + | "{ \"maxString\" : \"abcdefghijklmnopqrstuvwxyz\" }".as_bytes(),
|
1299 1205 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1300 1206 | )),
|
1301 1207 | ))
|
1302 1208 | .unwrap();
|
1303 1209 | #[allow(unused_mut)]
|
1304 1210 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1305 1211 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1306 1212 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1307 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
1213 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
1308 1214 | let sender = sender.clone();
|
1309 1215 | async move {
|
1310 - | 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> };
|
1216 + | 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> };
|
1311 1217 | sender.send(()).await.expect("receiver dropped early");
|
1312 1218 | result
|
1313 1219 | }
|
1314 1220 | })
|
1315 1221 | .build_unchecked();
|
1316 1222 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1317 1223 | .await
|
1318 1224 | .expect("unable to make an HTTP request");
|
1319 1225 | ::pretty_assertions::assert_eq!(
|
1320 1226 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1321 1227 | http_response.status()
|
1322 1228 | );
|
1323 1229 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1324 1230 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1325 1231 | http_response.headers(),
|
1326 1232 | expected_headers,
|
1327 1233 | ));
|
1328 1234 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1329 1235 | .await
|
1330 1236 | .expect("unable to extract body to bytes");
|
1331 1237 | ::aws_smithy_protocol_test::assert_ok(
|
1332 - | ::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"))
|
1238 + | ::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"))
|
1333 1239 | );
|
1334 1240 | }
|
1335 1241 | }
|
1336 1242 |
|
1337 - | /// When an list of unions contains non-unique values,
|
1243 + | /// When a list member does not fit within length bounds,
|
1338 1244 | /// the response should be a 400 ValidationException.
|
1339 - | /// Test ID: RestJsonMalformedUniqueItemsUnionList_case0
|
1245 + | /// Test ID: RestJsonMalformedLengthList_case0
|
1340 1246 | #[::tokio::test]
|
1341 1247 | #[::tracing_test::traced_test]
|
1342 - | #[should_panic]
|
1343 - | async fn rest_json_malformed_unique_items_union_list_case0_malformed_request() {
|
1248 + | async fn rest_json_malformed_length_list_case0_malformed_request() {
|
1344 1249 | {
|
1345 1250 | #[allow(unused_mut)]
|
1346 1251 | let mut http_request = ::http::Request::builder()
|
1347 - | .uri("/MalformedUniqueItems")
|
1252 + | .uri("/MalformedLength")
|
1348 1253 | .method("POST")
|
1349 1254 | .header("content-type", "application/json")
|
1350 1255 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1351 1256 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1352 - | "{ \"unionList\" : [{\"string\": \"foo\"}, {\"string\": \"foo\"}] }"
|
1353 - | .as_bytes(),
|
1257 + | "{ \"list\" : [\"abc\"] }".as_bytes(),
|
1354 1258 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1355 1259 | )),
|
1356 1260 | ))
|
1357 1261 | .unwrap();
|
1358 1262 | #[allow(unused_mut)]
|
1359 1263 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1360 1264 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1361 1265 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1362 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
1266 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
1363 1267 | let sender = sender.clone();
|
1364 1268 | async move {
|
1365 - | 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> };
|
1269 + | 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> };
|
1366 1270 | sender.send(()).await.expect("receiver dropped early");
|
1367 1271 | result
|
1368 1272 | }
|
1369 1273 | })
|
1370 1274 | .build_unchecked();
|
1371 1275 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1372 1276 | .await
|
1373 1277 | .expect("unable to make an HTTP request");
|
1374 1278 | ::pretty_assertions::assert_eq!(
|
1375 1279 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1376 1280 | http_response.status()
|
1377 1281 | );
|
1378 1282 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1379 1283 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1380 1284 | http_response.headers(),
|
1381 1285 | expected_headers,
|
1382 1286 | ));
|
1383 1287 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1384 1288 | .await
|
1385 1289 | .expect("unable to extract body to bytes");
|
1386 1290 | ::aws_smithy_protocol_test::assert_ok(
|
1387 - | ::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"))
|
1291 + | ::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"))
|
1388 1292 | );
|
1389 1293 | }
|
1390 1294 | }
|
1391 1295 |
|
1392 - | /// When an list of unions contains non-unique values,
|
1296 + | /// When a list member does not fit within length bounds,
|
1393 1297 | /// the response should be a 400 ValidationException.
|
1394 - | /// Test ID: RestJsonMalformedUniqueItemsUnionList_case1
|
1298 + | /// Test ID: RestJsonMalformedLengthList_case1
|
1395 1299 | #[::tokio::test]
|
1396 1300 | #[::tracing_test::traced_test]
|
1397 - | #[should_panic]
|
1398 - | async fn rest_json_malformed_unique_items_union_list_case1_malformed_request() {
|
1301 + | async fn rest_json_malformed_length_list_case1_malformed_request() {
|
1399 1302 | {
|
1400 1303 | #[allow(unused_mut)]
|
1401 1304 | let mut http_request = ::http::Request::builder()
|
1402 - | .uri("/MalformedUniqueItems")
|
1305 + | .uri("/MalformedLength")
|
1403 1306 | .method("POST")
|
1404 1307 | .header("content-type", "application/json")
|
1405 1308 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1406 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1407 - | "{ \"unionList\" : [{\"integer\": 1}, {\"integer\": 1}] }".as_bytes(),
|
1408 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1409 - | )),
|
1410 - | ))
|
1411 - | .unwrap();
|
1309 + | ::bytes::Bytes::copy_from_slice(
|
1310 + | &::aws_smithy_protocol_test::decode_body_data("{ \"list\" : [\"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\"] }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
1311 + | )
|
1312 + | )).unwrap();
|
1412 1313 | #[allow(unused_mut)]
|
1413 1314 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1414 1315 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1415 1316 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1416 - | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
1317 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
1417 1318 | let sender = sender.clone();
|
1418 1319 | async move {
|
1419 - | 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> };
|
1320 + | 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> };
|
1420 1321 | sender.send(()).await.expect("receiver dropped early");
|
1421 1322 | result
|
1422 1323 | }
|
1423 1324 | })
|
1424 1325 | .build_unchecked();
|
1425 1326 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1426 1327 | .await
|
1427 1328 | .expect("unable to make an HTTP request");
|
1428 1329 | ::pretty_assertions::assert_eq!(
|
1429 1330 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1430 1331 | http_response.status()
|
1431 1332 | );
|
1432 1333 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1433 1334 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1434 1335 | http_response.headers(),
|
1435 1336 | expected_headers,
|
1436 1337 | ));
|
1437 1338 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1438 1339 | .await
|
1439 1340 | .expect("unable to extract body to bytes");
|
1440 1341 | ::aws_smithy_protocol_test::assert_ok(
|
1441 - | ::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"))
|
1442 - | );
|
1443 - | }
|
1444 - | }
|
1445 - | }
|
1446 - |
|
1447 - | ::pin_project_lite::pin_project! {
|
1448 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
1449 - | /// [`MalformedRequiredInput`](crate::input::MalformedRequiredInput) using modelled bindings.
|
1450 - | pub struct MalformedRequiredInputFuture {
|
1451 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedRequiredInput, ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
1452 - | }
|
1453 - | }
|
1454 - |
|
1455 - | impl std::future::Future for MalformedRequiredInputFuture {
|
1456 - | type Output = Result<
|
1457 - | crate::input::MalformedRequiredInput,
|
1458 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
1459 - | >;
|
1460 - |
|
1461 - | fn poll(
|
1462 - | self: std::pin::Pin<&mut Self>,
|
1463 - | cx: &mut std::task::Context<'_>,
|
1464 - | ) -> std::task::Poll<Self::Output> {
|
1465 - | let this = self.project();
|
1466 - | this.inner.as_mut().poll(cx)
|
1467 - | }
|
1468 - | }
|
1469 - |
|
1470 - | impl<B>
|
1471 - | ::aws_smithy_legacy_http_server::request::FromRequest<
|
1472 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
1473 - | B,
|
1474 - | > for crate::input::MalformedRequiredInput
|
1475 - | where
|
1476 - | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
1477 - | B: 'static,
|
1478 - |
|
1479 - | B::Data: Send,
|
1480 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
1481 - | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
1482 - | {
|
1483 - | type Rejection =
|
1484 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
1485 - | type Future = MalformedRequiredInputFuture;
|
1486 - |
|
1487 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
1488 - | let fut = async move {
|
1489 - | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
1490 - | request.headers(),
|
1491 - | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
1492 - | ) {
|
1493 - | return Err(::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
1494 - | }
|
1495 - | crate::protocol_serde::shape_malformed_required::de_malformed_required_http_request(
|
1496 - | request,
|
1497 - | )
|
1498 - | .await
|
1499 - | };
|
1500 - | use ::futures_util::future::TryFutureExt;
|
1501 - | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
1502 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
1503 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e)
|
1504 - | });
|
1505 - | MalformedRequiredInputFuture {
|
1506 - | inner: Box::pin(fut),
|
1507 - | }
|
1508 - | }
|
1509 - | }
|
1510 - | impl
|
1511 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
1512 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
1513 - | > for crate::output::MalformedRequiredOutput
|
1514 - | {
|
1515 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
1516 - | match crate::protocol_serde::shape_malformed_required::ser_malformed_required_http_response(
|
1517 - | self,
|
1518 - | ) {
|
1519 - | Ok(response) => response,
|
1520 - | Err(e) => {
|
1521 - | ::tracing::error!(error = %e, "failed to serialize response");
|
1522 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
1523 - | }
|
1524 - | }
|
1525 - | }
|
1526 - | }
|
1527 - | impl
|
1528 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
1529 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
1530 - | > for crate::error::MalformedRequiredError
|
1531 - | {
|
1532 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
1533 - | match crate::protocol_serde::shape_malformed_required::ser_malformed_required_http_error(
|
1534 - | &self,
|
1535 - | ) {
|
1536 - | Ok(mut response) => {
|
1537 - | response.extensions_mut().insert(
|
1538 - | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
1539 - | self.name(),
|
1540 - | ),
|
1342 + | ::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"))
|
1541 1343 | );
|
1542 - | response
|
1543 - | }
|
1544 - | Err(e) => {
|
1545 - | ::tracing::error!(error = %e, "failed to serialize response");
|
1546 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
1547 - | }
|
1548 1344 | }
|
1549 1345 | }
|
1550 - | }
|
1551 - |
|
1552 - | #[allow(unreachable_code, unused_variables)]
|
1553 - | #[cfg(test)]
|
1554 - | mod malformed_required_test {
|
1555 1346 |
|
1556 - | /// When a required member is not set in the message body,
|
1347 + | /// When a list member's value does not fit within length bounds,
|
1557 1348 | /// the response should be a 400 ValidationException.
|
1558 - | /// Test ID: RestJsonMalformedRequiredBodyUnset
|
1349 + | /// Test ID: RestJsonMalformedLengthListValue_case0
|
1559 1350 | #[::tokio::test]
|
1560 1351 | #[::tracing_test::traced_test]
|
1561 - | async fn rest_json_malformed_required_body_unset_malformed_request() {
|
1352 + | async fn rest_json_malformed_length_list_value_case0_malformed_request() {
|
1562 1353 | {
|
1563 1354 | #[allow(unused_mut)]
|
1564 1355 | let mut http_request = ::http::Request::builder()
|
1565 - | .uri("/MalformedRequired")
|
1356 + | .uri("/MalformedLength")
|
1566 1357 | .method("POST")
|
1567 1358 | .header("content-type", "application/json")
|
1568 - | .header("string-in-headers", "abc")
|
1569 1359 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1570 1360 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1571 - | "{ }".as_bytes(),
|
1361 + | "{ \"list\" : [\"a\", \"abc\"] }".as_bytes(),
|
1572 1362 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1573 1363 | )),
|
1574 1364 | ))
|
1575 1365 | .unwrap();
|
1576 - | *http_request.uri_mut() = "/MalformedRequired?stringInQuery=abc".parse().unwrap();
|
1577 1366 | #[allow(unused_mut)]
|
1578 1367 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1579 1368 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1580 1369 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1581 - | .malformed_required(move |input: crate::input::MalformedRequiredInput| {
|
1370 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
1582 1371 | let sender = sender.clone();
|
1583 1372 | async move {
|
1584 - | 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> };
|
1373 + | 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> };
|
1585 1374 | sender.send(()).await.expect("receiver dropped early");
|
1586 1375 | result
|
1587 1376 | }
|
1588 1377 | })
|
1589 1378 | .build_unchecked();
|
1590 1379 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1591 1380 | .await
|
1592 1381 | .expect("unable to make an HTTP request");
|
1593 1382 | ::pretty_assertions::assert_eq!(
|
1594 1383 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1595 1384 | http_response.status()
|
1596 1385 | );
|
1597 1386 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1598 1387 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1599 1388 | http_response.headers(),
|
1600 1389 | expected_headers,
|
1601 1390 | ));
|
1602 1391 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1603 1392 | .await
|
1604 1393 | .expect("unable to extract body to bytes");
|
1605 1394 | ::aws_smithy_protocol_test::assert_ok(
|
1606 - | ::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"))
|
1395 + | ::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"))
|
1607 1396 | );
|
1608 1397 | }
|
1609 1398 | }
|
1610 1399 |
|
1611 - | /// When a required member is set to null in the message body,
|
1400 + | /// When a list member's value does not fit within length bounds,
|
1612 1401 | /// the response should be a 400 ValidationException.
|
1613 - | /// Test ID: RestJsonMalformedRequiredBodyExplicitNull
|
1402 + | /// Test ID: RestJsonMalformedLengthListValue_case1
|
1614 1403 | #[::tokio::test]
|
1615 1404 | #[::tracing_test::traced_test]
|
1616 - | async fn rest_json_malformed_required_body_explicit_null_malformed_request() {
|
1405 + | async fn rest_json_malformed_length_list_value_case1_malformed_request() {
|
1617 1406 | {
|
1618 1407 | #[allow(unused_mut)]
|
1619 1408 | let mut http_request = ::http::Request::builder()
|
1620 - | .uri("/MalformedRequired")
|
1409 + | .uri("/MalformedLength")
|
1621 1410 | .method("POST")
|
1622 1411 | .header("content-type", "application/json")
|
1623 - | .header("string-in-headers", "abc")
|
1624 1412 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1625 1413 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1626 - | "{ \"string\": null }".as_bytes(),
|
1414 + | "{ \"list\" : [\"abcdefghijklmnopqrstuvwxyz\", \"abc\"] }".as_bytes(),
|
1627 1415 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1628 1416 | )),
|
1629 1417 | ))
|
1630 1418 | .unwrap();
|
1631 - | *http_request.uri_mut() = "/MalformedRequired?stringInQuery=abc".parse().unwrap();
|
1632 1419 | #[allow(unused_mut)]
|
1633 1420 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1634 1421 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1635 1422 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1636 - | .malformed_required(move |input: crate::input::MalformedRequiredInput| {
|
1423 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
1637 1424 | let sender = sender.clone();
|
1638 1425 | async move {
|
1639 - | 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> };
|
1426 + | 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> };
|
1640 1427 | sender.send(()).await.expect("receiver dropped early");
|
1641 1428 | result
|
1642 1429 | }
|
1643 1430 | })
|
1644 1431 | .build_unchecked();
|
1645 1432 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1646 1433 | .await
|
1647 1434 | .expect("unable to make an HTTP request");
|
1648 1435 | ::pretty_assertions::assert_eq!(
|
1649 1436 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1650 1437 | http_response.status()
|
1651 1438 | );
|
1652 1439 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1653 1440 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1654 1441 | http_response.headers(),
|
1655 1442 | expected_headers,
|
1656 1443 | ));
|
1657 1444 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1658 1445 | .await
|
1659 1446 | .expect("unable to extract body to bytes");
|
1660 1447 | ::aws_smithy_protocol_test::assert_ok(
|
1661 - | ::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"))
|
1448 + | ::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"))
|
1662 1449 | );
|
1663 1450 | }
|
1664 1451 | }
|
1665 1452 |
|
1666 - | /// When a required member is not set in headers,
|
1453 + | /// When a map member does not fit within length bounds,
|
1667 1454 | /// the response should be a 400 ValidationException.
|
1668 - | /// Test ID: RestJsonMalformedRequiredHeaderUnset
|
1455 + | /// Test ID: RestJsonMalformedLengthMap_case0
|
1669 1456 | #[::tokio::test]
|
1670 1457 | #[::tracing_test::traced_test]
|
1671 - | async fn rest_json_malformed_required_header_unset_malformed_request() {
|
1458 + | async fn rest_json_malformed_length_map_case0_malformed_request() {
|
1672 1459 | {
|
1673 1460 | #[allow(unused_mut)]
|
1674 1461 | let mut http_request = ::http::Request::builder()
|
1675 - | .uri("/MalformedRequired")
|
1462 + | .uri("/MalformedLength")
|
1676 1463 | .method("POST")
|
1677 1464 | .header("content-type", "application/json")
|
1678 1465 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1679 1466 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1680 - | "{ \"string\": \"abc\" }".as_bytes(),
|
1467 + | "{ \"map\" : {\"abc\": [\"def\", \"efg\", \"fgh\"]} }".as_bytes(),
|
1681 1468 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1682 1469 | )),
|
1683 1470 | ))
|
1684 1471 | .unwrap();
|
1685 - | *http_request.uri_mut() = "/MalformedRequired?stringInQuery=abc".parse().unwrap();
|
1686 1472 | #[allow(unused_mut)]
|
1687 1473 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1688 1474 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1689 1475 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1690 - | .malformed_required(move |input: crate::input::MalformedRequiredInput| {
|
1476 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
1691 1477 | let sender = sender.clone();
|
1692 1478 | async move {
|
1693 - | 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> };
|
1479 + | 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> };
|
1694 1480 | sender.send(()).await.expect("receiver dropped early");
|
1695 1481 | result
|
1696 1482 | }
|
1697 1483 | })
|
1698 1484 | .build_unchecked();
|
1699 1485 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1700 1486 | .await
|
1701 1487 | .expect("unable to make an HTTP request");
|
1702 1488 | ::pretty_assertions::assert_eq!(
|
1703 1489 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1704 1490 | http_response.status()
|
1705 1491 | );
|
1706 1492 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1707 1493 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1708 1494 | http_response.headers(),
|
1709 1495 | expected_headers,
|
1710 1496 | ));
|
1711 1497 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1712 1498 | .await
|
1713 1499 | .expect("unable to extract body to bytes");
|
1714 1500 | ::aws_smithy_protocol_test::assert_ok(
|
1715 - | ::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"))
|
1501 + | ::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"))
|
1716 1502 | );
|
1717 1503 | }
|
1718 1504 | }
|
1719 - | }
|
1720 - |
|
1721 - | ::pin_project_lite::pin_project! {
|
1722 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
1723 - | /// [`MalformedRangeOverrideInput`](crate::input::MalformedRangeOverrideInput) using modelled bindings.
|
1724 - | pub struct MalformedRangeOverrideInputFuture {
|
1725 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedRangeOverrideInput, ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
1726 - | }
|
1727 - | }
|
1728 - |
|
1729 - | impl std::future::Future for MalformedRangeOverrideInputFuture {
|
1730 - | type Output = Result<
|
1731 - | crate::input::MalformedRangeOverrideInput,
|
1732 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
1733 - | >;
|
1734 1505 |
|
1735 - | fn poll(
|
1736 - | self: std::pin::Pin<&mut Self>,
|
1737 - | cx: &mut std::task::Context<'_>,
|
1738 - | ) -> std::task::Poll<Self::Output> {
|
1739 - | let this = self.project();
|
1740 - | this.inner.as_mut().poll(cx)
|
1741 - | }
|
1742 - | }
|
1743 - |
|
1744 - | impl<B>
|
1745 - | ::aws_smithy_legacy_http_server::request::FromRequest<
|
1746 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
1747 - | B,
|
1748 - | > for crate::input::MalformedRangeOverrideInput
|
1749 - | where
|
1750 - | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
1751 - | B: 'static,
|
1752 - |
|
1753 - | B::Data: Send,
|
1754 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
1755 - | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
1756 - | {
|
1757 - | type Rejection =
|
1758 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
1759 - | type Future = MalformedRangeOverrideInputFuture;
|
1760 - |
|
1761 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
1762 - | let fut = async move {
|
1763 - | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
1764 - | request.headers(),
|
1765 - | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
1766 - | ) {
|
1767 - | return Err(::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
1768 - | }
|
1769 - | crate::protocol_serde::shape_malformed_range_override::de_malformed_range_override_http_request(request)
|
1770 - | .await
|
1771 - | };
|
1772 - | use ::futures_util::future::TryFutureExt;
|
1773 - | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
1774 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
1775 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e)
|
1776 - | });
|
1777 - | MalformedRangeOverrideInputFuture {
|
1778 - | inner: Box::pin(fut),
|
1779 - | }
|
1780 - | }
|
1781 - | }
|
1782 - | impl
|
1783 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
1784 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
1785 - | > for crate::output::MalformedRangeOverrideOutput
|
1786 - | {
|
1787 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
1788 - | match crate::protocol_serde::shape_malformed_range_override::ser_malformed_range_override_http_response(self) {
|
1789 - | Ok(response) => response,
|
1790 - | Err(e) => {
|
1791 - | ::tracing::error!(error = %e, "failed to serialize response");
|
1792 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
1793 - | }
|
1794 - | }
|
1795 - | }
|
1796 - | }
|
1797 - | impl
|
1798 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
1799 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
1800 - | > for crate::error::MalformedRangeOverrideError
|
1801 - | {
|
1802 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
1803 - | match crate::protocol_serde::shape_malformed_range_override::ser_malformed_range_override_http_error(&self) {
|
1804 - | Ok(mut response) => {
|
1805 - | response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
1806 - | response
|
1807 - | },
|
1808 - | Err(e) => {
|
1809 - | ::tracing::error!(error = %e, "failed to serialize response");
|
1810 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
1811 - | }
|
1812 - | }
|
1813 - | }
|
1814 - | }
|
1815 - |
|
1816 - | #[allow(unreachable_code, unused_variables)]
|
1817 - | #[cfg(test)]
|
1818 - | mod malformed_range_override_test {
|
1819 - |
|
1820 - | /// When a byte member does not fit within range bounds,
|
1821 - | /// the response should be a 400 ValidationException.
|
1822 - | /// Test ID: RestJsonMalformedRangeByteOverride_case0
|
1823 - | #[::tokio::test]
|
1824 - | #[::tracing_test::traced_test]
|
1825 - | async fn rest_json_malformed_range_byte_override_case0_malformed_request() {
|
1826 - | {
|
1827 - | #[allow(unused_mut)]
|
1828 - | let mut http_request = ::http::Request::builder()
|
1829 - | .uri("/MalformedRangeOverride")
|
1830 - | .method("POST")
|
1831 - | .header("content-type", "application/json")
|
1832 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1833 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1834 - | "{ \"byte\" : 3 }".as_bytes(),
|
1835 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1836 - | )),
|
1837 - | ))
|
1838 - | .unwrap();
|
1839 - | #[allow(unused_mut)]
|
1840 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1841 - | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1842 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1843 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
1844 - | let sender = sender.clone();
|
1845 - | async move {
|
1846 - | 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> };
|
1847 - | sender.send(()).await.expect("receiver dropped early");
|
1848 - | result
|
1506 + | /// When a map member does not fit within length bounds,
|
1507 + | /// the response should be a 400 ValidationException.
|
1508 + | /// Test ID: RestJsonMalformedLengthMap_case1
|
1509 + | #[::tokio::test]
|
1510 + | #[::tracing_test::traced_test]
|
1511 + | async fn rest_json_malformed_length_map_case1_malformed_request() {
|
1512 + | {
|
1513 + | #[allow(unused_mut)]
|
1514 + | let mut http_request = ::http::Request::builder()
|
1515 + | .uri("/MalformedLength")
|
1516 + | .method("POST")
|
1517 + | .header("content-type", "application/json")
|
1518 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1519 + | ::bytes::Bytes::copy_from_slice(
|
1520 + | &::aws_smithy_protocol_test::decode_body_data("{ \"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(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
1521 + | )
|
1522 + | )).unwrap();
|
1523 + | #[allow(unused_mut)]
|
1524 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1525 + | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1526 + | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1527 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
1528 + | let sender = sender.clone();
|
1529 + | async move {
|
1530 + | 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> };
|
1531 + | sender.send(()).await.expect("receiver dropped early");
|
1532 + | result
|
1849 1533 | }
|
1850 1534 | })
|
1851 1535 | .build_unchecked();
|
1852 1536 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1853 1537 | .await
|
1854 1538 | .expect("unable to make an HTTP request");
|
1855 1539 | ::pretty_assertions::assert_eq!(
|
1856 1540 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1857 1541 | http_response.status()
|
1858 1542 | );
|
1859 1543 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1860 1544 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1861 1545 | http_response.headers(),
|
1862 1546 | expected_headers,
|
1863 1547 | ));
|
1864 1548 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1865 1549 | .await
|
1866 1550 | .expect("unable to extract body to bytes");
|
1867 1551 | ::aws_smithy_protocol_test::assert_ok(
|
1868 - | ::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"))
|
1552 + | ::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"))
|
1869 1553 | );
|
1870 1554 | }
|
1871 1555 | }
|
1872 1556 |
|
1873 - | /// When a byte member does not fit within range bounds,
|
1557 + | /// When a map member's key does not fit within length bounds,
|
1874 1558 | /// the response should be a 400 ValidationException.
|
1875 - | /// Test ID: RestJsonMalformedRangeByteOverride_case1
|
1559 + | /// Test ID: RestJsonMalformedLengthMapKey_case0
|
1876 1560 | #[::tokio::test]
|
1877 1561 | #[::tracing_test::traced_test]
|
1878 - | async fn rest_json_malformed_range_byte_override_case1_malformed_request() {
|
1562 + | async fn rest_json_malformed_length_map_key_case0_malformed_request() {
|
1879 1563 | {
|
1880 1564 | #[allow(unused_mut)]
|
1881 1565 | let mut http_request = ::http::Request::builder()
|
1882 - | .uri("/MalformedRangeOverride")
|
1566 + | .uri("/MalformedLength")
|
1883 1567 | .method("POST")
|
1884 1568 | .header("content-type", "application/json")
|
1885 1569 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1886 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1887 - | "{ \"byte\" : 7 }".as_bytes(),
|
1888 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1889 - | )),
|
1890 - | ))
|
1891 - | .unwrap();
|
1570 + | ::bytes::Bytes::copy_from_slice(
|
1571 + | &::aws_smithy_protocol_test::decode_body_data("{ \"map\" : {\"a\": [\"abc\", \"def\", \"efg\"], \"bcd\": [\"abc\", \"def\", \"efg\"], \"cde\": [\"abc\", \"def\", \"efg\"]} }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
1572 + | )
|
1573 + | )).unwrap();
|
1892 1574 | #[allow(unused_mut)]
|
1893 1575 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1894 1576 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1895 1577 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1896 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
1578 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
1897 1579 | let sender = sender.clone();
|
1898 1580 | async move {
|
1899 - | 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> };
|
1581 + | 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> };
|
1900 1582 | sender.send(()).await.expect("receiver dropped early");
|
1901 1583 | result
|
1902 1584 | }
|
1903 1585 | })
|
1904 1586 | .build_unchecked();
|
1905 1587 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1906 1588 | .await
|
1907 1589 | .expect("unable to make an HTTP request");
|
1908 1590 | ::pretty_assertions::assert_eq!(
|
1909 1591 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1910 1592 | http_response.status()
|
1911 1593 | );
|
1912 1594 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1913 1595 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1914 1596 | http_response.headers(),
|
1915 1597 | expected_headers,
|
1916 1598 | ));
|
1917 1599 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1918 1600 | .await
|
1919 1601 | .expect("unable to extract body to bytes");
|
1920 1602 | ::aws_smithy_protocol_test::assert_ok(
|
1921 - | ::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"))
|
1603 + | ::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"))
|
1922 1604 | );
|
1923 1605 | }
|
1924 1606 | }
|
1925 1607 |
|
1926 - | /// When a byte member does not fit within range bounds,
|
1608 + | /// When a map member's key does not fit within length bounds,
|
1927 1609 | /// the response should be a 400 ValidationException.
|
1928 - | /// Test ID: RestJsonMalformedRangeMinByteOverride
|
1610 + | /// Test ID: RestJsonMalformedLengthMapKey_case1
|
1929 1611 | #[::tokio::test]
|
1930 1612 | #[::tracing_test::traced_test]
|
1931 - | async fn rest_json_malformed_range_min_byte_override_malformed_request() {
|
1613 + | async fn rest_json_malformed_length_map_key_case1_malformed_request() {
|
1932 1614 | {
|
1933 1615 | #[allow(unused_mut)]
|
1934 1616 | let mut http_request = ::http::Request::builder()
|
1935 - | .uri("/MalformedRangeOverride")
|
1617 + | .uri("/MalformedLength")
|
1936 1618 | .method("POST")
|
1937 1619 | .header("content-type", "application/json")
|
1938 1620 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1939 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1940 - | "{ \"minByte\" : 3 }".as_bytes(),
|
1941 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1942 - | )),
|
1943 - | ))
|
1944 - | .unwrap();
|
1621 + | ::bytes::Bytes::copy_from_slice(
|
1622 + | &::aws_smithy_protocol_test::decode_body_data("{ \"map\" : {\"abcdefghijklmnopqrstuvwxyz\": [\"abc\", \"def\", \"efg\"], \"bcd\": [\"abc\", \"def\", \"efg\"], \"cde\": [\"abc\", \"def\", \"efg\"]} }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
1623 + | )
|
1624 + | )).unwrap();
|
1945 1625 | #[allow(unused_mut)]
|
1946 1626 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1947 1627 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1948 1628 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1949 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
1629 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
1950 1630 | let sender = sender.clone();
|
1951 1631 | async move {
|
1952 - | 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> };
|
1632 + | 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> };
|
1953 1633 | sender.send(()).await.expect("receiver dropped early");
|
1954 1634 | result
|
1955 1635 | }
|
1956 1636 | })
|
1957 1637 | .build_unchecked();
|
1958 1638 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1959 1639 | .await
|
1960 1640 | .expect("unable to make an HTTP request");
|
1961 1641 | ::pretty_assertions::assert_eq!(
|
1962 1642 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1963 1643 | http_response.status()
|
1964 1644 | );
|
1965 1645 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1966 1646 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1967 1647 | http_response.headers(),
|
1968 1648 | expected_headers,
|
1969 1649 | ));
|
1970 1650 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1971 1651 | .await
|
1972 1652 | .expect("unable to extract body to bytes");
|
1973 1653 | ::aws_smithy_protocol_test::assert_ok(
|
1974 - | ::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"))
|
1654 + | ::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"))
|
1975 1655 | );
|
1976 1656 | }
|
1977 1657 | }
|
1978 1658 |
|
1979 - | /// When a byte member does not fit within range bounds,
|
1659 + | /// When a map member's value does not fit within length bounds,
|
1980 1660 | /// the response should be a 400 ValidationException.
|
1981 - | /// Test ID: RestJsonMalformedRangeMaxByteOverride
|
1661 + | /// Test ID: RestJsonMalformedLengthMapValue_case0
|
1982 1662 | #[::tokio::test]
|
1983 1663 | #[::tracing_test::traced_test]
|
1984 - | async fn rest_json_malformed_range_max_byte_override_malformed_request() {
|
1664 + | async fn rest_json_malformed_length_map_value_case0_malformed_request() {
|
1985 1665 | {
|
1986 1666 | #[allow(unused_mut)]
|
1987 1667 | let mut http_request = ::http::Request::builder()
|
1988 - | .uri("/MalformedRangeOverride")
|
1668 + | .uri("/MalformedLength")
|
1989 1669 | .method("POST")
|
1990 1670 | .header("content-type", "application/json")
|
1991 1671 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1992 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1993 - | "{ \"maxByte\" : 7 }".as_bytes(),
|
1994 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1995 - | )),
|
1996 - | ))
|
1997 - | .unwrap();
|
1672 + | ::bytes::Bytes::copy_from_slice(
|
1673 + | &::aws_smithy_protocol_test::decode_body_data("{ \"map\" : {\"abc\": [\"def\"], \"bcd\": [\"abc\", \"def\", \"efg\"], \"cde\": [\"abc\", \"def\", \"efg\"]} }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
1674 + | )
|
1675 + | )).unwrap();
|
1998 1676 | #[allow(unused_mut)]
|
1999 1677 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2000 1678 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2001 1679 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2002 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
1680 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
2003 1681 | let sender = sender.clone();
|
2004 1682 | async move {
|
2005 - | 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> };
|
1683 + | 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> };
|
2006 1684 | sender.send(()).await.expect("receiver dropped early");
|
2007 1685 | result
|
2008 1686 | }
|
2009 1687 | })
|
2010 1688 | .build_unchecked();
|
2011 1689 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2012 1690 | .await
|
2013 1691 | .expect("unable to make an HTTP request");
|
2014 1692 | ::pretty_assertions::assert_eq!(
|
2015 1693 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2016 1694 | http_response.status()
|
2017 1695 | );
|
2018 1696 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2019 1697 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2020 1698 | http_response.headers(),
|
2021 1699 | expected_headers,
|
2022 1700 | ));
|
2023 1701 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2024 1702 | .await
|
2025 1703 | .expect("unable to extract body to bytes");
|
2026 1704 | ::aws_smithy_protocol_test::assert_ok(
|
2027 - | ::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"))
|
1705 + | ::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"))
|
2028 1706 | );
|
2029 1707 | }
|
2030 1708 | }
|
2031 1709 |
|
2032 - | /// When a float member does not fit within range bounds,
|
1710 + | /// When a map member's value does not fit within length bounds,
|
2033 1711 | /// the response should be a 400 ValidationException.
|
2034 - | /// Test ID: RestJsonMalformedRangeFloatOverride_case0
|
1712 + | /// Test ID: RestJsonMalformedLengthMapValue_case1
|
2035 1713 | #[::tokio::test]
|
2036 1714 | #[::tracing_test::traced_test]
|
2037 - | #[should_panic]
|
2038 - | async fn rest_json_malformed_range_float_override_case0_malformed_request() {
|
1715 + | async fn rest_json_malformed_length_map_value_case1_malformed_request() {
|
2039 1716 | {
|
2040 1717 | #[allow(unused_mut)]
|
2041 1718 | let mut http_request = ::http::Request::builder()
|
2042 - | .uri("/MalformedRangeOverride")
|
1719 + | .uri("/MalformedLength")
|
2043 1720 | .method("POST")
|
2044 1721 | .header("content-type", "application/json")
|
2045 1722 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2046 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2047 - | "{ \"float\" : 4.3 }".as_bytes(),
|
2048 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2049 - | )),
|
2050 - | ))
|
2051 - | .unwrap();
|
1723 + | ::bytes::Bytes::copy_from_slice(
|
1724 + | &::aws_smithy_protocol_test::decode_body_data("{ \"map\" : {\"abc\": [\"def\", \"efg\", \"fgh\", \"def\", \"efg\", \"fgh\", \"def\", \"efg\", \"fgh\", \"def\"],\n \"bcd\": [\"abc\", \"def\", \"efg\"],\n \"cde\": [\"abc\", \"def\", \"efg\"]} }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
1725 + | )
|
1726 + | )).unwrap();
|
2052 1727 | #[allow(unused_mut)]
|
2053 1728 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2054 1729 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2055 1730 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2056 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
1731 + | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
2057 1732 | let sender = sender.clone();
|
2058 1733 | async move {
|
2059 - | 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> };
|
1734 + | 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> };
|
2060 1735 | sender.send(()).await.expect("receiver dropped early");
|
2061 1736 | result
|
2062 1737 | }
|
2063 1738 | })
|
2064 1739 | .build_unchecked();
|
2065 1740 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2066 1741 | .await
|
2067 1742 | .expect("unable to make an HTTP request");
|
2068 1743 | ::pretty_assertions::assert_eq!(
|
2069 1744 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2070 1745 | http_response.status()
|
2071 1746 | );
|
2072 1747 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2073 1748 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2074 1749 | http_response.headers(),
|
2075 1750 | expected_headers,
|
2076 1751 | ));
|
2077 1752 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2078 1753 | .await
|
2079 1754 | .expect("unable to extract body to bytes");
|
2080 1755 | ::aws_smithy_protocol_test::assert_ok(
|
2081 - | ::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"))
|
1756 + | ::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"))
|
2082 1757 | );
|
2083 1758 | }
|
2084 1759 | }
|
1760 + | }
|
2085 1761 |
|
2086 - | /// When a float member does not fit within range bounds,
|
2087 - | /// the response should be a 400 ValidationException.
|
2088 - | /// Test ID: RestJsonMalformedRangeFloatOverride_case1
|
2089 - | #[::tokio::test]
|
2090 - | #[::tracing_test::traced_test]
|
2091 - | #[should_panic]
|
2092 - | async fn rest_json_malformed_range_float_override_case1_malformed_request() {
|
2093 - | {
|
2094 - | #[allow(unused_mut)]
|
2095 - | let mut http_request = ::http::Request::builder()
|
2096 - | .uri("/MalformedRangeOverride")
|
2097 - | .method("POST")
|
2098 - | .header("content-type", "application/json")
|
2099 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2100 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2101 - | "{ \"float\" : 6.7 }".as_bytes(),
|
2102 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2103 - | )),
|
2104 - | ))
|
2105 - | .unwrap();
|
2106 - | #[allow(unused_mut)]
|
2107 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2108 - | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2109 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2110 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2111 - | let sender = sender.clone();
|
2112 - | async move {
|
2113 - | 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> };
|
2114 - | sender.send(()).await.expect("receiver dropped early");
|
2115 - | result
|
1762 + | ::pin_project_lite::pin_project! {
|
1763 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
1764 + | /// [`MalformedLengthOverrideInput`](crate::input::MalformedLengthOverrideInput) using modelled bindings.
|
1765 + | pub struct MalformedLengthOverrideInputFuture {
|
1766 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedLengthOverrideInput, ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
1767 + | }
|
1768 + | }
|
1769 + |
|
1770 + | impl std::future::Future for MalformedLengthOverrideInputFuture {
|
1771 + | type Output = Result<
|
1772 + | crate::input::MalformedLengthOverrideInput,
|
1773 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
1774 + | >;
|
1775 + |
|
1776 + | fn poll(
|
1777 + | self: std::pin::Pin<&mut Self>,
|
1778 + | cx: &mut std::task::Context<'_>,
|
1779 + | ) -> std::task::Poll<Self::Output> {
|
1780 + | let this = self.project();
|
1781 + | this.inner.as_mut().poll(cx)
|
1782 + | }
|
1783 + | }
|
1784 + |
|
1785 + | impl<B>
|
1786 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
1787 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
1788 + | B,
|
1789 + | > for crate::input::MalformedLengthOverrideInput
|
1790 + | where
|
1791 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
1792 + | B: 'static,
|
1793 + |
|
1794 + | B::Data: Send,
|
1795 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
1796 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
1797 + | {
|
1798 + | type Rejection =
|
1799 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
1800 + | type Future = MalformedLengthOverrideInputFuture;
|
1801 + |
|
1802 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
1803 + | let fut = async move {
|
1804 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
1805 + | request.headers(),
|
1806 + | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
1807 + | ) {
|
1808 + | return Err(::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
1809 + | }
|
1810 + | crate::protocol_serde::shape_malformed_length_override::de_malformed_length_override_http_request(request)
|
1811 + | .await
|
1812 + | };
|
1813 + | use ::futures_util::future::TryFutureExt;
|
1814 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
1815 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
1816 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e)
|
1817 + | });
|
1818 + | MalformedLengthOverrideInputFuture {
|
1819 + | inner: Box::pin(fut),
|
1820 + | }
|
1821 + | }
|
1822 + | }
|
1823 + | impl
|
1824 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
1825 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
1826 + | > for crate::output::MalformedLengthOverrideOutput
|
1827 + | {
|
1828 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
1829 + | match crate::protocol_serde::shape_malformed_length_override::ser_malformed_length_override_http_response(self) {
|
1830 + | Ok(response) => response,
|
1831 + | Err(e) => {
|
1832 + | ::tracing::error!(error = %e, "failed to serialize response");
|
1833 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
1834 + | }
|
1835 + | }
|
1836 + | }
|
1837 + | }
|
1838 + | impl
|
1839 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
1840 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
1841 + | > for crate::error::MalformedLengthOverrideError
|
1842 + | {
|
1843 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
1844 + | match crate::protocol_serde::shape_malformed_length_override::ser_malformed_length_override_http_error(&self) {
|
1845 + | Ok(mut response) => {
|
1846 + | response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
1847 + | response
|
1848 + | },
|
1849 + | Err(e) => {
|
1850 + | ::tracing::error!(error = %e, "failed to serialize response");
|
1851 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
2116 1852 | }
|
2117 - | })
|
2118 - | .build_unchecked();
|
2119 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2120 - | .await
|
2121 - | .expect("unable to make an HTTP request");
|
2122 - | ::pretty_assertions::assert_eq!(
|
2123 - | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2124 - | http_response.status()
|
2125 - | );
|
2126 - | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2127 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2128 - | http_response.headers(),
|
2129 - | expected_headers,
|
2130 - | ));
|
2131 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2132 - | .await
|
2133 - | .expect("unable to extract body to bytes");
|
2134 - | ::aws_smithy_protocol_test::assert_ok(
|
2135 - | ::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"))
|
2136 - | );
|
2137 1853 | }
|
2138 1854 | }
|
1855 + | }
|
2139 1856 |
|
2140 - | /// When a float member does not fit within range bounds,
|
1857 + | #[allow(unreachable_code, unused_variables)]
|
1858 + | #[cfg(test)]
|
1859 + | mod malformed_length_override_test {
|
1860 + |
|
1861 + | /// When a blob member does not fit within length bounds,
|
2141 1862 | /// the response should be a 400 ValidationException.
|
2142 - | /// Test ID: RestJsonMalformedRangeMinFloatOverride
|
1863 + | /// Test ID: RestJsonMalformedLengthBlobOverride_case0
|
2143 1864 | #[::tokio::test]
|
2144 1865 | #[::tracing_test::traced_test]
|
2145 - | #[should_panic]
|
2146 - | async fn rest_json_malformed_range_min_float_override_malformed_request() {
|
1866 + | async fn rest_json_malformed_length_blob_override_case0_malformed_request() {
|
2147 1867 | {
|
2148 1868 | #[allow(unused_mut)]
|
2149 1869 | let mut http_request = ::http::Request::builder()
|
2150 - | .uri("/MalformedRangeOverride")
|
1870 + | .uri("/MalformedLengthOverride")
|
2151 1871 | .method("POST")
|
2152 1872 | .header("content-type", "application/json")
|
2153 1873 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2154 1874 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2155 - | "{ \"minFloat\" : 4.3 }".as_bytes(),
|
1875 + | "{ \"blob\" : \"YWJj\" }".as_bytes(),
|
2156 1876 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2157 1877 | )),
|
2158 1878 | ))
|
2159 1879 | .unwrap();
|
2160 1880 | #[allow(unused_mut)]
|
2161 1881 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2162 1882 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2163 1883 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2164 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
1884 + | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
2165 1885 | let sender = sender.clone();
|
2166 1886 | async move {
|
2167 - | 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> };
|
1887 + | 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> };
|
2168 1888 | sender.send(()).await.expect("receiver dropped early");
|
2169 1889 | result
|
2170 1890 | }
|
2171 1891 | })
|
2172 1892 | .build_unchecked();
|
2173 1893 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2174 1894 | .await
|
2175 1895 | .expect("unable to make an HTTP request");
|
2176 1896 | ::pretty_assertions::assert_eq!(
|
2177 1897 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2178 1898 | http_response.status()
|
2179 1899 | );
|
2180 1900 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2181 1901 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2182 1902 | http_response.headers(),
|
2183 1903 | expected_headers,
|
2184 1904 | ));
|
2185 1905 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2186 1906 | .await
|
2187 1907 | .expect("unable to extract body to bytes");
|
2188 1908 | ::aws_smithy_protocol_test::assert_ok(
|
2189 - | ::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"))
|
1909 + | ::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"))
|
2190 1910 | );
|
2191 1911 | }
|
2192 1912 | }
|
2193 1913 |
|
2194 - | /// When a float member does not fit within range bounds,
|
1914 + | /// When a blob member does not fit within length bounds,
|
2195 1915 | /// the response should be a 400 ValidationException.
|
2196 - | /// Test ID: RestJsonMalformedRangeMaxFloatOverride
|
1916 + | /// Test ID: RestJsonMalformedLengthBlobOverride_case1
|
2197 1917 | #[::tokio::test]
|
2198 1918 | #[::tracing_test::traced_test]
|
2199 - | #[should_panic]
|
2200 - | async fn rest_json_malformed_range_max_float_override_malformed_request() {
|
1919 + | async fn rest_json_malformed_length_blob_override_case1_malformed_request() {
|
2201 1920 | {
|
2202 1921 | #[allow(unused_mut)]
|
2203 1922 | let mut http_request = ::http::Request::builder()
|
2204 - | .uri("/MalformedRangeOverride")
|
1923 + | .uri("/MalformedLengthOverride")
|
2205 1924 | .method("POST")
|
2206 1925 | .header("content-type", "application/json")
|
2207 1926 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2208 1927 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2209 - | "{ \"maxFloat\" : 6.7 }".as_bytes(),
|
1928 + | "{ \"blob\" : \"YWJjZGVmZw==\" }".as_bytes(),
|
2210 1929 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2211 1930 | )),
|
2212 1931 | ))
|
2213 1932 | .unwrap();
|
2214 1933 | #[allow(unused_mut)]
|
2215 1934 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2216 1935 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2217 1936 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2218 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
1937 + | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
2219 1938 | let sender = sender.clone();
|
2220 1939 | async move {
|
2221 - | 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> };
|
1940 + | 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> };
|
2222 1941 | sender.send(()).await.expect("receiver dropped early");
|
2223 1942 | result
|
2224 1943 | }
|
2225 1944 | })
|
2226 1945 | .build_unchecked();
|
2227 1946 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2228 1947 | .await
|
2229 1948 | .expect("unable to make an HTTP request");
|
2230 1949 | ::pretty_assertions::assert_eq!(
|
2231 1950 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2232 1951 | http_response.status()
|
2233 1952 | );
|
2234 1953 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2235 1954 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2236 1955 | http_response.headers(),
|
2237 1956 | expected_headers,
|
2238 1957 | ));
|
2239 1958 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2240 1959 | .await
|
2241 1960 | .expect("unable to extract body to bytes");
|
2242 1961 | ::aws_smithy_protocol_test::assert_ok(
|
2243 - | ::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"))
|
1962 + | ::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"))
|
2244 1963 | );
|
2245 1964 | }
|
2246 1965 | }
|
2247 1966 |
|
2248 - | /// When a short member does not fit within range bounds,
|
1967 + | /// When a string member does not fit within length bounds,
|
2249 1968 | /// the response should be a 400 ValidationException.
|
2250 - | /// Test ID: RestJsonMalformedRangeShortOverride_case0
|
1969 + | /// Test ID: RestJsonMalformedLengthStringOverride_case0
|
2251 1970 | #[::tokio::test]
|
2252 1971 | #[::tracing_test::traced_test]
|
2253 - | async fn rest_json_malformed_range_short_override_case0_malformed_request() {
|
1972 + | async fn rest_json_malformed_length_string_override_case0_malformed_request() {
|
2254 1973 | {
|
2255 1974 | #[allow(unused_mut)]
|
2256 1975 | let mut http_request = ::http::Request::builder()
|
2257 - | .uri("/MalformedRangeOverride")
|
1976 + | .uri("/MalformedLengthOverride")
|
2258 1977 | .method("POST")
|
2259 1978 | .header("content-type", "application/json")
|
2260 1979 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2261 1980 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2262 - | "{ \"short\" : 3 }".as_bytes(),
|
1981 + | "{ \"string\" : \"abc\" }".as_bytes(),
|
2263 1982 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2264 1983 | )),
|
2265 1984 | ))
|
2266 1985 | .unwrap();
|
2267 1986 | #[allow(unused_mut)]
|
2268 1987 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2269 1988 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2270 1989 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2271 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
1990 + | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
2272 1991 | let sender = sender.clone();
|
2273 1992 | async move {
|
2274 - | 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> };
|
1993 + | 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> };
|
2275 1994 | sender.send(()).await.expect("receiver dropped early");
|
2276 1995 | result
|
2277 1996 | }
|
2278 1997 | })
|
2279 1998 | .build_unchecked();
|
2280 1999 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2281 2000 | .await
|
2282 2001 | .expect("unable to make an HTTP request");
|
2283 2002 | ::pretty_assertions::assert_eq!(
|
2284 2003 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2285 2004 | http_response.status()
|
2286 2005 | );
|
2287 2006 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2288 2007 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2289 2008 | http_response.headers(),
|
2290 2009 | expected_headers,
|
2291 2010 | ));
|
2292 2011 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2293 2012 | .await
|
2294 2013 | .expect("unable to extract body to bytes");
|
2295 2014 | ::aws_smithy_protocol_test::assert_ok(
|
2296 - | ::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"))
|
2015 + | ::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"))
|
2297 2016 | );
|
2298 2017 | }
|
2299 2018 | }
|
2300 2019 |
|
2301 - | /// When a short member does not fit within range bounds,
|
2020 + | /// When a string member does not fit within length bounds,
|
2302 2021 | /// the response should be a 400 ValidationException.
|
2303 - | /// Test ID: RestJsonMalformedRangeShortOverride_case1
|
2022 + | /// Test ID: RestJsonMalformedLengthStringOverride_case1
|
2304 2023 | #[::tokio::test]
|
2305 2024 | #[::tracing_test::traced_test]
|
2306 - | async fn rest_json_malformed_range_short_override_case1_malformed_request() {
|
2025 + | async fn rest_json_malformed_length_string_override_case1_malformed_request() {
|
2307 2026 | {
|
2308 2027 | #[allow(unused_mut)]
|
2309 2028 | let mut http_request = ::http::Request::builder()
|
2310 - | .uri("/MalformedRangeOverride")
|
2029 + | .uri("/MalformedLengthOverride")
|
2311 2030 | .method("POST")
|
2312 2031 | .header("content-type", "application/json")
|
2313 2032 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2314 2033 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2315 - | "{ \"short\" : 7 }".as_bytes(),
|
2034 + | "{ \"string\" : \"abcdefg\" }".as_bytes(),
|
2316 2035 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2317 2036 | )),
|
2318 2037 | ))
|
2319 2038 | .unwrap();
|
2320 2039 | #[allow(unused_mut)]
|
2321 2040 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2322 2041 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2323 2042 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2324 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2043 + | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
2325 2044 | let sender = sender.clone();
|
2326 2045 | async move {
|
2327 - | 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> };
|
2046 + | 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> };
|
2328 2047 | sender.send(()).await.expect("receiver dropped early");
|
2329 2048 | result
|
2330 2049 | }
|
2331 2050 | })
|
2332 2051 | .build_unchecked();
|
2333 2052 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2334 2053 | .await
|
2335 2054 | .expect("unable to make an HTTP request");
|
2336 2055 | ::pretty_assertions::assert_eq!(
|
2337 2056 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2338 2057 | http_response.status()
|
2339 2058 | );
|
2340 2059 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2341 2060 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2342 2061 | http_response.headers(),
|
2343 2062 | expected_headers,
|
2344 2063 | ));
|
2345 2064 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2346 2065 | .await
|
2347 2066 | .expect("unable to extract body to bytes");
|
2348 2067 | ::aws_smithy_protocol_test::assert_ok(
|
2349 - | ::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"))
|
2068 + | ::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"))
|
2350 2069 | );
|
2351 2070 | }
|
2352 2071 | }
|
2353 2072 |
|
2354 - | /// When a short member does not fit within range bounds,
|
2073 + | /// When a string member does not fit within length bounds,
|
2355 2074 | /// the response should be a 400 ValidationException.
|
2356 - | /// Test ID: RestJsonMalformedRangeMinShortOverride
|
2075 + | /// Test ID: RestJsonMalformedLengthStringOverride_case2
|
2357 2076 | #[::tokio::test]
|
2358 2077 | #[::tracing_test::traced_test]
|
2359 - | async fn rest_json_malformed_range_min_short_override_malformed_request() {
|
2078 + | async fn rest_json_malformed_length_string_override_case2_malformed_request() {
|
2360 2079 | {
|
2361 2080 | #[allow(unused_mut)]
|
2362 2081 | let mut http_request = ::http::Request::builder()
|
2363 - | .uri("/MalformedRangeOverride")
|
2082 + | .uri("/MalformedLengthOverride")
|
2364 2083 | .method("POST")
|
2365 2084 | .header("content-type", "application/json")
|
2366 2085 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2367 2086 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2368 - | "{ \"minShort\" : 3 }".as_bytes(),
|
2087 + | "{ \"string\" : \"👍👍👍\" }".as_bytes(),
|
2369 2088 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2370 2089 | )),
|
2371 2090 | ))
|
2372 2091 | .unwrap();
|
2373 2092 | #[allow(unused_mut)]
|
2374 2093 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2375 2094 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2376 2095 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2377 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2096 + | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
2378 2097 | let sender = sender.clone();
|
2379 2098 | async move {
|
2380 - | 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> };
|
2099 + | 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> };
|
2381 2100 | sender.send(()).await.expect("receiver dropped early");
|
2382 2101 | result
|
2383 2102 | }
|
2384 2103 | })
|
2385 2104 | .build_unchecked();
|
2386 2105 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2387 2106 | .await
|
2388 2107 | .expect("unable to make an HTTP request");
|
2389 2108 | ::pretty_assertions::assert_eq!(
|
2390 2109 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2391 2110 | http_response.status()
|
2392 2111 | );
|
2393 2112 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2394 2113 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2395 2114 | http_response.headers(),
|
2396 2115 | expected_headers,
|
2397 2116 | ));
|
2398 2117 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2399 2118 | .await
|
2400 2119 | .expect("unable to extract body to bytes");
|
2401 2120 | ::aws_smithy_protocol_test::assert_ok(
|
2402 - | ::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"))
|
2121 + | ::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"))
|
2403 2122 | );
|
2404 2123 | }
|
2405 2124 | }
|
2406 2125 |
|
2407 - | /// When a short member does not fit within range bounds,
|
2126 + | /// When a string member does not fit within length bounds,
|
2408 2127 | /// the response should be a 400 ValidationException.
|
2409 - | /// Test ID: RestJsonMalformedRangeMaxShortOverride
|
2128 + | /// Test ID: RestJsonMalformedLengthMinStringOverride
|
2410 2129 | #[::tokio::test]
|
2411 2130 | #[::tracing_test::traced_test]
|
2412 - | async fn rest_json_malformed_range_max_short_override_malformed_request() {
|
2131 + | async fn rest_json_malformed_length_min_string_override_malformed_request() {
|
2413 2132 | {
|
2414 2133 | #[allow(unused_mut)]
|
2415 2134 | let mut http_request = ::http::Request::builder()
|
2416 - | .uri("/MalformedRangeOverride")
|
2135 + | .uri("/MalformedLengthOverride")
|
2417 2136 | .method("POST")
|
2418 2137 | .header("content-type", "application/json")
|
2419 2138 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2420 2139 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2421 - | "{ \"maxShort\" : 7 }".as_bytes(),
|
2140 + | "{ \"minString\" : \"abc\" }".as_bytes(),
|
2422 2141 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2423 2142 | )),
|
2424 2143 | ))
|
2425 2144 | .unwrap();
|
2426 2145 | #[allow(unused_mut)]
|
2427 2146 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2428 2147 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2429 2148 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2430 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2149 + | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
2431 2150 | let sender = sender.clone();
|
2432 2151 | async move {
|
2433 - | 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> };
|
2152 + | 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> };
|
2434 2153 | sender.send(()).await.expect("receiver dropped early");
|
2435 2154 | result
|
2436 2155 | }
|
2437 2156 | })
|
2438 2157 | .build_unchecked();
|
2439 2158 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2440 2159 | .await
|
2441 2160 | .expect("unable to make an HTTP request");
|
2442 2161 | ::pretty_assertions::assert_eq!(
|
2443 2162 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2444 2163 | http_response.status()
|
2445 2164 | );
|
2446 2165 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2447 2166 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2448 2167 | http_response.headers(),
|
2449 2168 | expected_headers,
|
2450 2169 | ));
|
2451 2170 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2452 2171 | .await
|
2453 2172 | .expect("unable to extract body to bytes");
|
2454 2173 | ::aws_smithy_protocol_test::assert_ok(
|
2455 - | ::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"))
|
2174 + | ::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"))
|
2456 2175 | );
|
2457 2176 | }
|
2458 2177 | }
|
2459 2178 |
|
2460 - | /// When a integer member does not fit within range bounds,
|
2179 + | /// When a string member does not fit within length bounds,
|
2461 2180 | /// the response should be a 400 ValidationException.
|
2462 - | /// Test ID: RestJsonMalformedRangeIntegerOverride_case0
|
2181 + | /// Test ID: RestJsonMalformedLengthMaxStringOverride
|
2463 2182 | #[::tokio::test]
|
2464 2183 | #[::tracing_test::traced_test]
|
2465 - | async fn rest_json_malformed_range_integer_override_case0_malformed_request() {
|
2184 + | async fn rest_json_malformed_length_max_string_override_malformed_request() {
|
2466 2185 | {
|
2467 2186 | #[allow(unused_mut)]
|
2468 2187 | let mut http_request = ::http::Request::builder()
|
2469 - | .uri("/MalformedRangeOverride")
|
2188 + | .uri("/MalformedLengthOverride")
|
2470 2189 | .method("POST")
|
2471 2190 | .header("content-type", "application/json")
|
2472 2191 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2473 2192 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2474 - | "{ \"integer\" : 3 }".as_bytes(),
|
2193 + | "{ \"maxString\" : \"abcdefg\" }".as_bytes(),
|
2475 2194 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2476 2195 | )),
|
2477 2196 | ))
|
2478 2197 | .unwrap();
|
2479 2198 | #[allow(unused_mut)]
|
2480 2199 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2481 2200 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2482 2201 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2483 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2202 + | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
2484 2203 | let sender = sender.clone();
|
2485 2204 | async move {
|
2486 - | 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> };
|
2205 + | 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> };
|
2487 2206 | sender.send(()).await.expect("receiver dropped early");
|
2488 2207 | result
|
2489 2208 | }
|
2490 2209 | })
|
2491 2210 | .build_unchecked();
|
2492 2211 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2493 2212 | .await
|
2494 2213 | .expect("unable to make an HTTP request");
|
2495 2214 | ::pretty_assertions::assert_eq!(
|
2496 2215 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2497 2216 | http_response.status()
|
2498 2217 | );
|
2499 2218 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2500 2219 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2501 2220 | http_response.headers(),
|
2502 2221 | expected_headers,
|
2503 2222 | ));
|
2504 2223 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2505 2224 | .await
|
2506 2225 | .expect("unable to extract body to bytes");
|
2507 2226 | ::aws_smithy_protocol_test::assert_ok(
|
2508 - | ::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"))
|
2227 + | ::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"))
|
2509 2228 | );
|
2510 2229 | }
|
2511 2230 | }
|
2512 2231 |
|
2513 - | /// When a integer member does not fit within range bounds,
|
2232 + | /// When a list member does not fit within length bounds,
|
2514 2233 | /// the response should be a 400 ValidationException.
|
2515 - | /// Test ID: RestJsonMalformedRangeIntegerOverride_case1
|
2234 + | /// Test ID: RestJsonMalformedLengthListOverride_case0
|
2516 2235 | #[::tokio::test]
|
2517 2236 | #[::tracing_test::traced_test]
|
2518 - | async fn rest_json_malformed_range_integer_override_case1_malformed_request() {
|
2237 + | async fn rest_json_malformed_length_list_override_case0_malformed_request() {
|
2519 2238 | {
|
2520 2239 | #[allow(unused_mut)]
|
2521 2240 | let mut http_request = ::http::Request::builder()
|
2522 - | .uri("/MalformedRangeOverride")
|
2241 + | .uri("/MalformedLengthOverride")
|
2523 2242 | .method("POST")
|
2524 2243 | .header("content-type", "application/json")
|
2525 2244 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2526 2245 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2527 - | "{ \"integer\" : 7 }".as_bytes(),
|
2246 + | "{ \"list\" : [\"abc\", \"def\", \"ghi\"] }".as_bytes(),
|
2528 2247 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2529 2248 | )),
|
2530 2249 | ))
|
2531 2250 | .unwrap();
|
2532 2251 | #[allow(unused_mut)]
|
2533 2252 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2534 2253 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2535 2254 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2536 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2255 + | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
2537 2256 | let sender = sender.clone();
|
2538 2257 | async move {
|
2539 - | 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> };
|
2258 + | 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> };
|
2540 2259 | sender.send(()).await.expect("receiver dropped early");
|
2541 2260 | result
|
2542 2261 | }
|
2543 2262 | })
|
2544 2263 | .build_unchecked();
|
2545 2264 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2546 2265 | .await
|
2547 2266 | .expect("unable to make an HTTP request");
|
2548 2267 | ::pretty_assertions::assert_eq!(
|
2549 2268 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2550 2269 | http_response.status()
|
2551 2270 | );
|
2552 2271 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2553 2272 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2554 2273 | http_response.headers(),
|
2555 2274 | expected_headers,
|
2556 2275 | ));
|
2557 2276 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2558 2277 | .await
|
2559 2278 | .expect("unable to extract body to bytes");
|
2560 2279 | ::aws_smithy_protocol_test::assert_ok(
|
2561 - | ::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"))
|
2280 + | ::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"))
|
2562 2281 | );
|
2563 2282 | }
|
2564 2283 | }
|
2565 2284 |
|
2566 - | /// When a integer member does not fit within range bounds,
|
2285 + | /// When a list member does not fit within length bounds,
|
2567 2286 | /// the response should be a 400 ValidationException.
|
2568 - | /// Test ID: RestJsonMalformedRangeMinIntegerOverride
|
2287 + | /// Test ID: RestJsonMalformedLengthListOverride_case1
|
2569 2288 | #[::tokio::test]
|
2570 2289 | #[::tracing_test::traced_test]
|
2571 - | async fn rest_json_malformed_range_min_integer_override_malformed_request() {
|
2290 + | async fn rest_json_malformed_length_list_override_case1_malformed_request() {
|
2572 2291 | {
|
2573 2292 | #[allow(unused_mut)]
|
2574 2293 | let mut http_request = ::http::Request::builder()
|
2575 - | .uri("/MalformedRangeOverride")
|
2294 + | .uri("/MalformedLengthOverride")
|
2576 2295 | .method("POST")
|
2577 2296 | .header("content-type", "application/json")
|
2578 2297 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2579 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2580 - | "{ \"minInteger\" : 3 }".as_bytes(),
|
2581 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2582 - | )),
|
2583 - | ))
|
2584 - | .unwrap();
|
2298 + | ::bytes::Bytes::copy_from_slice(
|
2299 + | &::aws_smithy_protocol_test::decode_body_data("{ \"list\" : [\"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\"] }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
2300 + | )
|
2301 + | )).unwrap();
|
2585 2302 | #[allow(unused_mut)]
|
2586 2303 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2587 2304 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2588 2305 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2589 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2306 + | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
2590 2307 | let sender = sender.clone();
|
2591 2308 | async move {
|
2592 - | 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> };
|
2309 + | 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> };
|
2593 2310 | sender.send(()).await.expect("receiver dropped early");
|
2594 2311 | result
|
2595 2312 | }
|
2596 2313 | })
|
2597 2314 | .build_unchecked();
|
2598 2315 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2599 2316 | .await
|
2600 2317 | .expect("unable to make an HTTP request");
|
2601 2318 | ::pretty_assertions::assert_eq!(
|
2602 2319 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2603 2320 | http_response.status()
|
2604 2321 | );
|
2605 2322 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2606 2323 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2607 2324 | http_response.headers(),
|
2608 2325 | expected_headers,
|
2609 2326 | ));
|
2610 2327 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2611 2328 | .await
|
2612 2329 | .expect("unable to extract body to bytes");
|
2613 2330 | ::aws_smithy_protocol_test::assert_ok(
|
2614 - | ::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"))
|
2331 + | ::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"))
|
2615 2332 | );
|
2616 2333 | }
|
2617 2334 | }
|
2618 2335 |
|
2619 - | /// When a integer member does not fit within range bounds,
|
2336 + | /// When a map member does not fit within length bounds,
|
2620 2337 | /// the response should be a 400 ValidationException.
|
2621 - | /// Test ID: RestJsonMalformedRangeMaxIntegerOverride
|
2338 + | /// Test ID: RestJsonMalformedLengthMapOverride_case0
|
2622 2339 | #[::tokio::test]
|
2623 2340 | #[::tracing_test::traced_test]
|
2624 - | async fn rest_json_malformed_range_max_integer_override_malformed_request() {
|
2341 + | async fn rest_json_malformed_length_map_override_case0_malformed_request() {
|
2625 2342 | {
|
2626 2343 | #[allow(unused_mut)]
|
2627 2344 | let mut http_request = ::http::Request::builder()
|
2628 - | .uri("/MalformedRangeOverride")
|
2345 + | .uri("/MalformedLengthOverride")
|
2629 2346 | .method("POST")
|
2630 2347 | .header("content-type", "application/json")
|
2631 2348 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2632 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2633 - | "{ \"maxInteger\" : 7 }".as_bytes(),
|
2634 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2635 - | )),
|
2636 - | ))
|
2637 - | .unwrap();
|
2638 - | #[allow(unused_mut)]
|
2639 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2640 - | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2641 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2642 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2643 - | let sender = sender.clone();
|
2644 - | async move {
|
2645 - | 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> };
|
2646 - | sender.send(()).await.expect("receiver dropped early");
|
2647 - | result
|
2648 - | }
|
2649 - | })
|
2650 - | .build_unchecked();
|
2651 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2652 - | .await
|
2653 - | .expect("unable to make an HTTP request");
|
2654 - | ::pretty_assertions::assert_eq!(
|
2655 - | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2656 - | http_response.status()
|
2657 - | );
|
2658 - | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2659 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2660 - | http_response.headers(),
|
2661 - | expected_headers,
|
2662 - | ));
|
2663 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2664 - | .await
|
2665 - | .expect("unable to extract body to bytes");
|
2666 - | ::aws_smithy_protocol_test::assert_ok(
|
2667 - | ::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"))
|
2668 - | );
|
2669 - | }
|
2670 - | }
|
2671 - |
|
2672 - | /// When a long member does not fit within range bounds,
|
2673 - | /// the response should be a 400 ValidationException.
|
2674 - | /// Test ID: RestJsonMalformedRangeLongOverride_case0
|
2675 - | #[::tokio::test]
|
2676 - | #[::tracing_test::traced_test]
|
2677 - | async fn rest_json_malformed_range_long_override_case0_malformed_request() {
|
2678 - | {
|
2679 - | #[allow(unused_mut)]
|
2680 - | let mut http_request = ::http::Request::builder()
|
2681 - | .uri("/MalformedRangeOverride")
|
2682 - | .method("POST")
|
2683 - | .header("content-type", "application/json")
|
2684 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2685 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2686 - | "{ \"long\" : 3 }".as_bytes(),
|
2687 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2688 - | )),
|
2689 - | ))
|
2690 - | .unwrap();
|
2691 - | #[allow(unused_mut)]
|
2692 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2693 - | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2694 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2695 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2696 - | let sender = sender.clone();
|
2697 - | async move {
|
2698 - | 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> };
|
2699 - | sender.send(()).await.expect("receiver dropped early");
|
2700 - | result
|
2701 - | }
|
2702 - | })
|
2703 - | .build_unchecked();
|
2704 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2705 - | .await
|
2706 - | .expect("unable to make an HTTP request");
|
2707 - | ::pretty_assertions::assert_eq!(
|
2708 - | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2709 - | http_response.status()
|
2710 - | );
|
2711 - | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2712 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2713 - | http_response.headers(),
|
2714 - | expected_headers,
|
2715 - | ));
|
2716 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2717 - | .await
|
2718 - | .expect("unable to extract body to bytes");
|
2719 - | ::aws_smithy_protocol_test::assert_ok(
|
2720 - | ::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"))
|
2721 - | );
|
2722 - | }
|
2723 - | }
|
2724 - |
|
2725 - | /// When a long member does not fit within range bounds,
|
2726 - | /// the response should be a 400 ValidationException.
|
2727 - | /// Test ID: RestJsonMalformedRangeLongOverride_case1
|
2728 - | #[::tokio::test]
|
2729 - | #[::tracing_test::traced_test]
|
2730 - | async fn rest_json_malformed_range_long_override_case1_malformed_request() {
|
2731 - | {
|
2732 - | #[allow(unused_mut)]
|
2733 - | let mut http_request = ::http::Request::builder()
|
2734 - | .uri("/MalformedRangeOverride")
|
2735 - | .method("POST")
|
2736 - | .header("content-type", "application/json")
|
2737 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2738 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2739 - | "{ \"long\" : 7 }".as_bytes(),
|
2740 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2741 - | )),
|
2742 - | ))
|
2743 - | .unwrap();
|
2744 - | #[allow(unused_mut)]
|
2745 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2746 - | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2747 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2748 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2749 - | let sender = sender.clone();
|
2750 - | async move {
|
2751 - | 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> };
|
2752 - | sender.send(()).await.expect("receiver dropped early");
|
2753 - | result
|
2754 - | }
|
2755 - | })
|
2756 - | .build_unchecked();
|
2757 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2758 - | .await
|
2759 - | .expect("unable to make an HTTP request");
|
2760 - | ::pretty_assertions::assert_eq!(
|
2761 - | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2762 - | http_response.status()
|
2763 - | );
|
2764 - | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2765 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2766 - | http_response.headers(),
|
2767 - | expected_headers,
|
2768 - | ));
|
2769 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2770 - | .await
|
2771 - | .expect("unable to extract body to bytes");
|
2772 - | ::aws_smithy_protocol_test::assert_ok(
|
2773 - | ::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"))
|
2774 - | );
|
2775 - | }
|
2776 - | }
|
2777 - |
|
2778 - | /// When a long member does not fit within range bounds,
|
2779 - | /// the response should be a 400 ValidationException.
|
2780 - | /// Test ID: RestJsonMalformedRangeMinLongOverride
|
2781 - | #[::tokio::test]
|
2782 - | #[::tracing_test::traced_test]
|
2783 - | async fn rest_json_malformed_range_min_long_override_malformed_request() {
|
2784 - | {
|
2785 - | #[allow(unused_mut)]
|
2786 - | let mut http_request = ::http::Request::builder()
|
2787 - | .uri("/MalformedRangeOverride")
|
2788 - | .method("POST")
|
2789 - | .header("content-type", "application/json")
|
2790 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2791 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2792 - | "{ \"minLong\" : 3 }".as_bytes(),
|
2793 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2794 - | )),
|
2795 - | ))
|
2796 - | .unwrap();
|
2349 + | ::bytes::Bytes::copy_from_slice(
|
2350 + | &::aws_smithy_protocol_test::decode_body_data("{ \"map\" : {\"abc\": [\"def\", \"efg\", \"fgh\"], \"bcd\": [\"abc\", \"def\", \"efg\"], \"def\": [\"abc\", \"def\", \"efg\"]} }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
2351 + | )
|
2352 + | )).unwrap();
|
2797 2353 | #[allow(unused_mut)]
|
2798 2354 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2799 2355 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2800 2356 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2801 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2357 + | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
2802 2358 | let sender = sender.clone();
|
2803 2359 | async move {
|
2804 - | 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> };
|
2360 + | 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> };
|
2805 2361 | sender.send(()).await.expect("receiver dropped early");
|
2806 2362 | result
|
2807 2363 | }
|
2808 2364 | })
|
2809 2365 | .build_unchecked();
|
2810 2366 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2811 2367 | .await
|
2812 2368 | .expect("unable to make an HTTP request");
|
2813 2369 | ::pretty_assertions::assert_eq!(
|
2814 2370 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2815 2371 | http_response.status()
|
2816 2372 | );
|
2817 2373 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2818 2374 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2819 2375 | http_response.headers(),
|
2820 2376 | expected_headers,
|
2821 2377 | ));
|
2822 2378 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2823 2379 | .await
|
2824 2380 | .expect("unable to extract body to bytes");
|
2825 2381 | ::aws_smithy_protocol_test::assert_ok(
|
2826 - | ::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"))
|
2382 + | ::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"))
|
2827 2383 | );
|
2828 2384 | }
|
2829 2385 | }
|
2830 2386 |
|
2831 - | /// When a long member does not fit within range bounds,
|
2387 + | /// When a map member does not fit within length bounds,
|
2832 2388 | /// the response should be a 400 ValidationException.
|
2833 - | /// Test ID: RestJsonMalformedRangeMaxLongOverride
|
2389 + | /// Test ID: RestJsonMalformedLengthMapOverride_case1
|
2834 2390 | #[::tokio::test]
|
2835 2391 | #[::tracing_test::traced_test]
|
2836 - | async fn rest_json_malformed_range_max_long_override_malformed_request() {
|
2392 + | async fn rest_json_malformed_length_map_override_case1_malformed_request() {
|
2837 2393 | {
|
2838 2394 | #[allow(unused_mut)]
|
2839 2395 | let mut http_request = ::http::Request::builder()
|
2840 - | .uri("/MalformedRangeOverride")
|
2396 + | .uri("/MalformedLengthOverride")
|
2841 2397 | .method("POST")
|
2842 2398 | .header("content-type", "application/json")
|
2843 2399 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
2844 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2845 - | "{ \"maxLong\" : 7 }".as_bytes(),
|
2846 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2847 - | )),
|
2848 - | ))
|
2849 - | .unwrap();
|
2400 + | ::bytes::Bytes::copy_from_slice(
|
2401 + | &::aws_smithy_protocol_test::decode_body_data("{ \"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(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
2402 + | )
|
2403 + | )).unwrap();
|
2850 2404 | #[allow(unused_mut)]
|
2851 2405 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2852 2406 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2853 2407 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2854 - | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2408 + | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
2855 2409 | let sender = sender.clone();
|
2856 2410 | async move {
|
2857 - | 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> };
|
2411 + | 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> };
|
2858 2412 | sender.send(()).await.expect("receiver dropped early");
|
2859 2413 | result
|
2860 2414 | }
|
2861 2415 | })
|
2862 2416 | .build_unchecked();
|
2863 2417 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2864 2418 | .await
|
2865 2419 | .expect("unable to make an HTTP request");
|
2866 2420 | ::pretty_assertions::assert_eq!(
|
2867 2421 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2868 2422 | http_response.status()
|
2869 2423 | );
|
2870 2424 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2871 2425 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2872 2426 | http_response.headers(),
|
2873 2427 | expected_headers,
|
2874 2428 | ));
|
2875 2429 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2876 2430 | .await
|
2877 2431 | .expect("unable to extract body to bytes");
|
2878 2432 | ::aws_smithy_protocol_test::assert_ok(
|
2879 - | ::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"))
|
2433 + | ::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"))
|
2880 2434 | );
|
2881 2435 | }
|
2882 2436 | }
|
2883 2437 | }
|
2884 2438 |
|
2885 2439 | ::pin_project_lite::pin_project! {
|
2886 2440 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2887 - | /// [`MalformedRangeInput`](crate::input::MalformedRangeInput) using modelled bindings.
|
2888 - | pub struct MalformedRangeInputFuture {
|
2889 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedRangeInput, ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
2441 + | /// [`MalformedLengthQueryStringInput`](crate::input::MalformedLengthQueryStringInput) using modelled bindings.
|
2442 + | pub struct MalformedLengthQueryStringInputFuture {
|
2443 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedLengthQueryStringInput, ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
2890 2444 | }
|
2891 2445 | }
|
2892 2446 |
|
2893 - | impl std::future::Future for MalformedRangeInputFuture {
|
2447 + | impl std::future::Future for MalformedLengthQueryStringInputFuture {
|
2894 2448 | type Output = Result<
|
2895 - | crate::input::MalformedRangeInput,
|
2449 + | crate::input::MalformedLengthQueryStringInput,
|
2896 2450 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
2897 2451 | >;
|
2898 2452 |
|
2899 2453 | fn poll(
|
2900 2454 | self: std::pin::Pin<&mut Self>,
|
2901 2455 | cx: &mut std::task::Context<'_>,
|
2902 2456 | ) -> std::task::Poll<Self::Output> {
|
2903 2457 | let this = self.project();
|
2904 2458 | this.inner.as_mut().poll(cx)
|
2905 2459 | }
|
2906 2460 | }
|
2907 2461 |
|
2908 2462 | impl<B>
|
2909 2463 | ::aws_smithy_legacy_http_server::request::FromRequest<
|
2910 2464 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
2911 2465 | B,
|
2912 - | > for crate::input::MalformedRangeInput
|
2466 + | > for crate::input::MalformedLengthQueryStringInput
|
2913 2467 | where
|
2914 2468 | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
2915 2469 | B: 'static,
|
2916 2470 |
|
2917 2471 | B::Data: Send,
|
2918 2472 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
2919 2473 | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
2920 2474 | {
|
2921 2475 | type Rejection =
|
2922 2476 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
2923 - | type Future = MalformedRangeInputFuture;
|
2477 + | type Future = MalformedLengthQueryStringInputFuture;
|
2924 2478 |
|
2925 2479 | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2926 2480 | let fut = async move {
|
2927 2481 | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
2928 2482 | request.headers(),
|
2929 2483 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
2930 2484 | ) {
|
2931 2485 | return Err(::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
2932 2486 | }
|
2933 - | crate::protocol_serde::shape_malformed_range::de_malformed_range_http_request(request)
|
2487 + | crate::protocol_serde::shape_malformed_length_query_string::de_malformed_length_query_string_http_request(request)
|
2934 2488 | .await
|
2935 2489 | };
|
2936 2490 | use ::futures_util::future::TryFutureExt;
|
2937 2491 | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
2938 2492 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2939 2493 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e)
|
2940 2494 | });
|
2941 - | MalformedRangeInputFuture {
|
2495 + | MalformedLengthQueryStringInputFuture {
|
2942 2496 | inner: Box::pin(fut),
|
2943 2497 | }
|
2944 2498 | }
|
2945 2499 | }
|
2946 2500 | impl
|
2947 2501 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
2948 2502 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
2949 - | > for crate::output::MalformedRangeOutput
|
2503 + | > for crate::output::MalformedLengthQueryStringOutput
|
2950 2504 | {
|
2951 2505 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
2952 - | match crate::protocol_serde::shape_malformed_range::ser_malformed_range_http_response(self)
|
2953 - | {
|
2506 + | match crate::protocol_serde::shape_malformed_length_query_string::ser_malformed_length_query_string_http_response(self) {
|
2954 2507 | Ok(response) => response,
|
2955 2508 | Err(e) => {
|
2956 2509 | ::tracing::error!(error = %e, "failed to serialize response");
|
2957 2510 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
2958 2511 | }
|
2959 2512 | }
|
2960 2513 | }
|
2961 2514 | }
|
2962 2515 | impl
|
2963 2516 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
2964 2517 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
2965 - | > for crate::error::MalformedRangeError
|
2518 + | > for crate::error::MalformedLengthQueryStringError
|
2966 2519 | {
|
2967 2520 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
2968 - | match crate::protocol_serde::shape_malformed_range::ser_malformed_range_http_error(&self) {
|
2521 + | match crate::protocol_serde::shape_malformed_length_query_string::ser_malformed_length_query_string_http_error(&self) {
|
2969 2522 | Ok(mut response) => {
|
2970 - | response.extensions_mut().insert(
|
2971 - | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
2972 - | self.name(),
|
2973 - | ),
|
2974 - | );
|
2523 + | response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
2975 2524 | response
|
2976 - | }
|
2525 + | },
|
2977 2526 | Err(e) => {
|
2978 2527 | ::tracing::error!(error = %e, "failed to serialize response");
|
2979 2528 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
2980 2529 | }
|
2981 2530 | }
|
2982 2531 | }
|
2983 2532 | }
|
2984 2533 |
|
2985 2534 | #[allow(unreachable_code, unused_variables)]
|
2986 2535 | #[cfg(test)]
|
2987 - | mod malformed_range_test {
|
2536 + | mod malformed_length_query_string_test {
|
2988 2537 |
|
2989 - | /// When a byte member does not fit within range bounds,
|
2538 + | /// When a required member has no value in the query string,
|
2990 2539 | /// the response should be a 400 ValidationException.
|
2991 - | /// Test ID: RestJsonMalformedRangeByte_case0
|
2540 + | /// Test ID: RestJsonMalformedLengthQueryStringNoValue
|
2992 2541 | #[::tokio::test]
|
2993 2542 | #[::tracing_test::traced_test]
|
2994 - | async fn rest_json_malformed_range_byte_case0_malformed_request() {
|
2543 + | async fn rest_json_malformed_length_query_string_no_value_malformed_request() {
|
2995 2544 | {
|
2996 2545 | #[allow(unused_mut)]
|
2997 2546 | let mut http_request = ::http::Request::builder()
|
2998 - | .uri("/MalformedRange")
|
2547 + | .uri("/MalformedLengthQueryString")
|
2999 2548 | .method("POST")
|
3000 - | .header("content-type", "application/json")
|
3001 2549 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3002 2550 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3003 - | "{ \"byte\" : 1 }".as_bytes(),
|
2551 + | "{}".as_bytes(),
|
3004 2552 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3005 2553 | )),
|
3006 2554 | ))
|
3007 2555 | .unwrap();
|
2556 + | *http_request.uri_mut() = "/MalformedLengthQueryString?string".parse().unwrap();
|
3008 2557 | #[allow(unused_mut)]
|
3009 2558 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3010 2559 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3011 2560 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3012 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
2561 + | .malformed_length_query_string(move |input: crate::input::MalformedLengthQueryStringInput| {
|
3013 2562 | let sender = sender.clone();
|
3014 2563 | async move {
|
3015 - | 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> };
|
2564 + | 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> };
|
3016 2565 | sender.send(()).await.expect("receiver dropped early");
|
3017 2566 | result
|
3018 2567 | }
|
3019 2568 | })
|
3020 2569 | .build_unchecked();
|
3021 2570 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3022 2571 | .await
|
3023 2572 | .expect("unable to make an HTTP request");
|
3024 2573 | ::pretty_assertions::assert_eq!(
|
3025 2574 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3026 2575 | http_response.status()
|
3027 2576 | );
|
3028 2577 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3029 2578 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3030 2579 | http_response.headers(),
|
3031 2580 | expected_headers,
|
3032 2581 | ));
|
3033 2582 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3034 2583 | .await
|
3035 2584 | .expect("unable to extract body to bytes");
|
3036 2585 | ::aws_smithy_protocol_test::assert_ok(
|
3037 - | ::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"))
|
2586 + | ::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"))
|
3038 2587 | );
|
3039 2588 | }
|
3040 2589 | }
|
2590 + | }
|
3041 2591 |
|
3042 - | /// When a byte member does not fit within range bounds,
|
3043 - | /// the response should be a 400 ValidationException.
|
3044 - | /// Test ID: RestJsonMalformedRangeByte_case1
|
2592 + | ::pin_project_lite::pin_project! {
|
2593 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2594 + | /// [`MalformedPatternInput`](crate::input::MalformedPatternInput) using modelled bindings.
|
2595 + | pub struct MalformedPatternInputFuture {
|
2596 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedPatternInput, ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
2597 + | }
|
2598 + | }
|
2599 + |
|
2600 + | impl std::future::Future for MalformedPatternInputFuture {
|
2601 + | type Output = Result<
|
2602 + | crate::input::MalformedPatternInput,
|
2603 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
2604 + | >;
|
2605 + |
|
2606 + | fn poll(
|
2607 + | self: std::pin::Pin<&mut Self>,
|
2608 + | cx: &mut std::task::Context<'_>,
|
2609 + | ) -> std::task::Poll<Self::Output> {
|
2610 + | let this = self.project();
|
2611 + | this.inner.as_mut().poll(cx)
|
2612 + | }
|
2613 + | }
|
2614 + |
|
2615 + | impl<B>
|
2616 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
2617 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
2618 + | B,
|
2619 + | > for crate::input::MalformedPatternInput
|
2620 + | where
|
2621 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
2622 + | B: 'static,
|
2623 + |
|
2624 + | B::Data: Send,
|
2625 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
2626 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
2627 + | {
|
2628 + | type Rejection =
|
2629 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
2630 + | type Future = MalformedPatternInputFuture;
|
2631 + |
|
2632 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2633 + | let fut = async move {
|
2634 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
2635 + | request.headers(),
|
2636 + | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
2637 + | ) {
|
2638 + | return Err(::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
2639 + | }
|
2640 + | crate::protocol_serde::shape_malformed_pattern::de_malformed_pattern_http_request(
|
2641 + | request,
|
2642 + | )
|
2643 + | .await
|
2644 + | };
|
2645 + | use ::futures_util::future::TryFutureExt;
|
2646 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
2647 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2648 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e)
|
2649 + | });
|
2650 + | MalformedPatternInputFuture {
|
2651 + | inner: Box::pin(fut),
|
2652 + | }
|
2653 + | }
|
2654 + | }
|
2655 + | impl
|
2656 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
2657 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
2658 + | > for crate::output::MalformedPatternOutput
|
2659 + | {
|
2660 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
2661 + | match crate::protocol_serde::shape_malformed_pattern::ser_malformed_pattern_http_response(
|
2662 + | self,
|
2663 + | ) {
|
2664 + | Ok(response) => response,
|
2665 + | Err(e) => {
|
2666 + | ::tracing::error!(error = %e, "failed to serialize response");
|
2667 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
2668 + | }
|
2669 + | }
|
2670 + | }
|
2671 + | }
|
2672 + | impl
|
2673 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
2674 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
2675 + | > for crate::error::MalformedPatternError
|
2676 + | {
|
2677 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
2678 + | match crate::protocol_serde::shape_malformed_pattern::ser_malformed_pattern_http_error(
|
2679 + | &self,
|
2680 + | ) {
|
2681 + | Ok(mut response) => {
|
2682 + | response.extensions_mut().insert(
|
2683 + | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
2684 + | self.name(),
|
2685 + | ),
|
2686 + | );
|
2687 + | response
|
2688 + | }
|
2689 + | Err(e) => {
|
2690 + | ::tracing::error!(error = %e, "failed to serialize response");
|
2691 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
2692 + | }
|
2693 + | }
|
2694 + | }
|
2695 + | }
|
2696 + |
|
2697 + | #[allow(unreachable_code, unused_variables)]
|
2698 + | #[cfg(test)]
|
2699 + | mod malformed_pattern_test {
|
2700 + |
|
2701 + | /// When a string member does not match the specified pattern,
|
2702 + | /// the response should be a 400 ValidationException.
|
2703 + | /// Test ID: RestJsonMalformedPatternString_case0
|
3045 2704 | #[::tokio::test]
|
3046 2705 | #[::tracing_test::traced_test]
|
3047 - | async fn rest_json_malformed_range_byte_case1_malformed_request() {
|
2706 + | async fn rest_json_malformed_pattern_string_case0_malformed_request() {
|
3048 2707 | {
|
3049 2708 | #[allow(unused_mut)]
|
3050 2709 | let mut http_request = ::http::Request::builder()
|
3051 - | .uri("/MalformedRange")
|
2710 + | .uri("/MalformedPattern")
|
3052 2711 | .method("POST")
|
3053 2712 | .header("content-type", "application/json")
|
3054 2713 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3055 2714 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3056 - | "{ \"byte\" : 9 }".as_bytes(),
|
2715 + | "{ \"string\" : \"ABC\" }".as_bytes(),
|
3057 2716 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3058 2717 | )),
|
3059 2718 | ))
|
3060 2719 | .unwrap();
|
3061 2720 | #[allow(unused_mut)]
|
3062 2721 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3063 2722 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3064 2723 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3065 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
2724 + | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
3066 2725 | let sender = sender.clone();
|
3067 2726 | async move {
|
3068 - | 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> };
|
2727 + | 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> };
|
3069 2728 | sender.send(()).await.expect("receiver dropped early");
|
3070 2729 | result
|
3071 2730 | }
|
3072 2731 | })
|
3073 2732 | .build_unchecked();
|
3074 2733 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3075 2734 | .await
|
3076 2735 | .expect("unable to make an HTTP request");
|
3077 2736 | ::pretty_assertions::assert_eq!(
|
3078 2737 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3079 2738 | http_response.status()
|
3080 2739 | );
|
3081 2740 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3082 2741 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3083 2742 | http_response.headers(),
|
3084 2743 | expected_headers,
|
3085 2744 | ));
|
3086 2745 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3087 2746 | .await
|
3088 2747 | .expect("unable to extract body to bytes");
|
3089 2748 | ::aws_smithy_protocol_test::assert_ok(
|
3090 - | ::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"))
|
2749 + | ::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"))
|
3091 2750 | );
|
3092 2751 | }
|
3093 2752 | }
|
3094 2753 |
|
3095 - | /// When a byte member does not fit within range bounds,
|
2754 + | /// When a string member does not match the specified pattern,
|
3096 2755 | /// the response should be a 400 ValidationException.
|
3097 - | /// Test ID: RestJsonMalformedRangeMinByte
|
2756 + | /// Test ID: RestJsonMalformedPatternString_case1
|
3098 2757 | #[::tokio::test]
|
3099 2758 | #[::tracing_test::traced_test]
|
3100 - | async fn rest_json_malformed_range_min_byte_malformed_request() {
|
2759 + | async fn rest_json_malformed_pattern_string_case1_malformed_request() {
|
3101 2760 | {
|
3102 2761 | #[allow(unused_mut)]
|
3103 2762 | let mut http_request = ::http::Request::builder()
|
3104 - | .uri("/MalformedRange")
|
2763 + | .uri("/MalformedPattern")
|
3105 2764 | .method("POST")
|
3106 2765 | .header("content-type", "application/json")
|
3107 2766 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3108 2767 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3109 - | "{ \"minByte\" : 1 }".as_bytes(),
|
2768 + | "{ \"string\" : \"xyz\" }".as_bytes(),
|
3110 2769 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3111 2770 | )),
|
3112 2771 | ))
|
3113 2772 | .unwrap();
|
3114 2773 | #[allow(unused_mut)]
|
3115 2774 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3116 2775 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3117 2776 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3118 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
2777 + | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
3119 2778 | let sender = sender.clone();
|
3120 2779 | async move {
|
3121 - | 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> };
|
2780 + | 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> };
|
3122 2781 | sender.send(()).await.expect("receiver dropped early");
|
3123 2782 | result
|
3124 2783 | }
|
3125 2784 | })
|
3126 2785 | .build_unchecked();
|
3127 2786 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3128 2787 | .await
|
3129 2788 | .expect("unable to make an HTTP request");
|
3130 2789 | ::pretty_assertions::assert_eq!(
|
3131 2790 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3132 2791 | http_response.status()
|
3133 2792 | );
|
3134 2793 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3135 2794 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3136 2795 | http_response.headers(),
|
3137 2796 | expected_headers,
|
3138 2797 | ));
|
3139 2798 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3140 2799 | .await
|
3141 2800 | .expect("unable to extract body to bytes");
|
3142 2801 | ::aws_smithy_protocol_test::assert_ok(
|
3143 - | ::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"))
|
2802 + | ::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"))
|
3144 2803 | );
|
3145 2804 | }
|
3146 2805 | }
|
3147 2806 |
|
3148 - | /// When a byte member does not fit within range bounds,
|
3149 - | /// the response should be a 400 ValidationException.
|
3150 - | /// Test ID: RestJsonMalformedRangeMaxByte
|
2807 + | /// When the specified pattern is susceptible to ReDOS, the service will not
|
2808 + | /// hang indefinitely while evaluating the pattern
|
2809 + | /// Test ID: RestJsonMalformedPatternReDOSString
|
3151 2810 | #[::tokio::test]
|
3152 2811 | #[::tracing_test::traced_test]
|
3153 - | async fn rest_json_malformed_range_max_byte_malformed_request() {
|
2812 + | #[should_panic]
|
2813 + | async fn rest_json_malformed_pattern_re_dos_string_malformed_request() {
|
3154 2814 | {
|
3155 2815 | #[allow(unused_mut)]
|
3156 2816 | let mut http_request = ::http::Request::builder()
|
3157 - | .uri("/MalformedRange")
|
2817 + | .uri("/MalformedPattern")
|
3158 2818 | .method("POST")
|
3159 2819 | .header("content-type", "application/json")
|
3160 2820 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3161 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3162 - | "{ \"maxByte\" : 9 }".as_bytes(),
|
3163 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3164 - | )),
|
3165 - | ))
|
3166 - | .unwrap();
|
2821 + | ::bytes::Bytes::copy_from_slice(
|
2822 + | &::aws_smithy_protocol_test::decode_body_data("{ \"evilString\" : \"000000000000000000000000000000000000000000000000000000000000000000000000000000000000!\" }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
2823 + | )
|
2824 + | )).unwrap();
|
3167 2825 | #[allow(unused_mut)]
|
3168 2826 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3169 2827 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3170 2828 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3171 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
2829 + | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
3172 2830 | let sender = sender.clone();
|
3173 2831 | async move {
|
3174 - | 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> };
|
2832 + | 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> };
|
3175 2833 | sender.send(()).await.expect("receiver dropped early");
|
3176 2834 | result
|
3177 2835 | }
|
3178 2836 | })
|
3179 2837 | .build_unchecked();
|
3180 2838 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3181 2839 | .await
|
3182 2840 | .expect("unable to make an HTTP request");
|
3183 2841 | ::pretty_assertions::assert_eq!(
|
3184 2842 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3185 2843 | http_response.status()
|
3186 2844 | );
|
3187 2845 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3188 2846 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3189 2847 | http_response.headers(),
|
3190 2848 | expected_headers,
|
3191 2849 | ));
|
3192 2850 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3193 2851 | .await
|
3194 2852 | .expect("unable to extract body to bytes");
|
3195 2853 | ::aws_smithy_protocol_test::assert_ok(
|
3196 - | ::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"))
|
2854 + | ::aws_smithy_protocol_test::validate_body(&body, "{ \"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\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3197 2855 | );
|
3198 2856 | }
|
3199 2857 | }
|
3200 2858 |
|
3201 - | /// When a float member does not fit within range bounds,
|
3202 - | /// the response should be a 400 ValidationException.
|
3203 - | /// Test ID: RestJsonMalformedRangeFloat_case0
|
2859 + | /// When the specified pattern is susceptible to ReDOS, the service will not
|
2860 + | /// hang indefinitely while evaluating the pattern
|
2861 + | /// Test ID: RestJsonMalformedPatternReDOSString_hotfixed
|
3204 2862 | #[::tokio::test]
|
3205 2863 | #[::tracing_test::traced_test]
|
3206 - | #[should_panic]
|
3207 - | async fn rest_json_malformed_range_float_case0_malformed_request() {
|
2864 + | async fn rest_json_malformed_pattern_re_dos_string_hotfixed_malformed_request() {
|
3208 2865 | {
|
3209 2866 | #[allow(unused_mut)]
|
3210 2867 | let mut http_request = ::http::Request::builder()
|
3211 - | .uri("/MalformedRange")
|
2868 + | .uri("/MalformedPattern")
|
3212 2869 | .method("POST")
|
3213 2870 | .header("content-type", "application/json")
|
3214 2871 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3215 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3216 - | "{ \"float\" : 2.1 }".as_bytes(),
|
3217 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3218 - | )),
|
3219 - | ))
|
3220 - | .unwrap();
|
2872 + | ::bytes::Bytes::copy_from_slice(
|
2873 + | &::aws_smithy_protocol_test::decode_body_data("{ \"evilString\" : \"000000000000000000000000000000000000000000000000000000000000000000000000000000000000!\" }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
2874 + | )
|
2875 + | )).unwrap();
|
3221 2876 | #[allow(unused_mut)]
|
3222 2877 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3223 2878 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3224 2879 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3225 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
2880 + | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
3226 2881 | let sender = sender.clone();
|
3227 2882 | async move {
|
3228 - | 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> };
|
2883 + | 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> };
|
3229 2884 | sender.send(()).await.expect("receiver dropped early");
|
3230 2885 | result
|
3231 2886 | }
|
3232 2887 | })
|
3233 2888 | .build_unchecked();
|
3234 2889 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3235 2890 | .await
|
3236 2891 | .expect("unable to make an HTTP request");
|
3237 2892 | ::pretty_assertions::assert_eq!(
|
3238 2893 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3239 2894 | http_response.status()
|
3240 2895 | );
|
3241 2896 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3242 2897 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3243 2898 | http_response.headers(),
|
3244 2899 | expected_headers,
|
3245 2900 | ));
|
3246 2901 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3247 2902 | .await
|
3248 2903 | .expect("unable to extract body to bytes");
|
3249 2904 | ::aws_smithy_protocol_test::assert_ok(
|
3250 - | ::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"))
|
2905 + | ::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"))
|
3251 2906 | );
|
3252 2907 | }
|
3253 2908 | }
|
3254 2909 |
|
3255 - | /// When a float member does not fit within range bounds,
|
2910 + | /// When a list member value does not match the specified pattern,
|
3256 2911 | /// the response should be a 400 ValidationException.
|
3257 - | /// Test ID: RestJsonMalformedRangeFloat_case1
|
2912 + | /// Test ID: RestJsonMalformedPatternList_case0
|
3258 2913 | #[::tokio::test]
|
3259 2914 | #[::tracing_test::traced_test]
|
3260 - | #[should_panic]
|
3261 - | async fn rest_json_malformed_range_float_case1_malformed_request() {
|
2915 + | async fn rest_json_malformed_pattern_list_case0_malformed_request() {
|
3262 2916 | {
|
3263 2917 | #[allow(unused_mut)]
|
3264 2918 | let mut http_request = ::http::Request::builder()
|
3265 - | .uri("/MalformedRange")
|
2919 + | .uri("/MalformedPattern")
|
3266 2920 | .method("POST")
|
3267 2921 | .header("content-type", "application/json")
|
3268 2922 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3269 2923 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3270 - | "{ \"float\" : 8.9 }".as_bytes(),
|
2924 + | "{ \"list\" : [\"ABC\"] }".as_bytes(),
|
3271 2925 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3272 2926 | )),
|
3273 2927 | ))
|
3274 2928 | .unwrap();
|
3275 2929 | #[allow(unused_mut)]
|
3276 2930 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3277 2931 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3278 2932 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3279 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
2933 + | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
3280 2934 | let sender = sender.clone();
|
3281 2935 | async move {
|
3282 - | 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> };
|
2936 + | 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> };
|
3283 2937 | sender.send(()).await.expect("receiver dropped early");
|
3284 2938 | result
|
3285 2939 | }
|
3286 2940 | })
|
3287 2941 | .build_unchecked();
|
3288 2942 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3289 2943 | .await
|
3290 2944 | .expect("unable to make an HTTP request");
|
3291 2945 | ::pretty_assertions::assert_eq!(
|
3292 2946 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3293 2947 | http_response.status()
|
3294 2948 | );
|
3295 2949 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3296 2950 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3297 2951 | http_response.headers(),
|
3298 2952 | expected_headers,
|
3299 2953 | ));
|
3300 2954 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3301 2955 | .await
|
3302 2956 | .expect("unable to extract body to bytes");
|
3303 2957 | ::aws_smithy_protocol_test::assert_ok(
|
3304 - | ::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"))
|
2958 + | ::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"))
|
3305 2959 | );
|
3306 2960 | }
|
3307 2961 | }
|
3308 2962 |
|
3309 - | /// When a float member does not fit within range bounds,
|
2963 + | /// When a list member value does not match the specified pattern,
|
3310 2964 | /// the response should be a 400 ValidationException.
|
3311 - | /// Test ID: RestJsonMalformedRangeMinFloat
|
2965 + | /// Test ID: RestJsonMalformedPatternList_case1
|
3312 2966 | #[::tokio::test]
|
3313 2967 | #[::tracing_test::traced_test]
|
3314 - | #[should_panic]
|
3315 - | async fn rest_json_malformed_range_min_float_malformed_request() {
|
2968 + | async fn rest_json_malformed_pattern_list_case1_malformed_request() {
|
3316 2969 | {
|
3317 2970 | #[allow(unused_mut)]
|
3318 2971 | let mut http_request = ::http::Request::builder()
|
3319 - | .uri("/MalformedRange")
|
2972 + | .uri("/MalformedPattern")
|
3320 2973 | .method("POST")
|
3321 2974 | .header("content-type", "application/json")
|
3322 2975 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3323 2976 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3324 - | "{ \"minFloat\" : 2.1 }".as_bytes(),
|
2977 + | "{ \"list\" : [\"xyz\"] }".as_bytes(),
|
3325 2978 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3326 2979 | )),
|
3327 2980 | ))
|
3328 2981 | .unwrap();
|
3329 2982 | #[allow(unused_mut)]
|
3330 2983 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3331 2984 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3332 2985 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3333 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
2986 + | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
3334 2987 | let sender = sender.clone();
|
3335 2988 | async move {
|
3336 - | 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> };
|
2989 + | 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> };
|
3337 2990 | sender.send(()).await.expect("receiver dropped early");
|
3338 2991 | result
|
3339 2992 | }
|
3340 2993 | })
|
3341 2994 | .build_unchecked();
|
3342 2995 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3343 2996 | .await
|
3344 2997 | .expect("unable to make an HTTP request");
|
3345 2998 | ::pretty_assertions::assert_eq!(
|
3346 2999 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3347 3000 | http_response.status()
|
3348 3001 | );
|
3349 3002 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3350 3003 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3351 3004 | http_response.headers(),
|
3352 3005 | expected_headers,
|
3353 3006 | ));
|
3354 3007 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3355 3008 | .await
|
3356 3009 | .expect("unable to extract body to bytes");
|
3357 3010 | ::aws_smithy_protocol_test::assert_ok(
|
3358 - | ::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"))
|
3011 + | ::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"))
|
3359 3012 | );
|
3360 3013 | }
|
3361 3014 | }
|
3362 3015 |
|
3363 - | /// When a float member does not fit within range bounds,
|
3016 + | /// When a map member's key does not match the specified pattern,
|
3364 3017 | /// the response should be a 400 ValidationException.
|
3365 - | /// Test ID: RestJsonMalformedRangeMaxFloat
|
3018 + | /// Test ID: RestJsonMalformedPatternMapKey_case0
|
3366 3019 | #[::tokio::test]
|
3367 3020 | #[::tracing_test::traced_test]
|
3368 - | #[should_panic]
|
3369 - | async fn rest_json_malformed_range_max_float_malformed_request() {
|
3021 + | async fn rest_json_malformed_pattern_map_key_case0_malformed_request() {
|
3370 3022 | {
|
3371 3023 | #[allow(unused_mut)]
|
3372 3024 | let mut http_request = ::http::Request::builder()
|
3373 - | .uri("/MalformedRange")
|
3025 + | .uri("/MalformedPattern")
|
3374 3026 | .method("POST")
|
3375 3027 | .header("content-type", "application/json")
|
3376 3028 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3377 3029 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3378 - | "{ \"maxFloat\" : 8.9 }".as_bytes(),
|
3030 + | "{ \"map\" : { \"ABC\" : \"abc\" } }".as_bytes(),
|
3379 3031 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3380 3032 | )),
|
3381 3033 | ))
|
3382 3034 | .unwrap();
|
3383 3035 | #[allow(unused_mut)]
|
3384 3036 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3385 3037 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3386 3038 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3387 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3039 + | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
3388 3040 | let sender = sender.clone();
|
3389 3041 | async move {
|
3390 - | 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> };
|
3042 + | 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> };
|
3391 3043 | sender.send(()).await.expect("receiver dropped early");
|
3392 3044 | result
|
3393 3045 | }
|
3394 3046 | })
|
3395 3047 | .build_unchecked();
|
3396 3048 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3397 3049 | .await
|
3398 3050 | .expect("unable to make an HTTP request");
|
3399 3051 | ::pretty_assertions::assert_eq!(
|
3400 3052 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3401 3053 | http_response.status()
|
3402 3054 | );
|
3403 3055 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3404 3056 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3405 3057 | http_response.headers(),
|
3406 3058 | expected_headers,
|
3407 3059 | ));
|
3408 3060 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3409 3061 | .await
|
3410 3062 | .expect("unable to extract body to bytes");
|
3411 3063 | ::aws_smithy_protocol_test::assert_ok(
|
3412 - | ::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"))
|
3064 + | ::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"))
|
3413 3065 | );
|
3414 3066 | }
|
3415 3067 | }
|
3416 3068 |
|
3417 - | /// When a short member does not fit within range bounds,
|
3069 + | /// When a map member's key does not match the specified pattern,
|
3418 3070 | /// the response should be a 400 ValidationException.
|
3419 - | /// Test ID: RestJsonMalformedRangeShort_case0
|
3071 + | /// Test ID: RestJsonMalformedPatternMapKey_case1
|
3420 3072 | #[::tokio::test]
|
3421 3073 | #[::tracing_test::traced_test]
|
3422 - | async fn rest_json_malformed_range_short_case0_malformed_request() {
|
3074 + | async fn rest_json_malformed_pattern_map_key_case1_malformed_request() {
|
3423 3075 | {
|
3424 3076 | #[allow(unused_mut)]
|
3425 3077 | let mut http_request = ::http::Request::builder()
|
3426 - | .uri("/MalformedRange")
|
3078 + | .uri("/MalformedPattern")
|
3427 3079 | .method("POST")
|
3428 3080 | .header("content-type", "application/json")
|
3429 3081 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3430 3082 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3431 - | "{ \"short\" : 1 }".as_bytes(),
|
3083 + | "{ \"map\" : { \"xyz\" : \"abc\" } }".as_bytes(),
|
3432 3084 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3433 3085 | )),
|
3434 3086 | ))
|
3435 3087 | .unwrap();
|
3436 3088 | #[allow(unused_mut)]
|
3437 3089 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3438 3090 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3439 3091 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3440 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3092 + | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
3441 3093 | let sender = sender.clone();
|
3442 3094 | async move {
|
3443 - | 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 + | 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> };
|
3444 3096 | sender.send(()).await.expect("receiver dropped early");
|
3445 3097 | result
|
3446 3098 | }
|
3447 3099 | })
|
3448 3100 | .build_unchecked();
|
3449 3101 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3450 3102 | .await
|
3451 3103 | .expect("unable to make an HTTP request");
|
3452 3104 | ::pretty_assertions::assert_eq!(
|
3453 3105 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3454 3106 | http_response.status()
|
3455 3107 | );
|
3456 3108 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3457 3109 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3458 3110 | http_response.headers(),
|
3459 3111 | expected_headers,
|
3460 3112 | ));
|
3461 3113 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3462 3114 | .await
|
3463 3115 | .expect("unable to extract body to bytes");
|
3464 3116 | ::aws_smithy_protocol_test::assert_ok(
|
3465 - | ::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"))
|
3117 + | ::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"))
|
3466 3118 | );
|
3467 3119 | }
|
3468 3120 | }
|
3469 3121 |
|
3470 - | /// When a short member does not fit within range bounds,
|
3122 + | /// When a map member's value does not match the specified pattern,
|
3471 3123 | /// the response should be a 400 ValidationException.
|
3472 - | /// Test ID: RestJsonMalformedRangeShort_case1
|
3124 + | /// Test ID: RestJsonMalformedPatternMapValue_case0
|
3473 3125 | #[::tokio::test]
|
3474 3126 | #[::tracing_test::traced_test]
|
3475 - | async fn rest_json_malformed_range_short_case1_malformed_request() {
|
3127 + | async fn rest_json_malformed_pattern_map_value_case0_malformed_request() {
|
3476 3128 | {
|
3477 3129 | #[allow(unused_mut)]
|
3478 3130 | let mut http_request = ::http::Request::builder()
|
3479 - | .uri("/MalformedRange")
|
3131 + | .uri("/MalformedPattern")
|
3480 3132 | .method("POST")
|
3481 3133 | .header("content-type", "application/json")
|
3482 3134 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3483 3135 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3484 - | "{ \"short\" : 9 }".as_bytes(),
|
3136 + | "{ \"map\" : { \"abc\": \"ABC\" } }".as_bytes(),
|
3485 3137 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3486 3138 | )),
|
3487 3139 | ))
|
3488 3140 | .unwrap();
|
3489 3141 | #[allow(unused_mut)]
|
3490 3142 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3491 3143 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3492 3144 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3493 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3145 + | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
3494 3146 | let sender = sender.clone();
|
3495 3147 | async move {
|
3496 - | 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> };
|
3148 + | 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> };
|
3497 3149 | sender.send(()).await.expect("receiver dropped early");
|
3498 3150 | result
|
3499 3151 | }
|
3500 3152 | })
|
3501 3153 | .build_unchecked();
|
3502 3154 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3503 3155 | .await
|
3504 3156 | .expect("unable to make an HTTP request");
|
3505 3157 | ::pretty_assertions::assert_eq!(
|
3506 3158 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3507 3159 | http_response.status()
|
3508 3160 | );
|
3509 3161 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3510 3162 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3511 3163 | http_response.headers(),
|
3512 3164 | expected_headers,
|
3513 3165 | ));
|
3514 3166 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3515 3167 | .await
|
3516 3168 | .expect("unable to extract body to bytes");
|
3517 3169 | ::aws_smithy_protocol_test::assert_ok(
|
3518 - | ::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"))
|
3170 + | ::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"))
|
3519 3171 | );
|
3520 3172 | }
|
3521 3173 | }
|
3522 3174 |
|
3523 - | /// When a short member does not fit within range bounds,
|
3175 + | /// When a map member's value does not match the specified pattern,
|
3524 3176 | /// the response should be a 400 ValidationException.
|
3525 - | /// Test ID: RestJsonMalformedRangeMinShort
|
3177 + | /// Test ID: RestJsonMalformedPatternMapValue_case1
|
3526 3178 | #[::tokio::test]
|
3527 3179 | #[::tracing_test::traced_test]
|
3528 - | async fn rest_json_malformed_range_min_short_malformed_request() {
|
3180 + | async fn rest_json_malformed_pattern_map_value_case1_malformed_request() {
|
3529 3181 | {
|
3530 3182 | #[allow(unused_mut)]
|
3531 3183 | let mut http_request = ::http::Request::builder()
|
3532 - | .uri("/MalformedRange")
|
3184 + | .uri("/MalformedPattern")
|
3533 3185 | .method("POST")
|
3534 3186 | .header("content-type", "application/json")
|
3535 3187 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3536 3188 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3537 - | "{ \"minShort\" : 1 }".as_bytes(),
|
3189 + | "{ \"map\" : { \"abc\": \"xyz\" } }".as_bytes(),
|
3538 3190 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3539 3191 | )),
|
3540 3192 | ))
|
3541 3193 | .unwrap();
|
3542 3194 | #[allow(unused_mut)]
|
3543 3195 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3544 3196 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3545 3197 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3546 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3198 + | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
3547 3199 | let sender = sender.clone();
|
3548 3200 | async move {
|
3549 - | 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> };
|
3201 + | 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> };
|
3550 3202 | sender.send(()).await.expect("receiver dropped early");
|
3551 3203 | result
|
3552 3204 | }
|
3553 3205 | })
|
3554 3206 | .build_unchecked();
|
3555 3207 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3556 3208 | .await
|
3557 3209 | .expect("unable to make an HTTP request");
|
3558 3210 | ::pretty_assertions::assert_eq!(
|
3559 3211 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3560 3212 | http_response.status()
|
3561 3213 | );
|
3562 3214 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3563 3215 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3564 3216 | http_response.headers(),
|
3565 3217 | expected_headers,
|
3566 3218 | ));
|
3567 3219 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3568 3220 | .await
|
3569 3221 | .expect("unable to extract body to bytes");
|
3570 3222 | ::aws_smithy_protocol_test::assert_ok(
|
3571 - | ::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"))
|
3223 + | ::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"))
|
3572 3224 | );
|
3573 3225 | }
|
3574 3226 | }
|
3575 3227 |
|
3576 - | /// When a short member does not fit within range bounds,
|
3228 + | /// When a union member's value does not match the specified pattern,
|
3577 3229 | /// the response should be a 400 ValidationException.
|
3578 - | /// Test ID: RestJsonMalformedRangeMaxShort
|
3230 + | /// Test ID: RestJsonMalformedPatternUnion_case0
|
3579 3231 | #[::tokio::test]
|
3580 3232 | #[::tracing_test::traced_test]
|
3581 - | async fn rest_json_malformed_range_max_short_malformed_request() {
|
3233 + | async fn rest_json_malformed_pattern_union_case0_malformed_request() {
|
3582 3234 | {
|
3583 3235 | #[allow(unused_mut)]
|
3584 3236 | let mut http_request = ::http::Request::builder()
|
3585 - | .uri("/MalformedRange")
|
3237 + | .uri("/MalformedPattern")
|
3586 3238 | .method("POST")
|
3587 3239 | .header("content-type", "application/json")
|
3588 3240 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3589 3241 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3590 - | "{ \"maxShort\" : 9 }".as_bytes(),
|
3242 + | "{ \"union\" : { \"first\": \"ABC\" } }".as_bytes(),
|
3591 3243 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3592 3244 | )),
|
3593 3245 | ))
|
3594 3246 | .unwrap();
|
3595 3247 | #[allow(unused_mut)]
|
3596 3248 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3597 3249 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3598 3250 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3599 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3251 + | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
3600 3252 | let sender = sender.clone();
|
3601 3253 | async move {
|
3602 - | 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> };
|
3254 + | 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> };
|
3603 3255 | sender.send(()).await.expect("receiver dropped early");
|
3604 3256 | result
|
3605 3257 | }
|
3606 3258 | })
|
3607 3259 | .build_unchecked();
|
3608 3260 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3609 3261 | .await
|
3610 3262 | .expect("unable to make an HTTP request");
|
3611 3263 | ::pretty_assertions::assert_eq!(
|
3612 3264 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3613 3265 | http_response.status()
|
3614 3266 | );
|
3615 3267 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3616 3268 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3617 3269 | http_response.headers(),
|
3618 3270 | expected_headers,
|
3619 3271 | ));
|
3620 3272 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3621 3273 | .await
|
3622 3274 | .expect("unable to extract body to bytes");
|
3623 3275 | ::aws_smithy_protocol_test::assert_ok(
|
3624 - | ::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"))
|
3276 + | ::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"))
|
3625 3277 | );
|
3626 3278 | }
|
3627 3279 | }
|
3628 3280 |
|
3629 - | /// When a integer member does not fit within range bounds,
|
3281 + | /// When a union member's value does not match the specified pattern,
|
3630 3282 | /// the response should be a 400 ValidationException.
|
3631 - | /// Test ID: RestJsonMalformedRangeInteger_case0
|
3283 + | /// Test ID: RestJsonMalformedPatternUnion_case1
|
3632 3284 | #[::tokio::test]
|
3633 3285 | #[::tracing_test::traced_test]
|
3634 - | async fn rest_json_malformed_range_integer_case0_malformed_request() {
|
3286 + | async fn rest_json_malformed_pattern_union_case1_malformed_request() {
|
3635 3287 | {
|
3636 3288 | #[allow(unused_mut)]
|
3637 3289 | let mut http_request = ::http::Request::builder()
|
3638 - | .uri("/MalformedRange")
|
3290 + | .uri("/MalformedPattern")
|
3639 3291 | .method("POST")
|
3640 3292 | .header("content-type", "application/json")
|
3641 3293 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3642 3294 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3643 - | "{ \"integer\" : 1 }".as_bytes(),
|
3295 + | "{ \"union\" : { \"first\": \"xyz\" } }".as_bytes(),
|
3644 3296 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3645 3297 | )),
|
3646 3298 | ))
|
3647 3299 | .unwrap();
|
3648 3300 | #[allow(unused_mut)]
|
3649 3301 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3650 3302 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3651 3303 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3652 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3304 + | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
3653 3305 | let sender = sender.clone();
|
3654 3306 | async move {
|
3655 - | 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> };
|
3307 + | 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> };
|
3656 3308 | sender.send(()).await.expect("receiver dropped early");
|
3657 3309 | result
|
3658 3310 | }
|
3659 3311 | })
|
3660 3312 | .build_unchecked();
|
3661 3313 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3662 3314 | .await
|
3663 3315 | .expect("unable to make an HTTP request");
|
3664 3316 | ::pretty_assertions::assert_eq!(
|
3665 3317 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3666 3318 | http_response.status()
|
3667 3319 | );
|
3668 3320 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3669 3321 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3670 3322 | http_response.headers(),
|
3671 3323 | expected_headers,
|
3672 3324 | ));
|
3673 3325 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3674 3326 | .await
|
3675 3327 | .expect("unable to extract body to bytes");
|
3676 3328 | ::aws_smithy_protocol_test::assert_ok(
|
3677 - | ::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"))
|
3329 + | ::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"))
|
3678 3330 | );
|
3679 3331 | }
|
3680 3332 | }
|
3333 + | }
|
3681 3334 |
|
3682 - | /// When a integer member does not fit within range bounds,
|
3335 + | ::pin_project_lite::pin_project! {
|
3336 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
3337 + | /// [`MalformedPatternOverrideInput`](crate::input::MalformedPatternOverrideInput) using modelled bindings.
|
3338 + | pub struct MalformedPatternOverrideInputFuture {
|
3339 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedPatternOverrideInput, ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
3340 + | }
|
3341 + | }
|
3342 + |
|
3343 + | impl std::future::Future for MalformedPatternOverrideInputFuture {
|
3344 + | type Output = Result<
|
3345 + | crate::input::MalformedPatternOverrideInput,
|
3346 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
3347 + | >;
|
3348 + |
|
3349 + | fn poll(
|
3350 + | self: std::pin::Pin<&mut Self>,
|
3351 + | cx: &mut std::task::Context<'_>,
|
3352 + | ) -> std::task::Poll<Self::Output> {
|
3353 + | let this = self.project();
|
3354 + | this.inner.as_mut().poll(cx)
|
3355 + | }
|
3356 + | }
|
3357 + |
|
3358 + | impl<B>
|
3359 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
3360 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
3361 + | B,
|
3362 + | > for crate::input::MalformedPatternOverrideInput
|
3363 + | where
|
3364 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
3365 + | B: 'static,
|
3366 + |
|
3367 + | B::Data: Send,
|
3368 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
3369 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
3370 + | {
|
3371 + | type Rejection =
|
3372 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
3373 + | type Future = MalformedPatternOverrideInputFuture;
|
3374 + |
|
3375 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
3376 + | let fut = async move {
|
3377 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
3378 + | request.headers(),
|
3379 + | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
3380 + | ) {
|
3381 + | return Err(::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
3382 + | }
|
3383 + | crate::protocol_serde::shape_malformed_pattern_override::de_malformed_pattern_override_http_request(request)
|
3384 + | .await
|
3385 + | };
|
3386 + | use ::futures_util::future::TryFutureExt;
|
3387 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
3388 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
3389 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e)
|
3390 + | });
|
3391 + | MalformedPatternOverrideInputFuture {
|
3392 + | inner: Box::pin(fut),
|
3393 + | }
|
3394 + | }
|
3395 + | }
|
3396 + | impl
|
3397 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
3398 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
3399 + | > for crate::output::MalformedPatternOverrideOutput
|
3400 + | {
|
3401 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
3402 + | match crate::protocol_serde::shape_malformed_pattern_override::ser_malformed_pattern_override_http_response(self) {
|
3403 + | Ok(response) => response,
|
3404 + | Err(e) => {
|
3405 + | ::tracing::error!(error = %e, "failed to serialize response");
|
3406 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
3407 + | }
|
3408 + | }
|
3409 + | }
|
3410 + | }
|
3411 + | impl
|
3412 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
3413 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
3414 + | > for crate::error::MalformedPatternOverrideError
|
3415 + | {
|
3416 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
3417 + | match crate::protocol_serde::shape_malformed_pattern_override::ser_malformed_pattern_override_http_error(&self) {
|
3418 + | Ok(mut response) => {
|
3419 + | response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
3420 + | response
|
3421 + | },
|
3422 + | Err(e) => {
|
3423 + | ::tracing::error!(error = %e, "failed to serialize response");
|
3424 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
3425 + | }
|
3426 + | }
|
3427 + | }
|
3428 + | }
|
3429 + |
|
3430 + | #[allow(unreachable_code, unused_variables)]
|
3431 + | #[cfg(test)]
|
3432 + | mod malformed_pattern_override_test {
|
3433 + |
|
3434 + | /// When a string member does not match the specified pattern,
|
3683 3435 | /// the response should be a 400 ValidationException.
|
3684 - | /// Test ID: RestJsonMalformedRangeInteger_case1
|
3436 + | /// Test ID: RestJsonMalformedPatternStringOverride_case0
|
3685 3437 | #[::tokio::test]
|
3686 3438 | #[::tracing_test::traced_test]
|
3687 - | async fn rest_json_malformed_range_integer_case1_malformed_request() {
|
3439 + | async fn rest_json_malformed_pattern_string_override_case0_malformed_request() {
|
3688 3440 | {
|
3689 3441 | #[allow(unused_mut)]
|
3690 3442 | let mut http_request = ::http::Request::builder()
|
3691 - | .uri("/MalformedRange")
|
3443 + | .uri("/MalformedPatternOverride")
|
3692 3444 | .method("POST")
|
3693 3445 | .header("content-type", "application/json")
|
3694 3446 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3695 3447 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3696 - | "{ \"integer\" : 9 }".as_bytes(),
|
3448 + | "{ \"string\" : \"abc\" }".as_bytes(),
|
3697 3449 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3698 3450 | )),
|
3699 3451 | ))
|
3700 3452 | .unwrap();
|
3701 3453 | #[allow(unused_mut)]
|
3702 3454 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3703 3455 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3704 3456 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3705 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3457 + | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
3706 3458 | let sender = sender.clone();
|
3707 3459 | async move {
|
3708 - | 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> };
|
3460 + | 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> };
|
3709 3461 | sender.send(()).await.expect("receiver dropped early");
|
3710 3462 | result
|
3711 3463 | }
|
3712 3464 | })
|
3713 3465 | .build_unchecked();
|
3714 3466 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3715 3467 | .await
|
3716 3468 | .expect("unable to make an HTTP request");
|
3717 3469 | ::pretty_assertions::assert_eq!(
|
3718 3470 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3719 3471 | http_response.status()
|
3720 3472 | );
|
3721 3473 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3722 3474 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3723 3475 | http_response.headers(),
|
3724 3476 | expected_headers,
|
3725 3477 | ));
|
3726 3478 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3727 3479 | .await
|
3728 3480 | .expect("unable to extract body to bytes");
|
3729 3481 | ::aws_smithy_protocol_test::assert_ok(
|
3730 - | ::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"))
|
3482 + | ::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"))
|
3731 3483 | );
|
3732 3484 | }
|
3733 3485 | }
|
3734 3486 |
|
3735 - | /// When a integer member does not fit within range bounds,
|
3487 + | /// When a string member does not match the specified pattern,
|
3736 3488 | /// the response should be a 400 ValidationException.
|
3737 - | /// Test ID: RestJsonMalformedRangeMinInteger
|
3489 + | /// Test ID: RestJsonMalformedPatternStringOverride_case1
|
3738 3490 | #[::tokio::test]
|
3739 3491 | #[::tracing_test::traced_test]
|
3740 - | async fn rest_json_malformed_range_min_integer_malformed_request() {
|
3492 + | async fn rest_json_malformed_pattern_string_override_case1_malformed_request() {
|
3741 3493 | {
|
3742 3494 | #[allow(unused_mut)]
|
3743 3495 | let mut http_request = ::http::Request::builder()
|
3744 - | .uri("/MalformedRange")
|
3496 + | .uri("/MalformedPatternOverride")
|
3745 3497 | .method("POST")
|
3746 3498 | .header("content-type", "application/json")
|
3747 3499 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3748 3500 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3749 - | "{ \"minInteger\" : 1 }".as_bytes(),
|
3501 + | "{ \"string\" : \"xyz\" }".as_bytes(),
|
3750 3502 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3751 3503 | )),
|
3752 3504 | ))
|
3753 3505 | .unwrap();
|
3754 3506 | #[allow(unused_mut)]
|
3755 3507 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3756 3508 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3757 3509 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3758 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3510 + | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
3759 3511 | let sender = sender.clone();
|
3760 3512 | async move {
|
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> };
|
3513 + | 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> };
|
3762 3514 | sender.send(()).await.expect("receiver dropped early");
|
3763 3515 | result
|
3764 3516 | }
|
3765 3517 | })
|
3766 3518 | .build_unchecked();
|
3767 3519 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3768 3520 | .await
|
3769 3521 | .expect("unable to make an HTTP request");
|
3770 3522 | ::pretty_assertions::assert_eq!(
|
3771 3523 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3772 3524 | http_response.status()
|
3773 3525 | );
|
3774 3526 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3775 3527 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3776 3528 | http_response.headers(),
|
3777 3529 | expected_headers,
|
3778 3530 | ));
|
3779 3531 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3780 3532 | .await
|
3781 3533 | .expect("unable to extract body to bytes");
|
3782 3534 | ::aws_smithy_protocol_test::assert_ok(
|
3783 - | ::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"))
|
3535 + | ::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"))
|
3784 3536 | );
|
3785 3537 | }
|
3786 3538 | }
|
3787 3539 |
|
3788 - | /// When a integer member does not fit within range bounds,
|
3540 + | /// When a list member value does not match the specified pattern,
|
3789 3541 | /// the response should be a 400 ValidationException.
|
3790 - | /// Test ID: RestJsonMalformedRangeMaxInteger
|
3542 + | /// Test ID: RestJsonMalformedPatternListOverride_case0
|
3791 3543 | #[::tokio::test]
|
3792 3544 | #[::tracing_test::traced_test]
|
3793 - | async fn rest_json_malformed_range_max_integer_malformed_request() {
|
3545 + | async fn rest_json_malformed_pattern_list_override_case0_malformed_request() {
|
3794 3546 | {
|
3795 3547 | #[allow(unused_mut)]
|
3796 3548 | let mut http_request = ::http::Request::builder()
|
3797 - | .uri("/MalformedRange")
|
3549 + | .uri("/MalformedPatternOverride")
|
3798 3550 | .method("POST")
|
3799 3551 | .header("content-type", "application/json")
|
3800 3552 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3801 3553 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3802 - | "{ \"maxInteger\" : 9 }".as_bytes(),
|
3554 + | "{ \"list\" : [\"abc\"] }".as_bytes(),
|
3803 3555 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3804 3556 | )),
|
3805 3557 | ))
|
3806 3558 | .unwrap();
|
3807 3559 | #[allow(unused_mut)]
|
3808 3560 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3809 3561 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3810 3562 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3811 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3563 + | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
3812 3564 | let sender = sender.clone();
|
3813 3565 | async move {
|
3814 - | 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> };
|
3566 + | 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> };
|
3815 3567 | sender.send(()).await.expect("receiver dropped early");
|
3816 3568 | result
|
3817 3569 | }
|
3818 3570 | })
|
3819 3571 | .build_unchecked();
|
3820 3572 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3821 3573 | .await
|
3822 3574 | .expect("unable to make an HTTP request");
|
3823 3575 | ::pretty_assertions::assert_eq!(
|
3824 3576 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3825 3577 | http_response.status()
|
3826 3578 | );
|
3827 3579 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3828 3580 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3829 3581 | http_response.headers(),
|
3830 3582 | expected_headers,
|
3831 3583 | ));
|
3832 3584 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3833 3585 | .await
|
3834 3586 | .expect("unable to extract body to bytes");
|
3835 3587 | ::aws_smithy_protocol_test::assert_ok(
|
3836 - | ::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"))
|
3588 + | ::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"))
|
3837 3589 | );
|
3838 3590 | }
|
3839 3591 | }
|
3840 3592 |
|
3841 - | /// When a long member does not fit within range bounds,
|
3593 + | /// When a list member value does not match the specified pattern,
|
3842 3594 | /// the response should be a 400 ValidationException.
|
3843 - | /// Test ID: RestJsonMalformedRangeLong_case0
|
3595 + | /// Test ID: RestJsonMalformedPatternListOverride_case1
|
3844 3596 | #[::tokio::test]
|
3845 3597 | #[::tracing_test::traced_test]
|
3846 - | async fn rest_json_malformed_range_long_case0_malformed_request() {
|
3598 + | async fn rest_json_malformed_pattern_list_override_case1_malformed_request() {
|
3847 3599 | {
|
3848 3600 | #[allow(unused_mut)]
|
3849 3601 | let mut http_request = ::http::Request::builder()
|
3850 - | .uri("/MalformedRange")
|
3602 + | .uri("/MalformedPatternOverride")
|
3851 3603 | .method("POST")
|
3852 3604 | .header("content-type", "application/json")
|
3853 3605 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3854 3606 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3855 - | "{ \"long\" : 1 }".as_bytes(),
|
3607 + | "{ \"list\" : [\"xyz\"] }".as_bytes(),
|
3856 3608 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3857 3609 | )),
|
3858 3610 | ))
|
3859 3611 | .unwrap();
|
3860 3612 | #[allow(unused_mut)]
|
3861 3613 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3862 3614 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3863 3615 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3864 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3616 + | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
3865 3617 | let sender = sender.clone();
|
3866 3618 | async move {
|
3867 - | 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> };
|
3619 + | 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> };
|
3868 3620 | sender.send(()).await.expect("receiver dropped early");
|
3869 3621 | result
|
3870 3622 | }
|
3871 3623 | })
|
3872 3624 | .build_unchecked();
|
3873 3625 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3874 3626 | .await
|
3875 3627 | .expect("unable to make an HTTP request");
|
3876 3628 | ::pretty_assertions::assert_eq!(
|
3877 3629 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3878 3630 | http_response.status()
|
3879 3631 | );
|
3880 3632 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3881 3633 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3882 3634 | http_response.headers(),
|
3883 3635 | expected_headers,
|
3884 3636 | ));
|
3885 3637 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3886 3638 | .await
|
3887 3639 | .expect("unable to extract body to bytes");
|
3888 3640 | ::aws_smithy_protocol_test::assert_ok(
|
3889 - | ::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"))
|
3641 + | ::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"))
|
3890 3642 | );
|
3891 3643 | }
|
3892 3644 | }
|
3893 3645 |
|
3894 - | /// When a long member does not fit within range bounds,
|
3646 + | /// When a map member's key does not match the specified pattern,
|
3895 3647 | /// the response should be a 400 ValidationException.
|
3896 - | /// Test ID: RestJsonMalformedRangeLong_case1
|
3648 + | /// Test ID: RestJsonMalformedPatternMapKeyOverride_case0
|
3897 3649 | #[::tokio::test]
|
3898 3650 | #[::tracing_test::traced_test]
|
3899 - | async fn rest_json_malformed_range_long_case1_malformed_request() {
|
3651 + | async fn rest_json_malformed_pattern_map_key_override_case0_malformed_request() {
|
3900 3652 | {
|
3901 3653 | #[allow(unused_mut)]
|
3902 3654 | let mut http_request = ::http::Request::builder()
|
3903 - | .uri("/MalformedRange")
|
3655 + | .uri("/MalformedPatternOverride")
|
3904 3656 | .method("POST")
|
3905 3657 | .header("content-type", "application/json")
|
3906 3658 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3907 3659 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3908 - | "{ \"long\" : 9 }".as_bytes(),
|
3660 + | "{ \"map\" : { \"abc\" : \"ghi\" } }".as_bytes(),
|
3909 3661 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3910 3662 | )),
|
3911 3663 | ))
|
3912 3664 | .unwrap();
|
3913 3665 | #[allow(unused_mut)]
|
3914 3666 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3915 3667 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3916 3668 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3917 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3669 + | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
3918 3670 | let sender = sender.clone();
|
3919 3671 | async move {
|
3920 - | 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> };
|
3672 + | 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> };
|
3921 3673 | sender.send(()).await.expect("receiver dropped early");
|
3922 3674 | result
|
3923 3675 | }
|
3924 3676 | })
|
3925 3677 | .build_unchecked();
|
3926 3678 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3927 3679 | .await
|
3928 3680 | .expect("unable to make an HTTP request");
|
3929 3681 | ::pretty_assertions::assert_eq!(
|
3930 3682 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3931 3683 | http_response.status()
|
3932 3684 | );
|
3933 3685 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3934 3686 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3935 3687 | http_response.headers(),
|
3936 3688 | expected_headers,
|
3937 3689 | ));
|
3938 3690 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3939 3691 | .await
|
3940 3692 | .expect("unable to extract body to bytes");
|
3941 3693 | ::aws_smithy_protocol_test::assert_ok(
|
3942 - | ::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"))
|
3694 + | ::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"))
|
3943 3695 | );
|
3944 3696 | }
|
3945 3697 | }
|
3946 3698 |
|
3947 - | /// When a long member does not fit within range bounds,
|
3699 + | /// When a map member's key does not match the specified pattern,
|
3948 3700 | /// the response should be a 400 ValidationException.
|
3949 - | /// Test ID: RestJsonMalformedRangeMinLong
|
3701 + | /// Test ID: RestJsonMalformedPatternMapKeyOverride_case1
|
3950 3702 | #[::tokio::test]
|
3951 3703 | #[::tracing_test::traced_test]
|
3952 - | async fn rest_json_malformed_range_min_long_malformed_request() {
|
3704 + | async fn rest_json_malformed_pattern_map_key_override_case1_malformed_request() {
|
3953 3705 | {
|
3954 3706 | #[allow(unused_mut)]
|
3955 3707 | let mut http_request = ::http::Request::builder()
|
3956 - | .uri("/MalformedRange")
|
3708 + | .uri("/MalformedPatternOverride")
|
3957 3709 | .method("POST")
|
3958 3710 | .header("content-type", "application/json")
|
3959 3711 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3960 3712 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3961 - | "{ \"minLong\" : 1 }".as_bytes(),
|
3713 + | "{ \"map\" : { \"xyz\" : \"ghi\" } }".as_bytes(),
|
3962 3714 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3963 3715 | )),
|
3964 3716 | ))
|
3965 3717 | .unwrap();
|
3966 3718 | #[allow(unused_mut)]
|
3967 3719 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3968 3720 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3969 3721 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3970 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3722 + | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
3971 3723 | let sender = sender.clone();
|
3972 3724 | async move {
|
3973 - | 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> };
|
3725 + | 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> };
|
3974 3726 | sender.send(()).await.expect("receiver dropped early");
|
3975 3727 | result
|
3976 3728 | }
|
3977 3729 | })
|
3978 3730 | .build_unchecked();
|
3979 3731 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3980 3732 | .await
|
3981 3733 | .expect("unable to make an HTTP request");
|
3982 3734 | ::pretty_assertions::assert_eq!(
|
3983 3735 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3984 3736 | http_response.status()
|
3985 3737 | );
|
3986 3738 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3987 3739 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3988 3740 | http_response.headers(),
|
3989 3741 | expected_headers,
|
3990 3742 | ));
|
3991 3743 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3992 3744 | .await
|
3993 3745 | .expect("unable to extract body to bytes");
|
3994 3746 | ::aws_smithy_protocol_test::assert_ok(
|
3995 - | ::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"))
|
3747 + | ::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"))
|
3996 3748 | );
|
3997 3749 | }
|
3998 3750 | }
|
3999 3751 |
|
4000 - | /// When a long member does not fit within range bounds,
|
3752 + | /// When a map member's value does not match the specified pattern,
|
4001 3753 | /// the response should be a 400 ValidationException.
|
4002 - | /// Test ID: RestJsonMalformedRangeMaxLong
|
3754 + | /// Test ID: RestJsonMalformedPatternMapValueOverride_case0
|
4003 3755 | #[::tokio::test]
|
4004 3756 | #[::tracing_test::traced_test]
|
4005 - | async fn rest_json_malformed_range_max_long_malformed_request() {
|
3757 + | async fn rest_json_malformed_pattern_map_value_override_case0_malformed_request() {
|
4006 3758 | {
|
4007 3759 | #[allow(unused_mut)]
|
4008 3760 | let mut http_request = ::http::Request::builder()
|
4009 - | .uri("/MalformedRange")
|
3761 + | .uri("/MalformedPatternOverride")
|
4010 3762 | .method("POST")
|
4011 3763 | .header("content-type", "application/json")
|
4012 3764 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
4013 3765 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4014 - | "{ \"maxLong\" : 9 }".as_bytes(),
|
3766 + | "{ \"map\" : { \"ghi\": \"abc\" } }".as_bytes(),
|
4015 3767 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4016 3768 | )),
|
4017 3769 | ))
|
4018 3770 | .unwrap();
|
4019 3771 | #[allow(unused_mut)]
|
4020 3772 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4021 3773 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4022 3774 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4023 - | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3775 + | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
4024 3776 | let sender = sender.clone();
|
4025 3777 | async move {
|
4026 - | 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> };
|
3778 + | 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> };
|
4027 3779 | sender.send(()).await.expect("receiver dropped early");
|
4028 3780 | result
|
4029 3781 | }
|
4030 3782 | })
|
4031 3783 | .build_unchecked();
|
4032 3784 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4033 3785 | .await
|
4034 3786 | .expect("unable to make an HTTP request");
|
4035 3787 | ::pretty_assertions::assert_eq!(
|
4036 3788 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4037 3789 | http_response.status()
|
4038 3790 | );
|
4039 3791 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4040 3792 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4041 3793 | http_response.headers(),
|
4042 3794 | expected_headers,
|
4043 3795 | ));
|
4044 3796 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4045 3797 | .await
|
4046 3798 | .expect("unable to extract body to bytes");
|
4047 3799 | ::aws_smithy_protocol_test::assert_ok(
|
4048 - | ::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"))
|
3800 + | ::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"))
|
3801 + | );
|
3802 + | }
|
3803 + | }
|
3804 + |
|
3805 + | /// When a map member's value does not match the specified pattern,
|
3806 + | /// the response should be a 400 ValidationException.
|
3807 + | /// Test ID: RestJsonMalformedPatternMapValueOverride_case1
|
3808 + | #[::tokio::test]
|
3809 + | #[::tracing_test::traced_test]
|
3810 + | async fn rest_json_malformed_pattern_map_value_override_case1_malformed_request() {
|
3811 + | {
|
3812 + | #[allow(unused_mut)]
|
3813 + | let mut http_request = ::http::Request::builder()
|
3814 + | .uri("/MalformedPatternOverride")
|
3815 + | .method("POST")
|
3816 + | .header("content-type", "application/json")
|
3817 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3818 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3819 + | "{ \"map\" : { \"ghi\": \"xyz\" } }".as_bytes(),
|
3820 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3821 + | )),
|
3822 + | ))
|
3823 + | .unwrap();
|
3824 + | #[allow(unused_mut)]
|
3825 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3826 + | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3827 + | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3828 + | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
3829 + | let sender = sender.clone();
|
3830 + | async move {
|
3831 + | 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> };
|
3832 + | sender.send(()).await.expect("receiver dropped early");
|
3833 + | result
|
3834 + | }
|
3835 + | })
|
3836 + | .build_unchecked();
|
3837 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3838 + | .await
|
3839 + | .expect("unable to make an HTTP request");
|
3840 + | ::pretty_assertions::assert_eq!(
|
3841 + | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3842 + | http_response.status()
|
3843 + | );
|
3844 + | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3845 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3846 + | http_response.headers(),
|
3847 + | expected_headers,
|
3848 + | ));
|
3849 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3850 + | .await
|
3851 + | .expect("unable to extract body to bytes");
|
3852 + | ::aws_smithy_protocol_test::assert_ok(
|
3853 + | ::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"))
|
3854 + | );
|
3855 + | }
|
3856 + | }
|
3857 + |
|
3858 + | /// When a union member's value does not match the specified pattern,
|
3859 + | /// the response should be a 400 ValidationException.
|
3860 + | /// Test ID: RestJsonMalformedPatternUnionOverride_case0
|
3861 + | #[::tokio::test]
|
3862 + | #[::tracing_test::traced_test]
|
3863 + | async fn rest_json_malformed_pattern_union_override_case0_malformed_request() {
|
3864 + | {
|
3865 + | #[allow(unused_mut)]
|
3866 + | let mut http_request = ::http::Request::builder()
|
3867 + | .uri("/MalformedPatternOverride")
|
3868 + | .method("POST")
|
3869 + | .header("content-type", "application/json")
|
3870 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3871 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3872 + | "{ \"union\" : { \"first\": \"abc\" } }".as_bytes(),
|
3873 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3874 + | )),
|
3875 + | ))
|
3876 + | .unwrap();
|
3877 + | #[allow(unused_mut)]
|
3878 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3879 + | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3880 + | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3881 + | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
3882 + | let sender = sender.clone();
|
3883 + | async move {
|
3884 + | 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> };
|
3885 + | sender.send(()).await.expect("receiver dropped early");
|
3886 + | result
|
3887 + | }
|
3888 + | })
|
3889 + | .build_unchecked();
|
3890 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3891 + | .await
|
3892 + | .expect("unable to make an HTTP request");
|
3893 + | ::pretty_assertions::assert_eq!(
|
3894 + | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3895 + | http_response.status()
|
3896 + | );
|
3897 + | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3898 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3899 + | http_response.headers(),
|
3900 + | expected_headers,
|
3901 + | ));
|
3902 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3903 + | .await
|
3904 + | .expect("unable to extract body to bytes");
|
3905 + | ::aws_smithy_protocol_test::assert_ok(
|
3906 + | ::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"))
|
3907 + | );
|
3908 + | }
|
3909 + | }
|
3910 + |
|
3911 + | /// When a union member's value does not match the specified pattern,
|
3912 + | /// the response should be a 400 ValidationException.
|
3913 + | /// Test ID: RestJsonMalformedPatternUnionOverride_case1
|
3914 + | #[::tokio::test]
|
3915 + | #[::tracing_test::traced_test]
|
3916 + | async fn rest_json_malformed_pattern_union_override_case1_malformed_request() {
|
3917 + | {
|
3918 + | #[allow(unused_mut)]
|
3919 + | let mut http_request = ::http::Request::builder()
|
3920 + | .uri("/MalformedPatternOverride")
|
3921 + | .method("POST")
|
3922 + | .header("content-type", "application/json")
|
3923 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
3924 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3925 + | "{ \"union\" : { \"first\": \"xyz\" } }".as_bytes(),
|
3926 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3927 + | )),
|
3928 + | ))
|
3929 + | .unwrap();
|
3930 + | #[allow(unused_mut)]
|
3931 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3932 + | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3933 + | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3934 + | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
3935 + | let sender = sender.clone();
|
3936 + | async move {
|
3937 + | 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> };
|
3938 + | sender.send(()).await.expect("receiver dropped early");
|
3939 + | result
|
3940 + | }
|
3941 + | })
|
3942 + | .build_unchecked();
|
3943 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3944 + | .await
|
3945 + | .expect("unable to make an HTTP request");
|
3946 + | ::pretty_assertions::assert_eq!(
|
3947 + | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3948 + | http_response.status()
|
3949 + | );
|
3950 + | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3951 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3952 + | http_response.headers(),
|
3953 + | expected_headers,
|
3954 + | ));
|
3955 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3956 + | .await
|
3957 + | .expect("unable to extract body to bytes");
|
3958 + | ::aws_smithy_protocol_test::assert_ok(
|
3959 + | ::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"))
|
4049 3960 | );
|
4050 3961 | }
|
4051 3962 | }
|
4052 3963 | }
|
4053 3964 |
|
4054 3965 | ::pin_project_lite::pin_project! {
|
4055 3966 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
4056 - | /// [`MalformedPatternOverrideInput`](crate::input::MalformedPatternOverrideInput) using modelled bindings.
|
4057 - | pub struct MalformedPatternOverrideInputFuture {
|
4058 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedPatternOverrideInput, ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
3967 + | /// [`MalformedRangeInput`](crate::input::MalformedRangeInput) using modelled bindings.
|
3968 + | pub struct MalformedRangeInputFuture {
|
3969 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedRangeInput, ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
4059 3970 | }
|
4060 3971 | }
|
4061 3972 |
|
4062 - | impl std::future::Future for MalformedPatternOverrideInputFuture {
|
3973 + | impl std::future::Future for MalformedRangeInputFuture {
|
4063 3974 | type Output = Result<
|
4064 - | crate::input::MalformedPatternOverrideInput,
|
3975 + | crate::input::MalformedRangeInput,
|
4065 3976 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
4066 3977 | >;
|
4067 3978 |
|
4068 3979 | fn poll(
|
4069 3980 | self: std::pin::Pin<&mut Self>,
|
4070 3981 | cx: &mut std::task::Context<'_>,
|
4071 3982 | ) -> std::task::Poll<Self::Output> {
|
4072 3983 | let this = self.project();
|
4073 3984 | this.inner.as_mut().poll(cx)
|
4074 3985 | }
|
4075 3986 | }
|
4076 3987 |
|
4077 3988 | impl<B>
|
4078 3989 | ::aws_smithy_legacy_http_server::request::FromRequest<
|
4079 3990 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
4080 3991 | B,
|
4081 - | > for crate::input::MalformedPatternOverrideInput
|
3992 + | > for crate::input::MalformedRangeInput
|
4082 3993 | where
|
4083 3994 | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
4084 3995 | B: 'static,
|
4085 3996 |
|
4086 3997 | B::Data: Send,
|
4087 3998 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
4088 3999 | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
4089 4000 | {
|
4090 4001 | type Rejection =
|
4091 4002 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
4092 - | type Future = MalformedPatternOverrideInputFuture;
|
4003 + | type Future = MalformedRangeInputFuture;
|
4093 4004 |
|
4094 4005 | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
4095 4006 | let fut = async move {
|
4096 4007 | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
4097 4008 | request.headers(),
|
4098 4009 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
4099 4010 | ) {
|
4100 4011 | return Err(::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
4101 4012 | }
|
4102 - | crate::protocol_serde::shape_malformed_pattern_override::de_malformed_pattern_override_http_request(request)
|
4013 + | crate::protocol_serde::shape_malformed_range::de_malformed_range_http_request(request)
|
4103 4014 | .await
|
4104 4015 | };
|
4105 4016 | use ::futures_util::future::TryFutureExt;
|
4106 4017 | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
4107 4018 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
4108 4019 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e)
|
4109 4020 | });
|
4110 - | MalformedPatternOverrideInputFuture {
|
4021 + | MalformedRangeInputFuture {
|
4111 4022 | inner: Box::pin(fut),
|
4112 4023 | }
|
4113 4024 | }
|
4114 4025 | }
|
4115 4026 | impl
|
4116 4027 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
4117 4028 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
4118 - | > for crate::output::MalformedPatternOverrideOutput
|
4029 + | > for crate::output::MalformedRangeOutput
|
4119 4030 | {
|
4120 4031 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
4121 - | match crate::protocol_serde::shape_malformed_pattern_override::ser_malformed_pattern_override_http_response(self) {
|
4032 + | match crate::protocol_serde::shape_malformed_range::ser_malformed_range_http_response(self)
|
4033 + | {
|
4122 4034 | Ok(response) => response,
|
4123 4035 | Err(e) => {
|
4124 4036 | ::tracing::error!(error = %e, "failed to serialize response");
|
4125 4037 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
4126 4038 | }
|
4127 4039 | }
|
4128 4040 | }
|
4129 4041 | }
|
4130 4042 | impl
|
4131 4043 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
4132 4044 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
4133 - | > for crate::error::MalformedPatternOverrideError
|
4045 + | > for crate::error::MalformedRangeError
|
4134 4046 | {
|
4135 4047 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
4136 - | match crate::protocol_serde::shape_malformed_pattern_override::ser_malformed_pattern_override_http_error(&self) {
|
4048 + | match crate::protocol_serde::shape_malformed_range::ser_malformed_range_http_error(&self) {
|
4137 4049 | Ok(mut response) => {
|
4138 - | response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
4050 + | response.extensions_mut().insert(
|
4051 + | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
4052 + | self.name(),
|
4053 + | ),
|
4054 + | );
|
4139 4055 | response
|
4140 - | },
|
4056 + | }
|
4141 4057 | Err(e) => {
|
4142 4058 | ::tracing::error!(error = %e, "failed to serialize response");
|
4143 4059 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
4144 4060 | }
|
4145 4061 | }
|
4146 4062 | }
|
4147 4063 | }
|
4148 4064 |
|
4149 4065 | #[allow(unreachable_code, unused_variables)]
|
4150 4066 | #[cfg(test)]
|
4151 - | mod malformed_pattern_override_test {
|
4067 + | mod malformed_range_test {
|
4152 4068 |
|
4153 - | /// When a string member does not match the specified pattern,
|
4069 + | /// When a byte member does not fit within range bounds,
|
4154 4070 | /// the response should be a 400 ValidationException.
|
4155 - | /// Test ID: RestJsonMalformedPatternStringOverride_case0
|
4071 + | /// Test ID: RestJsonMalformedRangeByte_case0
|
4156 4072 | #[::tokio::test]
|
4157 4073 | #[::tracing_test::traced_test]
|
4158 - | async fn rest_json_malformed_pattern_string_override_case0_malformed_request() {
|
4074 + | async fn rest_json_malformed_range_byte_case0_malformed_request() {
|
4159 4075 | {
|
4160 4076 | #[allow(unused_mut)]
|
4161 4077 | let mut http_request = ::http::Request::builder()
|
4162 - | .uri("/MalformedPatternOverride")
|
4078 + | .uri("/MalformedRange")
|
4163 4079 | .method("POST")
|
4164 4080 | .header("content-type", "application/json")
|
4165 4081 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
4166 4082 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4167 - | "{ \"string\" : \"abc\" }".as_bytes(),
|
4083 + | "{ \"byte\" : 1 }".as_bytes(),
|
4168 4084 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4169 4085 | )),
|
4170 4086 | ))
|
4171 4087 | .unwrap();
|
4172 4088 | #[allow(unused_mut)]
|
4173 4089 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4174 4090 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4175 4091 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4176 - | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
4092 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
4177 4093 | let sender = sender.clone();
|
4178 4094 | async move {
|
4179 - | 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> };
|
4095 + | 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> };
|
4180 4096 | sender.send(()).await.expect("receiver dropped early");
|
4181 4097 | result
|
4182 4098 | }
|
4183 4099 | })
|
4184 4100 | .build_unchecked();
|
4185 4101 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4186 4102 | .await
|
4187 4103 | .expect("unable to make an HTTP request");
|
4188 4104 | ::pretty_assertions::assert_eq!(
|
4189 4105 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4190 4106 | http_response.status()
|
4191 4107 | );
|
4192 4108 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4193 4109 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4194 4110 | http_response.headers(),
|
4195 4111 | expected_headers,
|
4196 4112 | ));
|
4197 4113 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4198 4114 | .await
|
4199 4115 | .expect("unable to extract body to bytes");
|
4200 4116 | ::aws_smithy_protocol_test::assert_ok(
|
4201 - | ::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"))
|
4117 + | ::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"))
|
4202 4118 | );
|
4203 4119 | }
|
4204 4120 | }
|
4205 4121 |
|
4206 - | /// When a string member does not match the specified pattern,
|
4122 + | /// When a byte member does not fit within range bounds,
|
4207 4123 | /// the response should be a 400 ValidationException.
|
4208 - | /// Test ID: RestJsonMalformedPatternStringOverride_case1
|
4124 + | /// Test ID: RestJsonMalformedRangeByte_case1
|
4209 4125 | #[::tokio::test]
|
4210 4126 | #[::tracing_test::traced_test]
|
4211 - | async fn rest_json_malformed_pattern_string_override_case1_malformed_request() {
|
4127 + | async fn rest_json_malformed_range_byte_case1_malformed_request() {
|
4212 4128 | {
|
4213 4129 | #[allow(unused_mut)]
|
4214 4130 | let mut http_request = ::http::Request::builder()
|
4215 - | .uri("/MalformedPatternOverride")
|
4131 + | .uri("/MalformedRange")
|
4216 4132 | .method("POST")
|
4217 4133 | .header("content-type", "application/json")
|
4218 4134 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
4219 4135 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4220 - | "{ \"string\" : \"xyz\" }".as_bytes(),
|
4136 + | "{ \"byte\" : 9 }".as_bytes(),
|
4221 4137 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4222 4138 | )),
|
4223 4139 | ))
|
4224 4140 | .unwrap();
|
4225 4141 | #[allow(unused_mut)]
|
4226 4142 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4227 4143 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4228 4144 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4229 - | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
4145 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
4230 4146 | let sender = sender.clone();
|
4231 4147 | async move {
|
4232 - | 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> };
|
4148 + | 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> };
|
4233 4149 | sender.send(()).await.expect("receiver dropped early");
|
4234 4150 | result
|
4235 4151 | }
|
4236 4152 | })
|
4237 4153 | .build_unchecked();
|
4238 4154 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4239 4155 | .await
|
4240 4156 | .expect("unable to make an HTTP request");
|
4241 4157 | ::pretty_assertions::assert_eq!(
|
4242 4158 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4243 4159 | http_response.status()
|
4244 4160 | );
|
4245 4161 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4246 4162 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4247 4163 | http_response.headers(),
|
4248 4164 | expected_headers,
|
4249 4165 | ));
|
4250 4166 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4251 4167 | .await
|
4252 4168 | .expect("unable to extract body to bytes");
|
4253 4169 | ::aws_smithy_protocol_test::assert_ok(
|
4254 - | ::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"))
|
4170 + | ::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"))
|
4255 4171 | );
|
4256 4172 | }
|
4257 4173 | }
|
4258 4174 |
|
4259 - | /// When a list member value does not match the specified pattern,
|
4175 + | /// When a byte member does not fit within range bounds,
|
4260 4176 | /// the response should be a 400 ValidationException.
|
4261 - | /// Test ID: RestJsonMalformedPatternListOverride_case0
|
4177 + | /// Test ID: RestJsonMalformedRangeMinByte
|
4262 4178 | #[::tokio::test]
|
4263 4179 | #[::tracing_test::traced_test]
|
4264 - | async fn rest_json_malformed_pattern_list_override_case0_malformed_request() {
|
4180 + | async fn rest_json_malformed_range_min_byte_malformed_request() {
|
4265 4181 | {
|
4266 4182 | #[allow(unused_mut)]
|
4267 4183 | let mut http_request = ::http::Request::builder()
|
4268 - | .uri("/MalformedPatternOverride")
|
4184 + | .uri("/MalformedRange")
|
4269 4185 | .method("POST")
|
4270 4186 | .header("content-type", "application/json")
|
4271 4187 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
4272 4188 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4273 - | "{ \"list\" : [\"abc\"] }".as_bytes(),
|
4189 + | "{ \"minByte\" : 1 }".as_bytes(),
|
4274 4190 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4275 4191 | )),
|
4276 4192 | ))
|
4277 4193 | .unwrap();
|
4278 4194 | #[allow(unused_mut)]
|
4279 4195 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4280 4196 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4281 4197 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4282 - | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
4198 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
4283 4199 | let sender = sender.clone();
|
4284 4200 | async move {
|
4285 - | 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> };
|
4201 + | 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> };
|
4286 4202 | sender.send(()).await.expect("receiver dropped early");
|
4287 4203 | result
|
4288 4204 | }
|
4289 4205 | })
|
4290 4206 | .build_unchecked();
|
4291 4207 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4292 4208 | .await
|
4293 4209 | .expect("unable to make an HTTP request");
|
4294 4210 | ::pretty_assertions::assert_eq!(
|
4295 4211 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4296 4212 | http_response.status()
|
4297 4213 | );
|
4298 4214 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4299 4215 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4300 4216 | http_response.headers(),
|
4301 4217 | expected_headers,
|
4302 4218 | ));
|
4303 4219 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4304 4220 | .await
|
4305 4221 | .expect("unable to extract body to bytes");
|
4306 4222 | ::aws_smithy_protocol_test::assert_ok(
|
4307 - | ::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"))
|
4223 + | ::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"))
|
4308 4224 | );
|
4309 4225 | }
|
4310 4226 | }
|
4311 4227 |
|
4312 - | /// When a list member value does not match the specified pattern,
|
4228 + | /// When a byte member does not fit within range bounds,
|
4313 4229 | /// the response should be a 400 ValidationException.
|
4314 - | /// Test ID: RestJsonMalformedPatternListOverride_case1
|
4230 + | /// Test ID: RestJsonMalformedRangeMaxByte
|
4315 4231 | #[::tokio::test]
|
4316 4232 | #[::tracing_test::traced_test]
|
4317 - | async fn rest_json_malformed_pattern_list_override_case1_malformed_request() {
|
4233 + | async fn rest_json_malformed_range_max_byte_malformed_request() {
|
4318 4234 | {
|
4319 4235 | #[allow(unused_mut)]
|
4320 4236 | let mut http_request = ::http::Request::builder()
|
4321 - | .uri("/MalformedPatternOverride")
|
4237 + | .uri("/MalformedRange")
|
4322 4238 | .method("POST")
|
4323 4239 | .header("content-type", "application/json")
|
4324 4240 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
4325 4241 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4326 - | "{ \"list\" : [\"xyz\"] }".as_bytes(),
|
4242 + | "{ \"maxByte\" : 9 }".as_bytes(),
|
4327 4243 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4328 4244 | )),
|
4329 4245 | ))
|
4330 4246 | .unwrap();
|
4331 4247 | #[allow(unused_mut)]
|
4332 4248 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4333 4249 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4334 4250 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4335 - | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
4251 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
4336 4252 | let sender = sender.clone();
|
4337 4253 | async move {
|
4338 - | 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> };
|
4254 + | 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> };
|
4339 4255 | sender.send(()).await.expect("receiver dropped early");
|
4340 4256 | result
|
4341 4257 | }
|
4342 4258 | })
|
4343 4259 | .build_unchecked();
|
4344 4260 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4345 4261 | .await
|
4346 4262 | .expect("unable to make an HTTP request");
|
4347 4263 | ::pretty_assertions::assert_eq!(
|
4348 4264 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4349 4265 | http_response.status()
|
4350 4266 | );
|
4351 4267 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4352 4268 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4353 4269 | http_response.headers(),
|
4354 4270 | expected_headers,
|
4355 4271 | ));
|
4356 4272 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4357 4273 | .await
|
4358 4274 | .expect("unable to extract body to bytes");
|
4359 4275 | ::aws_smithy_protocol_test::assert_ok(
|
4360 - | ::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"))
|
4276 + | ::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"))
|
4361 4277 | );
|
4362 4278 | }
|
4363 4279 | }
|
4364 4280 |
|
4365 - | /// When a map member's key does not match the specified pattern,
|
4281 + | /// When a float member does not fit within range bounds,
|
4366 4282 | /// the response should be a 400 ValidationException.
|
4367 - | /// Test ID: RestJsonMalformedPatternMapKeyOverride_case0
|
4283 + | /// Test ID: RestJsonMalformedRangeFloat_case0
|
4368 4284 | #[::tokio::test]
|
4369 4285 | #[::tracing_test::traced_test]
|
4370 - | async fn rest_json_malformed_pattern_map_key_override_case0_malformed_request() {
|
4286 + | #[should_panic]
|
4287 + | async fn rest_json_malformed_range_float_case0_malformed_request() {
|
4371 4288 | {
|
4372 4289 | #[allow(unused_mut)]
|
4373 4290 | let mut http_request = ::http::Request::builder()
|
4374 - | .uri("/MalformedPatternOverride")
|
4291 + | .uri("/MalformedRange")
|
4375 4292 | .method("POST")
|
4376 4293 | .header("content-type", "application/json")
|
4377 4294 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
4378 4295 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4379 - | "{ \"map\" : { \"abc\" : \"ghi\" } }".as_bytes(),
|
4296 + | "{ \"float\" : 2.1 }".as_bytes(),
|
4380 4297 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4381 4298 | )),
|
4382 4299 | ))
|
4383 4300 | .unwrap();
|
4384 4301 | #[allow(unused_mut)]
|
4385 4302 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4386 4303 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4387 4304 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4388 - | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
4305 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
4389 4306 | let sender = sender.clone();
|
4390 4307 | async move {
|
4391 - | 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> };
|
4308 + | 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> };
|
4392 4309 | sender.send(()).await.expect("receiver dropped early");
|
4393 4310 | result
|
4394 4311 | }
|
4395 4312 | })
|
4396 4313 | .build_unchecked();
|
4397 4314 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4398 4315 | .await
|
4399 4316 | .expect("unable to make an HTTP request");
|
4400 4317 | ::pretty_assertions::assert_eq!(
|
4401 4318 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4402 4319 | http_response.status()
|
4403 4320 | );
|
4404 4321 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4405 4322 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4406 4323 | http_response.headers(),
|
4407 4324 | expected_headers,
|
4408 4325 | ));
|
4409 4326 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4410 4327 | .await
|
4411 4328 | .expect("unable to extract body to bytes");
|
4412 4329 | ::aws_smithy_protocol_test::assert_ok(
|
4413 - | ::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"))
|
4330 + | ::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"))
|
4414 4331 | );
|
4415 4332 | }
|
4416 4333 | }
|
4417 4334 |
|
4418 - | /// When a map member's key does not match the specified pattern,
|
4335 + | /// When a float member does not fit within range bounds,
|
4419 4336 | /// the response should be a 400 ValidationException.
|
4420 - | /// Test ID: RestJsonMalformedPatternMapKeyOverride_case1
|
4337 + | /// Test ID: RestJsonMalformedRangeFloat_case1
|
4421 4338 | #[::tokio::test]
|
4422 4339 | #[::tracing_test::traced_test]
|
4423 - | async fn rest_json_malformed_pattern_map_key_override_case1_malformed_request() {
|
4340 + | #[should_panic]
|
4341 + | async fn rest_json_malformed_range_float_case1_malformed_request() {
|
4424 4342 | {
|
4425 4343 | #[allow(unused_mut)]
|
4426 4344 | let mut http_request = ::http::Request::builder()
|
4427 - | .uri("/MalformedPatternOverride")
|
4345 + | .uri("/MalformedRange")
|
4428 4346 | .method("POST")
|
4429 4347 | .header("content-type", "application/json")
|
4430 4348 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
4431 4349 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4432 - | "{ \"map\" : { \"xyz\" : \"ghi\" } }".as_bytes(),
|
4350 + | "{ \"float\" : 8.9 }".as_bytes(),
|
4433 4351 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4434 4352 | )),
|
4435 4353 | ))
|
4436 4354 | .unwrap();
|
4437 4355 | #[allow(unused_mut)]
|
4438 4356 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4439 4357 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4440 4358 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4441 - | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
4359 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
4442 4360 | let sender = sender.clone();
|
4443 4361 | async move {
|
4444 - | 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> };
|
4362 + | 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> };
|
4445 4363 | sender.send(()).await.expect("receiver dropped early");
|
4446 4364 | result
|
4447 4365 | }
|
4448 4366 | })
|
4449 4367 | .build_unchecked();
|
4450 4368 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4451 4369 | .await
|
4452 4370 | .expect("unable to make an HTTP request");
|
4453 4371 | ::pretty_assertions::assert_eq!(
|
4454 4372 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4455 4373 | http_response.status()
|
4456 4374 | );
|
4457 4375 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4458 4376 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4459 4377 | http_response.headers(),
|
4460 4378 | expected_headers,
|
4461 4379 | ));
|
4462 4380 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4463 4381 | .await
|
4464 4382 | .expect("unable to extract body to bytes");
|
4465 4383 | ::aws_smithy_protocol_test::assert_ok(
|
4466 - | ::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"))
|
4384 + | ::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"))
|
4467 4385 | );
|
4468 4386 | }
|
4469 4387 | }
|
4470 4388 |
|
4471 - | /// When a map member's value does not match the specified pattern,
|
4389 + | /// When a float member does not fit within range bounds,
|
4472 4390 | /// the response should be a 400 ValidationException.
|
4473 - | /// Test ID: RestJsonMalformedPatternMapValueOverride_case0
|
4391 + | /// Test ID: RestJsonMalformedRangeMinFloat
|
4474 4392 | #[::tokio::test]
|
4475 4393 | #[::tracing_test::traced_test]
|
4476 - | async fn rest_json_malformed_pattern_map_value_override_case0_malformed_request() {
|
4394 + | #[should_panic]
|
4395 + | async fn rest_json_malformed_range_min_float_malformed_request() {
|
4477 4396 | {
|
4478 4397 | #[allow(unused_mut)]
|
4479 4398 | let mut http_request = ::http::Request::builder()
|
4480 - | .uri("/MalformedPatternOverride")
|
4399 + | .uri("/MalformedRange")
|
4481 4400 | .method("POST")
|
4482 4401 | .header("content-type", "application/json")
|
4483 4402 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
4484 4403 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4485 - | "{ \"map\" : { \"ghi\": \"abc\" } }".as_bytes(),
|
4404 + | "{ \"minFloat\" : 2.1 }".as_bytes(),
|
4486 4405 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4487 4406 | )),
|
4488 4407 | ))
|
4489 4408 | .unwrap();
|
4490 4409 | #[allow(unused_mut)]
|
4491 4410 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4492 4411 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4493 4412 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4494 - | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
4413 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
4495 4414 | let sender = sender.clone();
|
4496 4415 | async move {
|
4497 - | 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> };
|
4416 + | 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> };
|
4498 4417 | sender.send(()).await.expect("receiver dropped early");
|
4499 4418 | result
|
4500 4419 | }
|
4501 4420 | })
|
4502 4421 | .build_unchecked();
|
4503 4422 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4504 4423 | .await
|
4505 4424 | .expect("unable to make an HTTP request");
|
4506 4425 | ::pretty_assertions::assert_eq!(
|
4507 4426 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4508 4427 | http_response.status()
|
4509 4428 | );
|
4510 4429 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4511 4430 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4512 4431 | http_response.headers(),
|
4513 4432 | expected_headers,
|
4514 4433 | ));
|
4515 4434 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4516 4435 | .await
|
4517 4436 | .expect("unable to extract body to bytes");
|
4518 4437 | ::aws_smithy_protocol_test::assert_ok(
|
4519 - | ::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"))
|
4438 + | ::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"))
|
4520 4439 | );
|
4521 4440 | }
|
4522 4441 | }
|
4523 4442 |
|
4524 - | /// When a map member's value does not match the specified pattern,
|
4443 + | /// When a float member does not fit within range bounds,
|
4525 4444 | /// the response should be a 400 ValidationException.
|
4526 - | /// Test ID: RestJsonMalformedPatternMapValueOverride_case1
|
4445 + | /// Test ID: RestJsonMalformedRangeMaxFloat
|
4527 4446 | #[::tokio::test]
|
4528 4447 | #[::tracing_test::traced_test]
|
4529 - | async fn rest_json_malformed_pattern_map_value_override_case1_malformed_request() {
|
4448 + | #[should_panic]
|
4449 + | async fn rest_json_malformed_range_max_float_malformed_request() {
|
4530 4450 | {
|
4531 4451 | #[allow(unused_mut)]
|
4532 4452 | let mut http_request = ::http::Request::builder()
|
4533 - | .uri("/MalformedPatternOverride")
|
4453 + | .uri("/MalformedRange")
|
4534 4454 | .method("POST")
|
4535 4455 | .header("content-type", "application/json")
|
4536 4456 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
4537 4457 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4538 - | "{ \"map\" : { \"ghi\": \"xyz\" } }".as_bytes(),
|
4458 + | "{ \"maxFloat\" : 8.9 }".as_bytes(),
|
4539 4459 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4540 4460 | )),
|
4541 4461 | ))
|
4542 4462 | .unwrap();
|
4543 4463 | #[allow(unused_mut)]
|
4544 4464 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4545 4465 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4546 4466 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4547 - | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
4467 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
4548 4468 | let sender = sender.clone();
|
4549 4469 | async move {
|
4550 - | 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> };
|
4470 + | 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> };
|
4551 4471 | sender.send(()).await.expect("receiver dropped early");
|
4552 4472 | result
|
4553 4473 | }
|
4554 4474 | })
|
4555 4475 | .build_unchecked();
|
4556 4476 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4557 4477 | .await
|
4558 4478 | .expect("unable to make an HTTP request");
|
4559 4479 | ::pretty_assertions::assert_eq!(
|
4560 4480 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4561 4481 | http_response.status()
|
4562 4482 | );
|
4563 4483 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4564 4484 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4565 4485 | http_response.headers(),
|
4566 4486 | expected_headers,
|
4567 4487 | ));
|
4568 4488 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4569 4489 | .await
|
4570 4490 | .expect("unable to extract body to bytes");
|
4571 4491 | ::aws_smithy_protocol_test::assert_ok(
|
4572 - | ::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"))
|
4492 + | ::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"))
|
4573 4493 | );
|
4574 4494 | }
|
4575 4495 | }
|
4576 4496 |
|
4577 - | /// When a union member's value does not match the specified pattern,
|
4497 + | /// When a short member does not fit within range bounds,
|
4578 4498 | /// the response should be a 400 ValidationException.
|
4579 - | /// Test ID: RestJsonMalformedPatternUnionOverride_case0
|
4499 + | /// Test ID: RestJsonMalformedRangeShort_case0
|
4580 4500 | #[::tokio::test]
|
4581 4501 | #[::tracing_test::traced_test]
|
4582 - | async fn rest_json_malformed_pattern_union_override_case0_malformed_request() {
|
4502 + | async fn rest_json_malformed_range_short_case0_malformed_request() {
|
4583 4503 | {
|
4584 4504 | #[allow(unused_mut)]
|
4585 4505 | let mut http_request = ::http::Request::builder()
|
4586 - | .uri("/MalformedPatternOverride")
|
4506 + | .uri("/MalformedRange")
|
4587 4507 | .method("POST")
|
4588 4508 | .header("content-type", "application/json")
|
4589 4509 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
4590 4510 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4591 - | "{ \"union\" : { \"first\": \"abc\" } }".as_bytes(),
|
4511 + | "{ \"short\" : 1 }".as_bytes(),
|
4592 4512 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4593 4513 | )),
|
4594 4514 | ))
|
4595 4515 | .unwrap();
|
4596 4516 | #[allow(unused_mut)]
|
4597 4517 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4598 4518 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4599 4519 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4600 - | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
4520 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
4601 4521 | let sender = sender.clone();
|
4602 4522 | async move {
|
4603 - | 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> };
|
4523 + | 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> };
|
4604 4524 | sender.send(()).await.expect("receiver dropped early");
|
4605 4525 | result
|
4606 4526 | }
|
4607 4527 | })
|
4608 4528 | .build_unchecked();
|
4609 4529 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4610 4530 | .await
|
4611 4531 | .expect("unable to make an HTTP request");
|
4612 4532 | ::pretty_assertions::assert_eq!(
|
4613 4533 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4614 4534 | http_response.status()
|
4615 4535 | );
|
4616 4536 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4617 4537 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4618 4538 | http_response.headers(),
|
4619 4539 | expected_headers,
|
4620 4540 | ));
|
4621 4541 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4622 4542 | .await
|
4623 4543 | .expect("unable to extract body to bytes");
|
4624 4544 | ::aws_smithy_protocol_test::assert_ok(
|
4625 - | ::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"))
|
4545 + | ::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"))
|
4626 4546 | );
|
4627 4547 | }
|
4628 4548 | }
|
4629 4549 |
|
4630 - | /// When a union member's value does not match the specified pattern,
|
4550 + | /// When a short member does not fit within range bounds,
|
4631 4551 | /// the response should be a 400 ValidationException.
|
4632 - | /// Test ID: RestJsonMalformedPatternUnionOverride_case1
|
4552 + | /// Test ID: RestJsonMalformedRangeShort_case1
|
4633 4553 | #[::tokio::test]
|
4634 4554 | #[::tracing_test::traced_test]
|
4635 - | async fn rest_json_malformed_pattern_union_override_case1_malformed_request() {
|
4555 + | async fn rest_json_malformed_range_short_case1_malformed_request() {
|
4636 4556 | {
|
4637 4557 | #[allow(unused_mut)]
|
4638 4558 | let mut http_request = ::http::Request::builder()
|
4639 - | .uri("/MalformedPatternOverride")
|
4559 + | .uri("/MalformedRange")
|
4640 4560 | .method("POST")
|
4641 4561 | .header("content-type", "application/json")
|
4642 4562 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
4643 4563 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4644 - | "{ \"union\" : { \"first\": \"xyz\" } }".as_bytes(),
|
4564 + | "{ \"short\" : 9 }".as_bytes(),
|
4645 4565 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4646 4566 | )),
|
4647 4567 | ))
|
4648 4568 | .unwrap();
|
4649 4569 | #[allow(unused_mut)]
|
4650 4570 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4651 4571 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4652 4572 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4653 - | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
4573 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
4654 4574 | let sender = sender.clone();
|
4655 4575 | async move {
|
4656 - | 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> };
|
4576 + | 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> };
|
4657 4577 | sender.send(()).await.expect("receiver dropped early");
|
4658 4578 | result
|
4659 4579 | }
|
4660 4580 | })
|
4661 4581 | .build_unchecked();
|
4662 4582 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4663 4583 | .await
|
4664 4584 | .expect("unable to make an HTTP request");
|
4665 4585 | ::pretty_assertions::assert_eq!(
|
4666 4586 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4667 4587 | http_response.status()
|
4668 4588 | );
|
4669 4589 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4670 4590 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4671 4591 | http_response.headers(),
|
4672 4592 | expected_headers,
|
4673 4593 | ));
|
4674 4594 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4675 4595 | .await
|
4676 4596 | .expect("unable to extract body to bytes");
|
4677 4597 | ::aws_smithy_protocol_test::assert_ok(
|
4678 - | ::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"))
|
4679 - | );
|
4680 - | }
|
4681 - | }
|
4682 - | }
|
4683 - |
|
4684 - | ::pin_project_lite::pin_project! {
|
4685 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
4686 - | /// [`MalformedPatternInput`](crate::input::MalformedPatternInput) using modelled bindings.
|
4687 - | pub struct MalformedPatternInputFuture {
|
4688 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedPatternInput, ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
4689 - | }
|
4690 - | }
|
4691 - |
|
4692 - | impl std::future::Future for MalformedPatternInputFuture {
|
4693 - | type Output = Result<
|
4694 - | crate::input::MalformedPatternInput,
|
4695 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
4696 - | >;
|
4697 - |
|
4698 - | fn poll(
|
4699 - | self: std::pin::Pin<&mut Self>,
|
4700 - | cx: &mut std::task::Context<'_>,
|
4701 - | ) -> std::task::Poll<Self::Output> {
|
4702 - | let this = self.project();
|
4703 - | this.inner.as_mut().poll(cx)
|
4704 - | }
|
4705 - | }
|
4706 - |
|
4707 - | impl<B>
|
4708 - | ::aws_smithy_legacy_http_server::request::FromRequest<
|
4709 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
4710 - | B,
|
4711 - | > for crate::input::MalformedPatternInput
|
4712 - | where
|
4713 - | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
4714 - | B: 'static,
|
4715 - |
|
4716 - | B::Data: Send,
|
4717 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
4718 - | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
4719 - | {
|
4720 - | type Rejection =
|
4721 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
4722 - | type Future = MalformedPatternInputFuture;
|
4723 - |
|
4724 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
4725 - | let fut = async move {
|
4726 - | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
4727 - | request.headers(),
|
4728 - | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
4729 - | ) {
|
4730 - | return Err(::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
4731 - | }
|
4732 - | crate::protocol_serde::shape_malformed_pattern::de_malformed_pattern_http_request(
|
4733 - | request,
|
4734 - | )
|
4735 - | .await
|
4736 - | };
|
4737 - | use ::futures_util::future::TryFutureExt;
|
4738 - | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
4739 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
4740 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e)
|
4741 - | });
|
4742 - | MalformedPatternInputFuture {
|
4743 - | inner: Box::pin(fut),
|
4744 - | }
|
4745 - | }
|
4746 - | }
|
4747 - | impl
|
4748 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
4749 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
4750 - | > for crate::output::MalformedPatternOutput
|
4751 - | {
|
4752 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
4753 - | match crate::protocol_serde::shape_malformed_pattern::ser_malformed_pattern_http_response(
|
4754 - | self,
|
4755 - | ) {
|
4756 - | Ok(response) => response,
|
4757 - | Err(e) => {
|
4758 - | ::tracing::error!(error = %e, "failed to serialize response");
|
4759 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
4760 - | }
|
4761 - | }
|
4762 - | }
|
4763 - | }
|
4764 - | impl
|
4765 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
4766 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
4767 - | > for crate::error::MalformedPatternError
|
4768 - | {
|
4769 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
4770 - | match crate::protocol_serde::shape_malformed_pattern::ser_malformed_pattern_http_error(
|
4771 - | &self,
|
4772 - | ) {
|
4773 - | Ok(mut response) => {
|
4774 - | response.extensions_mut().insert(
|
4775 - | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
4776 - | self.name(),
|
4777 - | ),
|
4598 + | ::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"))
|
4778 4599 | );
|
4779 - | response
|
4780 - | }
|
4781 - | Err(e) => {
|
4782 - | ::tracing::error!(error = %e, "failed to serialize response");
|
4783 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
4784 4600 | }
|
4785 4601 | }
|
4786 - | }
|
4787 - | }
|
4788 - |
|
4789 - | #[allow(unreachable_code, unused_variables)]
|
4790 - | #[cfg(test)]
|
4791 - | mod malformed_pattern_test {
|
4792 4602 |
|
4793 - | /// When a string member does not match the specified pattern,
|
4603 + | /// When a short member does not fit within range bounds,
|
4794 4604 | /// the response should be a 400 ValidationException.
|
4795 - | /// Test ID: RestJsonMalformedPatternString_case0
|
4605 + | /// Test ID: RestJsonMalformedRangeMinShort
|
4796 4606 | #[::tokio::test]
|
4797 4607 | #[::tracing_test::traced_test]
|
4798 - | async fn rest_json_malformed_pattern_string_case0_malformed_request() {
|
4608 + | async fn rest_json_malformed_range_min_short_malformed_request() {
|
4799 4609 | {
|
4800 4610 | #[allow(unused_mut)]
|
4801 4611 | let mut http_request = ::http::Request::builder()
|
4802 - | .uri("/MalformedPattern")
|
4612 + | .uri("/MalformedRange")
|
4803 4613 | .method("POST")
|
4804 4614 | .header("content-type", "application/json")
|
4805 4615 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
4806 4616 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4807 - | "{ \"string\" : \"ABC\" }".as_bytes(),
|
4617 + | "{ \"minShort\" : 1 }".as_bytes(),
|
4808 4618 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4809 4619 | )),
|
4810 4620 | ))
|
4811 4621 | .unwrap();
|
4812 4622 | #[allow(unused_mut)]
|
4813 4623 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4814 4624 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4815 4625 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4816 - | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
4626 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
4817 4627 | let sender = sender.clone();
|
4818 4628 | async move {
|
4819 - | 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> };
|
4629 + | 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> };
|
4820 4630 | sender.send(()).await.expect("receiver dropped early");
|
4821 4631 | result
|
4822 4632 | }
|
4823 4633 | })
|
4824 4634 | .build_unchecked();
|
4825 4635 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4826 4636 | .await
|
4827 4637 | .expect("unable to make an HTTP request");
|
4828 4638 | ::pretty_assertions::assert_eq!(
|
4829 4639 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4830 4640 | http_response.status()
|
4831 4641 | );
|
4832 4642 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4833 4643 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4834 4644 | http_response.headers(),
|
4835 4645 | expected_headers,
|
4836 4646 | ));
|
4837 4647 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4838 4648 | .await
|
4839 4649 | .expect("unable to extract body to bytes");
|
4840 4650 | ::aws_smithy_protocol_test::assert_ok(
|
4841 - | ::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"))
|
4651 + | ::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"))
|
4842 4652 | );
|
4843 4653 | }
|
4844 4654 | }
|
4845 4655 |
|
4846 - | /// When a string member does not match the specified pattern,
|
4656 + | /// When a short member does not fit within range bounds,
|
4847 4657 | /// the response should be a 400 ValidationException.
|
4848 - | /// Test ID: RestJsonMalformedPatternString_case1
|
4658 + | /// Test ID: RestJsonMalformedRangeMaxShort
|
4849 4659 | #[::tokio::test]
|
4850 4660 | #[::tracing_test::traced_test]
|
4851 - | async fn rest_json_malformed_pattern_string_case1_malformed_request() {
|
4661 + | async fn rest_json_malformed_range_max_short_malformed_request() {
|
4852 4662 | {
|
4853 4663 | #[allow(unused_mut)]
|
4854 4664 | let mut http_request = ::http::Request::builder()
|
4855 - | .uri("/MalformedPattern")
|
4665 + | .uri("/MalformedRange")
|
4856 4666 | .method("POST")
|
4857 4667 | .header("content-type", "application/json")
|
4858 4668 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
4859 4669 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4860 - | "{ \"string\" : \"xyz\" }".as_bytes(),
|
4670 + | "{ \"maxShort\" : 9 }".as_bytes(),
|
4861 4671 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4862 4672 | )),
|
4863 4673 | ))
|
4864 4674 | .unwrap();
|
4865 4675 | #[allow(unused_mut)]
|
4866 4676 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4867 4677 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4868 4678 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4869 - | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
4870 - | let sender = sender.clone();
|
4871 - | async move {
|
4872 - | 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> };
|
4873 - | sender.send(()).await.expect("receiver dropped early");
|
4874 - | result
|
4875 - | }
|
4876 - | })
|
4877 - | .build_unchecked();
|
4878 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4879 - | .await
|
4880 - | .expect("unable to make an HTTP request");
|
4881 - | ::pretty_assertions::assert_eq!(
|
4882 - | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4883 - | http_response.status()
|
4884 - | );
|
4885 - | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4886 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4887 - | http_response.headers(),
|
4888 - | expected_headers,
|
4889 - | ));
|
4890 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4891 - | .await
|
4892 - | .expect("unable to extract body to bytes");
|
4893 - | ::aws_smithy_protocol_test::assert_ok(
|
4894 - | ::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"))
|
4895 - | );
|
4896 - | }
|
4897 - | }
|
4898 - |
|
4899 - | /// When the specified pattern is susceptible to ReDOS, the service will not
|
4900 - | /// hang indefinitely while evaluating the pattern
|
4901 - | /// Test ID: RestJsonMalformedPatternReDOSString
|
4902 - | #[::tokio::test]
|
4903 - | #[::tracing_test::traced_test]
|
4904 - | #[should_panic]
|
4905 - | async fn rest_json_malformed_pattern_re_dos_string_malformed_request() {
|
4906 - | {
|
4907 - | #[allow(unused_mut)]
|
4908 - | let mut http_request = ::http::Request::builder()
|
4909 - | .uri("/MalformedPattern")
|
4910 - | .method("POST")
|
4911 - | .header("content-type", "application/json")
|
4912 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
4913 - | ::bytes::Bytes::copy_from_slice(
|
4914 - | &::aws_smithy_protocol_test::decode_body_data("{ \"evilString\" : \"000000000000000000000000000000000000000000000000000000000000000000000000000000000000!\" }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
4915 - | )
|
4916 - | )).unwrap();
|
4917 - | #[allow(unused_mut)]
|
4918 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4919 - | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4920 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4921 - | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
4922 - | let sender = sender.clone();
|
4923 - | async move {
|
4924 - | 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> };
|
4925 - | sender.send(()).await.expect("receiver dropped early");
|
4926 - | result
|
4927 - | }
|
4928 - | })
|
4929 - | .build_unchecked();
|
4930 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4931 - | .await
|
4932 - | .expect("unable to make an HTTP request");
|
4933 - | ::pretty_assertions::assert_eq!(
|
4934 - | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4935 - | http_response.status()
|
4936 - | );
|
4937 - | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4938 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4939 - | http_response.headers(),
|
4940 - | expected_headers,
|
4941 - | ));
|
4942 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4943 - | .await
|
4944 - | .expect("unable to extract body to bytes");
|
4945 - | ::aws_smithy_protocol_test::assert_ok(
|
4946 - | ::aws_smithy_protocol_test::validate_body(&body, "{ \"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\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4947 - | );
|
4948 - | }
|
4949 - | }
|
4950 - |
|
4951 - | /// When the specified pattern is susceptible to ReDOS, the service will not
|
4952 - | /// hang indefinitely while evaluating the pattern
|
4953 - | /// Test ID: RestJsonMalformedPatternReDOSString_hotfixed
|
4954 - | #[::tokio::test]
|
4955 - | #[::tracing_test::traced_test]
|
4956 - | async fn rest_json_malformed_pattern_re_dos_string_hotfixed_malformed_request() {
|
4957 - | {
|
4958 - | #[allow(unused_mut)]
|
4959 - | let mut http_request = ::http::Request::builder()
|
4960 - | .uri("/MalformedPattern")
|
4961 - | .method("POST")
|
4962 - | .header("content-type", "application/json")
|
4963 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
4964 - | ::bytes::Bytes::copy_from_slice(
|
4965 - | &::aws_smithy_protocol_test::decode_body_data("{ \"evilString\" : \"000000000000000000000000000000000000000000000000000000000000000000000000000000000000!\" }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
4966 - | )
|
4967 - | )).unwrap();
|
4968 - | #[allow(unused_mut)]
|
4969 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4970 - | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4971 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4972 - | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
4679 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
4973 4680 | let sender = sender.clone();
|
4974 4681 | async move {
|
4975 - | 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> };
|
4682 + | 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> };
|
4976 4683 | sender.send(()).await.expect("receiver dropped early");
|
4977 4684 | result
|
4978 4685 | }
|
4979 4686 | })
|
4980 4687 | .build_unchecked();
|
4981 4688 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4982 4689 | .await
|
4983 4690 | .expect("unable to make an HTTP request");
|
4984 4691 | ::pretty_assertions::assert_eq!(
|
4985 4692 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4986 4693 | http_response.status()
|
4987 4694 | );
|
4988 4695 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4989 4696 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4990 4697 | http_response.headers(),
|
4991 4698 | expected_headers,
|
4992 4699 | ));
|
4993 4700 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4994 4701 | .await
|
4995 4702 | .expect("unable to extract body to bytes");
|
4996 4703 | ::aws_smithy_protocol_test::assert_ok(
|
4997 - | ::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"))
|
4704 + | ::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"))
|
4998 4705 | );
|
4999 4706 | }
|
5000 4707 | }
|
5001 4708 |
|
5002 - | /// When a list member value does not match the specified pattern,
|
4709 + | /// When a integer member does not fit within range bounds,
|
5003 4710 | /// the response should be a 400 ValidationException.
|
5004 - | /// Test ID: RestJsonMalformedPatternList_case0
|
4711 + | /// Test ID: RestJsonMalformedRangeInteger_case0
|
5005 4712 | #[::tokio::test]
|
5006 4713 | #[::tracing_test::traced_test]
|
5007 - | async fn rest_json_malformed_pattern_list_case0_malformed_request() {
|
4714 + | async fn rest_json_malformed_range_integer_case0_malformed_request() {
|
5008 4715 | {
|
5009 4716 | #[allow(unused_mut)]
|
5010 4717 | let mut http_request = ::http::Request::builder()
|
5011 - | .uri("/MalformedPattern")
|
4718 + | .uri("/MalformedRange")
|
5012 4719 | .method("POST")
|
5013 4720 | .header("content-type", "application/json")
|
5014 4721 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
5015 4722 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5016 - | "{ \"list\" : [\"ABC\"] }".as_bytes(),
|
4723 + | "{ \"integer\" : 1 }".as_bytes(),
|
5017 4724 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5018 4725 | )),
|
5019 4726 | ))
|
5020 4727 | .unwrap();
|
5021 4728 | #[allow(unused_mut)]
|
5022 4729 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5023 4730 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5024 4731 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5025 - | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
4732 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
5026 4733 | let sender = sender.clone();
|
5027 4734 | async move {
|
5028 - | 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> };
|
4735 + | 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> };
|
5029 4736 | sender.send(()).await.expect("receiver dropped early");
|
5030 4737 | result
|
5031 4738 | }
|
5032 4739 | })
|
5033 4740 | .build_unchecked();
|
5034 4741 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5035 4742 | .await
|
5036 4743 | .expect("unable to make an HTTP request");
|
5037 4744 | ::pretty_assertions::assert_eq!(
|
5038 4745 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5039 4746 | http_response.status()
|
5040 4747 | );
|
5041 4748 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5042 4749 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5043 4750 | http_response.headers(),
|
5044 4751 | expected_headers,
|
5045 4752 | ));
|
5046 4753 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5047 4754 | .await
|
5048 4755 | .expect("unable to extract body to bytes");
|
5049 4756 | ::aws_smithy_protocol_test::assert_ok(
|
5050 - | ::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"))
|
4757 + | ::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"))
|
5051 4758 | );
|
5052 4759 | }
|
5053 4760 | }
|
5054 4761 |
|
5055 - | /// When a list member value does not match the specified pattern,
|
4762 + | /// When a integer member does not fit within range bounds,
|
5056 4763 | /// the response should be a 400 ValidationException.
|
5057 - | /// Test ID: RestJsonMalformedPatternList_case1
|
4764 + | /// Test ID: RestJsonMalformedRangeInteger_case1
|
5058 4765 | #[::tokio::test]
|
5059 4766 | #[::tracing_test::traced_test]
|
5060 - | async fn rest_json_malformed_pattern_list_case1_malformed_request() {
|
4767 + | async fn rest_json_malformed_range_integer_case1_malformed_request() {
|
5061 4768 | {
|
5062 4769 | #[allow(unused_mut)]
|
5063 4770 | let mut http_request = ::http::Request::builder()
|
5064 - | .uri("/MalformedPattern")
|
4771 + | .uri("/MalformedRange")
|
5065 4772 | .method("POST")
|
5066 4773 | .header("content-type", "application/json")
|
5067 4774 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
5068 4775 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5069 - | "{ \"list\" : [\"xyz\"] }".as_bytes(),
|
4776 + | "{ \"integer\" : 9 }".as_bytes(),
|
5070 4777 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5071 4778 | )),
|
5072 4779 | ))
|
5073 4780 | .unwrap();
|
5074 4781 | #[allow(unused_mut)]
|
5075 4782 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5076 4783 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5077 4784 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5078 - | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
4785 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
5079 4786 | let sender = sender.clone();
|
5080 4787 | async move {
|
5081 - | 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> };
|
4788 + | 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> };
|
5082 4789 | sender.send(()).await.expect("receiver dropped early");
|
5083 4790 | result
|
5084 4791 | }
|
5085 4792 | })
|
5086 4793 | .build_unchecked();
|
5087 4794 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5088 4795 | .await
|
5089 4796 | .expect("unable to make an HTTP request");
|
5090 4797 | ::pretty_assertions::assert_eq!(
|
5091 4798 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5092 4799 | http_response.status()
|
5093 4800 | );
|
5094 4801 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5095 4802 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5096 4803 | http_response.headers(),
|
5097 4804 | expected_headers,
|
5098 4805 | ));
|
5099 4806 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5100 4807 | .await
|
5101 4808 | .expect("unable to extract body to bytes");
|
5102 4809 | ::aws_smithy_protocol_test::assert_ok(
|
5103 - | ::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"))
|
4810 + | ::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"))
|
5104 4811 | );
|
5105 4812 | }
|
5106 4813 | }
|
5107 4814 |
|
5108 - | /// When a map member's key does not match the specified pattern,
|
4815 + | /// When a integer member does not fit within range bounds,
|
5109 4816 | /// the response should be a 400 ValidationException.
|
5110 - | /// Test ID: RestJsonMalformedPatternMapKey_case0
|
4817 + | /// Test ID: RestJsonMalformedRangeMinInteger
|
5111 4818 | #[::tokio::test]
|
5112 4819 | #[::tracing_test::traced_test]
|
5113 - | async fn rest_json_malformed_pattern_map_key_case0_malformed_request() {
|
4820 + | async fn rest_json_malformed_range_min_integer_malformed_request() {
|
5114 4821 | {
|
5115 4822 | #[allow(unused_mut)]
|
5116 4823 | let mut http_request = ::http::Request::builder()
|
5117 - | .uri("/MalformedPattern")
|
4824 + | .uri("/MalformedRange")
|
5118 4825 | .method("POST")
|
5119 4826 | .header("content-type", "application/json")
|
5120 4827 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
5121 4828 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5122 - | "{ \"map\" : { \"ABC\" : \"abc\" } }".as_bytes(),
|
4829 + | "{ \"minInteger\" : 1 }".as_bytes(),
|
5123 4830 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5124 4831 | )),
|
5125 4832 | ))
|
5126 4833 | .unwrap();
|
5127 4834 | #[allow(unused_mut)]
|
5128 4835 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5129 4836 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5130 4837 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5131 - | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
4838 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
5132 4839 | let sender = sender.clone();
|
5133 4840 | async move {
|
5134 - | 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> };
|
4841 + | 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> };
|
5135 4842 | sender.send(()).await.expect("receiver dropped early");
|
5136 4843 | result
|
5137 4844 | }
|
5138 4845 | })
|
5139 4846 | .build_unchecked();
|
5140 4847 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5141 4848 | .await
|
5142 4849 | .expect("unable to make an HTTP request");
|
5143 4850 | ::pretty_assertions::assert_eq!(
|
5144 4851 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5145 4852 | http_response.status()
|
5146 4853 | );
|
5147 4854 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5148 4855 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5149 4856 | http_response.headers(),
|
5150 4857 | expected_headers,
|
5151 4858 | ));
|
5152 4859 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5153 4860 | .await
|
5154 4861 | .expect("unable to extract body to bytes");
|
5155 4862 | ::aws_smithy_protocol_test::assert_ok(
|
5156 - | ::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"))
|
4863 + | ::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"))
|
5157 4864 | );
|
5158 4865 | }
|
5159 4866 | }
|
5160 4867 |
|
5161 - | /// When a map member's key does not match the specified pattern,
|
4868 + | /// When a integer member does not fit within range bounds,
|
5162 4869 | /// the response should be a 400 ValidationException.
|
5163 - | /// Test ID: RestJsonMalformedPatternMapKey_case1
|
4870 + | /// Test ID: RestJsonMalformedRangeMaxInteger
|
5164 4871 | #[::tokio::test]
|
5165 4872 | #[::tracing_test::traced_test]
|
5166 - | async fn rest_json_malformed_pattern_map_key_case1_malformed_request() {
|
4873 + | async fn rest_json_malformed_range_max_integer_malformed_request() {
|
5167 4874 | {
|
5168 4875 | #[allow(unused_mut)]
|
5169 4876 | let mut http_request = ::http::Request::builder()
|
5170 - | .uri("/MalformedPattern")
|
4877 + | .uri("/MalformedRange")
|
5171 4878 | .method("POST")
|
5172 4879 | .header("content-type", "application/json")
|
5173 4880 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
5174 4881 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5175 - | "{ \"map\" : { \"xyz\" : \"abc\" } }".as_bytes(),
|
4882 + | "{ \"maxInteger\" : 9 }".as_bytes(),
|
5176 4883 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5177 4884 | )),
|
5178 4885 | ))
|
5179 4886 | .unwrap();
|
5180 4887 | #[allow(unused_mut)]
|
5181 4888 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5182 4889 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5183 4890 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5184 - | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
4891 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
5185 4892 | let sender = sender.clone();
|
5186 4893 | async move {
|
5187 - | 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> };
|
4894 + | 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> };
|
5188 4895 | sender.send(()).await.expect("receiver dropped early");
|
5189 4896 | result
|
5190 4897 | }
|
5191 4898 | })
|
5192 4899 | .build_unchecked();
|
5193 4900 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5194 4901 | .await
|
5195 4902 | .expect("unable to make an HTTP request");
|
5196 4903 | ::pretty_assertions::assert_eq!(
|
5197 4904 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5198 4905 | http_response.status()
|
5199 4906 | );
|
5200 4907 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5201 4908 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5202 4909 | http_response.headers(),
|
5203 4910 | expected_headers,
|
5204 4911 | ));
|
5205 4912 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5206 4913 | .await
|
5207 4914 | .expect("unable to extract body to bytes");
|
5208 4915 | ::aws_smithy_protocol_test::assert_ok(
|
5209 - | ::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"))
|
4916 + | ::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"))
|
5210 4917 | );
|
5211 4918 | }
|
5212 4919 | }
|
5213 4920 |
|
5214 - | /// When a map member's value does not match the specified pattern,
|
4921 + | /// When a long member does not fit within range bounds,
|
5215 4922 | /// the response should be a 400 ValidationException.
|
5216 - | /// Test ID: RestJsonMalformedPatternMapValue_case0
|
4923 + | /// Test ID: RestJsonMalformedRangeLong_case0
|
5217 4924 | #[::tokio::test]
|
5218 4925 | #[::tracing_test::traced_test]
|
5219 - | async fn rest_json_malformed_pattern_map_value_case0_malformed_request() {
|
4926 + | async fn rest_json_malformed_range_long_case0_malformed_request() {
|
5220 4927 | {
|
5221 4928 | #[allow(unused_mut)]
|
5222 4929 | let mut http_request = ::http::Request::builder()
|
5223 - | .uri("/MalformedPattern")
|
4930 + | .uri("/MalformedRange")
|
5224 4931 | .method("POST")
|
5225 4932 | .header("content-type", "application/json")
|
5226 4933 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
5227 4934 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5228 - | "{ \"map\" : { \"abc\": \"ABC\" } }".as_bytes(),
|
4935 + | "{ \"long\" : 1 }".as_bytes(),
|
5229 4936 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5230 4937 | )),
|
5231 4938 | ))
|
5232 4939 | .unwrap();
|
5233 4940 | #[allow(unused_mut)]
|
5234 4941 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5235 4942 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5236 4943 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5237 - | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
4944 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
5238 4945 | let sender = sender.clone();
|
5239 4946 | async move {
|
5240 - | 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> };
|
4947 + | 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> };
|
5241 4948 | sender.send(()).await.expect("receiver dropped early");
|
5242 4949 | result
|
5243 4950 | }
|
5244 4951 | })
|
5245 4952 | .build_unchecked();
|
5246 4953 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5247 4954 | .await
|
5248 4955 | .expect("unable to make an HTTP request");
|
5249 4956 | ::pretty_assertions::assert_eq!(
|
5250 4957 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5251 4958 | http_response.status()
|
5252 4959 | );
|
5253 4960 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5254 4961 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5255 4962 | http_response.headers(),
|
5256 4963 | expected_headers,
|
5257 4964 | ));
|
5258 4965 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5259 4966 | .await
|
5260 4967 | .expect("unable to extract body to bytes");
|
5261 4968 | ::aws_smithy_protocol_test::assert_ok(
|
5262 - | ::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"))
|
4969 + | ::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"))
|
5263 4970 | );
|
5264 4971 | }
|
5265 4972 | }
|
5266 4973 |
|
5267 - | /// When a map member's value does not match the specified pattern,
|
4974 + | /// When a long member does not fit within range bounds,
|
5268 4975 | /// the response should be a 400 ValidationException.
|
5269 - | /// Test ID: RestJsonMalformedPatternMapValue_case1
|
4976 + | /// Test ID: RestJsonMalformedRangeLong_case1
|
5270 4977 | #[::tokio::test]
|
5271 4978 | #[::tracing_test::traced_test]
|
5272 - | async fn rest_json_malformed_pattern_map_value_case1_malformed_request() {
|
4979 + | async fn rest_json_malformed_range_long_case1_malformed_request() {
|
5273 4980 | {
|
5274 4981 | #[allow(unused_mut)]
|
5275 4982 | let mut http_request = ::http::Request::builder()
|
5276 - | .uri("/MalformedPattern")
|
4983 + | .uri("/MalformedRange")
|
5277 4984 | .method("POST")
|
5278 4985 | .header("content-type", "application/json")
|
5279 4986 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
5280 4987 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5281 - | "{ \"map\" : { \"abc\": \"xyz\" } }".as_bytes(),
|
4988 + | "{ \"long\" : 9 }".as_bytes(),
|
5282 4989 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5283 4990 | )),
|
5284 4991 | ))
|
5285 4992 | .unwrap();
|
5286 4993 | #[allow(unused_mut)]
|
5287 4994 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5288 4995 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5289 4996 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5290 - | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
4997 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
5291 4998 | let sender = sender.clone();
|
5292 4999 | async move {
|
5293 - | 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> };
|
5000 + | 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> };
|
5294 5001 | sender.send(()).await.expect("receiver dropped early");
|
5295 5002 | result
|
5296 5003 | }
|
5297 5004 | })
|
5298 5005 | .build_unchecked();
|
5299 5006 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5300 5007 | .await
|
5301 5008 | .expect("unable to make an HTTP request");
|
5302 5009 | ::pretty_assertions::assert_eq!(
|
5303 5010 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5304 5011 | http_response.status()
|
5305 5012 | );
|
5306 5013 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5307 5014 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5308 5015 | http_response.headers(),
|
5309 5016 | expected_headers,
|
5310 5017 | ));
|
5311 5018 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5312 5019 | .await
|
5313 5020 | .expect("unable to extract body to bytes");
|
5314 5021 | ::aws_smithy_protocol_test::assert_ok(
|
5315 - | ::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"))
|
5022 + | ::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"))
|
5316 5023 | );
|
5317 5024 | }
|
5318 5025 | }
|
5319 5026 |
|
5320 - | /// When a union member's value does not match the specified pattern,
|
5027 + | /// When a long member does not fit within range bounds,
|
5321 5028 | /// the response should be a 400 ValidationException.
|
5322 - | /// Test ID: RestJsonMalformedPatternUnion_case0
|
5029 + | /// Test ID: RestJsonMalformedRangeMinLong
|
5323 5030 | #[::tokio::test]
|
5324 5031 | #[::tracing_test::traced_test]
|
5325 - | async fn rest_json_malformed_pattern_union_case0_malformed_request() {
|
5032 + | async fn rest_json_malformed_range_min_long_malformed_request() {
|
5326 5033 | {
|
5327 5034 | #[allow(unused_mut)]
|
5328 5035 | let mut http_request = ::http::Request::builder()
|
5329 - | .uri("/MalformedPattern")
|
5036 + | .uri("/MalformedRange")
|
5330 5037 | .method("POST")
|
5331 5038 | .header("content-type", "application/json")
|
5332 5039 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
5333 5040 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5334 - | "{ \"union\" : { \"first\": \"ABC\" } }".as_bytes(),
|
5041 + | "{ \"minLong\" : 1 }".as_bytes(),
|
5335 5042 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5336 5043 | )),
|
5337 5044 | ))
|
5338 5045 | .unwrap();
|
5339 5046 | #[allow(unused_mut)]
|
5340 5047 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5341 5048 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5342 5049 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5343 - | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
5050 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
5344 5051 | let sender = sender.clone();
|
5345 5052 | async move {
|
5346 - | 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> };
|
5053 + | 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> };
|
5347 5054 | sender.send(()).await.expect("receiver dropped early");
|
5348 5055 | result
|
5349 5056 | }
|
5350 5057 | })
|
5351 5058 | .build_unchecked();
|
5352 5059 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5353 5060 | .await
|
5354 5061 | .expect("unable to make an HTTP request");
|
5355 5062 | ::pretty_assertions::assert_eq!(
|
5356 5063 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5357 5064 | http_response.status()
|
5358 5065 | );
|
5359 5066 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5360 5067 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5361 5068 | http_response.headers(),
|
5362 5069 | expected_headers,
|
5363 5070 | ));
|
5364 5071 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5365 5072 | .await
|
5366 5073 | .expect("unable to extract body to bytes");
|
5367 5074 | ::aws_smithy_protocol_test::assert_ok(
|
5368 - | ::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"))
|
5075 + | ::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"))
|
5369 5076 | );
|
5370 5077 | }
|
5371 5078 | }
|
5372 5079 |
|
5373 - | /// When a union member's value does not match the specified pattern,
|
5080 + | /// When a long member does not fit within range bounds,
|
5374 5081 | /// the response should be a 400 ValidationException.
|
5375 - | /// Test ID: RestJsonMalformedPatternUnion_case1
|
5082 + | /// Test ID: RestJsonMalformedRangeMaxLong
|
5376 5083 | #[::tokio::test]
|
5377 5084 | #[::tracing_test::traced_test]
|
5378 - | async fn rest_json_malformed_pattern_union_case1_malformed_request() {
|
5085 + | async fn rest_json_malformed_range_max_long_malformed_request() {
|
5379 5086 | {
|
5380 5087 | #[allow(unused_mut)]
|
5381 5088 | let mut http_request = ::http::Request::builder()
|
5382 - | .uri("/MalformedPattern")
|
5089 + | .uri("/MalformedRange")
|
5383 5090 | .method("POST")
|
5384 5091 | .header("content-type", "application/json")
|
5385 5092 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
5386 5093 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5387 - | "{ \"union\" : { \"first\": \"xyz\" } }".as_bytes(),
|
5094 + | "{ \"maxLong\" : 9 }".as_bytes(),
|
5388 5095 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5389 5096 | )),
|
5390 5097 | ))
|
5391 5098 | .unwrap();
|
5392 5099 | #[allow(unused_mut)]
|
5393 5100 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5394 5101 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5395 5102 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5396 - | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
5103 + | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
5397 5104 | let sender = sender.clone();
|
5398 5105 | async move {
|
5399 - | 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> };
|
5106 + | 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> };
|
5400 5107 | sender.send(()).await.expect("receiver dropped early");
|
5401 5108 | result
|
5402 5109 | }
|
5403 5110 | })
|
5404 5111 | .build_unchecked();
|
5405 5112 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5406 5113 | .await
|
5407 5114 | .expect("unable to make an HTTP request");
|
5408 5115 | ::pretty_assertions::assert_eq!(
|
5409 5116 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5410 5117 | http_response.status()
|
5411 5118 | );
|
5412 5119 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5413 5120 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5414 5121 | http_response.headers(),
|
5415 5122 | expected_headers,
|
5416 5123 | ));
|
5417 5124 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5418 5125 | .await
|
5419 5126 | .expect("unable to extract body to bytes");
|
5420 5127 | ::aws_smithy_protocol_test::assert_ok(
|
5421 - | ::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"))
|
5128 + | ::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"))
|
5422 5129 | );
|
5423 5130 | }
|
5424 5131 | }
|
5425 5132 | }
|
5426 5133 |
|
5427 5134 | ::pin_project_lite::pin_project! {
|
5428 5135 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
5429 - | /// [`MalformedLengthQueryStringInput`](crate::input::MalformedLengthQueryStringInput) using modelled bindings.
|
5430 - | pub struct MalformedLengthQueryStringInputFuture {
|
5431 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedLengthQueryStringInput, ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
5136 + | /// [`MalformedRangeOverrideInput`](crate::input::MalformedRangeOverrideInput) using modelled bindings.
|
5137 + | pub struct MalformedRangeOverrideInputFuture {
|
5138 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedRangeOverrideInput, ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
5432 5139 | }
|
5433 5140 | }
|
5434 5141 |
|
5435 - | impl std::future::Future for MalformedLengthQueryStringInputFuture {
|
5142 + | impl std::future::Future for MalformedRangeOverrideInputFuture {
|
5436 5143 | type Output = Result<
|
5437 - | crate::input::MalformedLengthQueryStringInput,
|
5144 + | crate::input::MalformedRangeOverrideInput,
|
5438 5145 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
5439 5146 | >;
|
5440 5147 |
|
5441 5148 | fn poll(
|
5442 5149 | self: std::pin::Pin<&mut Self>,
|
5443 5150 | cx: &mut std::task::Context<'_>,
|
5444 5151 | ) -> std::task::Poll<Self::Output> {
|
5445 5152 | let this = self.project();
|
5446 5153 | this.inner.as_mut().poll(cx)
|
5447 5154 | }
|
5448 5155 | }
|
5449 5156 |
|
5450 5157 | impl<B>
|
5451 5158 | ::aws_smithy_legacy_http_server::request::FromRequest<
|
5452 5159 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
5453 5160 | B,
|
5454 - | > for crate::input::MalformedLengthQueryStringInput
|
5161 + | > for crate::input::MalformedRangeOverrideInput
|
5455 5162 | where
|
5456 5163 | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
5457 5164 | B: 'static,
|
5458 5165 |
|
5459 5166 | B::Data: Send,
|
5460 5167 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
5461 5168 | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
5462 5169 | {
|
5463 5170 | type Rejection =
|
5464 5171 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
5465 - | type Future = MalformedLengthQueryStringInputFuture;
|
5172 + | type Future = MalformedRangeOverrideInputFuture;
|
5466 5173 |
|
5467 5174 | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
5468 5175 | let fut = async move {
|
5469 5176 | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
5470 5177 | request.headers(),
|
5471 5178 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
5472 5179 | ) {
|
5473 5180 | return Err(::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
5474 5181 | }
|
5475 - | crate::protocol_serde::shape_malformed_length_query_string::de_malformed_length_query_string_http_request(request)
|
5182 + | crate::protocol_serde::shape_malformed_range_override::de_malformed_range_override_http_request(request)
|
5476 5183 | .await
|
5477 5184 | };
|
5478 5185 | use ::futures_util::future::TryFutureExt;
|
5479 5186 | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
5480 5187 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
5481 5188 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e)
|
5482 5189 | });
|
5483 - | MalformedLengthQueryStringInputFuture {
|
5190 + | MalformedRangeOverrideInputFuture {
|
5484 5191 | inner: Box::pin(fut),
|
5485 5192 | }
|
5486 5193 | }
|
5487 5194 | }
|
5488 5195 | impl
|
5489 5196 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
5490 5197 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
5491 - | > for crate::output::MalformedLengthQueryStringOutput
|
5198 + | > for crate::output::MalformedRangeOverrideOutput
|
5492 5199 | {
|
5493 5200 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
5494 - | match crate::protocol_serde::shape_malformed_length_query_string::ser_malformed_length_query_string_http_response(self) {
|
5201 + | match crate::protocol_serde::shape_malformed_range_override::ser_malformed_range_override_http_response(self) {
|
5495 5202 | Ok(response) => response,
|
5496 5203 | Err(e) => {
|
5497 5204 | ::tracing::error!(error = %e, "failed to serialize response");
|
5498 5205 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
5499 5206 | }
|
5500 5207 | }
|
5501 5208 | }
|
5502 5209 | }
|
5503 5210 | impl
|
5504 5211 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
5505 5212 | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
5506 - | > for crate::error::MalformedLengthQueryStringError
|
5213 + | > for crate::error::MalformedRangeOverrideError
|
5507 5214 | {
|
5508 5215 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
5509 - | match crate::protocol_serde::shape_malformed_length_query_string::ser_malformed_length_query_string_http_error(&self) {
|
5216 + | match crate::protocol_serde::shape_malformed_range_override::ser_malformed_range_override_http_error(&self) {
|
5510 5217 | Ok(mut response) => {
|
5511 5218 | response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
5512 5219 | response
|
5513 5220 | },
|
5514 5221 | Err(e) => {
|
5515 5222 | ::tracing::error!(error = %e, "failed to serialize response");
|
5516 5223 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
5517 5224 | }
|
5518 5225 | }
|
5519 5226 | }
|
5520 5227 | }
|
5521 5228 |
|
5522 5229 | #[allow(unreachable_code, unused_variables)]
|
5523 5230 | #[cfg(test)]
|
5524 - | mod malformed_length_query_string_test {
|
5231 + | mod malformed_range_override_test {
|
5525 5232 |
|
5526 - | /// When a required member has no value in the query string,
|
5233 + | /// When a byte member does not fit within range bounds,
|
5527 5234 | /// the response should be a 400 ValidationException.
|
5528 - | /// Test ID: RestJsonMalformedLengthQueryStringNoValue
|
5235 + | /// Test ID: RestJsonMalformedRangeByteOverride_case0
|
5529 5236 | #[::tokio::test]
|
5530 5237 | #[::tracing_test::traced_test]
|
5531 - | async fn rest_json_malformed_length_query_string_no_value_malformed_request() {
|
5238 + | async fn rest_json_malformed_range_byte_override_case0_malformed_request() {
|
5532 5239 | {
|
5533 5240 | #[allow(unused_mut)]
|
5534 5241 | let mut http_request = ::http::Request::builder()
|
5535 - | .uri("/MalformedLengthQueryString")
|
5242 + | .uri("/MalformedRangeOverride")
|
5536 5243 | .method("POST")
|
5244 + | .header("content-type", "application/json")
|
5537 5245 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
5538 5246 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5539 - | "{}".as_bytes(),
|
5247 + | "{ \"byte\" : 3 }".as_bytes(),
|
5540 5248 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5541 5249 | )),
|
5542 5250 | ))
|
5543 5251 | .unwrap();
|
5544 - | *http_request.uri_mut() = "/MalformedLengthQueryString?string".parse().unwrap();
|
5545 5252 | #[allow(unused_mut)]
|
5546 5253 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5547 5254 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5548 5255 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5549 - | .malformed_length_query_string(move |input: crate::input::MalformedLengthQueryStringInput| {
|
5256 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
5550 5257 | let sender = sender.clone();
|
5551 5258 | async move {
|
5552 - | 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> };
|
5259 + | 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> };
|
5553 5260 | sender.send(()).await.expect("receiver dropped early");
|
5554 5261 | result
|
5555 5262 | }
|
5556 5263 | })
|
5557 5264 | .build_unchecked();
|
5558 5265 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5559 5266 | .await
|
5560 5267 | .expect("unable to make an HTTP request");
|
5561 5268 | ::pretty_assertions::assert_eq!(
|
5562 5269 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5563 5270 | http_response.status()
|
5564 5271 | );
|
5565 5272 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5566 5273 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5567 5274 | http_response.headers(),
|
5568 5275 | expected_headers,
|
5569 5276 | ));
|
5570 5277 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5571 5278 | .await
|
5572 5279 | .expect("unable to extract body to bytes");
|
5573 5280 | ::aws_smithy_protocol_test::assert_ok(
|
5574 - | ::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"))
|
5281 + | ::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"))
|
5575 5282 | );
|
5576 5283 | }
|
5577 5284 | }
|
5578 - | }
|
5579 - |
|
5580 - | ::pin_project_lite::pin_project! {
|
5581 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
5582 - | /// [`MalformedLengthOverrideInput`](crate::input::MalformedLengthOverrideInput) using modelled bindings.
|
5583 - | pub struct MalformedLengthOverrideInputFuture {
|
5584 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedLengthOverrideInput, ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
5585 - | }
|
5586 - | }
|
5587 - |
|
5588 - | impl std::future::Future for MalformedLengthOverrideInputFuture {
|
5589 - | type Output = Result<
|
5590 - | crate::input::MalformedLengthOverrideInput,
|
5591 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
5592 - | >;
|
5593 - |
|
5594 - | fn poll(
|
5595 - | self: std::pin::Pin<&mut Self>,
|
5596 - | cx: &mut std::task::Context<'_>,
|
5597 - | ) -> std::task::Poll<Self::Output> {
|
5598 - | let this = self.project();
|
5599 - | this.inner.as_mut().poll(cx)
|
5600 - | }
|
5601 - | }
|
5602 - |
|
5603 - | impl<B>
|
5604 - | ::aws_smithy_legacy_http_server::request::FromRequest<
|
5605 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
5606 - | B,
|
5607 - | > for crate::input::MalformedLengthOverrideInput
|
5608 - | where
|
5609 - | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
5610 - | B: 'static,
|
5611 - |
|
5612 - | B::Data: Send,
|
5613 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
5614 - | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
5615 - | {
|
5616 - | type Rejection =
|
5617 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
5618 - | type Future = MalformedLengthOverrideInputFuture;
|
5619 - |
|
5620 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
5621 - | let fut = async move {
|
5622 - | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
5623 - | request.headers(),
|
5624 - | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
5625 - | ) {
|
5626 - | return Err(::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
5627 - | }
|
5628 - | crate::protocol_serde::shape_malformed_length_override::de_malformed_length_override_http_request(request)
|
5629 - | .await
|
5630 - | };
|
5631 - | use ::futures_util::future::TryFutureExt;
|
5632 - | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
5633 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
5634 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e)
|
5635 - | });
|
5636 - | MalformedLengthOverrideInputFuture {
|
5637 - | inner: Box::pin(fut),
|
5638 - | }
|
5639 - | }
|
5640 - | }
|
5641 - | impl
|
5642 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
5643 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
5644 - | > for crate::output::MalformedLengthOverrideOutput
|
5645 - | {
|
5646 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
5647 - | match crate::protocol_serde::shape_malformed_length_override::ser_malformed_length_override_http_response(self) {
|
5648 - | Ok(response) => response,
|
5649 - | Err(e) => {
|
5650 - | ::tracing::error!(error = %e, "failed to serialize response");
|
5651 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
5652 - | }
|
5653 - | }
|
5654 - | }
|
5655 - | }
|
5656 - | impl
|
5657 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
5658 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
5659 - | > for crate::error::MalformedLengthOverrideError
|
5660 - | {
|
5661 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
5662 - | match crate::protocol_serde::shape_malformed_length_override::ser_malformed_length_override_http_error(&self) {
|
5663 - | Ok(mut response) => {
|
5664 - | response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
5665 - | response
|
5666 - | },
|
5667 - | Err(e) => {
|
5668 - | ::tracing::error!(error = %e, "failed to serialize response");
|
5669 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
5670 - | }
|
5671 - | }
|
5672 - | }
|
5673 - | }
|
5674 - |
|
5675 - | #[allow(unreachable_code, unused_variables)]
|
5676 - | #[cfg(test)]
|
5677 - | mod malformed_length_override_test {
|
5678 5285 |
|
5679 - | /// When a blob member does not fit within length bounds,
|
5286 + | /// When a byte member does not fit within range bounds,
|
5680 5287 | /// the response should be a 400 ValidationException.
|
5681 - | /// Test ID: RestJsonMalformedLengthBlobOverride_case0
|
5288 + | /// Test ID: RestJsonMalformedRangeByteOverride_case1
|
5682 5289 | #[::tokio::test]
|
5683 5290 | #[::tracing_test::traced_test]
|
5684 - | async fn rest_json_malformed_length_blob_override_case0_malformed_request() {
|
5291 + | async fn rest_json_malformed_range_byte_override_case1_malformed_request() {
|
5685 5292 | {
|
5686 5293 | #[allow(unused_mut)]
|
5687 5294 | let mut http_request = ::http::Request::builder()
|
5688 - | .uri("/MalformedLengthOverride")
|
5295 + | .uri("/MalformedRangeOverride")
|
5689 5296 | .method("POST")
|
5690 5297 | .header("content-type", "application/json")
|
5691 5298 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
5692 5299 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5693 - | "{ \"blob\" : \"YWJj\" }".as_bytes(),
|
5300 + | "{ \"byte\" : 7 }".as_bytes(),
|
5694 5301 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5695 5302 | )),
|
5696 5303 | ))
|
5697 5304 | .unwrap();
|
5698 5305 | #[allow(unused_mut)]
|
5699 5306 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5700 5307 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5701 5308 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5702 - | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
5309 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
5703 5310 | let sender = sender.clone();
|
5704 5311 | async move {
|
5705 - | 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> };
|
5312 + | 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> };
|
5706 5313 | sender.send(()).await.expect("receiver dropped early");
|
5707 5314 | result
|
5708 5315 | }
|
5709 5316 | })
|
5710 5317 | .build_unchecked();
|
5711 5318 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5712 5319 | .await
|
5713 5320 | .expect("unable to make an HTTP request");
|
5714 5321 | ::pretty_assertions::assert_eq!(
|
5715 5322 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5716 5323 | http_response.status()
|
5717 5324 | );
|
5718 5325 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5719 5326 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5720 5327 | http_response.headers(),
|
5721 5328 | expected_headers,
|
5722 5329 | ));
|
5723 5330 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5724 5331 | .await
|
5725 5332 | .expect("unable to extract body to bytes");
|
5726 5333 | ::aws_smithy_protocol_test::assert_ok(
|
5727 - | ::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"))
|
5334 + | ::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"))
|
5728 5335 | );
|
5729 5336 | }
|
5730 5337 | }
|
5731 5338 |
|
5732 - | /// When a blob member does not fit within length bounds,
|
5339 + | /// When a byte member does not fit within range bounds,
|
5733 5340 | /// the response should be a 400 ValidationException.
|
5734 - | /// Test ID: RestJsonMalformedLengthBlobOverride_case1
|
5341 + | /// Test ID: RestJsonMalformedRangeMinByteOverride
|
5735 5342 | #[::tokio::test]
|
5736 5343 | #[::tracing_test::traced_test]
|
5737 - | async fn rest_json_malformed_length_blob_override_case1_malformed_request() {
|
5344 + | async fn rest_json_malformed_range_min_byte_override_malformed_request() {
|
5738 5345 | {
|
5739 5346 | #[allow(unused_mut)]
|
5740 5347 | let mut http_request = ::http::Request::builder()
|
5741 - | .uri("/MalformedLengthOverride")
|
5348 + | .uri("/MalformedRangeOverride")
|
5742 5349 | .method("POST")
|
5743 5350 | .header("content-type", "application/json")
|
5744 5351 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
5745 5352 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5746 - | "{ \"blob\" : \"YWJjZGVmZw==\" }".as_bytes(),
|
5353 + | "{ \"minByte\" : 3 }".as_bytes(),
|
5747 5354 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5748 5355 | )),
|
5749 5356 | ))
|
5750 5357 | .unwrap();
|
5751 5358 | #[allow(unused_mut)]
|
5752 5359 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5753 5360 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5754 5361 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5755 - | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
5362 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
5756 5363 | let sender = sender.clone();
|
5757 5364 | async move {
|
5758 - | 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> };
|
5365 + | 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> };
|
5759 5366 | sender.send(()).await.expect("receiver dropped early");
|
5760 5367 | result
|
5761 5368 | }
|
5762 5369 | })
|
5763 5370 | .build_unchecked();
|
5764 5371 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5765 5372 | .await
|
5766 5373 | .expect("unable to make an HTTP request");
|
5767 5374 | ::pretty_assertions::assert_eq!(
|
5768 5375 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5769 5376 | http_response.status()
|
5770 5377 | );
|
5771 5378 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5772 5379 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5773 5380 | http_response.headers(),
|
5774 5381 | expected_headers,
|
5775 5382 | ));
|
5776 5383 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5777 5384 | .await
|
5778 5385 | .expect("unable to extract body to bytes");
|
5779 5386 | ::aws_smithy_protocol_test::assert_ok(
|
5780 - | ::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"))
|
5387 + | ::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"))
|
5781 5388 | );
|
5782 5389 | }
|
5783 5390 | }
|
5784 5391 |
|
5785 - | /// When a string member does not fit within length bounds,
|
5392 + | /// When a byte member does not fit within range bounds,
|
5786 5393 | /// the response should be a 400 ValidationException.
|
5787 - | /// Test ID: RestJsonMalformedLengthStringOverride_case0
|
5394 + | /// Test ID: RestJsonMalformedRangeMaxByteOverride
|
5788 5395 | #[::tokio::test]
|
5789 5396 | #[::tracing_test::traced_test]
|
5790 - | async fn rest_json_malformed_length_string_override_case0_malformed_request() {
|
5397 + | async fn rest_json_malformed_range_max_byte_override_malformed_request() {
|
5791 5398 | {
|
5792 5399 | #[allow(unused_mut)]
|
5793 5400 | let mut http_request = ::http::Request::builder()
|
5794 - | .uri("/MalformedLengthOverride")
|
5401 + | .uri("/MalformedRangeOverride")
|
5795 5402 | .method("POST")
|
5796 5403 | .header("content-type", "application/json")
|
5797 5404 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
5798 5405 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5799 - | "{ \"string\" : \"abc\" }".as_bytes(),
|
5406 + | "{ \"maxByte\" : 7 }".as_bytes(),
|
5800 5407 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5801 5408 | )),
|
5802 5409 | ))
|
5803 5410 | .unwrap();
|
5804 5411 | #[allow(unused_mut)]
|
5805 5412 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5806 5413 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5807 5414 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5808 - | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
5415 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
5809 5416 | let sender = sender.clone();
|
5810 5417 | async move {
|
5811 - | 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> };
|
5418 + | 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> };
|
5812 5419 | sender.send(()).await.expect("receiver dropped early");
|
5813 5420 | result
|
5814 5421 | }
|
5815 5422 | })
|
5816 5423 | .build_unchecked();
|
5817 5424 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5818 5425 | .await
|
5819 5426 | .expect("unable to make an HTTP request");
|
5820 5427 | ::pretty_assertions::assert_eq!(
|
5821 5428 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5822 5429 | http_response.status()
|
5823 5430 | );
|
5824 5431 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5825 5432 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5826 5433 | http_response.headers(),
|
5827 5434 | expected_headers,
|
5828 5435 | ));
|
5829 5436 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5830 5437 | .await
|
5831 5438 | .expect("unable to extract body to bytes");
|
5832 5439 | ::aws_smithy_protocol_test::assert_ok(
|
5833 - | ::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"))
|
5440 + | ::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"))
|
5834 5441 | );
|
5835 5442 | }
|
5836 5443 | }
|
5837 5444 |
|
5838 - | /// When a string member does not fit within length bounds,
|
5445 + | /// When a float member does not fit within range bounds,
|
5839 5446 | /// the response should be a 400 ValidationException.
|
5840 - | /// Test ID: RestJsonMalformedLengthStringOverride_case1
|
5447 + | /// Test ID: RestJsonMalformedRangeFloatOverride_case0
|
5841 5448 | #[::tokio::test]
|
5842 5449 | #[::tracing_test::traced_test]
|
5843 - | async fn rest_json_malformed_length_string_override_case1_malformed_request() {
|
5450 + | #[should_panic]
|
5451 + | async fn rest_json_malformed_range_float_override_case0_malformed_request() {
|
5844 5452 | {
|
5845 5453 | #[allow(unused_mut)]
|
5846 5454 | let mut http_request = ::http::Request::builder()
|
5847 - | .uri("/MalformedLengthOverride")
|
5455 + | .uri("/MalformedRangeOverride")
|
5848 5456 | .method("POST")
|
5849 5457 | .header("content-type", "application/json")
|
5850 5458 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
5851 5459 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5852 - | "{ \"string\" : \"abcdefg\" }".as_bytes(),
|
5460 + | "{ \"float\" : 4.3 }".as_bytes(),
|
5853 5461 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5854 5462 | )),
|
5855 5463 | ))
|
5856 5464 | .unwrap();
|
5857 5465 | #[allow(unused_mut)]
|
5858 5466 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5859 5467 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5860 5468 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5861 - | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
5469 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
5862 5470 | let sender = sender.clone();
|
5863 5471 | async move {
|
5864 - | 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> };
|
5472 + | 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> };
|
5865 5473 | sender.send(()).await.expect("receiver dropped early");
|
5866 5474 | result
|
5867 5475 | }
|
5868 5476 | })
|
5869 5477 | .build_unchecked();
|
5870 5478 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5871 5479 | .await
|
5872 5480 | .expect("unable to make an HTTP request");
|
5873 5481 | ::pretty_assertions::assert_eq!(
|
5874 5482 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5875 5483 | http_response.status()
|
5876 5484 | );
|
5877 5485 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5878 5486 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5879 5487 | http_response.headers(),
|
5880 5488 | expected_headers,
|
5881 5489 | ));
|
5882 5490 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5883 5491 | .await
|
5884 5492 | .expect("unable to extract body to bytes");
|
5885 5493 | ::aws_smithy_protocol_test::assert_ok(
|
5886 - | ::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"))
|
5494 + | ::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"))
|
5887 5495 | );
|
5888 5496 | }
|
5889 5497 | }
|
5890 5498 |
|
5891 - | /// When a string member does not fit within length bounds,
|
5499 + | /// When a float member does not fit within range bounds,
|
5892 5500 | /// the response should be a 400 ValidationException.
|
5893 - | /// Test ID: RestJsonMalformedLengthStringOverride_case2
|
5501 + | /// Test ID: RestJsonMalformedRangeFloatOverride_case1
|
5894 5502 | #[::tokio::test]
|
5895 5503 | #[::tracing_test::traced_test]
|
5896 - | async fn rest_json_malformed_length_string_override_case2_malformed_request() {
|
5504 + | #[should_panic]
|
5505 + | async fn rest_json_malformed_range_float_override_case1_malformed_request() {
|
5897 5506 | {
|
5898 5507 | #[allow(unused_mut)]
|
5899 5508 | let mut http_request = ::http::Request::builder()
|
5900 - | .uri("/MalformedLengthOverride")
|
5509 + | .uri("/MalformedRangeOverride")
|
5901 5510 | .method("POST")
|
5902 5511 | .header("content-type", "application/json")
|
5903 5512 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
5904 5513 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5905 - | "{ \"string\" : \"👍👍👍\" }".as_bytes(),
|
5514 + | "{ \"float\" : 6.7 }".as_bytes(),
|
5906 5515 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5907 5516 | )),
|
5908 5517 | ))
|
5909 5518 | .unwrap();
|
5910 5519 | #[allow(unused_mut)]
|
5911 5520 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5912 5521 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5913 5522 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5914 - | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
5523 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
5915 5524 | let sender = sender.clone();
|
5916 5525 | async move {
|
5917 - | 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> };
|
5526 + | 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> };
|
5918 5527 | sender.send(()).await.expect("receiver dropped early");
|
5919 5528 | result
|
5920 5529 | }
|
5921 5530 | })
|
5922 5531 | .build_unchecked();
|
5923 5532 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5924 5533 | .await
|
5925 5534 | .expect("unable to make an HTTP request");
|
5926 5535 | ::pretty_assertions::assert_eq!(
|
5927 5536 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5928 5537 | http_response.status()
|
5929 5538 | );
|
5930 5539 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5931 5540 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5932 5541 | http_response.headers(),
|
5933 5542 | expected_headers,
|
5934 5543 | ));
|
5935 5544 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5936 5545 | .await
|
5937 5546 | .expect("unable to extract body to bytes");
|
5938 5547 | ::aws_smithy_protocol_test::assert_ok(
|
5939 - | ::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"))
|
5548 + | ::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"))
|
5940 5549 | );
|
5941 5550 | }
|
5942 5551 | }
|
5943 5552 |
|
5944 - | /// When a string member does not fit within length bounds,
|
5553 + | /// When a float member does not fit within range bounds,
|
5945 5554 | /// the response should be a 400 ValidationException.
|
5946 - | /// Test ID: RestJsonMalformedLengthMinStringOverride
|
5555 + | /// Test ID: RestJsonMalformedRangeMinFloatOverride
|
5947 5556 | #[::tokio::test]
|
5948 5557 | #[::tracing_test::traced_test]
|
5949 - | async fn rest_json_malformed_length_min_string_override_malformed_request() {
|
5558 + | #[should_panic]
|
5559 + | async fn rest_json_malformed_range_min_float_override_malformed_request() {
|
5950 5560 | {
|
5951 5561 | #[allow(unused_mut)]
|
5952 5562 | let mut http_request = ::http::Request::builder()
|
5953 - | .uri("/MalformedLengthOverride")
|
5563 + | .uri("/MalformedRangeOverride")
|
5954 5564 | .method("POST")
|
5955 5565 | .header("content-type", "application/json")
|
5956 5566 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
5957 5567 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5958 - | "{ \"minString\" : \"abc\" }".as_bytes(),
|
5568 + | "{ \"minFloat\" : 4.3 }".as_bytes(),
|
5959 5569 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5960 5570 | )),
|
5961 5571 | ))
|
5962 5572 | .unwrap();
|
5963 5573 | #[allow(unused_mut)]
|
5964 5574 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5965 5575 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5966 5576 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5967 - | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
5577 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
5968 5578 | let sender = sender.clone();
|
5969 5579 | async move {
|
5970 - | 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> };
|
5580 + | 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> };
|
5971 5581 | sender.send(()).await.expect("receiver dropped early");
|
5972 5582 | result
|
5973 5583 | }
|
5974 5584 | })
|
5975 5585 | .build_unchecked();
|
5976 5586 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5977 5587 | .await
|
5978 5588 | .expect("unable to make an HTTP request");
|
5979 5589 | ::pretty_assertions::assert_eq!(
|
5980 5590 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5981 5591 | http_response.status()
|
5982 5592 | );
|
5983 5593 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5984 5594 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5985 5595 | http_response.headers(),
|
5986 5596 | expected_headers,
|
5987 5597 | ));
|
5988 5598 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5989 5599 | .await
|
5990 5600 | .expect("unable to extract body to bytes");
|
5991 5601 | ::aws_smithy_protocol_test::assert_ok(
|
5992 - | ::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"))
|
5602 + | ::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"))
|
5993 5603 | );
|
5994 5604 | }
|
5995 5605 | }
|
5996 5606 |
|
5997 - | /// When a string member does not fit within length bounds,
|
5607 + | /// When a float member does not fit within range bounds,
|
5998 5608 | /// the response should be a 400 ValidationException.
|
5999 - | /// Test ID: RestJsonMalformedLengthMaxStringOverride
|
5609 + | /// Test ID: RestJsonMalformedRangeMaxFloatOverride
|
6000 5610 | #[::tokio::test]
|
6001 5611 | #[::tracing_test::traced_test]
|
6002 - | async fn rest_json_malformed_length_max_string_override_malformed_request() {
|
5612 + | #[should_panic]
|
5613 + | async fn rest_json_malformed_range_max_float_override_malformed_request() {
|
6003 5614 | {
|
6004 5615 | #[allow(unused_mut)]
|
6005 5616 | let mut http_request = ::http::Request::builder()
|
6006 - | .uri("/MalformedLengthOverride")
|
5617 + | .uri("/MalformedRangeOverride")
|
6007 5618 | .method("POST")
|
6008 5619 | .header("content-type", "application/json")
|
6009 5620 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
6010 5621 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6011 - | "{ \"maxString\" : \"abcdefg\" }".as_bytes(),
|
5622 + | "{ \"maxFloat\" : 6.7 }".as_bytes(),
|
6012 5623 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6013 5624 | )),
|
6014 5625 | ))
|
6015 5626 | .unwrap();
|
6016 5627 | #[allow(unused_mut)]
|
6017 5628 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6018 5629 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6019 5630 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6020 - | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
5631 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
6021 5632 | let sender = sender.clone();
|
6022 5633 | async move {
|
6023 - | 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> };
|
5634 + | 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> };
|
6024 5635 | sender.send(()).await.expect("receiver dropped early");
|
6025 5636 | result
|
6026 5637 | }
|
6027 5638 | })
|
6028 5639 | .build_unchecked();
|
6029 5640 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6030 5641 | .await
|
6031 5642 | .expect("unable to make an HTTP request");
|
6032 5643 | ::pretty_assertions::assert_eq!(
|
6033 5644 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6034 5645 | http_response.status()
|
6035 5646 | );
|
6036 5647 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6037 5648 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6038 5649 | http_response.headers(),
|
6039 5650 | expected_headers,
|
6040 5651 | ));
|
6041 5652 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6042 5653 | .await
|
6043 5654 | .expect("unable to extract body to bytes");
|
6044 5655 | ::aws_smithy_protocol_test::assert_ok(
|
6045 - | ::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"))
|
5656 + | ::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"))
|
6046 5657 | );
|
6047 5658 | }
|
6048 5659 | }
|
6049 5660 |
|
6050 - | /// When a list member does not fit within length bounds,
|
5661 + | /// When a short member does not fit within range bounds,
|
6051 5662 | /// the response should be a 400 ValidationException.
|
6052 - | /// Test ID: RestJsonMalformedLengthListOverride_case0
|
5663 + | /// Test ID: RestJsonMalformedRangeShortOverride_case0
|
6053 5664 | #[::tokio::test]
|
6054 5665 | #[::tracing_test::traced_test]
|
6055 - | async fn rest_json_malformed_length_list_override_case0_malformed_request() {
|
5666 + | async fn rest_json_malformed_range_short_override_case0_malformed_request() {
|
6056 5667 | {
|
6057 5668 | #[allow(unused_mut)]
|
6058 5669 | let mut http_request = ::http::Request::builder()
|
6059 - | .uri("/MalformedLengthOverride")
|
5670 + | .uri("/MalformedRangeOverride")
|
6060 5671 | .method("POST")
|
6061 5672 | .header("content-type", "application/json")
|
6062 5673 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
6063 5674 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6064 - | "{ \"list\" : [\"abc\", \"def\", \"ghi\"] }".as_bytes(),
|
5675 + | "{ \"short\" : 3 }".as_bytes(),
|
6065 5676 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6066 5677 | )),
|
6067 5678 | ))
|
6068 5679 | .unwrap();
|
6069 5680 | #[allow(unused_mut)]
|
6070 5681 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6071 5682 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6072 5683 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6073 - | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
5684 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
6074 5685 | let sender = sender.clone();
|
6075 5686 | async move {
|
6076 - | 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> };
|
5687 + | 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> };
|
6077 5688 | sender.send(()).await.expect("receiver dropped early");
|
6078 5689 | result
|
6079 5690 | }
|
6080 5691 | })
|
6081 5692 | .build_unchecked();
|
6082 5693 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6083 5694 | .await
|
6084 5695 | .expect("unable to make an HTTP request");
|
6085 5696 | ::pretty_assertions::assert_eq!(
|
6086 5697 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6087 5698 | http_response.status()
|
6088 5699 | );
|
6089 5700 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6090 5701 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6091 5702 | http_response.headers(),
|
6092 5703 | expected_headers,
|
6093 5704 | ));
|
6094 5705 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6095 5706 | .await
|
6096 5707 | .expect("unable to extract body to bytes");
|
6097 5708 | ::aws_smithy_protocol_test::assert_ok(
|
6098 - | ::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"))
|
5709 + | ::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"))
|
6099 5710 | );
|
6100 5711 | }
|
6101 5712 | }
|
6102 5713 |
|
6103 - | /// When a list member does not fit within length bounds,
|
5714 + | /// When a short member does not fit within range bounds,
|
6104 5715 | /// the response should be a 400 ValidationException.
|
6105 - | /// Test ID: RestJsonMalformedLengthListOverride_case1
|
5716 + | /// Test ID: RestJsonMalformedRangeShortOverride_case1
|
6106 5717 | #[::tokio::test]
|
6107 5718 | #[::tracing_test::traced_test]
|
6108 - | async fn rest_json_malformed_length_list_override_case1_malformed_request() {
|
5719 + | async fn rest_json_malformed_range_short_override_case1_malformed_request() {
|
6109 5720 | {
|
6110 5721 | #[allow(unused_mut)]
|
6111 5722 | let mut http_request = ::http::Request::builder()
|
6112 - | .uri("/MalformedLengthOverride")
|
5723 + | .uri("/MalformedRangeOverride")
|
6113 5724 | .method("POST")
|
6114 5725 | .header("content-type", "application/json")
|
6115 5726 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
6116 - | ::bytes::Bytes::copy_from_slice(
|
6117 - | &::aws_smithy_protocol_test::decode_body_data("{ \"list\" : [\"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\"] }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
6118 - | )
|
6119 - | )).unwrap();
|
5727 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5728 + | "{ \"short\" : 7 }".as_bytes(),
|
5729 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5730 + | )),
|
5731 + | ))
|
5732 + | .unwrap();
|
6120 5733 | #[allow(unused_mut)]
|
6121 5734 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6122 5735 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6123 5736 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6124 - | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
5737 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
6125 5738 | let sender = sender.clone();
|
6126 5739 | async move {
|
6127 - | 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> };
|
5740 + | 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> };
|
6128 5741 | sender.send(()).await.expect("receiver dropped early");
|
6129 5742 | result
|
6130 5743 | }
|
6131 5744 | })
|
6132 5745 | .build_unchecked();
|
6133 5746 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6134 5747 | .await
|
6135 5748 | .expect("unable to make an HTTP request");
|
6136 5749 | ::pretty_assertions::assert_eq!(
|
6137 5750 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6138 5751 | http_response.status()
|
6139 5752 | );
|
6140 5753 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6141 5754 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6142 5755 | http_response.headers(),
|
6143 5756 | expected_headers,
|
6144 5757 | ));
|
6145 5758 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6146 5759 | .await
|
6147 5760 | .expect("unable to extract body to bytes");
|
6148 5761 | ::aws_smithy_protocol_test::assert_ok(
|
6149 - | ::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"))
|
5762 + | ::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"))
|
6150 5763 | );
|
6151 5764 | }
|
6152 5765 | }
|
6153 5766 |
|
6154 - | /// When a map member does not fit within length bounds,
|
5767 + | /// When a short member does not fit within range bounds,
|
6155 5768 | /// the response should be a 400 ValidationException.
|
6156 - | /// Test ID: RestJsonMalformedLengthMapOverride_case0
|
5769 + | /// Test ID: RestJsonMalformedRangeMinShortOverride
|
6157 5770 | #[::tokio::test]
|
6158 5771 | #[::tracing_test::traced_test]
|
6159 - | async fn rest_json_malformed_length_map_override_case0_malformed_request() {
|
5772 + | async fn rest_json_malformed_range_min_short_override_malformed_request() {
|
6160 5773 | {
|
6161 5774 | #[allow(unused_mut)]
|
6162 5775 | let mut http_request = ::http::Request::builder()
|
6163 - | .uri("/MalformedLengthOverride")
|
5776 + | .uri("/MalformedRangeOverride")
|
6164 5777 | .method("POST")
|
6165 5778 | .header("content-type", "application/json")
|
6166 5779 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
6167 - | ::bytes::Bytes::copy_from_slice(
|
6168 - | &::aws_smithy_protocol_test::decode_body_data("{ \"map\" : {\"abc\": [\"def\", \"efg\", \"fgh\"], \"bcd\": [\"abc\", \"def\", \"efg\"], \"def\": [\"abc\", \"def\", \"efg\"]} }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
6169 - | )
|
6170 - | )).unwrap();
|
5780 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5781 + | "{ \"minShort\" : 3 }".as_bytes(),
|
5782 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5783 + | )),
|
5784 + | ))
|
5785 + | .unwrap();
|
6171 5786 | #[allow(unused_mut)]
|
6172 5787 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6173 5788 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6174 5789 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6175 - | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
5790 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
6176 5791 | let sender = sender.clone();
|
6177 5792 | async move {
|
6178 - | 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> };
|
5793 + | 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> };
|
6179 5794 | sender.send(()).await.expect("receiver dropped early");
|
6180 5795 | result
|
6181 5796 | }
|
6182 5797 | })
|
6183 5798 | .build_unchecked();
|
6184 5799 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6185 5800 | .await
|
6186 5801 | .expect("unable to make an HTTP request");
|
6187 5802 | ::pretty_assertions::assert_eq!(
|
6188 5803 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6189 5804 | http_response.status()
|
6190 5805 | );
|
6191 5806 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6192 5807 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6193 5808 | http_response.headers(),
|
6194 5809 | expected_headers,
|
6195 5810 | ));
|
6196 5811 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6197 5812 | .await
|
6198 5813 | .expect("unable to extract body to bytes");
|
6199 5814 | ::aws_smithy_protocol_test::assert_ok(
|
6200 - | ::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"))
|
5815 + | ::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"))
|
6201 5816 | );
|
6202 5817 | }
|
6203 5818 | }
|
6204 5819 |
|
6205 - | /// When a map member does not fit within length bounds,
|
5820 + | /// When a short member does not fit within range bounds,
|
6206 5821 | /// the response should be a 400 ValidationException.
|
6207 - | /// Test ID: RestJsonMalformedLengthMapOverride_case1
|
5822 + | /// Test ID: RestJsonMalformedRangeMaxShortOverride
|
6208 5823 | #[::tokio::test]
|
6209 5824 | #[::tracing_test::traced_test]
|
6210 - | async fn rest_json_malformed_length_map_override_case1_malformed_request() {
|
5825 + | async fn rest_json_malformed_range_max_short_override_malformed_request() {
|
6211 5826 | {
|
6212 5827 | #[allow(unused_mut)]
|
6213 5828 | let mut http_request = ::http::Request::builder()
|
6214 - | .uri("/MalformedLengthOverride")
|
5829 + | .uri("/MalformedRangeOverride")
|
6215 5830 | .method("POST")
|
6216 5831 | .header("content-type", "application/json")
|
6217 5832 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
6218 - | ::bytes::Bytes::copy_from_slice(
|
6219 - | &::aws_smithy_protocol_test::decode_body_data("{ \"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(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
6220 - | )
|
6221 - | )).unwrap();
|
5833 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5834 + | "{ \"maxShort\" : 7 }".as_bytes(),
|
5835 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5836 + | )),
|
5837 + | ))
|
5838 + | .unwrap();
|
6222 5839 | #[allow(unused_mut)]
|
6223 5840 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6224 5841 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6225 5842 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6226 - | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
5843 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
6227 5844 | let sender = sender.clone();
|
6228 5845 | async move {
|
6229 - | 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> };
|
5846 + | 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> };
|
6230 5847 | sender.send(()).await.expect("receiver dropped early");
|
6231 5848 | result
|
6232 5849 | }
|
6233 5850 | })
|
6234 5851 | .build_unchecked();
|
6235 5852 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6236 5853 | .await
|
6237 5854 | .expect("unable to make an HTTP request");
|
6238 5855 | ::pretty_assertions::assert_eq!(
|
6239 5856 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6240 5857 | http_response.status()
|
6241 5858 | );
|
6242 5859 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6243 5860 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6244 5861 | http_response.headers(),
|
6245 5862 | expected_headers,
|
6246 5863 | ));
|
6247 5864 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6248 5865 | .await
|
6249 5866 | .expect("unable to extract body to bytes");
|
6250 5867 | ::aws_smithy_protocol_test::assert_ok(
|
6251 - | ::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"))
|
6252 - | );
|
6253 - | }
|
6254 - | }
|
6255 - | }
|
6256 - |
|
6257 - | ::pin_project_lite::pin_project! {
|
6258 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
6259 - | /// [`MalformedLengthInput`](crate::input::MalformedLengthInput) using modelled bindings.
|
6260 - | pub struct MalformedLengthInputFuture {
|
6261 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedLengthInput, ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
6262 - | }
|
6263 - | }
|
6264 - |
|
6265 - | impl std::future::Future for MalformedLengthInputFuture {
|
6266 - | type Output = Result<
|
6267 - | crate::input::MalformedLengthInput,
|
6268 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
6269 - | >;
|
6270 - |
|
6271 - | fn poll(
|
6272 - | self: std::pin::Pin<&mut Self>,
|
6273 - | cx: &mut std::task::Context<'_>,
|
6274 - | ) -> std::task::Poll<Self::Output> {
|
6275 - | let this = self.project();
|
6276 - | this.inner.as_mut().poll(cx)
|
6277 - | }
|
6278 - | }
|
6279 - |
|
6280 - | impl<B>
|
6281 - | ::aws_smithy_legacy_http_server::request::FromRequest<
|
6282 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
6283 - | B,
|
6284 - | > for crate::input::MalformedLengthInput
|
6285 - | where
|
6286 - | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
6287 - | B: 'static,
|
6288 - |
|
6289 - | B::Data: Send,
|
6290 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
6291 - | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
6292 - | {
|
6293 - | type Rejection =
|
6294 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
6295 - | type Future = MalformedLengthInputFuture;
|
6296 - |
|
6297 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
6298 - | let fut = async move {
|
6299 - | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
6300 - | request.headers(),
|
6301 - | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
6302 - | ) {
|
6303 - | return Err(::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
6304 - | }
|
6305 - | crate::protocol_serde::shape_malformed_length::de_malformed_length_http_request(request)
|
6306 - | .await
|
6307 - | };
|
6308 - | use ::futures_util::future::TryFutureExt;
|
6309 - | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
6310 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
6311 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e)
|
6312 - | });
|
6313 - | MalformedLengthInputFuture {
|
6314 - | inner: Box::pin(fut),
|
6315 - | }
|
6316 - | }
|
6317 - | }
|
6318 - | impl
|
6319 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
6320 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
6321 - | > for crate::output::MalformedLengthOutput
|
6322 - | {
|
6323 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
6324 - | match crate::protocol_serde::shape_malformed_length::ser_malformed_length_http_response(
|
6325 - | self,
|
6326 - | ) {
|
6327 - | Ok(response) => response,
|
6328 - | Err(e) => {
|
6329 - | ::tracing::error!(error = %e, "failed to serialize response");
|
6330 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
6331 - | }
|
6332 - | }
|
6333 - | }
|
6334 - | }
|
6335 - | impl
|
6336 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
6337 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
6338 - | > for crate::error::MalformedLengthError
|
6339 - | {
|
6340 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
6341 - | match crate::protocol_serde::shape_malformed_length::ser_malformed_length_http_error(&self)
|
6342 - | {
|
6343 - | Ok(mut response) => {
|
6344 - | response.extensions_mut().insert(
|
6345 - | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
6346 - | self.name(),
|
6347 - | ),
|
5868 + | ::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"))
|
6348 5869 | );
|
6349 - | response
|
6350 - | }
|
6351 - | Err(e) => {
|
6352 - | ::tracing::error!(error = %e, "failed to serialize response");
|
6353 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
6354 5870 | }
|
6355 5871 | }
|
6356 - | }
|
6357 - | }
|
6358 - |
|
6359 - | #[allow(unreachable_code, unused_variables)]
|
6360 - | #[cfg(test)]
|
6361 - | mod malformed_length_test {
|
6362 5872 |
|
6363 - | /// When a blob member does not fit within length bounds,
|
5873 + | /// When a integer member does not fit within range bounds,
|
6364 5874 | /// the response should be a 400 ValidationException.
|
6365 - | /// Test ID: RestJsonMalformedLengthBlob_case0
|
5875 + | /// Test ID: RestJsonMalformedRangeIntegerOverride_case0
|
6366 5876 | #[::tokio::test]
|
6367 5877 | #[::tracing_test::traced_test]
|
6368 - | async fn rest_json_malformed_length_blob_case0_malformed_request() {
|
5878 + | async fn rest_json_malformed_range_integer_override_case0_malformed_request() {
|
6369 5879 | {
|
6370 5880 | #[allow(unused_mut)]
|
6371 5881 | let mut http_request = ::http::Request::builder()
|
6372 - | .uri("/MalformedLength")
|
5882 + | .uri("/MalformedRangeOverride")
|
6373 5883 | .method("POST")
|
6374 5884 | .header("content-type", "application/json")
|
6375 5885 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
6376 5886 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6377 - | "{ \"blob\" : \"YQ==\" }".as_bytes(),
|
5887 + | "{ \"integer\" : 3 }".as_bytes(),
|
6378 5888 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6379 5889 | )),
|
6380 5890 | ))
|
6381 5891 | .unwrap();
|
6382 5892 | #[allow(unused_mut)]
|
6383 5893 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6384 5894 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6385 5895 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6386 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
5896 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
6387 5897 | let sender = sender.clone();
|
6388 5898 | async move {
|
6389 - | 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> };
|
5899 + | 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> };
|
6390 5900 | sender.send(()).await.expect("receiver dropped early");
|
6391 5901 | result
|
6392 5902 | }
|
6393 5903 | })
|
6394 5904 | .build_unchecked();
|
6395 5905 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6396 5906 | .await
|
6397 5907 | .expect("unable to make an HTTP request");
|
6398 5908 | ::pretty_assertions::assert_eq!(
|
6399 5909 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6400 5910 | http_response.status()
|
6401 5911 | );
|
6402 5912 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6403 5913 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6404 5914 | http_response.headers(),
|
6405 5915 | expected_headers,
|
6406 5916 | ));
|
6407 5917 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6408 5918 | .await
|
6409 5919 | .expect("unable to extract body to bytes");
|
6410 5920 | ::aws_smithy_protocol_test::assert_ok(
|
6411 - | ::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"))
|
5921 + | ::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"))
|
6412 5922 | );
|
6413 5923 | }
|
6414 5924 | }
|
6415 5925 |
|
6416 - | /// When a blob member does not fit within length bounds,
|
5926 + | /// When a integer member does not fit within range bounds,
|
6417 5927 | /// the response should be a 400 ValidationException.
|
6418 - | /// Test ID: RestJsonMalformedLengthBlob_case1
|
5928 + | /// Test ID: RestJsonMalformedRangeIntegerOverride_case1
|
6419 5929 | #[::tokio::test]
|
6420 5930 | #[::tracing_test::traced_test]
|
6421 - | async fn rest_json_malformed_length_blob_case1_malformed_request() {
|
5931 + | async fn rest_json_malformed_range_integer_override_case1_malformed_request() {
|
6422 5932 | {
|
6423 5933 | #[allow(unused_mut)]
|
6424 5934 | let mut http_request = ::http::Request::builder()
|
6425 - | .uri("/MalformedLength")
|
5935 + | .uri("/MalformedRangeOverride")
|
6426 5936 | .method("POST")
|
6427 5937 | .header("content-type", "application/json")
|
6428 5938 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
6429 5939 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6430 - | "{ \"blob\" : \"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXo=\" }".as_bytes(),
|
5940 + | "{ \"integer\" : 7 }".as_bytes(),
|
6431 5941 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6432 5942 | )),
|
6433 5943 | ))
|
6434 5944 | .unwrap();
|
6435 5945 | #[allow(unused_mut)]
|
6436 5946 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6437 5947 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6438 5948 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6439 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
5949 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
6440 5950 | let sender = sender.clone();
|
6441 5951 | async move {
|
6442 - | 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> };
|
5952 + | 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> };
|
6443 5953 | sender.send(()).await.expect("receiver dropped early");
|
6444 5954 | result
|
6445 5955 | }
|
6446 5956 | })
|
6447 5957 | .build_unchecked();
|
6448 5958 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6449 5959 | .await
|
6450 5960 | .expect("unable to make an HTTP request");
|
6451 5961 | ::pretty_assertions::assert_eq!(
|
6452 5962 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6453 5963 | http_response.status()
|
6454 5964 | );
|
6455 5965 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6456 5966 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6457 5967 | http_response.headers(),
|
6458 5968 | expected_headers,
|
6459 5969 | ));
|
6460 5970 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6461 5971 | .await
|
6462 5972 | .expect("unable to extract body to bytes");
|
6463 5973 | ::aws_smithy_protocol_test::assert_ok(
|
6464 - | ::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"))
|
5974 + | ::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"))
|
6465 5975 | );
|
6466 5976 | }
|
6467 5977 | }
|
6468 5978 |
|
6469 - | /// When a string member does not fit within length bounds,
|
5979 + | /// When a integer member does not fit within range bounds,
|
6470 5980 | /// the response should be a 400 ValidationException.
|
6471 - | /// Test ID: RestJsonMalformedLengthString_case0
|
5981 + | /// Test ID: RestJsonMalformedRangeMinIntegerOverride
|
6472 5982 | #[::tokio::test]
|
6473 5983 | #[::tracing_test::traced_test]
|
6474 - | async fn rest_json_malformed_length_string_case0_malformed_request() {
|
5984 + | async fn rest_json_malformed_range_min_integer_override_malformed_request() {
|
6475 5985 | {
|
6476 5986 | #[allow(unused_mut)]
|
6477 5987 | let mut http_request = ::http::Request::builder()
|
6478 - | .uri("/MalformedLength")
|
5988 + | .uri("/MalformedRangeOverride")
|
6479 5989 | .method("POST")
|
6480 5990 | .header("content-type", "application/json")
|
6481 5991 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
6482 5992 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6483 - | "{ \"string\" : \"a\" }".as_bytes(),
|
5993 + | "{ \"minInteger\" : 3 }".as_bytes(),
|
6484 5994 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6485 5995 | )),
|
6486 5996 | ))
|
6487 5997 | .unwrap();
|
6488 5998 | #[allow(unused_mut)]
|
6489 5999 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6490 6000 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6491 6001 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6492 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6002 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
6493 6003 | let sender = sender.clone();
|
6494 6004 | async move {
|
6495 - | 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> };
|
6005 + | 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> };
|
6496 6006 | sender.send(()).await.expect("receiver dropped early");
|
6497 6007 | result
|
6498 6008 | }
|
6499 6009 | })
|
6500 6010 | .build_unchecked();
|
6501 6011 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6502 6012 | .await
|
6503 6013 | .expect("unable to make an HTTP request");
|
6504 6014 | ::pretty_assertions::assert_eq!(
|
6505 6015 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6506 6016 | http_response.status()
|
6507 6017 | );
|
6508 6018 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6509 6019 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6510 6020 | http_response.headers(),
|
6511 6021 | expected_headers,
|
6512 6022 | ));
|
6513 6023 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6514 6024 | .await
|
6515 6025 | .expect("unable to extract body to bytes");
|
6516 6026 | ::aws_smithy_protocol_test::assert_ok(
|
6517 - | ::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"))
|
6027 + | ::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"))
|
6518 6028 | );
|
6519 6029 | }
|
6520 6030 | }
|
6521 6031 |
|
6522 - | /// When a string member does not fit within length bounds,
|
6032 + | /// When a integer member does not fit within range bounds,
|
6523 6033 | /// the response should be a 400 ValidationException.
|
6524 - | /// Test ID: RestJsonMalformedLengthString_case1
|
6034 + | /// Test ID: RestJsonMalformedRangeMaxIntegerOverride
|
6525 6035 | #[::tokio::test]
|
6526 6036 | #[::tracing_test::traced_test]
|
6527 - | async fn rest_json_malformed_length_string_case1_malformed_request() {
|
6037 + | async fn rest_json_malformed_range_max_integer_override_malformed_request() {
|
6528 6038 | {
|
6529 6039 | #[allow(unused_mut)]
|
6530 6040 | let mut http_request = ::http::Request::builder()
|
6531 - | .uri("/MalformedLength")
|
6041 + | .uri("/MalformedRangeOverride")
|
6532 6042 | .method("POST")
|
6533 6043 | .header("content-type", "application/json")
|
6534 6044 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
6535 6045 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6536 - | "{ \"string\" : \"abcdefghijklmnopqrstuvwxyz\" }".as_bytes(),
|
6046 + | "{ \"maxInteger\" : 7 }".as_bytes(),
|
6537 6047 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6538 6048 | )),
|
6539 6049 | ))
|
6540 6050 | .unwrap();
|
6541 6051 | #[allow(unused_mut)]
|
6542 6052 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6543 6053 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6544 6054 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6545 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6055 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
6546 6056 | let sender = sender.clone();
|
6547 6057 | async move {
|
6548 - | 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> };
|
6058 + | 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> };
|
6549 6059 | sender.send(()).await.expect("receiver dropped early");
|
6550 6060 | result
|
6551 6061 | }
|
6552 6062 | })
|
6553 6063 | .build_unchecked();
|
6554 6064 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6555 6065 | .await
|
6556 6066 | .expect("unable to make an HTTP request");
|
6557 6067 | ::pretty_assertions::assert_eq!(
|
6558 6068 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6559 6069 | http_response.status()
|
6560 6070 | );
|
6561 6071 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6562 6072 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6563 6073 | http_response.headers(),
|
6564 6074 | expected_headers,
|
6565 6075 | ));
|
6566 6076 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6567 6077 | .await
|
6568 6078 | .expect("unable to extract body to bytes");
|
6569 6079 | ::aws_smithy_protocol_test::assert_ok(
|
6570 - | ::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"))
|
6080 + | ::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"))
|
6571 6081 | );
|
6572 6082 | }
|
6573 6083 | }
|
6574 6084 |
|
6575 - | /// When a string member does not fit within length bounds,
|
6085 + | /// When a long member does not fit within range bounds,
|
6576 6086 | /// the response should be a 400 ValidationException.
|
6577 - | /// Test ID: RestJsonMalformedLengthString_case2
|
6087 + | /// Test ID: RestJsonMalformedRangeLongOverride_case0
|
6578 6088 | #[::tokio::test]
|
6579 6089 | #[::tracing_test::traced_test]
|
6580 - | async fn rest_json_malformed_length_string_case2_malformed_request() {
|
6090 + | async fn rest_json_malformed_range_long_override_case0_malformed_request() {
|
6581 6091 | {
|
6582 6092 | #[allow(unused_mut)]
|
6583 6093 | let mut http_request = ::http::Request::builder()
|
6584 - | .uri("/MalformedLength")
|
6094 + | .uri("/MalformedRangeOverride")
|
6585 6095 | .method("POST")
|
6586 6096 | .header("content-type", "application/json")
|
6587 6097 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
6588 6098 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6589 - | "{ \"string\" : \"👍\" }".as_bytes(),
|
6099 + | "{ \"long\" : 3 }".as_bytes(),
|
6590 6100 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6591 6101 | )),
|
6592 6102 | ))
|
6593 6103 | .unwrap();
|
6594 6104 | #[allow(unused_mut)]
|
6595 6105 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6596 6106 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6597 6107 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6598 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6108 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
6599 6109 | let sender = sender.clone();
|
6600 6110 | async move {
|
6601 - | 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> };
|
6111 + | 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> };
|
6602 6112 | sender.send(()).await.expect("receiver dropped early");
|
6603 6113 | result
|
6604 6114 | }
|
6605 6115 | })
|
6606 6116 | .build_unchecked();
|
6607 6117 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6608 6118 | .await
|
6609 6119 | .expect("unable to make an HTTP request");
|
6610 6120 | ::pretty_assertions::assert_eq!(
|
6611 6121 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6612 6122 | http_response.status()
|
6613 6123 | );
|
6614 6124 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6615 6125 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6616 6126 | http_response.headers(),
|
6617 6127 | expected_headers,
|
6618 6128 | ));
|
6619 6129 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6620 6130 | .await
|
6621 6131 | .expect("unable to extract body to bytes");
|
6622 6132 | ::aws_smithy_protocol_test::assert_ok(
|
6623 - | ::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"))
|
6133 + | ::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"))
|
6624 6134 | );
|
6625 6135 | }
|
6626 6136 | }
|
6627 6137 |
|
6628 - | /// When a string member does not fit within length bounds,
|
6138 + | /// When a long member does not fit within range bounds,
|
6629 6139 | /// the response should be a 400 ValidationException.
|
6630 - | /// Test ID: RestJsonMalformedLengthMinString
|
6140 + | /// Test ID: RestJsonMalformedRangeLongOverride_case1
|
6631 6141 | #[::tokio::test]
|
6632 6142 | #[::tracing_test::traced_test]
|
6633 - | async fn rest_json_malformed_length_min_string_malformed_request() {
|
6143 + | async fn rest_json_malformed_range_long_override_case1_malformed_request() {
|
6634 6144 | {
|
6635 6145 | #[allow(unused_mut)]
|
6636 6146 | let mut http_request = ::http::Request::builder()
|
6637 - | .uri("/MalformedLength")
|
6147 + | .uri("/MalformedRangeOverride")
|
6638 6148 | .method("POST")
|
6639 6149 | .header("content-type", "application/json")
|
6640 6150 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
6641 6151 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6642 - | "{ \"minString\" : \"a\" }".as_bytes(),
|
6152 + | "{ \"long\" : 7 }".as_bytes(),
|
6643 6153 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6644 6154 | )),
|
6645 6155 | ))
|
6646 6156 | .unwrap();
|
6647 6157 | #[allow(unused_mut)]
|
6648 6158 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6649 6159 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6650 6160 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6651 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6161 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
6652 6162 | let sender = sender.clone();
|
6653 6163 | async move {
|
6654 - | 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> };
|
6164 + | 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> };
|
6655 6165 | sender.send(()).await.expect("receiver dropped early");
|
6656 6166 | result
|
6657 6167 | }
|
6658 6168 | })
|
6659 6169 | .build_unchecked();
|
6660 6170 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6661 6171 | .await
|
6662 6172 | .expect("unable to make an HTTP request");
|
6663 6173 | ::pretty_assertions::assert_eq!(
|
6664 6174 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6665 6175 | http_response.status()
|
6666 6176 | );
|
6667 6177 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6668 6178 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6669 6179 | http_response.headers(),
|
6670 6180 | expected_headers,
|
6671 6181 | ));
|
6672 6182 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6673 6183 | .await
|
6674 6184 | .expect("unable to extract body to bytes");
|
6675 6185 | ::aws_smithy_protocol_test::assert_ok(
|
6676 - | ::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"))
|
6186 + | ::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"))
|
6677 6187 | );
|
6678 6188 | }
|
6679 6189 | }
|
6680 6190 |
|
6681 - | /// When a string member does not fit within length bounds,
|
6191 + | /// When a long member does not fit within range bounds,
|
6682 6192 | /// the response should be a 400 ValidationException.
|
6683 - | /// Test ID: RestJsonMalformedLengthMaxString
|
6193 + | /// Test ID: RestJsonMalformedRangeMinLongOverride
|
6684 6194 | #[::tokio::test]
|
6685 6195 | #[::tracing_test::traced_test]
|
6686 - | async fn rest_json_malformed_length_max_string_malformed_request() {
|
6196 + | async fn rest_json_malformed_range_min_long_override_malformed_request() {
|
6687 6197 | {
|
6688 6198 | #[allow(unused_mut)]
|
6689 6199 | let mut http_request = ::http::Request::builder()
|
6690 - | .uri("/MalformedLength")
|
6200 + | .uri("/MalformedRangeOverride")
|
6691 6201 | .method("POST")
|
6692 6202 | .header("content-type", "application/json")
|
6693 6203 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
6694 6204 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6695 - | "{ \"maxString\" : \"abcdefghijklmnopqrstuvwxyz\" }".as_bytes(),
|
6205 + | "{ \"minLong\" : 3 }".as_bytes(),
|
6696 6206 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6697 6207 | )),
|
6698 6208 | ))
|
6699 6209 | .unwrap();
|
6700 6210 | #[allow(unused_mut)]
|
6701 6211 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6702 6212 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6703 6213 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6704 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6214 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
6705 6215 | let sender = sender.clone();
|
6706 6216 | async move {
|
6707 - | 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> };
|
6217 + | 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> };
|
6708 6218 | sender.send(()).await.expect("receiver dropped early");
|
6709 6219 | result
|
6710 6220 | }
|
6711 6221 | })
|
6712 6222 | .build_unchecked();
|
6713 6223 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6714 6224 | .await
|
6715 6225 | .expect("unable to make an HTTP request");
|
6716 6226 | ::pretty_assertions::assert_eq!(
|
6717 6227 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6718 6228 | http_response.status()
|
6719 6229 | );
|
6720 6230 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6721 6231 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6722 6232 | http_response.headers(),
|
6723 6233 | expected_headers,
|
6724 6234 | ));
|
6725 6235 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6726 6236 | .await
|
6727 6237 | .expect("unable to extract body to bytes");
|
6728 6238 | ::aws_smithy_protocol_test::assert_ok(
|
6729 - | ::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"))
|
6239 + | ::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"))
|
6730 6240 | );
|
6731 6241 | }
|
6732 6242 | }
|
6733 6243 |
|
6734 - | /// When a list member does not fit within length bounds,
|
6244 + | /// When a long member does not fit within range bounds,
|
6735 6245 | /// the response should be a 400 ValidationException.
|
6736 - | /// Test ID: RestJsonMalformedLengthList_case0
|
6246 + | /// Test ID: RestJsonMalformedRangeMaxLongOverride
|
6737 6247 | #[::tokio::test]
|
6738 6248 | #[::tracing_test::traced_test]
|
6739 - | async fn rest_json_malformed_length_list_case0_malformed_request() {
|
6249 + | async fn rest_json_malformed_range_max_long_override_malformed_request() {
|
6740 6250 | {
|
6741 6251 | #[allow(unused_mut)]
|
6742 6252 | let mut http_request = ::http::Request::builder()
|
6743 - | .uri("/MalformedLength")
|
6253 + | .uri("/MalformedRangeOverride")
|
6744 6254 | .method("POST")
|
6745 6255 | .header("content-type", "application/json")
|
6746 6256 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
6747 6257 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6748 - | "{ \"list\" : [\"abc\"] }".as_bytes(),
|
6258 + | "{ \"maxLong\" : 7 }".as_bytes(),
|
6749 6259 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6750 6260 | )),
|
6751 6261 | ))
|
6752 6262 | .unwrap();
|
6753 6263 | #[allow(unused_mut)]
|
6754 6264 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6755 6265 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6756 6266 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6757 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6267 + | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
6758 6268 | let sender = sender.clone();
|
6759 6269 | async move {
|
6760 - | 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> };
|
6270 + | 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> };
|
6761 6271 | sender.send(()).await.expect("receiver dropped early");
|
6762 6272 | result
|
6763 6273 | }
|
6764 6274 | })
|
6765 6275 | .build_unchecked();
|
6766 6276 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6767 6277 | .await
|
6768 6278 | .expect("unable to make an HTTP request");
|
6769 6279 | ::pretty_assertions::assert_eq!(
|
6770 6280 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6771 6281 | http_response.status()
|
6772 6282 | );
|
6773 6283 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6774 6284 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6775 6285 | http_response.headers(),
|
6776 6286 | expected_headers,
|
6777 6287 | ));
|
6778 6288 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6779 6289 | .await
|
6780 6290 | .expect("unable to extract body to bytes");
|
6781 6291 | ::aws_smithy_protocol_test::assert_ok(
|
6782 - | ::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"))
|
6292 + | ::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"))
|
6783 6293 | );
|
6784 6294 | }
|
6785 6295 | }
|
6296 + | }
|
6786 6297 |
|
6787 - | /// When a list member does not fit within length bounds,
|
6298 + | ::pin_project_lite::pin_project! {
|
6299 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
6300 + | /// [`MalformedRequiredInput`](crate::input::MalformedRequiredInput) using modelled bindings.
|
6301 + | pub struct MalformedRequiredInputFuture {
|
6302 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedRequiredInput, ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
6303 + | }
|
6304 + | }
|
6305 + |
|
6306 + | impl std::future::Future for MalformedRequiredInputFuture {
|
6307 + | type Output = Result<
|
6308 + | crate::input::MalformedRequiredInput,
|
6309 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
6310 + | >;
|
6311 + |
|
6312 + | fn poll(
|
6313 + | self: std::pin::Pin<&mut Self>,
|
6314 + | cx: &mut std::task::Context<'_>,
|
6315 + | ) -> std::task::Poll<Self::Output> {
|
6316 + | let this = self.project();
|
6317 + | this.inner.as_mut().poll(cx)
|
6318 + | }
|
6319 + | }
|
6320 + |
|
6321 + | impl<B>
|
6322 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
6323 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
6324 + | B,
|
6325 + | > for crate::input::MalformedRequiredInput
|
6326 + | where
|
6327 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
6328 + | B: 'static,
|
6329 + |
|
6330 + | B::Data: Send,
|
6331 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
6332 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
6333 + | {
|
6334 + | type Rejection =
|
6335 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
6336 + | type Future = MalformedRequiredInputFuture;
|
6337 + |
|
6338 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
6339 + | let fut = async move {
|
6340 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
6341 + | request.headers(),
|
6342 + | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
6343 + | ) {
|
6344 + | return Err(::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
6345 + | }
|
6346 + | crate::protocol_serde::shape_malformed_required::de_malformed_required_http_request(
|
6347 + | request,
|
6348 + | )
|
6349 + | .await
|
6350 + | };
|
6351 + | use ::futures_util::future::TryFutureExt;
|
6352 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
6353 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
6354 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e)
|
6355 + | });
|
6356 + | MalformedRequiredInputFuture {
|
6357 + | inner: Box::pin(fut),
|
6358 + | }
|
6359 + | }
|
6360 + | }
|
6361 + | impl
|
6362 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
6363 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
6364 + | > for crate::output::MalformedRequiredOutput
|
6365 + | {
|
6366 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
6367 + | match crate::protocol_serde::shape_malformed_required::ser_malformed_required_http_response(
|
6368 + | self,
|
6369 + | ) {
|
6370 + | Ok(response) => response,
|
6371 + | Err(e) => {
|
6372 + | ::tracing::error!(error = %e, "failed to serialize response");
|
6373 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
6374 + | }
|
6375 + | }
|
6376 + | }
|
6377 + | }
|
6378 + | impl
|
6379 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
6380 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
6381 + | > for crate::error::MalformedRequiredError
|
6382 + | {
|
6383 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
6384 + | match crate::protocol_serde::shape_malformed_required::ser_malformed_required_http_error(
|
6385 + | &self,
|
6386 + | ) {
|
6387 + | Ok(mut response) => {
|
6388 + | response.extensions_mut().insert(
|
6389 + | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
6390 + | self.name(),
|
6391 + | ),
|
6392 + | );
|
6393 + | response
|
6394 + | }
|
6395 + | Err(e) => {
|
6396 + | ::tracing::error!(error = %e, "failed to serialize response");
|
6397 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
6398 + | }
|
6399 + | }
|
6400 + | }
|
6401 + | }
|
6402 + |
|
6403 + | #[allow(unreachable_code, unused_variables)]
|
6404 + | #[cfg(test)]
|
6405 + | mod malformed_required_test {
|
6406 + |
|
6407 + | /// When a required member is not set in the message body,
|
6788 6408 | /// the response should be a 400 ValidationException.
|
6789 - | /// Test ID: RestJsonMalformedLengthList_case1
|
6409 + | /// Test ID: RestJsonMalformedRequiredBodyUnset
|
6790 6410 | #[::tokio::test]
|
6791 6411 | #[::tracing_test::traced_test]
|
6792 - | async fn rest_json_malformed_length_list_case1_malformed_request() {
|
6412 + | async fn rest_json_malformed_required_body_unset_malformed_request() {
|
6793 6413 | {
|
6794 6414 | #[allow(unused_mut)]
|
6795 6415 | let mut http_request = ::http::Request::builder()
|
6796 - | .uri("/MalformedLength")
|
6416 + | .uri("/MalformedRequired")
|
6797 6417 | .method("POST")
|
6798 6418 | .header("content-type", "application/json")
|
6419 + | .header("string-in-headers", "abc")
|
6799 6420 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
6800 - | ::bytes::Bytes::copy_from_slice(
|
6801 - | &::aws_smithy_protocol_test::decode_body_data("{ \"list\" : [\"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\"] }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
6802 - | )
|
6803 - | )).unwrap();
|
6421 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6422 + | "{ }".as_bytes(),
|
6423 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6424 + | )),
|
6425 + | ))
|
6426 + | .unwrap();
|
6427 + | *http_request.uri_mut() = "/MalformedRequired?stringInQuery=abc".parse().unwrap();
|
6804 6428 | #[allow(unused_mut)]
|
6805 6429 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6806 6430 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6807 6431 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6808 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6432 + | .malformed_required(move |input: crate::input::MalformedRequiredInput| {
|
6809 6433 | let sender = sender.clone();
|
6810 6434 | async move {
|
6811 - | 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> };
|
6435 + | 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> };
|
6812 6436 | sender.send(()).await.expect("receiver dropped early");
|
6813 6437 | result
|
6814 6438 | }
|
6815 6439 | })
|
6816 6440 | .build_unchecked();
|
6817 6441 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6818 6442 | .await
|
6819 6443 | .expect("unable to make an HTTP request");
|
6820 6444 | ::pretty_assertions::assert_eq!(
|
6821 6445 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6822 6446 | http_response.status()
|
6823 6447 | );
|
6824 6448 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6825 6449 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6826 6450 | http_response.headers(),
|
6827 6451 | expected_headers,
|
6828 6452 | ));
|
6829 6453 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6830 6454 | .await
|
6831 6455 | .expect("unable to extract body to bytes");
|
6832 6456 | ::aws_smithy_protocol_test::assert_ok(
|
6833 - | ::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"))
|
6457 + | ::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"))
|
6834 6458 | );
|
6835 6459 | }
|
6836 6460 | }
|
6837 6461 |
|
6838 - | /// When a list member's value does not fit within length bounds,
|
6462 + | /// When a required member is set to null in the message body,
|
6839 6463 | /// the response should be a 400 ValidationException.
|
6840 - | /// Test ID: RestJsonMalformedLengthListValue_case0
|
6464 + | /// Test ID: RestJsonMalformedRequiredBodyExplicitNull
|
6841 6465 | #[::tokio::test]
|
6842 6466 | #[::tracing_test::traced_test]
|
6843 - | async fn rest_json_malformed_length_list_value_case0_malformed_request() {
|
6467 + | async fn rest_json_malformed_required_body_explicit_null_malformed_request() {
|
6844 6468 | {
|
6845 6469 | #[allow(unused_mut)]
|
6846 6470 | let mut http_request = ::http::Request::builder()
|
6847 - | .uri("/MalformedLength")
|
6471 + | .uri("/MalformedRequired")
|
6848 6472 | .method("POST")
|
6849 6473 | .header("content-type", "application/json")
|
6474 + | .header("string-in-headers", "abc")
|
6850 6475 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
6851 6476 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6852 - | "{ \"list\" : [\"a\", \"abc\"] }".as_bytes(),
|
6477 + | "{ \"string\": null }".as_bytes(),
|
6853 6478 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6854 6479 | )),
|
6855 6480 | ))
|
6856 6481 | .unwrap();
|
6482 + | *http_request.uri_mut() = "/MalformedRequired?stringInQuery=abc".parse().unwrap();
|
6857 6483 | #[allow(unused_mut)]
|
6858 6484 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6859 6485 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6860 6486 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6861 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6487 + | .malformed_required(move |input: crate::input::MalformedRequiredInput| {
|
6862 6488 | let sender = sender.clone();
|
6863 6489 | async move {
|
6864 - | 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> };
|
6490 + | 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> };
|
6865 6491 | sender.send(()).await.expect("receiver dropped early");
|
6866 6492 | result
|
6867 6493 | }
|
6868 6494 | })
|
6869 6495 | .build_unchecked();
|
6870 6496 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6871 6497 | .await
|
6872 6498 | .expect("unable to make an HTTP request");
|
6873 6499 | ::pretty_assertions::assert_eq!(
|
6874 6500 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6875 6501 | http_response.status()
|
6876 6502 | );
|
6877 6503 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6878 6504 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6879 6505 | http_response.headers(),
|
6880 6506 | expected_headers,
|
6881 6507 | ));
|
6882 6508 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6883 6509 | .await
|
6884 6510 | .expect("unable to extract body to bytes");
|
6885 6511 | ::aws_smithy_protocol_test::assert_ok(
|
6886 - | ::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"))
|
6512 + | ::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"))
|
6887 6513 | );
|
6888 6514 | }
|
6889 6515 | }
|
6890 6516 |
|
6891 - | /// When a list member's value does not fit within length bounds,
|
6517 + | /// When a required member is not set in headers,
|
6892 6518 | /// the response should be a 400 ValidationException.
|
6893 - | /// Test ID: RestJsonMalformedLengthListValue_case1
|
6519 + | /// Test ID: RestJsonMalformedRequiredHeaderUnset
|
6894 6520 | #[::tokio::test]
|
6895 6521 | #[::tracing_test::traced_test]
|
6896 - | async fn rest_json_malformed_length_list_value_case1_malformed_request() {
|
6522 + | async fn rest_json_malformed_required_header_unset_malformed_request() {
|
6897 6523 | {
|
6898 6524 | #[allow(unused_mut)]
|
6899 6525 | let mut http_request = ::http::Request::builder()
|
6900 - | .uri("/MalformedLength")
|
6526 + | .uri("/MalformedRequired")
|
6901 6527 | .method("POST")
|
6902 6528 | .header("content-type", "application/json")
|
6903 6529 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
6904 6530 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6905 - | "{ \"list\" : [\"abcdefghijklmnopqrstuvwxyz\", \"abc\"] }".as_bytes(),
|
6531 + | "{ \"string\": \"abc\" }".as_bytes(),
|
6906 6532 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6907 6533 | )),
|
6908 6534 | ))
|
6909 6535 | .unwrap();
|
6536 + | *http_request.uri_mut() = "/MalformedRequired?stringInQuery=abc".parse().unwrap();
|
6910 6537 | #[allow(unused_mut)]
|
6911 6538 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6912 6539 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6913 6540 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6914 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6541 + | .malformed_required(move |input: crate::input::MalformedRequiredInput| {
|
6915 6542 | let sender = sender.clone();
|
6916 6543 | async move {
|
6917 - | 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> };
|
6544 + | 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> };
|
6918 6545 | sender.send(()).await.expect("receiver dropped early");
|
6919 6546 | result
|
6920 6547 | }
|
6921 6548 | })
|
6922 6549 | .build_unchecked();
|
6923 6550 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6924 6551 | .await
|
6925 6552 | .expect("unable to make an HTTP request");
|
6926 6553 | ::pretty_assertions::assert_eq!(
|
6927 6554 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6928 6555 | http_response.status()
|
6929 6556 | );
|
6930 6557 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6931 6558 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6932 6559 | http_response.headers(),
|
6933 6560 | expected_headers,
|
6934 6561 | ));
|
6935 6562 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6936 6563 | .await
|
6937 6564 | .expect("unable to extract body to bytes");
|
6938 6565 | ::aws_smithy_protocol_test::assert_ok(
|
6939 - | ::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"))
|
6566 + | ::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"))
|
6940 6567 | );
|
6941 6568 | }
|
6942 6569 | }
|
6570 + | }
|
6943 6571 |
|
6944 - | /// When a map member does not fit within length bounds,
|
6945 - | /// the response should be a 400 ValidationException.
|
6946 - | /// Test ID: RestJsonMalformedLengthMap_case0
|
6947 - | #[::tokio::test]
|
6948 - | #[::tracing_test::traced_test]
|
6949 - | async fn rest_json_malformed_length_map_case0_malformed_request() {
|
6950 - | {
|
6951 - | #[allow(unused_mut)]
|
6952 - | let mut http_request = ::http::Request::builder()
|
6953 - | .uri("/MalformedLength")
|
6954 - | .method("POST")
|
6955 - | .header("content-type", "application/json")
|
6956 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
6957 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6958 - | "{ \"map\" : {\"abc\": [\"def\", \"efg\", \"fgh\"]} }".as_bytes(),
|
6959 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6960 - | )),
|
6961 - | ))
|
6962 - | .unwrap();
|
6963 - | #[allow(unused_mut)]
|
6572 + | ::pin_project_lite::pin_project! {
|
6573 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
6574 + | /// [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput) using modelled bindings.
|
6575 + | pub struct MalformedUniqueItemsInputFuture {
|
6576 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedUniqueItemsInput, ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
6577 + | }
|
6578 + | }
|
6579 + |
|
6580 + | impl std::future::Future for MalformedUniqueItemsInputFuture {
|
6581 + | type Output = Result<
|
6582 + | crate::input::MalformedUniqueItemsInput,
|
6583 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
6584 + | >;
|
6585 + |
|
6586 + | fn poll(
|
6587 + | self: std::pin::Pin<&mut Self>,
|
6588 + | cx: &mut std::task::Context<'_>,
|
6589 + | ) -> std::task::Poll<Self::Output> {
|
6590 + | let this = self.project();
|
6591 + | this.inner.as_mut().poll(cx)
|
6592 + | }
|
6593 + | }
|
6594 + |
|
6595 + | impl<B>
|
6596 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
6597 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
6598 + | B,
|
6599 + | > for crate::input::MalformedUniqueItemsInput
|
6600 + | where
|
6601 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
6602 + | B: 'static,
|
6603 + |
|
6604 + | B::Data: Send,
|
6605 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
6606 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
6607 + | {
|
6608 + | type Rejection =
|
6609 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
6610 + | type Future = MalformedUniqueItemsInputFuture;
|
6611 + |
|
6612 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
6613 + | let fut = async move {
|
6614 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
6615 + | request.headers(),
|
6616 + | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
6617 + | ) {
|
6618 + | return Err(::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
6619 + | }
|
6620 + | crate::protocol_serde::shape_malformed_unique_items::de_malformed_unique_items_http_request(request)
|
6621 + | .await
|
6622 + | };
|
6623 + | use ::futures_util::future::TryFutureExt;
|
6624 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
6625 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
6626 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e)
|
6627 + | });
|
6628 + | MalformedUniqueItemsInputFuture {
|
6629 + | inner: Box::pin(fut),
|
6630 + | }
|
6631 + | }
|
6632 + | }
|
6633 + | impl
|
6634 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
6635 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
6636 + | > for crate::output::MalformedUniqueItemsOutput
|
6637 + | {
|
6638 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
6639 + | match crate::protocol_serde::shape_malformed_unique_items::ser_malformed_unique_items_http_response(self) {
|
6640 + | Ok(response) => response,
|
6641 + | Err(e) => {
|
6642 + | ::tracing::error!(error = %e, "failed to serialize response");
|
6643 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
6644 + | }
|
6645 + | }
|
6646 + | }
|
6647 + | }
|
6648 + | impl
|
6649 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
6650 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
6651 + | > for crate::error::MalformedUniqueItemsError
|
6652 + | {
|
6653 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
6654 + | match crate::protocol_serde::shape_malformed_unique_items::ser_malformed_unique_items_http_error(&self) {
|
6655 + | Ok(mut response) => {
|
6656 + | response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
6657 + | response
|
6658 + | },
|
6659 + | Err(e) => {
|
6660 + | ::tracing::error!(error = %e, "failed to serialize response");
|
6661 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
6662 + | }
|
6663 + | }
|
6664 + | }
|
6665 + | }
|
6666 + |
|
6667 + | #[allow(unreachable_code, unused_variables)]
|
6668 + | #[cfg(test)]
|
6669 + | mod malformed_unique_items_test {
|
6670 + |
|
6671 + | /// When a blob list contains non-unique values,
|
6672 + | /// the response should be a 400 ValidationException.
|
6673 + | /// Test ID: RestJsonMalformedUniqueItemsBlobList
|
6674 + | #[::tokio::test]
|
6675 + | #[::tracing_test::traced_test]
|
6676 + | #[should_panic]
|
6677 + | async fn rest_json_malformed_unique_items_blob_list_malformed_request() {
|
6678 + | {
|
6679 + | #[allow(unused_mut)]
|
6680 + | let mut http_request = ::http::Request::builder()
|
6681 + | .uri("/MalformedUniqueItems")
|
6682 + | .method("POST")
|
6683 + | .header("content-type", "application/json")
|
6684 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
6685 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6686 + | "{ \"blobList\" : [\"YQ==\", \"YQ==\"] }".as_bytes(),
|
6687 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6688 + | )),
|
6689 + | ))
|
6690 + | .unwrap();
|
6691 + | #[allow(unused_mut)]
|
6964 6692 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6965 6693 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6966 6694 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6967 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6695 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
6968 6696 | let sender = sender.clone();
|
6969 6697 | async move {
|
6970 - | 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> };
|
6698 + | 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> };
|
6971 6699 | sender.send(()).await.expect("receiver dropped early");
|
6972 6700 | result
|
6973 6701 | }
|
6974 6702 | })
|
6975 6703 | .build_unchecked();
|
6976 6704 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6977 6705 | .await
|
6978 6706 | .expect("unable to make an HTTP request");
|
6979 6707 | ::pretty_assertions::assert_eq!(
|
6980 6708 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6981 6709 | http_response.status()
|
6982 6710 | );
|
6983 6711 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6984 6712 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6985 6713 | http_response.headers(),
|
6986 6714 | expected_headers,
|
6987 6715 | ));
|
6988 6716 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6989 6717 | .await
|
6990 6718 | .expect("unable to extract body to bytes");
|
6991 6719 | ::aws_smithy_protocol_test::assert_ok(
|
6992 - | ::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"))
|
6720 + | ::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"))
|
6993 6721 | );
|
6994 6722 | }
|
6995 6723 | }
|
6996 6724 |
|
6997 - | /// When a map member does not fit within length bounds,
|
6725 + | /// When a boolean list contains non-unique values,
|
6998 6726 | /// the response should be a 400 ValidationException.
|
6999 - | /// Test ID: RestJsonMalformedLengthMap_case1
|
6727 + | /// Test ID: RestJsonMalformedUniqueItemsBooleanList_case0
|
7000 6728 | #[::tokio::test]
|
7001 6729 | #[::tracing_test::traced_test]
|
7002 - | async fn rest_json_malformed_length_map_case1_malformed_request() {
|
6730 + | #[should_panic]
|
6731 + | async fn rest_json_malformed_unique_items_boolean_list_case0_malformed_request() {
|
7003 6732 | {
|
7004 6733 | #[allow(unused_mut)]
|
7005 6734 | let mut http_request = ::http::Request::builder()
|
7006 - | .uri("/MalformedLength")
|
6735 + | .uri("/MalformedUniqueItems")
|
7007 6736 | .method("POST")
|
7008 6737 | .header("content-type", "application/json")
|
7009 6738 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7010 - | ::bytes::Bytes::copy_from_slice(
|
7011 - | &::aws_smithy_protocol_test::decode_body_data("{ \"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(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
7012 - | )
|
7013 - | )).unwrap();
|
6739 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6740 + | "{ \"booleanList\" : [true, true] }".as_bytes(),
|
6741 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6742 + | )),
|
6743 + | ))
|
6744 + | .unwrap();
|
7014 6745 | #[allow(unused_mut)]
|
7015 6746 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7016 6747 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7017 6748 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7018 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6749 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
7019 6750 | let sender = sender.clone();
|
7020 6751 | async move {
|
7021 - | 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> };
|
6752 + | 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> };
|
7022 6753 | sender.send(()).await.expect("receiver dropped early");
|
7023 6754 | result
|
7024 6755 | }
|
7025 6756 | })
|
7026 6757 | .build_unchecked();
|
7027 6758 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7028 6759 | .await
|
7029 6760 | .expect("unable to make an HTTP request");
|
7030 6761 | ::pretty_assertions::assert_eq!(
|
7031 6762 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7032 6763 | http_response.status()
|
7033 6764 | );
|
7034 6765 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7035 6766 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7036 6767 | http_response.headers(),
|
7037 6768 | expected_headers,
|
7038 6769 | ));
|
7039 6770 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7040 6771 | .await
|
7041 6772 | .expect("unable to extract body to bytes");
|
7042 6773 | ::aws_smithy_protocol_test::assert_ok(
|
7043 - | ::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"))
|
6774 + | ::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"))
|
7044 6775 | );
|
7045 6776 | }
|
7046 6777 | }
|
7047 6778 |
|
7048 - | /// When a map member's key does not fit within length bounds,
|
6779 + | /// When a boolean list contains non-unique values,
|
7049 6780 | /// the response should be a 400 ValidationException.
|
7050 - | /// Test ID: RestJsonMalformedLengthMapKey_case0
|
6781 + | /// Test ID: RestJsonMalformedUniqueItemsBooleanList_case1
|
7051 6782 | #[::tokio::test]
|
7052 6783 | #[::tracing_test::traced_test]
|
7053 - | async fn rest_json_malformed_length_map_key_case0_malformed_request() {
|
6784 + | #[should_panic]
|
6785 + | async fn rest_json_malformed_unique_items_boolean_list_case1_malformed_request() {
|
7054 6786 | {
|
7055 6787 | #[allow(unused_mut)]
|
7056 6788 | let mut http_request = ::http::Request::builder()
|
7057 - | .uri("/MalformedLength")
|
6789 + | .uri("/MalformedUniqueItems")
|
7058 6790 | .method("POST")
|
7059 6791 | .header("content-type", "application/json")
|
7060 6792 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7061 - | ::bytes::Bytes::copy_from_slice(
|
7062 - | &::aws_smithy_protocol_test::decode_body_data("{ \"map\" : {\"a\": [\"abc\", \"def\", \"efg\"], \"bcd\": [\"abc\", \"def\", \"efg\"], \"cde\": [\"abc\", \"def\", \"efg\"]} }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
7063 - | )
|
7064 - | )).unwrap();
|
6793 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6794 + | "{ \"booleanList\" : [false, false] }".as_bytes(),
|
6795 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6796 + | )),
|
6797 + | ))
|
6798 + | .unwrap();
|
7065 6799 | #[allow(unused_mut)]
|
7066 6800 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7067 6801 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7068 6802 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7069 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6803 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
7070 6804 | let sender = sender.clone();
|
7071 6805 | async move {
|
7072 - | 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> };
|
6806 + | 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> };
|
7073 6807 | sender.send(()).await.expect("receiver dropped early");
|
7074 6808 | result
|
7075 6809 | }
|
7076 6810 | })
|
7077 6811 | .build_unchecked();
|
7078 6812 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7079 6813 | .await
|
7080 6814 | .expect("unable to make an HTTP request");
|
7081 6815 | ::pretty_assertions::assert_eq!(
|
7082 6816 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7083 6817 | http_response.status()
|
7084 6818 | );
|
7085 6819 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7086 6820 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7087 6821 | http_response.headers(),
|
7088 6822 | expected_headers,
|
7089 6823 | ));
|
7090 6824 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7091 6825 | .await
|
7092 6826 | .expect("unable to extract body to bytes");
|
7093 6827 | ::aws_smithy_protocol_test::assert_ok(
|
7094 - | ::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"))
|
6828 + | ::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"))
|
7095 6829 | );
|
7096 6830 | }
|
7097 6831 | }
|
7098 6832 |
|
7099 - | /// When a map member's key does not fit within length bounds,
|
6833 + | /// When a string list contains non-unique values,
|
7100 6834 | /// the response should be a 400 ValidationException.
|
7101 - | /// Test ID: RestJsonMalformedLengthMapKey_case1
|
6835 + | /// Test ID: RestJsonMalformedUniqueItemsStringList
|
7102 6836 | #[::tokio::test]
|
7103 6837 | #[::tracing_test::traced_test]
|
7104 - | async fn rest_json_malformed_length_map_key_case1_malformed_request() {
|
6838 + | #[should_panic]
|
6839 + | async fn rest_json_malformed_unique_items_string_list_malformed_request() {
|
7105 6840 | {
|
7106 6841 | #[allow(unused_mut)]
|
7107 6842 | let mut http_request = ::http::Request::builder()
|
7108 - | .uri("/MalformedLength")
|
6843 + | .uri("/MalformedUniqueItems")
|
7109 6844 | .method("POST")
|
7110 6845 | .header("content-type", "application/json")
|
7111 6846 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7112 - | ::bytes::Bytes::copy_from_slice(
|
7113 - | &::aws_smithy_protocol_test::decode_body_data("{ \"map\" : {\"abcdefghijklmnopqrstuvwxyz\": [\"abc\", \"def\", \"efg\"], \"bcd\": [\"abc\", \"def\", \"efg\"], \"cde\": [\"abc\", \"def\", \"efg\"]} }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
7114 - | )
|
7115 - | )).unwrap();
|
6847 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6848 + | "{ \"stringList\" : [\"abc\", \"abc\"] }".as_bytes(),
|
6849 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6850 + | )),
|
6851 + | ))
|
6852 + | .unwrap();
|
7116 6853 | #[allow(unused_mut)]
|
7117 6854 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7118 6855 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7119 6856 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7120 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6857 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
7121 6858 | let sender = sender.clone();
|
7122 6859 | async move {
|
7123 - | 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> };
|
6860 + | 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> };
|
7124 6861 | sender.send(()).await.expect("receiver dropped early");
|
7125 6862 | result
|
7126 6863 | }
|
7127 6864 | })
|
7128 6865 | .build_unchecked();
|
7129 6866 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7130 6867 | .await
|
7131 6868 | .expect("unable to make an HTTP request");
|
7132 6869 | ::pretty_assertions::assert_eq!(
|
7133 6870 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7134 6871 | http_response.status()
|
7135 6872 | );
|
7136 6873 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7137 6874 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7138 6875 | http_response.headers(),
|
7139 6876 | expected_headers,
|
7140 6877 | ));
|
7141 6878 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7142 6879 | .await
|
7143 6880 | .expect("unable to extract body to bytes");
|
7144 6881 | ::aws_smithy_protocol_test::assert_ok(
|
7145 - | ::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"))
|
6882 + | ::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"))
|
7146 6883 | );
|
7147 6884 | }
|
7148 6885 | }
|
7149 6886 |
|
7150 - | /// When a map member's value does not fit within length bounds,
|
6887 + | /// When a byte list contains non-unique values,
|
7151 6888 | /// the response should be a 400 ValidationException.
|
7152 - | /// Test ID: RestJsonMalformedLengthMapValue_case0
|
6889 + | /// Test ID: RestJsonMalformedUniqueItemsByteList
|
7153 6890 | #[::tokio::test]
|
7154 6891 | #[::tracing_test::traced_test]
|
7155 - | async fn rest_json_malformed_length_map_value_case0_malformed_request() {
|
6892 + | #[should_panic]
|
6893 + | async fn rest_json_malformed_unique_items_byte_list_malformed_request() {
|
7156 6894 | {
|
7157 6895 | #[allow(unused_mut)]
|
7158 6896 | let mut http_request = ::http::Request::builder()
|
7159 - | .uri("/MalformedLength")
|
6897 + | .uri("/MalformedUniqueItems")
|
7160 6898 | .method("POST")
|
7161 6899 | .header("content-type", "application/json")
|
7162 6900 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7163 - | ::bytes::Bytes::copy_from_slice(
|
7164 - | &::aws_smithy_protocol_test::decode_body_data("{ \"map\" : {\"abc\": [\"def\"], \"bcd\": [\"abc\", \"def\", \"efg\"], \"cde\": [\"abc\", \"def\", \"efg\"]} }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
7165 - | )
|
7166 - | )).unwrap();
|
6901 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6902 + | "{ \"byteList\" : [1, 1] }".as_bytes(),
|
6903 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6904 + | )),
|
6905 + | ))
|
6906 + | .unwrap();
|
7167 6907 | #[allow(unused_mut)]
|
7168 6908 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7169 6909 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7170 6910 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7171 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6911 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
7172 6912 | let sender = sender.clone();
|
7173 6913 | async move {
|
7174 - | 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> };
|
6914 + | 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> };
|
7175 6915 | sender.send(()).await.expect("receiver dropped early");
|
7176 6916 | result
|
7177 6917 | }
|
7178 6918 | })
|
7179 6919 | .build_unchecked();
|
7180 6920 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7181 6921 | .await
|
7182 6922 | .expect("unable to make an HTTP request");
|
7183 6923 | ::pretty_assertions::assert_eq!(
|
7184 6924 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7185 6925 | http_response.status()
|
7186 6926 | );
|
7187 6927 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7188 6928 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7189 6929 | http_response.headers(),
|
7190 6930 | expected_headers,
|
7191 6931 | ));
|
7192 6932 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7193 6933 | .await
|
7194 6934 | .expect("unable to extract body to bytes");
|
7195 6935 | ::aws_smithy_protocol_test::assert_ok(
|
7196 - | ::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"))
|
6936 + | ::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"))
|
7197 6937 | );
|
7198 6938 | }
|
7199 6939 | }
|
7200 6940 |
|
7201 - | /// When a map member's value does not fit within length bounds,
|
6941 + | /// When a short list contains non-unique values,
|
7202 6942 | /// the response should be a 400 ValidationException.
|
7203 - | /// Test ID: RestJsonMalformedLengthMapValue_case1
|
6943 + | /// Test ID: RestJsonMalformedUniqueItemsShortList
|
7204 6944 | #[::tokio::test]
|
7205 6945 | #[::tracing_test::traced_test]
|
7206 - | async fn rest_json_malformed_length_map_value_case1_malformed_request() {
|
6946 + | #[should_panic]
|
6947 + | async fn rest_json_malformed_unique_items_short_list_malformed_request() {
|
7207 6948 | {
|
7208 6949 | #[allow(unused_mut)]
|
7209 6950 | let mut http_request = ::http::Request::builder()
|
7210 - | .uri("/MalformedLength")
|
6951 + | .uri("/MalformedUniqueItems")
|
7211 6952 | .method("POST")
|
7212 6953 | .header("content-type", "application/json")
|
7213 6954 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7214 - | ::bytes::Bytes::copy_from_slice(
|
7215 - | &::aws_smithy_protocol_test::decode_body_data("{ \"map\" : {\"abc\": [\"def\", \"efg\", \"fgh\", \"def\", \"efg\", \"fgh\", \"def\", \"efg\", \"fgh\", \"def\"],\n \"bcd\": [\"abc\", \"def\", \"efg\"],\n \"cde\": [\"abc\", \"def\", \"efg\"]} }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
7216 - | )
|
7217 - | )).unwrap();
|
6955 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6956 + | "{ \"shortList\" : [2, 2] }".as_bytes(),
|
6957 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6958 + | )),
|
6959 + | ))
|
6960 + | .unwrap();
|
7218 6961 | #[allow(unused_mut)]
|
7219 6962 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7220 6963 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7221 6964 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7222 - | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6965 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
7223 6966 | let sender = sender.clone();
|
7224 6967 | async move {
|
7225 - | 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> };
|
6968 + | 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> };
|
7226 6969 | sender.send(()).await.expect("receiver dropped early");
|
7227 6970 | result
|
7228 6971 | }
|
7229 6972 | })
|
7230 6973 | .build_unchecked();
|
7231 6974 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7232 6975 | .await
|
7233 6976 | .expect("unable to make an HTTP request");
|
7234 6977 | ::pretty_assertions::assert_eq!(
|
7235 6978 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7236 6979 | http_response.status()
|
7237 6980 | );
|
7238 6981 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7239 6982 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7240 6983 | http_response.headers(),
|
7241 6984 | expected_headers,
|
7242 6985 | ));
|
7243 6986 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7244 6987 | .await
|
7245 6988 | .expect("unable to extract body to bytes");
|
7246 6989 | ::aws_smithy_protocol_test::assert_ok(
|
7247 - | ::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"))
|
6990 + | ::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"))
|
7248 6991 | );
|
7249 6992 | }
|
7250 6993 | }
|
7251 - | }
|
7252 6994 |
|
7253 - | ::pin_project_lite::pin_project! {
|
7254 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
7255 - | /// [`MalformedEnumInput`](crate::input::MalformedEnumInput) using modelled bindings.
|
7256 - | pub struct MalformedEnumInputFuture {
|
7257 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedEnumInput, ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
7258 - | }
|
7259 - | }
|
7260 - |
|
7261 - | impl std::future::Future for MalformedEnumInputFuture {
|
7262 - | type Output = Result<
|
7263 - | crate::input::MalformedEnumInput,
|
7264 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
7265 - | >;
|
7266 - |
|
7267 - | fn poll(
|
7268 - | self: std::pin::Pin<&mut Self>,
|
7269 - | cx: &mut std::task::Context<'_>,
|
7270 - | ) -> std::task::Poll<Self::Output> {
|
7271 - | let this = self.project();
|
7272 - | this.inner.as_mut().poll(cx)
|
7273 - | }
|
7274 - | }
|
7275 - |
|
7276 - | impl<B>
|
7277 - | ::aws_smithy_legacy_http_server::request::FromRequest<
|
7278 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
7279 - | B,
|
7280 - | > for crate::input::MalformedEnumInput
|
7281 - | where
|
7282 - | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
7283 - | B: 'static,
|
7284 - |
|
7285 - | B::Data: Send,
|
7286 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
7287 - | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
7288 - | {
|
7289 - | type Rejection =
|
7290 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
7291 - | type Future = MalformedEnumInputFuture;
|
7292 - |
|
7293 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
7294 - | let fut = async move {
|
7295 - | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
7296 - | request.headers(),
|
7297 - | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
7298 - | ) {
|
7299 - | return Err(::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
7300 - | }
|
7301 - | crate::protocol_serde::shape_malformed_enum::de_malformed_enum_http_request(request)
|
7302 - | .await
|
7303 - | };
|
7304 - | use ::futures_util::future::TryFutureExt;
|
7305 - | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
7306 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
7307 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e)
|
7308 - | });
|
7309 - | MalformedEnumInputFuture {
|
7310 - | inner: Box::pin(fut),
|
7311 - | }
|
7312 - | }
|
7313 - | }
|
7314 - | impl
|
7315 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
7316 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
7317 - | > for crate::output::MalformedEnumOutput
|
7318 - | {
|
7319 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
7320 - | match crate::protocol_serde::shape_malformed_enum::ser_malformed_enum_http_response(self) {
|
7321 - | Ok(response) => response,
|
7322 - | Err(e) => {
|
7323 - | ::tracing::error!(error = %e, "failed to serialize response");
|
7324 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
7325 - | }
|
7326 - | }
|
7327 - | }
|
7328 - | }
|
7329 - | impl
|
7330 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
7331 - | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
7332 - | > for crate::error::MalformedEnumError
|
7333 - | {
|
7334 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
7335 - | match crate::protocol_serde::shape_malformed_enum::ser_malformed_enum_http_error(&self) {
|
7336 - | Ok(mut response) => {
|
7337 - | response.extensions_mut().insert(
|
7338 - | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
7339 - | self.name(),
|
7340 - | ),
|
7341 - | );
|
7342 - | response
|
7343 - | }
|
7344 - | Err(e) => {
|
7345 - | ::tracing::error!(error = %e, "failed to serialize response");
|
7346 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
7347 - | }
|
7348 - | }
|
7349 - | }
|
7350 - | }
|
7351 - |
|
7352 - | #[allow(unreachable_code, unused_variables)]
|
7353 - | #[cfg(test)]
|
7354 - | mod malformed_enum_test {
|
7355 - |
|
7356 - | /// When a string member does not contain a valid enum value,
|
7357 - | /// the response should be a 400 ValidationException. Internal-only
|
7358 - | /// enum values are excluded from the response message.
|
7359 - | /// Test ID: RestJsonMalformedEnumString_case0
|
6995 + | /// When an integer list contains non-unique values,
|
6996 + | /// the response should be a 400 ValidationException.
|
6997 + | /// Test ID: RestJsonMalformedUniqueItemsIntegerList
|
7360 6998 | #[::tokio::test]
|
7361 6999 | #[::tracing_test::traced_test]
|
7362 7000 | #[should_panic]
|
7363 - | async fn rest_json_malformed_enum_string_case0_malformed_request() {
|
7001 + | async fn rest_json_malformed_unique_items_integer_list_malformed_request() {
|
7364 7002 | {
|
7365 7003 | #[allow(unused_mut)]
|
7366 7004 | let mut http_request = ::http::Request::builder()
|
7367 - | .uri("/MalformedEnum")
|
7005 + | .uri("/MalformedUniqueItems")
|
7368 7006 | .method("POST")
|
7369 7007 | .header("content-type", "application/json")
|
7370 7008 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7371 7009 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
7372 - | "{ \"string\" : \"ABC\" }".as_bytes(),
|
7010 + | "{ \"integerList\" : [3, 3] }".as_bytes(),
|
7373 7011 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7374 7012 | )),
|
7375 7013 | ))
|
7376 7014 | .unwrap();
|
7377 7015 | #[allow(unused_mut)]
|
7378 7016 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7379 7017 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7380 7018 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7381 - | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7019 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
7382 7020 | let sender = sender.clone();
|
7383 7021 | async move {
|
7384 - | 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> };
|
7022 + | 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> };
|
7385 7023 | sender.send(()).await.expect("receiver dropped early");
|
7386 7024 | result
|
7387 7025 | }
|
7388 7026 | })
|
7389 7027 | .build_unchecked();
|
7390 7028 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7391 7029 | .await
|
7392 7030 | .expect("unable to make an HTTP request");
|
7393 7031 | ::pretty_assertions::assert_eq!(
|
7394 7032 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7395 7033 | http_response.status()
|
7396 7034 | );
|
7397 7035 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7398 7036 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7399 7037 | http_response.headers(),
|
7400 7038 | expected_headers,
|
7401 7039 | ));
|
7402 7040 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7403 7041 | .await
|
7404 7042 | .expect("unable to extract body to bytes");
|
7405 7043 | ::aws_smithy_protocol_test::assert_ok(
|
7406 - | ::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"))
|
7044 + | ::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"))
|
7407 7045 | );
|
7408 7046 | }
|
7409 7047 | }
|
7410 7048 |
|
7411 - | /// When a string member does not contain a valid enum value,
|
7412 - | /// the response should be a 400 ValidationException. Internal-only
|
7413 - | /// enum values are excluded from the response message.
|
7414 - | /// Test ID: RestJsonMalformedEnumString_case1
|
7049 + | /// When an integer list contains non-unique values,
|
7050 + | /// the response should be a 400 ValidationException.
|
7051 + | /// Test ID: RestJsonMalformedUniqueItemsLongList
|
7415 7052 | #[::tokio::test]
|
7416 7053 | #[::tracing_test::traced_test]
|
7417 7054 | #[should_panic]
|
7418 - | async fn rest_json_malformed_enum_string_case1_malformed_request() {
|
7055 + | async fn rest_json_malformed_unique_items_long_list_malformed_request() {
|
7419 7056 | {
|
7420 7057 | #[allow(unused_mut)]
|
7421 7058 | let mut http_request = ::http::Request::builder()
|
7422 - | .uri("/MalformedEnum")
|
7059 + | .uri("/MalformedUniqueItems")
|
7423 7060 | .method("POST")
|
7424 7061 | .header("content-type", "application/json")
|
7425 7062 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7426 7063 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
7427 - | "{ \"string\" : \"XYZ\" }".as_bytes(),
|
7064 + | "{ \"longList\" : [4, 4] }".as_bytes(),
|
7428 7065 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7429 7066 | )),
|
7430 7067 | ))
|
7431 7068 | .unwrap();
|
7432 7069 | #[allow(unused_mut)]
|
7433 7070 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7434 7071 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7435 7072 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7436 - | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7073 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
7437 7074 | let sender = sender.clone();
|
7438 7075 | async move {
|
7439 - | 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> };
|
7076 + | 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> };
|
7440 7077 | sender.send(()).await.expect("receiver dropped early");
|
7441 7078 | result
|
7442 7079 | }
|
7443 7080 | })
|
7444 7081 | .build_unchecked();
|
7445 7082 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7446 7083 | .await
|
7447 7084 | .expect("unable to make an HTTP request");
|
7448 7085 | ::pretty_assertions::assert_eq!(
|
7449 7086 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7450 7087 | http_response.status()
|
7451 7088 | );
|
7452 7089 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7453 7090 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7454 7091 | http_response.headers(),
|
7455 7092 | expected_headers,
|
7456 7093 | ));
|
7457 7094 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7458 7095 | .await
|
7459 7096 | .expect("unable to extract body to bytes");
|
7460 7097 | ::aws_smithy_protocol_test::assert_ok(
|
7461 - | ::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"))
|
7098 + | ::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"))
|
7462 7099 | );
|
7463 7100 | }
|
7464 7101 | }
|
7465 7102 |
|
7466 - | /// When a string member does not contain a valid enum value,
|
7467 - | /// the response should be a 400 ValidationException. Internal-only
|
7468 - | /// enum values are excluded from the response message.
|
7469 - | /// Test ID: RestJsonMalformedEnumTraitString_case0
|
7103 + | /// When a timestamp list contains non-unique values,
|
7104 + | /// the response should be a 400 ValidationException.
|
7105 + | /// Test ID: RestJsonMalformedUniqueItemsTimestampList
|
7470 7106 | #[::tokio::test]
|
7471 7107 | #[::tracing_test::traced_test]
|
7472 7108 | #[should_panic]
|
7473 - | async fn rest_json_malformed_enum_trait_string_case0_malformed_request() {
|
7109 + | async fn rest_json_malformed_unique_items_timestamp_list_malformed_request() {
|
7474 7110 | {
|
7475 7111 | #[allow(unused_mut)]
|
7476 7112 | let mut http_request = ::http::Request::builder()
|
7477 - | .uri("/MalformedEnum")
|
7113 + | .uri("/MalformedUniqueItems")
|
7478 7114 | .method("POST")
|
7479 7115 | .header("content-type", "application/json")
|
7480 7116 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7481 7117 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
7482 - | "{ \"stringWithEnumTrait\" : \"ABC\" }".as_bytes(),
|
7118 + | "{ \"timestampList\" : [1676660607, 1676660607] }".as_bytes(),
|
7483 7119 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7484 7120 | )),
|
7485 7121 | ))
|
7486 7122 | .unwrap();
|
7487 7123 | #[allow(unused_mut)]
|
7488 7124 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7489 7125 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7490 7126 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7491 - | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7127 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
7492 7128 | let sender = sender.clone();
|
7493 7129 | async move {
|
7494 - | 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> };
|
7130 + | 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> };
|
7495 7131 | sender.send(()).await.expect("receiver dropped early");
|
7496 7132 | result
|
7497 7133 | }
|
7498 7134 | })
|
7499 7135 | .build_unchecked();
|
7500 7136 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7501 7137 | .await
|
7502 7138 | .expect("unable to make an HTTP request");
|
7503 7139 | ::pretty_assertions::assert_eq!(
|
7504 7140 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7505 7141 | http_response.status()
|
7506 7142 | );
|
7507 7143 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7508 7144 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7509 7145 | http_response.headers(),
|
7510 7146 | expected_headers,
|
7511 7147 | ));
|
7512 7148 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7513 7149 | .await
|
7514 7150 | .expect("unable to extract body to bytes");
|
7515 7151 | ::aws_smithy_protocol_test::assert_ok(
|
7516 - | ::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"))
|
7152 + | ::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"))
|
7517 7153 | );
|
7518 7154 | }
|
7519 7155 | }
|
7520 7156 |
|
7521 - | /// When a string member does not contain a valid enum value,
|
7522 - | /// the response should be a 400 ValidationException. Internal-only
|
7523 - | /// enum values are excluded from the response message.
|
7524 - | /// Test ID: RestJsonMalformedEnumTraitString_case1
|
7157 + | /// When a date-time timestamp list contains non-unique values,
|
7158 + | /// the response should be a 400 ValidationException.
|
7159 + | /// Test ID: RestJsonMalformedUniqueItemsDateTimeList
|
7525 7160 | #[::tokio::test]
|
7526 7161 | #[::tracing_test::traced_test]
|
7527 7162 | #[should_panic]
|
7528 - | async fn rest_json_malformed_enum_trait_string_case1_malformed_request() {
|
7163 + | async fn rest_json_malformed_unique_items_date_time_list_malformed_request() {
|
7529 7164 | {
|
7530 7165 | #[allow(unused_mut)]
|
7531 7166 | let mut http_request = ::http::Request::builder()
|
7532 - | .uri("/MalformedEnum")
|
7167 + | .uri("/MalformedUniqueItems")
|
7533 7168 | .method("POST")
|
7534 7169 | .header("content-type", "application/json")
|
7535 7170 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7536 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
7537 - | "{ \"stringWithEnumTrait\" : \"XYZ\" }".as_bytes(),
|
7538 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7539 - | )),
|
7540 - | ))
|
7541 - | .unwrap();
|
7171 + | ::bytes::Bytes::copy_from_slice(
|
7172 + | &::aws_smithy_protocol_test::decode_body_data("{ \"dateTimeList\" : [\"1985-04-12T23:20:50.52Z\", \"1985-04-12T23:20:50.52Z\"] }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
7173 + | )
|
7174 + | )).unwrap();
|
7542 7175 | #[allow(unused_mut)]
|
7543 7176 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7544 7177 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7545 7178 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7546 - | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7179 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
7547 7180 | let sender = sender.clone();
|
7548 7181 | async move {
|
7549 - | 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> };
|
7182 + | 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> };
|
7550 7183 | sender.send(()).await.expect("receiver dropped early");
|
7551 7184 | result
|
7552 7185 | }
|
7553 7186 | })
|
7554 7187 | .build_unchecked();
|
7555 7188 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7556 7189 | .await
|
7557 7190 | .expect("unable to make an HTTP request");
|
7558 7191 | ::pretty_assertions::assert_eq!(
|
7559 7192 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7560 7193 | http_response.status()
|
7561 7194 | );
|
7562 7195 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7563 7196 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7564 7197 | http_response.headers(),
|
7565 7198 | expected_headers,
|
7566 7199 | ));
|
7567 7200 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7568 7201 | .await
|
7569 7202 | .expect("unable to extract body to bytes");
|
7570 7203 | ::aws_smithy_protocol_test::assert_ok(
|
7571 - | ::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"))
|
7204 + | ::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"))
|
7572 7205 | );
|
7573 7206 | }
|
7574 7207 | }
|
7575 7208 |
|
7576 - | /// When a list member value does not contain a valid enum value,
|
7577 - | /// the response should be a 400 ValidationException. Internal-only
|
7578 - | /// enum values are excluded from the response message.
|
7579 - | /// Test ID: RestJsonMalformedEnumList_case0
|
7209 + | /// When a http-date timestamp list contains non-unique values,
|
7210 + | /// the response should be a 400 ValidationException.
|
7211 + | /// Test ID: RestJsonMalformedUniqueItemsHttpDateList_case0
|
7580 7212 | #[::tokio::test]
|
7581 7213 | #[::tracing_test::traced_test]
|
7582 7214 | #[should_panic]
|
7583 - | async fn rest_json_malformed_enum_list_case0_malformed_request() {
|
7215 + | async fn rest_json_malformed_unique_items_http_date_list_case0_malformed_request() {
|
7584 7216 | {
|
7585 7217 | #[allow(unused_mut)]
|
7586 7218 | let mut http_request = ::http::Request::builder()
|
7587 - | .uri("/MalformedEnum")
|
7219 + | .uri("/MalformedUniqueItems")
|
7588 7220 | .method("POST")
|
7589 7221 | .header("content-type", "application/json")
|
7590 7222 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7591 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
7592 - | "{ \"list\" : [\"ABC\"] }".as_bytes(),
|
7593 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7594 - | )),
|
7595 - | ))
|
7596 - | .unwrap();
|
7223 + | ::bytes::Bytes::copy_from_slice(
|
7224 + | &::aws_smithy_protocol_test::decode_body_data("{ \"httpDateList\" : [\"Tue, 29 Apr 2014 18:30:38 GMT\", \"Tue, 29 Apr 2014 18:30:38 GMT\"] }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
7225 + | )
|
7226 + | )).unwrap();
|
7597 7227 | #[allow(unused_mut)]
|
7598 7228 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7599 7229 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7600 7230 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7601 - | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7231 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
7602 7232 | let sender = sender.clone();
|
7603 7233 | async move {
|
7604 - | 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> };
|
7234 + | 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> };
|
7605 7235 | sender.send(()).await.expect("receiver dropped early");
|
7606 7236 | result
|
7607 7237 | }
|
7608 7238 | })
|
7609 7239 | .build_unchecked();
|
7610 7240 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7611 7241 | .await
|
7612 7242 | .expect("unable to make an HTTP request");
|
7613 7243 | ::pretty_assertions::assert_eq!(
|
7614 7244 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7615 7245 | http_response.status()
|
7616 7246 | );
|
7617 7247 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7618 7248 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7619 7249 | http_response.headers(),
|
7620 7250 | expected_headers,
|
7621 7251 | ));
|
7622 7252 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7623 7253 | .await
|
7624 7254 | .expect("unable to extract body to bytes");
|
7625 7255 | ::aws_smithy_protocol_test::assert_ok(
|
7626 - | ::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"))
|
7256 + | ::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"))
|
7627 7257 | );
|
7628 7258 | }
|
7629 7259 | }
|
7630 7260 |
|
7631 - | /// When a list member value does not contain a valid enum value,
|
7632 - | /// the response should be a 400 ValidationException. Internal-only
|
7633 - | /// enum values are excluded from the response message.
|
7634 - | /// Test ID: RestJsonMalformedEnumList_case1
|
7261 + | /// When an enum list contains non-unique values,
|
7262 + | /// the response should be a 400 ValidationException.
|
7263 + | /// Test ID: RestJsonMalformedUniqueItemsEnumList
|
7635 7264 | #[::tokio::test]
|
7636 7265 | #[::tracing_test::traced_test]
|
7637 7266 | #[should_panic]
|
7638 - | async fn rest_json_malformed_enum_list_case1_malformed_request() {
|
7267 + | async fn rest_json_malformed_unique_items_enum_list_malformed_request() {
|
7639 7268 | {
|
7640 7269 | #[allow(unused_mut)]
|
7641 7270 | let mut http_request = ::http::Request::builder()
|
7642 - | .uri("/MalformedEnum")
|
7271 + | .uri("/MalformedUniqueItems")
|
7643 7272 | .method("POST")
|
7644 7273 | .header("content-type", "application/json")
|
7645 7274 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7646 7275 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
7647 - | "{ \"list\" : [\"XYZ\"] }".as_bytes(),
|
7276 + | "{ \"enumList\" : [\"Foo\", \"Foo\"] }".as_bytes(),
|
7648 7277 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7649 7278 | )),
|
7650 7279 | ))
|
7651 7280 | .unwrap();
|
7652 7281 | #[allow(unused_mut)]
|
7653 7282 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7654 7283 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7655 7284 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7656 - | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7285 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
7657 7286 | let sender = sender.clone();
|
7658 7287 | async move {
|
7659 - | 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> };
|
7288 + | 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> };
|
7660 7289 | sender.send(()).await.expect("receiver dropped early");
|
7661 7290 | result
|
7662 7291 | }
|
7663 7292 | })
|
7664 7293 | .build_unchecked();
|
7665 7294 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7666 7295 | .await
|
7667 7296 | .expect("unable to make an HTTP request");
|
7668 7297 | ::pretty_assertions::assert_eq!(
|
7669 7298 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7670 7299 | http_response.status()
|
7671 7300 | );
|
7672 7301 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7673 7302 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7674 7303 | http_response.headers(),
|
7675 7304 | expected_headers,
|
7676 7305 | ));
|
7677 7306 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7678 7307 | .await
|
7679 7308 | .expect("unable to extract body to bytes");
|
7680 7309 | ::aws_smithy_protocol_test::assert_ok(
|
7681 - | ::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"))
|
7310 + | ::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"))
|
7682 7311 | );
|
7683 7312 | }
|
7684 7313 | }
|
7685 7314 |
|
7686 - | /// When a map member's key does not contain a valid enum value,
|
7687 - | /// the response should be a 400 ValidationException. Internal-only
|
7688 - | /// enum values are excluded from the response message.
|
7689 - | /// Test ID: RestJsonMalformedEnumMapKey_case0
|
7315 + | /// When an intEnum list contains non-unique values,
|
7316 + | /// the response should be a 400 ValidationException.
|
7317 + | /// Test ID: RestJsonMalformedUniqueItemsIntEnumList
|
7690 7318 | #[::tokio::test]
|
7691 7319 | #[::tracing_test::traced_test]
|
7692 7320 | #[should_panic]
|
7693 - | async fn rest_json_malformed_enum_map_key_case0_malformed_request() {
|
7321 + | async fn rest_json_malformed_unique_items_int_enum_list_malformed_request() {
|
7694 7322 | {
|
7695 7323 | #[allow(unused_mut)]
|
7696 7324 | let mut http_request = ::http::Request::builder()
|
7697 - | .uri("/MalformedEnum")
|
7325 + | .uri("/MalformedUniqueItems")
|
7698 7326 | .method("POST")
|
7699 7327 | .header("content-type", "application/json")
|
7700 7328 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7701 7329 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
7702 - | "{ \"map\" : { \"ABC\" : \"abc\" } }".as_bytes(),
|
7330 + | "{ \"intEnumList\" : [3, 3] }".as_bytes(),
|
7703 7331 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7704 7332 | )),
|
7705 7333 | ))
|
7706 7334 | .unwrap();
|
7707 7335 | #[allow(unused_mut)]
|
7708 7336 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7709 7337 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7710 7338 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7711 - | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7339 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
7712 7340 | let sender = sender.clone();
|
7713 7341 | async move {
|
7714 - | 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> };
|
7342 + | 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> };
|
7715 7343 | sender.send(()).await.expect("receiver dropped early");
|
7716 7344 | result
|
7717 7345 | }
|
7718 7346 | })
|
7719 7347 | .build_unchecked();
|
7720 7348 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7721 7349 | .await
|
7722 7350 | .expect("unable to make an HTTP request");
|
7723 7351 | ::pretty_assertions::assert_eq!(
|
7724 7352 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7725 7353 | http_response.status()
|
7726 7354 | );
|
7727 7355 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7728 7356 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7729 7357 | http_response.headers(),
|
7730 7358 | expected_headers,
|
7731 7359 | ));
|
7732 7360 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7733 7361 | .await
|
7734 7362 | .expect("unable to extract body to bytes");
|
7735 7363 | ::aws_smithy_protocol_test::assert_ok(
|
7736 - | ::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"))
|
7364 + | ::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"))
|
7737 7365 | );
|
7738 7366 | }
|
7739 7367 | }
|
7740 7368 |
|
7741 - | /// When a map member's key does not contain a valid enum value,
|
7742 - | /// the response should be a 400 ValidationException. Internal-only
|
7743 - | /// enum values are excluded from the response message.
|
7744 - | /// Test ID: RestJsonMalformedEnumMapKey_case1
|
7369 + | /// When an list of lists contains non-unique values,
|
7370 + | /// the response should be a 400 ValidationException.
|
7371 + | /// Test ID: RestJsonMalformedUniqueItemsListList
|
7745 7372 | #[::tokio::test]
|
7746 7373 | #[::tracing_test::traced_test]
|
7747 7374 | #[should_panic]
|
7748 - | async fn rest_json_malformed_enum_map_key_case1_malformed_request() {
|
7375 + | async fn rest_json_malformed_unique_items_list_list_malformed_request() {
|
7749 7376 | {
|
7750 7377 | #[allow(unused_mut)]
|
7751 7378 | let mut http_request = ::http::Request::builder()
|
7752 - | .uri("/MalformedEnum")
|
7379 + | .uri("/MalformedUniqueItems")
|
7753 7380 | .method("POST")
|
7754 7381 | .header("content-type", "application/json")
|
7755 7382 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7756 7383 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
7757 - | "{ \"map\" : { \"XYZ\" : \"abc\" } }".as_bytes(),
|
7384 + | "{ \"listList\" : [[\"foo\",\"bar\"], [\"foo\",\"bar\"]] }".as_bytes(),
|
7758 7385 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7759 7386 | )),
|
7760 7387 | ))
|
7761 7388 | .unwrap();
|
7762 7389 | #[allow(unused_mut)]
|
7763 7390 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7764 7391 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7765 7392 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7766 - | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7393 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
7767 7394 | let sender = sender.clone();
|
7768 7395 | async move {
|
7769 - | 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> };
|
7396 + | 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> };
|
7770 7397 | sender.send(()).await.expect("receiver dropped early");
|
7771 7398 | result
|
7772 7399 | }
|
7773 7400 | })
|
7774 7401 | .build_unchecked();
|
7775 7402 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7776 7403 | .await
|
7777 7404 | .expect("unable to make an HTTP request");
|
7778 7405 | ::pretty_assertions::assert_eq!(
|
7779 7406 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7780 7407 | http_response.status()
|
7781 7408 | );
|
7782 7409 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7783 7410 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7784 7411 | http_response.headers(),
|
7785 7412 | expected_headers,
|
7786 7413 | ));
|
7787 7414 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7788 7415 | .await
|
7789 7416 | .expect("unable to extract body to bytes");
|
7790 7417 | ::aws_smithy_protocol_test::assert_ok(
|
7791 - | ::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"))
|
7418 + | ::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"))
|
7792 7419 | );
|
7793 7420 | }
|
7794 7421 | }
|
7795 7422 |
|
7796 - | /// When a map member's value does not contain a valid enum value,
|
7797 - | /// the response should be a 400 ValidationException. Internal-only
|
7798 - | /// enum values are excluded from the response message.
|
7799 - | /// Test ID: RestJsonMalformedEnumMapValue_case0
|
7423 + | /// When an list of structures contains non-unique values,
|
7424 + | /// the response should be a 400 ValidationException.
|
7425 + | /// Test ID: RestJsonMalformedUniqueItemsStructureList
|
7800 7426 | #[::tokio::test]
|
7801 7427 | #[::tracing_test::traced_test]
|
7802 7428 | #[should_panic]
|
7803 - | async fn rest_json_malformed_enum_map_value_case0_malformed_request() {
|
7429 + | async fn rest_json_malformed_unique_items_structure_list_malformed_request() {
|
7804 7430 | {
|
7805 7431 | #[allow(unused_mut)]
|
7806 7432 | let mut http_request = ::http::Request::builder()
|
7807 - | .uri("/MalformedEnum")
|
7433 + | .uri("/MalformedUniqueItems")
|
7808 7434 | .method("POST")
|
7809 7435 | .header("content-type", "application/json")
|
7810 7436 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7811 7437 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
7812 - | "{ \"map\" : { \"abc\": \"ABC\" } }".as_bytes(),
|
7438 + | "{ \"structureList\" : [{\"hi\": \"hello\"}, {\"hi\": \"hello\"}] }"
|
7439 + | .as_bytes(),
|
7813 7440 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7814 7441 | )),
|
7815 7442 | ))
|
7816 7443 | .unwrap();
|
7817 7444 | #[allow(unused_mut)]
|
7818 7445 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7819 7446 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7820 7447 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7821 - | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7448 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
7822 7449 | let sender = sender.clone();
|
7823 7450 | async move {
|
7824 - | 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> };
|
7451 + | 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> };
|
7825 7452 | sender.send(()).await.expect("receiver dropped early");
|
7826 7453 | result
|
7827 7454 | }
|
7828 7455 | })
|
7829 7456 | .build_unchecked();
|
7830 7457 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7831 7458 | .await
|
7832 7459 | .expect("unable to make an HTTP request");
|
7833 7460 | ::pretty_assertions::assert_eq!(
|
7834 7461 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7835 7462 | http_response.status()
|
7836 7463 | );
|
7837 7464 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7838 7465 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7839 7466 | http_response.headers(),
|
7840 7467 | expected_headers,
|
7841 7468 | ));
|
7842 7469 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7843 7470 | .await
|
7844 7471 | .expect("unable to extract body to bytes");
|
7845 7472 | ::aws_smithy_protocol_test::assert_ok(
|
7846 - | ::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"))
|
7473 + | ::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"))
|
7847 7474 | );
|
7848 7475 | }
|
7849 7476 | }
|
7850 7477 |
|
7851 - | /// When a map member's value does not contain a valid enum value,
|
7852 - | /// the response should be a 400 ValidationException. Internal-only
|
7853 - | /// enum values are excluded from the response message.
|
7854 - | /// Test ID: RestJsonMalformedEnumMapValue_case1
|
7478 + | /// When a list of structures does not contain required keys,
|
7479 + | /// the response should be a 400 ValidationException and not
|
7480 + | /// a 500 error.
|
7481 + | /// Test ID: RestJsonMalformedUniqueItemsStructureMissingKeyList
|
7855 7482 | #[::tokio::test]
|
7856 7483 | #[::tracing_test::traced_test]
|
7857 - | #[should_panic]
|
7858 - | async fn rest_json_malformed_enum_map_value_case1_malformed_request() {
|
7484 + | async fn rest_json_malformed_unique_items_structure_missing_key_list_malformed_request() {
|
7859 7485 | {
|
7860 7486 | #[allow(unused_mut)]
|
7861 7487 | let mut http_request = ::http::Request::builder()
|
7862 - | .uri("/MalformedEnum")
|
7488 + | .uri("/MalformedUniqueItems")
|
7863 7489 | .method("POST")
|
7864 7490 | .header("content-type", "application/json")
|
7865 7491 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7866 7492 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
7867 - | "{ \"map\" : { \"abc\": \"XYZ\" } }".as_bytes(),
|
7493 + | "{ \"structureListWithNoKey\" : [{\"hi2\": \"bar\"}] }".as_bytes(),
|
7868 7494 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7869 7495 | )),
|
7870 7496 | ))
|
7871 7497 | .unwrap();
|
7872 7498 | #[allow(unused_mut)]
|
7873 7499 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7874 7500 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7875 7501 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7876 - | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7502 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
7877 7503 | let sender = sender.clone();
|
7878 7504 | async move {
|
7879 - | 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> };
|
7505 + | 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> };
|
7880 7506 | sender.send(()).await.expect("receiver dropped early");
|
7881 7507 | result
|
7882 7508 | }
|
7883 7509 | })
|
7884 7510 | .build_unchecked();
|
7885 7511 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7886 7512 | .await
|
7887 7513 | .expect("unable to make an HTTP request");
|
7888 7514 | ::pretty_assertions::assert_eq!(
|
7889 7515 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7890 7516 | http_response.status()
|
7891 7517 | );
|
7892 7518 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7893 7519 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7894 7520 | http_response.headers(),
|
7895 7521 | expected_headers,
|
7896 7522 | ));
|
7897 7523 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7898 7524 | .await
|
7899 7525 | .expect("unable to extract body to bytes");
|
7900 7526 | ::aws_smithy_protocol_test::assert_ok(
|
7901 - | ::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"))
|
7527 + | ::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"))
|
7902 7528 | );
|
7903 7529 | }
|
7904 7530 | }
|
7905 7531 |
|
7906 - | /// When a union member's value does not contain a valid enum value,
|
7907 - | /// the response should be a 400 ValidationException. Internal-only
|
7908 - | /// enum values are excluded from the response message.
|
7909 - | /// Test ID: RestJsonMalformedEnumUnion_case0
|
7532 + | /// When an list of unions contains non-unique values,
|
7533 + | /// the response should be a 400 ValidationException.
|
7534 + | /// Test ID: RestJsonMalformedUniqueItemsUnionList_case0
|
7910 7535 | #[::tokio::test]
|
7911 7536 | #[::tracing_test::traced_test]
|
7912 7537 | #[should_panic]
|
7913 - | async fn rest_json_malformed_enum_union_case0_malformed_request() {
|
7538 + | async fn rest_json_malformed_unique_items_union_list_case0_malformed_request() {
|
7914 7539 | {
|
7915 7540 | #[allow(unused_mut)]
|
7916 7541 | let mut http_request = ::http::Request::builder()
|
7917 - | .uri("/MalformedEnum")
|
7542 + | .uri("/MalformedUniqueItems")
|
7918 7543 | .method("POST")
|
7919 7544 | .header("content-type", "application/json")
|
7920 7545 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7921 7546 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
7922 - | "{ \"union\" : { \"first\": \"ABC\" } }".as_bytes(),
|
7547 + | "{ \"unionList\" : [{\"string\": \"foo\"}, {\"string\": \"foo\"}] }"
|
7548 + | .as_bytes(),
|
7923 7549 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7924 7550 | )),
|
7925 7551 | ))
|
7926 7552 | .unwrap();
|
7927 7553 | #[allow(unused_mut)]
|
7928 7554 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7929 7555 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7930 7556 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7931 - | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7557 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
7932 7558 | let sender = sender.clone();
|
7933 7559 | async move {
|
7934 - | 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> };
|
7560 + | 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> };
|
7935 7561 | sender.send(()).await.expect("receiver dropped early");
|
7936 7562 | result
|
7937 7563 | }
|
7938 7564 | })
|
7939 7565 | .build_unchecked();
|
7940 7566 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7941 7567 | .await
|
7942 7568 | .expect("unable to make an HTTP request");
|
7943 7569 | ::pretty_assertions::assert_eq!(
|
7944 7570 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7945 7571 | http_response.status()
|
7946 7572 | );
|
7947 7573 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7948 7574 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7949 7575 | http_response.headers(),
|
7950 7576 | expected_headers,
|
7951 7577 | ));
|
7952 7578 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7953 7579 | .await
|
7954 7580 | .expect("unable to extract body to bytes");
|
7955 7581 | ::aws_smithy_protocol_test::assert_ok(
|
7956 - | ::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"))
|
7582 + | ::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"))
|
7957 7583 | );
|
7958 7584 | }
|
7959 7585 | }
|
7960 7586 |
|
7961 - | /// When a union member's value does not contain a valid enum value,
|
7962 - | /// the response should be a 400 ValidationException. Internal-only
|
7963 - | /// enum values are excluded from the response message.
|
7964 - | /// Test ID: RestJsonMalformedEnumUnion_case1
|
7587 + | /// When an list of unions contains non-unique values,
|
7588 + | /// the response should be a 400 ValidationException.
|
7589 + | /// Test ID: RestJsonMalformedUniqueItemsUnionList_case1
|
7965 7590 | #[::tokio::test]
|
7966 7591 | #[::tracing_test::traced_test]
|
7967 7592 | #[should_panic]
|
7968 - | async fn rest_json_malformed_enum_union_case1_malformed_request() {
|
7593 + | async fn rest_json_malformed_unique_items_union_list_case1_malformed_request() {
|
7969 7594 | {
|
7970 7595 | #[allow(unused_mut)]
|
7971 7596 | let mut http_request = ::http::Request::builder()
|
7972 - | .uri("/MalformedEnum")
|
7597 + | .uri("/MalformedUniqueItems")
|
7973 7598 | .method("POST")
|
7974 7599 | .header("content-type", "application/json")
|
7975 7600 | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7976 7601 | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
7977 - | "{ \"union\" : { \"first\": \"XYZ\" } }".as_bytes(),
|
7602 + | "{ \"unionList\" : [{\"integer\": 1}, {\"integer\": 1}] }".as_bytes(),
|
7978 7603 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7979 7604 | )),
|
7980 7605 | ))
|
7981 7606 | .unwrap();
|
7982 7607 | #[allow(unused_mut)]
|
7983 7608 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7984 7609 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7985 7610 | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7986 - | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7611 + | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
7987 7612 | let sender = sender.clone();
|
7988 7613 | async move {
|
7989 - | 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> };
|
7614 + | 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> };
|
7990 7615 | sender.send(()).await.expect("receiver dropped early");
|
7991 7616 | result
|
7992 7617 | }
|
7993 7618 | })
|
7994 7619 | .build_unchecked();
|
7995 7620 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7996 7621 | .await
|
7997 7622 | .expect("unable to make an HTTP request");
|
7998 7623 | ::pretty_assertions::assert_eq!(
|
7999 7624 | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8000 7625 | http_response.status()
|
8001 7626 | );
|
8002 7627 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
8003 7628 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8004 7629 | http_response.headers(),
|
8005 7630 | expected_headers,
|
8006 7631 | ));
|
8007 7632 | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8008 7633 | .await
|
8009 7634 | .expect("unable to extract body to bytes");
|
8010 7635 | ::aws_smithy_protocol_test::assert_ok(
|
8011 - | ::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"))
|
7636 + | ::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"))
|
7637 + | );
|
7638 + | }
|
7639 + | }
|
7640 + | }
|
7641 + |
|
7642 + | ::pin_project_lite::pin_project! {
|
7643 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
7644 + | /// [`RecursiveStructuresInput`](crate::input::RecursiveStructuresInput) using modelled bindings.
|
7645 + | pub struct RecursiveStructuresInputFuture {
|
7646 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::RecursiveStructuresInput, ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
7647 + | }
|
7648 + | }
|
7649 + |
|
7650 + | impl std::future::Future for RecursiveStructuresInputFuture {
|
7651 + | type Output = Result<
|
7652 + | crate::input::RecursiveStructuresInput,
|
7653 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
7654 + | >;
|
7655 + |
|
7656 + | fn poll(
|
7657 + | self: std::pin::Pin<&mut Self>,
|
7658 + | cx: &mut std::task::Context<'_>,
|
7659 + | ) -> std::task::Poll<Self::Output> {
|
7660 + | let this = self.project();
|
7661 + | this.inner.as_mut().poll(cx)
|
7662 + | }
|
7663 + | }
|
7664 + |
|
7665 + | impl<B>
|
7666 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
7667 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
7668 + | B,
|
7669 + | > for crate::input::RecursiveStructuresInput
|
7670 + | where
|
7671 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
7672 + | B: 'static,
|
7673 + |
|
7674 + | B::Data: Send,
|
7675 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
7676 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
7677 + | {
|
7678 + | type Rejection =
|
7679 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
7680 + | type Future = RecursiveStructuresInputFuture;
|
7681 + |
|
7682 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
7683 + | let fut = async move {
|
7684 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
7685 + | request.headers(),
|
7686 + | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
7687 + | ) {
|
7688 + | return Err(::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
7689 + | }
|
7690 + | crate::protocol_serde::shape_recursive_structures::de_recursive_structures_http_request(
|
7691 + | request,
|
7692 + | )
|
7693 + | .await
|
7694 + | };
|
7695 + | use ::futures_util::future::TryFutureExt;
|
7696 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
7697 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
7698 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e)
|
7699 + | });
|
7700 + | RecursiveStructuresInputFuture {
|
7701 + | inner: Box::pin(fut),
|
7702 + | }
|
7703 + | }
|
7704 + | }
|
7705 + | impl
|
7706 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
7707 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
7708 + | > for crate::output::RecursiveStructuresOutput
|
7709 + | {
|
7710 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
7711 + | match crate::protocol_serde::shape_recursive_structures::ser_recursive_structures_http_response(self) {
|
7712 + | Ok(response) => response,
|
7713 + | Err(e) => {
|
7714 + | ::tracing::error!(error = %e, "failed to serialize response");
|
7715 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
7716 + | }
|
7717 + | }
|
7718 + | }
|
7719 + | }
|
7720 + | impl
|
7721 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
7722 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
7723 + | > for crate::error::RecursiveStructuresError
|
7724 + | {
|
7725 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
7726 + | match crate::protocol_serde::shape_recursive_structures::ser_recursive_structures_http_error(
|
7727 + | &self,
|
7728 + | ) {
|
7729 + | Ok(mut response) => {
|
7730 + | response.extensions_mut().insert(
|
7731 + | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
7732 + | self.name(),
|
7733 + | ),
|
7734 + | );
|
7735 + | response
|
7736 + | }
|
7737 + | Err(e) => {
|
7738 + | ::tracing::error!(error = %e, "failed to serialize response");
|
7739 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
7740 + | }
|
7741 + | }
|
7742 + | }
|
7743 + | }
|
7744 + |
|
7745 + | #[allow(unreachable_code, unused_variables)]
|
7746 + | #[cfg(test)]
|
7747 + | mod recursive_structures_test {
|
7748 + |
|
7749 + | /// Validation should work with recursive structures.
|
7750 + | /// Test ID: RestJsonRecursiveStructuresValidate
|
7751 + | #[::tokio::test]
|
7752 + | #[::tracing_test::traced_test]
|
7753 + | async fn rest_json_recursive_structures_validate_request() {
|
7754 + | #[allow(unused_mut)]
|
7755 + | let mut http_request = ::http::Request::builder()
|
7756 + | .uri("/RecursiveStructures")
|
7757 + | .method("POST")
|
7758 + | .header("content-type", "application/json")
|
7759 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7760 + | ::bytes::Bytes::copy_from_slice(
|
7761 + | &::aws_smithy_protocol_test::decode_body_data("{ \"union\" : {\n \"union\" : {\n \"union\" : { \"string\" : \"abc\" }\n }\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7762 + | )
|
7763 + | )).unwrap();
|
7764 + | #[allow(unused_mut)]
|
7765 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7766 + | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7767 + | let service =
|
7768 + | crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7769 + | .recursive_structures(move |input: crate::input::RecursiveStructuresInput| {
|
7770 + | let sender = sender.clone();
|
7771 + | async move {
|
7772 + | let result = {
|
7773 + | let expected = crate::input::RecursiveStructuresInput {
|
7774 + | union: ::std::option::Option::Some(
|
7775 + | crate::model::RecursiveUnionOne::Union(::std::boxed::Box::new(
|
7776 + | crate::model::RecursiveUnionTwo::Union(
|
7777 + | crate::model::RecursiveUnionOne::String(
|
7778 + | "abc"
|
7779 + | .parse::<crate::model::RecursiveEnumString>()
|
7780 + | .expect("static value validated to member"),
|
7781 + | ),
|
7782 + | ),
|
7783 + | )),
|
7784 + | ),
|
7785 + | };
|
7786 + | ::pretty_assertions::assert_eq!(input, expected);
|
7787 + | let output = crate::output::RecursiveStructuresOutput {};
|
7788 + | Ok(output)
|
7789 + | };
|
7790 + | sender.send(()).await.expect("receiver dropped early");
|
7791 + | result
|
7792 + | }
|
7793 + | })
|
7794 + | .build_unchecked();
|
7795 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7796 + | .await
|
7797 + | .expect("unable to make an HTTP request");
|
7798 + | assert!(
|
7799 + | receiver.recv().await.is_some(),
|
7800 + | "we expected operation handler to be invoked but it was not entered"
|
7801 + | );
|
7802 + | }
|
7803 + |
|
7804 + | /// When a value deeply nested in a recursive structure does not meet constraints,
|
7805 + | /// a 400 ValidationException is returned.
|
7806 + | /// Test ID: RestJsonMalformedRecursiveStructures
|
7807 + | #[::tokio::test]
|
7808 + | #[::tracing_test::traced_test]
|
7809 + | async fn rest_json_malformed_recursive_structures_malformed_request() {
|
7810 + | {
|
7811 + | #[allow(unused_mut)]
|
7812 + | let mut http_request = ::http::Request::builder()
|
7813 + | .uri("/RecursiveStructures")
|
7814 + | .method("POST")
|
7815 + | .header("content-type", "application/json")
|
7816 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7817 + | ::bytes::Bytes::copy_from_slice(
|
7818 + | &::aws_smithy_protocol_test::decode_body_data("{ \"union\" : {\n \"union\" : {\n \"union\" : { \"string\" : \"XYZ\" }\n }\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
7819 + | )
|
7820 + | )).unwrap();
|
7821 + | #[allow(unused_mut)]
|
7822 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7823 + | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7824 + | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7825 + | .recursive_structures(move |input: crate::input::RecursiveStructuresInput| {
|
7826 + | let sender = sender.clone();
|
7827 + | async move {
|
7828 + | 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> };
|
7829 + | sender.send(()).await.expect("receiver dropped early");
|
7830 + | result
|
7831 + | }
|
7832 + | })
|
7833 + | .build_unchecked();
|
7834 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7835 + | .await
|
7836 + | .expect("unable to make an HTTP request");
|
7837 + | ::pretty_assertions::assert_eq!(
|
7838 + | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7839 + | http_response.status()
|
7840 + | );
|
7841 + | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7842 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7843 + | http_response.headers(),
|
7844 + | expected_headers,
|
7845 + | ));
|
7846 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7847 + | .await
|
7848 + | .expect("unable to extract body to bytes");
|
7849 + | ::aws_smithy_protocol_test::assert_ok(
|
7850 + | ::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"))
|
7851 + | );
|
7852 + | }
|
7853 + | }
|
7854 + | }
|
7855 + |
|
7856 + | ::pin_project_lite::pin_project! {
|
7857 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
7858 + | /// [`SensitiveValidationInput`](crate::input::SensitiveValidationInput) using modelled bindings.
|
7859 + | pub struct SensitiveValidationInputFuture {
|
7860 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SensitiveValidationInput, ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
7861 + | }
|
7862 + | }
|
7863 + |
|
7864 + | impl std::future::Future for SensitiveValidationInputFuture {
|
7865 + | type Output = Result<
|
7866 + | crate::input::SensitiveValidationInput,
|
7867 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
7868 + | >;
|
7869 + |
|
7870 + | fn poll(
|
7871 + | self: std::pin::Pin<&mut Self>,
|
7872 + | cx: &mut std::task::Context<'_>,
|
7873 + | ) -> std::task::Poll<Self::Output> {
|
7874 + | let this = self.project();
|
7875 + | this.inner.as_mut().poll(cx)
|
7876 + | }
|
7877 + | }
|
7878 + |
|
7879 + | impl<B>
|
7880 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
7881 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
7882 + | B,
|
7883 + | > for crate::input::SensitiveValidationInput
|
7884 + | where
|
7885 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
7886 + | B: 'static,
|
7887 + |
|
7888 + | B::Data: Send,
|
7889 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
7890 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
7891 + | {
|
7892 + | type Rejection =
|
7893 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
7894 + | type Future = SensitiveValidationInputFuture;
|
7895 + |
|
7896 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
7897 + | let fut = async move {
|
7898 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
7899 + | request.headers(),
|
7900 + | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
7901 + | ) {
|
7902 + | return Err(::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
7903 + | }
|
7904 + | crate::protocol_serde::shape_sensitive_validation::de_sensitive_validation_http_request(
|
7905 + | request,
|
7906 + | )
|
7907 + | .await
|
7908 + | };
|
7909 + | use ::futures_util::future::TryFutureExt;
|
7910 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
7911 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
7912 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e)
|
7913 + | });
|
7914 + | SensitiveValidationInputFuture {
|
7915 + | inner: Box::pin(fut),
|
7916 + | }
|
7917 + | }
|
7918 + | }
|
7919 + | impl
|
7920 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
7921 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
7922 + | > for crate::output::SensitiveValidationOutput
|
7923 + | {
|
7924 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
7925 + | match crate::protocol_serde::shape_sensitive_validation::ser_sensitive_validation_http_response(self) {
|
7926 + | Ok(response) => response,
|
7927 + | Err(e) => {
|
7928 + | ::tracing::error!(error = %e, "failed to serialize response");
|
7929 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
7930 + | }
|
7931 + | }
|
7932 + | }
|
7933 + | }
|
7934 + | impl
|
7935 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
7936 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
|
7937 + | > for crate::error::SensitiveValidationError
|
7938 + | {
|
7939 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
7940 + | match crate::protocol_serde::shape_sensitive_validation::ser_sensitive_validation_http_error(
|
7941 + | &self,
|
7942 + | ) {
|
7943 + | Ok(mut response) => {
|
7944 + | response.extensions_mut().insert(
|
7945 + | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
7946 + | self.name(),
|
7947 + | ),
|
7948 + | );
|
7949 + | response
|
7950 + | }
|
7951 + | Err(e) => {
|
7952 + | ::tracing::error!(error = %e, "failed to serialize response");
|
7953 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
7954 + | }
|
7955 + | }
|
7956 + | }
|
7957 + | }
|
7958 + |
|
7959 + | #[allow(unreachable_code, unused_variables)]
|
7960 + | #[cfg(test)]
|
7961 + | mod sensitive_validation_test {
|
7962 + |
|
7963 + | /// When a sensitive member fails validation, the resultant
|
7964 + | /// ValidationException will omit the value of the input.
|
7965 + | /// Test ID: RestJsonMalformedPatternSensitiveString
|
7966 + | #[::tokio::test]
|
7967 + | #[::tracing_test::traced_test]
|
7968 + | async fn rest_json_malformed_pattern_sensitive_string_malformed_request() {
|
7969 + | {
|
7970 + | #[allow(unused_mut)]
|
7971 + | let mut http_request = ::http::Request::builder()
|
7972 + | .uri("/SensitiveValidation")
|
7973 + | .method("POST")
|
7974 + | .header("content-type", "application/json")
|
7975 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
7976 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
7977 + | "{ \"string\" : \"ABC\" }".as_bytes(),
|
7978 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7979 + | )),
|
7980 + | ))
|
7981 + | .unwrap();
|
7982 + | #[allow(unused_mut)]
|
7983 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7984 + | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7985 + | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7986 + | .sensitive_validation(move |input: crate::input::SensitiveValidationInput| {
|
7987 + | let sender = sender.clone();
|
7988 + | async move {
|
7989 + | 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> };
|
7990 + | sender.send(()).await.expect("receiver dropped early");
|
7991 + | result
|
7992 + | }
|
7993 + | })
|
7994 + | .build_unchecked();
|
7995 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7996 + | .await
|
7997 + | .expect("unable to make an HTTP request");
|
7998 + | ::pretty_assertions::assert_eq!(
|
7999 + | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8000 + | http_response.status()
|
8001 + | );
|
8002 + | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
8003 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8004 + | http_response.headers(),
|
8005 + | expected_headers,
|
8006 + | ));
|
8007 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8008 + | .await
|
8009 + | .expect("unable to extract body to bytes");
|
8010 + | ::aws_smithy_protocol_test::assert_ok(
|
8011 + | ::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"))
|
8012 8012 | );
|
8013 8013 | }
|
8014 8014 | }
|
8015 8015 | }
|