Server Test

Server Test

rev. ee474c7509d7728618c23068f3741e8e5b339ef9

Files changed:

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

@@ -0,1 +0,51 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_constrained_shapes_only_in_output_operation_output_output_output(
           3  +
    value: &crate::output::ConstrainedShapesOnlyInOutputOperationOutput,
           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_constrained_shapes_only_in_output_operation_output::ser_constrained_shapes_only_in_output_operation_output_output(&mut object, value)?;
           8  +
    object.finish();
           9  +
    Ok(out)
          10  +
}
          11  +
          12  +
pub fn ser_constrained_shapes_only_in_output_operation_output_output(
          13  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          14  +
    input: &crate::output::ConstrainedShapesOnlyInOutputOperationOutput,
          15  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          16  +
    if let Some(var_1) = &input.list {
          17  +
        let mut array_2 = object.key("list").start_array();
          18  +
        for item_3 in &var_1.0 {
          19  +
            {
          20  +
                #[allow(unused_mut)]
          21  +
                let mut object_4 = array_2.value().start_object();
          22  +
                crate::protocol_serde::shape_constrained_union_in_output::ser_constrained_union_in_output(&mut object_4, item_3)?;
          23  +
                object_4.finish();
          24  +
            }
          25  +
        }
          26  +
        array_2.finish();
          27  +
    }
          28  +
    if let Some(var_5) = &input.map {
          29  +
        #[allow(unused_mut)]
          30  +
        let mut object_6 = object.key("map").start_object();
          31  +
        for (key_7, value_8) in &var_5.0 {
          32  +
            {
          33  +
                #[allow(unused_mut)]
          34  +
                let mut object_9 = object_6.key(key_7.as_str()).start_object();
          35  +
                crate::protocol_serde::shape_transitively_constrained_structure_in_output::ser_transitively_constrained_structure_in_output(&mut object_9, value_8)?;
          36  +
                object_9.finish();
          37  +
            }
          38  +
        }
          39  +
        object_6.finish();
          40  +
    }
          41  +
    if let Some(var_10) = &input.union {
          42  +
        #[allow(unused_mut)]
          43  +
        let mut object_11 = object.key("union").start_object();
          44  +
        crate::protocol_serde::shape_constrained_union_in_output::ser_constrained_union_in_output(
          45  +
            &mut object_11,
          46  +
            var_10,
          47  +
        )?;
          48  +
        object_11.finish();
          49  +
    }
          50  +
    Ok(())
          51  +
}

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

@@ -0,1 +0,144 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_constrained_shapes_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::ConstrainedShapesOperationInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
           8  +
>
           9  +
where
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          11  +
    B::Data: Send,
          12  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          14  +
{
          15  +
    Ok({
          16  +
        #[allow(unused_mut)]
          17  +
        let mut input = crate::input::constrained_shapes_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/json"),
          27  +
            )?;
          28  +
            input = crate::protocol_serde::shape_constrained_shapes_operation::de_constrained_shapes_operation(bytes.as_ref(), input)?;
          29  +
        }
          30  +
        input.build()?
          31  +
    })
          32  +
}
          33  +
          34  +
#[allow(clippy::unnecessary_wraps)]
          35  +
pub fn ser_constrained_shapes_operation_http_response(
          36  +
    #[allow(unused_variables)] output: crate::output::ConstrainedShapesOperationOutput,
          37  +
) -> std::result::Result<
          38  +
    ::aws_smithy_legacy_http_server::response::Response,
          39  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::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/json",
          48  +
        );
          49  +
        let http_status: u16 = 200;
          50  +
        builder = builder.status(http_status);
          51  +
        let payload =
          52  +
            crate::protocol_serde::shape_constrained_shapes_operation_output::ser_constrained_shapes_operation_output_output_output(&output)?
          53  +
        ;
          54  +
        let content_length = payload.len();
          55  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          56  +
            builder,
          57  +
            ::http::header::CONTENT_LENGTH,
          58  +
            content_length,
          59  +
        );
          60  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          61  +
        builder.body(body)?
          62  +
    })
          63  +
}
          64  +
          65  +
#[allow(clippy::unnecessary_wraps)]
          66  +
pub fn ser_constrained_shapes_operation_http_error(
          67  +
    error: &crate::error::ConstrainedShapesOperationError,
          68  +
) -> std::result::Result<
          69  +
    ::aws_smithy_legacy_http_server::response::Response,
          70  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          71  +
