Server Test

Server Test

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943

Files changed:

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

@@ -1,1 +57,84 @@
    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_http_response_code_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::HttpResponseCodeInput,
    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::http_response_code_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_http_response_code_http_response(
   29     42   
    #[allow(unused_variables)] output: crate::output::HttpResponseCodeOutput,
   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:597 */
   37     54   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   38     55   
            builder,
   39     56   
            ::http::header::CONTENT_TYPE,
   40     57   
            "application/json",
   41     58   
        );
   42         -
        let status = output.status.unwrap_or(200);
          59  +
        /* ServerHttpBoundProtocolGenerator.kt:701 */
          60  +
        let status = output.status
          61  +
            /* ServerHttpBoundProtocolGenerator.kt:703 */.unwrap_or(200)
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:701 */;
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:706 */
   43     64   
        let http_status: u16 = status.try_into().map_err(::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection::InvalidHttpStatusCode)?;
   44     65   
        builder = builder.status(http_status);
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   45     67   
        let payload =
   46         -
            crate::protocol_serde::shape_http_response_code_output::ser_http_response_code_output_output_output(&output)?
   47         -
        ;
          68  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_http_response_code_output::ser_http_response_code_output_output_output(&output)?
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          70  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   48     71   
        let content_length = payload.len();
   49     72   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   50     73   
            builder,
   51     74   
            ::http::header::CONTENT_LENGTH,
   52     75   
            content_length,
   53     76   
        );
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   54     78   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   55     80   
        builder.body(body)?
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   56     82   
    })
          83  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   57     84   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_http_response_code_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_http_response_code_output_output_output(
    3      4   
    value: &crate::output::HttpResponseCodeOutput,
    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_http_response_code_output::ser_http_response_code_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_http_response_code_output_output(
   16     22   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    #[allow(unused_variables)] input: &crate::output::HttpResponseCodeOutput,
   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_http_string_payload.rs

@@ -1,1 +68,91 @@
    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_http_string_payload_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::HttpStringPayloadInput,
    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::http_string_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   
            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("text/plain"),
   28     36   
                )?;
   29     37   
            }
   30     38   
            crate::protocol_serde::shape_http_string_payload_input::de_payload_payload(&bytes)?
   31     39   
        } {
   32     40   
            input = input.set_payload(Some(value))
   33     41   
        }
          42  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   34     43   
        input.build()
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   35     45   
    })
          46  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   36     47   
}
   37     48   
          49  +
/* RustType.kt:516 */
   38     50   
#[allow(clippy::unnecessary_wraps)]
          51  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   39     52   
pub fn ser_http_string_payload_http_response(
   40     53   
    #[allow(unused_variables)] output: crate::output::HttpStringPayloadOutput,
   41     54   
) -> std::result::Result<
   42     55   
    ::aws_smithy_http_server::response::Response,
   43     56   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   44     57   
> {
          58  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   45     59   
    Ok({
          60  +
        /* RustType.kt:516 */
   46     61   
        #[allow(unused_mut)]
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   47     63   
        let mut builder = ::http::Response::builder();
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   48     65   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   49     66   
            builder,
   50     67   
            ::http::header::CONTENT_TYPE,
   51     68   
            "text/plain",
   52     69   
        );
          70  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   53     71   
        let http_status: u16 = 200;
   54     72   
        builder = builder.status(http_status);
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   55     74   
        let payload =
   56         -
            crate::protocol_serde::shape_http_string_payload_output::ser_payload_http_payload(
   57         -
                output.payload,
   58         -
            )?;
          75  +
            /* HttpBoundProtocolPayloadGenerator.kt:350 */crate::protocol_serde::shape_http_string_payload_output::ser_payload_http_payload( output.payload)?
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   59     78   
        let content_length = payload.len();
   60     79   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   61     80   
            builder,
   62     81   
            ::http::header::CONTENT_LENGTH,
   63     82   
            content_length,
   64     83   
        );
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   65     85   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   66     87   
        builder.body(body)?
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   67     89   
    })
          90  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   68     91   
}

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

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

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_http_string_payload_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_payload_http_payload(
    3      4   
    payload: ::std::option::Option<::std::string::String>,
    4      5   
) -> ::std::result::Result<::std::vec::Vec<u8>, ::aws_smithy_types::error::operation::BuildError> {
           6  +
    /* HttpBoundProtocolPayloadGenerator.kt:320 */
    5      7   
    let payload = match payload {
    6      8   
        Some(t) => t,
    7         -
        None => return Ok(Vec::new()),
           9  +
        None => {
          10  +
            return Ok(
          11  +
                /* HttpBoundProtocolPayloadGenerator.kt:332 */
          12  +
                Vec::new(), /* HttpBoundProtocolPayloadGenerator.kt:320 */
          13  +
            )
          14  +
        }
    8     15   
    };
    9         -
    Ok(payload.into_bytes())
          16  +
    /* HttpBoundProtocolPayloadGenerator.kt:345 */
          17  +
    Ok(
          18  +
        /* HttpBoundProtocolPayloadGenerator.kt:366 */
          19  +
        payload.into_bytes(), /* 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_ignore_query_params_in_response.rs

@@ -1,1 +56,80 @@
    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_ignore_query_params_in_response_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::IgnoreQueryParamsInResponseInput,
    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::ignore_query_params_in_response_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_ignore_query_params_in_response_http_response(
   29     42   
    #[allow(unused_variables)] output: crate::output::IgnoreQueryParamsInResponseOutput,
   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:597 */
   37     54   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   38     55   
            builder,
   39     56   
            ::http::header::CONTENT_TYPE,
   40     57   
            "application/json",
   41     58   
        );
          59  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   42     60   
        let http_status: u16 = 200;
   43     61   
        builder = builder.status(http_status);
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   44     63   
        let payload =
   45         -
            crate::protocol_serde::shape_ignore_query_params_in_response_output::ser_ignore_query_params_in_response_output_output_output(&output)?
   46         -
        ;
          64  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_ignore_query_params_in_response_output::ser_ignore_query_params_in_response_output_output_output(&output)?
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   47     67   
        let content_length = payload.len();
   48     68   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   49     69   
            builder,
   50     70   
            ::http::header::CONTENT_LENGTH,
   51     71   
            content_length,
   52     72   
        );
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   53     74   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   54     76   
        builder.body(body)?
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   55     78   
    })
          79  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   56     80   
}

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

