Server Test

Server Test

rev. 3c756f73b1f83a0eed4275d9d1e22df0b10b66fb

Files changed:

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

@@ -1,1 +111,154 @@
    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_malformed_timestamp_path_epoch_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::MalformedTimestampPathEpochInput,
    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::malformed_timestamp_path_epoch_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();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:1134 */
   22     30   
        let input_string = uri.path();
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:1146 */
   23     32   
        let (input_string, (_, m1)) =
   24     33   
            ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
   25     34   
                ::nom::sequence::preceded(
   26     35   
                    ::nom::bytes::complete::tag("/"),
   27     36   
                    ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>(
   28     37   
                        "MalformedTimestampPathEpoch",
   29     38   
                    ),
   30     39   
                ),
   31     40   
                ::nom::sequence::preceded(
   32     41   
                    ::nom::bytes::complete::tag("/"),
   33     42   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   34     43   
                        ::nom::bytes::complete::take_until("/"),
   35     44   
                        ::nom::combinator::rest,
   36     45   
                    )),
   37     46   
                ),
   38     47   
            ))(input_string)?;
   39     48   
        debug_assert_eq!("", input_string);
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:1157 */
   40     50   
        input = input.set_timestamp(
   41     51   
            crate::protocol_serde::shape_malformed_timestamp_path_epoch_input::de_timestamp(m1)?,
   42     52   
        );
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   43     54   
        input.build()?
          55  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   44     56   
    })
          57  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   45     58   
}
   46     59   
          60  +
/* RustType.kt:534 */
   47     61   
#[allow(clippy::unnecessary_wraps)]
          62  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   48     63   
pub fn ser_malformed_timestamp_path_epoch_http_response(
   49     64   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampPathEpochOutput,
   50     65   
) -> std::result::Result<
   51     66   
    ::aws_smithy_http_server::response::Response,
   52     67   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   53     68   
> {
          69  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   54     70   
    Ok({
          71  +
        /* RustType.kt:534 */
   55     72   
        #[allow(unused_mut)]
   56         -
        let mut builder = ::http::Response::builder();
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          74  +
        let mut builder = ::http_1x::Response::builder();
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   57     76   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   58     77   
            builder,
   59         -
            ::http::header::CONTENT_TYPE,
          78  +
            ::http_1x::header::CONTENT_TYPE,
   60     79   
            "application/json",
   61     80   
        );
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   62     82   
        let http_status: u16 = 200;
   63     83   
        builder = builder.status(http_status);
   64         -
        let payload = "";
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          85  +
        let payload =
          86  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   65     89   
        let content_length = payload.len();
   66     90   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   67     91   
            builder,
   68         -
            ::http::header::CONTENT_LENGTH,
          92  +
            ::http_1x::header::CONTENT_LENGTH,
   69     93   
            content_length,
   70     94   
        );
          95  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   71     96   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          97  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   72     98   
        builder.body(body)?
          99  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   73    100   
    })
         101  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   74    102   
}
   75    103   
         104  +
/* RustType.kt:534 */
   76    105   
#[allow(clippy::unnecessary_wraps)]
         106  +
/* ServerHttpBoundProtocolGenerator.kt:471 */
   77    107   
pub fn ser_malformed_timestamp_path_epoch_http_error(
   78    108   
    error: &crate::error::MalformedTimestampPathEpochError,
   79    109   
) -> std::result::Result<
   80    110   
    ::aws_smithy_http_server::response::Response,
   81    111   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   82    112   
> {
         113  +
    /* ServerHttpBoundProtocolGenerator.kt:476 */
   83    114   
    Ok({
         115  +
        /* ServerHttpBoundProtocolGenerator.kt:492 */
   84    116   
        match error {
         117  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
   85    118   
            crate::error::MalformedTimestampPathEpochError::ValidationException(output) => {
         119  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
   86    120   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         121  +
                /* RustType.kt:534 */
   87    122   
                #[allow(unused_mut)]
   88         -
                let mut builder = ::http::Response::builder();
         123  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         124  +
                let mut builder = ::http_1x::Response::builder();
         125  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
   89    126   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   90    127   
                    builder,
   91         -
                    ::http::header::CONTENT_TYPE,
         128  +
                    ::http_1x::header::CONTENT_TYPE,
   92    129   
                    "application/json",
   93    130   
                );
         131  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
   94    132   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   95    133   
                    builder,
   96         -
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         134  +
                    ::http_1x::header::HeaderName::from_static("x-amzn-errortype"),
   97    135   
                    "ValidationException",
   98    136   
                );
         137  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
   99    138   
                let content_length = payload.len();
  100    139   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  101    140   
                    builder,
  102         -
                    ::http::header::CONTENT_LENGTH,
         141  +
                    ::http_1x::header::CONTENT_LENGTH,
  103    142   
                    content_length,
  104    143   
                );
         144  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
  105    145   
                builder
  106    146   
                    .status(400)
  107    147   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  108         -
            }
         148  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         149  +
            } /* ServerHttpBoundProtocolGenerator.kt:492 */
  109    150   
        }
         151  +
        /* ServerHttpBoundProtocolGenerator.kt:476 */
  110    152   
    })
         153  +
    /* ServerHttpBoundProtocolGenerator.kt:471 */
  111    154   
}

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

@@ -1,1 +14,16 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
    2      3   
pub fn de_timestamp(
    3      4   
    value: &str,
    4      5   
) -> std::result::Result<
    5      6   
    ::aws_smithy_types::DateTime,
    6      7   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    7      8   
> {
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1486 */
    8     10   
    let value = ::percent_encoding::percent_decode_str(value).decode_utf8()?;
    9         -
    let value = ::aws_smithy_types::DateTime::from_str(
   10         -
        value.as_ref(),
   11         -
        ::aws_smithy_types::date_time::Format::EpochSeconds,
   12         -
    )?;
          11  +
    let value = ::aws_smithy_types::DateTime::from_str(value.as_ref(), ::aws_smithy_types::date_time::Format::EpochSeconds)?
          12  +
    /* ServerHttpBoundProtocolGenerator.kt:1510 */;
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
   13     14   
    Ok(value)
          15  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
   14     16   
}

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

@@ -1,1 +113,156 @@
    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_malformed_timestamp_path_http_date_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::MalformedTimestampPathHttpDateInput,
    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::malformed_timestamp_path_http_date_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();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:1134 */
   22     30   
        let input_string = uri.path();
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:1146 */
   23     32   
        let (input_string, (_, m1)) =
   24     33   
            ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
   25     34   
                ::nom::sequence::preceded(
   26     35   
                    ::nom::bytes::complete::tag("/"),
   27     36   
                    ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>(
   28     37   
                        "MalformedTimestampPathHttpDate",
   29     38   
                    ),
   30     39   
                ),
   31     40   
                ::nom::sequence::preceded(
   32     41   
                    ::nom::bytes::complete::tag("/"),
   33     42   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   34     43   
                        ::nom::bytes::complete::take_until("/"),
   35     44   
                        ::nom::combinator::rest,
   36     45   
                    )),
   37     46   
                ),
   38     47   
            ))(input_string)?;
   39     48   
        debug_assert_eq!("", input_string);
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:1157 */
   40     50   
        input = input.set_timestamp(
   41     51   
            crate::protocol_serde::shape_malformed_timestamp_path_http_date_input::de_timestamp(
   42     52   
                m1,
   43     53   
            )?,
   44     54   
        );
          55  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   45     56   
        input.build()?
          57  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   46     58   
    })
          59  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   47     60   
}
   48     61   
          62  +
/* RustType.kt:534 */
   49     63   
#[allow(clippy::unnecessary_wraps)]
          64  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   50     65   
pub fn ser_malformed_timestamp_path_http_date_http_response(
   51     66   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampPathHttpDateOutput,
   52     67   
) -> std::result::Result<
   53     68   
    ::aws_smithy_http_server::response::Response,
   54     69   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   55     70   
> {
          71  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   56     72   
    Ok({
          73  +
        /* RustType.kt:534 */
   57     74   
        #[allow(unused_mut)]
   58         -
        let mut builder = ::http::Response::builder();
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          76  +
        let mut builder = ::http_1x::Response::builder();
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   59     78   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   60     79   
            builder,
   61         -
            ::http::header::CONTENT_TYPE,
          80  +
            ::http_1x::header::CONTENT_TYPE,
   62     81   
            "application/json",
   63     82   
        );
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   64     84   
        let http_status: u16 = 200;
   65     85   
        builder = builder.status(http_status);
   66         -
        let payload = "";
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          87  +
        let payload =
          88  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   67     91   
        let content_length = payload.len();
   68     92   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   69     93   
            builder,
   70         -
            ::http::header::CONTENT_LENGTH,
          94  +
            ::http_1x::header::CONTENT_LENGTH,
   71     95   
            content_length,
   72     96   
        );
          97  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   73     98   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          99  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   74    100   
        builder.body(body)?
         101  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   75    102   
    })
         103  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   76    104   
}
   77    105   
         106  +
