Server Test

Server Test

rev. 03e6e47f15dfd569240d570d98975ebba692c405 (ignoring whitespace)

Files changed:

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

@@ -0,1 +0,25 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:159 */
           3  +
pub(crate) fn de_timestamp_header(
           4  +
    header_map: &::aws_smithy_runtime_api::http::Headers,
           5  +
) -> ::std::result::Result<
           6  +
    ::std::option::Option<::aws_smithy_types::DateTime>,
           7  +
    ::aws_smithy_legacy_http::header::ParseError,
           8  +
> {
           9  +
    /* HttpBindingGenerator.kt:166 */
          10  +
    let headers = header_map.get_all("timestamp");
          11  +
    /* HttpBindingGenerator.kt:417 */
          12  +
    let var_1: Vec<::aws_smithy_types::DateTime> = ::aws_smithy_legacy_http::header::many_dates(headers, ::aws_smithy_types::date_time::Format::HttpDate)?
          13  +
    /* HttpBindingGenerator.kt:425 */;
          14  +
    /* HttpBindingGenerator.kt:491 */
          15  +
    if var_1.len() > 1 {
          16  +
        Err(::aws_smithy_legacy_http::header::ParseError::new(format!(
          17  +
            "expected one item but found {}",
          18  +
            var_1.len()
          19  +
        )))
          20  +
    } else {
          21  +
        let mut var_1 = var_1;
          22  +
        Ok(var_1.pop())
          23  +
    }
          24  +
    /* HttpBindingGenerator.kt:159 */
          25  +
}

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

@@ -0,1 +0,134 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
           3  +
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
           5  +
pub async fn de_malformed_timestamp_header_epoch_http_request<B>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::MalformedTimestampHeaderEpochInput,
           9  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
          10  +
>
          11  +
where
          12  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          13  +
    B::Data: Send,
          14  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          15  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          16  +
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
          18  +
    Ok({
          19  +
        /* RustType.kt:534 */
          20  +
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
          22  +
        let mut input = crate::input::malformed_timestamp_header_epoch_input::Builder::default();
          23  +
        /* RustType.kt:534 */
          24  +
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
          26  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          27  +
            uri, headers, body, ..
          28  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
          30  +
        if let Some(value) = crate::protocol_serde::shape_malformed_timestamp_header_epoch_input::de_timestamp_header(&headers)? {
          31  +
                                input = input.set_timestamp(value)
          32  +
                            }
          33  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
          34  +
        input.build()?
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
          36  +
    })
          37  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
          38  +
}
          39  +
          40  +
/* RustType.kt:534 */
          41  +
#[allow(clippy::unnecessary_wraps)]
          42  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
          43  +
pub fn ser_malformed_timestamp_header_epoch_http_response(
          44  +
    #[allow(unused_variables)] output: crate::output::MalformedTimestampHeaderEpochOutput,
          45  +
) -> std::result::Result<
          46  +
    ::aws_smithy_legacy_http_server::response::Response,
          47  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          48  +
> {
          49  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
          50  +
    Ok({
          51  +
        /* RustType.kt:534 */
          52  +
        #[allow(unused_mut)]
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          54  +
        let mut builder = ::http::Response::builder();
          55  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
          56  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          57  +
            builder,
          58  +
            ::http::header::CONTENT_TYPE,
          59  +
            "application/json",
          60  +
        );
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
          62  +
        let http_status: u16 = 200;
          63  +
        builder = builder.status(http_status);
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          65  +
        let payload =
          66  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          68  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
          69  +
        let content_length = payload.len();
          70  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          71  +
            builder,
          72  +
            ::http::header::CONTENT_LENGTH,
          73  +
            content_length,
          74  +
        );
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
          76  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
          78  +
        builder.body(body)?
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
          80  +
    })
          81  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
          82  +
}
          83  +
          84  +
/* RustType.kt:534 */
          85  +
#[allow(clippy::unnecessary_wraps)]
          86  +
/* ServerHttpBoundProtocolGenerator.kt:471 */
          87  +
pub fn ser_malformed_timestamp_header_epoch_http_error(
          88  +
    error: &crate::error::MalformedTimestampHeaderEpochError,
          89  +
) -> std::result::Result<
          90  +
    ::aws_smithy_legacy_http_server::response::Response,
          91  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          92  +
