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_short_input.rs

@@ -1,1 +36,49 @@
    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_short_in_header_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<::std::option::Option<i16>, ::aws_smithy_http::header::ParseError> {
           6  +
    /* HttpBindingGenerator.kt:160 */
    5      7   
    let headers = header_map.get_all("shortInHeader");
           8  +
    /* HttpBindingGenerator.kt:404 */
    6      9   
    let var_1 = ::aws_smithy_http::header::read_many_primitive::<i16>(headers)?;
          10  +
    /* HttpBindingGenerator.kt:468 */
    7     11   
    if var_1.len() > 1 {
    8     12   
        Err(::aws_smithy_http::header::ParseError::new(format!(
    9     13   
            "expected one item but found {}",
   10     14   
            var_1.len()
   11     15   
        )))
   12     16   
    } else {
   13     17   
        let mut var_1 = var_1;
   14     18   
        Ok(var_1.pop())
   15     19   
    }
          20  +
    /* HttpBindingGenerator.kt:153 */
   16     21   
}
   17     22   
          23  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
   18     24   
pub fn de_short_in_path(
   19     25   
    value: &str,
   20     26   
) -> std::result::Result<
   21     27   
    i16,
   22     28   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
   23     29   
> {
          30  +
    /* ServerHttpBoundProtocolGenerator.kt:1347 */
   24     31   
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
          32  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   25     33   
    Ok(value)
          34  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   26     35   
}
   27     36   
          37  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
   28     38   
pub fn de_short_in_query(
   29     39   
    value: &str,
   30     40   
) -> std::result::Result<
   31     41   
    ::std::option::Option<i16>,
   32     42   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
   33     43   
> {
          44  +
    /* ServerHttpBoundProtocolGenerator.kt:1347 */
   34     45   
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
          46  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   35     47   
    Ok(Some(value))
          48  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   36     49   
}

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

@@ -1,1 +95,136 @@
    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_string_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedStringInput,
    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_string_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_malformed_string_input::de_blob_header(&headers)?
   24     32   
        {
   25     33   
            input = input.set_blob(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_malformed_string_http_response(
   33     46   
    #[allow(unused_variables)] output: crate::output::MalformedStringOutput,
   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:597 */
   41     58   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   42     59   
            builder,
   43     60   
            ::http::header::CONTENT_TYPE,
   44     61   
            "application/json",
   45     62   
        );
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   46     64   
        let http_status: u16 = 200;
   47     65   
        builder = builder.status(http_status);
   48         -
        let payload = "";
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          67  +
        let payload =
          68  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          70  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   49     71   
        let content_length = payload.len();
   50     72   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   51     73   
            builder,
   52     74   
            ::http::header::CONTENT_LENGTH,
   53     75   
            content_length,
   54     76   
        );
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   55     78   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   56     80   
        builder.body(body)?
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   57     82   
    })
          83  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   58     84   
}
   59     85   
          86  +
/* RustType.kt:516 */
   60     87   
#[allow(clippy::unnecessary_wraps)]
          88  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   61     89   
pub fn ser_malformed_string_http_error(
   62     90   
    error: &crate::error::MalformedStringError,
   63     91   
) -> std::result::Result<
   64     92   
    ::aws_smithy_http_server::response::Response,
   65     93   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   66     94   
> {
          95  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   67     96   
    Ok({
          97  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   68     98   
        match error {
          99  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   69    100   
            crate::error::MalformedStringError::InternalServerError(output) => {
         101  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   70    102   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         103  +
                /* RustType.kt:516 */
   71    104   
                #[allow(unused_mut)]
         105  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   72    106   
                let mut builder = ::http::Response::builder();
         107  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   73    108   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   74    109   
                    builder,
   75    110   
                    ::http::header::CONTENT_TYPE,
   76    111   
                    "application/json",
   77    112   
                );
         113  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   78    114   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   79    115   
                    builder,
   80    116   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   81    117   
                    "InternalServerError",
   82    118   
                );
         119  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   83    120   
                let content_length = payload.len();
   84    121   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   85    122   
                    builder,
   86    123   
                    ::http::header::CONTENT_LENGTH,
   87    124   
                    content_length,
   88    125   
                );
         126  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   89    127   
                builder
   90    128   
                    .status(500)
   91    129   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
   92         -
            }
         130  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         131  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   93    132   
        }
         133  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   94    134   
    })
         135  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
   95    136   
}

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/src/protocol_serde/shape_malformed_string_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_blob_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("amz-media-typed-header");
          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_malformed_timestamp_body_date_time.rs

@@ -1,1 +174,248 @@
    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_body_date_time_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedTimestampBodyDateTimeInput,
    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_body_date_time_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:745 */
   23     31   
        let bytes = ::hyper::body::to_bytes(body).await?;
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   24     33   
        if !bytes.is_empty() {
          34  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   25     35   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   26     36   
                &headers,
   27     37   
                Some("application/json"),
   28     38   
            )?;
   29     39   
            input = crate::protocol_serde::shape_malformed_timestamp_body_date_time::de_malformed_timestamp_body_date_time(bytes.as_ref(), input)?;
          40  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   30     41   
        }
          42  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   31     43   
        input.build()?
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   32     45   
    })
          46  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   33     47   
}
   34     48   
          49  +
/* RustType.kt:516 */
   35     50   
#[allow(clippy::unnecessary_wraps)]
          51  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   36     52   
pub fn ser_malformed_timestamp_body_date_time_http_response(
   37     53   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampBodyDateTimeOutput,
   38     54   
) -> std::result::Result<
   39     55   
    ::aws_smithy_http_server::response::Response,
   40     56   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   41     57   
> {
          58  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   42     59   
    Ok({
          60  +
        /* RustType.kt:516 */
   43     61   
        #[allow(unused_mut)]
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   44     63   
        let mut builder = ::http::Response::builder();
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   45     65   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   46     66   
            builder,
   47     67   
            ::http::header::CONTENT_TYPE,
   48     68   
            "application/json",
   49     69   
        );
          70  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   50     71   
        let http_status: u16 = 200;
   51     72   
        builder = builder.status(http_status);
   52         -
        let payload = "";
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          74  +
        let payload =
          75  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   53     78   
        let content_length = payload.len();
   54     79   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   55     80   
            builder,
   56     81   
            ::http::header::CONTENT_LENGTH,
   57     82   
            content_length,
   58     83   
        );
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   59     85   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   60     87   
        builder.body(body)?
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   61     89   
    })
          90  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   62     91   
}
   63     92   
          93  +
/* RustType.kt:516 */
   64     94   
#[allow(clippy::unnecessary_wraps)]
          95  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   65     96   
pub fn ser_malformed_timestamp_body_date_time_http_error(
   66     97   
    error: &crate::error::MalformedTimestampBodyDateTimeError,
   67     98   
) -> std::result::Result<
   68     99   
    ::aws_smithy_http_server::response::Response,
   69    100   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   70    101   
