Server Test Python

Server Test Python

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943 (ignoring whitespace)

Files changed:

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

@@ -1,1 +23,42 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBoundProtocolPayloadGenerator.kt:311 */
    2      3   
pub fn ser_nested_http_payload(
    3      4   
    payload: &::std::option::Option<crate::model::UnionPayload>,
    4      5   
) -> ::std::result::Result<::std::vec::Vec<u8>, ::aws_smithy_types::error::operation::BuildError> {
           6  +
    /* HttpBoundProtocolPayloadGenerator.kt:320 */
    5      7   
    let payload = match payload.as_ref() {
    6      8   
        Some(t) => t,
    7         -
        None => return Ok(crate::protocol_serde::rest_json_unset_union_payload()),
           9  +
        None => {
          10  +
            return Ok(
          11  +
                /* HttpBoundProtocolPayloadGenerator.kt:339 */
          12  +
                crate::protocol_serde::rest_json_unset_union_payload(), /* HttpBoundProtocolPayloadGenerator.kt:320 */
          13  +
            )
          14  +
        }
    8     15   
    };
    9         -
    Ok(crate::protocol_serde::shape_http_payload_with_union_output::ser_nested_payload(payload)?)
          16  +
    /* HttpBoundProtocolPayloadGenerator.kt:345 */
          17  +
    Ok(
          18  +
        /* HttpBoundProtocolPayloadGenerator.kt:386 */
          19  +
        crate::protocol_serde::shape_http_payload_with_union_output::ser_nested_payload(payload)?, /* HttpBoundProtocolPayloadGenerator.kt:345 */
          20  +
    )
          21  +
    /* HttpBoundProtocolPayloadGenerator.kt:311 */
   10     22   
}
   11     23   
          24  +
/* JsonSerializerGenerator.kt:240 */
   12     25   
pub fn ser_nested_payload(
   13     26   
    input: &crate::model::UnionPayload,
   14     27   
) -> std::result::Result<
   15     28   
    ::std::vec::Vec<u8>,
   16     29   
    ::aws_smithy_types::error::operation::SerializationError,
   17     30   
> {
          31  +
    /* JsonSerializerGenerator.kt:245 */
   18     32   
    let mut out = String::new();
          33  +
    /* JsonSerializerGenerator.kt:246 */
   19     34   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
          35  +
    /* JsonSerializerGenerator.kt:579 */
   20     36   
    crate::protocol_serde::shape_union_payload::ser_union_payload(&mut object, input)?;
          37  +
    /* JsonSerializerGenerator.kt:252 */
   21     38   
    object.finish();
          39  +
    /* JsonSerializerGenerator.kt:253 */
   22     40   
    Ok(out.into_bytes())
          41  +
    /* JsonSerializerGenerator.kt:240 */
   23     42   
}

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

@@ -1,1 +156,211 @@
    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_http_prefix_headers_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::HttpPrefixHeadersInput,
    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::http_prefix_headers_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_http_prefix_headers_input::de_foo_header(&headers)?
   24     32   
        {
   25     33   
            input = input.set_foo(Some(value))
   26     34   
        }
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   27     36   
        if let Some(value) =
   28     37   
            crate::protocol_serde::shape_http_prefix_headers_input::de_foo_map_prefix_header(
   29     38   
                &headers,
   30     39   
            )?
   31     40   
        {
   32     41   
            input = input.set_foo_map(Some(value))
   33     42   
        }
          43  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   34     44   
        input.build()
          45  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   35     46   
    })
          47  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   36     48   
}
   37     49   
          50  +
/* RustType.kt:516 */
   38     51   
#[allow(clippy::unnecessary_wraps)]
          52  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   39     53   
pub fn ser_http_prefix_headers_http_response(
   40     54   
    #[allow(unused_variables)] output: crate::output::HttpPrefixHeadersOutput,
   41     55   
) -> std::result::Result<
   42     56   
    ::aws_smithy_http_server::response::Response,
   43     57   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   44     58   
> {
          59  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   45     60   
    Ok({
          61  +
        /* RustType.kt:516 */
   46     62   
        #[allow(unused_mut)]
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   47     64   
        let mut builder = ::http::Response::builder();
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:629 */
   48     66   
        builder =
   49     67   
            crate::protocol_serde::shape_http_prefix_headers::ser_http_prefix_headers_headers(
   50     68   
                &output, builder,
   51     69   
            )?;
          70  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   52     71   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   53     72   
            builder,
   54     73   
            ::http::header::CONTENT_TYPE,
   55     74   
            "application/json",
   56     75   
        );
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   57     77   
        let http_status: u16 = 200;
   58     78   
        builder = builder.status(http_status);
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   59     80   
        let payload =
   60         -
            crate::protocol_serde::shape_http_prefix_headers_output::ser_http_prefix_headers_output_output_output(&output)?
   61         -
        ;
          81  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_http_prefix_headers_output::ser_http_prefix_headers_output_output_output(&output)?
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   62     84   
        let content_length = payload.len();
   63     85   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   64     86   
            builder,
   65     87   
            ::http::header::CONTENT_LENGTH,
   66     88   
            content_length,
   67     89   
        );
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   68     91   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          92  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   69     93   
        builder.body(body)?
          94  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   70     95   
    })
          96  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   71     97   
}
   72     98   
          99  +
/* RustType.kt:516 */
   73    100   
#[allow(clippy::unnecessary_wraps)]
         101  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   74    102   
pub fn ser_http_prefix_headers_http_error(
   75    103   
    error: &crate::error::HttpPrefixHeadersError,
   76    104   
) -> std::result::Result<
   77    105   
    ::aws_smithy_http_server::response::Response,
   78    106   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   79    107   
> {
         108  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   80    109   
    Ok({
         110  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   81    111   
        match error {
         112  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   82    113   
            crate::error::HttpPrefixHeadersError::InternalServerError(output) => {
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   83    115   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         116  +
                /* RustType.kt:516 */
   84    117   
                #[allow(unused_mut)]
         118  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   85    119   
                let mut builder = ::http::Response::builder();
         120  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   86    121   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   87    122   
                    builder,
   88    123   
                    ::http::header::CONTENT_TYPE,
   89    124   
                    "application/json",
   90    125   
                );
         126  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   91    127   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   92    128   
                    builder,
   93    129   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   94    130   
                    "InternalServerError",
   95    131   
                );
         132  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   96    133   
                let content_length = payload.len();
   97    134   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   98    135   
                    builder,
   99    136   
                    ::http::header::CONTENT_LENGTH,
  100    137   
                    content_length,
  101    138   
                );
         139  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  102    140   
                builder
  103    141   
                    .status(500)
  104    142   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         143  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         144  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  105    145   
        }
  106         -
        }
         146  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  107    147   
    })
         148  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  108    149   
}
  109    150   
         151  +
