Server Test

Server Test

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943 (ignoring whitespace)

Files changed:

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

@@ -1,1 +88,122 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_test_get_no_payload_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::TestGetNoPayloadInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::test_get_no_payload_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   22     30   
        if let Some(value) =
   23     31   
            crate::protocol_serde::shape_test_get_no_payload_input::de_test_id_header(&headers)?
   24     32   
        {
   25     33   
            input = input.set_test_id(Some(value))
   26     34   
        }
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   27     36   
        input.build()
          37  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   28     38   
    })
          39  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   29     40   
}
   30     41   
          42  +
/* RustType.kt:516 */
   31     43   
#[allow(clippy::unnecessary_wraps)]
          44  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   32     45   
pub fn ser_test_get_no_payload_http_response(
   33     46   
    #[allow(unused_variables)] output: crate::output::TestGetNoPayloadOutput,
   34     47   
) -> std::result::Result<
   35     48   
    ::aws_smithy_http_server::response::Response,
   36     49   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   37     50   
> {
          51  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   38     52   
    Ok({
          53  +
        /* RustType.kt:516 */
   39     54   
        #[allow(unused_mut)]
          55  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   40     56   
        let mut builder = ::http::Response::builder();
          57  +
        /* ServerHttpBoundProtocolGenerator.kt:629 */
   41     58   
        builder =
   42     59   
            crate::protocol_serde::shape_test_get_no_payload::ser_test_get_no_payload_headers(
   43     60   
                &output, builder,
   44     61   
            )?;
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   45     63   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   46     64   
            builder,
   47     65   
            ::http::header::CONTENT_TYPE,
   48     66   
            "application/json",
   49     67   
        );
          68  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   50     69   
        let http_status: u16 = 200;
   51     70   
        builder = builder.status(http_status);
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   52     72   
        let payload =
   53         -
            crate::protocol_serde::shape_test_get_no_payload_output::ser_test_get_no_payload_output_output_output(&output)?
   54         -
        ;
          73  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_test_get_no_payload_output::ser_test_get_no_payload_output_output_output(&output)?
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   55     76   
        let content_length = payload.len();
   56     77   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     78   
            builder,
   58     79   
            ::http::header::CONTENT_LENGTH,
   59     80   
            content_length,
   60     81   
        );
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   61     83   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   62     85   
        builder.body(body)?
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   63     87   
    })
          88  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   64     89   
}
   65     90   
          91  +
/* HttpBindingGenerator.kt:542 */
   66     92   
pub fn ser_test_get_no_payload_headers(
   67     93   
    input: &crate::output::TestGetNoPayloadOutput,
   68     94   
    mut builder: ::http::response::Builder,
   69     95   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
   70     96   
{
          97  +
    /* HttpBindingGenerator.kt:592 */
   71     98   
    if let ::std::option::Option::Some(inner_1) = &input.test_id {
          99  +
        /* HttpBindingGenerator.kt:704 */
   72    100   
        let formatted_2 = inner_1.as_str();
         101  +
        /* HttpBindingGenerator.kt:705 */
   73    102   
        if !formatted_2.is_empty() {
         103  +
            /* HttpBindingGenerator.kt:706 */
   74    104   
            let header_value = formatted_2;
   75    105   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   76    106   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   77    107   
                    "test_id",
   78    108   
                    format!(
   79    109   
                        "`{}` cannot be used as a header value: {}",
   80    110   
                        &header_value, err
   81    111   
                    ),
   82    112   
                )
   83    113   
            })?;
   84    114   
            builder = builder.header("X-Amz-Test-Id", header_value);
         115  +
            /* HttpBindingGenerator.kt:705 */
   85    116   
        }
         117  +
        /* HttpBindingGenerator.kt:592 */
   86    118   
    }
         119  +
    /* HttpBindingGenerator.kt:555 */
   87    120   
    Ok(builder)
         121  +
    /* HttpBindingGenerator.kt:542 */
   88    122   
}

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

@@ -1,1 +10,14 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:153 */
    2      3   
