Client Test

Client Test

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943

Files changed:

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

@@ -1,1 +69,125 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:516 */
    2      3   
pub(crate) fn de_dialog<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<Option<crate::types::Dialog>, ::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  +
            /* RustType.kt:516 */
   11     14   
            #[allow(unused_mut)]
          15  +
            /* JsonParserGenerator.kt:526 */
   12     16   
            let mut builder = crate::types::builders::DialogBuilder::default();
          17  +
            /* JsonParserGenerator.kt:684 */
   13     18   
            loop {
          19  +
                /* JsonParserGenerator.kt:685 */
   14     20   
                match tokens.next().transpose()? {
   15         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   16         -
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   17         -
                        "language" => {
   18         -
                            builder = builder.set_language(
   19         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   20         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   21         -
                                    .transpose()?,
   22         -
                            );
          21  +
                    /* JsonParserGenerator.kt:686 */ Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          22  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          23  +
                        /* JsonParserGenerator.kt:260 */
          24  +
                        match key.to_unescaped()?.as_ref() {
          25  +
                            /* JsonParserGenerator.kt:262 */
          26  +
                            "language" => {
          27  +
                                /* JsonParserGenerator.kt:265 */
          28  +
                                builder = builder.set_language(
          29  +
                                    /* JsonParserGenerator.kt:354 */
          30  +
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
          31  +
                                        .map(|s|
          32  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          33  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
          34  +
                                        /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
          35  +
                                        .transpose()?, /* JsonParserGenerator.kt:265 */
          36  +
                                );
          37  +
                                /* JsonParserGenerator.kt:262 */
          38  +
                            }
          39  +
                            /* JsonParserGenerator.kt:262 */
          40  +
                            "greeting" => {
          41  +
                                /* JsonParserGenerator.kt:265 */
          42  +
                                builder = builder.set_greeting(
          43  +
                                    /* JsonParserGenerator.kt:354 */
          44  +
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
          45  +
                                        .map(|s|
          46  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          47  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
          48  +
                                        /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
          49  +
                                        .transpose()?, /* JsonParserGenerator.kt:265 */
          50  +
                                );
          51  +
                                /* JsonParserGenerator.kt:262 */
          52  +
                            }
          53  +
                            /* JsonParserGenerator.kt:262 */
          54  +
                            "farewell" => {
          55  +
                                /* JsonParserGenerator.kt:265 */
          56  +
                                builder = builder.set_farewell(
          57  +
                                    /* JsonParserGenerator.kt:544 */
          58  +
                                    crate::protocol_serde::shape_farewell::de_farewell(tokens)?, /* JsonParserGenerator.kt:265 */
          59  +
                                );
          60  +
                                /* JsonParserGenerator.kt:262 */
          61  +
                            }
          62  +
                            /* JsonParserGenerator.kt:290 */
          63  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   23     64   
                        }
   24         -
                        "greeting" => {
   25         -
                            builder = builder.set_greeting(
   26         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   27         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   28         -
                                    .transpose()?,
   29         -
                            );
   30         -
                        }
   31         -
                        "farewell" => {
   32         -
                            builder = builder.set_farewell(crate::protocol_serde::shape_farewell::de_farewell(tokens)?);
   33         -
                        }
   34         -
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   35         -
                    },
          65  +
                        /* JsonParserGenerator.kt:686 */
          66  +
                    }
          67  +
                    /* JsonParserGenerator.kt:695 */
   36     68   
                    other => {
   37     69   
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   38     70   
                            "expected object key or end object, found: {:?}",
   39     71   
                            other
   40     72   
                        )))
   41         -
                    }
          73  +
                    } /* JsonParserGenerator.kt:685 */
   42     74   
                }
          75  +
                /* JsonParserGenerator.kt:684 */
   43     76   
            }
          77  +
            /* JsonParserGenerator.kt:540 */
   44     78   
            Ok(Some(builder.build()))
          79  +
            /* JsonParserGenerator.kt:713 */
   45     80   
        }
   46         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   47         -
            "expected start object or null",
   48         -
        )),
          81  +
        /* JsonParserGenerator.kt:722 */
          82  +
        _ => {
          83  +
            /* JsonParserGenerator.kt:723 */
          84  +
            Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          85  +
                "expected start object or null",
          86  +
            ))
          87  +
            /* JsonParserGenerator.kt:722 */
          88  +
        } /* JsonParserGenerator.kt:712 */
   49     89   
    }
          90  +
    /* JsonParserGenerator.kt:516 */
   50     91   
}
   51     92   
          93  +
/* JsonSerializerGenerator.kt:358 */
   52     94   
