Server Test

Server Test

rev. 3c756f73b1f83a0eed4275d9d1e22df0b10b66fb

Files changed:

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

@@ -0,1 +0,74 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:460 */
           3  +
pub(crate) fn de_sparse_set_map<'a, I>(
           4  +
    tokens: &mut ::std::iter::Peekable<I>,
           5  +
) -> ::std::result::Result<
           6  +
    Option<crate::unconstrained::sparse_set_map_unconstrained::SparseSetMapUnconstrained>,
           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  +
            /* JsonParserGenerator.kt:469 */
          23  +
            let mut map = ::std::collections::HashMap::new();
          24  +
            /* JsonParserGenerator.kt:684 */
          25  +
            loop {
          26  +
                /* JsonParserGenerator.kt:685 */
          27  +
                match tokens.next().transpose()? {
          28  +
                    /* JsonParserGenerator.kt:686 */
          29  +
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          30  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          31  +
                        /* JsonParserGenerator.kt:471 */
          32  +
                        let key =
          33  +
                            /* JsonParserGenerator.kt:339 */key.to_unescaped().map(|u|
          34  +
                                /* JsonParserGenerator.kt:348 */u.into_owned()
          35  +
                            /* JsonParserGenerator.kt:339 */)
          36  +
                        /* JsonParserGenerator.kt:471 */?;
          37  +
                        /* JsonParserGenerator.kt:474 */
          38  +
                        let value =
          39  +
                            /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_string_set::de_string_set(tokens)?
          40  +
                        /* JsonParserGenerator.kt:474 */;
          41  +
                        /* JsonParserGenerator.kt:478 */
          42  +
                        map.insert(key, value);
          43  +
                        /* JsonParserGenerator.kt:686 */
          44  +
                    }
          45  +
                    /* JsonParserGenerator.kt:695 */
          46  +
                    other => {
          47  +
                        return Err(
          48  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          49  +
                                format!("expected object key or end object, found: {other:?}"),
          50  +
                            ),
          51  +
                        )
          52  +
                    } /* JsonParserGenerator.kt:685 */
          53  +
                }
          54  +
                /* JsonParserGenerator.kt:684 */
          55  +
            }
          56  +
            /* JsonParserGenerator.kt:502 */
          57  +
            Ok(Some(
          58  +
                crate::unconstrained::sparse_set_map_unconstrained::SparseSetMapUnconstrained(map),
          59  +
            ))
          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 object or null",
          68  +
                ),
          69  +
            )
          70  +
            /* JsonParserGenerator.kt:722 */
          71  +
        } /* JsonParserGenerator.kt:712 */
          72  +
    }
          73  +
    /* JsonParserGenerator.kt:460 */
          74  +
}

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

@@ -0,1 +0,67 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:398 */
           3  +
pub(crate) fn de_sparse_short_list<'a, I>(
           4  +
    tokens: &mut ::std::iter::Peekable<I>,
           5  +
) -> ::std::result::Result<
           6  +
    Option<::std::vec::Vec<::std::option::Option<i16>>>,
           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:415 */
          38  +
                        items.push(
          39  +
                            /* JsonParserGenerator.kt:365 */
          40  +
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
          41  +
                                tokens.next(),
          42  +
                            )?
          43  +
                            .map(i16::try_from)
          44  +
                            .transpose()?, /* JsonParserGenerator.kt:415 */
          45  +
                        );
          46  +
                        /* JsonParserGenerator.kt:413 */
          47  +
                    } /* JsonParserGenerator.kt:409 */
          48  +
                }
          49  +
                /* JsonParserGenerator.kt:408 */
          50  +
            }
          51  +
            /* JsonParserGenerator.kt:446 */
          52  +
            Ok(Some(items))
          53  +
            /* JsonParserGenerator.kt:713 */
          54  +
        }
          55  +
        /* JsonParserGenerator.kt:722 */
          56  +
        _ => {
          57  +
            /* JsonParserGenerator.kt:723 */
          58  +
            Err(
          59  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          60  +
                    "expected start array or null",
          61  +
                ),
          62  +
            )
          63  +
            /* JsonParserGenerator.kt:722 */
          64  +
        } /* JsonParserGenerator.kt:712 */
          65  +
    }
          66  +
    /* JsonParserGenerator.kt:398 */
          67  +
}

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