> {
         102  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   71    103   
    Ok({
         104  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   72    105   
        match error {
         106  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   73    107   
            crate::error::MalformedTimestampBodyDateTimeError::ValidationException(output) => {
         108  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   74    109   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         110  +
                /* RustType.kt:516 */
   75    111   
                #[allow(unused_mut)]
         112  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   76    113   
                let mut builder = ::http::Response::builder();
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   77    115   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   78    116   
                    builder,
   79    117   
                    ::http::header::CONTENT_TYPE,
   80    118   
                    "application/json",
   81    119   
                );
         120  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   82    121   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   83    122   
                    builder,
   84    123   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   85    124   
                    "ValidationException",
   86    125   
                );
         126  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   87    127   
                let content_length = payload.len();
   88    128   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   89    129   
                    builder,
   90    130   
                    ::http::header::CONTENT_LENGTH,
   91    131   
                    content_length,
   92    132   
                );
         133  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   93    134   
                builder
   94    135   
                    .status(400)
   95    136   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         137  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
   96    138   
            }
         139  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   97    140   
            crate::error::MalformedTimestampBodyDateTimeError::InternalServerError(output) => {
         141  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   98    142   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         143  +
                /* RustType.kt:516 */
   99    144   
                #[allow(unused_mut)]
         145  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  100    146   
                let mut builder = ::http::Response::builder();
         147  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  101    148   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  102    149   
                    builder,
  103    150   
                    ::http::header::CONTENT_TYPE,
  104    151   
                    "application/json",
  105    152   
                );
         153  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  106    154   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  107    155   
                    builder,
  108    156   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  109    157   
                    "InternalServerError",
  110    158   
                );
         159  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  111    160   
                let content_length = payload.len();
  112    161   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  113    162   
                    builder,
  114    163   
                    ::http::header::CONTENT_LENGTH,
  115    164   
                    content_length,
  116    165   
                );
         166  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  117    167   
                builder
  118    168   
                    .status(500)
  119    169   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  120         -
            }
         170  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         171  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  121    172   
        }
         173  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  122    174   
    })
         175  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  123    176   
}
  124    177   
         178  +
/* JsonParserGenerator.kt:148 */
  125    179   
pub(crate) fn de_malformed_timestamp_body_date_time(
  126    180   
    value: &[u8],
  127    181   
    mut builder: crate::input::malformed_timestamp_body_date_time_input_internal::Builder,
  128    182   
) -> ::std::result::Result<
  129    183   
    crate::input::malformed_timestamp_body_date_time_input_internal::Builder,
  130    184   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  131    185   
> {
         186  +
    /* JsonParserGenerator.kt:153 */
  132    187   
    let mut tokens_owned =
  133    188   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  134    189   
            .peekable();
  135    190   
    let tokens = &mut tokens_owned;
  136    191   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         192  +
    /* JsonParserGenerator.kt:684 */
  137    193   
    loop {
         194  +
        /* JsonParserGenerator.kt:685 */
  138    195   
        match tokens.next().transpose()? {
         196  +
            /* JsonParserGenerator.kt:686 */
  139    197   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  140    198   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         199  +
                /* JsonParserGenerator.kt:260 */
  141    200   
                match key.to_unescaped()?.as_ref() {
         201  +
                    /* JsonParserGenerator.kt:262 */
  142    202   
                    "timestamp" => {
         203  +
                        /* JsonParserGenerator.kt:276 */
  143    204   
                        if let Some(v) =
         205  +
                            /* JsonParserGenerator.kt:384 */
  144    206   
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
  145         -
                                tokens.next(),
  146         -
                                ::aws_smithy_types::date_time::Format::DateTime,
  147         -
                            )?
  148         -
                            .map(::aws_smithy_http_server_python::types::DateTime::from)
         207  +
                                    tokens.next(),
         208  +
                                    ::aws_smithy_types::date_time::Format::DateTime,
         209  +
                                )?
         210  +
                                /* PythonServerProtocolLoader.kt:44 */
         211  +
                                .map(::aws_smithy_http_server_python::types::DateTime::from)
         212  +
                        /* JsonParserGenerator.kt:278 */
  149    213   
                        {
  150    214   
                            builder = builder.set_timestamp(v);
  151    215   
                        }
         216  +
                        /* JsonParserGenerator.kt:262 */
  152    217   
                    }
  153         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         218  +
                    /* JsonParserGenerator.kt:290 */
         219  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  154    220   
                }
         221  +
                /* JsonParserGenerator.kt:686 */
  155    222   
            }
         223  +
            /* JsonParserGenerator.kt:695 */
  156    224   
            other => {
  157    225   
                return Err(
  158    226   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  159    227   
                        "expected object key or end object, found: {:?}",
  160    228   
                        other
  161    229   
                    )),
  162    230   
                )
  163         -
            }
         231  +
            } /* JsonParserGenerator.kt:685 */
  164    232   
        }
         233  +
        /* JsonParserGenerator.kt:684 */
  165    234   
    }
         235  +
    /* JsonParserGenerator.kt:250 */
  166    236   
    if tokens.next().is_some() {
         237  +
        /* JsonParserGenerator.kt:251 */
  167    238   
        return Err(
  168    239   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  169    240   
                "found more JSON tokens after completing parsing",
  170    241   
            ),
  171    242   
        );
         243  +
        /* JsonParserGenerator.kt:250 */
  172    244   
    }
         245  +
    /* JsonParserGenerator.kt:163 */
  173    246   
    Ok(builder)
         247  +
    /* JsonParserGenerator.kt:148 */
  174    248   
}

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

@@ -1,1 +174,248 @@
    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_body_default_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedTimestampBodyDefaultInput,
    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_body_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:745 */
   23     31   
        let bytes = ::hyper::body::to_bytes(body).await?;
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   24     33   
        if !bytes.is_empty() {
          34  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   25     35   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   26     36   
                &headers,
   27     37   
                Some("application/json"),
   28     38   
            )?;
   29     39   
            input = crate::protocol_serde::shape_malformed_timestamp_body_default::de_malformed_timestamp_body_default(bytes.as_ref(), input)?;
          40  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   30     41   
        }
          42  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   31     43   
        input.build()?
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   32     45   
    })
          46  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   33     47   
}
   34     48   
          49  +
/* RustType.kt:516 */
   35     50   
#[allow(clippy::unnecessary_wraps)]
          51  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   36     52   
pub fn ser_malformed_timestamp_body_default_http_response(
   37     53   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampBodyDefaultOutput,
   38     54   
) -> std::result::Result<
   39     55   
    ::aws_smithy_http_server::response::Response,
   40     56   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   41     57   
