Server Test

Server Test

rev. 3c756f73b1f83a0eed4275d9d1e22df0b10b66fb

Files changed:

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

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

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

@@ -0,1 +0,113 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:358 */
           3  +
pub fn ser_structure_list_member(
           4  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
           5  +
    input: &crate::model::StructureListMember,
           6  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           7  +
    /* JsonSerializerGenerator.kt:382 */
           8  +
    if let Some(var_1) = &input.a {
           9  +
        /* JsonSerializerGenerator.kt:423 */
          10  +
        object.key("value").string(var_1.as_str());
          11  +
        /* JsonSerializerGenerator.kt:382 */
          12  +
    }
          13  +
    /* JsonSerializerGenerator.kt:382 */
          14  +
    if let Some(var_2) = &input.b {
          15  +
        /* JsonSerializerGenerator.kt:423 */
          16  +
        object.key("other").string(var_2.as_str());
          17  +
        /* JsonSerializerGenerator.kt:382 */
          18  +
    }
          19  +
    /* JsonSerializerGenerator.kt:372 */
          20  +
    Ok(())
          21  +
    /* JsonSerializerGenerator.kt:358 */
          22  +
}
          23  +
          24  +
/* JsonParserGenerator.kt:516 */
          25  +
pub(crate) fn de_structure_list_member<'a, I>(
          26  +
    tokens: &mut ::std::iter::Peekable<I>,
          27  +
) -> ::std::result::Result<
          28  +
    Option<crate::model::StructureListMember>,
          29  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
          30  +
>
          31  +
where
          32  +
    I: Iterator<
          33  +
        Item = Result<
          34  +
            ::aws_smithy_json::deserialize::Token<'a>,
          35  +
            ::aws_smithy_json::deserialize::error::DeserializeError,
          36  +
        >,
          37  +
    >,
          38  +
{
          39  +
    /* JsonParserGenerator.kt:712 */
          40  +
    match tokens.next().transpose()? {
          41  +
        /* JsonParserGenerator.kt:713 */
          42  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          43  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          44  +
            /* RustType.kt:534 */
          45  +
            #[allow(unused_mut)]
          46  +
            /* JsonParserGenerator.kt:526 */
          47  +
            let mut builder = crate::model::structure_list_member::Builder::default();
          48  +
            /* JsonParserGenerator.kt:684 */
          49  +
            loop {
          50  +
                /* JsonParserGenerator.kt:685 */
          51  +
                match tokens.next().transpose()? {
          52  +
                    /* JsonParserGenerator.kt:686 */
          53  +
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          54  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          55  +
                        /* JsonParserGenerator.kt:260 */
          56  +
                        match key.to_unescaped()?.as_ref() {
          57  +
                            /* JsonParserGenerator.kt:262 */
          58  +
                            "value" => {
          59  +
                                /* JsonParserGenerator.kt:272 */
          60  +
                                builder = builder.set_a(
          61  +
                                    /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          62  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          63  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
          64  +
                                        /* JsonParserGenerator.kt:339 */)
          65  +
                                    /* JsonParserGenerator.kt:354 */).transpose()?
          66  +
                                /* JsonParserGenerator.kt:272 */);
          67  +
                                /* JsonParserGenerator.kt:262 */
          68  +
                            }
          69  +
                            /* JsonParserGenerator.kt:262 */
          70  +
                            "other" => {
          71  +
                                /* JsonParserGenerator.kt:272 */
          72  +
                                builder = builder.set_b(
          73  +
                                    /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          74  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          75  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
          76  +
                                        /* JsonParserGenerator.kt:339 */)
          77  +
                                    /* JsonParserGenerator.kt:354 */).transpose()?
          78  +
                                /* JsonParserGenerator.kt:272 */);
          79  +
                                /* JsonParserGenerator.kt:262 */
          80  +
                            }
          81  +
                            /* JsonParserGenerator.kt:290 */
          82  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
          83  +
                        }
          84  +
                        /* JsonParserGenerator.kt:686 */
          85  +
                    }
          86  +
                    /* JsonParserGenerator.kt:695 */
          87  +
                    other => {
          88  +
                        return Err(
          89  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          90  +
                                format!("expected object key or end object, found: {other:?}"),
          91  +
                            ),
          92  +
                        )
          93  +
                    } /* JsonParserGenerator.kt:685 */
          94  +
                }
          95  +
                /* JsonParserGenerator.kt:684 */
          96  +
            }
          97  +
            /* JsonParserGenerator.kt:540 */
          98  +
            Ok(Some(builder.build()))
          99  +
            /* JsonParserGenerator.kt:713 */
         100  +
        }
         101  +
        /* JsonParserGenerator.kt:722 */
         102  +
        _ => {
         103  +
            /* JsonParserGenerator.kt:723 */
         104  +
            Err(
         105  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         106  +
                    "expected start object or null",
         107  +
                ),
         108  +
            )
         109  +
            /* JsonParserGenerator.kt:722 */
         110  +
        } /* JsonParserGenerator.kt:712 */
         111  +
    }
         112  +
    /* JsonParserGenerator.kt:516 */
         113  +
}

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

