Server Test Python

Server Test Python

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943 (ignoring whitespace)

Files changed:

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

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

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

@@ -1,1 +10,14 @@
    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_test_id_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::option::Option<::std::string::String>,
    6      7   
    ::aws_smithy_http::header::ParseError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:160 */
    8     10   
    let headers = header_map.get_all("x-amz-test-id");
          11  +
    /* HttpBindingGenerator.kt:375 */
    9     12   
    ::aws_smithy_http::header::one_or_none(headers)
          13  +
    /* HttpBindingGenerator.kt:153 */
   10     14   
}

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

@@ -1,1 +26,40 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_test_body_structure_output_output_output(
    3      4   
    value: &crate::output::TestBodyStructureOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_test_body_structure_output::ser_test_body_structure_output_output(
    8     11   
        &mut object,
    9     12   
        value,
   10     13   
    )?;
          14  +
    /* JsonSerializerGenerator.kt:227 */
   11     15   
    object.finish();
   12     16   
    Ok(out)
          17  +
    /* JsonSerializerGenerator.kt:213 */
   13     18   
}
   14     19   
          20  +
/* JsonSerializerGenerator.kt:358 */
   15     21   
pub fn ser_test_body_structure_output_output(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::output::TestBodyStructureOutput,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:382 */
   19     26   
    if let Some(var_1) = &input.test_config {
          27  +
        /* JsonSerializerGenerator.kt:495 */
   20     28   
        #[allow(unused_mut)]
          29  +
        /* JsonSerializerGenerator.kt:496 */
   21     30   
        let mut object_2 = object.key("testConfig").start_object();
          31  +
        /* JsonSerializerGenerator.kt:375 */
   22     32   
        crate::protocol_serde::shape_test_config::ser_test_config(&mut object_2, var_1)?;
          33  +
        /* JsonSerializerGenerator.kt:515 */
   23     34   
        object_2.finish();
          35  +
        /* JsonSerializerGenerator.kt:382 */
   24     36   
    }
          37  +
    /* JsonSerializerGenerator.kt:372 */
   25     38   
    Ok(())
          39  +
    /* JsonSerializerGenerator.kt:358 */
   26     40   
}

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

@@ -1,1 +68,99 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:516 */
    2      3   
pub(crate) fn de_test_config<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::model::TestConfig>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
>
    8      9   
where
    9     10   
    I: Iterator<
   10     11   
        Item = Result<
   11     12   
            ::aws_smithy_json::deserialize::Token<'a>,
   12     13   
            ::aws_smithy_json::deserialize::error::DeserializeError,
   13     14   
        >,
   14     15   
    >,
   15     16   
{
          17  +
    /* JsonParserGenerator.kt:712 */
   16     18   
    match tokens.next().transpose()? {
          19  +
        /* JsonParserGenerator.kt:713 */
   17     20   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   18     21   
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          22  +
            /* RustType.kt:516 */
   19     23   
            #[allow(unused_mut)]
          24  +
            /* JsonParserGenerator.kt:526 */
   20     25   
            let mut builder = crate::model::test_config_internal::Builder::default();
          26  +
            /* JsonParserGenerator.kt:684 */
   21     27   
            loop {
          28  +
                /* JsonParserGenerator.kt:685 */
   22     29   
                match tokens.next().transpose()? {
          30  +
                    /* JsonParserGenerator.kt:686 */
   23     31   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   24     32   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          33  +
                        /* JsonParserGenerator.kt:260 */
   25     34   
                        match key.to_unescaped()?.as_ref() {
          35  +
                            /* JsonParserGenerator.kt:262 */
   26     36   
                            "timeout" => {
          37  +
                                /* JsonParserGenerator.kt:272 */
   27     38   
                                builder = builder.set_timeout(
          39  +
                                    /* JsonParserGenerator.kt:365 */
   28     40   
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
   29     41   
                                        tokens.next(),
   30     42   
                                    )?
   31     43   
                                    .map(i32::try_from)
   32         -
                                    .transpose()?,
          44  +
                                    .transpose()?, /* JsonParserGenerator.kt:272 */
   33     45   
                                );
          46  +
                                /* JsonParserGenerator.kt:262 */
   34     47   
                            }
   35         -
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          48  +
                            /* JsonParserGenerator.kt:290 */
          49  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   36     50   
                        }
          51  +
                        /* JsonParserGenerator.kt:686 */
   37     52   
                    }
          53  +
                    /* JsonParserGenerator.kt:695 */
   38     54   
                    other => {
   39     55   
                        return Err(
   40     56   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   41     57   
                                format!("expected object key or end object, found: {:?}", other),
   42     58   
                            ),
   43     59   
                        )
          60  +
                    } /* JsonParserGenerator.kt:685 */
   44     61   
                }
          62  +
                /* JsonParserGenerator.kt:684 */
   45     63   
            }
   46         -
            }
          64  +
            /* JsonParserGenerator.kt:540 */
   47     65   
            Ok(Some(builder.build()))
          66  +
            /* JsonParserGenerator.kt:713 */
   48     67   
        }
   49         -
        _ => Err(
          68  +
        /* JsonParserGenerator.kt:722 */
          69  +
        _ => {
          70  +
            /* JsonParserGenerator.kt:723 */
          71  +
            Err(
   50     72   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   51     73   
                    "expected start object or null",
   52     74   
                ),
   53         -
        ),
          75  +
            )
          76  +
            /* JsonParserGenerator.kt:722 */
          77  +
        } /* JsonParserGenerator.kt:712 */
   54     78   
    }
          79  +
    /* JsonParserGenerator.kt:516 */
   55     80   
}
   56     81   
          82  +
