Server Test Python

Server Test Python

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943

Files changed:

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

@@ -1,1 +138,190 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_timestamp_path_http_date_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::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:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input =
   18     23   
            crate::input::malformed_timestamp_path_http_date_input_internal::Builder::default();
          24  +
        /* RustType.kt:516 */
   19     25   
        #[allow(unused_variables)]
          26  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   20     27   
        let ::aws_smithy_runtime_api::http::RequestParts {
   21     28   
            uri, headers, body, ..
   22     29   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          30  +
        /* ServerHttpBoundProtocolGenerator.kt:986 */
   23     31   
        let input_string = uri.path();
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:998 */
   24     33   
        let (input_string, (_, m1)) =
   25     34   
            ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
   26     35   
                ::nom::sequence::preceded(
   27     36   
                    ::nom::bytes::complete::tag("/"),
   28     37   
                    ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>(
   29     38   
                        "MalformedTimestampPathHttpDate",
   30     39   
                    ),
   31     40   
                ),
   32     41   
                ::nom::sequence::preceded(
   33     42   
                    ::nom::bytes::complete::tag("/"),
   34     43   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   35     44   
                        ::nom::bytes::complete::take_until("/"),
   36     45   
                        ::nom::combinator::rest,
   37     46   
                    )),
   38     47   
                ),
   39     48   
            ))(input_string)?;
   40     49   
        debug_assert_eq!("", input_string);
          50  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   41     51   
        input = input.set_timestamp(
   42     52   
            crate::protocol_serde::shape_malformed_timestamp_path_http_date_input::de_timestamp(
   43     53   
                m1,
   44     54   
            )?,
   45     55   
        );
          56  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   46     57   
        input.build()?
          58  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   47     59   
    })
          60  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   48     61   
}
   49     62   
          63  +
/* RustType.kt:516 */
   50     64   
#[allow(clippy::unnecessary_wraps)]
          65  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   51     66   
pub fn ser_malformed_timestamp_path_http_date_http_response(
   52     67   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampPathHttpDateOutput,
   53     68   
) -> std::result::Result<
   54     69   
    ::aws_smithy_http_server::response::Response,
   55     70   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   56     71   
> {
          72  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   57     73   
    Ok({
          74  +
        /* RustType.kt:516 */
   58     75   
        #[allow(unused_mut)]
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   59     77   
        let mut builder = ::http::Response::builder();
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   60     79   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   61     80   
            builder,
   62     81   
            ::http::header::CONTENT_TYPE,
   63     82   
            "application/json",
   64     83   
        );
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   65     85   
        let http_status: u16 = 200;
   66     86   
        builder = builder.status(http_status);
   67         -
        let payload = "";
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          88  +
        let payload =
          89  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   68     92   
        let content_length = payload.len();
   69     93   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   70     94   
            builder,
   71     95   
            ::http::header::CONTENT_LENGTH,
   72     96   
            content_length,
   73     97   
        );
          98  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   74     99   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
         100  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   75    101   
        builder.body(body)?
         102  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   76    103   
    })
         104  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   77    105   
}
   78    106   
         107  +
/* RustType.kt:516 */
   79    108   
#[allow(clippy::unnecessary_wraps)]
         109  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   80    110   
pub fn ser_malformed_timestamp_path_http_date_http_error(
   81    111   
    error: &crate::error::MalformedTimestampPathHttpDateError,
   82    112   
) -> std::result::Result<
   83    113   
    ::aws_smithy_http_server::response::Response,
   84    114   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   85    115   
> {
         116  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   86    117   
    Ok({
         118  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   87    119   
        match error {
         120  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   88    121   
            crate::error::MalformedTimestampPathHttpDateError::ValidationException(output) => {
         122  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   89    123   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         124  +
                /* RustType.kt:516 */
   90    125   
                #[allow(unused_mut)]
         126  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   91    127   
                let mut builder = ::http::Response::builder();
         128  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   92    129   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   93    130   
                    builder,
   94    131   
                    ::http::header::CONTENT_TYPE,
   95    132   
                    "application/json",
   96    133   
                );
         134  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   97    135   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   98    136   
                    builder,
   99    137   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  100    138   
                    "ValidationException",
  101    139   
                );
         140  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  102    141   
                let content_length = payload.len();
  103    142   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  104    143   
                    builder,
  105    144   
                    ::http::header::CONTENT_LENGTH,
  106    145   
                    content_length,
  107    146   
                );
         147  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  108    148   
                builder
  109    149   
                    .status(400)
  110    150   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         151  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
  111    152   
            }
         153  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  112    154   
            crate::error::MalformedTimestampPathHttpDateError::InternalServerError(output) => {
         155  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  113    156   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         157  +
                /* RustType.kt:516 */
  114    158   
                #[allow(unused_mut)]
         159  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  115    160   
                let mut builder = ::http::Response::builder();
         161  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  116    162   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  117    163   
                    builder,
  118    164   
                    ::http::header::CONTENT_TYPE,
  119    165   
                    "application/json",
  120    166   
                );
         167  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  121    168   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  122    169   
                    builder,
  123    170   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  124    171   
                    "InternalServerError",
  125    172   
                );
         173  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  126    174   
                let content_length = payload.len();
  127    175   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  128    176   
                    builder,
  129    177   
                    ::http::header::CONTENT_LENGTH,
  130    178   
                    content_length,
  131    179   
                );
         180  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  132    181   
                builder
  133    182   
                    .status(500)
  134    183   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  135         -
            }
         184  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         185  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  136    186   
        }
         187  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  137    188   
    })
         189  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  138    190   
}

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

