Server Test

Server Test

rev. ee474c7509d7728618c23068f3741e8e5b339ef9 (ignoring whitespace)

Files changed:

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

@@ -0,1 +0,138 @@
           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_datetime_offsets;
           5  +
           6  +
pub(crate) mod shape_empty_operation;
           7  +
           8  +
pub(crate) mod shape_endpoint_operation;
           9  +
          10  +
pub(crate) mod shape_endpoint_with_host_label_operation;
          11  +
          12  +
pub(crate) mod shape_fractional_seconds;
          13  +
          14  +
pub(crate) mod shape_greeting_with_errors;
          15  +
          16  +
pub(crate) mod shape_host_with_path_operation;
          17  +
          18  +
pub(crate) mod shape_json_enums;
          19  +
          20  +
pub(crate) mod shape_json_int_enums;
          21  +
          22  +
pub(crate) mod shape_json_unions;
          23  +
          24  +
pub(crate) mod shape_kitchen_sink_operation;
          25  +
          26  +
pub(crate) mod shape_null_operation;
          27  +
          28  +
pub(crate) mod shape_operation_with_optional_input_output;
          29  +
          30  +
pub(crate) mod shape_put_and_get_inline_documents;
          31  +
          32  +
pub(crate) mod shape_put_with_content_encoding;
          33  +
          34  +
pub(crate) mod shape_simple_scalar_properties;
          35  +
          36  +
pub(crate) mod shape_sparse_nulls_operation;
          37  +
          38  +
pub(crate) mod shape_complex_error;
          39  +
          40  +
pub(crate) fn or_empty_doc(data: &[u8]) -> &[u8] {
          41  +
    if data.is_empty() {
          42  +
        b"{}"
          43  +
    } else {
          44  +
        data
          45  +
    }
          46  +
}
          47  +
          48  +
pub(crate) mod shape_content_type_parameters_output;
          49  +
          50  +
pub(crate) mod shape_datetime_offsets_output;
          51  +
          52  +
pub(crate) mod shape_error_with_members;
          53  +
          54  +
pub(crate) mod shape_error_without_members;
          55  +
          56  +
pub(crate) mod shape_foo_error;
          57  +
          58  +
pub(crate) mod shape_fractional_seconds_output;
          59  +
          60  +
pub(crate) mod shape_greeting_with_errors_output;
          61  +
          62  +
pub(crate) mod shape_invalid_greeting;
          63  +
          64  +
pub(crate) mod shape_json_enums_output;
          65  +
          66  +
pub(crate) mod shape_json_int_enums_output;
          67  +
          68  +
pub(crate) mod shape_json_unions_output;
          69  +
          70  +
pub(crate) mod shape_kitchen_sink_operation_output;
          71  +
          72  +
pub(crate) mod shape_null_operation_output;
          73  +
          74  +
pub(crate) mod shape_operation_with_optional_input_output_output;
          75  +
          76  +
pub(crate) mod shape_put_and_get_inline_documents_output;
          77  +
          78  +
pub(crate) mod shape_simple_scalar_properties_output;
          79  +
          80  +
pub(crate) mod shape_sparse_nulls_operation_output;
          81  +
          82  +
pub(crate) mod shape_validation_exception;
          83  +
          84  +
pub(crate) mod shape_empty_struct;
          85  +
          86  +
pub(crate) mod shape_foo_enum_list;
          87  +
          88  +
pub(crate) mod shape_foo_enum_map;
          89  +
          90  +
pub(crate) mod shape_foo_enum_set;
          91  +
          92  +
pub(crate) mod shape_integer_enum_list;
          93  +
          94  +
pub(crate) mod shape_integer_enum_map;
          95  +
          96  +
pub(crate) mod shape_integer_enum_set;
          97  +
          98  +
pub(crate) mod shape_kitchen_sink;
          99  +
         100  +
pub(crate) mod shape_list_of_kitchen_sinks;
         101  +
         102  +
pub(crate) mod shape_list_of_list_of_strings;
         103  +
         104  +
pub(crate) mod shape_list_of_maps_of_strings;
         105  +
         106  +
pub(crate) mod shape_list_of_strings;
         107  +
         108  +
pub(crate) mod shape_list_of_structs;
         109  +
         110  +
pub(crate) mod shape_map_of_kitchen_sinks;
         111  +
         112  +
pub(crate) mod shape_map_of_lists_of_strings;
         113  +
         114  +