/* JsonSerializerGenerator.kt:358 */
   57     83   
pub fn ser_test_config(
   58     84   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   59     85   
    input: &crate::model::TestConfig,
   60     86   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          87  +
    /* JsonSerializerGenerator.kt:382 */
   61     88   
    if let Some(var_1) = &input.timeout {
          89  +
        /* JsonSerializerGenerator.kt:432 */
   62     90   
        object.key("timeout").number(
   63     91   
            #[allow(clippy::useless_conversion)]
   64     92   
            ::aws_smithy_types::Number::NegInt((*var_1).into()),
   65     93   
        );
          94  +
        /* JsonSerializerGenerator.kt:382 */
   66     95   
    }
          96  +
    /* JsonSerializerGenerator.kt:372 */
   67     97   
    Ok(())
          98  +
    /* JsonSerializerGenerator.kt:358 */
   68     99   
}

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

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

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

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

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

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

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

@@ -1,1 +10,14 @@
    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_test_id_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::option::Option<::std::string::String>,
    6      7   
    ::aws_smithy_http::header::ParseError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:160 */
    8     10   
    let headers = header_map.get_all("X-Amz-Test-Id");
          11  +
    /* HttpBindingGenerator.kt:375 */
    9     12   
    ::aws_smithy_http::header::one_or_none(headers)
          13  +
    /* HttpBindingGenerator.kt:153 */
   10     14   
}

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

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

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

@@ -1,1 +121,169 @@
    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_test_payload_blob_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::TestPayloadBlobInput,
    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::test_payload_blob_input_internal::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   22     30   
        if let Some(value) =
   23     31   
            crate::protocol_serde::shape_test_payload_blob_input::de_content_type_header(&headers)?
   24     32   
        {
   25     33   
            input = input.set_content_type(Some(value))
   26     34   
        }
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   27     36   
        if let Some(value) = {
   28     37   
            let bytes = ::hyper::body::to_bytes(body).await?;
   29     38   
   30     39   
            crate::protocol_serde::shape_test_payload_blob_input::de_data_payload(&bytes)?
   31     40   
        } {
   32     41   
            input = input.set_data(Some(value))
   33     42   
        }
          43  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   34     44   
        input.build()
          45  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   35     46   
    })
          47  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   36     48   
}
   37     49   
          50  +
/* RustType.kt:516 */
   38     51   
