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_post_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_post_no_input_no_payload_output_output_output(
    3      4   
    value: &crate::output::TestPostNoInputNoPayloadOutput,
    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_post_no_input_no_payload_output::ser_test_post_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_post_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::TestPostNoInputNoPayloadOutput,
   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_post_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_post_no_payload_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::TestPostNoPayloadInput,
    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_post_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_post_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_post_no_payload_http_response(
   33     46   
    #[allow(unused_variables)] output: crate::output::TestPostNoPayloadOutput,
   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_post_no_payload::ser_test_post_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_post_no_payload_output::ser_test_post_no_payload_output_output_output(&output)?
   54         -
        ;
          73  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_test_post_no_payload_output::ser_test_post_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_post_no_payload_http_error(
   68     95   
    error: &crate::error::TestPostNoPayloadError,
   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::TestPostNoPayloadError::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_post_no_payload_headers(
  104    145   
    input: &crate::output::TestPostNoPayloadOutput,
  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_post_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_post_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_post_no_payload_output_output_output(
    3      4   
    value: &crate::output::TestPostNoPayloadOutput,
    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_post_no_payload_output::ser_test_post_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_post_no_payload_output_output(
   13     19   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    #[allow(unused_variables)] input: &crate::output::TestPostNoPayloadOutput,
   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_string_list.rs

@@ -1,1 +52,78 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:398 */
    2      3   
pub(crate) fn de_test_string_list<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<::std::vec::Vec<::std::string::String>>,
    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::StartArray { .. }) => {
          22  +
            /* JsonParserGenerator.kt:407 */
   19     23   
            let mut items = Vec::new();
          24  +
            /* JsonParserGenerator.kt:408 */
   20     25   
            loop {
          26  +
                /* JsonParserGenerator.kt:409 */
   21     27   
                match tokens.peek() {
          28  +
                    /* JsonParserGenerator.kt:410 */
   22     29   
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
          30  +
                        /* JsonParserGenerator.kt:411 */
   23     31   
                        tokens.next().transpose().unwrap();
   24     32   
                        break;
          33  +
                        /* JsonParserGenerator.kt:410 */
   25     34   
                    }
          35  +
                    /* JsonParserGenerator.kt:413 */
   26     36   
                    _ => {
   27         -
                        let value = ::aws_smithy_json::deserialize::token::expect_string_or_null(
   28         -
                            tokens.next(),
   29         -
                        )?
   30         -
                        .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   31         -
                        .transpose()?;
          37  +
                        /* JsonParserGenerator.kt:419 */
          38  +
                        let value =
          39  +
                            /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          40  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          41  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
          42  +
                                /* JsonParserGenerator.kt:339 */)
          43  +
                            /* JsonParserGenerator.kt:354 */).transpose()?
          44  +
                        /* JsonParserGenerator.kt:419 */;
          45  +
                        /* JsonParserGenerator.kt:422 */
   32     46   
                        if let Some(value) = value {
   33     47   
                            items.push(value);
   34         -
                        } else {
          48  +
                        }
          49  +
                        /* JsonParserGenerator.kt:430 */
          50  +
                        else {
   35     51   
                            return Err(
   36     52   
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37     53   
                                    "dense list cannot contain null values",
   38     54   
                                ),
   39     55   
                            );
   40     56   
                        }
          57  +
                        /* JsonParserGenerator.kt:413 */
          58  +
                    } /* JsonParserGenerator.kt:409 */
   41     59   
                }
          60  +
                /* JsonParserGenerator.kt:408 */
   42     61   
            }
   43         -
            }
          62  +
            /* JsonParserGenerator.kt:446 */
   44     63   
            Ok(Some(items))
          64  +
            /* JsonParserGenerator.kt:713 */
   45     65   
        }
   46         -
        _ => Err(
          66  +
        /* JsonParserGenerator.kt:722 */
          67  +
        _ => {
          68  +
            /* JsonParserGenerator.kt:723 */
          69  +
            Err(
   47     70   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   48     71   
                    "expected start array or null",
   49     72   
                ),
   50         -
        ),
          73  +
            )
          74  +
            /* JsonParserGenerator.kt:722 */
          75  +
        } /* JsonParserGenerator.kt:712 */
   51     76   
    }
          77  +
    /* JsonParserGenerator.kt:398 */
   52     78   
}

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

@@ -1,1 +60,87 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:460 */
    2      3   
pub(crate) fn de_test_string_map<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    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  +
            /* JsonParserGenerator.kt:469 */
   19     23   
            let mut map = ::std::collections::HashMap::new();
          24  +
            /* JsonParserGenerator.kt:684 */
   20     25   
            loop {
          26  +
                /* JsonParserGenerator.kt:685 */
   21     27   
                match tokens.next().transpose()? {
          28  +
                    /* JsonParserGenerator.kt:686 */
   22     29   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   23     30   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
   24         -
                        let key = key.to_unescaped().map(|u| u.into_owned())?;
   25         -
                        let value = ::aws_smithy_json::deserialize::token::expect_string_or_null(
   26         -
                            tokens.next(),
   27         -
                        )?
   28         -
                        .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   29         -
                        .transpose()?;
          31  +
                        /* JsonParserGenerator.kt:471 */
          32  +
                        let key =
          33  +
                            /* JsonParserGenerator.kt:339 */key.to_unescaped().map(|u|
          34  +
                                /* JsonParserGenerator.kt:348 */u.into_owned()
          35  +
                            /* JsonParserGenerator.kt:339 */)
          36  +
                        /* JsonParserGenerator.kt:471 */?;
          37  +
                        /* JsonParserGenerator.kt:474 */
          38  +
                        let value =
          39  +
                            /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          40  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          41  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
          42  +
                                /* JsonParserGenerator.kt:339 */)
          43  +
                            /* JsonParserGenerator.kt:354 */).transpose()?
          44  +
                        /* JsonParserGenerator.kt:474 */;
          45  +
                        /* JsonParserGenerator.kt:481 */
   30     46   
                        match value {
   31     47   
                            Some(value) => {
   32     48   
                                map.insert(key, value);
   33     49   
                            }
   34     50   
                            None => {
   35     51   
                                return Err(
   36     52   
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37     53   
                                        "dense map cannot contain null values",
   38     54   
                                    ),
   39     55   
                                )
   40     56   
                            }
   41     57   
                        }
          58  +
                        /* JsonParserGenerator.kt:686 */
   42     59   
                    }
          60  +
                    /* JsonParserGenerator.kt:695 */
   43     61   
                    other => {
   44     62   
                        return Err(
   45     63   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   46     64   
                                format!("expected object key or end object, found: {:?}", other),
   47     65   
                            ),
   48     66   
                        )
          67  +
                    } /* JsonParserGenerator.kt:685 */
   49     68   
                }
          69  +
                /* JsonParserGenerator.kt:684 */
   50     70   
            }
   51         -
            }
          71  +
            /* JsonParserGenerator.kt:504 */
   52     72   
            Ok(Some(map))
          73  +
            /* JsonParserGenerator.kt:713 */
   53     74   
        }
   54         -
        _ => Err(
          75  +
        /* JsonParserGenerator.kt:722 */
          76  +
        _ => {
          77  +
            /* JsonParserGenerator.kt:723 */
          78  +
            Err(
   55     79   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   56     80   
                    "expected start object or null",
   57     81   
                ),
   58         -
        ),
          82  +
            )
          83  +
            /* JsonParserGenerator.kt:722 */
          84  +
        } /* JsonParserGenerator.kt:712 */
   59     85   
    }
          86  +
    /* JsonParserGenerator.kt:460 */
   60     87   
}

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