/* HttpBindingGenerator.kt:542 */
  110    152   
pub fn ser_http_prefix_headers_headers(
  111    153   
    input: &crate::output::HttpPrefixHeadersOutput,
  112    154   
    mut builder: ::http::response::Builder,
  113    155   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
  114    156   
{
         157  +
    /* HttpBindingGenerator.kt:592 */
  115    158   
    if let ::std::option::Option::Some(inner_1) = &input.foo {
         159  +
        /* HttpBindingGenerator.kt:704 */
  116    160   
        let formatted_2 = inner_1.as_str();
         161  +
        /* HttpBindingGenerator.kt:705 */
  117    162   
        if !formatted_2.is_empty() {
         163  +
            /* HttpBindingGenerator.kt:706 */
  118    164   
            let header_value = formatted_2;
  119    165   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  120    166   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  121    167   
                    "foo",
  122    168   
                    format!(
  123    169   
                        "`{}` cannot be used as a header value: {}",
  124    170   
                        &header_value, err
  125    171   
                    ),
  126    172   
                )
  127    173   
            })?;
  128    174   
            builder = builder.header("X-Foo", header_value);
         175  +
            /* HttpBindingGenerator.kt:705 */
  129    176   
        }
         177  +
        /* HttpBindingGenerator.kt:592 */
  130    178   
    }
         179  +
    /* HttpBindingGenerator.kt:741 */
  131    180   
    if let ::std::option::Option::Some(inner_3) = &input.foo_map {
         181  +
        /* HttpBindingGenerator.kt:741 */
  132    182   
        {
         183  +
            /* HttpBindingGenerator.kt:747 */
  133    184   
            for (k, v) in inner_3 {
  134    185   
                use std::str::FromStr;
  135    186   
                let header_name =
  136    187   
                    http::header::HeaderName::from_str(&format!("{}{}", "X-Foo-", &k)).map_err(
  137    188   
                        |err| {
  138    189   
                            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  139    190   
                                "foo_map",
  140    191   
                                format!("`{k}` cannot be used as a header name: {err}"),
  141    192   
                            )
  142    193   
                        },
  143    194   
                    )?;
  144    195   
                let header_value = v.as_str();
  145    196   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  146    197   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  147    198   
                        "foo_map",
  148    199   
                        format!("`{}` cannot be used as a header value: {}", v, err),
  149    200   
                    )
  150    201   
                })?;
  151    202   
                builder = builder.header(header_name, header_value);
  152    203   
            }
         204  +
            /* HttpBindingGenerator.kt:741 */
  153    205   
        }
         206  +
        /* HttpBindingGenerator.kt:741 */
  154    207   
    }
         208  +
    /* HttpBindingGenerator.kt:555 */
  155    209   
    Ok(builder)
         210  +
    /* HttpBindingGenerator.kt:542 */
  156    211   
}

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

@@ -1,1 +124,171 @@
    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_http_prefix_headers_in_response_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::HttpPrefixHeadersInResponseInput,
    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::http_prefix_headers_in_response_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:834 */
   23     31   
        input.build()
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   24     33   
    })
          34  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   25     35   
}
   26     36   
          37  +
/* RustType.kt:516 */
   27     38   
#[allow(clippy::unnecessary_wraps)]
          39  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   28     40   
pub fn ser_http_prefix_headers_in_response_http_response(
   29     41   
    #[allow(unused_variables)] output: crate::output::HttpPrefixHeadersInResponseOutput,
   30     42   
) -> std::result::Result<
   31     43   
    ::aws_smithy_http_server::response::Response,
   32     44   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   33     45   
> {
          46  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   34     47   
    Ok({
          48  +
        /* RustType.kt:516 */
   35     49   
        #[allow(unused_mut)]
          50  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   36     51   
        let mut builder = ::http::Response::builder();
          52  +
        /* ServerHttpBoundProtocolGenerator.kt:629 */
   37     53   
        builder = crate::protocol_serde::shape_http_prefix_headers_in_response::ser_http_prefix_headers_in_response_headers(&output, builder)?;
          54  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   38     55   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   39     56   
            builder,
   40     57   
            ::http::header::CONTENT_TYPE,
   41     58   
            "application/json",
   42     59   
        );
          60  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   43     61   
        let http_status: u16 = 200;
   44     62   
        builder = builder.status(http_status);
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   45     64   
        let payload =
   46         -
            crate::protocol_serde::shape_http_prefix_headers_in_response_output::ser_http_prefix_headers_in_response_output_output_output(&output)?
   47         -
        ;
          65  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_http_prefix_headers_in_response_output::ser_http_prefix_headers_in_response_output_output_output(&output)?
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   48     68   
        let content_length = payload.len();
   49     69   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   50     70   
            builder,
   51     71   
            ::http::header::CONTENT_LENGTH,
   52     72   
            content_length,
   53     73   
        );
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   54     75   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   55     77   
        builder.body(body)?
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   56     79   
    })
          80  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   57     81   
}
   58     82   
          83  +
/* RustType.kt:516 */
   59     84   
#[allow(clippy::unnecessary_wraps)]
          85  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   60     86   
pub fn ser_http_prefix_headers_in_response_http_error(
   61     87   
    error: &crate::error::HttpPrefixHeadersInResponseError,
   62     88   
) -> std::result::Result<
   63     89   
    ::aws_smithy_http_server::response::Response,
   64     90   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   65     91   
> {
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   66     93   
    Ok({
          94  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   67     95   
        match error {
          96  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   68     97   
            crate::error::HttpPrefixHeadersInResponseError::InternalServerError(output) => {
          98  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   69     99   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         100  +
                /* RustType.kt:516 */
   70    101   
                #[allow(unused_mut)]
         102  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   71    103   
                let mut builder = ::http::Response::builder();
         104  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   72    105   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   73    106   
                    builder,
   74    107   
                    ::http::header::CONTENT_TYPE,
   75    108   
                    "application/json",
   76    109   
                );
         110  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   77    111   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   78    112   
                    builder,
   79    113   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   80    114   
                    "InternalServerError",
   81    115   
                );
         116  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   82    117   
                let content_length = payload.len();
   83    118   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   84    119   
                    builder,
   85    120   
                    ::http::header::CONTENT_LENGTH,
   86    121   
                    content_length,
   87    122   
                );
         123  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   88    124   
                builder
   89    125   
                    .status(500)
   90    126   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         127  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         128  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   91    129   
        }
   92         -
        }
         130  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   93    131   
    })
         132  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
   94    133   
}
   95    134   
         135  +
/* HttpBindingGenerator.kt:542 */
   96    136   
