Client Test

Client Test

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943

Files changed:

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

@@ -1,1 +32,55 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:398 */
    2      3   
pub(crate) fn de_nested_string_list<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<Option<::std::vec::Vec<::std::vec::Vec<::std::string::String>>>, ::aws_smithy_json::deserialize::error::DeserializeError>
    5      6   
where
    6      7   
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
    7      8   
{
           9  +
    /* JsonParserGenerator.kt:712 */
    8     10   
    match tokens.next().transpose()? {
    9         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          11  +
        /* JsonParserGenerator.kt:713 */ Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   10     12   
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
          13  +
            /* JsonParserGenerator.kt:407 */
   11     14   
            let mut items = Vec::new();
          15  +
            /* JsonParserGenerator.kt:408 */
   12     16   
            loop {
          17  +
                /* JsonParserGenerator.kt:409 */
   13     18   
                match tokens.peek() {
          19  +
                    /* JsonParserGenerator.kt:410 */
   14     20   
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
          21  +
                        /* JsonParserGenerator.kt:411 */
   15     22   
                        tokens.next().transpose().unwrap();
   16     23   
                        break;
          24  +
                        /* JsonParserGenerator.kt:410 */
   17     25   
                    }
          26  +
                    /* JsonParserGenerator.kt:413 */
   18     27   
                    _ => {
   19         -
                        let value = crate::protocol_serde::shape_string_list::de_string_list(tokens)?;
          28  +
                        /* JsonParserGenerator.kt:419 */
          29  +
                        let value =
          30  +
                            /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_string_list::de_string_list(tokens)?
          31  +
                        /* JsonParserGenerator.kt:419 */;
          32  +
                        /* JsonParserGenerator.kt:422 */
   20     33   
                        if let Some(value) = value {
   21     34   
                            items.push(value);
   22     35   
                        }
   23         -
                    }
          36  +
                        /* JsonParserGenerator.kt:413 */
          37  +
                    } /* JsonParserGenerator.kt:409 */
   24     38   
                }
          39  +
                /* JsonParserGenerator.kt:408 */
   25     40   
            }
          41  +
            /* JsonParserGenerator.kt:446 */
   26     42   
            Ok(Some(items))
          43  +
            /* JsonParserGenerator.kt:713 */
   27     44   
        }
   28         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   29         -
            "expected start array or null",
   30         -
        )),
          45  +
        /* JsonParserGenerator.kt:722 */
          46  +
        _ => {
          47  +
            /* JsonParserGenerator.kt:723 */
          48  +
            Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          49  +
                "expected start array or null",
          50  +
            ))
          51  +
            /* JsonParserGenerator.kt:722 */
          52  +
        } /* JsonParserGenerator.kt:712 */
   31     53   
    }
          54  +
    /* JsonParserGenerator.kt:398 */
   32     55   
}

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

@@ -1,1 +32,47 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ProtocolParserGenerator.kt:99 */
    3      5   
pub fn de_no_input_and_no_output_http_error(
    4      6   
    _response_status: u16,
    5      7   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6      8   
    _response_body: &[u8],
    7      9   
) -> std::result::Result<
    8     10   
    crate::operation::no_input_and_no_output::NoInputAndNoOutputOutput,
    9     11   
    crate::operation::no_input_and_no_output::NoInputAndNoOutputError,
   10     12   
> {
          13  +
    /* RustType.kt:516 */
   11     14   
    #[allow(unused_mut)]
          15  +
    /* ProtocolParserGenerator.kt:106 */
   12     16   
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   13     17   
        .map_err(crate::operation::no_input_and_no_output::NoInputAndNoOutputError::unhandled)?;
          18  +
    /* ProtocolParserGenerator.kt:120 */
   14     19   
    let generic = generic_builder.build();
          20  +
    /* ProtocolParserGenerator.kt:185 */
   15     21   
    Err(crate::operation::no_input_and_no_output::NoInputAndNoOutputError::generic(generic))
          22  +
    /* ProtocolParserGenerator.kt:99 */
   16     23   
}
   17     24   
          25  +
/* RustType.kt:516 */
   18     26   
#[allow(clippy::unnecessary_wraps)]
          27  +
/* ProtocolParserGenerator.kt:71 */
   19     28   
pub fn de_no_input_and_no_output_http_response(
   20     29   
    _response_status: u16,
   21     30   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   22     31   
    _response_body: &[u8],
   23     32   
) -> std::result::Result<
   24     33   
    crate::operation::no_input_and_no_output::NoInputAndNoOutputOutput,
   25     34   
    crate::operation::no_input_and_no_output::NoInputAndNoOutputError,
   26     35   
> {
          36  +
    /* ProtocolParserGenerator.kt:77 */
   27     37   
    Ok({
          38  +
        /* RustType.kt:516 */
   28     39   
        #[allow(unused_mut)]
          40  +
        /* ProtocolParserGenerator.kt:240 */
   29     41   
        let mut output = crate::operation::no_input_and_no_output::builders::NoInputAndNoOutputOutputBuilder::default();
          42  +
        /* ClientBuilderInstantiator.kt:56 */
   30     43   
        output.build()
          44  +
        /* ProtocolParserGenerator.kt:77 */
   31     45   
    })
          46  +
    /* ProtocolParserGenerator.kt:71 */
   32     47   
}

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

@@ -1,1 +28,43 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ProtocolParserGenerator.kt:99 */
    3      5   
pub fn de_no_input_and_output_http_error(
    4      6   
    _response_status: u16,
    5      7   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6      8   
    _response_body: &[u8],
    7      9   
) -> std::result::Result<crate::operation::no_input_and_output::NoInputAndOutputOutput, crate::operation::no_input_and_output::NoInputAndOutputError>
    8     10   
{
          11  +
    /* RustType.kt:516 */
    9     12   
    #[allow(unused_mut)]
          13  +
    /* ProtocolParserGenerator.kt:106 */
   10     14   
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   11     15   
        .map_err(crate::operation::no_input_and_output::NoInputAndOutputError::unhandled)?;
          16  +
    /* ProtocolParserGenerator.kt:120 */
   12     17   
    let generic = generic_builder.build();
          18  +
    /* ProtocolParserGenerator.kt:185 */
   13     19   
    Err(crate::operation::no_input_and_output::NoInputAndOutputError::generic(generic))
          20  +
    /* ProtocolParserGenerator.kt:99 */
   14     21   
}
   15     22   
          23  +
/* RustType.kt:516 */
   16     24   
#[allow(clippy::unnecessary_wraps)]
          25  +
/* ProtocolParserGenerator.kt:71 */
   17     26   
pub fn de_no_input_and_output_http_response(
   18     27   
    _response_status: u16,
   19     28   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   20     29   
    _response_body: &[u8],
   21     30   
) -> std::result::Result<crate::operation::no_input_and_output::NoInputAndOutputOutput, crate::operation::no_input_and_output::NoInputAndOutputError>
   22     31   
{
          32  +
    /* ProtocolParserGenerator.kt:77 */
   23     33   
    Ok({
          34  +
        /* RustType.kt:516 */
   24     35   
        #[allow(unused_mut)]
          36  +
        /* ProtocolParserGenerator.kt:240 */
   25     37   
        let mut output = crate::operation::no_input_and_output::builders::NoInputAndOutputOutputBuilder::default();
          38  +
        /* ClientBuilderInstantiator.kt:56 */
   26     39   
        output.build()
          40  +
        /* ProtocolParserGenerator.kt:77 */
   27     41   
    })
          42  +
    /* ProtocolParserGenerator.kt:71 */
   28     43   
}

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

@@ -1,1 +96,135 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ProtocolParserGenerator.kt:99 */
    3      5   
pub fn de_null_and_empty_headers_client_http_error(
    4      6   
    _response_status: u16,
    5      7   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6      8   
    _response_body: &[u8],
    7      9   
) -> std::result::Result<
    8     10   
    crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientOutput,
    9     11   
    crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientError,
   10     12   
> {
          13  +
    /* RustType.kt:516 */
   11     14   
    #[allow(unused_mut)]
          15  +
    /* ProtocolParserGenerator.kt:106 */
   12     16   
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   13     17   
        .map_err(crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientError::unhandled)?;
          18  +
    /* ProtocolParserGenerator.kt:120 */
   14     19   
    let generic = generic_builder.build();
          20  +
    /* ProtocolParserGenerator.kt:185 */
   15     21   
    Err(crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientError::generic(
   16     22   
        generic,
   17     23   
    ))
          24  +
    /* ProtocolParserGenerator.kt:99 */
   18     25   
}
   19     26   
          27  +
/* RustType.kt:516 */
   20     28   
#[allow(clippy::unnecessary_wraps)]
          29  +
/* ProtocolParserGenerator.kt:71 */
   21     30   
pub fn de_null_and_empty_headers_client_http_response(
   22     31   
    _response_status: u16,
   23     32   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   24     33   
    _response_body: &[u8],
   25     34   
) -> std::result::Result<
   26     35   
    crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientOutput,
   27     36   
    crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientError,
   28     37   
> {
          38  +
    /* ProtocolParserGenerator.kt:77 */
   29     39   
    Ok({
          40  +
        /* RustType.kt:516 */
   30     41   
        #[allow(unused_mut)]
          42  +
        /* ProtocolParserGenerator.kt:240 */
   31     43   
        let mut output = crate::operation::null_and_empty_headers_client::builders::NullAndEmptyHeadersClientOutputBuilder::default();
          44  +
        /* ProtocolParserGenerator.kt:267 */
   32     45   
        output = output.set_a(
          46  +
            /* ProtocolParserGenerator.kt:302 */
   33     47   
            crate::protocol_serde::shape_null_and_empty_headers_client_output::de_a_header(_response_headers).map_err(|_| {
   34     48   
                crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientError::unhandled("Failed to parse a from header `X-A")
   35         -
            })?,
          49  +
            })?, /* ProtocolParserGenerator.kt:267 */
   36     50   
        );
          51  +
        /* ProtocolParserGenerator.kt:267 */
   37     52   
        output = output.set_b(
          53  +
            /* ProtocolParserGenerator.kt:302 */
   38     54   
            crate::protocol_serde::shape_null_and_empty_headers_client_output::de_b_header(_response_headers).map_err(|_| {
   39     55   
                crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientError::unhandled("Failed to parse b from header `X-B")
   40         -
            })?,
          56  +
            })?, /* ProtocolParserGenerator.kt:267 */
   41     57   
        );
          58  +
        /* ProtocolParserGenerator.kt:267 */
   42     59   
        output = output.set_c(
          60  +
            /* ProtocolParserGenerator.kt:302 */
   43     61   
            crate::protocol_serde::shape_null_and_empty_headers_client_output::de_c_header(_response_headers).map_err(|_| {
   44     62   
                crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientError::unhandled("Failed to parse c from header `X-C")
   45         -
            })?,
          63  +
            })?, /* ProtocolParserGenerator.kt:267 */
   46     64   
        );
          65  +
        /* ClientBuilderInstantiator.kt:56 */
   47     66   
        output.build()
          67  +
        /* ProtocolParserGenerator.kt:77 */
   48     68   
    })
          69  +
    /* ProtocolParserGenerator.kt:71 */
   49     70   
}
   50     71   
          72  +