@@ -0,1 +0,199 @@
           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_test_body_structure_http_request<B>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::TestBodyStructureInput,
           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::test_body_structure_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_test_body_structure::de_test_body_structure(
          39  +
                bytes.as_ref(),
          40  +
                input,
          41  +
            )?;
          42  +
            /* ServerHttpBoundProtocolGenerator.kt:825 */
          43  +
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
          45  +
        if let Some(value) =
          46  +
            crate::protocol_serde::shape_test_body_structure_input::de_test_id_header(&headers)?
          47  +
        {
          48  +
            input = input.set_test_id(Some(value))
          49  +
        }
          50  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
          51  +
        input.build()
          52  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
          53  +
    })
          54  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
          55  +
}
          56  +
          57  +
/* RustType.kt:534 */
          58  +
#[allow(clippy::unnecessary_wraps)]
          59  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
          60  +
pub fn ser_test_body_structure_http_response(
          61  +
    #[allow(unused_variables)] output: crate::output::TestBodyStructureOutput,
          62  +
) -> std::result::Result<
          63  +
    ::aws_smithy_legacy_http_server::response::Response,
          64  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          65  +
> {
          66  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
          67  +
    Ok({
          68  +
        /* RustType.kt:534 */
          69  +
        #[allow(unused_mut)]
          70  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          71  +
        let mut builder = ::http::Response::builder();
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:665 */
          73  +
        builder =
          74  +
            crate::protocol_serde::shape_test_body_structure::ser_test_body_structure_headers(
          75  +
                &output, builder,
          76  +
            )?;
          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:235 */crate::protocol_serde::shape_test_body_structure_output::ser_test_body_structure_output_output_output(&output)?
          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  +
/* JsonParserGenerator.kt:148 */
         107  +
pub(crate) fn de_test_body_structure(
         108  +
    value: &[u8],
         109  +
    mut builder: crate::input::test_body_structure_input::Builder,
         110  +
) -> ::std::result::Result<
         111  +
    crate::input::test_body_structure_input::Builder,
         112  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
         113  +
> {
         114  +
    /* JsonParserGenerator.kt:153 */
         115  +
    let mut tokens_owned =
         116  +
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
         117  +
            .peekable();
         118  +
    let tokens = &mut tokens_owned;
         119  +
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         120  +
    /* JsonParserGenerator.kt:684 */
         121  +
    loop {
         122  +
        /* JsonParserGenerator.kt:685 */
         123  +
        match tokens.next().transpose()? {
         124  +
            /* JsonParserGenerator.kt:686 */
         125  +
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
         126  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         127  +
                /* JsonParserGenerator.kt:260 */
         128  +
                match key.to_unescaped()?.as_ref() {
         129  +
                    /* JsonParserGenerator.kt:262 */
         130  +
                    "testConfig" => {
         131  +
                        /* JsonParserGenerator.kt:272 */
         132  +
                        builder = builder.set_test_config(
         133  +
                            /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_test_config::de_test_config(tokens)?
         134  +
                        /* JsonParserGenerator.kt:272 */);
         135  +
                        /* JsonParserGenerator.kt:262 */
         136  +
                    }
         137  +
                    /* JsonParserGenerator.kt:290 */
         138  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
         139  +
                }
         140  +
                /* JsonParserGenerator.kt:686 */
         141  +
            }
         142  +
            /* JsonParserGenerator.kt:695 */
         143  +
            other => {
         144  +
                return Err(
         145  +
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
         146  +
                        "expected object key or end object, found: {other:?}"
         147  +
                    )),
         148  +
                )
         149  +
            } /* JsonParserGenerator.kt:685 */
         150  +
        }
         151  +
        /* JsonParserGenerator.kt:684 */
         152  +
    }
         153  +
    /* JsonParserGenerator.kt:250 */
         154  +
    if tokens.next().is_some() {
         155  +
        /* JsonParserGenerator.kt:251 */
         156  +
        return Err(
         157  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         158  +
                "found more JSON tokens after completing parsing",
         159  +
            ),
         160  +
        );
         161  +
        /* JsonParserGenerator.kt:250 */
         162  +
    }
         163  +
    /* JsonParserGenerator.kt:163 */
         164  +
    Ok(builder)
         165  +
    /* JsonParserGenerator.kt:148 */
         166  +
}
         167  +
         168  +
