Server Test

Server Test

rev. 3c756f73b1f83a0eed4275d9d1e22df0b10b66fb

Files changed:

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

@@ -0,1 +0,98 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) mod shape_content_type_parameters;
           3  +
           4  +
pub(crate) mod shape_empty_input_and_empty_output;
           5  +
           6  +
pub(crate) mod shape_endpoint_operation;
           7  +
           8  +
pub(crate) mod shape_endpoint_with_host_label_operation;
           9  +
          10  +
pub(crate) mod shape_greeting_with_errors;
          11  +
          12  +
pub(crate) mod shape_host_with_path_operation;
          13  +
          14  +
pub(crate) mod shape_json_unions;
          15  +
          16  +
pub(crate) mod shape_no_input_and_no_output;
          17  +
          18  +
pub(crate) mod shape_no_input_and_output;
          19  +
          20  +
pub(crate) mod shape_operation_with_defaults;
          21  +
          22  +
pub(crate) mod shape_operation_with_nested_structure;
          23  +
          24  +
pub(crate) mod shape_operation_with_required_members;
          25  +
          26  +
pub(crate) mod shape_operation_with_required_members_with_defaults;
          27  +
          28  +
pub(crate) mod shape_put_with_content_encoding;
          29  +
          30  +
pub(crate) mod shape_query_incompatible_operation;
          31  +
          32  +
pub(crate) mod shape_simple_scalar_properties;
          33  +
          34  +
pub(crate) mod shape_complex_error;
          35  +
          36  +
pub(crate) fn or_empty_doc(data: &[u8]) -> &[u8] {
          37  +
    if data.is_empty() {
          38  +
        b"{}"
          39  +
    } else {
          40  +
        data
          41  +
    }
          42  +
}
          43  +
          44  +
pub(crate) mod shape_content_type_parameters_output;
          45  +
          46  +
pub(crate) mod shape_empty_input_and_empty_output_output;
          47  +
          48  +
pub(crate) mod shape_foo_error;
          49  +
          50  +
pub(crate) mod shape_greeting_with_errors_output;
          51  +
          52  +
pub(crate) mod shape_invalid_greeting;
          53  +
          54  +
pub(crate) mod shape_json_unions_output;
          55  +
          56  +
pub(crate) mod shape_no_input_and_output_output;
          57  +
          58  +
pub(crate) mod shape_operation_with_defaults_output;
          59  +
          60  +
pub(crate) mod shape_operation_with_nested_structure_output;
          61  +
          62  +
pub(crate) mod shape_operation_with_required_members_output;
          63  +
          64  +
pub(crate) mod shape_operation_with_required_members_with_defaults_output;
          65  +
          66  +
pub(crate) mod shape_simple_scalar_properties_output;
          67  +
          68  +
pub(crate) mod shape_validation_exception;
          69  +
          70  +
pub(crate) mod shape_client_optional_defaults;
          71  +
          72  +
pub(crate) mod shape_defaults;
          73  +
          74  +
pub(crate) mod shape_my_union;
          75  +
          76  +
pub(crate) mod shape_top_level;
          77  +
          78  +
pub(crate) mod shape_complex_nested_error_data;
          79  +
          80  +
pub(crate) mod shape_dialog;
          81  +
          82  +
pub(crate) mod shape_dialog_list;
          83  +
          84  +
pub(crate) mod shape_dialog_map;
          85  +
          86  +
pub(crate) mod shape_greeting_struct;
          87  +
          88  +
pub(crate) mod shape_string_list;
          89  +
          90  +
pub(crate) mod shape_string_map;
          91  +
          92  +
pub(crate) mod shape_test_string_list;
          93  +
          94  +
pub(crate) mod shape_test_string_map;
          95  +
          96  +
pub(crate) mod shape_validation_exception_field;
          97  +
          98  +
pub(crate) mod shape_farewell;

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

