Server Test

Server Test

rev. 03e6e47f15dfd569240d570d98975ebba692c405 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-server-test/json_rpc11-http0x/rust-server-codegen/src/protocol_serde/shape_foo_error.rs

@@ -0,1 +0,18 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_foo_error_error(
           3  +
    value: &crate::error::FooError,
           4  +
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           5  +
    let mut out = ::std::string::String::new();
           6  +
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           7  +
    crate::protocol_serde::shape_foo_error::ser_foo_error(&mut object, value)?;
           8  +
    object.key("__type").string("FooError");
           9  +
    object.finish();
          10  +
    Ok(out)
          11  +
}
          12  +
          13  +
pub fn ser_foo_error(
          14  +
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          15  +
    #[allow(unused_variables)] input: &crate::error::FooError,
          16  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          17  +
    Ok(())
          18  +
}

tmp-codegen-diff/codegen-server-test/json_rpc11-http0x/rust-server-codegen/src/protocol_serde/shape_fractional_seconds.rs

@@ -0,1 +0,55 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_fractional_seconds_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::FractionalSecondsInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection,
           8  +
>
           9  +
where
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          11  +
    B::Data: Send,
          12  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          14  +
{
          15  +
    Ok({
          16  +
        #[allow(unused_mut)]
          17  +
        let mut input = crate::input::fractional_seconds_input::Builder::default();
          18  +
        #[allow(unused_variables)]
          19  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          20  +
            uri, headers, body, ..
          21  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          22  +
        input.build()
          23  +
    })
          24  +
}
          25  +
          26  +
#[allow(clippy::unnecessary_wraps)]
          27  +
pub fn ser_fractional_seconds_http_response(
          28  +
    #[allow(unused_variables)] output: crate::output::FractionalSecondsOutput,
          29  +
) -> std::result::Result<
          30  +
    ::aws_smithy_legacy_http_server::response::Response,
          31  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::ResponseRejection,
          32  +
> {
          33  +
    Ok({
          34  +
        #[allow(unused_mut)]
          35  +
        let mut builder = ::http::Response::builder();
          36  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          37  +
            builder,
          38  +
            ::http::header::CONTENT_TYPE,
          39  +
            "application/x-amz-json-1.1",
          40  +
        );
          41  +
        let http_status: u16 = 200;
          42  +
        builder = builder.status(http_status);
          43  +
        let payload =
          44  +
            crate::protocol_serde::shape_fractional_seconds_output::ser_fractional_seconds_output_output_output(&output)?
          45  +
        ;
          46  +
        let content_length = payload.len();
          47  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          48  +
            builder,
          49  +
            ::http::header::CONTENT_LENGTH,
          50  +
            content_length,
          51  +
        );
          52  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          53  +
        builder.body(body)?
          54  +
    })
          55  +
}

tmp-codegen-diff/codegen-server-test/json_rpc11-http0x/rust-server-codegen/src/protocol_serde/shape_fractional_seconds_output.rs

@@ -0,1 +0,25 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_fractional_seconds_output_output_output(
           3  +
    value: &crate::output::FractionalSecondsOutput,
           4  +
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           5  +
    let mut out = ::std::string::String::new();
           6  +
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           7  +
    crate::protocol_serde::shape_fractional_seconds_output::ser_fractional_seconds_output_output(
           8  +
        &mut object,
           9  +
        value,
          10  +
    )?;
          11  +
    object.finish();
          12  +
    Ok(out)
          13  +
}
          14  +
          15  +
pub fn ser_fractional_seconds_output_output(
          16  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          17  +
    input: &crate::output::FractionalSecondsOutput,
          18  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          19  +
    if let Some(var_1) = &input.datetime {
          20  +
        object
          21  +
            .key("datetime")
          22  +
            .date_time(var_1, ::aws_smithy_types::date_time::Format::DateTime)?;
          23  +
    }
          24  +
    Ok(())
          25  +
}

tmp-codegen-diff/codegen-server-test/json_rpc11-http0x/rust-server-codegen/src/protocol_serde/shape_greeting_struct.rs

@@ -0,1 +0,65 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_greeting_struct<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<crate::model::GreetingStruct>,
           6  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
           7  +
>
           8  +
