Server Test

Server Test

rev. 3c756f73b1f83a0eed4275d9d1e22df0b10b66fb

Files changed:

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

@@ -0,1 +0,451 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_length_list_pattern_string_header_header(header_map: &::aws_smithy_runtime_api::http::Headers) -> ::std::result::Result<::std::option::Option<crate::unconstrained::length_list_of_pattern_string_unconstrained::LengthListOfPatternStringUnconstrained>, ::aws_smithy_legacy_http::header::ParseError>{
           3  +
    let headers = header_map.get_all("X-Length-List-Pattern-String");
           4  +
    let var_1: Vec<::std::string::String> =
           5  +
        ::aws_smithy_legacy_http::header::read_many_from_str(headers)?;
           6  +
    Ok(if !var_1.is_empty() {
           7  +
        Some(crate::unconstrained::length_list_of_pattern_string_unconstrained::LengthListOfPatternStringUnconstrained(var_1))
           8  +
    } else {
           9  +
        None
          10  +
    })
          11  +
}
          12  +
          13  +
pub(crate) fn de_length_set_pattern_string_header_header(header_map: &::aws_smithy_runtime_api::http::Headers) -> ::std::result::Result<::std::option::Option<crate::unconstrained::length_set_of_pattern_string_unconstrained::LengthSetOfPatternStringUnconstrained>, ::aws_smithy_legacy_http::header::ParseError>{
          14  +
    let headers = header_map.get_all("X-Length-Set-Pattern-String");
          15  +
    let var_2: Vec<::std::string::String> =
          16  +
        ::aws_smithy_legacy_http::header::read_many_from_str(headers)?;
          17  +
    Ok(if !var_2.is_empty() {
          18  +
        Some(crate::unconstrained::length_set_of_pattern_string_unconstrained::LengthSetOfPatternStringUnconstrained(var_2))
          19  +
    } else {
          20  +
        None
          21  +
    })
          22  +
}
          23  +
          24  +
pub(crate) fn de_length_string_header_header(
          25  +
    header_map: &::aws_smithy_runtime_api::http::Headers,
          26  +
) -> ::std::result::Result<
          27  +
    ::std::option::Option<::std::string::String>,
          28  +
    ::aws_smithy_legacy_http::header::ParseError,
          29  +
> {
          30  +
    let headers = header_map.get_all("X-Length");
          31  +
    ::aws_smithy_legacy_http::header::one_or_none(headers)
          32  +
}
          33  +
          34  +
pub(crate) fn de_length_string_header_map_prefix_header(
          35  +
    header_map: &::aws_smithy_runtime_api::http::Headers,
          36  +
) -> std::result::Result<
          37  +
    ::std::option::Option<
          38  +
        crate::unconstrained::map_of_length_string_unconstrained::MapOfLengthStringUnconstrained,
          39  +
    >,
          40  +
    ::aws_smithy_legacy_http::header::ParseError,
          41  +
> {
          42  +
    let headers = ::aws_smithy_legacy_http::header::headers_for_prefix(
          43  +
        header_map.iter().map(|(k, _)| k),
          44  +
        "X-Length-String-Prefix-Headers-",
          45  +
    );
          46  +
    let out: std::result::Result<_, _> = headers.map(|(key, header_name)| {
          47  +
                            let values = header_map.get_all(header_name);
          48  +
                            crate::protocol_serde::shape_constrained_http_bound_shapes_operation_input::de_length_string_header_map_inner(values).map(|v| (key.to_string(), v.expect(
          49  +
                                "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"
          50  +
                            )))
          51  +
                        }).collect();
          52  +
    let out = out.map(
          53  +
        crate::unconstrained::map_of_length_string_unconstrained::MapOfLengthStringUnconstrained,
          54  +
    );
          55  +
    out.map(Some)
          56  +
}
          57  +
          58  +
pub(crate) fn de_length_string_set_header_header(
          59  +
    header_map: &::aws_smithy_runtime_api::http::Headers,
          60  +
) -> ::std::result::Result<
          61  +
    ::std::option::Option<
          62  +
        crate::unconstrained::set_of_length_string_unconstrained::SetOfLengthStringUnconstrained,
          63  +
    >,
          64  +
    ::aws_smithy_legacy_http::header::ParseError,
          65  +
> {
          66  +
    let headers = header_map.get_all("X-Length-Set");
          67  +
    let var_3: Vec<::std::string::String> =
          68  +
        ::aws_smithy_legacy_http::header::read_many_from_str(headers)?;
          69  +
    Ok(if !var_3.is_empty() {
          70  +
        Some(crate::unconstrained::set_of_length_string_unconstrained::SetOfLengthStringUnconstrained(var_3))
          71  +
    } else {
          72  +
        None
          73  +
    })
          74  +
}
          75  +
          76  +
pub(crate) fn de_list_length_string_header_header(
          77  +
    header_map: &::aws_smithy_runtime_api::http::Headers,
          78  +
) -> ::std::result::Result<
          79  +
    ::std::option::Option<
          80  +
        crate::unconstrained::list_of_length_string_unconstrained::ListOfLengthStringUnconstrained,
          81  +
    >,
          82  +
    ::aws_smithy_legacy_http::header::ParseError,
          83  +
