Server Test

Server Test

rev. d06a46cae0f385cdae37a9f8264db3469a090ab5 (ignoring whitespace)

Files changed:

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

@@ -1,1 +49,74 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:398 */
    2      3   
pub(crate) fn de_nested_string_list<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<::std::vec::Vec<::std::vec::Vec<::std::string::String>>>,
    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:712 */
   16     18   
    match tokens.next().transpose()? {
          19  +
        /* JsonParserGenerator.kt:713 */
   17     20   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   18     21   
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
          22  +
            /* JsonParserGenerator.kt:407 */
   19     23   
            let mut items = Vec::new();
          24  +
            /* JsonParserGenerator.kt:408 */
   20     25   
            loop {
          26  +
                /* JsonParserGenerator.kt:409 */
   21     27   
                match tokens.peek() {
          28  +
                    /* JsonParserGenerator.kt:410 */
   22     29   
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
          30  +
                        /* JsonParserGenerator.kt:411 */
   23     31   
                        tokens.next().transpose().unwrap();
   24     32   
                        break;
          33  +
                        /* JsonParserGenerator.kt:410 */
   25     34   
                    }
          35  +
                    /* JsonParserGenerator.kt:413 */
   26     36   
                    _ => {
          37  +
                        /* JsonParserGenerator.kt:419 */
   27     38   
                        let value =
   28         -
                            crate::protocol_serde::shape_string_list::de_string_list(tokens)?;
          39  +
                            /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_string_list::de_string_list(tokens)?
          40  +
                        /* JsonParserGenerator.kt:419 */;
          41  +
                        /* JsonParserGenerator.kt:422 */
   29     42   
                        if let Some(value) = value {
   30     43   
                            items.push(value);
   31         -
                        } else {
          44  +
                        }
          45  +
                        /* JsonParserGenerator.kt:430 */
          46  +
                        else {
   32     47   
                            return Err(
   33     48   
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   34     49   
                                    "dense list cannot contain null values",
   35     50   
                                ),
   36     51   
                            );
   37     52   
                        }
          53  +
                        /* JsonParserGenerator.kt:413 */
          54  +
                    } /* JsonParserGenerator.kt:409 */
   38     55   
                }
          56  +
                /* JsonParserGenerator.kt:408 */
   39     57   
            }
   40         -
            }
          58  +
            /* JsonParserGenerator.kt:446 */
   41     59   
            Ok(Some(items))
          60  +
            /* JsonParserGenerator.kt:713 */
   42     61   
        }
   43         -
        _ => Err(
          62  +
        /* JsonParserGenerator.kt:722 */
          63  +
        _ => {
          64  +
            /* JsonParserGenerator.kt:723 */
          65  +
            Err(
   44     66   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   45     67   
                    "expected start array or null",
   46     68   
                ),
   47         -
        ),
          69  +
            )
          70  +
            /* JsonParserGenerator.kt:722 */
          71  +
        } /* JsonParserGenerator.kt:712 */
   48     72   
    }
          73  +
    /* JsonParserGenerator.kt:398 */
   49     74   
}

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

@@ -1,1 +54,80 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_no_input_and_no_output_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::NoInputAndNoOutputInput,
    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:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::no_input_and_no_output_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   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:873 */
   22     30   
        ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(&headers, None)?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   23     32   
        input.build()
          33  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   24     34   
    })
          35  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   25     36   
}
   26     37   
          38  +
/* RustType.kt:534 */
   27     39   
#[allow(clippy::unnecessary_wraps)]
          40  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   28     41   
pub fn ser_no_input_and_no_output_http_response(
   29     42   
    #[allow(unused_variables)] output: crate::output::NoInputAndNoOutputOutput,
   30     43   
) -> std::result::Result<
   31     44   
    ::aws_smithy_http_server::response::Response,
   32     45   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   33     46   
> {
          47  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   34     48   
    Ok({
          49  +
        /* RustType.kt:534 */
   35     50   
        #[allow(unused_mut)]
   36         -
        let mut builder = ::http::Response::builder();
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          52  +
        let mut builder = ::http_1x::Response::builder();
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   37     54   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   38     55   
            builder,
   39         -
            ::http::header::CONTENT_TYPE,
          56  +
            ::http_1x::header::CONTENT_TYPE,
   40     57   
            "application/json",
   41     58   
        );
          59  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   42     60   
        let http_status: u16 = 200;
   43     61   
        builder = builder.status(http_status);
   44         -
        let payload = "";
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          63  +
        let payload =
          64  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   45     67   
        let content_length = payload.len();
   46     68   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   47     69   
            builder,
   48         -
            ::http::header::CONTENT_LENGTH,
          70  +
            ::http_1x::header::CONTENT_LENGTH,
   49     71   
            content_length,
   50     72   
        );
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   51     74   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   52     76   
        builder.body(body)?
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   53     78   
    })
          79  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   54     80   
}

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

@@ -1,1 +56,80 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_no_input_and_output_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::NoInputAndOutputInput,
    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:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::no_input_and_output_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   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:873 */
   22     30   
        ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(&headers, None)?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   23     32   
        input.build()
          33  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   24     34   
    })
          35  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   25     36   
}
   26     37   
          38  +
