Server Test

Server Test

rev. 3c756f73b1f83a0eed4275d9d1e22df0b10b66fb (ignoring whitespace)

Files changed:

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

@@ -0,1 +0,68 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) mod shape_case_insensitive_error_operation;
           3  +
           4  +
pub(crate) mod shape_empty_struct_with_content_on_wire_op;
           5  +
           6  +
pub(crate) mod shape_enum_query;
           7  +
           8  +
pub(crate) mod shape_escaped_string_values;
           9  +
          10  +
pub(crate) mod shape_http_query_params_only_operation;
          11  +
          12  +
pub(crate) mod shape_map_with_enum_key_op;
          13  +
          14  +
pub(crate) mod shape_null_in_non_sparse;
          15  +
          16  +
pub(crate) mod shape_primitive_int_header;
          17  +
          18  +
pub(crate) mod shape_primitive_int_op;
          19  +
          20  +
pub(crate) mod shape_query_precedence;
          21  +
          22  +
pub(crate) mod shape_status_response;
          23  +
          24  +
pub(crate) mod shape_string_payload;
          25  +
          26  +
pub(crate) mod shape_case_insensitive_error;
          27  +
          28  +
pub(crate) mod shape_empty_struct_with_content_on_wire_op_output;
          29  +
          30  +
pub(crate) mod shape_enum_query_input;
          31  +
          32  +
pub(crate) fn or_empty_doc(data: &[u8]) -> &[u8] {
          33  +
    if data.is_empty() {
          34  +
        b"{}"
          35  +
    } else {
          36  +
        data
          37  +
    }
          38  +
}
          39  +
          40  +
pub(crate) mod shape_escaped_string_values_output;
          41  +
          42  +
pub(crate) mod shape_extra_error;
          43  +
          44  +
pub(crate) mod shape_map_with_enum_key_op_output;
          45  +
          46  +
pub(crate) mod shape_null_in_non_sparse_output;
          47  +
          48  +
pub(crate) mod shape_primitive_int_header_output;
          49  +
          50  +
pub(crate) mod shape_primitive_int_op_output;
          51  +
          52  +
pub(crate) mod shape_query_precedence_input;
          53  +
          54  +
pub(crate) mod shape_status_response_output;
          55  +
          56  +
pub(crate) mod shape_string_payload_input;
          57  +
          58  +
pub(crate) mod shape_string_payload_output;
          59  +
          60  +
pub(crate) mod shape_validation_exception;
          61  +
          62  +
pub(crate) mod shape_map_with_enum_key;
          63  +
          64  +
pub(crate) mod shape_empty_struct;
          65  +
          66  +
pub(crate) mod shape_single_element_union;
          67  +
          68  +
pub(crate) mod shape_validation_exception_field;

tmp-codegen-diff/codegen-server-test/rest_json_extras-http0x/rust-server-codegen/src/protocol_serde/shape_case_insensitive_error.rs

@@ -0,1 +0,23 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_case_insensitive_error_error(
           3  +
    value: &crate::error::CaseInsensitiveError,
           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_case_insensitive_error::ser_case_insensitive_error(
           8  +
        &mut object,
           9  +
        value,
          10  +
    )?;
          11  +
    object.finish();
          12  +
    Ok(out)
          13  +
}
          14  +
          15  +
pub fn ser_case_insensitive_error(
          16  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          17  +
    input: &crate::error::CaseInsensitiveError,
          18  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          19  +
    if let Some(var_1) = &input.message {
          20  +
        object.key("message").string(var_1.as_str());
          21  +
    }
          22  +
    Ok(())
          23  +
}

tmp-codegen-diff/codegen-server-test/rest_json_extras-http0x/rust-server-codegen/src/protocol_serde/shape_case_insensitive_error_operation.rs

@@ -0,1 +0,118 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_case_insensitive_error_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::CaseInsensitiveErrorOperationInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::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::rest_json_1::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::case_insensitive_error_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  +
        ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
          23  +
            &headers, None,
          24  +
        )?;
          25  +
        input.build()
          26  +
    })
          27  +
}
          28  +
          29  +
#[allow(clippy::unnecessary_wraps)]
          30  +
pub fn ser_case_insensitive_error_operation_http_response(
          31  +
    #[allow(unused_variables)] output: crate::output::CaseInsensitiveErrorOperationOutput,
          32  +
) -> std::result::Result<
          33  +
    ::aws_smithy_legacy_http_server::response::Response,
          34  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          35  +