> {
          58  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   42     59   
    Ok({
          60  +
        /* RustType.kt:516 */
   43     61   
        #[allow(unused_mut)]
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   44     63   
        let mut builder = ::http::Response::builder();
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   45     65   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   46     66   
            builder,
   47     67   
            ::http::header::CONTENT_TYPE,
   48     68   
            "application/json",
   49     69   
        );
          70  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   50     71   
        let http_status: u16 = 200;
   51     72   
        builder = builder.status(http_status);
   52         -
        let payload = "";
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          74  +
        let payload =
          75  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   53     78   
        let content_length = payload.len();
   54     79   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   55     80   
            builder,
   56     81   
            ::http::header::CONTENT_LENGTH,
   57     82   
            content_length,
   58     83   
        );
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   59     85   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   60     87   
        builder.body(body)?
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   61     89   
    })
          90  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   62     91   
}
   63     92   
          93  +
/* RustType.kt:516 */
   64     94   
#[allow(clippy::unnecessary_wraps)]
          95  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   65     96   
pub fn ser_malformed_timestamp_body_default_http_error(
   66     97   
    error: &crate::error::MalformedTimestampBodyDefaultError,
   67     98   
) -> std::result::Result<
   68     99   
    ::aws_smithy_http_server::response::Response,
   69    100   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   70    101   
> {
         102  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   71    103   
    Ok({
         104  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   72    105   
        match error {
         106  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   73    107   
            crate::error::MalformedTimestampBodyDefaultError::ValidationException(output) => {
         108  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   74    109   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         110  +
                /* RustType.kt:516 */
   75    111   
                #[allow(unused_mut)]
         112  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   76    113   
                let mut builder = ::http::Response::builder();
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   77    115   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   78    116   
                    builder,
   79    117   
                    ::http::header::CONTENT_TYPE,
   80    118   
                    "application/json",
   81    119   
                );
         120  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   82    121   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   83    122   
                    builder,
   84    123   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   85    124   
                    "ValidationException",
   86    125   
                );
         126  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   87    127   
                let content_length = payload.len();
   88    128   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   89    129   
                    builder,
   90    130   
                    ::http::header::CONTENT_LENGTH,
   91    131   
                    content_length,
   92    132   
                );
         133  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   93    134   
                builder
   94    135   
                    .status(400)
   95    136   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         137  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
   96    138   
            }
         139  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   97    140   
            crate::error::MalformedTimestampBodyDefaultError::InternalServerError(output) => {
         141  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   98    142   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         143  +
                /* RustType.kt:516 */
   99    144   
                #[allow(unused_mut)]
         145  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  100    146   
                let mut builder = ::http::Response::builder();
         147  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  101    148   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  102    149   
                    builder,
  103    150   
                    ::http::header::CONTENT_TYPE,
  104    151   
                    "application/json",
  105    152   
                );
         153  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  106    154   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  107    155   
                    builder,
  108    156   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  109    157   
                    "InternalServerError",
  110    158   
                );
         159  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  111    160   
                let content_length = payload.len();
  112    161   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  113    162   
                    builder,
  114    163   
                    ::http::header::CONTENT_LENGTH,
  115    164   
                    content_length,
  116    165   
                );
         166  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  117    167   
                builder
  118    168   
                    .status(500)
  119    169   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  120         -
            }
         170  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         171  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  121    172   
        }
         173  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  122    174   
    })
         175  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  123    176   
}
  124    177   
         178  +
/* JsonParserGenerator.kt:148 */
  125    179   
pub(crate) fn de_malformed_timestamp_body_default(
  126    180   
    value: &[u8],
  127    181   
    mut builder: crate::input::malformed_timestamp_body_default_input_internal::Builder,
  128    182   
) -> ::std::result::Result<
  129    183   
    crate::input::malformed_timestamp_body_default_input_internal::Builder,
  130    184   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  131    185   
> {
         186  +
    /* JsonParserGenerator.kt:153 */
  132    187   
    let mut tokens_owned =
  133    188   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  134    189   
            .peekable();
  135    190   
    let tokens = &mut tokens_owned;
  136    191   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         192  +
    /* JsonParserGenerator.kt:684 */
  137    193   
    loop {
         194  +
        /* JsonParserGenerator.kt:685 */
  138    195   
        match tokens.next().transpose()? {
         196  +
            /* JsonParserGenerator.kt:686 */
  139    197   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  140    198   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         199  +
                /* JsonParserGenerator.kt:260 */
  141    200   
                match key.to_unescaped()?.as_ref() {
         201  +
                    /* JsonParserGenerator.kt:262 */
  142    202   
                    "timestamp" => {
         203  +
                        /* JsonParserGenerator.kt:276 */
  143    204   
                        if let Some(v) =
         205  +
                            /* JsonParserGenerator.kt:384 */
  144    206   
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
  145         -
                                tokens.next(),
  146         -
                                ::aws_smithy_types::date_time::Format::EpochSeconds,
  147         -
                            )?
  148         -
                            .map(::aws_smithy_http_server_python::types::DateTime::from)
         207  +
                                    tokens.next(),
         208  +
                                    ::aws_smithy_types::date_time::Format::EpochSeconds,
         209  +
                                )?
         210  +
                                /* PythonServerProtocolLoader.kt:44 */
         211  +
                                .map(::aws_smithy_http_server_python::types::DateTime::from)
         212  +
                        /* JsonParserGenerator.kt:278 */
  149    213   
                        {
  150    214   
                            builder = builder.set_timestamp(v);
  151    215   
                        }
         216  +
                        /* JsonParserGenerator.kt:262 */
  152    217   
                    }
  153         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         218  +
                    /* JsonParserGenerator.kt:290 */
         219  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  154    220   
                }
         221  +
                /* JsonParserGenerator.kt:686 */
  155    222   
            }
         223  +
            /* JsonParserGenerator.kt:695 */
  156    224   
            other => {
  157    225   
                return Err(
  158    226   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  159    227   
                        "expected object key or end object, found: {:?}",
  160    228   
                        other
  161    229   
                    )),
  162    230   
                )
  163         -
            }
         231  +
            } /* JsonParserGenerator.kt:685 */
  164    232   
        }
         233  +
        /* JsonParserGenerator.kt:684 */
  165    234   
    }
         235  +
    /* JsonParserGenerator.kt:250 */
  166    236   
    if tokens.next().is_some() {
         237  +
        /* JsonParserGenerator.kt:251 */
  167    238   
        return Err(
  168    239   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  169    240   
                "found more JSON tokens after completing parsing",
  170    241   
            ),
  171    242   
        );
         243  +
        /* JsonParserGenerator.kt:250 */
  172    244   
    }
         245  +
    /* JsonParserGenerator.kt:163 */
  173    246   
    Ok(builder)
         247  +
    /* JsonParserGenerator.kt:148 */
  174    248   
}

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

@@ -1,1 +174,248 @@
    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_body_http_date_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedTimestampBodyHttpDateInput,
    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_body_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:745 */
   23     31   
        let bytes = ::hyper::body::to_bytes(body).await?;
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   24     33   
        if !bytes.is_empty() {
          34  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   25     35   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   26     36   
                &headers,
   27     37   
                Some("application/json"),
   28     38   
            )?;
   29     39   
            input = crate::protocol_serde::shape_malformed_timestamp_body_http_date::de_malformed_timestamp_body_http_date(bytes.as_ref(), input)?;
          40  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   30     41   
        }
          42  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   31     43   
        input.build()?
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   32     45   
    })
          46  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   33     47   
}
   34     48   
          49  +