pub(crate) mod shape_map_of_map_of_strings;
         115  +
         116  +
pub(crate) mod shape_map_of_strings;
         117  +
         118  +
pub(crate) mod shape_map_of_structs;
         119  +
         120  +
pub(crate) mod shape_my_union;
         121  +
         122  +
pub(crate) mod shape_simple_struct;
         123  +
         124  +
pub(crate) mod shape_sparse_string_list;
         125  +
         126  +
pub(crate) mod shape_sparse_string_map;
         127  +
         128  +
pub(crate) mod shape_struct_with_json_name;
         129  +
         130  +
pub(crate) mod shape_complex_nested_error_data;
         131  +
         132  +
pub(crate) mod shape_greeting_struct;
         133  +
         134  +
pub(crate) mod shape_string_list;
         135  +
         136  +
pub(crate) mod shape_string_map;
         137  +
         138  +
pub(crate) mod shape_validation_exception_field;

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

@@ -0,1 +0,30 @@
           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.key("__type").string("ComplexError");
           9  +
    object.finish();
          10  +
    Ok(out)
          11  +
}
          12  +
          13  +
pub fn ser_complex_error(
          14  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          15  +
    input: &crate::error::ComplexError,
          16  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          17  +
    if let Some(var_1) = &input.top_level {
          18  +
        object.key("TopLevel").string(var_1.as_str());
          19  +
    }
          20  +
    if let Some(var_2) = &input.nested {
          21  +
        #[allow(unused_mut)]
          22  +
        let mut object_3 = object.key("Nested").start_object();
          23  +
        crate::protocol_serde::shape_complex_nested_error_data::ser_complex_nested_error_data(
          24  +
            &mut object_3,
          25  +
            var_2,
          26  +
        )?;
          27  +
        object_3.finish();
          28  +
    }
          29  +
    Ok(())
          30  +
}

tmp-codegen-diff/codegen-server-test/json_rpc11-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_rpc11-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.1"),
          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.1",
          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_rpc11-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_rpc11-http0x/rust-server-codegen/src/protocol_serde/shape_datetime_offsets.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_datetime_offsets_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::DatetimeOffsetsInput,
           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::datetime_offsets_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_datetime_offsets_http_response(
          28  +
    #[allow(unused_variables)] output: crate::output::DatetimeOffsetsOutput,
          29  +
) -> std::result::Result<
          30  +
    ::aws_smithy_legacy_http_server::response::Response,
          31  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::ResponseRejection,
          32  +
> {
          33  +
    Ok({
          34  +
        #[allow(unused_mut)]
          35  +
        let mut builder = ::http::Response::builder();
          36  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          37  +
            builder,
          38  +
            ::http::header::CONTENT_TYPE,
          39  +
            "application/x-amz-json-1.1",
          40  +
        );
          41  +
        let http_status: u16 = 200;
          42  +
        builder = builder.status(http_status);
          43  +
        let payload =
          44  +
            crate::protocol_serde::shape_datetime_offsets_output::ser_datetime_offsets_output_output_output(&output)?
          45  +
        ;
          46  +
        let content_length = payload.len();
          47  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          48  +
            builder,
          49  +
            ::http::header::CONTENT_LENGTH,
          50  +
            content_length,
          51  +
        );
          52  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          53  +
        builder.body(body)?
          54  +
    })
          55  +
}

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

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

tmp-codegen-diff/codegen-server-test/json_rpc11-http0x/rust-server-codegen/src/protocol_serde/shape_empty_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_empty_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::EmptyOperationInput,
           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_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_empty_operation_http_response(
          28  +
    #[allow(unused_variables)] output: crate::output::EmptyOperationOutput,
          29  +
) -> std::result::Result<
          30  +
    ::aws_smithy_legacy_http_server::response::Response,
          31  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::ResponseRejection,
          32  +
> {
          33  +
    Ok({
          34  +
        #[allow(unused_mut)]
          35  +
        let mut builder = ::http::Response::builder();
          36  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          37  +
            builder,
          38  +
            ::http::header::CONTENT_TYPE,
          39  +
            "application/x-amz-json-1.1",
          40  +
        );
          41  +
        let http_status: u16 = 200;
          42  +
        builder = builder.status(http_status);
          43  +
        let payload = "";
          44  +
        let content_length = payload.len();
          45  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          46  +
            builder,
          47  +
            ::http::header::CONTENT_LENGTH,
          48  +
            content_length,
          49  +
        );
          50  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          51  +
        builder.body(body)?
          52  +
    })
          53  +
}

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