/* RustType.kt:534 */
   27     39   
#[allow(clippy::unnecessary_wraps)]
          40  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   28     41   
pub fn ser_no_input_and_output_http_response(
   29     42   
    #[allow(unused_variables)] output: crate::output::NoInputAndOutputOutput,
   30     43   
) -> std::result::Result<
   31     44   
    ::aws_smithy_http_server::response::Response,
   32     45   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   33     46   
> {
          47  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   34     48   
    Ok({
          49  +
        /* RustType.kt:534 */
   35     50   
        #[allow(unused_mut)]
   36         -
        let mut builder = ::http::Response::builder();
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          52  +
        let mut builder = ::http_1x::Response::builder();
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   37     54   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   38     55   
            builder,
   39         -
            ::http::header::CONTENT_TYPE,
          56  +
            ::http_1x::header::CONTENT_TYPE,
   40     57   
            "application/json",
   41     58   
        );
          59  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   42     60   
        let http_status: u16 = 200;
   43     61   
        builder = builder.status(http_status);
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   44     63   
        let payload =
   45         -
            crate::protocol_serde::shape_no_input_and_output_output::ser_no_input_and_output_output_output_output(&output)?
   46         -
        ;
          64  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_no_input_and_output_output::ser_no_input_and_output_output_output_output(&output)?
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   47     67   
        let content_length = payload.len();
   48     68   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   49     69   
            builder,
   50         -
            ::http::header::CONTENT_LENGTH,
          70  +
            ::http_1x::header::CONTENT_LENGTH,
   51     71   
            content_length,
   52     72   
        );
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   53     74   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   54     76   
        builder.body(body)?
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   55     78   
    })
          79  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   56     80   
}

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

@@ -1,1 +20,28 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_no_input_and_output_output_output_output(
    3      4   
    value: &crate::output::NoInputAndOutputOutput,
    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_no_input_and_output_output::ser_no_input_and_output_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_no_input_and_output_output_output(
   16     22   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    #[allow(unused_variables)] input: &crate::output::NoInputAndOutputOutput,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:372 */
   19     26   
    Ok(())
          27  +
    /* JsonSerializerGenerator.kt:358 */
   20     28   
}

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

@@ -1,1 +129,181 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_null_and_empty_headers_client_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::NullAndEmptyHeadersClientInput,
    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:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::null_and_empty_headers_client_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   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:856 */
   22     30   
        if let Some(value) =
   23     31   
            crate::protocol_serde::shape_null_and_empty_headers_client_input::de_a_header(&headers)?
   24     32   
        {
   25     33   
            input = input.set_a(Some(value))
   26     34   
        }
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   27     36   
        if let Some(value) =
   28     37   
            crate::protocol_serde::shape_null_and_empty_headers_client_input::de_b_header(&headers)?
   29     38   
        {
   30     39   
            input = input.set_b(Some(value))
   31     40   
        }
          41  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   32     42   
        if let Some(value) =
   33     43   
            crate::protocol_serde::shape_null_and_empty_headers_client_input::de_c_header(&headers)?
   34     44   
        {
   35     45   
            input = input.set_c(Some(value))
   36     46   
        }
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   37     48   
        input.build()
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   38     50   
    })
          51  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   39     52   
}
   40     53   
          54  +
/* RustType.kt:534 */
   41     55   
#[allow(clippy::unnecessary_wraps)]
          56  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   42     57   
pub fn ser_null_and_empty_headers_client_http_response(
   43     58   
    #[allow(unused_variables)] output: crate::output::NullAndEmptyHeadersClientOutput,
   44     59   
) -> std::result::Result<
   45     60   
    ::aws_smithy_http_server::response::Response,
   46     61   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   47     62   
> {
          63  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   48     64   
    Ok({
          65  +
        /* RustType.kt:534 */
   49     66   
        #[allow(unused_mut)]
   50         -
        let mut builder = ::http::Response::builder();
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          68  +
        let mut builder = ::http_1x::Response::builder();
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:665 */
   51     70   
        builder = crate::protocol_serde::shape_null_and_empty_headers_client::ser_null_and_empty_headers_client_headers(&output, builder)?;
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   52     72   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   53     73   
            builder,
   54         -
            ::http::header::CONTENT_TYPE,
          74  +
            ::http_1x::header::CONTENT_TYPE,
   55     75   
            "application/json",
   56     76   
        );
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   57     78   
        let http_status: u16 = 200;
   58     79   
        builder = builder.status(http_status);
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   59     81   
        let payload =
   60         -
            crate::protocol_serde::shape_null_and_empty_headers_client_output::ser_null_and_empty_headers_client_output_output_output(&output)?
   61         -
        ;
          82  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_null_and_empty_headers_client_output::ser_null_and_empty_headers_client_output_output_output(&output)?
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   62     85   
        let content_length = payload.len();
   63     86   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   64     87   
            builder,
   65         -
            ::http::header::CONTENT_LENGTH,
          88  +
            ::http_1x::header::CONTENT_LENGTH,
   66     89   
            content_length,
   67     90   
        );
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   68     92   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          93  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   69     94   
        builder.body(body)?
          95  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   70     96   
    })
          97  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   71     98   
}
   72     99   
         100  +