> {
          36  +
    Ok({
          37  +
        #[allow(unused_mut)]
          38  +
        let mut builder = ::http::Response::builder();
          39  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          40  +
            builder,
          41  +
            ::http::header::CONTENT_TYPE,
          42  +
            "application/json",
          43  +
        );
          44  +
        let http_status: u16 = 200;
          45  +
        builder = builder.status(http_status);
          46  +
        let payload = "";
          47  +
        let content_length = payload.len();
          48  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          49  +
            builder,
          50  +
            ::http::header::CONTENT_LENGTH,
          51  +
            content_length,
          52  +
        );
          53  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          54  +
        builder.body(body)?
          55  +
    })
          56  +
}
          57  +
          58  +
#[allow(clippy::unnecessary_wraps)]
          59  +
pub fn ser_case_insensitive_error_operation_http_error(
          60  +
    error: &crate::error::CaseInsensitiveErrorOperationError,
          61  +
) -> std::result::Result<
          62  +
    ::aws_smithy_legacy_http_server::response::Response,
          63  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          64  +
> {
          65  +
    Ok({
          66  +
        match error {
          67  +
            crate::error::CaseInsensitiveErrorOperationError::CaseInsensitiveError(output) => {
          68  +
                let payload = crate::protocol_serde::shape_case_insensitive_error::ser_case_insensitive_error_error(output)?;
          69  +
                #[allow(unused_mut)]
          70  +
                let mut builder = ::http::Response::builder();
          71  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          72  +
                    builder,
          73  +
                    ::http::header::CONTENT_TYPE,
          74  +
                    "application/json",
          75  +
                );
          76  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          77  +
                    builder,
          78  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
          79  +
                    "CaseInsensitiveError",
          80  +
                );
          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  +
                builder
          88  +
                    .status(500)
          89  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
          90  +
            }
          91  +
            crate::error::CaseInsensitiveErrorOperationError::ExtraError(output) => {
          92  +
                let payload =
          93  +
                    crate::protocol_serde::shape_extra_error::ser_extra_error_error(output)?;
          94  +
                #[allow(unused_mut)]
          95  +
                let mut builder = ::http::Response::builder();
          96  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          97  +
                    builder,
          98  +
                    ::http::header::CONTENT_TYPE,
          99  +
                    "application/json",
         100  +
                );
         101  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         102  +
                    builder,
         103  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         104  +
                    "ExtraError",
         105  +
                );
         106  +
                let content_length = payload.len();
         107  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         108  +
                    builder,
         109  +
                    ::http::header::CONTENT_LENGTH,
         110  +
                    content_length,
         111  +
                );
         112  +
                builder
         113  +
                    .status(500)
         114  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         115  +
            }
         116  +
        }
         117  +
    })
         118  +
}

tmp-codegen-diff/codegen-server-test/rest_json_extras-http0x/rust-server-codegen/src/protocol_serde/shape_empty_struct.rs

@@ -0,1 +0,7 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_empty_struct(
           3  +
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
           4  +
    #[allow(unused_variables)] input: &crate::model::EmptyStruct,
           5  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    Ok(())
           7  +
}

tmp-codegen-diff/codegen-server-test/rest_json_extras-http0x/rust-server-codegen/src/protocol_serde/shape_empty_struct_with_content_on_wire_op.rs

@@ -0,1 +0,97 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_empty_struct_with_content_on_wire_op_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::EmptyStructWithContentOnWireOpInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::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::rest_json_1::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 =
          18  +
            crate::input::empty_struct_with_content_on_wire_op_input::Builder::default();
          19  +
        #[allow(unused_variables)]
          20  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          21  +
            uri, headers, body, ..
          22  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          23  +
        ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
          24  +
            &headers, None,
          25  +
        )?;
          26  +
        input.build()
          27  +
    })
          28  +
}
          29  +
          30  +
#[allow(clippy::unnecessary_wraps)]
          31  +
pub fn ser_empty_struct_with_content_on_wire_op_http_response(
          32  +
    #[allow(unused_variables)] output: crate::output::EmptyStructWithContentOnWireOpOutput,
          33  +
) -> std::result::Result<
          34  +
    ::aws_smithy_legacy_http_server::response::Response,
          35  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          36  +