@@ -1,1 +15,17 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
    2      3   
pub fn de_timestamp(
    3      4   
    value: &str,
    4      5   
) -> std::result::Result<
    5      6   
    ::aws_smithy_http_server_python::types::DateTime,
    6      7   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    7      8   
> {
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1323 */
    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         -
    )?
   13         -
    .into();
          11  +
    let value = ::aws_smithy_types::DateTime::from_str(value.as_ref(), ::aws_smithy_types::date_time::Format::HttpDate)?
          12  +
    /* PythonServerProtocolLoader.kt:68 */.into()
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1343 */;
          14  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   14     15   
    Ok(value)
          16  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   15     17   
}

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

@@ -1,1 +126,180 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_timestamp_query_default_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::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:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input =
   18     23   
            crate::input::malformed_timestamp_query_default_input_internal::Builder::default();
          24  +
        /* RustType.kt:516 */
   19     25   
        #[allow(unused_variables)]
          26  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   20     27   
        let ::aws_smithy_runtime_api::http::RequestParts {
   21     28   
            uri, headers, body, ..
   22     29   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          30  +
        /* ServerHttpBoundProtocolGenerator.kt:1073 */
   23     31   
        let query_string = uri.query().unwrap_or("");
   24     32   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          33  +
        /* ServerHttpBoundProtocolGenerator.kt:1099 */
   25     34   
        let mut timestamp_seen = false;
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:1105 */
   26     36   
        for (k, v) in pairs {
          37  +
            /* ServerHttpBoundProtocolGenerator.kt:1109 */
   27     38   
            if !timestamp_seen && k == "timestamp" {
   28     39   
                input = input.set_timestamp(
   29     40   
                    crate::protocol_serde::shape_malformed_timestamp_query_default_input::de_timestamp(&v)?
   30     41   
                );
   31     42   
                timestamp_seen = true;
   32     43   
            }
          44  +
            /* ServerHttpBoundProtocolGenerator.kt:1105 */
   33     45   
        }
          46  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   34     47   
        input.build()?
          48  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   35     49   
    })
          50  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   36     51   
}
   37     52   
          53  +
/* RustType.kt:516 */
   38     54   
#[allow(clippy::unnecessary_wraps)]
          55  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   39     56   
pub fn ser_malformed_timestamp_query_default_http_response(
   40     57   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampQueryDefaultOutput,
   41     58   
) -> std::result::Result<
   42     59   
    ::aws_smithy_http_server::response::Response,
   43     60   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   44     61   
> {
          62  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   45     63   
    Ok({
          64  +
        /* RustType.kt:516 */
   46     65   
        #[allow(unused_mut)]
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   47     67   
        let mut builder = ::http::Response::builder();
          68  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   48     69   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   49     70   
            builder,
   50     71   
            ::http::header::CONTENT_TYPE,
   51     72   
            "application/json",
   52     73   
        );
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   53     75   
        let http_status: u16 = 200;
   54     76   
        builder = builder.status(http_status);
   55         -
        let payload = "";
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          78  +
        let payload =
          79  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   56     82   
        let content_length = payload.len();
   57     83   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   58     84   
            builder,
   59     85   
            ::http::header::CONTENT_LENGTH,
   60     86   
            content_length,
   61     87   
        );
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   62     89   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   63     91   
        builder.body(body)?
          92  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   64     93   
    })
          94  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   65     95   
}
   66     96   
          97  +
/* RustType.kt:516 */
   67     98   
#[allow(clippy::unnecessary_wraps)]
          99  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   68    100   
pub fn ser_malformed_timestamp_query_default_http_error(
   69    101   
    error: &crate::error::MalformedTimestampQueryDefaultError,
   70    102   
) -> std::result::Result<
   71    103   
    ::aws_smithy_http_server::response::Response,
   72    104   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   73    105   