> {
          84  +
    let headers = header_map.get_all("X-List-Length-String");
          85  +
    let var_4: Vec<::std::string::String> =
          86  +
        ::aws_smithy_legacy_http::header::read_many_from_str(headers)?;
          87  +
    Ok(if !var_4.is_empty() {
          88  +
        Some(crate::unconstrained::list_of_length_string_unconstrained::ListOfLengthStringUnconstrained(var_4))
          89  +
    } else {
          90  +
        None
          91  +
    })
          92  +
}
          93  +
          94  +
pub(crate) fn de_range_byte_header_header(
          95  +
    header_map: &::aws_smithy_runtime_api::http::Headers,
          96  +
) -> ::std::result::Result<::std::option::Option<i8>, ::aws_smithy_legacy_http::header::ParseError>
          97  +
{
          98  +
    let headers = header_map.get_all("X-Range-Byte");
          99  +
    let var_5 = ::aws_smithy_legacy_http::header::read_many_primitive::<i8>(headers)?;
         100  +
    if var_5.len() > 1 {
         101  +
        Err(::aws_smithy_legacy_http::header::ParseError::new(format!(
         102  +
            "expected one item but found {}",
         103  +
            var_5.len()
         104  +
        )))
         105  +
    } else {
         106  +
        let mut var_5 = var_5;
         107  +
        Ok(var_5.pop())
         108  +
    }
         109  +
}
         110  +
         111  +
pub(crate) fn de_range_byte_list_header_header(
         112  +
    header_map: &::aws_smithy_runtime_api::http::Headers,
         113  +
) -> ::std::result::Result<
         114  +
    ::std::option::Option<
         115  +
        crate::unconstrained::list_of_range_byte_unconstrained::ListOfRangeByteUnconstrained,
         116  +
    >,
         117  +
    ::aws_smithy_legacy_http::header::ParseError,
         118  +
> {
         119  +
    let headers = header_map.get_all("X-Range-Byte-List");
         120  +
    let var_6 = ::aws_smithy_legacy_http::header::read_many_primitive::<i8>(headers)?;
         121  +
    Ok(if !var_6.is_empty() {
         122  +
        Some(
         123  +
            crate::unconstrained::list_of_range_byte_unconstrained::ListOfRangeByteUnconstrained(
         124  +
                var_6,
         125  +
            ),
         126  +
        )
         127  +
    } else {
         128  +
        None
         129  +
    })
         130  +
}
         131  +
         132  +
pub(crate) fn de_range_byte_set_header_header(
         133  +
    header_map: &::aws_smithy_runtime_api::http::Headers,
         134  +
) -> ::std::result::Result<
         135  +
    ::std::option::Option<
         136  +
        crate::unconstrained::set_of_range_byte_unconstrained::SetOfRangeByteUnconstrained,
         137  +
    >,
         138  +
    ::aws_smithy_legacy_http::header::ParseError,
         139  +
> {
         140  +
    let headers = header_map.get_all("X-Range-Byte-Set");
         141  +
    let var_7 = ::aws_smithy_legacy_http::header::read_many_primitive::<i8>(headers)?;
         142  +
    Ok(if !var_7.is_empty() {
         143  +
        Some(
         144  +
            crate::unconstrained::set_of_range_byte_unconstrained::SetOfRangeByteUnconstrained(
         145  +
                var_7,
         146  +
            ),
         147  +
        )
         148  +
    } else {
         149  +
        None
         150  +
    })
         151  +
}
         152  +
         153  +
pub(crate) fn de_range_integer_header_header(
         154  +
    header_map: &::aws_smithy_runtime_api::http::Headers,
         155  +
) -> ::std::result::Result<::std::option::Option<i32>, ::aws_smithy_legacy_http::header::ParseError>
         156  +
{
         157  +
    let headers = header_map.get_all("X-Range-Integer");
         158  +
    let var_8 = ::aws_smithy_legacy_http::header::read_many_primitive::<i32>(headers)?;
         159  +
    if var_8.len() > 1 {
         160  +
        Err(::aws_smithy_legacy_http::header::ParseError::new(format!(
         161  +
            "expected one item but found {}",
         162  +
            var_8.len()
         163  +
        )))
         164  +
    } else {
         165  +
        let mut var_8 = var_8;
         166  +
        Ok(var_8.pop())
         167  +
    }
         168  +
}
         169  +
         170  +
pub(crate) fn de_range_integer_list_header_header(
         171  +
    header_map: &::aws_smithy_runtime_api::http::Headers,
         172  +
) -> ::std::result::Result<
         173  +
    ::std::option::Option<
         174  +
        crate::unconstrained::list_of_range_integer_unconstrained::ListOfRangeIntegerUnconstrained,
         175  +
    >,
         176  +
    ::aws_smithy_legacy_http::header::ParseError,
         177  +
> {
         178  +
    let headers = header_map.get_all("X-Range-Integer-List");
         179  +
    let var_9 = ::aws_smithy_legacy_http::header::read_many_primitive::<i32>(headers)?;
         180  +
    Ok(if !var_9.is_empty() {
         181  +
        Some(crate::unconstrained::list_of_range_integer_unconstrained::ListOfRangeIntegerUnconstrained(var_9))
         182  +
    } else {
         183  +
        None
         184  +
    })
         185  +
}
         186  +
         187  +
pub(crate) fn de_range_integer_set_header_header(
         188  +
    header_map: &::aws_smithy_runtime_api::http::Headers,
         189  +
) -> ::std::result::Result<
         190  +
    ::std::option::Option<
         191  +
        crate::unconstrained::set_of_range_integer_unconstrained::SetOfRangeIntegerUnconstrained,
         192  +
    >,
         193  +
    ::aws_smithy_legacy_http::header::ParseError,
         194  +