pub fn ser_http_prefix_headers_in_response_headers(
   97    137   
    input: &crate::output::HttpPrefixHeadersInResponseOutput,
   98    138   
    mut builder: ::http::response::Builder,
   99    139   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
  100    140   
{
         141  +
    /* HttpBindingGenerator.kt:741 */
  101    142   
    if let ::std::option::Option::Some(inner_1) = &input.prefix_headers {
         143  +
        /* HttpBindingGenerator.kt:741 */
  102    144   
        {
         145  +
            /* HttpBindingGenerator.kt:747 */
  103    146   
            for (k, v) in inner_1 {
  104    147   
                use std::str::FromStr;
  105    148   
                let header_name = http::header::HeaderName::from_str(&format!("{}{}", "", &k))
  106    149   
                    .map_err(|err| {
  107    150   
                        ::aws_smithy_types::error::operation::BuildError::invalid_field(
  108    151   
                            "prefix_headers",
  109    152   
                            format!("`{k}` cannot be used as a header name: {err}"),
  110    153   
                        )
  111    154   
                    })?;
  112    155   
                let header_value = v.as_str();
  113    156   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  114    157   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  115    158   
                        "prefix_headers",
  116    159   
                        format!("`{}` cannot be used as a header value: {}", v, err),
  117    160   
                    )
  118    161   
                })?;
  119    162   
                builder = builder.header(header_name, header_value);
  120    163   
            }
         164  +
            /* HttpBindingGenerator.kt:741 */
  121    165   
        }
         166  +
        /* HttpBindingGenerator.kt:741 */
  122    167   
    }
         168  +
    /* HttpBindingGenerator.kt:555 */
  123    169   
    Ok(builder)
         170  +
    /* HttpBindingGenerator.kt:542 */
  124    171   
}

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

@@ -1,1 +17,25 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_http_prefix_headers_in_response_output_output_output(
    3      4   
    value: &crate::output::HttpPrefixHeadersInResponseOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_http_prefix_headers_in_response_output::ser_http_prefix_headers_in_response_output_output(&mut object, value)?;
          11  +
    /* JsonSerializerGenerator.kt:227 */
    8     12   
    object.finish();
    9     13   
    Ok(out)
          14  +
    /* JsonSerializerGenerator.kt:213 */
   10     15   
}
   11     16   
          17  +
/* JsonSerializerGenerator.kt:358 */
   12     18   
pub fn ser_http_prefix_headers_in_response_output_output(
   13     19   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    #[allow(unused_variables)] input: &crate::output::HttpPrefixHeadersInResponseOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* JsonSerializerGenerator.kt:372 */
   16     23   
    Ok(())
          24  +
    /* JsonSerializerGenerator.kt:358 */
   17     25   
}

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

@@ -1,1 +35,46 @@
    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_foo_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::option::Option<::std::string::String>,
    6      7   
    ::aws_smithy_http::header::ParseError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:160 */
    8     10   
    let headers = header_map.get_all("X-Foo");
          11  +
    /* HttpBindingGenerator.kt:375 */
    9     12   
    ::aws_smithy_http::header::one_or_none(headers)
          13  +
    /* HttpBindingGenerator.kt:153 */
   10     14   
}
   11     15   
          16  +
/* HttpBindingGenerator.kt:184 */
   12     17   
pub(crate) fn de_foo_map_prefix_header(
   13     18   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   14     19   
) -> std::result::Result<
   15     20   
    ::std::option::Option<
   16     21   
        ::std::collections::HashMap<::std::string::String, ::std::string::String>,
   17     22   
    >,
   18     23   
    ::aws_smithy_http::header::ParseError,
   19     24   
> {
          25  +
    /* HttpBindingGenerator.kt:190 */
   20     26   
    let headers =
   21     27   
        ::aws_smithy_http::header::headers_for_prefix(header_map.iter().map(|(k, _)| k), "X-Foo-");
   22     28   
    let out: std::result::Result<_, _> = headers.map(|(key, header_name)| {
   23     29   
                            let values = header_map.get_all(header_name);
   24     30   
                            crate::protocol_serde::shape_http_prefix_headers_input::de_foo_map_inner(values).map(|v| (key.to_string(), v.expect(
   25     31   
                                "we have checked there is at least one value for this header name; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues"
   26     32   
                            )))
   27     33   
                        }).collect();
          34  +
    /* HttpBindingGenerator.kt:211 */
   28     35   
    out.map(Some)
          36  +
    /* HttpBindingGenerator.kt:184 */
   29     37   
}
   30     38   
          39  +
/* HttpBindingGenerator.kt:173 */
   31     40   
pub fn de_foo_map_inner<'a>(
   32     41   
    headers: impl ::std::iter::Iterator<Item = &'a str>,
   33     42   
) -> std::result::Result<Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
          43  +
    /* HttpBindingGenerator.kt:375 */
   34     44   
    ::aws_smithy_http::header::one_or_none(headers)
          45  +
    /* HttpBindingGenerator.kt:173 */
   35     46   
}

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

@@ -1,1 +20,28 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_http_prefix_headers_output_output_output(
    3      4   
    value: &crate::output::HttpPrefixHeadersOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_http_prefix_headers_output::ser_http_prefix_headers_output_output(
    8     11   
        &mut object,
    9     12   
        value,
   10     13   
    )?;
          14  +
    /* JsonSerializerGenerator.kt:227 */
   11     15   
    object.finish();
   12     16   
    Ok(out)
          17  +
    /* JsonSerializerGenerator.kt:213 */
   13     18   
}
   14     19   
          20  +
/* JsonSerializerGenerator.kt:358 */
   15     21   
pub fn ser_http_prefix_headers_output_output(
   16     22   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    #[allow(unused_variables)] input: &crate::output::HttpPrefixHeadersOutput,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:372 */
   19     26   
    Ok(())
          27  +
    /* JsonSerializerGenerator.kt:358 */
   20     28   
}

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

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

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

@@ -1,1 +20,28 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
    2      3   
pub fn de_float(
    3      4   
    value: &str,
    4      5   
) -> std::result::Result<
    5      6   
    f32,
    6      7   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    7      8   
> {
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1347 */
    8     10   
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
          11  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
    9     12   
    Ok(value)
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   10     14   
}
   11     15   
          16  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
   12     17   
pub fn de_double(
   13     18   
    value: &str,
   14     19   
) -> std::result::Result<
   15     20   
    f64,
   16     21   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
   17     22   
> {
          23  +
    /* ServerHttpBoundProtocolGenerator.kt:1347 */
   18     24   
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
          25  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   19     26   
    Ok(value)
          27  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   20     28   
}

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

