Server Test

Server Test

rev. d06a46cae0f385cdae37a9f8264db3469a090ab5

Files changed:

tmp-codegen-diff/codegen-server-test/rest_json_validation-http0x/rust-server-codegen/src/protocol_serde/shape_pattern_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_pattern_list<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<crate::unconstrained::pattern_list_unconstrained::PatternListUnconstrained>,
           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::pattern_list_unconstrained::PatternListUnconstrained(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/rest_json_validation-http0x/rust-server-codegen/src/protocol_serde/shape_pattern_list_override.rs

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

@@ -0,1 +0,62 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_pattern_map<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<crate::unconstrained::pattern_map_unconstrained::PatternMapUnconstrained>,
           6  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
           7  +
>
           8  +
where
           9  +
    I: Iterator<
          10  +
        Item = Result<
          11  +
            ::aws_smithy_json::deserialize::Token<'a>,
          12  +
            ::aws_smithy_json::deserialize::error::DeserializeError,
          13  +
        >,
          14  +
    >,
          15  +
{
          16  +
    match tokens.next().transpose()? {
          17  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          18  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          19  +
            let mut map = ::std::collections::HashMap::new();
          20  +
            loop {
          21  +
                match tokens.next().transpose()? {
          22  +
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          23  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          24  +
                        let key = key.to_unescaped().map(|u| u.into_owned())?;
          25  +
                        let value = ::aws_smithy_json::deserialize::token::expect_string_or_null(
          26  +
                            tokens.next(),
          27  +
                        )?
          28  +
                        .map(|s| s.to_unescaped().map(|u| u.into_owned()))
          29  +
                        .transpose()?;
          30  +
                        match value {
          31  +
                            Some(value) => {
          32  +
                                map.insert(key, value);
          33  +
                            }
          34  +
                            None => {
          35  +
                                return Err(
          36  +
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          37  +
                                        "dense map cannot contain null values",
          38  +
                                    ),
          39  +
                                )
          40  +
                            }
          41  +
                        }
          42  +
                    }
          43  +
                    other => {
          44  +
                        return Err(
          45  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          46  +
                                format!("expected object key or end object, found: {other:?}"),
          47  +
                            ),
          48  +
                        )
          49  +
                    }
          50  +
                }
          51  +
            }
          52  +
            Ok(Some(
          53  +
                crate::unconstrained::pattern_map_unconstrained::PatternMapUnconstrained(map),
          54  +
            ))
          55  +
        }
          56  +
        _ => Err(
          57  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          58  +
                "expected start object or null",
          59  +
            ),
          60  +
        ),
          61  +
    }
          62  +
}

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

@@ -0,1 +0,62 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_pattern_map_override<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<
           6  +
        crate::unconstrained::pattern_map_override_unconstrained::PatternMapOverrideUnconstrained,
           7  +
    >,
           8  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
           9  +
>
          10  +
where
          11  +
    I: Iterator<
          12  +
        Item = Result<
          13  +
            ::aws_smithy_json::deserialize::Token<'a>,
          14  +
            ::aws_smithy_json::deserialize::error::DeserializeError,
          15  +
        >,
          16  +
    >,
          17  +
{
          18  +
    match tokens.next().transpose()? {
          19  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          20  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          21  +
            let mut map = ::std::collections::HashMap::new();
          22  +
            loop {
          23  +
                match tokens.next().transpose()? {
          24  +
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          25  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          26  +
                        let key = key.to_unescaped().map(|u| u.into_owned())?;
          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  +
                        match value {
          33  +
                            Some(value) => {
          34  +
                                map.insert(key, value);
          35  +
                            }
          36  +
                            None => {
          37  +
                                return Err(
          38  +
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          39  +
                                        "dense map cannot contain null values",
          40  +
                                    ),
          41  +
                                )
          42  +
                            }
          43  +
                        }
          44  +
                    }
          45  +
                    other => {
          46  +
                        return Err(
          47  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          48  +
                                format!("expected object key or end object, found: {other:?}"),
          49  +
                            ),
          50  +
                        )
          51  +
                    }
          52  +
                }
          53  +
            }
          54  +
            Ok(Some(crate::unconstrained::pattern_map_override_unconstrained::PatternMapOverrideUnconstrained(map)))
          55  +
        }
          56  +
        _ => Err(
          57  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          58  +
                "expected start object or null",
          59  +
            ),
          60  +
        ),
          61  +
    }
          62  +
}

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

