Server Test

Server Test

rev. d06a46cae0f385cdae37a9f8264db3469a090ab5 (ignoring whitespace)

Files changed:

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

@@ -0,1 +0,159 @@
           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_post_player_action_http_request<B>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::PostPlayerActionInput,
           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::post_player_action_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:801 */
          30  +
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:825 */
          32  +
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:826 */
          34  +
            ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
          35  +
                &headers,
          36  +
                Some("application/json"),
          37  +
            )?;
          38  +
            input = crate::protocol_serde::shape_post_player_action::de_post_player_action(
          39  +
                bytes.as_ref(),
          40  +
                input,
          41  +
            )?;
          42  +
            /* ServerHttpBoundProtocolGenerator.kt:825 */
          43  +
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
          45  +
        input.build()
          46  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
          47  +
    })
          48  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
          49  +
}
          50  +
          51  +
/* RustType.kt:534 */
          52  +
#[allow(clippy::unnecessary_wraps)]
          53  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
          54  +
pub fn ser_post_player_action_http_response(
          55  +
    #[allow(unused_variables)] output: crate::output::PostPlayerActionOutput,
          56  +
) -> std::result::Result<
          57  +
    ::aws_smithy_legacy_http_server::response::Response,
          58  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          59  +
> {
          60  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
          61  +
    Ok({
          62  +
        /* RustType.kt:534 */
          63  +
        #[allow(unused_mut)]
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          65  +
        let mut builder = ::http::Response::builder();
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
          67  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          68  +
            builder,
          69  +
            ::http::header::CONTENT_TYPE,
          70  +
            "application/json",
          71  +
        );
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
          73  +
        let http_status: u16 = 200;
          74  +
        builder = builder.status(http_status);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          76  +
        let payload =
          77  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_post_player_action_output::ser_post_player_action_output_output_output(&output)?
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
          80  +
        let content_length = payload.len();
          81  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          82  +
            builder,
          83  +
            ::http::header::CONTENT_LENGTH,
          84  +
            content_length,
          85  +
        );
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
          87  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
          89  +
        builder.body(body)?
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
          91  +
    })
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
          93  +
}
          94  +
          95  +
/* JsonParserGenerator.kt:148 */
          96  +
pub(crate) fn de_post_player_action(
          97  +
    value: &[u8],
          98  +
    mut builder: crate::input::post_player_action_input::Builder,
          99  +
) -> ::std::result::Result<
         100  +
    crate::input::post_player_action_input::Builder,
         101  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
         102  +
> {
         103  +
    /* JsonParserGenerator.kt:153 */
         104  +
    let mut tokens_owned =
         105  +
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
         106  +
            .peekable();
         107  +
    let tokens = &mut tokens_owned;
         108  +
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         109  +
    /* JsonParserGenerator.kt:684 */
         110  +
    loop {
         111  +
        /* JsonParserGenerator.kt:685 */
         112  +
        match tokens.next().transpose()? {
         113  +
            /* JsonParserGenerator.kt:686 */
         114  +
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
         115  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         116  +
                /* JsonParserGenerator.kt:260 */
         117  +
                match key.to_unescaped()?.as_ref() {
         118  +
                    /* JsonParserGenerator.kt:262 */
         119  +
                    "action" => {
         120  +
                        /* JsonParserGenerator.kt:272 */
         121  +
                        builder =
         122  +
                            builder.set_action(
         123  +
                                /* JsonParserGenerator.kt:660 */
         124  +
                                crate::protocol_serde::shape_player_action::de_player_action(
         125  +
                                    tokens,
         126  +
                                )?, /* JsonParserGenerator.kt:272 */
         127  +
                            );
         128  +
                        /* JsonParserGenerator.kt:262 */
         129  +
                    }
         130  +
                    /* JsonParserGenerator.kt:290 */
         131  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
         132  +
                }
         133  +
                /* JsonParserGenerator.kt:686 */
         134  +
            }
         135  +
            /* JsonParserGenerator.kt:695 */
         136  +
            other => {
         137  +
                return Err(
         138  +
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
         139  +
                        "expected object key or end object, found: {other:?}"
         140  +
                    )),
         141  +
                )
         142  +
            } /* JsonParserGenerator.kt:685 */
         143  +
        }
         144  +
        /* JsonParserGenerator.kt:684 */
         145  +
    }
         146  +
    /* JsonParserGenerator.kt:250 */
         147  +
    if tokens.next().is_some() {
         148  +
        /* JsonParserGenerator.kt:251 */
         149  +
        return Err(
         150  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         151  +
                "found more JSON tokens after completing parsing",
         152  +
            ),
         153  +
        );
         154  +
        /* JsonParserGenerator.kt:250 */
         155  +
    }
         156  +
    /* JsonParserGenerator.kt:163 */
         157  +
    Ok(builder)
         158  +
    /* JsonParserGenerator.kt:148 */
         159  +
}

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

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

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

