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_player_action.rs

@@ -1,1 +96,132 @@
    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_player_action<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::model::PlayerAction>,
    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     23   
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          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, .. }) => {
          31  +
                        /* JsonParserGenerator.kt:576 */
   24     32   
                        if let ::std::option::Option::Some(::std::result::Result::Ok(
   25     33   
                            ::aws_smithy_json::deserialize::Token::ValueNull { .. },
   26     34   
                        )) = tokens.peek()
   27     35   
                        {
   28     36   
                            let _ = tokens.next().expect("peek returned a token")?;
   29     37   
                            continue;
   30     38   
                        }
          39  +
                        /* JsonParserGenerator.kt:585 */
   31     40   
                        let key = key.to_unescaped()?;
   32     41   
                        if key == "__type" {
   33     42   
                            ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
   34     43   
                            continue;
   35     44   
                        }
   36     45   
                        if variant.is_some() {
   37     46   
                            return Err(
   38     47   
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   39     48   
                                    "encountered mixed variants in union",
   40     49   
                                ),
   41     50   
                            );
   42     51   
                        }
          52  +
                        /* JsonParserGenerator.kt:598 */
   43     53   
                        variant =
   44     54   
                            match key.as_ref() {
          55  +
                                /* JsonParserGenerator.kt:601 */
   45     56   
                                "quit" => {
          57  +
                                    /* JsonParserGenerator.kt:603 */
   46     58   
                                    ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
   47     59   
                                    Some(crate::model::PlayerAction::Quit)
          60  +
                                    /* JsonParserGenerator.kt:601 */
   48     61   
                                }
          62  +
                                /* JsonParserGenerator.kt:634 */
   49     63   
                                variant => return Err(
   50     64   
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   51     65   
                                        format!("unexpected union variant: {}", variant),
   52     66   
                                    ),
   53         -
                                ),
          67  +
                                ), /* JsonParserGenerator.kt:598 */
   54     68   
                            };
          69  +
                        /* JsonParserGenerator.kt:686 */
   55     70   
                    }
          71  +
                    /* JsonParserGenerator.kt:695 */
   56     72   
                    other => {
   57     73   
                        return Err(
   58     74   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   59     75   
                                format!("expected object key or end object, found: {:?}", other),
   60     76   
                            ),
   61     77   
                        )
          78  +
                    } /* JsonParserGenerator.kt:685 */
   62     79   
                }
          80  +
                /* JsonParserGenerator.kt:684 */
   63     81   
            }
          82  +
            /* JsonParserGenerator.kt:568 */
   64     83   
        }
   65         -
        }
          84  +
        /* JsonParserGenerator.kt:642 */
   66     85   
        _ => {
   67     86   
            return Err(
   68     87   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   69     88   
                    "expected start object or null",
   70     89   
                ),
   71     90   
            )
          91  +
        } /* JsonParserGenerator.kt:567 */
   72     92   
    }
   73         -
    }
          93  +
    /* JsonParserGenerator.kt:649 */
   74     94   
    if variant.is_none() {
   75     95   
        return Err(
   76     96   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   77     97   
                "Union did not contain a valid variant.",
   78     98   
            ),
   79     99   
        );
   80    100   
    }
         101  +
    /* JsonParserGenerator.kt:657 */
   81    102   
    Ok(variant)
         103  +
    /* JsonParserGenerator.kt:551 */
   82    104   
}
   83    105   
         106  +
/* JsonSerializerGenerator.kt:547 */
   84    107   
pub fn ser_player_action(
   85    108   
    object_1: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   86    109   
    input: &crate::model::PlayerAction,
   87    110   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
         111  +
    /* JsonSerializerGenerator.kt:556 */
   88    112   
    match input {
         113  +
        /* JsonSerializerGenerator.kt:564 */
   89    114   
        crate::model::PlayerAction::Quit => {
         115  +
            /* SerializerUtil.kt:42 */
         116  +
            {
         117  +
                /* JsonSerializerGenerator.kt:495 */
   90    118   
                #[allow(unused_mut)]
         119  +
                /* JsonSerializerGenerator.kt:496 */
   91    120   
                let mut object_1 = object_1.key("quit").start_object();
         121  +
                /* JsonSerializerGenerator.kt:515 */
   92    122   
                object_1.finish();
         123  +
                /* SerializerUtil.kt:42 */
         124  +
            }
         125  +
            /* JsonSerializerGenerator.kt:564 */
   93    126   
        }
         127  +
        /* JsonSerializerGenerator.kt:556 */
   94    128   
    }
         129  +
    /* JsonSerializerGenerator.kt:576 */
   95    130   
    Ok(())
         131  +
    /* JsonSerializerGenerator.kt:547 */
   96    132   
}

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

@@ -1,1 +148,212 @@
    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_post_player_action_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::PostPlayerActionInput,
    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::post_player_action_input_internal::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_post_player_action::de_post_player_action(
   29     39   
                bytes.as_ref(),
   30     40   
                input,
   31     41   
            )?;
          42  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   32     43   
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   33     45   
        input.build()
          46  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   34     47   
    })
          48  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   35     49   
}
   36     50   
          51  +
/* RustType.kt:516 */
   37     52   
#[allow(clippy::unnecessary_wraps)]
          53  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   38     54   
pub fn ser_post_player_action_http_response(
   39     55   
    #[allow(unused_variables)] output: crate::output::PostPlayerActionOutput,
   40     56   
) -> std::result::Result<
   41     57   
    ::aws_smithy_http_server::response::Response,
   42     58   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   43     59   
> {
          60  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   44     61   
    Ok({
          62  +
        /* RustType.kt:516 */
   45     63   
        #[allow(unused_mut)]
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   46     65   
        let mut builder = ::http::Response::builder();
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   47     67   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   48     68   
            builder,
   49     69   
            ::http::header::CONTENT_TYPE,
   50     70   
            "application/json",
   51     71   
        );
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   52     73   
        let http_status: u16 = 200;
   53     74   
        builder = builder.status(http_status);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   54     76   
        let payload =
   55         -
            crate::protocol_serde::shape_post_player_action_output::ser_post_player_action_output_output_output(&output)?
   56         -
        ;
          77  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_post_player_action_output::ser_post_player_action_output_output_output(&output)?
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   57     80   
        let content_length = payload.len();
   58     81   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   59     82   
            builder,
   60     83   
            ::http::header::CONTENT_LENGTH,
   61     84   
            content_length,
   62     85   
        );
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   63     87   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   64     89   
        builder.body(body)?
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   65     91   
    })
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   66     93   
}
   67     94   
          95  +
/* RustType.kt:516 */
   68     96   
#[allow(clippy::unnecessary_wraps)]
          97  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   69     98   
pub fn ser_post_player_action_http_error(
   70     99   
    error: &crate::error::PostPlayerActionError,
   71    100   
) -> std::result::Result<
   72    101   
    ::aws_smithy_http_server::response::Response,
   73    102   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   74    103   