where
           9  +
    I: Iterator<
          10  +
        Item = Result<
          11  +
            ::aws_smithy_json::deserialize::Token<'a>,
          12  +
            ::aws_smithy_json::deserialize::error::DeserializeError,
          13  +
        >,
          14  +
    >,
          15  +
{
          16  +
    match tokens.next().transpose()? {
          17  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          18  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          19  +
            #[allow(unused_mut)]
          20  +
            let mut builder = crate::model::greeting_struct::Builder::default();
          21  +
            loop {
          22  +
                match tokens.next().transpose()? {
          23  +
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          24  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          25  +
                        match key.to_unescaped()?.as_ref() {
          26  +
                            "hi" => {
          27  +
                                builder = builder.set_hi(
          28  +
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
          29  +
                                        tokens.next(),
          30  +
                                    )?
          31  +
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
          32  +
                                    .transpose()?,
          33  +
                                );
          34  +
                            }
          35  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          36  +
                        }
          37  +
                    }
          38  +
                    other => {
          39  +
                        return Err(
          40  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          41  +
                                format!("expected object key or end object, found: {other:?}"),
          42  +
                            ),
          43  +
                        )
          44  +
                    }
          45  +
                }
          46  +
            }
          47  +
            Ok(Some(builder.build()))
          48  +
        }
          49  +
        _ => Err(
          50  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          51  +
                "expected start object or null",
          52  +
            ),
          53  +
        ),
          54  +
    }
          55  +
}
          56  +
          57  +
pub fn ser_greeting_struct(
          58  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          59  +
    input: &crate::model::GreetingStruct,
          60  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          61  +
    if let Some(var_1) = &input.hi {
          62  +
        object.key("hi").string(var_1.as_str());
          63  +
    }
          64  +
    Ok(())
          65  +
}

tmp-codegen-diff/codegen-server-test/json_rpc11-http0x/rust-server-codegen/src/protocol_serde/shape_greeting_with_errors.rs

@@ -0,1 +0,129 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_greeting_with_errors_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::GreetingWithErrorsInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection,
           8  +
>
           9  +
where
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          11  +
    B::Data: Send,
          12  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          14  +
{
          15  +
    Ok({
          16  +
        #[allow(unused_mut)]
          17  +
        let mut input = crate::input::greeting_with_errors_input::Builder::default();
          18  +
        #[allow(unused_variables)]
          19  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          20  +
            uri, headers, body, ..
          21  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          22  +
        input.build()
          23  +
    })
          24  +
}
          25  +
          26  +
#[allow(clippy::unnecessary_wraps)]
          27  +
pub fn ser_greeting_with_errors_http_response(
          28  +
    #[allow(unused_variables)] output: crate::output::GreetingWithErrorsOutput,
          29  +
) -> std::result::Result<
          30  +
    ::aws_smithy_legacy_http_server::response::Response,
          31  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::ResponseRejection,
          32  +
> {
          33  +
    Ok({
          34  +
        #[allow(unused_mut)]
          35  +
        let mut builder = ::http::Response::builder();
          36  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          37  +
            builder,
          38  +
            ::http::header::CONTENT_TYPE,
          39  +
            "application/x-amz-json-1.1",
          40  +
        );
          41  +
        let http_status: u16 = 200;
          42  +
        builder = builder.status(http_status);
          43  +
        let payload =
          44  +
            crate::protocol_serde::shape_greeting_with_errors_output::ser_greeting_with_errors_output_output_output(&output)?
          45  +
        ;
          46  +
        let content_length = payload.len();
          47  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          48  +
            builder,
          49  +
            ::http::header::CONTENT_LENGTH,
          50  +
            content_length,
          51  +
        );
          52  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          53  +
        builder.body(body)?
          54  +
    })
          55  +
}
          56  +
          57  +
#[allow(clippy::unnecessary_wraps)]
          58  +
pub fn ser_greeting_with_errors_http_error(
          59  +
    error: &crate::error::GreetingWithErrorsError,
          60  +
) -> std::result::Result<
          61  +
    ::aws_smithy_legacy_http_server::response::Response,
          62  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::ResponseRejection,
          63  +
> {
          64  +
    Ok({
          65  +
        match error {
          66  +
            crate::error::GreetingWithErrorsError::InvalidGreeting(output) => {
          67  +
                let payload =
          68  +
                    crate::protocol_serde::shape_invalid_greeting::ser_invalid_greeting_error(
          69  +
                        output,
          70  +
                    )?;
          71  +
                #[allow(unused_mut)]
          72  +
                let mut builder = ::http::Response::builder();
          73  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          74  +
                    builder,
          75  +
                    ::http::header::CONTENT_TYPE,
          76  +
                    "application/x-amz-json-1.1",
          77  +
                );
          78  +
                let content_length = payload.len();
          79  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          80  +
                    builder,
          81  +
                    ::http::header::CONTENT_LENGTH,
          82  +
                    content_length,
          83  +
                );
          84  +
                builder
          85  +
                    .status(400)
          86  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
          87  +
            }
          88  +
            crate::error::GreetingWithErrorsError::ComplexError(output) => {
          89  +
                let payload =
          90  +
                    crate::protocol_serde::shape_complex_error::ser_complex_error_error(output)?;
          91  +
                #[allow(unused_mut)]
          92  +
                let mut builder = ::http::Response::builder();
          93  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          94  +
                    builder,
          95  +
                    ::http::header::CONTENT_TYPE,
          96  +
                    "application/x-amz-json-1.1",
          97  +
                );
          98  +
                let content_length = payload.len();
          99  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         100  +
                    builder,
         101  +
                    ::http::header::CONTENT_LENGTH,
         102  +
                    content_length,
         103  +
                );
         104  +
                builder
         105  +
                    .status(400)
         106  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         107  +
            }
         108  +
            crate::error::GreetingWithErrorsError::FooError(output) => {
         109  +
                let payload = crate::protocol_serde::shape_foo_error::ser_foo_error_error(output)?;
         110  +
                #[allow(unused_mut)]
         111  +
                let mut builder = ::http::Response::builder();
         112  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         113  +
                    builder,
         114  +
                    ::http::header::CONTENT_TYPE,
         115  +
                    "application/x-amz-json-1.1",
         116  +
                );
         117  +
                let content_length = payload.len();
         118  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         119  +
                    builder,
         120  +
                    ::http::header::CONTENT_LENGTH,
         121  +
                    content_length,
         122  +
                );
         123  +
                builder
         124  +
                    .status(500)
         125  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         126  +
            }
         127  +
        }
         128  +
    })
         129  +
}