/* RustType.kt:516 */
   35     50   
#[allow(clippy::unnecessary_wraps)]
          51  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   36     52   
pub fn ser_malformed_timestamp_body_http_date_http_response(
   37     53   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampBodyHttpDateOutput,
   38     54   
) -> std::result::Result<
   39     55   
    ::aws_smithy_http_server::response::Response,
   40     56   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   41     57   
> {
          58  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   42     59   
    Ok({
          60  +
        /* RustType.kt:516 */
   43     61   
        #[allow(unused_mut)]
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   44     63   
        let mut builder = ::http::Response::builder();
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   45     65   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   46     66   
            builder,
   47     67   
            ::http::header::CONTENT_TYPE,
   48     68   
            "application/json",
   49     69   
        );
          70  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   50     71   
        let http_status: u16 = 200;
   51     72   
        builder = builder.status(http_status);
   52         -
        let payload = "";
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          74  +
        let payload =
          75  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   53     78   
        let content_length = payload.len();
   54     79   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   55     80   
            builder,
   56     81   
            ::http::header::CONTENT_LENGTH,
   57     82   
            content_length,
   58     83   
        );
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   59     85   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   60     87   
        builder.body(body)?
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   61     89   
    })
          90  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   62     91   
}
   63     92   
          93  +
/* RustType.kt:516 */
   64     94   
#[allow(clippy::unnecessary_wraps)]
          95  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   65     96   
pub fn ser_malformed_timestamp_body_http_date_http_error(
   66     97   
    error: &crate::error::MalformedTimestampBodyHttpDateError,
   67     98   
) -> std::result::Result<
   68     99   
    ::aws_smithy_http_server::response::Response,
   69    100   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   70    101   
> {
         102  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   71    103   
    Ok({
         104  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   72    105   
        match error {
         106  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   73    107   
            crate::error::MalformedTimestampBodyHttpDateError::ValidationException(output) => {
         108  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   74    109   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         110  +
                /* RustType.kt:516 */
   75    111   
                #[allow(unused_mut)]
         112  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   76    113   
                let mut builder = ::http::Response::builder();
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   77    115   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   78    116   
                    builder,
   79    117   
                    ::http::header::CONTENT_TYPE,
   80    118   
                    "application/json",
   81    119   
                );
         120  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   82    121   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   83    122   
                    builder,
   84    123   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   85    124   
                    "ValidationException",
   86    125   
                );
         126  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   87    127   
                let content_length = payload.len();
   88    128   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   89    129   
                    builder,
   90    130   
                    ::http::header::CONTENT_LENGTH,
   91    131   
                    content_length,
   92    132   
                );
         133  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   93    134   
                builder
   94    135   
                    .status(400)
   95    136   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         137  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
   96    138   
            }
         139  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   97    140   
            crate::error::MalformedTimestampBodyHttpDateError::InternalServerError(output) => {
         141  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   98    142   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         143  +
                /* RustType.kt:516 */
   99    144   
                #[allow(unused_mut)]
         145  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  100    146   
                let mut builder = ::http::Response::builder();
         147  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  101    148   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  102    149   
                    builder,
  103    150   
                    ::http::header::CONTENT_TYPE,
  104    151   
                    "application/json",
  105    152   
                );
         153  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  106    154   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  107    155   
                    builder,
  108    156   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  109    157   
                    "InternalServerError",
  110    158   
                );
         159  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  111    160   
                let content_length = payload.len();
  112    161   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  113    162   
                    builder,
  114    163   
                    ::http::header::CONTENT_LENGTH,
  115    164   
                    content_length,
  116    165   
                );
         166  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  117    167   
                builder
  118    168   
                    .status(500)
  119    169   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  120         -
            }
         170  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         171  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  121    172   
        }
         173  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  122    174   
    })
         175  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  123    176   
}
  124    177   
         178  +
/* JsonParserGenerator.kt:148 */
  125    179   
pub(crate) fn de_malformed_timestamp_body_http_date(
  126    180   
    value: &[u8],
  127    181   
    mut builder: crate::input::malformed_timestamp_body_http_date_input_internal::Builder,
  128    182   
) -> ::std::result::Result<
  129    183   
    crate::input::malformed_timestamp_body_http_date_input_internal::Builder,
  130    184   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  131    185   
> {
         186  +
    /* JsonParserGenerator.kt:153 */
  132    187   
    let mut tokens_owned =
  133    188   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  134    189   
            .peekable();
  135    190   
    let tokens = &mut tokens_owned;
  136    191   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         192  +
    /* JsonParserGenerator.kt:684 */
  137    193   
    loop {
         194  +
        /* JsonParserGenerator.kt:685 */
  138    195   
        match tokens.next().transpose()? {
         196  +
            /* JsonParserGenerator.kt:686 */
  139    197   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  140    198   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         199  +
                /* JsonParserGenerator.kt:260 */
  141    200   
                match key.to_unescaped()?.as_ref() {
         201  +
                    /* JsonParserGenerator.kt:262 */
  142    202   
                    "timestamp" => {
         203  +
                        /* JsonParserGenerator.kt:276 */
  143    204   
                        if let Some(v) =
         205  +
                            /* JsonParserGenerator.kt:384 */
  144    206   
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
  145         -
                                tokens.next(),
  146         -
                                ::aws_smithy_types::date_time::Format::HttpDate,
  147         -
                            )?
  148         -
                            .map(::aws_smithy_http_server_python::types::DateTime::from)
         207  +
                                    tokens.next(),
         208  +
                                    ::aws_smithy_types::date_time::Format::HttpDate,
         209  +
                                )?
         210  +
                                /* PythonServerProtocolLoader.kt:44 */
         211  +
                                .map(::aws_smithy_http_server_python::types::DateTime::from)
         212  +
                        /* JsonParserGenerator.kt:278 */
  149    213   
                        {
  150    214   
                            builder = builder.set_timestamp(v);
  151    215   
                        }
         216  +
                        /* JsonParserGenerator.kt:262 */
  152    217   
                    }
  153         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         218  +
                    /* JsonParserGenerator.kt:290 */
         219  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  154    220   
                }
         221  +
                /* JsonParserGenerator.kt:686 */
  155    222   
            }
         223  +
            /* JsonParserGenerator.kt:695 */
  156    224   
            other => {
  157    225   
                return Err(
  158    226   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  159    227   
                        "expected object key or end object, found: {:?}",
  160    228   
                        other
  161    229   
                    )),
  162    230   
                )
  163         -
            }
         231  +
            } /* JsonParserGenerator.kt:685 */
  164    232   
        }
         233  +
        /* JsonParserGenerator.kt:684 */
  165    234   
    }
         235  +
    /* JsonParserGenerator.kt:250 */
  166    236   
    if tokens.next().is_some() {
         237  +
        /* JsonParserGenerator.kt:251 */
  167    238   
        return Err(
  168    239   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  169    240   
                "found more JSON tokens after completing parsing",
  170    241   
            ),
  171    242   
        );
         243  +
        /* JsonParserGenerator.kt:250 */
  172    244   
    }
         245  +
    /* JsonParserGenerator.kt:163 */
  173    246   
    Ok(builder)
         247  +
    /* JsonParserGenerator.kt:148 */
  174    248   
}

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

