Server Test

Server Test

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943 (ignoring whitespace)

Files changed:

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

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

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

@@ -1,1 +17,25 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_null_and_empty_headers_server_output_output_output(
    3      4   
    value: &crate::output::NullAndEmptyHeadersServerOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_null_and_empty_headers_server_output::ser_null_and_empty_headers_server_output_output(&mut object, value)?;
          11  +
    /* JsonSerializerGenerator.kt:227 */
    8     12   
    object.finish();
    9     13   
    Ok(out)
          14  +
    /* JsonSerializerGenerator.kt:213 */
   10     15   
}
   11     16   
          17  +
/* JsonSerializerGenerator.kt:358 */
   12     18   
pub fn ser_null_and_empty_headers_server_output_output(
   13     19   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    #[allow(unused_variables)] input: &crate::output::NullAndEmptyHeadersServerOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* JsonSerializerGenerator.kt:372 */
   16     23   
    Ok(())
          24  +
    /* JsonSerializerGenerator.kt:358 */
   17     25   
}

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

@@ -1,1 +71,103 @@
    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  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_omits_null_serializes_empty_string_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::OmitsNullSerializesEmptyStringInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::omits_null_serializes_empty_string_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:1073 */
   22     30   
        let query_string = uri.query().unwrap_or("");
   23     31   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:1099 */
   24     33   
        let mut empty_string_seen = false;
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:1099 */
   25     35   
        let mut null_value_seen = false;
          36  +
        /* ServerHttpBoundProtocolGenerator.kt:1105 */
   26     37   
        for (k, v) in pairs {
          38  +
            /* ServerHttpBoundProtocolGenerator.kt:1109 */
   27     39   
            if !empty_string_seen && k == "Empty" {
   28     40   
                input = input.set_empty_string(
   29     41   
                    crate::protocol_serde::shape_omits_null_serializes_empty_string_input::de_empty_string(&v)?
   30     42   
                );
   31     43   
                empty_string_seen = true;
   32     44   
            }
          45  +
            /* ServerHttpBoundProtocolGenerator.kt:1109 */
   33     46   
            if !null_value_seen && k == "Null" {
   34     47   
                input = input.set_null_value(
   35     48   
                    crate::protocol_serde::shape_omits_null_serializes_empty_string_input::de_null_value(&v)?
   36     49   
                );
   37     50   
                null_value_seen = true;
   38     51   
            }
          52  +
            /* ServerHttpBoundProtocolGenerator.kt:1105 */
   39     53   
        }
          54  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   40     55   
        input.build()
          56  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   41     57   
    })
          58  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   42     59   
}
   43     60   
          61  +
/* RustType.kt:516 */
   44     62   
#[allow(clippy::unnecessary_wraps)]
          63  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   45     64   
pub fn ser_omits_null_serializes_empty_string_http_response(
   46     65   
    #[allow(unused_variables)] output: crate::output::OmitsNullSerializesEmptyStringOutput,
   47     66   
) -> std::result::Result<
   48     67   
    ::aws_smithy_http_server::response::Response,
   49     68   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   50     69   
> {
          70  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   51     71   
    Ok({
          72  +
        /* RustType.kt:516 */
   52     73   
        #[allow(unused_mut)]
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   53     75   
        let mut builder = ::http::Response::builder();
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   54     77   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   55     78   
            builder,
   56     79   
            ::http::header::CONTENT_TYPE,
   57     80   
            "application/json",
   58     81   
        );
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   59     83   
        let http_status: u16 = 200;
   60     84   
        builder = builder.status(http_status);
   61         -
        let payload = "";
          85  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          86  +
        let payload =
          87  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   62     90   
        let content_length = payload.len();
   63     91   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   64     92   
            builder,
   65     93   
            ::http::header::CONTENT_LENGTH,
   66     94   
            content_length,
   67     95   
        );
          96  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   68     97   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          98  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   69     99   
        builder.body(body)?
         100  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   70    101   
    })
         102  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   71    103   
}

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

@@ -1,1 +20,28 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
    2      3   
pub fn de_empty_string(
    3      4   
    value: &str,
    4      5   
) -> std::result::Result<
    5      6   
    ::std::option::Option<::std::string::String>,
    6      7   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    7      8   
> {
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1309 */
    8     10   
    let value = value.to_owned();
          11  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
    9     12   
    Ok(Some(value))
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   10     14   
}
   11     15   
          16  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
   12     17   
pub fn de_null_value(
   13     18   
    value: &str,
   14     19   
) -> std::result::Result<
   15     20   
    ::std::option::Option<::std::string::String>,
   16     21   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
   17     22   
> {
          23  +
    /* ServerHttpBoundProtocolGenerator.kt:1309 */
   18     24   
    let value = value.to_owned();
          25  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   19     26   
    Ok(Some(value))
          27  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   20     28   
}

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