/* RustType.kt:534 */
   78    107   
#[allow(clippy::unnecessary_wraps)]
         108  +
/* ServerHttpBoundProtocolGenerator.kt:471 */
   79    109   
pub fn ser_malformed_timestamp_path_http_date_http_error(
   80    110   
    error: &crate::error::MalformedTimestampPathHttpDateError,
   81    111   
) -> std::result::Result<
   82    112   
    ::aws_smithy_http_server::response::Response,
   83    113   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   84    114   
> {
         115  +
    /* ServerHttpBoundProtocolGenerator.kt:476 */
   85    116   
    Ok({
         117  +
        /* ServerHttpBoundProtocolGenerator.kt:492 */
   86    118   
        match error {
         119  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
   87    120   
            crate::error::MalformedTimestampPathHttpDateError::ValidationException(output) => {
         121  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
   88    122   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         123  +
                /* RustType.kt:534 */
   89    124   
                #[allow(unused_mut)]
   90         -
                let mut builder = ::http::Response::builder();
         125  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         126  +
                let mut builder = ::http_1x::Response::builder();
         127  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
   91    128   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   92    129   
                    builder,
   93         -
                    ::http::header::CONTENT_TYPE,
         130  +
                    ::http_1x::header::CONTENT_TYPE,
   94    131   
                    "application/json",
   95    132   
                );
         133  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
   96    134   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   97    135   
                    builder,
   98         -
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         136  +
                    ::http_1x::header::HeaderName::from_static("x-amzn-errortype"),
   99    137   
                    "ValidationException",
  100    138   
                );
         139  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
  101    140   
                let content_length = payload.len();
  102    141   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  103    142   
                    builder,
  104         -
                    ::http::header::CONTENT_LENGTH,
         143  +
                    ::http_1x::header::CONTENT_LENGTH,
  105    144   
                    content_length,
  106    145   
                );
         146  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
  107    147   
                builder
  108    148   
                    .status(400)
  109    149   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  110         -
            }
         150  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         151  +
            } /* ServerHttpBoundProtocolGenerator.kt:492 */
  111    152   
        }
         153  +
        /* ServerHttpBoundProtocolGenerator.kt:476 */
  112    154   
    })
         155  +
    /* ServerHttpBoundProtocolGenerator.kt:471 */
  113    156   
}

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

@@ -1,1 +14,16 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
    2      3   
pub fn de_timestamp(
    3      4   
    value: &str,
    4      5   
) -> std::result::Result<
    5      6   
    ::aws_smithy_types::DateTime,
    6      7   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    7      8   
> {
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1486 */
    8     10   
    let value = ::percent_encoding::percent_decode_str(value).decode_utf8()?;
    9         -
    let value = ::aws_smithy_types::DateTime::from_str(
   10         -
        value.as_ref(),
   11         -
        ::aws_smithy_types::date_time::Format::HttpDate,
   12         -
    )?;
          11  +
    let value = ::aws_smithy_types::DateTime::from_str(value.as_ref(), ::aws_smithy_types::date_time::Format::HttpDate)?
          12  +
    /* ServerHttpBoundProtocolGenerator.kt:1510 */;
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
   13     14   
    Ok(value)
          15  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
   14     16   
}

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

@@ -1,1 +101,146 @@
    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_malformed_timestamp_query_default_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::MalformedTimestampQueryDefaultInput,
    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::malformed_timestamp_query_default_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();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:1221 */
   22     30   
        let query_string = uri.query().unwrap_or("");
   23     31   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:1247 */
   24     33   
        let mut timestamp_seen = false;
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:1253 */
   25     35   
        for (k, v) in pairs {
          36  +
            /* ServerHttpBoundProtocolGenerator.kt:1257 */
   26     37   
            if !timestamp_seen && k == "timestamp" {
   27     38   
                input = input.set_timestamp(
   28     39   
                    crate::protocol_serde::shape_malformed_timestamp_query_default_input::de_timestamp(&v)?
   29     40   
                );
   30     41   
                timestamp_seen = true;
   31     42   
            }
          43  +
            /* ServerHttpBoundProtocolGenerator.kt:1253 */
   32     44   
        }
          45  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   33     46   
        input.build()?
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   34     48   
    })
          49  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   35     50   
}
   36     51   
          52  +
/* RustType.kt:534 */
   37     53   
#[allow(clippy::unnecessary_wraps)]
          54  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   38     55   
pub fn ser_malformed_timestamp_query_default_http_response(
   39     56   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampQueryDefaultOutput,
   40     57   
) -> std::result::Result<
   41     58   
    ::aws_smithy_http_server::response::Response,
   42     59   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   43     60   
> {
          61  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   44     62   
    Ok({
          63  +
        /* RustType.kt:534 */
   45     64   
        #[allow(unused_mut)]
   46         -
        let mut builder = ::http::Response::builder();
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          66  +
        let mut builder = ::http_1x::Response::builder();
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   47     68   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   48     69   
            builder,
   49         -
            ::http::header::CONTENT_TYPE,
          70  +
            ::http_1x::header::CONTENT_TYPE,
   50     71   
            "application/json",
   51     72   
        );
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   52     74   
        let http_status: u16 = 200;
   53     75   
        builder = builder.status(http_status);
   54         -
        let payload = "";
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          77  +
        let payload =
          78  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   55     81   
        let content_length = payload.len();
   56     82   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     83   
            builder,
   58         -
            ::http::header::CONTENT_LENGTH,
          84  +
            ::http_1x::header::CONTENT_LENGTH,
   59     85   
            content_length,
   60     86   
        );
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   61     88   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   62     90   
        builder.body(body)?
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   63     92   
    })
          93  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   64     94   
}
   65     95   
          96  +
/* RustType.kt:534 */
   66     97   
#[allow(clippy::unnecessary_wraps)]
          98  +
/* ServerHttpBoundProtocolGenerator.kt:471 */
   67     99   
pub fn ser_malformed_timestamp_query_default_http_error(
   68    100   
    error: &crate::error::MalformedTimestampQueryDefaultError,
   69    101   
) -> std::result::Result<
   70    102   
    ::aws_smithy_http_server::response::Response,
   71    103   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   72    104   
> {
         105  +
    /* ServerHttpBoundProtocolGenerator.kt:476 */
   73    106   
    Ok({
         107  +
        /* ServerHttpBoundProtocolGenerator.kt:492 */
   74    108   
        match error {
         109  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
   75    110   
            crate::error::MalformedTimestampQueryDefaultError::ValidationException(output) => {
         111  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
   76    112   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         113  +
                /* RustType.kt:534 */
   77    114   
                #[allow(unused_mut)]
   78         -
                let mut builder = ::http::Response::builder();
         115  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         116  +
                let mut builder = ::http_1x::Response::builder();
         117  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
   79    118   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   80    119   
                    builder,
   81         -
                    ::http::header::CONTENT_TYPE,
         120  +
                    ::http_1x::header::CONTENT_TYPE,
   82    121   
                    "application/json",
   83    122   
                );
         123  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
   84    124   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   85    125   
                    builder,
   86         -
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         126  +
                    ::http_1x::header::HeaderName::from_static("x-amzn-errortype"),
   87    127   
                    "ValidationException",
   88    128   
                );
         129  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
   89    130   
                let content_length = payload.len();
   90    131   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   91    132   
                    builder,
   92         -
                    ::http::header::CONTENT_LENGTH,
         133  +
                    ::http_1x::header::CONTENT_LENGTH,
   93    134   
                    content_length,
   94    135   
                );
         136  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
   95    137   
                builder
   96    138   
                    .status(400)
   97    139   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
   98         -
            }
         140  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         141  +
            } /* ServerHttpBoundProtocolGenerator.kt:492 */
   99    142   
        }
         143  +
        /* ServerHttpBoundProtocolGenerator.kt:476 */
  100    144   
    })
         145  +
    /* ServerHttpBoundProtocolGenerator.kt:471 */
  101    146   
}

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

@@ -1,1 +13,15 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
    2      3   
pub fn de_timestamp(
    3      4   
    value: &str,
    4      5   
) -> std::result::Result<
    5      6   
    ::aws_smithy_types::DateTime,
    6      7   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    7      8   