> {
         195  +
    let headers = header_map.get_all("X-Range-Integer-Set");
         196  +
    let var_10 = ::aws_smithy_legacy_http::header::read_many_primitive::<i32>(headers)?;
         197  +
    Ok(if !var_10.is_empty() {
         198  +
        Some(crate::unconstrained::set_of_range_integer_unconstrained::SetOfRangeIntegerUnconstrained(var_10))
         199  +
    } else {
         200  +
        None
         201  +
    })
         202  +
}
         203  +
         204  +
pub(crate) fn de_range_long_header_header(
         205  +
    header_map: &::aws_smithy_runtime_api::http::Headers,
         206  +
) -> ::std::result::Result<::std::option::Option<i64>, ::aws_smithy_legacy_http::header::ParseError>
         207  +
{
         208  +
    let headers = header_map.get_all("X-Range-Long");
         209  +
    let var_11 = ::aws_smithy_legacy_http::header::read_many_primitive::<i64>(headers)?;
         210  +
    if var_11.len() > 1 {
         211  +
        Err(::aws_smithy_legacy_http::header::ParseError::new(format!(
         212  +
            "expected one item but found {}",
         213  +
            var_11.len()
         214  +
        )))
         215  +
    } else {
         216  +
        let mut var_11 = var_11;
         217  +
        Ok(var_11.pop())
         218  +
    }
         219  +
}
         220  +
         221  +
pub(crate) fn de_range_long_list_header_header(
         222  +
    header_map: &::aws_smithy_runtime_api::http::Headers,
         223  +
) -> ::std::result::Result<
         224  +
    ::std::option::Option<
         225  +
        crate::unconstrained::list_of_range_long_unconstrained::ListOfRangeLongUnconstrained,
         226  +
    >,
         227  +
    ::aws_smithy_legacy_http::header::ParseError,
         228  +
> {
         229  +
    let headers = header_map.get_all("X-Range-Long-List");
         230  +
    let var_12 = ::aws_smithy_legacy_http::header::read_many_primitive::<i64>(headers)?;
         231  +
    Ok(if !var_12.is_empty() {
         232  +
        Some(
         233  +
            crate::unconstrained::list_of_range_long_unconstrained::ListOfRangeLongUnconstrained(
         234  +
                var_12,
         235  +
            ),
         236  +
        )
         237  +
    } else {
         238  +
        None
         239  +
    })
         240  +
}
         241  +
         242  +
pub(crate) fn de_range_long_set_header_header(
         243  +
    header_map: &::aws_smithy_runtime_api::http::Headers,
         244  +
) -> ::std::result::Result<
         245  +
    ::std::option::Option<
         246  +
        crate::unconstrained::set_of_range_long_unconstrained::SetOfRangeLongUnconstrained,
         247  +
    >,
         248  +
    ::aws_smithy_legacy_http::header::ParseError,
         249  +
> {
         250  +
    let headers = header_map.get_all("X-Range-Long-Set");
         251  +
    let var_13 = ::aws_smithy_legacy_http::header::read_many_primitive::<i64>(headers)?;
         252  +
    Ok(if !var_13.is_empty() {
         253  +
        Some(
         254  +
            crate::unconstrained::set_of_range_long_unconstrained::SetOfRangeLongUnconstrained(
         255  +
                var_13,
         256  +
            ),
         257  +
        )
         258  +
    } else {
         259  +
        None
         260  +
    })
         261  +
}
         262  +
         263  +
pub(crate) fn de_range_short_header_header(
         264  +
    header_map: &::aws_smithy_runtime_api::http::Headers,
         265  +
) -> ::std::result::Result<::std::option::Option<i16>, ::aws_smithy_legacy_http::header::ParseError>
         266  +
{
         267  +
    let headers = header_map.get_all("X-Range-Short");
         268  +
    let var_14 = ::aws_smithy_legacy_http::header::read_many_primitive::<i16>(headers)?;
         269  +
    if var_14.len() > 1 {
         270  +
        Err(::aws_smithy_legacy_http::header::ParseError::new(format!(
         271  +
            "expected one item but found {}",
         272  +
            var_14.len()
         273  +
        )))
         274  +
    } else {
         275  +
        let mut var_14 = var_14;
         276  +
        Ok(var_14.pop())
         277  +
    }
         278  +
}
         279  +
         280  +
pub(crate) fn de_range_short_list_header_header(
         281  +
    header_map: &::aws_smithy_runtime_api::http::Headers,
         282  +
) -> ::std::result::Result<
         283  +
    ::std::option::Option<
         284  +
        crate::unconstrained::list_of_range_short_unconstrained::ListOfRangeShortUnconstrained,
         285  +
    >,
         286  +
    ::aws_smithy_legacy_http::header::ParseError,
         287  +
> {
         288  +
    let headers = header_map.get_all("X-Range-Short-List");
         289  +
    let var_15 = ::aws_smithy_legacy_http::header::read_many_primitive::<i16>(headers)?;
         290  +
    Ok(if !var_15.is_empty() {
         291  +
        Some(
         292  +
            crate::unconstrained::list_of_range_short_unconstrained::ListOfRangeShortUnconstrained(
         293  +
                var_15,
         294  +
            ),
         295  +
        )
         296  +
    } else {
         297  +
        None
         298  +
    })
         299  +
}
         300  +
         301  +