@@ -1,1 +20,31 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_ignore_query_params_in_response_output_output_output(
    3      4   
    value: &crate::output::IgnoreQueryParamsInResponseOutput,
    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_ignore_query_params_in_response_output::ser_ignore_query_params_in_response_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_ignore_query_params_in_response_output_output(
   13     19   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    input: &crate::output::IgnoreQueryParamsInResponseOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* JsonSerializerGenerator.kt:382 */
   16     23   
    if let Some(var_1) = &input.baz {
          24  +
        /* JsonSerializerGenerator.kt:423 */
   17     25   
        object.key("baz").string(var_1.as_str());
          26  +
        /* JsonSerializerGenerator.kt:382 */
   18     27   
    }
          28  +
    /* JsonSerializerGenerator.kt:372 */
   19     29   
    Ok(())
          30  +
    /* JsonSerializerGenerator.kt:358 */
   20     31   
}

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

@@ -1,1 +481,675 @@
    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_input_and_output_with_headers_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::InputAndOutputWithHeadersInput,
    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::input_and_output_with_headers_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) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_boolean_list_header(&headers)? {
   23     31   
                                input = input.set_header_boolean_list(Some(value))
   24     32   
                            }
          33  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   25     34   
        if let Some(value) =
   26     35   
            crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_byte_header(
   27     36   
                &headers,
   28     37   
            )?
   29     38   
        {
   30     39   
            input = input.set_header_byte(Some(value))
   31     40   
        }
          41  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   32     42   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_double_header(&headers)? {
   33     43   
                                input = input.set_header_double(Some(value))
   34     44   
                            }
          45  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   35     46   
        if let Some(value) =
   36     47   
            crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_enum_header(
   37     48   
                &headers,
   38     49   
            )?
   39     50   
        {
   40     51   
            input = input.set_header_enum(Some(value))
   41     52   
        }
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   42     54   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_enum_list_header(&headers)? {
   43     55   
                                input = input.set_header_enum_list(Some(value))
   44     56   
                            }
          57  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   45     58   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_false_bool_header(&headers)? {
   46     59   
                                input = input.set_header_false_bool(Some(value))
   47     60   
                            }
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   48     62   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_float_header(&headers)? {
   49     63   
                                input = input.set_header_float(Some(value))
   50     64   
                            }
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   51     66   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_integer_header(&headers)? {
   52     67   
                                input = input.set_header_integer(Some(value))
   53     68   
                            }
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   54     70   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_integer_enum_header(&headers)? {
   55     71   
                                input = input.set_header_integer_enum(Some(value))
   56     72   
                            }
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   57     74   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_integer_enum_list_header(&headers)? {
   58     75   
                                input = input.set_header_integer_enum_list(Some(value))
   59     76   
                            }
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   60     78   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_integer_list_header(&headers)? {
   61     79   
                                input = input.set_header_integer_list(Some(value))
   62     80   
                            }
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   63     82   
        if let Some(value) =
   64     83   
            crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_long_header(
   65     84   
                &headers,
   66     85   
            )?
   67     86   
        {
   68     87   
            input = input.set_header_long(Some(value))
   69     88   
        }
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   70     90   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_short_header(&headers)? {
   71     91   
                                input = input.set_header_short(Some(value))
   72     92   
                            }
          93  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   73     94   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_string_header(&headers)? {
   74     95   
                                input = input.set_header_string(Some(value))
   75     96   
                            }
          97  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   76     98   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_string_list_header(&headers)? {
   77     99   
                                input = input.set_header_string_list(Some(value))
   78    100   
                            }
         101  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   79    102   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_string_set_header(&headers)? {
   80    103   
                                input = input.set_header_string_set(Some(value))
   81    104   
                            }
         105  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   82    106   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_timestamp_list_header(&headers)? {
   83    107   
                                input = input.set_header_timestamp_list(Some(value))
   84    108   
                            }
         109  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   85    110   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_true_bool_header(&headers)? {
   86    111   
                                input = input.set_header_true_bool(Some(value))
   87    112   
                            }
         113  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   88    114   
        input.build()?
         115  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   89    116   
    })
         117  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   90    118   
}
   91    119   
         120  +
/* RustType.kt:516 */
   92    121   
#[allow(clippy::unnecessary_wraps)]
         122  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   93    123   
pub fn ser_input_and_output_with_headers_http_response(
   94    124   
    #[allow(unused_variables)] output: crate::output::InputAndOutputWithHeadersOutput,
   95    125   
) -> std::result::Result<
   96    126   
    ::aws_smithy_http_server::response::Response,
   97    127   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   98    128   