pub(crate) fn de_test_id_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::option::Option<::std::string::String>,
    6      7   
    ::aws_smithy_http::header::ParseError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:160 */
    8     10   
    let headers = header_map.get_all("X-Amz-Test-Id");
          11  +
    /* HttpBindingGenerator.kt:375 */
    9     12   
    ::aws_smithy_http::header::one_or_none(headers)
          13  +
    /* HttpBindingGenerator.kt:153 */
   10     14   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_test_get_no_payload_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_test_get_no_payload_output_output_output(
    3      4   
    value: &crate::output::TestGetNoPayloadOutput,
    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_test_get_no_payload_output::ser_test_get_no_payload_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_test_get_no_payload_output_output(
   16     22   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    #[allow(unused_variables)] input: &crate::output::TestGetNoPayloadOutput,
   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_test_payload_blob.rs

@@ -1,1 +89,123 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_test_payload_blob_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::TestPayloadBlobInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::test_payload_blob_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   22     30   
        if let Some(value) =
   23     31   
            crate::protocol_serde::shape_test_payload_blob_input::de_content_type_header(&headers)?
   24     32   
        {
   25     33   
            input = input.set_content_type(Some(value))
   26     34   
        }
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   27     36   
        if let Some(value) = {
   28     37   
            let bytes = ::hyper::body::to_bytes(body).await?;
   29     38   
   30     39   
            crate::protocol_serde::shape_test_payload_blob_input::de_data_payload(&bytes)?
   31     40   
        } {
   32     41   
            input = input.set_data(Some(value))
   33     42   
        }
          43  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   34     44   
        input.build()
          45  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   35     46   
    })
          47  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   36     48   
}
   37     49   
          50  +
/* RustType.kt:516 */
   38     51   
#[allow(clippy::unnecessary_wraps)]
          52  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   39     53   
pub fn ser_test_payload_blob_http_response(
   40     54   
    #[allow(unused_variables)] output: crate::output::TestPayloadBlobOutput,
   41     55   
) -> std::result::Result<
   42     56   
    ::aws_smithy_http_server::response::Response,
   43     57   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   44     58   
> {
          59  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   45     60   
    Ok({
          61  +
        /* RustType.kt:516 */
   46     62   
        #[allow(unused_mut)]
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   47     64   
        let mut builder = ::http::Response::builder();
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:629 */
   48     66   
        builder = crate::protocol_serde::shape_test_payload_blob::ser_test_payload_blob_headers(
   49     67   
            &output, builder,
   50     68   
        )?;
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   51     70   
        let http_status: u16 = 200;
   52     71   
        builder = builder.status(http_status);
   53         -
        let payload = crate::protocol_serde::shape_test_payload_blob_output::ser_data_http_payload(
   54         -
            output.data,
   55         -
        )?;
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          73  +
        let payload =
          74  +
            /* HttpBoundProtocolPayloadGenerator.kt:350 */crate::protocol_serde::shape_test_payload_blob_output::ser_data_http_payload( output.data)?
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   56     77   
        let content_length = payload.len();
   57     78   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   58     79   
            builder,
   59     80   
            ::http::header::CONTENT_LENGTH,
   60     81   
            content_length,
   61     82   
        );
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   62     84   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          85  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   63     86   
        builder.body(body)?
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   64     88   
    })
          89  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   65     90   
}
   66     91   
          92  +
/* HttpBindingGenerator.kt:542 */
   67     93   
pub fn ser_test_payload_blob_headers(
   68     94   
    input: &crate::output::TestPayloadBlobOutput,
   69     95   
    mut builder: ::http::response::Builder,
   70     96   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
   71     97   
{
          98  +
    /* HttpBindingGenerator.kt:592 */
   72     99   
    if let ::std::option::Option::Some(inner_1) = &input.content_type {
         100  +
        /* HttpBindingGenerator.kt:704 */
   73    101   
        let formatted_2 = inner_1.as_str();
         102  +
        /* HttpBindingGenerator.kt:705 */
   74    103   
        if !formatted_2.is_empty() {
         104  +
            /* HttpBindingGenerator.kt:706 */
   75    105   
            let header_value = formatted_2;
   76    106   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   77    107   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   78    108   
                    "content_type",
   79    109   
                    format!(
   80    110   
                        "`{}` cannot be used as a header value: {}",
   81    111   
                        &header_value, err
   82    112   
                    ),
   83    113   
                )
   84    114   
            })?;
   85    115   
            builder = builder.header("Content-Type", header_value);
         116  +
            /* HttpBindingGenerator.kt:705 */
   86    117   
        }
         118  +
        /* HttpBindingGenerator.kt:592 */
   87    119   
    }
         120  +
    /* HttpBindingGenerator.kt:555 */
   88    121   
    Ok(builder)
         122  +
    /* HttpBindingGenerator.kt:542 */
   89    123   
}

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