@@ -1,1 +254,345 @@
    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_timestamp_format_headers_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::TimestampFormatHeadersInput,
    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::timestamp_format_headers_input_internal::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   22     30   
        if let Some(value) =
   23     31   
            crate::protocol_serde::shape_timestamp_format_headers_input::de_default_format_header(
   24     32   
                &headers,
   25     33   
            )?
   26     34   
        {
   27     35   
            input = input.set_default_format(Some(value))
   28     36   
        }
          37  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   29     38   
        if let Some(value) =
   30     39   
            crate::protocol_serde::shape_timestamp_format_headers_input::de_member_date_time_header(
   31     40   
                &headers,
   32     41   
            )?
   33     42   
        {
   34     43   
            input = input.set_member_date_time(Some(value))
   35     44   
        }
          45  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   36     46   
        if let Some(value) = crate::protocol_serde::shape_timestamp_format_headers_input::de_member_epoch_seconds_header(&headers)? {
   37     47   
                                input = input.set_member_epoch_seconds(Some(value))
   38     48   
                            }
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   39     50   
        if let Some(value) =
   40     51   
            crate::protocol_serde::shape_timestamp_format_headers_input::de_member_http_date_header(
   41     52   
                &headers,
   42     53   
            )?
   43     54   
        {
   44     55   
            input = input.set_member_http_date(Some(value))
   45     56   
        }
          57  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   46     58   
        if let Some(value) =
   47     59   
            crate::protocol_serde::shape_timestamp_format_headers_input::de_target_date_time_header(
   48     60   
                &headers,
   49     61   
            )?
   50     62   
        {
   51     63   
            input = input.set_target_date_time(Some(value))
   52     64   
        }
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   53     66   
        if let Some(value) = crate::protocol_serde::shape_timestamp_format_headers_input::de_target_epoch_seconds_header(&headers)? {
   54     67   
                                input = input.set_target_epoch_seconds(Some(value))
   55     68   
                            }
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   56     70   
        if let Some(value) =
   57     71   
            crate::protocol_serde::shape_timestamp_format_headers_input::de_target_http_date_header(
   58     72   
                &headers,
   59     73   
            )?
   60     74   
        {
   61     75   
            input = input.set_target_http_date(Some(value))
   62     76   
        }
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   63     78   
        input.build()
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   64     80   
    })
          81  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   65     82   
}
   66     83   
          84  +
/* RustType.kt:516 */
   67     85   
#[allow(clippy::unnecessary_wraps)]
          86  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   68     87   
pub fn ser_timestamp_format_headers_http_response(
   69     88   
    #[allow(unused_variables)] output: crate::output::TimestampFormatHeadersOutput,
   70     89   
) -> std::result::Result<
   71     90   
    ::aws_smithy_http_server::response::Response,
   72     91   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   73     92   
> {
          93  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   74     94   
    Ok({
          95  +
        /* RustType.kt:516 */
   75     96   
        #[allow(unused_mut)]
          97  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   76     98   
        let mut builder = ::http::Response::builder();
          99  +
        /* ServerHttpBoundProtocolGenerator.kt:629 */
   77    100   
        builder = crate::protocol_serde::shape_timestamp_format_headers::ser_timestamp_format_headers_headers(&output, builder)?;
         101  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   78    102   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   79    103   
            builder,
   80    104   
            ::http::header::CONTENT_TYPE,
   81    105   
            "application/json",
   82    106   
        );
         107  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   83    108   
        let http_status: u16 = 200;
   84    109   
        builder = builder.status(http_status);
         110  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   85    111   
        let payload =
   86         -
            crate::protocol_serde::shape_timestamp_format_headers_output::ser_timestamp_format_headers_output_output_output(&output)?
   87         -
        ;
         112  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_timestamp_format_headers_output::ser_timestamp_format_headers_output_output_output(&output)?
         113  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
         114  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   88    115   
        let content_length = payload.len();
   89    116   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   90    117   
            builder,
   91    118   
            ::http::header::CONTENT_LENGTH,
   92    119   
            content_length,
   93    120   
        );
         121  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   94    122   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
         123  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   95    124   
        builder.body(body)?
         125  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   96    126   
    })
         127  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   97    128   
}
   98    129   
         130  +
/* RustType.kt:516 */
   99    131   
#[allow(clippy::unnecessary_wraps)]
         132  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
  100    133   
pub fn ser_timestamp_format_headers_http_error(
  101    134   
    error: &crate::error::TimestampFormatHeadersError,
  102    135   
) -> std::result::Result<
  103    136   
    ::aws_smithy_http_server::response::Response,
  104    137   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
  105    138   
> {
         139  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
  106    140   
    Ok({
         141  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
  107    142   
        match error {
         143  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  108    144   
            crate::error::TimestampFormatHeadersError::InternalServerError(output) => {
         145  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  109    146   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         147  +
                /* RustType.kt:516 */
  110    148   
                #[allow(unused_mut)]
         149  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  111    150   
                let mut builder = ::http::Response::builder();
         151  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  112    152   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  113    153   
                    builder,
  114    154   
                    ::http::header::CONTENT_TYPE,
  115    155   
                    "application/json",
  116    156   
                );
         157  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  117    158   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  118    159   
                    builder,
  119    160   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  120    161   
                    "InternalServerError",
  121    162   
                );
         163  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  122    164   
                let content_length = payload.len();
  123    165   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  124    166   
                    builder,
  125    167   
                    ::http::header::CONTENT_LENGTH,
  126    168   
                    content_length,
  127    169   
                );
         170  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  128    171   
                builder
  129    172   
                    .status(500)
  130    173   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         174  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         175  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  131    176   
        }
  132         -
        }
         177  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  133    178   
    })
         179  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  134    180   
}
  135    181   
         182  +
/* HttpBindingGenerator.kt:542 */
  136    183   