> {
          72  +
    Ok({
          73  +
        match error {
          74  +
            crate::error::ConstrainedShapesOperationError::ValidationException(output) => {
          75  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
          76  +
                #[allow(unused_mut)]
          77  +
                let mut builder = ::http::Response::builder();
          78  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          79  +
                    builder,
          80  +
                    ::http::header::CONTENT_TYPE,
          81  +
                    "application/json",
          82  +
                );
          83  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          84  +
                    builder,
          85  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
          86  +
                    "ValidationException",
          87  +
                );
          88  +
                let content_length = payload.len();
          89  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          90  +
                    builder,
          91  +
                    ::http::header::CONTENT_LENGTH,
          92  +
                    content_length,
          93  +
                );
          94  +
                builder
          95  +
                    .status(400)
          96  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
          97  +
            }
          98  +
        }
          99  +
    })
         100  +
}
         101  +
         102  +
pub(crate) fn de_constrained_shapes_operation(
         103  +
    value: &[u8],
         104  +
    mut builder: crate::input::constrained_shapes_operation_input::Builder,
         105  +
) -> ::std::result::Result<
         106  +
    crate::input::constrained_shapes_operation_input::Builder,
         107  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
         108  +
> {
         109  +
    let mut tokens_owned =
         110  +
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
         111  +
            .peekable();
         112  +
    let tokens = &mut tokens_owned;
         113  +
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         114  +
    loop {
         115  +
        match tokens.next().transpose()? {
         116  +
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
         117  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         118  +
                match key.to_unescaped()?.as_ref() {
         119  +
                    "conA" => {
         120  +
                        if let Some(v) = crate::protocol_serde::shape_con_a::de_con_a(tokens)? {
         121  +
                            builder = builder.set_con_a(v);
         122  +
                        }
         123  +
                    }
         124  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         125  +
                }
         126  +
            }
         127  +
            other => {
         128  +
                return Err(
         129  +
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
         130  +
                        "expected object key or end object, found: {other:?}"
         131  +
                    )),
         132  +
                )
         133  +
            }
         134  +
        }
         135  +
    }
         136  +
    if tokens.next().is_some() {
         137  +
        return Err(
         138  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         139  +
                "found more JSON tokens after completing parsing",
         140  +
            ),
         141  +
        );
         142  +
    }
         143  +
    Ok(builder)
         144  +
}

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

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

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