> {
         129  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   99    130   
    Ok({
         131  +
        /* RustType.kt:516 */
  100    132   
        #[allow(unused_mut)]
         133  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
  101    134   
        let mut builder = ::http::Response::builder();
         135  +
        /* ServerHttpBoundProtocolGenerator.kt:629 */
  102    136   
        builder = crate::protocol_serde::shape_input_and_output_with_headers::ser_input_and_output_with_headers_headers(&output, builder)?;
         137  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
  103    138   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
  104    139   
            builder,
  105    140   
            ::http::header::CONTENT_TYPE,
  106    141   
            "application/json",
  107    142   
        );
         143  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
  108    144   
        let http_status: u16 = 200;
  109    145   
        builder = builder.status(http_status);
         146  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
  110    147   
        let payload =
  111         -
            crate::protocol_serde::shape_input_and_output_with_headers_output::ser_input_and_output_with_headers_output_output_output(&output)?
  112         -
        ;
         148  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_input_and_output_with_headers_output::ser_input_and_output_with_headers_output_output_output(&output)?
         149  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
         150  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
  113    151   
        let content_length = payload.len();
  114    152   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
  115    153   
            builder,
  116    154   
            ::http::header::CONTENT_LENGTH,
  117    155   
            content_length,
  118    156   
        );
         157  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
  119    158   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
         159  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
  120    160   
        builder.body(body)?
         161  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
  121    162   
    })
         163  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
  122    164   
}
  123    165   
         166  +
/* RustType.kt:516 */
  124    167   
#[allow(clippy::unnecessary_wraps)]
         168  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
  125    169   
pub fn ser_input_and_output_with_headers_http_error(
  126    170   
    error: &crate::error::InputAndOutputWithHeadersError,
  127    171   
) -> std::result::Result<
  128    172   
    ::aws_smithy_http_server::response::Response,
  129    173   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
  130    174   
> {
         175  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
  131    176   
    Ok({
         177  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
  132    178   
        match error {
         179  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  133    180   
            crate::error::InputAndOutputWithHeadersError::ValidationException(output) => {
         181  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  134    182   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         183  +
                /* RustType.kt:516 */
  135    184   
                #[allow(unused_mut)]
         185  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  136    186   
                let mut builder = ::http::Response::builder();
         187  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  137    188   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  138    189   
                    builder,
  139    190   
                    ::http::header::CONTENT_TYPE,
  140    191   
                    "application/json",
  141    192   
                );
         193  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  142    194   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  143    195   
                    builder,
  144    196   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  145    197   
                    "ValidationException",
  146    198   
                );
         199  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  147    200   
                let content_length = payload.len();
  148    201   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  149    202   
                    builder,
  150    203   
                    ::http::header::CONTENT_LENGTH,
  151    204   
                    content_length,
  152    205   
                );
         206  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  153    207   
                builder
  154    208   
                    .status(400)
  155    209   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  156         -
            }
         210  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         211  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  157    212   
        }
         213  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  158    214   
    })
         215  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  159    216   
}
  160    217   
         218  +
/* HttpBindingGenerator.kt:542 */
  161    219   