/* HttpBindingGenerator.kt:542 */
   51     73   
pub fn ser_null_and_empty_headers_client_headers(
   52     74   
    input: &crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientInput,
   53     75   
    mut builder: ::http::request::Builder,
   54     76   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
          77  +
    /* HttpBindingGenerator.kt:592 */
   55     78   
    if let ::std::option::Option::Some(inner_1) = &input.a {
          79  +
        /* HttpBindingGenerator.kt:704 */
   56     80   
        let formatted_2 = inner_1.as_str();
          81  +
        /* HttpBindingGenerator.kt:706 */
   57     82   
        let header_value = formatted_2;
   58     83   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   59     84   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   60     85   
                "a",
   61     86   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   62     87   
            )
   63     88   
        })?;
   64     89   
        builder = builder.header("X-A", header_value);
          90  +
        /* HttpBindingGenerator.kt:592 */
   65     91   
    }
          92  +
    /* HttpBindingGenerator.kt:592 */
   66     93   
    if let ::std::option::Option::Some(inner_3) = &input.b {
          94  +
        /* HttpBindingGenerator.kt:704 */
   67     95   
        let formatted_4 = inner_3.as_str();
          96  +
        /* HttpBindingGenerator.kt:706 */
   68     97   
        let header_value = formatted_4;
   69     98   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   70     99   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   71    100   
                "b",
   72    101   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   73    102   
            )
   74    103   
        })?;
   75    104   
        builder = builder.header("X-B", header_value);
         105  +
        /* HttpBindingGenerator.kt:592 */
   76    106   
    }
         107  +
    /* HttpBindingGenerator.kt:592 */
   77    108   
    if let ::std::option::Option::Some(inner_5) = &input.c {
   78         -
        // Empty vec in header is serialized as an empty string
         109  +
        /* HttpBindingGenerator.kt:638 */// Empty vec in header is serialized as an empty string
   79    110   
        if inner_5.is_empty() {
   80    111   
            builder = builder.header("X-C", "");
   81    112   
        } else {
         113  +
            /* HttpBindingGenerator.kt:646 */
   82    114   
            for inner_6 in inner_5 {
         115  +
                /* HttpBindingGenerator.kt:704 */
   83    116   
                let formatted_7 = ::aws_smithy_http::header::quote_header_value(inner_6.as_str());
         117  +
                /* HttpBindingGenerator.kt:706 */
   84    118   
                let header_value = formatted_7;
   85    119   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   86    120   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
   87    121   
                        "c",
   88    122   
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
   89    123   
                    )
   90    124   
                })?;
   91    125   
                builder = builder.header("X-C", header_value);
         126  +
                /* HttpBindingGenerator.kt:646 */
   92    127   
            }
         128  +
            /* HttpBindingGenerator.kt:638 */
   93    129   
        }
         130  +
        /* HttpBindingGenerator.kt:592 */
   94    131   
    }
         132  +
    /* HttpBindingGenerator.kt:555 */
   95    133   
    Ok(builder)
         134  +
    /* HttpBindingGenerator.kt:542 */
   96    135   
}

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

@@ -1,1 +22,35 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:153 */
    2      3   
pub(crate) fn de_a_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
           6  +
    /* HttpBindingGenerator.kt:160 */
    5      7   
    let headers = header_map.get_all("X-A");
           8  +
    /* HttpBindingGenerator.kt:375 */
    6      9   
    ::aws_smithy_http::header::one_or_none(headers)
          10  +
    /* HttpBindingGenerator.kt:153 */
    7     11   
}
    8     12   
          13  +
/* HttpBindingGenerator.kt:153 */
    9     14   
pub(crate) fn de_b_header(
   10     15   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   11     16   
) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
          17  +
    /* HttpBindingGenerator.kt:160 */
   12     18   
    let headers = header_map.get_all("X-B");
          19  +
    /* HttpBindingGenerator.kt:375 */
   13     20   
    ::aws_smithy_http::header::one_or_none(headers)
          21  +
    /* HttpBindingGenerator.kt:153 */
   14     22   
}
   15     23   
          24  +
/* HttpBindingGenerator.kt:153 */
   16     25   
pub(crate) fn de_c_header(
   17     26   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   18     27   
) -> ::std::result::Result<::std::option::Option<::std::vec::Vec<::std::string::String>>, ::aws_smithy_http::header::ParseError> {
          28  +
    /* HttpBindingGenerator.kt:160 */
   19     29   
    let headers = header_map.get_all("X-C");
          30  +
    /* HttpBindingGenerator.kt:409 */
   20     31   
    let var_1: Vec<::std::string::String> = ::aws_smithy_http::header::read_many_from_str(headers)?;
          32  +
    /* HttpBindingGenerator.kt:430 */
   21     33   
    Ok(if !var_1.is_empty() { Some(var_1) } else { None })
          34  +
    /* HttpBindingGenerator.kt:153 */
   22     35   
}

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

@@ -1,1 +96,135 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ProtocolParserGenerator.kt:99 */
    3      5   
pub fn de_null_and_empty_headers_server_http_error(
    4      6   
    _response_status: u16,
    5      7   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6      8   
    _response_body: &[u8],
    7      9   
) -> std::result::Result<
    8     10   
    crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerOutput,
    9     11   
    crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerError,
   10     12   
> {
          13  +
    /* RustType.kt:516 */
   11     14   
    #[allow(unused_mut)]
          15  +
    /* ProtocolParserGenerator.kt:106 */
   12     16   
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   13     17   
        .map_err(crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerError::unhandled)?;
          18  +
    /* ProtocolParserGenerator.kt:120 */
   14     19   
    let generic = generic_builder.build();
          20  +
    /* ProtocolParserGenerator.kt:185 */
   15     21   
    Err(crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerError::generic(
   16     22   
        generic,
   17     23   
    ))
          24  +
    /* ProtocolParserGenerator.kt:99 */
   18     25   
}
   19     26   
          27  +
/* RustType.kt:516 */
   20     28   
#[allow(clippy::unnecessary_wraps)]
          29  +
/* ProtocolParserGenerator.kt:71 */
   21     30   
pub fn de_null_and_empty_headers_server_http_response(
   22     31   
    _response_status: u16,
   23     32   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   24     33   
    _response_body: &[u8],
   25     34   
) -> std::result::Result<
   26     35   
    crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerOutput,
   27     36   
    crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerError,
   28     37   
> {
          38  +
    /* ProtocolParserGenerator.kt:77 */
   29     39   
    Ok({
          40  +
        /* RustType.kt:516 */
   30     41   
        #[allow(unused_mut)]
          42  +
        /* ProtocolParserGenerator.kt:240 */
   31     43   
        let mut output = crate::operation::null_and_empty_headers_server::builders::NullAndEmptyHeadersServerOutputBuilder::default();
          44  +
        /* ProtocolParserGenerator.kt:267 */
   32     45   
        output = output.set_a(
          46  +
            /* ProtocolParserGenerator.kt:302 */
   33     47   
            crate::protocol_serde::shape_null_and_empty_headers_server_output::de_a_header(_response_headers).map_err(|_| {
   34     48   
                crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerError::unhandled("Failed to parse a from header `X-A")
   35         -
            })?,
          49  +
            })?, /* ProtocolParserGenerator.kt:267 */
   36     50   
        );
          51  +
        /* ProtocolParserGenerator.kt:267 */
   37     52   
        output = output.set_b(
          53  +
            /* ProtocolParserGenerator.kt:302 */
   38     54   
            crate::protocol_serde::shape_null_and_empty_headers_server_output::de_b_header(_response_headers).map_err(|_| {
   39     55   
                crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerError::unhandled("Failed to parse b from header `X-B")
   40         -
            })?,
          56  +
            })?, /* ProtocolParserGenerator.kt:267 */
   41     57   
        );
          58  +
        /* ProtocolParserGenerator.kt:267 */
   42     59   
        output = output.set_c(
          60  +
            /* ProtocolParserGenerator.kt:302 */
   43     61   
            crate::protocol_serde::shape_null_and_empty_headers_server_output::de_c_header(_response_headers).map_err(|_| {
   44     62   
                crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerError::unhandled("Failed to parse c from header `X-C")
   45         -
            })?,
          63  +
            })?, /* ProtocolParserGenerator.kt:267 */
   46     64   
        );
          65  +
        /* ClientBuilderInstantiator.kt:56 */
   47     66   
        output.build()
          67  +
        /* ProtocolParserGenerator.kt:77 */
   48     68   
    })
          69  +
    /* ProtocolParserGenerator.kt:71 */
   49     70   
}
   50     71   
          72  +
/* HttpBindingGenerator.kt:542 */
   51     73   
pub fn ser_null_and_empty_headers_server_headers(
   52     74   
    input: &crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerInput,
   53     75   
    mut builder: ::http::request::Builder,
   54     76   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
          77  +
    /* HttpBindingGenerator.kt:592 */
   55     78   
    if let ::std::option::Option::Some(inner_1) = &input.a {
          79  +
        /* HttpBindingGenerator.kt:704 */
   56     80   
        let formatted_2 = inner_1.as_str();
          81  +
        /* HttpBindingGenerator.kt:706 */
   57     82   
        let header_value = formatted_2;
   58     83   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   59     84   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   60     85   
                "a",
   61     86   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   62     87   
            )
   63     88   
        })?;
   64     89   
        builder = builder.header("X-A", header_value);
          90  +
        /* HttpBindingGenerator.kt:592 */
   65     91   
    }
          92  +
    /* HttpBindingGenerator.kt:592 */
   66     93   
    if let ::std::option::Option::Some(inner_3) = &input.b {
          94  +
        /* HttpBindingGenerator.kt:704 */
   67     95   
        let formatted_4 = inner_3.as_str();
          96  +
        /* HttpBindingGenerator.kt:706 */
   68     97   
        let header_value = formatted_4;
   69     98   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   70     99   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   71    100   
                "b",
   72    101   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   73    102   
            )
   74    103   
        })?;
   75    104   
        builder = builder.header("X-B", header_value);
         105  +
        /* HttpBindingGenerator.kt:592 */
   76    106   
    }
         107  +
    /* HttpBindingGenerator.kt:592 */
   77    108   
    if let ::std::option::Option::Some(inner_5) = &input.c {
   78         -
        // Empty vec in header is serialized as an empty string
         109  +
        /* HttpBindingGenerator.kt:638 */// Empty vec in header is serialized as an empty string
   79    110   
        if inner_5.is_empty() {
   80    111   
            builder = builder.header("X-C", "");
   81    112   
        } else {
         113  +
            /* HttpBindingGenerator.kt:646 */
   82    114   
            for inner_6 in inner_5 {
         115  +
                /* HttpBindingGenerator.kt:704 */
   83    116   
                let formatted_7 = ::aws_smithy_http::header::quote_header_value(inner_6.as_str());
         117  +
                /* HttpBindingGenerator.kt:706 */
   84    118   
                let header_value = formatted_7;
   85    119   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   86    120   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
   87    121   
                        "c",
   88    122   
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
   89    123   
                    )
   90    124   
                })?;
   91    125   
                builder = builder.header("X-C", header_value);
         126  +
                /* HttpBindingGenerator.kt:646 */
   92    127   
            }
         128  +
            /* HttpBindingGenerator.kt:638 */
   93    129   
        }
         130  +
        /* HttpBindingGenerator.kt:592 */
   94    131   
    }
         132  +
    /* HttpBindingGenerator.kt:555 */
   95    133   
    Ok(builder)
         134  +
    /* HttpBindingGenerator.kt:542 */
   96    135   
}

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