#[allow(clippy::unnecessary_wraps)]
          52  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   39     53   
pub fn ser_test_payload_blob_http_response(
   40     54   
    #[allow(unused_variables)] output: crate::output::TestPayloadBlobOutput,
   41     55   
) -> std::result::Result<
   42     56   
    ::aws_smithy_http_server::response::Response,
   43     57   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   44     58   
> {
          59  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   45     60   
    Ok({
          61  +
        /* RustType.kt:516 */
   46     62   
        #[allow(unused_mut)]
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   47     64   
        let mut builder = ::http::Response::builder();
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:629 */
   48     66   
        builder = crate::protocol_serde::shape_test_payload_blob::ser_test_payload_blob_headers(
   49     67   
            &output, builder,
   50     68   
        )?;
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   51     70   
        let http_status: u16 = 200;
   52     71   
        builder = builder.status(http_status);
   53         -
        let payload = crate::protocol_serde::shape_test_payload_blob_output::ser_data_http_payload(
   54         -
            output.data,
   55         -
        )?;
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          73  +
        let payload =
          74  +
            /* HttpBoundProtocolPayloadGenerator.kt:350 */crate::protocol_serde::shape_test_payload_blob_output::ser_data_http_payload( output.data)?
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   56     77   
        let content_length = payload.len();
   57     78   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   58     79   
            builder,
   59     80   
            ::http::header::CONTENT_LENGTH,
   60     81   
            content_length,
   61     82   
        );
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   62     84   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          85  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   63     86   
        builder.body(body)?
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   64     88   
    })
          89  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   65     90   
}
   66     91   
          92  +
/* RustType.kt:516 */
   67     93   
#[allow(clippy::unnecessary_wraps)]
          94  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   68     95   
pub fn ser_test_payload_blob_http_error(
   69     96   
    error: &crate::error::TestPayloadBlobError,
   70     97   
) -> std::result::Result<
   71     98   
    ::aws_smithy_http_server::response::Response,
   72     99   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   73    100   
> {
         101  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   74    102   
    Ok({
         103  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   75    104   
        match error {
         105  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   76    106   
            crate::error::TestPayloadBlobError::InternalServerError(output) => {
         107  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   77    108   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         109  +
                /* RustType.kt:516 */
   78    110   
                #[allow(unused_mut)]
         111  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   79    112   
                let mut builder = ::http::Response::builder();
         113  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   80    114   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   81    115   
                    builder,
   82    116   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   83    117   
                    "InternalServerError",
   84    118   
                );
         119  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   85    120   
                let content_length = payload.len();
   86    121   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   87    122   
                    builder,
   88    123   
                    ::http::header::CONTENT_LENGTH,
   89    124   
                    content_length,
   90    125   
                );
         126  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   91    127   
                builder
   92    128   
                    .status(500)
   93    129   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         130  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         131  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   94    132   
        }
   95         -
        }
         133  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   96    134   
    })
         135  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
   97    136   
}
   98    137   
         138  +
/* HttpBindingGenerator.kt:542 */
   99    139   
pub fn ser_test_payload_blob_headers(
  100    140   
    input: &crate::output::TestPayloadBlobOutput,
  101    141   
    mut builder: ::http::response::Builder,
  102    142   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
  103    143   
{
         144  +
    /* HttpBindingGenerator.kt:592 */
  104    145   
    if let ::std::option::Option::Some(inner_1) = &input.content_type {
         146  +
        /* HttpBindingGenerator.kt:704 */
  105    147   
        let formatted_2 = inner_1.as_str();
         148  +
        /* HttpBindingGenerator.kt:705 */
  106    149   
        if !formatted_2.is_empty() {
         150  +
            /* HttpBindingGenerator.kt:706 */
  107    151   
            let header_value = formatted_2;
  108    152   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  109    153   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  110    154   
                    "content_type",
  111    155   
                    format!(
  112    156   
                        "`{}` cannot be used as a header value: {}",
  113    157   
                        &header_value, err
  114    158   
                    ),
  115    159   
                )
  116    160   
            })?;
  117    161   
            builder = builder.header("Content-Type", header_value);
         162  +
            /* HttpBindingGenerator.kt:705 */
  118    163   
        }
         164  +
        /* HttpBindingGenerator.kt:592 */
  119    165   
    }
         166  +
    /* HttpBindingGenerator.kt:555 */
  120    167   
    Ok(builder)
         168  +
    /* HttpBindingGenerator.kt:542 */
  121    169   
}

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