@@ -1,1 +21,32 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:153 */
    2      3   
pub(crate) fn de_content_type_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::option::Option<::std::string::String>,
    6      7   
    ::aws_smithy_http::header::ParseError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:160 */
    8     10   
    let headers = header_map.get_all("Content-Type");
          11  +
    /* HttpBindingGenerator.kt:375 */
    9     12   
    ::aws_smithy_http::header::one_or_none(headers)
          13  +
    /* HttpBindingGenerator.kt:153 */
   10     14   
}
   11     15   
          16  +
/* HttpBindingGenerator.kt:248 */
   12     17   
pub(crate) fn de_data_payload(
   13     18   
    body: &[u8],
   14     19   
) -> std::result::Result<
   15     20   
    ::std::option::Option<::aws_smithy_types::Blob>,
   16     21   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   17     22   
> {
          23  +
    /* HttpBindingGenerator.kt:319 */
   18     24   
    (!body.is_empty())
   19         -
        .then(|| Ok(::aws_smithy_types::Blob::new(body)))
          25  +
        .then(|| {
          26  +
            /* HttpBindingGenerator.kt:349 */
          27  +
            Ok(::aws_smithy_types::Blob::new(body))
          28  +
            /* HttpBindingGenerator.kt:319 */
          29  +
        })
   20     30   
        .transpose()
          31  +
    /* HttpBindingGenerator.kt:248 */
   21     32   
}

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

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

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

@@ -1,1 +99,134 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_test_payload_structure_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::TestPayloadStructureInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::test_payload_structure_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   22     30   
        if let Some(value) = {
   23     31   
            let bytes = ::hyper::body::to_bytes(body).await?;
   24     32   
            if !bytes.is_empty() {
   25     33   
                ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   26     34   
                    &headers,
   27     35   
                    Some("application/json"),
   28     36   
                )?;
   29     37   
            }
   30     38   
            crate::protocol_serde::shape_test_payload_structure_input::de_payload_config_payload(
   31     39   
                &bytes,
   32     40   
            )?
   33     41   
        } {
   34     42   
            input = input.set_payload_config(Some(value))
   35     43   
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   36     45   
        if let Some(value) =
   37     46   
            crate::protocol_serde::shape_test_payload_structure_input::de_test_id_header(&headers)?
   38     47   
        {
   39     48   
            input = input.set_test_id(Some(value))
   40     49   
        }
          50  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   41     51   
        input.build()
          52  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   42     53   
    })
          54  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   43     55   
}
   44     56   
          57  +
/* RustType.kt:516 */
   45     58   
#[allow(clippy::unnecessary_wraps)]
          59  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   46     60   
pub fn ser_test_payload_structure_http_response(
   47     61   
    #[allow(unused_variables)] output: crate::output::TestPayloadStructureOutput,
   48     62   
) -> std::result::Result<
   49     63   
    ::aws_smithy_http_server::response::Response,
   50     64   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   51     65   
> {
          66  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   52     67   
    Ok({
          68  +
        /* RustType.kt:516 */
   53     69   
        #[allow(unused_mut)]
          70  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   54     71   
        let mut builder = ::http::Response::builder();
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:629 */
   55     73   
        builder = crate::protocol_serde::shape_test_payload_structure::ser_test_payload_structure_headers(&output, builder)?;
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   56     75   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     76   
            builder,
   58     77   
            ::http::header::CONTENT_TYPE,
   59     78   
            "application/json",
   60     79   
        );
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   61     81   
        let http_status: u16 = 200;
   62     82   
        builder = builder.status(http_status);
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   63     84   
        let payload =
   64         -
            crate::protocol_serde::shape_test_payload_structure_output::ser_payload_config_http_payload(& output.payload_config)?
   65         -
        ;
          85  +
            /* HttpBoundProtocolPayloadGenerator.kt:350 */crate::protocol_serde::shape_test_payload_structure_output::ser_payload_config_http_payload(& output.payload_config)?
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   66     88   
        let content_length = payload.len();
   67     89   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   68     90   
            builder,
   69     91   
            ::http::header::CONTENT_LENGTH,
   70     92   
            content_length,
   71     93   
        );
          94  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   72     95   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          96  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   73     97   
        builder.body(body)?
          98  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   74     99   
    })
         100  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   75    101   
}
   76    102   
         103  +