@@ -0,1 +0,179 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_constrained_union<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<crate::unconstrained::constrained_union_unconstrained::ConstrainedUnionUnconstrained>,
           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  +
    let mut variant = None;
          17  +
    match tokens.next().transpose()? {
          18  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => return Ok(None),
          19  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => loop {
          20  +
            match tokens.next().transpose()? {
          21  +
                Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          22  +
                Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          23  +
                    if let ::std::option::Option::Some(::std::result::Result::Ok(
          24  +
                        ::aws_smithy_json::deserialize::Token::ValueNull { .. },
          25  +
                    )) = tokens.peek()
          26  +
                    {
          27  +
                        let _ = tokens.next().expect("peek returned a token")?;
          28  +
                        continue;
          29  +
                    }
          30  +
                    let key = key.to_unescaped()?;
          31  +
                    if key == "__type" {
          32  +
                        ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
          33  +
                        continue;
          34  +
                    }
          35  +
                    if variant.is_some() {
          36  +
                        return Err(
          37  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          38  +
                                "encountered mixed variants in union",
          39  +
                            ),
          40  +
                        );
          41  +
                    }
          42  +
                    variant = match key.as_ref() {
          43  +
                            "enumString" => {
          44  +
                                Some(crate::unconstrained::constrained_union_unconstrained::ConstrainedUnionUnconstrained::EnumString(
          45  +
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          46  +
                                        s.to_unescaped().map(|u|
          47  +
                                            u.into_owned()
          48  +
                                        )
          49  +
                                    ).transpose()?
          50  +
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'enumString' cannot be null"))?
          51  +
                                ))
          52  +
                            }
          53  +
                            "lengthString" => {
          54  +
                                Some(crate::unconstrained::constrained_union_unconstrained::ConstrainedUnionUnconstrained::LengthString(
          55  +
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          56  +
                                        s.to_unescaped().map(|u|
          57  +
                                            u.into_owned()
          58  +
                                        )
          59  +
                                    ).transpose()?
          60  +
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'lengthString' cannot be null"))?
          61  +
                                ))
          62  +
                            }
          63  +
                            "constrainedStructure" => {
          64  +
                                Some(crate::unconstrained::constrained_union_unconstrained::ConstrainedUnionUnconstrained::ConstrainedStructure(
          65  +
                                    crate::protocol_serde::shape_con_b::de_con_b(tokens)?
          66  +
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'constrainedStructure' cannot be null"))?
          67  +
                                ))
          68  +
                            }
          69  +
                            "conBList" => {
          70  +
                                Some(crate::unconstrained::constrained_union_unconstrained::ConstrainedUnionUnconstrained::ConBList(
          71  +
                                    crate::protocol_serde::shape_con_b_list::de_con_b_list(tokens)?
          72  +
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'conBList' cannot be null"))?
          73  +
                                ))
          74  +
                            }
          75  +
                            "conBSet" => {
          76  +
                                Some(crate::unconstrained::constrained_union_unconstrained::ConstrainedUnionUnconstrained::ConBSet(
          77  +
                                    crate::protocol_serde::shape_con_b_set::de_con_b_set(tokens)?
          78  +
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'conBSet' cannot be null"))?
          79  +
                                ))
          80  +
                            }
          81  +
                            "conBMap" => {
          82  +
                                Some(crate::unconstrained::constrained_union_unconstrained::ConstrainedUnionUnconstrained::ConBMap(
          83  +
                                    crate::protocol_serde::shape_con_b_map::de_con_b_map(tokens)?
          84  +
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'conBMap' cannot be null"))?
          85  +
                                ))
          86  +
                            }
          87  +
                            variant => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("unexpected union variant: {variant}")))
          88  +
                        };
          89  +
                }
          90  +
                other => {
          91  +
                    return Err(
          92  +
                        ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
          93  +
                            "expected object key or end object, found: {other:?}"
          94  +
                        )),
          95  +
                    )
          96  +
                }
          97  +
            }
          98  +
        },
          99  +
        _ => {
         100  +
            return Err(
         101  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         102  +
                    "expected start object or null",
         103  +
                ),
         104  +
            )
         105  +
        }
         106  +
    }
         107  +
    if variant.is_none() {
         108  +
        return Err(
         109  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         110  +
                "Union did not contain a valid variant.",
         111  +
            ),
         112  +
        );
         113  +
    }
         114  +
    Ok(variant)
         115  +
}
         116  +
         117  +
pub fn ser_constrained_union(
         118  +
    object_71: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
         119  +
    input: &crate::model::ConstrainedUnion,
         120  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
         121  +
    match input {
         122  +
        crate::model::ConstrainedUnion::EnumString(inner) => {
         123  +
            object_71.key("enumString").string(inner.as_str());
         124  +
        }
         125  +
        crate::model::ConstrainedUnion::LengthString(inner) => {
         126  +
            object_71.key("lengthString").string(inner.as_str());
         127  +
        }
         128  +
        crate::model::ConstrainedUnion::ConstrainedStructure(inner) => {
         129  +
            #[allow(unused_mut)]
         130  +
            let mut object_1 = object_71.key("constrainedStructure").start_object();
         131  +
            crate::protocol_serde::shape_con_b::ser_con_b(&mut object_1, inner)?;
         132  +
            object_1.finish();
         133  +
        }
         134  +
        crate::model::ConstrainedUnion::ConBList(inner) => {
         135  +
            let mut array_2 = object_71.key("conBList").start_array();
         136  +
            for item_3 in inner {
         137  +
                {
         138  +
                    let mut array_4 = array_2.value().start_array();
         139  +
                    for item_5 in item_3 {
         140  +
                        {
         141  +
                            #[allow(unused_mut)]
         142  +
                            let mut object_6 = array_4.value().start_object();
         143  +
                            crate::protocol_serde::shape_con_b::ser_con_b(&mut object_6, item_5)?;
         144  +
                            object_6.finish();
         145  +
                        }
         146  +
                    }
         147  +
                    array_4.finish();
         148  +
                }
         149  +
            }
         150  +
            array_2.finish();
         151  +
        }
         152  +
        crate::model::ConstrainedUnion::ConBSet(inner) => {
         153  +
            let mut array_7 = object_71.key("conBSet").start_array();
         154  +
            for item_8 in &inner.0 {
         155  +
                {
         156  +
                    let mut array_9 = array_7.value().start_array();
         157  +
                    for item_10 in &item_8.0 {
         158  +
                        {
         159  +
                            array_9.value().string(item_10.as_str());
         160  +
                        }
         161  +
                    }
         162  +
                    array_9.finish();
         163  +
                }
         164  +
            }
         165  +
            array_7.finish();
         166  +
        }
         167  +
        crate::model::ConstrainedUnion::ConBMap(inner) => {
         168  +
            #[allow(unused_mut)]
         169  +
            let mut object_11 = object_71.key("conBMap").start_object();
         170  +
            for (key_12, value_13) in &inner.0 {
         171  +
                {
         172  +
                    object_11.key(key_12.as_str()).string(value_13.as_str());
         173  +
                }
         174  +
            }
         175  +
            object_11.finish();
         176  +
        }
         177  +
    }
         178  +
    Ok(())
         179  +
}

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

