Server Test

Server Test

rev. 3c756f73b1f83a0eed4275d9d1e22df0b10b66fb

Files changed:

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_integer_list.rs

@@ -1,1 +52,76 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:398 */
    2      3   
pub(crate) fn de_integer_list<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<::std::vec::Vec<i32>>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
>
    8      9   
where
    9     10   
    I: Iterator<
   10     11   
        Item = Result<
   11     12   
            ::aws_smithy_json::deserialize::Token<'a>,
   12     13   
            ::aws_smithy_json::deserialize::error::DeserializeError,
   13     14   
        >,
   14     15   
    >,
   15     16   
{
          17  +
    /* JsonParserGenerator.kt:712 */
   16     18   
    match tokens.next().transpose()? {
          19  +
        /* JsonParserGenerator.kt:713 */
   17     20   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   18     21   
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
          22  +
            /* JsonParserGenerator.kt:407 */
   19     23   
            let mut items = Vec::new();
          24  +
            /* JsonParserGenerator.kt:408 */
   20     25   
            loop {
          26  +
                /* JsonParserGenerator.kt:409 */
   21     27   
                match tokens.peek() {
          28  +
                    /* JsonParserGenerator.kt:410 */
   22     29   
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
          30  +
                        /* JsonParserGenerator.kt:411 */
   23     31   
                        tokens.next().transpose().unwrap();
   24     32   
                        break;
          33  +
                        /* JsonParserGenerator.kt:410 */
   25     34   
                    }
          35  +
                    /* JsonParserGenerator.kt:413 */
   26     36   
                    _ => {
   27         -
                        let value = ::aws_smithy_json::deserialize::token::expect_number_or_null(
   28         -
                            tokens.next(),
   29         -
                        )?
   30         -
                        .map(i32::try_from)
   31         -
                        .transpose()?;
          37  +
                        /* JsonParserGenerator.kt:419 */
          38  +
                        let value =
          39  +
                            /* JsonParserGenerator.kt:365 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
          40  +
                                                .map(i32::try_from)
          41  +
                                                .transpose()?
          42  +
                        /* JsonParserGenerator.kt:419 */;
          43  +
                        /* JsonParserGenerator.kt:422 */
   32     44   
                        if let Some(value) = value {
   33     45   
                            items.push(value);
   34         -
                        } else {
          46  +
                        }
          47  +
                        /* JsonParserGenerator.kt:430 */
          48  +
                        else {
   35     49   
                            return Err(
   36     50   
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37     51   
                                    "dense list cannot contain null values",
   38     52   
                                ),
   39     53   
                            );
   40     54   
                        }
   41         -
                    }
          55  +
                        /* JsonParserGenerator.kt:413 */
          56  +
                    } /* JsonParserGenerator.kt:409 */
   42     57   
                }
          58  +
                /* JsonParserGenerator.kt:408 */
   43     59   
            }
          60  +
            /* JsonParserGenerator.kt:446 */
   44     61   
            Ok(Some(items))
          62  +
            /* JsonParserGenerator.kt:713 */
   45     63   
        }
   46         -
        _ => Err(
   47         -
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   48         -
                "expected start array or null",
   49         -
            ),
   50         -
        ),
          64  +
        /* JsonParserGenerator.kt:722 */
          65  +
        _ => {
          66  +
            /* JsonParserGenerator.kt:723 */
          67  +
            Err(
          68  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          69  +
                    "expected start array or null",
          70  +
                ),
          71  +
            )
          72  +
            /* JsonParserGenerator.kt:722 */
          73  +
        } /* JsonParserGenerator.kt:712 */
   51     74   
    }
          75  +
    /* JsonParserGenerator.kt:398 */
   52     76   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_invalid_greeting.rs

@@ -1,1 +20,31 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_invalid_greeting_error(
    3      4   
    value: &crate::error::InvalidGreeting,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_invalid_greeting::ser_invalid_greeting(&mut object, value)?;
          11  +
    /* JsonSerializerGenerator.kt:227 */
    8     12   
    object.finish();
    9     13   
    Ok(out)
          14  +
    /* JsonSerializerGenerator.kt:213 */
   10     15   
}
   11     16   
          17  +
/* JsonSerializerGenerator.kt:358 */
   12     18   
pub fn ser_invalid_greeting(
   13     19   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    input: &crate::error::InvalidGreeting,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* JsonSerializerGenerator.kt:382 */
   16     23   
    if let Some(var_1) = &input.message {
          24  +
        /* JsonSerializerGenerator.kt:423 */
   17     25   
        object.key("Message").string(var_1.as_str());
          26  +
        /* JsonSerializerGenerator.kt:382 */
   18     27   
    }
          28  +
    /* JsonSerializerGenerator.kt:372 */
   19     29   
    Ok(())
          30  +
    /* JsonSerializerGenerator.kt:358 */
   20     31   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_json_blobs.rs

@@ -1,1 +110,158 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_json_blobs_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::JsonBlobsInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::json_blobs_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   22         -
        let bytes = ::hyper::body::to_bytes(body).await?;
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:789 */
          30  +
        let bytes = {
          31  +
            use ::http_body_util::BodyExt;
          32  +
            body.collect().await?.to_bytes()
          33  +
        };
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:825 */
   23     35   
        if !bytes.is_empty() {
          36  +
            /* ServerHttpBoundProtocolGenerator.kt:826 */
   24     37   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     38   
                &headers,
   26     39   
                Some("application/json"),
   27     40   
            )?;
   28     41   
            input = crate::protocol_serde::shape_json_blobs::de_json_blobs(bytes.as_ref(), input)?;
          42  +
            /* ServerHttpBoundProtocolGenerator.kt:825 */
   29     43   
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   30     45   
        input.build()
          46  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   31     47   
    })
          48  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   32     49   
}
   33     50   
          51  +
/* RustType.kt:534 */
   34     52   
#[allow(clippy::unnecessary_wraps)]
          53  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   35     54   
pub fn ser_json_blobs_http_response(
   36     55   
    #[allow(unused_variables)] output: crate::output::JsonBlobsOutput,
   37     56   
) -> std::result::Result<
   38     57   
    ::aws_smithy_http_server::response::Response,
   39     58   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   40     59   
> {
          60  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   41     61   
    Ok({
          62  +
        /* RustType.kt:534 */
   42     63   
        #[allow(unused_mut)]
   43         -
        let mut builder = ::http::Response::builder();
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          65  +
        let mut builder = ::http_1x::Response::builder();
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   44     67   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   45     68   
            builder,
   46         -
            ::http::header::CONTENT_TYPE,
          69  +
            ::http_1x::header::CONTENT_TYPE,
   47     70   
            "application/json",
   48     71   
        );
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   49     73   
        let http_status: u16 = 200;
   50     74   
        builder = builder.status(http_status);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   51     76   
        let payload =
   52         -
            crate::protocol_serde::shape_json_blobs_output::ser_json_blobs_output_output_output(
   53         -
                &output,
   54         -
            )?;
          77  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_json_blobs_output::ser_json_blobs_output_output_output(&output)?
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   55     80   
        let content_length = payload.len();
   56     81   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     82   
            builder,
   58         -
            ::http::header::CONTENT_LENGTH,
          83  +
            ::http_1x::header::CONTENT_LENGTH,
   59     84   
            content_length,
   60     85   
        );
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   61     87   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   62     89   
        builder.body(body)?
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   63     91   
    })
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   64     93   
}
   65     94   
          95  +
/* JsonParserGenerator.kt:148 */
   66     96   
pub(crate) fn de_json_blobs(
   67     97   
    value: &[u8],
   68     98   
    mut builder: crate::input::json_blobs_input::Builder,
   69     99   
) -> ::std::result::Result<
   70    100   
    crate::input::json_blobs_input::Builder,
   71    101   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   72    102   
> {
         103  +
    /* JsonParserGenerator.kt:153 */
   73    104   
    let mut tokens_owned =
   74    105   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
   75    106   
            .peekable();
   76    107   
    let tokens = &mut tokens_owned;
   77    108   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         109  +
    /* JsonParserGenerator.kt:684 */
   78    110   
    loop {
         111  +
        /* JsonParserGenerator.kt:685 */
   79    112   
        match tokens.next().transpose()? {
         113  +
            /* JsonParserGenerator.kt:686 */
   80    114   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   81    115   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         116  +
                /* JsonParserGenerator.kt:260 */
   82    117   
                match key.to_unescaped()?.as_ref() {
         118  +
                    /* JsonParserGenerator.kt:262 */
   83    119   
                    "data" => {
         120  +
                        /* JsonParserGenerator.kt:272 */
   84    121   
                        builder = builder.set_data(
         122  +
                            /* JsonParserGenerator.kt:326 */
   85    123   
                            ::aws_smithy_json::deserialize::token::expect_blob_or_null(
   86    124   
                                tokens.next(),
   87         -
                            )?,
         125  +
                            )?, /* JsonParserGenerator.kt:272 */
   88    126   
                        );
         127  +
                        /* JsonParserGenerator.kt:262 */
   89    128   
                    }
   90         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         129  +
                    /* JsonParserGenerator.kt:290 */
         130  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   91    131   
                }
         132  +
                /* JsonParserGenerator.kt:686 */
   92    133   
            }
         134  +
            /* JsonParserGenerator.kt:695 */
   93    135   
            other => {
   94    136   
                return Err(
   95    137   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   96    138   
                        "expected object key or end object, found: {other:?}"
   97    139   
                    )),
   98    140   
                )
   99         -
            }
         141  +
            } /* JsonParserGenerator.kt:685 */
  100    142   
        }
         143  +
        /* JsonParserGenerator.kt:684 */
  101    144   
    }
         145  +
    /* JsonParserGenerator.kt:250 */
  102    146   
    if tokens.next().is_some() {
         147  +
        /* JsonParserGenerator.kt:251 */
  103    148   
        return Err(
  104    149   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  105    150   
                "found more JSON tokens after completing parsing",
  106    151   
            ),
  107    152   
        );
         153  +
        /* JsonParserGenerator.kt:250 */
  108    154   
    }
         155  +
    /* JsonParserGenerator.kt:163 */
  109    156   
    Ok(builder)
         157  +
    /* JsonParserGenerator.kt:148 */
  110    158   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_json_blobs_output.rs

@@ -1,1 +25,36 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_json_blobs_output_output_output(
    3      4   
    value: &crate::output::JsonBlobsOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_json_blobs_output::ser_json_blobs_output_output(
    8     11   
        &mut object,
    9     12   
        value,
   10     13   
    )?;
          14  +
    /* JsonSerializerGenerator.kt:227 */
   11     15   
    object.finish();
   12     16   
    Ok(out)
          17  +
    /* JsonSerializerGenerator.kt:213 */
   13     18   
}
   14     19   
          20  +
/* JsonSerializerGenerator.kt:358 */
   15     21   
pub fn ser_json_blobs_output_output(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::output::JsonBlobsOutput,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:382 */
   19     26   
    if let Some(var_1) = &input.data {
          27  +
        /* JsonSerializerGenerator.kt:439 */
   20     28   
        object
   21     29   
            .key("data")
   22     30   
            .string_unchecked(&::aws_smithy_types::base64::encode(var_1));
          31  +
        /* JsonSerializerGenerator.kt:382 */
   23     32   
    }
          33  +
    /* JsonSerializerGenerator.kt:372 */
   24     34   
    Ok(())
          35  +
    /* JsonSerializerGenerator.kt:358 */
   25     36   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_json_enums.rs

@@ -1,1 +182,275 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_json_enums_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::JsonEnumsInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::json_enums_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   22         -
        let bytes = ::hyper::body::to_bytes(body).await?;
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:789 */
          30  +
        let bytes = {
          31  +
            use ::http_body_util::BodyExt;
          32  +
            body.collect().await?.to_bytes()
          33  +
        };
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:825 */
   23     35   
        if !bytes.is_empty() {
          36  +
            /* ServerHttpBoundProtocolGenerator.kt:826 */
   24     37   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     38   
                &headers,
   26     39   
                Some("application/json"),
   27     40   
            )?;
   28     41   
            input = crate::protocol_serde::shape_json_enums::de_json_enums(bytes.as_ref(), input)?;
          42  +
            /* ServerHttpBoundProtocolGenerator.kt:825 */
   29     43   
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   30     45   
        input.build()?
          46  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   31     47   
    })
          48  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   32     49   
}
   33     50   
          51  +