/* HttpBindingGenerator.kt:542 */
   77    104   
pub fn ser_test_payload_structure_headers(
   78    105   
    input: &crate::output::TestPayloadStructureOutput,
   79    106   
    mut builder: ::http::response::Builder,
   80    107   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
   81    108   
{
         109  +
    /* HttpBindingGenerator.kt:592 */
   82    110   
    if let ::std::option::Option::Some(inner_1) = &input.test_id {
         111  +
        /* HttpBindingGenerator.kt:704 */
   83    112   
        let formatted_2 = inner_1.as_str();
         113  +
        /* HttpBindingGenerator.kt:705 */
   84    114   
        if !formatted_2.is_empty() {
         115  +
            /* HttpBindingGenerator.kt:706 */
   85    116   
            let header_value = formatted_2;
   86    117   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   87    118   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   88    119   
                    "test_id",
   89    120   
                    format!(
   90    121   
                        "`{}` cannot be used as a header value: {}",
   91    122   
                        &header_value, err
   92    123   
                    ),
   93    124   
                )
   94    125   
            })?;
   95    126   
            builder = builder.header("x-amz-test-id", header_value);
         127  +
            /* HttpBindingGenerator.kt:705 */
   96    128   
        }
         129  +
        /* HttpBindingGenerator.kt:592 */
   97    130   
    }
         131  +
    /* HttpBindingGenerator.kt:555 */
   98    132   
    Ok(builder)
         133  +
    /* HttpBindingGenerator.kt:542 */
   99    134   
}

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

@@ -1,1 +21,32 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:248 */
    2      3   
pub(crate) fn de_payload_config_payload(
    3      4   
    body: &[u8],
    4      5   
) -> std::result::Result<
    5      6   
    ::std::option::Option<crate::model::PayloadConfig>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:319 */
    8     10   
    (!body.is_empty())
    9         -
        .then(|| crate::protocol_serde::shape_payload_config::de_payload_config_payload(body))
          11  +
        .then(|| {
          12  +
            /* ServerHttpBoundProtocolGenerator.kt:850 */
          13  +
            crate::protocol_serde::shape_payload_config::de_payload_config_payload(body)
          14  +
            /* HttpBindingGenerator.kt:319 */
          15  +
        })
   10     16   
        .transpose()
          17  +
    /* HttpBindingGenerator.kt:248 */
   11     18   
}
   12     19   
          20  +
/* HttpBindingGenerator.kt:153 */
   13     21   
pub(crate) fn de_test_id_header(
   14     22   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   15     23   
) -> ::std::result::Result<
   16     24   
    ::std::option::Option<::std::string::String>,
   17     25   
    ::aws_smithy_http::header::ParseError,
   18     26   
> {
          27  +
    /* HttpBindingGenerator.kt:160 */
   19     28   
    let headers = header_map.get_all("x-amz-test-id");
          29  +
    /* HttpBindingGenerator.kt:375 */
   20     30   
    ::aws_smithy_http::header::one_or_none(headers)
          31  +
    /* HttpBindingGenerator.kt:153 */
   21     32   
}

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

@@ -1,1 +27,44 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBoundProtocolPayloadGenerator.kt:311 */
    2      3   