@@ -0,1 +0,57 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_client_optional_defaults<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<crate::model::ClientOptionalDefaults>,
           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::client_optional_defaults::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  +
                            "member" => {
          27  +
                                if let Some(v) =
          28  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
          29  +
                                        tokens.next(),
          30  +
                                    )?
          31  +
                                    .map(i32::try_from)
          32  +
                                    .transpose()?
          33  +
                                {
          34  +
                                    builder = builder.set_member(v);
          35  +
                                }
          36  +
                            }
          37  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          38  +
                        }
          39  +
                    }
          40  +
                    other => {
          41  +
                        return Err(
          42  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          43  +
                                format!("expected object key or end object, found: {other:?}"),
          44  +
                            ),
          45  +
                        )
          46  +
                    }
          47  +
                }
          48  +
            }
          49  +
            Ok(Some(builder.build()))
          50  +
        }
          51  +
        _ => Err(
          52  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          53  +
                "expected start object or null",
          54  +
            ),
          55  +
        ),
          56  +
    }
          57  +
}

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

@@ -0,1 +0,32 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_complex_error_error(
           3  +
    value: &crate::error::ComplexError,
           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_complex_error::ser_complex_error(&mut object, value)?;
           8  +
    object
           9  +
        .key("__type")
          10  +
        .string("aws.protocoltests.json10#ComplexError");
          11  +
    object.finish();
          12  +
    Ok(out)
          13  +
}
          14  +
          15  +
pub fn ser_complex_error(
          16  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          17  +
    input: &crate::error::ComplexError,
          18  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          19  +
    if let Some(var_1) = &input.top_level {
          20  +
        object.key("TopLevel").string(var_1.as_str());
          21  +
    }
          22  +
    if let Some(var_2) = &input.nested {
          23  +
        #[allow(unused_mut)]
          24  +
        let mut object_3 = object.key("Nested").start_object();
          25  +
        crate::protocol_serde::shape_complex_nested_error_data::ser_complex_nested_error_data(
          26  +
            &mut object_3,
          27  +
            var_2,
          28  +
        )?;
          29  +
        object_3.finish();
          30  +
    }
          31  +
    Ok(())
          32  +
}

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

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

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

@@ -0,1 +0,115 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_content_type_parameters_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::ContentTypeParametersInput,
           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::content_type_parameters_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.0"),
          27  +
            )?;
          28  +
            input =
          29  +
                crate::protocol_serde::shape_content_type_parameters::de_content_type_parameters(
          30  +
                    bytes.as_ref(),
          31  +
                    input,
          32  +
                )?;
          33  +
        }
          34  +
        input.build()
          35  +
    })
          36  +
}
          37  +
          38  +
#[allow(clippy::unnecessary_wraps)]
          39  +
pub fn ser_content_type_parameters_http_response(
          40  +
    #[allow(unused_variables)] output: crate::output::ContentTypeParametersOutput,
          41  +
) -> std::result::Result<
          42  +
    ::aws_smithy_legacy_http_server::response::Response,
          43  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::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/x-amz-json-1.0",
          52  +
        );
          53  +
        let http_status: u16 = 200;
          54  +
        builder = builder.status(http_status);
          55  +
        let payload =
          56  +
            crate::protocol_serde::shape_content_type_parameters_output::ser_content_type_parameters_output_output_output(&output)?
          57  +
        ;
          58  +
        let content_length = payload.len();
          59  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          60  +
            builder,
          61  +
            ::http::header::CONTENT_LENGTH,
          62  +
            content_length,
          63  +
        );
          64  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          65  +
        builder.body(body)?
          66  +
    })
          67  +
}
          68  +
          69  +
pub(crate) fn de_content_type_parameters(
          70  +
    value: &[u8],
          71  +
    mut builder: crate::input::content_type_parameters_input::Builder,
          72  +
) -> ::std::result::Result<
          73  +
    crate::input::content_type_parameters_input::Builder,
          74  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
          75  +
> {
          76  +
    let mut tokens_owned =
          77  +
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
          78  +
            .peekable();
          79  +
    let tokens = &mut tokens_owned;
          80  +
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
          81  +
    loop {
          82  +
        match tokens.next().transpose()? {
          83  +
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          84  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          85  +
                match key.to_unescaped()?.as_ref() {
          86  +
                    "value" => {
          87  +
                        builder = builder.set_value(
          88  +
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
          89  +
                                tokens.next(),
          90  +
                            )?
          91  +
                            .map(i32::try_from)
          92  +
                            .transpose()?,
          93  +
                        );
          94  +
                    }
          95  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          96  +
                }
          97  +
            }
          98  +
            other => {
          99  +
                return Err(
         100  +
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
         101  +
                        "expected object key or end object, found: {other:?}"
         102  +
                    )),
         103  +
                )
         104  +
            }
         105  +
        }
         106  +
    }
         107  +
    if tokens.next().is_some() {
         108  +
        return Err(
         109  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         110  +
                "found more JSON tokens after completing parsing",
         111  +
            ),
         112  +
        );
         113  +
    }
         114  +
    Ok(builder)
         115  +
}

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

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

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