/* HttpBindingGenerator.kt:565 */
         169  +
pub fn ser_test_body_structure_headers(
         170  +
    input: &crate::output::TestBodyStructureOutput,
         171  +
    mut builder: ::http::response::Builder,
         172  +
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
         173  +
{
         174  +
    /* HttpBindingGenerator.kt:615 */
         175  +
    if let ::std::option::Option::Some(inner_1) = &input.test_id {
         176  +
        /* HttpBindingGenerator.kt:727 */
         177  +
        let formatted_2 = inner_1.as_str();
         178  +
        /* HttpBindingGenerator.kt:728 */
         179  +
        if !formatted_2.is_empty() {
         180  +
            /* HttpBindingGenerator.kt:729 */
         181  +
            let header_value = formatted_2;
         182  +
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         183  +
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
         184  +
                    "test_id",
         185  +
                    format!(
         186  +
                        "`{}` cannot be used as a header value: {}",
         187  +
                        &header_value, err
         188  +
                    ),
         189  +
                )
         190  +
            })?;
         191  +
            builder = builder.header("x-amz-test-id", header_value);
         192  +
            /* HttpBindingGenerator.kt:728 */
         193  +
        }
         194  +
        /* HttpBindingGenerator.kt:615 */
         195  +
    }
         196  +
    /* HttpBindingGenerator.kt:578 */
         197  +
    Ok(builder)
         198  +
    /* HttpBindingGenerator.kt:565 */
         199  +
}