@@ -1,1 +22,35 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:153 */
    2      3   
pub(crate) fn de_a_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
           6  +
    /* HttpBindingGenerator.kt:160 */
    5      7   
    let headers = header_map.get_all("X-A");
           8  +
    /* HttpBindingGenerator.kt:375 */
    6      9   
    ::aws_smithy_http::header::one_or_none(headers)
          10  +
    /* HttpBindingGenerator.kt:153 */
    7     11   
}
    8     12   
          13  +
/* HttpBindingGenerator.kt:153 */
    9     14   
pub(crate) fn de_b_header(
   10     15   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   11     16   
) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
          17  +
    /* HttpBindingGenerator.kt:160 */
   12     18   
    let headers = header_map.get_all("X-B");
          19  +
    /* HttpBindingGenerator.kt:375 */
   13     20   
    ::aws_smithy_http::header::one_or_none(headers)
          21  +
    /* HttpBindingGenerator.kt:153 */
   14     22   
}
   15     23   
          24  +
/* HttpBindingGenerator.kt:153 */
   16     25   
pub(crate) fn de_c_header(
   17     26   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   18     27   
) -> ::std::result::Result<::std::option::Option<::std::vec::Vec<::std::string::String>>, ::aws_smithy_http::header::ParseError> {
          28  +
    /* HttpBindingGenerator.kt:160 */
   19     29   
    let headers = header_map.get_all("X-C");
          30  +
    /* HttpBindingGenerator.kt:409 */
   20     31   
    let var_1: Vec<::std::string::String> = ::aws_smithy_http::header::read_many_from_str(headers)?;
          32  +
    /* HttpBindingGenerator.kt:430 */
   21     33   
    Ok(if !var_1.is_empty() { Some(var_1) } else { None })
          34  +
    /* HttpBindingGenerator.kt:153 */
   22     35   
}

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

@@ -1,1 +32,47 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ProtocolParserGenerator.kt:99 */
    3      5   
pub fn de_omits_null_serializes_empty_string_http_error(
    4      6   
    _response_status: u16,
    5      7   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6      8   
    _response_body: &[u8],
    7      9   
) -> std::result::Result<
    8     10   
    crate::operation::omits_null_serializes_empty_string::OmitsNullSerializesEmptyStringOutput,
    9     11   
    crate::operation::omits_null_serializes_empty_string::OmitsNullSerializesEmptyStringError,
   10     12   
> {
          13  +
    /* RustType.kt:516 */
   11     14   
    #[allow(unused_mut)]
          15  +
    /* ProtocolParserGenerator.kt:106 */
   12     16   
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   13     17   
        .map_err(crate::operation::omits_null_serializes_empty_string::OmitsNullSerializesEmptyStringError::unhandled)?;
          18  +
    /* ProtocolParserGenerator.kt:120 */
   14     19   
    let generic = generic_builder.build();
          20  +
    /* ProtocolParserGenerator.kt:185 */
   15     21   
    Err(crate::operation::omits_null_serializes_empty_string::OmitsNullSerializesEmptyStringError::generic(generic))
          22  +
    /* ProtocolParserGenerator.kt:99 */
   16     23   
}
   17     24   
          25  +
/* RustType.kt:516 */
   18     26   
#[allow(clippy::unnecessary_wraps)]
          27  +
/* ProtocolParserGenerator.kt:71 */
   19     28   
pub fn de_omits_null_serializes_empty_string_http_response(
   20     29   
    _response_status: u16,
   21     30   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   22     31   
    _response_body: &[u8],
   23     32   
) -> std::result::Result<
   24     33   
    crate::operation::omits_null_serializes_empty_string::OmitsNullSerializesEmptyStringOutput,
   25     34   
    crate::operation::omits_null_serializes_empty_string::OmitsNullSerializesEmptyStringError,
   26     35   
> {
          36  +
    /* ProtocolParserGenerator.kt:77 */
   27     37   
    Ok({
          38  +
        /* RustType.kt:516 */
   28     39   
        #[allow(unused_mut)]
          40  +
        /* ProtocolParserGenerator.kt:240 */
   29     41   
        let mut output = crate::operation::omits_null_serializes_empty_string::builders::OmitsNullSerializesEmptyStringOutputBuilder::default();
          42  +
        /* ClientBuilderInstantiator.kt:56 */
   30     43   
        output.build()
          44  +
        /* ProtocolParserGenerator.kt:77 */
   31     45   
    })
          46  +
    /* ProtocolParserGenerator.kt:71 */
   32     47   
}

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

@@ -1,1 +34,49 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ProtocolParserGenerator.kt:99 */
    3      5   
pub fn de_omits_serializing_empty_lists_http_error(
    4      6   
    _response_status: u16,
    5      7   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6      8   
    _response_body: &[u8],
    7      9   
) -> std::result::Result<
    8     10   
    crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsOutput,
    9     11   
    crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsError,
   10     12   
> {
          13  +
    /* RustType.kt:516 */
   11     14   
    #[allow(unused_mut)]
          15  +
    /* ProtocolParserGenerator.kt:106 */
   12     16   
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   13     17   
        .map_err(crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsError::unhandled)?;
          18  +
    /* ProtocolParserGenerator.kt:120 */
   14     19   
    let generic = generic_builder.build();
          20  +
    /* ProtocolParserGenerator.kt:185 */
   15     21   
    Err(crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsError::generic(
   16     22   
        generic,
   17     23   
    ))
          24  +
    /* ProtocolParserGenerator.kt:99 */
   18     25   
}
   19     26   
          27  +
/* RustType.kt:516 */
   20     28   
#[allow(clippy::unnecessary_wraps)]
          29  +
/* ProtocolParserGenerator.kt:71 */
   21     30   
pub fn de_omits_serializing_empty_lists_http_response(
   22     31   
    _response_status: u16,
   23     32   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   24     33   
    _response_body: &[u8],
   25     34   
) -> std::result::Result<
   26     35   
    crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsOutput,
   27     36   
    crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsError,
   28     37   
> {
          38  +
    /* ProtocolParserGenerator.kt:77 */
   29     39   
    Ok({
          40  +
        /* RustType.kt:516 */
   30     41   
        #[allow(unused_mut)]
          42  +
        /* ProtocolParserGenerator.kt:240 */
   31     43   
        let mut output = crate::operation::omits_serializing_empty_lists::builders::OmitsSerializingEmptyListsOutputBuilder::default();
          44  +
        /* ClientBuilderInstantiator.kt:56 */
   32     45   
        output.build()
          46  +
        /* ProtocolParserGenerator.kt:77 */
   33     47   
    })
          48  +
    /* ProtocolParserGenerator.kt:71 */
   34     49   
}

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

@@ -1,1 +215,399 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ProtocolParserGenerator.kt:99 */
    3      5   
pub fn de_operation_with_defaults_http_error(
    4      6   
    _response_status: u16,
    5      7   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6      8   
    _response_body: &[u8],
    7      9   
) -> std::result::Result<
    8     10   
    crate::operation::operation_with_defaults::OperationWithDefaultsOutput,
    9     11   
    crate::operation::operation_with_defaults::OperationWithDefaultsError,
   10     12   
> {
          13  +
    /* RustType.kt:516 */
   11     14   
    #[allow(unused_mut)]
          15  +
    /* ProtocolParserGenerator.kt:106 */
   12     16   
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   13     17   
        .map_err(crate::operation::operation_with_defaults::OperationWithDefaultsError::unhandled)?;
          18  +
    /* ProtocolParserGenerator.kt:120 */
   14     19   
    let generic = generic_builder.build();
          20  +
    /* ProtocolParserGenerator.kt:185 */
   15     21   
    Err(crate::operation::operation_with_defaults::OperationWithDefaultsError::generic(generic))
          22  +
    /* ProtocolParserGenerator.kt:99 */
   16     23   
}
   17     24   
          25  +
/* RustType.kt:516 */
   18     26   
#[allow(clippy::unnecessary_wraps)]
          27  +
/* ProtocolParserGenerator.kt:71 */
   19     28   
pub fn de_operation_with_defaults_http_response(
   20     29   
    _response_status: u16,
   21     30   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   22     31   
    _response_body: &[u8],
   23     32   
) -> std::result::Result<
   24     33   
    crate::operation::operation_with_defaults::OperationWithDefaultsOutput,
   25     34   
    crate::operation::operation_with_defaults::OperationWithDefaultsError,
   26     35   
> {
          36  +
    /* ProtocolParserGenerator.kt:77 */
   27     37   
    Ok({
          38  +
        /* RustType.kt:516 */
   28     39   
        #[allow(unused_mut)]
          40  +
        /* ProtocolParserGenerator.kt:240 */
   29     41   
        let mut output = crate::operation::operation_with_defaults::builders::OperationWithDefaultsOutputBuilder::default();
          42  +
        /* ProtocolParserGenerator.kt:247 */
   30     43   
        output = crate::protocol_serde::shape_operation_with_defaults::de_operation_with_defaults(_response_body, output)
   31     44   
            .map_err(crate::operation::operation_with_defaults::OperationWithDefaultsError::unhandled)?;
          45  +
        /* ClientBuilderInstantiator.kt:56 */
   32     46   
        output.build()
          47  +
        /* ProtocolParserGenerator.kt:77 */
   33     48   
    })
          49  +
    /* ProtocolParserGenerator.kt:71 */
   34     50   
}
   35     51   
          52  +
/* JsonSerializerGenerator.kt:287 */
   36     53   
