Client Test

Client Test

rev. 7254d43655ed63111c94f599437f2b0d3f55446e (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/unit_input_and_output/builders.rs

@@ -1,1 +35,35 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub use crate::operation::unit_input_and_output::_unit_input_and_output_output::UnitInputAndOutputOutputBuilder;
    3         -
    4      2   
pub use crate::operation::unit_input_and_output::_unit_input_and_output_input::UnitInputAndOutputInputBuilder;
    5      3   
           4  +
pub use crate::operation::unit_input_and_output::_unit_input_and_output_output::UnitInputAndOutputOutputBuilder;
           5  +
    6      6   
impl crate::operation::unit_input_and_output::builders::UnitInputAndOutputInputBuilder {
    7      7   
    /// Sends a request with this input using the given client.
    8      8   
    pub async fn send_with(
    9      9   
        self,
   10     10   
        client: &crate::Client,
   11     11   
    ) -> ::std::result::Result<
   12     12   
        crate::operation::unit_input_and_output::UnitInputAndOutputOutput,
   13     13   
        ::aws_smithy_runtime_api::client::result::SdkError<
   14     14   
            crate::operation::unit_input_and_output::UnitInputAndOutputError,
   15     15   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/primitives/event_stream.rs

@@ -1,1 +0,6 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub use crate::event_receiver::EventReceiver;
           3  +
pub use ::aws_smithy_types::event_stream::Header;
           4  +
pub use ::aws_smithy_types::event_stream::HeaderValue;
           5  +
pub use ::aws_smithy_types::event_stream::Message;
           6  +
pub use ::aws_smithy_types::str_bytes::StrBytes;

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde.rs

@@ -20,20 +147,159 @@
   40     40   
pub(crate) mod shape_document_type_as_payload;
   41     41   
   42     42   
pub fn serialize_document(input: &::aws_smithy_types::Document) -> ::std::vec::Vec<u8> {
   43     43   
    let mut out = String::new();
   44     44   
    ::aws_smithy_json::serialize::JsonValueWriter::new(&mut out).document(input);
   45     45   
    out.into_bytes()
   46     46   
}
   47     47   
   48     48   
pub(crate) mod shape_document_type_as_payload_input;
   49     49   
          50  +
pub(crate) mod shape_duplex_stream;
          51  +
          52  +
pub(crate) mod shape_duplex_stream_with_distinct_streams;
          53  +
          54  +
pub(crate) mod shape_duplex_stream_with_initial_messages;
          55  +
   50     56   
pub(crate) mod shape_empty_input_and_empty_output;
   51     57   
   52     58   
pub(crate) mod shape_endpoint_operation;
   53     59   
   54     60   
pub(crate) mod shape_endpoint_with_host_label_operation;
   55     61   
   56     62   
pub(crate) mod shape_fractional_seconds;
   57     63   
   58     64   
pub(crate) mod shape_greeting_with_errors;
   59     65   
   60     66   
pub(crate) mod shape_host_with_path_operation;
   61     67   
   62     68   
pub(crate) mod shape_http_checksum_required;
   63     69   
   64     70   
pub(crate) mod shape_http_empty_prefix_headers;
   65     71   
   66     72   
pub(crate) mod shape_http_enum_payload;
   67     73   
   68     74   
pub(crate) mod shape_http_enum_payload_input;
   69     75   
   70     76   
pub(crate) mod shape_http_payload_traits;
   71     77   
   72     78   
pub(crate) mod shape_http_payload_traits_input;
   73     79   
   74     80   
pub(crate) mod shape_http_payload_traits_with_media_type;
   75     81   
   76     82   
pub(crate) mod shape_http_payload_traits_with_media_type_input;
   77     83   
   78     84   
pub(crate) mod shape_http_payload_with_structure;
   79     85   
   80     86   
pub fn rest_json_unset_struct_payload() -> ::std::vec::Vec<u8> {
   81     87   
    b"{}"[..].into()
   82     88   
}
   83     89   
   84     90   
pub(crate) mod shape_http_payload_with_structure_input;
   85     91   
   86     92   
pub(crate) mod shape_http_payload_with_union;
   87     93   
   88     94   
pub fn rest_json_unset_union_payload() -> ::std::vec::Vec<u8> {
   89     95   
    ::std::vec::Vec::new()
   90     96   
}
   91     97   
   92     98   
pub(crate) mod shape_http_payload_with_union_input;
   93     99   
   94    100   
pub(crate) mod shape_http_prefix_headers;
   95    101   
   96    102   
pub(crate) mod shape_http_prefix_headers_in_response;
   97    103   
         104  +
pub(crate) mod shape_http_query_params_only_operation;
         105  +
   98    106   
pub(crate) mod shape_http_request_with_float_labels;
   99    107   
  100    108   
pub(crate) mod shape_http_request_with_greedy_label_in_path;
  101    109   
  102    110   
pub(crate) mod shape_http_request_with_labels;
  103    111   
  104    112   
pub(crate) mod shape_http_request_with_labels_and_timestamp_format;
  105    113   
  106    114   
pub(crate) mod shape_http_request_with_regex_literal;
  107    115   
  108    116   
pub(crate) mod shape_http_response_code;
  109    117   
  110    118   
pub(crate) mod shape_http_string_payload;
  111    119   
  112    120   
pub(crate) mod shape_http_string_payload_input;
  113    121   
  114    122   
pub(crate) mod shape_ignore_query_params_in_response;
  115    123   
  116    124   
pub(crate) mod shape_input_and_output_with_headers;
  117    125   
         126  +
pub(crate) mod shape_input_stream;
         127  +
         128  +
pub(crate) mod shape_input_stream_with_initial_request;
         129  +
  118    130   
pub(crate) mod shape_json_blobs;
  119    131   
  120    132   
pub(crate) mod shape_json_enums;
  121    133   
  122    134   
pub(crate) mod shape_json_int_enums;
  123    135   
  124    136   
pub(crate) mod shape_json_lists;
  125    137   
  126    138   
pub(crate) mod shape_json_maps;
  127    139   
@@ -190,202 +249,265 @@
  210    222   
pub(crate) mod shape_null_and_empty_headers_server;
  211    223   
  212    224   
pub(crate) mod shape_omits_null_serializes_empty_string;
  213    225   
  214    226   
pub(crate) mod shape_omits_serializing_empty_lists;
  215    227   
  216    228   
pub(crate) mod shape_operation_with_defaults;
  217    229   
  218    230   
pub(crate) mod shape_operation_with_nested_structure;
  219    231   
         232  +
pub(crate) mod shape_output_stream;
         233  +
         234  +
pub(crate) mod shape_output_stream_with_initial_response;
         235  +
  220    236   
pub(crate) mod shape_post_player_action;
  221    237   
  222    238   
pub(crate) mod shape_post_union_with_json_name;
  223    239   
  224    240   
pub(crate) mod shape_put_with_content_encoding;
  225    241   
  226    242   
pub(crate) mod shape_query_idempotency_token_auto_fill;
  227    243   
  228    244   
pub(crate) mod shape_query_params_as_string_list_map;
  229    245   
@@ -266,282 +331,357 @@
  286    302   
pub(crate) mod shape_complex_error;
  287    303   
  288    304   
pub(crate) mod shape_content_type_parameters_input;
  289    305   
  290    306   
pub(crate) mod shape_document_type_as_map_value_input;
  291    307   
  292    308   
pub(crate) mod shape_document_type_as_payload_output;
  293    309   
  294    310   
pub(crate) mod shape_document_type_input;
  295    311   
         312  +
pub(crate) mod shape_duplex_stream_output;
         313  +
         314  +
pub(crate) mod shape_duplex_stream_with_distinct_streams_output;
         315  +
         316  +
pub(crate) mod shape_duplex_stream_with_initial_messages_output;
         317  +
  296    318   
pub(crate) mod shape_endpoint_with_host_label_operation_input;
  297    319   
         320  +
pub(crate) mod shape_error_event;
         321  +
  298    322   
pub(crate) mod shape_foo_error;
  299    323   
  300    324   
pub(crate) mod shape_greeting_with_errors_output;
  301    325   
         326  +
pub(crate) mod shape_headers_and_explicit_payload_event;
         327  +
  302    328   
pub(crate) mod shape_http_checksum_required_input;
  303    329   
  304    330   
pub(crate) mod shape_http_empty_prefix_headers_output;
  305    331   
  306    332   
pub(crate) mod shape_http_enum_payload_output;
  307    333   
  308    334   
pub(crate) mod shape_http_payload_traits_output;
  309    335   
  310    336   
pub(crate) mod shape_http_payload_traits_with_media_type_output;
  311    337   
@@ -356,382 +0,576 @@
  376    402   
pub(crate) mod shape_media_type_header_output;
  377    403   
  378    404   
pub(crate) mod shape_null_and_empty_headers_client_output;
  379    405   
  380    406   
pub(crate) mod shape_null_and_empty_headers_server_output;
  381    407   
  382    408   
pub(crate) mod shape_operation_with_defaults_input;
  383    409   
  384    410   
pub(crate) mod shape_operation_with_nested_structure_input;
  385    411   
         412  +
pub(crate) mod shape_output_stream_output;
         413  +
         414  +
pub(crate) mod shape_output_stream_with_initial_response_output;
         415  +
  386    416   
pub(crate) mod shape_post_player_action_input;
  387    417   
  388    418   
pub(crate) mod shape_post_union_with_json_name_input;
  389    419   
  390    420   
pub(crate) mod shape_put_with_content_encoding_input;
  391    421   
  392    422   
pub(crate) mod shape_recursive_shapes_input;
  393    423   
         424  +
pub(crate) mod shape_service_unavailable_error;
         425  +
  394    426   
pub(crate) mod shape_simple_scalar_properties_input;
  395    427   
  396    428   
pub(crate) mod shape_simple_scalar_properties_output;
  397    429   
  398    430   
pub(crate) mod shape_sparse_json_lists_input;
  399    431   
  400    432   
pub(crate) mod shape_sparse_json_maps_input;
  401    433   
  402    434   
pub(crate) mod shape_streaming_traits_output;
  403    435   
  404    436   
pub(crate) mod shape_streaming_traits_with_media_type_output;
  405    437   
         438  +
pub(crate) mod shape_structure_payload_event;
         439  +
  406    440   
pub(crate) mod shape_test_body_structure_input;
  407    441   
  408    442   
pub(crate) mod shape_test_body_structure_output;
  409    443   
  410    444   
pub(crate) mod shape_test_get_no_input_no_payload_output;
  411    445   
  412    446   
pub(crate) mod shape_test_get_no_payload_output;
  413    447   
  414    448   
pub(crate) mod shape_test_payload_blob_output;
  415    449   
  416    450   
pub(crate) mod shape_test_payload_structure_output;
  417    451   
  418    452   
pub(crate) mod shape_test_post_no_input_no_payload_output;
  419    453   
  420    454   
pub(crate) mod shape_test_post_no_payload_output;
  421    455   
  422    456   
pub(crate) mod shape_timestamp_format_headers_output;
  423    457   
         458  +
pub(crate) mod shape_union_payload_event;
         459  +
         460  +
pub fn parse_event_stream_error_metadata(
         461  +
    payload: &::bytes::Bytes,
         462  +
) -> ::std::result::Result<::aws_smithy_types::error::metadata::Builder, ::aws_smithy_json::deserialize::error::DeserializeError> {
         463  +
    crate::json_errors::parse_error_metadata(payload, &::aws_smithy_runtime_api::http::Headers::new())
         464  +
}
         465  +
  424    466   
pub(crate) mod shape_boolean_list;
  425    467   
  426    468   
pub(crate) mod shape_client_optional_defaults;
  427    469   
  428    470   
pub(crate) mod shape_complex_nested_error_data;
  429    471   
  430    472   
pub(crate) mod shape_defaults;
  431    473   
  432    474   
pub(crate) mod shape_dense_boolean_map;
  433    475   
  434    476   
pub(crate) mod shape_dense_number_map;
  435    477   
  436    478   
pub(crate) mod shape_dense_set_map;
  437    479   
  438    480   
pub(crate) mod shape_dense_string_map;
  439    481   
  440    482   
pub(crate) mod shape_dense_struct_map;
  441    483   
  442    484   
pub(crate) mod shape_dialog;
  443    485   
  444    486   
pub(crate) mod shape_dialog_list;
  445    487   
  446    488   
pub(crate) mod shape_dialog_map;
  447    489   
  448    490   
pub(crate) mod shape_document;
  449    491   
  450    492   
pub(crate) mod shape_document_valued_map;
  451    493   
  452    494   
pub(crate) mod shape_foo_enum_list;
  453    495   
  454    496   
pub(crate) mod shape_foo_enum_map;
  455    497   
  456    498   
pub(crate) mod shape_foo_enum_set;
  457    499   
  458    500   
pub(crate) mod shape_greeting_struct;
  459    501   
  460    502   
pub(crate) mod shape_integer_enum_list;
  461    503   
  462    504   
pub(crate) mod shape_integer_enum_map;
  463    505   
  464    506   
pub(crate) mod shape_integer_enum_set;
  465    507   
  466    508   
pub(crate) mod shape_integer_list;
  467    509   
  468    510   
pub(crate) mod shape_my_union;
  469    511   
  470    512   
pub(crate) mod shape_nested_payload;
  471    513   
  472    514   
pub(crate) mod shape_nested_string_list;
  473    515   
  474    516   
pub(crate) mod shape_payload_config;
  475    517   
         518  +
pub(crate) mod shape_payload_structure;
         519  +
         520  +
pub(crate) mod shape_payload_union;
         521  +
  476    522   
pub(crate) mod shape_player_action;
  477    523   
  478    524   
pub(crate) mod shape_recursive_shapes_input_output_nested1;
  479    525   
  480    526   
pub(crate) mod shape_simple_union;
  481    527   
         528  +
pub(crate) mod shape_singleton_event_stream;
         529  +
  482    530   
pub(crate) mod shape_sparse_boolean_map;
  483    531   
  484    532   
pub(crate) mod shape_sparse_number_map;
  485    533   
  486    534   
pub(crate) mod shape_sparse_set_map;
  487    535   
  488    536   
pub(crate) mod shape_sparse_short_list;
  489    537   
  490    538   
pub(crate) mod shape_sparse_string_list;
  491    539   
  492    540   
pub(crate) mod shape_sparse_string_map;
  493    541   
  494    542   
pub(crate) mod shape_sparse_struct_map;
  495    543   
  496    544   
pub(crate) mod shape_string_list;
  497    545   
  498    546   
pub(crate) mod shape_string_set;
  499    547   
  500    548   
pub(crate) mod shape_structure_list;
  501    549   
  502    550   
pub(crate) mod shape_structure_list_member;
  503    551   
  504    552   
pub(crate) mod shape_test_config;
  505    553   
  506    554   
pub(crate) mod shape_test_string_list;
  507    555   
  508    556   
pub(crate) mod shape_test_string_map;
  509    557   
  510    558   
pub(crate) mod shape_timestamp_list;
  511    559   
  512    560   
pub(crate) mod shape_top_level;
  513    561   
  514    562   
pub(crate) mod shape_union_payload;
  515    563   
  516    564   
pub(crate) mod shape_union_with_json_name;
  517    565   
  518    566   
pub(crate) mod shape_farewell;
  519    567   
         568  +
pub(crate) mod shape_headers_and_implicit_payload_event;
         569  +
  520    570   
pub(crate) mod shape_recursive_shapes_input_output_nested2;
  521    571   
  522    572   
pub(crate) mod shape_renamed_greeting;
  523    573   
  524    574   
pub(crate) mod shape_string_map;
         575  +
         576  +
pub(crate) mod shape_singleton_event;

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_duplex_stream.rs

@@ -0,1 +0,56 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub fn de_duplex_stream_http_response(
           4  +
    response: &mut ::aws_smithy_runtime_api::http::Response,
           5  +
) -> std::result::Result<crate::operation::duplex_stream::DuplexStreamOutput, crate::operation::duplex_stream::DuplexStreamError> {
           6  +
    let mut _response_body = ::aws_smithy_types::body::SdkBody::taken();
           7  +
    std::mem::swap(&mut _response_body, response.body_mut());
           8  +
    let _response_body = &mut _response_body;
           9  +
          10  +
    let _response_status = response.status().as_u16();
          11  +
    let _response_headers = response.headers();
          12  +
    Ok({
          13  +
        #[allow(unused_mut)]
          14  +
        let mut output = crate::operation::duplex_stream::builders::DuplexStreamOutputBuilder::default();
          15  +
        output = output.set_stream(Some(crate::protocol_serde::shape_duplex_stream_output::de_stream_payload(
          16  +
            _response_body,
          17  +
        )?));
          18  +
        output.build().map_err(crate::operation::duplex_stream::DuplexStreamError::unhandled)?
          19  +
    })
          20  +
}
          21  +
          22  +
#[allow(clippy::unnecessary_wraps)]
          23  +
pub fn de_duplex_stream_http_error(
          24  +
    _response_status: u16,
          25  +
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
          26  +
    _response_body: &[u8],
          27  +
) -> std::result::Result<crate::operation::duplex_stream::DuplexStreamOutput, crate::operation::duplex_stream::DuplexStreamError> {
          28  +
    #[allow(unused_mut)]
          29  +
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
          30  +
        .map_err(crate::operation::duplex_stream::DuplexStreamError::unhandled)?;
          31  +
    let generic = generic_builder.build();
          32  +
    let error_code = match generic.code() {
          33  +
        Some(code) => code,
          34  +
        None => return Err(crate::operation::duplex_stream::DuplexStreamError::unhandled(generic)),
          35  +
    };
          36  +
          37  +
    let _error_message = generic.message().map(|msg| msg.to_owned());
          38  +
    Err(match error_code {
          39  +
        "ErrorEvent" => crate::operation::duplex_stream::DuplexStreamError::ErrorEvent({
          40  +
            #[allow(unused_mut)]
          41  +
            let mut tmp = {
          42  +
                #[allow(unused_mut)]
          43  +
                let mut output = crate::types::error::builders::ErrorEventBuilder::default();
          44  +
                output = crate::protocol_serde::shape_error_event::de_error_event_json_err(_response_body, output)
          45  +
                    .map_err(crate::operation::duplex_stream::DuplexStreamError::unhandled)?;
          46  +
                let output = output.meta(generic);
          47  +
                output.build()
          48  +
            };
          49  +
            if tmp.message.is_none() {
          50  +
                tmp.message = _error_message;
          51  +
            }
          52  +
            tmp
          53  +
        }),
          54  +
        _ => crate::operation::duplex_stream::DuplexStreamError::generic(generic),
          55  +
    })
          56  +
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_duplex_stream_output.rs

@@ -0,1 +0,12 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn de_stream_payload(
           3  +
    body: &mut ::aws_smithy_types::body::SdkBody,
           4  +
) -> std::result::Result<
           5  +
    crate::event_receiver::EventReceiver<crate::types::EventStream, crate::types::error::EventStreamError>,
           6  +
    crate::operation::duplex_stream::DuplexStreamError,
           7  +
> {
           8  +
    let unmarshaller = crate::event_stream_serde::EventStreamUnmarshaller::new();
           9  +
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
          10  +
    let receiver = crate::event_receiver::EventReceiver::new(::aws_smithy_http::event_stream::Receiver::new(unmarshaller, body));
          11  +
    Ok(receiver)
          12  +
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_duplex_stream_with_distinct_streams.rs

@@ -0,1 +0,56 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub fn de_duplex_stream_with_distinct_streams_http_error(
           4  +
    _response_status: u16,
           5  +
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
           6  +
    _response_body: &[u8],
           7  +
) -> std::result::Result<
           8  +
    crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsOutput,
           9  +
    crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsError,
          10  +
> {
          11  +
    #[allow(unused_mut)]
          12  +
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
          13  +
        .map_err(crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsError::unhandled)?;
          14  +
    let generic = generic_builder.build();
          15  +
    let error_code = match generic.code() {
          16  +
        Some(code) => code,
          17  +
        None => return Err(crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsError::unhandled(generic)),
          18  +
    };
          19  +
          20  +
    let _error_message = generic.message().map(|msg| msg.to_owned());
          21  +
    Err(match error_code {
          22  +
        "ErrorEvent" => crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsError::ErrorEvent({
          23  +
            #[allow(unused_mut)]
          24  +
            let mut tmp = {
          25  +
                #[allow(unused_mut)]
          26  +
                let mut output = crate::types::error::builders::ErrorEventBuilder::default();
          27  +
                output = crate::protocol_serde::shape_error_event::de_error_event_json_err(_response_body, output)
          28  +
                    .map_err(crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsError::unhandled)?;
          29  +
                let output = output.meta(generic);
          30  +
                output.build()
          31  +
            };
          32  +
            if tmp.message.is_none() {
          33  +
                tmp.message = _error_message;
          34  +
            }
          35  +
            tmp
          36  +
        }),
          37  +
        _ => crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsError::generic(generic),
          38  +
    })
          39  +
}
          40  +
          41  +
#[allow(clippy::unnecessary_wraps)]
          42  +
pub fn de_duplex_stream_with_distinct_streams_http_response(
          43  +
    _response_status: u16,
          44  +
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
          45  +
    _response_body: &[u8],
          46  +
) -> std::result::Result<
          47  +
    crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsOutput,
          48  +
    crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsError,
          49  +
> {
          50  +
    Ok({
          51  +
        #[allow(unused_mut)]
          52  +
        let mut output = crate::operation::duplex_stream_with_distinct_streams::builders::DuplexStreamWithDistinctStreamsOutputBuilder::default();
          53  +
        output = output.set_stream(crate::protocol_serde::shape_duplex_stream_with_distinct_streams_output::de_stream_payload(_response_body)?);
          54  +
        output.build()
          55  +
    })
          56  +
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_duplex_stream_with_distinct_streams_output.rs

@@ -0,1 +0,14 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_stream_payload(
           3  +
    body: &[u8],
           4  +
) -> std::result::Result<
           5  +
    ::std::option::Option<crate::types::SingletonEventStream>,
           6  +
    crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsError,
           7  +
> {
           8  +
    (!body.is_empty())
           9  +
        .then(|| {
          10  +
            crate::protocol_serde::shape_singleton_event_stream::de_singleton_event_stream_payload(body)
          11  +
                .map_err(crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsError::unhandled)
          12  +
        })
          13  +
        .transpose()
          14  +
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_duplex_stream_with_initial_messages.rs

@@ -0,1 +0,108 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub fn de_duplex_stream_with_initial_messages_http_response(
           4  +
    response: &mut ::aws_smithy_runtime_api::http::Response,
           5  +
) -> std::result::Result<
           6  +
    crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesOutput,
           7  +
    crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError,
           8  +
> {
           9  +
    let mut _response_body = ::aws_smithy_types::body::SdkBody::taken();
          10  +
    std::mem::swap(&mut _response_body, response.body_mut());
          11  +
    let _response_body = &mut _response_body;
          12  +
          13  +
    let _response_status = response.status().as_u16();
          14  +
    let _response_headers = response.headers();
          15  +
    Ok({
          16  +
        #[allow(unused_mut)]
          17  +
        let mut output = crate::operation::duplex_stream_with_initial_messages::builders::DuplexStreamWithInitialMessagesOutputBuilder::default();
          18  +
        output = output.set_initial_response_member(
          19  +
            crate::protocol_serde::shape_duplex_stream_with_initial_messages_output::de_initial_response_member_header(_response_headers).map_err(
          20  +
                |_| {
          21  +
                    crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError::unhandled(
          22  +
                        "Failed to parse initialResponseMember from header `initial-response-member",
          23  +
                    )
          24  +
                },
          25  +
            )?,
          26  +
        );
          27  +
        output = output.set_stream(Some(
          28  +
            crate::protocol_serde::shape_duplex_stream_with_initial_messages_output::de_stream_payload(_response_body)?,
          29  +
        ));
          30  +
        crate::serde_util::duplex_stream_with_initial_messages_output_output_correct_errors(output)
          31  +
            .build()
          32  +
            .map_err(crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError::unhandled)?
          33  +
    })
          34  +
}
          35  +
          36  +
#[allow(clippy::unnecessary_wraps)]
          37  +
pub fn de_duplex_stream_with_initial_messages_http_error(
          38  +
    _response_status: u16,
          39  +
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
          40  +
    _response_body: &[u8],
          41  +
) -> std::result::Result<
          42  +
    crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesOutput,
          43  +
    crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError,
          44  +
> {
          45  +
    #[allow(unused_mut)]
          46  +
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
          47  +
        .map_err(crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError::unhandled)?;
          48  +
    let generic = generic_builder.build();
          49  +
    let error_code = match generic.code() {
          50  +
        Some(code) => code,
          51  +
        None => return Err(crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError::unhandled(generic)),
          52  +
    };
          53  +
          54  +
    let _error_message = generic.message().map(|msg| msg.to_owned());
          55  +
    Err(match error_code {
          56  +
        "ServiceUnavailableError" => {
          57  +
            crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError::ServiceUnavailableError({
          58  +
                #[allow(unused_mut)]
          59  +
                let mut tmp = {
          60  +
                    #[allow(unused_mut)]
          61  +
                    let mut output = crate::types::error::builders::ServiceUnavailableErrorBuilder::default();
          62  +
                    output = crate::protocol_serde::shape_service_unavailable_error::de_service_unavailable_error_json_err(_response_body, output)
          63  +
                        .map_err(crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError::unhandled)?;
          64  +
                    let output = output.meta(generic);
          65  +
                    output.build()
          66  +
                };
          67  +
                if tmp.message.is_none() {
          68  +
                    tmp.message = _error_message;
          69  +
                }
          70  +
                tmp
          71  +
            })
          72  +
        }
          73  +
        "ErrorEvent" => crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError::ErrorEvent({
          74  +
            #[allow(unused_mut)]
          75  +
            let mut tmp = {
          76  +
                #[allow(unused_mut)]
          77  +
                let mut output = crate::types::error::builders::ErrorEventBuilder::default();
          78  +
                output = crate::protocol_serde::shape_error_event::de_error_event_json_err(_response_body, output)
          79  +
                    .map_err(crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError::unhandled)?;
          80  +
                let output = output.meta(generic);
          81  +
                output.build()
          82  +
            };
          83  +
            if tmp.message.is_none() {
          84  +
                tmp.message = _error_message;
          85  +
            }
          86  +
            tmp
          87  +
        }),
          88  +
        _ => crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError::generic(generic),
          89  +
    })
          90  +
}
          91  +
          92  +
pub fn ser_duplex_stream_with_initial_messages_headers(
          93  +
    input: &crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesInput,
          94  +
    mut builder: ::http_1x::request::Builder,
          95  +
) -> std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
          96  +
    if let ::std::option::Option::Some(inner_1) = &input.initial_request_member {
          97  +
        let formatted_2 = inner_1.as_str();
          98  +
        let header_value = formatted_2;
          99  +
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
         100  +
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
         101  +
                "initial_request_member",
         102  +
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
         103  +
            )
         104  +
        })?;
         105  +
        builder = builder.header("initial-request-member", header_value);
         106  +
    }
         107  +
    Ok(builder)
         108  +
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_duplex_stream_with_initial_messages_output.rs

@@ -0,1 +0,19 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_initial_response_member_header(
           3  +
    header_map: &::aws_smithy_runtime_api::http::Headers,
           4  +
) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
           5  +
    let headers = header_map.get_all("initial-response-member");
           6  +
    ::aws_smithy_http::header::one_or_none(headers)
           7  +
}
           8  +
           9  +
pub fn de_stream_payload(
          10  +
    body: &mut ::aws_smithy_types::body::SdkBody,
          11  +
) -> std::result::Result<
          12  +
    crate::event_receiver::EventReceiver<crate::types::EventStream, crate::types::error::EventStreamError>,
          13  +
    crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError,
          14  +
> {
          15  +
    let unmarshaller = crate::event_stream_serde::EventStreamUnmarshaller::new();
          16  +
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
          17  +
    let receiver = crate::event_receiver::EventReceiver::new(::aws_smithy_http::event_stream::Receiver::new(unmarshaller, body));
          18  +
    Ok(receiver)
          19  +
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_error_event.rs

@@ -0,1 +0,55 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_error_event_error(
           3  +
    value: &crate::types::error::ErrorEvent,
           4  +
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           5  +
    let mut out = ::std::string::String::new();
           6  +
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           7  +
    crate::protocol_serde::shape_error_event::ser_error_event(&mut object, value)?;
           8  +
    object.finish();
           9  +
    Ok(out)
          10  +
}
          11  +
          12  +
pub(crate) fn de_error_event_json_err(
          13  +
    _value: &[u8],
          14  +
    mut builder: crate::types::error::builders::ErrorEventBuilder,
          15  +
) -> ::std::result::Result<crate::types::error::builders::ErrorEventBuilder, ::aws_smithy_json::deserialize::error::DeserializeError> {
          16  +
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
          17  +
    let tokens = &mut tokens_owned;
          18  +
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
          19  +
    loop {
          20  +
        match tokens.next().transpose()? {
          21  +
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          22  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
          23  +
                "message" => {
          24  +
                    builder = builder.set_message(
          25  +
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
          26  +
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
          27  +
                            .transpose()?,
          28  +
                    );
          29  +
                }
          30  +
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          31  +
            },
          32  +
            other => {
          33  +
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
          34  +
                    "expected object key or end object, found: {other:?}"
          35  +
                )))
          36  +
            }
          37  +
        }
          38  +
    }
          39  +
    if tokens.next().is_some() {
          40  +
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          41  +
            "found more JSON tokens after completing parsing",
          42  +
        ));
          43  +
    }
          44  +
    Ok(builder)
          45  +
}
          46  +
          47  +