> {
          37  +
    Ok({
          38  +
        #[allow(unused_mut)]
          39  +
        let mut builder = ::http::Response::builder();
          40  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          41  +
            builder,
          42  +
            ::http::header::CONTENT_TYPE,
          43  +
            "application/json",
          44  +
        );
          45  +
        let http_status: u16 = 200;
          46  +
        builder = builder.status(http_status);
          47  +
        let payload =
          48  +
            crate::protocol_serde::shape_empty_struct_with_content_on_wire_op_output::ser_empty_struct_with_content_on_wire_op_output_output_output(&output)?
          49  +
        ;
          50  +
        let content_length = payload.len();
          51  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          52  +
            builder,
          53  +
            ::http::header::CONTENT_LENGTH,
          54  +
            content_length,
          55  +
        );
          56  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          57  +
        builder.body(body)?
          58  +
    })
          59  +
}
          60  +
          61  +
#[allow(clippy::unnecessary_wraps)]
          62  +
pub fn ser_empty_struct_with_content_on_wire_op_http_error(
          63  +
    error: &crate::error::EmptyStructWithContentOnWireOpError,
          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  +
    Ok({
          69  +
        match error {
          70  +
            crate::error::EmptyStructWithContentOnWireOpError::ExtraError(output) => {
          71  +
                let payload =
          72  +
                    crate::protocol_serde::shape_extra_error::ser_extra_error_error(output)?;
          73  +
                #[allow(unused_mut)]
          74  +
                let mut builder = ::http::Response::builder();
          75  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          76  +
                    builder,
          77  +
                    ::http::header::CONTENT_TYPE,
          78  +
                    "application/json",
          79  +
                );
          80  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          81  +
                    builder,
          82  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
          83  +
                    "ExtraError",
          84  +
                );
          85  +
                let content_length = payload.len();
          86  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          87  +
                    builder,
          88  +
                    ::http::header::CONTENT_LENGTH,
          89  +
                    content_length,
          90  +
                );
          91  +
                builder
          92  +
                    .status(500)
          93  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
          94  +
            }
          95  +
        }
          96  +
    })
          97  +
}

tmp-codegen-diff/codegen-server-test/rest_json_extras-http0x/rust-server-codegen/src/protocol_serde/shape_empty_struct_with_content_on_wire_op_output.rs

@@ -0,1 +0,23 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_empty_struct_with_content_on_wire_op_output_output_output(
           3  +
    value: &crate::output::EmptyStructWithContentOnWireOpOutput,
           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_empty_struct_with_content_on_wire_op_output::ser_empty_struct_with_content_on_wire_op_output_output(&mut object, value)?;
           8  +
    object.finish();
           9  +
    Ok(out)
          10  +
}
          11  +
          12  +
pub fn ser_empty_struct_with_content_on_wire_op_output_output(
          13  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          14  +
    input: &crate::output::EmptyStructWithContentOnWireOpOutput,
          15  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          16  +
    if let Some(var_1) = &input.empty {
          17  +
        #[allow(unused_mut)]
          18  +
        let mut object_2 = object.key("empty").start_object();
          19  +
        crate::protocol_serde::shape_empty_struct::ser_empty_struct(&mut object_2, var_1)?;
          20  +
        object_2.finish();
          21  +
    }
          22  +
    Ok(())
          23  +
}

tmp-codegen-diff/codegen-server-test/rest_json_extras-http0x/rust-server-codegen/src/protocol_serde/shape_enum_query.rs

@@ -0,1 +0,132 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_enum_query_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::EnumQueryInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::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::rest_json_1::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::enum_query_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 input_string = uri.path();
          23  +
        let (input_string, (_, m1)) =
          24  +
            ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
          25  +
                ::nom::sequence::preceded(
          26  +
                    ::nom::bytes::complete::tag("/"),
          27  +
                    ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>("foo"),
          28  +
                ),
          29  +
                ::nom::sequence::preceded(
          30  +
                    ::nom::bytes::complete::tag("/"),
          31  +
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
          32  +
                        ::nom::bytes::complete::take_until("/"),
          33  +
                        ::nom::combinator::rest,
          34  +
                    )),
          35  +
                ),
          36  +
            ))(input_string)?;
          37  +
        debug_assert_eq!("", input_string);
          38  +
        input = input.set_enum(crate::protocol_serde::shape_enum_query_input::de_enum(m1)?);
          39  +
        input.build()?
          40  +
    })
          41  +
}
          42  +
          43  +