pub fn ser_operation_with_defaults_input(
   37     54   
    input: &crate::operation::operation_with_defaults::OperationWithDefaultsInput,
   38     55   
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
          56  +
    /* JsonSerializerGenerator.kt:291 */
   39     57   
    let mut out = String::new();
          58  +
    /* JsonSerializerGenerator.kt:292 */
   40     59   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
          60  +
    /* JsonSerializerGenerator.kt:375 */
   41     61   
    crate::protocol_serde::shape_operation_with_defaults_input::ser_operation_with_defaults_input_input(&mut object, input)?;
          62  +
    /* JsonSerializerGenerator.kt:295 */
   42     63   
    object.finish();
          64  +
    /* JsonSerializerGenerator.kt:296 */
   43     65   
    Ok(::aws_smithy_types::body::SdkBody::from(out))
          66  +
    /* JsonSerializerGenerator.kt:287 */
   44     67   
}
   45     68   
          69  +
/* JsonParserGenerator.kt:148 */
   46     70   
pub(crate) fn de_operation_with_defaults(
   47     71   
    value: &[u8],
   48     72   
    mut builder: crate::operation::operation_with_defaults::builders::OperationWithDefaultsOutputBuilder,
   49     73   
) -> ::std::result::Result<
   50     74   
    crate::operation::operation_with_defaults::builders::OperationWithDefaultsOutputBuilder,
   51     75   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   52     76   
