Server Test

Server Test

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943

Files changed:

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

@@ -1,1 +10,22 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBoundProtocolPayloadGenerator.kt:311 */
    2      3   
pub fn ser_payload_http_payload(
    3      4   
    payload: ::std::option::Option<::std::string::String>,
    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 {
    6      8   
        Some(t) => t,
    7         -
        None => return Ok(Vec::new()),
           9  +
        None => {
          10  +
            return Ok(
          11  +
                /* HttpBoundProtocolPayloadGenerator.kt:332 */
          12  +
                Vec::new(), /* HttpBoundProtocolPayloadGenerator.kt:320 */
          13  +
            )
          14  +
        }
    8     15   
    };
    9         -
    Ok(payload.into_bytes())
          16  +
    /* HttpBoundProtocolPayloadGenerator.kt:345 */
          17  +
    Ok(
          18  +
        /* HttpBoundProtocolPayloadGenerator.kt:366 */
          19  +
        payload.into_bytes(), /* HttpBoundProtocolPayloadGenerator.kt:345 */
          20  +
    )
          21  +
    /* HttpBoundProtocolPayloadGenerator.kt:311 */
   10     22   
}

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

@@ -1,1 +56,80 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_accept_with_payload_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedAcceptWithPayloadInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::malformed_accept_with_payload_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:811 */
   22     30   
        ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(&headers, None)?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   23     32   
        input.build()
          33  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   24     34   
    })
          35  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   25     36   
}
   26     37   
          38  +
/* RustType.kt:516 */
   27     39   
#[allow(clippy::unnecessary_wraps)]
          40  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   28     41   
pub fn ser_malformed_accept_with_payload_http_response(
   29     42   
    #[allow(unused_variables)] output: crate::output::MalformedAcceptWithPayloadOutput,
   30     43   
) -> std::result::Result<
   31     44   
    ::aws_smithy_http_server::response::Response,
   32     45   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   33     46   
> {
          47  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   34     48   
    Ok({
          49  +
        /* RustType.kt:516 */
   35     50   
        #[allow(unused_mut)]
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   36     52   
        let mut builder = ::http::Response::builder();
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   37     54   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   38     55   
            builder,
   39     56   
            ::http::header::CONTENT_TYPE,
   40     57   
            "image/jpeg",
   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_malformed_accept_with_payload_output::ser_payload_http_payload( output.payload)?
   46         -
        ;
          64  +
            /* HttpBoundProtocolPayloadGenerator.kt:350 */crate::protocol_serde::shape_malformed_accept_with_payload_output::ser_payload_http_payload( output.payload)?
          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   
}

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

@@ -1,1 +10,22 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBoundProtocolPayloadGenerator.kt:311 */
    2      3   
pub fn ser_payload_http_payload(
    3      4   
    payload: ::std::option::Option<::aws_smithy_types::Blob>,
    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 {
    6      8   
        Some(t) => t,
    7         -
        None => return Ok(Vec::new()),
           9  +
        None => {
          10  +
            return Ok(
          11  +
                /* HttpBoundProtocolPayloadGenerator.kt:332 */
          12  +
                Vec::new(), /* HttpBoundProtocolPayloadGenerator.kt:320 */
          13  +
            )
          14  +
        }
    8     15   
    };
    9         -
    Ok(payload.into_inner())
          16  +
    /* HttpBoundProtocolPayloadGenerator.kt:345 */
          17  +
    Ok(
          18  +
        /* HttpBoundProtocolPayloadGenerator.kt:377 */
          19  +
        payload.into_inner(), /* HttpBoundProtocolPayloadGenerator.kt:345 */
          20  +
    )
          21  +
    /* HttpBoundProtocolPayloadGenerator.kt:311 */
   10     22   
}

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

@@ -1,1 +111,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_malformed_blob_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedBlobInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::malformed_blob_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:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_malformed_blob::de_malformed_blob(
   29     39   
                bytes.as_ref(),
   30     40   
                input,
   31     41   
            )?;
          42  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   32     43   
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   33     45   
        input.build()
          46  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   34     47   
    })
          48  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   35     49   
}
   36     50   
          51  +
/* RustType.kt:516 */
   37     52   
#[allow(clippy::unnecessary_wraps)]
          53  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   38     54   
pub fn ser_malformed_blob_http_response(
   39     55   
    #[allow(unused_variables)] output: crate::output::MalformedBlobOutput,
   40     56   
) -> std::result::Result<
   41     57   
    ::aws_smithy_http_server::response::Response,
   42     58   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   43     59   
> {
          60  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   44     61   
    Ok({
          62  +
        /* RustType.kt:516 */
   45     63   
        #[allow(unused_mut)]
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   46     65   
        let mut builder = ::http::Response::builder();
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   47     67   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   48     68   
            builder,
   49     69   
            ::http::header::CONTENT_TYPE,
   50     70   
            "application/json",
   51     71   
        );
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   52     73   
        let http_status: u16 = 200;
   53     74   
        builder = builder.status(http_status);
   54         -
        let payload = "";
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          76  +
        let payload =
          77  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   55     80   
        let content_length = payload.len();
   56     81   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     82   
            builder,
   58     83   
            ::http::header::CONTENT_LENGTH,
   59     84   
            content_length,
   60     85   
        );
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   61     87   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   62     89   
        builder.body(body)?
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   63     91   
    })
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   64     93   
}
   65     94   
          95  +
/* JsonParserGenerator.kt:148 */
   66     96   
pub(crate) fn de_malformed_blob(
   67     97   
    value: &[u8],
   68     98   
    mut builder: crate::input::malformed_blob_input::Builder,
   69     99   
) -> ::std::result::Result<
   70    100   
    crate::input::malformed_blob_input::Builder,
   71    101   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   72    102   