> {
          93  +
    /* ServerHttpBoundProtocolGenerator.kt:476 */
          94  +
    Ok({
          95  +
        /* ServerHttpBoundProtocolGenerator.kt:492 */
          96  +
        match error {
          97  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
          98  +
            crate::error::MalformedTimestampHeaderEpochError::ValidationException(output) => {
          99  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
         100  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         101  +
                /* RustType.kt:534 */
         102  +
                #[allow(unused_mut)]
         103  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         104  +
                let mut builder = ::http::Response::builder();
         105  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
         106  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         107  +
                    builder,
         108  +
                    ::http::header::CONTENT_TYPE,
         109  +
                    "application/json",
         110  +
                );
         111  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
         112  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         113  +
                    builder,
         114  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         115  +
                    "ValidationException",
         116  +
                );
         117  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
         118  +
                let content_length = payload.len();
         119  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         120  +
                    builder,
         121  +
                    ::http::header::CONTENT_LENGTH,
         122  +
                    content_length,
         123  +
                );
         124  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
         125  +
                builder
         126  +
                    .status(400)
         127  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         128  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         129  +
            } /* ServerHttpBoundProtocolGenerator.kt:492 */
         130  +
        }
         131  +
        /* ServerHttpBoundProtocolGenerator.kt:476 */
         132  +
    })
         133  +
    /* ServerHttpBoundProtocolGenerator.kt:471 */
         134  +
}

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

@@ -0,1 +0,25 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:159 */
           3  +
pub(crate) fn de_timestamp_header(
           4  +
    header_map: &::aws_smithy_runtime_api::http::Headers,
           5  +
) -> ::std::result::Result<
           6  +
    ::std::option::Option<::aws_smithy_types::DateTime>,
           7  +
    ::aws_smithy_legacy_http::header::ParseError,
           8  +
> {
           9  +
    /* HttpBindingGenerator.kt:166 */
          10  +
    let headers = header_map.get_all("timestamp");
          11  +
    /* HttpBindingGenerator.kt:417 */
          12  +
    let var_1: Vec<::aws_smithy_types::DateTime> = ::aws_smithy_legacy_http::header::many_dates(headers, ::aws_smithy_types::date_time::Format::EpochSeconds)?
          13  +
    /* HttpBindingGenerator.kt:425 */;
          14  +
    /* HttpBindingGenerator.kt:491 */
          15  +
    if var_1.len() > 1 {
          16  +
        Err(::aws_smithy_legacy_http::header::ParseError::new(format!(
          17  +
            "expected one item but found {}",
          18  +
            var_1.len()
          19  +
        )))
          20  +
    } else {
          21  +
        let mut var_1 = var_1;
          22  +
        Ok(var_1.pop())
          23  +
    }
          24  +
    /* HttpBindingGenerator.kt:159 */
          25  +
}

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

@@ -0,1 +0,154 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
           3  +
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
           5  +
pub async fn de_malformed_timestamp_path_default_http_request<B>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::MalformedTimestampPathDefaultInput,
           9  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
          10  +
>
          11  +
where
          12  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          13  +
    B::Data: Send,
          14  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          15  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          16  +
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
          18  +
    Ok({
          19  +
        /* RustType.kt:534 */
          20  +
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
          22  +
        let mut input = crate::input::malformed_timestamp_path_default_input::Builder::default();
          23  +
        /* RustType.kt:534 */
          24  +
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
          26  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          27  +
            uri, headers, body, ..
          28  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:1134 */
          30  +
        let input_string = uri.path();
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:1146 */
          32  +
        let (input_string, (_, m1)) =
          33  +
            ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
          34  +
                ::nom::sequence::preceded(
          35  +
                    ::nom::bytes::complete::tag("/"),
          36  +
                    ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>(
          37  +
                        "MalformedTimestampPathDefault",
          38  +
                    ),
          39  +
                ),
          40  +
                ::nom::sequence::preceded(
          41  +
                    ::nom::bytes::complete::tag("/"),
          42  +
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
          43  +
                        ::nom::bytes::complete::take_until("/"),
          44  +
                        ::nom::combinator::rest,
          45  +
                    )),
          46  +
                ),
          47  +
            ))(input_string)?;
          48  +
        debug_assert_eq!("", input_string);
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:1157 */
          50  +
        input = input.set_timestamp(
          51  +
            crate::protocol_serde::shape_malformed_timestamp_path_default_input::de_timestamp(m1)?,
          52  +
        );
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
          54  +
        input.build()?
          55  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
          56  +
    })
          57  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
          58  +
}
          59  +
          60  +