pub fn ser_timestamp_format_headers_headers(
  137    184   
    input: &crate::output::TimestampFormatHeadersOutput,
  138    185   
    mut builder: ::http::response::Builder,
  139    186   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
  140    187   
{
         188  +
    /* HttpBindingGenerator.kt:592 */
  141    189   
    if let ::std::option::Option::Some(inner_1) = &input.member_epoch_seconds {
         190  +
        /* HttpBindingGenerator.kt:704 */
  142    191   
        let formatted_2 = inner_1.fmt(::aws_smithy_types::date_time::Format::EpochSeconds)?;
         192  +
        /* HttpBindingGenerator.kt:705 */
  143    193   
        if !formatted_2.is_empty() {
         194  +
            /* HttpBindingGenerator.kt:706 */
  144    195   
            let header_value = formatted_2;
  145    196   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  146    197   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  147    198   
                    "member_epoch_seconds",
  148    199   
                    format!(
  149    200   
                        "`{}` cannot be used as a header value: {}",
  150    201   
                        &header_value, err
  151    202   
                    ),
  152    203   
                )
  153    204   
            })?;
  154    205   
            builder = builder.header("X-memberEpochSeconds", header_value);
         206  +
            /* HttpBindingGenerator.kt:705 */
  155    207   
        }
         208  +
        /* HttpBindingGenerator.kt:592 */
  156    209   
    }
         210  +
    /* HttpBindingGenerator.kt:592 */
  157    211   
    if let ::std::option::Option::Some(inner_3) = &input.member_http_date {
         212  +
        /* HttpBindingGenerator.kt:704 */
  158    213   
        let formatted_4 = inner_3.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
         214  +
        /* HttpBindingGenerator.kt:705 */
  159    215   
        if !formatted_4.is_empty() {
         216  +
            /* HttpBindingGenerator.kt:706 */
  160    217   
            let header_value = formatted_4;
  161    218   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  162    219   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  163    220   
                    "member_http_date",
  164    221   
                    format!(
  165    222   
                        "`{}` cannot be used as a header value: {}",
  166    223   
                        &header_value, err
  167    224   
                    ),
  168    225   
                )
  169    226   
            })?;
  170    227   
            builder = builder.header("X-memberHttpDate", header_value);
         228  +
            /* HttpBindingGenerator.kt:705 */
  171    229   
        }
         230  +
        /* HttpBindingGenerator.kt:592 */
  172    231   
    }
         232  +
    /* HttpBindingGenerator.kt:592 */
  173    233   
    if let ::std::option::Option::Some(inner_5) = &input.member_date_time {
         234  +
        /* HttpBindingGenerator.kt:704 */
  174    235   
        let formatted_6 = inner_5.fmt(::aws_smithy_types::date_time::Format::DateTime)?;
         236  +
        /* HttpBindingGenerator.kt:705 */
  175    237   
        if !formatted_6.is_empty() {
         238  +
            /* HttpBindingGenerator.kt:706 */
  176    239   
            let header_value = formatted_6;
  177    240   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  178    241   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  179    242   
                    "member_date_time",
  180    243   
                    format!(
  181    244   
                        "`{}` cannot be used as a header value: {}",
  182    245   
                        &header_value, err
  183    246   
                    ),
  184    247   
                )
  185    248   
            })?;
  186    249   
            builder = builder.header("X-memberDateTime", header_value);
         250  +
            /* HttpBindingGenerator.kt:705 */
  187    251   
        }
         252  +
        /* HttpBindingGenerator.kt:592 */
  188    253   
    }
         254  +
    /* HttpBindingGenerator.kt:592 */
  189    255   
    if let ::std::option::Option::Some(inner_7) = &input.default_format {
         256  +
        /* HttpBindingGenerator.kt:704 */
  190    257   
        let formatted_8 = inner_7.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
         258  +
        /* HttpBindingGenerator.kt:705 */
  191    259   
        if !formatted_8.is_empty() {
         260  +
            /* HttpBindingGenerator.kt:706 */
  192    261   
            let header_value = formatted_8;
  193    262   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  194    263   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  195    264   
                    "default_format",
  196    265   
                    format!(
  197    266   
                        "`{}` cannot be used as a header value: {}",
  198    267   
                        &header_value, err
  199    268   
                    ),
  200    269   
                )
  201    270   
            })?;
  202    271   
            builder = builder.header("X-defaultFormat", header_value);
         272  +
            /* HttpBindingGenerator.kt:705 */
  203    273   
        }
         274  +
        /* HttpBindingGenerator.kt:592 */
  204    275   
    }
         276  +
    /* HttpBindingGenerator.kt:592 */
  205    277   
    if let ::std::option::Option::Some(inner_9) = &input.target_epoch_seconds {
         278  +
        /* HttpBindingGenerator.kt:704 */
  206    279   
        let formatted_10 = inner_9.fmt(::aws_smithy_types::date_time::Format::EpochSeconds)?;
         280  +
        /* HttpBindingGenerator.kt:705 */
  207    281   
        if !formatted_10.is_empty() {
         282  +
            /* HttpBindingGenerator.kt:706 */
  208    283   
            let header_value = formatted_10;
  209    284   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  210    285   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  211    286   
                    "target_epoch_seconds",
  212    287   
                    format!(
  213    288   
                        "`{}` cannot be used as a header value: {}",
  214    289   
                        &header_value, err
  215    290   
                    ),
  216    291   
                )
  217    292   
            })?;
  218    293   
            builder = builder.header("X-targetEpochSeconds", header_value);
         294  +
            /* HttpBindingGenerator.kt:705 */
  219    295   
        }
         296  +
        /* HttpBindingGenerator.kt:592 */
  220    297   
    }
         298  +
    /* HttpBindingGenerator.kt:592 */
  221    299   
    if let ::std::option::Option::Some(inner_11) = &input.target_http_date {
         300  +
        /* HttpBindingGenerator.kt:704 */
  222    301   
        let formatted_12 = inner_11.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
         302  +
        /* HttpBindingGenerator.kt:705 */
  223    303   
        if !formatted_12.is_empty() {
         304  +
            /* HttpBindingGenerator.kt:706 */
  224    305   
            let header_value = formatted_12;
  225    306   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  226    307   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  227    308   
                    "target_http_date",
  228    309   
                    format!(
  229    310   
                        "`{}` cannot be used as a header value: {}",
  230    311   
                        &header_value, err
  231    312   
                    ),
  232    313   
                )
  233    314   
            })?;
  234    315   
            builder = builder.header("X-targetHttpDate", header_value);
         316  +
            /* HttpBindingGenerator.kt:705 */
  235    317   
        }
         318  +
        /* HttpBindingGenerator.kt:592 */
  236    319   
    }
         320  +
    /* HttpBindingGenerator.kt:592 */
  237    321   
    if let ::std::option::Option::Some(inner_13) = &input.target_date_time {
         322  +
        /* HttpBindingGenerator.kt:704 */
  238    323   
        let formatted_14 = inner_13.fmt(::aws_smithy_types::date_time::Format::DateTime)?;
         324  +
        /* HttpBindingGenerator.kt:705 */
  239    325   
        if !formatted_14.is_empty() {
         326  +
            /* HttpBindingGenerator.kt:706 */
  240    327   
            let header_value = formatted_14;
  241    328   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  242    329   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  243    330   
                    "target_date_time",
  244    331   
                    format!(
  245    332   
                        "`{}` cannot be used as a header value: {}",
  246    333   
                        &header_value, err
  247    334   
                    ),
  248    335   
                )
  249    336   
            })?;
  250    337   
            builder = builder.header("X-targetDateTime", header_value);
         338  +
            /* HttpBindingGenerator.kt:705 */
  251    339   
        }
         340  +
        /* HttpBindingGenerator.kt:592 */
  252    341   
    }
         342  +
    /* HttpBindingGenerator.kt:555 */
  253    343   
    Ok(builder)
         344  +
    /* HttpBindingGenerator.kt:542 */
  254    345   
}

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

@@ -1,1 +182,182 @@
    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_default_format_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::option::Option<::aws_smithy_http_server_python::types::DateTime>,
    6      7   
    ::aws_smithy_http::header::ParseError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:160 */
    8     10   
    let headers = header_map.get_all("X-defaultFormat");
    9         -
    let var_1: Vec<::aws_smithy_http_server_python::types::DateTime> =
   10         -
        ::aws_smithy_http::header::many_dates(
   11         -
            headers,
   12         -
            ::aws_smithy_types::date_time::Format::HttpDate,
   13         -
        )?
   14         -
        .into_iter()
   15         -
        .map(::aws_smithy_http_server_python::types::DateTime::from)
   16         -
        .collect();
          11  +
    /* HttpBindingGenerator.kt:394 */
          12  +
    let var_1: Vec<::aws_smithy_http_server_python::types::DateTime> = ::aws_smithy_http::header::many_dates(headers, ::aws_smithy_types::date_time::Format::HttpDate)?
          13  +
    /* PythonServerProtocolLoader.kt:84 */.into_iter().map(::aws_smithy_http_server_python::types::DateTime::from).collect()
          14  +
    /* HttpBindingGenerator.kt:402 */;
          15  +
    /* HttpBindingGenerator.kt:468 */
   17     16   
    if var_1.len() > 1 {
   18     17   
        Err(::aws_smithy_http::header::ParseError::new(format!(
   19     18   
            "expected one item but found {}",
   20     19   
            var_1.len()
   21     20   
        )))
   22     21   
    } else {
   23     22   
        let mut var_1 = var_1;
   24     23   
        Ok(var_1.pop())
   25     24   
    }
          25  +
    /* HttpBindingGenerator.kt:153 */
   26     26   
}
   27     27   
          28  +
/* HttpBindingGenerator.kt:153 */
   28     29   
pub(crate) fn de_member_date_time_header(
   29     30   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   30     31   
) -> ::std::result::Result<
   31     32   
    ::std::option::Option<::aws_smithy_http_server_python::types::DateTime>,
   32     33   
    ::aws_smithy_http::header::ParseError,
   33     34   