> {
         103  +
    /* JsonParserGenerator.kt:153 */
   73    104   
    let mut tokens_owned =
   74    105   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
   75    106   
            .peekable();
   76    107   
    let tokens = &mut tokens_owned;
   77    108   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         109  +
    /* JsonParserGenerator.kt:684 */
   78    110   
    loop {
         111  +
        /* JsonParserGenerator.kt:685 */
   79    112   
        match tokens.next().transpose()? {
         113  +
            /* JsonParserGenerator.kt:686 */
   80    114   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   81    115   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         116  +
                /* JsonParserGenerator.kt:260 */
   82    117   
                match key.to_unescaped()?.as_ref() {
         118  +
                    /* JsonParserGenerator.kt:262 */
   83    119   
                    "blob" => {
         120  +
                        /* JsonParserGenerator.kt:272 */
   84    121   
                        builder = builder.set_blob(
         122  +
                            /* JsonParserGenerator.kt:326 */
   85    123   
                            ::aws_smithy_json::deserialize::token::expect_blob_or_null(
   86    124   
                                tokens.next(),
   87         -
                            )?,
         125  +
                            )?, /* JsonParserGenerator.kt:272 */
   88    126   
                        );
         127  +
                        /* JsonParserGenerator.kt:262 */
   89    128   
                    }
   90         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         129  +
                    /* JsonParserGenerator.kt:290 */
         130  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   91    131   
                }
         132  +
                /* JsonParserGenerator.kt:686 */
   92    133   
            }
         134  +
            /* JsonParserGenerator.kt:695 */
   93    135   
            other => {
   94    136   
                return Err(
   95    137   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   96    138   
                        "expected object key or end object, found: {:?}",
   97    139   
                        other
   98    140   
                    )),
   99    141   
                )
  100         -
            }
         142  +
            } /* JsonParserGenerator.kt:685 */
  101    143   
        }
         144  +
        /* JsonParserGenerator.kt:684 */
  102    145   
    }
         146  +
    /* JsonParserGenerator.kt:250 */
  103    147   
    if tokens.next().is_some() {
         148  +
        /* JsonParserGenerator.kt:251 */
  104    149   
        return Err(
  105    150   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  106    151   
                "found more JSON tokens after completing parsing",
  107    152   
            ),
  108    153   
        );
         154  +
        /* JsonParserGenerator.kt:250 */
  109    155   
    }
         156  +
    /* JsonParserGenerator.kt:163 */
  110    157   
    Ok(builder)
         158  +
    /* JsonParserGenerator.kt:148 */
  111    159   
}

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

@@ -1,1 +187,259 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_boolean_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedBooleanInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::malformed_boolean_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:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_malformed_boolean::de_malformed_boolean(
   29     39   
                bytes.as_ref(),
   30     40   
                input,
   31     41   
            )?;
          42  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   32     43   
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   33     45   
        if let Some(value) =
   34     46   
            crate::protocol_serde::shape_malformed_boolean_input::de_boolean_in_header_header(
   35     47   
                &headers,
   36     48   
            )?
   37     49   
        {
   38     50   
            input = input.set_boolean_in_header(Some(value))
   39     51   
        }
          52  +
        /* ServerHttpBoundProtocolGenerator.kt:986 */
   40     53   
        let input_string = uri.path();
          54  +
        /* ServerHttpBoundProtocolGenerator.kt:998 */
   41     55   
        let (input_string, (_, m1)) =
   42     56   
            ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
   43     57   
                ::nom::sequence::preceded(
   44     58   
                    ::nom::bytes::complete::tag("/"),
   45     59   
                    ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>(
   46     60   
                        "MalformedBoolean",
   47     61   
                    ),
   48     62   
                ),
   49     63   
                ::nom::sequence::preceded(
   50     64   
                    ::nom::bytes::complete::tag("/"),
   51     65   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   52     66   
                        ::nom::bytes::complete::take_until("/"),
   53     67   
                        ::nom::combinator::rest,
   54     68   
                    )),
   55     69   
                ),
   56     70   
            ))(input_string)?;
   57     71   
        debug_assert_eq!("", input_string);
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   58     73   
        input = input.set_boolean_in_path(
   59     74   
            crate::protocol_serde::shape_malformed_boolean_input::de_boolean_in_path(m1)?,
   60     75   
        );
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:1073 */
   61     77   
        let query_string = uri.query().unwrap_or("");
   62     78   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:1099 */
   63     80   
        let mut boolean_in_query_seen = false;
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:1105 */
   64     82   
        for (k, v) in pairs {
          83  +
            /* ServerHttpBoundProtocolGenerator.kt:1109 */
   65     84   
            if !boolean_in_query_seen && k == "booleanInQuery" {
   66     85   
                input = input.set_boolean_in_query(
   67     86   
                    crate::protocol_serde::shape_malformed_boolean_input::de_boolean_in_query(&v)?,
   68     87   
                );
   69     88   
                boolean_in_query_seen = true;
   70     89   
            }
          90  +
            /* ServerHttpBoundProtocolGenerator.kt:1105 */
   71     91   
        }
          92  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   72     93   
        input.build()?
          94  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   73     95   
    })
          96  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   74     97   
}
   75     98   
          99  +
/* RustType.kt:516 */
   76    100   
#[allow(clippy::unnecessary_wraps)]
         101  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   77    102   
pub fn ser_malformed_boolean_http_response(
   78    103   
    #[allow(unused_variables)] output: crate::output::MalformedBooleanOutput,
   79    104   
) -> std::result::Result<
   80    105   
    ::aws_smithy_http_server::response::Response,
   81    106   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   82    107   