/* RustType.kt:534 */
          61  +
#[allow(clippy::unnecessary_wraps)]
          62  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
          63  +
pub fn ser_malformed_timestamp_path_default_http_response(
          64  +
    #[allow(unused_variables)] output: crate::output::MalformedTimestampPathDefaultOutput,
          65  +
) -> std::result::Result<
          66  +
    ::aws_smithy_legacy_http_server::response::Response,
          67  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          68  +
> {
          69  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
          70  +
    Ok({
          71  +
        /* RustType.kt:534 */
          72  +
        #[allow(unused_mut)]
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          74  +
        let mut builder = ::http::Response::builder();
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
          76  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          77  +
            builder,
          78  +
            ::http::header::CONTENT_TYPE,
          79  +
            "application/json",
          80  +
        );
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
          82  +
        let http_status: u16 = 200;
          83  +
        builder = builder.status(http_status);
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          85  +
        let payload =
          86  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
          89  +
        let content_length = payload.len();
          90  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          91  +
            builder,
          92  +
            ::http::header::CONTENT_LENGTH,
          93  +
            content_length,
          94  +
        );
          95  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
          96  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          97  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
          98  +
        builder.body(body)?
          99  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
         100  +
    })
         101  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
         102  +
}
         103  +
         104  +
/* RustType.kt:534 */
         105  +
#[allow(clippy::unnecessary_wraps)]
         106  +
/* ServerHttpBoundProtocolGenerator.kt:471 */
         107  +
pub fn ser_malformed_timestamp_path_default_http_error(
         108  +
    error: &crate::error::MalformedTimestampPathDefaultError,
         109  +
) -> std::result::Result<
         110  +
    ::aws_smithy_legacy_http_server::response::Response,
         111  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
         112  +
> {
         113  +
    /* ServerHttpBoundProtocolGenerator.kt:476 */
         114  +
    Ok({
         115  +
        /* ServerHttpBoundProtocolGenerator.kt:492 */
         116  +
        match error {
         117  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
         118  +
            crate::error::MalformedTimestampPathDefaultError::ValidationException(output) => {
         119  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
         120  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         121  +
                /* RustType.kt:534 */
         122  +
                #[allow(unused_mut)]
         123  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         124  +
                let mut builder = ::http::Response::builder();
         125  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
         126  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         127  +
                    builder,
         128  +
                    ::http::header::CONTENT_TYPE,
         129  +
                    "application/json",
         130  +
                );
         131  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
         132  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         133  +
                    builder,
         134  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         135  +
                    "ValidationException",
         136  +
                );
         137  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
         138  +
                let content_length = payload.len();
         139  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         140  +
                    builder,
         141  +
                    ::http::header::CONTENT_LENGTH,
         142  +
                    content_length,
         143  +
                );
         144  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
         145  +
                builder
         146  +
                    .status(400)
         147  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         148  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         149  +
            } /* ServerHttpBoundProtocolGenerator.kt:492 */
         150  +
        }
         151  +
        /* ServerHttpBoundProtocolGenerator.kt:476 */
         152  +
    })
         153  +
    /* ServerHttpBoundProtocolGenerator.kt:471 */
         154  +
}

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

@@ -0,1 +0,16 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
           3  +
pub fn de_timestamp(
           4  +
    value: &str,
           5  +
) -> std::result::Result<
           6  +
    ::aws_smithy_types::DateTime,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
           8  +
> {
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1486 */
          10  +
    let value = ::percent_encoding::percent_decode_str(value).decode_utf8()?;
          11  +
    let value = ::aws_smithy_types::DateTime::from_str(value.as_ref(), ::aws_smithy_types::date_time::Format::DateTime)?
          12  +
    /* ServerHttpBoundProtocolGenerator.kt:1510 */;
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
          14  +
    Ok(value)
          15  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
          16  +
}

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