tmp-codegen-diff/codegen-server-test/json_rpc11-http0x/rust-server-codegen/src/protocol_serde/shape_greeting_with_errors_output.rs

@@ -0,1 +0,20 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_greeting_with_errors_output_output_output(
           3  +
    value: &crate::output::GreetingWithErrorsOutput,
           4  +
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           5  +
    let mut out = ::std::string::String::new();
           6  +
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           7  +
    crate::protocol_serde::shape_greeting_with_errors_output::ser_greeting_with_errors_output_output(&mut object, value)?;
           8  +
    object.finish();
           9  +
    Ok(out)
          10  +
}
          11  +
          12  +
pub fn ser_greeting_with_errors_output_output(
          13  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          14  +
    input: &crate::output::GreetingWithErrorsOutput,
          15  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          16  +
    if let Some(var_1) = &input.greeting {
          17  +
        object.key("greeting").string(var_1.as_str());
          18  +
    }
          19  +
    Ok(())
          20  +
}

tmp-codegen-diff/codegen-server-test/json_rpc11-http0x/rust-server-codegen/src/protocol_serde/shape_host_with_path_operation.rs

@@ -0,1 +0,53 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_host_with_path_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::HostWithPathOperationInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection,
           8  +
>
           9  +
where
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          11  +
    B::Data: Send,
          12  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          14  +
{
          15  +
    Ok({
          16  +
        #[allow(unused_mut)]
          17  +
        let mut input = crate::input::host_with_path_operation_input::Builder::default();
          18  +
        #[allow(unused_variables)]
          19  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          20  +
            uri, headers, body, ..
          21  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          22  +
        input.build()
          23  +
    })
          24  +
}
          25  +
          26  +
#[allow(clippy::unnecessary_wraps)]
          27  +
pub fn ser_host_with_path_operation_http_response(
          28  +
    #[allow(unused_variables)] output: crate::output::HostWithPathOperationOutput,
          29  +
) -> std::result::Result<
          30  +
    ::aws_smithy_legacy_http_server::response::Response,
          31  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::ResponseRejection,
          32  +
> {
          33  +
    Ok({
          34  +
        #[allow(unused_mut)]
          35  +
        let mut builder = ::http::Response::builder();
          36  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          37  +
            builder,
          38  +
            ::http::header::CONTENT_TYPE,
          39  +
            "application/x-amz-json-1.1",
          40  +
        );
          41  +
        let http_status: u16 = 200;
          42  +
        builder = builder.status(http_status);
          43  +
        let payload = "";
          44  +
        let content_length = payload.len();
          45  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          46  +
            builder,
          47  +
            ::http::header::CONTENT_LENGTH,
          48  +
            content_length,
          49  +
        );
          50  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          51  +
        builder.body(body)?
          52  +
    })
          53  +
}

tmp-codegen-diff/codegen-server-test/json_rpc11-http0x/rust-server-codegen/src/protocol_serde/shape_integer_enum_list.rs

@@ -0,1 +0,52 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_integer_enum_list<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<::std::vec::Vec<i32>>,
           6  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
           7  +
>
           8  +