> {
          35  +
    /* HttpBindingGenerator.kt:160 */
   34     36   
    let headers = header_map.get_all("X-memberDateTime");
   35         -
    let var_2: Vec<::aws_smithy_http_server_python::types::DateTime> =
   36         -
        ::aws_smithy_http::header::many_dates(
   37         -
            headers,
   38         -
            ::aws_smithy_types::date_time::Format::DateTime,
   39         -
        )?
   40         -
        .into_iter()
   41         -
        .map(::aws_smithy_http_server_python::types::DateTime::from)
   42         -
        .collect();
          37  +
    /* HttpBindingGenerator.kt:394 */
          38  +
    let var_2: Vec<::aws_smithy_http_server_python::types::DateTime> = ::aws_smithy_http::header::many_dates(headers, ::aws_smithy_types::date_time::Format::DateTime)?
          39  +
    /* PythonServerProtocolLoader.kt:84 */.into_iter().map(::aws_smithy_http_server_python::types::DateTime::from).collect()
          40  +
    /* HttpBindingGenerator.kt:402 */;
          41  +
    /* HttpBindingGenerator.kt:468 */
   43     42   
    if var_2.len() > 1 {
   44     43   
        Err(::aws_smithy_http::header::ParseError::new(format!(
   45     44   
            "expected one item but found {}",
   46     45   
            var_2.len()
   47     46   
        )))
   48     47   
    } else {
   49     48   
        let mut var_2 = var_2;
   50     49   
        Ok(var_2.pop())
   51     50   
    }
          51  +
    /* HttpBindingGenerator.kt:153 */
   52     52   
}
   53     53   
          54  +
/* HttpBindingGenerator.kt:153 */
   54     55   
pub(crate) fn de_member_epoch_seconds_header(
   55     56   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   56     57   
) -> ::std::result::Result<
   57     58   
    ::std::option::Option<::aws_smithy_http_server_python::types::DateTime>,
   58     59   
    ::aws_smithy_http::header::ParseError,
   59     60   
> {
          61  +
    /* HttpBindingGenerator.kt:160 */
   60     62   
    let headers = header_map.get_all("X-memberEpochSeconds");
   61         -
    let var_3: Vec<::aws_smithy_http_server_python::types::DateTime> =
   62         -
        ::aws_smithy_http::header::many_dates(
   63         -
            headers,
   64         -
            ::aws_smithy_types::date_time::Format::EpochSeconds,
   65         -
        )?
   66         -
        .into_iter()
   67         -
        .map(::aws_smithy_http_server_python::types::DateTime::from)
   68         -
        .collect();
          63  +
    /* HttpBindingGenerator.kt:394 */
          64  +
    let var_3: Vec<::aws_smithy_http_server_python::types::DateTime> = ::aws_smithy_http::header::many_dates(headers, ::aws_smithy_types::date_time::Format::EpochSeconds)?
          65  +
    /* PythonServerProtocolLoader.kt:84 */.into_iter().map(::aws_smithy_http_server_python::types::DateTime::from).collect()
          66  +
    /* HttpBindingGenerator.kt:402 */;
          67  +
    /* HttpBindingGenerator.kt:468 */
   69     68   
    if var_3.len() > 1 {
   70     69   
        Err(::aws_smithy_http::header::ParseError::new(format!(
   71     70   
            "expected one item but found {}",
   72     71   
            var_3.len()
   73     72   
        )))
   74     73   
    } else {
   75     74   
        let mut var_3 = var_3;
   76     75   
        Ok(var_3.pop())
   77     76   
    }
          77  +
    /* HttpBindingGenerator.kt:153 */
   78     78   
}
   79     79   
          80  +
/* HttpBindingGenerator.kt:153 */
   80     81   
pub(crate) fn de_member_http_date_header(
   81     82   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   82     83   
) -> ::std::result::Result<
   83     84   
    ::std::option::Option<::aws_smithy_http_server_python::types::DateTime>,
   84     85   
    ::aws_smithy_http::header::ParseError,
   85     86   
> {
          87  +
    /* HttpBindingGenerator.kt:160 */
   86     88   
    let headers = header_map.get_all("X-memberHttpDate");
   87         -
    let var_4: Vec<::aws_smithy_http_server_python::types::DateTime> =
   88         -
        ::aws_smithy_http::header::many_dates(
   89         -
            headers,
   90         -
            ::aws_smithy_types::date_time::Format::HttpDate,
   91         -
        )?
   92         -
        .into_iter()
   93         -
        .map(::aws_smithy_http_server_python::types::DateTime::from)
   94         -
        .collect();
          89  +
    /* HttpBindingGenerator.kt:394 */
          90  +
    let var_4: Vec<::aws_smithy_http_server_python::types::DateTime> = ::aws_smithy_http::header::many_dates(headers, ::aws_smithy_types::date_time::Format::HttpDate)?
          91  +
    /* PythonServerProtocolLoader.kt:84 */.into_iter().map(::aws_smithy_http_server_python::types::DateTime::from).collect()
          92  +
    /* HttpBindingGenerator.kt:402 */;
          93  +
    /* HttpBindingGenerator.kt:468 */
   95     94   
    if var_4.len() > 1 {
   96     95   
        Err(::aws_smithy_http::header::ParseError::new(format!(
   97     96   
            "expected one item but found {}",
   98     97   
            var_4.len()
   99     98   
        )))
  100     99   
    } else {
  101    100   
        let mut var_4 = var_4;
  102    101   
        Ok(var_4.pop())
  103    102   
    }
         103  +
    /* HttpBindingGenerator.kt:153 */
  104    104   
}
  105    105   
         106  +
/* HttpBindingGenerator.kt:153 */
  106    107   
pub(crate) fn de_target_date_time_header(
  107    108   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  108    109   
) -> ::std::result::Result<
  109    110   
    ::std::option::Option<::aws_smithy_http_server_python::types::DateTime>,
  110    111   
    ::aws_smithy_http::header::ParseError,
  111    112   
> {
         113  +
    /* HttpBindingGenerator.kt:160 */
  112    114   
    let headers = header_map.get_all("X-targetDateTime");
  113         -
    let var_5: Vec<::aws_smithy_http_server_python::types::DateTime> =
  114         -
        ::aws_smithy_http::header::many_dates(
  115         -
            headers,
  116         -
            ::aws_smithy_types::date_time::Format::DateTime,
  117         -
        )?
  118         -
        .into_iter()
  119         -
        .map(::aws_smithy_http_server_python::types::DateTime::from)
  120         -
        .collect();
         115  +
    /* HttpBindingGenerator.kt:394 */
         116  +
    let var_5: Vec<::aws_smithy_http_server_python::types::DateTime> = ::aws_smithy_http::header::many_dates(headers, ::aws_smithy_types::date_time::Format::DateTime)?
         117  +
    /* PythonServerProtocolLoader.kt:84 */.into_iter().map(::aws_smithy_http_server_python::types::DateTime::from).collect()
         118  +
    /* HttpBindingGenerator.kt:402 */;
         119  +
    /* HttpBindingGenerator.kt:468 */
  121    120   
    if var_5.len() > 1 {
  122    121   
        Err(::aws_smithy_http::header::ParseError::new(format!(
  123    122   
            "expected one item but found {}",
  124    123   
            var_5.len()
  125    124   
        )))
  126    125   
    } else {
  127    126   
        let mut var_5 = var_5;
  128    127   
        Ok(var_5.pop())
  129    128   
    }
         129  +
    /* HttpBindingGenerator.kt:153 */
  130    130   
}
  131    131   
         132  +
/* HttpBindingGenerator.kt:153 */
  132    133   
pub(crate) fn de_target_epoch_seconds_header(
  133    134   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  134    135   
) -> ::std::result::Result<
  135    136   
    ::std::option::Option<::aws_smithy_http_server_python::types::DateTime>,
  136    137   
    ::aws_smithy_http::header::ParseError,
  137    138   
> {
         139  +
    /* HttpBindingGenerator.kt:160 */
  138    140   
    let headers = header_map.get_all("X-targetEpochSeconds");
  139         -
    let var_6: Vec<::aws_smithy_http_server_python::types::DateTime> =
  140         -
        ::aws_smithy_http::header::many_dates(
  141         -
            headers,
  142         -
            ::aws_smithy_types::date_time::Format::EpochSeconds,
  143         -
        )?
  144         -
        .into_iter()
  145         -
        .map(::aws_smithy_http_server_python::types::DateTime::from)
  146         -
        .collect();
         141  +
    /* HttpBindingGenerator.kt:394 */
         142  +
    let var_6: Vec<::aws_smithy_http_server_python::types::DateTime> = ::aws_smithy_http::header::many_dates(headers, ::aws_smithy_types::date_time::Format::EpochSeconds)?
         143  +
    /* PythonServerProtocolLoader.kt:84 */.into_iter().map(::aws_smithy_http_server_python::types::DateTime::from).collect()
         144  +
    /* HttpBindingGenerator.kt:402 */;
         145  +
    /* HttpBindingGenerator.kt:468 */
  147    146   
    if var_6.len() > 1 {
  148    147   
        Err(::aws_smithy_http::header::ParseError::new(format!(
  149    148   
            "expected one item but found {}",
  150    149   
            var_6.len()
  151    150   
        )))
  152    151   
    } else {
  153    152   
        let mut var_6 = var_6;
  154    153   
        Ok(var_6.pop())
  155    154   
    }
         155  +
    /* HttpBindingGenerator.kt:153 */
  156    156   
}
  157    157   
         158  +