@@ -0,1 +0,70 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:398 */
           3  +
pub(crate) fn de_sparse_string_list<'a, I>(
           4  +
    tokens: &mut ::std::iter::Peekable<I>,
           5  +
) -> ::std::result::Result<
           6  +
    Option<::std::vec::Vec<::std::option::Option<::std::string::String>>>,
           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:415 */
          38  +
                        items.push(
          39  +
                            /* JsonParserGenerator.kt:354 */
          40  +
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
          41  +
                                tokens.next(),
          42  +
                            )?
          43  +
                            .map(|s|
          44  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          45  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
          46  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
          47  +
                            .transpose()?, /* JsonParserGenerator.kt:415 */
          48  +
                        );
          49  +
                        /* JsonParserGenerator.kt:413 */
          50  +
                    } /* JsonParserGenerator.kt:409 */
          51  +
                }
          52  +
                /* JsonParserGenerator.kt:408 */
          53  +
            }
          54  +
            /* JsonParserGenerator.kt:446 */
          55  +
            Ok(Some(items))
          56  +
            /* JsonParserGenerator.kt:713 */
          57  +
        }
          58  +
        /* JsonParserGenerator.kt:722 */
          59  +
        _ => {
          60  +
            /* JsonParserGenerator.kt:723 */
          61  +
            Err(
          62  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          63  +
                    "expected start array or null",
          64  +
                ),
          65  +
            )
          66  +
            /* JsonParserGenerator.kt:722 */
          67  +
        } /* JsonParserGenerator.kt:712 */
          68  +
    }
          69  +
    /* JsonParserGenerator.kt:398 */
          70  +
}

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

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

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

@@ -0,1 +0,77 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:460 */
           3  +
pub(crate) fn de_sparse_struct_map<'a, I>(
           4  +
    tokens: &mut ::std::iter::Peekable<I>,
           5  +
) -> ::std::result::Result<
           6  +
    Option<
           7  +
        ::std::collections::HashMap<
           8  +
            ::std::string::String,
           9  +
            ::std::option::Option<crate::model::GreetingStruct>,
          10  +
        >,
          11  +
    >,
          12  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
          13  +
>
          14  +
