Client Test

Client Test

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943 (ignoring whitespace)

Files changed:

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

@@ -1,1 +10,20 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBoundProtocolPayloadGenerator.kt:311 */
    2      3   
pub fn ser_payload_http_payload(
    3      4   
    payload: ::std::option::Option<::std::string::String>,
    4      5   
) -> ::std::result::Result<::std::vec::Vec<u8>, ::aws_smithy_types::error::operation::BuildError> {
           6  +
    /* HttpBoundProtocolPayloadGenerator.kt:320 */
    5      7   
    let payload = match payload {
    6      8   
        Some(t) => t,
    7         -
        None => return Ok(Vec::new()),
           9  +
        None => {
          10  +
            return Ok(
          11  +
                /* HttpBoundProtocolPayloadGenerator.kt:332 */ Vec::new(), /* HttpBoundProtocolPayloadGenerator.kt:320 */
          12  +
            )
          13  +
        }
    8     14   
    };
    9         -
    Ok(payload.into_bytes())
          15  +
    /* HttpBoundProtocolPayloadGenerator.kt:345 */
          16  +
    Ok(
          17  +
        /* HttpBoundProtocolPayloadGenerator.kt:366 */ payload.into_bytes(), /* HttpBoundProtocolPayloadGenerator.kt:345 */
          18  +
    )
          19  +
    /* HttpBoundProtocolPayloadGenerator.kt:311 */
   10     20   
}

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

@@ -1,1 +11,17 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:248 */
    2      3   
pub(crate) fn de_payload_payload(
    3      4   
    body: &[u8],
    4      5   
) -> std::result::Result<::std::option::Option<::std::string::String>, crate::operation::http_string_payload::HttpStringPayloadError> {
           6  +
    /* HttpBindingGenerator.kt:319 */
    5      7   
    (!body.is_empty())
    6      8   
        .then(|| {
           9  +
            /* HttpBindingGenerator.kt:325 */
    7     10   
            let body_str = std::str::from_utf8(body).map_err(crate::operation::http_string_payload::HttpStringPayloadError::unhandled)?;
          11  +
            /* HttpBindingGenerator.kt:344 */
    8     12   
            Ok(body_str.to_string())
          13  +
            /* HttpBindingGenerator.kt:319 */
    9     14   
        })
   10     15   
        .transpose()
          16  +
    /* HttpBindingGenerator.kt:248 */
   11     17   
}

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

@@ -1,1 +73,112 @@
    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_ignore_query_params_in_response_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::ignore_query_params_in_response::IgnoreQueryParamsInResponseOutput,
    9     11   
    crate::operation::ignore_query_params_in_response::IgnoreQueryParamsInResponseError,
   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::ignore_query_params_in_response::IgnoreQueryParamsInResponseError::unhandled)?;
          18  +
    /* ProtocolParserGenerator.kt:120 */
   14     19   
    let generic = generic_builder.build();
          20  +
    /* ProtocolParserGenerator.kt:185 */
   15     21   
    Err(crate::operation::ignore_query_params_in_response::IgnoreQueryParamsInResponseError::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_ignore_query_params_in_response_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::ignore_query_params_in_response::IgnoreQueryParamsInResponseOutput,
   25     34   
    crate::operation::ignore_query_params_in_response::IgnoreQueryParamsInResponseError,
   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::ignore_query_params_in_response::builders::IgnoreQueryParamsInResponseOutputBuilder::default();
          42  +
        /* ProtocolParserGenerator.kt:247 */
   30     43   
        output = crate::protocol_serde::shape_ignore_query_params_in_response::de_ignore_query_params_in_response(_response_body, output)
   31     44   
            .map_err(crate::operation::ignore_query_params_in_response::IgnoreQueryParamsInResponseError::unhandled)?;
          45  +
        /* ClientBuilderInstantiator.kt:56 */
   32     46   
        output.build()
          47  +
        /* ProtocolParserGenerator.kt:77 */
   33     48   
    })
          49  +
    /* ProtocolParserGenerator.kt:71 */
   34     50   
}
   35     51   
          52  +
/* JsonParserGenerator.kt:148 */
   36     53   
pub(crate) fn de_ignore_query_params_in_response(
   37     54   
    value: &[u8],
   38     55   
    mut builder: crate::operation::ignore_query_params_in_response::builders::IgnoreQueryParamsInResponseOutputBuilder,
   39     56   
) -> ::std::result::Result<
   40     57   
    crate::operation::ignore_query_params_in_response::builders::IgnoreQueryParamsInResponseOutputBuilder,
   41     58   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   42     59   
> {
          60  +
    /* JsonParserGenerator.kt:153 */
   43     61   
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
   44     62   
    let tokens = &mut tokens_owned;
   45     63   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
          64  +
    /* JsonParserGenerator.kt:684 */
   46     65   
    loop {
          66  +
        /* JsonParserGenerator.kt:685 */
   47     67   
        match tokens.next().transpose()? {
   48         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   49         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
          68  +
            /* JsonParserGenerator.kt:686 */ Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          69  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          70  +
                /* JsonParserGenerator.kt:260 */
          71  +
                match key.to_unescaped()?.as_ref() {
          72  +
                    /* JsonParserGenerator.kt:262 */
   50     73   
                    "baz" => {
          74  +
                        /* JsonParserGenerator.kt:265 */
   51     75   
                        builder = builder.set_baz(
          76  +
                            /* JsonParserGenerator.kt:354 */
   52     77   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   53         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   54         -
                            .transpose()?,
          78  +
                                .map(|s|
          79  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          80  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
          81  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
          82  +
                                .transpose()?, /* JsonParserGenerator.kt:265 */
   55     83   
                        );
          84  +
                        /* JsonParserGenerator.kt:262 */
   56     85   
                    }
   57         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   58         -
            },
          86  +
                    /* JsonParserGenerator.kt:290 */
          87  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
          88  +
                }
          89  +
                /* JsonParserGenerator.kt:686 */
          90  +
            }
          91  +
            /* JsonParserGenerator.kt:695 */
   59     92   
            other => {
   60     93   
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   61     94   
                    "expected object key or end object, found: {:?}",
   62     95   
                    other
   63     96   
                )))
          97  +
            } /* JsonParserGenerator.kt:685 */
   64     98   
        }
          99  +
        /* JsonParserGenerator.kt:684 */
   65    100   
    }
   66         -
    }
         101  +
    /* JsonParserGenerator.kt:250 */
   67    102   
    if tokens.next().is_some() {
         103  +
        /* JsonParserGenerator.kt:251 */
   68    104   
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   69    105   
            "found more JSON tokens after completing parsing",
   70    106   
        ));
         107  +
        /* JsonParserGenerator.kt:250 */
   71    108   
    }
         109  +
    /* JsonParserGenerator.kt:163 */
   72    110   
    Ok(builder)
         111  +
    /* JsonParserGenerator.kt:148 */
   73    112   
}

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

@@ -1,1 +428,587 @@
    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_input_and_output_with_headers_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::input_and_output_with_headers::InputAndOutputWithHeadersOutput,
    9     11   
    crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError,
   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::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled)?;
          18  +
    /* ProtocolParserGenerator.kt:120 */
   14     19   
    let generic = generic_builder.build();
          20  +
    /* ProtocolParserGenerator.kt:185 */
   15     21   
    Err(crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::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_input_and_output_with_headers_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::input_and_output_with_headers::InputAndOutputWithHeadersOutput,
   27     36   
    crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError,
   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::input_and_output_with_headers::builders::InputAndOutputWithHeadersOutputBuilder::default();
          44  +
        /* ProtocolParserGenerator.kt:267 */
   32     45   
        output = output.set_header_boolean_list(
          46  +
            /* ProtocolParserGenerator.kt:302 */
   33     47   
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_boolean_list_header(_response_headers).map_err(|_| {
   34     48   
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
   35     49   
                    "Failed to parse headerBooleanList from header `X-BooleanList",
   36     50   
                )
   37         -
            })?,
          51  +
            })?, /* ProtocolParserGenerator.kt:267 */
   38     52   
        );
          53  +
        /* ProtocolParserGenerator.kt:267 */
   39     54   
        output = output.set_header_byte(
          55  +
            /* ProtocolParserGenerator.kt:302 */
   40     56   
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_byte_header(_response_headers).map_err(|_| {
   41     57   
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
   42     58   
                    "Failed to parse headerByte from header `X-Byte",
   43     59   
                )
   44         -
            })?,
          60  +
            })?, /* ProtocolParserGenerator.kt:267 */
   45     61   
        );
          62  +
        /* ProtocolParserGenerator.kt:267 */
   46     63   
        output = output.set_header_double(
          64  +
            /* ProtocolParserGenerator.kt:302 */
   47     65   
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_double_header(_response_headers).map_err(|_| {
   48     66   
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
   49     67   
                    "Failed to parse headerDouble from header `X-Double",
   50     68   
                )
   51         -
            })?,
          69  +
            })?, /* ProtocolParserGenerator.kt:267 */
   52     70   
        );
          71  +
        /* ProtocolParserGenerator.kt:267 */
   53     72   
        output = output.set_header_enum(
          73  +
            /* ProtocolParserGenerator.kt:302 */
   54     74   
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_enum_header(_response_headers).map_err(|_| {
   55     75   
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
   56     76   
                    "Failed to parse headerEnum from header `X-Enum",
   57     77   
                )
   58         -
            })?,
          78  +
            })?, /* ProtocolParserGenerator.kt:267 */
   59     79   
        );
          80  +
        /* ProtocolParserGenerator.kt:267 */
   60     81   
        output = output.set_header_enum_list(
          82  +
            /* ProtocolParserGenerator.kt:302 */
   61     83   
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_enum_list_header(_response_headers).map_err(|_| {
   62     84   
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
   63     85   
                    "Failed to parse headerEnumList from header `X-EnumList",
   64     86   
                )
   65         -
            })?,
          87  +
            })?, /* ProtocolParserGenerator.kt:267 */
   66     88   
        );
          89  +
        /* ProtocolParserGenerator.kt:267 */
   67     90   
        output = output.set_header_false_bool(
          91  +
            /* ProtocolParserGenerator.kt:302 */
   68     92   
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_false_bool_header(_response_headers).map_err(|_| {
   69     93   
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
   70     94   
                    "Failed to parse headerFalseBool from header `X-Boolean2",
   71     95   
                )
   72         -
            })?,
          96  +
            })?, /* ProtocolParserGenerator.kt:267 */
   73     97   
        );
          98  +
        /* ProtocolParserGenerator.kt:267 */
   74     99   
        output = output.set_header_float(
         100  +
            /* ProtocolParserGenerator.kt:302 */
   75    101   
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_float_header(_response_headers).map_err(|_| {
   76    102   
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
   77    103   
                    "Failed to parse headerFloat from header `X-Float",
   78    104   
                )
   79         -
            })?,
         105  +
            })?, /* ProtocolParserGenerator.kt:267 */
   80    106   
        );
         107  +
        /* ProtocolParserGenerator.kt:267 */
   81    108   
        output = output.set_header_integer(
         109  +
            /* ProtocolParserGenerator.kt:302 */
   82    110   
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_integer_header(_response_headers).map_err(|_| {
   83    111   
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
   84    112   
                    "Failed to parse headerInteger from header `X-Integer",
   85    113   
                )
   86         -
            })?,
         114  +
            })?, /* ProtocolParserGenerator.kt:267 */
   87    115   
        );
         116  +
        /* ProtocolParserGenerator.kt:267 */
   88    117   
        output = output.set_header_integer_enum(
         118  +
            /* ProtocolParserGenerator.kt:302 */
   89    119   
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_integer_enum_header(_response_headers).map_err(|_| {
   90    120   
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
   91    121   
                    "Failed to parse headerIntegerEnum from header `X-IntegerEnum",
   92    122   
                )
   93         -
            })?,
         123  +
            })?, /* ProtocolParserGenerator.kt:267 */
   94    124   
        );
         125  +
        /* ProtocolParserGenerator.kt:267 */
   95    126   
        output = output.set_header_integer_enum_list(
         127  +
            /* ProtocolParserGenerator.kt:302 */
   96    128   
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_integer_enum_list_header(_response_headers).map_err(
   97    129   
                |_| {
   98    130   
                    crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
   99    131   
                        "Failed to parse headerIntegerEnumList from header `X-IntegerEnumList",
  100    132   
                    )
  101    133   
                },
  102         -
            )?,
         134  +
            )?, /* ProtocolParserGenerator.kt:267 */
  103    135   
        );
         136  +
        /* ProtocolParserGenerator.kt:267 */
  104    137   
        output = output.set_header_integer_list(
         138  +
            /* ProtocolParserGenerator.kt:302 */
  105    139   
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_integer_list_header(_response_headers).map_err(|_| {
  106    140   
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
  107    141   
                    "Failed to parse headerIntegerList from header `X-IntegerList",
  108    142   
                )
  109         -
            })?,
         143  +
            })?, /* ProtocolParserGenerator.kt:267 */
  110    144   
        );
         145  +
        /* ProtocolParserGenerator.kt:267 */
  111    146   
        output = output.set_header_long(
         147  +
            /* ProtocolParserGenerator.kt:302 */
  112    148   
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_long_header(_response_headers).map_err(|_| {
  113    149   
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
  114    150   
                    "Failed to parse headerLong from header `X-Long",
  115    151   
                )
  116         -
            })?,
         152  +
            })?, /* ProtocolParserGenerator.kt:267 */
  117    153   
        );
         154  +
        /* ProtocolParserGenerator.kt:267 */
  118    155   
        output = output.set_header_short(
         156  +
            /* ProtocolParserGenerator.kt:302 */
  119    157   
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_short_header(_response_headers).map_err(|_| {
  120    158   
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
  121    159   
                    "Failed to parse headerShort from header `X-Short",
  122    160   
                )
  123         -
            })?,
         161  +
            })?, /* ProtocolParserGenerator.kt:267 */
  124    162   
        );
         163  +
        /* ProtocolParserGenerator.kt:267 */
  125    164   
        output = output.set_header_string(
         165  +
            /* ProtocolParserGenerator.kt:302 */
  126    166   
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_string_header(_response_headers).map_err(|_| {
  127    167   
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
  128    168   
                    "Failed to parse headerString from header `X-String",
  129    169   
                )
  130         -
            })?,
         170  +
            })?, /* ProtocolParserGenerator.kt:267 */
  131    171   
        );
         172  +
        /* ProtocolParserGenerator.kt:267 */
  132    173   
        output = output.set_header_string_list(
         174  +
            /* ProtocolParserGenerator.kt:302 */
  133    175   
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_string_list_header(_response_headers).map_err(|_| {
  134    176   
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
  135    177   
                    "Failed to parse headerStringList from header `X-StringList",
  136    178   
                )
  137         -
            })?,
         179  +
            })?, /* ProtocolParserGenerator.kt:267 */
  138    180   
        );
         181  +
        /* ProtocolParserGenerator.kt:267 */
  139    182   
        output = output.set_header_string_set(
         183  +
            /* ProtocolParserGenerator.kt:302 */
  140    184   
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_string_set_header(_response_headers).map_err(|_| {
  141    185   
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
  142    186   
                    "Failed to parse headerStringSet from header `X-StringSet",
  143    187   
                )
  144         -
            })?,
         188  +
            })?, /* ProtocolParserGenerator.kt:267 */
  145    189   
        );
         190  +
        /* ProtocolParserGenerator.kt:267 */
  146    191   
        output = output.set_header_timestamp_list(
         192  +
            /* ProtocolParserGenerator.kt:302 */
  147    193   
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_timestamp_list_header(_response_headers).map_err(|_| {
  148    194   
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
  149    195   
                    "Failed to parse headerTimestampList from header `X-TimestampList",
  150    196   
                )
  151         -
            })?,
         197  +
            })?, /* ProtocolParserGenerator.kt:267 */
  152    198   
        );
         199  +
        /* ProtocolParserGenerator.kt:267 */
  153    200   
        output = output.set_header_true_bool(
         201  +
            /* ProtocolParserGenerator.kt:302 */
  154    202   
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_true_bool_header(_response_headers).map_err(|_| {
  155    203   
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
  156    204   
                    "Failed to parse headerTrueBool from header `X-Boolean1",
  157    205   
                )
  158         -
            })?,
         206  +
            })?, /* ProtocolParserGenerator.kt:267 */
  159    207   
        );
         208  +
        /* ClientBuilderInstantiator.kt:56 */
  160    209   
        output.build()
         210  +
        /* ProtocolParserGenerator.kt:77 */
  161    211   
    })
         212  +
    /* ProtocolParserGenerator.kt:71 */
  162    213   
}
  163    214   
         215  +