> {
          77  +
    /* JsonParserGenerator.kt:153 */
   53     78   
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
   54     79   
    let tokens = &mut tokens_owned;
   55     80   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
          81  +
    /* JsonParserGenerator.kt:684 */
   56     82   
    loop {
          83  +
        /* JsonParserGenerator.kt:685 */
   57     84   
        match tokens.next().transpose()? {
   58         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   59         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   60         -
                "defaultBlob" => {
   61         -
                    builder = builder.set_default_blob(::aws_smithy_json::deserialize::token::expect_blob_or_null(tokens.next())?);
          85  +
            /* JsonParserGenerator.kt:686 */ Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          86  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          87  +
                /* JsonParserGenerator.kt:260 */
          88  +
                match key.to_unescaped()?.as_ref() {
          89  +
                    /* JsonParserGenerator.kt:262 */
          90  +
                    "defaultBlob" => {
          91  +
                        /* JsonParserGenerator.kt:265 */
          92  +
                        builder = builder.set_default_blob(
          93  +
                            /* JsonParserGenerator.kt:326 */
          94  +
                            ::aws_smithy_json::deserialize::token::expect_blob_or_null(tokens.next())?, /* JsonParserGenerator.kt:265 */
          95  +
                        );
          96  +
                        /* JsonParserGenerator.kt:262 */
          97  +
                    }
          98  +
                    /* JsonParserGenerator.kt:262 */
          99  +
                    "defaultBoolean" => {
         100  +
                        /* JsonParserGenerator.kt:265 */
         101  +
                        builder = builder.set_default_boolean(
         102  +
                            /* JsonParserGenerator.kt:298 */
         103  +
                            ::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?, /* JsonParserGenerator.kt:265 */
         104  +
                        );
         105  +
                        /* JsonParserGenerator.kt:262 */
         106  +
                    }
         107  +
                    /* JsonParserGenerator.kt:262 */
         108  +
                    "defaultByte" => {
         109  +
                        /* JsonParserGenerator.kt:265 */
         110  +
                        builder = builder.set_default_byte(
         111  +
                            /* JsonParserGenerator.kt:365 */
         112  +
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
         113  +
                                .map(i8::try_from)
         114  +
                                .transpose()?, /* JsonParserGenerator.kt:265 */
         115  +
                        );
         116  +
                        /* JsonParserGenerator.kt:262 */
         117  +
                    }
         118  +
                    /* JsonParserGenerator.kt:262 */
         119  +
                    "defaultDocumentBoolean" => {
         120  +
                        /* JsonParserGenerator.kt:265 */
         121  +
                        builder = builder.set_default_document_boolean(
         122  +
                            /* JsonParserGenerator.kt:319 */
         123  +
                            Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?), /* JsonParserGenerator.kt:265 */
         124  +
                        );
         125  +
                        /* JsonParserGenerator.kt:262 */
         126  +
                    }
         127  +
                    /* JsonParserGenerator.kt:262 */
         128  +
                    "defaultDocumentList" => {
         129  +
                        /* JsonParserGenerator.kt:265 */
         130  +
                        builder = builder.set_default_document_list(
         131  +
                            /* JsonParserGenerator.kt:319 */
         132  +
                            Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?), /* JsonParserGenerator.kt:265 */
         133  +
                        );
         134  +
                        /* JsonParserGenerator.kt:262 */
         135  +
                    }
         136  +
                    /* JsonParserGenerator.kt:262 */
         137  +
                    "defaultDocumentMap" => {
         138  +
                        /* JsonParserGenerator.kt:265 */
         139  +
                        builder = builder.set_default_document_map(
         140  +
                            /* JsonParserGenerator.kt:319 */
         141  +
                            Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?), /* JsonParserGenerator.kt:265 */
         142  +
                        );
         143  +
                        /* JsonParserGenerator.kt:262 */
         144  +
                    }
         145  +
                    /* JsonParserGenerator.kt:262 */
         146  +
                    "defaultDocumentString" => {
         147  +
                        /* JsonParserGenerator.kt:265 */
         148  +
                        builder = builder.set_default_document_string(
         149  +
                            /* JsonParserGenerator.kt:319 */
         150  +
                            Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?), /* JsonParserGenerator.kt:265 */
         151  +
                        );
         152  +
                        /* JsonParserGenerator.kt:262 */
         153  +
                    }
         154  +
                    /* JsonParserGenerator.kt:262 */
         155  +
                    "defaultDouble" => {
         156  +
                        /* JsonParserGenerator.kt:265 */
         157  +
                        builder = builder.set_default_double(
         158  +
                            /* JsonParserGenerator.kt:363 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f64_lossy())
         159  +
                        /* JsonParserGenerator.kt:265 */);
         160  +
                        /* JsonParserGenerator.kt:262 */
         161  +
                    }
         162  +
                    /* JsonParserGenerator.kt:262 */
         163  +
                    "defaultEnum" => {
         164  +
                        /* JsonParserGenerator.kt:265 */
         165  +
                        builder = builder.set_default_enum(
         166  +
                            /* JsonParserGenerator.kt:354 */
         167  +
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
         168  +
                                .map(|s|
         169  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         170  +
                                    /* JsonParserGenerator.kt:345 */crate::types::TestEnum::from(u.as_ref())
         171  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         172  +
                                .transpose()?, /* JsonParserGenerator.kt:265 */
         173  +
                        );
         174  +
                        /* JsonParserGenerator.kt:262 */
         175  +
                    }
         176  +
                    /* JsonParserGenerator.kt:262 */
         177  +
                    "defaultFloat" => {
         178  +
                        /* JsonParserGenerator.kt:265 */
         179  +
                        builder = builder.set_default_float(
         180  +
                            /* JsonParserGenerator.kt:361 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f32_lossy())
         181  +
                        /* JsonParserGenerator.kt:265 */);
         182  +
                        /* JsonParserGenerator.kt:262 */
         183  +
                    }
         184  +
                    /* JsonParserGenerator.kt:262 */
         185  +
                    "defaultIntEnum" => {
         186  +
                        /* JsonParserGenerator.kt:265 */
         187  +
                        builder = builder.set_default_int_enum(
         188  +
                            /* JsonParserGenerator.kt:365 */
         189  +
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
         190  +
                                .map(i32::try_from)
         191  +
                                .transpose()?, /* JsonParserGenerator.kt:265 */
         192  +
                        );
         193  +
                        /* JsonParserGenerator.kt:262 */
         194  +
                    }
         195  +
                    /* JsonParserGenerator.kt:262 */
         196  +
                    "defaultInteger" => {
         197  +
                        /* JsonParserGenerator.kt:265 */
         198  +
                        builder = builder.set_default_integer(
         199  +
                            /* JsonParserGenerator.kt:365 */
         200  +
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
         201  +
                                .map(i32::try_from)
         202  +
                                .transpose()?, /* JsonParserGenerator.kt:265 */
         203  +
                        );
         204  +
                        /* JsonParserGenerator.kt:262 */
         205  +
                    }
         206  +
                    /* JsonParserGenerator.kt:262 */
         207  +
                    "defaultList" => {
         208  +
                        /* JsonParserGenerator.kt:265 */
         209  +
                        builder = builder.set_default_list(
         210  +
                            /* JsonParserGenerator.kt:451 */
         211  +
                            crate::protocol_serde::shape_test_string_list::de_test_string_list(tokens)?, /* JsonParserGenerator.kt:265 */
         212  +
                        );
         213  +
                        /* JsonParserGenerator.kt:262 */
         214  +
                    }
         215  +
                    /* JsonParserGenerator.kt:262 */
         216  +
                    "defaultLong" => {
         217  +
                        /* JsonParserGenerator.kt:265 */
         218  +
                        builder = builder.set_default_long(
         219  +
                            /* JsonParserGenerator.kt:365 */
         220  +
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
         221  +
                                .map(i64::try_from)
         222  +
                                .transpose()?, /* JsonParserGenerator.kt:265 */
         223  +
                        );
         224  +
                        /* JsonParserGenerator.kt:262 */
         225  +
                    }
         226  +
                    /* JsonParserGenerator.kt:262 */
         227  +
                    "defaultMap" => {
         228  +
                        /* JsonParserGenerator.kt:265 */
         229  +
                        builder = builder.set_default_map(
         230  +
                            /* JsonParserGenerator.kt:509 */
         231  +
                            crate::protocol_serde::shape_test_string_map::de_test_string_map(tokens)?, /* JsonParserGenerator.kt:265 */
         232  +
                        );
         233  +
                        /* JsonParserGenerator.kt:262 */
         234  +
                    }
         235  +
                    /* JsonParserGenerator.kt:262 */
         236  +
                    "defaultNullDocument" => {
         237  +
                        /* JsonParserGenerator.kt:265 */
         238  +
                        builder = builder.set_default_null_document(
         239  +
                            /* JsonParserGenerator.kt:319 */
         240  +
                            Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?), /* JsonParserGenerator.kt:265 */
         241  +
                        );
         242  +
                        /* JsonParserGenerator.kt:262 */
         243  +
                    }
         244  +
                    /* JsonParserGenerator.kt:262 */
         245  +
                    "defaultShort" => {
         246  +
                        /* JsonParserGenerator.kt:265 */
         247  +
                        builder = builder.set_default_short(
         248  +
                            /* JsonParserGenerator.kt:365 */
         249  +
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
         250  +
                                .map(i16::try_from)
         251  +
                                .transpose()?, /* JsonParserGenerator.kt:265 */
         252  +
                        );
         253  +
                        /* JsonParserGenerator.kt:262 */
         254  +
                    }
         255  +
                    /* JsonParserGenerator.kt:262 */
         256  +
                    "defaultString" => {
         257  +
                        /* JsonParserGenerator.kt:265 */
         258  +
                        builder = builder.set_default_string(
         259  +
                            /* JsonParserGenerator.kt:354 */
         260  +
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
         261  +
                                .map(|s|
         262  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         263  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         264  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         265  +
                                .transpose()?, /* JsonParserGenerator.kt:265 */
         266  +
                        );
         267  +
                        /* JsonParserGenerator.kt:262 */
         268  +
                    }
         269  +
                    /* JsonParserGenerator.kt:262 */
         270  +
                    "defaultTimestamp" => {
         271  +
                        /* JsonParserGenerator.kt:265 */
         272  +
                        builder = builder.set_default_timestamp(
         273  +
                            /* JsonParserGenerator.kt:384 */
         274  +
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
         275  +
                                tokens.next(),
         276  +
                                ::aws_smithy_types::date_time::Format::EpochSeconds,
         277  +
                            )?, /* JsonParserGenerator.kt:265 */
         278  +
                        );
         279  +
                        /* JsonParserGenerator.kt:262 */
         280  +
                    }
         281  +
                    /* JsonParserGenerator.kt:262 */
         282  +
                    "emptyBlob" => {
         283  +
                        /* JsonParserGenerator.kt:265 */
         284  +
                        builder = builder.set_empty_blob(
         285  +
                            /* JsonParserGenerator.kt:326 */
         286  +
                            ::aws_smithy_json::deserialize::token::expect_blob_or_null(tokens.next())?, /* JsonParserGenerator.kt:265 */
         287  +
                        );
         288  +
                        /* JsonParserGenerator.kt:262 */
         289  +
                    }
         290  +
                    /* JsonParserGenerator.kt:262 */
         291  +
                    "emptyString" => {
         292  +
                        /* JsonParserGenerator.kt:265 */
         293  +
                        builder = builder.set_empty_string(
         294  +
                            /* JsonParserGenerator.kt:354 */
         295  +
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
         296  +
                                .map(|s|
         297  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         298  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         299  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         300  +
                                .transpose()?, /* JsonParserGenerator.kt:265 */
         301  +
                        );
         302  +
                        /* JsonParserGenerator.kt:262 */
         303  +
                    }
         304  +
                    /* JsonParserGenerator.kt:262 */
         305  +
                    "falseBoolean" => {
         306  +
                        /* JsonParserGenerator.kt:265 */
         307  +
                        builder = builder.set_false_boolean(
         308  +
                            /* JsonParserGenerator.kt:298 */
         309  +
                            ::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?, /* JsonParserGenerator.kt:265 */
         310  +
                        );
         311  +
                        /* JsonParserGenerator.kt:262 */
         312  +
                    }
         313  +
                    /* JsonParserGenerator.kt:262 */
         314  +
                    "zeroByte" => {
         315  +
                        /* JsonParserGenerator.kt:265 */
         316  +
                        builder = builder.set_zero_byte(
         317  +
                            /* JsonParserGenerator.kt:365 */
         318  +
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
         319  +
                                .map(i8::try_from)
         320  +
                                .transpose()?, /* JsonParserGenerator.kt:265 */
         321  +
                        );
         322  +
                        /* JsonParserGenerator.kt:262 */
         323  +
                    }
         324  +
                    /* JsonParserGenerator.kt:262 */
         325  +
                    "zeroDouble" => {
         326  +
                        /* JsonParserGenerator.kt:265 */
         327  +
                        builder = builder.set_zero_double(
         328  +
                            /* JsonParserGenerator.kt:363 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f64_lossy())
         329  +
                        /* JsonParserGenerator.kt:265 */);
         330  +
                        /* JsonParserGenerator.kt:262 */
         331  +
                    }
         332  +
                    /* JsonParserGenerator.kt:262 */
         333  +
                    "zeroFloat" => {
         334  +
                        /* JsonParserGenerator.kt:265 */
         335  +
                        builder = builder.set_zero_float(
         336  +
                            /* JsonParserGenerator.kt:361 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f32_lossy())
         337  +
                        /* JsonParserGenerator.kt:265 */);
         338  +
                        /* JsonParserGenerator.kt:262 */
         339  +
                    }
         340  +
                    /* JsonParserGenerator.kt:262 */
         341  +
                    "zeroInteger" => {
         342  +
                        /* JsonParserGenerator.kt:265 */
         343  +
                        builder = builder.set_zero_integer(
         344  +
                            /* JsonParserGenerator.kt:365 */
         345  +
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
         346  +
                                .map(i32::try_from)
         347  +
                                .transpose()?, /* JsonParserGenerator.kt:265 */
         348  +
                        );
         349  +
                        /* JsonParserGenerator.kt:262 */
         350  +
                    }
         351  +
                    /* JsonParserGenerator.kt:262 */
         352  +
                    "zeroLong" => {
         353  +
                        /* JsonParserGenerator.kt:265 */
         354  +
                        builder = builder.set_zero_long(
         355  +
                            /* JsonParserGenerator.kt:365 */
         356  +
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
         357  +
                                .map(i64::try_from)
         358  +
                                .transpose()?, /* JsonParserGenerator.kt:265 */
         359  +
                        );
         360  +
                        /* JsonParserGenerator.kt:262 */
         361  +
                    }
         362  +
                    /* JsonParserGenerator.kt:262 */
         363  +
                    "zeroShort" => {
         364  +
                        /* JsonParserGenerator.kt:265 */
         365  +
                        builder = builder.set_zero_short(
         366  +
                            /* JsonParserGenerator.kt:365 */
         367  +
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
         368  +
                                .map(i16::try_from)
         369  +
                                .transpose()?, /* JsonParserGenerator.kt:265 */
         370  +
                        );
         371  +
                        /* JsonParserGenerator.kt:262 */
         372  +
                    }
         373  +
                    /* JsonParserGenerator.kt:290 */
         374  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   62    375   
                }
   63         -
                "defaultBoolean" => {
   64         -
                    builder = builder.set_default_boolean(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
   65         -
                }
   66         -
                "defaultByte" => {
   67         -
                    builder = builder.set_default_byte(
   68         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   69         -
                            .map(i8::try_from)
   70         -
                            .transpose()?,
   71         -
                    );
   72         -
                }
   73         -
                "defaultDocumentBoolean" => {
   74         -
                    builder = builder.set_default_document_boolean(Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?));
   75         -
                }
   76         -
                "defaultDocumentList" => {
   77         -
                    builder = builder.set_default_document_list(Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?));
   78         -
                }
   79         -
                "defaultDocumentMap" => {
   80         -
                    builder = builder.set_default_document_map(Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?));
   81         -
                }
   82         -
                "defaultDocumentString" => {
   83         -
                    builder = builder.set_default_document_string(Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?));
   84         -
                }
   85         -
                "defaultDouble" => {
   86         -
                    builder = builder
   87         -
                        .set_default_double(::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f64_lossy()));
   88         -
                }
   89         -
                "defaultEnum" => {
   90         -
                    builder = builder.set_default_enum(
   91         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   92         -
                            .map(|s| s.to_unescaped().map(|u| crate::types::TestEnum::from(u.as_ref())))
   93         -
                            .transpose()?,
   94         -
                    );
   95         -
                }
   96         -
                "defaultFloat" => {
   97         -
                    builder = builder
   98         -
                        .set_default_float(::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f32_lossy()));
   99         -
                }
  100         -
                "defaultIntEnum" => {
  101         -
                    builder = builder.set_default_int_enum(
  102         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  103         -
                            .map(i32::try_from)
  104         -
                            .transpose()?,
  105         -
                    );
  106         -
                }
  107         -
                "defaultInteger" => {
  108         -
                    builder = builder.set_default_integer(
  109         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  110         -
                            .map(i32::try_from)
  111         -
                            .transpose()?,
  112         -
                    );
  113         -
                }
  114         -
                "defaultList" => {
  115         -
                    builder = builder.set_default_list(crate::protocol_serde::shape_test_string_list::de_test_string_list(tokens)?);
  116         -
                }
  117         -
                "defaultLong" => {
  118         -
                    builder = builder.set_default_long(
  119         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  120         -
                            .map(i64::try_from)
  121         -
                            .transpose()?,
  122         -
                    );
  123         -
                }
  124         -
                "defaultMap" => {
  125         -
                    builder = builder.set_default_map(crate::protocol_serde::shape_test_string_map::de_test_string_map(tokens)?);
  126         -
                }
  127         -
                "defaultNullDocument" => {
  128         -
                    builder = builder.set_default_null_document(Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?));
  129         -
                }
  130         -
                "defaultShort" => {
  131         -
                    builder = builder.set_default_short(
  132         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  133         -
                            .map(i16::try_from)
  134         -
                            .transpose()?,
  135         -
                    );
  136         -
                }
  137         -
                "defaultString" => {
  138         -
                    builder = builder.set_default_string(
  139         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
  140         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  141         -
                            .transpose()?,
  142         -
                    );
  143         -
                }
  144         -
                "defaultTimestamp" => {
  145         -
                    builder = builder.set_default_timestamp(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
  146         -
                        tokens.next(),
  147         -
                        ::aws_smithy_types::date_time::Format::EpochSeconds,
  148         -
                    )?);
  149         -
                }
  150         -
                "emptyBlob" => {
  151         -
                    builder = builder.set_empty_blob(::aws_smithy_json::deserialize::token::expect_blob_or_null(tokens.next())?);
  152         -
                }
  153         -
                "emptyString" => {
  154         -
                    builder = builder.set_empty_string(
  155         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
  156         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  157         -
                            .transpose()?,
  158         -
                    );
  159         -
                }
  160         -
                "falseBoolean" => {
  161         -
                    builder = builder.set_false_boolean(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
  162         -
                }
  163         -
                "zeroByte" => {
  164         -
                    builder = builder.set_zero_byte(
  165         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  166         -
                            .map(i8::try_from)
  167         -
                            .transpose()?,
  168         -
                    );
  169         -
                }
  170         -
                "zeroDouble" => {
  171         -
                    builder = builder
  172         -
                        .set_zero_double(::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f64_lossy()));
  173         -
                }
  174         -
                "zeroFloat" => {
  175         -
                    builder = builder
  176         -
                        .set_zero_float(::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f32_lossy()));
  177         -
                }
  178         -
                "zeroInteger" => {
  179         -
                    builder = builder.set_zero_integer(
  180         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  181         -
                            .map(i32::try_from)
  182         -
                            .transpose()?,
  183         -
                    );
  184         -
                }
  185         -
                "zeroLong" => {
  186         -
                    builder = builder.set_zero_long(
  187         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  188         -
                            .map(i64::try_from)
  189         -
                            .transpose()?,
  190         -
                    );
  191         -
                }
  192         -
                "zeroShort" => {
  193         -
                    builder = builder.set_zero_short(
  194         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  195         -
                            .map(i16::try_from)
  196         -
                            .transpose()?,
  197         -
                    );
  198         -
                }
  199         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
  200         -
            },
         376  +
                /* JsonParserGenerator.kt:686 */
         377  +
            }
         378  +
            /* JsonParserGenerator.kt:695 */
  201    379   
            other => {
  202    380   
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  203    381   
                    "expected object key or end object, found: {:?}",
  204    382   
                    other
  205    383   
                )))
  206         -
            }
         384  +
            } /* JsonParserGenerator.kt:685 */
  207    385   
        }
         386  +
        /* JsonParserGenerator.kt:684 */
  208    387   
    }
         388  +
    /* JsonParserGenerator.kt:250 */
  209    389   
    if tokens.next().is_some() {
         390  +
        /* JsonParserGenerator.kt:251 */
  210    391   
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
  211    392   
            "found more JSON tokens after completing parsing",
  212    393   
        ));
         394  +
        /* JsonParserGenerator.kt:250 */
  213    395   
    }
         396  +
    /* JsonParserGenerator.kt:163 */
  214    397   
    Ok(builder)
         398  +
    /* JsonParserGenerator.kt:148 */
  215    399   
}

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