@@ -1,1 +151,204 @@
    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_http_request_with_greedy_label_in_path_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::HttpRequestWithGreedyLabelInPathInput,
    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::http_request_with_greedy_label_in_path_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, (_, _, m2, _, m4)) =
   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   
                        "HttpRequestWithGreedyLabelInPath",
   30     39   
                    ),
   31     40   
                ),
   32     41   
                ::nom::sequence::preceded(
   33     42   
                    ::nom::bytes::complete::tag("/"),
   34     43   
                    ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>("foo"),
   35     44   
                ),
   36     45   
                ::nom::sequence::preceded(
   37     46   
                    ::nom::bytes::complete::tag("/"),
   38     47   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   39     48   
                        ::nom::bytes::complete::take_until("/"),
   40     49   
                        ::nom::combinator::rest,
   41     50   
                    )),
   42     51   
                ),
   43     52   
                ::nom::sequence::preceded(
   44     53   
                    ::nom::bytes::complete::tag("/"),
   45     54   
                    ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>("baz"),
   46     55   
                ),
   47     56   
                ::nom::sequence::preceded(
   48     57   
                    ::nom::bytes::complete::tag("/"),
   49     58   
                    ::nom::combinator::rest::<_, ::nom::error::Error<&str>>,
   50     59   
                ),
   51     60   
            ))(input_string)?;
   52     61   
        debug_assert_eq!("", input_string);
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   53     63   
        input = input.set_foo(
   54     64   
            crate::protocol_serde::shape_http_request_with_greedy_label_in_path_input::de_foo(m2)?,
   55     65   
        );
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   56     67   
        input = input.set_baz(
   57     68   
            crate::protocol_serde::shape_http_request_with_greedy_label_in_path_input::de_baz(m4)?,
   58     69   
        );
          70  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   59     71   
        input.build()?
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   60     73   
    })
          74  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   61     75   
}
   62     76   
          77  +
/* RustType.kt:516 */
   63     78   
#[allow(clippy::unnecessary_wraps)]
          79  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   64     80   
pub fn ser_http_request_with_greedy_label_in_path_http_response(
   65     81   
    #[allow(unused_variables)] output: crate::output::HttpRequestWithGreedyLabelInPathOutput,
   66     82   
) -> std::result::Result<
   67     83   
    ::aws_smithy_http_server::response::Response,
   68     84   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   69     85   
> {
          86  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   70     87   
    Ok({
          88  +
        /* RustType.kt:516 */
   71     89   
        #[allow(unused_mut)]
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   72     91   
        let mut builder = ::http::Response::builder();
          92  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   73     93   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   74     94   
            builder,
   75     95   
            ::http::header::CONTENT_TYPE,
   76     96   
            "application/json",
   77     97   
        );
          98  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   78     99   
        let http_status: u16 = 200;
   79    100   
        builder = builder.status(http_status);
   80         -
        let payload = "";
         101  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
         102  +
        let payload =
         103  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
         104  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
         105  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   81    106   
        let content_length = payload.len();
   82    107   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   83    108   
            builder,
   84    109   
            ::http::header::CONTENT_LENGTH,
   85    110   
            content_length,
   86    111   
        );
         112  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   87    113   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
         114  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   88    115   
        builder.body(body)?
         116  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   89    117   
    })
         118  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   90    119   
}
   91    120   
         121  +
/* RustType.kt:516 */
   92    122   
#[allow(clippy::unnecessary_wraps)]
         123  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   93    124   
pub fn ser_http_request_with_greedy_label_in_path_http_error(
   94    125   
    error: &crate::error::HttpRequestWithGreedyLabelInPathError,
   95    126   
) -> std::result::Result<
   96    127   
    ::aws_smithy_http_server::response::Response,
   97    128   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   98    129   
> {
         130  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   99    131   
    Ok({
         132  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
  100    133   
        match error {
         134  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  101    135   
            crate::error::HttpRequestWithGreedyLabelInPathError::ValidationException(output) => {
         136  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  102    137   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         138  +
                /* RustType.kt:516 */
  103    139   
                #[allow(unused_mut)]
         140  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  104    141   
                let mut builder = ::http::Response::builder();
         142  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  105    143   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  106    144   
                    builder,
  107    145   
                    ::http::header::CONTENT_TYPE,
  108    146   
                    "application/json",
  109    147   
                );
         148  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  110    149   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  111    150   
                    builder,
  112    151   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  113    152   
                    "ValidationException",
  114    153   
                );
         154  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  115    155   
                let content_length = payload.len();
  116    156   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  117    157   
                    builder,
  118    158   
                    ::http::header::CONTENT_LENGTH,
  119    159   
                    content_length,
  120    160   
                );
         161  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  121    162   
                builder
  122    163   
                    .status(400)
  123    164   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         165  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
  124    166   
            }
         167  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  125    168   
            crate::error::HttpRequestWithGreedyLabelInPathError::InternalServerError(output) => {
         169  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  126    170   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         171  +
                /* RustType.kt:516 */
  127    172   
                #[allow(unused_mut)]
         173  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  128    174   
                let mut builder = ::http::Response::builder();
         175  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  129    176   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  130    177   
                    builder,
  131    178   
                    ::http::header::CONTENT_TYPE,
  132    179   
                    "application/json",
  133    180   
                );
         181  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  134    182   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  135    183   
                    builder,
  136    184   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  137    185   
                    "InternalServerError",
  138    186   
                );
         187  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  139    188   
                let content_length = payload.len();
  140    189   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  141    190   
                    builder,
  142    191   
                    ::http::header::CONTENT_LENGTH,
  143    192   
                    content_length,
  144    193   
                );
         194  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  145    195   
                builder
  146    196   
                    .status(500)
  147    197   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         198  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         199  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  148    200   
        }
  149         -
        }
         201  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  150    202   
    })
         203  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  151    204   
}

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

@@ -1,1 +24,32 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
    2      3   
pub fn de_foo(
    3      4   
    value: &str,
    4      5   
) -> std::result::Result<
    5      6   
    ::std::string::String,
    6      7   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    7      8   
> {
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1302 */
    8     10   
    let value = ::percent_encoding::percent_decode_str(value)
    9     11   
        .decode_utf8()?
   10     12   
        .into_owned();
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   11     14   
    Ok(value)
          15  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   12     16   
}
   13     17   
          18  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
   14     19   
pub fn de_baz(
   15     20   
    value: &str,
   16     21   
) -> std::result::Result<
   17     22   
    ::std::string::String,
   18     23   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
   19     24   
> {
          25  +
    /* ServerHttpBoundProtocolGenerator.kt:1302 */
   20     26   
    let value = ::percent_encoding::percent_decode_str(value)
   21     27   
        .decode_utf8()?
   22     28   
        .into_owned();
          29  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   23     30   
    Ok(value)
          31  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   24     32   
}

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