@@ -1,1 +118,168 @@
    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_header_date_time_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedTimestampHeaderDateTimeInput,
    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_header_date_time_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:794 */
   23     31   
        if let Some(value) = crate::protocol_serde::shape_malformed_timestamp_header_date_time_input::de_timestamp_header(&headers)? {
   24     32   
                                input = input.set_timestamp(value)
   25     33   
                            }
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   26     35   
        input.build()?
          36  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   27     37   
    })
          38  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   28     39   
}
   29     40   
          41  +
/* RustType.kt:516 */
   30     42   
#[allow(clippy::unnecessary_wraps)]
          43  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   31     44   
pub fn ser_malformed_timestamp_header_date_time_http_response(
   32     45   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampHeaderDateTimeOutput,
   33     46   
) -> std::result::Result<
   34     47   
    ::aws_smithy_http_server::response::Response,
   35     48   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   36     49   
> {
          50  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   37     51   
    Ok({
          52  +
        /* RustType.kt:516 */
   38     53   
        #[allow(unused_mut)]
          54  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   39     55   
        let mut builder = ::http::Response::builder();
          56  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   40     57   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   41     58   
            builder,
   42     59   
            ::http::header::CONTENT_TYPE,
   43     60   
            "application/json",
   44     61   
        );
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   45     63   
        let http_status: u16 = 200;
   46     64   
        builder = builder.status(http_status);
   47         -
        let payload = "";
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          66  +
        let payload =
          67  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          68  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   48     70   
        let content_length = payload.len();
   49     71   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   50     72   
            builder,
   51     73   
            ::http::header::CONTENT_LENGTH,
   52     74   
            content_length,
   53     75   
        );
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   54     77   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   55     79   
        builder.body(body)?
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   56     81   
    })
          82  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   57     83   
}
   58     84   
          85  +
/* RustType.kt:516 */
   59     86   
#[allow(clippy::unnecessary_wraps)]
          87  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   60     88   
pub fn ser_malformed_timestamp_header_date_time_http_error(
   61     89   
    error: &crate::error::MalformedTimestampHeaderDateTimeError,
   62     90   
) -> std::result::Result<
   63     91   
    ::aws_smithy_http_server::response::Response,
   64     92   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   65     93   
> {
          94  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   66     95   
    Ok({
          96  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   67     97   
        match error {
          98  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   68     99   
            crate::error::MalformedTimestampHeaderDateTimeError::ValidationException(output) => {
         100  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   69    101   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         102  +
                /* RustType.kt:516 */
   70    103   
                #[allow(unused_mut)]
         104  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   71    105   
                let mut builder = ::http::Response::builder();
         106  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   72    107   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   73    108   
                    builder,
   74    109   
                    ::http::header::CONTENT_TYPE,
   75    110   
                    "application/json",
   76    111   
                );
         112  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   77    113   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   78    114   
                    builder,
   79    115   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   80    116   
                    "ValidationException",
   81    117   
                );
         118  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   82    119   
                let content_length = payload.len();
   83    120   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   84    121   
                    builder,
   85    122   
                    ::http::header::CONTENT_LENGTH,
   86    123   
                    content_length,
   87    124   
                );
         125  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   88    126   
                builder
   89    127   
                    .status(400)
   90    128   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         129  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
   91    130   
            }
         131  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   92    132   
            crate::error::MalformedTimestampHeaderDateTimeError::InternalServerError(output) => {
         133  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   93    134   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         135  +
                /* RustType.kt:516 */
   94    136   
                #[allow(unused_mut)]
         137  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   95    138   
                let mut builder = ::http::Response::builder();
         139  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   96    140   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   97    141   
                    builder,
   98    142   
                    ::http::header::CONTENT_TYPE,
   99    143   
                    "application/json",
  100    144   
                );
         145  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  101    146   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  102    147   
                    builder,
  103    148   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  104    149   
                    "InternalServerError",
  105    150   
                );
         151  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  106    152   
                let content_length = payload.len();
  107    153   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  108    154   
                    builder,
  109    155   
                    ::http::header::CONTENT_LENGTH,
  110    156   
                    content_length,
  111    157   
                );
         158  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  112    159   
                builder
  113    160   
                    .status(500)
  114    161   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  115         -
            }
         162  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         163  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  116    164   
        }
         165  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  117    166   
    })
         167  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  118    168   
}

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

@@ -1,1 +26,26 @@
    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_timestamp_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::option::Option<::aws_smithy_http_server_python::types::DateTime>,
    6      7   
    ::aws_smithy_http::header::ParseError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:160 */
    8     10   
    let headers = header_map.get_all("timestamp");
    9         -
    let var_1: Vec<::aws_smithy_http_server_python::types::DateTime> =
   10         -
        ::aws_smithy_http::header::many_dates(
   11         -
            headers,
   12         -
            ::aws_smithy_types::date_time::Format::DateTime,
   13         -
        )?
   14         -
        .into_iter()
   15         -
        .map(::aws_smithy_http_server_python::types::DateTime::from)
   16         -
        .collect();
          11  +
    /* HttpBindingGenerator.kt:394 */
          12  +
    let var_1: Vec<::aws_smithy_http_server_python::types::DateTime> = ::aws_smithy_http::header::many_dates(headers, ::aws_smithy_types::date_time::Format::DateTime)?
          13  +
    /* PythonServerProtocolLoader.kt:84 */.into_iter().map(::aws_smithy_http_server_python::types::DateTime::from).collect()
          14  +
    /* HttpBindingGenerator.kt:402 */;
          15  +
    /* HttpBindingGenerator.kt:468 */
   17     16   
    if var_1.len() > 1 {
   18     17   
        Err(::aws_smithy_http::header::ParseError::new(format!(
   19     18   
            "expected one item but found {}",
   20     19   
            var_1.len()
   21     20   
        )))
   22     21   
    } else {
   23     22   
        let mut var_1 = var_1;
   24     23   
        Ok(var_1.pop())
   25     24   
    }
          25  +
    /* HttpBindingGenerator.kt:153 */
   26     26   
}

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

@@ -1,1 +118,168 @@
    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_header_default_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedTimestampHeaderDefaultInput,
    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_header_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:794 */
   23     31   
        if let Some(value) = crate::protocol_serde::shape_malformed_timestamp_header_default_input::de_timestamp_header(&headers)? {
   24     32   
                                input = input.set_timestamp(value)
   25     33   
                            }
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   26     35   
        input.build()?
          36  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   27     37   
    })
          38  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   28     39   
}
   29     40   
          41  +