> {
         108  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   83    109   
    Ok({
         110  +
        /* RustType.kt:516 */
   84    111   
        #[allow(unused_mut)]
         112  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   85    113   
        let mut builder = ::http::Response::builder();
         114  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   86    115   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   87    116   
            builder,
   88    117   
            ::http::header::CONTENT_TYPE,
   89    118   
            "application/json",
   90    119   
        );
         120  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   91    121   
        let http_status: u16 = 200;
   92    122   
        builder = builder.status(http_status);
   93         -
        let payload = "";
         123  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
         124  +
        let payload =
         125  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
         126  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
         127  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   94    128   
        let content_length = payload.len();
   95    129   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   96    130   
            builder,
   97    131   
            ::http::header::CONTENT_LENGTH,
   98    132   
            content_length,
   99    133   
        );
         134  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
  100    135   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
         136  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
  101    137   
        builder.body(body)?
         138  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
  102    139   
    })
         140  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
  103    141   
}
  104    142   
         143  +
/* RustType.kt:516 */
  105    144   
#[allow(clippy::unnecessary_wraps)]
         145  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
  106    146   
pub fn ser_malformed_boolean_http_error(
  107    147   
    error: &crate::error::MalformedBooleanError,
  108    148   
) -> std::result::Result<
  109    149   
    ::aws_smithy_http_server::response::Response,
  110    150   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
  111    151   
> {
         152  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
  112    153   
    Ok({
         154  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
  113    155   
        match error {
         156  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  114    157   
            crate::error::MalformedBooleanError::ValidationException(output) => {
         158  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  115    159   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         160  +
                /* RustType.kt:516 */
  116    161   
                #[allow(unused_mut)]
         162  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  117    163   
                let mut builder = ::http::Response::builder();
         164  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  118    165   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  119    166   
                    builder,
  120    167   
                    ::http::header::CONTENT_TYPE,
  121    168   
                    "application/json",
  122    169   
                );
         170  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  123    171   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  124    172   
                    builder,
  125    173   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  126    174   
                    "ValidationException",
  127    175   
                );
         176  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  128    177   
                let content_length = payload.len();
  129    178   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  130    179   
                    builder,
  131    180   
                    ::http::header::CONTENT_LENGTH,
  132    181   
                    content_length,
  133    182   
                );
         183  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  134    184   
                builder
  135    185   
                    .status(400)
  136    186   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  137         -
            }
         187  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         188  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  138    189   
        }
         190  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  139    191   
    })
         192  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  140    193   
}
  141    194   
         195  +
/* JsonParserGenerator.kt:148 */
  142    196   
pub(crate) fn de_malformed_boolean(
  143    197   
    value: &[u8],
  144    198   
    mut builder: crate::input::malformed_boolean_input::Builder,
  145    199   
) -> ::std::result::Result<
  146    200   
    crate::input::malformed_boolean_input::Builder,
  147    201   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  148    202   
> {
         203  +
    /* JsonParserGenerator.kt:153 */
  149    204   
    let mut tokens_owned =
  150    205   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  151    206   
            .peekable();
  152    207   
    let tokens = &mut tokens_owned;
  153    208   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         209  +
    /* JsonParserGenerator.kt:684 */
  154    210   
    loop {
         211  +
        /* JsonParserGenerator.kt:685 */
  155    212   
        match tokens.next().transpose()? {
         213  +
            /* JsonParserGenerator.kt:686 */
  156    214   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  157    215   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         216  +
                /* JsonParserGenerator.kt:260 */
  158    217   
                match key.to_unescaped()?.as_ref() {
         218  +
                    /* JsonParserGenerator.kt:262 */
  159    219   
                    "booleanInBody" => {
         220  +
                        /* JsonParserGenerator.kt:272 */
  160    221   
                        builder = builder.set_boolean_in_body(
         222  +
                            /* JsonParserGenerator.kt:298 */
  161    223   
                            ::aws_smithy_json::deserialize::token::expect_bool_or_null(
  162    224   
                                tokens.next(),
  163         -
                            )?,
         225  +
                            )?, /* JsonParserGenerator.kt:272 */
  164    226   
                        );
         227  +
                        /* JsonParserGenerator.kt:262 */
  165    228   
                    }
  166         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         229  +
                    /* JsonParserGenerator.kt:290 */
         230  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  167    231   
                }
         232  +
                /* JsonParserGenerator.kt:686 */
  168    233   
            }
         234  +
            /* JsonParserGenerator.kt:695 */
  169    235   
            other => {
  170    236   
                return Err(
  171    237   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  172    238   
                        "expected object key or end object, found: {:?}",
  173    239   
                        other
  174    240   
                    )),
  175    241   
                )
  176         -
            }
         242  +
            } /* JsonParserGenerator.kt:685 */
  177    243   
        }
         244  +
        /* JsonParserGenerator.kt:684 */
  178    245   
    }
         246  +
    /* JsonParserGenerator.kt:250 */
  179    247   
    if tokens.next().is_some() {
         248  +
        /* JsonParserGenerator.kt:251 */
  180    249   
        return Err(
  181    250   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  182    251   
                "found more JSON tokens after completing parsing",
  183    252   
            ),
  184    253   
        );
         254  +
        /* JsonParserGenerator.kt:250 */
  185    255   
    }
         256  +
    /* JsonParserGenerator.kt:163 */
  186    257   
    Ok(builder)
         258  +
    /* JsonParserGenerator.kt:148 */
  187    259   
}

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

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

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