/* HttpBindingGenerator.kt:542 */
  164    216   
pub fn ser_input_and_output_with_headers_headers(
  165    217   
    input: &crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersInput,
  166    218   
    mut builder: ::http::request::Builder,
  167    219   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
         220  +
    /* HttpBindingGenerator.kt:592 */
  168    221   
    if let ::std::option::Option::Some(inner_1) = &input.header_string {
         222  +
        /* HttpBindingGenerator.kt:704 */
  169    223   
        let formatted_2 = inner_1.as_str();
         224  +
        /* HttpBindingGenerator.kt:706 */
  170    225   
        let header_value = formatted_2;
  171    226   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  172    227   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  173    228   
                "header_string",
  174    229   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  175    230   
            )
  176    231   
        })?;
  177    232   
        builder = builder.header("X-String", header_value);
         233  +
        /* HttpBindingGenerator.kt:592 */
  178    234   
    }
         235  +
    /* HttpBindingGenerator.kt:592 */
  179    236   
    if let ::std::option::Option::Some(inner_3) = &input.header_byte {
         237  +
        /* HttpBindingGenerator.kt:690 */
  180    238   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_3);
         239  +
        /* HttpBindingGenerator.kt:704 */
  181    240   
        let formatted_4 = encoder.encode();
         241  +
        /* HttpBindingGenerator.kt:706 */
  182    242   
        let header_value = formatted_4;
  183    243   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  184    244   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  185    245   
                "header_byte",
  186    246   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  187    247   
            )
  188    248   
        })?;
  189    249   
        builder = builder.header("X-Byte", header_value);
         250  +
        /* HttpBindingGenerator.kt:592 */
  190    251   
    }
         252  +
    /* HttpBindingGenerator.kt:592 */
  191    253   
    if let ::std::option::Option::Some(inner_5) = &input.header_short {
         254  +
        /* HttpBindingGenerator.kt:690 */
  192    255   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_5);
         256  +
        /* HttpBindingGenerator.kt:704 */
  193    257   
        let formatted_6 = encoder.encode();
         258  +
        /* HttpBindingGenerator.kt:706 */
  194    259   
        let header_value = formatted_6;
  195    260   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  196    261   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  197    262   
                "header_short",
  198    263   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  199    264   
            )
  200    265   
        })?;
  201    266   
        builder = builder.header("X-Short", header_value);
         267  +
        /* HttpBindingGenerator.kt:592 */
  202    268   
    }
         269  +
    /* HttpBindingGenerator.kt:592 */
  203    270   
    if let ::std::option::Option::Some(inner_7) = &input.header_integer {
         271  +
        /* HttpBindingGenerator.kt:690 */
  204    272   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_7);
         273  +
        /* HttpBindingGenerator.kt:704 */
  205    274   
        let formatted_8 = encoder.encode();
         275  +
        /* HttpBindingGenerator.kt:706 */
  206    276   
        let header_value = formatted_8;
  207    277   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  208    278   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  209    279   
                "header_integer",
  210    280   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  211    281   
            )
  212    282   
        })?;
  213    283   
        builder = builder.header("X-Integer", header_value);
         284  +
        /* HttpBindingGenerator.kt:592 */
  214    285   
    }
         286  +
    /* HttpBindingGenerator.kt:592 */
  215    287   
    if let ::std::option::Option::Some(inner_9) = &input.header_long {
         288  +
        /* HttpBindingGenerator.kt:690 */
  216    289   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_9);
         290  +
        /* HttpBindingGenerator.kt:704 */
  217    291   
        let formatted_10 = encoder.encode();
         292  +
        /* HttpBindingGenerator.kt:706 */
  218    293   
        let header_value = formatted_10;
  219    294   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  220    295   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  221    296   
                "header_long",
  222    297   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  223    298   
            )
  224    299   
        })?;
  225    300   
        builder = builder.header("X-Long", header_value);
         301  +
        /* HttpBindingGenerator.kt:592 */
  226    302   
    }
         303  +
    /* HttpBindingGenerator.kt:592 */
  227    304   
    if let ::std::option::Option::Some(inner_11) = &input.header_float {
         305  +
        /* HttpBindingGenerator.kt:690 */
  228    306   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_11);
         307  +
        /* HttpBindingGenerator.kt:704 */
  229    308   
        let formatted_12 = encoder.encode();
         309  +
        /* HttpBindingGenerator.kt:706 */
  230    310   
        let header_value = formatted_12;
  231    311   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  232    312   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  233    313   
                "header_float",
  234    314   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  235    315   
            )
  236    316   
        })?;
  237    317   
        builder = builder.header("X-Float", header_value);
         318  +
        /* HttpBindingGenerator.kt:592 */
  238    319   
    }
         320  +
    /* HttpBindingGenerator.kt:592 */
  239    321   
    if let ::std::option::Option::Some(inner_13) = &input.header_double {
         322  +
        /* HttpBindingGenerator.kt:690 */
  240    323   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_13);
         324  +
        /* HttpBindingGenerator.kt:704 */
  241    325   
        let formatted_14 = encoder.encode();
         326  +
        /* HttpBindingGenerator.kt:706 */
  242    327   
        let header_value = formatted_14;
  243    328   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  244    329   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  245    330   
                "header_double",
  246    331   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  247    332   
            )
  248    333   
        })?;
  249    334   
        builder = builder.header("X-Double", header_value);
         335  +
        /* HttpBindingGenerator.kt:592 */
  250    336   
    }
         337  +
    /* HttpBindingGenerator.kt:592 */
  251    338   
    if let ::std::option::Option::Some(inner_15) = &input.header_true_bool {
         339  +
        /* HttpBindingGenerator.kt:690 */
  252    340   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_15);
         341  +
        /* HttpBindingGenerator.kt:704 */
  253    342   
        let formatted_16 = encoder.encode();
         343  +
        /* HttpBindingGenerator.kt:706 */
  254    344   
        let header_value = formatted_16;
  255    345   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  256    346   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  257    347   
                "header_true_bool",
  258    348   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  259    349   
            )
  260    350   
        })?;
  261    351   
        builder = builder.header("X-Boolean1", header_value);
         352  +
        /* HttpBindingGenerator.kt:592 */
  262    353   
    }
         354  +
    /* HttpBindingGenerator.kt:592 */
  263    355   
    if let ::std::option::Option::Some(inner_17) = &input.header_false_bool {
         356  +
        /* HttpBindingGenerator.kt:690 */
  264    357   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_17);
         358  +
        /* HttpBindingGenerator.kt:704 */
  265    359   
        let formatted_18 = encoder.encode();
         360  +
        /* HttpBindingGenerator.kt:706 */
  266    361   
        let header_value = formatted_18;
  267    362   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  268    363   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  269    364   
                "header_false_bool",
  270    365   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  271    366   
            )
  272    367   
        })?;
  273    368   
        builder = builder.header("X-Boolean2", header_value);
         369  +
        /* HttpBindingGenerator.kt:592 */
  274    370   
    }
         371  +
    /* HttpBindingGenerator.kt:592 */
  275    372   
    if let ::std::option::Option::Some(inner_19) = &input.header_string_list {
  276         -
        // Empty vec in header is serialized as an empty string
         373  +
        /* HttpBindingGenerator.kt:638 */// Empty vec in header is serialized as an empty string
  277    374   
        if inner_19.is_empty() {
  278    375   
            builder = builder.header("X-StringList", "");
  279    376   
        } else {
         377  +
            /* HttpBindingGenerator.kt:646 */
  280    378   
            for inner_20 in inner_19 {
         379  +
                /* HttpBindingGenerator.kt:704 */
  281    380   
                let formatted_21 = ::aws_smithy_http::header::quote_header_value(inner_20.as_str());
         381  +
                /* HttpBindingGenerator.kt:706 */
  282    382   
                let header_value = formatted_21;
  283    383   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  284    384   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  285    385   
                        "header_string_list",
  286    386   
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
  287    387   
                    )
  288    388   
                })?;
  289    389   
                builder = builder.header("X-StringList", header_value);
         390  +
                /* HttpBindingGenerator.kt:646 */
  290    391   
            }
         392  +
            /* HttpBindingGenerator.kt:638 */
  291    393   
        }
         394  +
        /* HttpBindingGenerator.kt:592 */
  292    395   
    }
         396  +
    /* HttpBindingGenerator.kt:592 */
  293    397   
    if let ::std::option::Option::Some(inner_22) = &input.header_string_set {
  294         -
        // Empty vec in header is serialized as an empty string
         398  +
        /* HttpBindingGenerator.kt:638 */// Empty vec in header is serialized as an empty string
  295    399   
        if inner_22.is_empty() {
  296    400   
            builder = builder.header("X-StringSet", "");
  297    401   
        } else {
         402  +
            /* HttpBindingGenerator.kt:646 */
  298    403   
            for inner_23 in inner_22 {
         404  +
                /* HttpBindingGenerator.kt:704 */
  299    405   
                let formatted_24 = ::aws_smithy_http::header::quote_header_value(inner_23.as_str());
         406  +
                /* HttpBindingGenerator.kt:706 */
  300    407   
                let header_value = formatted_24;
  301    408   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  302    409   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  303    410   
                        "header_string_set",
  304    411   
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
  305    412   
                    )
  306    413   
                })?;
  307    414   
                builder = builder.header("X-StringSet", header_value);
         415  +
                /* HttpBindingGenerator.kt:646 */
  308    416   
            }
         417  +
            /* HttpBindingGenerator.kt:638 */
  309    418   
        }
         419  +
        /* HttpBindingGenerator.kt:592 */
  310    420   
    }
         421  +
    /* HttpBindingGenerator.kt:592 */
  311    422   
    if let ::std::option::Option::Some(inner_25) = &input.header_integer_list {
  312         -
        // Empty vec in header is serialized as an empty string
         423  +
        /* HttpBindingGenerator.kt:638 */// Empty vec in header is serialized as an empty string
  313    424   
        if inner_25.is_empty() {
  314    425   
            builder = builder.header("X-IntegerList", "");
  315    426   
        } else {
         427  +
            /* HttpBindingGenerator.kt:646 */
  316    428   
            for inner_26 in inner_25 {
         429  +
                /* HttpBindingGenerator.kt:690 */
  317    430   
                let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_26);
         431  +
                /* HttpBindingGenerator.kt:704 */
  318    432   
                let formatted_27 = encoder.encode();
         433  +
                /* HttpBindingGenerator.kt:706 */
  319    434   
                let header_value = formatted_27;
  320    435   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  321    436   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  322    437   
                        "header_integer_list",
  323    438   
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
  324    439   
                    )
  325    440   
                })?;
  326    441   
                builder = builder.header("X-IntegerList", header_value);
         442  +
                /* HttpBindingGenerator.kt:646 */
  327    443   
            }
         444  +
            /* HttpBindingGenerator.kt:638 */
  328    445   
        }
         446  +
        /* HttpBindingGenerator.kt:592 */
  329    447   
    }
         448  +
    /* HttpBindingGenerator.kt:592 */
  330    449   
    if let ::std::option::Option::Some(inner_28) = &input.header_boolean_list {
  331         -
        // Empty vec in header is serialized as an empty string
         450  +
        /* HttpBindingGenerator.kt:638 */// Empty vec in header is serialized as an empty string
  332    451   
        if inner_28.is_empty() {
  333    452   
            builder = builder.header("X-BooleanList", "");
  334    453   
        } else {
         454  +
            /* HttpBindingGenerator.kt:646 */
  335    455   
            for inner_29 in inner_28 {
         456  +
                /* HttpBindingGenerator.kt:690 */
  336    457   
                let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_29);
         458  +
                /* HttpBindingGenerator.kt:704 */
  337    459   
                let formatted_30 = encoder.encode();
         460  +
                /* HttpBindingGenerator.kt:706 */
  338    461   
                let header_value = formatted_30;
  339    462   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  340    463   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  341    464   
                        "header_boolean_list",
  342    465   
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
  343    466   
                    )
  344    467   
                })?;
  345    468   
                builder = builder.header("X-BooleanList", header_value);
         469  +
                /* HttpBindingGenerator.kt:646 */
  346    470   
            }
         471  +
            /* HttpBindingGenerator.kt:638 */
  347    472   
        }
         473  +
        /* HttpBindingGenerator.kt:592 */
  348    474   
    }
         475  +
    /* HttpBindingGenerator.kt:592 */
  349    476   
    if let ::std::option::Option::Some(inner_31) = &input.header_timestamp_list {
  350         -
        // Empty vec in header is serialized as an empty string
         477  +
        /* HttpBindingGenerator.kt:638 */// Empty vec in header is serialized as an empty string
  351    478   
        if inner_31.is_empty() {
  352    479   
            builder = builder.header("X-TimestampList", "");
  353    480   
        } else {
         481  +
            /* HttpBindingGenerator.kt:646 */
  354    482   
            for inner_32 in inner_31 {
         483  +
                /* HttpBindingGenerator.kt:704 */
  355    484   
                let formatted_33 = inner_32.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
         485  +
                /* HttpBindingGenerator.kt:706 */
  356    486   
                let header_value = formatted_33;
  357    487   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  358    488   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  359    489   
                        "header_timestamp_list",
  360    490   
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
  361    491   
                    )
  362    492   
                })?;
  363    493   
                builder = builder.header("X-TimestampList", header_value);
         494  +
                /* HttpBindingGenerator.kt:646 */
  364    495   
            }
         496  +
            /* HttpBindingGenerator.kt:638 */
  365    497   
        }
         498  +
        /* HttpBindingGenerator.kt:592 */
  366    499   
    }
         500  +
    /* HttpBindingGenerator.kt:592 */
  367    501   
    if let ::std::option::Option::Some(inner_34) = &input.header_enum {
         502  +
        /* HttpBindingGenerator.kt:704 */
  368    503   
        let formatted_35 = inner_34.as_str();
         504  +
        /* HttpBindingGenerator.kt:706 */
  369    505   
        let header_value = formatted_35;
  370    506   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  371    507   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  372    508   
                "header_enum",
  373    509   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  374    510   
            )
  375    511   
        })?;
  376    512   
        builder = builder.header("X-Enum", header_value);
         513  +
        /* HttpBindingGenerator.kt:592 */
  377    514   
    }
         515  +
    /* HttpBindingGenerator.kt:592 */
  378    516   
    if let ::std::option::Option::Some(inner_36) = &input.header_enum_list {
  379         -
        // Empty vec in header is serialized as an empty string
         517  +
        /* HttpBindingGenerator.kt:638 */// Empty vec in header is serialized as an empty string
  380    518   
        if inner_36.is_empty() {
  381    519   
            builder = builder.header("X-EnumList", "");
  382    520   
        } else {
         521  +
            /* HttpBindingGenerator.kt:646 */
  383    522   
            for inner_37 in inner_36 {
         523  +
                /* HttpBindingGenerator.kt:704 */
  384    524   
                let formatted_38 = ::aws_smithy_http::header::quote_header_value(inner_37.as_str());
         525  +
                /* HttpBindingGenerator.kt:706 */
  385    526   
                let header_value = formatted_38;
  386    527   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  387    528   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  388    529   
                        "header_enum_list",
  389    530   
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
  390    531   
                    )
  391    532   
                })?;
  392    533   
                builder = builder.header("X-EnumList", header_value);
         534  +
                /* HttpBindingGenerator.kt:646 */
  393    535   
            }
         536  +
            /* HttpBindingGenerator.kt:638 */
  394    537   
        }
         538  +
        /* HttpBindingGenerator.kt:592 */
  395    539   
    }
         540  +
    /* HttpBindingGenerator.kt:592 */
  396    541   
    if let ::std::option::Option::Some(inner_39) = &input.header_integer_enum {
         542  +
        /* HttpBindingGenerator.kt:690 */
  397    543   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_39);
         544  +
        /* HttpBindingGenerator.kt:704 */
  398    545   
        let formatted_40 = encoder.encode();
         546  +
        /* HttpBindingGenerator.kt:706 */
  399    547   
        let header_value = formatted_40;
  400    548   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  401    549   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  402    550   
                "header_integer_enum",
  403    551   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  404    552   
            )
  405    553   
        })?;
  406    554   
        builder = builder.header("X-IntegerEnum", header_value);
         555  +
        /* HttpBindingGenerator.kt:592 */
  407    556   
    }
         557  +
    /* HttpBindingGenerator.kt:592 */
  408    558   
    if let ::std::option::Option::Some(inner_41) = &input.header_integer_enum_list {
  409         -
        // Empty vec in header is serialized as an empty string
         559  +
        /* HttpBindingGenerator.kt:638 */// Empty vec in header is serialized as an empty string
  410    560   
        if inner_41.is_empty() {
  411    561   
            builder = builder.header("X-IntegerEnumList", "");
  412    562   
        } else {
         563  +
            /* HttpBindingGenerator.kt:646 */
  413    564   
            for inner_42 in inner_41 {
         565  +
                /* HttpBindingGenerator.kt:690 */
  414    566   
                let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_42);
         567  +
                /* HttpBindingGenerator.kt:704 */
  415    568   
                let formatted_43 = encoder.encode();
         569  +
                /* HttpBindingGenerator.kt:706 */
  416    570   
                let header_value = formatted_43;
  417    571   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  418    572   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  419    573   
                        "header_integer_enum_list",
  420    574   
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
  421    575   
                    )
  422    576   
                })?;
  423    577   
                builder = builder.header("X-IntegerEnumList", header_value);
         578  +
                /* HttpBindingGenerator.kt:646 */
  424    579   
            }
         580  +
            /* HttpBindingGenerator.kt:638 */
  425    581   
        }
         582  +
        /* HttpBindingGenerator.kt:592 */
  426    583   
    }
         584  +
    /* HttpBindingGenerator.kt:555 */
  427    585   
    Ok(builder)
         586  +
    /* HttpBindingGenerator.kt:542 */
  428    587   
}

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