#[allow(clippy::unnecessary_wraps)]
          44  +
pub fn ser_enum_query_http_response(
          45  +
    #[allow(unused_variables)] output: crate::output::EnumQueryOutput,
          46  +
) -> std::result::Result<
          47  +
    ::aws_smithy_legacy_http_server::response::Response,
          48  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          49  +
> {
          50  +
    Ok({
          51  +
        #[allow(unused_mut)]
          52  +
        let mut builder = ::http::Response::builder();
          53  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          54  +
            builder,
          55  +
            ::http::header::CONTENT_TYPE,
          56  +
            "application/json",
          57  +
        );
          58  +
        let http_status: u16 = 200;
          59  +
        builder = builder.status(http_status);
          60  +
        let payload = "";
          61  +
        let content_length = payload.len();
          62  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          63  +
            builder,
          64  +
            ::http::header::CONTENT_LENGTH,
          65  +
            content_length,
          66  +
        );
          67  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          68  +
        builder.body(body)?
          69  +
    })
          70  +
}
          71  +
          72  +
#[allow(clippy::unnecessary_wraps)]
          73  +
pub fn ser_enum_query_http_error(
          74  +
    error: &crate::error::EnumQueryError,
          75  +
) -> std::result::Result<
          76  +
    ::aws_smithy_legacy_http_server::response::Response,
          77  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          78  +
> {
          79  +
    Ok({
          80  +
        match error {
          81  +
            crate::error::EnumQueryError::ValidationException(output) => {
          82  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
          83  +
                #[allow(unused_mut)]
          84  +
                let mut builder = ::http::Response::builder();
          85  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          86  +
                    builder,
          87  +
                    ::http::header::CONTENT_TYPE,
          88  +
                    "application/json",
          89  +
                );
          90  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          91  +
                    builder,
          92  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
          93  +
                    "ValidationException",
          94  +
                );
          95  +
                let content_length = payload.len();
          96  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          97  +
                    builder,
          98  +
                    ::http::header::CONTENT_LENGTH,
          99  +
                    content_length,
         100  +
                );
         101  +
                builder
         102  +
                    .status(400)
         103  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         104  +
            }
         105  +
            crate::error::EnumQueryError::ExtraError(output) => {
         106  +
                let payload =
         107  +
                    crate::protocol_serde::shape_extra_error::ser_extra_error_error(output)?;
         108  +
                #[allow(unused_mut)]
         109  +
                let mut builder = ::http::Response::builder();
         110  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         111  +
                    builder,
         112  +
                    ::http::header::CONTENT_TYPE,
         113  +
                    "application/json",
         114  +
                );
         115  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         116  +
                    builder,
         117  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         118  +
                    "ExtraError",
         119  +
                );
         120  +
                let content_length = payload.len();
         121  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         122  +
                    builder,
         123  +
                    ::http::header::CONTENT_LENGTH,
         124  +
                    content_length,
         125  +
                );
         126  +
                builder
         127  +
                    .status(500)
         128  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         129  +
            }
         130  +
        }
         131  +
    })
         132  +
}

tmp-codegen-diff/codegen-server-test/rest_json_extras-http0x/rust-server-codegen/src/protocol_serde/shape_enum_query_input.rs

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

tmp-codegen-diff/codegen-server-test/rest_json_extras-http0x/rust-server-codegen/src/protocol_serde/shape_escaped_string_values.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_escaped_string_values_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::EscapedStringValuesInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::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::rest_json_1::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::escaped_string_values_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/json"),
          27  +
            )?;
          28  +
            input = crate::protocol_serde::shape_escaped_string_values::de_escaped_string_values(
          29  +
                bytes.as_ref(),
          30  +
                input,
          31  +
            )?;
          32  +
        }
          33  +
        input.build()?
          34  +
    })
          35  +
}
          36  +
          37  +
#[allow(clippy::unnecessary_wraps)]
          38  +
pub fn ser_escaped_string_values_http_response(
          39  +
    #[allow(unused_variables)] output: crate::output::EscapedStringValuesOutput,
          40  +
) -> std::result::Result<
          41  +
    ::aws_smithy_legacy_http_server::response::Response,
          42  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::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/json",
          51  +
        );
          52  +
        let http_status: u16 = 200;
          53  +
        builder = builder.status(http_status);
          54  +
        let payload =
          55  +
            crate::protocol_serde::shape_escaped_string_values_output::ser_escaped_string_values_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_escaped_string_values_http_error(
          70  +
    error: &crate::error::EscapedStringValuesError,
          71  +
) -> std::result::Result<
          72  +
    ::aws_smithy_legacy_http_server::response::Response,
          73  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          74  +