@@ -0,1 +0,37 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_empty_struct<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<crate::model::EmptyStruct>,
           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::empty_struct::Builder::default();
          21  +
            ::aws_smithy_json::deserialize::token::skip_to_end(tokens)?;
          22  +
            Ok(Some(builder.build()))
          23  +
        }
          24  +
        _ => Err(
          25  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          26  +
                "expected start object or null",
          27  +
            ),
          28  +
        ),
          29  +
    }
          30  +
}
          31  +
          32  +
pub fn ser_empty_struct(
          33  +
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          34  +
    #[allow(unused_variables)] input: &crate::model::EmptyStruct,
          35  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          36  +
    Ok(())
          37  +
}

tmp-codegen-diff/codegen-server-test/json_rpc11-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.1",
          40  +
        );
          41  +
        let http_status: u16 = 200;
          42  +
        builder = builder.status(http_status);
          43  +
        let payload = "";
          44  +
        let content_length = payload.len();
          45  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          46  +
            builder,
          47  +
            ::http::header::CONTENT_LENGTH,
          48  +
            content_length,
          49  +
        );
          50  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          51  +
        builder.body(body)?
          52  +
    })
          53  +
}

tmp-codegen-diff/codegen-server-test/json_rpc11-http0x/rust-server-codegen/src/protocol_serde/shape_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.1"),
          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.1",
          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.1",
          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  +
}

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

@@ -0,1 +0,58 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_error_with_members_error(
           3  +
    value: &crate::error::ErrorWithMembers,
           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_error_with_members::ser_error_with_members(&mut object, value)?;
           8  +
    object.key("__type").string("ErrorWithMembers");
           9  +
    object.finish();
          10  +
    Ok(out)
          11  +
}
          12  +
          13  +
pub fn ser_error_with_members(
          14  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          15  +
    input: &crate::error::ErrorWithMembers,
          16  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          17  +
    if let Some(var_1) = &input.code {
          18  +
        object.key("Code").string(var_1.as_str());
          19  +
    }
          20  +
    if let Some(var_2) = &input.complex_data {
          21  +
        #[allow(unused_mut)]
          22  +
        let mut object_3 = object.key("ComplexData").start_object();
          23  +
        crate::protocol_serde::shape_kitchen_sink::ser_kitchen_sink(&mut object_3, var_2)?;
          24  +
        object_3.finish();
          25  +
    }
          26  +
    if let Some(var_4) = &input.integer_field {
          27  +
        object.key("IntegerField").number(
          28  +
            #[allow(clippy::useless_conversion)]
          29  +
            ::aws_smithy_types::Number::NegInt((*var_4).into()),
          30  +
        );
          31  +
    }
          32  +
    if let Some(var_5) = &input.list_field {
          33  +
        let mut array_6 = object.key("ListField").start_array();
          34  +
        for item_7 in var_5 {
          35  +
            {
          36  +
                array_6.value().string(item_7.as_str());
          37  +
            }
          38  +
        }
          39  +
        array_6.finish();
          40  +
    }
          41  +
    if let Some(var_8) = &input.map_field {
          42  +
        #[allow(unused_mut)]
          43  +
        let mut object_9 = object.key("MapField").start_object();
          44  +
        for (key_10, value_11) in var_8 {
          45  +
            {
          46  +
                object_9.key(key_10.as_str()).string(value_11.as_str());
          47  +
            }
          48  +
        }
          49  +
        object_9.finish();
          50  +
    }
          51  +
    if let Some(var_12) = &input.message {
          52  +
        object.key("Message").string(var_12.as_str());
          53  +
    }
          54  +
    if let Some(var_13) = &input.string_field {
          55  +
        object.key("StringField").string(var_13.as_str());
          56  +
    }
          57  +
    Ok(())
          58  +
}

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

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

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

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

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

@@ -0,1 +0,62 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_foo_enum_map<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<crate::unconstrained::foo_enum_map_unconstrained::FooEnumMapUnconstrained>,
           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::foo_enum_map_unconstrained::FooEnumMapUnconstrained(map),
          54  +
            ))
          55  +
        }
          56  +
        _ => Err(
          57  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          58  +
                "expected start object or null",
          59  +
            ),
          60  +
        ),
          61  +
    }
          62  +
}

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

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