pub fn ser_dialog(
   53     95   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   54     96   
    input: &crate::types::Dialog,
   55     97   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          98  +
    /* JsonSerializerGenerator.kt:382 */
   56     99   
    if let Some(var_1) = &input.language {
         100  +
        /* JsonSerializerGenerator.kt:423 */
   57    101   
        object.key("language").string(var_1.as_str());
         102  +
        /* JsonSerializerGenerator.kt:382 */
   58    103   
    }
         104  +
    /* SerializerUtil.kt:46 */
   59    105   
    {
         106  +
        /* JsonSerializerGenerator.kt:423 */
   60    107   
        object.key("greeting").string(input.greeting.as_str());
         108  +
        /* SerializerUtil.kt:46 */
   61    109   
    }
         110  +
    /* JsonSerializerGenerator.kt:382 */
   62    111   
    if let Some(var_2) = &input.farewell {
         112  +
        /* JsonSerializerGenerator.kt:495 */
   63    113   
        #[allow(unused_mut)]
         114  +
        /* JsonSerializerGenerator.kt:496 */
   64    115   
        let mut object_3 = object.key("farewell").start_object();
         116  +
        /* JsonSerializerGenerator.kt:375 */
   65    117   
        crate::protocol_serde::shape_farewell::ser_farewell(&mut object_3, var_2)?;
         118  +
        /* JsonSerializerGenerator.kt:515 */
   66    119   
        object_3.finish();
         120  +
        /* JsonSerializerGenerator.kt:382 */
   67    121   
    }
         122  +
    /* JsonSerializerGenerator.kt:372 */
   68    123   
    Ok(())
         124  +
    /* JsonSerializerGenerator.kt:358 */
   69    125   
}

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

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

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

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

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

@@ -1,1 +40,58 @@
    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_empty_input_and_empty_output_http_error(
    4      6   
    _response_status: u16,
    5      7   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6      8   
    _response_body: &[u8],
    7      9   
) -> std::result::Result<
    8     10   
    crate::operation::empty_input_and_empty_output::EmptyInputAndEmptyOutputOutput,
    9     11   
    crate::operation::empty_input_and_empty_output::EmptyInputAndEmptyOutputError,
   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::empty_input_and_empty_output::EmptyInputAndEmptyOutputError::unhandled)?;
          18  +
    /* ProtocolParserGenerator.kt:120 */
   14     19   
    let generic = generic_builder.build();
          20  +
    /* ProtocolParserGenerator.kt:185 */
   15     21   
    Err(crate::operation::empty_input_and_empty_output::EmptyInputAndEmptyOutputError::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_empty_input_and_empty_output_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::empty_input_and_empty_output::EmptyInputAndEmptyOutputOutput,
   27     36   
    crate::operation::empty_input_and_empty_output::EmptyInputAndEmptyOutputError,
   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::empty_input_and_empty_output::builders::EmptyInputAndEmptyOutputOutputBuilder::default();
          44  +
        /* ClientBuilderInstantiator.kt:56 */
   32     45   
        output.build()
          46  +
        /* ProtocolParserGenerator.kt:77 */
   33     47   
    })
          48  +
    /* ProtocolParserGenerator.kt:71 */
   34     49   
}
   35     50   
          51  +
/* AwsJson.kt:152 */
   36     52   
pub fn ser_empty_input_and_empty_output_input(
   37     53   
    _input: &crate::operation::empty_input_and_empty_output::EmptyInputAndEmptyOutputInput,
   38     54   
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
          55  +
    /* AwsJson.kt:156 */
   39     56   
    Ok(::aws_smithy_types::body::SdkBody::from("{}"))
          57  +
    /* AwsJson.kt:152 */
   40     58   
}

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

@@ -1,1 +34,52 @@
    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_endpoint_operation_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::endpoint_operation::EndpointOperationOutput, crate::operation::endpoint_operation::EndpointOperationError>
    8     10   
{
          11  +
    /* RustType.kt:516 */
    9     12   
    #[allow(unused_mut)]
          13  +
    /* ProtocolParserGenerator.kt:106 */
   10     14   
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   11     15   
        .map_err(crate::operation::endpoint_operation::EndpointOperationError::unhandled)?;
          16  +
    /* ProtocolParserGenerator.kt:120 */
   12     17   
    let generic = generic_builder.build();
          18  +
    /* ProtocolParserGenerator.kt:185 */
   13     19   
    Err(crate::operation::endpoint_operation::EndpointOperationError::generic(generic))
          20  +
    /* ProtocolParserGenerator.kt:99 */
   14     21   
}
   15     22   
          23  +
/* RustType.kt:516 */
   16     24   
#[allow(clippy::unnecessary_wraps)]
          25  +
/* ProtocolParserGenerator.kt:71 */
   17     26   
pub fn de_endpoint_operation_http_response(
   18     27   
    _response_status: u16,
   19     28   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   20     29   
    _response_body: &[u8],
   21     30   
) -> std::result::Result<crate::operation::endpoint_operation::EndpointOperationOutput, crate::operation::endpoint_operation::EndpointOperationError>
   22     31   
{
          32  +
    /* ProtocolParserGenerator.kt:77 */
   23     33   
    Ok({
          34  +
        /* RustType.kt:516 */
   24     35   
        #[allow(unused_mut)]
          36  +
        /* ProtocolParserGenerator.kt:240 */
   25     37   
        let mut output = crate::operation::endpoint_operation::builders::EndpointOperationOutputBuilder::default();
          38  +
        /* ClientBuilderInstantiator.kt:56 */
   26     39   
        output.build()
          40  +
        /* ProtocolParserGenerator.kt:77 */
   27     41   
    })
          42  +
    /* ProtocolParserGenerator.kt:71 */
   28     43   
}
   29     44   
          45  +
/* AwsJson.kt:152 */
   30     46   