pub fn ser_input_and_output_with_headers_headers(
  162    220   
    input: &crate::output::InputAndOutputWithHeadersOutput,
  163    221   
    mut builder: ::http::response::Builder,
  164    222   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
  165    223   
{
         224  +
    /* HttpBindingGenerator.kt:592 */
  166    225   
    if let ::std::option::Option::Some(inner_1) = &input.header_string {
         226  +
        /* HttpBindingGenerator.kt:704 */
  167    227   
        let formatted_2 = inner_1.as_str();
         228  +
        /* HttpBindingGenerator.kt:705 */
  168    229   
        if !formatted_2.is_empty() {
         230  +
            /* HttpBindingGenerator.kt:706 */
  169    231   
            let header_value = formatted_2;
  170    232   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  171    233   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  172    234   
                    "header_string",
  173    235   
                    format!(
  174    236   
                        "`{}` cannot be used as a header value: {}",
  175    237   
                        &header_value, err
  176    238   
                    ),
  177    239   
                )
  178    240   
            })?;
  179    241   
            builder = builder.header("X-String", header_value);
         242  +
            /* HttpBindingGenerator.kt:705 */
  180    243   
        }
         244  +
        /* HttpBindingGenerator.kt:592 */
  181    245   
    }
         246  +
    /* HttpBindingGenerator.kt:592 */
  182    247   
    if let ::std::option::Option::Some(inner_3) = &input.header_byte {
         248  +
        /* HttpBindingGenerator.kt:690 */
  183    249   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_3);
         250  +
        /* HttpBindingGenerator.kt:704 */
  184    251   
        let formatted_4 = encoder.encode();
         252  +
        /* HttpBindingGenerator.kt:705 */
  185    253   
        if !formatted_4.is_empty() {
         254  +
            /* HttpBindingGenerator.kt:706 */
  186    255   
            let header_value = formatted_4;
  187    256   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  188    257   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  189    258   
                    "header_byte",
  190    259   
                    format!(
  191    260   
                        "`{}` cannot be used as a header value: {}",
  192    261   
                        &header_value, err
  193    262   
                    ),
  194    263   
                )
  195    264   
            })?;
  196    265   
            builder = builder.header("X-Byte", header_value);
         266  +
            /* HttpBindingGenerator.kt:705 */
  197    267   
        }
         268  +
        /* HttpBindingGenerator.kt:592 */
  198    269   
    }
         270  +
    /* HttpBindingGenerator.kt:592 */
  199    271   
    if let ::std::option::Option::Some(inner_5) = &input.header_short {
         272  +
        /* HttpBindingGenerator.kt:690 */
  200    273   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_5);
         274  +
        /* HttpBindingGenerator.kt:704 */
  201    275   
        let formatted_6 = encoder.encode();
         276  +
        /* HttpBindingGenerator.kt:705 */
  202    277   
        if !formatted_6.is_empty() {
         278  +
            /* HttpBindingGenerator.kt:706 */
  203    279   
            let header_value = formatted_6;
  204    280   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  205    281   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  206    282   
                    "header_short",
  207    283   
                    format!(
  208    284   
                        "`{}` cannot be used as a header value: {}",
  209    285   
                        &header_value, err
  210    286   
                    ),
  211    287   
                )
  212    288   
            })?;
  213    289   
            builder = builder.header("X-Short", header_value);
         290  +
            /* HttpBindingGenerator.kt:705 */
  214    291   
        }
         292  +
        /* HttpBindingGenerator.kt:592 */
  215    293   
    }
         294  +
    /* HttpBindingGenerator.kt:592 */
  216    295   
    if let ::std::option::Option::Some(inner_7) = &input.header_integer {
         296  +
        /* HttpBindingGenerator.kt:690 */
  217    297   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_7);
         298  +
        /* HttpBindingGenerator.kt:704 */
  218    299   
        let formatted_8 = encoder.encode();
         300  +
        /* HttpBindingGenerator.kt:705 */
  219    301   
        if !formatted_8.is_empty() {
         302  +
            /* HttpBindingGenerator.kt:706 */
  220    303   
            let header_value = formatted_8;
  221    304   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  222    305   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  223    306   
                    "header_integer",
  224    307   
                    format!(
  225    308   
                        "`{}` cannot be used as a header value: {}",
  226    309   
                        &header_value, err
  227    310   
                    ),
  228    311   
                )
  229    312   
            })?;
  230    313   
            builder = builder.header("X-Integer", header_value);
         314  +
            /* HttpBindingGenerator.kt:705 */
  231    315   
        }
         316  +
        /* HttpBindingGenerator.kt:592 */
  232    317   
    }
         318  +
    /* HttpBindingGenerator.kt:592 */
  233    319   
    if let ::std::option::Option::Some(inner_9) = &input.header_long {
         320  +
        /* HttpBindingGenerator.kt:690 */
  234    321   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_9);
         322  +
        /* HttpBindingGenerator.kt:704 */
  235    323   
        let formatted_10 = encoder.encode();
         324  +
        /* HttpBindingGenerator.kt:705 */
  236    325   
        if !formatted_10.is_empty() {
         326  +
            /* HttpBindingGenerator.kt:706 */
  237    327   
            let header_value = formatted_10;
  238    328   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  239    329   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  240    330   
                    "header_long",
  241    331   
                    format!(
  242    332   
                        "`{}` cannot be used as a header value: {}",
  243    333   
                        &header_value, err
  244    334   
                    ),
  245    335   
                )
  246    336   
            })?;
  247    337   
            builder = builder.header("X-Long", header_value);
         338  +
            /* HttpBindingGenerator.kt:705 */
  248    339   
        }
         340  +
        /* HttpBindingGenerator.kt:592 */
  249    341   
    }
         342  +
    /* HttpBindingGenerator.kt:592 */
  250    343   
    if let ::std::option::Option::Some(inner_11) = &input.header_float {
         344  +
        /* HttpBindingGenerator.kt:690 */
  251    345   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_11);
         346  +
        /* HttpBindingGenerator.kt:704 */
  252    347   
        let formatted_12 = encoder.encode();
         348  +
        /* HttpBindingGenerator.kt:705 */
  253    349   
        if !formatted_12.is_empty() {
         350  +
            /* HttpBindingGenerator.kt:706 */
  254    351   
            let header_value = formatted_12;
  255    352   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  256    353   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  257    354   
                    "header_float",
  258    355   
                    format!(
  259    356   
                        "`{}` cannot be used as a header value: {}",
  260    357   
                        &header_value, err
  261    358   
                    ),
  262    359   
                )
  263    360   
            })?;
  264    361   
            builder = builder.header("X-Float", header_value);
         362  +
            /* HttpBindingGenerator.kt:705 */
  265    363   
        }
         364  +
        /* HttpBindingGenerator.kt:592 */
  266    365   
    }
         366  +
    /* HttpBindingGenerator.kt:592 */
  267    367   
    if let ::std::option::Option::Some(inner_13) = &input.header_double {
         368  +
        /* HttpBindingGenerator.kt:690 */
  268    369   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_13);
         370  +
        /* HttpBindingGenerator.kt:704 */
  269    371   
        let formatted_14 = encoder.encode();
         372  +
        /* HttpBindingGenerator.kt:705 */
  270    373   
        if !formatted_14.is_empty() {
         374  +
            /* HttpBindingGenerator.kt:706 */
  271    375   
            let header_value = formatted_14;
  272    376   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  273    377   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  274    378   
                    "header_double",
  275    379   
                    format!(
  276    380   
                        "`{}` cannot be used as a header value: {}",
  277    381   
                        &header_value, err
  278    382   
                    ),
  279    383   
                )
  280    384   
            })?;
  281    385   
            builder = builder.header("X-Double", header_value);
         386  +
            /* HttpBindingGenerator.kt:705 */
  282    387   
        }
         388  +
        /* HttpBindingGenerator.kt:592 */
  283    389   
    }
         390  +
    /* HttpBindingGenerator.kt:592 */
  284    391   
    if let ::std::option::Option::Some(inner_15) = &input.header_true_bool {
         392  +
        /* HttpBindingGenerator.kt:690 */
  285    393   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_15);
         394  +
        /* HttpBindingGenerator.kt:704 */
  286    395   
        let formatted_16 = encoder.encode();
         396  +
        /* HttpBindingGenerator.kt:705 */
  287    397   
        if !formatted_16.is_empty() {
         398  +
            /* HttpBindingGenerator.kt:706 */
  288    399   
            let header_value = formatted_16;
  289    400   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  290    401   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  291    402   
                    "header_true_bool",
  292    403   
                    format!(
  293    404   
                        "`{}` cannot be used as a header value: {}",
  294    405   
                        &header_value, err
  295    406   
                    ),
  296    407   
                )
  297    408   
            })?;
  298    409   
            builder = builder.header("X-Boolean1", header_value);
         410  +
            /* HttpBindingGenerator.kt:705 */
  299    411   
        }
         412  +
        /* HttpBindingGenerator.kt:592 */
  300    413   
    }
         414  +
    /* HttpBindingGenerator.kt:592 */
  301    415   
    if let ::std::option::Option::Some(inner_17) = &input.header_false_bool {
         416  +
        /* HttpBindingGenerator.kt:690 */
  302    417   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_17);
         418  +
        /* HttpBindingGenerator.kt:704 */
  303    419   
        let formatted_18 = encoder.encode();
         420  +
        /* HttpBindingGenerator.kt:705 */
  304    421   
        if !formatted_18.is_empty() {
         422  +
            /* HttpBindingGenerator.kt:706 */
  305    423   
            let header_value = formatted_18;
  306    424   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  307    425   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  308    426   
                    "header_false_bool",
  309    427   
                    format!(
  310    428   
                        "`{}` cannot be used as a header value: {}",
  311    429   
                        &header_value, err
  312    430   
                    ),
  313    431   
                )
  314    432   
            })?;
  315    433   
            builder = builder.header("X-Boolean2", header_value);
         434  +
            /* HttpBindingGenerator.kt:705 */
  316    435   
        }
         436  +
        /* HttpBindingGenerator.kt:592 */
  317    437   
    }
         438  +
    /* HttpBindingGenerator.kt:592 */
  318    439   
    if let ::std::option::Option::Some(inner_19) = &input.header_string_list {
         440  +
        /* HttpBindingGenerator.kt:646 */
  319    441   
        for inner_20 in inner_19 {
         442  +
            /* HttpBindingGenerator.kt:704 */
  320    443   
            let formatted_21 = ::aws_smithy_http::header::quote_header_value(inner_20.as_str());
         444  +
            /* HttpBindingGenerator.kt:705 */
  321    445   
            if !formatted_21.is_empty() {
         446  +
                /* HttpBindingGenerator.kt:706 */
  322    447   
                let header_value = formatted_21;
  323    448   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  324    449   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  325    450   
                        "header_string_list",
  326    451   
                        format!(
  327    452   
                            "`{}` cannot be used as a header value: {}",
  328    453   
                            &header_value, err
  329    454   
                        ),
  330    455   
                    )
  331    456   
                })?;
  332    457   
                builder = builder.header("X-StringList", header_value);
         458  +
                /* HttpBindingGenerator.kt:705 */
  333    459   
            }
         460  +
            /* HttpBindingGenerator.kt:646 */
  334    461   
        }
         462  +
        /* HttpBindingGenerator.kt:592 */
  335    463   
    }
         464  +
    /* HttpBindingGenerator.kt:592 */
  336    465   
    if let ::std::option::Option::Some(inner_22) = &input.header_string_set {
         466  +
        /* HttpBindingGenerator.kt:646 */
  337    467   
        for inner_23 in &inner_22.0 {
         468  +
            /* HttpBindingGenerator.kt:704 */
  338    469   
            let formatted_24 = ::aws_smithy_http::header::quote_header_value(inner_23.as_str());
         470  +
            /* HttpBindingGenerator.kt:705 */
  339    471   
            if !formatted_24.is_empty() {
         472  +
                /* HttpBindingGenerator.kt:706 */
  340    473   
                let header_value = formatted_24;
  341    474   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  342    475   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  343    476   
                        "header_string_set",
  344    477   
                        format!(
  345    478   
                            "`{}` cannot be used as a header value: {}",
  346    479   
                            &header_value, err
  347    480   
                        ),
  348    481   
                    )
  349    482   
                })?;
  350    483   
                builder = builder.header("X-StringSet", header_value);
         484  +
                /* HttpBindingGenerator.kt:705 */
  351    485   
            }
         486  +
            /* HttpBindingGenerator.kt:646 */
  352    487   
        }
         488  +
        /* HttpBindingGenerator.kt:592 */
  353    489   
    }
         490  +
    /* HttpBindingGenerator.kt:592 */
  354    491   
    if let ::std::option::Option::Some(inner_25) = &input.header_integer_list {
         492  +
        /* HttpBindingGenerator.kt:646 */
  355    493   
        for inner_26 in inner_25 {
         494  +
            /* HttpBindingGenerator.kt:690 */
  356    495   
            let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_26);
         496  +
            /* HttpBindingGenerator.kt:704 */
  357    497   
            let formatted_27 = encoder.encode();
         498  +
            /* HttpBindingGenerator.kt:705 */
  358    499   
            if !formatted_27.is_empty() {
         500  +
                /* HttpBindingGenerator.kt:706 */
  359    501   
                let header_value = formatted_27;
  360    502   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  361    503   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  362    504   
                        "header_integer_list",
  363    505   
                        format!(
  364    506   
                            "`{}` cannot be used as a header value: {}",
  365    507   
                            &header_value, err
  366    508   
                        ),
  367    509   
                    )
  368    510   
                })?;
  369    511   
                builder = builder.header("X-IntegerList", header_value);
         512  +
                /* HttpBindingGenerator.kt:705 */
  370    513   
            }
         514  +
            /* HttpBindingGenerator.kt:646 */
  371    515   
        }
         516  +
        /* HttpBindingGenerator.kt:592 */
  372    517   
    }
         518  +
    /* HttpBindingGenerator.kt:592 */
  373    519   
    if let ::std::option::Option::Some(inner_28) = &input.header_boolean_list {
         520  +
        /* HttpBindingGenerator.kt:646 */
  374    521   
        for inner_29 in inner_28 {
         522  +
            /* HttpBindingGenerator.kt:690 */
  375    523   
            let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_29);
         524  +
            /* HttpBindingGenerator.kt:704 */
  376    525   
            let formatted_30 = encoder.encode();
         526  +
            /* HttpBindingGenerator.kt:705 */
  377    527   
            if !formatted_30.is_empty() {
         528  +
                /* HttpBindingGenerator.kt:706 */
  378    529   
                let header_value = formatted_30;
  379    530   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  380    531   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  381    532   
                        "header_boolean_list",
  382    533   
                        format!(
  383    534   
                            "`{}` cannot be used as a header value: {}",
  384    535   
                            &header_value, err
  385    536   
                        ),
  386    537   
                    )
  387    538   
                })?;
  388    539   
                builder = builder.header("X-BooleanList", header_value);
         540  +
                /* HttpBindingGenerator.kt:705 */
  389    541   
            }
         542  +
            /* HttpBindingGenerator.kt:646 */
  390    543   
        }
         544  +
        /* HttpBindingGenerator.kt:592 */
  391    545   
    }
         546  +
    /* HttpBindingGenerator.kt:592 */
  392    547   
    if let ::std::option::Option::Some(inner_31) = &input.header_timestamp_list {
         548  +
        /* HttpBindingGenerator.kt:646 */
  393    549   
        for inner_32 in inner_31 {
         550  +
            /* HttpBindingGenerator.kt:704 */
  394    551   
            let formatted_33 = inner_32.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
         552  +
            /* HttpBindingGenerator.kt:705 */
  395    553   
            if !formatted_33.is_empty() {
         554  +
                /* HttpBindingGenerator.kt:706 */
  396    555   
                let header_value = formatted_33;
  397    556   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  398    557   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  399    558   
                        "header_timestamp_list",
  400    559   
                        format!(
  401    560   
                            "`{}` cannot be used as a header value: {}",
  402    561   
                            &header_value, err
  403    562   
                        ),
  404    563   
                    )
  405    564   
                })?;
  406    565   
                builder = builder.header("X-TimestampList", header_value);
         566  +
                /* HttpBindingGenerator.kt:705 */
  407    567   
            }
         568  +
            /* HttpBindingGenerator.kt:646 */
  408    569   
        }
         570  +
        /* HttpBindingGenerator.kt:592 */
  409    571   
    }
         572  +
    /* HttpBindingGenerator.kt:592 */
  410    573   
    if let ::std::option::Option::Some(inner_34) = &input.header_enum {
         574  +
        /* HttpBindingGenerator.kt:704 */
  411    575   
        let formatted_35 = inner_34.as_str();
         576  +
        /* HttpBindingGenerator.kt:705 */
  412    577   
        if !formatted_35.is_empty() {
         578  +
            /* HttpBindingGenerator.kt:706 */
  413    579   
            let header_value = formatted_35;
  414    580   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  415    581   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  416    582   
                    "header_enum",
  417    583   
                    format!(
  418    584   
                        "`{}` cannot be used as a header value: {}",
  419    585   
                        &header_value, err
  420    586   
                    ),
  421    587   
                )
  422    588   
            })?;
  423    589   
            builder = builder.header("X-Enum", header_value);
         590  +
            /* HttpBindingGenerator.kt:705 */
  424    591   
        }
         592  +
        /* HttpBindingGenerator.kt:592 */
  425    593   
    }
         594  +
    /* HttpBindingGenerator.kt:592 */
  426    595   
    if let ::std::option::Option::Some(inner_36) = &input.header_enum_list {
         596  +
        /* HttpBindingGenerator.kt:646 */
  427    597   
        for inner_37 in inner_36 {
         598  +
            /* HttpBindingGenerator.kt:704 */
  428    599   
            let formatted_38 = ::aws_smithy_http::header::quote_header_value(inner_37.as_str());
         600  +
            /* HttpBindingGenerator.kt:705 */
  429    601   
            if !formatted_38.is_empty() {
         602  +
                /* HttpBindingGenerator.kt:706 */
  430    603   
                let header_value = formatted_38;
  431    604   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  432    605   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  433    606   
                        "header_enum_list",
  434    607   
                        format!(
  435    608   
                            "`{}` cannot be used as a header value: {}",
  436    609   
                            &header_value, err
  437    610   
                        ),
  438    611   
                    )
  439    612   
                })?;
  440    613   
                builder = builder.header("X-EnumList", header_value);
         614  +
                /* HttpBindingGenerator.kt:705 */
  441    615   
            }
         616  +
            /* HttpBindingGenerator.kt:646 */
  442    617   
        }
         618  +
        /* HttpBindingGenerator.kt:592 */
  443    619   
    }
         620  +
    /* HttpBindingGenerator.kt:592 */
  444    621   
    if let ::std::option::Option::Some(inner_39) = &input.header_integer_enum {
         622  +
        /* HttpBindingGenerator.kt:690 */
  445    623   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_39);
         624  +
        /* HttpBindingGenerator.kt:704 */
  446    625   
        let formatted_40 = encoder.encode();
         626  +
        /* HttpBindingGenerator.kt:705 */
  447    627   
        if !formatted_40.is_empty() {
         628  +
            /* HttpBindingGenerator.kt:706 */
  448    629   
            let header_value = formatted_40;
  449    630   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  450    631   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  451    632   
                    "header_integer_enum",
  452    633   
                    format!(
  453    634   
                        "`{}` cannot be used as a header value: {}",
  454    635   
                        &header_value, err
  455    636   
                    ),
  456    637   
                )
  457    638   
            })?;
  458    639   
            builder = builder.header("X-IntegerEnum", header_value);
         640  +
            /* HttpBindingGenerator.kt:705 */
  459    641   
        }
         642  +
        /* HttpBindingGenerator.kt:592 */
  460    643   
    }
         644  +
    /* HttpBindingGenerator.kt:592 */
  461    645   
    if let ::std::option::Option::Some(inner_41) = &input.header_integer_enum_list {
         646  +
        /* HttpBindingGenerator.kt:646 */
  462    647   
        for inner_42 in inner_41 {
         648  +
            /* HttpBindingGenerator.kt:690 */
  463    649   
            let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_42);
         650  +
            /* HttpBindingGenerator.kt:704 */
  464    651   
            let formatted_43 = encoder.encode();
         652  +
            /* HttpBindingGenerator.kt:705 */
  465    653   
            if !formatted_43.is_empty() {
         654  +
                /* HttpBindingGenerator.kt:706 */
  466    655   
                let header_value = formatted_43;
  467    656   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  468    657   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  469    658   
                        "header_integer_enum_list",
  470    659   
                        format!(
  471    660   
                            "`{}` cannot be used as a header value: {}",
  472    661   
                            &header_value, err
  473    662   
                        ),
  474    663   
                    )
  475    664   
                })?;
  476    665   
                builder = builder.header("X-IntegerEnumList", header_value);
         666  +
                /* HttpBindingGenerator.kt:705 */
  477    667   
            }
         668  +
            /* HttpBindingGenerator.kt:646 */
  478    669   
        }
         670  +
        /* HttpBindingGenerator.kt:592 */
  479    671   
    }
         672  +
    /* HttpBindingGenerator.kt:555 */
  480    673   
    Ok(builder)
         674  +
    /* HttpBindingGenerator.kt:542 */
  481    675   
}

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

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

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_input_and_output_with_headers_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_input_and_output_with_headers_output_output_output(
    3      4   
    value: &crate::output::InputAndOutputWithHeadersOutput,
    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_input_and_output_with_headers_output::ser_input_and_output_with_headers_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_input_and_output_with_headers_output_output(
   13     19   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    #[allow(unused_variables)] input: &crate::output::InputAndOutputWithHeadersOutput,
   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_integer_enum_list.rs

@@ -1,1 +52,76 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:398 */
    2      3   
pub(crate) fn de_integer_enum_list<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<::std::vec::Vec<i32>>,
    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_number_or_null(
   28         -
                            tokens.next(),
   29         -
                        )?
   30         -
                        .map(i32::try_from)
   31         -
                        .transpose()?;
          37  +
                        /* JsonParserGenerator.kt:419 */
          38  +
                        let value =
          39  +
                            /* JsonParserGenerator.kt:365 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
          40  +
                                                .map(i32::try_from)
          41  +
                                                .transpose()?
          42  +
                        /* JsonParserGenerator.kt:419 */;
          43  +
                        /* JsonParserGenerator.kt:422 */
   32     44   
                        if let Some(value) = value {
   33     45   
                            items.push(value);
   34         -
                        } else {
          46  +
                        }
          47  +
                        /* JsonParserGenerator.kt:430 */
          48  +
                        else {
   35     49   
                            return Err(
   36     50   
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37     51   
                                    "dense list cannot contain null values",
   38     52   
                                ),
   39     53   
                            );
   40     54   
                        }
   41         -
                    }
          55  +
                        /* JsonParserGenerator.kt:413 */
          56  +
                    } /* JsonParserGenerator.kt:409 */
   42     57   
                }
          58  +
                /* JsonParserGenerator.kt:408 */
   43     59   
            }
          60  +
            /* JsonParserGenerator.kt:446 */
   44     61   
            Ok(Some(items))
          62  +
            /* JsonParserGenerator.kt:713 */
   45     63   
        }
   46         -
        _ => Err(
   47         -
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   48         -
                "expected start array or null",
   49         -
            ),
   50         -
        ),
          64  +
        /* JsonParserGenerator.kt:722 */
          65  +
        _ => {
          66  +
            /* JsonParserGenerator.kt:723 */
          67  +
            Err(
          68  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          69  +
                    "expected start array or null",
          70  +
                ),
          71  +
            )
          72  +
            /* JsonParserGenerator.kt:722 */
          73  +
        } /* JsonParserGenerator.kt:712 */
   51     74   
    }
          75  +
    /* JsonParserGenerator.kt:398 */
   52     76   
}

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

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

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