@@ -0,1 +0,311 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_defaults<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<crate::model::defaults::Builder>,
           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::defaults::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  +
                            "defaultString" => {
          27  +
                                if let Some(v) =
          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  +
                                    builder = builder.set_default_string(v);
          35  +
                                }
          36  +
                            }
          37  +
                            "defaultBoolean" => {
          38  +
                                if let Some(v) =
          39  +
                                    ::aws_smithy_json::deserialize::token::expect_bool_or_null(
          40  +
                                        tokens.next(),
          41  +
                                    )?
          42  +
                                {
          43  +
                                    builder = builder.set_default_boolean(v);
          44  +
                                }
          45  +
                            }
          46  +
                            "defaultList" => {
          47  +
                                if let Some(v) =
          48  +
                                crate::protocol_serde::shape_test_string_list::de_test_string_list(tokens)?
          49  +
                                {
          50  +
                                                                            builder = builder.set_default_list(v);
          51  +
                                                                        }
          52  +
                            }
          53  +
                            "defaultDocumentMap" => {
          54  +
                                if let Some(v) = Some(
          55  +
                                    ::aws_smithy_json::deserialize::token::expect_document(tokens)?,
          56  +
                                ) {
          57  +
                                    builder = builder.set_default_document_map(v);
          58  +
                                }
          59  +
                            }
          60  +
                            "defaultDocumentString" => {
          61  +
                                if let Some(v) = Some(
          62  +
                                    ::aws_smithy_json::deserialize::token::expect_document(tokens)?,
          63  +
                                ) {
          64  +
                                    builder = builder.set_default_document_string(v);
          65  +
                                }
          66  +
                            }
          67  +
                            "defaultDocumentBoolean" => {
          68  +
                                if let Some(v) = Some(
          69  +
                                    ::aws_smithy_json::deserialize::token::expect_document(tokens)?,
          70  +
                                ) {
          71  +
                                    builder = builder.set_default_document_boolean(v);
          72  +
                                }
          73  +
                            }
          74  +
                            "defaultDocumentList" => {
          75  +
                                if let Some(v) = Some(
          76  +
                                    ::aws_smithy_json::deserialize::token::expect_document(tokens)?,
          77  +
                                ) {
          78  +
                                    builder = builder.set_default_document_list(v);
          79  +
                                }
          80  +
                            }
          81  +
                            "defaultNullDocument" => {
          82  +
                                builder = builder.set_default_null_document(Some(
          83  +
                                    ::aws_smithy_json::deserialize::token::expect_document(tokens)?,
          84  +
                                ));
          85  +
                            }
          86  +
                            "defaultTimestamp" => {
          87  +
                                if let Some(v) =
          88  +
                                    ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
          89  +
                                        tokens.next(),
          90  +
                                        ::aws_smithy_types::date_time::Format::EpochSeconds,
          91  +
                                    )?
          92  +
                                {
          93  +
                                    builder = builder.set_default_timestamp(v);
          94  +
                                }
          95  +
                            }
          96  +
                            "defaultBlob" => {
          97  +
                                if let Some(v) =
          98  +
                                    ::aws_smithy_json::deserialize::token::expect_blob_or_null(
          99  +
                                        tokens.next(),
         100  +
                                    )?
         101  +
                                {
         102  +
                                    builder = builder.set_default_blob(v);
         103  +
                                }
         104  +
                            }
         105  +
                            "defaultByte" => {
         106  +
                                if let Some(v) =
         107  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
         108  +
                                        tokens.next(),
         109  +
                                    )?
         110  +
                                    .map(i8::try_from)
         111  +
                                    .transpose()?
         112  +
                                {
         113  +
                                    builder = builder.set_default_byte(v);
         114  +
                                }
         115  +
                            }
         116  +
                            "defaultShort" => {
         117  +
                                if let Some(v) =
         118  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
         119  +
                                        tokens.next(),
         120  +
                                    )?
         121  +
                                    .map(i16::try_from)
         122  +
                                    .transpose()?
         123  +
                                {
         124  +
                                    builder = builder.set_default_short(v);
         125  +
                                }
         126  +
                            }
         127  +
                            "defaultInteger" => {
         128  +
                                if let Some(v) =
         129  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
         130  +
                                        tokens.next(),
         131  +
                                    )?
         132  +
                                    .map(i32::try_from)
         133  +
                                    .transpose()?
         134  +
                                {
         135  +
                                    builder = builder.set_default_integer(v);
         136  +
                                }
         137  +
                            }
         138  +
                            "defaultLong" => {
         139  +
                                if let Some(v) =
         140  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
         141  +
                                        tokens.next(),
         142  +
                                    )?
         143  +
                                    .map(i64::try_from)
         144  +
                                    .transpose()?
         145  +
                                {
         146  +
                                    builder = builder.set_default_long(v);
         147  +
                                }
         148  +
                            }
         149  +
                            "defaultFloat" => {
         150  +
                                if let Some(v) =
         151  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
         152  +
                                        tokens.next(),
         153  +
                                    )?
         154  +
                                    .map(|v| v.to_f32_lossy())
         155  +
                                {
         156  +
                                    builder = builder.set_default_float(v);
         157  +
                                }
         158  +
                            }
         159  +
                            "defaultDouble" => {
         160  +
                                if let Some(v) =
         161  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
         162  +
                                        tokens.next(),
         163  +
                                    )?
         164  +
                                    .map(|v| v.to_f64_lossy())
         165  +
                                {
         166  +
                                    builder = builder.set_default_double(v);
         167  +
                                }
         168  +
                            }
         169  +
                            "defaultMap" => {
         170  +
                                if let Some(v) =
         171  +
                                crate::protocol_serde::shape_test_string_map::de_test_string_map(tokens)?
         172  +
                                {
         173  +
                                                                            builder = builder.set_default_map(v);
         174  +
                                                                        }
         175  +
                            }
         176  +
                            "defaultEnum" => {
         177  +
                                if let Some(v) =
         178  +
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
         179  +
                                        tokens.next(),
         180  +
                                    )?
         181  +
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
         182  +
                                    .transpose()?
         183  +
                                {
         184  +
                                    builder = builder.set_default_enum(v);
         185  +
                                }
         186  +
                            }
         187  +
                            "defaultIntEnum" => {
         188  +
                                if let Some(v) =
         189  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
         190  +
                                        tokens.next(),
         191  +
                                    )?
         192  +
                                    .map(i32::try_from)
         193  +
                                    .transpose()?
         194  +
                                {
         195  +
                                    builder = builder.set_default_int_enum(v);
         196  +
                                }
         197  +
                            }
         198  +
                            "emptyString" => {
         199  +
                                if let Some(v) =
         200  +
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
         201  +
                                        tokens.next(),
         202  +
                                    )?
         203  +
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
         204  +
                                    .transpose()?
         205  +
                                {
         206  +
                                    builder = builder.set_empty_string(v);
         207  +
                                }
         208  +
                            }
         209  +
                            "falseBoolean" => {
         210  +
                                if let Some(v) =
         211  +
                                    ::aws_smithy_json::deserialize::token::expect_bool_or_null(
         212  +
                                        tokens.next(),
         213  +
                                    )?
         214  +
                                {
         215  +
                                    builder = builder.set_false_boolean(v);
         216  +
                                }
         217  +
                            }
         218  +
                            "emptyBlob" => {
         219  +
                                if let Some(v) =
         220  +
                                    ::aws_smithy_json::deserialize::token::expect_blob_or_null(
         221  +
                                        tokens.next(),
         222  +
                                    )?
         223  +
                                {
         224  +
                                    builder = builder.set_empty_blob(v);
         225  +
                                }
         226  +
                            }
         227  +
                            "zeroByte" => {
         228  +
                                if let Some(v) =
         229  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
         230  +
                                        tokens.next(),
         231  +
                                    )?
         232  +
                                    .map(i8::try_from)
         233  +
                                    .transpose()?
         234  +
                                {
         235  +
                                    builder = builder.set_zero_byte(v);
         236  +
                                }
         237  +
                            }
         238  +
                            "zeroShort" => {
         239  +
                                if let Some(v) =
         240  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
         241  +
                                        tokens.next(),
         242  +
                                    )?
         243  +
                                    .map(i16::try_from)
         244  +
                                    .transpose()?
         245  +
                                {
         246  +
                                    builder = builder.set_zero_short(v);
         247  +
                                }
         248  +
                            }
         249  +
                            "zeroInteger" => {
         250  +
                                if let Some(v) =
         251  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
         252  +
                                        tokens.next(),
         253  +
                                    )?
         254  +
                                    .map(i32::try_from)
         255  +
                                    .transpose()?
         256  +
                                {
         257  +
                                    builder = builder.set_zero_integer(v);
         258  +
                                }
         259  +
                            }
         260  +
                            "zeroLong" => {
         261  +
                                if let Some(v) =
         262  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
         263  +
                                        tokens.next(),
         264  +
                                    )?
         265  +
                                    .map(i64::try_from)
         266  +
                                    .transpose()?
         267  +
                                {
         268  +
                                    builder = builder.set_zero_long(v);
         269  +
                                }
         270  +
                            }
         271  +
                            "zeroFloat" => {
         272  +
                                if let Some(v) =
         273  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
         274  +
                                        tokens.next(),
         275  +
                                    )?
         276  +
                                    .map(|v| v.to_f32_lossy())
         277  +
                                {
         278  +
                                    builder = builder.set_zero_float(v);
         279  +
                                }
         280  +
                            }
         281  +
                            "zeroDouble" => {
         282  +
                                if let Some(v) =
         283  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
         284  +
                                        tokens.next(),
         285  +
                                    )?
         286  +
                                    .map(|v| v.to_f64_lossy())
         287  +
                                {
         288  +
                                    builder = builder.set_zero_double(v);
         289  +
                                }
         290  +
                            }
         291  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         292  +
                        }
         293  +
                    }
         294  +
                    other => {
         295  +
                        return Err(
         296  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         297  +
                                format!("expected object key or end object, found: {other:?}"),
         298  +
                            ),
         299  +
                        )
         300  +
                    }
         301  +
                }
         302  +
            }
         303  +
            Ok(Some(builder))
         304  +
        }
         305  +
        _ => Err(
         306  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         307  +
                "expected start object or null",
         308  +
            ),
         309  +
        ),
         310  +
    }
         311  +
}

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