where
           9  +
    I: Iterator<
          10  +
        Item = Result<
          11  +
            ::aws_smithy_json::deserialize::Token<'a>,
          12  +
            ::aws_smithy_json::deserialize::error::DeserializeError,
          13  +
        >,
          14  +
    >,
          15  +
{
          16  +
    match tokens.next().transpose()? {
          17  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          18  +
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
          19  +
            let mut items = Vec::new();
          20  +
            loop {
          21  +
                match tokens.peek() {
          22  +
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
          23  +
                        tokens.next().transpose().unwrap();
          24  +
                        break;
          25  +
                    }
          26  +
                    _ => {
          27  +
                        let value = ::aws_smithy_json::deserialize::token::expect_number_or_null(
          28  +
                            tokens.next(),
          29  +
                        )?
          30  +
                        .map(i32::try_from)
          31  +
                        .transpose()?;
          32  +
                        if let Some(value) = value {
          33  +
                            items.push(value);
          34  +
                        } else {
          35  +
                            return Err(
          36  +
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          37  +
                                    "dense list cannot contain null values",
          38  +
                                ),
          39  +
                            );
          40  +
                        }
          41  +
                    }
          42  +
                }
          43  +
            }
          44  +
            Ok(Some(items))
          45  +
        }
          46  +
        _ => Err(
          47  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          48  +
                "expected start array or null",
          49  +
            ),
          50  +
        ),
          51  +
    }
          52  +
}

tmp-codegen-diff/codegen-server-test/json_rpc11-http0x/rust-server-codegen/src/protocol_serde/shape_integer_enum_map.rs

@@ -0,1 +0,60 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_integer_enum_map<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<::std::collections::HashMap<::std::string::String, i32>>,
           6  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
           7  +
>
           8  +
where
           9  +
    I: Iterator<
          10  +
        Item = Result<
          11  +
            ::aws_smithy_json::deserialize::Token<'a>,
          12  +
            ::aws_smithy_json::deserialize::error::DeserializeError,
          13  +
        >,
          14  +
    >,
          15  +
{
          16  +
    match tokens.next().transpose()? {
          17  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          18  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          19  +
            let mut map = ::std::collections::HashMap::new();
          20  +
            loop {
          21  +
                match tokens.next().transpose()? {
          22  +
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          23  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          24  +
                        let key = key.to_unescaped().map(|u| u.into_owned())?;
          25  +
                        let value = ::aws_smithy_json::deserialize::token::expect_number_or_null(
          26  +
                            tokens.next(),
          27  +
                        )?
          28  +
                        .map(i32::try_from)
          29  +
                        .transpose()?;
          30  +
                        match value {
          31  +
                            Some(value) => {
          32  +
                                map.insert(key, value);
          33  +
                            }
          34  +
                            None => {
          35  +
                                return Err(
          36  +
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          37  +
                                        "dense map cannot contain null values",
          38  +
                                    ),
          39  +
                                )
          40  +
                            }
          41  +
                        }
          42  +
                    }
          43  +
                    other => {
          44  +
                        return Err(
          45  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          46  +
                                format!("expected object key or end object, found: {other:?}"),
          47  +
                            ),
          48  +
                        )
          49  +
                    }
          50  +
                }
          51  +
            }
          52  +
            Ok(Some(map))
          53  +
        }
          54  +
        _ => Err(
          55  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          56  +
                "expected start object or null",
          57  +
            ),
          58  +
        ),
          59  +
    }
          60  +
}

tmp-codegen-diff/codegen-server-test/json_rpc11-http0x/rust-server-codegen/src/protocol_serde/shape_integer_enum_set.rs

@@ -0,1 +0,56 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_integer_enum_set<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<crate::unconstrained::integer_enum_set_unconstrained::IntegerEnumSetUnconstrained>,
           6  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
           7  +
>
           8  +
where
           9  +
    I: Iterator<
          10  +
        Item = Result<
          11  +
            ::aws_smithy_json::deserialize::Token<'a>,
          12  +
            ::aws_smithy_json::deserialize::error::DeserializeError,
          13  +
        >,
          14  +
    >,
          15  +
{
          16  +
    match tokens.next().transpose()? {
          17  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          18  +
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
          19  +
            let mut items = Vec::new();
          20  +
            loop {
          21  +
                match tokens.peek() {
          22  +
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
          23  +
                        tokens.next().transpose().unwrap();
          24  +
                        break;
          25  +
                    }
          26  +
                    _ => {
          27  +
                        let value = ::aws_smithy_json::deserialize::token::expect_number_or_null(
          28  +
                            tokens.next(),
          29  +
                        )?
          30  +
                        .map(i32::try_from)
          31  +
                        .transpose()?;
          32  +
                        if let Some(value) = value {
          33  +
                            items.push(value);
          34  +
                        } else {
          35  +
                            return Err(
          36  +
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          37  +
                                    "dense list cannot contain null values",
          38  +
                                ),
          39  +
                            );
          40  +
                        }
          41  +
                    }
          42  +
                }
          43  +
            }
          44  +
            Ok(Some(
          45  +
                crate::unconstrained::integer_enum_set_unconstrained::IntegerEnumSetUnconstrained(
          46  +
                    items,
          47  +
                ),
          48  +
            ))
          49  +
        }
          50  +
        _ => Err(
          51  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          52  +
                "expected start array or null",
          53  +
            ),
          54  +
        ),
          55  +
    }
          56  +
}

tmp-codegen-diff/codegen-server-test/json_rpc11-http0x/rust-server-codegen/src/protocol_serde/shape_invalid_greeting.rs