> {
         106  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   74    107   
    Ok({
         108  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   75    109   
        match error {
         110  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   76    111   
            crate::error::MalformedTimestampQueryDefaultError::ValidationException(output) => {
         112  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   77    113   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         114  +
                /* RustType.kt:516 */
   78    115   
                #[allow(unused_mut)]
         116  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   79    117   
                let mut builder = ::http::Response::builder();
         118  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   80    119   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   81    120   
                    builder,
   82    121   
                    ::http::header::CONTENT_TYPE,
   83    122   
                    "application/json",
   84    123   
                );
         124  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   85    125   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   86    126   
                    builder,
   87    127   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   88    128   
                    "ValidationException",
   89    129   
                );
         130  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   90    131   
                let content_length = payload.len();
   91    132   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   92    133   
                    builder,
   93    134   
                    ::http::header::CONTENT_LENGTH,
   94    135   
                    content_length,
   95    136   
                );
         137  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   96    138   
                builder
   97    139   
                    .status(400)
   98    140   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         141  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
   99    142   
            }
         143  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  100    144   
            crate::error::MalformedTimestampQueryDefaultError::InternalServerError(output) => {
         145  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  101    146   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         147  +
                /* RustType.kt:516 */
  102    148   
                #[allow(unused_mut)]
         149  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  103    150   
                let mut builder = ::http::Response::builder();
         151  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  104    152   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  105    153   
                    builder,
  106    154   
                    ::http::header::CONTENT_TYPE,
  107    155   
                    "application/json",
  108    156   
                );
         157  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  109    158   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  110    159   
                    builder,
  111    160   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  112    161   
                    "InternalServerError",
  113    162   
                );
         163  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  114    164   
                let content_length = payload.len();
  115    165   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  116    166   
                    builder,
  117    167   
                    ::http::header::CONTENT_LENGTH,
  118    168   
                    content_length,
  119    169   
                );
         170  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  120    171   
                builder
  121    172   
                    .status(500)
  122    173   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  123         -
            }
         174  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         175  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  124    176   
        }
         177  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  125    178   
    })
         179  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  126    180   
}

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

@@ -1,1 +14,16 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
    2      3   
pub fn de_timestamp(
    3      4   
    value: &str,
    4      5   
) -> std::result::Result<
    5      6   
    ::aws_smithy_http_server_python::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         -
    )?
   12         -
    .into();
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1332 */
          10  +
    let value = ::aws_smithy_types::DateTime::from_str(value, ::aws_smithy_types::date_time::Format::DateTime)?
          11  +
    /* PythonServerProtocolLoader.kt:68 */.into()
          12  +
    /* ServerHttpBoundProtocolGenerator.kt:1343 */;
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   13     14   
    Ok(value)
          15  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   14     16   
}

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

@@ -1,1 +126,180 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_timestamp_query_epoch_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::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:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input =
   18     23   
            crate::input::malformed_timestamp_query_epoch_input_internal::Builder::default();
          24  +
        /* RustType.kt:516 */
   19     25   
        #[allow(unused_variables)]
          26  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   20     27   
        let ::aws_smithy_runtime_api::http::RequestParts {
   21     28   
            uri, headers, body, ..
   22     29   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          30  +
        /* ServerHttpBoundProtocolGenerator.kt:1073 */
   23     31   
        let query_string = uri.query().unwrap_or("");
   24     32   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          33  +
        /* ServerHttpBoundProtocolGenerator.kt:1099 */
   25     34   
        let mut timestamp_seen = false;
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:1105 */
   26     36   
        for (k, v) in pairs {
          37  +
            /* ServerHttpBoundProtocolGenerator.kt:1109 */
   27     38   
            if !timestamp_seen && k == "timestamp" {
   28     39   
                input = input.set_timestamp(
   29     40   
                    crate::protocol_serde::shape_malformed_timestamp_query_epoch_input::de_timestamp(&v)?
   30     41   
                );
   31     42   
                timestamp_seen = true;
   32     43   
            }
          44  +
            /* ServerHttpBoundProtocolGenerator.kt:1105 */
   33     45   
        }
          46  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   34     47   
        input.build()?
          48  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   35     49   
    })
          50  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   36     51   
}
   37     52   
          53  +
/* RustType.kt:516 */
   38     54   
#[allow(clippy::unnecessary_wraps)]
          55  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   39     56   
pub fn ser_malformed_timestamp_query_epoch_http_response(
   40     57   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampQueryEpochOutput,
   41     58   
) -> std::result::Result<
   42     59   
    ::aws_smithy_http_server::response::Response,
   43     60   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   44     61   
> {
          62  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   45     63   
    Ok({
          64  +
        /* RustType.kt:516 */
   46     65   
        #[allow(unused_mut)]
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   47     67   
        let mut builder = ::http::Response::builder();
          68  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   48     69   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   49     70   
            builder,
   50     71   
            ::http::header::CONTENT_TYPE,
   51     72   
            "application/json",
   52     73   
        );
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   53     75   
        let http_status: u16 = 200;
   54     76   
        builder = builder.status(http_status);
   55         -
        let payload = "";
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          78  +
        let payload =
          79  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   56     82   
        let content_length = payload.len();
   57     83   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   58     84   
            builder,
   59     85   
            ::http::header::CONTENT_LENGTH,
   60     86   
            content_length,
   61     87   
        );
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   62     89   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   63     91   
        builder.body(body)?
          92  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   64     93   
    })
          94  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   65     95   
}
   66     96   
          97  +