@@ -0,1 +0,152 @@
           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_post_union_with_json_name_http_request<B>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::PostUnionWithJsonNameInput,
           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::post_union_with_json_name_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:801 */
          30  +
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:825 */
          32  +
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:826 */
          34  +
            ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
          35  +
                &headers,
          36  +
                Some("application/json"),
          37  +
            )?;
          38  +
            input = crate::protocol_serde::shape_post_union_with_json_name::de_post_union_with_json_name(bytes.as_ref(), input)?;
          39  +
            /* ServerHttpBoundProtocolGenerator.kt:825 */
          40  +
        }
          41  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
          42  +
        input.build()
          43  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
          44  +
    })
          45  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
          46  +
}
          47  +
          48  +
/* RustType.kt:534 */
          49  +
#[allow(clippy::unnecessary_wraps)]
          50  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
          51  +
pub fn ser_post_union_with_json_name_http_response(
          52  +
    #[allow(unused_variables)] output: crate::output::PostUnionWithJsonNameOutput,
          53  +
) -> std::result::Result<
          54  +
    ::aws_smithy_legacy_http_server::response::Response,
          55  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          56  +
> {
          57  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
          58  +
    Ok({
          59  +
        /* RustType.kt:534 */
          60  +
        #[allow(unused_mut)]
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          62  +
        let mut builder = ::http::Response::builder();
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
          64  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          65  +
            builder,
          66  +
            ::http::header::CONTENT_TYPE,
          67  +
            "application/json",
          68  +
        );
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
          70  +
        let http_status: u16 = 200;
          71  +
        builder = builder.status(http_status);
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          73  +
        let payload =
          74  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_post_union_with_json_name_output::ser_post_union_with_json_name_output_output_output(&output)?
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
          77  +
        let content_length = payload.len();
          78  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          79  +
            builder,
          80  +
            ::http::header::CONTENT_LENGTH,
          81  +
            content_length,
          82  +
        );
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
          84  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          85  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
          86  +
        builder.body(body)?
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
          88  +
    })
          89  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
          90  +
}
          91  +
          92  +
/* JsonParserGenerator.kt:148 */
          93  +
pub(crate) fn de_post_union_with_json_name(
          94  +
    value: &[u8],
          95  +
    mut builder: crate::input::post_union_with_json_name_input::Builder,
          96  +
) -> ::std::result::Result<
          97  +
    crate::input::post_union_with_json_name_input::Builder,
          98  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
          99  +
> {
         100  +
    /* JsonParserGenerator.kt:153 */
         101  +
    let mut tokens_owned =
         102  +
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
         103  +
            .peekable();
         104  +
    let tokens = &mut tokens_owned;
         105  +
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         106  +
    /* JsonParserGenerator.kt:684 */
         107  +
    loop {
         108  +
        /* JsonParserGenerator.kt:685 */
         109  +
        match tokens.next().transpose()? {
         110  +
            /* JsonParserGenerator.kt:686 */
         111  +
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
         112  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         113  +
                /* JsonParserGenerator.kt:260 */
         114  +
                match key.to_unescaped()?.as_ref() {
         115  +
                    /* JsonParserGenerator.kt:262 */
         116  +
                    "value" => {
         117  +
                        /* JsonParserGenerator.kt:272 */
         118  +
                        builder = builder.set_value(
         119  +
                            /* JsonParserGenerator.kt:660 */crate::protocol_serde::shape_union_with_json_name::de_union_with_json_name(tokens)?
         120  +
                        /* JsonParserGenerator.kt:272 */);
         121  +
                        /* JsonParserGenerator.kt:262 */
         122  +
                    }
         123  +
                    /* JsonParserGenerator.kt:290 */
         124  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
         125  +
                }
         126  +
                /* JsonParserGenerator.kt:686 */
         127  +
            }
         128  +
            /* JsonParserGenerator.kt:695 */
         129  +
            other => {
         130  +
                return Err(
         131  +
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
         132  +
                        "expected object key or end object, found: {other:?}"
         133  +
                    )),
         134  +
                )
         135  +
            } /* JsonParserGenerator.kt:685 */
         136  +
        }
         137  +
        /* JsonParserGenerator.kt:684 */
         138  +
    }
         139  +
    /* JsonParserGenerator.kt:250 */
         140  +
    if tokens.next().is_some() {
         141  +
        /* JsonParserGenerator.kt:251 */
         142  +
        return Err(
         143  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         144  +
                "found more JSON tokens after completing parsing",
         145  +
            ),
         146  +
        );
         147  +
        /* JsonParserGenerator.kt:250 */
         148  +
    }
         149  +
    /* JsonParserGenerator.kt:163 */
         150  +
    Ok(builder)
         151  +
    /* JsonParserGenerator.kt:148 */
         152  +
}

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

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

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