/* HttpBindingGenerator.kt:153 */
  158    159   
pub(crate) fn de_target_http_date_header(
  159    160   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  160    161   
) -> ::std::result::Result<
  161    162   
    ::std::option::Option<::aws_smithy_http_server_python::types::DateTime>,
  162    163   
    ::aws_smithy_http::header::ParseError,
  163    164   
> {
         165  +
    /* HttpBindingGenerator.kt:160 */
  164    166   
    let headers = header_map.get_all("X-targetHttpDate");
  165         -
    let var_7: Vec<::aws_smithy_http_server_python::types::DateTime> =
  166         -
        ::aws_smithy_http::header::many_dates(
  167         -
            headers,
  168         -
            ::aws_smithy_types::date_time::Format::HttpDate,
  169         -
        )?
  170         -
        .into_iter()
  171         -
        .map(::aws_smithy_http_server_python::types::DateTime::from)
  172         -
        .collect();
         167  +
    /* HttpBindingGenerator.kt:394 */
         168  +
    let var_7: Vec<::aws_smithy_http_server_python::types::DateTime> = ::aws_smithy_http::header::many_dates(headers, ::aws_smithy_types::date_time::Format::HttpDate)?
         169  +
    /* PythonServerProtocolLoader.kt:84 */.into_iter().map(::aws_smithy_http_server_python::types::DateTime::from).collect()
         170  +
    /* HttpBindingGenerator.kt:402 */;
         171  +
    /* HttpBindingGenerator.kt:468 */
  173    172   
    if var_7.len() > 1 {
  174    173   
        Err(::aws_smithy_http::header::ParseError::new(format!(
  175    174   
            "expected one item but found {}",
  176    175   
            var_7.len()
  177    176   
        )))
  178    177   
    } else {
  179    178   
        let mut var_7 = var_7;
  180    179   
        Ok(var_7.pop())
  181    180   
    }
         181  +
    /* HttpBindingGenerator.kt:153 */
  182    182   
}

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/src/protocol_serde/shape_timestamp_format_headers_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_timestamp_format_headers_output_output_output(
    3      4   
    value: &crate::output::TimestampFormatHeadersOutput,
    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_timestamp_format_headers_output::ser_timestamp_format_headers_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_timestamp_format_headers_output_output(
   13     19   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    #[allow(unused_variables)] input: &crate::output::TimestampFormatHeadersOutput,
   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_timestamp_list.rs

@@ -1,1 +53,75 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:398 */
    2      3   
pub(crate) fn de_timestamp_list<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<::std::vec::Vec<::aws_smithy_http_server_python::types::DateTime>>,
    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::StartArray { .. }) => {
          22  +
            /* JsonParserGenerator.kt:407 */
   19     23   
            let mut items = Vec::new();
          24  +
            /* JsonParserGenerator.kt:408 */
   20     25   
            loop {
          26  +
                /* JsonParserGenerator.kt:409 */
   21     27   
                match tokens.peek() {
          28  +
                    /* JsonParserGenerator.kt:410 */
   22     29   
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
          30  +
                        /* JsonParserGenerator.kt:411 */
   23     31   
                        tokens.next().transpose().unwrap();
   24     32   
                        break;
          33  +
                        /* JsonParserGenerator.kt:410 */
   25     34   
                    }
          35  +
                    /* JsonParserGenerator.kt:413 */
   26     36   
                    _ => {
          37  +
                        /* JsonParserGenerator.kt:419 */
   27     38   
                        let value =
   28         -
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
   29         -
                                tokens.next(),
   30         -
                                ::aws_smithy_types::date_time::Format::EpochSeconds,
   31         -
                            )?
   32         -
                            .map(::aws_smithy_http_server_python::types::DateTime::from);
          39  +
                            /* JsonParserGenerator.kt:384 */::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::EpochSeconds)?
          40  +
                            /* PythonServerProtocolLoader.kt:44 */.map(::aws_smithy_http_server_python::types::DateTime::from)
          41  +
                        /* JsonParserGenerator.kt:419 */;
          42  +
                        /* JsonParserGenerator.kt:422 */
   33     43   
                        if let Some(value) = value {
   34     44   
                            items.push(value);
   35         -
                        } else {
          45  +
                        }
          46  +
                        /* JsonParserGenerator.kt:430 */
          47  +
                        else {
   36     48   
                            return Err(
   37     49   
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   38     50   
                                    "dense list cannot contain null values",
   39     51   
                                ),
   40     52   
                            );
   41     53   
                        }
          54  +
                        /* JsonParserGenerator.kt:413 */
          55  +
                    } /* JsonParserGenerator.kt:409 */
   42     56   
                }
          57  +
                /* JsonParserGenerator.kt:408 */
   43     58   
            }
   44         -
            }
          59  +
            /* JsonParserGenerator.kt:446 */
   45     60   
            Ok(Some(items))
          61  +
            /* JsonParserGenerator.kt:713 */
   46     62   
        }
   47         -
        _ => Err(
          63  +
        /* JsonParserGenerator.kt:722 */
          64  +
        _ => {
          65  +
            /* JsonParserGenerator.kt:723 */
          66  +
            Err(
   48     67   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   49     68   
                    "expected start array or null",
   50     69   
                ),
   51         -
        ),
          70  +
            )
          71  +
            /* JsonParserGenerator.kt:722 */
          72  +
        } /* JsonParserGenerator.kt:712 */
   52     73   
    }
          74  +
    /* JsonParserGenerator.kt:398 */
   53     75   
}

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