@@ -0,1 +0,91 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_pattern_union<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<crate::unconstrained::pattern_union_unconstrained::PatternUnionUnconstrained>,
           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  +
                            "first" => {
          44  +
                                Some(crate::unconstrained::pattern_union_unconstrained::PatternUnionUnconstrained::First(
          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 'first' cannot be null"))?
          51  +
                                ))
          52  +
                            }
          53  +
                            "second" => {
          54  +
                                Some(crate::unconstrained::pattern_union_unconstrained::PatternUnionUnconstrained::Second(
          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 'second' cannot be null"))?
          61  +
                                ))
          62  +
                            }
          63  +
                            variant => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("unexpected union variant: {variant}")))
          64  +
                        };
          65  +
                }
          66  +
                other => {
          67  +
                    return Err(
          68  +
                        ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
          69  +
                            "expected object key or end object, found: {other:?}"
          70  +
                        )),
          71  +
                    )
          72  +
                }
          73  +
            }
          74  +
        },
          75  +
        _ => {
          76  +
            return Err(
          77  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          78  +
                    "expected start object or null",
          79  +
                ),
          80  +
            )
          81  +
        }
          82  +
    }
          83  +
    if variant.is_none() {
          84  +
        return Err(
          85  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          86  +
                "Union did not contain a valid variant.",
          87  +
            ),
          88  +
        );
          89  +
    }
          90  +
    Ok(variant)
          91  +
}

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

@@ -0,1 +0,79 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_pattern_union_override<'a, I>(tokens: &mut ::std::iter::Peekable<I>) -> ::std::result::Result<Option<crate::unconstrained::pattern_union_override_unconstrained::PatternUnionOverrideUnconstrained>, ::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  +
    let mut variant = None;
           5  +
    match tokens.next().transpose()? {
           6  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => return Ok(None),
           7  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => loop {
           8  +
            match tokens.next().transpose()? {
           9  +
                Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          10  +
                Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          11  +
                    if let ::std::option::Option::Some(::std::result::Result::Ok(
          12  +
                        ::aws_smithy_json::deserialize::Token::ValueNull { .. },
          13  +
                    )) = tokens.peek()
          14  +
                    {
          15  +
                        let _ = tokens.next().expect("peek returned a token")?;
          16  +
                        continue;
          17  +
                    }
          18  +
                    let key = key.to_unescaped()?;
          19  +
                    if key == "__type" {
          20  +
                        ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
          21  +
                        continue;
          22  +
                    }
          23  +
                    if variant.is_some() {
          24  +
                        return Err(
          25  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          26  +
                                "encountered mixed variants in union",
          27  +
                            ),
          28  +
                        );
          29  +
                    }
          30  +
                    variant = match key.as_ref() {
          31  +
                            "first" => {
          32  +
                                Some(crate::unconstrained::pattern_union_override_unconstrained::PatternUnionOverrideUnconstrained::First(
          33  +
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          34  +
                                        s.to_unescaped().map(|u|
          35  +
                                            u.into_owned()
          36  +
                                        )
          37  +
                                    ).transpose()?
          38  +
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'first' cannot be null"))?
          39  +
                                ))
          40  +
                            }
          41  +
                            "second" => {
          42  +
                                Some(crate::unconstrained::pattern_union_override_unconstrained::PatternUnionOverrideUnconstrained::Second(
          43  +
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          44  +
                                        s.to_unescaped().map(|u|
          45  +
                                            u.into_owned()
          46  +
                                        )
          47  +
                                    ).transpose()?
          48  +
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'second' cannot be null"))?
          49  +
                                ))
          50  +
                            }
          51  +
                            variant => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("unexpected union variant: {variant}")))
          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  +
        _ => {
          64  +
            return Err(
          65  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          66  +
                    "expected start object or null",
          67  +
                ),
          68  +
            )
          69  +
        }
          70  +
    }
          71  +
    if variant.is_none() {
          72  +
        return Err(
          73  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          74  +
                "Union did not contain a valid variant.",
          75  +
            ),
          76  +
        );
          77  +
    }
          78  +
    Ok(variant)
          79  +
}

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

@@ -0,1 +0,145 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_recursive_structures_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::RecursiveStructuresInput,
           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::recursive_structures_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_recursive_structures::de_recursive_structures(
          29  +
                bytes.as_ref(),
          30  +
                input,
          31  +
            )?;
          32  +
        }
          33  +
        input.build()?
          34  +
    })
          35  +
}
          36  +
          37  +