@@ -0,1 +0,90 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_dialog(
           3  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
           4  +
    input: &crate::model::Dialog,
           5  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    if let Some(var_1) = &input.language {
           7  +
        object.key("language").string(var_1.as_str());
           8  +
    }
           9  +
    {
          10  +
        object.key("greeting").string(input.greeting.as_str());
          11  +
    }
          12  +
    if let Some(var_2) = &input.farewell {
          13  +
        #[allow(unused_mut)]
          14  +
        let mut object_3 = object.key("farewell").start_object();
          15  +
        crate::protocol_serde::shape_farewell::ser_farewell(&mut object_3, var_2)?;
          16  +
        object_3.finish();
          17  +
    }
          18  +
    Ok(())
          19  +
}
          20  +
          21  +
pub(crate) fn de_dialog<'a, I>(
          22  +
    tokens: &mut ::std::iter::Peekable<I>,
          23  +
) -> ::std::result::Result<
          24  +
    Option<crate::model::Dialog>,
          25  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
          26  +
>
          27  +
where
          28  +
    I: Iterator<
          29  +
        Item = Result<
          30  +
            ::aws_smithy_json::deserialize::Token<'a>,
          31  +
            ::aws_smithy_json::deserialize::error::DeserializeError,
          32  +
        >,
          33  +
    >,
          34  +
{
          35  +
    match tokens.next().transpose()? {
          36  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          37  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          38  +
            #[allow(unused_mut)]
          39  +
            let mut builder = crate::model::dialog::Builder::default();
          40  +
            loop {
          41  +
                match tokens.next().transpose()? {
          42  +
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          43  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          44  +
                        match key.to_unescaped()?.as_ref() {
          45  +
                            "language" => {
          46  +
                                builder = builder.set_language(
          47  +
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
          48  +
                                        tokens.next(),
          49  +
                                    )?
          50  +
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
          51  +
                                    .transpose()?,
          52  +
                                );
          53  +
                            }
          54  +
                            "greeting" => {
          55  +
                                if let Some(v) =
          56  +
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
          57  +
                                        tokens.next(),
          58  +
                                    )?
          59  +
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
          60  +
                                    .transpose()?
          61  +
                                {
          62  +
                                    builder = builder.set_greeting(v);
          63  +
                                }
          64  +
                            }
          65  +
                            "farewell" => {
          66  +
                                builder = builder.set_farewell(
          67  +
                                    crate::protocol_serde::shape_farewell::de_farewell(tokens)?,
          68  +
                                );
          69  +
                            }
          70  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          71  +
                        }
          72  +
                    }
          73  +
                    other => {
          74  +
                        return Err(
          75  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          76  +
                                format!("expected object key or end object, found: {other:?}"),
          77  +
                            ),
          78  +
                        )
          79  +
                    }
          80  +
                }
          81  +
            }
          82  +
            Ok(Some(builder.build()))
          83  +
        }
          84  +
        _ => Err(
          85  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          86  +
                "expected start object or null",
          87  +
            ),
          88  +
        ),
          89  +
    }
          90  +
}

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