@@ -0,1 +0,21 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_invalid_greeting_error(
           3  +
    value: &crate::error::InvalidGreeting,
           4  +
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           5  +
    let mut out = ::std::string::String::new();
           6  +
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           7  +
    crate::protocol_serde::shape_invalid_greeting::ser_invalid_greeting(&mut object, value)?;
           8  +
    object.key("__type").string("InvalidGreeting");
           9  +
    object.finish();
          10  +
    Ok(out)
          11  +
}
          12  +
          13  +
pub fn ser_invalid_greeting(
          14  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          15  +
    input: &crate::error::InvalidGreeting,
          16  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          17  +
    if let Some(var_1) = &input.message {
          18  +
        object.key("Message").string(var_1.as_str());
          19  +
    }
          20  +
    Ok(())
          21  +
}

tmp-codegen-diff/codegen-server-test/json_rpc11-http0x/rust-server-codegen/src/protocol_serde/shape_json_enums.rs

@@ -0,1 +0,177 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_json_enums_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::JsonEnumsInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection,
           8  +
>
           9  +
where
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          11  +
    B::Data: Send,
          12  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          14  +
{
          15  +
    Ok({
          16  +
        #[allow(unused_mut)]
          17  +
        let mut input = crate::input::json_enums_input::Builder::default();
          18  +
        #[allow(unused_variables)]
          19  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          20  +
            uri, headers, body, ..
          21  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          22  +
        let bytes = ::hyper::body::to_bytes(body).await?;
          23  +
        if !bytes.is_empty() {
          24  +
            ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
          25  +
                &headers,
          26  +
                Some("application/x-amz-json-1.1"),
          27  +
            )?;
          28  +
            input = crate::protocol_serde::shape_json_enums::de_json_enums(bytes.as_ref(), input)?;
          29  +
        }
          30  +
        input.build()?
          31  +
    })
          32  +
}
          33  +
          34  +
#[allow(clippy::unnecessary_wraps)]
          35  +
pub fn ser_json_enums_http_response(
          36  +
    #[allow(unused_variables)] output: crate::output::JsonEnumsOutput,
          37  +
) -> std::result::Result<
          38  +
    ::aws_smithy_legacy_http_server::response::Response,
          39  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::ResponseRejection,
          40  +
> {
          41  +
    Ok({
          42  +
        #[allow(unused_mut)]
          43  +
        let mut builder = ::http::Response::builder();
          44  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          45  +
            builder,
          46  +
            ::http::header::CONTENT_TYPE,
          47  +
            "application/x-amz-json-1.1",
          48  +
        );
          49  +
        let http_status: u16 = 200;
          50  +
        builder = builder.status(http_status);
          51  +
        let payload =
          52  +
            crate::protocol_serde::shape_json_enums_output::ser_json_enums_output_output_output(
          53  +
                &output,
          54  +
            )?;
          55  +
        let content_length = payload.len();
          56  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          57  +
            builder,
          58  +
            ::http::header::CONTENT_LENGTH,
          59  +
            content_length,
          60  +
        );
          61  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          62  +
        builder.body(body)?
          63  +
    })
          64  +
}
          65  +
          66  +
#[allow(clippy::unnecessary_wraps)]
          67  +
pub fn ser_json_enums_http_error(
          68  +
    error: &crate::error::JsonEnumsError,
          69  +
) -> std::result::Result<
          70  +
    ::aws_smithy_legacy_http_server::response::Response,
          71  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::ResponseRejection,
          72  +
> {
          73  +
    Ok({
          74  +
        match error {
          75  +
            crate::error::JsonEnumsError::ValidationException(output) => {
          76  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
          77  +
                #[allow(unused_mut)]
          78  +
                let mut builder = ::http::Response::builder();
          79  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          80  +
                    builder,
          81  +
                    ::http::header::CONTENT_TYPE,
          82  +
                    "application/x-amz-json-1.1",
          83  +
                );
          84  +
                let content_length = payload.len();
          85  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          86  +
                    builder,
          87  +
                    ::http::header::CONTENT_LENGTH,
          88  +
                    content_length,
          89  +
                );
          90  +
                builder
          91  +
                    .status(400)
          92  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
          93  +
            }
          94  +
        }
          95  +
    })
          96  +
}
          97  +
          98  +
pub(crate) fn de_json_enums(
          99  +
    value: &[u8],
         100  +
    mut builder: crate::input::json_enums_input::Builder,
         101  +
) -> ::std::result::Result<
         102  +
    crate::input::json_enums_input::Builder,
         103  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
         104  +