pub fn ser_error_event(
          48  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          49  +
    input: &crate::types::error::ErrorEvent,
          50  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          51  +
    if let Some(var_1) = &input.message {
          52  +
        object.key("message").string(var_1.as_str());
          53  +
    }
          54  +
    Ok(())
          55  +
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_headers_and_explicit_payload_event.rs

@@ -0,1 +0,10 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_payload_payload(
           3  +
    input: &crate::types::PayloadStructure,
           4  +
) -> std::result::Result<::std::vec::Vec<u8>, ::aws_smithy_types::error::operation::SerializationError> {
           5  +
    let mut out = String::new();
           6  +
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           7  +
    crate::protocol_serde::shape_payload_structure::ser_payload_structure(&mut object, input)?;
           8  +
    object.finish();
           9  +
    Ok(out.into_bytes())
          10  +
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_headers_and_implicit_payload_event.rs

@@ -0,1 +0,42 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_headers_and_implicit_payload_event_json_err(
           3  +
    _value: &[u8],
           4  +
    mut builder: crate::types::builders::HeadersAndImplicitPayloadEventBuilder,
           5  +
) -> ::std::result::Result<crate::types::builders::HeadersAndImplicitPayloadEventBuilder, ::aws_smithy_json::deserialize::error::DeserializeError> {
           6  +
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
           7  +
    let tokens = &mut tokens_owned;
           8  +
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
           9  +
    loop {
          10  +
        match tokens.next().transpose()? {
          11  +
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          12  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
          13  +
                "header" => {
          14  +
                    builder = builder.set_header(
          15  +
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
          16  +
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
          17  +
                            .transpose()?,
          18  +
                    );
          19  +
                }
          20  +
                "payload" => {
          21  +
                    builder = builder.set_payload(
          22  +
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
          23  +
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
          24  +
                            .transpose()?,
          25  +
                    );
          26  +
                }
          27  +
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          28  +
            },
          29  +
            other => {
          30  +
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
          31  +
                    "expected object key or end object, found: {other:?}"
          32  +
                )))
          33  +
            }
          34  +
        }
          35  +
    }
          36  +
    if tokens.next().is_some() {
          37  +
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          38  +
            "found more JSON tokens after completing parsing",
          39  +
        ));
          40  +
    }
          41  +
    Ok(builder)
          42  +
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_http_query_params_only_operation.rs