pub fn ser_endpoint_operation_input(
   31     47   
    _input: &crate::operation::endpoint_operation::EndpointOperationInput,
   32     48   
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
          49  +
    /* AwsJson.kt:156 */
   33     50   
    Ok(::aws_smithy_types::body::SdkBody::from("{}"))
          51  +
    /* AwsJson.kt:152 */
   34     52   
}

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

@@ -1,1 +42,64 @@
    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_endpoint_with_host_label_operation_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::endpoint_with_host_label_operation::EndpointWithHostLabelOperationOutput,
    9     11   
    crate::operation::endpoint_with_host_label_operation::EndpointWithHostLabelOperationError,
   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::endpoint_with_host_label_operation::EndpointWithHostLabelOperationError::unhandled)?;
          18  +
    /* ProtocolParserGenerator.kt:120 */
   14     19   
    let generic = generic_builder.build();
          20  +
    /* ProtocolParserGenerator.kt:185 */
   15     21   
    Err(crate::operation::endpoint_with_host_label_operation::EndpointWithHostLabelOperationError::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_endpoint_with_host_label_operation_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::endpoint_with_host_label_operation::EndpointWithHostLabelOperationOutput,
   25     34   
    crate::operation::endpoint_with_host_label_operation::EndpointWithHostLabelOperationError,
   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::endpoint_with_host_label_operation::builders::EndpointWithHostLabelOperationOutputBuilder::default();
          42  +
        /* ClientBuilderInstantiator.kt:56 */
   30     43   
        output.build()
          44  +
        /* ProtocolParserGenerator.kt:77 */
   31     45   
    })
          46  +
    /* ProtocolParserGenerator.kt:71 */
   32     47   
}
   33     48   
          49  +
/* JsonSerializerGenerator.kt:287 */
   34     50   
pub fn ser_endpoint_with_host_label_operation_input(
   35     51   
    input: &crate::operation::endpoint_with_host_label_operation::EndpointWithHostLabelOperationInput,
   36     52   
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
          53  +
    /* JsonSerializerGenerator.kt:291 */
   37     54   
    let mut out = String::new();
          55  +
    /* JsonSerializerGenerator.kt:292 */
   38     56   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
          57  +
    /* JsonSerializerGenerator.kt:375 */
   39     58   
    crate::protocol_serde::shape_endpoint_with_host_label_operation_input::ser_endpoint_with_host_label_operation_input_input(&mut object, input)?;
          59  +
    /* JsonSerializerGenerator.kt:295 */
   40     60   
    object.finish();
          61  +
    /* JsonSerializerGenerator.kt:296 */
   41     62   
    Ok(::aws_smithy_types::body::SdkBody::from(out))
          63  +
    /* JsonSerializerGenerator.kt:287 */
   42     64   
}

tmp-codegen-diff/codegen-client-test/json_rpc10/rust-client-codegen/src/protocol_serde/shape_endpoint_with_host_label_operation_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_endpoint_with_host_label_operation_input_input(
    3      4   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4      5   
    input: &crate::operation::endpoint_with_host_label_operation::EndpointWithHostLabelOperationInput,
    5      6   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           7  +
    /* JsonSerializerGenerator.kt:382 */
    6      8   
    if let Some(var_1) = &input.label {
           9  +
        /* JsonSerializerGenerator.kt:423 */
    7     10   
        object.key("label").string(var_1.as_str());
          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/json_rpc10/rust-client-codegen/src/protocol_serde/shape_farewell.rs

@@ -1,1 +50,84 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:516 */
    2      3   
pub(crate) fn de_farewell<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<Option<crate::types::Farewell>, ::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  +
            /* RustType.kt:516 */
   11     14   
            #[allow(unused_mut)]
          15  +
            /* JsonParserGenerator.kt:526 */
   12     16   
            let mut builder = crate::types::builders::FarewellBuilder::default();
          17  +
            /* JsonParserGenerator.kt:684 */
   13     18   
            loop {
          19  +
                /* JsonParserGenerator.kt:685 */
   14     20   
                match tokens.next().transpose()? {
   15         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   16         -
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   17         -
                        "phrase" => {
   18         -
                            builder = builder.set_phrase(
   19         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   20         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   21         -
                                    .transpose()?,
   22         -
                            );
          21  +
                    /* JsonParserGenerator.kt:686 */ Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          22  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          23  +
                        /* JsonParserGenerator.kt:260 */
          24  +
                        match key.to_unescaped()?.as_ref() {
          25  +
                            /* JsonParserGenerator.kt:262 */
          26  +
                            "phrase" => {
          27  +
                                /* JsonParserGenerator.kt:265 */
          28  +
                                builder = builder.set_phrase(
          29  +
                                    /* JsonParserGenerator.kt:354 */
          30  +
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
          31  +
                                        .map(|s|
          32  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          33  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
          34  +
                                        /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
          35  +
                                        .transpose()?, /* JsonParserGenerator.kt:265 */
          36  +
                                );
          37  +
                                /* JsonParserGenerator.kt:262 */
          38  +
                            }
          39  +
                            /* JsonParserGenerator.kt:290 */
          40  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   23     41   
                        }
   24         -
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   25         -
                    },
          42  +
                        /* JsonParserGenerator.kt:686 */
          43  +
                    }
          44  +
                    /* JsonParserGenerator.kt:695 */
   26     45   
                    other => {
   27     46   
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   28     47   
                            "expected object key or end object, found: {:?}",
   29     48   
                            other
   30     49   
                        )))
   31         -
                    }
          50  +
                    } /* JsonParserGenerator.kt:685 */
   32     51   
                }
          52  +
                /* JsonParserGenerator.kt:684 */
   33     53   
            }
          54  +
            /* JsonParserGenerator.kt:540 */
   34     55   
            Ok(Some(builder.build()))
          56  +
            /* JsonParserGenerator.kt:713 */
   35     57   
        }
   36         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37         -
            "expected start object or null",
   38         -
        )),
          58  +
        /* JsonParserGenerator.kt:722 */
          59  +
        _ => {
          60  +
            /* JsonParserGenerator.kt:723 */
          61  +
            Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          62  +
                "expected start object or null",
          63  +
            ))
          64  +
            /* JsonParserGenerator.kt:722 */
          65  +
        } /* JsonParserGenerator.kt:712 */
   39     66   
    }
          67  +
    /* JsonParserGenerator.kt:516 */
   40     68   
}
   41     69   
          70  +