@@ -0,1 +0,48 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_dialog_list<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<::std::vec::Vec<crate::model::Dialog>>,
           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 = crate::protocol_serde::shape_dialog::de_dialog(tokens)?;
          28  +
                        if let Some(value) = value {
          29  +
                            items.push(value);
          30  +
                        } else {
          31  +
                            return Err(
          32  +
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          33  +
                                    "dense list cannot contain null values",
          34  +
                                ),
          35  +
                            );
          36  +
                        }
          37  +
                    }
          38  +
                }
          39  +
            }
          40  +
            Ok(Some(items))
          41  +
        }
          42  +
        _ => Err(
          43  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          44  +
                "expected start array or null",
          45  +
            ),
          46  +
        ),
          47  +
    }
          48  +
}

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

@@ -0,1 +0,56 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_dialog_map<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<::std::collections::HashMap<::std::string::String, crate::model::Dialog>>,
           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 = crate::protocol_serde::shape_dialog::de_dialog(tokens)?;
          26  +
                        match value {
          27  +
                            Some(value) => {
          28  +
                                map.insert(key, value);
          29  +
                            }
          30  +
                            None => {
          31  +
                                return Err(
          32  +
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          33  +
                                        "dense map cannot contain null values",
          34  +
                                    ),
          35  +
                                )
          36  +
                            }
          37  +
                        }
          38  +
                    }
          39  +
                    other => {
          40  +
                        return Err(
          41  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          42  +
                                format!("expected object key or end object, found: {other:?}"),
          43  +
                            ),
          44  +
                        )
          45  +
                    }
          46  +
                }
          47  +
            }
          48  +
            Ok(Some(map))
          49  +
        }
          50  +
        _ => Err(
          51  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          52  +
                "expected start object or null",
          53  +
            ),
          54  +
        ),
          55  +
    }
          56  +
}