@@ -1,1 +214,303 @@
    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_header_boolean_list_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<::std::option::Option<::std::vec::Vec<bool>>, ::aws_smithy_http::header::ParseError> {
           6  +
    /* HttpBindingGenerator.kt:160 */
    5      7   
    let headers = header_map.get_all("X-BooleanList");
           8  +
    /* HttpBindingGenerator.kt:404 */
    6      9   
    let var_1 = ::aws_smithy_http::header::read_many_primitive::<bool>(headers)?;
          10  +
    /* HttpBindingGenerator.kt:430 */
    7     11   
    Ok(if !var_1.is_empty() { Some(var_1) } else { None })
          12  +
    /* HttpBindingGenerator.kt:153 */
    8     13   
}
    9     14   
          15  +
/* HttpBindingGenerator.kt:153 */
   10     16   
pub(crate) fn de_header_byte_header(
   11     17   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   12     18   
) -> ::std::result::Result<::std::option::Option<i8>, ::aws_smithy_http::header::ParseError> {
          19  +
    /* HttpBindingGenerator.kt:160 */
   13     20   
    let headers = header_map.get_all("X-Byte");
          21  +
    /* HttpBindingGenerator.kt:404 */
   14     22   
    let var_2 = ::aws_smithy_http::header::read_many_primitive::<i8>(headers)?;
          23  +
    /* HttpBindingGenerator.kt:468 */
   15     24   
    if var_2.len() > 1 {
   16     25   
        Err(::aws_smithy_http::header::ParseError::new(format!(
   17     26   
            "expected one item but found {}",
   18     27   
            var_2.len()
   19     28   
        )))
   20     29   
    } else {
   21     30   
        let mut var_2 = var_2;
   22     31   
        Ok(var_2.pop())
   23     32   
    }
          33  +
    /* HttpBindingGenerator.kt:153 */
   24     34   
}
   25     35   
          36  +