/* RustType.kt:534 */
   34     52   
#[allow(clippy::unnecessary_wraps)]
          53  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   35     54   
pub fn ser_json_enums_http_response(
   36     55   
    #[allow(unused_variables)] output: crate::output::JsonEnumsOutput,
   37     56   
) -> std::result::Result<
   38     57   
    ::aws_smithy_http_server::response::Response,
   39     58   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   40     59   
> {
          60  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   41     61   
    Ok({
          62  +
        /* RustType.kt:534 */
   42     63   
        #[allow(unused_mut)]
   43         -
        let mut builder = ::http::Response::builder();
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          65  +
        let mut builder = ::http_1x::Response::builder();
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   44     67   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   45     68   
            builder,
   46         -
            ::http::header::CONTENT_TYPE,
          69  +
            ::http_1x::header::CONTENT_TYPE,
   47     70   
            "application/json",
   48     71   
        );
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   49     73   
        let http_status: u16 = 200;
   50     74   
        builder = builder.status(http_status);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   51     76   
        let payload =
   52         -
            crate::protocol_serde::shape_json_enums_output::ser_json_enums_output_output_output(
   53         -
                &output,
   54         -
            )?;
          77  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_json_enums_output::ser_json_enums_output_output_output(&output)?
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   55     80   
        let content_length = payload.len();
   56     81   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     82   
            builder,
   58         -
            ::http::header::CONTENT_LENGTH,
          83  +
            ::http_1x::header::CONTENT_LENGTH,
   59     84   
            content_length,
   60     85   
        );
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   61     87   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   62     89   
        builder.body(body)?
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   63     91   
    })
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   64     93   
}
   65     94   
          95  +
/* RustType.kt:534 */
   66     96   
#[allow(clippy::unnecessary_wraps)]
          97  +
/* ServerHttpBoundProtocolGenerator.kt:471 */
   67     98   
pub fn ser_json_enums_http_error(
   68     99   
    error: &crate::error::JsonEnumsError,
   69    100   
) -> std::result::Result<
   70    101   
    ::aws_smithy_http_server::response::Response,
   71    102   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   72    103   
> {
         104  +
    /* ServerHttpBoundProtocolGenerator.kt:476 */
   73    105   
    Ok({
         106  +
        /* ServerHttpBoundProtocolGenerator.kt:492 */
   74    107   
        match error {
         108  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
   75    109   
            crate::error::JsonEnumsError::ValidationException(output) => {
         110  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
   76    111   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         112  +
                /* RustType.kt:534 */
   77    113   
                #[allow(unused_mut)]
   78         -
                let mut builder = ::http::Response::builder();
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         115  +
                let mut builder = ::http_1x::Response::builder();
         116  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
   79    117   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   80    118   
                    builder,
   81         -
                    ::http::header::CONTENT_TYPE,
         119  +
                    ::http_1x::header::CONTENT_TYPE,
   82    120   
                    "application/json",
   83    121   
                );
         122  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
   84    123   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   85    124   
                    builder,
   86         -
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         125  +
                    ::http_1x::header::HeaderName::from_static("x-amzn-errortype"),
   87    126   
                    "ValidationException",
   88    127   
                );
         128  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
   89    129   
                let content_length = payload.len();
   90    130   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   91    131   
                    builder,
   92         -
                    ::http::header::CONTENT_LENGTH,
         132  +
                    ::http_1x::header::CONTENT_LENGTH,
   93    133   
                    content_length,
   94    134   
                );
         135  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
   95    136   
                builder
   96    137   
                    .status(400)
   97    138   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
   98         -
            }
         139  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         140  +
            } /* ServerHttpBoundProtocolGenerator.kt:492 */
   99    141   
        }
         142  +
        /* ServerHttpBoundProtocolGenerator.kt:476 */
  100    143   
    })
         144  +
    /* ServerHttpBoundProtocolGenerator.kt:471 */
  101    145   
}
  102    146   
         147  +
/* JsonParserGenerator.kt:148 */
  103    148   
pub(crate) fn de_json_enums(
  104    149   
    value: &[u8],
  105    150   
    mut builder: crate::input::json_enums_input::Builder,
  106    151   
) -> ::std::result::Result<
  107    152   
    crate::input::json_enums_input::Builder,
  108    153   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  109    154   
> {
         155  +
    /* JsonParserGenerator.kt:153 */
  110    156   
    let mut tokens_owned =
  111    157   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  112    158   
            .peekable();
  113    159   
    let tokens = &mut tokens_owned;
  114    160   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         161  +
    /* JsonParserGenerator.kt:684 */
  115    162   
    loop {
         163  +
        /* JsonParserGenerator.kt:685 */
  116    164   
        match tokens.next().transpose()? {
         165  +
            /* JsonParserGenerator.kt:686 */
  117    166   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  118    167   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         168  +
                /* JsonParserGenerator.kt:260 */
  119    169   
                match key.to_unescaped()?.as_ref() {
         170  +
                    /* JsonParserGenerator.kt:262 */
  120    171   
                    "fooEnum1" => {
         172  +
                        /* JsonParserGenerator.kt:272 */
  121    173   
                        builder = builder.set_foo_enum1(
         174  +
                            /* JsonParserGenerator.kt:354 */
  122    175   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
  123    176   
                                tokens.next(),
  124    177   
                            )?
  125         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  126         -
                            .transpose()?,
         178  +
                            .map(|s|
         179  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         180  +
                                    /* JsonParserGenerator.kt:343 */u.into_owned()
         181  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         182  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  127    183   
                        );
         184  +
                        /* JsonParserGenerator.kt:262 */
  128    185   
                    }
         186  +
                    /* JsonParserGenerator.kt:262 */
  129    187   
                    "fooEnum2" => {
         188  +
                        /* JsonParserGenerator.kt:272 */
  130    189   
                        builder = builder.set_foo_enum2(
         190  +
                            /* JsonParserGenerator.kt:354 */
  131    191   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
  132    192   
                                tokens.next(),
  133    193   
                            )?
  134         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  135         -
                            .transpose()?,
         194  +
                            .map(|s|
         195  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         196  +
                                    /* JsonParserGenerator.kt:343 */u.into_owned()
         197  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         198  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  136    199   
                        );
         200  +
                        /* JsonParserGenerator.kt:262 */
  137    201   
                    }
         202  +
                    /* JsonParserGenerator.kt:262 */
  138    203   
                    "fooEnum3" => {
         204  +
                        /* JsonParserGenerator.kt:272 */
  139    205   
                        builder = builder.set_foo_enum3(
         206  +
                            /* JsonParserGenerator.kt:354 */
  140    207   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
  141    208   
                                tokens.next(),
  142    209   
                            )?
  143         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  144         -
                            .transpose()?,
         210  +
                            .map(|s|
         211  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         212  +
                                    /* JsonParserGenerator.kt:343 */u.into_owned()
         213  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         214  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  145    215   
                        );
         216  +
                        /* JsonParserGenerator.kt:262 */
  146    217   
                    }
         218  +
                    /* JsonParserGenerator.kt:262 */
  147    219   
                    "fooEnumList" => {
  148         -
                        builder = builder.set_foo_enum_list(
  149         -
                            crate::protocol_serde::shape_foo_enum_list::de_foo_enum_list(tokens)?,
  150         -
                        );
         220  +
                        /* JsonParserGenerator.kt:272 */
         221  +
                        builder =
         222  +
                            builder.set_foo_enum_list(
         223  +
                                /* JsonParserGenerator.kt:451 */
         224  +
                                crate::protocol_serde::shape_foo_enum_list::de_foo_enum_list(
         225  +
                                    tokens,
         226  +
                                )?, /* JsonParserGenerator.kt:272 */
         227  +
                            );
         228  +
                        /* JsonParserGenerator.kt:262 */
  151    229   
                    }
         230  +
                    /* JsonParserGenerator.kt:262 */
  152    231   
                    "fooEnumMap" => {
         232  +
                        /* JsonParserGenerator.kt:272 */
  153    233   
                        builder = builder.set_foo_enum_map(
  154         -
                            crate::protocol_serde::shape_foo_enum_map::de_foo_enum_map(tokens)?,
  155         -
                        );
         234  +
                            /* JsonParserGenerator.kt:509 */crate::protocol_serde::shape_foo_enum_map::de_foo_enum_map(tokens)?
         235  +
                        /* JsonParserGenerator.kt:272 */);
         236  +
                        /* JsonParserGenerator.kt:262 */
  156    237   
                    }
         238  +
                    /* JsonParserGenerator.kt:262 */
  157    239   
                    "fooEnumSet" => {
         240  +
                        /* JsonParserGenerator.kt:272 */
  158    241   
                        builder = builder.set_foo_enum_set(
  159         -
                            crate::protocol_serde::shape_foo_enum_set::de_foo_enum_set(tokens)?,
  160         -
                        );
         242  +
                            /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_foo_enum_set::de_foo_enum_set(tokens)?
         243  +
                        /* JsonParserGenerator.kt:272 */);
         244  +
                        /* JsonParserGenerator.kt:262 */
  161    245   
                    }
  162         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         246  +
                    /* JsonParserGenerator.kt:290 */
         247  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  163    248   
                }
         249  +
                /* JsonParserGenerator.kt:686 */
  164    250   
            }
         251  +
            /* JsonParserGenerator.kt:695 */
  165    252   
            other => {
  166    253   
                return Err(
  167    254   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  168    255   
                        "expected object key or end object, found: {other:?}"
  169    256   
                    )),
  170    257   
                )
  171         -
            }
         258  +
            } /* JsonParserGenerator.kt:685 */
  172    259   
        }
         260  +
        /* JsonParserGenerator.kt:684 */
  173    261   
    }
         262  +
    /* JsonParserGenerator.kt:250 */
  174    263   
    if tokens.next().is_some() {
         264  +
        /* JsonParserGenerator.kt:251 */
  175    265   
        return Err(
  176    266   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  177    267   
                "found more JSON tokens after completing parsing",
  178    268   
            ),
  179    269   
        );
         270  +
        /* JsonParserGenerator.kt:250 */
  180    271   
    }
         272  +
    /* JsonParserGenerator.kt:163 */
  181    273   
    Ok(builder)
         274  +
    /* JsonParserGenerator.kt:148 */
  182    275   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_json_enums_output.rs

@@ -1,1 +57,102 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_json_enums_output_output_output(
    3      4   
    value: &crate::output::JsonEnumsOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_json_enums_output::ser_json_enums_output_output(
    8     11   
        &mut object,
    9     12   
        value,
   10     13   
    )?;
          14  +
    /* JsonSerializerGenerator.kt:227 */
   11     15   
    object.finish();
   12     16   
    Ok(out)
          17  +
    /* JsonSerializerGenerator.kt:213 */
   13     18   
}
   14     19   
          20  +
/* JsonSerializerGenerator.kt:358 */
   15     21   