@@ -1,1 +67,107 @@
    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_top_level<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::model::top_level_internal::Builder>,
    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::top_level_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         -
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key
   25         -
                        .to_unescaped()?
   26         -
                        .as_ref()
   27         -
                    {
          32  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          33  +
                        /* JsonParserGenerator.kt:260 */
          34  +
                        match key.to_unescaped()?.as_ref() {
          35  +
                            /* JsonParserGenerator.kt:262 */
   28     36   
                            "dialog" => {
   29         -
                            if let Some(v) = crate::protocol_serde::shape_dialog::de_dialog(tokens)?
          37  +
                                /* JsonParserGenerator.kt:276 */
          38  +
                                if let Some(v) =
          39  +
                                    /* JsonParserGenerator.kt:544 */
          40  +
                                    crate::protocol_serde::shape_dialog::de_dialog(tokens)?
          41  +
                                /* JsonParserGenerator.kt:278 */
   30     42   
                                {
   31     43   
                                    builder = builder.set_dialog(v);
   32     44   
                                }
          45  +
                                /* JsonParserGenerator.kt:262 */
   33     46   
                            }
          47  +
                            /* JsonParserGenerator.kt:262 */
   34     48   
                            "dialogList" => {
          49  +
                                /* JsonParserGenerator.kt:276 */
   35     50   
                                if let Some(v) =
   36         -
                                crate::protocol_serde::shape_dialog_list::de_dialog_list(tokens)?
          51  +
                                    /* JsonParserGenerator.kt:451 */
          52  +
                                    crate::protocol_serde::shape_dialog_list::de_dialog_list(
          53  +
                                            tokens,
          54  +
                                        )?
          55  +
                                /* JsonParserGenerator.kt:278 */
   37     56   
                                {
   38     57   
                                    builder = builder.set_dialog_list(v);
   39     58   
                                }
          59  +
                                /* JsonParserGenerator.kt:262 */
   40     60   
                            }
          61  +
                            /* JsonParserGenerator.kt:262 */
   41     62   
                            "dialogMap" => {
          63  +
                                /* JsonParserGenerator.kt:276 */
   42     64   
                                if let Some(v) =
   43         -
                                crate::protocol_serde::shape_dialog_map::de_dialog_map(tokens)?
          65  +
                                    /* JsonParserGenerator.kt:509 */
          66  +
                                    crate::protocol_serde::shape_dialog_map::de_dialog_map(
          67  +
                                            tokens,
          68  +
                                        )?
          69  +
                                /* JsonParserGenerator.kt:278 */
   44     70   
                                {
   45     71   
                                    builder = builder.set_dialog_map(v);
   46     72   
                                }
          73  +
                                /* JsonParserGenerator.kt:262 */
          74  +
                            }
          75  +
                            /* JsonParserGenerator.kt:290 */
          76  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
          77  +
                        }
          78  +
                        /* JsonParserGenerator.kt:686 */
   47     79   
                    }
   48         -
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   49         -
                    },
          80  +
                    /* JsonParserGenerator.kt:695 */
   50     81   
                    other => {
   51     82   
                        return Err(
   52     83   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   53     84   
                                format!("expected object key or end object, found: {:?}", other),
   54     85   
                            ),
   55     86   
                        )
          87  +
                    } /* JsonParserGenerator.kt:685 */
   56     88   
                }
          89  +
                /* JsonParserGenerator.kt:684 */
   57     90   
            }
   58         -
            }
          91  +
            /* JsonParserGenerator.kt:540 */
   59     92   
            Ok(Some(builder))
          93  +
            /* JsonParserGenerator.kt:713 */
   60     94   
        }
   61         -
        _ => Err(
          95  +
        /* JsonParserGenerator.kt:722 */
          96  +
        _ => {
          97  +
            /* JsonParserGenerator.kt:723 */
          98  +
            Err(
   62     99   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   63    100   
                    "expected start object or null",
   64    101   
                ),
   65         -
        ),
         102  +
            )
         103  +
            /* JsonParserGenerator.kt:722 */
         104  +
        } /* JsonParserGenerator.kt:712 */
   66    105   
    }
         106  +
    /* JsonParserGenerator.kt:516 */
   67    107   
}

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

@@ -1,1 +128,166 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:175 */
    2      3   
pub(crate) fn de_union_payload_payload(
    3      4   
    input: &[u8],
    4      5   
) -> ::std::result::Result<
    5      6   
    crate::model::UnionPayload,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
> {
           9  +
    /* JsonParserGenerator.kt:187 */
    8     10   
    let mut tokens_owned =
    9     11   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(input))
   10     12   
            .peekable();
   11     13   
    let tokens = &mut tokens_owned;
          14  +
    /* JsonParserGenerator.kt:194 */
   12     15   
    let result =
   13         -
        crate::protocol_serde::shape_union_payload::de_union_payload(tokens)?.ok_or_else(|| {
   14         -
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   15         -
                "expected payload member value",
   16         -
            )
   17         -
        });
          16  +
    /* JsonParserGenerator.kt:660 */crate::protocol_serde::shape_union_payload::de_union_payload(tokens)?
          17  +
    /* JsonParserGenerator.kt:196 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("expected payload member value"));
          18  +
    /* JsonParserGenerator.kt:250 */
   18     19   
    if tokens.next().is_some() {
          20  +
        /* JsonParserGenerator.kt:251 */
   19     21   
        return Err(
   20     22   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   21     23   
                "found more JSON tokens after completing parsing",
   22     24   
            ),
   23     25   
        );
          26  +
        /* JsonParserGenerator.kt:250 */
   24     27   
    }
          28  +
    /* JsonParserGenerator.kt:198 */
   25     29   
    result
          30  +
    /* JsonParserGenerator.kt:175 */
   26     31   
}
   27     32   
          33  +
/* JsonSerializerGenerator.kt:547 */
   28     34   
pub fn ser_union_payload(
   29     35   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   30     36   
    input: &crate::model::UnionPayload,
   31     37   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          38  +
    /* JsonSerializerGenerator.kt:556 */
   32     39   
    match input {
          40  +
        /* JsonSerializerGenerator.kt:564 */
   33     41   
        crate::model::UnionPayload::Greeting(inner) => {
          42  +
            /* SerializerUtil.kt:42 */
          43  +
            {
          44  +
                /* JsonSerializerGenerator.kt:423 */
   34     45   
                object.key("greeting").string(inner.as_str());
          46  +
                /* SerializerUtil.kt:42 */
   35     47   
            }
          48  +
            /* JsonSerializerGenerator.kt:564 */
   36     49   
        }
          50  +
        /* JsonSerializerGenerator.kt:556 */
          51  +
    }
          52  +
    /* JsonSerializerGenerator.kt:576 */
   37     53   
    Ok(())
          54  +
    /* JsonSerializerGenerator.kt:547 */
   38     55   
}
   39     56   
          57  +
/* JsonParserGenerator.kt:551 */
   40     58   
pub(crate) fn de_union_payload<'a, I>(
   41     59   
    tokens: &mut ::std::iter::Peekable<I>,
   42     60   
) -> ::std::result::Result<
   43     61   
    Option<crate::model::UnionPayload>,
   44     62   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   45     63   
>
   46     64   
where
   47     65   
    I: Iterator<
   48     66   
        Item = Result<
   49     67   
            ::aws_smithy_json::deserialize::Token<'a>,
   50     68   
            ::aws_smithy_json::deserialize::error::DeserializeError,
   51     69   
        >,
   52     70   
    >,
   53     71   
{
          72  +
    /* JsonParserGenerator.kt:565 */
   54     73   
    let mut variant = None;
          74  +
    /* JsonParserGenerator.kt:567 */
   55     75   
    match tokens.next().transpose()? {
          76  +
        /* JsonParserGenerator.kt:568 */
   56     77   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => return Ok(None),
   57         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => loop {
          78  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          79  +
            /* JsonParserGenerator.kt:684 */
          80  +
            loop {
          81  +
                /* JsonParserGenerator.kt:685 */
   58     82   
                match tokens.next().transpose()? {
          83  +
                    /* JsonParserGenerator.kt:686 */
   59     84   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   60     85   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          86  +
                        /* JsonParserGenerator.kt:576 */
   61     87   
                        if let ::std::option::Option::Some(::std::result::Result::Ok(
   62     88   
                            ::aws_smithy_json::deserialize::Token::ValueNull { .. },
   63     89   
                        )) = tokens.peek()
   64     90   
                        {
   65     91   
                            let _ = tokens.next().expect("peek returned a token")?;
   66     92   
                            continue;
   67     93   
                        }
          94  +
                        /* JsonParserGenerator.kt:585 */
   68     95   
                        let key = key.to_unescaped()?;
   69     96   
                        if key == "__type" {
   70     97   
                            ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
   71     98   
                            continue;
   72     99   
                        }
   73    100   
                        if variant.is_some() {
   74    101   
                            return Err(
   75    102   
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   76    103   
                                    "encountered mixed variants in union",
   77    104   
                                ),
   78    105   
                            );
   79    106   
                        }
         107  +
                        /* JsonParserGenerator.kt:598 */
   80    108   
                        variant = match key.as_ref() {
   81         -
                        "greeting" => Some(crate::model::UnionPayload::Greeting(
   82         -
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
   83         -
                                tokens.next(),
   84         -
                            )?
   85         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   86         -
                            .transpose()?
   87         -
                            .ok_or_else(|| {
   88         -
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   89         -
                                    "value for 'greeting' cannot be null",
   90         -
                                )
   91         -
                            })?,
   92         -
                        )),
         109  +
                            /* JsonParserGenerator.kt:601 */
         110  +
                            "greeting" => {
         111  +
                                /* JsonParserGenerator.kt:611 */
         112  +
                                Some(crate::model::UnionPayload::Greeting(
         113  +
                                    /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
         114  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         115  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
         116  +
                                        /* JsonParserGenerator.kt:339 */)
         117  +
                                    /* JsonParserGenerator.kt:354 */).transpose()?
         118  +
                                    /* JsonParserGenerator.kt:670 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'greeting' cannot be null"))?
         119  +
                                /* JsonParserGenerator.kt:611 */))
         120  +
                                /* JsonParserGenerator.kt:601 */
         121  +
                            }
         122  +
                            /* JsonParserGenerator.kt:634 */
   93    123   
                            variant => {
   94    124   
                                return Err(
   95    125   
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   96    126   
                                        format!("unexpected union variant: {}", variant),
   97    127   
                                    ),
   98    128   
                                )
   99         -
                        }
         129  +
                            } /* JsonParserGenerator.kt:598 */
  100    130   
                        };
         131  +
                        /* JsonParserGenerator.kt:686 */
  101    132   
                    }
         133  +
                    /* JsonParserGenerator.kt:695 */
  102    134   
                    other => {
  103    135   
                        return Err(
  104         -
                        ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  105         -
                            "expected object key or end object, found: {:?}",
  106         -
                            other
  107         -
                        )),
         136  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         137  +
                                format!("expected object key or end object, found: {:?}", other),
         138  +
                            ),
  108    139   
                        )
         140  +
                    } /* JsonParserGenerator.kt:685 */
         141  +
                }
         142  +
                /* JsonParserGenerator.kt:684 */
  109    143   
            }
         144  +
            /* JsonParserGenerator.kt:568 */
  110    145   
        }
  111         -
        },
         146  +
        /* JsonParserGenerator.kt:642 */
  112    147   
        _ => {
  113    148   
            return Err(
  114    149   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  115    150   
                    "expected start object or null",
  116    151   
                ),
  117    152   
            )
         153  +
        } /* JsonParserGenerator.kt:567 */
  118    154   
    }
  119         -
    }
         155  +
    /* JsonParserGenerator.kt:649 */
  120    156   
    if variant.is_none() {
  121    157   
        return Err(
  122    158   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  123    159   
                "Union did not contain a valid variant.",
  124    160   
            ),
  125    161   
        );
  126    162   
    }
         163  +
    /* JsonParserGenerator.kt:657 */
  127    164   
    Ok(variant)
         165  +
    /* JsonParserGenerator.kt:551 */
  128    166   
}

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