pub(crate) fn de_range_short_set_header_header(
         302  +
    header_map: &::aws_smithy_runtime_api::http::Headers,
         303  +
) -> ::std::result::Result<
         304  +
    ::std::option::Option<
         305  +
        crate::unconstrained::set_of_range_short_unconstrained::SetOfRangeShortUnconstrained,
         306  +
    >,
         307  +
    ::aws_smithy_legacy_http::header::ParseError,
         308  +
> {
         309  +
    let headers = header_map.get_all("X-Range-Short-Set");
         310  +
    let var_16 = ::aws_smithy_legacy_http::header::read_many_primitive::<i16>(headers)?;
         311  +
    Ok(if !var_16.is_empty() {
         312  +
        Some(
         313  +
            crate::unconstrained::set_of_range_short_unconstrained::SetOfRangeShortUnconstrained(
         314  +
                var_16,
         315  +
            ),
         316  +
        )
         317  +
    } else {
         318  +
        None
         319  +
    })
         320  +
}
         321  +
         322  +
pub fn de_range_integer_label(
         323  +
    value: &str,
         324  +
) -> std::result::Result<
         325  +
    i32,
         326  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
         327  +
> {
         328  +
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
         329  +
    Ok(value)
         330  +
}
         331  +
         332  +
pub fn de_range_short_label(
         333  +
    value: &str,
         334  +
) -> std::result::Result<
         335  +
    i16,
         336  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
         337  +
> {
         338  +
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
         339  +
    Ok(value)
         340  +
}
         341  +
         342  +
pub fn de_range_long_label(
         343  +
    value: &str,
         344  +
) -> std::result::Result<
         345  +
    i64,
         346  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
         347  +
> {
         348  +
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
         349  +
    Ok(value)
         350  +
}
         351  +
         352  +
pub fn de_range_byte_label(
         353  +
    value: &str,
         354  +
) -> std::result::Result<
         355  +
    i8,
         356  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
         357  +
> {
         358  +
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
         359  +
    Ok(value)
         360  +
}
         361  +
         362  +
pub fn de_length_string_label(
         363  +
    value: &str,
         364  +
) -> std::result::Result<
         365  +
    ::std::string::String,
         366  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
         367  +
> {
         368  +
    let value = ::percent_encoding::percent_decode_str(value)
         369  +
        .decode_utf8()?
         370  +
        .into_owned();
         371  +
    Ok(value)
         372  +
}
         373  +
         374  +
pub fn de_enum_string_label(
         375  +
    value: &str,
         376  +
) -> std::result::Result<
         377  +
    ::std::string::String,
         378  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
         379  +
> {
         380  +
    let value = ::percent_encoding::percent_decode_str(value)
         381  +
        .decode_utf8()?
         382  +
        .into_owned();
         383  +
    Ok(value)
         384  +
}
         385  +
         386  +
pub fn de_enum_string_query(
         387  +
    value: &str,
         388  +
) -> std::result::Result<
         389  +
    ::std::option::Option<::std::string::String>,
         390  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
         391  +
> {
         392  +
    let value = value.to_owned();
         393  +
    Ok(Some(value))
         394  +
}
         395  +
         396  +
pub fn de_length_string_query(
         397  +
    value: &str,
         398  +
) -> std::result::Result<
         399  +
    ::std::option::Option<::std::string::String>,
         400  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
         401  +
> {
         402  +
    let value = value.to_owned();
         403  +
    Ok(Some(value))
         404  +
}
         405  +
         406  +
pub fn de_range_byte_query(
         407  +
    value: &str,
         408  +
) -> std::result::Result<
         409  +
    i8,
         410  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
         411  +
> {
         412  +
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
         413  +
    Ok(value)
         414  +
}
         415  +
         416  +
pub fn de_range_integer_query(
         417  +
    value: &str,
         418  +
) -> std::result::Result<
         419  +
    i32,
         420  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
         421  +
> {
         422  +
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
         423  +
    Ok(value)
         424  +
}
         425  +
         426  +
pub fn de_range_long_query(
         427  +
    value: &str,
         428  +
) -> std::result::Result<
         429  +
    i64,
         430  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
         431  +
> {
         432  +
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
         433  +
    Ok(value)
         434  +
}
         435  +
         436  +
pub fn de_range_short_query(
         437  +
    value: &str,
         438  +
) -> std::result::Result<
         439  +
    i16,
         440  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
         441  +
> {
         442  +
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
         443  +
    Ok(value)
         444  +
}
         445  +
         446  +
pub fn de_length_string_header_map_inner<'a>(
         447  +
    headers: impl ::std::iter::Iterator<Item = &'a str>,
         448  +
) -> std::result::Result<Option<::std::string::String>, ::aws_smithy_legacy_http::header::ParseError>
         449  +
{
         450  +
    ::aws_smithy_legacy_http::header::one_or_none(headers)
         451  +
}

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

@@ -0,1 +0,213 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_constrained_http_bound_shapes_operation_output_output_output(
           3  +
    value: &crate::output::ConstrainedHttpBoundShapesOperationOutput,
           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_http_bound_shapes_operation_output::ser_constrained_http_bound_shapes_operation_output_output(&mut object, value)?;
           8  +
    object.finish();
           9  +
    Ok(out)
          10  +
}
          11  +
          12  +