> {
    8         -
    let value = ::aws_smithy_types::DateTime::from_str(
    9         -
        value,
   10         -
        ::aws_smithy_types::date_time::Format::DateTime,
   11         -
    )?;
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1495 */
          10  +
    let value = ::aws_smithy_types::DateTime::from_str(value, ::aws_smithy_types::date_time::Format::DateTime)?
          11  +
    /* ServerHttpBoundProtocolGenerator.kt:1510 */;
          12  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
   12     13   
    Ok(value)
          14  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
   13     15   
}

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

@@ -1,1 +101,146 @@
    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_malformed_timestamp_query_epoch_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::MalformedTimestampQueryEpochInput,
    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::malformed_timestamp_query_epoch_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();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:1221 */
   22     30   
        let query_string = uri.query().unwrap_or("");
   23     31   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:1247 */
   24     33   
        let mut timestamp_seen = false;
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:1253 */
   25     35   
        for (k, v) in pairs {
          36  +
            /* ServerHttpBoundProtocolGenerator.kt:1257 */
   26     37   
            if !timestamp_seen && k == "timestamp" {
   27     38   
                input = input.set_timestamp(
   28     39   
                    crate::protocol_serde::shape_malformed_timestamp_query_epoch_input::de_timestamp(&v)?
   29     40   
                );
   30     41   
                timestamp_seen = true;
   31     42   
            }
          43  +
            /* ServerHttpBoundProtocolGenerator.kt:1253 */
   32     44   
        }
          45  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   33     46   
        input.build()?
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   34     48   
    })
          49  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   35     50   
}
   36     51   
          52  +
/* RustType.kt:534 */
   37     53   
#[allow(clippy::unnecessary_wraps)]
          54  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   38     55   
pub fn ser_malformed_timestamp_query_epoch_http_response(
   39     56   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampQueryEpochOutput,
   40     57   
) -> std::result::Result<
   41     58   
    ::aws_smithy_http_server::response::Response,
   42     59   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   43     60   
> {
          61  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   44     62   
    Ok({
          63  +
        /* RustType.kt:534 */
   45     64   
        #[allow(unused_mut)]
   46         -
        let mut builder = ::http::Response::builder();
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          66  +
        let mut builder = ::http_1x::Response::builder();
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   47     68   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   48     69   
            builder,
   49         -
            ::http::header::CONTENT_TYPE,
          70  +
            ::http_1x::header::CONTENT_TYPE,
   50     71   
            "application/json",
   51     72   
        );
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   52     74   
        let http_status: u16 = 200;
   53     75   
        builder = builder.status(http_status);
   54         -
        let payload = "";
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          77  +
        let payload =
          78  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   55     81   
        let content_length = payload.len();
   56     82   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     83   
            builder,
   58         -
            ::http::header::CONTENT_LENGTH,
          84  +
            ::http_1x::header::CONTENT_LENGTH,
   59     85   
            content_length,
   60     86   
        );
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   61     88   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   62     90   
        builder.body(body)?
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   63     92   
    })
          93  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   64     94   
}
   65     95   
          96  +
/* RustType.kt:534 */
   66     97   
#[allow(clippy::unnecessary_wraps)]
          98  +
/* ServerHttpBoundProtocolGenerator.kt:471 */
   67     99   
pub fn ser_malformed_timestamp_query_epoch_http_error(
   68    100   
    error: &crate::error::MalformedTimestampQueryEpochError,
   69    101   
) -> std::result::Result<
   70    102   
    ::aws_smithy_http_server::response::Response,
   71    103   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   72    104   
> {
         105  +
    /* ServerHttpBoundProtocolGenerator.kt:476 */
   73    106   
    Ok({
         107  +
        /* ServerHttpBoundProtocolGenerator.kt:492 */
   74    108   
        match error {
         109  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
   75    110   
            crate::error::MalformedTimestampQueryEpochError::ValidationException(output) => {
         111  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
   76    112   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         113  +
                /* RustType.kt:534 */
   77    114   
                #[allow(unused_mut)]
   78         -
                let mut builder = ::http::Response::builder();
         115  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         116  +
                let mut builder = ::http_1x::Response::builder();
         117  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
   79    118   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   80    119   
                    builder,
   81         -
                    ::http::header::CONTENT_TYPE,
         120  +
                    ::http_1x::header::CONTENT_TYPE,
   82    121   
                    "application/json",
   83    122   
                );
         123  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
   84    124   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   85    125   
                    builder,
   86         -
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         126  +
                    ::http_1x::header::HeaderName::from_static("x-amzn-errortype"),
   87    127   
                    "ValidationException",
   88    128   
                );
         129  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
   89    130   
                let content_length = payload.len();
   90    131   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   91    132   
                    builder,
   92         -
                    ::http::header::CONTENT_LENGTH,
         133  +
                    ::http_1x::header::CONTENT_LENGTH,
   93    134   
                    content_length,
   94    135   
                );
         136  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
   95    137   
                builder
   96    138   
                    .status(400)
   97    139   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
   98         -
            }
         140  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         141  +
            } /* ServerHttpBoundProtocolGenerator.kt:492 */
   99    142   
        }
         143  +
        /* ServerHttpBoundProtocolGenerator.kt:476 */
  100    144   
    })
         145  +
    /* ServerHttpBoundProtocolGenerator.kt:471 */
  101    146   
}

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

@@ -1,1 +13,15 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
    2      3   
pub fn de_timestamp(
    3      4   
    value: &str,
    4      5   
) -> std::result::Result<
    5      6   
    ::aws_smithy_types::DateTime,
    6      7   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    7      8   
> {
    8         -
    let value = ::aws_smithy_types::DateTime::from_str(
    9         -
        value,
   10         -
        ::aws_smithy_types::date_time::Format::EpochSeconds,
   11         -
    )?;
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1495 */
          10  +
    let value = ::aws_smithy_types::DateTime::from_str(value, ::aws_smithy_types::date_time::Format::EpochSeconds)?
          11  +
    /* ServerHttpBoundProtocolGenerator.kt:1510 */;
          12  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
   12     13   
    Ok(value)
          14  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
   13     15   
}

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

@@ -1,1 +101,146 @@
    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_malformed_timestamp_query_http_date_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::MalformedTimestampQueryHttpDateInput,
    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::malformed_timestamp_query_http_date_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();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:1221 */
   22     30   
        let query_string = uri.query().unwrap_or("");
   23     31   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:1247 */
   24     33   
        let mut timestamp_seen = false;
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:1253 */
   25     35   
        for (k, v) in pairs {
          36  +
            /* ServerHttpBoundProtocolGenerator.kt:1257 */
   26     37   
            if !timestamp_seen && k == "timestamp" {
   27     38   
                input = input.set_timestamp(
   28     39   
                    crate::protocol_serde::shape_malformed_timestamp_query_http_date_input::de_timestamp(&v)?
   29     40   
                );
   30     41   
                timestamp_seen = true;
   31     42   
            }
          43  +
            /* ServerHttpBoundProtocolGenerator.kt:1253 */
   32     44   
        }
          45  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   33     46   
        input.build()?
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   34     48   
    })
          49  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   35     50   
}
   36     51   
          52  +
/* RustType.kt:534 */
   37     53   
#[allow(clippy::unnecessary_wraps)]
          54  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   38     55   
pub fn ser_malformed_timestamp_query_http_date_http_response(
   39     56   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampQueryHttpDateOutput,
   40     57   
) -> std::result::Result<
   41     58   
    ::aws_smithy_http_server::response::Response,
   42     59   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   43     60   
> {
          61  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   44     62   
    Ok({
          63  +
        /* RustType.kt:534 */
   45     64   
        #[allow(unused_mut)]
   46         -
        let mut builder = ::http::Response::builder();
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          66  +
        let mut builder = ::http_1x::Response::builder();
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   47     68   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   48     69   
            builder,
   49         -
            ::http::header::CONTENT_TYPE,
          70  +
            ::http_1x::header::CONTENT_TYPE,
   50     71   
            "application/json",
   51     72   
        );
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   52     74   
        let http_status: u16 = 200;
   53     75   
        builder = builder.status(http_status);
   54         -
        let payload = "";
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          77  +
        let payload =
          78  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   55     81   
        let content_length = payload.len();
   56     82   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     83   
            builder,
   58         -
            ::http::header::CONTENT_LENGTH,
          84  +
            ::http_1x::header::CONTENT_LENGTH,
   59     85   
            content_length,
   60     86   
        );
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   61     88   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   62     90   
        builder.body(body)?
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   63     92   
    })
          93  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   64     94   
}
   65     95   
          96  +
/* RustType.kt:534 */
   66     97   