/* HttpBindingGenerator.kt:153 */
   26     37   
pub(crate) fn de_header_double_header(
   27     38   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   28     39   
) -> ::std::result::Result<::std::option::Option<f64>, ::aws_smithy_http::header::ParseError> {
          40  +
    /* HttpBindingGenerator.kt:160 */
   29     41   
    let headers = header_map.get_all("X-Double");
          42  +
    /* HttpBindingGenerator.kt:404 */
   30     43   
    let var_3 = ::aws_smithy_http::header::read_many_primitive::<f64>(headers)?;
          44  +
    /* HttpBindingGenerator.kt:468 */
   31     45   
    if var_3.len() > 1 {
   32     46   
        Err(::aws_smithy_http::header::ParseError::new(format!(
   33     47   
            "expected one item but found {}",
   34     48   
            var_3.len()
   35     49   
        )))
   36     50   
    } else {
   37     51   
        let mut var_3 = var_3;
   38     52   
        Ok(var_3.pop())
   39     53   
    }
          54  +
    /* HttpBindingGenerator.kt:153 */
   40     55   
}
   41     56   
          57  +
/* HttpBindingGenerator.kt:153 */
   42     58   
pub(crate) fn de_header_enum_header(
   43     59   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   44     60   
) -> ::std::result::Result<::std::option::Option<crate::types::FooEnum>, ::aws_smithy_http::header::ParseError> {
          61  +
    /* HttpBindingGenerator.kt:160 */
   45     62   
    let headers = header_map.get_all("X-Enum");
          63  +
    /* HttpBindingGenerator.kt:375 */
   46     64   
    ::aws_smithy_http::header::one_or_none(headers)
          65  +
    /* HttpBindingGenerator.kt:153 */
   47     66   
}
   48     67   
          68  +
/* HttpBindingGenerator.kt:153 */
   49     69   
pub(crate) fn de_header_enum_list_header(
   50     70   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   51     71   
) -> ::std::result::Result<::std::option::Option<::std::vec::Vec<crate::types::FooEnum>>, ::aws_smithy_http::header::ParseError> {
          72  +
    /* HttpBindingGenerator.kt:160 */
   52     73   
    let headers = header_map.get_all("X-EnumList");
          74  +
    /* HttpBindingGenerator.kt:409 */
   53     75   
    let var_4: Vec<crate::types::FooEnum> = ::aws_smithy_http::header::read_many_from_str(headers)?;
          76  +
    /* HttpBindingGenerator.kt:430 */
   54     77   
    Ok(if !var_4.is_empty() { Some(var_4) } else { None })
          78  +
    /* HttpBindingGenerator.kt:153 */
   55     79   
}
   56     80   
          81  +
/* HttpBindingGenerator.kt:153 */
   57     82   
pub(crate) fn de_header_false_bool_header(
   58     83   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   59     84   
) -> ::std::result::Result<::std::option::Option<bool>, ::aws_smithy_http::header::ParseError> {
          85  +
    /* HttpBindingGenerator.kt:160 */
   60     86   
    let headers = header_map.get_all("X-Boolean2");
          87  +
    /* HttpBindingGenerator.kt:404 */
   61     88   
    let var_5 = ::aws_smithy_http::header::read_many_primitive::<bool>(headers)?;
          89  +
    /* HttpBindingGenerator.kt:468 */
   62     90   
    if var_5.len() > 1 {
   63     91   
        Err(::aws_smithy_http::header::ParseError::new(format!(
   64     92   
            "expected one item but found {}",
   65     93   
            var_5.len()
   66     94   
        )))
   67     95   
    } else {
   68     96   
        let mut var_5 = var_5;
   69     97   
        Ok(var_5.pop())
   70     98   
    }
          99  +
    /* HttpBindingGenerator.kt:153 */
   71    100   
}
   72    101   
         102  +
/* HttpBindingGenerator.kt:153 */
   73    103   
pub(crate) fn de_header_float_header(
   74    104   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   75    105   
) -> ::std::result::Result<::std::option::Option<f32>, ::aws_smithy_http::header::ParseError> {
         106  +
    /* HttpBindingGenerator.kt:160 */
   76    107   
    let headers = header_map.get_all("X-Float");
         108  +
    /* HttpBindingGenerator.kt:404 */
   77    109   
    let var_6 = ::aws_smithy_http::header::read_many_primitive::<f32>(headers)?;
         110  +
    /* HttpBindingGenerator.kt:468 */
   78    111   
    if var_6.len() > 1 {
   79    112   
        Err(::aws_smithy_http::header::ParseError::new(format!(
   80    113   
            "expected one item but found {}",
   81    114   
            var_6.len()
   82    115   
        )))
   83    116   
    } else {
   84    117   
        let mut var_6 = var_6;
   85    118   
        Ok(var_6.pop())
   86    119   
    }
         120  +
    /* HttpBindingGenerator.kt:153 */
   87    121   
}
   88    122   
         123  +
/* HttpBindingGenerator.kt:153 */
   89    124   
pub(crate) fn de_header_integer_header(
   90    125   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   91    126   
) -> ::std::result::Result<::std::option::Option<i32>, ::aws_smithy_http::header::ParseError> {
         127  +
    /* HttpBindingGenerator.kt:160 */
   92    128   
    let headers = header_map.get_all("X-Integer");
         129  +
    /* HttpBindingGenerator.kt:404 */
   93    130   
    let var_7 = ::aws_smithy_http::header::read_many_primitive::<i32>(headers)?;
         131  +
    /* HttpBindingGenerator.kt:468 */
   94    132   
    if var_7.len() > 1 {
   95    133   
        Err(::aws_smithy_http::header::ParseError::new(format!(
   96    134   
            "expected one item but found {}",
   97    135   
            var_7.len()
   98    136   
        )))
   99    137   
    } else {
  100    138   
        let mut var_7 = var_7;
  101    139   
        Ok(var_7.pop())
  102    140   
    }
         141  +
    /* HttpBindingGenerator.kt:153 */
  103    142   
}
  104    143   
         144  +
/* HttpBindingGenerator.kt:153 */
  105    145   
pub(crate) fn de_header_integer_enum_header(
  106    146   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  107    147   
) -> ::std::result::Result<::std::option::Option<i32>, ::aws_smithy_http::header::ParseError> {
         148  +
    /* HttpBindingGenerator.kt:160 */
  108    149   
    let headers = header_map.get_all("X-IntegerEnum");
         150  +
    /* HttpBindingGenerator.kt:404 */
  109    151   
    let var_8 = ::aws_smithy_http::header::read_many_primitive::<i32>(headers)?;
         152  +
    /* HttpBindingGenerator.kt:468 */
  110    153   
    if var_8.len() > 1 {
  111    154   
        Err(::aws_smithy_http::header::ParseError::new(format!(
  112    155   
            "expected one item but found {}",
  113    156   
            var_8.len()
  114    157   
        )))
  115    158   
    } else {
  116    159   
        let mut var_8 = var_8;
  117    160   
        Ok(var_8.pop())
  118    161   
    }
         162  +
    /* HttpBindingGenerator.kt:153 */
  119    163   
}
  120    164   
         165  +
/* HttpBindingGenerator.kt:153 */
  121    166   
pub(crate) fn de_header_integer_enum_list_header(
  122    167   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  123    168   
) -> ::std::result::Result<::std::option::Option<::std::vec::Vec<i32>>, ::aws_smithy_http::header::ParseError> {
         169  +
    /* HttpBindingGenerator.kt:160 */
  124    170   
    let headers = header_map.get_all("X-IntegerEnumList");
         171  +
    /* HttpBindingGenerator.kt:404 */
  125    172   
    let var_9 = ::aws_smithy_http::header::read_many_primitive::<i32>(headers)?;
         173  +
    /* HttpBindingGenerator.kt:430 */
  126    174   
    Ok(if !var_9.is_empty() { Some(var_9) } else { None })
         175  +
    /* HttpBindingGenerator.kt:153 */
  127    176   
}
  128    177   
         178  +
/* HttpBindingGenerator.kt:153 */
  129    179   
pub(crate) fn de_header_integer_list_header(
  130    180   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  131    181   
) -> ::std::result::Result<::std::option::Option<::std::vec::Vec<i32>>, ::aws_smithy_http::header::ParseError> {
         182  +
    /* HttpBindingGenerator.kt:160 */
  132    183   
    let headers = header_map.get_all("X-IntegerList");
         184  +
    /* HttpBindingGenerator.kt:404 */
  133    185   
    let var_10 = ::aws_smithy_http::header::read_many_primitive::<i32>(headers)?;
         186  +
    /* HttpBindingGenerator.kt:430 */
  134    187   
    Ok(if !var_10.is_empty() { Some(var_10) } else { None })
         188  +
    /* HttpBindingGenerator.kt:153 */
  135    189   
}
  136    190   
         191  +
/* HttpBindingGenerator.kt:153 */
  137    192   
pub(crate) fn de_header_long_header(
  138    193   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  139    194   
) -> ::std::result::Result<::std::option::Option<i64>, ::aws_smithy_http::header::ParseError> {
         195  +
    /* HttpBindingGenerator.kt:160 */
  140    196   
    let headers = header_map.get_all("X-Long");
         197  +
    /* HttpBindingGenerator.kt:404 */
  141    198   
    let var_11 = ::aws_smithy_http::header::read_many_primitive::<i64>(headers)?;
         199  +
    /* HttpBindingGenerator.kt:468 */
  142    200   
    if var_11.len() > 1 {
  143    201   
        Err(::aws_smithy_http::header::ParseError::new(format!(
  144    202   
            "expected one item but found {}",
  145    203   
            var_11.len()
  146    204   
        )))
  147    205   
    } else {
  148    206   
        let mut var_11 = var_11;
  149    207   
        Ok(var_11.pop())
  150    208   
    }
         209  +
    /* HttpBindingGenerator.kt:153 */
  151    210   
}
  152    211   
         212  +
/* HttpBindingGenerator.kt:153 */
  153    213   
pub(crate) fn de_header_short_header(
  154    214   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  155    215   
) -> ::std::result::Result<::std::option::Option<i16>, ::aws_smithy_http::header::ParseError> {
         216  +
    /* HttpBindingGenerator.kt:160 */
  156    217   
    let headers = header_map.get_all("X-Short");
         218  +
    /* HttpBindingGenerator.kt:404 */
  157    219   
    let var_12 = ::aws_smithy_http::header::read_many_primitive::<i16>(headers)?;
         220  +
    /* HttpBindingGenerator.kt:468 */
  158    221   
    if var_12.len() > 1 {
  159    222   
        Err(::aws_smithy_http::header::ParseError::new(format!(
  160    223   
            "expected one item but found {}",
  161    224   
            var_12.len()
  162    225   
        )))
  163    226   
    } else {
  164    227   
        let mut var_12 = var_12;
  165    228   
        Ok(var_12.pop())
  166    229   
    }
         230  +
    /* HttpBindingGenerator.kt:153 */
  167    231   
}
  168    232   
         233  +
