Server Test

Server Test

rev. ee474c7509d7728618c23068f3741e8e5b339ef9 (ignoring whitespace)

Files changed:

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

@@ -0,1 +0,155 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
           3  +
pub fn de_query_boolean(
           4  +
    value: &str,
           5  +
) -> std::result::Result<
           6  +
    ::std::option::Option<bool>,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
           8  +
> {
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1515 */
          10  +
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
          11  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
          12  +
    Ok(Some(value))
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
          14  +
}
          15  +
          16  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
          17  +
pub fn de_query_byte(
          18  +
    value: &str,
          19  +
) -> std::result::Result<
          20  +
    ::std::option::Option<i8>,
          21  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
          22  +
> {
          23  +
    /* ServerHttpBoundProtocolGenerator.kt:1515 */
          24  +
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
          25  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
          26  +
    Ok(Some(value))
          27  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
          28  +
}
          29  +
          30  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
          31  +
pub fn de_query_double(
          32  +
    value: &str,
          33  +
) -> std::result::Result<
          34  +
    ::std::option::Option<f64>,
          35  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
          36  +
> {
          37  +
    /* ServerHttpBoundProtocolGenerator.kt:1515 */
          38  +
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
          39  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
          40  +
    Ok(Some(value))
          41  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
          42  +
}
          43  +
          44  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
          45  +
pub fn de_query_enum(
          46  +
    value: &str,
          47  +
) -> std::result::Result<
          48  +
    ::std::option::Option<::std::string::String>,
          49  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
          50  +
> {
          51  +
    /* ServerHttpBoundProtocolGenerator.kt:1470 */
          52  +
    let value = value.to_owned();
          53  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
          54  +
    Ok(Some(value))
          55  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
          56  +
}
          57  +
          58  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
          59  +
pub fn de_query_float(
          60  +
    value: &str,
          61  +
) -> std::result::Result<
          62  +
    ::std::option::Option<f32>,
          63  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
          64  +
> {
          65  +
    /* ServerHttpBoundProtocolGenerator.kt:1515 */
          66  +
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
          67  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
          68  +
    Ok(Some(value))
          69  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
          70  +
}
          71  +
          72  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
          73  +
pub fn de_query_integer(
          74  +
    value: &str,
          75  +
) -> std::result::Result<
          76  +
    ::std::option::Option<i32>,
          77  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
          78  +
> {
          79  +
    /* ServerHttpBoundProtocolGenerator.kt:1515 */
          80  +
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
          81  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
          82  +
    Ok(Some(value))
          83  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
          84  +
}
          85  +
          86  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
          87  +
pub fn de_query_integer_enum(
          88  +
    value: &str,
          89  +
) -> std::result::Result<
          90  +
    ::std::option::Option<i32>,
          91  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
          92  +
> {
          93  +
    /* ServerHttpBoundProtocolGenerator.kt:1515 */
          94  +
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
          95  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
          96  +
    Ok(Some(value))
          97  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
          98  +
}
          99  +
         100  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
         101  +
pub fn de_query_long(
         102  +
    value: &str,
         103  +
) -> std::result::Result<
         104  +
    ::std::option::Option<i64>,
         105  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
         106  +
> {
         107  +
    /* ServerHttpBoundProtocolGenerator.kt:1515 */
         108  +
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
         109  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
         110  +
    Ok(Some(value))
         111  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
         112  +
}
         113  +
         114  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
         115  +
pub fn de_query_short(
         116  +
    value: &str,
         117  +
) -> std::result::Result<
         118  +
    ::std::option::Option<i16>,
         119  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
         120  +
> {
         121  +
    /* ServerHttpBoundProtocolGenerator.kt:1515 */
         122  +
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
         123  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
         124  +
    Ok(Some(value))
         125  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
         126  +
}
         127  +
         128  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
         129  +
pub fn de_query_string(
         130  +
    value: &str,
         131  +
) -> std::result::Result<
         132  +
    ::std::option::Option<::std::string::String>,
         133  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
         134  +
> {
         135  +
    /* ServerHttpBoundProtocolGenerator.kt:1470 */
         136  +
    let value = value.to_owned();
         137  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
         138  +
    Ok(Some(value))
         139  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
         140  +
}
         141  +
         142  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
         143  +
pub fn de_query_timestamp(
         144  +
    value: &str,
         145  +
) -> std::result::Result<
         146  +
    ::std::option::Option<::aws_smithy_types::DateTime>,
         147  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
         148  +