@@ -1,1 +151,295 @@
    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  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_omits_serializing_empty_lists_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::OmitsSerializingEmptyListsInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::omits_serializing_empty_lists_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:1073 */
   22     30   
        let query_string = uri.query().unwrap_or("");
   23     31   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:1102 */
   24     33   
        let mut query_boolean_list = Vec::new();
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:1102 */
   25     35   
        let mut query_double_list = Vec::new();
          36  +
        /* ServerHttpBoundProtocolGenerator.kt:1102 */
   26     37   
        let mut query_enum_list = Vec::new();
          38  +
        /* ServerHttpBoundProtocolGenerator.kt:1102 */
   27     39   
        let mut query_integer_enum_list = Vec::new();
          40  +
        /* ServerHttpBoundProtocolGenerator.kt:1102 */
   28     41   
        let mut query_integer_list = Vec::new();
          42  +
        /* ServerHttpBoundProtocolGenerator.kt:1102 */
   29     43   
        let mut query_string_list = Vec::new();
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:1102 */
   30     45   
        let mut query_timestamp_list = Vec::new();
          46  +
        /* ServerHttpBoundProtocolGenerator.kt:1105 */
   31     47   
        for (k, v) in pairs {
          48  +
            /* ServerHttpBoundProtocolGenerator.kt:1122 */
   32     49   
            if k == "BooleanList" {
          50  +
                /* ServerHttpBoundProtocolGenerator.kt:1159 */
   33     51   
                let v = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(&v)?;
          52  +
                /* ServerHttpBoundProtocolGenerator.kt:1168 */
   34     53   
                query_boolean_list.push(v);
   35         -
            } else if k == "DoubleList" {
          54  +
            /* ServerHttpBoundProtocolGenerator.kt:1122 */
          55  +
            }
          56  +
            /* ServerHttpBoundProtocolGenerator.kt:1122 */
          57  +
            else if k == "DoubleList" {
          58  +
                /* ServerHttpBoundProtocolGenerator.kt:1159 */
   36     59   
                let v = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(&v)?;
          60  +
                /* ServerHttpBoundProtocolGenerator.kt:1168 */
   37     61   
                query_double_list.push(v);
   38         -
            } else if k == "EnumList" {
          62  +
            /* ServerHttpBoundProtocolGenerator.kt:1122 */
          63  +
            }
          64  +
            /* ServerHttpBoundProtocolGenerator.kt:1122 */
          65  +
            else if k == "EnumList" {
          66  +
                /* ServerHttpBoundProtocolGenerator.kt:1134 */
   39     67   
                let v = v.into_owned();
          68  +
                /* ServerHttpBoundProtocolGenerator.kt:1168 */
   40     69   
                query_enum_list.push(v);
   41         -
            } else if k == "IntegerEnumList" {
          70  +
            /* ServerHttpBoundProtocolGenerator.kt:1122 */
          71  +
            }
          72  +
            /* ServerHttpBoundProtocolGenerator.kt:1122 */
          73  +
            else if k == "IntegerEnumList" {
          74  +
                /* ServerHttpBoundProtocolGenerator.kt:1159 */
   42     75   
                let v = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(&v)?;
          76  +
                /* ServerHttpBoundProtocolGenerator.kt:1168 */
   43     77   
                query_integer_enum_list.push(v);
   44         -
            } else if k == "IntegerList" {
          78  +
            /* ServerHttpBoundProtocolGenerator.kt:1122 */
          79  +
            }
          80  +
            /* ServerHttpBoundProtocolGenerator.kt:1122 */
          81  +
            else if k == "IntegerList" {
          82  +
                /* ServerHttpBoundProtocolGenerator.kt:1159 */
   45     83   
                let v = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(&v)?;
          84  +
                /* ServerHttpBoundProtocolGenerator.kt:1168 */
   46     85   
                query_integer_list.push(v);
   47         -
            } else if k == "StringList" {
          86  +
            /* ServerHttpBoundProtocolGenerator.kt:1122 */
          87  +
            }
          88  +
            /* ServerHttpBoundProtocolGenerator.kt:1122 */
          89  +
            else if k == "StringList" {
          90  +
                /* ServerHttpBoundProtocolGenerator.kt:1134 */
   48     91   
                let v = v.into_owned();
          92  +
                /* ServerHttpBoundProtocolGenerator.kt:1168 */
   49     93   
                query_string_list.push(v);
   50         -
            } else if k == "TimestampList" {
   51         -
                let v = ::aws_smithy_types::DateTime::from_str(
   52         -
                    &v,
   53         -
                    ::aws_smithy_types::date_time::Format::DateTime,
   54         -
                )?;
          94  +
            /* ServerHttpBoundProtocolGenerator.kt:1122 */
          95  +
            }
          96  +
            /* ServerHttpBoundProtocolGenerator.kt:1122 */
          97  +
            else if k == "TimestampList" {
          98  +
                /* ServerHttpBoundProtocolGenerator.kt:1146 */
          99  +
                let v = ::aws_smithy_types::DateTime::from_str(&v, ::aws_smithy_types::date_time::Format::DateTime)?
         100  +
                /* ServerHttpBoundProtocolGenerator.kt:1156 */;
         101  +
                /* ServerHttpBoundProtocolGenerator.kt:1168 */
   55    102   
                query_timestamp_list.push(v);
         103  +
                /* ServerHttpBoundProtocolGenerator.kt:1122 */
   56    104   
            }
         105  +
            /* ServerHttpBoundProtocolGenerator.kt:1105 */
   57    106   
        }
         107  +
        /* ServerHttpBoundProtocolGenerator.kt:1228 */
   58    108   
        if !query_boolean_list.is_empty() {
   59         -
            input = input.set_query_boolean_list(Some(query_boolean_list));
         109  +
            /* ServerHttpBoundProtocolGenerator.kt:1229 */
         110  +
            input = input.set_query_boolean_list(
         111  +
                /* ServerHttpBoundProtocolGenerator.kt:1235 */
         112  +
                Some(
         113  +
                    /* ServerHttpBoundProtocolGenerator.kt:1244 */
         114  +
                    query_boolean_list, /* ServerHttpBoundProtocolGenerator.kt:1235 */
         115  +
                ), /* ServerHttpBoundProtocolGenerator.kt:1229 */
         116  +
            );
         117  +
            /* ServerHttpBoundProtocolGenerator.kt:1228 */
   60    118   
        }
         119  +
        /* ServerHttpBoundProtocolGenerator.kt:1228 */
   61    120   
        if !query_double_list.is_empty() {
   62         -
            input = input.set_query_double_list(Some(query_double_list));
         121  +
            /* ServerHttpBoundProtocolGenerator.kt:1229 */
         122  +
            input = input.set_query_double_list(
         123  +
                /* ServerHttpBoundProtocolGenerator.kt:1235 */
         124  +
                Some(
         125  +
                    /* ServerHttpBoundProtocolGenerator.kt:1244 */
         126  +
                    query_double_list, /* ServerHttpBoundProtocolGenerator.kt:1235 */
         127  +
                ), /* ServerHttpBoundProtocolGenerator.kt:1229 */
         128  +
            );
         129  +
            /* ServerHttpBoundProtocolGenerator.kt:1228 */
   63    130   
        }
         131  +
        /* ServerHttpBoundProtocolGenerator.kt:1228 */
   64    132   
        if !query_enum_list.is_empty() {
   65         -
            input = input.set_query_enum_list(Some(
         133  +
            /* ServerHttpBoundProtocolGenerator.kt:1229 */
         134  +
            input = input.set_query_enum_list(
         135  +
                /* ServerHttpBoundProtocolGenerator.kt:1235 */
         136  +
                Some(
         137  +
                    /* ServerHttpBoundProtocolGenerator.kt:1236 */
   66    138   
                    crate::unconstrained::foo_enum_list_unconstrained::FooEnumListUnconstrained(
   67         -
                    query_enum_list,
   68         -
                ),
   69         -
            ));
         139  +
                        /* ServerHttpBoundProtocolGenerator.kt:1244 */
         140  +
                        query_enum_list, /* ServerHttpBoundProtocolGenerator.kt:1236 */
         141  +
                    ), /* ServerHttpBoundProtocolGenerator.kt:1235 */
         142  +
                ), /* ServerHttpBoundProtocolGenerator.kt:1229 */
         143  +
            );
         144  +
            /* ServerHttpBoundProtocolGenerator.kt:1228 */
   70    145   
        }
         146  +
        /* ServerHttpBoundProtocolGenerator.kt:1228 */
   71    147   
        if !query_integer_enum_list.is_empty() {
   72         -
            input = input.set_query_integer_enum_list(Some(query_integer_enum_list));
         148  +
            /* ServerHttpBoundProtocolGenerator.kt:1229 */
         149  +
            input = input.set_query_integer_enum_list(
         150  +
                /* ServerHttpBoundProtocolGenerator.kt:1235 */
         151  +
                Some(
         152  +
                    /* ServerHttpBoundProtocolGenerator.kt:1244 */
         153  +
                    query_integer_enum_list, /* ServerHttpBoundProtocolGenerator.kt:1235 */
         154  +
                ), /* ServerHttpBoundProtocolGenerator.kt:1229 */
         155  +
            );
         156  +
            /* ServerHttpBoundProtocolGenerator.kt:1228 */
   73    157   
        }
         158  +
        /* ServerHttpBoundProtocolGenerator.kt:1228 */
   74    159   
        if !query_integer_list.is_empty() {
   75         -
            input = input.set_query_integer_list(Some(query_integer_list));
         160  +
            /* ServerHttpBoundProtocolGenerator.kt:1229 */
         161  +
            input = input.set_query_integer_list(
         162  +
                /* ServerHttpBoundProtocolGenerator.kt:1235 */
         163  +
                Some(
         164  +
                    /* ServerHttpBoundProtocolGenerator.kt:1244 */
         165  +
                    query_integer_list, /* ServerHttpBoundProtocolGenerator.kt:1235 */
         166  +
                ), /* ServerHttpBoundProtocolGenerator.kt:1229 */
         167  +
            );
         168  +
            /* ServerHttpBoundProtocolGenerator.kt:1228 */
   76    169   
        }
         170  +
        /* ServerHttpBoundProtocolGenerator.kt:1228 */
   77    171   
        if !query_string_list.is_empty() {
   78         -
            input = input.set_query_string_list(Some(query_string_list));
         172  +
            /* ServerHttpBoundProtocolGenerator.kt:1229 */
         173  +
            input = input.set_query_string_list(
         174  +
                /* ServerHttpBoundProtocolGenerator.kt:1235 */
         175  +
                Some(
         176  +
                    /* ServerHttpBoundProtocolGenerator.kt:1244 */
         177  +
                    query_string_list, /* ServerHttpBoundProtocolGenerator.kt:1235 */
         178  +
                ), /* ServerHttpBoundProtocolGenerator.kt:1229 */
         179  +
            );
         180  +
            /* ServerHttpBoundProtocolGenerator.kt:1228 */
   79    181   
        }
         182  +
        /* ServerHttpBoundProtocolGenerator.kt:1228 */
   80    183   
        if !query_timestamp_list.is_empty() {
   81         -
            input = input.set_query_timestamp_list(Some(query_timestamp_list));
         184  +
            /* ServerHttpBoundProtocolGenerator.kt:1229 */
         185  +
            input = input.set_query_timestamp_list(
         186  +
                /* ServerHttpBoundProtocolGenerator.kt:1235 */
         187  +
                Some(
         188  +
                    /* ServerHttpBoundProtocolGenerator.kt:1244 */
         189  +
                    query_timestamp_list, /* ServerHttpBoundProtocolGenerator.kt:1235 */
         190  +
                ), /* ServerHttpBoundProtocolGenerator.kt:1229 */
         191  +
            );
         192  +
            /* ServerHttpBoundProtocolGenerator.kt:1228 */
   82    193   
        }
         194  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   83    195   
        input.build()?
         196  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   84    197   
    })
         198  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   85    199   
}
   86    200   
         201  +
/* RustType.kt:516 */
   87    202   
#[allow(clippy::unnecessary_wraps)]
         203  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   88    204   
pub fn ser_omits_serializing_empty_lists_http_response(
   89    205   
    #[allow(unused_variables)] output: crate::output::OmitsSerializingEmptyListsOutput,
   90    206   
) -> std::result::Result<
   91    207   
    ::aws_smithy_http_server::response::Response,
   92    208   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   93    209   
