Server Test

Server Test

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943 (ignoring whitespace)

Files changed:

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

@@ -1,1 +119,159 @@
    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::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  +
/* HttpBindingGenerator.kt:542 */
   73    100   
pub fn ser_http_prefix_headers_headers(
   74    101   
    input: &crate::output::HttpPrefixHeadersOutput,
   75    102   
    mut builder: ::http::response::Builder,
   76    103   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
   77    104   
{
         105  +
    /* HttpBindingGenerator.kt:592 */
   78    106   
    if let ::std::option::Option::Some(inner_1) = &input.foo {
         107  +
        /* HttpBindingGenerator.kt:704 */
   79    108   
        let formatted_2 = inner_1.as_str();
         109  +
        /* HttpBindingGenerator.kt:705 */
   80    110   
        if !formatted_2.is_empty() {
         111  +
            /* HttpBindingGenerator.kt:706 */
   81    112   
            let header_value = formatted_2;
   82    113   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   83    114   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   84    115   
                    "foo",
   85    116   
                    format!(
   86    117   
                        "`{}` cannot be used as a header value: {}",
   87    118   
                        &header_value, err
   88    119   
                    ),
   89    120   
                )
   90    121   
            })?;
   91    122   
            builder = builder.header("X-Foo", header_value);
         123  +
            /* HttpBindingGenerator.kt:705 */
   92    124   
        }
         125  +
        /* HttpBindingGenerator.kt:592 */
   93    126   
    }
         127  +
    /* HttpBindingGenerator.kt:741 */
   94    128   
    if let ::std::option::Option::Some(inner_3) = &input.foo_map {
         129  +
        /* HttpBindingGenerator.kt:741 */
   95    130   
        {
         131  +
            /* HttpBindingGenerator.kt:747 */
   96    132   
            for (k, v) in inner_3 {
   97    133   
                use std::str::FromStr;
   98    134   
                let header_name =
   99    135   
                    http::header::HeaderName::from_str(&format!("{}{}", "X-Foo-", &k)).map_err(
  100    136   
                        |err| {
  101    137   
                            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  102    138   
                                "foo_map",
  103    139   
                                format!("`{k}` cannot be used as a header name: {err}"),
  104    140   
                            )
  105    141   
                        },
  106    142   
                    )?;
  107    143   
                let header_value = v.as_str();
  108    144   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  109    145   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  110    146   
                        "foo_map",
  111    147   
                        format!("`{}` cannot be used as a header value: {}", v, err),
  112    148   
                    )
  113    149   
                })?;
  114    150   
                builder = builder.header(header_name, header_value);
  115    151   
            }
         152  +
            /* HttpBindingGenerator.kt:741 */
  116    153   
        }
         154  +
        /* HttpBindingGenerator.kt:741 */
  117    155   
    }
         156  +
    /* HttpBindingGenerator.kt:555 */
  118    157   
    Ok(builder)
         158  +
    /* HttpBindingGenerator.kt:542 */
  119    159   
}

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

@@ -1,1 +86,118 @@
    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 = crate::input::http_prefix_headers_in_response_input::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:834 */
   22     30   
        input.build()
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   23     32   
    })
          33  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   24     34   
}
   25     35   
          36  +
/* RustType.kt:516 */
   26     37   
#[allow(clippy::unnecessary_wraps)]
          38  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   27     39   
pub fn ser_http_prefix_headers_in_response_http_response(
   28     40   
    #[allow(unused_variables)] output: crate::output::HttpPrefixHeadersInResponseOutput,
   29     41   
) -> std::result::Result<
   30     42   
    ::aws_smithy_http_server::response::Response,
   31     43   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   32     44   
> {
          45  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   33     46   
    Ok({
          47  +
        /* RustType.kt:516 */
   34     48   
        #[allow(unused_mut)]
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   35     50   
        let mut builder = ::http::Response::builder();
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:629 */
   36     52   
        builder = crate::protocol_serde::shape_http_prefix_headers_in_response::ser_http_prefix_headers_in_response_headers(&output, builder)?;
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   37     54   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   38     55   
            builder,
   39     56   
            ::http::header::CONTENT_TYPE,
   40     57   
            "application/json",
   41     58   
        );
          59  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   42     60   
        let http_status: u16 = 200;
   43     61   
        builder = builder.status(http_status);
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   44     63   
        let payload =
   45         -
            crate::protocol_serde::shape_http_prefix_headers_in_response_output::ser_http_prefix_headers_in_response_output_output_output(&output)?
   46         -
        ;
          64  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_http_prefix_headers_in_response_output::ser_http_prefix_headers_in_response_output_output_output(&output)?
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   47     67   
        let content_length = payload.len();
   48     68   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   49     69   
            builder,
   50     70   
            ::http::header::CONTENT_LENGTH,
   51     71   
            content_length,
   52     72   
        );
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   53     74   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   54     76   
        builder.body(body)?
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   55     78   
    })
          79  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   56     80   
}
   57     81   
          82  +