#[allow(clippy::unnecessary_wraps)]
          38  +
pub fn ser_recursive_structures_http_response(
          39  +
    #[allow(unused_variables)] output: crate::output::RecursiveStructuresOutput,
          40  +
) -> std::result::Result<
          41  +
    ::aws_smithy_legacy_http_server::response::Response,
          42  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          43  +
> {
          44  +
    Ok({
          45  +
        #[allow(unused_mut)]
          46  +
        let mut builder = ::http::Response::builder();
          47  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          48  +
            builder,
          49  +
            ::http::header::CONTENT_TYPE,
          50  +
            "application/json",
          51  +
        );
          52  +
        let http_status: u16 = 200;
          53  +
        builder = builder.status(http_status);
          54  +
        let payload = "";
          55  +
        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_recursive_structures_http_error(
          68  +
    error: &crate::error::RecursiveStructuresError,
          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::RecursiveStructuresError::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_recursive_structures(
         104  +
    value: &[u8],
         105  +
    mut builder: crate::input::recursive_structures_input::Builder,
         106  +
) -> ::std::result::Result<
         107  +
    crate::input::recursive_structures_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  +
                    "union" => {
         121  +
                        builder = builder.set_union(
         122  +
                            crate::protocol_serde::shape_recursive_union_one::de_recursive_union_one(tokens)?
         123  +
                        );
         124  +
                    }
         125  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         126  +
                }
         127  +
            }
         128  +
            other => {
         129  +
                return Err(
         130  +
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
         131  +
                        "expected object key or end object, found: {other:?}"
         132  +
                    )),
         133  +
                )
         134  +
            }
         135  +
        }
         136  +
    }
         137  +
    if tokens.next().is_some() {
         138  +
        return Err(
         139  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         140  +
                "found more JSON tokens after completing parsing",
         141  +
            ),
         142  +
        );
         143  +
    }
         144  +
    Ok(builder)
         145  +
}

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

@@ -0,1 +0,88 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_recursive_union_one<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<crate::unconstrained::recursive_union_one_unconstrained::RecursiveUnionOneUnconstrained>,
           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  +
                            "string" => {
          44  +
                                Some(crate::unconstrained::recursive_union_one_unconstrained::RecursiveUnionOneUnconstrained::String(
          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 'string' cannot be null"))?
          51  +
                                ))
          52  +
                            }
          53  +
                            "union" => {
          54  +
                                Some(crate::unconstrained::recursive_union_one_unconstrained::RecursiveUnionOneUnconstrained::Union(
          55  +
                                    crate::protocol_serde::shape_recursive_union_two::de_recursive_union_two(tokens)?
          56  +
                                    .map(Box::new)
          57  +
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'union' cannot be null"))?
          58  +
                                ))
          59  +
                            }
          60  +
                            variant => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("unexpected union variant: {variant}")))
          61  +
                        };
          62  +
                }
          63  +
                other => {
          64  +
                    return Err(
          65  +
                        ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
          66  +
                            "expected object key or end object, found: {other:?}"
          67  +
                        )),
          68  +
                    )
          69  +
                }
          70  +
            }
          71  +
        },
          72  +
        _ => {
          73  +
            return Err(
          74  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          75  +
                    "expected start object or null",
          76  +
                ),
          77  +
            )
          78  +
        }
          79  +
    }
          80  +
    if variant.is_none() {
          81  +
        return Err(
          82  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          83  +
                "Union did not contain a valid variant.",
          84  +
            ),
          85  +
        );
          86  +
    }
          87  +
    Ok(variant)
          88  +
}

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