> {
         210  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   94    211   
    Ok({
         212  +
        /* RustType.kt:516 */
   95    213   
        #[allow(unused_mut)]
         214  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   96    215   
        let mut builder = ::http::Response::builder();
         216  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   97    217   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   98    218   
            builder,
   99    219   
            ::http::header::CONTENT_TYPE,
  100    220   
            "application/json",
  101    221   
        );
         222  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
  102    223   
        let http_status: u16 = 200;
  103    224   
        builder = builder.status(http_status);
  104         -
        let payload = "";
         225  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
         226  +
        let payload =
         227  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
         228  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
         229  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
  105    230   
        let content_length = payload.len();
  106    231   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
  107    232   
            builder,
  108    233   
            ::http::header::CONTENT_LENGTH,
  109    234   
            content_length,
  110    235   
        );
         236  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
  111    237   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
         238  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
  112    239   
        builder.body(body)?
         240  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
  113    241   
    })
         242  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
  114    243   
}
  115    244   
         245  +
/* RustType.kt:516 */
  116    246   
#[allow(clippy::unnecessary_wraps)]
         247  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
  117    248   
pub fn ser_omits_serializing_empty_lists_http_error(
  118    249   
    error: &crate::error::OmitsSerializingEmptyListsError,
  119    250   
) -> std::result::Result<
  120    251   
    ::aws_smithy_http_server::response::Response,
  121    252   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
  122    253   
> {
         254  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
  123    255   
    Ok({
         256  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
  124    257   
        match error {
         258  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  125    259   
            crate::error::OmitsSerializingEmptyListsError::ValidationException(output) => {
         260  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  126    261   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         262  +
                /* RustType.kt:516 */
  127    263   
                #[allow(unused_mut)]
         264  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  128    265   
                let mut builder = ::http::Response::builder();
         266  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  129    267   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  130    268   
                    builder,
  131    269   
                    ::http::header::CONTENT_TYPE,
  132    270   
                    "application/json",
  133    271   
                );
         272  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  134    273   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  135    274   
                    builder,
  136    275   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  137    276   
                    "ValidationException",
  138    277   
                );
         278  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  139    279   
                let content_length = payload.len();
  140    280   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  141    281   
                    builder,
  142    282   
                    ::http::header::CONTENT_LENGTH,
  143    283   
                    content_length,
  144    284   
                );
         285  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  145    286   
                builder
  146    287   
                    .status(400)
  147    288   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         289  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         290  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  148    291   
        }
  149         -
        }
         292  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  150    293   
    })
         294  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  151    295   
}

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

@@ -1,1 +176,252 @@
    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  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_operation_with_defaults_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::OperationWithDefaultsInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::operation_with_defaults_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input =
   29     39   
                crate::protocol_serde::shape_operation_with_defaults::de_operation_with_defaults(
   30     40   
                    bytes.as_ref(),
   31     41   
                    input,
   32     42   
                )?;
          43  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   33     44   
        }
          45  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   34     46   
        input.build()?
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   35     48   
    })
          49  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   36     50   
}
   37     51   
          52  +
/* RustType.kt:516 */
   38     53   
#[allow(clippy::unnecessary_wraps)]
          54  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   39     55   
pub fn ser_operation_with_defaults_http_response(
   40     56   
    #[allow(unused_variables)] output: crate::output::OperationWithDefaultsOutput,
   41     57   
) -> std::result::Result<
   42     58   
    ::aws_smithy_http_server::response::Response,
   43     59   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   44     60   
> {
          61  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   45     62   
    Ok({
          63  +
        /* RustType.kt:516 */
   46     64   
        #[allow(unused_mut)]
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   47     66   
        let mut builder = ::http::Response::builder();
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   48     68   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   49     69   
            builder,
   50     70   
            ::http::header::CONTENT_TYPE,
   51     71   
            "application/json",
   52     72   
        );
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   53     74   
        let http_status: u16 = 200;
   54     75   
        builder = builder.status(http_status);
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   55     77   
        let payload =
   56         -
            crate::protocol_serde::shape_operation_with_defaults_output::ser_operation_with_defaults_output_output_output(&output)?
   57         -
        ;
          78  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_operation_with_defaults_output::ser_operation_with_defaults_output_output_output(&output)?
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   58     81   
        let content_length = payload.len();
   59     82   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   60     83   
            builder,
   61     84   
            ::http::header::CONTENT_LENGTH,
   62     85   
            content_length,
   63     86   
        );
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   64     88   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   65     90   
        builder.body(body)?
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   66     92   
    })
          93  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   67     94   
}
   68     95   
          96  +
/* RustType.kt:516 */
   69     97   
#[allow(clippy::unnecessary_wraps)]
          98  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   70     99   
pub fn ser_operation_with_defaults_http_error(
   71    100   
    error: &crate::error::OperationWithDefaultsError,
   72    101   
) -> std::result::Result<
   73    102   
    ::aws_smithy_http_server::response::Response,
   74    103   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   75    104   
> {
         105  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   76    106   
    Ok({
         107  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   77    108   
        match error {
         109  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   78    110   
            crate::error::OperationWithDefaultsError::ValidationException(output) => {
         111  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   79    112   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         113  +
                /* RustType.kt:516 */
   80    114   
                #[allow(unused_mut)]
         115  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   81    116   
                let mut builder = ::http::Response::builder();
         117  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   82    118   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   83    119   
                    builder,
   84    120   
                    ::http::header::CONTENT_TYPE,
   85    121   
                    "application/json",
   86    122   
                );
         123  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   87    124   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   88    125   
                    builder,
   89    126   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   90    127   
                    "ValidationException",
   91    128   
                );
         129  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   92    130   
                let content_length = payload.len();
   93    131   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   94    132   
                    builder,
   95    133   
                    ::http::header::CONTENT_LENGTH,
   96    134   
                    content_length,
   97    135   
                );
         136  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   98    137   
                builder
   99    138   
                    .status(400)
  100    139   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         140  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         141  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  101    142   
        }
  102         -
        }
         143  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  103    144   
    })
         145  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  104    146   
}
  105    147   
         148  +
/* JsonParserGenerator.kt:148 */
  106    149   
pub(crate) fn de_operation_with_defaults(
  107    150   
    value: &[u8],
  108    151   
    mut builder: crate::input::operation_with_defaults_input::Builder,
  109    152   
) -> ::std::result::Result<
  110    153   
    crate::input::operation_with_defaults_input::Builder,
  111    154   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  112    155   
> {
         156  +
    /* JsonParserGenerator.kt:153 */
  113    157   
    let mut tokens_owned =
  114    158   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  115    159   
            .peekable();
  116    160   
    let tokens = &mut tokens_owned;
  117    161   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         162  +
    /* JsonParserGenerator.kt:684 */
  118    163   
    loop {
         164  +
        /* JsonParserGenerator.kt:685 */
  119    165   
        match tokens.next().transpose()? {
         166  +
            /* JsonParserGenerator.kt:686 */
  120    167   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  121    168   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         169  +
                /* JsonParserGenerator.kt:260 */
  122    170   
                match key.to_unescaped()?.as_ref() {
         171  +
                    /* JsonParserGenerator.kt:262 */
  123    172   
                    "clientOptionalDefaults" => {
         173  +
                        /* JsonParserGenerator.kt:272 */
  124    174   
                        builder = builder.set_client_optional_defaults(
  125         -
                            crate::protocol_serde::shape_client_optional_defaults::de_client_optional_defaults(tokens)?
  126         -
                        );
         175  +
                            /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_client_optional_defaults::de_client_optional_defaults(tokens)?
         176  +
                        /* JsonParserGenerator.kt:272 */);
         177  +
                        /* JsonParserGenerator.kt:262 */
  127    178   
                    }
         179  +
                    /* JsonParserGenerator.kt:262 */
  128    180   
                    "defaults" => {
         181  +
                        /* JsonParserGenerator.kt:272 */
  129    182   
                        builder = builder.set_defaults(
  130         -
                            crate::protocol_serde::shape_defaults::de_defaults(tokens)?,
  131         -
                        );
         183  +
                            /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_defaults::de_defaults(tokens)?
         184  +
                        /* JsonParserGenerator.kt:272 */);
         185  +
                        /* JsonParserGenerator.kt:262 */
  132    186   
                    }
         187  +
                    /* JsonParserGenerator.kt:262 */
  133    188   
                    "otherTopLevelDefault" => {
         189  +
                        /* JsonParserGenerator.kt:276 */
  134    190   
                        if let Some(v) =
         191  +
                            /* JsonParserGenerator.kt:365 */
  135    192   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
  136    193   
                                    tokens.next(),
  137    194   
                                )?
  138    195   
                                .map(i32::try_from)
  139    196   
                                .transpose()?
         197  +
                        /* JsonParserGenerator.kt:278 */
  140    198   
                        {
  141    199   
                            builder = builder.set_other_top_level_default(v);
  142    200   
                        }
         201  +
                        /* JsonParserGenerator.kt:262 */
  143    202   
                    }
         203  +
                    /* JsonParserGenerator.kt:262 */
  144    204   
                    "topLevelDefault" => {
         205  +
                        /* JsonParserGenerator.kt:276 */
  145    206   
                        if let Some(v) =
         207  +
                            /* JsonParserGenerator.kt:354 */
  146    208   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
  147    209   
                                    tokens.next(),
  148    210   
                                )?
  149         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
         211  +
                                .map(|s|
         212  +
                            /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         213  +
                                /* JsonParserGenerator.kt:348 */u.into_owned()
         214  +
                            /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
  150    215   
                                .transpose()?
         216  +
                        /* JsonParserGenerator.kt:278 */
  151    217   
                        {
  152    218   
                            builder = builder.set_top_level_default(v);
  153    219   
                        }
         220  +
                        /* JsonParserGenerator.kt:262 */
  154    221   
                    }
  155         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         222  +
                    /* JsonParserGenerator.kt:290 */
         223  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  156    224   
                }
         225  +
                /* JsonParserGenerator.kt:686 */
  157    226   
            }
         227  +
            /* JsonParserGenerator.kt:695 */
  158    228   
            other => {
  159    229   
                return Err(
  160    230   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  161    231   
                        "expected object key or end object, found: {:?}",
  162    232   
                        other
  163    233   
                    )),
  164    234   
                )
         235  +
            } /* JsonParserGenerator.kt:685 */
  165    236   
        }
         237  +
        /* JsonParserGenerator.kt:684 */
  166    238   
    }
  167         -
    }
         239  +
    /* JsonParserGenerator.kt:250 */
  168    240   
    if tokens.next().is_some() {
         241  +
        /* JsonParserGenerator.kt:251 */
  169    242   
        return Err(
  170    243   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  171    244   
                "found more JSON tokens after completing parsing",
  172    245   
            ),
  173    246   
        );
         247  +
        /* JsonParserGenerator.kt:250 */
  174    248   
    }
         249  +
    /* JsonParserGenerator.kt:163 */
  175    250   
    Ok(builder)
         251  +
    /* JsonParserGenerator.kt:148 */
  176    252   
}

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