/* RustType.kt:516 */
   30     42   
#[allow(clippy::unnecessary_wraps)]
          43  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   31     44   
pub fn ser_malformed_timestamp_header_default_http_response(
   32     45   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampHeaderDefaultOutput,
   33     46   
) -> std::result::Result<
   34     47   
    ::aws_smithy_http_server::response::Response,
   35     48   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   36     49   
> {
          50  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   37     51   
    Ok({
          52  +
        /* RustType.kt:516 */
   38     53   
        #[allow(unused_mut)]
          54  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   39     55   
        let mut builder = ::http::Response::builder();
          56  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   40     57   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   41     58   
            builder,
   42     59   
            ::http::header::CONTENT_TYPE,
   43     60   
            "application/json",
   44     61   
        );
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   45     63   
        let http_status: u16 = 200;
   46     64   
        builder = builder.status(http_status);
   47         -
        let payload = "";
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          66  +
        let payload =
          67  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          68  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   48     70   
        let content_length = payload.len();
   49     71   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   50     72   
            builder,
   51     73   
            ::http::header::CONTENT_LENGTH,
   52     74   
            content_length,
   53     75   
        );
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   54     77   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   55     79   
        builder.body(body)?
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   56     81   
    })
          82  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   57     83   
}
   58     84   
          85  +
/* RustType.kt:516 */
   59     86   
#[allow(clippy::unnecessary_wraps)]
          87  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   60     88   
pub fn ser_malformed_timestamp_header_default_http_error(
   61     89   
    error: &crate::error::MalformedTimestampHeaderDefaultError,
   62     90   
) -> std::result::Result<
   63     91   
    ::aws_smithy_http_server::response::Response,
   64     92   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   65     93   
> {
          94  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   66     95   
    Ok({
          96  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   67     97   
        match error {
          98  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   68     99   
            crate::error::MalformedTimestampHeaderDefaultError::ValidationException(output) => {
         100  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   69    101   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         102  +
                /* RustType.kt:516 */
   70    103   
                #[allow(unused_mut)]
         104  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   71    105   
                let mut builder = ::http::Response::builder();
         106  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   72    107   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   73    108   
                    builder,
   74    109   
                    ::http::header::CONTENT_TYPE,
   75    110   
                    "application/json",
   76    111   
                );
         112  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   77    113   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   78    114   
                    builder,
   79    115   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   80    116   
                    "ValidationException",
   81    117   
                );
         118  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   82    119   
                let content_length = payload.len();
   83    120   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   84    121   
                    builder,
   85    122   
                    ::http::header::CONTENT_LENGTH,
   86    123   
                    content_length,
   87    124   
                );
         125  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   88    126   
                builder
   89    127   
                    .status(400)
   90    128   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         129  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
   91    130   
            }
         131  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   92    132   
            crate::error::MalformedTimestampHeaderDefaultError::InternalServerError(output) => {
         133  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   93    134   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         135  +
                /* RustType.kt:516 */
   94    136   
                #[allow(unused_mut)]
         137  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   95    138   
                let mut builder = ::http::Response::builder();
         139  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   96    140   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   97    141   
                    builder,
   98    142   
                    ::http::header::CONTENT_TYPE,
   99    143   
                    "application/json",
  100    144   
                );
         145  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  101    146   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  102    147   
                    builder,
  103    148   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  104    149   
                    "InternalServerError",
  105    150   
                );
         151  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  106    152   
                let content_length = payload.len();
  107    153   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  108    154   
                    builder,
  109    155   
                    ::http::header::CONTENT_LENGTH,
  110    156   
                    content_length,
  111    157   
                );
         158  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  112    159   
                builder
  113    160   
                    .status(500)
  114    161   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  115         -
            }
         162  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         163  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  116    164   
        }
         165  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  117    166   
    })
         167  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  118    168   
}

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

@@ -1,1 +26,26 @@
    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_timestamp_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::option::Option<::aws_smithy_http_server_python::types::DateTime>,
    6      7   
    ::aws_smithy_http::header::ParseError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:160 */
    8     10   
    let headers = header_map.get_all("timestamp");
    9         -
    let var_1: Vec<::aws_smithy_http_server_python::types::DateTime> =
   10         -
        ::aws_smithy_http::header::many_dates(
   11         -
            headers,
   12         -
            ::aws_smithy_types::date_time::Format::HttpDate,
   13         -
        )?
   14         -
        .into_iter()
   15         -
        .map(::aws_smithy_http_server_python::types::DateTime::from)
   16         -
        .collect();
          11  +
    /* HttpBindingGenerator.kt:394 */
          12  +
    let var_1: Vec<::aws_smithy_http_server_python::types::DateTime> = ::aws_smithy_http::header::many_dates(headers, ::aws_smithy_types::date_time::Format::HttpDate)?
          13  +
    /* PythonServerProtocolLoader.kt:84 */.into_iter().map(::aws_smithy_http_server_python::types::DateTime::from).collect()
          14  +
    /* HttpBindingGenerator.kt:402 */;
          15  +
    /* HttpBindingGenerator.kt:468 */
   17     16   
    if var_1.len() > 1 {
   18     17   
        Err(::aws_smithy_http::header::ParseError::new(format!(
   19     18   
            "expected one item but found {}",
   20     19   
            var_1.len()
   21     20   
        )))
   22     21   
    } else {
   23     22   
        let mut var_1 = var_1;
   24     23   
        Ok(var_1.pop())
   25     24   
    }
          25  +
    /* HttpBindingGenerator.kt:153 */
   26     26   
}

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

@@ -1,1 +118,168 @@
    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_header_epoch_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedTimestampHeaderEpochInput,
    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_header_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:794 */
   23     31   
        if let Some(value) = crate::protocol_serde::shape_malformed_timestamp_header_epoch_input::de_timestamp_header(&headers)? {
   24     32   
                                input = input.set_timestamp(value)
   25     33   
                            }
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   26     35   
        input.build()?
          36  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   27     37   
    })
          38  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   28     39   
}
   29     40   
          41  +
/* RustType.kt:516 */
   30     42   
#[allow(clippy::unnecessary_wraps)]
          43  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   31     44   
pub fn ser_malformed_timestamp_header_epoch_http_response(
   32     45   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampHeaderEpochOutput,
   33     46   
) -> std::result::Result<
   34     47   
    ::aws_smithy_http_server::response::Response,
   35     48   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   36     49   