#[allow(clippy::unnecessary_wraps)]
          98  +
/* ServerHttpBoundProtocolGenerator.kt:471 */
   67     99   
pub fn ser_malformed_timestamp_query_http_date_http_error(
   68    100   
    error: &crate::error::MalformedTimestampQueryHttpDateError,
   69    101   
) -> std::result::Result<
   70    102   
    ::aws_smithy_http_server::response::Response,
   71    103   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   72    104   
> {
         105  +
    /* ServerHttpBoundProtocolGenerator.kt:476 */
   73    106   
    Ok({
         107  +
        /* ServerHttpBoundProtocolGenerator.kt:492 */
   74    108   
        match error {
         109  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
   75    110   
            crate::error::MalformedTimestampQueryHttpDateError::ValidationException(output) => {
         111  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
   76    112   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         113  +
                /* RustType.kt:534 */
   77    114   
                #[allow(unused_mut)]
   78         -
                let mut builder = ::http::Response::builder();
         115  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         116  +
                let mut builder = ::http_1x::Response::builder();
         117  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
   79    118   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   80    119   
                    builder,
   81         -
                    ::http::header::CONTENT_TYPE,
         120  +
                    ::http_1x::header::CONTENT_TYPE,
   82    121   
                    "application/json",
   83    122   
                );
         123  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
   84    124   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   85    125   
                    builder,
   86         -
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         126  +
                    ::http_1x::header::HeaderName::from_static("x-amzn-errortype"),
   87    127   
                    "ValidationException",
   88    128   
                );
         129  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
   89    130   
                let content_length = payload.len();
   90    131   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   91    132   
                    builder,
   92         -
                    ::http::header::CONTENT_LENGTH,
         133  +
                    ::http_1x::header::CONTENT_LENGTH,
   93    134   
                    content_length,
   94    135   
                );
         136  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
   95    137   
                builder
   96    138   
                    .status(400)
   97    139   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
   98         -
            }
         140  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         141  +
            } /* ServerHttpBoundProtocolGenerator.kt:492 */
   99    142   
        }
         143  +
        /* ServerHttpBoundProtocolGenerator.kt:476 */
  100    144   
    })
         145  +
    /* ServerHttpBoundProtocolGenerator.kt:471 */
  101    146   
}

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

@@ -1,1 +13,15 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
    2      3   
pub fn de_timestamp(
    3      4   
    value: &str,
    4      5   
) -> std::result::Result<
    5      6   
    ::aws_smithy_types::DateTime,
    6      7   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    7      8   
> {
    8         -
    let value = ::aws_smithy_types::DateTime::from_str(
    9         -
        value,
   10         -
        ::aws_smithy_types::date_time::Format::HttpDate,
   11         -
    )?;
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1495 */
          10  +
    let value = ::aws_smithy_types::DateTime::from_str(value, ::aws_smithy_types::date_time::Format::HttpDate)?
          11  +
    /* ServerHttpBoundProtocolGenerator.kt:1510 */;
          12  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
   12     13   
    Ok(value)
          14  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
   13     15   
}

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

@@ -1,1 +108,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_malformed_union_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::MalformedUnionInput,
    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::malformed_union_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_malformed_union::de_malformed_union(
   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_malformed_union_http_response(
   39     58   
    #[allow(unused_variables)] output: crate::output::MalformedUnionOutput,
   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);
   54         -
        let payload = "";
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          79  +
        let payload =
          80  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   55     83   
        let content_length = payload.len();
   56     84   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     85   
            builder,
   58         -
            ::http::header::CONTENT_LENGTH,
          86  +
            ::http_1x::header::CONTENT_LENGTH,
   59     87   
            content_length,
   60     88   
        );
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   61     90   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   62     92   
        builder.body(body)?
          93  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   63     94   
    })
          95  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   64     96   
}
   65     97   
          98  +
/* JsonParserGenerator.kt:148 */
   66     99   
pub(crate) fn de_malformed_union(
   67    100   
    value: &[u8],
   68    101   
    mut builder: crate::input::malformed_union_input::Builder,
   69    102   
) -> ::std::result::Result<
   70    103   
    crate::input::malformed_union_input::Builder,
   71    104   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   72    105   
> {
         106  +
    /* JsonParserGenerator.kt:153 */
   73    107   
    let mut tokens_owned =
   74    108   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
   75    109   
            .peekable();
   76    110   
    let tokens = &mut tokens_owned;
   77    111   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         112  +
    /* JsonParserGenerator.kt:684 */
   78    113   
    loop {
         114  +
        /* JsonParserGenerator.kt:685 */
   79    115   
        match tokens.next().transpose()? {
         116  +
            /* JsonParserGenerator.kt:686 */
   80    117   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   81    118   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         119  +
                /* JsonParserGenerator.kt:260 */
   82    120   
                match key.to_unescaped()?.as_ref() {
         121  +
                    /* JsonParserGenerator.kt:262 */
   83    122   
                    "union" => {
         123  +
                        /* JsonParserGenerator.kt:272 */
   84    124   
                        builder = builder.set_union(
   85         -
                            crate::protocol_serde::shape_simple_union::de_simple_union(tokens)?,
   86         -
                        );
         125  +
                            /* JsonParserGenerator.kt:660 */crate::protocol_serde::shape_simple_union::de_simple_union(tokens)?
         126  +
                        /* JsonParserGenerator.kt:272 */);
         127  +
                        /* JsonParserGenerator.kt:262 */
   87    128   
                    }
   88         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         129  +
                    /* JsonParserGenerator.kt:290 */
         130  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   89    131   
                }
         132  +
                /* JsonParserGenerator.kt:686 */
   90    133   
            }
         134  +
            /* JsonParserGenerator.kt:695 */
   91    135   
            other => {
   92    136   
                return Err(
   93    137   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   94    138   
                        "expected object key or end object, found: {other:?}"
   95    139   
                    )),
   96    140   
                )
   97         -
            }
         141  +
            } /* JsonParserGenerator.kt:685 */
   98    142   
        }
         143  +
        /* JsonParserGenerator.kt:684 */
   99    144   
    }
         145  +
    /* JsonParserGenerator.kt:250 */
  100    146   
    if tokens.next().is_some() {
         147  +
        /* JsonParserGenerator.kt:251 */
  101    148   
        return Err(
  102    149   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  103    150   
                "found more JSON tokens after completing parsing",
  104    151   
            ),
  105    152   
        );
         153  +
        /* JsonParserGenerator.kt:250 */
  106    154   
    }
         155  +
    /* JsonParserGenerator.kt:163 */
  107    156   
    Ok(builder)
         157  +
    /* JsonParserGenerator.kt:148 */
  108    158   
}

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

@@ -1,1 +87,123 @@
    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_media_type_header_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::MediaTypeHeaderInput,
    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::media_type_header_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();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   22     30   
        if let Some(value) =
   23     31   
            crate::protocol_serde::shape_media_type_header_input::de_json_header(&headers)?
   24     32   
        {
   25     33   
            input = input.set_json(Some(value))
   26     34   
        }
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   27     36   
        input.build()
          37  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   28     38   
    })
          39  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   29     40   
}
   30     41   
          42  +
/* RustType.kt:534 */
   31     43   
#[allow(clippy::unnecessary_wraps)]
          44  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   32     45   
pub fn ser_media_type_header_http_response(
   33     46   
    #[allow(unused_variables)] output: crate::output::MediaTypeHeaderOutput,
   34     47   
) -> std::result::Result<
   35     48   
    ::aws_smithy_http_server::response::Response,
   36     49   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   37     50   
> {
          51  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   38     52   
    Ok({
          53  +
        /* RustType.kt:534 */
   39     54   
        #[allow(unused_mut)]
   40         -
        let mut builder = ::http::Response::builder();
          55  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          56  +
        let mut builder = ::http_1x::Response::builder();
          57  +
        /* ServerHttpBoundProtocolGenerator.kt:665 */
   41     58   
        builder = crate::protocol_serde::shape_media_type_header::ser_media_type_header_headers(
   42     59   
            &output, builder,
   43     60   
        )?;
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   44     62   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   45     63   
            builder,
   46         -
            ::http::header::CONTENT_TYPE,
          64  +
            ::http_1x::header::CONTENT_TYPE,
   47     65   
            "application/json",
   48     66   
        );
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   49     68   
        let http_status: u16 = 200;
   50     69   
        builder = builder.status(http_status);
          70  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   51     71   
        let payload =
   52         -
            crate::protocol_serde::shape_media_type_header_output::ser_media_type_header_output_output_output(&output)?
   53         -
        ;
          72  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_media_type_header_output::ser_media_type_header_output_output_output(&output)?
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   54     75   
        let content_length = payload.len();
   55     76   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   56     77   
            builder,
   57         -
            ::http::header::CONTENT_LENGTH,
          78  +
            ::http_1x::header::CONTENT_LENGTH,
   58     79   
            content_length,
   59     80   
        );
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   60     82   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   61     84   
        builder.body(body)?
          85  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   62     86   
    })
          87  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   63     88   
}
   64     89   
          90  +