@@ -1,1 +174,279 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_operation_with_defaults_output_output_output(
    3      4   
    value: &crate::output::OperationWithDefaultsOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_operation_with_defaults_output::ser_operation_with_defaults_output_output(&mut object, value)?;
          11  +
    /* JsonSerializerGenerator.kt:227 */
    8     12   
    object.finish();
    9     13   
    Ok(out)
          14  +
    /* JsonSerializerGenerator.kt:213 */
   10     15   
}
   11     16   
          17  +
/* JsonSerializerGenerator.kt:358 */
   12     18   
pub fn ser_operation_with_defaults_output_output(
   13     19   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    input: &crate::output::OperationWithDefaultsOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* SerializerUtil.kt:46 */
   16     23   
    {
          24  +
        /* JsonSerializerGenerator.kt:439 */
   17     25   
        object
   18     26   
            .key("defaultBlob")
   19     27   
            .string_unchecked(&::aws_smithy_types::base64::encode(&input.default_blob));
          28  +
        /* SerializerUtil.kt:46 */
   20     29   
    }
          30  +
    /* SerializerUtil.kt:46 */
   21     31   
    {
          32  +
        /* JsonSerializerGenerator.kt:424 */
   22     33   
        object.key("defaultBoolean").boolean(input.default_boolean);
          34  +
        /* SerializerUtil.kt:46 */
   23     35   
    }
          36  +
    /* SerializerUtil.kt:46 */
   24     37   
    {
          38  +
        /* JsonSerializerGenerator.kt:432 */
   25     39   
        object.key("defaultByte").number(
   26     40   
            #[allow(clippy::useless_conversion)]
   27     41   
            ::aws_smithy_types::Number::NegInt((input.default_byte).into()),
   28     42   
        );
          43  +
        /* SerializerUtil.kt:46 */
   29     44   
    }
          45  +
    /* SerializerUtil.kt:46 */
   30     46   
    {
          47  +
        /* JsonSerializerGenerator.kt:474 */
   31     48   
        object
   32     49   
            .key("defaultDocumentBoolean")
   33     50   
            .document(&input.default_document_boolean);
          51  +
        /* SerializerUtil.kt:46 */
   34     52   
    }
          53  +
    /* SerializerUtil.kt:46 */
   35     54   
    {
          55  +
        /* JsonSerializerGenerator.kt:474 */
   36     56   
        object
   37     57   
            .key("defaultDocumentList")
   38     58   
            .document(&input.default_document_list);
          59  +
        /* SerializerUtil.kt:46 */
   39     60   
    }
          61  +
    /* SerializerUtil.kt:46 */
   40     62   
    {
          63  +
        /* JsonSerializerGenerator.kt:474 */
   41     64   
        object
   42     65   
            .key("defaultDocumentMap")
   43     66   
            .document(&input.default_document_map);
          67  +
        /* SerializerUtil.kt:46 */
   44     68   
    }
          69  +
    /* SerializerUtil.kt:46 */
   45     70   
    {
          71  +
        /* JsonSerializerGenerator.kt:474 */
   46     72   
        object
   47     73   
            .key("defaultDocumentString")
   48     74   
            .document(&input.default_document_string);
          75  +
        /* SerializerUtil.kt:46 */
   49     76   
    }
          77  +
    /* SerializerUtil.kt:46 */
   50     78   
    {
          79  +
        /* JsonSerializerGenerator.kt:432 */
   51     80   
        object.key("defaultDouble").number(
   52     81   
            #[allow(clippy::useless_conversion)]
   53     82   
            ::aws_smithy_types::Number::Float((input.default_double).into()),
   54     83   
        );
          84  +
        /* SerializerUtil.kt:46 */
   55     85   
    }
          86  +
    /* SerializerUtil.kt:46 */
   56     87   
    {
          88  +
        /* JsonSerializerGenerator.kt:423 */
   57     89   
        object
   58     90   
            .key("defaultEnum")
   59     91   
            .string(input.default_enum.as_str());
          92  +
        /* SerializerUtil.kt:46 */
   60     93   
    }
          94  +
    /* SerializerUtil.kt:46 */
   61     95   
    {
          96  +
        /* JsonSerializerGenerator.kt:432 */
   62     97   
        object.key("defaultFloat").number(
   63     98   
            #[allow(clippy::useless_conversion)]
   64     99   
            ::aws_smithy_types::Number::Float((input.default_float).into()),
   65    100   
        );
         101  +
        /* SerializerUtil.kt:46 */
   66    102   
    }
         103  +
    /* SerializerUtil.kt:46 */
   67    104   
    {
         105  +
        /* JsonSerializerGenerator.kt:432 */
   68    106   
        object.key("defaultIntEnum").number(
   69    107   
            #[allow(clippy::useless_conversion)]
   70    108   
            ::aws_smithy_types::Number::NegInt((input.default_int_enum).into()),
   71    109   
        );
         110  +
        /* SerializerUtil.kt:46 */
   72    111   
    }
         112  +
    /* SerializerUtil.kt:46 */
   73    113   
    {
         114  +
        /* JsonSerializerGenerator.kt:432 */
   74    115   
        object.key("defaultInteger").number(
   75    116   
            #[allow(clippy::useless_conversion)]
   76    117   
            ::aws_smithy_types::Number::NegInt((input.default_integer).into()),
   77    118   
        );
         119  +
        /* SerializerUtil.kt:46 */
   78    120   
    }
         121  +
    /* SerializerUtil.kt:46 */
   79    122   
    {
         123  +
        /* JsonSerializerGenerator.kt:484 */
   80    124   
        let mut array_1 = object.key("defaultList").start_array();
         125  +
        /* JsonSerializerGenerator.kt:524 */
   81    126   
        for item_2 in &input.default_list {
         127  +
            /* SerializerUtil.kt:42 */
   82    128   
            {
         129  +
                /* JsonSerializerGenerator.kt:423 */
   83    130   
                array_1.value().string(item_2.as_str());
         131  +
                /* SerializerUtil.kt:42 */
   84    132   
            }
         133  +
            /* JsonSerializerGenerator.kt:524 */
   85    134   
        }
         135  +
        /* JsonSerializerGenerator.kt:486 */
   86    136   
        array_1.finish();
         137  +
        /* SerializerUtil.kt:46 */
   87    138   
    }
         139  +
    /* SerializerUtil.kt:46 */
   88    140   
    {
         141  +
        /* JsonSerializerGenerator.kt:432 */
   89    142   
        object.key("defaultLong").number(
   90    143   
            #[allow(clippy::useless_conversion)]
   91    144   
            ::aws_smithy_types::Number::NegInt((input.default_long).into()),
   92    145   
        );
         146  +
        /* SerializerUtil.kt:46 */
   93    147   
    }
         148  +
    /* SerializerUtil.kt:46 */
   94    149   
    {
         150  +
        /* JsonSerializerGenerator.kt:495 */
   95    151   
        #[allow(unused_mut)]
         152  +
        /* JsonSerializerGenerator.kt:496 */
   96    153   
        let mut object_3 = object.key("defaultMap").start_object();
         154  +
        /* JsonSerializerGenerator.kt:537 */
   97    155   
        for (key_4, value_5) in &input.default_map {
         156  +
            /* SerializerUtil.kt:42 */
   98    157   
            {
         158  +
                /* JsonSerializerGenerator.kt:423 */
   99    159   
                object_3.key(key_4.as_str()).string(value_5.as_str());
         160  +
                /* SerializerUtil.kt:42 */
  100    161   
            }
         162  +
            /* JsonSerializerGenerator.kt:537 */
  101    163   
        }
         164  +
        /* JsonSerializerGenerator.kt:515 */
  102    165   
        object_3.finish();
         166  +
        /* SerializerUtil.kt:46 */
  103    167   
    }
         168  +
    /* JsonSerializerGenerator.kt:382 */
  104    169   
    if let Some(var_6) = &input.default_null_document {
         170  +
        /* JsonSerializerGenerator.kt:474 */
  105    171   
        object.key("defaultNullDocument").document(var_6);
         172  +
        /* JsonSerializerGenerator.kt:382 */
  106    173   
    }
         174  +
    /* SerializerUtil.kt:46 */
  107    175   
    {
         176  +
        /* JsonSerializerGenerator.kt:432 */
  108    177   
        object.key("defaultShort").number(
  109    178   
            #[allow(clippy::useless_conversion)]
  110    179   
            ::aws_smithy_types::Number::NegInt((input.default_short).into()),
  111    180   
        );
         181  +
        /* SerializerUtil.kt:46 */
  112    182   
    }
         183  +
    /* SerializerUtil.kt:46 */
  113    184   
    {
         185  +
        /* JsonSerializerGenerator.kt:423 */
  114    186   
        object
  115    187   
            .key("defaultString")
  116    188   
            .string(input.default_string.as_str());
         189  +
        /* SerializerUtil.kt:46 */
  117    190   
    }
         191  +
    /* SerializerUtil.kt:46 */
  118    192   
    {
         193  +
        /* JsonSerializerGenerator.kt:448 */
  119    194   
        object.key("defaultTimestamp").date_time(
  120    195   
            &input.default_timestamp,
  121    196   
            ::aws_smithy_types::date_time::Format::EpochSeconds,
  122    197   
        )?;
         198  +
        /* SerializerUtil.kt:46 */
  123    199   
    }
         200  +
    /* SerializerUtil.kt:46 */
  124    201   
    {
         202  +
        /* JsonSerializerGenerator.kt:439 */
  125    203   
        object
  126    204   
            .key("emptyBlob")
  127    205   
            .string_unchecked(&::aws_smithy_types::base64::encode(&input.empty_blob));
         206  +
        /* SerializerUtil.kt:46 */
  128    207   
    }
         208  +
    /* SerializerUtil.kt:46 */
  129    209   
    {
         210  +
        /* JsonSerializerGenerator.kt:423 */
  130    211   
        object
  131    212   
            .key("emptyString")
  132    213   
            .string(input.empty_string.as_str());
         214  +
        /* SerializerUtil.kt:46 */
  133    215   
    }
         216  +
    /* SerializerUtil.kt:46 */
  134    217   
    {
         218  +
        /* JsonSerializerGenerator.kt:424 */
  135    219   
        object.key("falseBoolean").boolean(input.false_boolean);
         220  +
        /* SerializerUtil.kt:46 */
  136    221   
    }
         222  +
    /* SerializerUtil.kt:46 */
  137    223   
    {
         224  +
        /* JsonSerializerGenerator.kt:432 */
  138    225   
        object.key("zeroByte").number(
  139    226   
            #[allow(clippy::useless_conversion)]
  140    227   
            ::aws_smithy_types::Number::NegInt((input.zero_byte).into()),
  141    228   
        );
         229  +
        /* SerializerUtil.kt:46 */
  142    230   
    }
         231  +
    /* SerializerUtil.kt:46 */
  143    232   
    {
         233  +
        /* JsonSerializerGenerator.kt:432 */
  144    234   
        object.key("zeroDouble").number(
  145    235   
            #[allow(clippy::useless_conversion)]
  146    236   
            ::aws_smithy_types::Number::Float((input.zero_double).into()),
  147    237   
        );
         238  +
        /* SerializerUtil.kt:46 */
  148    239   
    }
         240  +
    /* SerializerUtil.kt:46 */
  149    241   
    {
         242  +
        /* JsonSerializerGenerator.kt:432 */
  150    243   
        object.key("zeroFloat").number(
  151    244   
            #[allow(clippy::useless_conversion)]
  152    245   
            ::aws_smithy_types::Number::Float((input.zero_float).into()),
  153    246   
        );
         247  +
        /* SerializerUtil.kt:46 */
  154    248   
    }
         249  +
    /* SerializerUtil.kt:46 */
  155    250   
    {
         251  +
        /* JsonSerializerGenerator.kt:432 */
  156    252   
        object.key("zeroInteger").number(
  157    253   
            #[allow(clippy::useless_conversion)]
  158    254   
            ::aws_smithy_types::Number::NegInt((input.zero_integer).into()),
  159    255   
        );
         256  +
        /* SerializerUtil.kt:46 */
  160    257   
    }
         258  +
    /* SerializerUtil.kt:46 */
  161    259   
    {
         260  +
        /* JsonSerializerGenerator.kt:432 */
  162    261   
        object.key("zeroLong").number(
  163    262   
            #[allow(clippy::useless_conversion)]
  164    263   
            ::aws_smithy_types::Number::NegInt((input.zero_long).into()),
  165    264   
        );
         265  +
        /* SerializerUtil.kt:46 */
  166    266   
    }
         267  +
    /* SerializerUtil.kt:46 */
  167    268   
    {
         269  +
        /* JsonSerializerGenerator.kt:432 */
  168    270   
        object.key("zeroShort").number(
  169    271   
            #[allow(clippy::useless_conversion)]
  170    272   
            ::aws_smithy_types::Number::NegInt((input.zero_short).into()),
  171    273   
        );
         274  +
        /* SerializerUtil.kt:46 */
  172    275   
    }
         276  +
    /* JsonSerializerGenerator.kt:372 */
  173    277   
    Ok(())
         278  +
    /* JsonSerializerGenerator.kt:358 */
  174    279   
}

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