/* HttpBindingGenerator.kt:565 */
   73    101   
pub fn ser_null_and_empty_headers_client_headers(
   74    102   
    input: &crate::output::NullAndEmptyHeadersClientOutput,
   75         -
    mut builder: ::http::response::Builder,
   76         -
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
   77         -
{
         103  +
    mut builder: ::http_1x::response::Builder,
         104  +
) -> std::result::Result<
         105  +
    ::http_1x::response::Builder,
         106  +
    ::aws_smithy_types::error::operation::BuildError,
         107  +
> {
         108  +
    /* HttpBindingGenerator.kt:615 */
   78    109   
    if let ::std::option::Option::Some(inner_1) = &input.a {
         110  +
        /* HttpBindingGenerator.kt:727 */
   79    111   
        let formatted_2 = inner_1.as_str();
         112  +
        /* HttpBindingGenerator.kt:728 */
   80    113   
        if !formatted_2.is_empty() {
         114  +
            /* HttpBindingGenerator.kt:729 */
   81    115   
            let header_value = formatted_2;
   82         -
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         116  +
            let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   83    117   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   84    118   
                    "a",
   85    119   
                    format!(
   86    120   
                        "`{}` cannot be used as a header value: {}",
   87    121   
                        &header_value, err
   88    122   
                    ),
   89    123   
                )
   90    124   
            })?;
   91    125   
            builder = builder.header("X-A", header_value);
         126  +
            /* HttpBindingGenerator.kt:728 */
   92    127   
        }
         128  +
        /* HttpBindingGenerator.kt:615 */
   93    129   
    }
         130  +
    /* HttpBindingGenerator.kt:615 */
   94    131   
    if let ::std::option::Option::Some(inner_3) = &input.b {
         132  +
        /* HttpBindingGenerator.kt:727 */
   95    133   
        let formatted_4 = inner_3.as_str();
         134  +
        /* HttpBindingGenerator.kt:728 */
   96    135   
        if !formatted_4.is_empty() {
         136  +
            /* HttpBindingGenerator.kt:729 */
   97    137   
            let header_value = formatted_4;
   98         -
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         138  +
            let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   99    139   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  100    140   
                    "b",
  101    141   
                    format!(
  102    142   
                        "`{}` cannot be used as a header value: {}",
  103    143   
                        &header_value, err
  104    144   
                    ),
  105    145   
                )
  106    146   
            })?;
  107    147   
            builder = builder.header("X-B", header_value);
         148  +
            /* HttpBindingGenerator.kt:728 */
  108    149   
        }
         150  +
        /* HttpBindingGenerator.kt:615 */
  109    151   
    }
         152  +
    /* HttpBindingGenerator.kt:615 */
  110    153   
    if let ::std::option::Option::Some(inner_5) = &input.c {
         154  +
        /* HttpBindingGenerator.kt:669 */
  111    155   
        for inner_6 in inner_5 {
         156  +
            /* HttpBindingGenerator.kt:727 */
  112    157   
            let formatted_7 = ::aws_smithy_http::header::quote_header_value(inner_6.as_str());
         158  +
            /* HttpBindingGenerator.kt:728 */
  113    159   
            if !formatted_7.is_empty() {
         160  +
                /* HttpBindingGenerator.kt:729 */
  114    161   
                let header_value = formatted_7;
  115         -
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         162  +
                let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  116    163   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  117    164   
                        "c",
  118    165   
                        format!(
  119    166   
                            "`{}` cannot be used as a header value: {}",
  120    167   
                            &header_value, err
  121    168   
                        ),
  122    169   
                    )
  123    170   
                })?;
  124    171   
                builder = builder.header("X-C", header_value);
         172  +
                /* HttpBindingGenerator.kt:728 */
  125    173   
            }
         174  +
            /* HttpBindingGenerator.kt:669 */
  126    175   
        }
         176  +
        /* HttpBindingGenerator.kt:615 */
  127    177   
    }
         178  +
    /* HttpBindingGenerator.kt:578 */
  128    179   
    Ok(builder)
         180  +
    /* HttpBindingGenerator.kt:565 */
  129    181   
}

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

@@ -1,1 +31,44 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:159 */
    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:166 */
    8     10   
    let headers = header_map.get_all("X-A");
          11  +
    /* HttpBindingGenerator.kt:398 */
    9     12   
    ::aws_smithy_http::header::one_or_none(headers)
          13  +
    /* HttpBindingGenerator.kt:159 */
   10     14   
}
   11     15   
          16  +
/* HttpBindingGenerator.kt:159 */
   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:166 */
   18     24   
    let headers = header_map.get_all("X-B");
          25  +
    /* HttpBindingGenerator.kt:398 */
   19     26   
    ::aws_smithy_http::header::one_or_none(headers)
          27  +
    /* HttpBindingGenerator.kt:159 */
   20     28   
}
   21     29   
          30  +