> {
         104  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   75    105   
    Ok({
         106  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   76    107   
        match error {
         108  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   77    109   
            crate::error::PostPlayerActionError::InternalServerError(output) => {
         110  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   78    111   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         112  +
                /* RustType.kt:516 */
   79    113   
                #[allow(unused_mut)]
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   80    115   
                let mut builder = ::http::Response::builder();
         116  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   81    117   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   82    118   
                    builder,
   83    119   
                    ::http::header::CONTENT_TYPE,
   84    120   
                    "application/json",
   85    121   
                );
         122  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   86    123   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   87    124   
                    builder,
   88    125   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   89    126   
                    "InternalServerError",
   90    127   
                );
         128  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   91    129   
                let content_length = payload.len();
   92    130   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   93    131   
                    builder,
   94    132   
                    ::http::header::CONTENT_LENGTH,
   95    133   
                    content_length,
   96    134   
                );
         135  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   97    136   
                builder
   98    137   
                    .status(500)
   99    138   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         139  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         140  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  100    141   
        }
  101         -
        }
         142  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  102    143   
    })
         144  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  103    145   
}
  104    146   
         147  +
/* JsonParserGenerator.kt:148 */
  105    148   
pub(crate) fn de_post_player_action(
  106    149   
    value: &[u8],
  107    150   
    mut builder: crate::input::post_player_action_input_internal::Builder,
  108    151   
) -> ::std::result::Result<
  109    152   
    crate::input::post_player_action_input_internal::Builder,
  110    153   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  111    154   
> {
         155  +
    /* JsonParserGenerator.kt:153 */
  112    156   
    let mut tokens_owned =
  113    157   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  114    158   
            .peekable();
  115    159   
    let tokens = &mut tokens_owned;
  116    160   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         161  +
    /* JsonParserGenerator.kt:684 */
  117    162   
    loop {
         163  +
        /* JsonParserGenerator.kt:685 */
  118    164   
        match tokens.next().transpose()? {
         165  +
            /* JsonParserGenerator.kt:686 */
  119    166   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  120    167   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         168  +
                /* JsonParserGenerator.kt:260 */
  121    169   
                match key.to_unescaped()?.as_ref() {
         170  +
                    /* JsonParserGenerator.kt:262 */
  122    171   
                    "action" => {
  123         -
                        builder = builder.set_action(
  124         -
                            crate::protocol_serde::shape_player_action::de_player_action(tokens)?,
         172  +
                        /* JsonParserGenerator.kt:272 */
         173  +
                        builder =
         174  +
                            builder.set_action(
         175  +
                                /* JsonParserGenerator.kt:660 */
         176  +
                                crate::protocol_serde::shape_player_action::de_player_action(
         177  +
                                    tokens,
         178  +
                                )?, /* JsonParserGenerator.kt:272 */
  125    179   
                            );
         180  +
                        /* JsonParserGenerator.kt:262 */
  126    181   
                    }
  127         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         182  +
                    /* JsonParserGenerator.kt:290 */
         183  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  128    184   
                }
         185  +
                /* JsonParserGenerator.kt:686 */
  129    186   
            }
         187  +
            /* JsonParserGenerator.kt:695 */
  130    188   
            other => {
  131    189   
                return Err(
  132    190   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  133    191   
                        "expected object key or end object, found: {:?}",
  134    192   
                        other
  135    193   
                    )),
  136    194   
                )
         195  +
            } /* JsonParserGenerator.kt:685 */
  137    196   
        }
         197  +
        /* JsonParserGenerator.kt:684 */
  138    198   
    }
  139         -
    }
         199  +
    /* JsonParserGenerator.kt:250 */
  140    200   
    if tokens.next().is_some() {
         201  +
        /* JsonParserGenerator.kt:251 */
  141    202   
        return Err(
  142    203   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  143    204   
                "found more JSON tokens after completing parsing",
  144    205   
            ),
  145    206   
        );
         207  +
        /* JsonParserGenerator.kt:250 */
  146    208   
    }
         209  +
    /* JsonParserGenerator.kt:163 */
  147    210   
    Ok(builder)
         211  +
    /* JsonParserGenerator.kt:148 */
  148    212   
}

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

@@ -1,1 +29,43 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_post_player_action_output_output_output(
    3      4   
    value: &crate::output::PostPlayerActionOutput,
    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_post_player_action_output::ser_post_player_action_output_output(
    8     11   
        &mut object,
    9     12   
        value,
   10     13   
    )?;
          14  +
    /* JsonSerializerGenerator.kt:227 */
   11     15   
    object.finish();
   12     16   
    Ok(out)
          17  +
    /* JsonSerializerGenerator.kt:213 */
   13     18   
}
   14     19   
          20  +
/* JsonSerializerGenerator.kt:358 */
   15     21   
pub fn ser_post_player_action_output_output(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::output::PostPlayerActionOutput,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* SerializerUtil.kt:42 */
   19     26   
    {
          27  +
        /* JsonSerializerGenerator.kt:495 */
   20     28   
        #[allow(unused_mut)]
          29  +
        /* JsonSerializerGenerator.kt:496 */
   21     30   
        let mut object_1 = object.key("action").start_object();
          31  +
        /* JsonSerializerGenerator.kt:579 */
   22     32   
        crate::protocol_serde::shape_player_action::ser_player_action(
   23     33   
            &mut object_1,
   24     34   
            &input.action,
   25     35   
        )?;
          36  +
        /* JsonSerializerGenerator.kt:515 */
   26     37   
        object_1.finish();
          38  +
        /* SerializerUtil.kt:42 */
   27     39   
    }
          40  +
    /* JsonSerializerGenerator.kt:372 */
   28     41   
    Ok(())
          42  +
    /* JsonSerializerGenerator.kt:358 */
   29     43   
}

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

@@ -1,1 +145,205 @@
    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_post_union_with_json_name_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::PostUnionWithJsonNameInput,
    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::post_union_with_json_name_input_internal::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_post_union_with_json_name::de_post_union_with_json_name(bytes.as_ref(), input)?;
          39  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   29     40   
        }
          41  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   30     42   
        input.build()
          43  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   31     44   
    })
          45  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   32     46   
}
   33     47   
          48  +
/* RustType.kt:516 */
   34     49   
#[allow(clippy::unnecessary_wraps)]
          50  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   35     51   
pub fn ser_post_union_with_json_name_http_response(
   36     52   
    #[allow(unused_variables)] output: crate::output::PostUnionWithJsonNameOutput,
   37     53   
) -> std::result::Result<
   38     54   
    ::aws_smithy_http_server::response::Response,
   39     55   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   40     56   
> {
          57  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   41     58   
    Ok({
          59  +
        /* RustType.kt:516 */
   42     60   
        #[allow(unused_mut)]
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   43     62   
        let mut builder = ::http::Response::builder();
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   44     64   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   45     65   
            builder,
   46     66   
            ::http::header::CONTENT_TYPE,
   47     67   
            "application/json",
   48     68   
        );
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   49     70   
        let http_status: u16 = 200;
   50     71   
        builder = builder.status(http_status);
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   51     73   
        let payload =
   52         -
            crate::protocol_serde::shape_post_union_with_json_name_output::ser_post_union_with_json_name_output_output_output(&output)?
   53         -
        ;
          74  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_post_union_with_json_name_output::ser_post_union_with_json_name_output_output_output(&output)?
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   54     77   
        let content_length = payload.len();
   55     78   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   56     79   
            builder,
   57     80   
            ::http::header::CONTENT_LENGTH,
   58     81   
            content_length,
   59     82   
        );
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   60     84   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          85  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   61     86   
        builder.body(body)?
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   62     88   
    })
          89  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   63     90   
}
   64     91   
          92  +
/* RustType.kt:516 */
   65     93   
#[allow(clippy::unnecessary_wraps)]
          94  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   66     95   