where
          15  +
    I: Iterator<
          16  +
        Item = Result<
          17  +
            ::aws_smithy_json::deserialize::Token<'a>,
          18  +
            ::aws_smithy_json::deserialize::error::DeserializeError,
          19  +
        >,
          20  +
    >,
          21  +
{
          22  +
    /* JsonParserGenerator.kt:712 */
          23  +
    match tokens.next().transpose()? {
          24  +
        /* JsonParserGenerator.kt:713 */
          25  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          26  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          27  +
            /* JsonParserGenerator.kt:469 */
          28  +
            let mut map = ::std::collections::HashMap::new();
          29  +
            /* JsonParserGenerator.kt:684 */
          30  +
            loop {
          31  +
                /* JsonParserGenerator.kt:685 */
          32  +
                match tokens.next().transpose()? {
          33  +
                    /* JsonParserGenerator.kt:686 */
          34  +
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          35  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          36  +
                        /* JsonParserGenerator.kt:471 */
          37  +
                        let key =
          38  +
                            /* JsonParserGenerator.kt:339 */key.to_unescaped().map(|u|
          39  +
                                /* JsonParserGenerator.kt:348 */u.into_owned()
          40  +
                            /* JsonParserGenerator.kt:339 */)
          41  +
                        /* JsonParserGenerator.kt:471 */?;
          42  +
                        /* JsonParserGenerator.kt:474 */
          43  +
                        let value =
          44  +
                            /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_greeting_struct::de_greeting_struct(tokens)?
          45  +
                        /* JsonParserGenerator.kt:474 */;
          46  +
                        /* JsonParserGenerator.kt:478 */
          47  +
                        map.insert(key, value);
          48  +
                        /* JsonParserGenerator.kt:686 */
          49  +
                    }
          50  +
                    /* JsonParserGenerator.kt:695 */
          51  +
                    other => {
          52  +
                        return Err(
          53  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          54  +
                                format!("expected object key or end object, found: {other:?}"),
          55  +
                            ),
          56  +
                        )
          57  +
                    } /* JsonParserGenerator.kt:685 */
          58  +
                }
          59  +
                /* JsonParserGenerator.kt:684 */
          60  +
            }
          61  +
            /* JsonParserGenerator.kt:504 */
          62  +
            Ok(Some(map))
          63  +
            /* JsonParserGenerator.kt:713 */
          64  +
        }
          65  +
        /* JsonParserGenerator.kt:722 */
          66  +
        _ => {
          67  +
            /* JsonParserGenerator.kt:723 */
          68  +
            Err(
          69  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          70  +
                    "expected start object or null",
          71  +
                ),
          72  +
            )
          73  +
            /* JsonParserGenerator.kt:722 */
          74  +
        } /* JsonParserGenerator.kt:712 */
          75  +
    }
          76  +
    /* JsonParserGenerator.kt:460 */
          77  +
}

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

@@ -0,1 +0,125 @@
           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_streaming_traits_http_request<B>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::StreamingTraitsInput,
           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: Into<::aws_smithy_types::byte_stream::ByteStream>,
          14  +
    B::Data: Send,
          15  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          16  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          17  +
{
          18  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
          19  +
    Ok({
          20  +
        /* RustType.kt:534 */
          21  +
        #[allow(unused_mut)]
          22  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
          23  +
        let mut input = crate::input::streaming_traits_input::Builder::default();
          24  +
        /* RustType.kt:534 */
          25  +
        #[allow(unused_variables)]
          26  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
          27  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          28  +
            uri, headers, body, ..
          29  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          30  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
          31  +
        if let Some(value) = {
          32  +
            Some(
          33  +
                crate::protocol_serde::shape_streaming_traits_input::de_blob_payload(
          34  +
                    &mut body.into().into_inner(),
          35  +
                )?,
          36  +
            )
          37  +
        } {
          38  +
            input = input.set_blob(value)
          39  +
        }
          40  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
          41  +
        if let Some(value) =
          42  +
            crate::protocol_serde::shape_streaming_traits_input::de_foo_header(&headers)?
          43  +
        {
          44  +
            input = input.set_foo(Some(value))
          45  +
        }
          46  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
          47  +
        input.build()
          48  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
          49  +
    })
          50  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
          51  +
}
          52  +
          53  +
/* RustType.kt:534 */
          54  +
#[allow(clippy::unnecessary_wraps)]
          55  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
          56  +
pub fn ser_streaming_traits_http_response(
          57  +
    #[allow(unused_variables)] output: crate::output::StreamingTraitsOutput,
          58  +
) -> std::result::Result<
          59  +
    ::aws_smithy_legacy_http_server::response::Response,
          60  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          61  +