@@ -1,1 +147,209 @@
    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  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_operation_with_nested_structure_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::OperationWithNestedStructureInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::operation_with_nested_structure_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_operation_with_nested_structure::de_operation_with_nested_structure(bytes.as_ref(), input)?;
          39  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   29     40   
        }
          41  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   30     42   
        input.build()?
          43  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   31     44   
    })
          45  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   32     46   
}
   33     47   
          48  +
/* RustType.kt:516 */
   34     49   
#[allow(clippy::unnecessary_wraps)]
          50  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   35     51   
pub fn ser_operation_with_nested_structure_http_response(
   36     52   
    #[allow(unused_variables)] output: crate::output::OperationWithNestedStructureOutput,
   37     53   
) -> std::result::Result<
   38     54   
    ::aws_smithy_http_server::response::Response,
   39     55   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   40     56   
> {
          57  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   41     58   
    Ok({
          59  +
        /* RustType.kt:516 */
   42     60   
        #[allow(unused_mut)]
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   43     62   
        let mut builder = ::http::Response::builder();
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   44     64   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   45     65   
            builder,
   46     66   
            ::http::header::CONTENT_TYPE,
   47     67   
            "application/json",
   48     68   
        );
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   49     70   
        let http_status: u16 = 200;
   50     71   
        builder = builder.status(http_status);
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   51     73   
        let payload =
   52         -
            crate::protocol_serde::shape_operation_with_nested_structure_output::ser_operation_with_nested_structure_output_output_output(&output)?
   53         -
        ;
          74  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_operation_with_nested_structure_output::ser_operation_with_nested_structure_output_output_output(&output)?
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   54     77   
        let content_length = payload.len();
   55     78   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   56     79   
            builder,
   57     80   
            ::http::header::CONTENT_LENGTH,
   58     81   
            content_length,
   59     82   
        );
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   60     84   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          85  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   61     86   
        builder.body(body)?
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   62     88   
    })
          89  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   63     90   
}
   64     91   
          92  +
/* RustType.kt:516 */
   65     93   
#[allow(clippy::unnecessary_wraps)]
          94  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   66     95   
pub fn ser_operation_with_nested_structure_http_error(
   67     96   
    error: &crate::error::OperationWithNestedStructureError,
   68     97   
) -> std::result::Result<
   69     98   
    ::aws_smithy_http_server::response::Response,
   70     99   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   71    100   