@@ -1,1 +132,181 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:551 */
    2      3   
pub(crate) fn de_union_with_json_name<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::model::UnionWithJsonName>,
    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:565 */
   16     18   
    let mut variant = None;
          19  +
    /* JsonParserGenerator.kt:567 */
   17     20   
    match tokens.next().transpose()? {
          21  +
        /* JsonParserGenerator.kt:568 */
   18     22   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => return Ok(None),
   19         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => loop {
          23  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          24  +
            /* JsonParserGenerator.kt:684 */
          25  +
            loop {
          26  +
                /* JsonParserGenerator.kt:685 */
   20     27   
                match tokens.next().transpose()? {
          28  +
                    /* JsonParserGenerator.kt:686 */
   21     29   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   22     30   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          31  +
                        /* JsonParserGenerator.kt:576 */
   23     32   
                        if let ::std::option::Option::Some(::std::result::Result::Ok(
   24     33   
                            ::aws_smithy_json::deserialize::Token::ValueNull { .. },
   25     34   
                        )) = tokens.peek()
   26     35   
                        {
   27     36   
                            let _ = tokens.next().expect("peek returned a token")?;
   28     37   
                            continue;
   29     38   
                        }
          39  +
                        /* JsonParserGenerator.kt:585 */
   30     40   
                        let key = key.to_unescaped()?;
   31     41   
                        if key == "__type" {
   32     42   
                            ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
   33     43   
                            continue;
   34     44   
                        }
   35     45   
                        if variant.is_some() {
   36     46   
                            return Err(
   37     47   
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   38     48   
                                    "encountered mixed variants in union",
   39     49   
                                ),
   40     50   
                            );
   41     51   
                        }
          52  +
                        /* JsonParserGenerator.kt:598 */
   42     53   
                        variant = match key.as_ref() {
   43         -
                        "FOO" => Some(crate::model::UnionWithJsonName::Foo(
   44         -
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
   45         -
                                tokens.next(),
   46         -
                            )?
   47         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   48         -
                            .transpose()?
   49         -
                            .ok_or_else(|| {
   50         -
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   51         -
                                    "value for 'foo' cannot be null",
   52         -
                                )
   53         -
                            })?,
   54         -
                        )),
   55         -
                        "bar" => Some(crate::model::UnionWithJsonName::Bar(
   56         -
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
   57         -
                                tokens.next(),
   58         -
                            )?
   59         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   60         -
                            .transpose()?
   61         -
                            .ok_or_else(|| {
   62         -
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   63         -
                                    "value for 'bar' cannot be null",
   64         -
                                )
   65         -
                            })?,
   66         -
                        )),
   67         -
                        "_baz" => Some(crate::model::UnionWithJsonName::Baz(
   68         -
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
   69         -
                                tokens.next(),
   70         -
                            )?
   71         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   72         -
                            .transpose()?
   73         -
                            .ok_or_else(|| {
   74         -
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   75         -
                                    "value for 'baz' cannot be null",
   76         -
                                )
   77         -
                            })?,
   78         -
                        )),
          54  +
                            /* JsonParserGenerator.kt:601 */
          55  +
                            "FOO" => {
          56  +
                                /* JsonParserGenerator.kt:611 */
          57  +
                                Some(crate::model::UnionWithJsonName::Foo(
          58  +
                                    /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          59  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          60  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
          61  +
                                        /* JsonParserGenerator.kt:339 */)
          62  +
                                    /* JsonParserGenerator.kt:354 */).transpose()?
          63  +
                                    /* JsonParserGenerator.kt:670 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'foo' cannot be null"))?
          64  +
                                /* JsonParserGenerator.kt:611 */))
          65  +
                                /* JsonParserGenerator.kt:601 */
          66  +
                            }
          67  +
                            /* JsonParserGenerator.kt:601 */
          68  +
                            "bar" => {
          69  +
                                /* JsonParserGenerator.kt:611 */
          70  +
                                Some(crate::model::UnionWithJsonName::Bar(
          71  +
                                    /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          72  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          73  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
          74  +
                                        /* JsonParserGenerator.kt:339 */)
          75  +
                                    /* JsonParserGenerator.kt:354 */).transpose()?
          76  +
                                    /* JsonParserGenerator.kt:670 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'bar' cannot be null"))?
          77  +
                                /* JsonParserGenerator.kt:611 */))
          78  +
                                /* JsonParserGenerator.kt:601 */
          79  +
                            }
          80  +
                            /* JsonParserGenerator.kt:601 */
          81  +
                            "_baz" => {
          82  +
                                /* JsonParserGenerator.kt:611 */
          83  +
                                Some(crate::model::UnionWithJsonName::Baz(
          84  +
                                    /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          85  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          86  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
          87  +
                                        /* JsonParserGenerator.kt:339 */)
          88  +
                                    /* JsonParserGenerator.kt:354 */).transpose()?
          89  +
                                    /* JsonParserGenerator.kt:670 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'baz' cannot be null"))?
          90  +
                                /* JsonParserGenerator.kt:611 */))
          91  +
                                /* JsonParserGenerator.kt:601 */
          92  +
                            }
          93  +
                            /* JsonParserGenerator.kt:634 */
   79     94   
                            variant => {
   80     95   
                                return Err(
   81     96   
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   82     97   
                                        format!("unexpected union variant: {}", variant),
   83     98   
                                    ),
   84     99   
                                )
   85         -
                        }
         100  +
                            } /* JsonParserGenerator.kt:598 */
   86    101   
                        };
         102  +
                        /* JsonParserGenerator.kt:686 */
   87    103   
                    }
         104  +
                    /* JsonParserGenerator.kt:695 */
   88    105   
                    other => {
   89    106   
                        return Err(
   90         -
                        ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   91         -
                            "expected object key or end object, found: {:?}",
   92         -
                            other
   93         -
                        )),
         107  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         108  +
                                format!("expected object key or end object, found: {:?}", other),
         109  +
                            ),
   94    110   
                        )
         111  +
                    } /* JsonParserGenerator.kt:685 */
         112  +
                }
         113  +
                /* JsonParserGenerator.kt:684 */
   95    114   
            }
         115  +
            /* JsonParserGenerator.kt:568 */
   96    116   
        }
   97         -
        },
         117  +
        /* JsonParserGenerator.kt:642 */
   98    118   
        _ => {
   99    119   
            return Err(
  100    120   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  101    121   
                    "expected start object or null",
  102    122   
                ),
  103    123   
            )
         124  +
        } /* JsonParserGenerator.kt:567 */
  104    125   
    }
  105         -
    }
         126  +
    /* JsonParserGenerator.kt:649 */
  106    127   
    if variant.is_none() {
  107    128   
        return Err(
  108    129   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  109    130   
                "Union did not contain a valid variant.",
  110    131   
            ),
  111    132   
        );
  112    133   
    }
         134  +
    /* JsonParserGenerator.kt:657 */
  113    135   
    Ok(variant)
         136  +
    /* JsonParserGenerator.kt:551 */
  114    137   
}
  115    138   
         139  +