/* HttpBindingGenerator.kt:159 */
   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:166 */
   28     38   
    let headers = header_map.get_all("X-C");
          39  +
    /* HttpBindingGenerator.kt:432 */
   29     40   
    let var_1: Vec<::std::string::String> = ::aws_smithy_http::header::read_many_from_str(headers)?;
          41  +
    /* HttpBindingGenerator.kt:453 */
   30     42   
    Ok(if !var_1.is_empty() { Some(var_1) } else { None })
          43  +
    /* HttpBindingGenerator.kt:159 */
   31     44   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_null_and_empty_headers_client_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_client_output_output_output(
    3      4   
    value: &crate::output::NullAndEmptyHeadersClientOutput,
    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_client_output::ser_null_and_empty_headers_client_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_client_output_output(
   13     19   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    #[allow(unused_variables)] input: &crate::output::NullAndEmptyHeadersClientOutput,
   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_null_and_empty_headers_server.rs

@@ -1,1 +129,181 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_null_and_empty_headers_server_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::NullAndEmptyHeadersServerInput,
    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:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::null_and_empty_headers_server_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   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:856 */
   22     30   
        if let Some(value) =
   23     31   
            crate::protocol_serde::shape_null_and_empty_headers_server_input::de_a_header(&headers)?
   24     32   
        {
   25     33   
            input = input.set_a(Some(value))
   26     34   
        }
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   27     36   
        if let Some(value) =
   28     37   
            crate::protocol_serde::shape_null_and_empty_headers_server_input::de_b_header(&headers)?
   29     38   
        {
   30     39   
            input = input.set_b(Some(value))
   31     40   
        }
          41  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   32     42   
        if let Some(value) =
   33     43   
            crate::protocol_serde::shape_null_and_empty_headers_server_input::de_c_header(&headers)?
   34     44   
        {
   35     45   
            input = input.set_c(Some(value))
   36     46   
        }
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   37     48   
        input.build()
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   38     50   
    })
          51  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   39     52   
}
   40     53   
          54  +
/* RustType.kt:534 */
   41     55   
#[allow(clippy::unnecessary_wraps)]
          56  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   42     57   
pub fn ser_null_and_empty_headers_server_http_response(
   43     58   
    #[allow(unused_variables)] output: crate::output::NullAndEmptyHeadersServerOutput,
   44     59   
) -> std::result::Result<
   45     60   
    ::aws_smithy_http_server::response::Response,
   46     61   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   47     62   
> {
          63  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   48     64   
    Ok({
          65  +
        /* RustType.kt:534 */
   49     66   
        #[allow(unused_mut)]
   50         -
        let mut builder = ::http::Response::builder();
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          68  +
        let mut builder = ::http_1x::Response::builder();
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:665 */
   51     70   
        builder = crate::protocol_serde::shape_null_and_empty_headers_server::ser_null_and_empty_headers_server_headers(&output, builder)?;
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   52     72   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   53     73   
            builder,
   54         -
            ::http::header::CONTENT_TYPE,
          74  +
            ::http_1x::header::CONTENT_TYPE,
   55     75   
            "application/json",
   56     76   
        );
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   57     78   
        let http_status: u16 = 200;
   58     79   
        builder = builder.status(http_status);
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   59     81   
        let payload =
   60         -
            crate::protocol_serde::shape_null_and_empty_headers_server_output::ser_null_and_empty_headers_server_output_output_output(&output)?
   61         -
        ;
          82  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_null_and_empty_headers_server_output::ser_null_and_empty_headers_server_output_output_output(&output)?
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   62     85   
        let content_length = payload.len();
   63     86   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   64     87   
            builder,
   65         -
            ::http::header::CONTENT_LENGTH,
          88  +
            ::http_1x::header::CONTENT_LENGTH,
   66     89   
            content_length,
   67     90   
        );
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   68     92   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          93  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   69     94   
        builder.body(body)?
          95  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   70     96   
    })
          97  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   71     98   
}
   72     99   
         100  +
/* HttpBindingGenerator.kt:565 */
   73    101   