Renamed from tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/protocol_serde/shape_http_query_params_only_operation.rs

@@ -1,1 +55,32 @@
    5      5   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6      6   
    _response_body: &[u8],
    7      7   
) -> std::result::Result<
    8      8   
    crate::operation::http_query_params_only_operation::HttpQueryParamsOnlyOperationOutput,
    9      9   
    crate::operation::http_query_params_only_operation::HttpQueryParamsOnlyOperationError,
   10     10   
> {
   11     11   
    #[allow(unused_mut)]
   12     12   
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   13     13   
        .map_err(crate::operation::http_query_params_only_operation::HttpQueryParamsOnlyOperationError::unhandled)?;
   14     14   
    let generic = generic_builder.build();
   15         -
    let error_code = match generic.code() {
   16         -
        Some(code) => code,
   17         -
        None => return Err(crate::operation::http_query_params_only_operation::HttpQueryParamsOnlyOperationError::unhandled(generic)),
   18         -
    };
   19         -
   20         -
    let _error_message = generic.message().map(|msg| msg.to_owned());
   21         -
    Err(match error_code {
   22         -
        "ExtraError" => crate::operation::http_query_params_only_operation::HttpQueryParamsOnlyOperationError::ExtraError({
   23         -
            #[allow(unused_mut)]
   24         -
            let mut tmp = {
   25         -
                #[allow(unused_mut)]
   26         -
                let mut output = crate::types::error::builders::ExtraErrorBuilder::default();
   27         -
                output = crate::protocol_serde::shape_extra_error::de_extra_error_json_err(_response_body, output)
   28         -
                    .map_err(crate::operation::http_query_params_only_operation::HttpQueryParamsOnlyOperationError::unhandled)?;
   29         -
                let output = output.meta(generic);
   30         -
                output.build()
   31         -
            };
   32         -
            if tmp.message.is_none() {
   33         -
                tmp.message = _error_message;
   34         -
            }
   35         -
            tmp
   36         -
        }),
   37         -
        _ => crate::operation::http_query_params_only_operation::HttpQueryParamsOnlyOperationError::generic(generic),
   38         -
    })
          15  +
    Err(crate::operation::http_query_params_only_operation::HttpQueryParamsOnlyOperationError::generic(generic))
   39     16   
}
   40     17   
   41     18   