@@ -1,1 +185,257 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_byte_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedByteInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::malformed_byte_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:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_malformed_byte::de_malformed_byte(
   29     39   
                bytes.as_ref(),
   30     40   
                input,
   31     41   
            )?;
          42  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   32     43   
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   33     45   
        if let Some(value) =
   34     46   
            crate::protocol_serde::shape_malformed_byte_input::de_byte_in_header_header(&headers)?
   35     47   
        {
   36     48   
            input = input.set_byte_in_header(Some(value))
   37     49   
        }
          50  +
        /* ServerHttpBoundProtocolGenerator.kt:986 */
   38     51   
        let input_string = uri.path();
          52  +
        /* ServerHttpBoundProtocolGenerator.kt:998 */
   39     53   
        let (input_string, (_, m1)) =
   40     54   
            ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
   41     55   
                ::nom::sequence::preceded(
   42     56   
                    ::nom::bytes::complete::tag("/"),
   43     57   
                    ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>("MalformedByte"),
   44     58   
                ),
   45     59   
                ::nom::sequence::preceded(
   46     60   
                    ::nom::bytes::complete::tag("/"),
   47     61   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   48     62   
                        ::nom::bytes::complete::take_until("/"),
   49     63   
                        ::nom::combinator::rest,
   50     64   
                    )),
   51     65   
                ),
   52     66   
            ))(input_string)?;
   53     67   
        debug_assert_eq!("", input_string);
          68  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   54     69   
        input = input.set_byte_in_path(
   55     70   
            crate::protocol_serde::shape_malformed_byte_input::de_byte_in_path(m1)?,
   56     71   
        );
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:1073 */
   57     73   
        let query_string = uri.query().unwrap_or("");
   58     74   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:1099 */
   59     76   
        let mut byte_in_query_seen = false;
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:1105 */
   60     78   
        for (k, v) in pairs {
          79  +
            /* ServerHttpBoundProtocolGenerator.kt:1109 */
   61     80   
            if !byte_in_query_seen && k == "byteInQuery" {
   62     81   
                input = input.set_byte_in_query(
   63     82   
                    crate::protocol_serde::shape_malformed_byte_input::de_byte_in_query(&v)?,
   64     83   
                );
   65     84   
                byte_in_query_seen = true;
   66     85   
            }
          86  +
            /* ServerHttpBoundProtocolGenerator.kt:1105 */
   67     87   
        }
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   68     89   
        input.build()?
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   69     91   
    })
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   70     93   
}
   71     94   
          95  +
/* RustType.kt:516 */
   72     96   
#[allow(clippy::unnecessary_wraps)]
          97  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   73     98   
pub fn ser_malformed_byte_http_response(
   74     99   
    #[allow(unused_variables)] output: crate::output::MalformedByteOutput,
   75    100   
) -> std::result::Result<
   76    101   
    ::aws_smithy_http_server::response::Response,
   77    102   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   78    103   
> {
         104  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   79    105   
    Ok({
         106  +
        /* RustType.kt:516 */
   80    107   
        #[allow(unused_mut)]
         108  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   81    109   
        let mut builder = ::http::Response::builder();
         110  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   82    111   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   83    112   
            builder,
   84    113   
            ::http::header::CONTENT_TYPE,
   85    114   
            "application/json",
   86    115   
        );
         116  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   87    117   
        let http_status: u16 = 200;
   88    118   
        builder = builder.status(http_status);
   89         -
        let payload = "";
         119  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
         120  +
        let payload =
         121  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
         122  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
         123  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   90    124   
        let content_length = payload.len();
   91    125   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   92    126   
            builder,
   93    127   
            ::http::header::CONTENT_LENGTH,
   94    128   
            content_length,
   95    129   
        );
         130  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   96    131   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
         132  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   97    133   
        builder.body(body)?
         134  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   98    135   
    })
         136  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   99    137   
}
  100    138   
         139  +
/* RustType.kt:516 */
  101    140   
#[allow(clippy::unnecessary_wraps)]
         141  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
  102    142   
pub fn ser_malformed_byte_http_error(
  103    143   
    error: &crate::error::MalformedByteError,
  104    144   
) -> std::result::Result<
  105    145   
    ::aws_smithy_http_server::response::Response,
  106    146   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
  107    147   
> {
         148  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
  108    149   
    Ok({
         150  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
  109    151   
        match error {
         152  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  110    153   
            crate::error::MalformedByteError::ValidationException(output) => {
         154  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  111    155   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         156  +
                /* RustType.kt:516 */
  112    157   
                #[allow(unused_mut)]
         158  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  113    159   
                let mut builder = ::http::Response::builder();
         160  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  114    161   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  115    162   
                    builder,
  116    163   
                    ::http::header::CONTENT_TYPE,
  117    164   
                    "application/json",
  118    165   
                );
         166  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  119    167   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  120    168   
                    builder,
  121    169   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  122    170   
                    "ValidationException",
  123    171   
                );
         172  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  124    173   
                let content_length = payload.len();
  125    174   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  126    175   
                    builder,
  127    176   
                    ::http::header::CONTENT_LENGTH,
  128    177   
                    content_length,
  129    178   
                );
         179  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  130    180   
                builder
  131    181   
                    .status(400)
  132    182   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  133         -
            }
         183  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         184  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  134    185   
        }
         186  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  135    187   
    })
         188  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  136    189   
}
  137    190   
         191  +
/* JsonParserGenerator.kt:148 */
  138    192   
pub(crate) fn de_malformed_byte(
  139    193   
    value: &[u8],
  140    194   
    mut builder: crate::input::malformed_byte_input::Builder,
  141    195   
) -> ::std::result::Result<
  142    196   
    crate::input::malformed_byte_input::Builder,
  143    197   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  144    198   