/* HttpBindingGenerator.kt:565 */
   65     91   
pub fn ser_media_type_header_headers(
   66     92   
    input: &crate::output::MediaTypeHeaderOutput,
   67         -
    mut builder: ::http::response::Builder,
   68         -
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
   69         -
{
          93  +
    mut builder: ::http_1x::response::Builder,
          94  +
) -> std::result::Result<
          95  +
    ::http_1x::response::Builder,
          96  +
    ::aws_smithy_types::error::operation::BuildError,
          97  +
> {
          98  +
    /* HttpBindingGenerator.kt:615 */
   70     99   
    if let ::std::option::Option::Some(inner_1) = &input.json {
         100  +
        /* HttpBindingGenerator.kt:727 */
   71    101   
        let formatted_2 = ::aws_smithy_types::base64::encode(inner_1);
         102  +
        /* HttpBindingGenerator.kt:728 */
   72    103   
        if !formatted_2.is_empty() {
         104  +
            /* HttpBindingGenerator.kt:729 */
   73    105   
            let header_value = formatted_2;
   74         -
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         106  +
            let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   75    107   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   76    108   
                    "json",
   77    109   
                    format!(
   78    110   
                        "`{}` cannot be used as a header value: {}",
   79    111   
                        &header_value, err
   80    112   
                    ),
   81    113   
                )
   82    114   
            })?;
   83    115   
            builder = builder.header("X-Json", header_value);
         116  +
            /* HttpBindingGenerator.kt:728 */
   84    117   
        }
         118  +
        /* HttpBindingGenerator.kt:615 */
   85    119   
    }
         120  +
    /* HttpBindingGenerator.kt:578 */
   86    121   
    Ok(builder)
         122  +
    /* HttpBindingGenerator.kt:565 */
   87    123   
}

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

@@ -1,1 +34,41 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:159 */
    2      3   
pub(crate) fn de_json_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::option::Option<::std::string::String>,
    6      7   
    ::aws_smithy_http::header::ParseError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:166 */
    8     10   
    let headers = header_map.get_all("X-Json");
          11  +
    /* HttpBindingGenerator.kt:432 */
    9     12   
    let var_1: Vec<::std::string::String> = ::aws_smithy_http::header::read_many_from_str(headers)?;
          13  +
    /* HttpBindingGenerator.kt:437 */
   10     14   
    let var_1: std::result::Result<Vec<_>, _> = var_1
   11     15   
        .iter()
   12     16   
        .map(|s| {
   13     17   
            ::aws_smithy_types::base64::decode(s)
   14     18   
                .map_err(|_| ::aws_smithy_http::header::ParseError::new("failed to decode base64"))
   15     19   
                .and_then(|bytes| {
   16     20   
                    String::from_utf8(bytes).map_err(|_| {
   17     21   
                        ::aws_smithy_http::header::ParseError::new(
   18     22   
                            "base64 encoded data was not valid utf-8",
   19     23   
                        )
   20     24   
                    })
   21     25   
                })
   22     26   
        })
   23     27   
        .collect();
          28  +
    /* HttpBindingGenerator.kt:448 */
   24     29   
    let var_1 = var_1?;
          30  +
    /* HttpBindingGenerator.kt:491 */
   25     31   
    if var_1.len() > 1 {
   26     32   
        Err(::aws_smithy_http::header::ParseError::new(format!(
   27     33   
            "expected one item but found {}",
   28     34   
            var_1.len()
   29     35   
        )))
   30     36   
    } else {
   31     37   
        let mut var_1 = var_1;
   32     38   
        Ok(var_1.pop())
   33     39   
    }
          40  +
    /* HttpBindingGenerator.kt:159 */
   34     41   
}

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