pub fn ser_null_and_empty_headers_server_headers(
   74    102   
    input: &crate::output::NullAndEmptyHeadersServerOutput,
   75         -
    mut builder: ::http::response::Builder,
   76         -
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
   77         -
{
         103  +
    mut builder: ::http_1x::response::Builder,
         104  +
) -> std::result::Result<
         105  +
    ::http_1x::response::Builder,
         106  +
    ::aws_smithy_types::error::operation::BuildError,
         107  +
> {
         108  +
    /* HttpBindingGenerator.kt:615 */
   78    109   
    if let ::std::option::Option::Some(inner_1) = &input.a {
         110  +
        /* HttpBindingGenerator.kt:727 */
   79    111   
        let formatted_2 = inner_1.as_str();
         112  +
        /* HttpBindingGenerator.kt:728 */
   80    113   
        if !formatted_2.is_empty() {
         114  +
            /* HttpBindingGenerator.kt:729 */
   81    115   
            let header_value = formatted_2;
   82         -
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         116  +
            let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   83    117   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   84    118   
                    "a",
   85    119   
                    format!(
   86    120   
                        "`{}` cannot be used as a header value: {}",
   87    121   
                        &header_value, err
   88    122   
                    ),
   89    123   
                )
   90    124   
            })?;
   91    125   
            builder = builder.header("X-A", header_value);
         126  +
            /* HttpBindingGenerator.kt:728 */
   92    127   
        }
         128  +
        /* HttpBindingGenerator.kt:615 */
   93    129   
    }
         130  +
    /* HttpBindingGenerator.kt:615 */
   94    131   
    if let ::std::option::Option::Some(inner_3) = &input.b {
         132  +
        /* HttpBindingGenerator.kt:727 */
   95    133   
        let formatted_4 = inner_3.as_str();
         134  +
        /* HttpBindingGenerator.kt:728 */
   96    135   
        if !formatted_4.is_empty() {
         136  +
            /* HttpBindingGenerator.kt:729 */
   97    137   
            let header_value = formatted_4;
   98         -
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         138  +
            let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   99    139   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  100    140   
                    "b",
  101    141   
                    format!(
  102    142   
                        "`{}` cannot be used as a header value: {}",
  103    143   
                        &header_value, err
  104    144   
                    ),
  105    145   
                )
  106    146   
            })?;
  107    147   
            builder = builder.header("X-B", header_value);
         148  +
            /* HttpBindingGenerator.kt:728 */
  108    149   
        }
         150  +
        /* HttpBindingGenerator.kt:615 */
  109    151   
    }
         152  +
    /* HttpBindingGenerator.kt:615 */
  110    153   
    if let ::std::option::Option::Some(inner_5) = &input.c {
         154  +
        /* HttpBindingGenerator.kt:669 */
  111    155   
        for inner_6 in inner_5 {
         156  +
            /* HttpBindingGenerator.kt:727 */
  112    157   
            let formatted_7 = ::aws_smithy_http::header::quote_header_value(inner_6.as_str());
         158  +
            /* HttpBindingGenerator.kt:728 */
  113    159   
            if !formatted_7.is_empty() {
         160  +
                /* HttpBindingGenerator.kt:729 */
  114    161   
                let header_value = formatted_7;
  115         -
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         162  +
                let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  116    163   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  117    164   
                        "c",
  118    165   
                        format!(
  119    166   
                            "`{}` cannot be used as a header value: {}",
  120    167   
                            &header_value, err
  121    168   
                        ),
  122    169   
                    )
  123    170   
                })?;
  124    171   
                builder = builder.header("X-C", header_value);
         172  +
                /* HttpBindingGenerator.kt:728 */
  125    173   
            }
         174  +
            /* HttpBindingGenerator.kt:669 */
  126    175   
        }
         176  +
        /* HttpBindingGenerator.kt:615 */
  127    177   
    }
         178  +
    /* HttpBindingGenerator.kt:578 */
  128    179   
    Ok(builder)
         180  +
    /* HttpBindingGenerator.kt:565 */
  129    181   
}

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:159 */
    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:166 */
    8     10   
    let headers = header_map.get_all("X-A");
          11  +
    /* HttpBindingGenerator.kt:398 */
    9     12   
    ::aws_smithy_http::header::one_or_none(headers)
          13  +
    /* HttpBindingGenerator.kt:159 */
   10     14   
}
   11     15   
          16  +
/* HttpBindingGenerator.kt:159 */
   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:166 */
   18     24   
    let headers = header_map.get_all("X-B");
          25  +
    /* HttpBindingGenerator.kt:398 */
   19     26   
    ::aws_smithy_http::header::one_or_none(headers)
          27  +
    /* HttpBindingGenerator.kt:159 */
   20     28   
}
   21     29   
          30  +
/* HttpBindingGenerator.kt:159 */
   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:166 */
   28     38   
    let headers = header_map.get_all("X-C");
          39  +
    /* HttpBindingGenerator.kt:432 */
   29     40   
    let var_1: Vec<::std::string::String> = ::aws_smithy_http::header::read_many_from_str(headers)?;
          41  +
    /* HttpBindingGenerator.kt:453 */
   30     42   
    Ok(if !var_1.is_empty() { Some(var_1) } else { None })
          43  +
    /* HttpBindingGenerator.kt:159 */
   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:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_omits_null_serializes_empty_string_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::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:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::omits_null_serializes_empty_string_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   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:1221 */
   22     30   
        let query_string = uri.query().unwrap_or("");
   23     31   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:1247 */
   24     33   
        let mut empty_string_seen = false;
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:1247 */
   25     35   
        let mut null_value_seen = false;
          36  +
        /* ServerHttpBoundProtocolGenerator.kt:1253 */
   26     37   
        for (k, v) in pairs {
          38  +
            /* ServerHttpBoundProtocolGenerator.kt:1257 */
   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:1257 */
   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:1253 */
   39     53   
        }
          54  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   40     55   
        input.build()
          56  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   41     57   
    })
          58  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   42     59   
}
   43     60   
          61  +
/* RustType.kt:534 */
   44     62   