> {
          75  +
    Ok({
          76  +
        match error {
          77  +
            crate::error::EscapedStringValuesError::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/json",
          85  +
                );
          86  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          87  +
                    builder,
          88  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
          89  +
                    "ValidationException",
          90  +
                );
          91  +
                let content_length = payload.len();
          92  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          93  +
                    builder,
          94  +
                    ::http::header::CONTENT_LENGTH,
          95  +
                    content_length,
          96  +
                );
          97  +
                builder
          98  +
                    .status(400)
          99  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         100  +
            }
         101  +
            crate::error::EscapedStringValuesError::ExtraError(output) => {
         102  +
                let payload =
         103  +
                    crate::protocol_serde::shape_extra_error::ser_extra_error_error(output)?;
         104  +
                #[allow(unused_mut)]
         105  +
                let mut builder = ::http::Response::builder();
         106  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         107  +
                    builder,
         108  +
                    ::http::header::CONTENT_TYPE,
         109  +
                    "application/json",
         110  +
                );
         111  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         112  +
                    builder,
         113  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         114  +
                    "ExtraError",
         115  +
                );
         116  +
                let content_length = payload.len();
         117  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         118  +
                    builder,
         119  +
                    ::http::header::CONTENT_LENGTH,
         120  +
                    content_length,
         121  +
                );
         122  +
                builder
         123  +
                    .status(500)
         124  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         125  +
            }
         126  +
        }
         127  +
    })
         128  +
}
         129  +
         130  +
pub(crate) fn de_escaped_string_values(
         131  +
    value: &[u8],
         132  +
    mut builder: crate::input::escaped_string_values_input::Builder,
         133  +
) -> ::std::result::Result<
         134  +
    crate::input::escaped_string_values_input::Builder,
         135  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
         136  +
> {
         137  +
    let mut tokens_owned =
         138  +
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
         139  +
            .peekable();
         140  +
    let tokens = &mut tokens_owned;
         141  +
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         142  +
    loop {
         143  +
        match tokens.next().transpose()? {
         144  +
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
         145  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         146  +
                match key.to_unescaped()?.as_ref() {
         147  +
                    "enum" => {
         148  +
                        builder = builder.set_enum(
         149  +
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
         150  +
                                tokens.next(),
         151  +
                            )?
         152  +
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
         153  +
                            .transpose()?,
         154  +
                        );
         155  +
                    }
         156  +
                    "also\"has\"quotes" => {
         157  +
                        builder = builder.set_some_string(
         158  +
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
         159  +
                                tokens.next(),
         160  +
                            )?
         161  +
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
         162  +
                            .transpose()?,
         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/rest_json_extras-http0x/rust-server-codegen/src/protocol_serde/shape_escaped_string_values_output.rs

@@ -0,1 +0,23 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_escaped_string_values_output_output_output(
           3  +
    value: &crate::output::EscapedStringValuesOutput,
           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_escaped_string_values_output::ser_escaped_string_values_output_output(&mut object, value)?;
           8  +
    object.finish();
           9  +
    Ok(out)
          10  +
}
          11  +
          12  +
pub fn ser_escaped_string_values_output_output(
          13  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          14  +
    input: &crate::output::EscapedStringValuesOutput,
          15  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          16  +
    if let Some(var_1) = &input.r#enum {
          17  +
        object.key("enum").string(var_1.as_str());
          18  +
    }
          19  +
    if let Some(var_2) = &input.some_string {
          20  +
        object.key("also\"has\"quotes").string(var_2.as_str());
          21  +
    }
          22  +
    Ok(())
          23  +
}

tmp-codegen-diff/codegen-server-test/rest_json_extras-http0x/rust-server-codegen/src/protocol_serde/shape_extra_error.rs

@@ -0,1 +0,17 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_extra_error_error(
           3  +
    value: &crate::error::ExtraError,
           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_extra_error::ser_extra_error(&mut object, value)?;
           8  +
    object.finish();
           9  +
    Ok(out)
          10  +
}
          11  +
          12  +
pub fn ser_extra_error(
          13  +
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          14  +
    #[allow(unused_variables)] input: &crate::error::ExtraError,
          15  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          16  +
    Ok(())
          17  +
}

tmp-codegen-diff/codegen-server-test/rest_json_extras-http0x/rust-server-codegen/src/protocol_serde/shape_http_query_params_only_operation.rs

@@ -0,1 +0,103 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_http_query_params_only_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::HttpQueryParamsOnlyOperationInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::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::rest_json_1::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::http_query_params_only_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  +
        let query_string = uri.query().unwrap_or("");
          23  +
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          24  +
        let mut query_params: ::std::collections::HashMap<
          25  +
            ::std::string::String,
          26  +
            ::std::string::String,
          27  +
        > = ::std::collections::HashMap::new();
          28  +
        for (k, v) in pairs {
          29  +
            query_params
          30  +
                .entry(String::from(k))
          31  +
                .or_insert_with(|| String::from(v));
          32  +
        }
          33  +
        input = input.set_query_map(Some(query_params));
          34  +
        input.build()
          35  +
    })
          36  +
}
          37  +
          38  +