> {
         199  +
    /* JsonParserGenerator.kt:153 */
  145    200   
    let mut tokens_owned =
  146    201   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  147    202   
            .peekable();
  148    203   
    let tokens = &mut tokens_owned;
  149    204   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         205  +
    /* JsonParserGenerator.kt:684 */
  150    206   
    loop {
         207  +
        /* JsonParserGenerator.kt:685 */
  151    208   
        match tokens.next().transpose()? {
         209  +
            /* JsonParserGenerator.kt:686 */
  152    210   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  153    211   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         212  +
                /* JsonParserGenerator.kt:260 */
  154    213   
                match key.to_unescaped()?.as_ref() {
         214  +
                    /* JsonParserGenerator.kt:262 */
  155    215   
                    "byteInBody" => {
         216  +
                        /* JsonParserGenerator.kt:272 */
  156    217   
                        builder = builder.set_byte_in_body(
         218  +
                            /* JsonParserGenerator.kt:365 */
  157    219   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
  158    220   
                                tokens.next(),
  159    221   
                            )?
  160    222   
                            .map(i8::try_from)
  161         -
                            .transpose()?,
         223  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  162    224   
                        );
         225  +
                        /* JsonParserGenerator.kt:262 */
  163    226   
                    }
  164         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         227  +
                    /* JsonParserGenerator.kt:290 */
         228  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  165    229   
                }
         230  +
                /* JsonParserGenerator.kt:686 */
  166    231   
            }
         232  +
            /* JsonParserGenerator.kt:695 */
  167    233   
            other => {
  168    234   
                return Err(
  169    235   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  170    236   
                        "expected object key or end object, found: {:?}",
  171    237   
                        other
  172    238   
                    )),
  173    239   
                )
  174         -
            }
         240  +
            } /* JsonParserGenerator.kt:685 */
  175    241   
        }
         242  +
        /* JsonParserGenerator.kt:684 */
  176    243   
    }
         244  +
    /* JsonParserGenerator.kt:250 */
  177    245   
    if tokens.next().is_some() {
         246  +
        /* JsonParserGenerator.kt:251 */
  178    247   
        return Err(
  179    248   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  180    249   
                "found more JSON tokens after completing parsing",
  181    250   
            ),
  182    251   
        );
         252  +
        /* JsonParserGenerator.kt:250 */
  183    253   
    }
         254  +
    /* JsonParserGenerator.kt:163 */
  184    255   
    Ok(builder)
         256  +
    /* JsonParserGenerator.kt:148 */
  185    257   
}

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

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

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

@@ -1,1 +110,161 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_content_type_with_body_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedContentTypeWithBodyInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::malformed_content_type_with_body_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:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_malformed_content_type_with_body::de_malformed_content_type_with_body(bytes.as_ref(), input)?;
          39  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   29     40   
        }
          41  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   30     42   
        input.build()
          43  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   31     44   
    })
          45  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   32     46   
}
   33     47   
          48  +
/* RustType.kt:516 */
   34     49   
#[allow(clippy::unnecessary_wraps)]
          50  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   35     51   
pub fn ser_malformed_content_type_with_body_http_response(
   36     52   
    #[allow(unused_variables)] output: crate::output::MalformedContentTypeWithBodyOutput,
   37     53   
) -> std::result::Result<
   38     54   
    ::aws_smithy_http_server::response::Response,
   39     55   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   40     56   
> {
          57  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   41     58   
    Ok({
          59  +
        /* RustType.kt:516 */
   42     60   
        #[allow(unused_mut)]
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   43     62   
        let mut builder = ::http::Response::builder();
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   44     64   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   45     65   
            builder,
   46     66   
            ::http::header::CONTENT_TYPE,
   47     67   
            "application/json",
   48     68   
        );
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   49     70   
        let http_status: u16 = 200;
   50     71   
        builder = builder.status(http_status);
   51         -
        let payload = "";
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          73  +
        let payload =
          74  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   52     77   
        let content_length = payload.len();
   53     78   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   54     79   
            builder,
   55     80   
            ::http::header::CONTENT_LENGTH,
   56     81   
            content_length,
   57     82   
        );
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   58     84   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          85  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   59     86   
        builder.body(body)?
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   60     88   
    })
          89  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   61     90   
}
   62     91   
          92  +
/* JsonParserGenerator.kt:148 */
   63     93   
pub(crate) fn de_malformed_content_type_with_body(
   64     94   
    value: &[u8],
   65     95   
    mut builder: crate::input::malformed_content_type_with_body_input::Builder,
   66     96   
) -> ::std::result::Result<
   67     97   
    crate::input::malformed_content_type_with_body_input::Builder,
   68     98   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   69     99   
> {
         100  +
    /* JsonParserGenerator.kt:153 */
   70    101   
    let mut tokens_owned =
   71    102   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
   72    103   
            .peekable();
   73    104   
    let tokens = &mut tokens_owned;
   74    105   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         106  +
    /* JsonParserGenerator.kt:684 */
   75    107   
    loop {
         108  +
        /* JsonParserGenerator.kt:685 */
   76    109   
        match tokens.next().transpose()? {
         110  +
            /* JsonParserGenerator.kt:686 */
   77    111   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   78    112   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         113  +
                /* JsonParserGenerator.kt:260 */
   79    114   
                match key.to_unescaped()?.as_ref() {
         115  +
                    /* JsonParserGenerator.kt:262 */
   80    116   
                    "hi" => {
         117  +
                        /* JsonParserGenerator.kt:272 */
   81    118   
                        builder = builder.set_hi(
         119  +
                            /* JsonParserGenerator.kt:354 */
   82    120   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
   83    121   
                                tokens.next(),
   84    122   
                            )?
   85         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   86         -
                            .transpose()?,
         123  +
                            .map(|s|
         124  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         125  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         126  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         127  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
   87    128   
                        );
         129  +
                        /* JsonParserGenerator.kt:262 */
   88    130   
                    }
   89         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         131  +
                    /* JsonParserGenerator.kt:290 */
         132  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   90    133   
                }
         134  +
                /* JsonParserGenerator.kt:686 */
   91    135   
            }
         136  +
            /* JsonParserGenerator.kt:695 */
   92    137   
            other => {
   93    138   
                return Err(
   94    139   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   95    140   
                        "expected object key or end object, found: {:?}",
   96    141   
                        other
   97    142   
                    )),
   98    143   
                )
   99         -
            }
         144  +
            } /* JsonParserGenerator.kt:685 */
  100    145   
        }
         146  +
        /* JsonParserGenerator.kt:684 */
  101    147   
    }
         148  +
    /* JsonParserGenerator.kt:250 */
  102    149   
    if tokens.next().is_some() {
         150  +
        /* JsonParserGenerator.kt:251 */
  103    151   
        return Err(
  104    152   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  105    153   
                "found more JSON tokens after completing parsing",
  106    154   
            ),
  107    155   
        );
         156  +
        /* JsonParserGenerator.kt:250 */
  108    157   
    }
         158  +
    /* JsonParserGenerator.kt:163 */
  109    159   
    Ok(builder)
         160  +
    /* JsonParserGenerator.kt:148 */
  110    161   
}

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