pub fn ser_json_enums_output_output(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::output::JsonEnumsOutput,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:382 */
   19     26   
    if let Some(var_1) = &input.foo_enum1 {
          27  +
        /* JsonSerializerGenerator.kt:423 */
   20     28   
        object.key("fooEnum1").string(var_1.as_str());
          29  +
        /* JsonSerializerGenerator.kt:382 */
   21     30   
    }
          31  +
    /* JsonSerializerGenerator.kt:382 */
   22     32   
    if let Some(var_2) = &input.foo_enum2 {
          33  +
        /* JsonSerializerGenerator.kt:423 */
   23     34   
        object.key("fooEnum2").string(var_2.as_str());
          35  +
        /* JsonSerializerGenerator.kt:382 */
   24     36   
    }
          37  +
    /* JsonSerializerGenerator.kt:382 */
   25     38   
    if let Some(var_3) = &input.foo_enum3 {
          39  +
        /* JsonSerializerGenerator.kt:423 */
   26     40   
        object.key("fooEnum3").string(var_3.as_str());
          41  +
        /* JsonSerializerGenerator.kt:382 */
   27     42   
    }
          43  +
    /* JsonSerializerGenerator.kt:382 */
   28     44   
    if let Some(var_4) = &input.foo_enum_list {
          45  +
        /* JsonSerializerGenerator.kt:484 */
   29     46   
        let mut array_5 = object.key("fooEnumList").start_array();
          47  +
        /* JsonSerializerGenerator.kt:524 */
   30     48   
        for item_6 in var_4 {
          49  +
            /* SerializerUtil.kt:42 */
   31     50   
            {
          51  +
                /* JsonSerializerGenerator.kt:423 */
   32     52   
                array_5.value().string(item_6.as_str());
          53  +
                /* SerializerUtil.kt:42 */
   33     54   
            }
          55  +
            /* JsonSerializerGenerator.kt:524 */
   34     56   
        }
          57  +
        /* JsonSerializerGenerator.kt:486 */
   35     58   
        array_5.finish();
          59  +
        /* JsonSerializerGenerator.kt:382 */
   36     60   
    }
          61  +
    /* JsonSerializerGenerator.kt:382 */
   37     62   
    if let Some(var_7) = &input.foo_enum_map {
          63  +
        /* JsonSerializerGenerator.kt:495 */
   38     64   
        #[allow(unused_mut)]
          65  +
        /* JsonSerializerGenerator.kt:496 */
   39     66   
        let mut object_8 = object.key("fooEnumMap").start_object();
          67  +
        /* JsonSerializerGenerator.kt:537 */
   40     68   
        for (key_9, value_10) in var_7 {
          69  +
            /* SerializerUtil.kt:42 */
   41     70   
            {
          71  +
                /* JsonSerializerGenerator.kt:423 */
   42     72   
                object_8.key(key_9.as_str()).string(value_10.as_str());
          73  +
                /* SerializerUtil.kt:42 */
   43     74   
            }
          75  +
            /* JsonSerializerGenerator.kt:537 */
   44     76   
        }
          77  +
        /* JsonSerializerGenerator.kt:515 */
   45     78   
        object_8.finish();
          79  +
        /* JsonSerializerGenerator.kt:382 */
   46     80   
    }
          81  +
    /* JsonSerializerGenerator.kt:382 */
   47     82   
    if let Some(var_11) = &input.foo_enum_set {
          83  +
        /* JsonSerializerGenerator.kt:484 */
   48     84   
        let mut array_12 = object.key("fooEnumSet").start_array();
          85  +
        /* JsonSerializerGenerator.kt:524 */
   49     86   
        for item_13 in &var_11.0 {
          87  +
            /* SerializerUtil.kt:42 */
   50     88   
            {
          89  +
                /* JsonSerializerGenerator.kt:423 */
   51     90   
                array_12.value().string(item_13.as_str());
          91  +
                /* SerializerUtil.kt:42 */
   52     92   
            }
          93  +
            /* JsonSerializerGenerator.kt:524 */
   53     94   
        }
          95  +
        /* JsonSerializerGenerator.kt:486 */
   54     96   
        array_12.finish();
          97  +
        /* JsonSerializerGenerator.kt:382 */
   55     98   
    }
          99  +
    /* JsonSerializerGenerator.kt:372 */
   56    100   
    Ok(())
         101  +
    /* JsonSerializerGenerator.kt:358 */
   57    102   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_json_int_enums.rs

@@ -1,1 +190,274 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_json_int_enums_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::JsonIntEnumsInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::json_int_enums_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   22         -
        let bytes = ::hyper::body::to_bytes(body).await?;
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:789 */
          30  +
        let bytes = {
          31  +
            use ::http_body_util::BodyExt;
          32  +
            body.collect().await?.to_bytes()
          33  +
        };
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:825 */
   23     35   
        if !bytes.is_empty() {
          36  +
            /* ServerHttpBoundProtocolGenerator.kt:826 */
   24     37   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     38   
                &headers,
   26     39   
                Some("application/json"),
   27     40   
            )?;
   28     41   
            input = crate::protocol_serde::shape_json_int_enums::de_json_int_enums(
   29     42   
                bytes.as_ref(),
   30     43   
                input,
   31     44   
            )?;
          45  +
            /* ServerHttpBoundProtocolGenerator.kt:825 */
   32     46   
        }
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   33     48   
        input.build()?
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   34     50   
    })
          51  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   35     52   
}
   36     53   
          54  +
/* RustType.kt:534 */
   37     55   
#[allow(clippy::unnecessary_wraps)]
          56  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   38     57   
pub fn ser_json_int_enums_http_response(
   39     58   
    #[allow(unused_variables)] output: crate::output::JsonIntEnumsOutput,
   40     59   
) -> std::result::Result<
   41     60   
    ::aws_smithy_http_server::response::Response,
   42     61   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   43     62   
> {
          63  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   44     64   
    Ok({
          65  +
        /* RustType.kt:534 */
   45     66   
        #[allow(unused_mut)]
   46         -
        let mut builder = ::http::Response::builder();
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          68  +
        let mut builder = ::http_1x::Response::builder();
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   47     70   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   48     71   
            builder,
   49         -
            ::http::header::CONTENT_TYPE,
          72  +
            ::http_1x::header::CONTENT_TYPE,
   50     73   
            "application/json",
   51     74   
        );
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   52     76   
        let http_status: u16 = 200;
   53     77   
        builder = builder.status(http_status);
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   54     79   
        let payload =
   55         -
            crate::protocol_serde::shape_json_int_enums_output::ser_json_int_enums_output_output_output(&output)?
   56         -
        ;
          80  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_json_int_enums_output::ser_json_int_enums_output_output_output(&output)?
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   57     83   
        let content_length = payload.len();
   58     84   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   59     85   
            builder,
   60         -
            ::http::header::CONTENT_LENGTH,
          86  +
            ::http_1x::header::CONTENT_LENGTH,
   61     87   
            content_length,
   62     88   
        );
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   63     90   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   64     92   
        builder.body(body)?
          93  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   65     94   
    })
          95  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   66     96   
}
   67     97   
          98  +
/* RustType.kt:534 */
   68     99   
#[allow(clippy::unnecessary_wraps)]
         100  +
/* ServerHttpBoundProtocolGenerator.kt:471 */
   69    101   
pub fn ser_json_int_enums_http_error(
   70    102   
    error: &crate::error::JsonIntEnumsError,
   71    103   
) -> std::result::Result<
   72    104   
    ::aws_smithy_http_server::response::Response,
   73    105   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   74    106   
> {
         107  +
    /* ServerHttpBoundProtocolGenerator.kt:476 */
   75    108   
    Ok({
         109  +
        /* ServerHttpBoundProtocolGenerator.kt:492 */
   76    110   
        match error {
         111  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
   77    112   
            crate::error::JsonIntEnumsError::ValidationException(output) => {
         113  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
   78    114   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         115  +
                /* RustType.kt:534 */
   79    116   
                #[allow(unused_mut)]
   80         -
                let mut builder = ::http::Response::builder();
         117  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         118  +
                let mut builder = ::http_1x::Response::builder();
         119  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
   81    120   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   82    121   
                    builder,
   83         -
                    ::http::header::CONTENT_TYPE,
         122  +
                    ::http_1x::header::CONTENT_TYPE,
   84    123   
                    "application/json",
   85    124   
                );
         125  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
   86    126   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   87    127   
                    builder,
   88         -
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         128  +
                    ::http_1x::header::HeaderName::from_static("x-amzn-errortype"),
   89    129   
                    "ValidationException",
   90    130   
                );
         131  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
   91    132   
                let content_length = payload.len();
   92    133   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   93    134   
                    builder,
   94         -
                    ::http::header::CONTENT_LENGTH,
         135  +
                    ::http_1x::header::CONTENT_LENGTH,
   95    136   
                    content_length,
   96    137   
                );
         138  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
   97    139   
                builder
   98    140   
                    .status(400)
   99    141   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  100         -
            }
         142  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         143  +
            } /* ServerHttpBoundProtocolGenerator.kt:492 */
  101    144   
        }
         145  +
        /* ServerHttpBoundProtocolGenerator.kt:476 */
  102    146   
    })
         147  +
    /* ServerHttpBoundProtocolGenerator.kt:471 */
  103    148   
}
  104    149   
         150  +
/* JsonParserGenerator.kt:148 */
  105    151   
pub(crate) fn de_json_int_enums(
  106    152   
    value: &[u8],
  107    153   
    mut builder: crate::input::json_int_enums_input::Builder,
  108    154   
) -> ::std::result::Result<
  109    155   
    crate::input::json_int_enums_input::Builder,
  110    156   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  111    157   
> {
         158  +
    /* JsonParserGenerator.kt:153 */
  112    159   
    let mut tokens_owned =
  113    160   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  114    161   
            .peekable();
  115    162   
    let tokens = &mut tokens_owned;
  116    163   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         164  +
    /* JsonParserGenerator.kt:684 */
  117    165   
    loop {
         166  +
        /* JsonParserGenerator.kt:685 */
  118    167   
        match tokens.next().transpose()? {
         168  +
            /* JsonParserGenerator.kt:686 */
  119    169   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  120    170   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         171  +
                /* JsonParserGenerator.kt:260 */
  121    172   
                match key.to_unescaped()?.as_ref() {
         173  +
                    /* JsonParserGenerator.kt:262 */
  122    174   
                    "integerEnum1" => {
         175  +
                        /* JsonParserGenerator.kt:272 */
  123    176   
                        builder = builder.set_integer_enum1(
         177  +
                            /* JsonParserGenerator.kt:365 */
  124    178   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
  125    179   
                                tokens.next(),
  126    180   
                            )?
  127    181   
                            .map(i32::try_from)
  128         -
                            .transpose()?,
         182  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  129    183   
                        );
         184  +
                        /* JsonParserGenerator.kt:262 */
  130    185   
                    }
         186  +
                    /* JsonParserGenerator.kt:262 */
  131    187   
                    "integerEnum2" => {
         188  +
                        /* JsonParserGenerator.kt:272 */
  132    189   
                        builder = builder.set_integer_enum2(
         190  +
                            /* JsonParserGenerator.kt:365 */
  133    191   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
  134    192   
                                tokens.next(),
  135    193   
                            )?
  136    194   
                            .map(i32::try_from)
  137         -
                            .transpose()?,
         195  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  138    196   
                        );
         197  +
                        /* JsonParserGenerator.kt:262 */
  139    198   
                    }
         199  +
                    /* JsonParserGenerator.kt:262 */
  140    200   
                    "integerEnum3" => {
         201  +
                        /* JsonParserGenerator.kt:272 */
  141    202   
                        builder = builder.set_integer_enum3(
         203  +
                            /* JsonParserGenerator.kt:365 */
  142    204   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
  143    205   
                                tokens.next(),
  144    206   
                            )?
  145    207   
                            .map(i32::try_from)
  146         -
                            .transpose()?,
         208  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  147    209   
                        );
         210  +
                        /* JsonParserGenerator.kt:262 */
  148    211   
                    }
         212  +
                    /* JsonParserGenerator.kt:262 */
  149    213   
                    "integerEnumList" => {
         214  +
                        /* JsonParserGenerator.kt:272 */
  150    215   
                        builder = builder.set_integer_enum_list(
         216  +
                            /* JsonParserGenerator.kt:451 */
  151    217   
                            crate::protocol_serde::shape_integer_enum_list::de_integer_enum_list(
  152    218   
                                tokens,
  153         -
                            )?,
         219  +
                            )?, /* JsonParserGenerator.kt:272 */
  154    220   
                        );
         221  +
                        /* JsonParserGenerator.kt:262 */
  155    222   
                    }
         223  +
                    /* JsonParserGenerator.kt:262 */
  156    224   
                    "integerEnumMap" => {
         225  +
                        /* JsonParserGenerator.kt:272 */
  157    226   
                        builder = builder.set_integer_enum_map(
         227  +
                            /* JsonParserGenerator.kt:509 */
  158    228   
                            crate::protocol_serde::shape_integer_enum_map::de_integer_enum_map(
  159    229   
                                tokens,
  160         -
                            )?,
         230  +
                            )?, /* JsonParserGenerator.kt:272 */
  161    231   
                        );
         232  +
                        /* JsonParserGenerator.kt:262 */
  162    233   
                    }
         234  +
                    /* JsonParserGenerator.kt:262 */
  163    235   
                    "integerEnumSet" => {
         236  +
                        /* JsonParserGenerator.kt:272 */
  164    237   
                        builder = builder.set_integer_enum_set(
         238  +
                            /* JsonParserGenerator.kt:451 */
  165    239   
                            crate::protocol_serde::shape_integer_enum_set::de_integer_enum_set(
  166    240   
                                tokens,
  167         -
                            )?,
         241  +
                            )?, /* JsonParserGenerator.kt:272 */
  168    242   
                        );
         243  +
                        /* JsonParserGenerator.kt:262 */
  169    244   
                    }
  170         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         245  +
                    /* JsonParserGenerator.kt:290 */
         246  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  171    247   
                }
         248  +
                /* JsonParserGenerator.kt:686 */
  172    249   
            }
         250  +
            /* JsonParserGenerator.kt:695 */
  173    251   
            other => {
  174    252   
                return Err(
  175    253   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  176    254   
                        "expected object key or end object, found: {other:?}"
  177    255   
                    )),
  178    256   
                )
  179         -
            }
         257  +
            } /* JsonParserGenerator.kt:685 */
  180    258   
        }
         259  +
        /* JsonParserGenerator.kt:684 */
  181    260   
    }
         261  +
    /* JsonParserGenerator.kt:250 */
  182    262   
    if tokens.next().is_some() {
         263  +
        /* JsonParserGenerator.kt:251 */
  183    264   
        return Err(
  184    265   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  185    266   
                "found more JSON tokens after completing parsing",
  186    267   
            ),
  187    268   
        );
         269  +
        /* JsonParserGenerator.kt:250 */
  188    270   
    }
         271  +
    /* JsonParserGenerator.kt:163 */
  189    272   
    Ok(builder)
         273  +
    /* JsonParserGenerator.kt:148 */
  190    274   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_json_int_enums_output.rs