@@ -0,1 +0,168 @@
           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_put_with_content_encoding_http_request<B>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::PutWithContentEncodingInput,
           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::put_with_content_encoding_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:801 */
          30  +
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:825 */
          32  +
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:826 */
          34  +
            ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
          35  +
                &headers,
          36  +
                Some("application/json"),
          37  +
            )?;
          38  +
            input = crate::protocol_serde::shape_put_with_content_encoding::de_put_with_content_encoding(bytes.as_ref(), input)?;
          39  +
            /* ServerHttpBoundProtocolGenerator.kt:825 */
          40  +
        }
          41  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
          42  +
        if let Some(value) =
          43  +
            crate::protocol_serde::shape_put_with_content_encoding_input::de_encoding_header(
          44  +
                &headers,
          45  +
            )?
          46  +
        {
          47  +
            input = input.set_encoding(Some(value))
          48  +
        }
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
          50  +
        input.build()
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
          52  +
    })
          53  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
          54  +
}
          55  +
          56  +
/* RustType.kt:534 */
          57  +
#[allow(clippy::unnecessary_wraps)]
          58  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
          59  +
pub fn ser_put_with_content_encoding_http_response(
          60  +
    #[allow(unused_variables)] output: crate::output::PutWithContentEncodingOutput,
          61  +
) -> std::result::Result<
          62  +
    ::aws_smithy_legacy_http_server::response::Response,
          63  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          64  +
> {
          65  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
          66  +
    Ok({
          67  +
        /* RustType.kt:534 */
          68  +
        #[allow(unused_mut)]
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          70  +
        let mut builder = ::http::Response::builder();
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
          72  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          73  +
            builder,
          74  +
            ::http::header::CONTENT_TYPE,
          75  +
            "application/json",
          76  +
        );
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
          78  +
        let http_status: u16 = 200;
          79  +
        builder = builder.status(http_status);
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          81  +
        let payload =
          82  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
          85  +
        let content_length = payload.len();
          86  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          87  +
            builder,
          88  +
            ::http::header::CONTENT_LENGTH,
          89  +
            content_length,
          90  +
        );
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
          92  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          93  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
          94  +
        builder.body(body)?
          95  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
          96  +
    })
          97  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
          98  +
}
          99  +
         100  +
/* JsonParserGenerator.kt:148 */
         101  +
pub(crate) fn de_put_with_content_encoding(
         102  +
    value: &[u8],
         103  +
    mut builder: crate::input::put_with_content_encoding_input::Builder,
         104  +
) -> ::std::result::Result<
         105  +
    crate::input::put_with_content_encoding_input::Builder,
         106  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
         107  +