/* RustType.kt:516 */
   67     98   
#[allow(clippy::unnecessary_wraps)]
          99  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   68    100   
pub fn ser_malformed_timestamp_query_epoch_http_error(
   69    101   
    error: &crate::error::MalformedTimestampQueryEpochError,
   70    102   
) -> std::result::Result<
   71    103   
    ::aws_smithy_http_server::response::Response,
   72    104   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   73    105   
> {
         106  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   74    107   
    Ok({
         108  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   75    109   
        match error {
         110  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   76    111   
            crate::error::MalformedTimestampQueryEpochError::ValidationException(output) => {
         112  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   77    113   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         114  +
                /* RustType.kt:516 */
   78    115   
                #[allow(unused_mut)]
         116  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   79    117   
                let mut builder = ::http::Response::builder();
         118  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   80    119   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   81    120   
                    builder,
   82    121   
                    ::http::header::CONTENT_TYPE,
   83    122   
                    "application/json",
   84    123   
                );
         124  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   85    125   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   86    126   
                    builder,
   87    127   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   88    128   
                    "ValidationException",
   89    129   
                );
         130  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   90    131   
                let content_length = payload.len();
   91    132   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   92    133   
                    builder,
   93    134   
                    ::http::header::CONTENT_LENGTH,
   94    135   
                    content_length,
   95    136   
                );
         137  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   96    138   
                builder
   97    139   
                    .status(400)
   98    140   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         141  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
   99    142   
            }
         143  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  100    144   
            crate::error::MalformedTimestampQueryEpochError::InternalServerError(output) => {
         145  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  101    146   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         147  +
                /* RustType.kt:516 */
  102    148   
                #[allow(unused_mut)]
         149  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  103    150   
                let mut builder = ::http::Response::builder();
         151  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  104    152   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  105    153   
                    builder,
  106    154   
                    ::http::header::CONTENT_TYPE,
  107    155   
                    "application/json",
  108    156   
                );
         157  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  109    158   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  110    159   
                    builder,
  111    160   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  112    161   
                    "InternalServerError",
  113    162   
                );
         163  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  114    164   
                let content_length = payload.len();
  115    165   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  116    166   
                    builder,
  117    167   
                    ::http::header::CONTENT_LENGTH,
  118    168   
                    content_length,
  119    169   
                );
         170  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  120    171   
                builder
  121    172   
                    .status(500)
  122    173   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  123         -
            }
         174  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         175  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  124    176   
        }
         177  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  125    178   
    })
         179  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  126    180   
}

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/src/protocol_serde/shape_malformed_timestamp_query_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:1292 */
    2      3   
pub fn de_timestamp(
    3      4   
    value: &str,
    4      5   
) -> std::result::Result<
    5      6   
    ::aws_smithy_http_server_python::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         -
    )?
   12         -
    .into();
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1332 */
          10  +
    let value = ::aws_smithy_types::DateTime::from_str(value, ::aws_smithy_types::date_time::Format::EpochSeconds)?
          11  +
    /* PythonServerProtocolLoader.kt:68 */.into()
          12  +
    /* ServerHttpBoundProtocolGenerator.kt:1343 */;
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   13     14   
    Ok(value)
          15  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   14     16   
}

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

@@ -1,1 +126,180 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_timestamp_query_http_date_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::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:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input =
   18     23   
            crate::input::malformed_timestamp_query_http_date_input_internal::Builder::default();
          24  +
        /* RustType.kt:516 */
   19     25   
        #[allow(unused_variables)]
          26  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   20     27   
        let ::aws_smithy_runtime_api::http::RequestParts {
   21     28   
            uri, headers, body, ..
   22     29   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          30  +
        /* ServerHttpBoundProtocolGenerator.kt:1073 */
   23     31   
        let query_string = uri.query().unwrap_or("");
   24     32   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          33  +
        /* ServerHttpBoundProtocolGenerator.kt:1099 */
   25     34   
        let mut timestamp_seen = false;
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:1105 */
   26     36   
        for (k, v) in pairs {
          37  +
            /* ServerHttpBoundProtocolGenerator.kt:1109 */
   27     38   
            if !timestamp_seen && k == "timestamp" {
   28     39   
                input = input.set_timestamp(
   29     40   
                    crate::protocol_serde::shape_malformed_timestamp_query_http_date_input::de_timestamp(&v)?
   30     41   
                );
   31     42   
                timestamp_seen = true;
   32     43   
            }
          44  +
            /* ServerHttpBoundProtocolGenerator.kt:1105 */
   33     45   
        }
          46  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   34     47   
        input.build()?
          48  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   35     49   
    })
          50  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   36     51   
}
   37     52   
          53  +