/* JsonSerializerGenerator.kt:358 */
   42     71   
pub fn ser_farewell(
   43     72   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   44     73   
    input: &crate::types::Farewell,
   45     74   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          75  +
    /* SerializerUtil.kt:46 */
   46     76   
    {
          77  +
        /* JsonSerializerGenerator.kt:423 */
   47     78   
        object.key("phrase").string(input.phrase.as_str());
          79  +
        /* SerializerUtil.kt:46 */
   48     80   
    }
          81  +
    /* JsonSerializerGenerator.kt:372 */
   49     82   
    Ok(())
          83  +
    /* JsonSerializerGenerator.kt:358 */
   50     84   
}

tmp-codegen-diff/codegen-client-test/json_rpc10/rust-client-codegen/src/protocol_serde/shape_foo_error.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_foo_error_json_err(
    3      4   
    value: &[u8],
    4      5   
    mut builder: crate::types::error::builders::FooErrorBuilder,
    5      6   
) -> ::std::result::Result<crate::types::error::builders::FooErrorBuilder, ::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() {
   13         -
                "Message" => {
   14         -
                    builder = builder.set_message(
   15         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   16         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   17         -
                            .transpose()?,
   18         -
                    );
          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 */
          20  +
                    "Message" => {
          21  +
                        /* JsonParserGenerator.kt:265 */
          22  +
                        builder = builder.set_message(
          23  +
                            /* JsonParserGenerator.kt:354 */
          24  +
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
          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 */
          30  +
                        );
          31  +
                        /* JsonParserGenerator.kt:262 */
          32  +
                    }
          33  +
                    /* JsonParserGenerator.kt:290 */
          34  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   19     35   
                }
   20         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   21         -
            },
          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   
                )))
   27         -
            }
          44  +
            } /* JsonParserGenerator.kt:685 */
   28     45   
        }
          46  +
        /* JsonParserGenerator.kt:684 */
   29     47   
    }
          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/json_rpc10/rust-client-codegen/src/protocol_serde/shape_greeting_struct.rs

@@ -1,1 +50,84 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:516 */
    2      3   
pub(crate) fn de_greeting_struct<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<Option<crate::types::GreetingStruct>, ::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  +
            /* RustType.kt:516 */
   11     14   
            #[allow(unused_mut)]
          15  +
            /* JsonParserGenerator.kt:526 */
   12     16   
            let mut builder = crate::types::builders::GreetingStructBuilder::default();
          17  +
            /* JsonParserGenerator.kt:684 */
   13     18   
            loop {
          19  +
                /* JsonParserGenerator.kt:685 */
   14     20   
                match tokens.next().transpose()? {
   15         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   16         -
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   17         -
                        "hi" => {
   18         -
                            builder = builder.set_hi(
   19         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   20         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   21         -
                                    .transpose()?,
   22         -
                            );
          21  +
                    /* JsonParserGenerator.kt:686 */ Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          22  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          23  +
                        /* JsonParserGenerator.kt:260 */
          24  +
                        match key.to_unescaped()?.as_ref() {
          25  +
                            /* JsonParserGenerator.kt:262 */
          26  +
                            "hi" => {
          27  +
                                /* JsonParserGenerator.kt:265 */
          28  +
                                builder = builder.set_hi(
          29  +
                                    /* JsonParserGenerator.kt:354 */
          30  +
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
          31  +
                                        .map(|s|
          32  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          33  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
          34  +
                                        /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
          35  +
                                        .transpose()?, /* JsonParserGenerator.kt:265 */
          36  +
                                );
          37  +
                                /* JsonParserGenerator.kt:262 */
          38  +
                            }
          39  +
                            /* JsonParserGenerator.kt:290 */
          40  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   23     41   
                        }
   24         -
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   25         -
                    },
          42  +
                        /* JsonParserGenerator.kt:686 */
          43  +
                    }
          44  +
                    /* JsonParserGenerator.kt:695 */
   26     45   
                    other => {
   27     46   
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   28     47   
                            "expected object key or end object, found: {:?}",
   29     48   
                            other
   30     49   
                        )))
   31         -
                    }
          50  +
                    } /* JsonParserGenerator.kt:685 */
   32     51   
                }
          52  +
                /* JsonParserGenerator.kt:684 */
   33     53   
            }
          54  +
            /* JsonParserGenerator.kt:540 */
   34     55   
            Ok(Some(builder.build()))
          56  +
            /* JsonParserGenerator.kt:713 */
   35     57   
        }
   36         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37         -
            "expected start object or null",
   38         -
        )),
          58  +
        /* JsonParserGenerator.kt:722 */
          59  +
        _ => {
          60  +
            /* JsonParserGenerator.kt:723 */
          61  +
            Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          62  +
                "expected start object or null",
          63  +
            ))
          64  +
            /* JsonParserGenerator.kt:722 */
          65  +
        } /* JsonParserGenerator.kt:712 */
   39     66   
    }
          67  +
    /* JsonParserGenerator.kt:516 */
   40     68   
}
   41     69   
          70  +