#[allow(clippy::unnecessary_wraps)]
          63  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   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:457 */
   51     71   
    Ok({
          72  +
        /* RustType.kt:534 */
   52     73   
        #[allow(unused_mut)]
   53         -
        let mut builder = ::http::Response::builder();
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          75  +
        let mut builder = ::http_1x::Response::builder();
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   54     77   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   55     78   
            builder,
   56         -
            ::http::header::CONTENT_TYPE,
          79  +
            ::http_1x::header::CONTENT_TYPE,
   57     80   
            "application/json",
   58     81   
        );
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   59     83   
        let http_status: u16 = 200;
   60     84   
        builder = builder.status(http_status);
   61         -
        let payload = "";
          85  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          86  +
        let payload =
          87  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   62     90   
        let content_length = payload.len();
   63     91   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   64     92   
            builder,
   65         -
            ::http::header::CONTENT_LENGTH,
          93  +
            ::http_1x::header::CONTENT_LENGTH,
   66     94   
            content_length,
   67     95   
        );
          96  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   68     97   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          98  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   69     99   
        builder.body(body)?
         100  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   70    101   
    })
         102  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   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:1453 */
    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:1470 */
    8     10   
    let value = value.to_owned();
          11  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
    9     12   
    Ok(Some(value))
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
   10     14   
}
   11     15   
          16  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
   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:1470 */
   18     24   
    let value = value.to_owned();
          25  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
   19     26   
    Ok(Some(value))
          27  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
   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:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_omits_serializing_empty_lists_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::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:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::omits_serializing_empty_lists_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   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:1221 */
   22     30   
        let query_string = uri.query().unwrap_or("");
   23     31   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:1250 */
   24     33   
        let mut query_boolean_list = Vec::new();
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:1250 */
   25     35   
        let mut query_double_list = Vec::new();
          36  +
        /* ServerHttpBoundProtocolGenerator.kt:1250 */
   26     37   
        let mut query_enum_list = Vec::new();
          38  +
        /* ServerHttpBoundProtocolGenerator.kt:1250 */
   27     39   
        let mut query_integer_enum_list = Vec::new();
          40  +
        /* ServerHttpBoundProtocolGenerator.kt:1250 */
   28     41   
        let mut query_integer_list = Vec::new();
          42  +
        /* ServerHttpBoundProtocolGenerator.kt:1250 */
   29     43   
        let mut query_string_list = Vec::new();
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:1250 */
   30     45   
        let mut query_timestamp_list = Vec::new();
          46  +
        /* ServerHttpBoundProtocolGenerator.kt:1253 */
   31     47   
        for (k, v) in pairs {
          48  +
            /* ServerHttpBoundProtocolGenerator.kt:1270 */
   32     49   
            if k == "BooleanList" {
          50  +
                /* ServerHttpBoundProtocolGenerator.kt:1318 */
   33     51   
                let v = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(&v)?;
          52  +
                /* ServerHttpBoundProtocolGenerator.kt:1327 */
   34     53   
                query_boolean_list.push(v);
   35         -
            } else if k == "DoubleList" {
          54  +
            /* ServerHttpBoundProtocolGenerator.kt:1270 */
          55  +
            }
          56  +
            /* ServerHttpBoundProtocolGenerator.kt:1270 */
          57  +
            else if k == "DoubleList" {
          58  +
                /* ServerHttpBoundProtocolGenerator.kt:1318 */
   36     59   
                let v = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(&v)?;
          60  +
                /* ServerHttpBoundProtocolGenerator.kt:1327 */
   37     61   
                query_double_list.push(v);
   38         -
            } else if k == "EnumList" {
          62  +
            /* ServerHttpBoundProtocolGenerator.kt:1270 */
          63  +
            }
          64  +
            /* ServerHttpBoundProtocolGenerator.kt:1270 */
          65  +
            else if k == "EnumList" {
          66  +
                /* ServerHttpBoundProtocolGenerator.kt:1282 */
   39     67   
                let v = v.into_owned();
          68  +
                /* ServerHttpBoundProtocolGenerator.kt:1327 */
   40     69   
                query_enum_list.push(v);
   41         -
            } else if k == "IntegerEnumList" {
          70  +
            /* ServerHttpBoundProtocolGenerator.kt:1270 */
          71  +
            }
          72  +
            /* ServerHttpBoundProtocolGenerator.kt:1270 */
          73  +
            else if k == "IntegerEnumList" {
          74  +
                /* ServerHttpBoundProtocolGenerator.kt:1318 */
   42     75   
                let v = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(&v)?;
          76  +
                /* ServerHttpBoundProtocolGenerator.kt:1327 */
   43     77   
                query_integer_enum_list.push(v);
   44         -
            } else if k == "IntegerList" {
          78  +
            /* ServerHttpBoundProtocolGenerator.kt:1270 */
          79  +
            }
          80  +
            /* ServerHttpBoundProtocolGenerator.kt:1270 */
          81  +
            else if k == "IntegerList" {
          82  +
                /* ServerHttpBoundProtocolGenerator.kt:1318 */
   45     83   
                let v = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(&v)?;
          84  +
                /* ServerHttpBoundProtocolGenerator.kt:1327 */
   46     85   
                query_integer_list.push(v);
   47         -
            } else if k == "StringList" {
          86  +
            /* ServerHttpBoundProtocolGenerator.kt:1270 */
          87  +
            }
          88  +
            /* ServerHttpBoundProtocolGenerator.kt:1270 */
          89  +
            else if k == "StringList" {
          90  +
                /* ServerHttpBoundProtocolGenerator.kt:1282 */
   48     91   
                let v = v.into_owned();
          92  +
                /* ServerHttpBoundProtocolGenerator.kt:1327 */
   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:1270 */
          95  +
            }
          96  +
            /* ServerHttpBoundProtocolGenerator.kt:1270 */
          97  +
            else if k == "TimestampList" {
          98  +
                /* ServerHttpBoundProtocolGenerator.kt:1300 */
          99  +
                let v = ::aws_smithy_types::DateTime::from_str(&v, ::aws_smithy_types::date_time::Format::DateTime)?
         100  +
                /* ServerHttpBoundProtocolGenerator.kt:1314 */;
         101  +
                /* ServerHttpBoundProtocolGenerator.kt:1327 */
   55    102   
                query_timestamp_list.push(v);
         103  +
                /* ServerHttpBoundProtocolGenerator.kt:1270 */
   56    104   
            }
         105  +
            /* ServerHttpBoundProtocolGenerator.kt:1253 */
   57    106   
        }
         107  +
        /* ServerHttpBoundProtocolGenerator.kt:1389 */
   58    108   
        if !query_boolean_list.is_empty() {
   59         -
            input = input.set_query_boolean_list(Some(query_boolean_list));
         109  +
            /* ServerHttpBoundProtocolGenerator.kt:1390 */
         110  +
            input = input.set_query_boolean_list(
         111  +
                /* ServerHttpBoundProtocolGenerator.kt:1396 */
         112  +
                Some(
         113  +
                    /* ServerHttpBoundProtocolGenerator.kt:1405 */
         114  +
                    query_boolean_list, /* ServerHttpBoundProtocolGenerator.kt:1396 */
         115  +
                ), /* ServerHttpBoundProtocolGenerator.kt:1390 */
         116  +
            );
         117  +
            /* ServerHttpBoundProtocolGenerator.kt:1389 */
   60    118   
        }
         119  +
        /* ServerHttpBoundProtocolGenerator.kt:1389 */
   61    120   
        if !query_double_list.is_empty() {
   62         -
            input = input.set_query_double_list(Some(query_double_list));
         121  +
            /* ServerHttpBoundProtocolGenerator.kt:1390 */
         122  +
            input = input.set_query_double_list(
         123  +
                /* ServerHttpBoundProtocolGenerator.kt:1396 */
         124  +
                Some(
         125  +
                    /* ServerHttpBoundProtocolGenerator.kt:1405 */
         126  +
                    query_double_list, /* ServerHttpBoundProtocolGenerator.kt:1396 */
         127  +
                ), /* ServerHttpBoundProtocolGenerator.kt:1390 */
         128  +
            );
         129  +
            /* ServerHttpBoundProtocolGenerator.kt:1389 */
   63    130   
        }
         131  +
        /* ServerHttpBoundProtocolGenerator.kt:1389 */
   64    132   
        if !query_enum_list.is_empty() {
   65         -
            input = input.set_query_enum_list(Some(
         133  +
            /* ServerHttpBoundProtocolGenerator.kt:1390 */
         134  +
            input = input.set_query_enum_list(
         135  +
                /* ServerHttpBoundProtocolGenerator.kt:1396 */
         136  +
                Some(
         137  +
                    /* ServerHttpBoundProtocolGenerator.kt:1397 */
   66    138   
                    crate::unconstrained::foo_enum_list_unconstrained::FooEnumListUnconstrained(
   67         -
                    query_enum_list,
   68         -
                ),
   69         -
            ));
         139  +
                        /* ServerHttpBoundProtocolGenerator.kt:1405 */
         140  +
                        query_enum_list, /* ServerHttpBoundProtocolGenerator.kt:1397 */
         141  +
                    ), /* ServerHttpBoundProtocolGenerator.kt:1396 */
         142  +
                ), /* ServerHttpBoundProtocolGenerator.kt:1390 */
         143  +
            );
         144  +
            /* ServerHttpBoundProtocolGenerator.kt:1389 */
   70    145   
        }
         146  +
        /* ServerHttpBoundProtocolGenerator.kt:1389 */
   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:1390 */
         149  +
            input = input.set_query_integer_enum_list(
         150  +
                /* ServerHttpBoundProtocolGenerator.kt:1396 */
         151  +
                Some(
         152  +
                    /* ServerHttpBoundProtocolGenerator.kt:1405 */
         153  +
                    query_integer_enum_list, /* ServerHttpBoundProtocolGenerator.kt:1396 */
         154  +
                ), /* ServerHttpBoundProtocolGenerator.kt:1390 */
         155  +
            );
         156  +
            /* ServerHttpBoundProtocolGenerator.kt:1389 */
   73    157   
        }
         158  +
        /* ServerHttpBoundProtocolGenerator.kt:1389 */
   74    159   
        if !query_integer_list.is_empty() {
   75         -
            input = input.set_query_integer_list(Some(query_integer_list));
         160  +
            /* ServerHttpBoundProtocolGenerator.kt:1390 */
         161  +
            input = input.set_query_integer_list(
         162  +
                /* ServerHttpBoundProtocolGenerator.kt:1396 */
         163  +
                Some(
         164  +
                    /* ServerHttpBoundProtocolGenerator.kt:1405 */
         165  +
                    query_integer_list, /* ServerHttpBoundProtocolGenerator.kt:1396 */
         166  +
                ), /* ServerHttpBoundProtocolGenerator.kt:1390 */
         167  +
            );
         168  +
            /* ServerHttpBoundProtocolGenerator.kt:1389 */
   76    169   
        }
         170  +
        /* ServerHttpBoundProtocolGenerator.kt:1389 */
   77    171   
        if !query_string_list.is_empty() {
   78         -
            input = input.set_query_string_list(Some(query_string_list));
         172  +
            /* ServerHttpBoundProtocolGenerator.kt:1390 */
         173  +
            input = input.set_query_string_list(
         174  +
                /* ServerHttpBoundProtocolGenerator.kt:1396 */
         175  +
                Some(
         176  +
                    /* ServerHttpBoundProtocolGenerator.kt:1405 */
         177  +
                    query_string_list, /* ServerHttpBoundProtocolGenerator.kt:1396 */
         178  +
                ), /* ServerHttpBoundProtocolGenerator.kt:1390 */
         179  +
            );
         180  +
            /* ServerHttpBoundProtocolGenerator.kt:1389 */
   79    181   
        }
         182  +
        /* ServerHttpBoundProtocolGenerator.kt:1389 */
   80    183   
        if !query_timestamp_list.is_empty() {
   81         -
            input = input.set_query_timestamp_list(Some(query_timestamp_list));
         184  +
            /* ServerHttpBoundProtocolGenerator.kt:1390 */
         185  +
            input = input.set_query_timestamp_list(
         186  +
                /* ServerHttpBoundProtocolGenerator.kt:1396 */
         187  +
                Some(
         188  +
                    /* ServerHttpBoundProtocolGenerator.kt:1405 */
         189  +
                    query_timestamp_list, /* ServerHttpBoundProtocolGenerator.kt:1396 */
         190  +
                ), /* ServerHttpBoundProtocolGenerator.kt:1390 */
         191  +
            );
         192  +
            /* ServerHttpBoundProtocolGenerator.kt:1389 */
   82    193   
        }
         194  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   83    195   
        input.build()?
         196  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   84    197   
    })
         198  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   85    199   
}
   86    200   
         201  +