@@ -1,1 +66,92 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_content_type_with_generic_string_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedContentTypeWithGenericStringInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input =
   18     23   
            crate::input::malformed_content_type_with_generic_string_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:794 */
   23     31   
        if let Some(value) = {
   24     32   
            let bytes = ::hyper::body::to_bytes(body).await?;
   25     33   
            if !bytes.is_empty() {
   26     34   
                ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   27     35   
                    &headers,
   28     36   
                    Some("text/plain"),
   29     37   
                )?;
   30     38   
            }
   31     39   
            crate::protocol_serde::shape_malformed_content_type_with_generic_string_input::de_payload_payload(&bytes)?
   32     40   
        } {
   33     41   
            input = input.set_payload(Some(value))
   34     42   
        }
          43  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   35     44   
        input.build()
          45  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   36     46   
    })
          47  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   37     48   
}
   38     49   
          50  +
/* RustType.kt:516 */
   39     51   
#[allow(clippy::unnecessary_wraps)]
          52  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   40     53   
pub fn ser_malformed_content_type_with_generic_string_http_response(
   41     54   
    #[allow(unused_variables)] output: crate::output::MalformedContentTypeWithGenericStringOutput,
   42     55   
) -> std::result::Result<
   43     56   
    ::aws_smithy_http_server::response::Response,
   44     57   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   45     58   
> {
          59  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   46     60   
    Ok({
          61  +
        /* RustType.kt:516 */
   47     62   
        #[allow(unused_mut)]
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   48     64   
        let mut builder = ::http::Response::builder();
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   49     66   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   50     67   
            builder,
   51     68   
            ::http::header::CONTENT_TYPE,
   52     69   
            "application/json",
   53     70   
        );
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   54     72   
        let http_status: u16 = 200;
   55     73   
        builder = builder.status(http_status);
   56         -
        let payload = "";
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          75  +
        let payload =
          76  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   57     79   
        let content_length = payload.len();
   58     80   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   59     81   
            builder,
   60     82   
            ::http::header::CONTENT_LENGTH,
   61     83   
            content_length,
   62     84   
        );
          85  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   63     86   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   64     88   
        builder.body(body)?
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   65     90   
    })
          91  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   66     92   
}

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

@@ -1,1 +14,20 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:248 */
    2      3   
pub(crate) fn de_payload_payload(
    3      4   
    body: &[u8],
    4      5   
) -> std::result::Result<
    5      6   
    ::std::option::Option<::std::string::String>,
    6      7   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:319 */
    8     10   
    (!body.is_empty())
    9     11   
        .then(|| {
          12  +
            /* HttpBindingGenerator.kt:332 */
   10     13   
            let body_str = std::str::from_utf8(body)?;
          14  +
            /* HttpBindingGenerator.kt:344 */
   11     15   
            Ok(body_str.to_string())
          16  +
            /* HttpBindingGenerator.kt:319 */
   12     17   
        })
   13     18   
        .transpose()
          19  +
    /* HttpBindingGenerator.kt:248 */
   14     20   
}

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

@@ -1,1 +65,91 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_content_type_with_payload_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedContentTypeWithPayloadInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::malformed_content_type_with_payload_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   
            let bytes = ::hyper::body::to_bytes(body).await?;
   24     32   
            if !bytes.is_empty() {
   25     33   
                ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   26     34   
                    &headers,
   27     35   
                    Some("image/jpeg"),
   28     36   
                )?;
   29     37   
            }
   30     38   
            crate::protocol_serde::shape_malformed_content_type_with_payload_input::de_payload_payload(&bytes)?
   31     39   
        } {
   32     40   
            input = input.set_payload(Some(value))
   33     41   
        }
          42  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   34     43   
        input.build()
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   35     45   
    })
          46  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   36     47   
}
   37     48   
          49  +
/* RustType.kt:516 */
   38     50   
#[allow(clippy::unnecessary_wraps)]
          51  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   39     52   
pub fn ser_malformed_content_type_with_payload_http_response(
   40     53   
    #[allow(unused_variables)] output: crate::output::MalformedContentTypeWithPayloadOutput,
   41     54   
) -> std::result::Result<
   42     55   
    ::aws_smithy_http_server::response::Response,
   43     56   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   44     57   