@@ -0,1 +0,154 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
           3  +
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
           5  +
pub async fn de_malformed_timestamp_path_epoch_http_request<B>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::MalformedTimestampPathEpochInput,
           9  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
          10  +
>
          11  +
where
          12  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          13  +
    B::Data: Send,
          14  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          15  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          16  +
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
          18  +
    Ok({
          19  +
        /* RustType.kt:534 */
          20  +
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
          22  +
        let mut input = crate::input::malformed_timestamp_path_epoch_input::Builder::default();
          23  +
        /* RustType.kt:534 */
          24  +
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
          26  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          27  +
            uri, headers, body, ..
          28  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:1134 */
          30  +
        let input_string = uri.path();
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:1146 */
          32  +
        let (input_string, (_, m1)) =
          33  +
            ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
          34  +
                ::nom::sequence::preceded(
          35  +
                    ::nom::bytes::complete::tag("/"),
          36  +
                    ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>(
          37  +
                        "MalformedTimestampPathEpoch",
          38  +
                    ),
          39  +
                ),
          40  +
                ::nom::sequence::preceded(
          41  +
                    ::nom::bytes::complete::tag("/"),
          42  +
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
          43  +
                        ::nom::bytes::complete::take_until("/"),
          44  +
                        ::nom::combinator::rest,
          45  +
                    )),
          46  +
                ),
          47  +
            ))(input_string)?;
          48  +
        debug_assert_eq!("", input_string);
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:1157 */
          50  +
        input = input.set_timestamp(
          51  +
            crate::protocol_serde::shape_malformed_timestamp_path_epoch_input::de_timestamp(m1)?,
          52  +
        );
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
          54  +
        input.build()?
          55  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
          56  +
    })
          57  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
          58  +
}
          59  +
          60  +
/* RustType.kt:534 */
          61  +
#[allow(clippy::unnecessary_wraps)]
          62  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
          63  +
pub fn ser_malformed_timestamp_path_epoch_http_response(
          64  +
    #[allow(unused_variables)] output: crate::output::MalformedTimestampPathEpochOutput,
          65  +
) -> std::result::Result<
          66  +
    ::aws_smithy_legacy_http_server::response::Response,
          67  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          68  +
> {
          69  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
          70  +
    Ok({
          71  +
        /* RustType.kt:534 */
          72  +
        #[allow(unused_mut)]
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          74  +
        let mut builder = ::http::Response::builder();
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
          76  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          77  +
            builder,
          78  +
            ::http::header::CONTENT_TYPE,
          79  +
            "application/json",
          80  +
        );
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
          82  +
        let http_status: u16 = 200;
          83  +
        builder = builder.status(http_status);
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          85  +
        let payload =
          86  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
          89  +
        let content_length = payload.len();
          90  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          91  +
            builder,
          92  +
            ::http::header::CONTENT_LENGTH,
          93  +
            content_length,
          94  +
        );
          95  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
          96  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          97  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
          98  +
        builder.body(body)?
          99  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
         100  +
    })
         101  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
         102  +
}
         103  +
         104  +
/* RustType.kt:534 */
         105  +
#[allow(clippy::unnecessary_wraps)]
         106  +
/* ServerHttpBoundProtocolGenerator.kt:471 */
         107  +
pub fn ser_malformed_timestamp_path_epoch_http_error(
         108  +
    error: &crate::error::MalformedTimestampPathEpochError,
         109  +
) -> std::result::Result<
         110  +
    ::aws_smithy_legacy_http_server::response::Response,
         111  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
         112  +