@@ -1,1 +52,61 @@
    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_http_request_with_labels_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::HttpRequestWithLabelsInput,
    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::http_request_with_labels_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:986 */
   22     30   
        let input_string = uri.path();
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:998 */
   23     32   
        let (input_string, (_, m1, m2, m3, m4, m5, m6, m7, m8)) =
   24     33   
            ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
   25     34   
                ::nom::sequence::preceded(
   26     35   
                    ::nom::bytes::complete::tag("/"),
   27     36   
                    ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>(
   28     37   
                        "HttpRequestWithLabels",
   29     38   
                    ),
   30     39   
                ),
   31     40   
                ::nom::sequence::preceded(
   32     41   
                    ::nom::bytes::complete::tag("/"),
@@ -59,68 +202,261 @@
   79     88   
                ),
   80     89   
                ::nom::sequence::preceded(
   81     90   
                    ::nom::bytes::complete::tag("/"),
   82     91   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   83     92   
                        ::nom::bytes::complete::take_until("/"),
   84     93   
                        ::nom::combinator::rest,
   85     94   
                    )),
   86     95   
                ),
   87     96   
            ))(input_string)?;
   88     97   
        debug_assert_eq!("", input_string);
          98  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   89     99   
        input = input.set_string(
   90    100   
            crate::protocol_serde::shape_http_request_with_labels_input::de_string(m1)?,
   91    101   
        );
         102  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   92    103   
        input = input
   93    104   
            .set_short(crate::protocol_serde::shape_http_request_with_labels_input::de_short(m2)?);
         105  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   94    106   
        input = input.set_integer(
   95    107   
            crate::protocol_serde::shape_http_request_with_labels_input::de_integer(m3)?,
   96    108   
        );
         109  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   97    110   
        input = input
   98    111   
            .set_long(crate::protocol_serde::shape_http_request_with_labels_input::de_long(m4)?);
         112  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   99    113   
        input = input
  100    114   
            .set_float(crate::protocol_serde::shape_http_request_with_labels_input::de_float(m5)?);
         115  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
  101    116   
        input = input.set_double(
  102    117   
            crate::protocol_serde::shape_http_request_with_labels_input::de_double(m6)?,
  103    118   
        );
         119  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
  104    120   
        input = input.set_boolean(
  105    121   
            crate::protocol_serde::shape_http_request_with_labels_input::de_boolean(m7)?,
  106    122   
        );
         123  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
  107    124   
        input = input.set_timestamp(
  108    125   
            crate::protocol_serde::shape_http_request_with_labels_input::de_timestamp(m8)?,
  109    126   
        );
         127  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
  110    128   
        input.build()?
         129  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
  111    130   
    })
         131  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
  112    132   
}
  113    133   
         134  +
/* RustType.kt:516 */
  114    135   
#[allow(clippy::unnecessary_wraps)]
         136  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
  115    137   
pub fn ser_http_request_with_labels_http_response(
  116    138   
    #[allow(unused_variables)] output: crate::output::HttpRequestWithLabelsOutput,
  117    139   
) -> std::result::Result<
  118    140   
    ::aws_smithy_http_server::response::Response,
  119    141   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
  120    142   
> {
         143  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
  121    144   
    Ok({
         145  +
        /* RustType.kt:516 */
  122    146   
        #[allow(unused_mut)]
         147  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
  123    148   
        let mut builder = ::http::Response::builder();
         149  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
  124    150   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
  125    151   
            builder,
  126    152   
            ::http::header::CONTENT_TYPE,
  127    153   
            "application/json",
  128    154   
        );
         155  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
  129    156   
        let http_status: u16 = 200;
  130    157   
        builder = builder.status(http_status);
  131         -
        let payload = "";
         158  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
         159  +
        let payload =
         160  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
         161  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
         162  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
  132    163   
        let content_length = payload.len();
  133    164   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
  134    165   
            builder,
  135    166   
            ::http::header::CONTENT_LENGTH,
  136    167   
            content_length,
  137    168   
        );
         169  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
  138    170   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
         171  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
  139    172   
        builder.body(body)?
         173  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
  140    174   
    })
         175  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
  141    176   
}
  142    177   
         178  +
/* RustType.kt:516 */
  143    179   
#[allow(clippy::unnecessary_wraps)]
         180  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
  144    181   
pub fn ser_http_request_with_labels_http_error(
  145    182   
    error: &crate::error::HttpRequestWithLabelsError,
  146    183   
) -> std::result::Result<
  147    184   
    ::aws_smithy_http_server::response::Response,
  148    185   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
  149    186   
> {
         187  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
  150    188   
    Ok({
         189  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
  151    190   
        match error {
         191  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  152    192   
            crate::error::HttpRequestWithLabelsError::ValidationException(output) => {
         193  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  153    194   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         195  +
                /* RustType.kt:516 */
  154    196   
                #[allow(unused_mut)]
         197  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  155    198   
                let mut builder = ::http::Response::builder();
         199  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  156    200   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  157    201   
                    builder,
  158    202   
                    ::http::header::CONTENT_TYPE,
  159    203   
                    "application/json",
  160    204   
                );
         205  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  161    206   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  162    207   
                    builder,
  163    208   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  164    209   
                    "ValidationException",
  165    210   
                );
         211  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  166    212   
                let content_length = payload.len();
  167    213   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  168    214   
                    builder,
  169    215   
                    ::http::header::CONTENT_LENGTH,
  170    216   
                    content_length,
  171    217   
                );
         218  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  172    219   
                builder
  173    220   
                    .status(400)
  174    221   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         222  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
  175    223   
            }
         224  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  176    225   
            crate::error::HttpRequestWithLabelsError::InternalServerError(output) => {
         226  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  177    227   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         228  +
                /* RustType.kt:516 */
  178    229   
                #[allow(unused_mut)]
         230  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  179    231   
                let mut builder = ::http::Response::builder();
         232  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  180    233   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  181    234   
                    builder,
  182    235   
                    ::http::header::CONTENT_TYPE,
  183    236   
                    "application/json",
  184    237   
                );
         238  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  185    239   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  186    240   
                    builder,
  187    241   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  188    242   
                    "InternalServerError",
  189    243   
                );
         244  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  190    245   
                let content_length = payload.len();
  191    246   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  192    247   
                    builder,
  193    248   
                    ::http::header::CONTENT_LENGTH,
  194    249   
                    content_length,
  195    250   
                );
         251  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  196    252   
                builder
  197    253   
                    .status(500)
  198    254   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         255  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         256  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  199    257   
        }
  200         -
        }
         258  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  201    259   
    })
         260  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  202    261   
}

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