> {
         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  +
    loop {
         111  +
        match tokens.next().transpose()? {
         112  +
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
         113  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         114  +
                match key.to_unescaped()?.as_ref() {
         115  +
                    "fooEnum1" => {
         116  +
                        builder = builder.set_foo_enum1(
         117  +
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
         118  +
                                tokens.next(),
         119  +
                            )?
         120  +
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
         121  +
                            .transpose()?,
         122  +
                        );
         123  +
                    }
         124  +
                    "fooEnum2" => {
         125  +
                        builder = builder.set_foo_enum2(
         126  +
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
         127  +
                                tokens.next(),
         128  +
                            )?
         129  +
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
         130  +
                            .transpose()?,
         131  +
                        );
         132  +
                    }
         133  +
                    "fooEnum3" => {
         134  +
                        builder = builder.set_foo_enum3(
         135  +
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
         136  +
                                tokens.next(),
         137  +
                            )?
         138  +
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
         139  +
                            .transpose()?,
         140  +
                        );
         141  +
                    }
         142  +
                    "fooEnumList" => {
         143  +
                        builder = builder.set_foo_enum_list(
         144  +
                            crate::protocol_serde::shape_foo_enum_list::de_foo_enum_list(tokens)?,
         145  +
                        );
         146  +
                    }
         147  +
                    "fooEnumSet" => {
         148  +
                        builder = builder.set_foo_enum_set(
         149  +
                            crate::protocol_serde::shape_foo_enum_set::de_foo_enum_set(tokens)?,
         150  +
                        );
         151  +
                    }
         152  +
                    "fooEnumMap" => {
         153  +
                        builder = builder.set_foo_enum_map(
         154  +
                            crate::protocol_serde::shape_foo_enum_map::de_foo_enum_map(tokens)?,
         155  +
                        );
         156  +
                    }
         157  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         158  +
                }
         159  +
            }
         160  +
            other => {
         161  +
                return Err(
         162  +
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
         163  +
                        "expected object key or end object, found: {other:?}"
         164  +
                    )),
         165  +
                )
         166  +
            }
         167  +
        }
         168  +
    }
         169  +
    if tokens.next().is_some() {
         170  +
        return Err(
         171  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         172  +
                "found more JSON tokens after completing parsing",
         173  +
            ),
         174  +
        );
         175  +
    }
         176  +
    Ok(builder)
         177  +
}

tmp-codegen-diff/codegen-server-test/json_rpc11-http0x/rust-server-codegen/src/protocol_serde/shape_json_enums_output.rs

@@ -0,1 +0,57 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_json_enums_output_output_output(
           3  +
    value: &crate::output::JsonEnumsOutput,
           4  +
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           5  +
    let mut out = ::std::string::String::new();
           6  +
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           7  +
    crate::protocol_serde::shape_json_enums_output::ser_json_enums_output_output(
           8  +
        &mut object,
           9  +
        value,
          10  +
    )?;
          11  +
    object.finish();
          12  +
    Ok(out)
          13  +
}
          14  +
          15  +
pub fn ser_json_enums_output_output(
          16  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          17  +
    input: &crate::output::JsonEnumsOutput,
          18  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          19  +
    if let Some(var_1) = &input.foo_enum1 {
          20  +
        object.key("fooEnum1").string(var_1.as_str());
          21  +
    }
          22  +
    if let Some(var_2) = &input.foo_enum2 {
          23  +
        object.key("fooEnum2").string(var_2.as_str());
          24  +
    }
          25  +
    if let Some(var_3) = &input.foo_enum3 {
          26  +
        object.key("fooEnum3").string(var_3.as_str());
          27  +
    }
          28  +
    if let Some(var_4) = &input.foo_enum_list {
          29  +
        let mut array_5 = object.key("fooEnumList").start_array();
          30  +
        for item_6 in var_4 {
          31  +
            {
          32  +
                array_5.value().string(item_6.as_str());
          33  +
            }
          34  +
        }
          35  +
        array_5.finish();
          36  +
    }
          37  +
    if let Some(var_7) = &input.foo_enum_set {
          38  +
        let mut array_8 = object.key("fooEnumSet").start_array();
          39  +
        for item_9 in &var_7.0 {
          40  +
            {
          41  +
                array_8.value().string(item_9.as_str());
          42  +
            }
          43  +
        }
          44  +
        array_8.finish();
          45  +
    }
          46  +
    if let Some(var_10) = &input.foo_enum_map {
          47  +
        #[allow(unused_mut)]
          48  +
        let mut object_11 = object.key("fooEnumMap").start_object();
          49  +
        for (key_12, value_13) in var_10 {
          50  +
            {
          51  +
                object_11.key(key_12.as_str()).string(value_13.as_str());
          52  +
            }
          53  +
        }
          54  +
        object_11.finish();
          55  +
    }
          56  +
    Ok(())
          57  +
}

tmp-codegen-diff/codegen-server-test/json_rpc11-http0x/rust-server-codegen/src/protocol_serde/shape_json_int_enums.rs

@@ -0,1 +0,185 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_json_int_enums_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::JsonIntEnumsInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection,
           8  +