@@ -0,1 +0,87 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_recursive_union_two<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<crate::unconstrained::recursive_union_two_unconstrained::RecursiveUnionTwoUnconstrained>,
           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  +
                            "string" => {
          44  +
                                Some(crate::unconstrained::recursive_union_two_unconstrained::RecursiveUnionTwoUnconstrained::String(
          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 'string' cannot be null"))?
          51  +
                                ))
          52  +
                            }
          53  +
                            "union" => {
          54  +
                                Some(crate::unconstrained::recursive_union_two_unconstrained::RecursiveUnionTwoUnconstrained::Union(
          55  +
                                    crate::protocol_serde::shape_recursive_union_one::de_recursive_union_one(tokens)?
          56  +
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'union' cannot be null"))?
          57  +
                                ))
          58  +
                            }
          59  +
                            variant => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("unexpected union variant: {variant}")))
          60  +
                        };
          61  +
                }
          62  +
                other => {
          63  +
                    return Err(
          64  +
                        ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
          65  +
                            "expected object key or end object, found: {other:?}"
          66  +
                        )),
          67  +
                    )
          68  +
                }
          69  +
            }
          70  +
        },
          71  +
        _ => {
          72  +
            return Err(
          73  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          74  +
                    "expected start object or null",
          75  +
                ),
          76  +
            )
          77  +
        }
          78  +
    }
          79  +
    if variant.is_none() {
          80  +
        return Err(
          81  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          82  +
                "Union did not contain a valid variant.",
          83  +
            ),
          84  +
        );
          85  +
    }
          86  +
    Ok(variant)
          87  +
}

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

@@ -0,1 +0,149 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_sensitive_validation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::SensitiveValidationInput,
           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::sensitive_validation_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_sensitive_validation::de_sensitive_validation(
          29  +
                bytes.as_ref(),
          30  +
                input,
          31  +
            )?;
          32  +
        }
          33  +
        input.build()?
          34  +
    })
          35  +
}
          36  +
          37  +
#[allow(clippy::unnecessary_wraps)]
          38  +
pub fn ser_sensitive_validation_http_response(
          39  +
    #[allow(unused_variables)] output: crate::output::SensitiveValidationOutput,
          40  +
) -> std::result::Result<
          41  +
    ::aws_smithy_legacy_http_server::response::Response,
          42  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          43  +
> {
          44  +
    Ok({
          45  +
        #[allow(unused_mut)]
          46  +
        let mut builder = ::http::Response::builder();
          47  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          48  +
            builder,
          49  +
            ::http::header::CONTENT_TYPE,
          50  +
            "application/json",
          51  +
        );
          52  +
        let http_status: u16 = 200;
          53  +
        builder = builder.status(http_status);
          54  +
        let payload = "";
          55  +
        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_sensitive_validation_http_error(
          68  +
    error: &crate::error::SensitiveValidationError,
          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::SensitiveValidationError::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_sensitive_validation(
         104  +
    value: &[u8],
         105  +
    mut builder: crate::input::sensitive_validation_input::Builder,
         106  +
) -> ::std::result::Result<
         107  +
    crate::input::sensitive_validation_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  +
                    "string" => {
         121  +
                        builder = builder.set_string(
         122  +
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
         123  +
                                tokens.next(),
         124  +
                            )?
         125  +
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
         126  +
                            .transpose()?,
         127  +
                        );
         128  +
                    }
         129  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         130  +
                }
         131  +
            }
         132  +
            other => {
         133  +
                return Err(
         134  +
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
         135  +
                        "expected object key or end object, found: {other:?}"
         136  +
                    )),
         137  +
                )
         138  +
            }
         139  +
        }
         140  +
    }
         141  +
    if tokens.next().is_some() {
         142  +
        return Err(
         143  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         144  +
                "found more JSON tokens after completing parsing",
         145  +
            ),
         146  +
        );
         147  +
    }
         148  +
    Ok(builder)
         149  +
}

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

@@ -0,1 +0,54 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_short_set<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<crate::unconstrained::short_set_unconstrained::ShortSetUnconstrained>,
           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_number_or_null(
          28  +
                            tokens.next(),
          29  +
                        )?
          30  +
                        .map(i16::try_from)
          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::short_set_unconstrained::ShortSetUnconstrained(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/rest_json_validation-http0x/rust-server-codegen/src/protocol_serde/shape_string_list.rs

@@ -0,1 +0,52 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_string_list<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<::std::vec::Vec<::std::string::String>>,
           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(items))
          45  +
        }
          46  +
        _ => Err(
          47  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          48  +
                "expected start array or null",
          49  +
            ),
          50  +
        ),
          51  +
    }
          52  +
}

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

@@ -0,1 +0,54 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_string_set<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<crate::unconstrained::string_set_unconstrained::StringSetUnconstrained>,
           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::string_set_unconstrained::StringSetUnconstrained(items),
          46  +
            ))
          47  +
        }
          48  +
        _ => Err(
          49  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          50  +
                "expected start array or null",
          51  +
            ),
          52  +
        ),
          53  +
    }
          54  +
}