tmp-codegen-diff/codegen-server-test/rest_json-http0x/rust-server-codegen/src/protocol_serde/shape_test_body_structure_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_test_id_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("x-amz-test-id");
          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_test_body_structure_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_test_body_structure_output_output_output(
           4  +
    value: &crate::output::TestBodyStructureOutput,
           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_test_body_structure_output::ser_test_body_structure_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_test_body_structure_output_output(
          22  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          23  +
    input: &crate::output::TestBodyStructureOutput,
          24  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:382 */
          26  +
    if let Some(var_1) = &input.test_config {
          27  +
        /* JsonSerializerGenerator.kt:495 */
          28  +
        #[allow(unused_mut)]
          29  +
        /* JsonSerializerGenerator.kt:496 */
          30  +
        let mut object_2 = object.key("testConfig").start_object();
          31  +
        /* JsonSerializerGenerator.kt:375 */
          32  +
        crate::protocol_serde::shape_test_config::ser_test_config(&mut object_2, var_1)?;
          33  +
        /* JsonSerializerGenerator.kt:515 */
          34  +
        object_2.finish();
          35  +
        /* JsonSerializerGenerator.kt:382 */
          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_test_config.rs

@@ -0,1 +0,99 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:516 */
           3  +
pub(crate) fn de_test_config<'a, I>(
           4  +
    tokens: &mut ::std::iter::Peekable<I>,
           5  +
) -> ::std::result::Result<
           6  +
    Option<crate::model::TestConfig>,
           7  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
           8  +
>
           9  +
where
          10  +
    I: Iterator<
          11  +
        Item = Result<
          12  +
            ::aws_smithy_json::deserialize::Token<'a>,
          13  +
            ::aws_smithy_json::deserialize::error::DeserializeError,
          14  +
        >,
          15  +
    >,
          16  +
{
          17  +
    /* JsonParserGenerator.kt:712 */
          18  +
    match tokens.next().transpose()? {
          19  +
        /* JsonParserGenerator.kt:713 */
          20  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          21  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          22  +
            /* RustType.kt:534 */
          23  +
            #[allow(unused_mut)]
          24  +
            /* JsonParserGenerator.kt:526 */
          25  +
            let mut builder = crate::model::test_config::Builder::default();
          26  +
            /* JsonParserGenerator.kt:684 */
          27  +
            loop {
          28  +
                /* JsonParserGenerator.kt:685 */
          29  +
                match tokens.next().transpose()? {
          30  +
                    /* JsonParserGenerator.kt:686 */
          31  +
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          32  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          33  +
                        /* JsonParserGenerator.kt:260 */
          34  +
                        match key.to_unescaped()?.as_ref() {
          35  +
                            /* JsonParserGenerator.kt:262 */
          36  +
                            "timeout" => {
          37  +
                                /* JsonParserGenerator.kt:272 */
          38  +
                                builder = builder.set_timeout(
          39  +
                                    /* JsonParserGenerator.kt:365 */
          40  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
          41  +
                                        tokens.next(),
          42  +
                                    )?
          43  +
                                    .map(i32::try_from)
          44  +
                                    .transpose()?, /* JsonParserGenerator.kt:272 */
          45  +
                                );
          46  +
                                /* JsonParserGenerator.kt:262 */
          47  +
                            }
          48  +
                            /* JsonParserGenerator.kt:290 */
          49  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
          50  +
                        }
          51  +
                        /* JsonParserGenerator.kt:686 */
          52  +
                    }
          53  +
                    /* JsonParserGenerator.kt:695 */
          54  +
                    other => {
          55  +
                        return Err(
          56  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          57  +
                                format!("expected object key or end object, found: {other:?}"),
          58  +
                            ),
          59  +
                        )
          60  +
                    } /* JsonParserGenerator.kt:685 */
          61  +
                }
          62  +
                /* JsonParserGenerator.kt:684 */
          63  +
            }
          64  +
            /* JsonParserGenerator.kt:540 */
          65  +
            Ok(Some(builder.build()))
          66  +
            /* JsonParserGenerator.kt:713 */
          67  +
        }
          68  +
        /* JsonParserGenerator.kt:722 */
          69  +
        _ => {
          70  +
            /* JsonParserGenerator.kt:723 */
          71  +
            Err(
          72  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          73  +
                    "expected start object or null",
          74  +
                ),
          75  +
            )
          76  +
            /* JsonParserGenerator.kt:722 */
          77  +
        } /* JsonParserGenerator.kt:712 */
          78  +
    }
          79  +
    /* JsonParserGenerator.kt:516 */
          80  +
}
          81  +
          82  +
/* JsonSerializerGenerator.kt:358 */
          83  +
pub fn ser_test_config(
          84  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          85  +
    input: &crate::model::TestConfig,
          86  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          87  +
    /* JsonSerializerGenerator.kt:382 */
          88  +
    if let Some(var_1) = &input.timeout {
          89  +
        /* JsonSerializerGenerator.kt:432 */
          90  +
        object.key("timeout").number(
          91  +
            #[allow(clippy::useless_conversion)]
          92  +
            ::aws_smithy_types::Number::NegInt((*var_1).into()),
          93  +
        );
          94  +
        /* JsonSerializerGenerator.kt:382 */
          95  +
    }
          96  +
    /* JsonSerializerGenerator.kt:372 */
          97  +
    Ok(())
          98  +
    /* JsonSerializerGenerator.kt:358 */
          99  +
}

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