pub fn ser_constrained_http_bound_shapes_operation_output_output(
          13  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          14  +
    input: &crate::output::ConstrainedHttpBoundShapesOperationOutput,
          15  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          16  +
    {
          17  +
        object
          18  +
            .key("enumStringLabel")
          19  +
            .string(input.enum_string_label.as_str());
          20  +
    }
          21  +
    if let Some(var_1) = &input.enum_string_list_query {
          22  +
        let mut array_2 = object.key("enumStringListQuery").start_array();
          23  +
        for item_3 in var_1 {
          24  +
            {
          25  +
                array_2.value().string(item_3.as_str());
          26  +
            }
          27  +
        }
          28  +
        array_2.finish();
          29  +
    }
          30  +
    if let Some(var_4) = &input.enum_string_query {
          31  +
        object.key("enumStringQuery").string(var_4.as_str());
          32  +
    }
          33  +
    if let Some(var_5) = &input.length_list_pattern_string_query {
          34  +
        let mut array_6 = object.key("lengthListPatternStringQuery").start_array();
          35  +
        for item_7 in &var_5.0 {
          36  +
            {
          37  +
                array_6.value().string(item_7.as_str());
          38  +
            }
          39  +
        }
          40  +
        array_6.finish();
          41  +
    }
          42  +
    {
          43  +
        object
          44  +
            .key("lengthStringLabel")
          45  +
            .string(input.length_string_label.as_str());
          46  +
    }
          47  +
    if let Some(var_8) = &input.length_string_list_query {
          48  +
        let mut array_9 = object.key("lengthStringListQuery").start_array();
          49  +
        for item_10 in var_8 {
          50  +
            {
          51  +
                array_9.value().string(item_10.as_str());
          52  +
            }
          53  +
        }
          54  +
        array_9.finish();
          55  +
    }
          56  +
    if let Some(var_11) = &input.length_string_query {
          57  +
        object.key("lengthStringQuery").string(var_11.as_str());
          58  +
    }
          59  +
    if let Some(var_12) = &input.length_string_set_query {
          60  +
        let mut array_13 = object.key("lengthStringSetQuery").start_array();
          61  +
        for item_14 in &var_12.0 {
          62  +
            {
          63  +
                array_13.value().string(item_14.as_str());
          64  +
            }
          65  +
        }
          66  +
        array_13.finish();
          67  +
    }
          68  +
    {
          69  +
        object.key("rangeByteLabel").number(
          70  +
            #[allow(clippy::useless_conversion)]
          71  +
            ::aws_smithy_types::Number::NegInt((input.range_byte_label.0).into()),
          72  +
        );
          73  +
    }
          74  +
    if let Some(var_15) = &input.range_byte_list_query {
          75  +
        let mut array_16 = object.key("rangeByteListQuery").start_array();
          76  +
        for item_17 in var_15 {
          77  +
            {
          78  +
                array_16.value().number(
          79  +
                    #[allow(clippy::useless_conversion)]
          80  +
                    ::aws_smithy_types::Number::NegInt((item_17.0).into()),
          81  +
                );
          82  +
            }
          83  +
        }
          84  +
        array_16.finish();
          85  +
    }
          86  +
    {
          87  +
        object.key("rangeByteQuery").number(
          88  +
            #[allow(clippy::useless_conversion)]
          89  +
            ::aws_smithy_types::Number::NegInt((input.range_byte_query.0).into()),
          90  +
        );
          91  +
    }
          92  +
    if let Some(var_18) = &input.range_byte_set_query {
          93  +
        let mut array_19 = object.key("rangeByteSetQuery").start_array();
          94  +
        for item_20 in &var_18.0 {
          95  +
            {
          96  +
                array_19.value().number(
          97  +
                    #[allow(clippy::useless_conversion)]
          98  +
                    ::aws_smithy_types::Number::NegInt((item_20.0).into()),
          99  +
                );
         100  +
            }
         101  +
        }
         102  +
        array_19.finish();
         103  +
    }
         104  +
    {
         105  +
        object.key("rangeIntegerLabel").number(
         106  +
            #[allow(clippy::useless_conversion)]
         107  +
            ::aws_smithy_types::Number::NegInt((input.range_integer_label.0).into()),
         108  +
        );
         109  +
    }
         110  +
    if let Some(var_21) = &input.range_integer_list_query {
         111  +
        let mut array_22 = object.key("rangeIntegerListQuery").start_array();
         112  +
        for item_23 in var_21 {
         113  +
            {
         114  +
                array_22.value().number(
         115  +
                    #[allow(clippy::useless_conversion)]
         116  +
                    ::aws_smithy_types::Number::NegInt((item_23.0).into()),
         117  +
                );
         118  +
            }
         119  +
        }
         120  +
        array_22.finish();
         121  +
    }
         122  +
    {
         123  +
        object.key("rangeIntegerQuery").number(
         124  +
            #[allow(clippy::useless_conversion)]
         125  +
            ::aws_smithy_types::Number::NegInt((input.range_integer_query.0).into()),
         126  +
        );
         127  +
    }
         128  +
    if let Some(var_24) = &input.range_integer_set_query {
         129  +
        let mut array_25 = object.key("rangeIntegerSetQuery").start_array();
         130  +
        for item_26 in &var_24.0 {
         131  +
            {
         132  +
                array_25.value().number(
         133  +
                    #[allow(clippy::useless_conversion)]
         134  +
                    ::aws_smithy_types::Number::NegInt((item_26.0).into()),
         135  +
                );
         136  +
            }
         137  +
        }
         138  +
        array_25.finish();
         139  +
    }
         140  +
    {
         141  +
        object.key("rangeLongLabel").number(
         142  +
            #[allow(clippy::useless_conversion)]
         143  +
            ::aws_smithy_types::Number::NegInt((input.range_long_label.0).into()),
         144  +
        );
         145  +
    }
         146  +
    if let Some(var_27) = &input.range_long_list_query {
         147  +
        let mut array_28 = object.key("rangeLongListQuery").start_array();
         148  +
        for item_29 in var_27 {
         149  +
            {
         150  +
                array_28.value().number(
         151  +
                    #[allow(clippy::useless_conversion)]
         152  +
                    ::aws_smithy_types::Number::NegInt((item_29.0).into()),
         153  +
                );
         154  +
            }
         155  +
        }
         156  +
        array_28.finish();
         157  +
    }
         158  +
    {
         159  +
        object.key("rangeLongQuery").number(
         160  +
            #[allow(clippy::useless_conversion)]
         161  +
            ::aws_smithy_types::Number::NegInt((input.range_long_query.0).into()),
         162  +
        );
         163  +
    }
         164  +
    if let Some(var_30) = &input.range_long_set_query {
         165  +
        let mut array_31 = object.key("rangeLongSetQuery").start_array();
         166  +
        for item_32 in &var_30.0 {
         167  +
            {
         168  +
                array_31.value().number(
         169  +
                    #[allow(clippy::useless_conversion)]
         170  +
                    ::aws_smithy_types::Number::NegInt((item_32.0).into()),
         171  +
                );
         172  +
            }
         173  +
        }
         174  +
        array_31.finish();
         175  +
    }
         176  +
    {
         177  +
        object.key("rangeShortLabel").number(
         178  +
            #[allow(clippy::useless_conversion)]
         179  +
            ::aws_smithy_types::Number::NegInt((input.range_short_label.0).into()),
         180  +
        );
         181  +
    }
         182  +
    if let Some(var_33) = &input.range_short_list_query {
         183  +
        let mut array_34 = object.key("rangeShortListQuery").start_array();
         184  +
        for item_35 in var_33 {
         185  +
            {
         186  +
                array_34.value().number(
         187  +
                    #[allow(clippy::useless_conversion)]
         188  +
                    ::aws_smithy_types::Number::NegInt((item_35.0).into()),
         189  +
                );
         190  +
            }
         191  +
        }
         192  +
        array_34.finish();
         193  +
    }
         194  +
    {
         195  +
        object.key("rangeShortQuery").number(
         196  +
            #[allow(clippy::useless_conversion)]
         197  +
            ::aws_smithy_types::Number::NegInt((input.range_short_query.0).into()),
         198  +
        );
         199  +
    }
         200  +
    if let Some(var_36) = &input.range_short_set_query {
         201  +
        let mut array_37 = object.key("rangeShortSetQuery").start_array();
         202  +
        for item_38 in &var_36.0 {
         203  +
            {
         204  +
                array_37.value().number(
         205  +
                    #[allow(clippy::useless_conversion)]
         206  +
                    ::aws_smithy_types::Number::NegInt((item_38.0).into()),
         207  +
                );
         208  +
            }
         209  +
        }
         210  +
        array_37.finish();
         211  +
    }
         212  +
    Ok(())
         213  +
}

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