> {
         101  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   72    102   
    Ok({
         103  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   73    104   
        match error {
         105  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   74    106   
            crate::error::OperationWithNestedStructureError::ValidationException(output) => {
         107  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   75    108   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         109  +
                /* RustType.kt:516 */
   76    110   
                #[allow(unused_mut)]
         111  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   77    112   
                let mut builder = ::http::Response::builder();
         113  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   78    114   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   79    115   
                    builder,
   80    116   
                    ::http::header::CONTENT_TYPE,
   81    117   
                    "application/json",
   82    118   
                );
         119  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   83    120   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   84    121   
                    builder,
   85    122   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   86    123   
                    "ValidationException",
   87    124   
                );
         125  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   88    126   
                let content_length = payload.len();
   89    127   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   90    128   
                    builder,
   91    129   
                    ::http::header::CONTENT_LENGTH,
   92    130   
                    content_length,
   93    131   
                );
         132  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   94    133   
                builder
   95    134   
                    .status(400)
   96    135   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         136  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         137  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   97    138   
        }
   98         -
        }
         139  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   99    140   
    })
         141  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  100    142   
}
  101    143   
         144  +
/* JsonParserGenerator.kt:148 */
  102    145   
pub(crate) fn de_operation_with_nested_structure(
  103    146   
    value: &[u8],
  104    147   
    mut builder: crate::input::operation_with_nested_structure_input::Builder,
  105    148   
) -> ::std::result::Result<
  106    149   
    crate::input::operation_with_nested_structure_input::Builder,
  107    150   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  108    151   
> {
         152  +
    /* JsonParserGenerator.kt:153 */
  109    153   
    let mut tokens_owned =
  110    154   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  111    155   
            .peekable();
  112    156   
    let tokens = &mut tokens_owned;
  113    157   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         158  +
    /* JsonParserGenerator.kt:684 */
  114    159   
    loop {
         160  +
        /* JsonParserGenerator.kt:685 */
  115    161   
        match tokens.next().transpose()? {
         162  +
            /* JsonParserGenerator.kt:686 */
  116    163   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  117    164   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         165  +
                /* JsonParserGenerator.kt:260 */
  118    166   
                match key.to_unescaped()?.as_ref() {
         167  +
                    /* JsonParserGenerator.kt:262 */
  119    168   
                    "topLevel" => {
         169  +
                        /* JsonParserGenerator.kt:276 */
  120    170   
                        if let Some(v) =
         171  +
                            /* JsonParserGenerator.kt:544 */
  121    172   
                            crate::protocol_serde::shape_top_level::de_top_level(tokens)?
         173  +
                        /* JsonParserGenerator.kt:278 */
  122    174   
                        {
  123    175   
                            builder = builder.set_top_level(v);
  124    176   
                        }
         177  +
                        /* JsonParserGenerator.kt:262 */
  125    178   
                    }
  126         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         179  +
                    /* JsonParserGenerator.kt:290 */
         180  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  127    181   
                }
         182  +
                /* JsonParserGenerator.kt:686 */
  128    183   
            }
         184  +
            /* JsonParserGenerator.kt:695 */
  129    185   
            other => {
  130    186   
                return Err(
  131    187   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  132    188   
                        "expected object key or end object, found: {:?}",
  133    189   
                        other
  134    190   
                    )),
  135    191   
                )
         192  +
            } /* JsonParserGenerator.kt:685 */
  136    193   
        }
         194  +
        /* JsonParserGenerator.kt:684 */
  137    195   
    }
  138         -
    }
         196  +
    /* JsonParserGenerator.kt:250 */
  139    197   
    if tokens.next().is_some() {
         198  +
        /* JsonParserGenerator.kt:251 */
  140    199   
        return Err(
  141    200   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  142    201   
                "found more JSON tokens after completing parsing",
  143    202   
            ),
  144    203   
        );
         204  +
        /* JsonParserGenerator.kt:250 */
  145    205   
    }
         206  +
    /* JsonParserGenerator.kt:163 */
  146    207   
    Ok(builder)
         208  +
    /* JsonParserGenerator.kt:148 */
  147    209   
}

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

@@ -1,1 +48,87 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_operation_with_nested_structure_output_output_output(
    3      4   
    value: &crate::output::OperationWithNestedStructureOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_operation_with_nested_structure_output::ser_operation_with_nested_structure_output_output(&mut object, value)?;
          11  +
    /* JsonSerializerGenerator.kt:227 */
    8     12   
    object.finish();
    9     13   
    Ok(out)
          14  +
    /* JsonSerializerGenerator.kt:213 */
   10     15   
}
   11     16   
          17  +
/* JsonSerializerGenerator.kt:358 */
   12     18   
pub fn ser_operation_with_nested_structure_output_output(
   13     19   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    input: &crate::output::OperationWithNestedStructureOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* SerializerUtil.kt:42 */
   16     23   
    {
          24  +
        /* JsonSerializerGenerator.kt:495 */
   17     25   
        #[allow(unused_mut)]
          26  +
        /* JsonSerializerGenerator.kt:496 */
   18     27   
        let mut object_1 = object.key("dialog").start_object();
          28  +
        /* JsonSerializerGenerator.kt:375 */
   19     29   
        crate::protocol_serde::shape_dialog::ser_dialog(&mut object_1, &input.dialog)?;
          30  +
        /* JsonSerializerGenerator.kt:515 */
   20     31   
        object_1.finish();
          32  +
        /* SerializerUtil.kt:42 */
   21     33   
    }
          34  +
    /* SerializerUtil.kt:46 */
   22     35   
    {
          36  +
        /* JsonSerializerGenerator.kt:484 */
   23     37   
        let mut array_2 = object.key("dialogList").start_array();
          38  +
        /* JsonSerializerGenerator.kt:524 */
   24     39   
        for item_3 in &input.dialog_list {
          40  +
            /* SerializerUtil.kt:42 */
   25     41   
            {
          42  +
                /* JsonSerializerGenerator.kt:495 */
   26     43   
                #[allow(unused_mut)]
          44  +
                /* JsonSerializerGenerator.kt:496 */
   27     45   
                let mut object_4 = array_2.value().start_object();
          46  +
                /* JsonSerializerGenerator.kt:375 */
   28     47   
                crate::protocol_serde::shape_dialog::ser_dialog(&mut object_4, item_3)?;
          48  +
                /* JsonSerializerGenerator.kt:515 */
   29     49   
                object_4.finish();
          50  +
                /* SerializerUtil.kt:42 */
   30     51   
            }
          52  +
            /* JsonSerializerGenerator.kt:524 */
   31     53   
        }
          54  +
        /* JsonSerializerGenerator.kt:486 */
   32     55   
        array_2.finish();
          56  +
        /* SerializerUtil.kt:46 */
   33     57   
    }
          58  +
    /* SerializerUtil.kt:46 */
   34     59   
    {
          60  +
        /* JsonSerializerGenerator.kt:495 */
   35     61   
        #[allow(unused_mut)]
          62  +
        /* JsonSerializerGenerator.kt:496 */
   36     63   
        let mut object_5 = object.key("dialogMap").start_object();
          64  +
        /* JsonSerializerGenerator.kt:537 */
   37     65   
        for (key_6, value_7) in &input.dialog_map {
          66  +
            /* SerializerUtil.kt:42 */
   38     67   
            {
          68  +
                /* JsonSerializerGenerator.kt:495 */
   39     69   
                #[allow(unused_mut)]
          70  +
                /* JsonSerializerGenerator.kt:496 */
   40     71   
                let mut object_8 = object_5.key(key_6.as_str()).start_object();
          72  +
                /* JsonSerializerGenerator.kt:375 */
   41     73   
                crate::protocol_serde::shape_dialog::ser_dialog(&mut object_8, value_7)?;
          74  +
                /* JsonSerializerGenerator.kt:515 */
   42     75   
                object_8.finish();
          76  +
                /* SerializerUtil.kt:42 */
   43     77   
            }
          78  +
            /* JsonSerializerGenerator.kt:537 */
   44     79   
        }
          80  +
        /* JsonSerializerGenerator.kt:515 */
   45     81   
        object_5.finish();
          82  +
        /* SerializerUtil.kt:46 */
   46     83   
    }
          84  +
    /* JsonSerializerGenerator.kt:372 */
   47     85   
    Ok(())
          86  +
    /* JsonSerializerGenerator.kt:358 */
   48     87   
}

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

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

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

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

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

@@ -1,1 +111,160 @@
    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  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_post_player_action_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::PostPlayerActionInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::post_player_action_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_post_player_action::de_post_player_action(
   29     39   
                bytes.as_ref(),
   30     40   
                input,
   31     41   
            )?;
          42  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   32     43   
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   33     45   
        input.build()
          46  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   34     47   
    })
          48  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   35     49   
}
   36     50   
          51  +