@@ -1,1 +56,80 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:398 */
    2      3   
pub(crate) fn de_integer_enum_set<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::unconstrained::integer_enum_set_unconstrained::IntegerEnumSetUnconstrained>,
    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_number_or_null(
   28         -
                            tokens.next(),
   29         -
                        )?
   30         -
                        .map(i32::try_from)
   31         -
                        .transpose()?;
          37  +
                        /* JsonParserGenerator.kt:419 */
          38  +
                        let value =
          39  +
                            /* JsonParserGenerator.kt:365 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
          40  +
                                                .map(i32::try_from)
          41  +
                                                .transpose()?
          42  +
                        /* JsonParserGenerator.kt:419 */;
          43  +
                        /* JsonParserGenerator.kt:422 */
   32     44   
                        if let Some(value) = value {
   33     45   
                            items.push(value);
   34         -
                        } else {
          46  +
                        }
          47  +
                        /* JsonParserGenerator.kt:430 */
          48  +
                        else {
   35     49   
                            return Err(
   36     50   
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37     51   
                                    "dense list cannot contain null values",
   38     52   
                                ),
   39     53   
                            );
   40     54   
                        }
   41         -
                    }
          55  +
                        /* JsonParserGenerator.kt:413 */
          56  +
                    } /* JsonParserGenerator.kt:409 */
   42     57   
                }
          58  +
                /* JsonParserGenerator.kt:408 */
   43     59   
            }
          60  +
            /* JsonParserGenerator.kt:444 */
   44     61   
            Ok(Some(
   45     62   
                crate::unconstrained::integer_enum_set_unconstrained::IntegerEnumSetUnconstrained(
   46     63   
                    items,
   47     64   
                ),
   48     65   
            ))
          66  +
            /* JsonParserGenerator.kt:713 */
   49     67   
        }
   50         -
        _ => Err(
   51         -
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   52         -
                "expected start array or null",
   53         -
            ),
   54         -
        ),
          68  +
        /* JsonParserGenerator.kt:722 */
          69  +
        _ => {
          70  +
            /* JsonParserGenerator.kt:723 */
          71  +
            Err(
          72  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          73  +
                    "expected start array or null",
          74  +
                ),
          75  +
            )
          76  +
            /* JsonParserGenerator.kt:722 */
          77  +
        } /* JsonParserGenerator.kt:712 */
   55     78   
    }
          79  +
    /* JsonParserGenerator.kt:398 */
   56     80   
}

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