@@ -0,1 +0,117 @@
           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_test_get_no_input_no_payload_http_request<B>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::TestGetNoInputNoPayloadInput,
           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::test_get_no_input_no_payload_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:873 */
          30  +
        ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
          31  +
            &headers, None,
          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_test_get_no_input_no_payload_http_response(
          44  +
    #[allow(unused_variables)] output: crate::output::TestGetNoInputNoPayloadOutput,
          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:665 */
          56  +
        builder = crate::protocol_serde::shape_test_get_no_input_no_payload::ser_test_get_no_input_no_payload_headers(&output, builder)?;
          57  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
          58  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          59  +
            builder,
          60  +
            ::http::header::CONTENT_TYPE,
          61  +
            "application/json",
          62  +
        );
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
          64  +
        let http_status: u16 = 200;
          65  +
        builder = builder.status(http_status);
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          67  +
        let payload =
          68  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_test_get_no_input_no_payload_output::ser_test_get_no_input_no_payload_output_output_output(&output)?
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          70  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
          71  +
        let content_length = payload.len();
          72  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          73  +
            builder,
          74  +
            ::http::header::CONTENT_LENGTH,
          75  +
            content_length,
          76  +
        );
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
          78  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
          80  +
        builder.body(body)?
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
          82  +
    })
          83  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
          84  +
}
          85  +
          86  +
/* HttpBindingGenerator.kt:565 */
          87  +
pub fn ser_test_get_no_input_no_payload_headers(
          88  +
    input: &crate::output::TestGetNoInputNoPayloadOutput,
          89  +
    mut builder: ::http::response::Builder,
          90  +
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
          91  +
{
          92  +
    /* HttpBindingGenerator.kt:615 */
          93  +
    if let ::std::option::Option::Some(inner_1) = &input.test_id {
          94  +
        /* HttpBindingGenerator.kt:727 */
          95  +
        let formatted_2 = inner_1.as_str();
          96  +
        /* HttpBindingGenerator.kt:728 */
          97  +
        if !formatted_2.is_empty() {
          98  +
            /* HttpBindingGenerator.kt:729 */
          99  +
            let header_value = formatted_2;
         100  +
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         101  +
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
         102  +
                    "test_id",
         103  +
                    format!(
         104  +
                        "`{}` cannot be used as a header value: {}",
         105  +
                        &header_value, err
         106  +
                    ),
         107  +
                )
         108  +
            })?;
         109  +
            builder = builder.header("X-Amz-Test-Id", header_value);
         110  +
            /* HttpBindingGenerator.kt:728 */
         111  +
        }
         112  +
        /* HttpBindingGenerator.kt:615 */
         113  +
    }
         114  +
    /* HttpBindingGenerator.kt:578 */
         115  +
    Ok(builder)
         116  +
    /* HttpBindingGenerator.kt:565 */
         117  +
}

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

@@ -0,1 +0,25 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
           3  +
pub fn ser_test_get_no_input_no_payload_output_output_output(
           4  +
    value: &crate::output::TestGetNoInputNoPayloadOutput,
           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_test_get_no_input_no_payload_output::ser_test_get_no_input_no_payload_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_test_get_no_input_no_payload_output_output(
          19  +
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          20  +
    #[allow(unused_variables)] input: &crate::output::TestGetNoInputNoPayloadOutput,
          21  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* JsonSerializerGenerator.kt:372 */
          23  +
    Ok(())
          24  +
    /* JsonSerializerGenerator.kt:358 */
          25  +
}

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

@@ -0,1 +0,122 @@
           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_test_get_no_payload_http_request<B>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::TestGetNoPayloadInput,
           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::test_get_no_payload_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) =
          31  +
            crate::protocol_serde::shape_test_get_no_payload_input::de_test_id_header(&headers)?
          32  +
        {
          33  +
            input = input.set_test_id(Some(value))
          34  +
        }
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
          36  +
        input.build()
          37  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
          38  +
    })
          39  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
          40  +
}
          41  +
          42  +