> {
          58  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   45     59   
    Ok({
          60  +
        /* RustType.kt:516 */
   46     61   
        #[allow(unused_mut)]
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   47     63   
        let mut builder = ::http::Response::builder();
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   48     65   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   49     66   
            builder,
   50     67   
            ::http::header::CONTENT_TYPE,
   51     68   
            "application/json",
   52     69   
        );
          70  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   53     71   
        let http_status: u16 = 200;
   54     72   
        builder = builder.status(http_status);
   55         -
        let payload = "";
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          74  +
        let payload =
          75  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   56     78   
        let content_length = payload.len();
   57     79   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   58     80   
            builder,
   59     81   
            ::http::header::CONTENT_LENGTH,
   60     82   
            content_length,
   61     83   
        );
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   62     85   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   63     87   
        builder.body(body)?
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   64     89   
    })
          90  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   65     91   
}

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

@@ -1,1 +11,18 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:248 */
    2      3   
pub(crate) fn de_payload_payload(
    3      4   
    body: &[u8],
    4      5   
) -> std::result::Result<
    5      6   
    ::std::option::Option<::aws_smithy_types::Blob>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:319 */
    8     10   
    (!body.is_empty())
    9         -
        .then(|| Ok(::aws_smithy_types::Blob::new(body)))
          11  +
        .then(|| {
          12  +
            /* HttpBindingGenerator.kt:349 */
          13  +
            Ok(::aws_smithy_types::Blob::new(body))
          14  +
            /* HttpBindingGenerator.kt:319 */
          15  +
        })
   10     16   
        .transpose()
          17  +
    /* HttpBindingGenerator.kt:248 */
   11     18   
}

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

@@ -1,1 +54,80 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_content_type_without_body_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedContentTypeWithoutBodyInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::malformed_content_type_without_body_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:811 */
   22     30   
        ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(&headers, None)?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   23     32   
        input.build()
          33  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   24     34   
    })
          35  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   25     36   
}
   26     37   
          38  +
/* RustType.kt:516 */
   27     39   
#[allow(clippy::unnecessary_wraps)]
          40  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   28     41   
pub fn ser_malformed_content_type_without_body_http_response(
   29     42   
    #[allow(unused_variables)] output: crate::output::MalformedContentTypeWithoutBodyOutput,
   30     43   
) -> std::result::Result<
   31     44   
    ::aws_smithy_http_server::response::Response,
   32     45   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   33     46   
> {
          47  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   34     48   
    Ok({
          49  +
        /* RustType.kt:516 */
   35     50   
        #[allow(unused_mut)]
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   36     52   
        let mut builder = ::http::Response::builder();
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   37     54   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   38     55   
            builder,
   39     56   
            ::http::header::CONTENT_TYPE,
   40     57   
            "application/json",
   41     58   
        );
          59  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   42     60   
        let http_status: u16 = 200;
   43     61   
        builder = builder.status(http_status);
   44         -
        let payload = "";
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          63  +
        let payload =
          64  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   45     67   
        let content_length = payload.len();
   46     68   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   47     69   
            builder,
   48     70   
            ::http::header::CONTENT_LENGTH,
   49     71   
            content_length,
   50     72   
        );
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   51     74   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   52     76   
        builder.body(body)?
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   53     78   
    })
          79  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   54     80   
}

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

@@ -1,1 +188,260 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_double_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedDoubleInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::malformed_double_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:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_malformed_double::de_malformed_double(
   29     39   
                bytes.as_ref(),
   30     40   
                input,
   31     41   
            )?;
          42  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   32     43   
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   33     45   
        if let Some(value) =
   34     46   
            crate::protocol_serde::shape_malformed_double_input::de_double_in_header_header(
   35     47   
                &headers,
   36     48   
            )?
   37     49   
        {
   38     50   
            input = input.set_double_in_header(Some(value))
   39     51   
        }
          52  +
        /* ServerHttpBoundProtocolGenerator.kt:986 */
   40     53   
        let input_string = uri.path();
          54  +
        /* ServerHttpBoundProtocolGenerator.kt:998 */
   41     55   
        let (input_string, (_, m1)) =
   42     56   
            ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
   43     57   
                ::nom::sequence::preceded(
   44     58   
                    ::nom::bytes::complete::tag("/"),
   45     59   
                    ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>(
   46     60   
                        "MalformedDouble",
   47     61   
                    ),
   48     62   
                ),
   49     63   
                ::nom::sequence::preceded(
   50     64   
                    ::nom::bytes::complete::tag("/"),
   51     65   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   52     66   
                        ::nom::bytes::complete::take_until("/"),
   53     67   
                        ::nom::combinator::rest,
   54     68   
                    )),
   55     69   
                ),
   56     70   
            ))(input_string)?;
   57     71   
        debug_assert_eq!("", input_string);
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   58     73   
        input = input.set_double_in_path(
   59     74   
            crate::protocol_serde::shape_malformed_double_input::de_double_in_path(m1)?,
   60     75   
        );
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:1073 */
   61     77   
        let query_string = uri.query().unwrap_or("");
   62     78   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:1099 */
   63     80   
        let mut double_in_query_seen = false;
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:1105 */
   64     82   
        for (k, v) in pairs {
          83  +
            /* ServerHttpBoundProtocolGenerator.kt:1109 */
   65     84   
            if !double_in_query_seen && k == "doubleInQuery" {
   66     85   
                input = input.set_double_in_query(
   67     86   
                    crate::protocol_serde::shape_malformed_double_input::de_double_in_query(&v)?,
   68     87   
                );
   69     88   
                double_in_query_seen = true;
   70     89   
            }
          90  +
            /* ServerHttpBoundProtocolGenerator.kt:1105 */
   71     91   
        }
          92  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   72     93   
        input.build()?
          94  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   73     95   
    })
          96  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   74     97   
}
   75     98   
          99  +
/* RustType.kt:516 */
   76    100   
#[allow(clippy::unnecessary_wraps)]
         101  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   77    102   