@@ -1,1 +52,76 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:398 */
    2      3   
pub(crate) fn de_integer_list<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<::std::vec::Vec<i32>>,
    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_number_or_null(
   28         -
                            tokens.next(),
   29         -
                        )?
   30         -
                        .map(i32::try_from)
   31         -
                        .transpose()?;
          37  +
                        /* JsonParserGenerator.kt:419 */
          38  +
                        let value =
          39  +
                            /* JsonParserGenerator.kt:365 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
          40  +
                                                .map(i32::try_from)
          41  +
                                                .transpose()?
          42  +
                        /* JsonParserGenerator.kt:419 */;
          43  +
                        /* JsonParserGenerator.kt:422 */
   32     44   
                        if let Some(value) = value {
   33     45   
                            items.push(value);
   34         -
                        } else {
          46  +
                        }
          47  +
                        /* JsonParserGenerator.kt:430 */
          48  +
                        else {
   35     49   
                            return Err(
   36     50   
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37     51   
                                    "dense list cannot contain null values",
   38     52   
                                ),
   39     53   
                            );
   40     54   
                        }
   41         -
                    }
          55  +
                        /* JsonParserGenerator.kt:413 */
          56  +
                    } /* JsonParserGenerator.kt:409 */
   42     57   
                }
          58  +
                /* JsonParserGenerator.kt:408 */
   43     59   
            }
          60  +
            /* JsonParserGenerator.kt:446 */
   44     61   
            Ok(Some(items))
          62  +
            /* JsonParserGenerator.kt:713 */
   45     63   
        }
   46         -
        _ => Err(
   47         -
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   48         -
                "expected start array or null",
   49         -
            ),
   50         -
        ),
          64  +
        /* JsonParserGenerator.kt:722 */
          65  +
        _ => {
          66  +
            /* JsonParserGenerator.kt:723 */
          67  +
            Err(
          68  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          69  +
                    "expected start array or null",
          70  +
                ),
          71  +
            )
          72  +
            /* JsonParserGenerator.kt:722 */
          73  +
        } /* JsonParserGenerator.kt:712 */
   51     74   
    }
          75  +
    /* JsonParserGenerator.kt:398 */
   52     76   
}

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

@@ -1,1 +20,31 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_invalid_greeting_error(
    3      4   
    value: &crate::error::InvalidGreeting,
    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_invalid_greeting::ser_invalid_greeting(&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_invalid_greeting(
   13     19   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    input: &crate::error::InvalidGreeting,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* JsonSerializerGenerator.kt:382 */
   16     23   
    if let Some(var_1) = &input.message {
          24  +
        /* JsonSerializerGenerator.kt:423 */
   17     25   
        object.key("Message").string(var_1.as_str());
          26  +
        /* JsonSerializerGenerator.kt:382 */
   18     27   
    }
          28  +
    /* JsonSerializerGenerator.kt:372 */
   19     29   
    Ok(())
          30  +
    /* JsonSerializerGenerator.kt:358 */
   20     31   
}

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

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