> {
         149  +
    /* ServerHttpBoundProtocolGenerator.kt:1495 */
         150  +
    let value = ::aws_smithy_types::DateTime::from_str(value, ::aws_smithy_types::date_time::Format::DateTime)?
         151  +
    /* ServerHttpBoundProtocolGenerator.kt:1510 */;
         152  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
         153  +
    Ok(Some(value))
         154  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
         155  +
}

tmp-codegen-diff/codegen-server-test/rest_json-http0x/rust-server-codegen/src/protocol_serde/shape_boolean_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_boolean_list<'a, I>(
           4  +
    tokens: &mut ::std::iter::Peekable<I>,
           5  +
) -> ::std::result::Result<
           6  +
    Option<::std::vec::Vec<bool>>,
           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:298 */::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?
          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_client_optional_defaults.rs

@@ -0,1 +0,79 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:516 */
           3  +
pub(crate) fn de_client_optional_defaults<'a, I>(
           4  +
    tokens: &mut ::std::iter::Peekable<I>,
           5  +
) -> ::std::result::Result<
           6  +
    Option<crate::model::ClientOptionalDefaults>,
           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::client_optional_defaults::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  +
                            "member" => {
          37  +
                                /* JsonParserGenerator.kt:276 */
          38  +
                                if let Some(v) =
          39  +
                                /* JsonParserGenerator.kt:365 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
          40  +
                                                    .map(i32::try_from)
          41  +
                                                    .transpose()?
          42  +
                                /* JsonParserGenerator.kt:278 */{
          43  +
                                                                            builder = builder.set_member(v);
          44  +
                                                                        }
          45  +
                                /* JsonParserGenerator.kt:262 */
          46  +
                            }
          47  +
                            /* JsonParserGenerator.kt:290 */
          48  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
          49  +
                        }
          50  +
                        /* JsonParserGenerator.kt:686 */
          51  +
                    }
          52  +
                    /* JsonParserGenerator.kt:695 */
          53  +
                    other => {
          54  +
                        return Err(
          55  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          56  +
                                format!("expected object key or end object, found: {other:?}"),
          57  +
                            ),
          58  +
                        )
          59  +
                    } /* JsonParserGenerator.kt:685 */
          60  +
                }
          61  +
                /* JsonParserGenerator.kt:684 */
          62  +
            }
          63  +
            /* JsonParserGenerator.kt:540 */
          64  +
            Ok(Some(builder.build()))
          65  +
            /* JsonParserGenerator.kt:713 */
          66  +
        }
          67  +
        /* JsonParserGenerator.kt:722 */
          68  +
        _ => {
          69  +
            /* JsonParserGenerator.kt:723 */
          70  +
            Err(
          71  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          72  +
                    "expected start object or null",
          73  +
                ),
          74  +
            )
          75  +
            /* JsonParserGenerator.kt:722 */
          76  +
        } /* JsonParserGenerator.kt:712 */
          77  +
    }
          78  +
    /* JsonParserGenerator.kt:516 */
          79  +
}

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

@@ -0,1 +0,79 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
           3  +
pub fn ser_complex_error_error(
           4  +
    value: &crate::error::ComplexError,
           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_complex_error::ser_complex_error(&mut object, value)?;
          11  +
    /* JsonSerializerGenerator.kt:227 */
          12  +
    object.finish();
          13  +
    Ok(out)
          14  +
    /* JsonSerializerGenerator.kt:213 */
          15  +
}
          16  +
          17  +
/* HttpBindingGenerator.kt:565 */
          18  +
pub fn ser_complex_error_headers(
          19  +
    input: &crate::error::ComplexError,
          20  +
    mut builder: ::http::response::Builder,
          21  +
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
          22  +
{
          23  +
    /* HttpBindingGenerator.kt:615 */
          24  +
    if let ::std::option::Option::Some(inner_1) = &input.header {
          25  +
        /* HttpBindingGenerator.kt:727 */
          26  +
        let formatted_2 = inner_1.as_str();
          27  +
        /* HttpBindingGenerator.kt:728 */
          28  +
        if !formatted_2.is_empty() {
          29  +
            /* HttpBindingGenerator.kt:729 */
          30  +
            let header_value = formatted_2;
          31  +
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
          32  +
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
          33  +
                    "header",
          34  +
                    format!(
          35  +
                        "`{}` cannot be used as a header value: {}",
          36  +
                        &header_value, err
          37  +
                    ),
          38  +
                )
          39  +
            })?;
          40  +
            builder = builder.header("X-Header", header_value);
          41  +
            /* HttpBindingGenerator.kt:728 */
          42  +
        }
          43  +
        /* HttpBindingGenerator.kt:615 */
          44  +
    }
          45  +
    /* HttpBindingGenerator.kt:578 */
          46  +
    Ok(builder)
          47  +
    /* HttpBindingGenerator.kt:565 */
          48  +
}
          49  +
          50  +