@@ -0,1 +0,108 @@
           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_http_payload_bound_shape_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::ConstrainedHttpPayloadBoundShapeOperationInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
           8  +
>
           9  +
where
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          11  +
    B::Data: Send,
          12  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          14  +
{
          15  +
    Ok({
          16  +
        #[allow(unused_mut)]
          17  +
        let mut input =
          18  +
            crate::input::constrained_http_payload_bound_shape_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 bytes = ::hyper::body::to_bytes(body).await?;
          25  +
            if !bytes.is_empty() {
          26  +
                ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
          27  +
                    &headers,
          28  +
                    Some("application/json"),
          29  +
                )?;
          30  +
            }
          31  +
            crate::protocol_serde::shape_constrained_http_payload_bound_shape_operation_input::de_http_payload_bound_constrained_shape_payload(&bytes)?
          32  +
        } {
          33  +
            input = input.set_http_payload_bound_constrained_shape(value)
          34  +
        }
          35  +
        input.build()?
          36  +
    })
          37  +
}
          38  +
          39  +
#[allow(clippy::unnecessary_wraps)]
          40  +
pub fn ser_constrained_http_payload_bound_shape_operation_http_response(
          41  +
    #[allow(unused_variables)]
          42  +
    output: crate::output::ConstrainedHttpPayloadBoundShapeOperationOutput,
          43  +
) -> std::result::Result<
          44  +
    ::aws_smithy_legacy_http_server::response::Response,
          45  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          46  +
> {
          47  +
    Ok({
          48  +
        #[allow(unused_mut)]
          49  +
        let mut builder = ::http::Response::builder();
          50  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          51  +
            builder,
          52  +
            ::http::header::CONTENT_TYPE,
          53  +
            "application/json",
          54  +
        );
          55  +
        let http_status: u16 = 200;
          56  +
        builder = builder.status(http_status);
          57  +
        let payload =
          58  +
            crate::protocol_serde::shape_constrained_http_payload_bound_shape_operation_output::ser_http_payload_bound_constrained_shape_http_payload(& output.http_payload_bound_constrained_shape)?
          59  +
        ;
          60  +
        let content_length = payload.len();
          61  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          62  +
            builder,
          63  +
            ::http::header::CONTENT_LENGTH,
          64  +
            content_length,
          65  +
        );
          66  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          67  +
        builder.body(body)?
          68  +
    })
          69  +
}
          70  +
          71  +