#[allow(clippy::unnecessary_wraps)]
   42     19   
pub fn de_http_query_params_only_operation_http_response(
   43     20   
    _response_status: u16,
   44     21   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   45     22   
    _response_body: &[u8],
   46     23   
) -> std::result::Result<
   47     24   
    crate::operation::http_query_params_only_operation::HttpQueryParamsOnlyOperationOutput,
   48     25   
    crate::operation::http_query_params_only_operation::HttpQueryParamsOnlyOperationError,

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_input_stream.rs

@@ -0,1 +0,49 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub fn de_input_stream_http_error(
           4  +
    _response_status: u16,
           5  +
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
           6  +
    _response_body: &[u8],
           7  +
) -> std::result::Result<crate::operation::input_stream::InputStreamOutput, crate::operation::input_stream::InputStreamError> {
           8  +
    #[allow(unused_mut)]
           9  +
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
          10  +
        .map_err(crate::operation::input_stream::InputStreamError::unhandled)?;
          11  +
    let generic = generic_builder.build();
          12  +
    let error_code = match generic.code() {
          13  +
        Some(code) => code,
          14  +
        None => return Err(crate::operation::input_stream::InputStreamError::unhandled(generic)),
          15  +
    };
          16  +
          17  +
    let _error_message = generic.message().map(|msg| msg.to_owned());
          18  +
    Err(match error_code {
          19  +
        "ErrorEvent" => crate::operation::input_stream::InputStreamError::ErrorEvent({
          20  +
            #[allow(unused_mut)]
          21  +
            let mut tmp = {
          22  +
                #[allow(unused_mut)]
          23  +
                let mut output = crate::types::error::builders::ErrorEventBuilder::default();
          24  +
                output = crate::protocol_serde::shape_error_event::de_error_event_json_err(_response_body, output)
          25  +
                    .map_err(crate::operation::input_stream::InputStreamError::unhandled)?;
          26  +
                let output = output.meta(generic);
          27  +
                output.build()
          28  +
            };
          29  +
            if tmp.message.is_none() {
          30  +
                tmp.message = _error_message;
          31  +
            }
          32  +
            tmp
          33  +
        }),
          34  +
        _ => crate::operation::input_stream::InputStreamError::generic(generic),
          35  +
    })
          36  +
}
          37  +
          38  +