tmp-codegen-diff/codegen-server-test/json_rpc10-http0x/rust-server-codegen/src/protocol_serde/shape_empty_input_and_empty_output.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_empty_input_and_empty_output_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::EmptyInputAndEmptyOutputInput,
           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::empty_input_and_empty_output_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_empty_input_and_empty_output_http_response(
          28  +
    #[allow(unused_variables)] output: crate::output::EmptyInputAndEmptyOutputOutput,
          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.0",
          40  +
        );
          41  +
        let http_status: u16 = 200;
          42  +
        builder = builder.status(http_status);
          43  +
        let payload =
          44  +
            crate::protocol_serde::shape_empty_input_and_empty_output_output::ser_empty_input_and_empty_output_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_rpc10-http0x/rust-server-codegen/src/protocol_serde/shape_empty_input_and_empty_output_output.rs

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

tmp-codegen-diff/codegen-server-test/json_rpc10-http0x/rust-server-codegen/src/protocol_serde/shape_endpoint_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_endpoint_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::EndpointOperationInput,
           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::endpoint_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_endpoint_operation_http_response(
          28  +
    #[allow(unused_variables)] output: crate::output::EndpointOperationOutput,
          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.0",
          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_rpc10-http0x/rust-server-codegen/src/protocol_serde/shape_endpoint_with_host_label_operation.rs

@@ -0,1 +0,143 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_endpoint_with_host_label_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::EndpointWithHostLabelOperationInput,
           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::endpoint_with_host_label_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 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.0"),
          27  +
            )?;
          28  +
            input = crate::protocol_serde::shape_endpoint_with_host_label_operation::de_endpoint_with_host_label_operation(bytes.as_ref(), input)?;
          29  +
        }
          30  +
        input.build()?
          31  +
    })
          32  +
}
          33  +
          34  +