>
           9  +
where
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          11  +
    B::Data: Send,
          12  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          14  +
{
          15  +
    Ok({
          16  +
        #[allow(unused_mut)]
          17  +
        let mut input = crate::input::json_int_enums_input::Builder::default();
          18  +
        #[allow(unused_variables)]
          19  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          20  +
            uri, headers, body, ..
          21  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          22  +
        let bytes = ::hyper::body::to_bytes(body).await?;
          23  +
        if !bytes.is_empty() {
          24  +
            ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
          25  +
                &headers,
          26  +
                Some("application/x-amz-json-1.1"),
          27  +
            )?;
          28  +
            input = crate::protocol_serde::shape_json_int_enums::de_json_int_enums(
          29  +
                bytes.as_ref(),
          30  +
                input,
          31  +
            )?;
          32  +
        }
          33  +
        input.build()?
          34  +
    })
          35  +
}
          36  +
          37  +
#[allow(clippy::unnecessary_wraps)]
          38  +
pub fn ser_json_int_enums_http_response(
          39  +
    #[allow(unused_variables)] output: crate::output::JsonIntEnumsOutput,
          40  +
) -> std::result::Result<
          41  +
    ::aws_smithy_legacy_http_server::response::Response,
          42  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::ResponseRejection,
          43  +
> {
          44  +
    Ok({
          45  +
        #[allow(unused_mut)]
          46  +
        let mut builder = ::http::Response::builder();
          47  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          48  +
            builder,
          49  +
            ::http::header::CONTENT_TYPE,
          50  +
            "application/x-amz-json-1.1",
          51  +
        );
          52  +
        let http_status: u16 = 200;
          53  +
        builder = builder.status(http_status);
          54  +
        let payload =
          55  +
            crate::protocol_serde::shape_json_int_enums_output::ser_json_int_enums_output_output_output(&output)?
          56  +
        ;
          57  +
        let content_length = payload.len();
          58  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          59  +
            builder,
          60  +
            ::http::header::CONTENT_LENGTH,
          61  +
            content_length,
          62  +
        );
          63  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          64  +
        builder.body(body)?
          65  +
    })
          66  +
}
          67  +
          68  +
#[allow(clippy::unnecessary_wraps)]
          69  +
pub fn ser_json_int_enums_http_error(
          70  +
    error: &crate::error::JsonIntEnumsError,
          71  +
) -> std::result::Result<
          72  +
    ::aws_smithy_legacy_http_server::response::Response,
          73  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::ResponseRejection,
          74  +
> {
          75  +
    Ok({
          76  +
        match error {
          77  +
            crate::error::JsonIntEnumsError::ValidationException(output) => {
          78  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
          79  +
                #[allow(unused_mut)]
          80  +
                let mut builder = ::http::Response::builder();
          81  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          82  +
                    builder,
          83  +
                    ::http::header::CONTENT_TYPE,
          84  +
                    "application/x-amz-json-1.1",
          85  +
                );
          86  +
                let content_length = payload.len();
          87  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          88  +
                    builder,
          89  +
                    ::http::header::CONTENT_LENGTH,
          90  +
                    content_length,
          91  +
                );
          92  +
                builder
          93  +
                    .status(400)
          94  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
          95  +
            }
          96  +
        }
          97  +
    })
          98  +
}
          99  +
         100  +
pub(crate) fn de_json_int_enums(
         101  +
    value: &[u8],
         102  +
    mut builder: crate::input::json_int_enums_input::Builder,
         103  +
) -> ::std::result::Result<
         104  +
    crate::input::json_int_enums_input::Builder,
         105  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
         106  +