> {
         113  +
    /* ServerHttpBoundProtocolGenerator.kt:476 */
         114  +
    Ok({
         115  +
        /* ServerHttpBoundProtocolGenerator.kt:492 */
         116  +
        match error {
         117  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
         118  +
            crate::error::MalformedTimestampPathEpochError::ValidationException(output) => {
         119  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
         120  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         121  +
                /* RustType.kt:534 */
         122  +
                #[allow(unused_mut)]
         123  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         124  +
                let mut builder = ::http::Response::builder();
         125  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
         126  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         127  +
                    builder,
         128  +
                    ::http::header::CONTENT_TYPE,
         129  +
                    "application/json",
         130  +
                );
         131  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
         132  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         133  +
                    builder,
         134  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         135  +
                    "ValidationException",
         136  +
                );
         137  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
         138  +
                let content_length = payload.len();
         139  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         140  +
                    builder,
         141  +
                    ::http::header::CONTENT_LENGTH,
         142  +
                    content_length,
         143  +
                );
         144  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
         145  +
                builder
         146  +
                    .status(400)
         147  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         148  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         149  +
            } /* ServerHttpBoundProtocolGenerator.kt:492 */
         150  +
        }
         151  +
        /* ServerHttpBoundProtocolGenerator.kt:476 */
         152  +
    })
         153  +
    /* ServerHttpBoundProtocolGenerator.kt:471 */
         154  +
}

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

@@ -0,1 +0,16 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
           3  +
pub fn de_timestamp(
           4  +
    value: &str,
           5  +
) -> std::result::Result<
           6  +
    ::aws_smithy_types::DateTime,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
           8  +
> {
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1486 */
          10  +
    let value = ::percent_encoding::percent_decode_str(value).decode_utf8()?;
          11  +
    let value = ::aws_smithy_types::DateTime::from_str(value.as_ref(), ::aws_smithy_types::date_time::Format::EpochSeconds)?
          12  +
    /* ServerHttpBoundProtocolGenerator.kt:1510 */;
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
          14  +
    Ok(value)
          15  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
          16  +
}

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

@@ -0,1 +0,156 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
           3  +
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
           5  +
pub async fn de_malformed_timestamp_path_http_date_http_request<B>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::MalformedTimestampPathHttpDateInput,
           9  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
          10  +
>
          11  +
where
          12  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          13  +
    B::Data: Send,
          14  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          15  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          16  +
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
          18  +
    Ok({
          19  +
        /* RustType.kt:534 */
          20  +
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
          22  +
        let mut input = crate::input::malformed_timestamp_path_http_date_input::Builder::default();
          23  +
        /* RustType.kt:534 */
          24  +
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
          26  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          27  +
            uri, headers, body, ..
          28  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:1134 */
          30  +
        let input_string = uri.path();
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:1146 */
          32  +
        let (input_string, (_, m1)) =
          33  +
            ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
          34  +
                ::nom::sequence::preceded(
          35  +
                    ::nom::bytes::complete::tag("/"),
          36  +
                    ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>(
          37  +
                        "MalformedTimestampPathHttpDate",
          38  +
                    ),
          39  +
                ),
          40  +
                ::nom::sequence::preceded(
          41  +
                    ::nom::bytes::complete::tag("/"),
          42  +
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
          43  +
                        ::nom::bytes::complete::take_until("/"),
          44  +
                        ::nom::combinator::rest,
          45  +
                    )),
          46  +
                ),
          47  +
            ))(input_string)?;
          48  +
        debug_assert_eq!("", input_string);
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:1157 */
          50  +
        input = input.set_timestamp(
          51  +
            crate::protocol_serde::shape_malformed_timestamp_path_http_date_input::de_timestamp(
          52  +
                m1,
          53  +
            )?,
          54  +
        );
          55  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
          56  +
        input.build()?
          57  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
          58  +
    })
          59  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
          60  +
}
          61  +
          62  +
/* RustType.kt:534 */
          63  +
#[allow(clippy::unnecessary_wraps)]
          64  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
          65  +
pub fn ser_malformed_timestamp_path_http_date_http_response(
          66  +
    #[allow(unused_variables)] output: crate::output::MalformedTimestampPathHttpDateOutput,
          67  +
) -> std::result::Result<
          68  +
    ::aws_smithy_legacy_http_server::response::Response,
          69  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          70  +
> {
          71  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
          72  +
    Ok({
          73  +
        /* RustType.kt:534 */
          74  +
        #[allow(unused_mut)]
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          76  +
        let mut builder = ::http::Response::builder();
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
          78  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          79  +
            builder,
          80  +
            ::http::header::CONTENT_TYPE,
          81  +
            "application/json",
          82  +
        );
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
          84  +
        let http_status: u16 = 200;
          85  +
        builder = builder.status(http_status);
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          87  +
        let payload =
          88  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
          91  +
        let content_length = payload.len();
          92  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          93  +
            builder,
          94  +
            ::http::header::CONTENT_LENGTH,
          95  +
            content_length,
          96  +
        );
          97  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
          98  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          99  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
         100  +
        builder.body(body)?
         101  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
         102  +
    })
         103  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
         104  +
}
         105  +
         106  +