@@ -1,1 +199,256 @@
    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_http_request_with_labels_and_timestamp_format_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::HttpRequestWithLabelsAndTimestampFormatInput,
    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)]
   17         -
        let mut input = crate::input::http_request_with_labels_and_timestamp_format_input_internal::Builder::default();
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */let mut input = crate::input::http_request_with_labels_and_timestamp_format_input_internal::Builder::default();
          22  +
        /* RustType.kt:516 */
   18     23   
        #[allow(unused_variables)]
          24  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     25   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     26   
            uri, headers, body, ..
   21     27   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          28  +
        /* ServerHttpBoundProtocolGenerator.kt:986 */
   22     29   
        let input_string = uri.path();
          30  +
        /* ServerHttpBoundProtocolGenerator.kt:998 */
   23     31   
        let (input_string, (_, m1, m2, m3, m4, m5, m6, m7)) =
   24     32   
            ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
   25     33   
                ::nom::sequence::preceded(
   26     34   
                    ::nom::bytes::complete::tag("/"),
   27     35   
                    ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>(
   28     36   
                        "HttpRequestWithLabelsAndTimestampFormat",
   29     37   
                    ),
   30     38   
                ),
   31     39   
                ::nom::sequence::preceded(
   32     40   
                    ::nom::bytes::complete::tag("/"),
   33     41   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   34     42   
                        ::nom::bytes::complete::take_until("/"),
   35     43   
                        ::nom::combinator::rest,
   36     44   
                    )),
   37     45   
                ),
   38     46   
                ::nom::sequence::preceded(
   39     47   
                    ::nom::bytes::complete::tag("/"),
   40     48   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   41     49   
                        ::nom::bytes::complete::take_until("/"),
   42     50   
                        ::nom::combinator::rest,
   43     51   
                    )),
   44     52   
                ),
   45     53   
                ::nom::sequence::preceded(
   46     54   
                    ::nom::bytes::complete::tag("/"),
   47     55   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   48     56   
                        ::nom::bytes::complete::take_until("/"),
   49     57   
                        ::nom::combinator::rest,
   50     58   
                    )),
   51     59   
                ),
   52     60   
                ::nom::sequence::preceded(
   53     61   
                    ::nom::bytes::complete::tag("/"),
   54     62   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   55     63   
                        ::nom::bytes::complete::take_until("/"),
   56     64   
                        ::nom::combinator::rest,
   57     65   
                    )),
   58     66   
                ),
   59     67   
                ::nom::sequence::preceded(
   60     68   
                    ::nom::bytes::complete::tag("/"),
   61     69   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   62     70   
                        ::nom::bytes::complete::take_until("/"),
   63     71   
                        ::nom::combinator::rest,
   64     72   
                    )),
   65     73   
                ),
   66     74   
                ::nom::sequence::preceded(
   67     75   
                    ::nom::bytes::complete::tag("/"),
   68     76   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   69     77   
                        ::nom::bytes::complete::take_until("/"),
   70     78   
                        ::nom::combinator::rest,
   71     79   
                    )),
   72     80   
                ),
   73     81   
                ::nom::sequence::preceded(
   74     82   
                    ::nom::bytes::complete::tag("/"),
   75     83   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   76     84   
                        ::nom::bytes::complete::take_until("/"),
   77     85   
                        ::nom::combinator::rest,
   78     86   
                    )),
   79     87   
                ),
   80     88   
            ))(input_string)?;
   81     89   
        debug_assert_eq!("", input_string);
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   82     91   
        input = input.set_member_epoch_seconds(
   83     92   
                                        crate::protocol_serde::shape_http_request_with_labels_and_timestamp_format_input::de_member_epoch_seconds(m1)?
   84     93   
                                    );
          94  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   85     95   
        input = input.set_member_http_date(
   86     96   
                                        crate::protocol_serde::shape_http_request_with_labels_and_timestamp_format_input::de_member_http_date(m2)?
   87     97   
                                    );
          98  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   88     99   
        input = input.set_member_date_time(
   89    100   
                                        crate::protocol_serde::shape_http_request_with_labels_and_timestamp_format_input::de_member_date_time(m3)?
   90    101   
                                    );
         102  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   91    103   
        input = input.set_default_format(
   92    104   
                                        crate::protocol_serde::shape_http_request_with_labels_and_timestamp_format_input::de_default_format(m4)?
   93    105   
                                    );
         106  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   94    107   
        input = input.set_target_epoch_seconds(
   95    108   
                                        crate::protocol_serde::shape_http_request_with_labels_and_timestamp_format_input::de_target_epoch_seconds(m5)?
   96    109   
                                    );
         110  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   97    111   
        input = input.set_target_http_date(
   98    112   
                                        crate::protocol_serde::shape_http_request_with_labels_and_timestamp_format_input::de_target_http_date(m6)?
   99    113   
                                    );
         114  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
  100    115   
        input = input.set_target_date_time(
  101    116   
                                        crate::protocol_serde::shape_http_request_with_labels_and_timestamp_format_input::de_target_date_time(m7)?
  102    117   
                                    );
         118  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
  103    119   
        input.build()?
         120  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
  104    121   
    })
         122  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
  105    123   
}
  106    124   
         125  +
/* RustType.kt:516 */
  107    126   
#[allow(clippy::unnecessary_wraps)]
         127  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
  108    128   
pub fn ser_http_request_with_labels_and_timestamp_format_http_response(
  109    129   
    #[allow(unused_variables)] output: crate::output::HttpRequestWithLabelsAndTimestampFormatOutput,
  110    130   
) -> std::result::Result<
  111    131   
    ::aws_smithy_http_server::response::Response,
  112    132   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
  113    133   
> {
         134  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
  114    135   
    Ok({
         136  +
        /* RustType.kt:516 */
  115    137   
        #[allow(unused_mut)]
         138  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
  116    139   
        let mut builder = ::http::Response::builder();
         140  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
  117    141   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
  118    142   
            builder,
  119    143   
            ::http::header::CONTENT_TYPE,
  120    144   
            "application/json",
  121    145   
        );
         146  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
  122    147   
        let http_status: u16 = 200;
  123    148   
        builder = builder.status(http_status);
  124         -
        let payload = "";
         149  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
         150  +
        let payload =
         151  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
         152  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
         153  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
  125    154   
        let content_length = payload.len();
  126    155   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
  127    156   
            builder,
  128    157   
            ::http::header::CONTENT_LENGTH,
  129    158   
            content_length,
  130    159   
        );
         160  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
  131    161   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
         162  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
  132    163   
        builder.body(body)?
         164  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
  133    165   
    })
         166  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
  134    167   
}
  135    168   
         169  +
/* RustType.kt:516 */
  136    170   
#[allow(clippy::unnecessary_wraps)]
         171  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
  137    172   