/* RustType.kt:516 */
   37     52   
#[allow(clippy::unnecessary_wraps)]
          53  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   38     54   
pub fn ser_post_player_action_http_response(
   39     55   
    #[allow(unused_variables)] output: crate::output::PostPlayerActionOutput,
   40     56   
) -> std::result::Result<
   41     57   
    ::aws_smithy_http_server::response::Response,
   42     58   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   43     59   
> {
          60  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   44     61   
    Ok({
          62  +
        /* RustType.kt:516 */
   45     63   
        #[allow(unused_mut)]
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   46     65   
        let mut builder = ::http::Response::builder();
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   47     67   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   48     68   
            builder,
   49     69   
            ::http::header::CONTENT_TYPE,
   50     70   
            "application/json",
   51     71   
        );
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   52     73   
        let http_status: u16 = 200;
   53     74   
        builder = builder.status(http_status);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   54     76   
        let payload =
   55         -
            crate::protocol_serde::shape_post_player_action_output::ser_post_player_action_output_output_output(&output)?
   56         -
        ;
          77  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_post_player_action_output::ser_post_player_action_output_output_output(&output)?
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   57     80   
        let content_length = payload.len();
   58     81   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   59     82   
            builder,
   60     83   
            ::http::header::CONTENT_LENGTH,
   61     84   
            content_length,
   62     85   
        );
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   63     87   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   64     89   
        builder.body(body)?
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   65     91   
    })
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   66     93   
}
   67     94   
          95  +
/* JsonParserGenerator.kt:148 */
   68     96   
pub(crate) fn de_post_player_action(
   69     97   
    value: &[u8],
   70     98   
    mut builder: crate::input::post_player_action_input::Builder,
   71     99   
) -> ::std::result::Result<
   72    100   
    crate::input::post_player_action_input::Builder,
   73    101   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   74    102   
> {
         103  +
    /* JsonParserGenerator.kt:153 */
   75    104   
    let mut tokens_owned =
   76    105   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
   77    106   
            .peekable();
   78    107   
    let tokens = &mut tokens_owned;
   79    108   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         109  +
    /* JsonParserGenerator.kt:684 */
   80    110   
    loop {
         111  +
        /* JsonParserGenerator.kt:685 */
   81    112   
        match tokens.next().transpose()? {
         113  +
            /* JsonParserGenerator.kt:686 */
   82    114   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   83    115   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         116  +
                /* JsonParserGenerator.kt:260 */
   84    117   
                match key.to_unescaped()?.as_ref() {
         118  +
                    /* JsonParserGenerator.kt:262 */
   85    119   
                    "action" => {
   86         -
                        builder = builder.set_action(
   87         -
                            crate::protocol_serde::shape_player_action::de_player_action(tokens)?,
         120  +
                        /* JsonParserGenerator.kt:272 */
         121  +
                        builder =
         122  +
                            builder.set_action(
         123  +
                                /* JsonParserGenerator.kt:660 */
         124  +
                                crate::protocol_serde::shape_player_action::de_player_action(
         125  +
                                    tokens,
         126  +
                                )?, /* JsonParserGenerator.kt:272 */
   88    127   
                            );
         128  +
                        /* JsonParserGenerator.kt:262 */
   89    129   
                    }
   90         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         130  +
                    /* JsonParserGenerator.kt:290 */
         131  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   91    132   
                }
         133  +
                /* JsonParserGenerator.kt:686 */
   92    134   
            }
         135  +
            /* JsonParserGenerator.kt:695 */
   93    136   
            other => {
   94    137   
                return Err(
   95    138   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   96    139   
                        "expected object key or end object, found: {:?}",
   97    140   
                        other
   98    141   
                    )),
   99    142   
                )
         143  +
            } /* JsonParserGenerator.kt:685 */
  100    144   
        }
         145  +
        /* JsonParserGenerator.kt:684 */
  101    146   
    }
  102         -
    }
         147  +
    /* JsonParserGenerator.kt:250 */
  103    148   
    if tokens.next().is_some() {
         149  +
        /* JsonParserGenerator.kt:251 */
  104    150   
        return Err(
  105    151   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  106    152   
                "found more JSON tokens after completing parsing",
  107    153   
            ),
  108    154   
        );
         155  +
        /* JsonParserGenerator.kt:250 */
  109    156   
    }
         157  +
    /* JsonParserGenerator.kt:163 */
  110    158   
    Ok(builder)
         159  +
    /* JsonParserGenerator.kt:148 */
  111    160   
}

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

@@ -1,1 +29,43 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_post_player_action_output_output_output(
    3      4   
    value: &crate::output::PostPlayerActionOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_post_player_action_output::ser_post_player_action_output_output(
    8     11   
        &mut object,
    9     12   
        value,
   10     13   
    )?;
          14  +
    /* JsonSerializerGenerator.kt:227 */
   11     15   
    object.finish();
   12     16   
    Ok(out)
          17  +
    /* JsonSerializerGenerator.kt:213 */
   13     18   
}
   14     19   
          20  +
/* JsonSerializerGenerator.kt:358 */
   15     21   
pub fn ser_post_player_action_output_output(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::output::PostPlayerActionOutput,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* SerializerUtil.kt:42 */
   19     26   
    {
          27  +
        /* JsonSerializerGenerator.kt:495 */
   20     28   
        #[allow(unused_mut)]
          29  +
        /* JsonSerializerGenerator.kt:496 */
   21     30   
        let mut object_1 = object.key("action").start_object();
          31  +
        /* JsonSerializerGenerator.kt:579 */
   22     32   
        crate::protocol_serde::shape_player_action::ser_player_action(
   23     33   
            &mut object_1,
   24     34   
            &input.action,
   25     35   
        )?;
          36  +
        /* JsonSerializerGenerator.kt:515 */
   26     37   
        object_1.finish();
          38  +
        /* SerializerUtil.kt:42 */
   27     39   
    }
          40  +
    /* JsonSerializerGenerator.kt:372 */
   28     41   
    Ok(())
          42  +
    /* JsonSerializerGenerator.kt:358 */
   29     43   
}

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

@@ -1,1 +108,153 @@
    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  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_post_union_with_json_name_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::PostUnionWithJsonNameInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::post_union_with_json_name_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_post_union_with_json_name::de_post_union_with_json_name(bytes.as_ref(), input)?;
          39  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   29     40   
        }
          41  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   30     42   
        input.build()
          43  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   31     44   
    })
          45  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   32     46   
}
   33     47   
          48  +
/* RustType.kt:516 */
   34     49   
#[allow(clippy::unnecessary_wraps)]
          50  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   35     51   
pub fn ser_post_union_with_json_name_http_response(
   36     52   
    #[allow(unused_variables)] output: crate::output::PostUnionWithJsonNameOutput,
   37     53   
) -> std::result::Result<
   38     54   
    ::aws_smithy_http_server::response::Response,
   39     55   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   40     56   
> {
          57  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   41     58   
    Ok({
          59  +
        /* RustType.kt:516 */
   42     60   
        #[allow(unused_mut)]
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   43     62   
        let mut builder = ::http::Response::builder();
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   44     64   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   45     65   
            builder,
   46     66   
            ::http::header::CONTENT_TYPE,
   47     67   
            "application/json",
   48     68   
        );
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   49     70   
        let http_status: u16 = 200;
   50     71   
        builder = builder.status(http_status);
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   51     73   
        let payload =
   52         -
            crate::protocol_serde::shape_post_union_with_json_name_output::ser_post_union_with_json_name_output_output_output(&output)?
   53         -
        ;
          74  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_post_union_with_json_name_output::ser_post_union_with_json_name_output_output_output(&output)?
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   54     77   
        let content_length = payload.len();
   55     78   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   56     79   
            builder,
   57     80   
            ::http::header::CONTENT_LENGTH,
   58     81   
            content_length,
   59     82   
        );
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   60     84   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          85  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   61     86   
        builder.body(body)?
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   62     88   
    })
          89  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   63     90   
}
   64     91   
          92  +
/* JsonParserGenerator.kt:148 */
   65     93   
pub(crate) fn de_post_union_with_json_name(
   66     94   
    value: &[u8],
   67     95   
    mut builder: crate::input::post_union_with_json_name_input::Builder,
   68     96   
) -> ::std::result::Result<
   69     97   
    crate::input::post_union_with_json_name_input::Builder,
   70     98   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   71     99   