/* RustType.kt:516 */
   38     54   
#[allow(clippy::unnecessary_wraps)]
          55  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   39     56   
pub fn ser_malformed_timestamp_query_http_date_http_response(
   40     57   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampQueryHttpDateOutput,
   41     58   
) -> std::result::Result<
   42     59   
    ::aws_smithy_http_server::response::Response,
   43     60   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   44     61   
> {
          62  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   45     63   
    Ok({
          64  +
        /* RustType.kt:516 */
   46     65   
        #[allow(unused_mut)]
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   47     67   
        let mut builder = ::http::Response::builder();
          68  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   48     69   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   49     70   
            builder,
   50     71   
            ::http::header::CONTENT_TYPE,
   51     72   
            "application/json",
   52     73   
        );
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   53     75   
        let http_status: u16 = 200;
   54     76   
        builder = builder.status(http_status);
   55         -
        let payload = "";
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          78  +
        let payload =
          79  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   56     82   
        let content_length = payload.len();
   57     83   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   58     84   
            builder,
   59     85   
            ::http::header::CONTENT_LENGTH,
   60     86   
            content_length,
   61     87   
        );
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   62     89   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   63     91   
        builder.body(body)?
          92  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   64     93   
    })
          94  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   65     95   
}
   66     96   
          97  +
/* RustType.kt:516 */
   67     98   
#[allow(clippy::unnecessary_wraps)]
          99  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   68    100   
pub fn ser_malformed_timestamp_query_http_date_http_error(
   69    101   
    error: &crate::error::MalformedTimestampQueryHttpDateError,
   70    102   
) -> std::result::Result<
   71    103   
    ::aws_smithy_http_server::response::Response,
   72    104   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   73    105   
> {
         106  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   74    107   
    Ok({
         108  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   75    109   
        match error {
         110  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   76    111   
            crate::error::MalformedTimestampQueryHttpDateError::ValidationException(output) => {
         112  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   77    113   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         114  +
                /* RustType.kt:516 */
   78    115   
                #[allow(unused_mut)]
         116  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   79    117   
                let mut builder = ::http::Response::builder();
         118  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   80    119   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   81    120   
                    builder,
   82    121   
                    ::http::header::CONTENT_TYPE,
   83    122   
                    "application/json",
   84    123   
                );
         124  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   85    125   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   86    126   
                    builder,
   87    127   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   88    128   
                    "ValidationException",
   89    129   
                );
         130  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   90    131   
                let content_length = payload.len();
   91    132   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   92    133   
                    builder,
   93    134   
                    ::http::header::CONTENT_LENGTH,
   94    135   
                    content_length,
   95    136   
                );
         137  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   96    138   
                builder
   97    139   
                    .status(400)
   98    140   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         141  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
   99    142   
            }
         143  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  100    144   
            crate::error::MalformedTimestampQueryHttpDateError::InternalServerError(output) => {
         145  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  101    146   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         147  +
                /* RustType.kt:516 */
  102    148   
                #[allow(unused_mut)]
         149  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  103    150   
                let mut builder = ::http::Response::builder();
         151  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  104    152   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  105    153   
                    builder,
  106    154   
                    ::http::header::CONTENT_TYPE,
  107    155   
                    "application/json",
  108    156   
                );
         157  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  109    158   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  110    159   
                    builder,
  111    160   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  112    161   
                    "InternalServerError",
  113    162   
                );
         163  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  114    164   
                let content_length = payload.len();
  115    165   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  116    166   
                    builder,
  117    167   
                    ::http::header::CONTENT_LENGTH,
  118    168   
                    content_length,
  119    169   
                );
         170  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  120    171   
                builder
  121    172   
                    .status(500)
  122    173   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  123         -
            }
         174  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         175  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  124    176   
        }
         177  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  125    178   
    })
         179  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  126    180   
}

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/src/protocol_serde/shape_malformed_timestamp_query_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:1292 */
    2      3   
pub fn de_timestamp(
    3      4   
    value: &str,
    4      5   
) -> std::result::Result<
    5      6   
    ::aws_smithy_http_server_python::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         -
    )?
   12         -
    .into();
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1332 */
          10  +
    let value = ::aws_smithy_types::DateTime::from_str(value, ::aws_smithy_types::date_time::Format::HttpDate)?
          11  +
    /* PythonServerProtocolLoader.kt:68 */.into()
          12  +
    /* ServerHttpBoundProtocolGenerator.kt:1343 */;
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   13     14   
    Ok(value)
          15  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   14     16   
}

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

@@ -1,1 +146,208 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_union_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::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:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::malformed_union_input_internal::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   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:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_malformed_union::de_malformed_union(
   29     39   
                bytes.as_ref(),
   30     40   
                input,
   31     41   
            )?;
          42  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   32     43   
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   33     45   
        input.build()
          46  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   34     47   
    })
          48  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   35     49   
}
   36     50   
          51  +