/* RustType.kt:534 */
   87    202   
#[allow(clippy::unnecessary_wraps)]
         203  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   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:457 */
   94    211   
    Ok({
         212  +
        /* RustType.kt:534 */
   95    213   
        #[allow(unused_mut)]
   96         -
        let mut builder = ::http::Response::builder();
         214  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
         215  +
        let mut builder = ::http_1x::Response::builder();
         216  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   97    217   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   98    218   
            builder,
   99         -
            ::http::header::CONTENT_TYPE,
         219  +
            ::http_1x::header::CONTENT_TYPE,
  100    220   
            "application/json",
  101    221   
        );
         222  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
  102    223   
        let http_status: u16 = 200;
  103    224   
        builder = builder.status(http_status);
  104         -
        let payload = "";
         225  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
         226  +
        let payload =
         227  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
         228  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
         229  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
  105    230   
        let content_length = payload.len();
  106    231   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
  107    232   
            builder,
  108         -
            ::http::header::CONTENT_LENGTH,
         233  +
            ::http_1x::header::CONTENT_LENGTH,
  109    234   
            content_length,
  110    235   
        );
         236  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
  111    237   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
         238  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
  112    239   
        builder.body(body)?
         240  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
  113    241   
    })
         242  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
  114    243   
}
  115    244   
         245  +