@@ -1,1 +28,49 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:358 */
    2      3   
pub fn ser_operation_with_defaults_input_input(
    3      4   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4      5   
    input: &crate::operation::operation_with_defaults::OperationWithDefaultsInput,
    5      6   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           7  +
    /* JsonSerializerGenerator.kt:382 */
    6      8   
    if let Some(var_1) = &input.client_optional_defaults {
           9  +
        /* JsonSerializerGenerator.kt:495 */
    7     10   
        #[allow(unused_mut)]
          11  +
        /* JsonSerializerGenerator.kt:496 */
    8     12   
        let mut object_2 = object.key("clientOptionalDefaults").start_object();
          13  +
        /* JsonSerializerGenerator.kt:375 */
    9     14   
        crate::protocol_serde::shape_client_optional_defaults::ser_client_optional_defaults(&mut object_2, var_1)?;
          15  +
        /* JsonSerializerGenerator.kt:515 */
   10     16   
        object_2.finish();
          17  +
        /* JsonSerializerGenerator.kt:382 */
   11     18   
    }
          19  +
    /* JsonSerializerGenerator.kt:382 */
   12     20   
    if let Some(var_3) = &input.defaults {
          21  +
        /* JsonSerializerGenerator.kt:495 */
   13     22   
        #[allow(unused_mut)]
          23  +
        /* JsonSerializerGenerator.kt:496 */
   14     24   
        let mut object_4 = object.key("defaults").start_object();
          25  +
        /* JsonSerializerGenerator.kt:375 */
   15     26   
        crate::protocol_serde::shape_defaults::ser_defaults(&mut object_4, var_3)?;
          27  +
        /* JsonSerializerGenerator.kt:515 */
   16     28   
        object_4.finish();
          29  +
        /* JsonSerializerGenerator.kt:382 */
   17     30   
    }
          31  +
    /* JsonSerializerGenerator.kt:382 */
   18     32   
    if let Some(var_5) = &input.other_top_level_default {
          33  +
        /* JsonSerializerGenerator.kt:432 */
   19     34   
        object.key("otherTopLevelDefault").number(
   20     35   
            #[allow(clippy::useless_conversion)]
   21     36   
            ::aws_smithy_types::Number::NegInt((*var_5).into()),
   22     37   
        );
          38  +
        /* JsonSerializerGenerator.kt:382 */
   23     39   
    }
          40  +
    /* JsonSerializerGenerator.kt:382 */
   24     41   
    if let Some(var_6) = &input.top_level_default {
          42  +
        /* JsonSerializerGenerator.kt:423 */
   25     43   
        object.key("topLevelDefault").string(var_6.as_str());
          44  +
        /* JsonSerializerGenerator.kt:382 */
   26     45   
    }
          46  +
    /* JsonSerializerGenerator.kt:372 */
   27     47   
    Ok(())
          48  +
    /* JsonSerializerGenerator.kt:358 */
   28     49   
}

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

@@ -1,1 +87,144 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ProtocolParserGenerator.kt:99 */
    3      5   
pub fn de_operation_with_nested_structure_http_error(
    4      6   
    _response_status: u16,
    5      7   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6      8   
    _response_body: &[u8],
    7      9   
) -> std::result::Result<
    8     10   
    crate::operation::operation_with_nested_structure::OperationWithNestedStructureOutput,
    9     11   
    crate::operation::operation_with_nested_structure::OperationWithNestedStructureError,
   10     12   
> {
          13  +
    /* RustType.kt:516 */
   11     14   
    #[allow(unused_mut)]
          15  +
    /* ProtocolParserGenerator.kt:106 */
   12     16   
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   13     17   
        .map_err(crate::operation::operation_with_nested_structure::OperationWithNestedStructureError::unhandled)?;
          18  +
    /* ProtocolParserGenerator.kt:120 */
   14     19   
    let generic = generic_builder.build();
          20  +
    /* ProtocolParserGenerator.kt:185 */
   15     21   
    Err(crate::operation::operation_with_nested_structure::OperationWithNestedStructureError::generic(generic))
          22  +
    /* ProtocolParserGenerator.kt:99 */
   16     23   
}
   17     24   
          25  +
/* RustType.kt:516 */
   18     26   
#[allow(clippy::unnecessary_wraps)]
          27  +
/* ProtocolParserGenerator.kt:71 */
   19     28   
pub fn de_operation_with_nested_structure_http_response(
   20     29   
    _response_status: u16,
   21     30   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   22     31   
    _response_body: &[u8],
   23     32   
) -> std::result::Result<
   24     33   
    crate::operation::operation_with_nested_structure::OperationWithNestedStructureOutput,
   25     34   
    crate::operation::operation_with_nested_structure::OperationWithNestedStructureError,
   26     35   
> {
          36  +
    /* ProtocolParserGenerator.kt:77 */
   27     37   
    Ok({
          38  +
        /* RustType.kt:516 */
   28     39   
        #[allow(unused_mut)]
          40  +
        /* ProtocolParserGenerator.kt:240 */
   29     41   
        let mut output = crate::operation::operation_with_nested_structure::builders::OperationWithNestedStructureOutputBuilder::default();
          42  +
        /* ProtocolParserGenerator.kt:247 */
   30     43   
        output = crate::protocol_serde::shape_operation_with_nested_structure::de_operation_with_nested_structure(_response_body, output)
   31     44   
            .map_err(crate::operation::operation_with_nested_structure::OperationWithNestedStructureError::unhandled)?;
          45  +
        /* ClientBuilderInstantiator.kt:46 */
   32     46   
        crate::serde_util::operation_with_nested_structure_output_output_correct_errors(output)
   33     47   
            .build()
   34     48   
            .map_err(crate::operation::operation_with_nested_structure::OperationWithNestedStructureError::unhandled)?
          49  +
        /* ProtocolParserGenerator.kt:77 */
   35     50   
    })
          51  +
    /* ProtocolParserGenerator.kt:71 */
   36     52   
}
   37     53   
          54  +
/* JsonSerializerGenerator.kt:287 */
   38     55   
pub fn ser_operation_with_nested_structure_input(
   39     56   
    input: &crate::operation::operation_with_nested_structure::OperationWithNestedStructureInput,
   40     57   
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
          58  +
    /* JsonSerializerGenerator.kt:291 */
   41     59   
    let mut out = String::new();
          60  +
    /* JsonSerializerGenerator.kt:292 */
   42     61   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
          62  +
    /* JsonSerializerGenerator.kt:375 */
   43     63   
    crate::protocol_serde::shape_operation_with_nested_structure_input::ser_operation_with_nested_structure_input_input(&mut object, input)?;
          64  +
    /* JsonSerializerGenerator.kt:295 */
   44     65   
    object.finish();
          66  +
    /* JsonSerializerGenerator.kt:296 */
   45     67   
    Ok(::aws_smithy_types::body::SdkBody::from(out))
          68  +
    /* JsonSerializerGenerator.kt:287 */
   46     69   
}
   47     70   
          71  +
/* JsonParserGenerator.kt:148 */
   48     72   
pub(crate) fn de_operation_with_nested_structure(
   49     73   
    value: &[u8],
   50     74   
    mut builder: crate::operation::operation_with_nested_structure::builders::OperationWithNestedStructureOutputBuilder,
   51     75   
) -> ::std::result::Result<
   52     76   
    crate::operation::operation_with_nested_structure::builders::OperationWithNestedStructureOutputBuilder,
   53     77   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   54     78   
> {
          79  +
    /* JsonParserGenerator.kt:153 */
   55     80   
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
   56     81   
    let tokens = &mut tokens_owned;
   57     82   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
          83  +
    /* JsonParserGenerator.kt:684 */
   58     84   
    loop {
          85  +
        /* JsonParserGenerator.kt:685 */
   59     86   
        match tokens.next().transpose()? {
   60         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   61         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   62         -
                "dialog" => {
   63         -
                    builder = builder.set_dialog(crate::protocol_serde::shape_dialog::de_dialog(tokens)?);
          87  +
            /* JsonParserGenerator.kt:686 */ Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          88  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          89  +
                /* JsonParserGenerator.kt:260 */
          90  +
                match key.to_unescaped()?.as_ref() {
          91  +
                    /* JsonParserGenerator.kt:262 */
          92  +
                    "dialog" => {
          93  +
                        /* JsonParserGenerator.kt:265 */
          94  +
                        builder = builder.set_dialog(
          95  +
                            /* JsonParserGenerator.kt:544 */
          96  +
                            crate::protocol_serde::shape_dialog::de_dialog(tokens)?, /* JsonParserGenerator.kt:265 */
          97  +
                        );
          98  +
                        /* JsonParserGenerator.kt:262 */
          99  +
                    }
         100  +
                    /* JsonParserGenerator.kt:262 */
         101  +
                    "dialogList" => {
         102  +
                        /* JsonParserGenerator.kt:265 */
         103  +
                        builder = builder.set_dialog_list(
         104  +
                            /* JsonParserGenerator.kt:451 */
         105  +
                            crate::protocol_serde::shape_dialog_list::de_dialog_list(tokens)?, /* JsonParserGenerator.kt:265 */
         106  +
                        );
         107  +
                        /* JsonParserGenerator.kt:262 */
         108  +
                    }
         109  +
                    /* JsonParserGenerator.kt:262 */
         110  +
                    "dialogMap" => {
         111  +
                        /* JsonParserGenerator.kt:265 */
         112  +
                        builder = builder.set_dialog_map(
         113  +
                            /* JsonParserGenerator.kt:509 */
         114  +
                            crate::protocol_serde::shape_dialog_map::de_dialog_map(tokens)?, /* JsonParserGenerator.kt:265 */
         115  +
                        );
         116  +
                        /* JsonParserGenerator.kt:262 */
         117  +
                    }
         118  +
                    /* JsonParserGenerator.kt:290 */
         119  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   64    120   
                }
   65         -
                "dialogList" => {
   66         -
                    builder = builder.set_dialog_list(crate::protocol_serde::shape_dialog_list::de_dialog_list(tokens)?);
   67         -
                }
   68         -
                "dialogMap" => {
   69         -
                    builder = builder.set_dialog_map(crate::protocol_serde::shape_dialog_map::de_dialog_map(tokens)?);
   70         -
                }
   71         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   72         -
            },
         121  +
                /* JsonParserGenerator.kt:686 */
         122  +
            }
         123  +
            /* JsonParserGenerator.kt:695 */
   73    124   
            other => {
   74    125   
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   75    126   
                    "expected object key or end object, found: {:?}",
   76    127   
                    other
   77    128   
                )))
   78         -
            }
         129  +
            } /* JsonParserGenerator.kt:685 */
   79    130   
        }
         131  +
        /* JsonParserGenerator.kt:684 */
   80    132   
    }
         133  +
    /* JsonParserGenerator.kt:250 */
   81    134   
    if tokens.next().is_some() {
         135  +
        /* JsonParserGenerator.kt:251 */
   82    136   
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   83    137   
            "found more JSON tokens after completing parsing",
   84    138   
        ));
         139  +
        /* JsonParserGenerator.kt:250 */
   85    140   
    }
         141  +
    /* JsonParserGenerator.kt:163 */
   86    142   
    Ok(builder)
         143  +
    /* JsonParserGenerator.kt:148 */
   87    144   
}

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