pub fn ser_http_request_with_labels_and_timestamp_format_http_error(
  138    173   
    error: &crate::error::HttpRequestWithLabelsAndTimestampFormatError,
  139    174   
) -> std::result::Result<
  140    175   
    ::aws_smithy_http_server::response::Response,
  141    176   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
  142    177   
> {
         178  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
  143    179   
    Ok({
         180  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
  144    181   
        match error {
         182  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  145    183   
            crate::error::HttpRequestWithLabelsAndTimestampFormatError::ValidationException(
  146    184   
                output,
  147    185   
            ) => {
         186  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  148    187   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         188  +
                /* RustType.kt:516 */
  149    189   
                #[allow(unused_mut)]
         190  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  150    191   
                let mut builder = ::http::Response::builder();
         192  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  151    193   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  152    194   
                    builder,
  153    195   
                    ::http::header::CONTENT_TYPE,
  154    196   
                    "application/json",
  155    197   
                );
         198  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  156    199   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  157    200   
                    builder,
  158    201   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  159    202   
                    "ValidationException",
  160    203   
                );
         204  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  161    205   
                let content_length = payload.len();
  162    206   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  163    207   
                    builder,
  164    208   
                    ::http::header::CONTENT_LENGTH,
  165    209   
                    content_length,
  166    210   
                );
         211  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  167    212   
                builder
  168    213   
                    .status(400)
  169    214   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         215  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
  170    216   
            }
         217  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  171    218   
            crate::error::HttpRequestWithLabelsAndTimestampFormatError::InternalServerError(
  172    219   
                output,
  173    220   
            ) => {
         221  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  174    222   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         223  +
                /* RustType.kt:516 */
  175    224   
                #[allow(unused_mut)]
         225  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  176    226   
                let mut builder = ::http::Response::builder();
         227  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  177    228   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  178    229   
                    builder,
  179    230   
                    ::http::header::CONTENT_TYPE,
  180    231   
                    "application/json",
  181    232   
                );
         233  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  182    234   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  183    235   
                    builder,
  184    236   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  185    237   
                    "InternalServerError",
  186    238   
                );
         239  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  187    240   
                let content_length = payload.len();
  188    241   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  189    242   
                    builder,
  190    243   
                    ::http::header::CONTENT_LENGTH,
  191    244   
                    content_length,
  192    245   
                );
         246  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  193    247   
                builder
  194    248   
                    .status(500)
  195    249   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         250  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         251  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  196    252   
        }
  197         -
        }
         253  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  198    254   
    })
         255  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  199    256   
}

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

@@ -1,1 +105,119 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
    2      3   
pub fn de_member_epoch_seconds(
    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   
}
   16     18   
          19  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
   17     20   
pub fn de_member_http_date(
   18     21   
    value: &str,
   19     22   
) -> std::result::Result<
   20     23   
    ::aws_smithy_http_server_python::types::DateTime,
   21     24   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
   22     25   
> {
          26  +
    /* ServerHttpBoundProtocolGenerator.kt:1323 */
   23     27   
    let value = ::percent_encoding::percent_decode_str(value).decode_utf8()?;
   24         -
    let value = ::aws_smithy_types::DateTime::from_str(
   25         -
        value.as_ref(),
   26         -
        ::aws_smithy_types::date_time::Format::HttpDate,
   27         -
    )?
   28         -
    .into();
          28  +
    let value = ::aws_smithy_types::DateTime::from_str(value.as_ref(), ::aws_smithy_types::date_time::Format::HttpDate)?
          29  +
    /* PythonServerProtocolLoader.kt:68 */.into()
          30  +
    /* ServerHttpBoundProtocolGenerator.kt:1343 */;
          31  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   29     32   
    Ok(value)
          33  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   30     34   
}
   31     35   
          36  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
   32     37   
pub fn de_member_date_time(
   33     38   
    value: &str,
   34     39   
) -> std::result::Result<
   35     40   
    ::aws_smithy_http_server_python::types::DateTime,
   36     41   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
   37     42   
> {
          43  +
    /* ServerHttpBoundProtocolGenerator.kt:1323 */
   38     44   
    let value = ::percent_encoding::percent_decode_str(value).decode_utf8()?;
   39         -
    let value = ::aws_smithy_types::DateTime::from_str(
   40         -
        value.as_ref(),
   41         -
        ::aws_smithy_types::date_time::Format::DateTime,
   42         -
    )?
   43         -
    .into();
          45  +
    let value = ::aws_smithy_types::DateTime::from_str(value.as_ref(), ::aws_smithy_types::date_time::Format::DateTime)?
          46  +
    /* PythonServerProtocolLoader.kt:68 */.into()
          47  +
    /* ServerHttpBoundProtocolGenerator.kt:1343 */;
          48  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   44     49   
    Ok(value)
          50  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   45     51   
}
   46     52   
          53  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
   47     54   
pub fn de_default_format(
   48     55   
    value: &str,
   49     56   
) -> std::result::Result<
   50     57   
    ::aws_smithy_http_server_python::types::DateTime,
   51     58   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
   52     59   
> {
          60  +
    /* ServerHttpBoundProtocolGenerator.kt:1323 */
   53     61   
    let value = ::percent_encoding::percent_decode_str(value).decode_utf8()?;
   54         -
    let value = ::aws_smithy_types::DateTime::from_str(
   55         -
        value.as_ref(),
   56         -
        ::aws_smithy_types::date_time::Format::DateTime,
   57         -
    )?
   58         -
    .into();
          62  +
    let value = ::aws_smithy_types::DateTime::from_str(value.as_ref(), ::aws_smithy_types::date_time::Format::DateTime)?
          63  +
    /* PythonServerProtocolLoader.kt:68 */.into()
          64  +
    /* ServerHttpBoundProtocolGenerator.kt:1343 */;
          65  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   59     66   
    Ok(value)
          67  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   60     68   
}
   61     69   
          70  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
   62     71   
pub fn de_target_epoch_seconds(
   63     72   
    value: &str,
   64     73   
) -> std::result::Result<
   65     74   
    ::aws_smithy_http_server_python::types::DateTime,
   66     75   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
   67     76   
> {
          77  +
    /* ServerHttpBoundProtocolGenerator.kt:1323 */
   68     78   
    let value = ::percent_encoding::percent_decode_str(value).decode_utf8()?;
   69         -
    let value = ::aws_smithy_types::DateTime::from_str(
   70         -
        value.as_ref(),
   71         -
        ::aws_smithy_types::date_time::Format::EpochSeconds,
   72         -
    )?
   73         -
    .into();
          79  +
    let value = ::aws_smithy_types::DateTime::from_str(value.as_ref(), ::aws_smithy_types::date_time::Format::EpochSeconds)?
          80  +
    /* PythonServerProtocolLoader.kt:68 */.into()
          81  +
    /* ServerHttpBoundProtocolGenerator.kt:1343 */;
          82  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   74     83   
    Ok(value)
          84  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   75     85   
}
   76     86   
          87  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
   77     88   