@@ -0,1 +0,15 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_constrained_union_in_output(
           3  +
    object_4: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
           4  +
    input: &crate::model::ConstrainedUnionInOutput,
           5  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    match input {
           7  +
        crate::model::ConstrainedUnionInOutput::Structure(inner) => {
           8  +
            #[allow(unused_mut)]
           9  +
            let mut object_1 = object_4.key("structure").start_object();
          10  +
            crate::protocol_serde::shape_transitively_constrained_structure_in_output::ser_transitively_constrained_structure_in_output(&mut object_1, inner)?;
          11  +
            object_1.finish();
          12  +
        }
          13  +
    }
          14  +
    Ok(())
          15  +
}

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

@@ -0,1 +0,16 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_regular_message_payload(
           3  +
    input: &crate::model::EventStreamRegularMessage,
           4  +
) -> std::result::Result<
           5  +
    ::std::vec::Vec<u8>,
           6  +
    ::aws_smithy_types::error::operation::SerializationError,
           7  +
> {
           8  +
    let mut out = String::new();
           9  +
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
          10  +
    crate::protocol_serde::shape_event_stream_regular_message::ser_event_stream_regular_message(
          11  +
        &mut object,
          12  +
        input,
          13  +
    )?;
          14  +
    object.finish();
          15  +
    Ok(out.into_bytes())
          16  +
}

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

@@ -0,1 +0,71 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_event_stream_error_message_error(
           3  +
    value: &crate::error::EventStreamErrorMessage,
           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_event_stream_error_message::ser_event_stream_error_message(
           8  +
        &mut object,
           9  +
        value,
          10  +
    )?;
          11  +
    object.finish();
          12  +
    Ok(out)
          13  +
}
          14  +
          15  +
pub fn ser_event_stream_error_message(
          16  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          17  +
    input: &crate::error::EventStreamErrorMessage,
          18  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          19  +
    if let Some(var_1) = &input.message_content {
          20  +
        object.key("messageContent").string(var_1.as_str());
          21  +
    }
          22  +
    Ok(())
          23  +
}
          24  +
          25  +
pub(crate) fn de_event_stream_error_message_json_err(
          26  +
    value: &[u8],
          27  +
    mut builder: crate::error::event_stream_error_message::Builder,
          28  +
) -> ::std::result::Result<
          29  +
    crate::error::event_stream_error_message::Builder,
          30  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
          31  +
> {
          32  +
    let mut tokens_owned =
          33  +
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
          34  +
            .peekable();
          35  +
    let tokens = &mut tokens_owned;
          36  +
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
          37  +
    loop {
          38  +
        match tokens.next().transpose()? {
          39  +
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          40  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          41  +
                match key.to_unescaped()?.as_ref() {
          42  +
                    "messageContent" => {
          43  +
                        builder = builder.set_message_content(
          44  +
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
          45  +
                                tokens.next(),
          46  +
                            )?
          47  +
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
          48  +
                            .transpose()?,
          49  +
                        );
          50  +
                    }
          51  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          52  +
                }
          53  +
            }
          54  +
            other => {
          55  +
                return Err(
          56  +
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
          57  +
                        "expected object key or end object, found: {other:?}"
          58  +
                    )),
          59  +
                )
          60  +
            }
          61  +
        }
          62  +
    }
          63  +
    if tokens.next().is_some() {
          64  +
        return Err(
          65  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          66  +
                "found more JSON tokens after completing parsing",
          67  +
            ),
          68  +
        );
          69  +
    }
          70  +
    Ok(builder)
          71  +
}

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

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

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