@@ -1,1 +20,28 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_media_type_header_output_output_output(
    3      4   
    value: &crate::output::MediaTypeHeaderOutput,
    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_media_type_header_output::ser_media_type_header_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_media_type_header_output_output(
   16     22   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    #[allow(unused_variables)] input: &crate::output::MediaTypeHeaderOutput,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:372 */
   19     26   
    Ok(())
          27  +
    /* JsonSerializerGenerator.kt:358 */
   20     28   
}

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

@@ -1,1 +212,363 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:551 */
    2      3   
pub(crate) fn de_my_union<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained>,
    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:565 */
   16     18   
    let mut variant = None;
          19  +
    /* JsonParserGenerator.kt:567 */
   17     20   
    match tokens.next().transpose()? {
          21  +
        /* JsonParserGenerator.kt:568 */
   18     22   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => return Ok(None),
   19         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => loop {
   20         -
            match tokens.next().transpose()? {
   21         -
                Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   22         -
                Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
   23         -
                    if let ::std::option::Option::Some(::std::result::Result::Ok(
   24         -
                        ::aws_smithy_json::deserialize::Token::ValueNull { .. },
   25         -
                    )) = tokens.peek()
   26         -
                    {
   27         -
                        let _ = tokens.next().expect("peek returned a token")?;
   28         -
                        continue;
   29         -
                    }
   30         -
                    let key = key.to_unescaped()?;
   31         -
                    if key == "__type" {
   32         -
                        ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
   33         -
                        continue;
   34         -
                    }
   35         -
                    if variant.is_some() {
   36         -
                        return Err(
   37         -
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   38         -
                                "encountered mixed variants in union",
   39         -
                            ),
   40         -
                        );
   41         -
                    }
   42         -
                    variant = match key.as_ref() {
          23  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          24  +
            /* JsonParserGenerator.kt:684 */
          25  +
            loop {
          26  +
                /* JsonParserGenerator.kt:685 */
          27  +
                match tokens.next().transpose()? {
          28  +
                    /* JsonParserGenerator.kt:686 */
          29  +
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          30  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          31  +
                        /* JsonParserGenerator.kt:576 */
          32  +
                        if let ::std::option::Option::Some(::std::result::Result::Ok(
          33  +
                            ::aws_smithy_json::deserialize::Token::ValueNull { .. },
          34  +
                        )) = tokens.peek()
          35  +
                        {
          36  +
                            let _ = tokens.next().expect("peek returned a token")?;
          37  +
                            continue;
          38  +
                        }
          39  +
                        /* JsonParserGenerator.kt:585 */
          40  +
                        let key = key.to_unescaped()?;
          41  +
                        if key == "__type" {
          42  +
                            ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
          43  +
                            continue;
          44  +
                        }
          45  +
                        if variant.is_some() {
          46  +
                            return Err(
          47  +
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          48  +
                                    "encountered mixed variants in union",
          49  +
                                ),
          50  +
                            );
          51  +
                        }
          52  +
                        /* JsonParserGenerator.kt:598 */
          53  +
                        variant = match key.as_ref() {
          54  +
                            /* JsonParserGenerator.kt:601 */
   43     55   
                            "stringValue" => {
          56  +
                                /* JsonParserGenerator.kt:611 */
   44     57   
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::StringValue(
   45         -
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
   46         -
                                        s.to_unescaped().map(|u|
   47         -
                                            u.into_owned()
   48         -
                                        )
   49         -
                                    ).transpose()?
   50         -
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'stringValue' cannot be null"))?
   51         -
                                ))
          58  +
                                    /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          59  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          60  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
          61  +
                                        /* JsonParserGenerator.kt:339 */)
          62  +
                                    /* JsonParserGenerator.kt:354 */).transpose()?
          63  +
                                    /* JsonParserGenerator.kt:670 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'stringValue' cannot be null"))?
          64  +
                                /* JsonParserGenerator.kt:611 */))
          65  +
                                /* JsonParserGenerator.kt:601 */
   52     66   
                            }
          67  +
                            /* JsonParserGenerator.kt:601 */
   53     68   
                            "booleanValue" => {
          69  +
                                /* JsonParserGenerator.kt:611 */
   54     70   
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::BooleanValue(
   55         -
                                    ::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?
   56         -
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'booleanValue' cannot be null"))?
   57         -
                                ))
          71  +
                                    /* JsonParserGenerator.kt:298 */::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?
          72  +
                                    /* JsonParserGenerator.kt:670 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'booleanValue' cannot be null"))?
          73  +
                                /* JsonParserGenerator.kt:611 */))
          74  +
                                /* JsonParserGenerator.kt:601 */
   58     75   
                            }
          76  +
                            /* JsonParserGenerator.kt:601 */
   59     77   
                            "numberValue" => {
          78  +
                                /* JsonParserGenerator.kt:611 */
   60     79   
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::NumberValue(
   61         -
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
          80  +
                                    /* JsonParserGenerator.kt:365 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   62     81   
                                                        .map(i32::try_from)
   63     82   
                                                        .transpose()?
   64         -
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'numberValue' cannot be null"))?
   65         -
                                ))
          83  +
                                    /* JsonParserGenerator.kt:670 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'numberValue' cannot be null"))?
          84  +
                                /* JsonParserGenerator.kt:611 */))
          85  +
                                /* JsonParserGenerator.kt:601 */
   66     86   
                            }
          87  +
                            /* JsonParserGenerator.kt:601 */
   67     88   
                            "blobValue" => {
          89  +
                                /* JsonParserGenerator.kt:611 */
   68     90   
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::BlobValue(
   69         -
                                    ::aws_smithy_json::deserialize::token::expect_blob_or_null(tokens.next())?
   70         -
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'blobValue' cannot be null"))?
   71         -
                                ))
          91  +
                                    /* JsonParserGenerator.kt:326 */::aws_smithy_json::deserialize::token::expect_blob_or_null(tokens.next())?
          92  +
                                    /* JsonParserGenerator.kt:670 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'blobValue' cannot be null"))?
          93  +
                                /* JsonParserGenerator.kt:611 */))
          94  +
                                /* JsonParserGenerator.kt:601 */
   72     95   
                            }
          96  +
                            /* JsonParserGenerator.kt:601 */
   73     97   
                            "timestampValue" => {
          98  +
                                /* JsonParserGenerator.kt:611 */
   74     99   
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::TimestampValue(
   75         -
                                    ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::EpochSeconds)?
   76         -
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'timestampValue' cannot be null"))?
   77         -
                                ))
         100  +
                                    /* JsonParserGenerator.kt:384 */::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::EpochSeconds)?
         101  +
                                    /* JsonParserGenerator.kt:670 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'timestampValue' cannot be null"))?
         102  +
                                /* JsonParserGenerator.kt:611 */))
         103  +
                                /* JsonParserGenerator.kt:601 */
   78    104   
                            }
         105  +
                            /* JsonParserGenerator.kt:601 */
   79    106   
                            "enumValue" => {
         107  +
                                /* JsonParserGenerator.kt:611 */
   80    108   
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::EnumValue(
   81         -
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
   82         -
                                        s.to_unescaped().map(|u|
   83         -
                                            u.into_owned()
   84         -
                                        )
   85         -
                                    ).transpose()?
   86         -
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'enumValue' cannot be null"))?
   87         -
                                ))
         109  +
                                    /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
         110  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         111  +
                                            /* JsonParserGenerator.kt:343 */u.into_owned()
         112  +
                                        /* JsonParserGenerator.kt:339 */)
         113  +
                                    /* JsonParserGenerator.kt:354 */).transpose()?
         114  +
                                    /* JsonParserGenerator.kt:670 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'enumValue' cannot be null"))?
         115  +
                                /* JsonParserGenerator.kt:611 */))
         116  +
                                /* JsonParserGenerator.kt:601 */
   88    117   
                            }
         118  +
                            /* JsonParserGenerator.kt:601 */
   89    119   
                            "listValue" => {
         120  +
                                /* JsonParserGenerator.kt:611 */
   90    121   
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::ListValue(
   91         -
                                    crate::protocol_serde::shape_string_list::de_string_list(tokens)?
   92         -
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'listValue' cannot be null"))?
   93         -
                                ))
         122  +
                                    /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_string_list::de_string_list(tokens)?
         123  +
                                    /* JsonParserGenerator.kt:670 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'listValue' cannot be null"))?
         124  +
                                /* JsonParserGenerator.kt:611 */))
         125  +
                                /* JsonParserGenerator.kt:601 */
   94    126   
                            }
         127  +
                            /* JsonParserGenerator.kt:601 */
   95    128   
                            "mapValue" => {
         129  +
                                /* JsonParserGenerator.kt:611 */
   96    130   
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::MapValue(
   97         -
                                    crate::protocol_serde::shape_string_map::de_string_map(tokens)?
   98         -
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'mapValue' cannot be null"))?
   99         -
                                ))
         131  +
                                    /* JsonParserGenerator.kt:509 */crate::protocol_serde::shape_string_map::de_string_map(tokens)?
         132  +
                                    /* JsonParserGenerator.kt:670 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'mapValue' cannot be null"))?
         133  +
                                /* JsonParserGenerator.kt:611 */))
         134  +
                                /* JsonParserGenerator.kt:601 */
  100    135   
                            }
         136  +
                            /* JsonParserGenerator.kt:601 */
  101    137   
                            "structureValue" => {
         138  +
                                /* JsonParserGenerator.kt:611 */
  102    139   
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::StructureValue(
  103         -
                                    crate::protocol_serde::shape_greeting_struct::de_greeting_struct(tokens)?
  104         -
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'structureValue' cannot be null"))?
  105         -
                                ))
         140  +
                                    /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_greeting_struct::de_greeting_struct(tokens)?
         141  +
                                    /* JsonParserGenerator.kt:670 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'structureValue' cannot be null"))?
         142  +
                                /* JsonParserGenerator.kt:611 */))
         143  +
                                /* JsonParserGenerator.kt:601 */
  106    144   
                            }
         145  +
                            /* JsonParserGenerator.kt:601 */
  107    146   
                            "renamedStructureValue" => {
         147  +
                                /* JsonParserGenerator.kt:611 */
  108    148   
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::RenamedStructureValue(
  109         -
                                    crate::protocol_serde::shape_renamed_greeting::de_renamed_greeting(tokens)?
  110         -
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'renamedStructureValue' cannot be null"))?
  111         -
                                ))
         149  +
                                    /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_renamed_greeting::de_renamed_greeting(tokens)?
         150  +
                                    /* JsonParserGenerator.kt:670 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'renamedStructureValue' cannot be null"))?
         151  +
                                /* JsonParserGenerator.kt:611 */))
         152  +
                                /* JsonParserGenerator.kt:601 */
  112    153   
                            }
  113         -
                            variant => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("unexpected union variant: {variant}")))
         154  +
                            /* JsonParserGenerator.kt:634 */
         155  +
                            variant => {
         156  +
                                return Err(
         157  +
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         158  +
                                        format!("unexpected union variant: {variant}"),
         159  +
                                    ),
         160  +
                                )
         161  +
                            } /* JsonParserGenerator.kt:598 */
  114    162   
                        };
         163  +
                        /* JsonParserGenerator.kt:686 */
         164  +
                    }
         165  +
                    /* JsonParserGenerator.kt:695 */
         166  +
                    other => {
         167  +
                        return Err(
         168  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         169  +
                                format!("expected object key or end object, found: {other:?}"),
         170  +
                            ),
         171  +
                        )
         172  +
                    } /* JsonParserGenerator.kt:685 */
  115    173   
                }
  116         -
                other => {
  117         -
                    return Err(
  118         -
                        ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  119         -
                            "expected object key or end object, found: {other:?}"
  120         -
                        )),
  121         -
                    )
  122         -
                }
         174  +
                /* JsonParserGenerator.kt:684 */
  123    175   
            }
  124         -
        },
         176  +
            /* JsonParserGenerator.kt:568 */
         177  +
        }
         178  +
        /* JsonParserGenerator.kt:642 */
  125    179   
        _ => {
  126    180   
            return Err(
  127    181   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  128    182   
                    "expected start object or null",
  129    183   
                ),
  130    184   
            )
  131         -
        }
         185  +
        } /* JsonParserGenerator.kt:567 */
  132    186   
    }
         187  +
    /* JsonParserGenerator.kt:649 */
  133    188   
    if variant.is_none() {
  134    189   
        return Err(
  135    190   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  136    191   
                "Union did not contain a valid variant.",
  137    192   
            ),
  138    193   
        );
  139    194   
    }
         195  +
    /* JsonParserGenerator.kt:657 */
  140    196   
    Ok(variant)
         197  +
    /* JsonParserGenerator.kt:551 */
  141    198   
}
  142    199   
         200  +
/* JsonSerializerGenerator.kt:547 */
  143    201   