pub fn ser_payload_config_http_payload(
    3      4   
    payload: &::std::option::Option<crate::model::PayloadConfig>,
    4      5   
) -> ::std::result::Result<::std::vec::Vec<u8>, ::aws_smithy_types::error::operation::BuildError> {
           6  +
    /* HttpBoundProtocolPayloadGenerator.kt:320 */
    5      7   
    let payload = match payload.as_ref() {
    6      8   
        Some(t) => t,
    7         -
        None => return Ok(crate::protocol_serde::rest_json_unset_struct_payload()),
           9  +
        None => {
          10  +
            return Ok(
          11  +
                /* HttpBoundProtocolPayloadGenerator.kt:338 */
          12  +
                crate::protocol_serde::rest_json_unset_struct_payload(), /* HttpBoundProtocolPayloadGenerator.kt:320 */
          13  +
            )
          14  +
        }
    8     15   
    };
          16  +
    /* HttpBoundProtocolPayloadGenerator.kt:345 */
    9     17   
    Ok(
          18  +
        /* HttpBoundProtocolPayloadGenerator.kt:386 */
   10     19   
        crate::protocol_serde::shape_test_payload_structure_output::ser_payload_config_payload(
   11     20   
            payload,
   12         -
        )?,
          21  +
        )?, /* HttpBoundProtocolPayloadGenerator.kt:345 */
   13     22   
    )
          23  +
    /* HttpBoundProtocolPayloadGenerator.kt:311 */
   14     24   
}
   15     25   
          26  +
/* JsonSerializerGenerator.kt:240 */
   16     27   
pub fn ser_payload_config_payload(
   17     28   
    input: &crate::model::PayloadConfig,
   18     29   
) -> std::result::Result<
   19     30   
    ::std::vec::Vec<u8>,
   20     31   
    ::aws_smithy_types::error::operation::SerializationError,
   21     32   
> {
          33  +
    /* JsonSerializerGenerator.kt:245 */
   22     34   
    let mut out = String::new();
          35  +
    /* JsonSerializerGenerator.kt:246 */
   23     36   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
          37  +
    /* JsonSerializerGenerator.kt:375 */
   24     38   
    crate::protocol_serde::shape_payload_config::ser_payload_config(&mut object, input)?;
          39  +
    /* JsonSerializerGenerator.kt:252 */
   25     40   
    object.finish();
          41  +
    /* JsonSerializerGenerator.kt:253 */
   26     42   
    Ok(out.into_bytes())
          43  +
    /* JsonSerializerGenerator.kt:240 */
   27     44   
}

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

@@ -1,1 +81,115 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_test_post_no_input_no_payload_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::TestPostNoInputNoPayloadInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::test_post_no_input_no_payload_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:811 */
   22     30   
        ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(&headers, None)?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   23     32   
        input.build()
          33  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   24     34   
    })
          35  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   25     36   
}
   26     37   
          38  +
/* RustType.kt:516 */
   27     39   
#[allow(clippy::unnecessary_wraps)]
          40  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   28     41   
pub fn ser_test_post_no_input_no_payload_http_response(
   29     42   
    #[allow(unused_variables)] output: crate::output::TestPostNoInputNoPayloadOutput,
   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:433 */
   34     48   
    Ok({
          49  +
        /* RustType.kt:516 */
   35     50   
        #[allow(unused_mut)]
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   36     52   
        let mut builder = ::http::Response::builder();
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:629 */
   37     54   
        builder = crate::protocol_serde::shape_test_post_no_input_no_payload::ser_test_post_no_input_no_payload_headers(&output, builder)?;
          55  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   38     56   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   39     57   
            builder,
   40     58   
            ::http::header::CONTENT_TYPE,
   41     59   
            "application/json",
   42     60   
        );
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   43     62   
        let http_status: u16 = 200;
   44     63   
        builder = builder.status(http_status);
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   45     65   
        let payload =
   46         -
            crate::protocol_serde::shape_test_post_no_input_no_payload_output::ser_test_post_no_input_no_payload_output_output_output(&output)?
   47         -
        ;
          66  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_test_post_no_input_no_payload_output::ser_test_post_no_input_no_payload_output_output_output(&output)?
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          68  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   48     69   
        let content_length = payload.len();
   49     70   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   50     71   
            builder,
   51     72   
            ::http::header::CONTENT_LENGTH,
   52     73   
            content_length,
   53     74   
        );
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   54     76   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   55     78   
        builder.body(body)?
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   56     80   
    })
          81  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   57     82   
}
   58     83   
          84  +