/* HttpBindingGenerator.kt:153 */
  169    234   
pub(crate) fn de_header_string_header(
  170    235   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  171    236   
) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
         237  +
    /* HttpBindingGenerator.kt:160 */
  172    238   
    let headers = header_map.get_all("X-String");
         239  +
    /* HttpBindingGenerator.kt:375 */
  173    240   
    ::aws_smithy_http::header::one_or_none(headers)
         241  +
    /* HttpBindingGenerator.kt:153 */
  174    242   
}
  175    243   
         244  +
/* HttpBindingGenerator.kt:153 */
  176    245   
pub(crate) fn de_header_string_list_header(
  177    246   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  178    247   
) -> ::std::result::Result<::std::option::Option<::std::vec::Vec<::std::string::String>>, ::aws_smithy_http::header::ParseError> {
         248  +
    /* HttpBindingGenerator.kt:160 */
  179    249   
    let headers = header_map.get_all("X-StringList");
         250  +
    /* HttpBindingGenerator.kt:409 */
  180    251   
    let var_13: Vec<::std::string::String> = ::aws_smithy_http::header::read_many_from_str(headers)?;
         252  +
    /* HttpBindingGenerator.kt:430 */
  181    253   
    Ok(if !var_13.is_empty() { Some(var_13) } else { None })
         254  +
    /* HttpBindingGenerator.kt:153 */
  182    255   
}
  183    256   
         257  +
/* HttpBindingGenerator.kt:153 */
  184    258   
pub(crate) fn de_header_string_set_header(
  185    259   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  186    260   
) -> ::std::result::Result<::std::option::Option<::std::vec::Vec<::std::string::String>>, ::aws_smithy_http::header::ParseError> {
         261  +
    /* HttpBindingGenerator.kt:160 */
  187    262   
    let headers = header_map.get_all("X-StringSet");
         263  +
    /* HttpBindingGenerator.kt:409 */
  188    264   
    let var_14: Vec<::std::string::String> = ::aws_smithy_http::header::read_many_from_str(headers)?;
         265  +
    /* HttpBindingGenerator.kt:430 */
  189    266   
    Ok(if !var_14.is_empty() { Some(var_14) } else { None })
         267  +
    /* HttpBindingGenerator.kt:153 */
  190    268   
}
  191    269   
         270  +
/* HttpBindingGenerator.kt:153 */
  192    271   
pub(crate) fn de_header_timestamp_list_header(
  193    272   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  194    273   
) -> ::std::result::Result<::std::option::Option<::std::vec::Vec<::aws_smithy_types::DateTime>>, ::aws_smithy_http::header::ParseError> {
         274  +
    /* HttpBindingGenerator.kt:160 */
  195    275   
    let headers = header_map.get_all("X-TimestampList");
  196         -
    let var_15: Vec<::aws_smithy_types::DateTime> = ::aws_smithy_http::header::many_dates(headers, ::aws_smithy_types::date_time::Format::HttpDate)?;
         276  +
    /* HttpBindingGenerator.kt:394 */
         277  +
    let var_15: Vec<::aws_smithy_types::DateTime> = ::aws_smithy_http::header::many_dates(headers, ::aws_smithy_types::date_time::Format::HttpDate)?
         278  +
    /* HttpBindingGenerator.kt:402 */;
         279  +
    /* HttpBindingGenerator.kt:430 */
  197    280   
    Ok(if !var_15.is_empty() { Some(var_15) } else { None })
         281  +
    /* HttpBindingGenerator.kt:153 */
  198    282   
}
  199    283   
         284  +
/* HttpBindingGenerator.kt:153 */
  200    285   
pub(crate) fn de_header_true_bool_header(
  201    286   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  202    287   
) -> ::std::result::Result<::std::option::Option<bool>, ::aws_smithy_http::header::ParseError> {
         288  +
    /* HttpBindingGenerator.kt:160 */
  203    289   
    let headers = header_map.get_all("X-Boolean1");
         290  +
    /* HttpBindingGenerator.kt:404 */
  204    291   
    let var_16 = ::aws_smithy_http::header::read_many_primitive::<bool>(headers)?;
         292  +
    /* HttpBindingGenerator.kt:468 */
  205    293   
    if var_16.len() > 1 {
  206    294   
        Err(::aws_smithy_http::header::ParseError::new(format!(
  207    295   
            "expected one item but found {}",
  208    296   
            var_16.len()
  209    297   
        )))
  210    298   
    } else {
  211    299   
        let mut var_16 = var_16;
  212    300   
        Ok(var_16.pop())
  213    301   
    }
         302  +
    /* HttpBindingGenerator.kt:153 */
  214    303   
}

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

@@ -1,1 +34,57 @@
    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_integer_enum_list<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<Option<::std::vec::Vec<i32>>, ::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 = ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
          28  +
                        /* JsonParserGenerator.kt:419 */
          29  +
                        let value =
          30  +
                            /* JsonParserGenerator.kt:365 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   20     31   
                                                .map(i32::try_from)
   21         -
                            .transpose()?;
          32  +
                                                .transpose()?
          33  +
                        /* JsonParserGenerator.kt:419 */;
          34  +
                        /* JsonParserGenerator.kt:422 */
   22     35   
                        if let Some(value) = value {
   23     36   
                            items.push(value);
   24     37   
                        }
          38  +
                        /* JsonParserGenerator.kt:413 */
          39  +
                    } /* JsonParserGenerator.kt:409 */
   25     40   
                }
          41  +
                /* JsonParserGenerator.kt:408 */
   26     42   
            }
   27         -
            }
          43  +
            /* JsonParserGenerator.kt:446 */
   28     44   
            Ok(Some(items))
          45  +
            /* JsonParserGenerator.kt:713 */
   29     46   
        }
   30         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          47  +
        /* JsonParserGenerator.kt:722 */
          48  +
        _ => {
          49  +
            /* JsonParserGenerator.kt:723 */
          50  +
            Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   31     51   
                "expected start array or null",
   32         -
        )),
          52  +
            ))
          53  +
            /* JsonParserGenerator.kt:722 */
          54  +
        } /* JsonParserGenerator.kt:712 */
   33     55   
    }
          56  +
    /* JsonParserGenerator.kt:398 */
   34     57   
}

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

@@ -1,1 +38,63 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:460 */
    2      3   
pub(crate) fn de_integer_enum_map<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<Option<::std::collections::HashMap<::std::string::String, i32>>, ::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::StartObject { .. }) => {
          13  +
            /* JsonParserGenerator.kt:469 */
   11     14   
            let mut map = ::std::collections::HashMap::new();
          15  +
            /* JsonParserGenerator.kt:684 */
   12     16   
            loop {
          17  +
                /* JsonParserGenerator.kt:685 */
   13     18   
                match tokens.next().transpose()? {
   14         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          19  +
                    /* JsonParserGenerator.kt:686 */ Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   15     20   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
   16         -
                        let key = key.to_unescaped().map(|u| u.into_owned())?;
   17         -
                        let value = ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
          21  +
                        /* JsonParserGenerator.kt:471 */
          22  +
                        let key =
          23  +
                            /* JsonParserGenerator.kt:339 */key.to_unescaped().map(|u|
          24  +
                                /* JsonParserGenerator.kt:348 */u.into_owned()
          25  +
                            /* JsonParserGenerator.kt:339 */)
          26  +
                        /* JsonParserGenerator.kt:471 */?;
          27  +
                        /* JsonParserGenerator.kt:474 */
          28  +
                        let value =
          29  +
                            /* JsonParserGenerator.kt:365 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   18     30   
                                                .map(i32::try_from)
   19         -
                            .transpose()?;
          31  +
                                                .transpose()?
          32  +
                        /* JsonParserGenerator.kt:474 */;
          33  +
                        /* JsonParserGenerator.kt:491 */
   20     34   
                        if let Some(value) = value {
   21     35   
                            map.insert(key, value);
   22     36   
                        }
          37  +
                        /* JsonParserGenerator.kt:686 */
   23     38   
                    }
          39  +
                    /* JsonParserGenerator.kt:695 */
   24     40   
                    other => {
   25     41   
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   26     42   
                            "expected object key or end object, found: {:?}",
   27     43   
                            other
   28     44   
                        )))
          45  +
                    } /* JsonParserGenerator.kt:685 */
   29     46   
                }
          47  +
                /* JsonParserGenerator.kt:684 */
   30     48   
            }
   31         -
            }
          49  +
            /* JsonParserGenerator.kt:504 */
   32     50   
            Ok(Some(map))
          51  +
            /* JsonParserGenerator.kt:713 */
   33     52   
        }
   34         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          53  +
        /* JsonParserGenerator.kt:722 */
          54  +
        _ => {
          55  +
            /* JsonParserGenerator.kt:723 */
          56  +
            Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   35     57   
                "expected start object or null",
   36         -
        )),
          58  +
            ))
          59  +
            /* JsonParserGenerator.kt:722 */
          60  +
        } /* JsonParserGenerator.kt:712 */
   37     61   
    }
          62  +
    /* JsonParserGenerator.kt:460 */
   38     63   
}

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

@@ -1,1 +34,57 @@
    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_integer_enum_set<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<Option<::std::vec::Vec<i32>>, ::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 = ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
          28  +
                        /* JsonParserGenerator.kt:419 */
          29  +
                        let value =
          30  +
                            /* JsonParserGenerator.kt:365 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   20     31   
                                                .map(i32::try_from)
   21         -
                            .transpose()?;
          32  +
                                                .transpose()?
          33  +
                        /* JsonParserGenerator.kt:419 */;
          34  +
                        /* JsonParserGenerator.kt:422 */
   22     35   
                        if let Some(value) = value {
   23     36   
                            items.push(value);
   24     37   
                        }
          38  +
                        /* JsonParserGenerator.kt:413 */
          39  +
                    } /* JsonParserGenerator.kt:409 */
   25     40   
                }
          41  +
                /* JsonParserGenerator.kt:408 */
   26     42   
            }
   27         -
            }
          43  +
            /* JsonParserGenerator.kt:446 */
   28     44   
            Ok(Some(items))
          45  +
            /* JsonParserGenerator.kt:713 */
   29     46   
        }
   30         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          47  +
        /* JsonParserGenerator.kt:722 */
          48  +
        _ => {
          49  +
            /* JsonParserGenerator.kt:723 */
          50  +
            Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   31     51   
                "expected start array or null",
   32         -
        )),
          52  +
            ))
          53  +
            /* JsonParserGenerator.kt:722 */
          54  +
        } /* JsonParserGenerator.kt:712 */
   33     55   
    }
          56  +
    /* JsonParserGenerator.kt:398 */
   34     57   
}

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

@@ -1,1 +34,57 @@
    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_integer_list<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<Option<::std::vec::Vec<i32>>, ::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 = ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
          28  +
                        /* JsonParserGenerator.kt:419 */
          29  +
                        let value =
          30  +
                            /* JsonParserGenerator.kt:365 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   20     31   
                                                .map(i32::try_from)
   21         -
                            .transpose()?;
          32  +
                                                .transpose()?
          33  +
                        /* JsonParserGenerator.kt:419 */;
          34  +
                        /* JsonParserGenerator.kt:422 */
   22     35   
                        if let Some(value) = value {
   23     36   
                            items.push(value);
   24     37   
                        }
          38  +
                        /* JsonParserGenerator.kt:413 */
          39  +
                    } /* JsonParserGenerator.kt:409 */
   25     40   
                }
          41  +
                /* JsonParserGenerator.kt:408 */
   26     42   
            }
   27         -
            }
          43  +
            /* JsonParserGenerator.kt:446 */
   28     44   
            Ok(Some(items))
          45  +
            /* JsonParserGenerator.kt:713 */
   29     46   
        }
   30         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          47  +
        /* JsonParserGenerator.kt:722 */
          48  +
        _ => {
          49  +
            /* JsonParserGenerator.kt:723 */
          50  +
            Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   31     51   
                "expected start array or null",
   32         -
        )),
          52  +
            ))
          53  +
            /* JsonParserGenerator.kt:722 */
          54  +
        } /* JsonParserGenerator.kt:712 */
   33     55   
    }
          56  +
    /* JsonParserGenerator.kt:398 */
   34     57   
}

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