> {
          62  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
          63  +
    Ok({
          64  +
        /* RustType.kt:534 */
          65  +
        #[allow(unused_mut)]
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          67  +
        let mut builder = ::http::Response::builder();
          68  +
        /* ServerHttpBoundProtocolGenerator.kt:665 */
          69  +
        builder = crate::protocol_serde::shape_streaming_traits::ser_streaming_traits_headers(
          70  +
            &output, builder,
          71  +
        )?;
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
          73  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          74  +
            builder,
          75  +
            ::http::header::CONTENT_TYPE,
          76  +
            "application/octet-stream",
          77  +
        );
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
          79  +
        let http_status: u16 = 200;
          80  +
        builder = builder.status(http_status);
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
          82  +
        let body = ::aws_smithy_legacy_http_server::body::boxed(::aws_smithy_legacy_http_server::body::Body::wrap_stream(
          83  +
            /* ServerProtocolLoader.kt:42 */::aws_smithy_legacy_http::futures_stream_adapter::FuturesStreamCompatByteStream::new(
          84  +
                /* HttpBoundProtocolPayloadGenerator.kt:348 */crate::protocol_serde::shape_streaming_traits_output::ser_blob_http_payload( output.blob)?
          85  +
            /* ServerProtocolLoader.kt:42 */)
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */));
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
          88  +
        builder.body(body)?
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
          90  +
    })
          91  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
          92  +
}
          93  +
          94  +
/* HttpBindingGenerator.kt:565 */
          95  +
pub fn ser_streaming_traits_headers(
          96  +
    input: &crate::output::StreamingTraitsOutput,
          97  +
    mut builder: ::http::response::Builder,
          98  +
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
          99  +
{
         100  +
    /* HttpBindingGenerator.kt:615 */
         101  +
    if let ::std::option::Option::Some(inner_1) = &input.foo {
         102  +
        /* HttpBindingGenerator.kt:727 */
         103  +
        let formatted_2 = inner_1.as_str();
         104  +
        /* HttpBindingGenerator.kt:728 */
         105  +
        if !formatted_2.is_empty() {
         106  +
            /* HttpBindingGenerator.kt:729 */
         107  +
            let header_value = formatted_2;
         108  +
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         109  +
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
         110  +
                    "foo",
         111  +
                    format!(
         112  +
                        "`{}` cannot be used as a header value: {}",
         113  +
                        &header_value, err
         114  +
                    ),
         115  +
                )
         116  +
            })?;
         117  +
            builder = builder.header("X-Foo", header_value);
         118  +
            /* HttpBindingGenerator.kt:728 */
         119  +
        }
         120  +
        /* HttpBindingGenerator.kt:615 */
         121  +
    }
         122  +
    /* HttpBindingGenerator.kt:578 */
         123  +
    Ok(builder)
         124  +
    /* HttpBindingGenerator.kt:565 */
         125  +
}

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

@@ -0,1 +0,27 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:236 */
           3  +
pub fn de_blob_payload(
           4  +
    body: &mut ::aws_smithy_types::body::SdkBody,
           5  +
) -> std::result::Result<
           6  +
    ::aws_smithy_types::byte_stream::ByteStream,
           7  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
           8  +
> {
           9  +
    /* HttpBindingGenerator.kt:322 */// replace the body with an empty body
          10  +
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
          11  +
    Ok(::aws_smithy_types::byte_stream::ByteStream::new(body))
          12  +
    /* HttpBindingGenerator.kt:236 */
          13  +
}
          14  +
          15  +
/* HttpBindingGenerator.kt:159 */
          16  +
pub(crate) fn de_foo_header(
          17  +
    header_map: &::aws_smithy_runtime_api::http::Headers,
          18  +
) -> ::std::result::Result<
          19  +
    ::std::option::Option<::std::string::String>,
          20  +
    ::aws_smithy_legacy_http::header::ParseError,
          21  +
> {
          22  +
    /* HttpBindingGenerator.kt:166 */
          23  +
    let headers = header_map.get_all("X-Foo");
          24  +
    /* HttpBindingGenerator.kt:398 */
          25  +
    ::aws_smithy_legacy_http::header::one_or_none(headers)
          26  +
    /* HttpBindingGenerator.kt:159 */
          27  +
}

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

@@ -0,1 +0,15 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBoundProtocolPayloadGenerator.kt:309 */
           3  +