@@ -1,1 +75,120 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_json_int_enums_output_output_output(
    3      4   
    value: &crate::output::JsonIntEnumsOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_json_int_enums_output::ser_json_int_enums_output_output(
    8     11   
        &mut object,
    9     12   
        value,
   10     13   
    )?;
          14  +
    /* JsonSerializerGenerator.kt:227 */
   11     15   
    object.finish();
   12     16   
    Ok(out)
          17  +
    /* JsonSerializerGenerator.kt:213 */
   13     18   
}
   14     19   
          20  +
/* JsonSerializerGenerator.kt:358 */
   15     21   
pub fn ser_json_int_enums_output_output(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::output::JsonIntEnumsOutput,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:382 */
   19     26   
    if let Some(var_1) = &input.integer_enum1 {
          27  +
        /* JsonSerializerGenerator.kt:432 */
   20     28   
        object.key("integerEnum1").number(
   21     29   
            #[allow(clippy::useless_conversion)]
   22     30   
            ::aws_smithy_types::Number::NegInt((*var_1).into()),
   23     31   
        );
          32  +
        /* JsonSerializerGenerator.kt:382 */
   24     33   
    }
          34  +
    /* JsonSerializerGenerator.kt:382 */
   25     35   
    if let Some(var_2) = &input.integer_enum2 {
          36  +
        /* JsonSerializerGenerator.kt:432 */
   26     37   
        object.key("integerEnum2").number(
   27     38   
            #[allow(clippy::useless_conversion)]
   28     39   
            ::aws_smithy_types::Number::NegInt((*var_2).into()),
   29     40   
        );
          41  +
        /* JsonSerializerGenerator.kt:382 */
   30     42   
    }
          43  +
    /* JsonSerializerGenerator.kt:382 */
   31     44   
    if let Some(var_3) = &input.integer_enum3 {
          45  +
        /* JsonSerializerGenerator.kt:432 */
   32     46   
        object.key("integerEnum3").number(
   33     47   
            #[allow(clippy::useless_conversion)]
   34     48   
            ::aws_smithy_types::Number::NegInt((*var_3).into()),
   35     49   
        );
          50  +
        /* JsonSerializerGenerator.kt:382 */
   36     51   
    }
          52  +
    /* JsonSerializerGenerator.kt:382 */
   37     53   
    if let Some(var_4) = &input.integer_enum_list {
          54  +
        /* JsonSerializerGenerator.kt:484 */
   38     55   
        let mut array_5 = object.key("integerEnumList").start_array();
          56  +
        /* JsonSerializerGenerator.kt:524 */
   39     57   
        for item_6 in var_4 {
          58  +
            /* SerializerUtil.kt:42 */
   40     59   
            {
          60  +
                /* JsonSerializerGenerator.kt:432 */
   41     61   
                array_5.value().number(
   42     62   
                    #[allow(clippy::useless_conversion)]
   43     63   
                    ::aws_smithy_types::Number::NegInt((*item_6).into()),
   44     64   
                );
          65  +
                /* SerializerUtil.kt:42 */
   45     66   
            }
          67  +
            /* JsonSerializerGenerator.kt:524 */
   46     68   
        }
          69  +
        /* JsonSerializerGenerator.kt:486 */
   47     70   
        array_5.finish();
          71  +
        /* JsonSerializerGenerator.kt:382 */
   48     72   
    }
          73  +
    /* JsonSerializerGenerator.kt:382 */
   49     74   
    if let Some(var_7) = &input.integer_enum_map {
          75  +
        /* JsonSerializerGenerator.kt:495 */
   50     76   
        #[allow(unused_mut)]
          77  +
        /* JsonSerializerGenerator.kt:496 */
   51     78   
        let mut object_8 = object.key("integerEnumMap").start_object();
          79  +
        /* JsonSerializerGenerator.kt:537 */
   52     80   
        for (key_9, value_10) in var_7 {
          81  +
            /* SerializerUtil.kt:42 */
   53     82   
            {
          83  +
                /* JsonSerializerGenerator.kt:432 */
   54     84   
                object_8.key(key_9.as_str()).number(
   55     85   
                    #[allow(clippy::useless_conversion)]
   56     86   
                    ::aws_smithy_types::Number::NegInt((*value_10).into()),
   57     87   
                );
          88  +
                /* SerializerUtil.kt:42 */
   58     89   
            }
          90  +
            /* JsonSerializerGenerator.kt:537 */
   59     91   
        }
          92  +
        /* JsonSerializerGenerator.kt:515 */
   60     93   
        object_8.finish();
          94  +
        /* JsonSerializerGenerator.kt:382 */
   61     95   
    }
          96  +
    /* JsonSerializerGenerator.kt:382 */
   62     97   
    if let Some(var_11) = &input.integer_enum_set {
          98  +
        /* JsonSerializerGenerator.kt:484 */
   63     99   
        let mut array_12 = object.key("integerEnumSet").start_array();
         100  +
        /* JsonSerializerGenerator.kt:524 */
   64    101   
        for item_13 in &var_11.0 {
         102  +
            /* SerializerUtil.kt:42 */
   65    103   
            {
         104  +
                /* JsonSerializerGenerator.kt:432 */
   66    105   
                array_12.value().number(
   67    106   
                    #[allow(clippy::useless_conversion)]
   68    107   
                    ::aws_smithy_types::Number::NegInt((*item_13).into()),
   69    108   
                );
         109  +
                /* SerializerUtil.kt:42 */
   70    110   
            }
         111  +
            /* JsonSerializerGenerator.kt:524 */
   71    112   
        }
         113  +
        /* JsonSerializerGenerator.kt:486 */
   72    114   
        array_12.finish();
         115  +
        /* JsonSerializerGenerator.kt:382 */
   73    116   
    }
         117  +
    /* JsonSerializerGenerator.kt:372 */
   74    118   
    Ok(())
         119  +
    /* JsonSerializerGenerator.kt:358 */
   75    120   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_json_lists.rs

@@ -1,1 +189,289 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_json_lists_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::JsonListsInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::json_lists_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   22         -
        let bytes = ::hyper::body::to_bytes(body).await?;
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:789 */
          30  +
        let bytes = {
          31  +
            use ::http_body_util::BodyExt;
          32  +
            body.collect().await?.to_bytes()
          33  +
        };
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:825 */
   23     35   
        if !bytes.is_empty() {
          36  +
            /* ServerHttpBoundProtocolGenerator.kt:826 */
   24     37   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     38   
                &headers,
   26     39   
                Some("application/json"),
   27     40   
            )?;
   28     41   
            input = crate::protocol_serde::shape_json_lists::de_json_lists(bytes.as_ref(), input)?;
          42  +
            /* ServerHttpBoundProtocolGenerator.kt:825 */
   29     43   
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   30     45   
        input.build()?
          46  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   31     47   
    })
          48  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   32     49   
}
   33     50   
          51  +
/* RustType.kt:534 */
   34     52   
#[allow(clippy::unnecessary_wraps)]
          53  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   35     54   
pub fn ser_json_lists_http_response(
   36     55   
    #[allow(unused_variables)] output: crate::output::JsonListsOutput,
   37     56   
) -> std::result::Result<
   38     57   
    ::aws_smithy_http_server::response::Response,
   39     58   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   40     59   
> {
          60  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   41     61   
    Ok({
          62  +
        /* RustType.kt:534 */
   42     63   
        #[allow(unused_mut)]
   43         -
        let mut builder = ::http::Response::builder();
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          65  +
        let mut builder = ::http_1x::Response::builder();
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   44     67   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   45     68   
            builder,
   46         -
            ::http::header::CONTENT_TYPE,
          69  +
            ::http_1x::header::CONTENT_TYPE,
   47     70   
            "application/json",
   48     71   
        );
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   49     73   
        let http_status: u16 = 200;
   50     74   
        builder = builder.status(http_status);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   51     76   
        let payload =
   52         -
            crate::protocol_serde::shape_json_lists_output::ser_json_lists_output_output_output(
   53         -
                &output,
   54         -
            )?;
          77  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_json_lists_output::ser_json_lists_output_output_output(&output)?
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   55     80   
        let content_length = payload.len();
   56     81   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     82   
            builder,
   58         -
            ::http::header::CONTENT_LENGTH,
          83  +
            ::http_1x::header::CONTENT_LENGTH,
   59     84   
            content_length,
   60     85   
        );
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   61     87   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   62     89   
        builder.body(body)?
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   63     91   
    })
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   64     93   
}
   65     94   
          95  +
/* RustType.kt:534 */
   66     96   
#[allow(clippy::unnecessary_wraps)]
          97  +
/* ServerHttpBoundProtocolGenerator.kt:471 */
   67     98   
pub fn ser_json_lists_http_error(
   68     99   
    error: &crate::error::JsonListsError,
   69    100   
) -> std::result::Result<
   70    101   
    ::aws_smithy_http_server::response::Response,
   71    102   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   72    103   