/* JsonSerializerGenerator.kt:358 */
   42     71   
pub fn ser_greeting_struct(
   43     72   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   44     73   
    input: &crate::types::GreetingStruct,
   45     74   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          75  +
    /* JsonSerializerGenerator.kt:382 */
   46     76   
    if let Some(var_1) = &input.hi {
          77  +
        /* JsonSerializerGenerator.kt:423 */
   47     78   
        object.key("hi").string(var_1.as_str());
          79  +
        /* JsonSerializerGenerator.kt:382 */
   48     80   
    }
          81  +
    /* JsonSerializerGenerator.kt:372 */
   49     82   
    Ok(())
          83  +
    /* JsonSerializerGenerator.kt:358 */
   50     84   
}

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

@@ -1,1 +136,202 @@
    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_greeting_with_errors_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::greeting_with_errors::GreetingWithErrorsOutput,
    9     11   
    crate::operation::greeting_with_errors::GreetingWithErrorsError,
   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::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
          18  +
    /* ProtocolParserGenerator.kt:120 */
   14     19   
    let generic = generic_builder.build();
          20  +
    /* ProtocolParserGenerator.kt:122 */
   15     21   
    let error_code = match generic.code() {
   16     22   
        Some(code) => code,
   17     23   
        None => return Err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled(generic)),
   18     24   
    };
   19     25   
   20     26   
    let _error_message = generic.message().map(|msg| msg.to_owned());
          27  +
    /* ProtocolParserGenerator.kt:133 */
   21     28   
    Err(match error_code {
          29  +
        /* ProtocolParserGenerator.kt:139 */
   22     30   
        "InvalidGreeting" => crate::operation::greeting_with_errors::GreetingWithErrorsError::InvalidGreeting({
          31  +
            /* RustType.kt:516 */
   23     32   
            #[allow(unused_mut)]
   24         -
            let mut tmp = {
   25         -
                #[allow(unused_mut)]
   26         -
                let mut output = crate::types::error::builders::InvalidGreetingBuilder::default();
   27         -
                output = crate::protocol_serde::shape_invalid_greeting::de_invalid_greeting_json_err(_response_body, output)
   28         -
                    .map_err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
   29         -
                let output = output.meta(generic);
   30         -
                output.build()
   31         -
            };
          33  +
            /* ProtocolParserGenerator.kt:145 */let mut tmp =
          34  +
                /* ProtocolParserGenerator.kt:146 */ {
          35  +
                    /* RustType.kt:516 */#[allow(unused_mut)]
          36  +
                    /* ProtocolParserGenerator.kt:240 */let mut output = crate::types::error::builders::InvalidGreetingBuilder::default();
          37  +
                    /* ProtocolParserGenerator.kt:257 */output = crate::protocol_serde::shape_invalid_greeting::de_invalid_greeting_json_err(_response_body, output).map_err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
          38  +
                    /* ProtocolParserGenerator.kt:157 */let output = output.meta(generic);
          39  +
                    /* ClientBuilderInstantiator.kt:56 */output.build()
          40  +
                /* ProtocolParserGenerator.kt:146 */}
          41  +
            /* ProtocolParserGenerator.kt:145 */;
          42  +
            /* ProtocolParserGenerator.kt:170 */
   32     43   
            if tmp.message.is_none() {
   33     44   
                tmp.message = _error_message;
   34     45   
            }
          46  +
            /* ProtocolParserGenerator.kt:179 */
   35     47   
            tmp
          48  +
            /* ProtocolParserGenerator.kt:139 */
   36     49   
        }),
          50  +
        /* ProtocolParserGenerator.kt:139 */
   37     51   
        "ComplexError" => crate::operation::greeting_with_errors::GreetingWithErrorsError::ComplexError({
          52  +
            /* RustType.kt:516 */
   38     53   
            #[allow(unused_mut)]
   39         -
            let mut tmp = {
   40         -
                #[allow(unused_mut)]
   41         -
                let mut output = crate::types::error::builders::ComplexErrorBuilder::default();
   42         -
                output = crate::protocol_serde::shape_complex_error::de_complex_error_json_err(_response_body, output)
   43         -
                    .map_err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
   44         -
                let output = output.meta(generic);
   45         -
                output.build()
   46         -
            };
          54  +
            /* ProtocolParserGenerator.kt:145 */let mut tmp =
          55  +
                /* ProtocolParserGenerator.kt:146 */ {
          56  +
                    /* RustType.kt:516 */#[allow(unused_mut)]
          57  +
                    /* ProtocolParserGenerator.kt:240 */let mut output = crate::types::error::builders::ComplexErrorBuilder::default();
          58  +
                    /* ProtocolParserGenerator.kt:257 */output = crate::protocol_serde::shape_complex_error::de_complex_error_json_err(_response_body, output).map_err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
          59  +
                    /* ProtocolParserGenerator.kt:157 */let output = output.meta(generic);
          60  +
                    /* ClientBuilderInstantiator.kt:56 */output.build()
          61  +
                /* ProtocolParserGenerator.kt:146 */}
          62  +
            /* ProtocolParserGenerator.kt:145 */;
          63  +
            /* ProtocolParserGenerator.kt:170 */
   47     64   
            if tmp.message.is_none() {
   48     65   
                tmp.message = _error_message;
   49     66   
            }
          67  +
            /* ProtocolParserGenerator.kt:179 */
   50     68   
            tmp
          69  +
            /* ProtocolParserGenerator.kt:139 */
   51     70   
        }),
          71  +
        /* ProtocolParserGenerator.kt:139 */
   52     72   
        "FooError" => crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError({
          73  +
            /* RustType.kt:516 */
   53     74   
            #[allow(unused_mut)]
   54         -
            let mut tmp = {
   55         -
                #[allow(unused_mut)]
   56         -
                let mut output = crate::types::error::builders::FooErrorBuilder::default();
   57         -
                output = crate::protocol_serde::shape_foo_error::de_foo_error_json_err(_response_body, output)
   58         -
                    .map_err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
   59         -
                let output = output.meta(generic);
   60         -
                output.build()
   61         -
            };
          75  +
            /* ProtocolParserGenerator.kt:145 */let mut tmp =
          76  +
                /* ProtocolParserGenerator.kt:146 */ {
          77  +
                    /* RustType.kt:516 */#[allow(unused_mut)]
          78  +
                    /* ProtocolParserGenerator.kt:240 */let mut output = crate::types::error::builders::FooErrorBuilder::default();
          79  +
                    /* ProtocolParserGenerator.kt:257 */output = crate::protocol_serde::shape_foo_error::de_foo_error_json_err(_response_body, output).map_err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
          80  +
                    /* ProtocolParserGenerator.kt:157 */let output = output.meta(generic);
          81  +
                    /* ClientBuilderInstantiator.kt:56 */output.build()
          82  +
                /* ProtocolParserGenerator.kt:146 */}
          83  +
            /* ProtocolParserGenerator.kt:145 */;
          84  +
            /* ProtocolParserGenerator.kt:170 */
   62     85   
            if tmp.message.is_none() {
   63     86   
                tmp.message = _error_message;
   64     87   
            }
          88  +
            /* ProtocolParserGenerator.kt:179 */
   65     89   
            tmp
          90  +
            /* ProtocolParserGenerator.kt:139 */
   66     91   
        }),
   67         -
        _ => crate::operation::greeting_with_errors::GreetingWithErrorsError::generic(generic),
          92  +
        /* ProtocolParserGenerator.kt:182 */
          93  +
        _ => crate::operation::greeting_with_errors::GreetingWithErrorsError::generic(generic), /* ProtocolParserGenerator.kt:133 */
   68     94   
    })
          95  +
    /* ProtocolParserGenerator.kt:99 */
   69     96   
}
   70     97   
          98  +