/* HttpBindingGenerator.kt:542 */
   59     85   
pub fn ser_test_post_no_input_no_payload_headers(
   60     86   
    input: &crate::output::TestPostNoInputNoPayloadOutput,
   61     87   
    mut builder: ::http::response::Builder,
   62     88   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
   63     89   
{
          90  +
    /* HttpBindingGenerator.kt:592 */
   64     91   
    if let ::std::option::Option::Some(inner_1) = &input.test_id {
          92  +
        /* HttpBindingGenerator.kt:704 */
   65     93   
        let formatted_2 = inner_1.as_str();
          94  +
        /* HttpBindingGenerator.kt:705 */
   66     95   
        if !formatted_2.is_empty() {
          96  +
            /* HttpBindingGenerator.kt:706 */
   67     97   
            let header_value = formatted_2;
   68     98   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   69     99   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   70    100   
                    "test_id",
   71    101   
                    format!(
   72    102   
                        "`{}` cannot be used as a header value: {}",
   73    103   
                        &header_value, err
   74    104   
                    ),
   75    105   
                )
   76    106   
            })?;
   77    107   
            builder = builder.header("X-Amz-Test-Id", header_value);
         108  +
            /* HttpBindingGenerator.kt:705 */
   78    109   
        }
         110  +
        /* HttpBindingGenerator.kt:592 */
   79    111   
    }
         112  +
    /* HttpBindingGenerator.kt:555 */
   80    113   
    Ok(builder)
         114  +
    /* HttpBindingGenerator.kt:542 */
   81    115   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_test_post_no_input_no_payload_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_test_post_no_input_no_payload_output_output_output(
    3      4   
    value: &crate::output::TestPostNoInputNoPayloadOutput,
    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_test_post_no_input_no_payload_output::ser_test_post_no_input_no_payload_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_test_post_no_input_no_payload_output_output(
   13     19   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    #[allow(unused_variables)] input: &crate::output::TestPostNoInputNoPayloadOutput,
   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_test_post_no_payload.rs

@@ -1,1 +88,122 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_test_post_no_payload_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::TestPostNoPayloadInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::test_post_no_payload_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   22     30   
        if let Some(value) =
   23     31   
            crate::protocol_serde::shape_test_post_no_payload_input::de_test_id_header(&headers)?
   24     32   
        {
   25     33   
            input = input.set_test_id(Some(value))
   26     34   
        }
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   27     36   
        input.build()
          37  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   28     38   
    })
          39  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   29     40   
}
   30     41   
          42  +
/* RustType.kt:516 */
   31     43   
#[allow(clippy::unnecessary_wraps)]
          44  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   32     45   
pub fn ser_test_post_no_payload_http_response(
   33     46   
    #[allow(unused_variables)] output: crate::output::TestPostNoPayloadOutput,
   34     47   
) -> std::result::Result<
   35     48   
    ::aws_smithy_http_server::response::Response,
   36     49   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   37     50   
> {
          51  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   38     52   
    Ok({
          53  +
        /* RustType.kt:516 */
   39     54   
        #[allow(unused_mut)]
          55  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   40     56   
        let mut builder = ::http::Response::builder();
          57  +
        /* ServerHttpBoundProtocolGenerator.kt:629 */
   41     58   
        builder =
   42     59   
            crate::protocol_serde::shape_test_post_no_payload::ser_test_post_no_payload_headers(
   43     60   
                &output, builder,
   44     61   
            )?;
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   45     63   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   46     64   
            builder,
   47     65   
            ::http::header::CONTENT_TYPE,
   48     66   
            "application/json",
   49     67   
        );
          68  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   50     69   
        let http_status: u16 = 200;
   51     70   
        builder = builder.status(http_status);
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   52     72   
        let payload =
   53         -
            crate::protocol_serde::shape_test_post_no_payload_output::ser_test_post_no_payload_output_output_output(&output)?
   54         -
        ;
          73  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_test_post_no_payload_output::ser_test_post_no_payload_output_output_output(&output)?
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   55     76   
        let content_length = payload.len();
   56     77   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     78   
            builder,
   58     79   
            ::http::header::CONTENT_LENGTH,
   59     80   
            content_length,
   60     81   
        );
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   61     83   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   62     85   
        builder.body(body)?
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   63     87   
    })
          88  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   64     89   
}
   65     90   
          91  +