#[allow(clippy::unnecessary_wraps)]
          39  +
pub fn ser_http_query_params_only_operation_http_response(
          40  +
    #[allow(unused_variables)] output: crate::output::HttpQueryParamsOnlyOperationOutput,
          41  +
) -> std::result::Result<
          42  +
    ::aws_smithy_legacy_http_server::response::Response,
          43  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          44  +
> {
          45  +
    Ok({
          46  +
        #[allow(unused_mut)]
          47  +
        let mut builder = ::http::Response::builder();
          48  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          49  +
            builder,
          50  +
            ::http::header::CONTENT_TYPE,
          51  +
            "application/json",
          52  +
        );
          53  +
        let http_status: u16 = 200;
          54  +
        builder = builder.status(http_status);
          55  +
        let payload = "";
          56  +
        let content_length = payload.len();
          57  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          58  +
            builder,
          59  +
            ::http::header::CONTENT_LENGTH,
          60  +
            content_length,
          61  +
        );
          62  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          63  +
        builder.body(body)?
          64  +
    })
          65  +
}
          66  +
          67  +
#[allow(clippy::unnecessary_wraps)]
          68  +
pub fn ser_http_query_params_only_operation_http_error(
          69  +
    error: &crate::error::HttpQueryParamsOnlyOperationError,
          70  +
) -> std::result::Result<
          71  +
    ::aws_smithy_legacy_http_server::response::Response,
          72  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          73  +
> {
          74  +
    Ok({
          75  +
        match error {
          76  +
            crate::error::HttpQueryParamsOnlyOperationError::ExtraError(output) => {
          77  +
                let payload =
          78  +
                    crate::protocol_serde::shape_extra_error::ser_extra_error_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/json",
          85  +
                );
          86  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          87  +
                    builder,
          88  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
          89  +
                    "ExtraError",
          90  +
                );
          91  +
                let content_length = payload.len();
          92  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          93  +
                    builder,
          94  +
                    ::http::header::CONTENT_LENGTH,
          95  +
                    content_length,
          96  +
                );
          97  +
                builder
          98  +
                    .status(500)
          99  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         100  +
            }
         101  +
        }
         102  +
    })
         103  +
}

tmp-codegen-diff/codegen-server-test/rest_json_extras-http0x/rust-server-codegen/src/protocol_serde/shape_map_with_enum_key.rs

@@ -0,1 +0,64 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_map_with_enum_key<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<crate::unconstrained::map_with_enum_key_unconstrained::MapWithEnumKeyUnconstrained>,
           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_string_or_null(
          26  +
                            tokens.next(),
          27  +
                        )?
          28  +
                        .map(|s| s.to_unescaped().map(|u| u.into_owned()))
          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(
          53  +
                crate::unconstrained::map_with_enum_key_unconstrained::MapWithEnumKeyUnconstrained(
          54  +
                    map,
          55  +
                ),
          56  +
            ))
          57  +
        }
          58  +
        _ => Err(
          59  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          60  +
                "expected start object or null",
          61  +
            ),
          62  +
        ),
          63  +
    }
          64  +
}

tmp-codegen-diff/codegen-server-test/rest_json_extras-http0x/rust-server-codegen/src/protocol_serde/shape_map_with_enum_key_op.rs