/* RustType.kt:534 */
         107  +
#[allow(clippy::unnecessary_wraps)]
         108  +
/* ServerHttpBoundProtocolGenerator.kt:471 */
         109  +
pub fn ser_malformed_timestamp_path_http_date_http_error(
         110  +
    error: &crate::error::MalformedTimestampPathHttpDateError,
         111  +
) -> std::result::Result<
         112  +
    ::aws_smithy_legacy_http_server::response::Response,
         113  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
         114  +
> {
         115  +
    /* ServerHttpBoundProtocolGenerator.kt:476 */
         116  +
    Ok({
         117  +
        /* ServerHttpBoundProtocolGenerator.kt:492 */
         118  +
        match error {
         119  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
         120  +
            crate::error::MalformedTimestampPathHttpDateError::ValidationException(output) => {
         121  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
         122  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         123  +
                /* RustType.kt:534 */
         124  +
                #[allow(unused_mut)]
         125  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         126  +
                let mut builder = ::http::Response::builder();
         127  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
         128  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         129  +
                    builder,
         130  +
                    ::http::header::CONTENT_TYPE,
         131  +
                    "application/json",
         132  +
                );
         133  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
         134  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         135  +
                    builder,
         136  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         137  +
                    "ValidationException",
         138  +
                );
         139  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
         140  +
                let content_length = payload.len();
         141  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         142  +
                    builder,
         143  +
                    ::http::header::CONTENT_LENGTH,
         144  +
                    content_length,
         145  +
                );
         146  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
         147  +
                builder
         148  +
                    .status(400)
         149  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         150  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         151  +
            } /* ServerHttpBoundProtocolGenerator.kt:492 */
         152  +
        }
         153  +
        /* ServerHttpBoundProtocolGenerator.kt:476 */
         154  +
    })
         155  +
    /* ServerHttpBoundProtocolGenerator.kt:471 */
         156  +
}

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

@@ -0,1 +0,16 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
           3  +
pub fn de_timestamp(
           4  +
    value: &str,
           5  +
) -> std::result::Result<
           6  +
    ::aws_smithy_types::DateTime,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
           8  +
> {
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1486 */
          10  +
    let value = ::percent_encoding::percent_decode_str(value).decode_utf8()?;
          11  +
    let value = ::aws_smithy_types::DateTime::from_str(value.as_ref(), ::aws_smithy_types::date_time::Format::HttpDate)?
          12  +
    /* ServerHttpBoundProtocolGenerator.kt:1510 */;
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
          14  +
    Ok(value)
          15  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
          16  +
}

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

@@ -0,1 +0,146 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
           3  +
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
           5  +
pub async fn de_malformed_timestamp_query_default_http_request<B>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::MalformedTimestampQueryDefaultInput,
           9  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
          10  +
>
          11  +
where
          12  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          13  +
    B::Data: Send,
          14  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          15  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          16  +
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
          18  +
    Ok({
          19  +
        /* RustType.kt:534 */
          20  +
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
          22  +
        let mut input = crate::input::malformed_timestamp_query_default_input::Builder::default();
          23  +
        /* RustType.kt:534 */
          24  +
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
          26  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          27  +
            uri, headers, body, ..
          28  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:1221 */
          30  +
        let query_string = uri.query().unwrap_or("");
          31  +
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:1247 */
          33  +
        let mut timestamp_seen = false;
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:1253 */
          35  +
        for (k, v) in pairs {
          36  +
            /* ServerHttpBoundProtocolGenerator.kt:1257 */
          37  +
            if !timestamp_seen && k == "timestamp" {
          38  +
                input = input.set_timestamp(
          39  +
                    crate::protocol_serde::shape_malformed_timestamp_query_default_input::de_timestamp(&v)?
          40  +
                );
          41  +
                timestamp_seen = true;
          42  +
            }
          43  +
            /* ServerHttpBoundProtocolGenerator.kt:1253 */
          44  +
        }
          45  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
          46  +
        input.build()?
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
          48  +
    })
          49  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
          50  +
}
          51  +
          52  +