@@ -0,1 +0,137 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_event_streams_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::EventStreamsOperationInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
           8  +
>
           9  +
where
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          11  +
    B: Into<::aws_smithy_types::byte_stream::ByteStream>,
          12  +
    B::Data: Send,
          13  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          14  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          15  +
{
          16  +
    Ok({
          17  +
        #[allow(unused_mut)]
          18  +
        let mut input = crate::input::event_streams_operation_input::Builder::default();
          19  +
        #[allow(unused_variables)]
          20  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          21  +
            uri, headers, body, ..
          22  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          23  +
        if let Some(value) = {
          24  +
            let mut receiver =
          25  +
                crate::protocol_serde::shape_event_streams_operation_input::de_events_payload(
          26  +
                    &mut body.into().into_inner(),
          27  +
                )?;
          28  +
            if let Some(_initial_event) = receiver
          29  +
                                                .try_recv_initial(::aws_smithy_legacy_http::event_stream::InitialMessageType::Request)
          30  +
                                                .await
          31  +
                                                .map_err(
          32  +
                                                    |ev_error| ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection::ConstraintViolation(
          33  +
                                                        #[allow(clippy::useless_conversion)]
          34  +
                                                        format!("{ev_error}").into()
          35  +
                                                    )
          36  +
                                                )? {
          37  +
                                                
          38  +
                                            }
          39  +
            Some(receiver)
          40  +
        } {
          41  +
            input = input.set_events(value)
          42  +
        }
          43  +
        input.build()?
          44  +
    })
          45  +
}
          46  +
          47  +
#[allow(clippy::unnecessary_wraps)]
          48  +
pub fn ser_event_streams_operation_http_response(
          49  +
    #[allow(unused_variables)] output: crate::output::EventStreamsOperationOutput,
          50  +
) -> std::result::Result<
          51  +
    ::aws_smithy_legacy_http_server::response::Response,
          52  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          53  +
> {
          54  +
    Ok({
          55  +
        #[allow(unused_mut)]
          56  +
        let mut builder = ::http::Response::builder();
          57  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          58  +
            builder,
          59  +
            ::http::header::CONTENT_TYPE,
          60  +
            "application/vnd.amazon.eventstream",
          61  +
        );
          62  +
        let http_status: u16 = 200;
          63  +
        builder = builder.status(http_status);
          64  +
        let body = ::aws_smithy_legacy_http_server::body::boxed(
          65  +
            ::aws_smithy_legacy_http_server::body::Body::wrap_stream({
          66  +
                let error_marshaller = crate::event_stream_serde::EventErrorMarshaller::new();
          67  +
                let marshaller = crate::event_stream_serde::EventMarshaller::new();
          68  +
                let signer = ::aws_smithy_eventstream::frame::NoOpSigner {};
          69  +
                output
          70  +
                    .events
          71  +
                    .into_body_stream(marshaller, error_marshaller, signer)
          72  +
            }),
          73  +
        );
          74  +
        builder.body(body)?
          75  +
    })
          76  +
}
          77  +
          78  +
#[allow(clippy::unnecessary_wraps)]
          79  +
pub fn ser_event_streams_operation_http_error(
          80  +
    error: &crate::error::EventStreamsOperationError,
          81  +
) -> std::result::Result<
          82  +
    ::aws_smithy_legacy_http_server::response::Response,
          83  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          84  +