@@ -1,1 +36,59 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:148 */
    2      3   
pub(crate) fn de_invalid_greeting_json_err(
    3      4   
    value: &[u8],
    4      5   
    mut builder: crate::types::error::builders::InvalidGreetingBuilder,
    5      6   
) -> ::std::result::Result<crate::types::error::builders::InvalidGreetingBuilder, ::aws_smithy_json::deserialize::error::DeserializeError> {
           7  +
    /* JsonParserGenerator.kt:153 */
    6      8   
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
    7      9   
    let tokens = &mut tokens_owned;
    8     10   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
          11  +
    /* JsonParserGenerator.kt:684 */
    9     12   
    loop {
          13  +
        /* JsonParserGenerator.kt:685 */
   10     14   
        match tokens.next().transpose()? {
   11         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   12         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
          15  +
            /* JsonParserGenerator.kt:686 */ Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          16  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          17  +
                /* JsonParserGenerator.kt:260 */
          18  +
                match key.to_unescaped()?.as_ref() {
          19  +
                    /* JsonParserGenerator.kt:262 */
   13     20   
                    "Message" => {
          21  +
                        /* JsonParserGenerator.kt:265 */
   14     22   
                        builder = builder.set_message(
          23  +
                            /* JsonParserGenerator.kt:354 */
   15     24   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   16         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   17         -
                            .transpose()?,
          25  +
                                .map(|s|
          26  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          27  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
          28  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
          29  +
                                .transpose()?, /* JsonParserGenerator.kt:265 */
   18     30   
                        );
          31  +
                        /* JsonParserGenerator.kt:262 */
   19     32   
                    }
   20         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   21         -
            },
          33  +
                    /* JsonParserGenerator.kt:290 */
          34  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
          35  +
                }
          36  +
                /* JsonParserGenerator.kt:686 */
          37  +
            }
          38  +
            /* JsonParserGenerator.kt:695 */
   22     39   
            other => {
   23     40   
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   24     41   
                    "expected object key or end object, found: {:?}",
   25     42   
                    other
   26     43   
                )))
          44  +
            } /* JsonParserGenerator.kt:685 */
   27     45   
        }
          46  +
        /* JsonParserGenerator.kt:684 */
   28     47   
    }
   29         -
    }
          48  +
    /* JsonParserGenerator.kt:250 */
   30     49   
    if tokens.next().is_some() {
          50  +
        /* JsonParserGenerator.kt:251 */
   31     51   
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   32     52   
            "found more JSON tokens after completing parsing",
   33     53   
        ));
          54  +
        /* JsonParserGenerator.kt:250 */
   34     55   
    }
          56  +
    /* JsonParserGenerator.kt:163 */
   35     57   
    Ok(builder)
          58  +
    /* JsonParserGenerator.kt:148 */
   36     59   
}

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

@@ -1,1 +70,115 @@
    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_json_blobs_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::json_blobs::JsonBlobsOutput, crate::operation::json_blobs::JsonBlobsError> {
          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::json_blobs::JsonBlobsError::unhandled)?;
          15  +
    /* ProtocolParserGenerator.kt:120 */
   11     16   
    let generic = generic_builder.build();
          17  +
    /* ProtocolParserGenerator.kt:185 */
   12     18   
    Err(crate::operation::json_blobs::JsonBlobsError::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_json_blobs_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::json_blobs::JsonBlobsOutput, crate::operation::json_blobs::JsonBlobsError> {
          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::json_blobs::builders::JsonBlobsOutputBuilder::default();
          36  +
        /* ProtocolParserGenerator.kt:247 */
   24     37   
        output = crate::protocol_serde::shape_json_blobs::de_json_blobs(_response_body, output)
   25     38   
            .map_err(crate::operation::json_blobs::JsonBlobsError::unhandled)?;
          39  +
        /* ClientBuilderInstantiator.kt:56 */
   26     40   
        output.build()
          41  +
        /* ProtocolParserGenerator.kt:77 */
   27     42   
    })
          43  +
    /* ProtocolParserGenerator.kt:71 */
   28     44   
}
   29     45   
          46  +
/* JsonSerializerGenerator.kt:287 */
   30     47   
pub fn ser_json_blobs_input(
   31     48   
    input: &crate::operation::json_blobs::JsonBlobsInput,
   32     49   
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
          50  +
    /* JsonSerializerGenerator.kt:291 */
   33     51   
    let mut out = String::new();
          52  +
    /* JsonSerializerGenerator.kt:292 */
   34     53   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
          54  +
    /* JsonSerializerGenerator.kt:375 */
   35     55   
    crate::protocol_serde::shape_json_blobs_input::ser_json_blobs_input_input(&mut object, input)?;
          56  +
    /* JsonSerializerGenerator.kt:295 */
   36     57   
    object.finish();
          58  +
    /* JsonSerializerGenerator.kt:296 */
   37     59   
    Ok(::aws_smithy_types::body::SdkBody::from(out))
          60  +
    /* JsonSerializerGenerator.kt:287 */
   38     61   
}
   39     62   
          63  +
/* JsonParserGenerator.kt:148 */
   40     64   
pub(crate) fn de_json_blobs(
   41     65   
    value: &[u8],
   42     66   
    mut builder: crate::operation::json_blobs::builders::JsonBlobsOutputBuilder,
   43     67   
) -> ::std::result::Result<crate::operation::json_blobs::builders::JsonBlobsOutputBuilder, ::aws_smithy_json::deserialize::error::DeserializeError> {
          68  +
    /* JsonParserGenerator.kt:153 */
   44     69   
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
   45     70   
    let tokens = &mut tokens_owned;
   46     71   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
          72  +
    /* JsonParserGenerator.kt:684 */
   47     73   
    loop {
          74  +
        /* JsonParserGenerator.kt:685 */
   48     75   
        match tokens.next().transpose()? {
   49         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   50         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
          76  +
            /* JsonParserGenerator.kt:686 */ Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          77  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          78  +
                /* JsonParserGenerator.kt:260 */
          79  +
                match key.to_unescaped()?.as_ref() {
          80  +
                    /* JsonParserGenerator.kt:262 */
   51     81   
                    "data" => {
   52         -
                    builder = builder.set_data(::aws_smithy_json::deserialize::token::expect_blob_or_null(tokens.next())?);
          82  +
                        /* JsonParserGenerator.kt:265 */
          83  +
                        builder = builder.set_data(
          84  +
                            /* JsonParserGenerator.kt:326 */
          85  +
                            ::aws_smithy_json::deserialize::token::expect_blob_or_null(tokens.next())?, /* JsonParserGenerator.kt:265 */
          86  +
                        );
          87  +
                        /* JsonParserGenerator.kt:262 */
   53     88   
                    }
   54         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   55         -
            },
          89  +
                    /* JsonParserGenerator.kt:290 */
          90  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
          91  +
                }
          92  +
                /* JsonParserGenerator.kt:686 */
          93  +
            }
          94  +
            /* JsonParserGenerator.kt:695 */
   56     95   
            other => {
   57     96   
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   58     97   
                    "expected object key or end object, found: {:?}",
   59     98   
                    other
   60     99   
                )))
         100  +
            } /* JsonParserGenerator.kt:685 */
   61    101   
        }
         102  +
        /* JsonParserGenerator.kt:684 */
   62    103   
    }
   63         -
    }
         104  +
    /* JsonParserGenerator.kt:250 */
   64    105   
    if tokens.next().is_some() {
         106  +
        /* JsonParserGenerator.kt:251 */
   65    107   
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   66    108   
            "found more JSON tokens after completing parsing",
   67    109   
        ));
         110  +
        /* JsonParserGenerator.kt:250 */
   68    111   
    }
         112  +
    /* JsonParserGenerator.kt:163 */
   69    113   
    Ok(builder)
         114  +
    /* JsonParserGenerator.kt:148 */
   70    115   
}

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

@@ -1,1 +10,16 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:358 */
    2      3   
pub fn ser_json_blobs_input_input(
    3      4   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4      5   
    input: &crate::operation::json_blobs::JsonBlobsInput,
    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:439 */
    7     10   
        object.key("data").string_unchecked(&::aws_smithy_types::base64::encode(var_1));
          11  +
        /* JsonSerializerGenerator.kt:382 */
    8     12   
    }
          13  +
    /* JsonSerializerGenerator.kt:372 */
    9     14   
    Ok(())
          15  +
    /* JsonSerializerGenerator.kt:358 */
   10     16   
}

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

@@ -1,1 +97,175 @@
    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_json_enums_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::json_enums::JsonEnumsOutput, crate::operation::json_enums::JsonEnumsError> {
          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::json_enums::JsonEnumsError::unhandled)?;
          15  +
    /* ProtocolParserGenerator.kt:120 */
   11     16   
    let generic = generic_builder.build();
          17  +
    /* ProtocolParserGenerator.kt:185 */
   12     18   
    Err(crate::operation::json_enums::JsonEnumsError::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_json_enums_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::json_enums::JsonEnumsOutput, crate::operation::json_enums::JsonEnumsError> {
          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::json_enums::builders::JsonEnumsOutputBuilder::default();
          36  +
        /* ProtocolParserGenerator.kt:247 */
   24     37   
        output = crate::protocol_serde::shape_json_enums::de_json_enums(_response_body, output)
   25     38   
            .map_err(crate::operation::json_enums::JsonEnumsError::unhandled)?;
          39  +
        /* ClientBuilderInstantiator.kt:56 */
   26     40   
        output.build()
          41  +
        /* ProtocolParserGenerator.kt:77 */
   27     42   
    })
          43  +
    /* ProtocolParserGenerator.kt:71 */
   28     44   
}
   29     45   
          46  +
/* JsonSerializerGenerator.kt:287 */
   30     47   
pub fn ser_json_enums_input(
   31     48   
    input: &crate::operation::json_enums::JsonEnumsInput,
   32     49   
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
          50  +
    /* JsonSerializerGenerator.kt:291 */
   33     51   
    let mut out = String::new();
          52  +
    /* JsonSerializerGenerator.kt:292 */
   34     53   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
          54  +
    /* JsonSerializerGenerator.kt:375 */
   35     55   
    crate::protocol_serde::shape_json_enums_input::ser_json_enums_input_input(&mut object, input)?;
          56  +
    /* JsonSerializerGenerator.kt:295 */
   36     57   
    object.finish();
          58  +
    /* JsonSerializerGenerator.kt:296 */
   37     59   
    Ok(::aws_smithy_types::body::SdkBody::from(out))
          60  +
    /* JsonSerializerGenerator.kt:287 */
   38     61   
}
   39     62   
          63  +
/* JsonParserGenerator.kt:148 */
   40     64   
