133 137 | ::std::borrow::Cow::Owned(rcb)
|
134 138 | }
|
135 139 | }
|
136 140 |
|
137 141 | #[derive(Debug)]
|
138 142 | struct ProcessBigNumbersResponseDeserializer;
|
139 143 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ProcessBigNumbersResponseDeserializer {
|
140 144 | fn deserialize_nonstreaming(
|
141 145 | &self,
|
142 146 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
147 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
143 148 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
144 149 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
150 + | #[allow(unused_mut)]
|
151 + | let mut force_error = false;
|
152 + |
|
153 + | if !success && status != 200 || force_error {
|
145 154 | let headers = response.headers();
|
146 155 | let body = response.body().bytes().expect("body loaded");
|
147 156 | #[allow(unused_mut)]
|
148 - | let mut force_error = false;
|
157 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
158 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
159 + | })?;
|
149 160 |
|
150 - | let parse_result = if !success && status != 200 || force_error {
|
151 - | crate::protocol_serde::shape_process_big_numbers::de_process_big_numbers_http_error(status, headers, body)
|
161 + | let generic = generic_builder.build();
|
162 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
163 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
|
164 + | crate::operation::process_big_numbers::ProcessBigNumbersError::generic(generic),
|
165 + | ),
|
166 + | ))
|
152 167 | } else {
|
153 - | crate::protocol_serde::shape_process_big_numbers::de_process_big_numbers_http_response(status, headers, body)
|
154 - | };
|
155 - | crate::protocol_serde::type_erase_result(parse_result)
|
168 + | let protocol = _cfg
|
169 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
170 + | .expect("a SharedClientProtocol is required");
|
171 + | let mut deser = protocol
|
172 + | .deserialize_response(response, ProcessBigNumbers::OUTPUT_SCHEMA, _cfg)
|
173 + | .map_err(|e| {
|
174 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
175 + | })?;
|
176 + | let body = response.body().bytes().expect("body loaded");
|
177 + | let output = crate::operation::process_big_numbers::ProcessBigNumbersOutput::deserialize_with_response(
|
178 + | &mut *deser,
|
179 + | response.headers(),
|
180 + | response.status().into(),
|
181 + | body,
|
182 + | )
|
183 + | .map_err(|e| {
|
184 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
185 + | })?;
|
186 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
187 + | }
|
156 188 | }
|
157 189 | }
|
158 190 | #[derive(Debug)]
|
159 191 | struct ProcessBigNumbersRequestSerializer;
|
160 192 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ProcessBigNumbersRequestSerializer {
|
161 193 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
162 194 | fn serialize_input(
|
163 195 | &self,
|
164 196 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
165 197 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
166 198 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
167 199 | let input = input
|
168 200 | .downcast::<crate::operation::process_big_numbers::ProcessBigNumbersInput>()
|
169 201 | .expect("correct type");
|
170 - | let _header_serialization_settings = _cfg
|
171 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
172 - | .cloned()
|
173 - | .unwrap_or_default();
|
174 - | let mut request_builder = {
|
175 - | #[allow(clippy::uninlined_format_args)]
|
176 - | fn uri_base(
|
177 - | _input: &crate::operation::process_big_numbers::ProcessBigNumbersInput,
|
178 - | output: &mut ::std::string::String,
|
179 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
180 - | use ::std::fmt::Write as _;
|
181 - | ::std::write!(output, "/process").expect("formatting should succeed");
|
182 - | ::std::result::Result::Ok(())
|
183 - | }
|
184 - | #[allow(clippy::unnecessary_wraps)]
|
185 - | fn update_http_builder(
|
186 - | input: &crate::operation::process_big_numbers::ProcessBigNumbersInput,
|
187 - | builder: ::http_1x::request::Builder,
|
188 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
189 - | let mut uri = ::std::string::String::new();
|
190 - | uri_base(input, &mut uri)?;
|
191 - | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
192 - | }
|
193 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
194 - | builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
|
195 - | builder
|
196 - | };
|
197 - | let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_process_big_numbers::ser_process_big_numbers_input(&input)?);
|
198 - | if let Some(content_length) = body.content_length() {
|
199 - | let content_length = content_length.to_string();
|
200 - | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
|
201 - | }
|
202 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
202 + | let protocol = _cfg
|
203 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
204 + | .expect("a SharedClientProtocol is required");
|
205 + | let mut request = protocol
|
206 + | .serialize_request(&input, ProcessBigNumbers::INPUT_SCHEMA, "", _cfg)
|
207 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
208 + |
|
209 + | return ::std::result::Result::Ok(request);
|
203 210 | }
|
204 211 | }
|
205 212 | #[derive(Debug)]
|
206 213 | struct ProcessBigNumbersEndpointParamsInterceptor;
|
207 214 |
|
208 215 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ProcessBigNumbersEndpointParamsInterceptor {
|
209 216 | fn name(&self) -> &'static str {
|
210 217 | "ProcessBigNumbersEndpointParamsInterceptor"
|
211 218 | }
|
212 219 |
|
493 500 | .expect("the config must have a deserializer");
|
494 501 |
|
495 502 | let parsed = de.deserialize_streaming(&mut http_response);
|
496 503 | let parsed = parsed.unwrap_or_else(|| {
|
497 504 | let http_response = http_response.map(|body| {
|
498 505 | ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
499 506 | body.bytes().unwrap(),
|
500 507 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
501 508 | )))
|
502 509 | });
|
503 - | de.deserialize_nonstreaming(&http_response)
|
510 + | // Build a config bag with the protocol for schema-based deserialization
|
511 + | #[allow(unused_mut)]
|
512 + | let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
|
513 + | {
|
514 + | let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
|
515 + | layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
|
516 + | ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
|
517 + | ));
|
518 + | test_cfg.push_shared_layer(layer.freeze());
|
519 + | }
|
520 + | de.deserialize_nonstreaming(&http_response, &test_cfg)
|
504 521 | });
|
505 522 | let parsed = parsed
|
506 523 | .expect("should be successful response")
|
507 524 | .downcast::<crate::operation::process_big_numbers::ProcessBigNumbersOutput>()
|
508 525 | .unwrap();
|
509 526 | ::pretty_assertions::assert_eq!(parsed.result, expected_output.result, "Unexpected value for `result`");
|
510 527 | ::pretty_assertions::assert_eq!(parsed.ratio, expected_output.ratio, "Unexpected value for `ratio`");
|
511 528 | }
|
512 529 | /// Test ID: NegativeBigNumbersInJsonResponse
|
513 530 | #[::tokio::test]
|
514 531 | #[::tracing_test::traced_test]
|
515 532 | async fn negative_big_numbers_in_json_response_response() {
|
516 533 | let expected_output = crate::operation::process_big_numbers::ProcessBigNumbersOutput::builder()
|
517 534 | .set_result(::std::option::Option::Some(
|
518 535 | <::aws_smithy_types::BigInteger as ::std::str::FromStr>::from_str("-123456789").expect("Invalid string for BigInteger"),
|
519 536 | ))
|
520 537 | .set_ratio(::std::option::Option::Some(
|
521 538 | <::aws_smithy_types::BigDecimal as ::std::str::FromStr>::from_str("-999.999").expect("invalid string for BigDecimal"),
|
522 539 | ))
|
523 540 | .build();
|
524 541 | let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
|
525 542 | ::http_1x::response::Builder::new()
|
526 543 | .header("Content-Type", "application/json")
|
527 544 | .status(200)
|
528 545 | .body(::aws_smithy_types::body::SdkBody::from("{\"result\":-123456789,\"ratio\":-999.999}"))
|
529 546 | .unwrap(),
|
530 547 | )
|
531 548 | .unwrap();
|
532 549 | use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
|
533 550 | use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
|
534 551 |
|
535 552 | let op = crate::operation::process_big_numbers::ProcessBigNumbers::new();
|
536 553 | let config = op.config().expect("the operation has config");
|
537 554 | let de = config
|
538 555 | .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
|
539 556 | .expect("the config must have a deserializer");
|
540 557 |
|
541 558 | let parsed = de.deserialize_streaming(&mut http_response);
|
542 559 | let parsed = parsed.unwrap_or_else(|| {
|
543 560 | let http_response = http_response.map(|body| {
|
544 561 | ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
545 562 | body.bytes().unwrap(),
|
546 563 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
547 564 | )))
|
548 565 | });
|
549 - | de.deserialize_nonstreaming(&http_response)
|
566 + | // Build a config bag with the protocol for schema-based deserialization
|
567 + | #[allow(unused_mut)]
|
568 + | let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
|
569 + | {
|
570 + | let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
|
571 + | layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
|
572 + | ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
|
573 + | ));
|
574 + | test_cfg.push_shared_layer(layer.freeze());
|
575 + | }
|
576 + | de.deserialize_nonstreaming(&http_response, &test_cfg)
|
550 577 | });
|
551 578 | let parsed = parsed
|
552 579 | .expect("should be successful response")
|
553 580 | .downcast::<crate::operation::process_big_numbers::ProcessBigNumbersOutput>()
|
554 581 | .unwrap();
|
555 582 | ::pretty_assertions::assert_eq!(parsed.result, expected_output.result, "Unexpected value for `result`");
|
556 583 | ::pretty_assertions::assert_eq!(parsed.ratio, expected_output.ratio, "Unexpected value for `ratio`");
|
557 584 | }
|
558 585 | /// Test ID: VeryLargeBigNumbersInJsonResponse
|
559 586 | #[::tokio::test]
|
560 587 | #[::tracing_test::traced_test]
|
561 588 | async fn very_large_big_numbers_in_json_response_response() {
|
562 589 | let expected_output = crate::operation::process_big_numbers::ProcessBigNumbersOutput::builder()
|
563 590 | .set_result(::std::option::Option::Some(
|
564 591 | <::aws_smithy_types::BigInteger as ::std::str::FromStr>::from_str("18446744073709551616").expect("Invalid string for BigInteger"),
|
565 592 | ))
|
566 593 | .set_ratio(::std::option::Option::Some(
|
567 594 | <::aws_smithy_types::BigDecimal as ::std::str::FromStr>::from_str("123456.789").expect("invalid string for BigDecimal"),
|
568 595 | ))
|
569 596 | .build();
|
570 597 | let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
|
571 598 | ::http_1x::response::Builder::new()
|
572 599 | .header("Content-Type", "application/json")
|
573 600 | .status(200)
|
574 601 | .body(::aws_smithy_types::body::SdkBody::from(
|
575 602 | "{\"result\":18446744073709551616,\"ratio\":123456.789}",
|
576 603 | ))
|
577 604 | .unwrap(),
|
578 605 | )
|
579 606 | .unwrap();
|
580 607 | use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
|
581 608 | use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
|
582 609 |
|
583 610 | let op = crate::operation::process_big_numbers::ProcessBigNumbers::new();
|
584 611 | let config = op.config().expect("the operation has config");
|
585 612 | let de = config
|
586 613 | .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
|
587 614 | .expect("the config must have a deserializer");
|
588 615 |
|
589 616 | let parsed = de.deserialize_streaming(&mut http_response);
|
590 617 | let parsed = parsed.unwrap_or_else(|| {
|
591 618 | let http_response = http_response.map(|body| {
|
592 619 | ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
593 620 | body.bytes().unwrap(),
|
594 621 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
595 622 | )))
|
596 623 | });
|
597 - | de.deserialize_nonstreaming(&http_response)
|
624 + | // Build a config bag with the protocol for schema-based deserialization
|
625 + | #[allow(unused_mut)]
|
626 + | let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
|
627 + | {
|
628 + | let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
|
629 + | layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
|
630 + | ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
|
631 + | ));
|
632 + | test_cfg.push_shared_layer(layer.freeze());
|
633 + | }
|
634 + | de.deserialize_nonstreaming(&http_response, &test_cfg)
|
598 635 | });
|
599 636 | let parsed = parsed
|
600 637 | .expect("should be successful response")
|
601 638 | .downcast::<crate::operation::process_big_numbers::ProcessBigNumbersOutput>()
|
602 639 | .unwrap();
|
603 640 | ::pretty_assertions::assert_eq!(parsed.result, expected_output.result, "Unexpected value for `result`");
|
604 641 | ::pretty_assertions::assert_eq!(parsed.ratio, expected_output.ratio, "Unexpected value for `ratio`");
|
605 642 | }
|
606 643 | /// Test ID: ZeroBigNumbersInJsonResponse
|
607 644 | #[::tokio::test]
|
608 645 | #[::tracing_test::traced_test]
|
609 646 | async fn zero_big_numbers_in_json_response_response() {
|
610 647 | let expected_output = crate::operation::process_big_numbers::ProcessBigNumbersOutput::builder()
|
611 648 | .set_result(::std::option::Option::Some(
|
612 649 | <::aws_smithy_types::BigInteger as ::std::str::FromStr>::from_str("0").expect("Invalid string for BigInteger"),
|
613 650 | ))
|
614 651 | .set_ratio(::std::option::Option::Some(
|
615 652 | <::aws_smithy_types::BigDecimal as ::std::str::FromStr>::from_str("0.0").expect("invalid string for BigDecimal"),
|
616 653 | ))
|
617 654 | .build();
|
618 655 | let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
|
619 656 | ::http_1x::response::Builder::new()
|
620 657 | .header("Content-Type", "application/json")
|
621 658 | .status(200)
|
622 659 | .body(::aws_smithy_types::body::SdkBody::from("{\"result\":0,\"ratio\":0.0}"))
|
623 660 | .unwrap(),
|
624 661 | )
|
625 662 | .unwrap();
|
626 663 | use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
|
627 664 | use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
|
628 665 |
|
629 666 | let op = crate::operation::process_big_numbers::ProcessBigNumbers::new();
|
630 667 | let config = op.config().expect("the operation has config");
|
631 668 | let de = config
|
632 669 | .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
|
633 670 | .expect("the config must have a deserializer");
|
634 671 |
|
635 672 | let parsed = de.deserialize_streaming(&mut http_response);
|
636 673 | let parsed = parsed.unwrap_or_else(|| {
|
637 674 | let http_response = http_response.map(|body| {
|
638 675 | ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
639 676 | body.bytes().unwrap(),
|
640 677 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
641 678 | )))
|
642 679 | });
|
643 - | de.deserialize_nonstreaming(&http_response)
|
680 + | // Build a config bag with the protocol for schema-based deserialization
|
681 + | #[allow(unused_mut)]
|
682 + | let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
|
683 + | {
|
684 + | let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
|
685 + | layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
|
686 + | ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
|
687 + | ));
|
688 + | test_cfg.push_shared_layer(layer.freeze());
|
689 + | }
|
690 + | de.deserialize_nonstreaming(&http_response, &test_cfg)
|
644 691 | });
|
645 692 | let parsed = parsed
|
646 693 | .expect("should be successful response")
|
647 694 | .downcast::<crate::operation::process_big_numbers::ProcessBigNumbersOutput>()
|
648 695 | .unwrap();
|
649 696 | ::pretty_assertions::assert_eq!(parsed.result, expected_output.result, "Unexpected value for `result`");
|
650 697 | ::pretty_assertions::assert_eq!(parsed.ratio, expected_output.ratio, "Unexpected value for `ratio`");
|
651 698 | }
|
652 699 | /// Test ID: NullBigNumbersInJsonResponse
|
653 700 | #[::tokio::test]
|
654 701 | #[::tracing_test::traced_test]
|
655 702 | async fn null_big_numbers_in_json_response_response() {
|
656 703 | let expected_output = crate::operation::process_big_numbers::ProcessBigNumbersOutput::builder().build();
|
657 704 | let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
|
658 705 | ::http_1x::response::Builder::new()
|
659 706 | .header("Content-Type", "application/json")
|
660 707 | .status(200)
|
661 708 | .body(::aws_smithy_types::body::SdkBody::from("{\"result\":null,\"ratio\":null}"))
|
662 709 | .unwrap(),
|
663 710 | )
|
664 711 | .unwrap();
|
665 712 | use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
|
666 713 | use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
|
667 714 |
|
668 715 | let op = crate::operation::process_big_numbers::ProcessBigNumbers::new();
|
669 716 | let config = op.config().expect("the operation has config");
|
670 717 | let de = config
|
671 718 | .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
|
672 719 | .expect("the config must have a deserializer");
|
673 720 |
|
674 721 | let parsed = de.deserialize_streaming(&mut http_response);
|
675 722 | let parsed = parsed.unwrap_or_else(|| {
|
676 723 | let http_response = http_response.map(|body| {
|
677 724 | ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
678 725 | body.bytes().unwrap(),
|
679 726 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
680 727 | )))
|
681 728 | });
|
682 - | de.deserialize_nonstreaming(&http_response)
|
729 + | // Build a config bag with the protocol for schema-based deserialization
|
730 + | #[allow(unused_mut)]
|
731 + | let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
|
732 + | {
|
733 + | let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
|
734 + | layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
|
735 + | ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
|
736 + | ));
|
737 + | test_cfg.push_shared_layer(layer.freeze());
|
738 + | }
|
739 + | de.deserialize_nonstreaming(&http_response, &test_cfg)
|
683 740 | });
|
684 741 | let parsed = parsed
|
685 742 | .expect("should be successful response")
|
686 743 | .downcast::<crate::operation::process_big_numbers::ProcessBigNumbersOutput>()
|
687 744 | .unwrap();
|
688 745 | ::pretty_assertions::assert_eq!(parsed.result, expected_output.result, "Unexpected value for `result`");
|
689 746 | ::pretty_assertions::assert_eq!(parsed.ratio, expected_output.ratio, "Unexpected value for `ratio`");
|
690 747 | }
|
691 748 | /// Test ID: ScientificNotationBigNumbersInJsonResponse
|
692 749 | #[::tokio::test]
|
693 750 | #[::tracing_test::traced_test]
|
694 751 | async fn scientific_notation_big_numbers_in_json_response_response() {
|
695 752 | let expected_output = crate::operation::process_big_numbers::ProcessBigNumbersOutput::builder()
|
696 753 | .set_result(::std::option::Option::Some(
|
697 754 | <::aws_smithy_types::BigInteger as ::std::str::FromStr>::from_str("1500000000000").expect("Invalid string for BigInteger"),
|
698 755 | ))
|
699 756 | .set_ratio(::std::option::Option::Some(
|
700 757 | <::aws_smithy_types::BigDecimal as ::std::str::FromStr>::from_str("2.5E-8").expect("invalid string for BigDecimal"),
|
701 758 | ))
|
702 759 | .build();
|
703 760 | let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
|
704 761 | ::http_1x::response::Builder::new()
|
705 762 | .header("Content-Type", "application/json")
|
706 763 | .status(200)
|
707 764 | .body(::aws_smithy_types::body::SdkBody::from("{\"result\":1500000000000,\"ratio\":2.5E-8}"))
|
708 765 | .unwrap(),
|
709 766 | )
|
710 767 | .unwrap();
|
711 768 | use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
|
712 769 | use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
|
713 770 |
|
714 771 | let op = crate::operation::process_big_numbers::ProcessBigNumbers::new();
|
715 772 | let config = op.config().expect("the operation has config");
|
716 773 | let de = config
|
717 774 | .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
|
718 775 | .expect("the config must have a deserializer");
|
719 776 |
|
720 777 | let parsed = de.deserialize_streaming(&mut http_response);
|
721 778 | let parsed = parsed.unwrap_or_else(|| {
|
722 779 | let http_response = http_response.map(|body| {
|
723 780 | ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
724 781 | body.bytes().unwrap(),
|
725 782 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
726 783 | )))
|
727 784 | });
|
728 - | de.deserialize_nonstreaming(&http_response)
|
785 + | // Build a config bag with the protocol for schema-based deserialization
|
786 + | #[allow(unused_mut)]
|
787 + | let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
|
788 + | {
|
789 + | let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
|
790 + | layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
|
791 + | ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
|
792 + | ));
|
793 + | test_cfg.push_shared_layer(layer.freeze());
|
794 + | }
|
795 + | de.deserialize_nonstreaming(&http_response, &test_cfg)
|
729 796 | });
|
730 797 | let parsed = parsed
|
731 798 | .expect("should be successful response")
|
732 799 | .downcast::<crate::operation::process_big_numbers::ProcessBigNumbersOutput>()
|
733 800 | .unwrap();
|
734 801 | ::pretty_assertions::assert_eq!(parsed.result, expected_output.result, "Unexpected value for `result`");
|
735 802 | ::pretty_assertions::assert_eq!(parsed.ratio, expected_output.ratio, "Unexpected value for `ratio`");
|
736 803 | }
|
737 804 | /// Test ID: UppercaseScientificNotationBigNumbersInJsonResponse
|
738 805 | #[::tokio::test]
|
739 806 | #[::tracing_test::traced_test]
|
740 807 | async fn uppercase_scientific_notation_big_numbers_in_json_response_response() {
|
741 808 | let expected_output = crate::operation::process_big_numbers::ProcessBigNumbersOutput::builder()
|
742 809 | .set_result(::std::option::Option::Some(
|
743 810 | <::aws_smithy_types::BigInteger as ::std::str::FromStr>::from_str("789000000000000000000").expect("Invalid string for BigInteger"),
|
744 811 | ))
|
745 812 | .set_ratio(::std::option::Option::Some(
|
746 813 | <::aws_smithy_types::BigDecimal as ::std::str::FromStr>::from_str("1.23E-15").expect("invalid string for BigDecimal"),
|
747 814 | ))
|
748 815 | .build();
|
749 816 | let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
|
750 817 | ::http_1x::response::Builder::new()
|
751 818 | .header("Content-Type", "application/json")
|
752 819 | .status(200)
|
753 820 | .body(::aws_smithy_types::body::SdkBody::from(
|
754 821 | "{\"result\":789000000000000000000,\"ratio\":1.23E-15}",
|
755 822 | ))
|
756 823 | .unwrap(),
|
757 824 | )
|
758 825 | .unwrap();
|
759 826 | use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
|
760 827 | use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
|
761 828 |
|
762 829 | let op = crate::operation::process_big_numbers::ProcessBigNumbers::new();
|
763 830 | let config = op.config().expect("the operation has config");
|
764 831 | let de = config
|
765 832 | .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
|
766 833 | .expect("the config must have a deserializer");
|
767 834 |
|
768 835 | let parsed = de.deserialize_streaming(&mut http_response);
|
769 836 | let parsed = parsed.unwrap_or_else(|| {
|
770 837 | let http_response = http_response.map(|body| {
|
771 838 | ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
772 839 | body.bytes().unwrap(),
|
773 840 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
774 841 | )))
|
775 842 | });
|
776 - | de.deserialize_nonstreaming(&http_response)
|
843 + | // Build a config bag with the protocol for schema-based deserialization
|
844 + | #[allow(unused_mut)]
|
845 + | let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
|
846 + | {
|
847 + | let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
|
848 + | layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
|
849 + | ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
|
850 + | ));
|
851 + | test_cfg.push_shared_layer(layer.freeze());
|
852 + | }
|
853 + | de.deserialize_nonstreaming(&http_response, &test_cfg)
|
777 854 | });
|
778 855 | let parsed = parsed
|
779 856 | .expect("should be successful response")
|
780 857 | .downcast::<crate::operation::process_big_numbers::ProcessBigNumbersOutput>()
|
781 858 | .unwrap();
|
782 859 | ::pretty_assertions::assert_eq!(parsed.result, expected_output.result, "Unexpected value for `result`");
|
783 860 | ::pretty_assertions::assert_eq!(parsed.ratio, expected_output.ratio, "Unexpected value for `ratio`");
|
784 861 | }
|
785 862 | }
|
786 863 |
|