@@ -1,1 +13,22 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:358 */
    2      3   
pub fn ser_operation_with_nested_structure_input_input(
    3      4   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4      5   
    input: &crate::operation::operation_with_nested_structure::OperationWithNestedStructureInput,
    5      6   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           7  +
    /* JsonSerializerGenerator.kt:382 */
    6      8   
    if let Some(var_1) = &input.top_level {
           9  +
        /* JsonSerializerGenerator.kt:495 */
    7     10   
        #[allow(unused_mut)]
          11  +
        /* JsonSerializerGenerator.kt:496 */
    8     12   
        let mut object_2 = object.key("topLevel").start_object();
          13  +
        /* JsonSerializerGenerator.kt:375 */
    9     14   
        crate::protocol_serde::shape_top_level::ser_top_level(&mut object_2, var_1)?;
          15  +
        /* JsonSerializerGenerator.kt:515 */
   10     16   
        object_2.finish();
          17  +
        /* JsonSerializerGenerator.kt:382 */
   11     18   
    }
          19  +
    /* JsonSerializerGenerator.kt:372 */
   12     20   
    Ok(())
          21  +
    /* JsonSerializerGenerator.kt:358 */
   13     22   
}

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

@@ -1,1 +68,108 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:358 */
    2      3   
pub fn ser_payload_config(
    3      4   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4      5   
    input: &crate::types::PayloadConfig,
    5      6   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           7  +
    /* JsonSerializerGenerator.kt:382 */
    6      8   
    if let Some(var_1) = &input.data {
           9  +
        /* JsonSerializerGenerator.kt:432 */
    7     10   
        object.key("data").number(
    8     11   
            #[allow(clippy::useless_conversion)]
    9     12   
            ::aws_smithy_types::Number::NegInt((*var_1).into()),
   10     13   
        );
          14  +
        /* JsonSerializerGenerator.kt:382 */
   11     15   
    }
          16  +
    /* JsonSerializerGenerator.kt:372 */
   12     17   
    Ok(())
          18  +
    /* JsonSerializerGenerator.kt:358 */
   13     19   
}
   14     20   
          21  +
/* JsonParserGenerator.kt:175 */
   15     22   
pub(crate) fn de_payload_config_payload(
   16     23   
    input: &[u8],
   17     24   
) -> ::std::result::Result<crate::types::PayloadConfig, ::aws_smithy_json::deserialize::error::DeserializeError> {
          25  +
    /* JsonParserGenerator.kt:187 */
   18     26   
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(input)).peekable();
   19     27   
    let tokens = &mut tokens_owned;
   20         -
    let result = crate::protocol_serde::shape_payload_config::de_payload_config(tokens)?
   21         -
        .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("expected payload member value"));
          28  +
    /* JsonParserGenerator.kt:194 */
          29  +
    let result =
          30  +
    /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_payload_config::de_payload_config(tokens)?
          31  +
    /* JsonParserGenerator.kt:196 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("expected payload member value"));
          32  +
    /* JsonParserGenerator.kt:250 */
   22     33   
    if tokens.next().is_some() {
          34  +
        /* JsonParserGenerator.kt:251 */
   23     35   
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   24     36   
            "found more JSON tokens after completing parsing",
   25     37   
        ));
          38  +
        /* JsonParserGenerator.kt:250 */
   26     39   
    }
          40  +
    /* JsonParserGenerator.kt:198 */
   27     41   
    result
          42  +
    /* JsonParserGenerator.kt:175 */
   28     43   
}
   29     44   
          45  +
/* JsonParserGenerator.kt:516 */
   30     46   
pub(crate) fn de_payload_config<'a, I>(
   31     47   
    tokens: &mut ::std::iter::Peekable<I>,
   32     48   
) -> ::std::result::Result<Option<crate::types::PayloadConfig>, ::aws_smithy_json::deserialize::error::DeserializeError>
   33     49   
where
   34     50   
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
   35     51   
{
          52  +
    /* JsonParserGenerator.kt:712 */
   36     53   
    match tokens.next().transpose()? {
   37         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          54  +
        /* JsonParserGenerator.kt:713 */ Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   38     55   
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          56  +
            /* RustType.kt:516 */
   39     57   
            #[allow(unused_mut)]
          58  +
            /* JsonParserGenerator.kt:526 */
   40     59   
            let mut builder = crate::types::builders::PayloadConfigBuilder::default();
          60  +
            /* JsonParserGenerator.kt:684 */
   41     61   
            loop {
          62  +
                /* JsonParserGenerator.kt:685 */
   42     63   
                match tokens.next().transpose()? {
   43         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   44         -
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   45         -
                        "data" => {
   46         -
                            builder = builder.set_data(
   47         -
                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   48         -
                                    .map(i32::try_from)
   49         -
                                    .transpose()?,
   50         -
                            );
          64  +
                    /* JsonParserGenerator.kt:686 */ Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          65  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          66  +
                        /* JsonParserGenerator.kt:260 */
          67  +
                        match key.to_unescaped()?.as_ref() {
          68  +
                            /* JsonParserGenerator.kt:262 */
          69  +
                            "data" => {
          70  +
                                /* JsonParserGenerator.kt:265 */
          71  +
                                builder = builder.set_data(
          72  +
                                    /* JsonParserGenerator.kt:365 */
          73  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
          74  +
                                        .map(i32::try_from)
          75  +
                                        .transpose()?, /* JsonParserGenerator.kt:265 */
          76  +
                                );
          77  +
                                /* JsonParserGenerator.kt:262 */
          78  +
                            }
          79  +
                            /* JsonParserGenerator.kt:290 */
          80  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   51     81   
                        }
   52         -
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   53         -
                    },
          82  +
                        /* JsonParserGenerator.kt:686 */
          83  +
                    }
          84  +
                    /* JsonParserGenerator.kt:695 */
   54     85   
                    other => {
   55     86   
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   56     87   
                            "expected object key or end object, found: {:?}",
   57     88   
                            other
   58     89   
                        )))
   59         -
                    }
          90  +
                    } /* JsonParserGenerator.kt:685 */
   60     91   
                }
          92  +
                /* JsonParserGenerator.kt:684 */
   61     93   
            }
          94  +
            /* JsonParserGenerator.kt:540 */
   62     95   
            Ok(Some(builder.build()))
          96  +
            /* JsonParserGenerator.kt:713 */
   63     97   
        }
   64         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   65         -
            "expected start object or null",
   66         -
        )),
          98  +
        /* JsonParserGenerator.kt:722 */
          99  +
        _ => {
         100  +
            /* JsonParserGenerator.kt:723 */
         101  +
            Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
         102  +
                "expected start object or null",
         103  +
            ))
         104  +
            /* JsonParserGenerator.kt:722 */
         105  +
        } /* JsonParserGenerator.kt:712 */
   67    106   
    }
         107  +
    /* JsonParserGenerator.kt:516 */
   68    108   
}

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

@@ -1,1 +77,113 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:551 */
    2      3   
pub(crate) fn de_player_action<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<Option<crate::types::PlayerAction>, ::aws_smithy_json::deserialize::error::DeserializeError>
    5      6   