pub fn ser_my_union(
  144    202   
    object_2: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
  145    203   
    input: &crate::model::MyUnion,
  146    204   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
         205  +
    /* JsonSerializerGenerator.kt:556 */
  147    206   
    match input {
         207  +
        /* JsonSerializerGenerator.kt:564 */
  148    208   
        crate::model::MyUnion::StringValue(inner) => {
  149         -
            object_2.key("stringValue").string(inner.as_str());
         209  +
            /* SerializerUtil.kt:42 */
         210  +
            {
         211  +
                /* JsonSerializerGenerator.kt:423 */
         212  +
                object_2.key("stringValue").string(inner.as_str());
         213  +
                /* SerializerUtil.kt:42 */
         214  +
            }
         215  +
            /* JsonSerializerGenerator.kt:564 */
  150    216   
        }
         217  +
        /* JsonSerializerGenerator.kt:564 */
  151    218   
        crate::model::MyUnion::BooleanValue(inner) => {
  152         -
            object_2.key("booleanValue").boolean(*inner);
         219  +
            /* SerializerUtil.kt:42 */
         220  +
            {
         221  +
                /* JsonSerializerGenerator.kt:424 */
         222  +
                object_2.key("booleanValue").boolean(*inner);
         223  +
                /* SerializerUtil.kt:42 */
         224  +
            }
         225  +
            /* JsonSerializerGenerator.kt:564 */
  153    226   
        }
         227  +
        /* JsonSerializerGenerator.kt:564 */
  154    228   
        crate::model::MyUnion::NumberValue(inner) => {
  155         -
            object_2.key("numberValue").number(
  156         -
                #[allow(clippy::useless_conversion)]
  157         -
                ::aws_smithy_types::Number::NegInt((*inner).into()),
  158         -
            );
         229  +
            /* SerializerUtil.kt:42 */
         230  +
            {
         231  +
                /* JsonSerializerGenerator.kt:432 */
         232  +
                object_2.key("numberValue").number(
         233  +
                    #[allow(clippy::useless_conversion)]
         234  +
                    ::aws_smithy_types::Number::NegInt((*inner).into()),
         235  +
                );
         236  +
                /* SerializerUtil.kt:42 */
         237  +
            }
         238  +
            /* JsonSerializerGenerator.kt:564 */
  159    239   
        }
         240  +
        /* JsonSerializerGenerator.kt:564 */
  160    241   
        crate::model::MyUnion::BlobValue(inner) => {
  161         -
            object_2
  162         -
                .key("blobValue")
  163         -
                .string_unchecked(&::aws_smithy_types::base64::encode(inner));
         242  +
            /* SerializerUtil.kt:42 */
         243  +
            {
         244  +
                /* JsonSerializerGenerator.kt:439 */
         245  +
                object_2
         246  +
                    .key("blobValue")
         247  +
                    .string_unchecked(&::aws_smithy_types::base64::encode(inner));
         248  +
                /* SerializerUtil.kt:42 */
         249  +
            }
         250  +
            /* JsonSerializerGenerator.kt:564 */
  164    251   
        }
         252  +
        /* JsonSerializerGenerator.kt:564 */
  165    253   
        crate::model::MyUnion::TimestampValue(inner) => {
  166         -
            object_2
  167         -
                .key("timestampValue")
  168         -
                .date_time(inner, ::aws_smithy_types::date_time::Format::EpochSeconds)?;
         254  +
            /* SerializerUtil.kt:42 */
         255  +
            {
         256  +
                /* JsonSerializerGenerator.kt:448 */
         257  +
                object_2
         258  +
                    .key("timestampValue")
         259  +
                    .date_time(inner, ::aws_smithy_types::date_time::Format::EpochSeconds)?;
         260  +
                /* SerializerUtil.kt:42 */
         261  +
            }
         262  +
            /* JsonSerializerGenerator.kt:564 */
  169    263   
        }
         264  +
        /* JsonSerializerGenerator.kt:564 */
  170    265   
        crate::model::MyUnion::EnumValue(inner) => {
  171         -
            object_2.key("enumValue").string(inner.as_str());
         266  +
            /* SerializerUtil.kt:42 */
         267  +
            {
         268  +
                /* JsonSerializerGenerator.kt:423 */
         269  +
                object_2.key("enumValue").string(inner.as_str());
         270  +
                /* SerializerUtil.kt:42 */
         271  +
            }
         272  +
            /* JsonSerializerGenerator.kt:564 */
  172    273   
        }
         274  +
        /* JsonSerializerGenerator.kt:564 */
  173    275   
        crate::model::MyUnion::ListValue(inner) => {
  174         -
            let mut array_1 = object_2.key("listValue").start_array();
  175         -
            for item_2 in inner {
  176         -
                {
  177         -
                    array_1.value().string(item_2.as_str());
         276  +
            /* SerializerUtil.kt:42 */
         277  +
            {
         278  +
                /* JsonSerializerGenerator.kt:484 */
         279  +
                let mut array_1 = object_2.key("listValue").start_array();
         280  +
                /* JsonSerializerGenerator.kt:524 */
         281  +
                for item_2 in inner {
         282  +
                    /* SerializerUtil.kt:42 */
         283  +
                    {
         284  +
                        /* JsonSerializerGenerator.kt:423 */
         285  +
                        array_1.value().string(item_2.as_str());
         286  +
                        /* SerializerUtil.kt:42 */
         287  +
                    }
         288  +
                    /* JsonSerializerGenerator.kt:524 */
  178    289   
                }
         290  +
                /* JsonSerializerGenerator.kt:486 */
         291  +
                array_1.finish();
         292  +
                /* SerializerUtil.kt:42 */
  179    293   
            }
  180         -
            array_1.finish();
         294  +
            /* JsonSerializerGenerator.kt:564 */
  181    295   
        }
         296  +
        /* JsonSerializerGenerator.kt:564 */
  182    297   
        crate::model::MyUnion::MapValue(inner) => {
  183         -
            #[allow(unused_mut)]
  184         -
            let mut object_3 = object_2.key("mapValue").start_object();
  185         -
            for (key_4, value_5) in inner {
  186         -
                {
  187         -
                    object_3.key(key_4.as_str()).string(value_5.as_str());
         298  +
            /* SerializerUtil.kt:42 */
         299  +
            {
         300  +
                /* JsonSerializerGenerator.kt:495 */
         301  +
                #[allow(unused_mut)]
         302  +
                /* JsonSerializerGenerator.kt:496 */
         303  +
                let mut object_3 = object_2.key("mapValue").start_object();
         304  +
                /* JsonSerializerGenerator.kt:537 */
         305  +
                for (key_4, value_5) in inner {
         306  +
                    /* SerializerUtil.kt:42 */
         307  +
                    {
         308  +
                        /* JsonSerializerGenerator.kt:423 */
         309  +
                        object_3.key(key_4.as_str()).string(value_5.as_str());
         310  +
                        /* SerializerUtil.kt:42 */
         311  +
                    }
         312  +
                    /* JsonSerializerGenerator.kt:537 */
  188    313   
                }
         314  +
                /* JsonSerializerGenerator.kt:515 */
         315  +
                object_3.finish();
         316  +
                /* SerializerUtil.kt:42 */
  189    317   
            }
  190         -
            object_3.finish();
         318  +
            /* JsonSerializerGenerator.kt:564 */
  191    319   
        }
         320  +
        /* JsonSerializerGenerator.kt:564 */
  192    321   
        crate::model::MyUnion::StructureValue(inner) => {
  193         -
            #[allow(unused_mut)]
  194         -
            let mut object_6 = object_2.key("structureValue").start_object();
  195         -
            crate::protocol_serde::shape_greeting_struct::ser_greeting_struct(
  196         -
                &mut object_6,
  197         -
                inner,
  198         -
            )?;
  199         -
            object_6.finish();
         322  +
            /* SerializerUtil.kt:42 */
         323  +
            {
         324  +
                /* JsonSerializerGenerator.kt:495 */
         325  +
                #[allow(unused_mut)]
         326  +
                /* JsonSerializerGenerator.kt:496 */
         327  +
                let mut object_6 = object_2.key("structureValue").start_object();
         328  +
                /* JsonSerializerGenerator.kt:375 */
         329  +
                crate::protocol_serde::shape_greeting_struct::ser_greeting_struct(
         330  +
                    &mut object_6,
         331  +
                    inner,
         332  +
                )?;
         333  +
                /* JsonSerializerGenerator.kt:515 */
         334  +
                object_6.finish();
         335  +
                /* SerializerUtil.kt:42 */
         336  +
            }
         337  +
            /* JsonSerializerGenerator.kt:564 */
  200    338   
        }
         339  +
        /* JsonSerializerGenerator.kt:564 */
  201    340   
        crate::model::MyUnion::RenamedStructureValue(inner) => {
  202         -
            #[allow(unused_mut)]
  203         -
            let mut object_7 = object_2.key("renamedStructureValue").start_object();
  204         -
            crate::protocol_serde::shape_renamed_greeting::ser_renamed_greeting(
  205         -
                &mut object_7,
  206         -
                inner,
  207         -
            )?;
  208         -
            object_7.finish();
         341  +
            /* SerializerUtil.kt:42 */
         342  +
            {
         343  +
                /* JsonSerializerGenerator.kt:495 */
         344  +
                #[allow(unused_mut)]
         345  +
                /* JsonSerializerGenerator.kt:496 */
         346  +
                let mut object_7 = object_2.key("renamedStructureValue").start_object();
         347  +
                /* JsonSerializerGenerator.kt:375 */
         348  +
                crate::protocol_serde::shape_renamed_greeting::ser_renamed_greeting(
         349  +
                    &mut object_7,
         350  +
                    inner,
         351  +
                )?;
         352  +
                /* JsonSerializerGenerator.kt:515 */
         353  +
                object_7.finish();
         354  +
                /* SerializerUtil.kt:42 */
         355  +
            }
         356  +
            /* JsonSerializerGenerator.kt:564 */
  209    357   
        }
         358  +
        /* JsonSerializerGenerator.kt:556 */
  210    359   
    }
         360  +
    /* JsonSerializerGenerator.kt:576 */
  211    361   
    Ok(())
         362  +
    /* JsonSerializerGenerator.kt:547 */
  212    363   
}

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

@@ -1,1 +103,144 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:175 */
    2      3   
pub(crate) fn de_nested_payload_payload(
    3      4   
    input: &[u8],
    4      5   
) -> ::std::result::Result<
    5      6   
    crate::model::NestedPayload,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
> {
           9  +
    /* JsonParserGenerator.kt:187 */
    8     10   
    let mut tokens_owned =
    9     11   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(input))
   10     12   
            .peekable();
   11     13   
    let tokens = &mut tokens_owned;
   12         -
    let result = crate::protocol_serde::shape_nested_payload::de_nested_payload(tokens)?
   13         -
        .ok_or_else(|| {
   14         -
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   15         -
                "expected payload member value",
   16         -
            )
   17         -
        });
          14  +
    /* JsonParserGenerator.kt:194 */
          15  +
    let result =
          16  +
    /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_nested_payload::de_nested_payload(tokens)?
          17  +
    /* JsonParserGenerator.kt:196 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("expected payload member value"));
          18  +
    /* JsonParserGenerator.kt:250 */
   18     19   
    if tokens.next().is_some() {
          20  +
        /* JsonParserGenerator.kt:251 */
   19     21   
        return Err(
   20     22   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   21     23   
                "found more JSON tokens after completing parsing",
   22     24   
            ),
   23     25   
        );
          26  +
        /* JsonParserGenerator.kt:250 */
   24     27   
    }
          28  +
    /* JsonParserGenerator.kt:198 */
   25     29   
    result
          30  +
    /* JsonParserGenerator.kt:175 */
   26     31   
}
   27     32   
          33  +
/* JsonSerializerGenerator.kt:358 */
   28     34   
pub fn ser_nested_payload(
   29     35   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   30     36   
    input: &crate::model::NestedPayload,
   31     37   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          38  +
    /* JsonSerializerGenerator.kt:382 */
   32     39   
    if let Some(var_1) = &input.greeting {
          40  +
        /* JsonSerializerGenerator.kt:423 */
   33     41   
        object.key("greeting").string(var_1.as_str());
          42  +
        /* JsonSerializerGenerator.kt:382 */
   34     43   
    }
          44  +
    /* JsonSerializerGenerator.kt:382 */
   35     45   
    if let Some(var_2) = &input.name {
          46  +
        /* JsonSerializerGenerator.kt:423 */
   36     47   
        object.key("name").string(var_2.as_str());
          48  +
        /* JsonSerializerGenerator.kt:382 */
   37     49   
    }
          50  +
    /* JsonSerializerGenerator.kt:372 */
   38     51   
    Ok(())
          52  +
    /* JsonSerializerGenerator.kt:358 */
   39     53   
}
   40     54   
          55  +
/* JsonParserGenerator.kt:516 */
   41     56   
pub(crate) fn de_nested_payload<'a, I>(
   42     57   
    tokens: &mut ::std::iter::Peekable<I>,
   43     58   
) -> ::std::result::Result<
   44     59   
    Option<crate::model::NestedPayload>,
   45     60   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   46     61   