/* RustType.kt:516 */
   71     99   
#[allow(clippy::unnecessary_wraps)]
         100  +
/* ProtocolParserGenerator.kt:71 */
   72    101   
pub fn de_greeting_with_errors_http_response(
   73    102   
    _response_status: u16,
   74    103   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   75    104   
    _response_body: &[u8],
   76    105   
) -> std::result::Result<
   77    106   
    crate::operation::greeting_with_errors::GreetingWithErrorsOutput,
   78    107   
    crate::operation::greeting_with_errors::GreetingWithErrorsError,
   79    108   
> {
         109  +
    /* ProtocolParserGenerator.kt:77 */
   80    110   
    Ok({
         111  +
        /* RustType.kt:516 */
   81    112   
        #[allow(unused_mut)]
         113  +
        /* ProtocolParserGenerator.kt:240 */
   82    114   
        let mut output = crate::operation::greeting_with_errors::builders::GreetingWithErrorsOutputBuilder::default();
         115  +
        /* ProtocolParserGenerator.kt:247 */
   83    116   
        output = crate::protocol_serde::shape_greeting_with_errors::de_greeting_with_errors(_response_body, output)
   84    117   
            .map_err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
         118  +
        /* ClientBuilderInstantiator.kt:56 */
   85    119   
        output.build()
         120  +
        /* ProtocolParserGenerator.kt:77 */
   86    121   
    })
         122  +
    /* ProtocolParserGenerator.kt:71 */
   87    123   
}
   88    124   
         125  +
/* JsonSerializerGenerator.kt:287 */
   89    126   