pub fn ser_post_union_with_json_name_http_error(
   67     96   
    error: &crate::error::PostUnionWithJsonNameError,
   68     97   
) -> std::result::Result<
   69     98   
    ::aws_smithy_http_server::response::Response,
   70     99   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   71    100   
> {
         101  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   72    102   
    Ok({
         103  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   73    104   
        match error {
         105  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   74    106   
            crate::error::PostUnionWithJsonNameError::InternalServerError(output) => {
         107  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   75    108   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         109  +
                /* RustType.kt:516 */
   76    110   
                #[allow(unused_mut)]
         111  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   77    112   
                let mut builder = ::http::Response::builder();
         113  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   78    114   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   79    115   
                    builder,
   80    116   
                    ::http::header::CONTENT_TYPE,
   81    117   
                    "application/json",
   82    118   
                );
         119  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   83    120   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   84    121   
                    builder,
   85    122   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   86    123   
                    "InternalServerError",
   87    124   
                );
         125  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   88    126   
                let content_length = payload.len();
   89    127   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   90    128   
                    builder,
   91    129   
                    ::http::header::CONTENT_LENGTH,
   92    130   
                    content_length,
   93    131   
                );
         132  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   94    133   
                builder
   95    134   
                    .status(500)
   96    135   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         136  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         137  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   97    138   
        }
   98         -
        }
         139  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   99    140   
    })
         141  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  100    142   
}
  101    143   
         144  +
/* JsonParserGenerator.kt:148 */
  102    145   
pub(crate) fn de_post_union_with_json_name(
  103    146   
    value: &[u8],
  104    147   
    mut builder: crate::input::post_union_with_json_name_input_internal::Builder,
  105    148   
) -> ::std::result::Result<
  106    149   
    crate::input::post_union_with_json_name_input_internal::Builder,
  107    150   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  108    151   
> {
         152  +
    /* JsonParserGenerator.kt:153 */
  109    153   
    let mut tokens_owned =
  110    154   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  111    155   
            .peekable();
  112    156   
    let tokens = &mut tokens_owned;
  113    157   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         158  +
    /* JsonParserGenerator.kt:684 */
  114    159   
    loop {
         160  +
        /* JsonParserGenerator.kt:685 */
  115    161   
        match tokens.next().transpose()? {
         162  +
            /* JsonParserGenerator.kt:686 */
  116    163   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  117    164   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         165  +
                /* JsonParserGenerator.kt:260 */
  118    166   
                match key.to_unescaped()?.as_ref() {
         167  +
                    /* JsonParserGenerator.kt:262 */
  119    168   
                    "value" => {
         169  +
                        /* JsonParserGenerator.kt:272 */
  120    170   
                        builder = builder.set_value(
  121         -
                            crate::protocol_serde::shape_union_with_json_name::de_union_with_json_name(tokens)?
  122         -
                        );
         171  +
                            /* JsonParserGenerator.kt:660 */crate::protocol_serde::shape_union_with_json_name::de_union_with_json_name(tokens)?
         172  +
                        /* JsonParserGenerator.kt:272 */);
         173  +
                        /* JsonParserGenerator.kt:262 */
  123    174   
                    }
  124         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         175  +
                    /* JsonParserGenerator.kt:290 */
         176  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  125    177   
                }
         178  +
                /* JsonParserGenerator.kt:686 */
  126    179   
            }
         180  +
            /* JsonParserGenerator.kt:695 */
  127    181   
            other => {
  128    182   
                return Err(
  129    183   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  130    184   
                        "expected object key or end object, found: {:?}",
  131    185   
                        other
  132    186   
                    )),
  133    187   
                )
         188  +
            } /* JsonParserGenerator.kt:685 */
  134    189   
        }
         190  +
        /* JsonParserGenerator.kt:684 */
  135    191   
    }
  136         -
    }
         192  +
    /* JsonParserGenerator.kt:250 */
  137    193   
    if tokens.next().is_some() {
         194  +
        /* JsonParserGenerator.kt:251 */
  138    195   
        return Err(
  139    196   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  140    197   
                "found more JSON tokens after completing parsing",
  141    198   
            ),
  142    199   
        );
         200  +
        /* JsonParserGenerator.kt:250 */
  143    201   
    }
         202  +
    /* JsonParserGenerator.kt:163 */
  144    203   
    Ok(builder)
         204  +
    /* JsonParserGenerator.kt:148 */
  145    205   
}

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

@@ -1,1 +26,40 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_post_union_with_json_name_output_output_output(
    3      4   
    value: &crate::output::PostUnionWithJsonNameOutput,
    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_post_union_with_json_name_output::ser_post_union_with_json_name_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_post_union_with_json_name_output_output(
   13     19   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    input: &crate::output::PostUnionWithJsonNameOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* SerializerUtil.kt:42 */
   16     23   
    {
          24  +
        /* JsonSerializerGenerator.kt:495 */
   17     25   
        #[allow(unused_mut)]
          26  +
        /* JsonSerializerGenerator.kt:496 */
   18     27   
        let mut object_1 = object.key("value").start_object();
          28  +
        /* JsonSerializerGenerator.kt:579 */
   19     29   
        crate::protocol_serde::shape_union_with_json_name::ser_union_with_json_name(
   20     30   
            &mut object_1,
   21     31   
            &input.value,
   22     32   
        )?;
          33  +
        /* JsonSerializerGenerator.kt:515 */
   23     34   
        object_1.finish();
          35  +
        /* SerializerUtil.kt:42 */
   24     36   
    }
          37  +
    /* JsonSerializerGenerator.kt:372 */
   25     38   
    Ok(())
          39  +
    /* JsonSerializerGenerator.kt:358 */
   26     40   
}

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

@@ -1,1 +154,221 @@
    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_put_with_content_encoding_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::PutWithContentEncodingInput,
    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::put_with_content_encoding_input_internal::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_put_with_content_encoding::de_put_with_content_encoding(bytes.as_ref(), input)?;
          39  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   29     40   
        }
          41  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   30     42   
        if let Some(value) =
   31     43   
            crate::protocol_serde::shape_put_with_content_encoding_input::de_encoding_header(
   32     44   
                &headers,
   33     45   
            )?
   34     46   
        {
   35     47   
            input = input.set_encoding(Some(value))
   36     48   
        }
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   37     50   
        input.build()
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   38     52   
    })
          53  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   39     54   
}
   40     55   
          56  +
/* RustType.kt:516 */
   41     57   
#[allow(clippy::unnecessary_wraps)]
          58  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   42     59   
pub fn ser_put_with_content_encoding_http_response(
   43     60   
    #[allow(unused_variables)] output: crate::output::PutWithContentEncodingOutput,
   44     61   
) -> std::result::Result<
   45     62   
    ::aws_smithy_http_server::response::Response,
   46     63   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   47     64   
> {
          65  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   48     66   
    Ok({
          67  +
        /* RustType.kt:516 */
   49     68   
        #[allow(unused_mut)]
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   50     70   
        let mut builder = ::http::Response::builder();
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   51     72   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   52     73   
            builder,
   53     74   
            ::http::header::CONTENT_TYPE,
   54     75   
            "application/json",
   55     76   
        );
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   56     78   
        let http_status: u16 = 200;
   57     79   
        builder = builder.status(http_status);
   58         -
        let payload = "";
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          81  +
        let payload =
          82  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   59     85   
        let content_length = payload.len();
   60     86   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   61     87   
            builder,
   62     88   
            ::http::header::CONTENT_LENGTH,
   63     89   
            content_length,
   64     90   
        );
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   65     92   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          93  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   66     94   
        builder.body(body)?
          95  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   67     96   
    })
          97  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   68     98   
}
   69     99   
         100  +