/* HttpBindingGenerator.kt:542 */
   58     83   
pub fn ser_http_prefix_headers_in_response_headers(
   59     84   
    input: &crate::output::HttpPrefixHeadersInResponseOutput,
   60     85   
    mut builder: ::http::response::Builder,
   61     86   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
   62     87   
{
          88  +
    /* HttpBindingGenerator.kt:741 */
   63     89   
    if let ::std::option::Option::Some(inner_1) = &input.prefix_headers {
          90  +
        /* HttpBindingGenerator.kt:741 */
   64     91   
        {
          92  +
            /* HttpBindingGenerator.kt:747 */
   65     93   
            for (k, v) in inner_1 {
   66     94   
                use std::str::FromStr;
   67     95   
                let header_name = http::header::HeaderName::from_str(&format!("{}{}", "", &k))
   68     96   
                    .map_err(|err| {
   69     97   
                        ::aws_smithy_types::error::operation::BuildError::invalid_field(
   70     98   
                            "prefix_headers",
   71     99   
                            format!("`{k}` cannot be used as a header name: {err}"),
   72    100   
                        )
   73    101   
                    })?;
   74    102   
                let header_value = v.as_str();
   75    103   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   76    104   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
   77    105   
                        "prefix_headers",
   78    106   
                        format!("`{}` cannot be used as a header value: {}", v, err),
   79    107   
                    )
   80    108   
                })?;
   81    109   
                builder = builder.header(header_name, header_value);
   82    110   
            }
         111  +
            /* HttpBindingGenerator.kt:741 */
   83    112   
        }
         113  +
        /* HttpBindingGenerator.kt:741 */
   84    114   
    }
         115  +
    /* HttpBindingGenerator.kt:555 */
   85    116   
    Ok(builder)
         117  +
    /* HttpBindingGenerator.kt:542 */
   86    118   
}

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

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

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

@@ -1,1 +127,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_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::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 */
         166  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  124    167   
        }
  125         -
        }
         168  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  126    169   
    })
         170  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  127    171   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/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/rest_json/rust-server-codegen/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::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 +178,228 @@
   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 */
         223  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  175    224   
        }
  176         -
        }
         225  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  177    226   
    })
         227  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  178    228   
}

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

@@ -1,1 +174,223 @@
    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)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input =
   18     23   
            crate::input::http_request_with_labels_and_timestamp_format_input::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, m3, m4, m5, m6, m7)) =
   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   
                        "HttpRequestWithLabelsAndTimestampFormat",
   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   
                ::nom::sequence::preceded(
   47     56   
                    ::nom::bytes::complete::tag("/"),
   48     57   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   49     58   
                        ::nom::bytes::complete::take_until("/"),
   50     59   
                        ::nom::combinator::rest,
   51     60   
                    )),
   52     61   
                ),
   53     62   
                ::nom::sequence::preceded(
   54     63   
                    ::nom::bytes::complete::tag("/"),
   55     64   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   56     65   
                        ::nom::bytes::complete::take_until("/"),
   57     66   
                        ::nom::combinator::rest,
   58     67   
                    )),
   59     68   
                ),
   60     69   
                ::nom::sequence::preceded(
   61     70   
                    ::nom::bytes::complete::tag("/"),
   62     71   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   63     72   
                        ::nom::bytes::complete::take_until("/"),
   64     73   
                        ::nom::combinator::rest,
   65     74   
                    )),
   66     75   
                ),
   67     76   
                ::nom::sequence::preceded(
   68     77   
                    ::nom::bytes::complete::tag("/"),
   69     78   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   70     79   
                        ::nom::bytes::complete::take_until("/"),
   71     80   
                        ::nom::combinator::rest,
   72     81   
                    )),
   73     82   
                ),
   74     83   
                ::nom::sequence::preceded(
   75     84   
                    ::nom::bytes::complete::tag("/"),
   76     85   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   77     86   
                        ::nom::bytes::complete::take_until("/"),
   78     87   
                        ::nom::combinator::rest,
   79     88   
                    )),
   80     89   
                ),
   81     90   
            ))(input_string)?;
   82     91   
        debug_assert_eq!("", input_string);
          92  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   83     93   
        input = input.set_member_epoch_seconds(
   84     94   
                                        crate::protocol_serde::shape_http_request_with_labels_and_timestamp_format_input::de_member_epoch_seconds(m1)?
   85     95   
                                    );
          96  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   86     97   
        input = input.set_member_http_date(
   87     98   
                                        crate::protocol_serde::shape_http_request_with_labels_and_timestamp_format_input::de_member_http_date(m2)?
   88     99   
                                    );
         100  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   89    101   
        input = input.set_member_date_time(
   90    102   
                                        crate::protocol_serde::shape_http_request_with_labels_and_timestamp_format_input::de_member_date_time(m3)?
   91    103   
                                    );
         104  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   92    105   
        input = input.set_default_format(
   93    106   
                                        crate::protocol_serde::shape_http_request_with_labels_and_timestamp_format_input::de_default_format(m4)?
   94    107   
                                    );
         108  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   95    109   
        input = input.set_target_epoch_seconds(
   96    110   
                                        crate::protocol_serde::shape_http_request_with_labels_and_timestamp_format_input::de_target_epoch_seconds(m5)?
   97    111   
                                    );
         112  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   98    113   
        input = input.set_target_http_date(
   99    114   
                                        crate::protocol_serde::shape_http_request_with_labels_and_timestamp_format_input::de_target_http_date(m6)?
  100    115   
                                    );
         116  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
  101    117   
        input = input.set_target_date_time(
  102    118   
                                        crate::protocol_serde::shape_http_request_with_labels_and_timestamp_format_input::de_target_date_time(m7)?
  103    119   
                                    );
         120  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
  104    121   
        input.build()?
         122  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
  105    123   
    })
         124  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
  106    125   
}
  107    126   
         127  +