pub fn ser_greeting_with_errors_input(
   90    127   
    input: &crate::operation::greeting_with_errors::GreetingWithErrorsInput,
   91    128   
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
         129  +
    /* JsonSerializerGenerator.kt:291 */
   92    130   
    let mut out = String::new();
         131  +
    /* JsonSerializerGenerator.kt:292 */
   93    132   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
         133  +
    /* JsonSerializerGenerator.kt:375 */
   94    134   
    crate::protocol_serde::shape_greeting_with_errors_input::ser_greeting_with_errors_input_input(&mut object, input)?;
         135  +
    /* JsonSerializerGenerator.kt:295 */
   95    136   
    object.finish();
         137  +
    /* JsonSerializerGenerator.kt:296 */
   96    138   
    Ok(::aws_smithy_types::body::SdkBody::from(out))
         139  +
    /* JsonSerializerGenerator.kt:287 */
   97    140   
}
   98    141   
         142  +
/* JsonParserGenerator.kt:148 */
   99    143   
pub(crate) fn de_greeting_with_errors(
  100    144   
    value: &[u8],
  101    145   
    mut builder: crate::operation::greeting_with_errors::builders::GreetingWithErrorsOutputBuilder,
  102    146   
) -> ::std::result::Result<
  103    147   
    crate::operation::greeting_with_errors::builders::GreetingWithErrorsOutputBuilder,
  104    148   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  105    149   
> {
         150  +
    /* JsonParserGenerator.kt:153 */
  106    151   
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
  107    152   
    let tokens = &mut tokens_owned;
  108    153   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         154  +
    /* JsonParserGenerator.kt:684 */
  109    155   
    loop {
         156  +
        /* JsonParserGenerator.kt:685 */
  110    157   
        match tokens.next().transpose()? {
  111         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  112         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
  113         -
                "greeting" => {
  114         -
                    builder = builder.set_greeting(
  115         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
  116         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  117         -
                            .transpose()?,
  118         -
                    );
         158  +
            /* JsonParserGenerator.kt:686 */ Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
         159  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         160  +
                /* JsonParserGenerator.kt:260 */
         161  +
                match key.to_unescaped()?.as_ref() {
         162  +
                    /* JsonParserGenerator.kt:262 */
         163  +
                    "greeting" => {
         164  +
                        /* JsonParserGenerator.kt:265 */
         165  +
                        builder = builder.set_greeting(
         166  +
                            /* JsonParserGenerator.kt:354 */
         167  +
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
         168  +
                                .map(|s|
         169  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         170  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         171  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         172  +
                                .transpose()?, /* JsonParserGenerator.kt:265 */
         173  +
                        );
         174  +
                        /* JsonParserGenerator.kt:262 */
         175  +
                    }
         176  +
                    /* JsonParserGenerator.kt:290 */
         177  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  119    178   
                }
  120         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
  121         -
            },
         179  +
                /* JsonParserGenerator.kt:686 */
         180  +
            }
         181  +
            /* JsonParserGenerator.kt:695 */
  122    182   
            other => {
  123    183   
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  124    184   
                    "expected object key or end object, found: {:?}",
  125    185   
                    other
  126    186   
                )))
  127         -
            }
         187  +
            } /* JsonParserGenerator.kt:685 */
  128    188   
        }
         189  +
        /* JsonParserGenerator.kt:684 */
  129    190   
    }
         191  +
    /* JsonParserGenerator.kt:250 */
  130    192   
    if tokens.next().is_some() {
         193  +
        /* JsonParserGenerator.kt:251 */
  131    194   
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
  132    195   
            "found more JSON tokens after completing parsing",
  133    196   
        ));
         197  +
        /* JsonParserGenerator.kt:250 */
  134    198   
    }
         199  +
    /* JsonParserGenerator.kt:163 */
  135    200   
    Ok(builder)
         201  +
    /* JsonParserGenerator.kt:148 */
  136    202   
}

tmp-codegen-diff/codegen-client-test/json_rpc10/rust-client-codegen/src/protocol_serde/shape_greeting_with_errors_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_greeting_with_errors_input_input(
    3      4   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4      5   
    input: &crate::operation::greeting_with_errors::GreetingWithErrorsInput,
    5      6   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           7  +
    /* JsonSerializerGenerator.kt:382 */
    6      8   
    if let Some(var_1) = &input.greeting {
           9  +
        /* JsonSerializerGenerator.kt:423 */
    7     10   
        object.key("greeting").string(var_1.as_str());
          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/json_rpc10/rust-client-codegen/src/protocol_serde/shape_host_with_path_operation.rs

@@ -1,1 +38,56 @@
    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_host_with_path_operation_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::host_with_path_operation::HostWithPathOperationOutput,
    9     11   
    crate::operation::host_with_path_operation::HostWithPathOperationError,
   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::host_with_path_operation::HostWithPathOperationError::unhandled)?;
          18  +
    /* ProtocolParserGenerator.kt:120 */
   14     19   
    let generic = generic_builder.build();
          20  +
    /* ProtocolParserGenerator.kt:185 */
   15     21   
    Err(crate::operation::host_with_path_operation::HostWithPathOperationError::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_host_with_path_operation_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::host_with_path_operation::HostWithPathOperationOutput,
   25     34   
    crate::operation::host_with_path_operation::HostWithPathOperationError,
   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::host_with_path_operation::builders::HostWithPathOperationOutputBuilder::default();
          42  +
        /* ClientBuilderInstantiator.kt:56 */
   30     43   
        output.build()
          44  +
        /* ProtocolParserGenerator.kt:77 */
   31     45   
    })
          46  +
    /* ProtocolParserGenerator.kt:71 */
   32     47   
}
   33     48   
          49  +