> {
         100  +
    /* JsonParserGenerator.kt:153 */
   72    101   
    let mut tokens_owned =
   73    102   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
   74    103   
            .peekable();
   75    104   
    let tokens = &mut tokens_owned;
   76    105   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         106  +
    /* JsonParserGenerator.kt:684 */
   77    107   
    loop {
         108  +
        /* JsonParserGenerator.kt:685 */
   78    109   
        match tokens.next().transpose()? {
         110  +
            /* JsonParserGenerator.kt:686 */
   79    111   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   80    112   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         113  +
                /* JsonParserGenerator.kt:260 */
   81    114   
                match key.to_unescaped()?.as_ref() {
         115  +
                    /* JsonParserGenerator.kt:262 */
   82    116   
                    "value" => {
         117  +
                        /* JsonParserGenerator.kt:272 */
   83    118   
                        builder = builder.set_value(
   84         -
                            crate::protocol_serde::shape_union_with_json_name::de_union_with_json_name(tokens)?
   85         -
                        );
         119  +
                            /* JsonParserGenerator.kt:660 */crate::protocol_serde::shape_union_with_json_name::de_union_with_json_name(tokens)?
         120  +
                        /* JsonParserGenerator.kt:272 */);
         121  +
                        /* JsonParserGenerator.kt:262 */
   86    122   
                    }
   87         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         123  +
                    /* JsonParserGenerator.kt:290 */
         124  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   88    125   
                }
         126  +
                /* JsonParserGenerator.kt:686 */
   89    127   
            }
         128  +
            /* JsonParserGenerator.kt:695 */
   90    129   
            other => {
   91    130   
                return Err(
   92    131   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   93    132   
                        "expected object key or end object, found: {:?}",
   94    133   
                        other
   95    134   
                    )),
   96    135   
                )
         136  +
            } /* JsonParserGenerator.kt:685 */
   97    137   
        }
         138  +
        /* JsonParserGenerator.kt:684 */
   98    139   
    }
   99         -
    }
         140  +
    /* JsonParserGenerator.kt:250 */
  100    141   
    if tokens.next().is_some() {
         142  +
        /* JsonParserGenerator.kt:251 */
  101    143   
        return Err(
  102    144   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  103    145   
                "found more JSON tokens after completing parsing",
  104    146   
            ),
  105    147   
        );
         148  +
        /* JsonParserGenerator.kt:250 */
  106    149   
    }
         150  +
    /* JsonParserGenerator.kt:163 */
  107    151   
    Ok(builder)
         152  +
    /* JsonParserGenerator.kt:148 */
  108    153   
}

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

@@ -1,1 +26,40 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_post_union_with_json_name_output_output_output(
    3      4   
    value: &crate::output::PostUnionWithJsonNameOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_post_union_with_json_name_output::ser_post_union_with_json_name_output_output(&mut object, value)?;
          11  +
    /* JsonSerializerGenerator.kt:227 */
    8     12   
    object.finish();
    9     13   
    Ok(out)
          14  +
    /* JsonSerializerGenerator.kt:213 */
   10     15   
}
   11     16   
          17  +
/* JsonSerializerGenerator.kt:358 */
   12     18   
pub fn ser_post_union_with_json_name_output_output(
   13     19   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    input: &crate::output::PostUnionWithJsonNameOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* SerializerUtil.kt:42 */
   16     23   
    {
          24  +
        /* JsonSerializerGenerator.kt:495 */
   17     25   
        #[allow(unused_mut)]
          26  +
        /* JsonSerializerGenerator.kt:496 */
   18     27   
        let mut object_1 = object.key("value").start_object();
          28  +
        /* JsonSerializerGenerator.kt:579 */
   19     29   
        crate::protocol_serde::shape_union_with_json_name::ser_union_with_json_name(
   20     30   
            &mut object_1,
   21     31   
            &input.value,
   22     32   
        )?;
          33  +
        /* JsonSerializerGenerator.kt:515 */
   23     34   
        object_1.finish();
          35  +
        /* SerializerUtil.kt:42 */
   24     36   
    }
          37  +
    /* JsonSerializerGenerator.kt:372 */
   25     38   
    Ok(())
          39  +
    /* JsonSerializerGenerator.kt:358 */
   26     40   
}

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

@@ -1,1 +117,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  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_put_with_content_encoding_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::PutWithContentEncodingInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::put_with_content_encoding_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_put_with_content_encoding::de_put_with_content_encoding(bytes.as_ref(), input)?;
          39  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   29     40   
        }
          41  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   30     42   
        if let Some(value) =
   31     43   
            crate::protocol_serde::shape_put_with_content_encoding_input::de_encoding_header(
   32     44   
                &headers,
   33     45   
            )?
   34     46   
        {
   35     47   
            input = input.set_encoding(Some(value))
   36     48   
        }
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   37     50   
        input.build()
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   38     52   
    })
          53  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   39     54   
}
   40     55   
          56  +
/* RustType.kt:516 */
   41     57   
#[allow(clippy::unnecessary_wraps)]
          58  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   42     59   
pub fn ser_put_with_content_encoding_http_response(
   43     60   
    #[allow(unused_variables)] output: crate::output::PutWithContentEncodingOutput,
   44     61   
) -> std::result::Result<
   45     62   
    ::aws_smithy_http_server::response::Response,
   46     63   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   47     64   
> {
          65  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   48     66   
    Ok({
          67  +
        /* RustType.kt:516 */
   49     68   
        #[allow(unused_mut)]
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   50     70   
        let mut builder = ::http::Response::builder();
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   51     72   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   52     73   
            builder,
   53     74   
            ::http::header::CONTENT_TYPE,
   54     75   
            "application/json",
   55     76   
        );
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   56     78   
        let http_status: u16 = 200;
   57     79   
        builder = builder.status(http_status);
   58         -
        let payload = "";
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          81  +
        let payload =
          82  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   59     85   
        let content_length = payload.len();
   60     86   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   61     87   
            builder,
   62     88   
            ::http::header::CONTENT_LENGTH,
   63     89   
            content_length,
   64     90   
        );
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   65     92   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          93  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   66     94   
        builder.body(body)?
          95  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   67     96   
    })
          97  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   68     98   
}
   69     99   
         100  +
/* JsonParserGenerator.kt:148 */
   70    101   
pub(crate) fn de_put_with_content_encoding(
   71    102   
    value: &[u8],
   72    103   
    mut builder: crate::input::put_with_content_encoding_input::Builder,
   73    104   
) -> ::std::result::Result<
   74    105   
    crate::input::put_with_content_encoding_input::Builder,
   75    106   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   76    107   
> {
         108  +
    /* JsonParserGenerator.kt:153 */
   77    109   
    let mut tokens_owned =
   78    110   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
   79    111   
            .peekable();
   80    112   
    let tokens = &mut tokens_owned;
   81    113   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         114  +
    /* JsonParserGenerator.kt:684 */
   82    115   
    loop {
         116  +
        /* JsonParserGenerator.kt:685 */
   83    117   
        match tokens.next().transpose()? {
         118  +
            /* JsonParserGenerator.kt:686 */
   84    119   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   85    120   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         121  +
                /* JsonParserGenerator.kt:260 */
   86    122   
                match key.to_unescaped()?.as_ref() {
         123  +
                    /* JsonParserGenerator.kt:262 */
   87    124   
                    "data" => {
         125  +
                        /* JsonParserGenerator.kt:272 */
   88    126   
                        builder = builder.set_data(
         127  +
                            /* JsonParserGenerator.kt:354 */
   89    128   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
   90    129   
                                tokens.next(),
   91    130   
                            )?
   92         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   93         -
                            .transpose()?,
         131  +
                            .map(|s|
         132  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         133  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         134  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         135  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
   94    136   
                        );
         137  +
                        /* JsonParserGenerator.kt:262 */
   95    138   
                    }
   96         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         139  +
                    /* JsonParserGenerator.kt:290 */
         140  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   97    141   
                }
         142  +
                /* JsonParserGenerator.kt:686 */
   98    143   
            }
         144  +
            /* JsonParserGenerator.kt:695 */
   99    145   
            other => {
  100    146   
                return Err(
  101    147   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  102    148   
                        "expected object key or end object, found: {:?}",
  103    149   
                        other
  104    150   
                    )),
  105    151   
                )
         152  +
            } /* JsonParserGenerator.kt:685 */
  106    153   
        }
         154  +
        /* JsonParserGenerator.kt:684 */
  107    155   
    }
  108         -
    }
         156  +
    /* JsonParserGenerator.kt:250 */
  109    157   
    if tokens.next().is_some() {
         158  +
        /* JsonParserGenerator.kt:251 */
  110    159   
        return Err(
  111    160   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  112    161   
                "found more JSON tokens after completing parsing",
  113    162   
            ),
  114    163   
        );
         164  +
        /* JsonParserGenerator.kt:250 */
  115    165   
    }
         166  +
    /* JsonParserGenerator.kt:163 */
  116    167   
    Ok(builder)
         168  +
    /* JsonParserGenerator.kt:148 */
  117    169   
}