#[allow(clippy::unnecessary_wraps)]
          72  +
pub fn ser_constrained_http_payload_bound_shape_operation_http_error(
          73  +
    error: &crate::error::ConstrainedHttpPayloadBoundShapeOperationError,
          74  +
) -> std::result::Result<
          75  +
    ::aws_smithy_legacy_http_server::response::Response,
          76  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          77  +
> {
          78  +
    Ok({
          79  +
        match error {
          80  +
            crate::error::ConstrainedHttpPayloadBoundShapeOperationError::ValidationException(
          81  +
                output,
          82  +
            ) => {
          83  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
          84  +
                #[allow(unused_mut)]
          85  +
                let mut builder = ::http::Response::builder();
          86  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          87  +
                    builder,
          88  +
                    ::http::header::CONTENT_TYPE,
          89  +
                    "application/json",
          90  +
                );
          91  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          92  +
                    builder,
          93  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
          94  +
                    "ValidationException",
          95  +
                );
          96  +
                let content_length = payload.len();
          97  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          98  +
                    builder,
          99  +
                    ::http::header::CONTENT_LENGTH,
         100  +
                    content_length,
         101  +
                );
         102  +
                builder
         103  +
                    .status(400)
         104  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         105  +
            }
         106  +
        }
         107  +
    })
         108  +
}

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

@@ -0,1 +0,11 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_http_payload_bound_constrained_shape_payload(
           3  +
    body: &[u8],
           4  +
) -> std::result::Result<
           5  +
    ::std::option::Option<crate::model::con_a::Builder>,
           6  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
           7  +
> {
           8  +
    (!body.is_empty())
           9  +
        .then(|| crate::protocol_serde::shape_con_a::de_con_a_payload(body))
          10  +
        .transpose()
          11  +
}

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

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

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

@@ -0,1 +0,152 @@
           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_recursive_shapes_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::ConstrainedRecursiveShapesOperationInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
           8  +
>
           9  +
where
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          11  +
    B::Data: Send,
          12  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          14  +
{
          15  +
    Ok({
          16  +
        #[allow(unused_mut)]
          17  +
        let mut input =
          18  +
            crate::input::constrained_recursive_shapes_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  +
        let bytes = ::hyper::body::to_bytes(body).await?;
          24  +
        if !bytes.is_empty() {
          25  +
            ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
          26  +
                &headers,
          27  +
                Some("application/json"),
          28  +
            )?;
          29  +
            input = crate::protocol_serde::shape_constrained_recursive_shapes_operation::de_constrained_recursive_shapes_operation(bytes.as_ref(), input)?;
          30  +
        }
          31  +
        input.build()?
          32  +
    })
          33  +
}
          34  +
          35  +
#[allow(clippy::unnecessary_wraps)]
          36  +
pub fn ser_constrained_recursive_shapes_operation_http_response(
          37  +
    #[allow(unused_variables)] output: crate::output::ConstrainedRecursiveShapesOperationOutput,
          38  +
) -> std::result::Result<
          39  +
    ::aws_smithy_legacy_http_server::response::Response,
          40  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          41  +
> {
          42  +
    Ok({
          43  +
        #[allow(unused_mut)]
          44  +
        let mut builder = ::http::Response::builder();
          45  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          46  +
            builder,
          47  +
            ::http::header::CONTENT_TYPE,
          48  +
            "application/json",
          49  +
        );
          50  +
        let http_status: u16 = 200;
          51  +
        builder = builder.status(http_status);
          52  +
        let payload =
          53  +
            crate::protocol_serde::shape_constrained_recursive_shapes_operation_output::ser_constrained_recursive_shapes_operation_output_output_output(&output)?
          54  +
        ;
          55  +
        let content_length = payload.len();
          56  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          57  +
            builder,
          58  +
            ::http::header::CONTENT_LENGTH,
          59  +
            content_length,
          60  +
        );
          61  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          62  +
        builder.body(body)?
          63  +
    })
          64  +
}
          65  +
          66  +
#[allow(clippy::unnecessary_wraps)]
          67  +
pub fn ser_constrained_recursive_shapes_operation_http_error(
          68  +
    error: &crate::error::ConstrainedRecursiveShapesOperationError,
          69  +
) -> std::result::Result<
          70  +
    ::aws_smithy_legacy_http_server::response::Response,
          71  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          72  +
> {
          73  +
    Ok({
          74  +
        match error {
          75  +
            crate::error::ConstrainedRecursiveShapesOperationError::ValidationException(output) => {
          76  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
          77  +
                #[allow(unused_mut)]
          78  +
                let mut builder = ::http::Response::builder();
          79  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          80  +
                    builder,
          81  +
                    ::http::header::CONTENT_TYPE,
          82  +
                    "application/json",
          83  +
                );
          84  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          85  +
                    builder,
          86  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
          87  +
                    "ValidationException",
          88  +
                );
          89  +
                let content_length = payload.len();
          90  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          91  +
                    builder,
          92  +
                    ::http::header::CONTENT_LENGTH,
          93  +
                    content_length,
          94  +
                );
          95  +
                builder
          96  +
                    .status(400)
          97  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
          98  +
            }
          99  +
        }
         100  +
    })
         101  +
}
         102  +
         103  +