> {
          85  +
    Ok({
          86  +
        match error {
          87  +
            crate::error::EventStreamsOperationError::ValidationException(output) => {
          88  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
          89  +
                #[allow(unused_mut)]
          90  +
                let mut builder = ::http::Response::builder();
          91  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          92  +
                    builder,
          93  +
                    ::http::header::CONTENT_TYPE,
          94  +
                    "application/vnd.amazon.eventstream",
          95  +
                );
          96  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          97  +
                    builder,
          98  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
          99  +
                    "ValidationException",
         100  +
                );
         101  +
                let content_length = payload.len();
         102  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         103  +
                    builder,
         104  +
                    ::http::header::CONTENT_LENGTH,
         105  +
                    content_length,
         106  +
                );
         107  +
                builder
         108  +
                    .status(400)
         109  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         110  +
            }
         111  +
            crate::error::EventStreamsOperationError::EventStreamErrorMessage(output) => {
         112  +
                let payload = crate::protocol_serde::shape_event_stream_error_message::ser_event_stream_error_message_error(output)?;
         113  +
                #[allow(unused_mut)]
         114  +
                let mut builder = ::http::Response::builder();
         115  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         116  +
                    builder,
         117  +
                    ::http::header::CONTENT_TYPE,
         118  +
                    "application/vnd.amazon.eventstream",
         119  +
                );
         120  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         121  +
                    builder,
         122  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         123  +
                    "EventStreamErrorMessage",
         124  +
                );
         125  +
                let content_length = payload.len();
         126  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         127  +
                    builder,
         128  +
                    ::http::header::CONTENT_LENGTH,
         129  +
                    content_length,
         130  +
                );
         131  +
                builder
         132  +
                    .status(500)
         133  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         134  +
            }
         135  +
        }
         136  +
    })
         137  +
}

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

@@ -0,1 +0,12 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn de_events_payload(
           3  +
    body: &mut ::aws_smithy_types::body::SdkBody,
           4  +
) -> std::result::Result<
           5  +
    ::aws_smithy_legacy_http::event_stream::Receiver<crate::model::Event, crate::error::EventError>,
           6  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
           7  +
> {
           8  +
    let unmarshaller = crate::event_stream_serde::EventUnmarshaller::new();
           9  +
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
          10  +
    let receiver = ::aws_smithy_legacy_http::event_stream::Receiver::new(unmarshaller, body);
          11  +
    Ok(receiver)
          12  +
}

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

@@ -0,1 +0,125 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_http_prefix_headers_targeting_length_map_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::HttpPrefixHeadersTargetingLengthMapOperationInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
           8  +
>
           9  +
where
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          11  +
    B::Data: Send,
          12  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          14  +
{
          15  +
    Ok({
          16  +
        #[allow(unused_mut)]
          17  +
        let mut input = crate::input::http_prefix_headers_targeting_length_map_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  +
        if let Some(value) = crate::protocol_serde::shape_http_prefix_headers_targeting_length_map_operation_input::de_length_map_prefix_header(&headers)? {
          23  +
                                input = input.set_length_map(Some(value))
          24  +
                            }
          25  +
        input.build()?
          26  +
    })
          27  +
}
          28  +
          29  +
#[allow(clippy::unnecessary_wraps)]
          30  +
pub fn ser_http_prefix_headers_targeting_length_map_operation_http_response(
          31  +
    #[allow(unused_variables)]
          32  +
    output: crate::output::HttpPrefixHeadersTargetingLengthMapOperationOutput,
          33  +
) -> std::result::Result<
          34  +
    ::aws_smithy_legacy_http_server::response::Response,
          35  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          36  +
> {
          37  +
    Ok({
          38  +
        #[allow(unused_mut)]
          39  +
        let mut builder = ::http::Response::builder();
          40  +
        builder = crate::protocol_serde::shape_http_prefix_headers_targeting_length_map_operation::ser_http_prefix_headers_targeting_length_map_operation_headers(&output, builder)?;
          41  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          42  +
            builder,
          43  +
            ::http::header::CONTENT_TYPE,
          44  +
            "application/json",
          45  +
        );
          46  +
        let http_status: u16 = 200;
          47  +
        builder = builder.status(http_status);
          48  +
        let payload =
          49  +
            crate::protocol_serde::shape_http_prefix_headers_targeting_length_map_operation_output::ser_http_prefix_headers_targeting_length_map_operation_output_output_output(&output)?
          50  +
        ;
          51  +
        let content_length = payload.len();
          52  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          53  +
            builder,
          54  +
            ::http::header::CONTENT_LENGTH,
          55  +
            content_length,
          56  +
        );
          57  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          58  +
        builder.body(body)?
          59  +
    })
          60  +
}
          61  +
          62  +
#[allow(clippy::unnecessary_wraps)]
          63  +
pub fn ser_http_prefix_headers_targeting_length_map_operation_http_error(
          64  +
    error: &crate::error::HttpPrefixHeadersTargetingLengthMapOperationError,
          65  +
) -> std::result::Result<
          66  +
    ::aws_smithy_legacy_http_server::response::Response,
          67  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          68  +