> {
         108  +
    /* JsonParserGenerator.kt:153 */
         109  +
    let mut tokens_owned =
         110  +
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
         111  +
            .peekable();
         112  +
    let tokens = &mut tokens_owned;
         113  +
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         114  +
    /* JsonParserGenerator.kt:684 */
         115  +
    loop {
         116  +
        /* JsonParserGenerator.kt:685 */
         117  +
        match tokens.next().transpose()? {
         118  +
            /* JsonParserGenerator.kt:686 */
         119  +
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
         120  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         121  +
                /* JsonParserGenerator.kt:260 */
         122  +
                match key.to_unescaped()?.as_ref() {
         123  +
                    /* JsonParserGenerator.kt:262 */
         124  +
                    "data" => {
         125  +
                        /* JsonParserGenerator.kt:272 */
         126  +
                        builder = builder.set_data(
         127  +
                            /* JsonParserGenerator.kt:354 */
         128  +
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
         129  +
                                tokens.next(),
         130  +
                            )?
         131  +
                            .map(|s|
         132  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         133  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         134  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         135  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
         136  +
                        );
         137  +
                        /* JsonParserGenerator.kt:262 */
         138  +
                    }
         139  +
                    /* JsonParserGenerator.kt:290 */
         140  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
         141  +
                }
         142  +
                /* JsonParserGenerator.kt:686 */
         143  +
            }
         144  +
            /* JsonParserGenerator.kt:695 */
         145  +
            other => {
         146  +
                return Err(
         147  +
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
         148  +
                        "expected object key or end object, found: {other:?}"
         149  +
                    )),
         150  +
                )
         151  +
            } /* JsonParserGenerator.kt:685 */
         152  +
        }
         153  +
        /* JsonParserGenerator.kt:684 */
         154  +
    }
         155  +
    /* JsonParserGenerator.kt:250 */
         156  +
    if tokens.next().is_some() {
         157  +
        /* JsonParserGenerator.kt:251 */
         158  +
        return Err(
         159  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         160  +
                "found more JSON tokens after completing parsing",
         161  +
            ),
         162  +
        );
         163  +
        /* JsonParserGenerator.kt:250 */
         164  +
    }
         165  +
    /* JsonParserGenerator.kt:163 */
         166  +
    Ok(builder)
         167  +
    /* JsonParserGenerator.kt:148 */
         168  +
}

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

@@ -0,1 +0,14 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:159 */
           3  +
pub(crate) fn de_encoding_header(
           4  +
    header_map: &::aws_smithy_runtime_api::http::Headers,
           5  +
) -> ::std::result::Result<
           6  +
    ::std::option::Option<::std::string::String>,
           7  +
    ::aws_smithy_legacy_http::header::ParseError,
           8  +
> {
           9  +
    /* HttpBindingGenerator.kt:166 */
          10  +
    let headers = header_map.get_all("Content-Encoding");
          11  +
    /* HttpBindingGenerator.kt:398 */
          12  +
    ::aws_smithy_legacy_http::header::one_or_none(headers)
          13  +
    /* HttpBindingGenerator.kt:159 */
          14  +
}

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

@@ -0,1 +0,96 @@
           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_query_idempotency_token_auto_fill_http_request<B>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::QueryIdempotencyTokenAutoFillInput,
           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::query_idempotency_token_auto_fill_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 token_seen = false;
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:1253 */
          35  +
        for (k, v) in pairs {
          36  +
            /* ServerHttpBoundProtocolGenerator.kt:1257 */
          37  +
            if !token_seen && k == "token" {
          38  +
                input = input.set_token(
          39  +
                    crate::protocol_serde::shape_query_idempotency_token_auto_fill_input::de_token(
          40  +
                        &v,
          41  +
                    )?,
          42  +
                );
          43  +
                token_seen = true;
          44  +
            }
          45  +
            /* ServerHttpBoundProtocolGenerator.kt:1253 */
          46  +
        }
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
          48  +
        input.build()
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
          50  +
    })
          51  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
          52  +
}
          53  +
          54  +
/* RustType.kt:534 */
          55  +
#[allow(clippy::unnecessary_wraps)]
          56  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
          57  +
pub fn ser_query_idempotency_token_auto_fill_http_response(
          58  +
    #[allow(unused_variables)] output: crate::output::QueryIdempotencyTokenAutoFillOutput,
          59  +
) -> std::result::Result<
          60  +
    ::aws_smithy_legacy_http_server::response::Response,
          61  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          62  +