/* RustType.kt:534 */
  116    246   
#[allow(clippy::unnecessary_wraps)]
         247  +
/* ServerHttpBoundProtocolGenerator.kt:471 */
  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:476 */
  123    255   
    Ok({
         256  +
        /* ServerHttpBoundProtocolGenerator.kt:492 */
  124    257   
        match error {
         258  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
  125    259   
            crate::error::OmitsSerializingEmptyListsError::ValidationException(output) => {
         260  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
  126    261   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         262  +
                /* RustType.kt:534 */
  127    263   
                #[allow(unused_mut)]
  128         -
                let mut builder = ::http::Response::builder();
         264  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         265  +
                let mut builder = ::http_1x::Response::builder();
         266  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
  129    267   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  130    268   
                    builder,
  131         -
                    ::http::header::CONTENT_TYPE,
         269  +
                    ::http_1x::header::CONTENT_TYPE,
  132    270   
                    "application/json",
  133    271   
                );
         272  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
  134    273   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  135    274   
                    builder,
  136         -
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         275  +
                    ::http_1x::header::HeaderName::from_static("x-amzn-errortype"),
  137    276   
                    "ValidationException",
  138    277   
                );
         278  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
  139    279   
                let content_length = payload.len();
  140    280   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  141    281   
                    builder,
  142         -
                    ::http::header::CONTENT_LENGTH,
         282  +
                    ::http_1x::header::CONTENT_LENGTH,
  143    283   
                    content_length,
  144    284   
                );
         285  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
  145    286   
                builder
  146    287   
                    .status(400)
  147    288   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         289  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         290  +
            } /* ServerHttpBoundProtocolGenerator.kt:492 */
  148    291   
        }
  149         -
        }
         292  +
        /* ServerHttpBoundProtocolGenerator.kt:476 */
  150    293   
    })
         294  +
    /* ServerHttpBoundProtocolGenerator.kt:471 */
  151    295   
}

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

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

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