/* RustType.kt:534 */
          53  +
#[allow(clippy::unnecessary_wraps)]
          54  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
          55  +
pub fn ser_malformed_timestamp_query_default_http_response(
          56  +
    #[allow(unused_variables)] output: crate::output::MalformedTimestampQueryDefaultOutput,
          57  +
) -> std::result::Result<
          58  +
    ::aws_smithy_legacy_http_server::response::Response,
          59  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          60  +
> {
          61  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
          62  +
    Ok({
          63  +
        /* RustType.kt:534 */
          64  +
        #[allow(unused_mut)]
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          66  +
        let mut builder = ::http::Response::builder();
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
          68  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          69  +
            builder,
          70  +
            ::http::header::CONTENT_TYPE,
          71  +
            "application/json",
          72  +
        );
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
          74  +
        let http_status: u16 = 200;
          75  +
        builder = builder.status(http_status);
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          77  +
        let payload =
          78  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
          81  +
        let content_length = payload.len();
          82  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          83  +
            builder,
          84  +
            ::http::header::CONTENT_LENGTH,
          85  +
            content_length,
          86  +
        );
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
          88  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
          90  +
        builder.body(body)?
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
          92  +
    })
          93  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
          94  +
}
          95  +
          96  +
/* RustType.kt:534 */
          97  +
#[allow(clippy::unnecessary_wraps)]
          98  +
/* ServerHttpBoundProtocolGenerator.kt:471 */
          99  +
pub fn ser_malformed_timestamp_query_default_http_error(
         100  +
    error: &crate::error::MalformedTimestampQueryDefaultError,
         101  +
) -> std::result::Result<
         102  +
    ::aws_smithy_legacy_http_server::response::Response,
         103  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
         104  +
> {
         105  +
    /* ServerHttpBoundProtocolGenerator.kt:476 */
         106  +
    Ok({
         107  +
        /* ServerHttpBoundProtocolGenerator.kt:492 */
         108  +
        match error {
         109  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
         110  +
            crate::error::MalformedTimestampQueryDefaultError::ValidationException(output) => {
         111  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
         112  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         113  +
                /* RustType.kt:534 */
         114  +
                #[allow(unused_mut)]
         115  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         116  +
                let mut builder = ::http::Response::builder();
         117  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
         118  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         119  +
                    builder,
         120  +
                    ::http::header::CONTENT_TYPE,
         121  +
                    "application/json",
         122  +
                );
         123  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
         124  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         125  +
                    builder,
         126  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         127  +
                    "ValidationException",
         128  +
                );
         129  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
         130  +
                let content_length = payload.len();
         131  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         132  +
                    builder,
         133  +
                    ::http::header::CONTENT_LENGTH,
         134  +
                    content_length,
         135  +
                );
         136  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
         137  +
                builder
         138  +
                    .status(400)
         139  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         140  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         141  +
            } /* ServerHttpBoundProtocolGenerator.kt:492 */
         142  +
        }
         143  +
        /* ServerHttpBoundProtocolGenerator.kt:476 */
         144  +
    })
         145  +
    /* ServerHttpBoundProtocolGenerator.kt:471 */
         146  +
}

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

@@ -0,1 +0,15 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
           3  +
pub fn de_timestamp(
           4  +
    value: &str,
           5  +
) -> std::result::Result<
           6  +
    ::aws_smithy_types::DateTime,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
           8  +
> {
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1495 */
          10  +
    let value = ::aws_smithy_types::DateTime::from_str(value, ::aws_smithy_types::date_time::Format::DateTime)?
          11  +
    /* ServerHttpBoundProtocolGenerator.kt:1510 */;
          12  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
          13  +
    Ok(value)
          14  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
          15  +
}

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

@@ -0,1 +0,146 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
           3  +
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
           5  +
pub async fn de_malformed_timestamp_query_epoch_http_request<B>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::MalformedTimestampQueryEpochInput,
           9  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
          10  +
>
          11  +