@@ -0,1 +0,174 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_map_with_enum_key_op_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::MapWithEnumKeyOpInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::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::rest_json_1::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::map_with_enum_key_op_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/json"),
          27  +
            )?;
          28  +
            input = crate::protocol_serde::shape_map_with_enum_key_op::de_map_with_enum_key_op(
          29  +
                bytes.as_ref(),
          30  +
                input,
          31  +
            )?;
          32  +
        }
          33  +
        input.build()?
          34  +
    })
          35  +
}
          36  +
          37  +
#[allow(clippy::unnecessary_wraps)]
          38  +
pub fn ser_map_with_enum_key_op_http_response(
          39  +
    #[allow(unused_variables)] output: crate::output::MapWithEnumKeyOpOutput,
          40  +
) -> std::result::Result<
          41  +
    ::aws_smithy_legacy_http_server::response::Response,
          42  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::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/json",
          51  +
        );
          52  +
        let http_status: u16 = 200;
          53  +
        builder = builder.status(http_status);
          54  +
        let payload =
          55  +
            crate::protocol_serde::shape_map_with_enum_key_op_output::ser_map_with_enum_key_op_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_map_with_enum_key_op_http_error(
          70  +
    error: &crate::error::MapWithEnumKeyOpError,
          71  +
) -> std::result::Result<
          72  +
    ::aws_smithy_legacy_http_server::response::Response,
          73  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          74  +
> {
          75  +
    Ok({
          76  +
        match error {
          77  +
            crate::error::MapWithEnumKeyOpError::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/json",
          85  +
                );
          86  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          87  +
                    builder,
          88  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
          89  +
                    "ValidationException",
          90  +
                );
          91  +
                let content_length = payload.len();
          92  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          93  +
                    builder,
          94  +
                    ::http::header::CONTENT_LENGTH,
          95  +
                    content_length,
          96  +
                );
          97  +
                builder
          98  +
                    .status(400)
          99  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         100  +
            }
         101  +
            crate::error::MapWithEnumKeyOpError::ExtraError(output) => {
         102  +
                let payload =
         103  +
                    crate::protocol_serde::shape_extra_error::ser_extra_error_error(output)?;
         104  +
                #[allow(unused_mut)]
         105  +
                let mut builder = ::http::Response::builder();
         106  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         107  +
                    builder,
         108  +
                    ::http::header::CONTENT_TYPE,
         109  +
                    "application/json",
         110  +
                );
         111  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         112  +
                    builder,
         113  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         114  +
                    "ExtraError",
         115  +
                );
         116  +
                let content_length = payload.len();
         117  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         118  +
                    builder,
         119  +
                    ::http::header::CONTENT_LENGTH,
         120  +
                    content_length,
         121  +
                );
         122  +
                builder
         123  +
                    .status(500)
         124  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         125  +
            }
         126  +
        }
         127  +
    })
         128  +
}
         129  +
         130  +
pub(crate) fn de_map_with_enum_key_op(
         131  +
    value: &[u8],
         132  +
    mut builder: crate::input::map_with_enum_key_op_input::Builder,
         133  +
) -> ::std::result::Result<
         134  +
    crate::input::map_with_enum_key_op_input::Builder,
         135  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
         136  +
> {
         137  +
    let mut tokens_owned =
         138  +
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
         139  +
            .peekable();
         140  +
    let tokens = &mut tokens_owned;
         141  +
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         142  +
    loop {
         143  +
        match tokens.next().transpose()? {
         144  +
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
         145  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         146  +
                match key.to_unescaped()?.as_ref() {
         147  +
                    "map" => {
         148  +
                        builder = builder.set_map(
         149  +
                            crate::protocol_serde::shape_map_with_enum_key::de_map_with_enum_key(
         150  +
                                tokens,
         151  +
                            )?,
         152  +
                        );
         153  +
                    }
         154  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         155  +
                }
         156  +
            }
         157  +
            other => {
         158  +
                return Err(
         159  +
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
         160  +
                        "expected object key or end object, found: {other:?}"
         161  +
                    )),
         162  +
                )
         163  +
            }
         164  +
        }
         165  +
    }
         166  +
    if tokens.next().is_some() {
         167  +
        return Err(
         168  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         169  +
                "found more JSON tokens after completing parsing",
         170  +
            ),
         171  +
        );
         172  +
    }
         173  +
    Ok(builder)
         174  +
}