/* RustType.kt:516 */
   37     52   
#[allow(clippy::unnecessary_wraps)]
          53  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   38     54   
pub fn ser_malformed_union_http_response(
   39     55   
    #[allow(unused_variables)] output: crate::output::MalformedUnionOutput,
   40     56   
) -> std::result::Result<
   41     57   
    ::aws_smithy_http_server::response::Response,
   42     58   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   43     59   
> {
          60  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   44     61   
    Ok({
          62  +
        /* RustType.kt:516 */
   45     63   
        #[allow(unused_mut)]
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   46     65   
        let mut builder = ::http::Response::builder();
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   47     67   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   48     68   
            builder,
   49     69   
            ::http::header::CONTENT_TYPE,
   50     70   
            "application/json",
   51     71   
        );
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   52     73   
        let http_status: u16 = 200;
   53     74   
        builder = builder.status(http_status);
   54         -
        let payload = "";
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          76  +
        let payload =
          77  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   55     80   
        let content_length = payload.len();
   56     81   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     82   
            builder,
   58     83   
            ::http::header::CONTENT_LENGTH,
   59     84   
            content_length,
   60     85   
        );
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   61     87   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   62     89   
        builder.body(body)?
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   63     91   
    })
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   64     93   
}
   65     94   
          95  +
/* RustType.kt:516 */
   66     96   
#[allow(clippy::unnecessary_wraps)]
          97  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   67     98   
pub fn ser_malformed_union_http_error(
   68     99   
    error: &crate::error::MalformedUnionError,
   69    100   
) -> std::result::Result<
   70    101   
    ::aws_smithy_http_server::response::Response,
   71    102   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   72    103   
> {
         104  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   73    105   
    Ok({
         106  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   74    107   
        match error {
         108  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   75    109   
            crate::error::MalformedUnionError::InternalServerError(output) => {
         110  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   76    111   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         112  +
                /* RustType.kt:516 */
   77    113   
                #[allow(unused_mut)]
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   78    115   
                let mut builder = ::http::Response::builder();
         116  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   79    117   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   80    118   
                    builder,
   81    119   
                    ::http::header::CONTENT_TYPE,
   82    120   
                    "application/json",
   83    121   
                );
         122  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   84    123   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   85    124   
                    builder,
   86    125   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   87    126   
                    "InternalServerError",
   88    127   
                );
         128  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   89    129   
                let content_length = payload.len();
   90    130   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   91    131   
                    builder,
   92    132   
                    ::http::header::CONTENT_LENGTH,
   93    133   
                    content_length,
   94    134   
                );
         135  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   95    136   
                builder
   96    137   
                    .status(500)
   97    138   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
   98         -
            }
         139  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         140  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   99    141   
        }
         142  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  100    143   
    })
         144  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  101    145   
}
  102    146   
         147  +
/* JsonParserGenerator.kt:148 */
  103    148   
pub(crate) fn de_malformed_union(
  104    149   
    value: &[u8],
  105    150   
    mut builder: crate::input::malformed_union_input_internal::Builder,
  106    151   
) -> ::std::result::Result<
  107    152   
    crate::input::malformed_union_input_internal::Builder,
  108    153   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  109    154   
> {
         155  +
    /* JsonParserGenerator.kt:153 */
  110    156   
    let mut tokens_owned =
  111    157   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  112    158   
            .peekable();
  113    159   
    let tokens = &mut tokens_owned;
  114    160   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         161  +
    /* JsonParserGenerator.kt:684 */
  115    162   
    loop {
         163  +
        /* JsonParserGenerator.kt:685 */
  116    164   
        match tokens.next().transpose()? {
         165  +
            /* JsonParserGenerator.kt:686 */
  117    166   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  118    167   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         168  +
                /* JsonParserGenerator.kt:260 */
  119    169   
                match key.to_unescaped()?.as_ref() {
         170  +
                    /* JsonParserGenerator.kt:262 */
  120    171   
                    "union" => {
         172  +
                        /* JsonParserGenerator.kt:272 */
  121    173   
                        builder = builder.set_union(
  122         -
                            crate::protocol_serde::shape_simple_union::de_simple_union(tokens)?,
  123         -
                        );
         174  +
                            /* JsonParserGenerator.kt:660 */crate::protocol_serde::shape_simple_union::de_simple_union(tokens)?
         175  +
                        /* JsonParserGenerator.kt:272 */);
         176  +
                        /* JsonParserGenerator.kt:262 */
  124    177   
                    }
  125         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         178  +
                    /* JsonParserGenerator.kt:290 */
         179  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  126    180   
                }
         181  +
                /* JsonParserGenerator.kt:686 */
  127    182   
            }
         183  +
            /* JsonParserGenerator.kt:695 */
  128    184   
            other => {
  129    185   
                return Err(
  130    186   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  131    187   
                        "expected object key or end object, found: {:?}",
  132    188   
                        other
  133    189   
                    )),
  134    190   
                )
  135         -
            }
         191  +
            } /* JsonParserGenerator.kt:685 */
  136    192   
        }
         193  +
        /* JsonParserGenerator.kt:684 */
  137    194   
    }
         195  +
    /* JsonParserGenerator.kt:250 */
  138    196   
    if tokens.next().is_some() {
         197  +
        /* JsonParserGenerator.kt:251 */
  139    198   
        return Err(
  140    199   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  141    200   
                "found more JSON tokens after completing parsing",
  142    201   
            ),
  143    202   
        );
         203  +
        /* JsonParserGenerator.kt:250 */
  144    204   
    }
         205  +
    /* JsonParserGenerator.kt:163 */
  145    206   
    Ok(builder)
         207  +
    /* JsonParserGenerator.kt:148 */
  146    208   
}

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