/* RustType.kt:516 */
   70    101   
#[allow(clippy::unnecessary_wraps)]
         102  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   71    103   
pub fn ser_put_with_content_encoding_http_error(
   72    104   
    error: &crate::error::PutWithContentEncodingError,
   73    105   
) -> std::result::Result<
   74    106   
    ::aws_smithy_http_server::response::Response,
   75    107   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   76    108   
> {
         109  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   77    110   
    Ok({
         111  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   78    112   
        match error {
         113  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   79    114   
            crate::error::PutWithContentEncodingError::InternalServerError(output) => {
         115  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   80    116   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         117  +
                /* RustType.kt:516 */
   81    118   
                #[allow(unused_mut)]
         119  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   82    120   
                let mut builder = ::http::Response::builder();
         121  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   83    122   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   84    123   
                    builder,
   85    124   
                    ::http::header::CONTENT_TYPE,
   86    125   
                    "application/json",
   87    126   
                );
         127  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   88    128   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   89    129   
                    builder,
   90    130   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   91    131   
                    "InternalServerError",
   92    132   
                );
         133  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   93    134   
                let content_length = payload.len();
   94    135   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   95    136   
                    builder,
   96    137   
                    ::http::header::CONTENT_LENGTH,
   97    138   
                    content_length,
   98    139   
                );
         140  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   99    141   
                builder
  100    142   
                    .status(500)
  101    143   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         144  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         145  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  102    146   
        }
  103         -
        }
         147  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  104    148   
    })
         149  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  105    150   
}
  106    151   
         152  +
/* JsonParserGenerator.kt:148 */
  107    153   
pub(crate) fn de_put_with_content_encoding(
  108    154   
    value: &[u8],
  109    155   
    mut builder: crate::input::put_with_content_encoding_input_internal::Builder,
  110    156   
) -> ::std::result::Result<
  111    157   
    crate::input::put_with_content_encoding_input_internal::Builder,
  112    158   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  113    159   
> {
         160  +
    /* JsonParserGenerator.kt:153 */
  114    161   
    let mut tokens_owned =
  115    162   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  116    163   
            .peekable();
  117    164   
    let tokens = &mut tokens_owned;
  118    165   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         166  +
    /* JsonParserGenerator.kt:684 */
  119    167   
    loop {
         168  +
        /* JsonParserGenerator.kt:685 */
  120    169   
        match tokens.next().transpose()? {
         170  +
            /* JsonParserGenerator.kt:686 */
  121    171   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  122    172   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         173  +
                /* JsonParserGenerator.kt:260 */
  123    174   
                match key.to_unescaped()?.as_ref() {
         175  +
                    /* JsonParserGenerator.kt:262 */
  124    176   
                    "data" => {
         177  +
                        /* JsonParserGenerator.kt:272 */
  125    178   
                        builder = builder.set_data(
         179  +
                            /* JsonParserGenerator.kt:354 */
  126    180   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
  127    181   
                                tokens.next(),
  128    182   
                            )?
  129         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  130         -
                            .transpose()?,
         183  +
                            .map(|s|
         184  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         185  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         186  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         187  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  131    188   
                        );
         189  +
                        /* JsonParserGenerator.kt:262 */
  132    190   
                    }
  133         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         191  +
                    /* JsonParserGenerator.kt:290 */
         192  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  134    193   
                }
         194  +
                /* JsonParserGenerator.kt:686 */
  135    195   
            }
         196  +
            /* JsonParserGenerator.kt:695 */
  136    197   
            other => {
  137    198   
                return Err(
  138    199   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  139    200   
                        "expected object key or end object, found: {:?}",
  140    201   
                        other
  141    202   
                    )),
  142    203   
                )
         204  +
            } /* JsonParserGenerator.kt:685 */
  143    205   
        }
         206  +
        /* JsonParserGenerator.kt:684 */
  144    207   
    }
  145         -
    }
         208  +
    /* JsonParserGenerator.kt:250 */
  146    209   
    if tokens.next().is_some() {
         210  +
        /* JsonParserGenerator.kt:251 */
  147    211   
        return Err(
  148    212   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  149    213   
                "found more JSON tokens after completing parsing",
  150    214   
            ),
  151    215   
        );
         216  +
        /* JsonParserGenerator.kt:250 */
  152    217   
    }
         218  +
    /* JsonParserGenerator.kt:163 */
  153    219   
    Ok(builder)
         220  +
    /* JsonParserGenerator.kt:148 */
  154    221   
}

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/src/protocol_serde/shape_put_with_content_encoding_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_encoding_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::option::Option<::std::string::String>,
    6      7   
    ::aws_smithy_http::header::ParseError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:160 */
    8     10   
    let headers = header_map.get_all("Content-Encoding");
          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_query_idempotency_token_auto_fill.rs

@@ -1,1 +104,149 @@
    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_query_idempotency_token_auto_fill_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::QueryIdempotencyTokenAutoFillInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input =
   18     23   
            crate::input::query_idempotency_token_auto_fill_input_internal::Builder::default();
          24  +
        /* RustType.kt:516 */
   19     25   
        #[allow(unused_variables)]
          26  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   20     27   
        let ::aws_smithy_runtime_api::http::RequestParts {
   21     28   
            uri, headers, body, ..
   22     29   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          30  +
        /* ServerHttpBoundProtocolGenerator.kt:1073 */
   23     31   
        let query_string = uri.query().unwrap_or("");
   24     32   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          33  +
        /* ServerHttpBoundProtocolGenerator.kt:1099 */
   25     34   
        let mut token_seen = false;
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:1105 */
   26     36   
        for (k, v) in pairs {
          37  +
            /* ServerHttpBoundProtocolGenerator.kt:1109 */
   27     38   
            if !token_seen && k == "token" {
   28     39   
                input = input.set_token(
   29     40   
                    crate::protocol_serde::shape_query_idempotency_token_auto_fill_input::de_token(
   30     41   
                        &v,
   31     42   
                    )?,
   32     43   
                );
   33     44   
                token_seen = true;
   34     45   
            }
          46  +
            /* ServerHttpBoundProtocolGenerator.kt:1105 */
   35     47   
        }
          48  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   36     49   
        input.build()
          50  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   37     51   
    })
          52  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   38     53   
}
   39     54   
          55  +
/* RustType.kt:516 */
   40     56   
#[allow(clippy::unnecessary_wraps)]
          57  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   41     58   
pub fn ser_query_idempotency_token_auto_fill_http_response(
   42     59   
    #[allow(unused_variables)] output: crate::output::QueryIdempotencyTokenAutoFillOutput,
   43     60   
) -> std::result::Result<
   44     61   
    ::aws_smithy_http_server::response::Response,
   45     62   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   46     63   
> {
          64  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   47     65   
    Ok({
          66  +
        /* RustType.kt:516 */
   48     67   
        #[allow(unused_mut)]
          68  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   49     69   
        let mut builder = ::http::Response::builder();
          70  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   50     71   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   51     72   
            builder,
   52     73   
            ::http::header::CONTENT_TYPE,
   53     74   
            "application/json",
   54     75   
        );
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   55     77   
        let http_status: u16 = 200;
   56     78   
        builder = builder.status(http_status);
   57         -
        let payload = "";
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          80  +
        let payload =
          81  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   58     84   
        let content_length = payload.len();
   59     85   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   60     86   
            builder,
   61     87   
            ::http::header::CONTENT_LENGTH,
   62     88   
            content_length,
   63     89   
        );
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   64     91   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          92  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   65     93   
        builder.body(body)?
          94  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   66     95   
    })
          96  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   67     97   
}
   68     98   
          99  +