pub fn ser_blob_http_payload(
           4  +
    payload: ::aws_smithy_types::byte_stream::ByteStream,
           5  +
) -> ::std::result::Result<
           6  +
    ::aws_smithy_types::byte_stream::ByteStream,
           7  +
    ::aws_smithy_types::error::operation::BuildError,
           8  +
> {
           9  +
    /* HttpBoundProtocolPayloadGenerator.kt:343 */
          10  +
    Ok(
          11  +
        /* HttpBoundProtocolPayloadGenerator.kt:372 */
          12  +
        payload, /* HttpBoundProtocolPayloadGenerator.kt:343 */
          13  +
    )
          14  +
    /* HttpBoundProtocolPayloadGenerator.kt:309 */
          15  +
}

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

@@ -0,1 +0,93 @@
           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_streaming_traits_require_length_http_request<B>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::StreamingTraitsRequireLengthInput,
           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: Into<::aws_smithy_types::byte_stream::ByteStream>,
          14  +
    B::Data: Send,
          15  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          16  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          17  +
{
          18  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
          19  +
    Ok({
          20  +
        /* RustType.kt:534 */
          21  +
        #[allow(unused_mut)]
          22  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
          23  +
        let mut input = crate::input::streaming_traits_require_length_input::Builder::default();
          24  +
        /* RustType.kt:534 */
          25  +
        #[allow(unused_variables)]
          26  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
          27  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          28  +
            uri, headers, body, ..
          29  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          30  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
          31  +
        if let Some(value) = {
          32  +
            Some(crate::protocol_serde::shape_streaming_traits_require_length_input::de_blob_payload(&mut body.into().into_inner())?)
          33  +
        } {
          34  +
            input = input.set_blob(value)
          35  +
        }
          36  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
          37  +
        if let Some(value) =
          38  +
            crate::protocol_serde::shape_streaming_traits_require_length_input::de_foo_header(
          39  +
                &headers,
          40  +
            )?
          41  +
        {
          42  +
            input = input.set_foo(Some(value))
          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_streaming_traits_require_length_http_response(
          55  +
    #[allow(unused_variables)] output: crate::output::StreamingTraitsRequireLengthOutput,
          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:233 */""
          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  +
}

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

@@ -0,1 +0,27 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:236 */
           3  +
pub fn de_blob_payload(
           4  +
    body: &mut ::aws_smithy_types::body::SdkBody,
           5  +
) -> std::result::Result<
           6  +
    ::aws_smithy_types::byte_stream::ByteStream,
           7  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
           8  +
> {
           9  +
    /* HttpBindingGenerator.kt:322 */// replace the body with an empty body
          10  +
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
          11  +
    Ok(::aws_smithy_types::byte_stream::ByteStream::new(body))
          12  +
    /* HttpBindingGenerator.kt:236 */
          13  +
}
          14  +
          15  +
/* HttpBindingGenerator.kt:159 */
          16  +
pub(crate) fn de_foo_header(
          17  +
    header_map: &::aws_smithy_runtime_api::http::Headers,
          18  +
) -> ::std::result::Result<
          19  +
    ::std::option::Option<::std::string::String>,
          20  +
    ::aws_smithy_legacy_http::header::ParseError,
          21  +
> {
          22  +
    /* HttpBindingGenerator.kt:166 */
          23  +
    let headers = header_map.get_all("X-Foo");
          24  +
    /* HttpBindingGenerator.kt:398 */
          25  +
    ::aws_smithy_legacy_http::header::one_or_none(headers)
          26  +
    /* HttpBindingGenerator.kt:159 */
          27  +
}

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

@@ -0,1 +0,121 @@
           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_streaming_traits_with_media_type_http_request<B>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::StreamingTraitsWithMediaTypeInput,
           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: Into<::aws_smithy_types::byte_stream::ByteStream>,
          14  +
    B::Data: Send,
          15  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          16  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          17  +
{
          18  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
          19  +
    Ok({
          20  +
        /* RustType.kt:534 */
          21  +
        #[allow(unused_mut)]
          22  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
          23  +
        let mut input = crate::input::streaming_traits_with_media_type_input::Builder::default();
          24  +
        /* RustType.kt:534 */
          25  +
        #[allow(unused_variables)]
          26  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
          27  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          28  +
            uri, headers, body, ..
          29  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          30  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
          31  +
        if let Some(value) = {
          32  +
            Some(crate::protocol_serde::shape_streaming_traits_with_media_type_input::de_blob_payload(&mut body.into().into_inner())?)
          33  +
        } {
          34  +
            input = input.set_blob(value)
          35  +
        }
          36  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
          37  +
        if let Some(value) =
          38  +
            crate::protocol_serde::shape_streaming_traits_with_media_type_input::de_foo_header(
          39  +
                &headers,
          40  +
            )?
          41  +
        {
          42  +
            input = input.set_foo(Some(value))
          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_streaming_traits_with_media_type_http_response(
          55  +
    #[allow(unused_variables)] output: crate::output::StreamingTraitsWithMediaTypeOutput,
          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:665 */
          67  +
        builder = crate::protocol_serde::shape_streaming_traits_with_media_type::ser_streaming_traits_with_media_type_headers(&output, builder)?;
          68  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
          69  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          70  +
            builder,
          71  +
            ::http::header::CONTENT_TYPE,
          72  +
            "text/plain",
          73  +
        );
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
          75  +
        let http_status: u16 = 200;
          76  +
        builder = builder.status(http_status);
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
          78  +
        let body = ::aws_smithy_legacy_http_server::body::boxed(::aws_smithy_legacy_http_server::body::Body::wrap_stream(
          79  +
            /* ServerProtocolLoader.kt:42 */::aws_smithy_legacy_http::futures_stream_adapter::FuturesStreamCompatByteStream::new(
          80  +
                /* HttpBoundProtocolPayloadGenerator.kt:348 */crate::protocol_serde::shape_streaming_traits_with_media_type_output::ser_blob_http_payload( output.blob)?
          81  +
            /* ServerProtocolLoader.kt:42 */)
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */));
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
          84  +
        builder.body(body)?
          85  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
          86  +
    })
          87  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
          88  +
}
          89  +
          90  +
/* HttpBindingGenerator.kt:565 */
          91  +
pub fn ser_streaming_traits_with_media_type_headers(
          92  +
    input: &crate::output::StreamingTraitsWithMediaTypeOutput,
          93  +
    mut builder: ::http::response::Builder,
          94  +
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
          95  +
{
          96  +
    /* HttpBindingGenerator.kt:615 */
          97  +
    if let ::std::option::Option::Some(inner_1) = &input.foo {
          98  +
        /* HttpBindingGenerator.kt:727 */
          99  +
        let formatted_2 = inner_1.as_str();
         100  +
        /* HttpBindingGenerator.kt:728 */
         101  +
        if !formatted_2.is_empty() {
         102  +
            /* HttpBindingGenerator.kt:729 */
         103  +
            let header_value = formatted_2;
         104  +
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         105  +
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
         106  +
                    "foo",
         107  +
                    format!(
         108  +
                        "`{}` cannot be used as a header value: {}",
         109  +
                        &header_value, err
         110  +
                    ),
         111  +
                )
         112  +
            })?;
         113  +
            builder = builder.header("X-Foo", header_value);
         114  +
            /* HttpBindingGenerator.kt:728 */
         115  +
        }
         116  +
        /* HttpBindingGenerator.kt:615 */
         117  +
    }
         118  +
    /* HttpBindingGenerator.kt:578 */
         119  +
    Ok(builder)
         120  +
    /* HttpBindingGenerator.kt:565 */
         121  +
}

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

@@ -0,1 +0,27 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:236 */
           3  +
pub fn de_blob_payload(
           4  +
    body: &mut ::aws_smithy_types::body::SdkBody,
           5  +
) -> std::result::Result<
           6  +
    ::aws_smithy_types::byte_stream::ByteStream,
           7  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
           8  +
> {
           9  +
    /* HttpBindingGenerator.kt:322 */// replace the body with an empty body
          10  +
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
          11  +
    Ok(::aws_smithy_types::byte_stream::ByteStream::new(body))
          12  +
    /* HttpBindingGenerator.kt:236 */
          13  +
}
          14  +
          15  +
/* HttpBindingGenerator.kt:159 */
          16  +
pub(crate) fn de_foo_header(
          17  +
    header_map: &::aws_smithy_runtime_api::http::Headers,
          18  +
) -> ::std::result::Result<
          19  +
    ::std::option::Option<::std::string::String>,
          20  +
    ::aws_smithy_legacy_http::header::ParseError,
          21  +
> {
          22  +
    /* HttpBindingGenerator.kt:166 */
          23  +
    let headers = header_map.get_all("X-Foo");
          24  +
    /* HttpBindingGenerator.kt:398 */
          25  +
    ::aws_smithy_legacy_http::header::one_or_none(headers)
          26  +
    /* HttpBindingGenerator.kt:159 */
          27  +
}

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

@@ -0,1 +0,15 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBoundProtocolPayloadGenerator.kt:309 */
           3  +
pub fn ser_blob_http_payload(
           4  +
    payload: ::aws_smithy_types::byte_stream::ByteStream,
           5  +
) -> ::std::result::Result<
           6  +
    ::aws_smithy_types::byte_stream::ByteStream,
           7  +
    ::aws_smithy_types::error::operation::BuildError,
           8  +
> {
           9  +
    /* HttpBoundProtocolPayloadGenerator.kt:343 */
          10  +
    Ok(
          11  +
        /* HttpBoundProtocolPayloadGenerator.kt:372 */
          12  +
        payload, /* HttpBoundProtocolPayloadGenerator.kt:343 */
          13  +
    )
          14  +
    /* HttpBoundProtocolPayloadGenerator.kt:309 */
          15  +
}

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

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

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

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

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

@@ -0,1 +0,80 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:398 */
           3  +
pub(crate) fn de_string_set<'a, I>(
           4  +
    tokens: &mut ::std::iter::Peekable<I>,
           5  +
) -> ::std::result::Result<
           6  +
    Option<crate::unconstrained::string_set_unconstrained::StringSetUnconstrained>,
           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:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          40  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          41  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
          42  +
                                /* JsonParserGenerator.kt:339 */)
          43  +
                            /* JsonParserGenerator.kt:354 */).transpose()?
          44  +
                        /* JsonParserGenerator.kt:419 */;
          45  +
                        /* JsonParserGenerator.kt:422 */
          46  +
                        if let Some(value) = value {
          47  +
                            items.push(value);
          48  +
                        }
          49  +
                        /* JsonParserGenerator.kt:430 */
          50  +
                        else {
          51  +
                            return Err(
          52  +
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          53  +
                                    "dense list cannot contain null values",
          54  +
                                ),
          55  +
                            );
          56  +
                        }
          57  +
                        /* JsonParserGenerator.kt:413 */
          58  +
                    } /* JsonParserGenerator.kt:409 */
          59  +
                }
          60  +
                /* JsonParserGenerator.kt:408 */
          61  +
            }
          62  +
            /* JsonParserGenerator.kt:444 */
          63  +
            Ok(Some(
          64  +
                crate::unconstrained::string_set_unconstrained::StringSetUnconstrained(items),
          65  +
            ))
          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 array or null",
          74  +
                ),
          75  +
            )
          76  +
            /* JsonParserGenerator.kt:722 */
          77  +
        } /* JsonParserGenerator.kt:712 */
          78  +
    }
          79  +
    /* JsonParserGenerator.kt:398 */
          80  +
}