> {
         107  +
    let mut tokens_owned =
         108  +
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
         109  +
            .peekable();
         110  +
    let tokens = &mut tokens_owned;
         111  +
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         112  +
    loop {
         113  +
        match tokens.next().transpose()? {
         114  +
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
         115  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         116  +
                match key.to_unescaped()?.as_ref() {
         117  +
                    "intEnum1" => {
         118  +
                        builder = builder.set_int_enum1(
         119  +
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
         120  +
                                tokens.next(),
         121  +
                            )?
         122  +
                            .map(i32::try_from)
         123  +
                            .transpose()?,
         124  +
                        );
         125  +
                    }
         126  +
                    "intEnum2" => {
         127  +
                        builder = builder.set_int_enum2(
         128  +
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
         129  +
                                tokens.next(),
         130  +
                            )?
         131  +
                            .map(i32::try_from)
         132  +
                            .transpose()?,
         133  +
                        );
         134  +
                    }
         135  +
                    "intEnum3" => {
         136  +
                        builder = builder.set_int_enum3(
         137  +
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
         138  +
                                tokens.next(),
         139  +
                            )?
         140  +
                            .map(i32::try_from)
         141  +
                            .transpose()?,
         142  +
                        );
         143  +
                    }
         144  +
                    "intEnumList" => {
         145  +
                        builder = builder.set_int_enum_list(
         146  +
                            crate::protocol_serde::shape_integer_enum_list::de_integer_enum_list(
         147  +
                                tokens,
         148  +
                            )?,
         149  +
                        );
         150  +
                    }
         151  +
                    "intEnumSet" => {
         152  +
                        builder = builder.set_int_enum_set(
         153  +
                            crate::protocol_serde::shape_integer_enum_set::de_integer_enum_set(
         154  +
                                tokens,
         155  +
                            )?,
         156  +
                        );
         157  +
                    }
         158  +
                    "intEnumMap" => {
         159  +
                        builder = builder.set_int_enum_map(
         160  +
                            crate::protocol_serde::shape_integer_enum_map::de_integer_enum_map(
         161  +
                                tokens,
         162  +
                            )?,
         163  +
                        );
         164  +
                    }
         165  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         166  +
                }
         167  +
            }
         168  +
            other => {
         169  +
                return Err(
         170  +
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
         171  +
                        "expected object key or end object, found: {other:?}"
         172  +
                    )),
         173  +
                )
         174  +
            }
         175  +
        }
         176  +
    }
         177  +
    if tokens.next().is_some() {
         178  +
        return Err(
         179  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         180  +
                "found more JSON tokens after completing parsing",
         181  +
            ),
         182  +
        );
         183  +
    }
         184  +
    Ok(builder)
         185  +
}

tmp-codegen-diff/codegen-server-test/json_rpc11-http0x/rust-server-codegen/src/protocol_serde/shape_json_int_enums_output.rs

@@ -0,1 +0,75 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_json_int_enums_output_output_output(
           3  +
    value: &crate::output::JsonIntEnumsOutput,
           4  +
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           5  +
    let mut out = ::std::string::String::new();
           6  +
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           7  +
    crate::protocol_serde::shape_json_int_enums_output::ser_json_int_enums_output_output(
           8  +
        &mut object,
           9  +
        value,
          10  +
    )?;
          11  +
    object.finish();
          12  +
    Ok(out)
          13  +
}
          14  +
          15  +
pub fn ser_json_int_enums_output_output(
          16  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          17  +
    input: &crate::output::JsonIntEnumsOutput,
          18  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          19  +
    if let Some(var_1) = &input.int_enum1 {
          20  +
        object.key("intEnum1").number(
          21  +
            #[allow(clippy::useless_conversion)]
          22  +
            ::aws_smithy_types::Number::NegInt((*var_1).into()),
          23  +
        );
          24  +
    }
          25  +
    if let Some(var_2) = &input.int_enum2 {
          26  +
        object.key("intEnum2").number(
          27  +
            #[allow(clippy::useless_conversion)]
          28  +
            ::aws_smithy_types::Number::NegInt((*var_2).into()),
          29  +
        );
          30  +
    }
          31  +
    if let Some(var_3) = &input.int_enum3 {
          32  +
        object.key("intEnum3").number(
          33  +
            #[allow(clippy::useless_conversion)]
          34  +
            ::aws_smithy_types::Number::NegInt((*var_3).into()),
          35  +
        );
          36  +
    }
          37  +
    if let Some(var_4) = &input.int_enum_list {
          38  +
        let mut array_5 = object.key("intEnumList").start_array();
          39  +
        for item_6 in var_4 {
          40  +
            {
          41  +
                array_5.value().number(
          42  +
                    #[allow(clippy::useless_conversion)]
          43  +
                    ::aws_smithy_types::Number::NegInt((*item_6).into()),
          44  +
                );
          45  +
            }
          46  +
        }
          47  +
        array_5.finish();
          48  +
    }
          49  +
    if let Some(var_7) = &input.int_enum_set {
          50  +
        let mut array_8 = object.key("intEnumSet").start_array();
          51  +
        for item_9 in &var_7.0 {
          52  +
            {
          53  +
                array_8.value().number(
          54  +
                    #[allow(clippy::useless_conversion)]
          55  +
                    ::aws_smithy_types::Number::NegInt((*item_9).into()),
          56  +
                );
          57  +
            }
          58  +
        }
          59  +
        array_8.finish();
          60  +
    }
          61  +
    if let Some(var_10) = &input.int_enum_map {
          62  +
        #[allow(unused_mut)]
          63  +
        let mut object_11 = object.key("intEnumMap").start_object();
          64  +
        for (key_12, value_13) in var_10 {
          65  +
            {
          66  +
                object_11.key(key_12.as_str()).number(
          67  +
                    #[allow(clippy::useless_conversion)]
          68  +
                    ::aws_smithy_types::Number::NegInt((*value_13).into()),
          69  +
                );
          70  +
            }
          71  +
        }
          72  +
        object_11.finish();
          73  +
    }
          74  +
    Ok(())
          75  +
}