/* RustType.kt:516 */
   69    100   
#[allow(clippy::unnecessary_wraps)]
         101  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   70    102   
pub fn ser_query_idempotency_token_auto_fill_http_error(
   71    103   
    error: &crate::error::QueryIdempotencyTokenAutoFillError,
   72    104   
) -> std::result::Result<
   73    105   
    ::aws_smithy_http_server::response::Response,
   74    106   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   75    107   
> {
         108  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   76    109   
    Ok({
         110  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   77    111   
        match error {
         112  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   78    113   
            crate::error::QueryIdempotencyTokenAutoFillError::InternalServerError(output) => {
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   79    115   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         116  +
                /* RustType.kt:516 */
   80    117   
                #[allow(unused_mut)]
         118  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   81    119   
                let mut builder = ::http::Response::builder();
         120  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   82    121   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   83    122   
                    builder,
   84    123   
                    ::http::header::CONTENT_TYPE,
   85    124   
                    "application/json",
   86    125   
                );
         126  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   87    127   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   88    128   
                    builder,
   89    129   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   90    130   
                    "InternalServerError",
   91    131   
                );
         132  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   92    133   
                let content_length = payload.len();
   93    134   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   94    135   
                    builder,
   95    136   
                    ::http::header::CONTENT_LENGTH,
   96    137   
                    content_length,
   97    138   
                );
         139  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   98    140   
                builder
   99    141   
                    .status(500)
  100    142   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         143  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         144  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  101    145   
        }
  102         -
        }
         146  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  103    147   
    })
         148  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  104    149   
}

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

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

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

@@ -1,1 +109,162 @@
    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_query_params_as_string_list_map_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::QueryParamsAsStringListMapInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input =
   18     23   
            crate::input::query_params_as_string_list_map_input_internal::Builder::default();
          24  +
        /* RustType.kt:516 */
   19     25   
        #[allow(unused_variables)]
          26  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   20     27   
        let ::aws_smithy_runtime_api::http::RequestParts {
   21     28   
            uri, headers, body, ..
   22     29   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          30  +
        /* ServerHttpBoundProtocolGenerator.kt:1073 */
   23     31   
        let query_string = uri.query().unwrap_or("");
   24     32   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
   25         -
        let mut query_params: ::std::collections::HashMap<
   26         -
            ::std::string::String,
   27         -
            ::std::vec::Vec<::std::string::String>,
   28         -
        > = ::std::collections::HashMap::new();
          33  +
        /* ServerHttpBoundProtocolGenerator.kt:1088 */
          34  +
        let mut query_params: ::std::collections::HashMap::<::std::string::String, ::std::vec::Vec::<::std::string::String>> =
          35  +
            /* ServerHttpBoundProtocolGenerator.kt:1090 */::std::collections::HashMap::new()
          36  +
        /* ServerHttpBoundProtocolGenerator.kt:1088 */;
          37  +
        /* ServerHttpBoundProtocolGenerator.kt:1099 */
   29     38   
        let mut qux_seen = false;
          39  +
        /* ServerHttpBoundProtocolGenerator.kt:1105 */
   30     40   
        for (k, v) in pairs {
          41  +
            /* ServerHttpBoundProtocolGenerator.kt:1109 */
   31     42   
            if !qux_seen && k == "corge" {
   32     43   
                input = input.set_qux(
   33     44   
                    crate::protocol_serde::shape_query_params_as_string_list_map_input::de_qux(&v)?,
   34     45   
                );
   35     46   
                qux_seen = true;
   36     47   
            }
          48  +
            /* ServerHttpBoundProtocolGenerator.kt:1197 */
   37     49   
            let entry = query_params.entry(String::from(k)).or_default();
   38     50   
            entry.push(String::from(v));
          51  +
            /* ServerHttpBoundProtocolGenerator.kt:1105 */
   39     52   
        }
   40         -
        input = input.set_foo(Some(query_params));
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:1213 */
          54  +
        input = input.set_foo(
          55  +
            /* ServerHttpBoundProtocolGenerator.kt:1214 */
          56  +
            Some(
          57  +
                /* ServerHttpBoundProtocolGenerator.kt:1215 */
          58  +
                query_params, /* ServerHttpBoundProtocolGenerator.kt:1214 */
          59  +
            ), /* ServerHttpBoundProtocolGenerator.kt:1213 */
          60  +
        );
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   41     62   
        input.build()
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   42     64   
    })
          65  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   43     66   
}
   44     67   
          68  +
/* RustType.kt:516 */
   45     69   
#[allow(clippy::unnecessary_wraps)]
          70  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   46     71   
pub fn ser_query_params_as_string_list_map_http_response(
   47     72   
    #[allow(unused_variables)] output: crate::output::QueryParamsAsStringListMapOutput,
   48     73   
) -> std::result::Result<
   49     74   
    ::aws_smithy_http_server::response::Response,
   50     75   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   51     76   
> {
          77  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   52     78   
    Ok({
          79  +
        /* RustType.kt:516 */
   53     80   
        #[allow(unused_mut)]
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   54     82   
        let mut builder = ::http::Response::builder();
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   55     84   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   56     85   
            builder,
   57     86   
            ::http::header::CONTENT_TYPE,
   58     87   
            "application/json",
   59     88   
        );
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   60     90   
        let http_status: u16 = 200;
   61     91   
        builder = builder.status(http_status);
   62         -
        let payload = "";
          92  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          93  +
        let payload =
          94  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          95  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          96  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   63     97   
        let content_length = payload.len();
   64     98   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   65     99   
            builder,
   66    100   
            ::http::header::CONTENT_LENGTH,
   67    101   
            content_length,
   68    102   
        );
         103  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   69    104   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
         105  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   70    106   
        builder.body(body)?
         107  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   71    108   
    })
         109  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   72    110   
}
   73    111   
         112  +
/* RustType.kt:516 */
   74    113   
#[allow(clippy::unnecessary_wraps)]
         114  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   75    115   
pub fn ser_query_params_as_string_list_map_http_error(
   76    116   
    error: &crate::error::QueryParamsAsStringListMapError,
   77    117   
) -> std::result::Result<
   78    118   
    ::aws_smithy_http_server::response::Response,
   79    119   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   80    120   
> {
         121  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   81    122   
    Ok({
         123  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   82    124   
        match error {
         125  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   83    126   
            crate::error::QueryParamsAsStringListMapError::InternalServerError(output) => {
         127  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   84    128   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         129  +
                /* RustType.kt:516 */
   85    130   
                #[allow(unused_mut)]
         131  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   86    132   
                let mut builder = ::http::Response::builder();
         133  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   87    134   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   88    135   
                    builder,
   89    136   
                    ::http::header::CONTENT_TYPE,
   90    137   
                    "application/json",
   91    138   
                );
         139  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   92    140   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   93    141   
                    builder,
   94    142   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   95    143   
                    "InternalServerError",
   96    144   
                );
         145  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   97    146   
                let content_length = payload.len();
   98    147   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   99    148   
                    builder,
  100    149   
                    ::http::header::CONTENT_LENGTH,
  101    150   
                    content_length,
  102    151   
                );
         152  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  103    153   
                builder
  104    154   
                    .status(500)
  105    155   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         156  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         157  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  106    158   
        }
  107         -
        }
         159  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  108    160   
    })
         161  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  109    162   
}

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

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

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