/* JsonSerializerGenerator.kt:547 */
  116    140   
pub fn ser_union_with_json_name(
  117    141   
    object_1: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
  118    142   
    input: &crate::model::UnionWithJsonName,
  119    143   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
         144  +
    /* JsonSerializerGenerator.kt:556 */
  120    145   
    match input {
         146  +
        /* JsonSerializerGenerator.kt:564 */
  121    147   
        crate::model::UnionWithJsonName::Foo(inner) => {
         148  +
            /* SerializerUtil.kt:42 */
         149  +
            {
         150  +
                /* JsonSerializerGenerator.kt:423 */
  122    151   
                object_1.key("FOO").string(inner.as_str());
         152  +
                /* SerializerUtil.kt:42 */
  123    153   
            }
         154  +
            /* JsonSerializerGenerator.kt:564 */
         155  +
        }
         156  +
        /* JsonSerializerGenerator.kt:564 */
  124    157   
        crate::model::UnionWithJsonName::Bar(inner) => {
         158  +
            /* SerializerUtil.kt:42 */
         159  +
            {
         160  +
                /* JsonSerializerGenerator.kt:423 */
  125    161   
                object_1.key("bar").string(inner.as_str());
         162  +
                /* SerializerUtil.kt:42 */
         163  +
            }
         164  +
            /* JsonSerializerGenerator.kt:564 */
  126    165   
        }
         166  +
        /* JsonSerializerGenerator.kt:564 */
  127    167   
        crate::model::UnionWithJsonName::Baz(inner) => {
         168  +
            /* SerializerUtil.kt:42 */
         169  +
            {
         170  +
                /* JsonSerializerGenerator.kt:423 */
  128    171   
                object_1.key("_baz").string(inner.as_str());
         172  +
                /* SerializerUtil.kt:42 */
         173  +
            }
         174  +
            /* JsonSerializerGenerator.kt:564 */
  129    175   
        }
         176  +
        /* JsonSerializerGenerator.kt:556 */
  130    177   
    }
         178  +
    /* JsonSerializerGenerator.kt:576 */
  131    179   
    Ok(())
         180  +
    /* JsonSerializerGenerator.kt:547 */
  132    181   
}

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

@@ -1,1 +91,132 @@
    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_unit_input_and_output_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::UnitInputAndOutputInput,
    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::unit_input_and_output_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: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_unit_input_and_output_http_response(
   29     42   
    #[allow(unused_variables)] output: crate::output::UnitInputAndOutputOutput,
   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   
}
   55     81   
          82  +
/* RustType.kt:516 */
   56     83   
#[allow(clippy::unnecessary_wraps)]
          84  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   57     85   
pub fn ser_unit_input_and_output_http_error(
   58     86   
    error: &crate::error::UnitInputAndOutputError,
   59     87   
) -> std::result::Result<
   60     88   
    ::aws_smithy_http_server::response::Response,
   61     89   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   62     90   
> {
          91  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   63     92   
    Ok({
          93  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   64     94   
        match error {
          95  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   65     96   
            crate::error::UnitInputAndOutputError::InternalServerError(output) => {
          97  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   66     98   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
          99  +
                /* RustType.kt:516 */
   67    100   
                #[allow(unused_mut)]
         101  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   68    102   
                let mut builder = ::http::Response::builder();
         103  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   69    104   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   70    105   
                    builder,
   71    106   
                    ::http::header::CONTENT_TYPE,
   72    107   
                    "application/json",
   73    108   
                );
         109  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   74    110   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   75    111   
                    builder,
   76    112   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   77    113   
                    "InternalServerError",
   78    114   
                );
         115  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   79    116   
                let content_length = payload.len();
   80    117   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   81    118   
                    builder,
   82    119   
                    ::http::header::CONTENT_LENGTH,
   83    120   
                    content_length,
   84    121   
                );
         122  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   85    123   
                builder
   86    124   
                    .status(500)
   87    125   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         126  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         127  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   88    128   
        }
   89         -
        }
         129  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   90    130   
    })
         131  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
   91    132   
}

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

@@ -1,1 +35,58 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_validation_exception_error(
    3      4   
    value: &crate::error::ValidationException,
    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_validation_exception::ser_validation_exception(
    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_validation_exception(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::error::ValidationException,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:382 */
   19     26   
    if let Some(var_1) = &input.field_list {
          27  +
        /* JsonSerializerGenerator.kt:484 */
   20     28   
        let mut array_2 = object.key("fieldList").start_array();
          29  +
        /* JsonSerializerGenerator.kt:524 */
   21     30   
        for item_3 in var_1 {
          31  +
            /* SerializerUtil.kt:42 */
   22     32   
            {
          33  +
                /* JsonSerializerGenerator.kt:495 */
   23     34   
                #[allow(unused_mut)]
          35  +
                /* JsonSerializerGenerator.kt:496 */
   24     36   
                let mut object_4 = array_2.value().start_object();
          37  +
                /* JsonSerializerGenerator.kt:375 */
   25     38   
                crate::protocol_serde::shape_validation_exception_field::ser_validation_exception_field(&mut object_4, item_3)?;
          39  +
                /* JsonSerializerGenerator.kt:515 */
   26     40   
                object_4.finish();
          41  +
                /* SerializerUtil.kt:42 */
   27     42   
            }
          43  +
            /* JsonSerializerGenerator.kt:524 */
   28     44   
        }
          45  +
        /* JsonSerializerGenerator.kt:486 */
   29     46   
        array_2.finish();
          47  +
        /* JsonSerializerGenerator.kt:382 */
   30     48   
    }
          49  +
    /* SerializerUtil.kt:42 */
   31     50   
    {
          51  +
        /* JsonSerializerGenerator.kt:423 */
   32     52   
        object.key("message").string(input.message.as_str());
          53  +
        /* SerializerUtil.kt:42 */
   33     54   
    }
          55  +
    /* JsonSerializerGenerator.kt:372 */
   34     56   
    Ok(())
          57  +
    /* JsonSerializerGenerator.kt:358 */
   35     58   
}

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

@@ -1,1 +13,22 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:358 */
    2      3   
pub fn ser_validation_exception_field(
    3      4   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4      5   
    input: &crate::model::ValidationExceptionField,
    5      6   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           7  +
    /* SerializerUtil.kt:42 */
    6      8   
    {
           9  +
        /* JsonSerializerGenerator.kt:423 */
    7     10   
        object.key("path").string(input.path.as_str());
          11  +
        /* SerializerUtil.kt:42 */
    8     12   
    }
          13  +
    /* SerializerUtil.kt:42 */
    9     14   
    {
          15  +
        /* JsonSerializerGenerator.kt:423 */
   10     16   
        object.key("message").string(input.message.as_str());
          17  +
        /* SerializerUtil.kt:42 */
   11     18   
    }
          19  +
    /* JsonSerializerGenerator.kt:372 */
   12     20   
    Ok(())
          21  +
    /* JsonSerializerGenerator.kt:358 */
   13     22   
}