/* JsonSerializerGenerator.kt:358 */
          51  +
pub fn ser_complex_error(
          52  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          53  +
    input: &crate::error::ComplexError,
          54  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          55  +
    /* JsonSerializerGenerator.kt:382 */
          56  +
    if let Some(var_3) = &input.nested {
          57  +
        /* JsonSerializerGenerator.kt:495 */
          58  +
        #[allow(unused_mut)]
          59  +
        /* JsonSerializerGenerator.kt:496 */
          60  +
        let mut object_4 = object.key("Nested").start_object();
          61  +
        /* JsonSerializerGenerator.kt:375 */
          62  +
        crate::protocol_serde::shape_complex_nested_error_data::ser_complex_nested_error_data(
          63  +
            &mut object_4,
          64  +
            var_3,
          65  +
        )?;
          66  +
        /* JsonSerializerGenerator.kt:515 */
          67  +
        object_4.finish();
          68  +
        /* JsonSerializerGenerator.kt:382 */
          69  +
    }
          70  +
    /* JsonSerializerGenerator.kt:382 */
          71  +
    if let Some(var_5) = &input.top_level {
          72  +
        /* JsonSerializerGenerator.kt:423 */
          73  +
        object.key("TopLevel").string(var_5.as_str());
          74  +
        /* JsonSerializerGenerator.kt:382 */
          75  +
    }
          76  +
    /* JsonSerializerGenerator.kt:372 */
          77  +
    Ok(())
          78  +
    /* JsonSerializerGenerator.kt:358 */
          79  +
}

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

@@ -0,1 +0,16 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:358 */
           3  +
pub fn ser_complex_nested_error_data(
           4  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
           5  +
    input: &crate::model::ComplexNestedErrorData,
           6  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           7  +
    /* JsonSerializerGenerator.kt:382 */
           8  +
    if let Some(var_1) = &input.foo {
           9  +
        /* JsonSerializerGenerator.kt:423 */
          10  +
        object.key("Fooooo").string(var_1.as_str());
          11  +
        /* JsonSerializerGenerator.kt:382 */
          12  +
    }
          13  +
    /* JsonSerializerGenerator.kt:372 */
          14  +
    Ok(())
          15  +
    /* JsonSerializerGenerator.kt:358 */
          16  +
}

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

@@ -0,1 +0,105 @@
           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_constant_and_variable_query_string_http_request<B>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::ConstantAndVariableQueryStringInput,
           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::constant_and_variable_query_string_input::Builder::default();
          23  +
        /* RustType.kt:534 */
          24  +
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
          26  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          27  +
            uri, headers, body, ..
          28  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:1221 */
          30  +
        let query_string = uri.query().unwrap_or("");
          31  +
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:1247 */
          33  +
        let mut baz_seen = false;
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:1247 */
          35  +
        let mut maybe_set_seen = false;
          36  +
        /* ServerHttpBoundProtocolGenerator.kt:1253 */
          37  +
        for (k, v) in pairs {
          38  +
            /* ServerHttpBoundProtocolGenerator.kt:1257 */
          39  +
            if !baz_seen && k == "baz" {
          40  +
                input = input.set_baz(
          41  +
                    crate::protocol_serde::shape_constant_and_variable_query_string_input::de_baz(
          42  +
                        &v,
          43  +
                    )?,
          44  +
                );
          45  +
                baz_seen = true;
          46  +
            }
          47  +
            /* ServerHttpBoundProtocolGenerator.kt:1257 */
          48  +
            if !maybe_set_seen && k == "maybeSet" {
          49  +
                input = input.set_maybe_set(
          50  +
                    crate::protocol_serde::shape_constant_and_variable_query_string_input::de_maybe_set(&v)?
          51  +
                );
          52  +
                maybe_set_seen = true;
          53  +
            }
          54  +
            /* ServerHttpBoundProtocolGenerator.kt:1253 */
          55  +
        }
          56  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
          57  +
        input.build()
          58  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
          59  +
    })
          60  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
          61  +
}
          62  +
          63  +