/* RustType.kt:534 */
          43  +
#[allow(clippy::unnecessary_wraps)]
          44  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
          45  +
pub fn ser_test_get_no_payload_http_response(
          46  +
    #[allow(unused_variables)] output: crate::output::TestGetNoPayloadOutput,
          47  +
) -> std::result::Result<
          48  +
    ::aws_smithy_legacy_http_server::response::Response,
          49  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          50  +
> {
          51  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
          52  +
    Ok({
          53  +
        /* RustType.kt:534 */
          54  +
        #[allow(unused_mut)]
          55  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          56  +
        let mut builder = ::http::Response::builder();
          57  +
        /* ServerHttpBoundProtocolGenerator.kt:665 */
          58  +
        builder =
          59  +
            crate::protocol_serde::shape_test_get_no_payload::ser_test_get_no_payload_headers(
          60  +
                &output, builder,
          61  +
            )?;
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
          63  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          64  +
            builder,
          65  +
            ::http::header::CONTENT_TYPE,
          66  +
            "application/json",
          67  +
        );
          68  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
          69  +
        let http_status: u16 = 200;
          70  +
        builder = builder.status(http_status);
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          72  +
        let payload =
          73  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_test_get_no_payload_output::ser_test_get_no_payload_output_output_output(&output)?
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
          76  +
        let content_length = payload.len();
          77  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          78  +
            builder,
          79  +
            ::http::header::CONTENT_LENGTH,
          80  +
            content_length,
          81  +
        );
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
          83  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
          85  +
        builder.body(body)?
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
          87  +
    })
          88  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
          89  +
}
          90  +
          91  +
/* HttpBindingGenerator.kt:565 */
          92  +
pub fn ser_test_get_no_payload_headers(
          93  +
    input: &crate::output::TestGetNoPayloadOutput,
          94  +
    mut builder: ::http::response::Builder,
          95  +
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
          96  +
{
          97  +
    /* HttpBindingGenerator.kt:615 */
          98  +
    if let ::std::option::Option::Some(inner_1) = &input.test_id {
          99  +
        /* HttpBindingGenerator.kt:727 */
         100  +
        let formatted_2 = inner_1.as_str();
         101  +
        /* HttpBindingGenerator.kt:728 */
         102  +
        if !formatted_2.is_empty() {
         103  +
            /* HttpBindingGenerator.kt:729 */
         104  +
            let header_value = formatted_2;
         105  +
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         106  +
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
         107  +
                    "test_id",
         108  +
                    format!(
         109  +
                        "`{}` cannot be used as a header value: {}",
         110  +
                        &header_value, err
         111  +
                    ),
         112  +
                )
         113  +
            })?;
         114  +
            builder = builder.header("X-Amz-Test-Id", header_value);
         115  +
            /* HttpBindingGenerator.kt:728 */
         116  +
        }
         117  +
        /* HttpBindingGenerator.kt:615 */
         118  +
    }
         119  +
    /* HttpBindingGenerator.kt:578 */
         120  +
    Ok(builder)
         121  +
    /* HttpBindingGenerator.kt:565 */
         122  +
}

tmp-codegen-diff/codegen-server-test/rest_json-http0x/rust-server-codegen/src/protocol_serde/shape_test_get_no_payload_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_test_id_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("X-Amz-Test-Id");
          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_test_get_no_payload_output.rs

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

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