pub(crate) fn de_json_enums(
   41     65   
    value: &[u8],
   42     66   
    mut builder: crate::operation::json_enums::builders::JsonEnumsOutputBuilder,
   43     67   
) -> ::std::result::Result<crate::operation::json_enums::builders::JsonEnumsOutputBuilder, ::aws_smithy_json::deserialize::error::DeserializeError> {
          68  +
    /* JsonParserGenerator.kt:153 */
   44     69   
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
   45     70   
    let tokens = &mut tokens_owned;
   46     71   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
          72  +
    /* JsonParserGenerator.kt:684 */
   47     73   
    loop {
          74  +
        /* JsonParserGenerator.kt:685 */
   48     75   
        match tokens.next().transpose()? {
   49         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   50         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
          76  +
            /* JsonParserGenerator.kt:686 */ Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          77  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          78  +
                /* JsonParserGenerator.kt:260 */
          79  +
                match key.to_unescaped()?.as_ref() {
          80  +
                    /* JsonParserGenerator.kt:262 */
   51     81   
                    "fooEnum1" => {
          82  +
                        /* JsonParserGenerator.kt:265 */
   52     83   
                        builder = builder.set_foo_enum1(
          84  +
                            /* JsonParserGenerator.kt:354 */
   53     85   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   54         -
                            .map(|s| s.to_unescaped().map(|u| crate::types::FooEnum::from(u.as_ref())))
   55         -
                            .transpose()?,
          86  +
                                .map(|s|
          87  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          88  +
                                    /* JsonParserGenerator.kt:345 */crate::types::FooEnum::from(u.as_ref())
          89  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
          90  +
                                .transpose()?, /* JsonParserGenerator.kt:265 */
   56     91   
                        );
          92  +
                        /* JsonParserGenerator.kt:262 */
   57     93   
                    }
          94  +
                    /* JsonParserGenerator.kt:262 */
   58     95   
                    "fooEnum2" => {
          96  +
                        /* JsonParserGenerator.kt:265 */
   59     97   
                        builder = builder.set_foo_enum2(
          98  +
                            /* JsonParserGenerator.kt:354 */
   60     99   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   61         -
                            .map(|s| s.to_unescaped().map(|u| crate::types::FooEnum::from(u.as_ref())))
   62         -
                            .transpose()?,
         100  +
                                .map(|s|
         101  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         102  +
                                    /* JsonParserGenerator.kt:345 */crate::types::FooEnum::from(u.as_ref())
         103  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         104  +
                                .transpose()?, /* JsonParserGenerator.kt:265 */
   63    105   
                        );
         106  +
                        /* JsonParserGenerator.kt:262 */
   64    107   
                    }
         108  +
                    /* JsonParserGenerator.kt:262 */
   65    109   
                    "fooEnum3" => {
         110  +
                        /* JsonParserGenerator.kt:265 */
   66    111   
                        builder = builder.set_foo_enum3(
         112  +
                            /* JsonParserGenerator.kt:354 */
   67    113   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   68         -
                            .map(|s| s.to_unescaped().map(|u| crate::types::FooEnum::from(u.as_ref())))
   69         -
                            .transpose()?,
         114  +
                                .map(|s|
         115  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         116  +
                                    /* JsonParserGenerator.kt:345 */crate::types::FooEnum::from(u.as_ref())
         117  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         118  +
                                .transpose()?, /* JsonParserGenerator.kt:265 */
   70    119   
                        );
         120  +
                        /* JsonParserGenerator.kt:262 */
   71    121   
                    }
         122  +
                    /* JsonParserGenerator.kt:262 */
   72    123   
                    "fooEnumList" => {
   73         -
                    builder = builder.set_foo_enum_list(crate::protocol_serde::shape_foo_enum_list::de_foo_enum_list(tokens)?);
         124  +
                        /* JsonParserGenerator.kt:265 */
         125  +
                        builder = builder.set_foo_enum_list(
         126  +
                            /* JsonParserGenerator.kt:451 */
         127  +
                            crate::protocol_serde::shape_foo_enum_list::de_foo_enum_list(tokens)?, /* JsonParserGenerator.kt:265 */
         128  +
                        );
         129  +
                        /* JsonParserGenerator.kt:262 */
   74    130   
                    }
         131  +
                    /* JsonParserGenerator.kt:262 */
   75    132   
                    "fooEnumMap" => {
   76         -
                    builder = builder.set_foo_enum_map(crate::protocol_serde::shape_foo_enum_map::de_foo_enum_map(tokens)?);
         133  +
                        /* JsonParserGenerator.kt:265 */
         134  +
                        builder = builder.set_foo_enum_map(
         135  +
                            /* JsonParserGenerator.kt:509 */
         136  +
                            crate::protocol_serde::shape_foo_enum_map::de_foo_enum_map(tokens)?, /* JsonParserGenerator.kt:265 */
         137  +
                        );
         138  +
                        /* JsonParserGenerator.kt:262 */
   77    139   
                    }
         140  +
                    /* JsonParserGenerator.kt:262 */
   78    141   
                    "fooEnumSet" => {
   79         -
                    builder = builder.set_foo_enum_set(crate::protocol_serde::shape_foo_enum_set::de_foo_enum_set(tokens)?);
         142  +
                        /* JsonParserGenerator.kt:265 */
         143  +
                        builder = builder.set_foo_enum_set(
         144  +
                            /* JsonParserGenerator.kt:451 */
         145  +
                            crate::protocol_serde::shape_foo_enum_set::de_foo_enum_set(tokens)?, /* JsonParserGenerator.kt:265 */
         146  +
                        );
         147  +
                        /* JsonParserGenerator.kt:262 */
   80    148   
                    }
   81         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   82         -
            },
         149  +
                    /* JsonParserGenerator.kt:290 */
         150  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
         151  +
                }
         152  +
                /* JsonParserGenerator.kt:686 */
         153  +
            }
         154  +
            /* JsonParserGenerator.kt:695 */
   83    155   
            other => {
   84    156   
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   85    157   
                    "expected object key or end object, found: {:?}",
   86    158   
                    other
   87    159   
                )))
         160  +
            } /* JsonParserGenerator.kt:685 */
   88    161   
        }
         162  +
        /* JsonParserGenerator.kt:684 */
   89    163   
    }
   90         -
    }
         164  +
    /* JsonParserGenerator.kt:250 */
   91    165   
    if tokens.next().is_some() {
         166  +
        /* JsonParserGenerator.kt:251 */
   92    167   
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   93    168   
            "found more JSON tokens after completing parsing",
   94    169   
        ));
         170  +
        /* JsonParserGenerator.kt:250 */
   95    171   
    }
         172  +
    /* JsonParserGenerator.kt:163 */
   96    173   
    Ok(builder)
         174  +
    /* JsonParserGenerator.kt:148 */
   97    175   
}

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

@@ -1,1 +44,84 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:358 */
    2      3   
pub fn ser_json_enums_input_input(
    3      4   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4      5   
    input: &crate::operation::json_enums::JsonEnumsInput,
    5      6   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           7  +
    /* JsonSerializerGenerator.kt:382 */
    6      8   
    if let Some(var_1) = &input.foo_enum1 {
           9  +
        /* JsonSerializerGenerator.kt:423 */
    7     10   
        object.key("fooEnum1").string(var_1.as_str());
          11  +
        /* JsonSerializerGenerator.kt:382 */
    8     12   
    }
          13  +
    /* JsonSerializerGenerator.kt:382 */
    9     14   
    if let Some(var_2) = &input.foo_enum2 {
          15  +
        /* JsonSerializerGenerator.kt:423 */
   10     16   
        object.key("fooEnum2").string(var_2.as_str());
          17  +
        /* JsonSerializerGenerator.kt:382 */
   11     18   
    }
          19  +
    /* JsonSerializerGenerator.kt:382 */
   12     20   
    if let Some(var_3) = &input.foo_enum3 {
          21  +
        /* JsonSerializerGenerator.kt:423 */
   13     22   
        object.key("fooEnum3").string(var_3.as_str());
          23  +
        /* JsonSerializerGenerator.kt:382 */
   14     24   
    }
          25  +
    /* JsonSerializerGenerator.kt:382 */
   15     26   
    if let Some(var_4) = &input.foo_enum_list {
          27  +
        /* JsonSerializerGenerator.kt:484 */
   16     28   
        let mut array_5 = object.key("fooEnumList").start_array();
          29  +
        /* JsonSerializerGenerator.kt:524 */
   17     30   
        for item_6 in var_4 {
          31  +
            /* SerializerUtil.kt:42 */
   18     32   
            {
          33  +
                /* JsonSerializerGenerator.kt:423 */
   19     34   
                array_5.value().string(item_6.as_str());
          35  +
                /* SerializerUtil.kt:42 */
   20     36   
            }
          37  +
            /* JsonSerializerGenerator.kt:524 */
   21     38   
        }
          39  +
        /* JsonSerializerGenerator.kt:486 */
   22     40   
        array_5.finish();
          41  +
        /* JsonSerializerGenerator.kt:382 */
   23     42   
    }
          43  +
    /* JsonSerializerGenerator.kt:382 */
   24     44   
    if let Some(var_7) = &input.foo_enum_map {
          45  +
        /* JsonSerializerGenerator.kt:495 */
   25     46   
        #[allow(unused_mut)]
          47  +
        /* JsonSerializerGenerator.kt:496 */
   26     48   
        let mut object_8 = object.key("fooEnumMap").start_object();
          49  +
        /* JsonSerializerGenerator.kt:537 */
   27     50   
        for (key_9, value_10) in var_7 {
          51  +
            /* SerializerUtil.kt:42 */
   28     52   
            {
          53  +
                /* JsonSerializerGenerator.kt:423 */
   29     54   
                object_8.key(key_9.as_str()).string(value_10.as_str());
          55  +
                /* SerializerUtil.kt:42 */
   30     56   
            }
          57  +
            /* JsonSerializerGenerator.kt:537 */
   31     58   
        }
          59  +
        /* JsonSerializerGenerator.kt:515 */
   32     60   
        object_8.finish();
          61  +
        /* JsonSerializerGenerator.kt:382 */
   33     62   
    }
          63  +
    /* JsonSerializerGenerator.kt:382 */
   34     64   
    if let Some(var_11) = &input.foo_enum_set {
          65  +
        /* JsonSerializerGenerator.kt:484 */
   35     66   
        let mut array_12 = object.key("fooEnumSet").start_array();
          67  +
        /* JsonSerializerGenerator.kt:524 */
   36     68   
        for item_13 in var_11 {
          69  +
            /* SerializerUtil.kt:42 */
   37     70   
            {
          71  +
                /* JsonSerializerGenerator.kt:423 */
   38     72   
                array_12.value().string(item_13.as_str());
          73  +
                /* SerializerUtil.kt:42 */
   39     74   
            }
          75  +
            /* JsonSerializerGenerator.kt:524 */
   40     76   
        }
          77  +
        /* JsonSerializerGenerator.kt:486 */
   41     78   
        array_12.finish();
          79  +
        /* JsonSerializerGenerator.kt:382 */
   42     80   
    }
          81  +
    /* JsonSerializerGenerator.kt:372 */
   43     82   
    Ok(())
          83  +
    /* JsonSerializerGenerator.kt:358 */
   44     84   
}

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

@@ -1,1 +100,169 @@
    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_json_int_enums_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::json_int_enums::JsonIntEnumsOutput, crate::operation::json_int_enums::JsonIntEnumsError> {
          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::json_int_enums::JsonIntEnumsError::unhandled)?;
          15  +
    /* ProtocolParserGenerator.kt:120 */
   11     16   
    let generic = generic_builder.build();
          17  +
    /* ProtocolParserGenerator.kt:185 */
   12     18   
    Err(crate::operation::json_int_enums::JsonIntEnumsError::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_json_int_enums_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::json_int_enums::JsonIntEnumsOutput, crate::operation::json_int_enums::JsonIntEnumsError> {
          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::json_int_enums::builders::JsonIntEnumsOutputBuilder::default();
          36  +
        /* ProtocolParserGenerator.kt:247 */
   24     37   
        output = crate::protocol_serde::shape_json_int_enums::de_json_int_enums(_response_body, output)
   25     38   
            .map_err(crate::operation::json_int_enums::JsonIntEnumsError::unhandled)?;
          39  +
        /* ClientBuilderInstantiator.kt:56 */
   26     40   
        output.build()
          41  +
        /* ProtocolParserGenerator.kt:77 */
   27     42   
    })
          43  +
    /* ProtocolParserGenerator.kt:71 */
   28     44   
}
   29     45   
          46  +
/* JsonSerializerGenerator.kt:287 */
   30     47   