> {
          69  +
    Ok({
          70  +
        match error {
          71  +
            crate::error::HttpPrefixHeadersTargetingLengthMapOperationError::ValidationException(output) => {
          72  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
          73  +
                #[allow(unused_mut)]
          74  +
                let mut builder = ::http::Response::builder();
          75  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          76  +
                                builder,
          77  +
                                ::http::header::CONTENT_TYPE,
          78  +
                                "application/json",
          79  +
                            );
          80  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          81  +
                                builder,
          82  +
                                ::http::header::HeaderName::from_static("x-amzn-errortype"),
          83  +
                                "ValidationException",
          84  +
                            );
          85  +
                let content_length = payload.len();
          86  +
                            builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(builder, ::http::header::CONTENT_LENGTH, content_length);
          87  +
                builder.status(400).body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
          88  +
            }
          89  +
        }
          90  +
    })
          91  +
}
          92  +
          93  +
pub fn ser_http_prefix_headers_targeting_length_map_operation_headers(
          94  +
    input: &crate::output::HttpPrefixHeadersTargetingLengthMapOperationOutput,
          95  +
    mut builder: ::http::response::Builder,
          96  +
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
          97  +
{
          98  +
    if let ::std::option::Option::Some(inner_1) = &input.length_map {
          99  +
        {
         100  +
            let inner_1 = &inner_1.0;
         101  +
            for (k, v) in inner_1 {
         102  +
                use std::str::FromStr;
         103  +
                let header_name = ::http::HeaderName::from_str(&format!(
         104  +
                    "{}{}",
         105  +
                    "X-Prefix-Headers-LengthMap-", &k
         106  +
                ))
         107  +
                .map_err(|err| {
         108  +
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
         109  +
                        "length_map",
         110  +
                        format!("`{k}` cannot be used as a header name: {err}"),
         111  +
                    )
         112  +
                })?;
         113  +
                let header_value = v.as_str();
         114  +
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         115  +
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
         116  +
                        "length_map",
         117  +
                        format!("`{v}` cannot be used as a header value: {err}"),
         118  +
                    )
         119  +
                })?;
         120  +
                builder = builder.header(header_name, header_value);
         121  +
            }
         122  +
        }
         123  +
    }
         124  +
    Ok(builder)
         125  +
}

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

@@ -0,1 +0,27 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_length_map_prefix_header(
           3  +
    header_map: &::aws_smithy_runtime_api::http::Headers,
           4  +
) -> std::result::Result<
           5  +
    ::std::option::Option<crate::unconstrained::con_b_map_unconstrained::ConBMapUnconstrained>,
           6  +
    ::aws_smithy_legacy_http::header::ParseError,
           7  +
> {
           8  +
    let headers = ::aws_smithy_legacy_http::header::headers_for_prefix(
           9  +
        header_map.iter().map(|(k, _)| k),
          10  +
        "X-Prefix-Headers-LengthMap-",
          11  +
    );
          12  +
    let out: std::result::Result<_, _> = headers.map(|(key, header_name)| {
          13  +
                            let values = header_map.get_all(header_name);
          14  +
                            crate::protocol_serde::shape_http_prefix_headers_targeting_length_map_operation_input::de_length_map_inner(values).map(|v| (key.to_string(), v.expect(
          15  +
                                "we have checked there is at least one value for this header name; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues"
          16  +
                            )))
          17  +
                        }).collect();
          18  +
    let out = out.map(crate::unconstrained::con_b_map_unconstrained::ConBMapUnconstrained);
          19  +
    out.map(Some)
          20  +
}
          21  +
          22  +
pub fn de_length_map_inner<'a>(
          23  +
    headers: impl ::std::iter::Iterator<Item = &'a str>,
          24  +
) -> std::result::Result<Option<::std::string::String>, ::aws_smithy_legacy_http::header::ParseError>
          25  +
{
          26  +
    ::aws_smithy_legacy_http::header::one_or_none(headers)
          27  +
}

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

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

tmp-codegen-diff/codegen-server-test/constraints-http0x/rust-server-codegen/src/protocol_serde/shape_length_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_length_list<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<crate::unconstrained::length_list_unconstrained::LengthListUnconstrained>,
           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::length_list_unconstrained::LengthListUnconstrained(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/constraints-http0x/rust-server-codegen/src/protocol_serde/shape_length_list_of_pattern_string.rs

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