@@ -1,1 +109,162 @@
    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_query_precedence_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::QueryPrecedenceInput,
    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::query_precedence_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:1073 */
   22     30   
        let query_string = uri.query().unwrap_or("");
   23     31   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
   24         -
        let mut query_params: ::std::collections::HashMap<
   25         -
            ::std::string::String,
   26         -
            ::std::string::String,
   27         -
        > = ::std::collections::HashMap::new();
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:1088 */
          33  +
        let mut query_params: ::std::collections::HashMap::<::std::string::String, ::std::string::String> =
          34  +
            /* ServerHttpBoundProtocolGenerator.kt:1090 */::std::collections::HashMap::new()
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:1088 */;
          36  +
        /* ServerHttpBoundProtocolGenerator.kt:1099 */
   28     37   
        let mut foo_seen = false;
          38  +
        /* ServerHttpBoundProtocolGenerator.kt:1105 */
   29     39   
        for (k, v) in pairs {
          40  +
            /* ServerHttpBoundProtocolGenerator.kt:1109 */
   30     41   
            if !foo_seen && k == "bar" {
   31     42   
                input = input.set_foo(crate::protocol_serde::shape_query_precedence_input::de_foo(
   32     43   
                    &v,
   33     44   
                )?);
   34     45   
                foo_seen = true;
   35     46   
            }
          47  +
            /* ServerHttpBoundProtocolGenerator.kt:1180 */
   36     48   
            query_params
   37     49   
                .entry(String::from(k))
   38     50   
                .or_insert_with(|| String::from(v));
          51  +
            /* ServerHttpBoundProtocolGenerator.kt:1105 */
   39     52   
        }
   40         -
        input = input.set_baz(Some(query_params));
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:1213 */
          54  +
        input = input.set_baz(
          55  +
            /* ServerHttpBoundProtocolGenerator.kt:1214 */
          56  +
            Some(
          57  +
                /* ServerHttpBoundProtocolGenerator.kt:1215 */
          58  +
                query_params, /* ServerHttpBoundProtocolGenerator.kt:1214 */
          59  +
            ), /* ServerHttpBoundProtocolGenerator.kt:1213 */
          60  +
        );
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   41     62   
        input.build()
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   42     64   
    })
          65  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   43     66   
}
   44     67   
          68  +
/* RustType.kt:516 */
   45     69   
#[allow(clippy::unnecessary_wraps)]
          70  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   46     71   
pub fn ser_query_precedence_http_response(
   47     72   
    #[allow(unused_variables)] output: crate::output::QueryPrecedenceOutput,
   48     73   
) -> std::result::Result<
   49     74   
    ::aws_smithy_http_server::response::Response,
   50     75   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   51     76   
> {
          77  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   52     78   
    Ok({
          79  +
        /* RustType.kt:516 */
   53     80   
        #[allow(unused_mut)]
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   54     82   
        let mut builder = ::http::Response::builder();
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   55     84   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   56     85   
            builder,
   57     86   
            ::http::header::CONTENT_TYPE,
   58     87   
            "application/json",
   59     88   
        );
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   60     90   
        let http_status: u16 = 200;
   61     91   
        builder = builder.status(http_status);
   62         -
        let payload = "";
          92  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          93  +
        let payload =
          94  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          95  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          96  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   63     97   
        let content_length = payload.len();
   64     98   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   65     99   
            builder,
   66    100   
            ::http::header::CONTENT_LENGTH,
   67    101   
            content_length,
   68    102   
        );
         103  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   69    104   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
         105  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   70    106   
        builder.body(body)?
         107  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   71    108   
    })
         109  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   72    110   
}
   73    111   
         112  +
/* RustType.kt:516 */
   74    113   
#[allow(clippy::unnecessary_wraps)]
         114  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   75    115   
pub fn ser_query_precedence_http_error(
   76    116   
    error: &crate::error::QueryPrecedenceError,
   77    117   
) -> std::result::Result<
   78    118   
    ::aws_smithy_http_server::response::Response,
   79    119   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   80    120   
> {
         121  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   81    122   
    Ok({
         123  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   82    124   
        match error {
         125  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   83    126   
            crate::error::QueryPrecedenceError::InternalServerError(output) => {
         127  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   84    128   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         129  +
                /* RustType.kt:516 */
   85    130   
                #[allow(unused_mut)]
         131  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   86    132   
                let mut builder = ::http::Response::builder();
         133  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   87    134   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   88    135   
                    builder,
   89    136   
                    ::http::header::CONTENT_TYPE,
   90    137   
                    "application/json",
   91    138   
                );
         139  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   92    140   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   93    141   
                    builder,
   94    142   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   95    143   
                    "InternalServerError",
   96    144   
                );
         145  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   97    146   
                let content_length = payload.len();
   98    147   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   99    148   
                    builder,
  100    149   
                    ::http::header::CONTENT_LENGTH,
  101    150   
                    content_length,
  102    151   
                );
         152  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  103    153   
                builder
  104    154   
                    .status(500)
  105    155   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         156  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         157  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  106    158   
        }
  107         -
        }
         159  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  108    160   
    })
         161  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  109    162   
}

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

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

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

@@ -1,1 +148,208 @@
    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_recursive_shapes_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::RecursiveShapesInput,
    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::recursive_shapes_input_internal::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_recursive_shapes::de_recursive_shapes(
   29     39   
                bytes.as_ref(),
   30     40   
                input,
   31     41   
            )?;
          42  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   32     43   
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   33     45   
        input.build()
          46  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   34     47   
    })
          48  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   35     49   
}
   36     50   
          51  +
/* RustType.kt:516 */
   37     52   
#[allow(clippy::unnecessary_wraps)]
          53  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   38     54   
pub fn ser_recursive_shapes_http_response(
   39     55   
    #[allow(unused_variables)] output: crate::output::RecursiveShapesOutput,
   40     56   
) -> std::result::Result<
   41     57   
    ::aws_smithy_http_server::response::Response,
   42     58   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   43     59   
> {
          60  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   44     61   
    Ok({
          62  +
        /* RustType.kt:516 */
   45     63   
        #[allow(unused_mut)]
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   46     65   
        let mut builder = ::http::Response::builder();
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   47     67   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   48     68   
            builder,
   49     69   
            ::http::header::CONTENT_TYPE,
   50     70   
            "application/json",
   51     71   
        );
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   52     73   
        let http_status: u16 = 200;
   53     74   
        builder = builder.status(http_status);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   54     76   
        let payload =
   55         -
            crate::protocol_serde::shape_recursive_shapes_output::ser_recursive_shapes_output_output_output(&output)?
   56         -
        ;
          77  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_recursive_shapes_output::ser_recursive_shapes_output_output_output(&output)?
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   57     80   
        let content_length = payload.len();
   58     81   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   59     82   
            builder,
   60     83   
            ::http::header::CONTENT_LENGTH,
   61     84   
            content_length,
   62     85   
        );
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   63     87   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   64     89   
        builder.body(body)?
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   65     91   
    })
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   66     93   
}
   67     94   
          95  +
/* RustType.kt:516 */
   68     96   