/* AwsJson.kt:152 */
   34     50   
pub fn ser_host_with_path_operation_input(
   35     51   
    _input: &crate::operation::host_with_path_operation::HostWithPathOperationInput,
   36     52   
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
          53  +
    /* AwsJson.kt:156 */
   37     54   
    Ok(::aws_smithy_types::body::SdkBody::from("{}"))
          55  +
    /* AwsJson.kt:152 */
   38     56   
}

tmp-codegen-diff/codegen-client-test/json_rpc10/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() {
   13         -
                "Message" => {
   14         -
                    builder = builder.set_message(
   15         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   16         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   17         -
                            .transpose()?,
   18         -
                    );
          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 */
          20  +
                    "Message" => {
          21  +
                        /* JsonParserGenerator.kt:265 */
          22  +
                        builder = builder.set_message(
          23  +
                            /* JsonParserGenerator.kt:354 */
          24  +
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
          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 */
          30  +
                        );
          31  +
                        /* JsonParserGenerator.kt:262 */
          32  +
                    }
          33  +
                    /* JsonParserGenerator.kt:290 */
          34  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   19     35   
                }
   20         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   21         -
            },
          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   
                )))
   27         -
            }
          44  +
            } /* JsonParserGenerator.kt:685 */
   28     45   
        }
          46  +
        /* JsonParserGenerator.kt:684 */
   29     47   
    }
          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/json_rpc10/rust-client-codegen/src/protocol_serde/shape_json_unions.rs

@@ -1,1 +71,116 @@
    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_unions_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_unions::JsonUnionsOutput, crate::operation::json_unions::JsonUnionsError> {
          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_unions::JsonUnionsError::unhandled)?;
          15  +
    /* ProtocolParserGenerator.kt:120 */
   11     16   
    let generic = generic_builder.build();
          17  +
    /* ProtocolParserGenerator.kt:185 */
   12     18   
    Err(crate::operation::json_unions::JsonUnionsError::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_unions_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_unions::JsonUnionsOutput, crate::operation::json_unions::JsonUnionsError> {
          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_unions::builders::JsonUnionsOutputBuilder::default();
          36  +
        /* ProtocolParserGenerator.kt:247 */
   24     37   
        output = crate::protocol_serde::shape_json_unions::de_json_unions(_response_body, output)
   25     38   
            .map_err(crate::operation::json_unions::JsonUnionsError::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_unions_input(
   31     48   
    input: &crate::operation::json_unions::JsonUnionsInput,
   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_unions_input::ser_json_unions_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_unions(
   41     65   
    value: &[u8],
   42     66   
    mut builder: crate::operation::json_unions::builders::JsonUnionsOutputBuilder,
   43     67   
) -> ::std::result::Result<crate::operation::json_unions::builders::JsonUnionsOutputBuilder, ::aws_smithy_json::deserialize::error::DeserializeError>
   44     68   
{
          69  +
    /* JsonParserGenerator.kt:153 */
   45     70   
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
   46     71   
    let tokens = &mut tokens_owned;
   47     72   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
          73  +
    /* JsonParserGenerator.kt:684 */
   48     74   
    loop {
          75  +
        /* JsonParserGenerator.kt:685 */
   49     76   
        match tokens.next().transpose()? {
   50         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   51         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   52         -
                "contents" => {
   53         -
                    builder = builder.set_contents(crate::protocol_serde::shape_my_union::de_my_union(tokens)?);
          77  +
            /* JsonParserGenerator.kt:686 */ Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          78  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          79  +
                /* JsonParserGenerator.kt:260 */
          80  +
                match key.to_unescaped()?.as_ref() {
          81  +
                    /* JsonParserGenerator.kt:262 */
          82  +
                    "contents" => {
          83  +
                        /* JsonParserGenerator.kt:265 */
          84  +
                        builder = builder.set_contents(
          85  +
                            /* JsonParserGenerator.kt:660 */
          86  +
                            crate::protocol_serde::shape_my_union::de_my_union(tokens)?, /* JsonParserGenerator.kt:265 */
          87  +
                        );
          88  +
                        /* JsonParserGenerator.kt:262 */
          89  +
                    }
          90  +
                    /* JsonParserGenerator.kt:290 */
          91  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   54     92   
                }
   55         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   56         -
            },
          93  +
                /* JsonParserGenerator.kt:686 */
          94  +
            }
          95  +
            /* JsonParserGenerator.kt:695 */
   57     96   
            other => {
   58     97   
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   59     98   
                    "expected object key or end object, found: {:?}",
   60     99   
                    other
   61    100   
                )))
   62         -
            }
         101  +
            } /* JsonParserGenerator.kt:685 */
   63    102   
        }
         103  +
        /* JsonParserGenerator.kt:684 */
   64    104   
    }
         105  +
    /* JsonParserGenerator.kt:250 */
   65    106   
    if tokens.next().is_some() {
         107  +
        /* JsonParserGenerator.kt:251 */
   66    108   
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   67    109   
            "found more JSON tokens after completing parsing",
   68    110   
        ));
         111  +
        /* JsonParserGenerator.kt:250 */
   69    112   
    }
         113  +
    /* JsonParserGenerator.kt:163 */
   70    114   
    Ok(builder)
         115  +
    /* JsonParserGenerator.kt:148 */
   71    116   
}

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

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