> {
         104  +
    /* ServerHttpBoundProtocolGenerator.kt:476 */
   73    105   
    Ok({
         106  +
        /* ServerHttpBoundProtocolGenerator.kt:492 */
   74    107   
        match error {
         108  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
   75    109   
            crate::error::JsonListsError::ValidationException(output) => {
         110  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
   76    111   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         112  +
                /* RustType.kt:534 */
   77    113   
                #[allow(unused_mut)]
   78         -
                let mut builder = ::http::Response::builder();
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         115  +
                let mut builder = ::http_1x::Response::builder();
         116  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
   79    117   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   80    118   
                    builder,
   81         -
                    ::http::header::CONTENT_TYPE,
         119  +
                    ::http_1x::header::CONTENT_TYPE,
   82    120   
                    "application/json",
   83    121   
                );
         122  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
   84    123   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   85    124   
                    builder,
   86         -
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         125  +
                    ::http_1x::header::HeaderName::from_static("x-amzn-errortype"),
   87    126   
                    "ValidationException",
   88    127   
                );
         128  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
   89    129   
                let content_length = payload.len();
   90    130   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   91    131   
                    builder,
   92         -
                    ::http::header::CONTENT_LENGTH,
         132  +
                    ::http_1x::header::CONTENT_LENGTH,
   93    133   
                    content_length,
   94    134   
                );
         135  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
   95    136   
                builder
   96    137   
                    .status(400)
   97    138   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
   98         -
            }
         139  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         140  +
            } /* ServerHttpBoundProtocolGenerator.kt:492 */
   99    141   
        }
         142  +
        /* ServerHttpBoundProtocolGenerator.kt:476 */
  100    143   
    })
         144  +
    /* ServerHttpBoundProtocolGenerator.kt:471 */
  101    145   
}
  102    146   
         147  +
/* JsonParserGenerator.kt:148 */
  103    148   
pub(crate) fn de_json_lists(
  104    149   
    value: &[u8],
  105    150   
    mut builder: crate::input::json_lists_input::Builder,
  106    151   
) -> ::std::result::Result<
  107    152   
    crate::input::json_lists_input::Builder,
  108    153   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  109    154   
> {
         155  +
    /* JsonParserGenerator.kt:153 */
  110    156   
    let mut tokens_owned =
  111    157   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  112    158   
            .peekable();
  113    159   
    let tokens = &mut tokens_owned;
  114    160   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         161  +
    /* JsonParserGenerator.kt:684 */
  115    162   
    loop {
         163  +
        /* JsonParserGenerator.kt:685 */
  116    164   
        match tokens.next().transpose()? {
         165  +
            /* JsonParserGenerator.kt:686 */
  117    166   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  118    167   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         168  +
                /* JsonParserGenerator.kt:260 */
  119    169   
                match key.to_unescaped()?.as_ref() {
         170  +
                    /* JsonParserGenerator.kt:262 */
  120    171   
                    "booleanList" => {
         172  +
                        /* JsonParserGenerator.kt:272 */
  121    173   
                        builder = builder.set_boolean_list(
  122         -
                            crate::protocol_serde::shape_boolean_list::de_boolean_list(tokens)?,
  123         -
                        );
         174  +
                            /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_boolean_list::de_boolean_list(tokens)?
         175  +
                        /* JsonParserGenerator.kt:272 */);
         176  +
                        /* JsonParserGenerator.kt:262 */
  124    177   
                    }
         178  +
                    /* JsonParserGenerator.kt:262 */
  125    179   
                    "enumList" => {
  126         -
                        builder = builder.set_enum_list(
  127         -
                            crate::protocol_serde::shape_foo_enum_list::de_foo_enum_list(tokens)?,
  128         -
                        );
         180  +
                        /* JsonParserGenerator.kt:272 */
         181  +
                        builder =
         182  +
                            builder.set_enum_list(
         183  +
                                /* JsonParserGenerator.kt:451 */
         184  +
                                crate::protocol_serde::shape_foo_enum_list::de_foo_enum_list(
         185  +
                                    tokens,
         186  +
                                )?, /* JsonParserGenerator.kt:272 */
         187  +
                            );
         188  +
                        /* JsonParserGenerator.kt:262 */
  129    189   
                    }
         190  +
                    /* JsonParserGenerator.kt:262 */
  130    191   
                    "intEnumList" => {
         192  +
                        /* JsonParserGenerator.kt:272 */
  131    193   
                        builder = builder.set_int_enum_list(
         194  +
                            /* JsonParserGenerator.kt:451 */
  132    195   
                            crate::protocol_serde::shape_integer_enum_list::de_integer_enum_list(
  133    196   
                                tokens,
  134         -
                            )?,
         197  +
                            )?, /* JsonParserGenerator.kt:272 */
  135    198   
                        );
         199  +
                        /* JsonParserGenerator.kt:262 */
  136    200   
                    }
         201  +
                    /* JsonParserGenerator.kt:262 */
  137    202   
                    "integerList" => {
         203  +
                        /* JsonParserGenerator.kt:272 */
  138    204   
                        builder = builder.set_integer_list(
  139         -
                            crate::protocol_serde::shape_integer_list::de_integer_list(tokens)?,
  140         -
                        );
         205  +
                            /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_integer_list::de_integer_list(tokens)?
         206  +
                        /* JsonParserGenerator.kt:272 */);
         207  +
                        /* JsonParserGenerator.kt:262 */
  141    208   
                    }
         209  +
                    /* JsonParserGenerator.kt:262 */
  142    210   
                    "nestedStringList" => {
         211  +
                        /* JsonParserGenerator.kt:272 */
  143    212   
                        builder = builder.set_nested_string_list(
         213  +
                            /* JsonParserGenerator.kt:451 */
  144    214   
                            crate::protocol_serde::shape_nested_string_list::de_nested_string_list(
  145    215   
                                tokens,
  146         -
                            )?,
         216  +
                            )?, /* JsonParserGenerator.kt:272 */
  147    217   
                        );
         218  +
                        /* JsonParserGenerator.kt:262 */
  148    219   
                    }
         220  +
                    /* JsonParserGenerator.kt:262 */
  149    221   
                    "stringList" => {
         222  +
                        /* JsonParserGenerator.kt:272 */
  150    223   
                        builder = builder.set_string_list(
  151         -
                            crate::protocol_serde::shape_string_list::de_string_list(tokens)?,
  152         -
                        );
         224  +
                            /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_string_list::de_string_list(tokens)?
         225  +
                        /* JsonParserGenerator.kt:272 */);
         226  +
                        /* JsonParserGenerator.kt:262 */
  153    227   
                    }
         228  +
                    /* JsonParserGenerator.kt:262 */
  154    229   
                    "stringSet" => {
         230  +
                        /* JsonParserGenerator.kt:272 */
  155    231   
                        builder = builder.set_string_set(
  156         -
                            crate::protocol_serde::shape_string_set::de_string_set(tokens)?,
  157         -
                        );
         232  +
                            /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_string_set::de_string_set(tokens)?
         233  +
                        /* JsonParserGenerator.kt:272 */);
         234  +
                        /* JsonParserGenerator.kt:262 */
  158    235   
                    }
         236  +
                    /* JsonParserGenerator.kt:262 */
  159    237   
                    "myStructureList" => {
  160         -
                        builder = builder.set_structure_list(
  161         -
                            crate::protocol_serde::shape_structure_list::de_structure_list(tokens)?,
  162         -
                        );
         238  +
                        /* JsonParserGenerator.kt:272 */
         239  +
                        builder =
         240  +
                            builder.set_structure_list(
         241  +
                                /* JsonParserGenerator.kt:451 */
         242  +
                                crate::protocol_serde::shape_structure_list::de_structure_list(
         243  +
                                    tokens,
         244  +
                                )?, /* JsonParserGenerator.kt:272 */
         245  +
                            );
         246  +
                        /* JsonParserGenerator.kt:262 */
  163    247   
                    }
         248  +
                    /* JsonParserGenerator.kt:262 */
  164    249   
                    "timestampList" => {
  165         -
                        builder = builder.set_timestamp_list(
  166         -
                            crate::protocol_serde::shape_timestamp_list::de_timestamp_list(tokens)?,
  167         -
                        );
         250  +
                        /* JsonParserGenerator.kt:272 */
         251  +
                        builder =
         252  +
                            builder.set_timestamp_list(
         253  +
                                /* JsonParserGenerator.kt:451 */
         254  +
                                crate::protocol_serde::shape_timestamp_list::de_timestamp_list(
         255  +
                                    tokens,
         256  +
                                )?, /* JsonParserGenerator.kt:272 */
         257  +
                            );
         258  +
                        /* JsonParserGenerator.kt:262 */
  168    259   
                    }
  169         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         260  +
                    /* JsonParserGenerator.kt:290 */
         261  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  170    262   
                }
         263  +
                /* JsonParserGenerator.kt:686 */
  171    264   
            }
         265  +
            /* JsonParserGenerator.kt:695 */
  172    266   
            other => {
  173    267   
                return Err(
  174    268   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  175    269   
                        "expected object key or end object, found: {other:?}"
  176    270   
                    )),
  177    271   
                )
  178         -
            }
         272  +
            } /* JsonParserGenerator.kt:685 */
  179    273   
        }
         274  +
        /* JsonParserGenerator.kt:684 */
  180    275   
    }
         276  +
    /* JsonParserGenerator.kt:250 */
  181    277   
    if tokens.next().is_some() {
         278  +
        /* JsonParserGenerator.kt:251 */
  182    279   
        return Err(
  183    280   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  184    281   
                "found more JSON tokens after completing parsing",
  185    282   
            ),
  186    283   
        );
         284  +
        /* JsonParserGenerator.kt:250 */
  187    285   
    }
         286  +
    /* JsonParserGenerator.kt:163 */
  188    287   
    Ok(builder)
         288  +
    /* JsonParserGenerator.kt:148 */
  189    289   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_json_lists_output.rs

@@ -1,1 +121,219 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_json_lists_output_output_output(
    3      4   
    value: &crate::output::JsonListsOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_json_lists_output::ser_json_lists_output_output(
    8     11   
        &mut object,
    9     12   
        value,
   10     13   
    )?;
          14  +
    /* JsonSerializerGenerator.kt:227 */
   11     15   
    object.finish();
   12     16   
    Ok(out)
          17  +
    /* JsonSerializerGenerator.kt:213 */
   13     18   
}
   14     19   
          20  +
/* JsonSerializerGenerator.kt:358 */
   15     21   