#[allow(clippy::unnecessary_wraps)]
          97  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   69     98   
pub fn ser_recursive_shapes_http_error(
   70     99   
    error: &crate::error::RecursiveShapesError,
   71    100   
) -> std::result::Result<
   72    101   
    ::aws_smithy_http_server::response::Response,
   73    102   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   74    103   
> {
         104  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   75    105   
    Ok({
         106  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   76    107   
        match error {
         108  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   77    109   
            crate::error::RecursiveShapesError::InternalServerError(output) => {
         110  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   78    111   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         112  +
                /* RustType.kt:516 */
   79    113   
                #[allow(unused_mut)]
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   80    115   
                let mut builder = ::http::Response::builder();
         116  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   81    117   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   82    118   
                    builder,
   83    119   
                    ::http::header::CONTENT_TYPE,
   84    120   
                    "application/json",
   85    121   
                );
         122  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   86    123   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   87    124   
                    builder,
   88    125   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   89    126   
                    "InternalServerError",
   90    127   
                );
         128  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   91    129   
                let content_length = payload.len();
   92    130   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   93    131   
                    builder,
   94    132   
                    ::http::header::CONTENT_LENGTH,
   95    133   
                    content_length,
   96    134   
                );
         135  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   97    136   
                builder
   98    137   
                    .status(500)
   99    138   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         139  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         140  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  100    141   
        }
  101         -
        }
         142  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  102    143   
    })
         144  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  103    145   
}
  104    146   
         147  +
/* JsonParserGenerator.kt:148 */
  105    148   
pub(crate) fn de_recursive_shapes(
  106    149   
    value: &[u8],
  107    150   
    mut builder: crate::input::recursive_shapes_input_internal::Builder,
  108    151   
) -> ::std::result::Result<
  109    152   
    crate::input::recursive_shapes_input_internal::Builder,
  110    153   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  111    154   
> {
         155  +
    /* JsonParserGenerator.kt:153 */
  112    156   
    let mut tokens_owned =
  113    157   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  114    158   
            .peekable();
  115    159   
    let tokens = &mut tokens_owned;
  116    160   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         161  +
    /* JsonParserGenerator.kt:684 */
  117    162   
    loop {
         163  +
        /* JsonParserGenerator.kt:685 */
  118    164   
        match tokens.next().transpose()? {
         165  +
            /* JsonParserGenerator.kt:686 */
  119    166   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  120    167   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         168  +
                /* JsonParserGenerator.kt:260 */
  121    169   
                match key.to_unescaped()?.as_ref() {
         170  +
                    /* JsonParserGenerator.kt:262 */
  122    171   
                    "nested" => {
         172  +
                        /* JsonParserGenerator.kt:272 */
  123    173   
                        builder = builder.set_nested(
  124         -
                            crate::protocol_serde::shape_recursive_shapes_input_output_nested1::de_recursive_shapes_input_output_nested1(tokens)?
  125         -
                        );
         174  +
                            /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_recursive_shapes_input_output_nested1::de_recursive_shapes_input_output_nested1(tokens)?
         175  +
                        /* JsonParserGenerator.kt:272 */);
         176  +
                        /* JsonParserGenerator.kt:262 */
  126    177   
                    }
  127         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         178  +
                    /* JsonParserGenerator.kt:290 */
         179  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  128    180   
                }
         181  +
                /* JsonParserGenerator.kt:686 */
  129    182   
            }
         183  +
            /* JsonParserGenerator.kt:695 */
  130    184   
            other => {
  131    185   
                return Err(
  132    186   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  133    187   
                        "expected object key or end object, found: {:?}",
  134    188   
                        other
  135    189   
                    )),
  136    190   
                )
         191  +
            } /* JsonParserGenerator.kt:685 */
  137    192   
        }
         193  +
        /* JsonParserGenerator.kt:684 */
  138    194   
    }
  139         -
    }
         195  +
    /* JsonParserGenerator.kt:250 */
  140    196   
    if tokens.next().is_some() {
         197  +
        /* JsonParserGenerator.kt:251 */
  141    198   
        return Err(
  142    199   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  143    200   
                "found more JSON tokens after completing parsing",
  144    201   
            ),
  145    202   
        );
         203  +
        /* JsonParserGenerator.kt:250 */
  146    204   
    }
         205  +
    /* JsonParserGenerator.kt:163 */
  147    206   
    Ok(builder)
         207  +
    /* JsonParserGenerator.kt:148 */
  148    208   
}

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

@@ -1,1 +78,117 @@
    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_recursive_shapes_input_output_nested1<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::model::RecursiveShapesInputOutputNested1>,
    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 =
   21     26   
                crate::model::recursive_shapes_input_output_nested1_internal::Builder::default();
          27  +
            /* JsonParserGenerator.kt:684 */
   22     28   
            loop {
          29  +
                /* JsonParserGenerator.kt:685 */
   23     30   
                match tokens.next().transpose()? {
          31  +
                    /* JsonParserGenerator.kt:686 */
   24     32   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   25     33   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          34  +
                        /* JsonParserGenerator.kt:260 */
   26     35   
                        match key.to_unescaped()?.as_ref() {
          36  +
                            /* JsonParserGenerator.kt:262 */
   27     37   
                            "foo" => {
          38  +
                                /* JsonParserGenerator.kt:272 */
   28     39   
                                builder = builder.set_foo(
   29         -
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
   30         -
                                        tokens.next(),
   31         -
                                    )?
   32         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   33         -
                                    .transpose()?,
   34         -
                                );
          40  +
                                    /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          41  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          42  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
          43  +
                                        /* JsonParserGenerator.kt:339 */)
          44  +
                                    /* JsonParserGenerator.kt:354 */).transpose()?
          45  +
                                /* JsonParserGenerator.kt:272 */);
          46  +
                                /* JsonParserGenerator.kt:262 */
   35     47   
                            }
          48  +
                            /* JsonParserGenerator.kt:262 */
   36     49   
                            "nested" => {
          50  +
                                /* JsonParserGenerator.kt:272 */
   37     51   
                                builder = builder.set_nested(
   38         -
                                    crate::protocol_serde::shape_recursive_shapes_input_output_nested2::de_recursive_shapes_input_output_nested2(tokens)?
   39         -
                                    .map(Box::new)
   40         -
                                );
          52  +
                                    /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_recursive_shapes_input_output_nested2::de_recursive_shapes_input_output_nested2(tokens)?
          53  +
                                    /* JsonParserGenerator.kt:314 */.map(Box::new)
          54  +
                                /* JsonParserGenerator.kt:272 */);
          55  +
                                /* JsonParserGenerator.kt:262 */
   41     56   
                            }
   42         -
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          57  +
                            /* JsonParserGenerator.kt:290 */
          58  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   43     59   
                        }
          60  +
                        /* JsonParserGenerator.kt:686 */
   44     61   
                    }
          62  +
                    /* JsonParserGenerator.kt:695 */
   45     63   
                    other => {
   46     64   
                        return Err(
   47     65   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   48     66   
                                format!("expected object key or end object, found: {:?}", other),
   49     67   
                            ),
   50     68   
                        )
          69  +
                    } /* JsonParserGenerator.kt:685 */
   51     70   
                }
          71  +
                /* JsonParserGenerator.kt:684 */
   52     72   
            }
   53         -
            }
          73  +
            /* JsonParserGenerator.kt:540 */
   54     74   
            Ok(Some(builder.build()))
          75  +
            /* JsonParserGenerator.kt:713 */
   55     76   
        }
   56         -
        _ => Err(
          77  +
        /* JsonParserGenerator.kt:722 */
          78  +
        _ => {
          79  +
            /* JsonParserGenerator.kt:723 */
          80  +
            Err(
   57     81   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   58     82   
                    "expected start object or null",
   59     83   
                ),
   60         -
        ),
          84  +
            )
          85  +
            /* JsonParserGenerator.kt:722 */
          86  +
        } /* JsonParserGenerator.kt:712 */
   61     87   
    }
          88  +
    /* JsonParserGenerator.kt:516 */
   62     89   
}
   63     90   
          91  +