/* HttpBindingGenerator.kt:542 */
   66     92   
pub fn ser_test_post_no_payload_headers(
   67     93   
    input: &crate::output::TestPostNoPayloadOutput,
   68     94   
    mut builder: ::http::response::Builder,
   69     95   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
   70     96   
{
          97  +
    /* HttpBindingGenerator.kt:592 */
   71     98   
    if let ::std::option::Option::Some(inner_1) = &input.test_id {
          99  +
        /* HttpBindingGenerator.kt:704 */
   72    100   
        let formatted_2 = inner_1.as_str();
         101  +
        /* HttpBindingGenerator.kt:705 */
   73    102   
        if !formatted_2.is_empty() {
         103  +
            /* HttpBindingGenerator.kt:706 */
   74    104   
            let header_value = formatted_2;
   75    105   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   76    106   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   77    107   
                    "test_id",
   78    108   
                    format!(
   79    109   
                        "`{}` cannot be used as a header value: {}",
   80    110   
                        &header_value, err
   81    111   
                    ),
   82    112   
                )
   83    113   
            })?;
   84    114   
            builder = builder.header("X-Amz-Test-Id", header_value);
         115  +
            /* HttpBindingGenerator.kt:705 */
   85    116   
        }
         117  +
        /* HttpBindingGenerator.kt:592 */
   86    118   
    }
         119  +
    /* HttpBindingGenerator.kt:555 */
   87    120   
    Ok(builder)
         121  +
    /* HttpBindingGenerator.kt:542 */
   88    122   
}

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

@@ -1,1 +10,14 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:153 */
    2      3   
pub(crate) fn de_test_id_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::option::Option<::std::string::String>,
    6      7   
    ::aws_smithy_http::header::ParseError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:160 */
    8     10   
    let headers = header_map.get_all("X-Amz-Test-Id");
          11  +
    /* HttpBindingGenerator.kt:375 */
    9     12   
    ::aws_smithy_http::header::one_or_none(headers)
          13  +
    /* HttpBindingGenerator.kt:153 */
   10     14   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_test_post_no_payload_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_test_post_no_payload_output_output_output(
    3      4   
    value: &crate::output::TestPostNoPayloadOutput,
    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_test_post_no_payload_output::ser_test_post_no_payload_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_test_post_no_payload_output_output(
   13     19   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    #[allow(unused_variables)] input: &crate::output::TestPostNoPayloadOutput,
   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_test_string_list.rs

@@ -1,1 +52,78 @@
    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_test_string_list<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<::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   
                    _ => {
   27         -
                        let value = ::aws_smithy_json::deserialize::token::expect_string_or_null(
   28         -
                            tokens.next(),
   29         -
                        )?
   30         -
                        .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   31         -
                        .transpose()?;
          37  +
                        /* JsonParserGenerator.kt:419 */
          38  +
                        let value =
          39  +
                            /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          40  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          41  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
          42  +
                                /* JsonParserGenerator.kt:339 */)
          43  +
                            /* JsonParserGenerator.kt:354 */).transpose()?
          44  +
                        /* JsonParserGenerator.kt:419 */;
          45  +
                        /* JsonParserGenerator.kt:422 */
   32     46   
                        if let Some(value) = value {
   33     47   
                            items.push(value);
   34         -
                        } else {
          48  +
                        }
          49  +
                        /* JsonParserGenerator.kt:430 */
          50  +
                        else {
   35     51   
                            return Err(
   36     52   
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37     53   
                                    "dense list cannot contain null values",
   38     54   
                                ),
   39     55   
                            );
   40     56   
                        }
          57  +
                        /* JsonParserGenerator.kt:413 */
          58  +
                    } /* JsonParserGenerator.kt:409 */
   41     59   
                }
          60  +
                /* JsonParserGenerator.kt:408 */
   42     61   
            }
   43         -
            }
          62  +
            /* JsonParserGenerator.kt:446 */
   44     63   
            Ok(Some(items))
          64  +
            /* JsonParserGenerator.kt:713 */
   45     65   
        }
   46         -
        _ => Err(
          66  +
        /* JsonParserGenerator.kt:722 */
          67  +
        _ => {
          68  +
            /* JsonParserGenerator.kt:723 */
          69  +
            Err(
   47     70   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   48     71   
                    "expected start array or null",
   49     72   
                ),
   50         -
        ),
          73  +
            )
          74  +
            /* JsonParserGenerator.kt:722 */
          75  +
        } /* JsonParserGenerator.kt:712 */
   51     76   
    }
          77  +
    /* JsonParserGenerator.kt:398 */
   52     78   
}

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