> {
          63  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
          64  +
    Ok({
          65  +
        /* RustType.kt:534 */
          66  +
        #[allow(unused_mut)]
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          68  +
        let mut builder = ::http::Response::builder();
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
          70  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          71  +
            builder,
          72  +
            ::http::header::CONTENT_TYPE,
          73  +
            "application/json",
          74  +
        );
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
          76  +
        let http_status: u16 = 200;
          77  +
        builder = builder.status(http_status);
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          79  +
        let payload =
          80  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
          83  +
        let content_length = payload.len();
          84  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          85  +
            builder,
          86  +
            ::http::header::CONTENT_LENGTH,
          87  +
            content_length,
          88  +
        );
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
          90  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
          92  +
        builder.body(body)?
          93  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
          94  +
    })
          95  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
          96  +
}

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

@@ -0,1 +0,14 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
           3  +
pub fn de_token(
           4  +
    value: &str,
           5  +
) -> std::result::Result<
           6  +
    ::std::option::Option<::std::string::String>,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
           8  +
> {
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1470 */
          10  +
    let value = value.to_owned();
          11  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
          12  +
    Ok(Some(value))
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
          14  +
}

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

@@ -0,1 +0,109 @@
           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_query_params_as_string_list_map_http_request<B>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::QueryParamsAsStringListMapInput,
           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::query_params_as_string_list_map_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:1236 */
          33  +
        let mut query_params: ::std::collections::HashMap::<::std::string::String, ::std::vec::Vec::<::std::string::String>> =
          34  +
            /* ServerHttpBoundProtocolGenerator.kt:1238 */::std::collections::HashMap::new()
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:1236 */;
          36  +
        /* ServerHttpBoundProtocolGenerator.kt:1247 */
          37  +
        let mut qux_seen = false;
          38  +
        /* ServerHttpBoundProtocolGenerator.kt:1253 */
          39  +
        for (k, v) in pairs {
          40  +
            /* ServerHttpBoundProtocolGenerator.kt:1257 */
          41  +
            if !qux_seen && k == "corge" {
          42  +
                input = input.set_qux(
          43  +
                    crate::protocol_serde::shape_query_params_as_string_list_map_input::de_qux(&v)?,
          44  +
                );
          45  +
                qux_seen = true;
          46  +
            }
          47  +
            /* ServerHttpBoundProtocolGenerator.kt:1358 */
          48  +
            let entry = query_params.entry(String::from(k)).or_default();
          49  +
            entry.push(String::from(v));
          50  +
            /* ServerHttpBoundProtocolGenerator.kt:1253 */
          51  +
        }
          52  +
        /* ServerHttpBoundProtocolGenerator.kt:1374 */
          53  +
        input = input.set_foo(
          54  +
            /* ServerHttpBoundProtocolGenerator.kt:1375 */
          55  +
            Some(
          56  +
                /* ServerHttpBoundProtocolGenerator.kt:1376 */
          57  +
                query_params, /* ServerHttpBoundProtocolGenerator.kt:1375 */
          58  +
            ), /* ServerHttpBoundProtocolGenerator.kt:1374 */
          59  +
        );
          60  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
          61  +
        input.build()
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
          63  +
    })
          64  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
          65  +
}
          66  +
          67  +
/* RustType.kt:534 */
          68  +
#[allow(clippy::unnecessary_wraps)]
          69  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
          70  +
pub fn ser_query_params_as_string_list_map_http_response(
          71  +
    #[allow(unused_variables)] output: crate::output::QueryParamsAsStringListMapOutput,
          72  +
) -> std::result::Result<
          73  +
    ::aws_smithy_legacy_http_server::response::Response,
          74  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          75  +
> {
          76  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
          77  +
    Ok({
          78  +
        /* RustType.kt:534 */
          79  +
        #[allow(unused_mut)]
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          81  +
        let mut builder = ::http::Response::builder();
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
          83  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          84  +
            builder,
          85  +
            ::http::header::CONTENT_TYPE,
          86  +
            "application/json",
          87  +
        );
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
          89  +
        let http_status: u16 = 200;
          90  +
        builder = builder.status(http_status);
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          92  +
        let payload =
          93  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          94  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          95  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
          96  +
        let content_length = payload.len();
          97  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          98  +
            builder,
          99  +
            ::http::header::CONTENT_LENGTH,
         100  +
            content_length,
         101  +
        );
         102  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
         103  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
         104  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
         105  +
        builder.body(body)?
         106  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
         107  +
    })
         108  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
         109  +
}

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

@@ -0,1 +0,14 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
           3  +