> {
          50  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   37     51   
    Ok({
          52  +
        /* RustType.kt:516 */
   38     53   
        #[allow(unused_mut)]
          54  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   39     55   
        let mut builder = ::http::Response::builder();
          56  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   40     57   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   41     58   
            builder,
   42     59   
            ::http::header::CONTENT_TYPE,
   43     60   
            "application/json",
   44     61   
        );
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   45     63   
        let http_status: u16 = 200;
   46     64   
        builder = builder.status(http_status);
   47         -
        let payload = "";
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          66  +
        let payload =
          67  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          68  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   48     70   
        let content_length = payload.len();
   49     71   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   50     72   
            builder,
   51     73   
            ::http::header::CONTENT_LENGTH,
   52     74   
            content_length,
   53     75   
        );
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   54     77   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   55     79   
        builder.body(body)?
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   56     81   
    })
          82  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   57     83   
}
   58     84   
          85  +
/* RustType.kt:516 */
   59     86   
#[allow(clippy::unnecessary_wraps)]
          87  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   60     88   
pub fn ser_malformed_timestamp_header_epoch_http_error(
   61     89   
    error: &crate::error::MalformedTimestampHeaderEpochError,
   62     90   
) -> std::result::Result<
   63     91   
    ::aws_smithy_http_server::response::Response,
   64     92   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   65     93   
> {
          94  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   66     95   
    Ok({
          96  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   67     97   
        match error {
          98  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   68     99   
            crate::error::MalformedTimestampHeaderEpochError::ValidationException(output) => {
         100  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   69    101   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         102  +
                /* RustType.kt:516 */
   70    103   
                #[allow(unused_mut)]
         104  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   71    105   
                let mut builder = ::http::Response::builder();
         106  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   72    107   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   73    108   
                    builder,
   74    109   
                    ::http::header::CONTENT_TYPE,
   75    110   
                    "application/json",
   76    111   
                );
         112  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   77    113   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   78    114   
                    builder,
   79    115   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   80    116   
                    "ValidationException",
   81    117   
                );
         118  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   82    119   
                let content_length = payload.len();
   83    120   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   84    121   
                    builder,
   85    122   
                    ::http::header::CONTENT_LENGTH,
   86    123   
                    content_length,
   87    124   
                );
         125  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   88    126   
                builder
   89    127   
                    .status(400)
   90    128   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         129  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
   91    130   
            }
         131  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   92    132   
            crate::error::MalformedTimestampHeaderEpochError::InternalServerError(output) => {
         133  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   93    134   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         135  +
                /* RustType.kt:516 */
   94    136   
                #[allow(unused_mut)]
         137  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   95    138   
                let mut builder = ::http::Response::builder();
         139  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   96    140   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   97    141   
                    builder,
   98    142   
                    ::http::header::CONTENT_TYPE,
   99    143   
                    "application/json",
  100    144   
                );
         145  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  101    146   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  102    147   
                    builder,
  103    148   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  104    149   
                    "InternalServerError",
  105    150   
                );
         151  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  106    152   
                let content_length = payload.len();
  107    153   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  108    154   
                    builder,
  109    155   
                    ::http::header::CONTENT_LENGTH,
  110    156   
                    content_length,
  111    157   
                );
         158  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  112    159   
                builder
  113    160   
                    .status(500)
  114    161   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  115         -
            }
         162  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         163  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  116    164   
        }
         165  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  117    166   
    })
         167  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  118    168   
}

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

@@ -1,1 +26,26 @@
    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_timestamp_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::option::Option<::aws_smithy_http_server_python::types::DateTime>,
    6      7   
    ::aws_smithy_http::header::ParseError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:160 */
    8     10   
    let headers = header_map.get_all("timestamp");
    9         -
    let var_1: Vec<::aws_smithy_http_server_python::types::DateTime> =
   10         -
        ::aws_smithy_http::header::many_dates(
   11         -
            headers,
   12         -
            ::aws_smithy_types::date_time::Format::EpochSeconds,
   13         -
        )?
   14         -
        .into_iter()
   15         -
        .map(::aws_smithy_http_server_python::types::DateTime::from)
   16         -
        .collect();
          11  +
    /* HttpBindingGenerator.kt:394 */
          12  +
    let var_1: Vec<::aws_smithy_http_server_python::types::DateTime> = ::aws_smithy_http::header::many_dates(headers, ::aws_smithy_types::date_time::Format::EpochSeconds)?
          13  +
    /* PythonServerProtocolLoader.kt:84 */.into_iter().map(::aws_smithy_http_server_python::types::DateTime::from).collect()
          14  +
    /* HttpBindingGenerator.kt:402 */;
          15  +
    /* HttpBindingGenerator.kt:468 */
   17     16   
    if var_1.len() > 1 {
   18     17   
        Err(::aws_smithy_http::header::ParseError::new(format!(
   19     18   
            "expected one item but found {}",
   20     19   
            var_1.len()
   21     20   
        )))
   22     21   
    } else {
   23     22   
        let mut var_1 = var_1;
   24     23   
        Ok(var_1.pop())
   25     24   
    }
          25  +
    /* HttpBindingGenerator.kt:153 */
   26     26   
}

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

@@ -1,1 +136,188 @@
    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_default_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedTimestampPathDefaultInput,
    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_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: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   
                        "MalformedTimestampPathDefault",
   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_default_input::de_timestamp(m1)?,
   43     53   
        );
          54  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   44     55   
        input.build()?
          56  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   45     57   
    })
          58  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   46     59   
}
   47     60   
          61  +
/* RustType.kt:516 */
   48     62   
#[allow(clippy::unnecessary_wraps)]
          63  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   49     64   
pub fn ser_malformed_timestamp_path_default_http_response(
   50     65   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampPathDefaultOutput,
   51     66   
) -> std::result::Result<
   52     67   
    ::aws_smithy_http_server::response::Response,
   53     68   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   54     69   
> {
          70  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   55     71   
    Ok({
          72  +
        /* RustType.kt:516 */
   56     73   
        #[allow(unused_mut)]
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   57     75   
        let mut builder = ::http::Response::builder();
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   58     77   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   59     78   
            builder,
   60     79   
            ::http::header::CONTENT_TYPE,
   61     80   
            "application/json",
   62     81   
        );
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   63     83   
        let http_status: u16 = 200;
   64     84   
        builder = builder.status(http_status);
   65         -
        let payload = "";
          85  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          86  +
        let payload =
          87  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   66     90   
        let content_length = payload.len();
   67     91   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   68     92   
            builder,
   69     93   
            ::http::header::CONTENT_LENGTH,
   70     94   
            content_length,
   71     95   
        );
          96  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   72     97   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          98  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   73     99   
        builder.body(body)?
         100  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   74    101   
    })
         102  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   75    103   
}
   76    104   
         105  +
/* RustType.kt:516 */
   77    106   
#[allow(clippy::unnecessary_wraps)]
         107  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   78    108   
pub fn ser_malformed_timestamp_path_default_http_error(
   79    109   
    error: &crate::error::MalformedTimestampPathDefaultError,
   80    110   
) -> std::result::Result<
   81    111   
    ::aws_smithy_http_server::response::Response,
   82    112   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   83    113   