#[allow(clippy::unnecessary_wraps)]
          35  +
pub fn ser_endpoint_with_host_label_operation_http_response(
          36  +
    #[allow(unused_variables)] output: crate::output::EndpointWithHostLabelOperationOutput,
          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.0",
          48  +
        );
          49  +
        let http_status: u16 = 200;
          50  +
        builder = builder.status(http_status);
          51  +
        let payload = "";
          52  +
        let content_length = payload.len();
          53  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          54  +
            builder,
          55  +
            ::http::header::CONTENT_LENGTH,
          56  +
            content_length,
          57  +
        );
          58  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          59  +
        builder.body(body)?
          60  +
    })
          61  +
}
          62  +
          63  +
#[allow(clippy::unnecessary_wraps)]
          64  +
pub fn ser_endpoint_with_host_label_operation_http_error(
          65  +
    error: &crate::error::EndpointWithHostLabelOperationError,
          66  +
) -> std::result::Result<
          67  +
    ::aws_smithy_legacy_http_server::response::Response,
          68  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::ResponseRejection,
          69  +
> {
          70  +
    Ok({
          71  +
        match error {
          72  +
            crate::error::EndpointWithHostLabelOperationError::ValidationException(output) => {
          73  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
          74  +
                #[allow(unused_mut)]
          75  +
                let mut builder = ::http::Response::builder();
          76  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          77  +
                    builder,
          78  +
                    ::http::header::CONTENT_TYPE,
          79  +
                    "application/x-amz-json-1.0",
          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(400)
          89  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
          90  +
            }
          91  +
        }
          92  +
    })
          93  +
}
          94  +
          95  +
pub(crate) fn de_endpoint_with_host_label_operation(
          96  +
    value: &[u8],
          97  +
    mut builder: crate::input::endpoint_with_host_label_operation_input::Builder,
          98  +
) -> ::std::result::Result<
          99  +
    crate::input::endpoint_with_host_label_operation_input::Builder,
         100  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
         101  +
> {
         102  +
    let mut tokens_owned =
         103  +
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
         104  +
            .peekable();
         105  +
    let tokens = &mut tokens_owned;
         106  +
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         107  +
    loop {
         108  +
        match tokens.next().transpose()? {
         109  +
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
         110  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         111  +
                match key.to_unescaped()?.as_ref() {
         112  +
                    "label" => {
         113  +
                        if let Some(v) =
         114  +
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
         115  +
                                tokens.next(),
         116  +
                            )?
         117  +
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
         118  +
                            .transpose()?
         119  +
                        {
         120  +
                            builder = builder.set_label(v);
         121  +
                        }
         122  +
                    }
         123  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         124  +
                }
         125  +
            }
         126  +
            other => {
         127  +
                return Err(
         128  +
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
         129  +
                        "expected object key or end object, found: {other:?}"
         130  +
                    )),
         131  +
                )
         132  +
            }
         133  +
        }
         134  +
    }
         135  +
    if tokens.next().is_some() {
         136  +
        return Err(
         137  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         138  +
                "found more JSON tokens after completing parsing",
         139  +
            ),
         140  +
        );
         141  +
    }
         142  +
    Ok(builder)
         143  +
}