@@ -1,1 +21,32 @@
    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_content_type_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::option::Option<::std::string::String>,
    6      7   
    ::aws_smithy_http::header::ParseError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:160 */
    8     10   
    let headers = header_map.get_all("Content-Type");
          11  +
    /* HttpBindingGenerator.kt:375 */
    9     12   
    ::aws_smithy_http::header::one_or_none(headers)
          13  +
    /* HttpBindingGenerator.kt:153 */
   10     14   
}
   11     15   
          16  +
/* HttpBindingGenerator.kt:248 */
   12     17   
pub(crate) fn de_data_payload(
   13     18   
    body: &[u8],
   14     19   
) -> std::result::Result<
   15     20   
    ::std::option::Option<::aws_smithy_http_server_python::types::Blob>,
   16     21   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   17     22   
> {
          23  +
    /* HttpBindingGenerator.kt:319 */
   18     24   
    (!body.is_empty())
   19         -
        .then(|| Ok(::aws_smithy_http_server_python::types::Blob::new(body)))
          25  +
        .then(|| {
          26  +
            /* HttpBindingGenerator.kt:349 */
          27  +
            Ok(::aws_smithy_http_server_python::types::Blob::new(body))
          28  +
            /* HttpBindingGenerator.kt:319 */
          29  +
        })
   20     30   
        .transpose()
          31  +
    /* HttpBindingGenerator.kt:248 */
   21     32   
}

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/src/protocol_serde/shape_test_payload_blob_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_data_http_payload(
    3      4   
    payload: ::std::option::Option<::aws_smithy_http_server_python::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-python/rest_json/rust-server-codegen-python/src/protocol_serde/shape_test_payload_structure.rs

@@ -1,1 +136,186 @@
    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_test_payload_structure_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::TestPayloadStructureInput,
    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::test_payload_structure_input_internal::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   22     30   
        if let Some(value) = {
   23     31   
            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("application/json"),
   28     36   
                )?;
   29     37   
            }
   30     38   
            crate::protocol_serde::shape_test_payload_structure_input::de_payload_config_payload(
   31     39   
                &bytes,
   32     40   
            )?
   33     41   
        } {
   34     42   
            input = input.set_payload_config(Some(value))
   35     43   
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   36     45   
        if let Some(value) =
   37     46   
            crate::protocol_serde::shape_test_payload_structure_input::de_test_id_header(&headers)?
   38     47   
        {
   39     48   
            input = input.set_test_id(Some(value))
   40     49   
        }
          50  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   41     51   
        input.build()
          52  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   42     53   
    })
          54  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   43     55   
}
   44     56   
          57  +
/* RustType.kt:516 */
   45     58   
#[allow(clippy::unnecessary_wraps)]
          59  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   46     60   
pub fn ser_test_payload_structure_http_response(
   47     61   
    #[allow(unused_variables)] output: crate::output::TestPayloadStructureOutput,
   48     62   
) -> std::result::Result<
   49     63   
    ::aws_smithy_http_server::response::Response,
   50     64   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   51     65   