> {
         114  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   84    115   
    Ok({
         116  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   85    117   
        match error {
         118  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   86    119   
            crate::error::MalformedTimestampPathDefaultError::ValidationException(output) => {
         120  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   87    121   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         122  +
                /* RustType.kt:516 */
   88    123   
                #[allow(unused_mut)]
         124  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   89    125   
                let mut builder = ::http::Response::builder();
         126  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   90    127   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   91    128   
                    builder,
   92    129   
                    ::http::header::CONTENT_TYPE,
   93    130   
                    "application/json",
   94    131   
                );
         132  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   95    133   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   96    134   
                    builder,
   97    135   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   98    136   
                    "ValidationException",
   99    137   
                );
         138  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  100    139   
                let content_length = payload.len();
  101    140   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  102    141   
                    builder,
  103    142   
                    ::http::header::CONTENT_LENGTH,
  104    143   
                    content_length,
  105    144   
                );
         145  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  106    146   
                builder
  107    147   
                    .status(400)
  108    148   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         149  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
  109    150   
            }
         151  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  110    152   
            crate::error::MalformedTimestampPathDefaultError::InternalServerError(output) => {
         153  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  111    154   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         155  +
                /* RustType.kt:516 */
  112    156   
                #[allow(unused_mut)]
         157  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  113    158   
                let mut builder = ::http::Response::builder();
         159  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  114    160   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  115    161   
                    builder,
  116    162   
                    ::http::header::CONTENT_TYPE,
  117    163   
                    "application/json",
  118    164   
                );
         165  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  119    166   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  120    167   
                    builder,
  121    168   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  122    169   
                    "InternalServerError",
  123    170   
                );
         171  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  124    172   
                let content_length = payload.len();
  125    173   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  126    174   
                    builder,
  127    175   
                    ::http::header::CONTENT_LENGTH,
  128    176   
                    content_length,
  129    177   
                );
         178  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  130    179   
                builder
  131    180   
                    .status(500)
  132    181   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  133         -
            }
         182  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         183  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  134    184   
        }
         185  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  135    186   
    })
         187  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  136    188   
}

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/src/protocol_serde/shape_malformed_timestamp_path_default_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::DateTime,
   12         -
    )?
   13         -
    .into();
          11  +
    let value = ::aws_smithy_types::DateTime::from_str(value.as_ref(), ::aws_smithy_types::date_time::Format::DateTime)?
          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_path_epoch.rs

@@ -1,1 +136,188 @@
    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_epoch_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedTimestampPathEpochInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt: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_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: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   
                        "MalformedTimestampPathEpoch",
   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_epoch_input::de_timestamp(m1)?,
   43     53   
        );
          54  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   44     55   
        input.build()?
          56  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   45     57   
    })
          58  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   46     59   
}
   47     60   
          61  +
/* RustType.kt:516 */
   48     62   
#[allow(clippy::unnecessary_wraps)]
          63  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   49     64   
pub fn ser_malformed_timestamp_path_epoch_http_response(
   50     65   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampPathEpochOutput,
   51     66   
) -> std::result::Result<
   52     67   
    ::aws_smithy_http_server::response::Response,
   53     68   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   54     69   
> {
          70  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   55     71   
    Ok({
          72  +
        /* RustType.kt:516 */
   56     73   
        #[allow(unused_mut)]
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   57     75   
        let mut builder = ::http::Response::builder();
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   58     77   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   59     78   
            builder,
   60     79   
            ::http::header::CONTENT_TYPE,
   61     80   
            "application/json",
   62     81   
        );
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   63     83   
        let http_status: u16 = 200;
   64     84   
        builder = builder.status(http_status);
   65         -
        let payload = "";
          85  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          86  +
        let payload =
          87  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   66     90   
        let content_length = payload.len();
   67     91   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   68     92   
            builder,
   69     93   
            ::http::header::CONTENT_LENGTH,
   70     94   
            content_length,
   71     95   
        );
          96  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   72     97   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          98  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   73     99   
        builder.body(body)?
         100  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   74    101   
    })
         102  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   75    103   
}
   76    104   
         105  +
/* RustType.kt:516 */
   77    106   
#[allow(clippy::unnecessary_wraps)]
         107  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   78    108   
pub fn ser_malformed_timestamp_path_epoch_http_error(
   79    109   
    error: &crate::error::MalformedTimestampPathEpochError,
   80    110   
) -> std::result::Result<
   81    111   
    ::aws_smithy_http_server::response::Response,
   82    112   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   83    113   
> {
         114  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   84    115   
    Ok({
         116  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   85    117   
        match error {
         118  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   86    119   
            crate::error::MalformedTimestampPathEpochError::ValidationException(output) => {
         120  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   87    121   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         122  +
                /* RustType.kt:516 */
   88    123   
                #[allow(unused_mut)]
         124  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   89    125   
                let mut builder = ::http::Response::builder();
         126  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   90    127   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   91    128   
                    builder,
   92    129   
                    ::http::header::CONTENT_TYPE,
   93    130   
                    "application/json",
   94    131   
                );
         132  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   95    133   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   96    134   
                    builder,
   97    135   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   98    136   
                    "ValidationException",
   99    137   
                );
         138  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  100    139   
                let content_length = payload.len();
  101    140   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  102    141   
                    builder,
  103    142   
                    ::http::header::CONTENT_LENGTH,
  104    143   
                    content_length,
  105    144   
                );
         145  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  106    146   
                builder
  107    147   
                    .status(400)
  108    148   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         149  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
  109    150   
            }
         151  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  110    152   
            crate::error::MalformedTimestampPathEpochError::InternalServerError(output) => {
         153  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  111    154   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         155  +
                /* RustType.kt:516 */
  112    156   
                #[allow(unused_mut)]
         157  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  113    158   
                let mut builder = ::http::Response::builder();
         159  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  114    160   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  115    161   
                    builder,
  116    162   
                    ::http::header::CONTENT_TYPE,
  117    163   
                    "application/json",
  118    164   
                );
         165  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  119    166   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  120    167   
                    builder,
  121    168   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  122    169   
                    "InternalServerError",
  123    170   
                );
         171  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  124    172   
                let content_length = payload.len();
  125    173   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  126    174   
                    builder,
  127    175   
                    ::http::header::CONTENT_LENGTH,
  128    176   
                    content_length,
  129    177   
                );
         178  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  130    179   
                builder
  131    180   
                    .status(500)
  132    181   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  133         -
            }
         182  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         183  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  134    184   
        }
         185  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  135    186   
    })
         187  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  136    188   
}

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/src/protocol_serde/shape_malformed_timestamp_path_epoch_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::EpochSeconds,
   12         -
    )?
   13         -
    .into();
          11  +
    let value = ::aws_smithy_types::DateTime::from_str(value.as_ref(), ::aws_smithy_types::date_time::Format::EpochSeconds)?
          12  +
    /* PythonServerProtocolLoader.kt:68 */.into()
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1343 */;
          14  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   14     15   
    Ok(value)
          16  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   15     17   
}