pub fn de_qux(
           4  +
    value: &str,
           5  +
) -> std::result::Result<
           6  +
    ::std::option::Option<::std::string::String>,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
           8  +
> {
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1470 */
          10  +
    let value = value.to_owned();
          11  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
          12  +
    Ok(Some(value))
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
          14  +
}

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

@@ -0,1 +0,110 @@
           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_query_precedence_http_request<B>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::QueryPrecedenceInput,
           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::query_precedence_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:1236 */
          33  +
        let mut query_params: ::std::collections::HashMap::<::std::string::String, ::std::string::String> =
          34  +
            /* ServerHttpBoundProtocolGenerator.kt:1238 */::std::collections::HashMap::new()
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:1236 */;
          36  +
        /* ServerHttpBoundProtocolGenerator.kt:1247 */
          37  +
        let mut foo_seen = false;
          38  +
        /* ServerHttpBoundProtocolGenerator.kt:1253 */
          39  +
        for (k, v) in pairs {
          40  +
            /* ServerHttpBoundProtocolGenerator.kt:1257 */
          41  +
            if !foo_seen && k == "bar" {
          42  +
                input = input.set_foo(crate::protocol_serde::shape_query_precedence_input::de_foo(
          43  +
                    &v,
          44  +
                )?);
          45  +
                foo_seen = true;
          46  +
            }
          47  +
            /* ServerHttpBoundProtocolGenerator.kt:1339 */
          48  +
            query_params
          49  +
                .entry(String::from(k))
          50  +
                .or_insert_with(|| String::from(v));
          51  +
            /* ServerHttpBoundProtocolGenerator.kt:1253 */
          52  +
        }
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:1374 */
          54  +
        input = input.set_baz(
          55  +
            /* ServerHttpBoundProtocolGenerator.kt:1375 */
          56  +
            Some(
          57  +
                /* ServerHttpBoundProtocolGenerator.kt:1376 */
          58  +
                query_params, /* ServerHttpBoundProtocolGenerator.kt:1375 */
          59  +
            ), /* ServerHttpBoundProtocolGenerator.kt:1374 */
          60  +
        );
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
          62  +
        input.build()
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
          64  +
    })
          65  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
          66  +
}
          67  +
          68  +
/* RustType.kt:534 */
          69  +
#[allow(clippy::unnecessary_wraps)]
          70  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
          71  +
pub fn ser_query_precedence_http_response(
          72  +
    #[allow(unused_variables)] output: crate::output::QueryPrecedenceOutput,
          73  +
) -> std::result::Result<
          74  +
    ::aws_smithy_legacy_http_server::response::Response,
          75  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          76  +
> {
          77  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
          78  +
    Ok({
          79  +
        /* RustType.kt:534 */
          80  +
        #[allow(unused_mut)]
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          82  +
        let mut builder = ::http::Response::builder();
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
          84  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          85  +
            builder,
          86  +
            ::http::header::CONTENT_TYPE,
          87  +
            "application/json",
          88  +
        );
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
          90  +
        let http_status: u16 = 200;
          91  +
        builder = builder.status(http_status);
          92  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          93  +
        let payload =
          94  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          95  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          96  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
          97  +
        let content_length = payload.len();
          98  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          99  +
            builder,
         100  +
            ::http::header::CONTENT_LENGTH,
         101  +
            content_length,
         102  +
        );
         103  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
         104  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
         105  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
         106  +
        builder.body(body)?
         107  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
         108  +
    })
         109  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
         110  +
}

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

@@ -0,1 +0,14 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
           3  +
pub fn de_foo(
           4  +
    value: &str,
           5  +
) -> std::result::Result<
           6  +
    ::std::option::Option<::std::string::String>,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
           8  +
> {
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1470 */
          10  +
    let value = value.to_owned();
          11  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
          12  +
    Ok(Some(value))
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
          14  +
}

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

@@ -0,1 +0,155 @@
           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_recursive_shapes_http_request<B>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::RecursiveShapesInput,
           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::recursive_shapes_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:801 */
          30  +
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:825 */
          32  +
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:826 */
          34  +
            ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
          35  +
                &headers,
          36  +
                Some("application/json"),
          37  +
            )?;
          38  +
            input = crate::protocol_serde::shape_recursive_shapes::de_recursive_shapes(
          39  +
                bytes.as_ref(),
          40  +
                input,
          41  +
            )?;
          42  +
            /* ServerHttpBoundProtocolGenerator.kt:825 */
          43  +
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
          45  +
        input.build()
          46  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
          47  +
    })
          48  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
          49  +
}
          50  +
          51  +