@@ -1,1 +60,87 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:460 */
    2      3   
pub(crate) fn de_test_string_map<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<::std::collections::HashMap<::std::string::String, ::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::StartObject { .. }) => {
          22  +
            /* JsonParserGenerator.kt:469 */
   19     23   
            let mut map = ::std::collections::HashMap::new();
          24  +
            /* JsonParserGenerator.kt:684 */
   20     25   
            loop {
          26  +
                /* JsonParserGenerator.kt:685 */
   21     27   
                match tokens.next().transpose()? {
          28  +
                    /* JsonParserGenerator.kt:686 */
   22     29   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   23     30   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
   24         -
                        let key = key.to_unescaped().map(|u| u.into_owned())?;
   25         -
                        let value = ::aws_smithy_json::deserialize::token::expect_string_or_null(
   26         -
                            tokens.next(),
   27         -
                        )?
   28         -
                        .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   29         -
                        .transpose()?;
          31  +
                        /* JsonParserGenerator.kt:471 */
          32  +
                        let key =
          33  +
                            /* JsonParserGenerator.kt:339 */key.to_unescaped().map(|u|
          34  +
                                /* JsonParserGenerator.kt:348 */u.into_owned()
          35  +
                            /* JsonParserGenerator.kt:339 */)
          36  +
                        /* JsonParserGenerator.kt:471 */?;
          37  +
                        /* JsonParserGenerator.kt:474 */
          38  +
                        let value =
          39  +
                            /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          40  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          41  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
          42  +
                                /* JsonParserGenerator.kt:339 */)
          43  +
                            /* JsonParserGenerator.kt:354 */).transpose()?
          44  +
                        /* JsonParserGenerator.kt:474 */;
          45  +
                        /* JsonParserGenerator.kt:481 */
   30     46   
                        match value {
   31     47   
                            Some(value) => {
   32     48   
                                map.insert(key, value);
   33     49   
                            }
   34     50   
                            None => {
   35     51   
                                return Err(
   36     52   
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37     53   
                                        "dense map cannot contain null values",
   38     54   
                                    ),
   39     55   
                                )
   40     56   
                            }
   41     57   
                        }
          58  +
                        /* JsonParserGenerator.kt:686 */
   42     59   
                    }
          60  +
                    /* JsonParserGenerator.kt:695 */
   43     61   
                    other => {
   44     62   
                        return Err(
   45     63   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   46     64   
                                format!("expected object key or end object, found: {:?}", other),
   47     65   
                            ),
   48     66   
                        )
          67  +
                    } /* JsonParserGenerator.kt:685 */
   49     68   
                }
          69  +
                /* JsonParserGenerator.kt:684 */
   50     70   
            }
   51         -
            }
          71  +
            /* JsonParserGenerator.kt:504 */
   52     72   
            Ok(Some(map))
          73  +
            /* JsonParserGenerator.kt:713 */
   53     74   
        }
   54         -
        _ => Err(
          75  +
        /* JsonParserGenerator.kt:722 */
          76  +
        _ => {
          77  +
            /* JsonParserGenerator.kt:723 */
          78  +
            Err(
   55     79   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   56     80   
                    "expected start object or null",
   57     81   
                ),
   58         -
        ),
          82  +
            )
          83  +
            /* JsonParserGenerator.kt:722 */
          84  +
        } /* JsonParserGenerator.kt:712 */
   59     85   
    }
          86  +
    /* JsonParserGenerator.kt:460 */
   60     87   
}