where
          12  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          13  +
    B::Data: Send,
          14  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          15  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          16  +
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
          18  +
    Ok({
          19  +
        /* RustType.kt:534 */
          20  +
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
          22  +
        let mut input = crate::input::malformed_timestamp_query_epoch_input::Builder::default();
          23  +
        /* RustType.kt:534 */
          24  +
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
          26  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          27  +
            uri, headers, body, ..
          28  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:1221 */
          30  +
        let query_string = uri.query().unwrap_or("");
          31  +
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:1247 */
          33  +
        let mut timestamp_seen = false;
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:1253 */
          35  +
        for (k, v) in pairs {
          36  +
            /* ServerHttpBoundProtocolGenerator.kt:1257 */
          37  +
            if !timestamp_seen && k == "timestamp" {
          38  +
                input = input.set_timestamp(
          39  +
                    crate::protocol_serde::shape_malformed_timestamp_query_epoch_input::de_timestamp(&v)?
          40  +
                );
          41  +
                timestamp_seen = true;
          42  +
            }
          43  +
            /* ServerHttpBoundProtocolGenerator.kt:1253 */
          44  +
        }
          45  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
          46  +
        input.build()?
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
          48  +
    })
          49  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
          50  +
}
          51  +
          52  +
/* RustType.kt:534 */
          53  +
#[allow(clippy::unnecessary_wraps)]
          54  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
          55  +
pub fn ser_malformed_timestamp_query_epoch_http_response(
          56  +
    #[allow(unused_variables)] output: crate::output::MalformedTimestampQueryEpochOutput,
          57  +
) -> std::result::Result<
          58  +
    ::aws_smithy_legacy_http_server::response::Response,
          59  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          60  +
> {
          61  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
          62  +
    Ok({
          63  +
        /* RustType.kt:534 */
          64  +
        #[allow(unused_mut)]
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          66  +
        let mut builder = ::http::Response::builder();
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
          68  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          69  +
            builder,
          70  +
            ::http::header::CONTENT_TYPE,
          71  +
            "application/json",
          72  +
        );
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
          74  +
        let http_status: u16 = 200;
          75  +
        builder = builder.status(http_status);
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          77  +
        let payload =
          78  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
          81  +
        let content_length = payload.len();
          82  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          83  +
            builder,
          84  +
            ::http::header::CONTENT_LENGTH,
          85  +
            content_length,
          86  +
        );
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
          88  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
          90  +
        builder.body(body)?
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
          92  +
    })
          93  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
          94  +
}
          95  +
          96  +
/* RustType.kt:534 */
          97  +
#[allow(clippy::unnecessary_wraps)]
          98  +
/* ServerHttpBoundProtocolGenerator.kt:471 */
          99  +
pub fn ser_malformed_timestamp_query_epoch_http_error(
         100  +
    error: &crate::error::MalformedTimestampQueryEpochError,
         101  +
) -> std::result::Result<
         102  +
    ::aws_smithy_legacy_http_server::response::Response,
         103  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
         104  +
> {
         105  +
    /* ServerHttpBoundProtocolGenerator.kt:476 */
         106  +
    Ok({
         107  +
        /* ServerHttpBoundProtocolGenerator.kt:492 */
         108  +
        match error {
         109  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
         110  +
            crate::error::MalformedTimestampQueryEpochError::ValidationException(output) => {
         111  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
         112  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         113  +
                /* RustType.kt:534 */
         114  +
                #[allow(unused_mut)]
         115  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         116  +
                let mut builder = ::http::Response::builder();
         117  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
         118  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         119  +
                    builder,
         120  +
                    ::http::header::CONTENT_TYPE,
         121  +
                    "application/json",
         122  +
                );
         123  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
         124  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         125  +
                    builder,
         126  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         127  +
                    "ValidationException",
         128  +
                );
         129  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
         130  +
                let content_length = payload.len();
         131  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         132  +
                    builder,
         133  +
                    ::http::header::CONTENT_LENGTH,
         134  +
                    content_length,
         135  +
                );
         136  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
         137  +
                builder
         138  +
                    .status(400)
         139  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         140  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         141  +
            } /* ServerHttpBoundProtocolGenerator.kt:492 */
         142  +
        }
         143  +
        /* ServerHttpBoundProtocolGenerator.kt:476 */
         144  +
    })
         145  +
    /* ServerHttpBoundProtocolGenerator.kt:471 */
         146  +
}