/* RustType.kt:516 */
  108    128   
#[allow(clippy::unnecessary_wraps)]
         129  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
  109    130   
pub fn ser_http_request_with_labels_and_timestamp_format_http_response(
  110    131   
    #[allow(unused_variables)] output: crate::output::HttpRequestWithLabelsAndTimestampFormatOutput,
  111    132   
) -> std::result::Result<
  112    133   
    ::aws_smithy_http_server::response::Response,
  113    134   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
  114    135   
> {
         136  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
  115    137   
    Ok({
         138  +
        /* RustType.kt:516 */
  116    139   
        #[allow(unused_mut)]
         140  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
  117    141   
        let mut builder = ::http::Response::builder();
         142  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
  118    143   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
  119    144   
            builder,
  120    145   
            ::http::header::CONTENT_TYPE,
  121    146   
            "application/json",
  122    147   
        );
         148  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
  123    149   
        let http_status: u16 = 200;
  124    150   
        builder = builder.status(http_status);
  125         -
        let payload = "";
         151  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
         152  +
        let payload =
         153  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
         154  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
         155  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
  126    156   
        let content_length = payload.len();
  127    157   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
  128    158   
            builder,
  129    159   
            ::http::header::CONTENT_LENGTH,
  130    160   
            content_length,
  131    161   
        );
         162  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
  132    163   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
         164  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
  133    165   
        builder.body(body)?
         166  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
  134    167   
    })
         168  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
  135    169   
}
  136    170   
         171  +
/* RustType.kt:516 */
  137    172   
#[allow(clippy::unnecessary_wraps)]
         173  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
  138    174   
pub fn ser_http_request_with_labels_and_timestamp_format_http_error(
  139    175   
    error: &crate::error::HttpRequestWithLabelsAndTimestampFormatError,
  140    176   
) -> std::result::Result<
  141    177   
    ::aws_smithy_http_server::response::Response,
  142    178   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
  143    179   
> {
         180  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
  144    181   
    Ok({
         182  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
  145    183   
        match error {
         184  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  146    185   
            crate::error::HttpRequestWithLabelsAndTimestampFormatError::ValidationException(
  147    186   
                output,
  148    187   
            ) => {
         188  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  149    189   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         190  +
                /* RustType.kt:516 */
  150    191   
                #[allow(unused_mut)]
         192  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  151    193   
                let mut builder = ::http::Response::builder();
         194  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  152    195   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  153    196   
                    builder,
  154    197   
                    ::http::header::CONTENT_TYPE,
  155    198   
                    "application/json",
  156    199   
                );
         200  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  157    201   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  158    202   
                    builder,
  159    203   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  160    204   
                    "ValidationException",
  161    205   
                );
         206  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  162    207   
                let content_length = payload.len();
  163    208   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  164    209   
                    builder,
  165    210   
                    ::http::header::CONTENT_LENGTH,
  166    211   
                    content_length,
  167    212   
                );
         213  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  168    214   
                builder
  169    215   
                    .status(400)
  170    216   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         217  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         218  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  171    219   
        }
  172         -
        }
         220  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  173    221   
    })
         222  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  174    223   
}

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

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

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

@@ -1,1 +86,116 @@
    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_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         -
    )?;
         111  +
    let value = ::aws_smithy_types::DateTime::from_str(value.as_ref(), ::aws_smithy_types::date_time::Format::DateTime)?
         112  +
    /* ServerHttpBoundProtocolGenerator.kt:1343 */;
         113  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   85    114   
    Ok(value)
         115  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   86    116   
}

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

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

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/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   
}