pub fn ser_json_lists_output_output(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::output::JsonListsOutput,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:382 */
   19     26   
    if let Some(var_1) = &input.boolean_list {
          27  +
        /* JsonSerializerGenerator.kt:484 */
   20     28   
        let mut array_2 = object.key("booleanList").start_array();
          29  +
        /* JsonSerializerGenerator.kt:524 */
   21     30   
        for item_3 in var_1 {
          31  +
            /* SerializerUtil.kt:42 */
   22     32   
            {
          33  +
                /* JsonSerializerGenerator.kt:424 */
   23     34   
                array_2.value().boolean(*item_3);
          35  +
                /* SerializerUtil.kt:42 */
   24     36   
            }
          37  +
            /* JsonSerializerGenerator.kt:524 */
   25     38   
        }
          39  +
        /* JsonSerializerGenerator.kt:486 */
   26     40   
        array_2.finish();
          41  +
        /* JsonSerializerGenerator.kt:382 */
   27     42   
    }
          43  +
    /* JsonSerializerGenerator.kt:382 */
   28     44   
    if let Some(var_4) = &input.enum_list {
          45  +
        /* JsonSerializerGenerator.kt:484 */
   29     46   
        let mut array_5 = object.key("enumList").start_array();
          47  +
        /* JsonSerializerGenerator.kt:524 */
   30     48   
        for item_6 in var_4 {
          49  +
            /* SerializerUtil.kt:42 */
   31     50   
            {
          51  +
                /* JsonSerializerGenerator.kt:423 */
   32     52   
                array_5.value().string(item_6.as_str());
          53  +
                /* SerializerUtil.kt:42 */
   33     54   
            }
          55  +
            /* JsonSerializerGenerator.kt:524 */
   34     56   
        }
          57  +
        /* JsonSerializerGenerator.kt:486 */
   35     58   
        array_5.finish();
          59  +
        /* JsonSerializerGenerator.kt:382 */
   36     60   
    }
          61  +
    /* JsonSerializerGenerator.kt:382 */
   37     62   
    if let Some(var_7) = &input.int_enum_list {
          63  +
        /* JsonSerializerGenerator.kt:484 */
   38     64   
        let mut array_8 = object.key("intEnumList").start_array();
          65  +
        /* JsonSerializerGenerator.kt:524 */
   39     66   
        for item_9 in var_7 {
          67  +
            /* SerializerUtil.kt:42 */
   40     68   
            {
          69  +
                /* JsonSerializerGenerator.kt:432 */
   41     70   
                array_8.value().number(
   42     71   
                    #[allow(clippy::useless_conversion)]
   43     72   
                    ::aws_smithy_types::Number::NegInt((*item_9).into()),
   44     73   
                );
          74  +
                /* SerializerUtil.kt:42 */
   45     75   
            }
          76  +
            /* JsonSerializerGenerator.kt:524 */
   46     77   
        }
          78  +
        /* JsonSerializerGenerator.kt:486 */
   47     79   
        array_8.finish();
          80  +
        /* JsonSerializerGenerator.kt:382 */
   48     81   
    }
          82  +
    /* JsonSerializerGenerator.kt:382 */
   49     83   
    if let Some(var_10) = &input.integer_list {
          84  +
        /* JsonSerializerGenerator.kt:484 */
   50     85   
        let mut array_11 = object.key("integerList").start_array();
          86  +
        /* JsonSerializerGenerator.kt:524 */
   51     87   
        for item_12 in var_10 {
          88  +
            /* SerializerUtil.kt:42 */
   52     89   
            {
          90  +
                /* JsonSerializerGenerator.kt:432 */
   53     91   
                array_11.value().number(
   54     92   
                    #[allow(clippy::useless_conversion)]
   55     93   
                    ::aws_smithy_types::Number::NegInt((*item_12).into()),
   56     94   
                );
          95  +
                /* SerializerUtil.kt:42 */
   57     96   
            }
          97  +
            /* JsonSerializerGenerator.kt:524 */
   58     98   
        }
          99  +
        /* JsonSerializerGenerator.kt:486 */
   59    100   
        array_11.finish();
         101  +
        /* JsonSerializerGenerator.kt:382 */
   60    102   
    }
         103  +
    /* JsonSerializerGenerator.kt:382 */
   61    104   
    if let Some(var_13) = &input.nested_string_list {
         105  +
        /* JsonSerializerGenerator.kt:484 */
   62    106   
        let mut array_14 = object.key("nestedStringList").start_array();
         107  +
        /* JsonSerializerGenerator.kt:524 */
   63    108   
        for item_15 in var_13 {
         109  +
            /* SerializerUtil.kt:42 */
   64    110   
            {
         111  +
                /* JsonSerializerGenerator.kt:484 */
   65    112   
                let mut array_16 = array_14.value().start_array();
         113  +
                /* JsonSerializerGenerator.kt:524 */
   66    114   
                for item_17 in item_15 {
         115  +
                    /* SerializerUtil.kt:42 */
   67    116   
                    {
         117  +
                        /* JsonSerializerGenerator.kt:423 */
   68    118   
                        array_16.value().string(item_17.as_str());
         119  +
                        /* SerializerUtil.kt:42 */
   69    120   
                    }
         121  +
                    /* JsonSerializerGenerator.kt:524 */
   70    122   
                }
         123  +
                /* JsonSerializerGenerator.kt:486 */
   71    124   
                array_16.finish();
         125  +
                /* SerializerUtil.kt:42 */
   72    126   
            }
         127  +
            /* JsonSerializerGenerator.kt:524 */
   73    128   
        }
         129  +
        /* JsonSerializerGenerator.kt:486 */
   74    130   
        array_14.finish();
         131  +
        /* JsonSerializerGenerator.kt:382 */
   75    132   
    }
         133  +
    /* JsonSerializerGenerator.kt:382 */
   76    134   
    if let Some(var_18) = &input.string_list {
         135  +
        /* JsonSerializerGenerator.kt:484 */
   77    136   
        let mut array_19 = object.key("stringList").start_array();
         137  +
        /* JsonSerializerGenerator.kt:524 */
   78    138   
        for item_20 in var_18 {
         139  +
            /* SerializerUtil.kt:42 */
   79    140   
            {
         141  +
                /* JsonSerializerGenerator.kt:423 */
   80    142   
                array_19.value().string(item_20.as_str());
         143  +
                /* SerializerUtil.kt:42 */
   81    144   
            }
         145  +
            /* JsonSerializerGenerator.kt:524 */
   82    146   
        }
         147  +
        /* JsonSerializerGenerator.kt:486 */
   83    148   
        array_19.finish();
         149  +
        /* JsonSerializerGenerator.kt:382 */
   84    150   
    }
         151  +
    /* JsonSerializerGenerator.kt:382 */
   85    152   
    if let Some(var_21) = &input.string_set {
         153  +
        /* JsonSerializerGenerator.kt:484 */
   86    154   
        let mut array_22 = object.key("stringSet").start_array();
         155  +
        /* JsonSerializerGenerator.kt:524 */
   87    156   
        for item_23 in &var_21.0 {
         157  +
            /* SerializerUtil.kt:42 */
   88    158   
            {
         159  +
                /* JsonSerializerGenerator.kt:423 */
   89    160   
                array_22.value().string(item_23.as_str());
         161  +
                /* SerializerUtil.kt:42 */
   90    162   
            }
         163  +
            /* JsonSerializerGenerator.kt:524 */
   91    164   
        }
         165  +
        /* JsonSerializerGenerator.kt:486 */
   92    166   
        array_22.finish();
         167  +
        /* JsonSerializerGenerator.kt:382 */
   93    168   
    }
         169  +
    /* JsonSerializerGenerator.kt:382 */
   94    170   
    if let Some(var_24) = &input.structure_list {
         171  +
        /* JsonSerializerGenerator.kt:484 */
   95    172   
        let mut array_25 = object.key("myStructureList").start_array();
         173  +
        /* JsonSerializerGenerator.kt:524 */
   96    174   
        for item_26 in var_24 {
         175  +
            /* SerializerUtil.kt:42 */
   97    176   
            {
         177  +
                /* JsonSerializerGenerator.kt:495 */
   98    178   
                #[allow(unused_mut)]
         179  +
                /* JsonSerializerGenerator.kt:496 */
   99    180   
                let mut object_27 = array_25.value().start_object();
         181  +
                /* JsonSerializerGenerator.kt:375 */
  100    182   
                crate::protocol_serde::shape_structure_list_member::ser_structure_list_member(
  101    183   
                    &mut object_27,
  102    184   
                    item_26,
  103    185   
                )?;
         186  +
                /* JsonSerializerGenerator.kt:515 */
  104    187   
                object_27.finish();
         188  +
                /* SerializerUtil.kt:42 */
  105    189   
            }
         190  +
            /* JsonSerializerGenerator.kt:524 */
  106    191   
        }
         192  +
        /* JsonSerializerGenerator.kt:486 */
  107    193   
        array_25.finish();
         194  +
        /* JsonSerializerGenerator.kt:382 */
  108    195   
    }
         196  +
    /* JsonSerializerGenerator.kt:382 */
  109    197   
    if let Some(var_28) = &input.timestamp_list {
         198  +
        /* JsonSerializerGenerator.kt:484 */
  110    199   
        let mut array_29 = object.key("timestampList").start_array();
         200  +
        /* JsonSerializerGenerator.kt:524 */
  111    201   
        for item_30 in var_28 {
         202  +
            /* SerializerUtil.kt:42 */
  112    203   
            {
         204  +
                /* JsonSerializerGenerator.kt:448 */
  113    205   
                array_29
  114    206   
                    .value()
  115    207   
                    .date_time(item_30, ::aws_smithy_types::date_time::Format::EpochSeconds)?;
         208  +
                /* SerializerUtil.kt:42 */
  116    209   
            }
         210  +
            /* JsonSerializerGenerator.kt:524 */
  117    211   
        }
         212  +
        /* JsonSerializerGenerator.kt:486 */
  118    213   
        array_29.finish();
         214  +
        /* JsonSerializerGenerator.kt:382 */
  119    215   
    }
         216  +
    /* JsonSerializerGenerator.kt:372 */
  120    217   
    Ok(())
         218  +
    /* JsonSerializerGenerator.kt:358 */
  121    219   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_json_maps.rs

@@ -1,1 +173,255 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_json_maps_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::JsonMapsInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::json_maps_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   22         -
        let bytes = ::hyper::body::to_bytes(body).await?;
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:789 */
          30  +
        let bytes = {
          31  +
            use ::http_body_util::BodyExt;
          32  +
            body.collect().await?.to_bytes()
          33  +
        };
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:825 */
   23     35   
        if !bytes.is_empty() {
          36  +
            /* ServerHttpBoundProtocolGenerator.kt:826 */
   24     37   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     38   
                &headers,
   26     39   
                Some("application/json"),
   27     40   
            )?;
   28     41   
            input = crate::protocol_serde::shape_json_maps::de_json_maps(bytes.as_ref(), input)?;
          42  +
            /* ServerHttpBoundProtocolGenerator.kt:825 */
   29     43   
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   30     45   
        input.build()?
          46  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   31     47   
    })
          48  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   32     49   
}
   33     50   
          51  +
/* RustType.kt:534 */
   34     52   
#[allow(clippy::unnecessary_wraps)]
          53  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   35     54   
pub fn ser_json_maps_http_response(
   36     55   
    #[allow(unused_variables)] output: crate::output::JsonMapsOutput,
   37     56   
) -> std::result::Result<
   38     57   
    ::aws_smithy_http_server::response::Response,
   39     58   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   40     59   
> {
          60  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   41     61   
    Ok({
          62  +
        /* RustType.kt:534 */
   42     63   
        #[allow(unused_mut)]
   43         -
        let mut builder = ::http::Response::builder();
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          65  +
        let mut builder = ::http_1x::Response::builder();
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   44     67   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   45     68   
            builder,
   46         -
            ::http::header::CONTENT_TYPE,
          69  +
            ::http_1x::header::CONTENT_TYPE,
   47     70   
            "application/json",
   48     71   
        );
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   49     73   
        let http_status: u16 = 200;
   50     74   
        builder = builder.status(http_status);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   51     76   
        let payload =
   52         -
            crate::protocol_serde::shape_json_maps_output::ser_json_maps_output_output_output(
   53         -
                &output,
   54         -
            )?;
          77  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_json_maps_output::ser_json_maps_output_output_output(&output)?
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   55     80   
        let content_length = payload.len();
   56     81   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     82   
            builder,
   58         -
            ::http::header::CONTENT_LENGTH,
          83  +
            ::http_1x::header::CONTENT_LENGTH,
   59     84   
            content_length,
   60     85   
        );
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   61     87   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   62     89   
        builder.body(body)?
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   63     91   
    })
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   64     93   
}
   65     94   
          95  +
/* RustType.kt:534 */
   66     96   
#[allow(clippy::unnecessary_wraps)]
          97  +
/* ServerHttpBoundProtocolGenerator.kt:471 */
   67     98   
pub fn ser_json_maps_http_error(
   68     99   
    error: &crate::error::JsonMapsError,
   69    100   
) -> std::result::Result<
   70    101   
    ::aws_smithy_http_server::response::Response,
   71    102   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   72    103   