where
    6      7   
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
    7      8   
{
           9  +
    /* JsonParserGenerator.kt:565 */
    8     10   
    let mut variant = None;
          11  +
    /* JsonParserGenerator.kt:567 */
    9     12   
    match tokens.next().transpose()? {
   10         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => return Ok(None),
   11         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => loop {
   12         -
            match tokens.next().transpose()? {
   13         -
                Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   14         -
                Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
   15         -
                    if let ::std::option::Option::Some(::std::result::Result::Ok(::aws_smithy_json::deserialize::Token::ValueNull { .. })) =
   16         -
                        tokens.peek()
   17         -
                    {
   18         -
                        let _ = tokens.next().expect("peek returned a token")?;
   19         -
                        continue;
   20         -
                    }
   21         -
                    let key = key.to_unescaped()?;
   22         -
                    if key == "__type" {
   23         -
                        ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
   24         -
                        continue;
   25         -
                    }
   26         -
                    if variant.is_some() {
   27         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   28         -
                            "encountered mixed variants in union",
   29         -
                        ));
   30         -
                    }
   31         -
                    variant = match key.as_ref() {
   32         -
                        "quit" => {
   33         -
                            ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
   34         -
                            Some(crate::types::PlayerAction::Quit)
          13  +
        /* JsonParserGenerator.kt:568 */ Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => return Ok(None),
          14  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          15  +
            /* JsonParserGenerator.kt:684 */
          16  +
            loop {
          17  +
                /* JsonParserGenerator.kt:685 */
          18  +
                match tokens.next().transpose()? {
          19  +
                    /* JsonParserGenerator.kt:686 */ Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          20  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          21  +
                        /* JsonParserGenerator.kt:576 */
          22  +
                        if let ::std::option::Option::Some(::std::result::Result::Ok(::aws_smithy_json::deserialize::Token::ValueNull { .. })) =
          23  +
                            tokens.peek()
          24  +
                        {
          25  +
                            let _ = tokens.next().expect("peek returned a token")?;
          26  +
                            continue;
   35     27   
                        }
   36         -
                        _ => {
          28  +
                        /* JsonParserGenerator.kt:585 */
          29  +
                        let key = key.to_unescaped()?;
          30  +
                        if key == "__type" {
   37     31   
                            ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
   38         -
                            Some(crate::types::PlayerAction::Unknown)
          32  +
                            continue;
   39     33   
                        }
   40         -
                    };
   41         -
                }
   42         -
                other => {
   43         -
                    return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   44         -
                        "expected object key or end object, found: {:?}",
   45         -
                        other
   46         -
                    )))
          34  +
                        if variant.is_some() {
          35  +
                            return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          36  +
                                "encountered mixed variants in union",
          37  +
                            ));
          38  +
                        }
          39  +
                        /* JsonParserGenerator.kt:598 */
          40  +
                        variant = match key.as_ref() {
          41  +
                            /* JsonParserGenerator.kt:601 */
          42  +
                            "quit" => {
          43  +
                                /* JsonParserGenerator.kt:603 */
          44  +
                                ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
          45  +
                                Some(crate::types::PlayerAction::Quit)
          46  +
                                /* JsonParserGenerator.kt:601 */
          47  +
                            }
          48  +
                            /* JsonParserGenerator.kt:621 */
          49  +
                            _ => {
          50  +
                                ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
          51  +
                                Some(crate::types::PlayerAction::Unknown)
          52  +
                            } /* JsonParserGenerator.kt:598 */
          53  +
                        };
          54  +
                        /* JsonParserGenerator.kt:686 */
          55  +
                    }
          56  +
                    /* JsonParserGenerator.kt:695 */
          57  +
                    other => {
          58  +
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
          59  +
                            "expected object key or end object, found: {:?}",
          60  +
                            other
          61  +
                        )))
          62  +
                    } /* JsonParserGenerator.kt:685 */
   47     63   
                }
          64  +
                /* JsonParserGenerator.kt:684 */
   48     65   
            }
   49         -
        },
          66  +
            /* JsonParserGenerator.kt:568 */
          67  +
        }
          68  +
        /* JsonParserGenerator.kt:642 */
   50     69   
        _ => {
   51     70   
            return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   52     71   
                "expected start object or null",
   53     72   
            ))
   54         -
        }
          73  +
        } /* JsonParserGenerator.kt:567 */
   55     74   
    }
          75  +
    /* JsonParserGenerator.kt:649 */
   56     76   
    if variant.is_none() {
   57     77   
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   58     78   
            "Union did not contain a valid variant.",
   59     79   
        ));
   60     80   
    }
          81  +
    /* JsonParserGenerator.kt:657 */
   61     82   
    Ok(variant)
          83  +
    /* JsonParserGenerator.kt:551 */
   62     84   
}
   63     85   
          86  +
/* JsonSerializerGenerator.kt:547 */
   64     87   
pub fn ser_player_action(
   65     88   
    object_2: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   66     89   
    input: &crate::types::PlayerAction,
   67     90   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          91  +
    /* JsonSerializerGenerator.kt:556 */
   68     92   
    match input {
          93  +
        /* JsonSerializerGenerator.kt:564 */
   69     94   
        crate::types::PlayerAction::Quit => {
   70         -
            #[allow(unused_mut)]
   71         -
            let mut object_1 = object_2.key("quit").start_object();
   72         -
            object_1.finish();
          95  +
            /* SerializerUtil.kt:42 */
          96  +
            {
          97  +
                /* JsonSerializerGenerator.kt:495 */
          98  +
                #[allow(unused_mut)]
          99  +
                /* JsonSerializerGenerator.kt:496 */
         100  +
                let mut object_1 = object_2.key("quit").start_object();
         101  +
                /* JsonSerializerGenerator.kt:515 */
         102  +
                object_1.finish();
         103  +
                /* SerializerUtil.kt:42 */
         104  +
            }
         105  +
            /* JsonSerializerGenerator.kt:564 */
   73    106   
        }
   74         -
        crate::types::PlayerAction::Unknown => return Err(::aws_smithy_types::error::operation::SerializationError::unknown_variant("PlayerAction")),
         107  +
        /* JsonSerializerGenerator.kt:569 */
         108  +
        crate::types::PlayerAction::Unknown => return Err(::aws_smithy_types::error::operation::SerializationError::unknown_variant("PlayerAction")), /* JsonSerializerGenerator.kt:556 */
   75    109   
    }
         110  +
    /* JsonSerializerGenerator.kt:576 */
   76    111   
    Ok(())
         112  +
    /* JsonSerializerGenerator.kt:547 */
   77    113   
}

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

@@ -1,1 +75,120 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ProtocolParserGenerator.kt:99 */
    3      5   
pub fn de_post_player_action_http_error(
    4      6   
    _response_status: u16,
    5      7   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6      8   
    _response_body: &[u8],
    7      9   
) -> std::result::Result<crate::operation::post_player_action::PostPlayerActionOutput, crate::operation::post_player_action::PostPlayerActionError> {
          10  +
    /* RustType.kt:516 */
    8     11   
    #[allow(unused_mut)]
          12  +
    /* ProtocolParserGenerator.kt:106 */
    9     13   
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   10     14   
        .map_err(crate::operation::post_player_action::PostPlayerActionError::unhandled)?;
          15  +
    /* ProtocolParserGenerator.kt:120 */
   11     16   
    let generic = generic_builder.build();
          17  +
    /* ProtocolParserGenerator.kt:185 */
   12     18   
    Err(crate::operation::post_player_action::PostPlayerActionError::generic(generic))
          19  +
    /* ProtocolParserGenerator.kt:99 */
   13     20   
}
   14     21   
          22  +
/* RustType.kt:516 */
   15     23   
#[allow(clippy::unnecessary_wraps)]
          24  +
/* ProtocolParserGenerator.kt:71 */
   16     25   
pub fn de_post_player_action_http_response(
   17     26   
    _response_status: u16,
   18     27   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   19     28   
    _response_body: &[u8],
   20     29   
) -> std::result::Result<crate::operation::post_player_action::PostPlayerActionOutput, crate::operation::post_player_action::PostPlayerActionError> {
          30  +
    /* ProtocolParserGenerator.kt:77 */
   21     31   
    Ok({
          32  +
        /* RustType.kt:516 */
   22     33   
        #[allow(unused_mut)]
          34  +
        /* ProtocolParserGenerator.kt:240 */
   23     35   
        let mut output = crate::operation::post_player_action::builders::PostPlayerActionOutputBuilder::default();
          36  +
        /* ProtocolParserGenerator.kt:247 */
   24     37   
        output = crate::protocol_serde::shape_post_player_action::de_post_player_action(_response_body, output)
   25     38   
            .map_err(crate::operation::post_player_action::PostPlayerActionError::unhandled)?;
          39  +
        /* ClientBuilderInstantiator.kt:46 */
   26     40   
        crate::serde_util::post_player_action_output_output_correct_errors(output)
   27     41   
            .build()
   28     42   
            .map_err(crate::operation::post_player_action::PostPlayerActionError::unhandled)?
          43  +
        /* ProtocolParserGenerator.kt:77 */
   29     44   
    })
          45  +
    /* ProtocolParserGenerator.kt:71 */
   30     46   
}
   31     47   
          48  +
/* JsonSerializerGenerator.kt:287 */
   32     49   
pub fn ser_post_player_action_input(
   33     50   
    input: &crate::operation::post_player_action::PostPlayerActionInput,
   34     51   
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
          52  +
    /* JsonSerializerGenerator.kt:291 */
   35     53   
    let mut out = String::new();
          54  +
    /* JsonSerializerGenerator.kt:292 */
   36     55   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
          56  +
    /* JsonSerializerGenerator.kt:375 */
   37     57   
    crate::protocol_serde::shape_post_player_action_input::ser_post_player_action_input_input(&mut object, input)?;
          58  +
    /* JsonSerializerGenerator.kt:295 */
   38     59   
    object.finish();
          60  +
    /* JsonSerializerGenerator.kt:296 */
   39     61   
    Ok(::aws_smithy_types::body::SdkBody::from(out))
          62  +
    /* JsonSerializerGenerator.kt:287 */
   40     63   
}
   41     64   
          65  +
/* JsonParserGenerator.kt:148 */
   42     66   
pub(crate) fn de_post_player_action(
   43     67   
    value: &[u8],
   44     68   
    mut builder: crate::operation::post_player_action::builders::PostPlayerActionOutputBuilder,
   45     69   
) -> ::std::result::Result<
   46     70   
    crate::operation::post_player_action::builders::PostPlayerActionOutputBuilder,
   47     71   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   48     72   
> {
          73  +
    /* JsonParserGenerator.kt:153 */
   49     74   
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
   50     75   
    let tokens = &mut tokens_owned;
   51     76   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
          77  +
    /* JsonParserGenerator.kt:684 */
   52     78   
    loop {
          79  +
        /* JsonParserGenerator.kt:685 */
   53     80   
        match tokens.next().transpose()? {
   54         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   55         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   56         -
                "action" => {
   57         -
                    builder = builder.set_action(crate::protocol_serde::shape_player_action::de_player_action(tokens)?);
          81  +
            /* JsonParserGenerator.kt:686 */ Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          82  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          83  +
                /* JsonParserGenerator.kt:260 */
          84  +
                match key.to_unescaped()?.as_ref() {
          85  +
                    /* JsonParserGenerator.kt:262 */
          86  +
                    "action" => {
          87  +
                        /* JsonParserGenerator.kt:265 */
          88  +
                        builder = builder.set_action(
          89  +
                            /* JsonParserGenerator.kt:660 */
          90  +
                            crate::protocol_serde::shape_player_action::de_player_action(tokens)?, /* JsonParserGenerator.kt:265 */
          91  +
                        );
          92  +
                        /* JsonParserGenerator.kt:262 */
          93  +
                    }
          94  +
                    /* JsonParserGenerator.kt:290 */
          95  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   58     96   
                }
   59         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   60         -
            },
          97  +
                /* JsonParserGenerator.kt:686 */
          98  +
            }
          99  +
            /* JsonParserGenerator.kt:695 */
   61    100   
            other => {
   62    101   
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   63    102   
                    "expected object key or end object, found: {:?}",
   64    103   
                    other
   65    104   
                )))
   66         -
            }
         105  +
            } /* JsonParserGenerator.kt:685 */
   67    106   
        }
         107  +
        /* JsonParserGenerator.kt:684 */
   68    108   
    }
         109  +
    /* JsonParserGenerator.kt:250 */
   69    110   
    if tokens.next().is_some() {
         111  +
        /* JsonParserGenerator.kt:251 */
   70    112   
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   71    113   
            "found more JSON tokens after completing parsing",
   72    114   
        ));
         115  +
        /* JsonParserGenerator.kt:250 */
   73    116   
    }
         117  +
    /* JsonParserGenerator.kt:163 */
   74    118   
    Ok(builder)
         119  +
    /* JsonParserGenerator.kt:148 */
   75    120   
}