pub fn ser_json_int_enums_input(
   31     48   
    input: &crate::operation::json_int_enums::JsonIntEnumsInput,
   32     49   
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
          50  +
    /* JsonSerializerGenerator.kt:291 */
   33     51   
    let mut out = String::new();
          52  +
    /* JsonSerializerGenerator.kt:292 */
   34     53   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
          54  +
    /* JsonSerializerGenerator.kt:375 */
   35     55   
    crate::protocol_serde::shape_json_int_enums_input::ser_json_int_enums_input_input(&mut object, input)?;
          56  +
    /* JsonSerializerGenerator.kt:295 */
   36     57   
    object.finish();
          58  +
    /* JsonSerializerGenerator.kt:296 */
   37     59   
    Ok(::aws_smithy_types::body::SdkBody::from(out))
          60  +
    /* JsonSerializerGenerator.kt:287 */
   38     61   
}
   39     62   
          63  +
/* JsonParserGenerator.kt:148 */
   40     64   
pub(crate) fn de_json_int_enums(
   41     65   
    value: &[u8],
   42     66   
    mut builder: crate::operation::json_int_enums::builders::JsonIntEnumsOutputBuilder,
   43     67   
) -> ::std::result::Result<
   44     68   
    crate::operation::json_int_enums::builders::JsonIntEnumsOutputBuilder,
   45     69   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   46     70   
> {
          71  +
    /* JsonParserGenerator.kt:153 */
   47     72   
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
   48     73   
    let tokens = &mut tokens_owned;
   49     74   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
          75  +
    /* JsonParserGenerator.kt:684 */
   50     76   
    loop {
          77  +
        /* JsonParserGenerator.kt:685 */
   51     78   
        match tokens.next().transpose()? {
   52         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   53         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
          79  +
            /* JsonParserGenerator.kt:686 */ Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          80  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          81  +
                /* JsonParserGenerator.kt:260 */
          82  +
                match key.to_unescaped()?.as_ref() {
          83  +
                    /* JsonParserGenerator.kt:262 */
   54     84   
                    "integerEnum1" => {
          85  +
                        /* JsonParserGenerator.kt:265 */
   55     86   
                        builder = builder.set_integer_enum1(
          87  +
                            /* JsonParserGenerator.kt:365 */
   56     88   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   57     89   
                                .map(i32::try_from)
   58         -
                            .transpose()?,
          90  +
                                .transpose()?, /* JsonParserGenerator.kt:265 */
   59     91   
                        );
          92  +
                        /* JsonParserGenerator.kt:262 */
   60     93   
                    }
          94  +
                    /* JsonParserGenerator.kt:262 */
   61     95   
                    "integerEnum2" => {
          96  +
                        /* JsonParserGenerator.kt:265 */
   62     97   
                        builder = builder.set_integer_enum2(
          98  +
                            /* JsonParserGenerator.kt:365 */
   63     99   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   64    100   
                                .map(i32::try_from)
   65         -
                            .transpose()?,
         101  +
                                .transpose()?, /* JsonParserGenerator.kt:265 */
   66    102   
                        );
         103  +
                        /* JsonParserGenerator.kt:262 */
   67    104   
                    }
         105  +
                    /* JsonParserGenerator.kt:262 */
   68    106   
                    "integerEnum3" => {
         107  +
                        /* JsonParserGenerator.kt:265 */
   69    108   
                        builder = builder.set_integer_enum3(
         109  +
                            /* JsonParserGenerator.kt:365 */
   70    110   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   71    111   
                                .map(i32::try_from)
   72         -
                            .transpose()?,
         112  +
                                .transpose()?, /* JsonParserGenerator.kt:265 */
   73    113   
                        );
         114  +
                        /* JsonParserGenerator.kt:262 */
   74    115   
                    }
         116  +
                    /* JsonParserGenerator.kt:262 */
   75    117   
                    "integerEnumList" => {
   76         -
                    builder = builder.set_integer_enum_list(crate::protocol_serde::shape_integer_enum_list::de_integer_enum_list(tokens)?);
         118  +
                        /* JsonParserGenerator.kt:265 */
         119  +
                        builder = builder.set_integer_enum_list(
         120  +
                            /* JsonParserGenerator.kt:451 */
         121  +
                            crate::protocol_serde::shape_integer_enum_list::de_integer_enum_list(tokens)?, /* JsonParserGenerator.kt:265 */
         122  +
                        );
         123  +
                        /* JsonParserGenerator.kt:262 */
   77    124   
                    }
         125  +
                    /* JsonParserGenerator.kt:262 */
   78    126   
                    "integerEnumMap" => {
   79         -
                    builder = builder.set_integer_enum_map(crate::protocol_serde::shape_integer_enum_map::de_integer_enum_map(tokens)?);
         127  +
                        /* JsonParserGenerator.kt:265 */
         128  +
                        builder = builder.set_integer_enum_map(
         129  +
                            /* JsonParserGenerator.kt:509 */
         130  +
                            crate::protocol_serde::shape_integer_enum_map::de_integer_enum_map(tokens)?, /* JsonParserGenerator.kt:265 */
         131  +
                        );
         132  +
                        /* JsonParserGenerator.kt:262 */
   80    133   
                    }
         134  +
                    /* JsonParserGenerator.kt:262 */
   81    135   
                    "integerEnumSet" => {
   82         -
                    builder = builder.set_integer_enum_set(crate::protocol_serde::shape_integer_enum_set::de_integer_enum_set(tokens)?);
         136  +
                        /* JsonParserGenerator.kt:265 */
         137  +
                        builder = builder.set_integer_enum_set(
         138  +
                            /* JsonParserGenerator.kt:451 */
         139  +
                            crate::protocol_serde::shape_integer_enum_set::de_integer_enum_set(tokens)?, /* JsonParserGenerator.kt:265 */
         140  +
                        );
         141  +
                        /* JsonParserGenerator.kt:262 */
   83    142   
                    }
   84         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   85         -
            },
         143  +
                    /* JsonParserGenerator.kt:290 */
         144  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
         145  +
                }
         146  +
                /* JsonParserGenerator.kt:686 */
         147  +
            }
         148  +
            /* JsonParserGenerator.kt:695 */
   86    149   
            other => {
   87    150   
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   88    151   
                    "expected object key or end object, found: {:?}",
   89    152   
                    other
   90    153   
                )))
         154  +
            } /* JsonParserGenerator.kt:685 */
   91    155   
        }
         156  +
        /* JsonParserGenerator.kt:684 */
   92    157   
    }
   93         -
    }
         158  +
    /* JsonParserGenerator.kt:250 */
   94    159   
    if tokens.next().is_some() {
         160  +
        /* JsonParserGenerator.kt:251 */
   95    161   
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   96    162   
            "found more JSON tokens after completing parsing",
   97    163   
        ));
         164  +
        /* JsonParserGenerator.kt:250 */
   98    165   
    }
         166  +
    /* JsonParserGenerator.kt:163 */
   99    167   
    Ok(builder)
         168  +
    /* JsonParserGenerator.kt:148 */
  100    169   
}

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

@@ -1,1 +62,102 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:358 */
    2      3   
pub fn ser_json_int_enums_input_input(
    3      4   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4      5   
    input: &crate::operation::json_int_enums::JsonIntEnumsInput,
    5      6   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           7  +
    /* JsonSerializerGenerator.kt:382 */
    6      8   
    if let Some(var_1) = &input.integer_enum1 {
           9  +
        /* JsonSerializerGenerator.kt:432 */
    7     10   
        object.key("integerEnum1").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:382 */
   12     17   
    if let Some(var_2) = &input.integer_enum2 {
          18  +
        /* JsonSerializerGenerator.kt:432 */
   13     19   
        object.key("integerEnum2").number(
   14     20   
            #[allow(clippy::useless_conversion)]
   15     21   
            ::aws_smithy_types::Number::NegInt((*var_2).into()),
   16     22   
        );
          23  +
        /* JsonSerializerGenerator.kt:382 */
   17     24   
    }
          25  +
    /* JsonSerializerGenerator.kt:382 */
   18     26   
    if let Some(var_3) = &input.integer_enum3 {
          27  +
        /* JsonSerializerGenerator.kt:432 */
   19     28   
        object.key("integerEnum3").number(
   20     29   
            #[allow(clippy::useless_conversion)]
   21     30   
            ::aws_smithy_types::Number::NegInt((*var_3).into()),
   22     31   
        );
          32  +
        /* JsonSerializerGenerator.kt:382 */
   23     33   
    }
          34  +
    /* JsonSerializerGenerator.kt:382 */
   24     35   
    if let Some(var_4) = &input.integer_enum_list {
          36  +
        /* JsonSerializerGenerator.kt:484 */
   25     37   
        let mut array_5 = object.key("integerEnumList").start_array();
          38  +
        /* JsonSerializerGenerator.kt:524 */
   26     39   
        for item_6 in var_4 {
          40  +
            /* SerializerUtil.kt:42 */
   27     41   
            {
          42  +
                /* JsonSerializerGenerator.kt:432 */
   28     43   
                array_5.value().number(
   29     44   
                    #[allow(clippy::useless_conversion)]
   30     45   
                    ::aws_smithy_types::Number::NegInt((*item_6).into()),
   31     46   
                );
          47  +
                /* SerializerUtil.kt:42 */
   32     48   
            }
          49  +
            /* JsonSerializerGenerator.kt:524 */
   33     50   
        }
          51  +
        /* JsonSerializerGenerator.kt:486 */
   34     52   
        array_5.finish();
          53  +
        /* JsonSerializerGenerator.kt:382 */
   35     54   
    }
          55  +
    /* JsonSerializerGenerator.kt:382 */
   36     56   
    if let Some(var_7) = &input.integer_enum_map {
          57  +
        /* JsonSerializerGenerator.kt:495 */
   37     58   
        #[allow(unused_mut)]
          59  +
        /* JsonSerializerGenerator.kt:496 */
   38     60   
        let mut object_8 = object.key("integerEnumMap").start_object();
          61  +
        /* JsonSerializerGenerator.kt:537 */
   39     62   
        for (key_9, value_10) in var_7 {
          63  +
            /* SerializerUtil.kt:42 */
   40     64   
            {
          65  +
                /* JsonSerializerGenerator.kt:432 */
   41     66   
                object_8.key(key_9.as_str()).number(
   42     67   
                    #[allow(clippy::useless_conversion)]
   43     68   
                    ::aws_smithy_types::Number::NegInt((*value_10).into()),
   44     69   
                );
          70  +
                /* SerializerUtil.kt:42 */
   45     71   
            }
          72  +
            /* JsonSerializerGenerator.kt:537 */
   46     73   
        }
          74  +
        /* JsonSerializerGenerator.kt:515 */
   47     75   
        object_8.finish();
          76  +
        /* JsonSerializerGenerator.kt:382 */
   48     77   
    }
          78  +
    /* JsonSerializerGenerator.kt:382 */
   49     79   
    if let Some(var_11) = &input.integer_enum_set {
          80  +
        /* JsonSerializerGenerator.kt:484 */
   50     81   
        let mut array_12 = object.key("integerEnumSet").start_array();
          82  +
        /* JsonSerializerGenerator.kt:524 */
   51     83   
        for item_13 in var_11 {
          84  +
            /* SerializerUtil.kt:42 */
   52     85   
            {
          86  +
                /* JsonSerializerGenerator.kt:432 */
   53     87   
                array_12.value().number(
   54     88   
                    #[allow(clippy::useless_conversion)]
   55     89   
                    ::aws_smithy_types::Number::NegInt((*item_13).into()),
   56     90   
                );
          91  +
                /* SerializerUtil.kt:42 */
   57     92   
            }
          93  +
            /* JsonSerializerGenerator.kt:524 */
   58     94   
        }
          95  +
        /* JsonSerializerGenerator.kt:486 */
   59     96   
        array_12.finish();
          97  +
        /* JsonSerializerGenerator.kt:382 */
   60     98   
    }
          99  +
    /* JsonSerializerGenerator.kt:372 */
   61    100   
    Ok(())
         101  +
    /* JsonSerializerGenerator.kt:358 */
   62    102   
}