> {
         104  +
    /* ServerHttpBoundProtocolGenerator.kt:476 */
   73    105   
    Ok({
         106  +
        /* ServerHttpBoundProtocolGenerator.kt:492 */
   74    107   
        match error {
         108  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
   75    109   
            crate::error::JsonMapsError::ValidationException(output) => {
         110  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
   76    111   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         112  +
                /* RustType.kt:534 */
   77    113   
                #[allow(unused_mut)]
   78         -
                let mut builder = ::http::Response::builder();
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         115  +
                let mut builder = ::http_1x::Response::builder();
         116  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
   79    117   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   80    118   
                    builder,
   81         -
                    ::http::header::CONTENT_TYPE,
         119  +
                    ::http_1x::header::CONTENT_TYPE,
   82    120   
                    "application/json",
   83    121   
                );
         122  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
   84    123   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   85    124   
                    builder,
   86         -
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         125  +
                    ::http_1x::header::HeaderName::from_static("x-amzn-errortype"),
   87    126   
                    "ValidationException",
   88    127   
                );
         128  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
   89    129   
                let content_length = payload.len();
   90    130   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   91    131   
                    builder,
   92         -
                    ::http::header::CONTENT_LENGTH,
         132  +
                    ::http_1x::header::CONTENT_LENGTH,
   93    133   
                    content_length,
   94    134   
                );
         135  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
   95    136   
                builder
   96    137   
                    .status(400)
   97    138   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
   98         -
            }
         139  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         140  +
            } /* ServerHttpBoundProtocolGenerator.kt:492 */
   99    141   
        }
         142  +
        /* ServerHttpBoundProtocolGenerator.kt:476 */
  100    143   
    })
         144  +
    /* ServerHttpBoundProtocolGenerator.kt:471 */
  101    145   
}
  102    146   
         147  +
/* JsonParserGenerator.kt:148 */
  103    148   
pub(crate) fn de_json_maps(
  104    149   
    value: &[u8],
  105    150   
    mut builder: crate::input::json_maps_input::Builder,
  106    151   
) -> ::std::result::Result<
  107    152   
    crate::input::json_maps_input::Builder,
  108    153   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  109    154   
> {
         155  +
    /* JsonParserGenerator.kt:153 */
  110    156   
    let mut tokens_owned =
  111    157   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  112    158   
            .peekable();
  113    159   
    let tokens = &mut tokens_owned;
  114    160   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         161  +
    /* JsonParserGenerator.kt:684 */
  115    162   
    loop {
         163  +
        /* JsonParserGenerator.kt:685 */
  116    164   
        match tokens.next().transpose()? {
         165  +
            /* JsonParserGenerator.kt:686 */
  117    166   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  118    167   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         168  +
                /* JsonParserGenerator.kt:260 */
  119    169   
                match key.to_unescaped()?.as_ref() {
         170  +
                    /* JsonParserGenerator.kt:262 */
  120    171   
                    "denseBooleanMap" => {
         172  +
                        /* JsonParserGenerator.kt:272 */
  121    173   
                        builder = builder.set_dense_boolean_map(
         174  +
                            /* JsonParserGenerator.kt:509 */
  122    175   
                            crate::protocol_serde::shape_dense_boolean_map::de_dense_boolean_map(
  123    176   
                                tokens,
  124         -
                            )?,
         177  +
                            )?, /* JsonParserGenerator.kt:272 */
  125    178   
                        );
         179  +
                        /* JsonParserGenerator.kt:262 */
  126    180   
                    }
         181  +
                    /* JsonParserGenerator.kt:262 */
  127    182   
                    "denseNumberMap" => {
         183  +
                        /* JsonParserGenerator.kt:272 */
  128    184   
                        builder = builder.set_dense_number_map(
         185  +
                            /* JsonParserGenerator.kt:509 */
  129    186   
                            crate::protocol_serde::shape_dense_number_map::de_dense_number_map(
  130    187   
                                tokens,
  131         -
                            )?,
         188  +
                            )?, /* JsonParserGenerator.kt:272 */
  132    189   
                        );
         190  +
                        /* JsonParserGenerator.kt:262 */
  133    191   
                    }
         192  +
                    /* JsonParserGenerator.kt:262 */
  134    193   
                    "denseSetMap" => {
  135         -
                        builder = builder.set_dense_set_map(
  136         -
                            crate::protocol_serde::shape_dense_set_map::de_dense_set_map(tokens)?,
  137         -
                        );
         194  +
                        /* JsonParserGenerator.kt:272 */
         195  +
                        builder =
         196  +
                            builder.set_dense_set_map(
         197  +
                                /* JsonParserGenerator.kt:509 */
         198  +
                                crate::protocol_serde::shape_dense_set_map::de_dense_set_map(
         199  +
                                    tokens,
         200  +
                                )?, /* JsonParserGenerator.kt:272 */
         201  +
                            );
         202  +
                        /* JsonParserGenerator.kt:262 */
  138    203   
                    }
         204  +
                    /* JsonParserGenerator.kt:262 */
  139    205   
                    "denseStringMap" => {
         206  +
                        /* JsonParserGenerator.kt:272 */
  140    207   
                        builder = builder.set_dense_string_map(
         208  +
                            /* JsonParserGenerator.kt:509 */
  141    209   
                            crate::protocol_serde::shape_dense_string_map::de_dense_string_map(
  142    210   
                                tokens,
  143         -
                            )?,
         211  +
                            )?, /* JsonParserGenerator.kt:272 */
  144    212   
                        );
         213  +
                        /* JsonParserGenerator.kt:262 */
  145    214   
                    }
         215  +
                    /* JsonParserGenerator.kt:262 */
  146    216   
                    "denseStructMap" => {
         217  +
                        /* JsonParserGenerator.kt:272 */
  147    218   
                        builder = builder.set_dense_struct_map(
         219  +
                            /* JsonParserGenerator.kt:509 */
  148    220   
                            crate::protocol_serde::shape_dense_struct_map::de_dense_struct_map(
  149    221   
                                tokens,
  150         -
                            )?,
         222  +
                            )?, /* JsonParserGenerator.kt:272 */
  151    223   
                        );
         224  +
                        /* JsonParserGenerator.kt:262 */
  152    225   
                    }
  153         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         226  +
                    /* JsonParserGenerator.kt:290 */
         227  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  154    228   
                }
         229  +
                /* JsonParserGenerator.kt:686 */
  155    230   
            }
         231  +
            /* JsonParserGenerator.kt:695 */
  156    232   
            other => {
  157    233   
                return Err(
  158    234   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  159    235   
                        "expected object key or end object, found: {other:?}"
  160    236   
                    )),
  161    237   
                )
  162         -
            }
         238  +
            } /* JsonParserGenerator.kt:685 */
  163    239   
        }
         240  +
        /* JsonParserGenerator.kt:684 */
  164    241   
    }
         242  +
    /* JsonParserGenerator.kt:250 */
  165    243   
    if tokens.next().is_some() {
         244  +
        /* JsonParserGenerator.kt:251 */
  166    245   
        return Err(
  167    246   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  168    247   
                "found more JSON tokens after completing parsing",
  169    248   
            ),
  170    249   
        );
         250  +
        /* JsonParserGenerator.kt:250 */
  171    251   
    }
         252  +
    /* JsonParserGenerator.kt:163 */
  172    253   
    Ok(builder)
         254  +
    /* JsonParserGenerator.kt:148 */
  173    255   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_json_maps_output.rs

@@ -1,1 +82,149 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_json_maps_output_output_output(
    3      4   
    value: &crate::output::JsonMapsOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_json_maps_output::ser_json_maps_output_output(&mut object, value)?;
          11  +
    /* JsonSerializerGenerator.kt:227 */
    8     12   
    object.finish();
    9     13   
    Ok(out)
          14  +
    /* JsonSerializerGenerator.kt:213 */
   10     15   
}
   11     16   
          17  +
/* JsonSerializerGenerator.kt:358 */
   12     18   
pub fn ser_json_maps_output_output(
   13     19   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    input: &crate::output::JsonMapsOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* JsonSerializerGenerator.kt:382 */
   16     23   
    if let Some(var_1) = &input.dense_boolean_map {
          24  +
        /* JsonSerializerGenerator.kt:495 */
   17     25   
        #[allow(unused_mut)]
          26  +
        /* JsonSerializerGenerator.kt:496 */
   18     27   
        let mut object_2 = object.key("denseBooleanMap").start_object();
          28  +
        /* JsonSerializerGenerator.kt:537 */
   19     29   
        for (key_3, value_4) in var_1 {
          30  +
            /* SerializerUtil.kt:42 */
   20     31   
            {
          32  +
                /* JsonSerializerGenerator.kt:424 */
   21     33   
                object_2.key(key_3.as_str()).boolean(*value_4);
          34  +
                /* SerializerUtil.kt:42 */
   22     35   
            }
          36  +
            /* JsonSerializerGenerator.kt:537 */
   23     37   
        }
          38  +
        /* JsonSerializerGenerator.kt:515 */
   24     39   
        object_2.finish();
          40  +
        /* JsonSerializerGenerator.kt:382 */
   25     41   
    }
          42  +
    /* JsonSerializerGenerator.kt:382 */
   26     43   
    if let Some(var_5) = &input.dense_number_map {
          44  +
        /* JsonSerializerGenerator.kt:495 */
   27     45   
        #[allow(unused_mut)]
          46  +
        /* JsonSerializerGenerator.kt:496 */
   28     47   
        let mut object_6 = object.key("denseNumberMap").start_object();
          48  +
        /* JsonSerializerGenerator.kt:537 */
   29     49   
        for (key_7, value_8) in var_5 {
          50  +
            /* SerializerUtil.kt:42 */
   30     51   
            {
          52  +
                /* JsonSerializerGenerator.kt:432 */
   31     53   
                object_6.key(key_7.as_str()).number(
   32     54   
                    #[allow(clippy::useless_conversion)]
   33     55   
                    ::aws_smithy_types::Number::NegInt((*value_8).into()),
   34     56   
                );
          57  +
                /* SerializerUtil.kt:42 */
   35     58   
            }
          59  +
            /* JsonSerializerGenerator.kt:537 */
   36     60   
        }
          61  +
        /* JsonSerializerGenerator.kt:515 */
   37     62   
        object_6.finish();
          63  +
        /* JsonSerializerGenerator.kt:382 */
   38     64   
    }
          65  +
    /* JsonSerializerGenerator.kt:382 */
   39     66   
    if let Some(var_9) = &input.dense_set_map {
          67  +
        /* JsonSerializerGenerator.kt:495 */
   40     68   
        #[allow(unused_mut)]
          69  +
        /* JsonSerializerGenerator.kt:496 */
   41     70   
        let mut object_10 = object.key("denseSetMap").start_object();
          71  +
        /* JsonSerializerGenerator.kt:537 */
   42     72   
        for (key_11, value_12) in var_9 {
          73  +
            /* SerializerUtil.kt:42 */
   43     74   
            {
          75  +
                /* JsonSerializerGenerator.kt:484 */
   44     76   
                let mut array_13 = object_10.key(key_11.as_str()).start_array();
          77  +
                /* JsonSerializerGenerator.kt:524 */
   45     78   
                for item_14 in &value_12.0 {
          79  +
                    /* SerializerUtil.kt:42 */
   46     80   
                    {
          81  +
                        /* JsonSerializerGenerator.kt:423 */
   47     82   
                        array_13.value().string(item_14.as_str());
          83  +
                        /* SerializerUtil.kt:42 */
   48     84   
                    }
          85  +
                    /* JsonSerializerGenerator.kt:524 */
   49     86   
                }
          87  +
                /* JsonSerializerGenerator.kt:486 */
   50     88   
                array_13.finish();
          89  +
                /* SerializerUtil.kt:42 */
   51     90   
            }
          91  +
            /* JsonSerializerGenerator.kt:537 */
   52     92   
        }
          93  +
        /* JsonSerializerGenerator.kt:515 */
   53     94   
        object_10.finish();
          95  +
        /* JsonSerializerGenerator.kt:382 */
   54     96   
    }
          97  +
    /* JsonSerializerGenerator.kt:382 */
   55     98   
    if let Some(var_15) = &input.dense_string_map {
          99  +
        /* JsonSerializerGenerator.kt:495 */
   56    100   
        #[allow(unused_mut)]
         101  +
        /* JsonSerializerGenerator.kt:496 */
   57    102   
        let mut object_16 = object.key("denseStringMap").start_object();
         103  +
        /* JsonSerializerGenerator.kt:537 */
   58    104   
        for (key_17, value_18) in var_15 {
         105  +
            /* SerializerUtil.kt:42 */
   59    106   
            {
         107  +
                /* JsonSerializerGenerator.kt:423 */
   60    108   
                object_16.key(key_17.as_str()).string(value_18.as_str());
         109  +
                /* SerializerUtil.kt:42 */
   61    110   
            }
         111  +
            /* JsonSerializerGenerator.kt:537 */
   62    112   
        }
         113  +
        /* JsonSerializerGenerator.kt:515 */
   63    114   
        object_16.finish();
         115  +
        /* JsonSerializerGenerator.kt:382 */
   64    116   
    }
         117  +
    /* JsonSerializerGenerator.kt:382 */
   65    118   
    if let Some(var_19) = &input.dense_struct_map {
         119  +
        /* JsonSerializerGenerator.kt:495 */
   66    120   
        #[allow(unused_mut)]
         121  +
        /* JsonSerializerGenerator.kt:496 */
   67    122   
        let mut object_20 = object.key("denseStructMap").start_object();
         123  +
        /* JsonSerializerGenerator.kt:537 */
   68    124   
        for (key_21, value_22) in var_19 {
         125  +
            /* SerializerUtil.kt:42 */
   69    126   
            {
         127  +
                /* JsonSerializerGenerator.kt:495 */
   70    128   
                #[allow(unused_mut)]
         129  +
                /* JsonSerializerGenerator.kt:496 */
   71    130   
                let mut object_23 = object_20.key(key_21.as_str()).start_object();
         131  +
                /* JsonSerializerGenerator.kt:375 */
   72    132   
                crate::protocol_serde::shape_greeting_struct::ser_greeting_struct(
   73    133   
                    &mut object_23,
   74    134   
                    value_22,
   75    135   
                )?;
         136  +
                /* JsonSerializerGenerator.kt:515 */
   76    137   
                object_23.finish();
         138  +
                /* SerializerUtil.kt:42 */
   77    139   
            }
         140  +
            /* JsonSerializerGenerator.kt:537 */
   78    141   
        }
         142  +
        /* JsonSerializerGenerator.kt:515 */
   79    143   
        object_20.finish();
         144  +
        /* JsonSerializerGenerator.kt:382 */
   80    145   
    }
         146  +
    /* JsonSerializerGenerator.kt:372 */
   81    147   
    Ok(())
         148  +
    /* JsonSerializerGenerator.kt:358 */
   82    149   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_json_timestamps.rs

@@ -1,1 +161,234 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_json_timestamps_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::JsonTimestampsInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::json_timestamps_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   22         -
        let bytes = ::hyper::body::to_bytes(body).await?;
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:789 */
          30  +
        let bytes = {
          31  +
            use ::http_body_util::BodyExt;
          32  +
            body.collect().await?.to_bytes()
          33  +
        };
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:825 */
   23     35   
        if !bytes.is_empty() {
          36  +
            /* ServerHttpBoundProtocolGenerator.kt:826 */
   24     37   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     38   
                &headers,
   26     39   
                Some("application/json"),
   27     40   
            )?;
   28     41   
            input = crate::protocol_serde::shape_json_timestamps::de_json_timestamps(
   29     42   
                bytes.as_ref(),
   30     43   
                input,
   31     44   
            )?;
          45  +
            /* ServerHttpBoundProtocolGenerator.kt:825 */
   32     46   
        }
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   33     48   
        input.build()
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   34     50   
    })
          51  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   35     52   
}
   36     53   
          54  +