> {
          66  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   52     67   
    Ok({
          68  +
        /* RustType.kt:516 */
   53     69   
        #[allow(unused_mut)]
          70  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   54     71   
        let mut builder = ::http::Response::builder();
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:629 */
   55     73   
        builder = crate::protocol_serde::shape_test_payload_structure::ser_test_payload_structure_headers(&output, builder)?;
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   56     75   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     76   
            builder,
   58     77   
            ::http::header::CONTENT_TYPE,
   59     78   
            "application/json",
   60     79   
        );
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   61     81   
        let http_status: u16 = 200;
   62     82   
        builder = builder.status(http_status);
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   63     84   
        let payload =
   64         -
            crate::protocol_serde::shape_test_payload_structure_output::ser_payload_config_http_payload(& output.payload_config)?
   65         -
        ;
          85  +
            /* HttpBoundProtocolPayloadGenerator.kt:350 */crate::protocol_serde::shape_test_payload_structure_output::ser_payload_config_http_payload(& output.payload_config)?
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   66     88   
        let content_length = payload.len();
   67     89   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   68     90   
            builder,
   69     91   
            ::http::header::CONTENT_LENGTH,
   70     92   
            content_length,
   71     93   
        );
          94  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   72     95   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          96  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   73     97   
        builder.body(body)?
          98  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   74     99   
    })
         100  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   75    101   
}
   76    102   
         103  +
/* RustType.kt:516 */
   77    104   
#[allow(clippy::unnecessary_wraps)]
         105  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   78    106   
pub fn ser_test_payload_structure_http_error(
   79    107   
    error: &crate::error::TestPayloadStructureError,
   80    108   
) -> std::result::Result<
   81    109   
    ::aws_smithy_http_server::response::Response,
   82    110   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   83    111   
> {
         112  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   84    113   
    Ok({
         114  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   85    115   
        match error {
         116  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   86    117   
            crate::error::TestPayloadStructureError::InternalServerError(output) => {
         118  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   87    119   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         120  +
                /* RustType.kt:516 */
   88    121   
                #[allow(unused_mut)]
         122  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   89    123   
                let mut builder = ::http::Response::builder();
         124  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   90    125   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   91    126   
                    builder,
   92    127   
                    ::http::header::CONTENT_TYPE,
   93    128   
                    "application/json",
   94    129   
                );
         130  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   95    131   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   96    132   
                    builder,
   97    133   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   98    134   
                    "InternalServerError",
   99    135   
                );
         136  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  100    137   
                let content_length = payload.len();
  101    138   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  102    139   
                    builder,
  103    140   
                    ::http::header::CONTENT_LENGTH,
  104    141   
                    content_length,
  105    142   
                );
         143  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  106    144   
                builder
  107    145   
                    .status(500)
  108    146   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         147  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         148  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  109    149   
        }
  110         -
        }
         150  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  111    151   
    })
         152  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  112    153   
}
  113    154   
         155  +
/* HttpBindingGenerator.kt:542 */
  114    156   
pub fn ser_test_payload_structure_headers(
  115    157   
    input: &crate::output::TestPayloadStructureOutput,
  116    158   
    mut builder: ::http::response::Builder,
  117    159   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
  118    160   
{
         161  +
    /* HttpBindingGenerator.kt:592 */
  119    162   
    if let ::std::option::Option::Some(inner_1) = &input.test_id {
         163  +
        /* HttpBindingGenerator.kt:704 */
  120    164   
        let formatted_2 = inner_1.as_str();
         165  +
        /* HttpBindingGenerator.kt:705 */
  121    166   
        if !formatted_2.is_empty() {
         167  +
            /* HttpBindingGenerator.kt:706 */
  122    168   
            let header_value = formatted_2;
  123    169   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  124    170   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  125    171   
                    "test_id",
  126    172   
                    format!(
  127    173   
                        "`{}` cannot be used as a header value: {}",
  128    174   
                        &header_value, err
  129    175   
                    ),
  130    176   
                )
  131    177   
            })?;
  132    178   
            builder = builder.header("x-amz-test-id", header_value);
         179  +
            /* HttpBindingGenerator.kt:705 */
  133    180   
        }
         181  +
        /* HttpBindingGenerator.kt:592 */
  134    182   
    }
         183  +
    /* HttpBindingGenerator.kt:555 */
  135    184   
    Ok(builder)
         185  +
    /* HttpBindingGenerator.kt:542 */
  136    186   
}

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