/* JsonSerializerGenerator.kt:358 */
   64     92   
pub fn ser_recursive_shapes_input_output_nested1(
   65     93   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   66     94   
    input: &crate::model::RecursiveShapesInputOutputNested1,
   67     95   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          96  +
    /* JsonSerializerGenerator.kt:382 */
   68     97   
    if let Some(var_1) = &input.foo {
          98  +
        /* JsonSerializerGenerator.kt:423 */
   69     99   
        object.key("foo").string(var_1.as_str());
         100  +
        /* JsonSerializerGenerator.kt:382 */
   70    101   
    }
         102  +
    /* JsonSerializerGenerator.kt:382 */
   71    103   
    if let Some(var_2) = &input.nested {
         104  +
        /* JsonSerializerGenerator.kt:495 */
   72    105   
        #[allow(unused_mut)]
         106  +
        /* JsonSerializerGenerator.kt:496 */
   73    107   
        let mut object_3 = object.key("nested").start_object();
         108  +
        /* JsonSerializerGenerator.kt:375 */
   74    109   
        crate::protocol_serde::shape_recursive_shapes_input_output_nested2::ser_recursive_shapes_input_output_nested2(&mut object_3, var_2)?;
         110  +
        /* JsonSerializerGenerator.kt:515 */
   75    111   
        object_3.finish();
         112  +
        /* JsonSerializerGenerator.kt:382 */
   76    113   
    }
         114  +
    /* JsonSerializerGenerator.kt:372 */
   77    115   
    Ok(())
         116  +
    /* JsonSerializerGenerator.kt:358 */
   78    117   
}

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

@@ -1,1 +77,116 @@
    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_recursive_shapes_input_output_nested2<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::model::RecursiveShapesInputOutputNested2>,
    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 =
   21     26   
                crate::model::recursive_shapes_input_output_nested2_internal::Builder::default();
          27  +
            /* JsonParserGenerator.kt:684 */
   22     28   
            loop {
          29  +
                /* JsonParserGenerator.kt:685 */
   23     30   
                match tokens.next().transpose()? {
          31  +
                    /* JsonParserGenerator.kt:686 */
   24     32   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   25     33   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          34  +
                        /* JsonParserGenerator.kt:260 */
   26     35   
                        match key.to_unescaped()?.as_ref() {
          36  +
                            /* JsonParserGenerator.kt:262 */
   27     37   
                            "bar" => {
          38  +
                                /* JsonParserGenerator.kt:272 */
   28     39   
                                builder = builder.set_bar(
   29         -
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
   30         -
                                        tokens.next(),
   31         -
                                    )?
   32         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   33         -
                                    .transpose()?,
   34         -
                                );
          40  +
                                    /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          41  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          42  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
          43  +
                                        /* JsonParserGenerator.kt:339 */)
          44  +
                                    /* JsonParserGenerator.kt:354 */).transpose()?
          45  +
                                /* JsonParserGenerator.kt:272 */);
          46  +
                                /* JsonParserGenerator.kt:262 */
   35     47   
                            }
          48  +
                            /* JsonParserGenerator.kt:262 */
   36     49   
                            "recursiveMember" => {
          50  +
                                /* JsonParserGenerator.kt:272 */
   37     51   
                                builder = builder.set_recursive_member(
   38         -
                                    crate::protocol_serde::shape_recursive_shapes_input_output_nested1::de_recursive_shapes_input_output_nested1(tokens)?
   39         -
                                );
          52  +
                                    /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_recursive_shapes_input_output_nested1::de_recursive_shapes_input_output_nested1(tokens)?
          53  +
                                /* JsonParserGenerator.kt:272 */);
          54  +
                                /* JsonParserGenerator.kt:262 */
   40     55   
                            }
   41         -
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          56  +
                            /* JsonParserGenerator.kt:290 */
          57  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   42     58   
                        }
          59  +
                        /* JsonParserGenerator.kt:686 */
   43     60   
                    }
          61  +
                    /* JsonParserGenerator.kt:695 */
   44     62   
                    other => {
   45     63   
                        return Err(
   46     64   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   47     65   
                                format!("expected object key or end object, found: {:?}", other),
   48     66   
                            ),
   49     67   
                        )
          68  +
                    } /* JsonParserGenerator.kt:685 */
   50     69   
                }
          70  +
                /* JsonParserGenerator.kt:684 */
   51     71   
            }
   52         -
            }
          72  +
            /* JsonParserGenerator.kt:540 */
   53     73   
            Ok(Some(builder.build()))
          74  +
            /* JsonParserGenerator.kt:713 */
   54     75   
        }
   55         -
        _ => Err(
          76  +
        /* JsonParserGenerator.kt:722 */
          77  +
        _ => {
          78  +
            /* JsonParserGenerator.kt:723 */
          79  +
            Err(
   56     80   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   57     81   
                    "expected start object or null",
   58     82   
                ),
   59         -
        ),
          83  +
            )
          84  +
            /* JsonParserGenerator.kt:722 */
          85  +
        } /* JsonParserGenerator.kt:712 */
   60     86   
    }
          87  +
    /* JsonParserGenerator.kt:516 */
   61     88   
}
   62     89   
          90  +
/* JsonSerializerGenerator.kt:358 */
   63     91   
pub fn ser_recursive_shapes_input_output_nested2(
   64     92   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   65     93   
    input: &crate::model::RecursiveShapesInputOutputNested2,
   66     94   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          95  +
    /* JsonSerializerGenerator.kt:382 */
   67     96   
    if let Some(var_1) = &input.bar {
          97  +
        /* JsonSerializerGenerator.kt:423 */
   68     98   
        object.key("bar").string(var_1.as_str());
          99  +
        /* JsonSerializerGenerator.kt:382 */
   69    100   
    }
         101  +
    /* JsonSerializerGenerator.kt:382 */
   70    102   
    if let Some(var_2) = &input.recursive_member {
         103  +
        /* JsonSerializerGenerator.kt:495 */
   71    104   
        #[allow(unused_mut)]
         105  +
        /* JsonSerializerGenerator.kt:496 */
   72    106   
        let mut object_3 = object.key("recursiveMember").start_object();
         107  +
        /* JsonSerializerGenerator.kt:375 */
   73    108   
        crate::protocol_serde::shape_recursive_shapes_input_output_nested1::ser_recursive_shapes_input_output_nested1(&mut object_3, var_2)?;
         109  +
        /* JsonSerializerGenerator.kt:515 */
   74    110   
        object_3.finish();
         111  +
        /* JsonSerializerGenerator.kt:382 */
   75    112   
    }
         113  +
    /* JsonSerializerGenerator.kt:372 */
   76    114   
    Ok(())
         115  +
    /* JsonSerializerGenerator.kt:358 */
   77    116   
}