pub fn de_target_http_date(
   78     89   
    value: &str,
   79     90   
) -> std::result::Result<
   80     91   
    ::aws_smithy_http_server_python::types::DateTime,
   81     92   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
   82     93   
> {
          94  +
    /* ServerHttpBoundProtocolGenerator.kt:1323 */
   83     95   
    let value = ::percent_encoding::percent_decode_str(value).decode_utf8()?;
   84         -
    let value = ::aws_smithy_types::DateTime::from_str(
   85         -
        value.as_ref(),
   86         -
        ::aws_smithy_types::date_time::Format::HttpDate,
   87         -
    )?
   88         -
    .into();
          96  +
    let value = ::aws_smithy_types::DateTime::from_str(value.as_ref(), ::aws_smithy_types::date_time::Format::HttpDate)?
          97  +
    /* PythonServerProtocolLoader.kt:68 */.into()
          98  +
    /* ServerHttpBoundProtocolGenerator.kt:1343 */;
          99  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   89    100   
    Ok(value)
         101  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   90    102   
}
   91    103   
         104  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
   92    105   
pub fn de_target_date_time(
   93    106   
    value: &str,
   94    107   
) -> std::result::Result<
   95    108   
    ::aws_smithy_http_server_python::types::DateTime,
   96    109   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
   97    110   
> {
         111  +
    /* ServerHttpBoundProtocolGenerator.kt:1323 */
   98    112   
    let value = ::percent_encoding::percent_decode_str(value).decode_utf8()?;
   99         -
    let value = ::aws_smithy_types::DateTime::from_str(
  100         -
        value.as_ref(),
  101         -
        ::aws_smithy_types::date_time::Format::DateTime,
  102         -
    )?
  103         -
    .into();
         113  +
    let value = ::aws_smithy_types::DateTime::from_str(value.as_ref(), ::aws_smithy_types::date_time::Format::DateTime)?
         114  +
    /* PythonServerProtocolLoader.kt:68 */.into()
         115  +
    /* ServerHttpBoundProtocolGenerator.kt:1343 */;
         116  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
  104    117   
    Ok(value)
         118  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
  105    119   
}

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

@@ -1,1 +87,117 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
    2      3   
pub fn de_string(
    3      4   
    value: &str,
    4      5   
) -> std::result::Result<
    5      6   
    ::std::string::String,
    6      7   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    7      8   
> {
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1302 */
    8     10   
    let value = ::percent_encoding::percent_decode_str(value)
    9     11   
        .decode_utf8()?
   10     12   
        .into_owned();
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   11     14   
    Ok(value)
          15  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   12     16   
}
   13     17   
          18  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
   14     19   
pub fn de_short(
   15     20   
    value: &str,
   16     21   
) -> std::result::Result<
   17     22   
    i16,
   18     23   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
   19     24   
> {
          25  +
    /* ServerHttpBoundProtocolGenerator.kt:1347 */
   20     26   
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
          27  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   21     28   
    Ok(value)
          29  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   22     30   
}
   23     31   
          32  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
   24     33   
pub fn de_integer(
   25     34   
    value: &str,
   26     35   
) -> std::result::Result<
   27     36   
    i32,
   28     37   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
   29     38   
> {
          39  +
    /* ServerHttpBoundProtocolGenerator.kt:1347 */
   30     40   
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
          41  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   31     42   
    Ok(value)
          43  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   32     44   
}
   33     45   
          46  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
   34     47   
pub fn de_long(
   35     48   
    value: &str,
   36     49   
) -> std::result::Result<
   37     50   
    i64,
   38     51   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
   39     52   
> {
          53  +
    /* ServerHttpBoundProtocolGenerator.kt:1347 */
   40     54   
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
          55  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   41     56   
    Ok(value)
          57  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   42     58   
}
   43     59   
          60  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
   44     61   
pub fn de_float(
   45     62   
    value: &str,
   46     63   
) -> std::result::Result<
   47     64   
    f32,
   48     65   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
   49     66   
> {
          67  +
    /* ServerHttpBoundProtocolGenerator.kt:1347 */
   50     68   
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
          69  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   51     70   
    Ok(value)
          71  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   52     72   
}
   53     73   
          74  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
   54     75   
pub fn de_double(
   55     76   
    value: &str,
   56     77   
) -> std::result::Result<
   57     78   
    f64,
   58     79   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
   59     80   
> {
          81  +
    /* ServerHttpBoundProtocolGenerator.kt:1347 */
   60     82   
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
          83  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   61     84   
    Ok(value)
          85  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   62     86   
}
   63     87   
          88  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
   64     89   
pub fn de_boolean(
   65     90   
    value: &str,
   66     91   
) -> std::result::Result<
   67     92   
    bool,
   68     93   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
   69     94   
> {
          95  +
    /* ServerHttpBoundProtocolGenerator.kt:1347 */
   70     96   
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
          97  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   71     98   
    Ok(value)
          99  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   72    100   
}
   73    101   
         102  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
   74    103   
pub fn de_timestamp(
   75    104   
    value: &str,
   76    105   
) -> std::result::Result<
   77    106   
    ::aws_smithy_http_server_python::types::DateTime,
   78    107   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
   79    108   
> {
         109  +
    /* ServerHttpBoundProtocolGenerator.kt:1323 */
   80    110   
    let value = ::percent_encoding::percent_decode_str(value).decode_utf8()?;
   81         -
    let value = ::aws_smithy_types::DateTime::from_str(
   82         -
        value.as_ref(),
   83         -
        ::aws_smithy_types::date_time::Format::DateTime,
   84         -
    )?
   85         -
    .into();
         111  +
    let value = ::aws_smithy_types::DateTime::from_str(value.as_ref(), ::aws_smithy_types::date_time::Format::DateTime)?
         112  +
    /* PythonServerProtocolLoader.kt:68 */.into()
         113  +
    /* ServerHttpBoundProtocolGenerator.kt:1343 */;
         114  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   86    115   
    Ok(value)
         116  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   87    117   
}

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

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

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

@@ -1,1 +12,16 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
    2      3   
pub fn de_str(
    3      4   
    value: &str,
    4      5   
) -> std::result::Result<
    5      6   
    ::std::string::String,
    6      7   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    7      8   
> {
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1302 */
    8     10   
    let value = ::percent_encoding::percent_decode_str(value)
    9     11   
        .decode_utf8()?
   10     12   
        .into_owned();
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   11     14   
    Ok(value)
          15  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   12     16   
}