/* RustType.kt:534 */
          64  +
#[allow(clippy::unnecessary_wraps)]
          65  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
          66  +
pub fn ser_constant_and_variable_query_string_http_response(
          67  +
    #[allow(unused_variables)] output: crate::output::ConstantAndVariableQueryStringOutput,
          68  +
) -> std::result::Result<
          69  +
    ::aws_smithy_legacy_http_server::response::Response,
          70  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          71  +
> {
          72  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
          73  +
    Ok({
          74  +
        /* RustType.kt:534 */
          75  +
        #[allow(unused_mut)]
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          77  +
        let mut builder = ::http::Response::builder();
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
          79  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          80  +
            builder,
          81  +
            ::http::header::CONTENT_TYPE,
          82  +
            "application/json",
          83  +
        );
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
          85  +
        let http_status: u16 = 200;
          86  +
        builder = builder.status(http_status);
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          88  +
        let payload =
          89  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
          92  +
        let content_length = payload.len();
          93  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          94  +
            builder,
          95  +
            ::http::header::CONTENT_LENGTH,
          96  +
            content_length,
          97  +
        );
          98  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
          99  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
         100  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
         101  +
        builder.body(body)?
         102  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
         103  +
    })
         104  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
         105  +
}

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

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

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

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

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

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

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

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

tmp-codegen-diff/codegen-server-test/rest_json-http0x/rust-server-codegen/src/protocol_serde/shape_content_type_parameters_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_content_type_parameters_output_output_output(
           4  +
    value: &crate::output::ContentTypeParametersOutput,
           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_content_type_parameters_output::ser_content_type_parameters_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_content_type_parameters_output_output(
          19  +
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          20  +
    #[allow(unused_variables)] input: &crate::output::ContentTypeParametersOutput,
          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_datetime_offsets.rs

@@ -0,1 +0,82 @@
           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_datetime_offsets_http_request<B>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::DatetimeOffsetsInput,
           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::datetime_offsets_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_datetime_offsets_http_response(
          44  +
    #[allow(unused_variables)] output: crate::output::DatetimeOffsetsOutput,
          45  +
) -> std::result::Result<
          46  +
    ::aws_smithy_legacy_http_server::response::Response,
          47  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          48  +
> {
          49  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
          50  +
    Ok({
          51  +
        /* RustType.kt:534 */
          52  +
        #[allow(unused_mut)]
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          54  +
        let mut builder = ::http::Response::builder();
          55  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
          56  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          57  +
            builder,
          58  +
            ::http::header::CONTENT_TYPE,
          59  +
            "application/json",
          60  +
        );
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
          62  +
        let http_status: u16 = 200;
          63  +
        builder = builder.status(http_status);
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          65  +
        let payload =
          66  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_datetime_offsets_output::ser_datetime_offsets_output_output_output(&output)?
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          68  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
          69  +
        let content_length = payload.len();
          70  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          71  +
            builder,
          72  +
            ::http::header::CONTENT_LENGTH,
          73  +
            content_length,
          74  +
        );
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
          76  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
          78  +
        builder.body(body)?
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
          80  +
    })
          81  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
          82  +
}

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

@@ -0,1 +0,36 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
           3  +
pub fn ser_datetime_offsets_output_output_output(
           4  +
    value: &crate::output::DatetimeOffsetsOutput,
           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_datetime_offsets_output::ser_datetime_offsets_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_datetime_offsets_output_output(
          22  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          23  +
    input: &crate::output::DatetimeOffsetsOutput,
          24  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:382 */
          26  +
    if let Some(var_1) = &input.datetime {
          27  +
        /* JsonSerializerGenerator.kt:448 */
          28  +
        object
          29  +
            .key("datetime")
          30  +
            .date_time(var_1, ::aws_smithy_types::date_time::Format::DateTime)?;
          31  +
        /* JsonSerializerGenerator.kt:382 */
          32  +
    }
          33  +
    /* JsonSerializerGenerator.kt:372 */
          34  +
    Ok(())
          35  +
    /* JsonSerializerGenerator.kt:358 */
          36  +
}