pub(crate) fn de_constrained_recursive_shapes_operation(
         104  +
    value: &[u8],
         105  +
    mut builder: crate::input::constrained_recursive_shapes_operation_input::Builder,
         106  +
) -> ::std::result::Result<
         107  +
    crate::input::constrained_recursive_shapes_operation_input::Builder,
         108  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
         109  +
> {
         110  +
    let mut tokens_owned =
         111  +
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
         112  +
            .peekable();
         113  +
    let tokens = &mut tokens_owned;
         114  +
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         115  +
    loop {
         116  +
        match tokens.next().transpose()? {
         117  +
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
         118  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         119  +
                match key.to_unescaped()?.as_ref() {
         120  +
                    "nested" => {
         121  +
                        builder = builder.set_nested(
         122  +
                            crate::protocol_serde::shape_recursive_shapes_input_output_nested1::de_recursive_shapes_input_output_nested1(tokens)?
         123  +
                        );
         124  +
                    }
         125  +
                    "recursiveList" => {
         126  +
                        if let Some(v) =
         127  +
                            crate::protocol_serde::shape_recursive_list::de_recursive_list(tokens)?
         128  +
                        {
         129  +
                            builder = builder.set_recursive_list(v);
         130  +
                        }
         131  +
                    }
         132  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         133  +
                }
         134  +
            }
         135  +
            other => {
         136  +
                return Err(
         137  +
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
         138  +
                        "expected object key or end object, found: {other:?}"
         139  +
                    )),
         140  +
                )
         141  +
            }
         142  +
        }
         143  +
    }
         144  +
    if tokens.next().is_some() {
         145  +
        return Err(
         146  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         147  +
                "found more JSON tokens after completing parsing",
         148  +
            ),
         149  +
        );
         150  +
    }
         151  +
    Ok(builder)
         152  +
}

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

@@ -0,1 +0,35 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_constrained_recursive_shapes_operation_output_output_output(
           3  +
    value: &crate::output::ConstrainedRecursiveShapesOperationOutput,
           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_recursive_shapes_operation_output::ser_constrained_recursive_shapes_operation_output_output(&mut object, value)?;
           8  +
    object.finish();
           9  +
    Ok(out)
          10  +
}
          11  +
          12  +
pub fn ser_constrained_recursive_shapes_operation_output_output(
          13  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          14  +
    input: &crate::output::ConstrainedRecursiveShapesOperationOutput,
          15  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          16  +
    if let Some(var_1) = &input.nested {
          17  +
        #[allow(unused_mut)]
          18  +
        let mut object_2 = object.key("nested").start_object();
          19  +
        crate::protocol_serde::shape_recursive_shapes_input_output_nested1::ser_recursive_shapes_input_output_nested1(&mut object_2, var_1)?;
          20  +
        object_2.finish();
          21  +
    }
          22  +
    {
          23  +
        let mut array_3 = object.key("recursiveList").start_array();
          24  +
        for item_4 in &input.recursive_list {
          25  +
            {
          26  +
                #[allow(unused_mut)]
          27  +
                let mut object_5 = array_3.value().start_object();
          28  +
                crate::protocol_serde::shape_recursive_shapes_input_output_nested1::ser_recursive_shapes_input_output_nested1(&mut object_5, item_4)?;
          29  +
                object_5.finish();
          30  +
            }
          31  +
        }
          32  +
        array_3.finish();
          33  +
    }
          34  +
    Ok(())
          35  +
}

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

@@ -0,1 +0,59 @@
           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_only_in_output_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::ConstrainedShapesOnlyInOutputOperationInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
           8  +
>
           9  +
where
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          11  +
    B::Data: Send,
          12  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          14  +
{
          15  +
    Ok({
          16  +
        #[allow(unused_mut)]
          17  +
        let mut input =
          18  +
            crate::input::constrained_shapes_only_in_output_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  +
        ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
          24  +
            &headers, None,
          25  +
        )?;
          26  +
        input.build()
          27  +
    })
          28  +
}
          29  +
          30  +
#[allow(clippy::unnecessary_wraps)]
          31  +
pub fn ser_constrained_shapes_only_in_output_operation_http_response(
          32  +
    #[allow(unused_variables)] output: crate::output::ConstrainedShapesOnlyInOutputOperationOutput,
          33  +
) -> std::result::Result<
          34  +
    ::aws_smithy_legacy_http_server::response::Response,
          35  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          36  +
> {
          37  +
    Ok({
          38  +
        #[allow(unused_mut)]
          39  +
        let mut builder = ::http::Response::builder();
          40  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          41  +
            builder,
          42  +
            ::http::header::CONTENT_TYPE,
          43  +
            "application/json",
          44  +
        );
          45  +
        let http_status: u16 = 200;
          46  +
        builder = builder.status(http_status);
          47  +
        let payload =
          48  +
            crate::protocol_serde::shape_constrained_shapes_only_in_output_operation_output::ser_constrained_shapes_only_in_output_operation_output_output_output(&output)?
          49  +
        ;
          50  +
        let content_length = payload.len();
          51  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          52  +
            builder,
          53  +
            ::http::header::CONTENT_LENGTH,
          54  +
            content_length,
          55  +
        );
          56  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          57  +
        builder.body(body)?
          58  +
    })
          59  +
}