/* RustType.kt:534 */
   37     55   
#[allow(clippy::unnecessary_wraps)]
          56  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   38     57   
pub fn ser_json_timestamps_http_response(
   39     58   
    #[allow(unused_variables)] output: crate::output::JsonTimestampsOutput,
   40     59   
) -> std::result::Result<
   41     60   
    ::aws_smithy_http_server::response::Response,
   42     61   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   43     62   
> {
          63  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   44     64   
    Ok({
          65  +
        /* RustType.kt:534 */
   45     66   
        #[allow(unused_mut)]
   46         -
        let mut builder = ::http::Response::builder();
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          68  +
        let mut builder = ::http_1x::Response::builder();
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   47     70   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   48     71   
            builder,
   49         -
            ::http::header::CONTENT_TYPE,
          72  +
            ::http_1x::header::CONTENT_TYPE,
   50     73   
            "application/json",
   51     74   
        );
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   52     76   
        let http_status: u16 = 200;
   53     77   
        builder = builder.status(http_status);
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   54     79   
        let payload =
   55         -
            crate::protocol_serde::shape_json_timestamps_output::ser_json_timestamps_output_output_output(&output)?
   56         -
        ;
          80  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_json_timestamps_output::ser_json_timestamps_output_output_output(&output)?
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   57     83   
        let content_length = payload.len();
   58     84   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   59     85   
            builder,
   60         -
            ::http::header::CONTENT_LENGTH,
          86  +
            ::http_1x::header::CONTENT_LENGTH,
   61     87   
            content_length,
   62     88   
        );
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   63     90   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   64     92   
        builder.body(body)?
          93  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   65     94   
    })
          95  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   66     96   
}
   67     97   
          98  +
/* JsonParserGenerator.kt:148 */
   68     99   
pub(crate) fn de_json_timestamps(
   69    100   
    value: &[u8],
   70    101   
    mut builder: crate::input::json_timestamps_input::Builder,
   71    102   
) -> ::std::result::Result<
   72    103   
    crate::input::json_timestamps_input::Builder,
   73    104   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   74    105   
> {
         106  +
    /* JsonParserGenerator.kt:153 */
   75    107   
    let mut tokens_owned =
   76    108   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
   77    109   
            .peekable();
   78    110   
    let tokens = &mut tokens_owned;
   79    111   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         112  +
    /* JsonParserGenerator.kt:684 */
   80    113   
    loop {
         114  +
        /* JsonParserGenerator.kt:685 */
   81    115   
        match tokens.next().transpose()? {
         116  +
            /* JsonParserGenerator.kt:686 */
   82    117   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   83    118   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         119  +
                /* JsonParserGenerator.kt:260 */
   84    120   
                match key.to_unescaped()?.as_ref() {
         121  +
                    /* JsonParserGenerator.kt:262 */
   85    122   
                    "dateTime" => {
         123  +
                        /* JsonParserGenerator.kt:272 */
   86    124   
                        builder = builder.set_date_time(
         125  +
                            /* JsonParserGenerator.kt:384 */
   87    126   
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
   88    127   
                                tokens.next(),
   89    128   
                                ::aws_smithy_types::date_time::Format::DateTime,
   90         -
                            )?,
         129  +
                            )?, /* JsonParserGenerator.kt:272 */
   91    130   
                        );
         131  +
                        /* JsonParserGenerator.kt:262 */
   92    132   
                    }
         133  +
                    /* JsonParserGenerator.kt:262 */
   93    134   
                    "dateTimeOnTarget" => {
         135  +
                        /* JsonParserGenerator.kt:272 */
   94    136   
                        builder = builder.set_date_time_on_target(
         137  +
                            /* JsonParserGenerator.kt:384 */
   95    138   
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
   96    139   
                                tokens.next(),
   97    140   
                                ::aws_smithy_types::date_time::Format::DateTime,
   98         -
                            )?,
         141  +
                            )?, /* JsonParserGenerator.kt:272 */
   99    142   
                        );
         143  +
                        /* JsonParserGenerator.kt:262 */
  100    144   
                    }
         145  +
                    /* JsonParserGenerator.kt:262 */
  101    146   
                    "epochSeconds" => {
         147  +
                        /* JsonParserGenerator.kt:272 */
  102    148   
                        builder = builder.set_epoch_seconds(
         149  +
                            /* JsonParserGenerator.kt:384 */
  103    150   
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
  104    151   
                                tokens.next(),
  105    152   
                                ::aws_smithy_types::date_time::Format::EpochSeconds,
  106         -
                            )?,
         153  +
                            )?, /* JsonParserGenerator.kt:272 */
  107    154   
                        );
         155  +
                        /* JsonParserGenerator.kt:262 */
  108    156   
                    }
         157  +
                    /* JsonParserGenerator.kt:262 */
  109    158   
                    "epochSecondsOnTarget" => {
         159  +
                        /* JsonParserGenerator.kt:272 */
  110    160   
                        builder = builder.set_epoch_seconds_on_target(
         161  +
                            /* JsonParserGenerator.kt:384 */
  111    162   
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
  112    163   
                                tokens.next(),
  113    164   
                                ::aws_smithy_types::date_time::Format::EpochSeconds,
  114         -
                            )?,
         165  +
                            )?, /* JsonParserGenerator.kt:272 */
  115    166   
                        );
         167  +
                        /* JsonParserGenerator.kt:262 */
  116    168   
                    }
         169  +
                    /* JsonParserGenerator.kt:262 */
  117    170   
                    "httpDate" => {
         171  +
                        /* JsonParserGenerator.kt:272 */
  118    172   
                        builder = builder.set_http_date(
         173  +
                            /* JsonParserGenerator.kt:384 */
  119    174   
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
  120    175   
                                tokens.next(),
  121    176   
                                ::aws_smithy_types::date_time::Format::HttpDate,
  122         -
                            )?,
         177  +
                            )?, /* JsonParserGenerator.kt:272 */
  123    178   
                        );
         179  +
                        /* JsonParserGenerator.kt:262 */
  124    180   
                    }
         181  +
                    /* JsonParserGenerator.kt:262 */
  125    182   
                    "httpDateOnTarget" => {
         183  +
                        /* JsonParserGenerator.kt:272 */
  126    184   
                        builder = builder.set_http_date_on_target(
         185  +
                            /* JsonParserGenerator.kt:384 */
  127    186   
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
  128    187   
                                tokens.next(),
  129    188   
                                ::aws_smithy_types::date_time::Format::HttpDate,
  130         -
                            )?,
         189  +
                            )?, /* JsonParserGenerator.kt:272 */
  131    190   
                        );
         191  +
                        /* JsonParserGenerator.kt:262 */
  132    192   
                    }
         193  +
                    /* JsonParserGenerator.kt:262 */
  133    194   
                    "normal" => {
         195  +
                        /* JsonParserGenerator.kt:272 */
  134    196   
                        builder = builder.set_normal(
         197  +
                            /* JsonParserGenerator.kt:384 */
  135    198   
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
  136    199   
                                tokens.next(),
  137    200   
                                ::aws_smithy_types::date_time::Format::EpochSeconds,
  138         -
                            )?,
         201  +
                            )?, /* JsonParserGenerator.kt:272 */
  139    202   
                        );
         203  +
                        /* JsonParserGenerator.kt:262 */
  140    204   
                    }
  141         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         205  +
                    /* JsonParserGenerator.kt:290 */
         206  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  142    207   
                }
         208  +
                /* JsonParserGenerator.kt:686 */
  143    209   
            }
         210  +
            /* JsonParserGenerator.kt:695 */
  144    211   
            other => {
  145    212   
                return Err(
  146    213   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  147    214   
                        "expected object key or end object, found: {other:?}"
  148    215   
                    )),
  149    216   
                )
  150         -
            }
         217  +
            } /* JsonParserGenerator.kt:685 */
  151    218   
        }
         219  +
        /* JsonParserGenerator.kt:684 */
  152    220   
    }
         221  +
    /* JsonParserGenerator.kt:250 */
  153    222   
    if tokens.next().is_some() {
         223  +
        /* JsonParserGenerator.kt:251 */
  154    224   
        return Err(
  155    225   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  156    226   
                "found more JSON tokens after completing parsing",
  157    227   
            ),
  158    228   
        );
         229  +
        /* JsonParserGenerator.kt:250 */
  159    230   
    }
         231  +
    /* JsonParserGenerator.kt:163 */
  160    232   
    Ok(builder)
         233  +
    /* JsonParserGenerator.kt:148 */
  161    234   
}