@@ -1,1 +21,32 @@
    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_config_payload(
    3      4   
    body: &[u8],
    4      5   
) -> std::result::Result<
    5      6   
    ::std::option::Option<crate::model::PayloadConfig>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:319 */
    8     10   
    (!body.is_empty())
    9         -
        .then(|| crate::protocol_serde::shape_payload_config::de_payload_config_payload(body))
          11  +
        .then(|| {
          12  +
            /* ServerHttpBoundProtocolGenerator.kt:850 */
          13  +
            crate::protocol_serde::shape_payload_config::de_payload_config_payload(body)
          14  +
            /* HttpBindingGenerator.kt:319 */
          15  +
        })
   10     16   
        .transpose()
          17  +
    /* HttpBindingGenerator.kt:248 */
   11     18   
}
   12     19   
          20  +
/* HttpBindingGenerator.kt:153 */
   13     21   
pub(crate) fn de_test_id_header(
   14     22   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   15     23   
) -> ::std::result::Result<
   16     24   
    ::std::option::Option<::std::string::String>,
   17     25   
    ::aws_smithy_http::header::ParseError,
   18     26   
> {
          27  +
    /* HttpBindingGenerator.kt:160 */
   19     28   
    let headers = header_map.get_all("x-amz-test-id");
          29  +
    /* HttpBindingGenerator.kt:375 */
   20     30   
    ::aws_smithy_http::header::one_or_none(headers)
          31  +
    /* HttpBindingGenerator.kt:153 */
   21     32   
}

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

@@ -1,1 +27,44 @@
    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_config_http_payload(
    3      4   
    payload: &::std::option::Option<crate::model::PayloadConfig>,
    4      5   
) -> ::std::result::Result<::std::vec::Vec<u8>, ::aws_smithy_types::error::operation::BuildError> {
           6  +
    /* HttpBoundProtocolPayloadGenerator.kt:320 */
    5      7   
    let payload = match payload.as_ref() {
    6      8   
        Some(t) => t,
    7         -
        None => return Ok(crate::protocol_serde::rest_json_unset_struct_payload()),
           9  +
        None => {
          10  +
            return Ok(
          11  +
                /* HttpBoundProtocolPayloadGenerator.kt:338 */
          12  +
                crate::protocol_serde::rest_json_unset_struct_payload(), /* HttpBoundProtocolPayloadGenerator.kt:320 */
          13  +
            )
          14  +
        }
    8     15   
    };
          16  +
    /* HttpBoundProtocolPayloadGenerator.kt:345 */
    9     17   
    Ok(
          18  +
        /* HttpBoundProtocolPayloadGenerator.kt:386 */
   10     19   
        crate::protocol_serde::shape_test_payload_structure_output::ser_payload_config_payload(
   11     20   
            payload,
   12         -
        )?,
          21  +
        )?, /* HttpBoundProtocolPayloadGenerator.kt:345 */
   13     22   
    )
          23  +
    /* HttpBoundProtocolPayloadGenerator.kt:311 */
   14     24   
}
   15     25   
          26  +
/* JsonSerializerGenerator.kt:240 */
   16     27   
pub fn ser_payload_config_payload(
   17     28   
    input: &crate::model::PayloadConfig,
   18     29   
) -> std::result::Result<
   19     30   
    ::std::vec::Vec<u8>,
   20     31   
    ::aws_smithy_types::error::operation::SerializationError,
   21     32   
> {
          33  +
    /* JsonSerializerGenerator.kt:245 */
   22     34   
    let mut out = String::new();
          35  +
    /* JsonSerializerGenerator.kt:246 */
   23     36   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
          37  +
    /* JsonSerializerGenerator.kt:375 */
   24     38   
    crate::protocol_serde::shape_payload_config::ser_payload_config(&mut object, input)?;
          39  +
    /* JsonSerializerGenerator.kt:252 */
   25     40   
    object.finish();
          41  +
    /* JsonSerializerGenerator.kt:253 */
   26     42   
    Ok(out.into_bytes())
          43  +
    /* JsonSerializerGenerator.kt:240 */
   27     44   
}

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

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