@@ -1,1 +124,173 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_media_type_header_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::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:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::media_type_header_input_internal::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   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:794 */
   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:834 */
   27     36   
        input.build()
          37  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   28     38   
    })
          39  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   29     40   
}
   30     41   
          42  +
/* RustType.kt:516 */
   31     43   
#[allow(clippy::unnecessary_wraps)]
          44  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   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:433 */
   38     52   
    Ok({
          53  +
        /* RustType.kt:516 */
   39     54   
        #[allow(unused_mut)]
          55  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   40     56   
        let mut builder = ::http::Response::builder();
          57  +
        /* ServerHttpBoundProtocolGenerator.kt:629 */
   41     58   
        builder = crate::protocol_serde::shape_media_type_header::ser_media_type_header_headers(
   42     59   
            &output, builder,
   43     60   
        )?;
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   44     62   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   45     63   
            builder,
   46     64   
            ::http::header::CONTENT_TYPE,
   47     65   
            "application/json",
   48     66   
        );
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   49     68   
        let http_status: u16 = 200;
   50     69   
        builder = builder.status(http_status);
          70  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   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:237 */crate::protocol_serde::shape_media_type_header_output::ser_media_type_header_output_output_output(&output)?
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   54     75   
        let content_length = payload.len();
   55     76   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   56     77   
            builder,
   57     78   
            ::http::header::CONTENT_LENGTH,
   58     79   
            content_length,
   59     80   
        );
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   60     82   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   61     84   
        builder.body(body)?
          85  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   62     86   
    })
          87  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   63     88   
}
   64     89   
          90  +
/* RustType.kt:516 */
   65     91   
#[allow(clippy::unnecessary_wraps)]
          92  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   66     93   
pub fn ser_media_type_header_http_error(
   67     94   
    error: &crate::error::MediaTypeHeaderError,
   68     95   
) -> std::result::Result<
   69     96   
    ::aws_smithy_http_server::response::Response,
   70     97   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   71     98   
> {
          99  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   72    100   
    Ok({
         101  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   73    102   
        match error {
         103  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   74    104   
            crate::error::MediaTypeHeaderError::InternalServerError(output) => {
         105  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   75    106   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         107  +
                /* RustType.kt:516 */
   76    108   
                #[allow(unused_mut)]
         109  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   77    110   
                let mut builder = ::http::Response::builder();
         111  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   78    112   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   79    113   
                    builder,
   80    114   
                    ::http::header::CONTENT_TYPE,
   81    115   
                    "application/json",
   82    116   
                );
         117  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   83    118   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   84    119   
                    builder,
   85    120   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   86    121   
                    "InternalServerError",
   87    122   
                );
         123  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   88    124   
                let content_length = payload.len();
   89    125   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   90    126   
                    builder,
   91    127   
                    ::http::header::CONTENT_LENGTH,
   92    128   
                    content_length,
   93    129   
                );
         130  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   94    131   
                builder
   95    132   
                    .status(500)
   96    133   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
   97         -
            }
         134  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         135  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   98    136   
        }
         137  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   99    138   
    })
         139  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  100    140   
}
  101    141   
         142  +
/* HttpBindingGenerator.kt:542 */
  102    143   