@@ -0,1 +0,123 @@
           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_test_payload_blob_http_request<B>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::TestPayloadBlobInput,
           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::test_payload_blob_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) =
          31  +
            crate::protocol_serde::shape_test_payload_blob_input::de_content_type_header(&headers)?
          32  +
        {
          33  +
            input = input.set_content_type(Some(value))
          34  +
        }
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
          36  +
        if let Some(value) = {
          37  +
            let bytes = ::hyper::body::to_bytes(body).await?;
          38  +
          39  +
            crate::protocol_serde::shape_test_payload_blob_input::de_data_payload(&bytes)?
          40  +
        } {
          41  +
            input = input.set_data(Some(value))
          42  +
        }
          43  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
          44  +
        input.build()
          45  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
          46  +
    })
          47  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
          48  +
}
          49  +
          50  +
/* RustType.kt:534 */
          51  +
#[allow(clippy::unnecessary_wraps)]
          52  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
          53  +
pub fn ser_test_payload_blob_http_response(
          54  +
    #[allow(unused_variables)] output: crate::output::TestPayloadBlobOutput,
          55  +
) -> std::result::Result<
          56  +
    ::aws_smithy_legacy_http_server::response::Response,
          57  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          58  +
> {
          59  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
          60  +
    Ok({
          61  +
        /* RustType.kt:534 */
          62  +
        #[allow(unused_mut)]
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          64  +
        let mut builder = ::http::Response::builder();
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:665 */
          66  +
        builder = crate::protocol_serde::shape_test_payload_blob::ser_test_payload_blob_headers(
          67  +
            &output, builder,
          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:348 */crate::protocol_serde::shape_test_payload_blob_output::ser_data_http_payload( output.data)?
          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  +
/* HttpBindingGenerator.kt:565 */
          93  +
pub fn ser_test_payload_blob_headers(
          94  +
    input: &crate::output::TestPayloadBlobOutput,
          95  +
    mut builder: ::http::response::Builder,
          96  +
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
          97  +
{
          98  +
    /* HttpBindingGenerator.kt:615 */
          99  +
    if let ::std::option::Option::Some(inner_1) = &input.content_type {
         100  +
        /* HttpBindingGenerator.kt:727 */
         101  +
        let formatted_2 = inner_1.as_str();
         102  +
        /* HttpBindingGenerator.kt:728 */
         103  +
        if !formatted_2.is_empty() {
         104  +
            /* HttpBindingGenerator.kt:729 */
         105  +
            let header_value = formatted_2;
         106  +
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         107  +
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
         108  +
                    "content_type",
         109  +
                    format!(
         110  +
                        "`{}` cannot be used as a header value: {}",
         111  +
                        &header_value, err
         112  +
                    ),
         113  +
                )
         114  +
            })?;
         115  +
            builder = builder.header("Content-Type", header_value);
         116  +
            /* HttpBindingGenerator.kt:728 */
         117  +
        }
         118  +
        /* HttpBindingGenerator.kt:615 */
         119  +
    }
         120  +
    /* HttpBindingGenerator.kt:578 */
         121  +
    Ok(builder)
         122  +
    /* HttpBindingGenerator.kt:565 */
         123  +
}

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

@@ -0,1 +0,32 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:159 */
           3  +
pub(crate) fn de_content_type_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-Type");
          11  +
    /* HttpBindingGenerator.kt:398 */
          12  +
    ::aws_smithy_legacy_http::header::one_or_none(headers)
          13  +
    /* HttpBindingGenerator.kt:159 */
          14  +
}
          15  +
          16  +
/* HttpBindingGenerator.kt:254 */
          17  +
pub(crate) fn de_data_payload(
          18  +
    body: &[u8],
          19  +
) -> std::result::Result<
          20  +
    ::std::option::Option<::aws_smithy_types::Blob>,
          21  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
          22  +
> {
          23  +
    /* HttpBindingGenerator.kt:342 */
          24  +
    (!body.is_empty())
          25  +
        .then(|| {
          26  +
            /* HttpBindingGenerator.kt:372 */
          27  +
            Ok(::aws_smithy_types::Blob::new(body))
          28  +
            /* HttpBindingGenerator.kt:342 */
          29  +
        })
          30  +
        .transpose()
          31  +
    /* HttpBindingGenerator.kt:254 */
          32  +
}