>
   47     62   
where
   48     63   
    I: Iterator<
   49     64   
        Item = Result<
   50     65   
            ::aws_smithy_json::deserialize::Token<'a>,
   51     66   
            ::aws_smithy_json::deserialize::error::DeserializeError,
   52     67   
        >,
   53     68   
    >,
   54     69   
{
          70  +
    /* JsonParserGenerator.kt:712 */
   55     71   
    match tokens.next().transpose()? {
          72  +
        /* JsonParserGenerator.kt:713 */
   56     73   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   57     74   
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          75  +
            /* RustType.kt:534 */
   58     76   
            #[allow(unused_mut)]
          77  +
            /* JsonParserGenerator.kt:526 */
   59     78   
            let mut builder = crate::model::nested_payload::Builder::default();
          79  +
            /* JsonParserGenerator.kt:684 */
   60     80   
            loop {
          81  +
                /* JsonParserGenerator.kt:685 */
   61     82   
                match tokens.next().transpose()? {
          83  +
                    /* JsonParserGenerator.kt:686 */
   62     84   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   63     85   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          86  +
                        /* JsonParserGenerator.kt:260 */
   64     87   
                        match key.to_unescaped()?.as_ref() {
          88  +
                            /* JsonParserGenerator.kt:262 */
   65     89   
                            "greeting" => {
          90  +
                                /* JsonParserGenerator.kt:272 */
   66     91   
                                builder = builder.set_greeting(
   67         -
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
   68         -
                                        tokens.next(),
   69         -
                                    )?
   70         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   71         -
                                    .transpose()?,
   72         -
                                );
          92  +
                                    /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          93  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          94  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
          95  +
                                        /* JsonParserGenerator.kt:339 */)
          96  +
                                    /* JsonParserGenerator.kt:354 */).transpose()?
          97  +
                                /* JsonParserGenerator.kt:272 */);
          98  +
                                /* JsonParserGenerator.kt:262 */
   73     99   
                            }
         100  +
                            /* JsonParserGenerator.kt:262 */
   74    101   
                            "name" => {
         102  +
                                /* JsonParserGenerator.kt:272 */
   75    103   
                                builder = builder.set_name(
   76         -
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
   77         -
                                        tokens.next(),
   78         -
                                    )?
   79         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   80         -
                                    .transpose()?,
   81         -
                                );
         104  +
                                    /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
         105  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         106  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
         107  +
                                        /* JsonParserGenerator.kt:339 */)
         108  +
                                    /* JsonParserGenerator.kt:354 */).transpose()?
         109  +
                                /* JsonParserGenerator.kt:272 */);
         110  +
                                /* JsonParserGenerator.kt:262 */
   82    111   
                            }
   83         -
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         112  +
                            /* JsonParserGenerator.kt:290 */
         113  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   84    114   
                        }
         115  +
                        /* JsonParserGenerator.kt:686 */
   85    116   
                    }
         117  +
                    /* JsonParserGenerator.kt:695 */
   86    118   
                    other => {
   87    119   
                        return Err(
   88    120   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   89    121   
                                format!("expected object key or end object, found: {other:?}"),
   90    122   
                            ),
   91    123   
                        )
   92         -
                    }
         124  +
                    } /* JsonParserGenerator.kt:685 */
   93    125   
                }
         126  +
                /* JsonParserGenerator.kt:684 */
   94    127   
            }
         128  +
            /* JsonParserGenerator.kt:540 */
   95    129   
            Ok(Some(builder.build()))
         130  +
            /* JsonParserGenerator.kt:713 */
   96    131   
        }
   97         -
        _ => Err(
   98         -
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   99         -
                "expected start object or null",
  100         -
            ),
  101         -
        ),
         132  +
        /* JsonParserGenerator.kt:722 */
         133  +
        _ => {
         134  +
            /* JsonParserGenerator.kt:723 */
         135  +
            Err(
         136  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         137  +
                    "expected start object or null",
         138  +
                ),
         139  +
            )
         140  +
            /* JsonParserGenerator.kt:722 */
         141  +
        } /* JsonParserGenerator.kt:712 */
  102    142   
    }
         143  +
    /* JsonParserGenerator.kt:516 */
  103    144   
}