pub fn ser_media_type_header_headers(
  103    144   
    input: &crate::output::MediaTypeHeaderOutput,
  104    145   
    mut builder: ::http::response::Builder,
  105    146   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
  106    147   
{
         148  +
    /* HttpBindingGenerator.kt:592 */
  107    149   
    if let ::std::option::Option::Some(inner_1) = &input.json {
         150  +
        /* HttpBindingGenerator.kt:704 */
  108    151   
        let formatted_2 = ::aws_smithy_types::base64::encode(inner_1);
         152  +
        /* HttpBindingGenerator.kt:705 */
  109    153   
        if !formatted_2.is_empty() {
         154  +
            /* HttpBindingGenerator.kt:706 */
  110    155   
            let header_value = formatted_2;
  111    156   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  112    157   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  113    158   
                    "json",
  114    159   
                    format!(
  115    160   
                        "`{}` cannot be used as a header value: {}",
  116    161   
                        &header_value, err
  117    162   
                    ),
  118    163   
                )
  119    164   
            })?;
  120    165   
            builder = builder.header("X-Json", header_value);
         166  +
            /* HttpBindingGenerator.kt:705 */
  121    167   
        }
         168  +
        /* HttpBindingGenerator.kt:592 */
  122    169   
    }
         170  +
    /* HttpBindingGenerator.kt:555 */
  123    171   
    Ok(builder)
         172  +
    /* HttpBindingGenerator.kt:542 */
  124    173   
}

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/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:153 */
    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:160 */
    8     10   
    let headers = header_map.get_all("X-Json");
          11  +
    /* HttpBindingGenerator.kt:409 */
    9     12   
    let var_1: Vec<::std::string::String> = ::aws_smithy_http::header::read_many_from_str(headers)?;
          13  +
    /* HttpBindingGenerator.kt:414 */
   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:425 */
   24     29   
    let var_1 = var_1?;
          30  +
    /* HttpBindingGenerator.kt:468 */
   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:153 */
   34     41   
}

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/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-python/rest_json/rust-server-codegen-python/src/protocol_serde/shape_my_union.rs

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

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/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:516 */
   58     76   
            #[allow(unused_mut)]
          77  +
            /* JsonParserGenerator.kt:526 */
   59     78   
            let mut builder = crate::model::nested_payload_internal::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   
}

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

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

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

@@ -1,1 +91,132 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_no_input_and_no_output_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::NoInputAndNoOutputInput,
    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:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::no_input_and_no_output_input_internal::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   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:811 */
   22     30   
        ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(&headers, None)?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   23     32   
        input.build()
          33  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   24     34   
    })
          35  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   25     36   
}
   26     37   
          38  +
/* RustType.kt:516 */
   27     39   
#[allow(clippy::unnecessary_wraps)]
          40  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   28     41   
pub fn ser_no_input_and_no_output_http_response(
   29     42   
    #[allow(unused_variables)] output: crate::output::NoInputAndNoOutputOutput,
   30     43   
) -> std::result::Result<
   31     44   
    ::aws_smithy_http_server::response::Response,
   32     45   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   33     46   
> {
          47  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   34     48   
    Ok({
          49  +
        /* RustType.kt:516 */
   35     50   
        #[allow(unused_mut)]
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   36     52   
        let mut builder = ::http::Response::builder();
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   37     54   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   38     55   
            builder,
   39     56   
            ::http::header::CONTENT_TYPE,
   40     57   
            "application/json",
   41     58   
        );
          59  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   42     60   
        let http_status: u16 = 200;
   43     61   
        builder = builder.status(http_status);
   44         -
        let payload = "";
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          63  +
        let payload =
          64  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   45     67   
        let content_length = payload.len();
   46     68   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   47     69   
            builder,
   48     70   
            ::http::header::CONTENT_LENGTH,
   49     71   
            content_length,
   50     72   
        );
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   51     74   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   52     76   
        builder.body(body)?
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   53     78   
    })
          79  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   54     80   
}
   55     81   
          82  +
/* RustType.kt:516 */
   56     83   
#[allow(clippy::unnecessary_wraps)]
          84  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   57     85   
pub fn ser_no_input_and_no_output_http_error(
   58     86   
    error: &crate::error::NoInputAndNoOutputError,
   59     87   
) -> std::result::Result<
   60     88   
    ::aws_smithy_http_server::response::Response,
   61     89   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   62     90   
> {
          91  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   63     92   
    Ok({
          93  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   64     94   
        match error {
          95  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   65     96   
            crate::error::NoInputAndNoOutputError::InternalServerError(output) => {
          97  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   66     98   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
          99  +
                /* RustType.kt:516 */
   67    100   
                #[allow(unused_mut)]
         101  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   68    102   
                let mut builder = ::http::Response::builder();
         103  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   69    104   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   70    105   
                    builder,
   71    106   
                    ::http::header::CONTENT_TYPE,
   72    107   
                    "application/json",
   73    108   
                );
         109  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   74    110   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   75    111   
                    builder,
   76    112   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   77    113   
                    "InternalServerError",
   78    114   
                );
         115  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   79    116   
                let content_length = payload.len();
   80    117   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   81    118   
                    builder,
   82    119   
                    ::http::header::CONTENT_LENGTH,
   83    120   
                    content_length,
   84    121   
                );
         122  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   85    123   
                builder
   86    124   
                    .status(500)
   87    125   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
   88         -
            }
         126  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         127  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   89    128   
        }
         129  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   90    130   
    })
         131  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
   91    132   
}