/* RustType.kt:534 */
          52  +
#[allow(clippy::unnecessary_wraps)]
          53  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
          54  +
pub fn ser_recursive_shapes_http_response(
          55  +
    #[allow(unused_variables)] output: crate::output::RecursiveShapesOutput,
          56  +
) -> std::result::Result<
          57  +
    ::aws_smithy_legacy_http_server::response::Response,
          58  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          59  +
> {
          60  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
          61  +
    Ok({
          62  +
        /* RustType.kt:534 */
          63  +
        #[allow(unused_mut)]
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          65  +
        let mut builder = ::http::Response::builder();
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
          67  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          68  +
            builder,
          69  +
            ::http::header::CONTENT_TYPE,
          70  +
            "application/json",
          71  +
        );
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
          73  +
        let http_status: u16 = 200;
          74  +
        builder = builder.status(http_status);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          76  +
        let payload =
          77  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_recursive_shapes_output::ser_recursive_shapes_output_output_output(&output)?
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
          80  +
        let content_length = payload.len();
          81  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          82  +
            builder,
          83  +
            ::http::header::CONTENT_LENGTH,
          84  +
            content_length,
          85  +
        );
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
          87  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
          89  +
        builder.body(body)?
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
          91  +
    })
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
          93  +
}
          94  +
          95  +
/* JsonParserGenerator.kt:148 */
          96  +
pub(crate) fn de_recursive_shapes(
          97  +
    value: &[u8],
          98  +
    mut builder: crate::input::recursive_shapes_input::Builder,
          99  +
) -> ::std::result::Result<
         100  +
    crate::input::recursive_shapes_input::Builder,
         101  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
         102  +
> {
         103  +
    /* JsonParserGenerator.kt:153 */
         104  +
    let mut tokens_owned =
         105  +
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
         106  +
            .peekable();
         107  +
    let tokens = &mut tokens_owned;
         108  +
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         109  +
    /* JsonParserGenerator.kt:684 */
         110  +
    loop {
         111  +
        /* JsonParserGenerator.kt:685 */
         112  +
        match tokens.next().transpose()? {
         113  +
            /* JsonParserGenerator.kt:686 */
         114  +
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
         115  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         116  +
                /* JsonParserGenerator.kt:260 */
         117  +
                match key.to_unescaped()?.as_ref() {
         118  +
                    /* JsonParserGenerator.kt:262 */
         119  +
                    "nested" => {
         120  +
                        /* JsonParserGenerator.kt:272 */
         121  +
                        builder = builder.set_nested(
         122  +
                            /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_recursive_shapes_input_output_nested1::de_recursive_shapes_input_output_nested1(tokens)?
         123  +
                        /* JsonParserGenerator.kt:272 */);
         124  +
                        /* JsonParserGenerator.kt:262 */
         125  +
                    }
         126  +
                    /* JsonParserGenerator.kt:290 */
         127  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
         128  +
                }
         129  +
                /* JsonParserGenerator.kt:686 */
         130  +
            }
         131  +
            /* JsonParserGenerator.kt:695 */
         132  +
            other => {
         133  +
                return Err(
         134  +
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
         135  +
                        "expected object key or end object, found: {other:?}"
         136  +
                    )),
         137  +
                )
         138  +
            } /* JsonParserGenerator.kt:685 */
         139  +
        }
         140  +
        /* JsonParserGenerator.kt:684 */
         141  +
    }
         142  +
    /* JsonParserGenerator.kt:250 */
         143  +
    if tokens.next().is_some() {
         144  +
        /* JsonParserGenerator.kt:251 */
         145  +
        return Err(
         146  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         147  +
                "found more JSON tokens after completing parsing",
         148  +
            ),
         149  +
        );
         150  +
        /* JsonParserGenerator.kt:250 */
         151  +
    }
         152  +
    /* JsonParserGenerator.kt:163 */
         153  +
    Ok(builder)
         154  +
    /* JsonParserGenerator.kt:148 */
         155  +
}