#[allow(clippy::unnecessary_wraps)]
          39  +
pub fn de_input_stream_http_response(
          40  +
    _response_status: u16,
          41  +
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
          42  +
    _response_body: &[u8],
          43  +
) -> std::result::Result<crate::operation::input_stream::InputStreamOutput, crate::operation::input_stream::InputStreamError> {
          44  +
    Ok({
          45  +
        #[allow(unused_mut)]
          46  +
        let mut output = crate::operation::input_stream::builders::InputStreamOutputBuilder::default();
          47  +
        output.build()
          48  +
    })
          49  +
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_input_stream_with_initial_request.rs

@@ -0,1 +0,73 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub fn de_input_stream_with_initial_request_http_error(
           4  +
    _response_status: u16,
           5  +
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
           6  +
    _response_body: &[u8],
           7  +
) -> std::result::Result<
           8  +
    crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestOutput,
           9  +
    crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestError,
          10  +
> {
          11  +
    #[allow(unused_mut)]
          12  +
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
          13  +
        .map_err(crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestError::unhandled)?;
          14  +
    let generic = generic_builder.build();
          15  +
    let error_code = match generic.code() {
          16  +
        Some(code) => code,
          17  +
        None => return Err(crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestError::unhandled(generic)),
          18  +
    };
          19  +
          20  +
    let _error_message = generic.message().map(|msg| msg.to_owned());
          21  +
    Err(match error_code {
          22  +
        "ErrorEvent" => crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestError::ErrorEvent({
          23  +
            #[allow(unused_mut)]
          24  +
            let mut tmp = {
          25  +
                #[allow(unused_mut)]
          26  +
                let mut output = crate::types::error::builders::ErrorEventBuilder::default();
          27  +
                output = crate::protocol_serde::shape_error_event::de_error_event_json_err(_response_body, output)
          28  +
                    .map_err(crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestError::unhandled)?;
          29  +
                let output = output.meta(generic);
          30  +
                output.build()
          31  +
            };
          32  +
            if tmp.message.is_none() {
          33  +
                tmp.message = _error_message;
          34  +
            }
          35  +
            tmp
          36  +
        }),
          37  +
        _ => crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestError::generic(generic),
          38  +
    })
          39  +
}
          40  +
          41  +
#[allow(clippy::unnecessary_wraps)]
          42  +
pub fn de_input_stream_with_initial_request_http_response(
          43  +
    _response_status: u16,
          44  +
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
          45  +
    _response_body: &[u8],
          46  +
) -> std::result::Result<
          47  +
    crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestOutput,
          48  +
    crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestError,
          49  +
> {
          50  +
    Ok({
          51  +
        #[allow(unused_mut)]
          52  +
        let mut output = crate::operation::input_stream_with_initial_request::builders::InputStreamWithInitialRequestOutputBuilder::default();
          53  +
        output.build()
          54  +
    })
          55  +
}
          56  +
          57  +
pub fn ser_input_stream_with_initial_request_headers(
          58  +
    input: &crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestInput,
          59  +
    mut builder: ::http_1x::request::Builder,
          60  +
) -> std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
          61  +
    if let ::std::option::Option::Some(inner_1) = &input.initial_request_member {
          62  +
        let formatted_2 = inner_1.as_str();
          63  +
        let header_value = formatted_2;
          64  +
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
          65  +
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
          66  +
                "initial_request_member",
          67  +
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
          68  +
            )
          69  +
        })?;
          70  +
        builder = builder.header("initial-request-member", header_value);
          71  +
    }
          72  +
    Ok(builder)
          73  +
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_output_stream.rs