pub fn ser_malformed_double_http_response(
   78    103   
    #[allow(unused_variables)] output: crate::output::MalformedDoubleOutput,
   79    104   
) -> std::result::Result<
   80    105   
    ::aws_smithy_http_server::response::Response,
   81    106   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   82    107   
> {
         108  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   83    109   
    Ok({
         110  +
        /* RustType.kt:516 */
   84    111   
        #[allow(unused_mut)]
         112  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   85    113   
        let mut builder = ::http::Response::builder();
         114  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   86    115   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   87    116   
            builder,
   88    117   
            ::http::header::CONTENT_TYPE,
   89    118   
            "application/json",
   90    119   
        );
         120  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   91    121   
        let http_status: u16 = 200;
   92    122   
        builder = builder.status(http_status);
   93         -
        let payload = "";
         123  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
         124  +
        let payload =
         125  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
         126  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
         127  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   94    128   
        let content_length = payload.len();
   95    129   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   96    130   
            builder,
   97    131   
            ::http::header::CONTENT_LENGTH,
   98    132   
            content_length,
   99    133   
        );
         134  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
  100    135   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
         136  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
  101    137   
        builder.body(body)?
         138  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
  102    139   
    })
         140  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
  103    141   
}
  104    142   
         143  +
/* RustType.kt:516 */
  105    144   
#[allow(clippy::unnecessary_wraps)]
         145  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
  106    146   
pub fn ser_malformed_double_http_error(
  107    147   
    error: &crate::error::MalformedDoubleError,
  108    148   
) -> std::result::Result<
  109    149   
    ::aws_smithy_http_server::response::Response,
  110    150   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
  111    151   
> {
         152  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
  112    153   
    Ok({
         154  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
  113    155   
        match error {
         156  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  114    157   
            crate::error::MalformedDoubleError::ValidationException(output) => {
         158  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  115    159   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         160  +
                /* RustType.kt:516 */
  116    161   
                #[allow(unused_mut)]
         162  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  117    163   
                let mut builder = ::http::Response::builder();
         164  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  118    165   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  119    166   
                    builder,
  120    167   
                    ::http::header::CONTENT_TYPE,
  121    168   
                    "application/json",
  122    169   
                );
         170  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  123    171   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  124    172   
                    builder,
  125    173   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  126    174   
                    "ValidationException",
  127    175   
                );
         176  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  128    177   
                let content_length = payload.len();
  129    178   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  130    179   
                    builder,
  131    180   
                    ::http::header::CONTENT_LENGTH,
  132    181   
                    content_length,
  133    182   
                );
         183  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  134    184   
                builder
  135    185   
                    .status(400)
  136    186   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  137         -
            }
         187  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         188  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  138    189   
        }
         190  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  139    191   
    })
         192  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  140    193   
}
  141    194   
         195  +
/* JsonParserGenerator.kt:148 */
  142    196   
pub(crate) fn de_malformed_double(
  143    197   
    value: &[u8],
  144    198   
    mut builder: crate::input::malformed_double_input::Builder,
  145    199   
) -> ::std::result::Result<
  146    200   
    crate::input::malformed_double_input::Builder,
  147    201   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  148    202   
> {
         203  +
    /* JsonParserGenerator.kt:153 */
  149    204   
    let mut tokens_owned =
  150    205   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  151    206   
            .peekable();
  152    207   
    let tokens = &mut tokens_owned;
  153    208   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         209  +
    /* JsonParserGenerator.kt:684 */
  154    210   
    loop {
         211  +
        /* JsonParserGenerator.kt:685 */
  155    212   
        match tokens.next().transpose()? {
         213  +
            /* JsonParserGenerator.kt:686 */
  156    214   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  157    215   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         216  +
                /* JsonParserGenerator.kt:260 */
  158    217   
                match key.to_unescaped()?.as_ref() {
         218  +
                    /* JsonParserGenerator.kt:262 */
  159    219   
                    "doubleInBody" => {
         220  +
                        /* JsonParserGenerator.kt:272 */
  160    221   
                        builder = builder.set_double_in_body(
         222  +
                            /* JsonParserGenerator.kt:363 */
  161    223   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
  162    224   
                                tokens.next(),
  163    225   
                            )?
  164         -
                            .map(|v| v.to_f64_lossy()),
         226  +
                            .map(|v| v.to_f64_lossy()), /* JsonParserGenerator.kt:272 */
  165    227   
                        );
         228  +
                        /* JsonParserGenerator.kt:262 */
  166    229   
                    }
  167         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         230  +
                    /* JsonParserGenerator.kt:290 */
         231  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  168    232   
                }
         233  +
                /* JsonParserGenerator.kt:686 */
  169    234   
            }
         235  +
            /* JsonParserGenerator.kt:695 */
  170    236   
            other => {
  171    237   
                return Err(
  172    238   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  173    239   
                        "expected object key or end object, found: {:?}",
  174    240   
                        other
  175    241   
                    )),
  176    242   
                )
  177         -
            }
         243  +
            } /* JsonParserGenerator.kt:685 */
  178    244   
        }
         245  +
        /* JsonParserGenerator.kt:684 */
  179    246   
    }
         247  +
    /* JsonParserGenerator.kt:250 */
  180    248   
    if tokens.next().is_some() {
         249  +
        /* JsonParserGenerator.kt:251 */
  181    250   
        return Err(
  182    251   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  183    252   
                "found more JSON tokens after completing parsing",
  184    253   
            ),
  185    254   
        );
         255  +
        /* JsonParserGenerator.kt:250 */
  186    256   
    }
         257  +
    /* JsonParserGenerator.kt:163 */
  187    258   
    Ok(builder)
         259  +
    /* JsonParserGenerator.kt:148 */
  188    260   
}

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

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