@@ -0,1 +0,71 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub fn de_output_stream_http_response(
           4  +
    response: &mut ::aws_smithy_runtime_api::http::Response,
           5  +
) -> std::result::Result<crate::operation::output_stream::OutputStreamOutput, crate::operation::output_stream::OutputStreamError> {
           6  +
    let mut _response_body = ::aws_smithy_types::body::SdkBody::taken();
           7  +
    std::mem::swap(&mut _response_body, response.body_mut());
           8  +
    let _response_body = &mut _response_body;
           9  +
          10  +
    let _response_status = response.status().as_u16();
          11  +
    let _response_headers = response.headers();
          12  +
    Ok({
          13  +
        #[allow(unused_mut)]
          14  +
        let mut output = crate::operation::output_stream::builders::OutputStreamOutputBuilder::default();
          15  +
        output = output.set_stream(Some(crate::protocol_serde::shape_output_stream_output::de_stream_payload(
          16  +
            _response_body,
          17  +
        )?));
          18  +
        output.build().map_err(crate::operation::output_stream::OutputStreamError::unhandled)?
          19  +
    })
          20  +
}
          21  +
          22  +
#[allow(clippy::unnecessary_wraps)]
          23  +
pub fn de_output_stream_http_error(
          24  +
    _response_status: u16,
          25  +
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
          26  +
    _response_body: &[u8],
          27  +
) -> std::result::Result<crate::operation::output_stream::OutputStreamOutput, crate::operation::output_stream::OutputStreamError> {
          28  +
    #[allow(unused_mut)]
          29  +
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
          30  +
        .map_err(crate::operation::output_stream::OutputStreamError::unhandled)?;
          31  +
    let generic = generic_builder.build();
          32  +
    let error_code = match generic.code() {
          33  +
        Some(code) => code,
          34  +
        None => return Err(crate::operation::output_stream::OutputStreamError::unhandled(generic)),
          35  +
    };
          36  +
          37  +
    let _error_message = generic.message().map(|msg| msg.to_owned());
          38  +
    Err(match error_code {
          39  +
        "ServiceUnavailableError" => crate::operation::output_stream::OutputStreamError::ServiceUnavailableError({
          40  +
            #[allow(unused_mut)]
          41  +
            let mut tmp = {
          42  +
                #[allow(unused_mut)]
          43  +
                let mut output = crate::types::error::builders::ServiceUnavailableErrorBuilder::default();
          44  +
                output = crate::protocol_serde::shape_service_unavailable_error::de_service_unavailable_error_json_err(_response_body, output)
          45  +
                    .map_err(crate::operation::output_stream::OutputStreamError::unhandled)?;
          46  +
                let output = output.meta(generic);
          47  +
                output.build()
          48  +
            };
          49  +
            if tmp.message.is_none() {
          50  +
                tmp.message = _error_message;
          51  +
            }
          52  +
            tmp
          53  +
        }),
          54  +
        "ErrorEvent" => crate::operation::output_stream::OutputStreamError::ErrorEvent({
          55  +
            #[allow(unused_mut)]
          56  +
            let mut tmp = {
          57  +
                #[allow(unused_mut)]
          58  +
                let mut output = crate::types::error::builders::ErrorEventBuilder::default();
          59  +
                output = crate::protocol_serde::shape_error_event::de_error_event_json_err(_response_body, output)
          60  +
                    .map_err(crate::operation::output_stream::OutputStreamError::unhandled)?;
          61  +
                let output = output.meta(generic);
          62  +
                output.build()
          63  +
            };
          64  +
            if tmp.message.is_none() {
          65  +
                tmp.message = _error_message;
          66  +
            }
          67  +
            tmp
          68  +
        }),
          69  +
        _ => crate::operation::output_stream::OutputStreamError::generic(generic),
          70  +
    })
          71  +
}