Server Test

Server Test

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/protocol_serde/shape_greeting_struct.rs

@@ -1,1 +65,95 @@
    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_greeting_struct<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::model::GreetingStruct>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
>
    8      9   
where
    9     10   
    I: Iterator<
   10     11   
        Item = Result<
   11     12   
            ::aws_smithy_json::deserialize::Token<'a>,
   12     13   
            ::aws_smithy_json::deserialize::error::DeserializeError,
   13     14   
        >,
   14     15   
    >,
   15     16   
{
          17  +
    /* JsonParserGenerator.kt:712 */
   16     18   
    match tokens.next().transpose()? {
          19  +
        /* JsonParserGenerator.kt:713 */
   17     20   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   18     21   
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          22  +
            /* RustType.kt:516 */
   19     23   
            #[allow(unused_mut)]
          24  +
            /* JsonParserGenerator.kt:526 */
   20     25   
            let mut builder = crate::model::greeting_struct::Builder::default();
          26  +
            /* JsonParserGenerator.kt:684 */
   21     27   
            loop {
          28  +
                /* JsonParserGenerator.kt:685 */
   22     29   
                match tokens.next().transpose()? {
          30  +
                    /* JsonParserGenerator.kt:686 */
   23     31   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   24     32   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          33  +
                        /* JsonParserGenerator.kt:260 */
   25     34   
                        match key.to_unescaped()?.as_ref() {
          35  +
                            /* JsonParserGenerator.kt:262 */
   26     36   
                            "hi" => {
          37  +
                                /* JsonParserGenerator.kt:272 */
   27     38   
                                builder = builder.set_hi(
   28         -
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
   29         -
                                        tokens.next(),
   30         -
                                    )?
   31         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   32         -
                                    .transpose()?,
   33         -
                                );
          39  +
                                    /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          40  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          41  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
          42  +
                                        /* JsonParserGenerator.kt:339 */)
          43  +
                                    /* JsonParserGenerator.kt:354 */).transpose()?
          44  +
                                /* JsonParserGenerator.kt:272 */);
          45  +
                                /* JsonParserGenerator.kt:262 */
   34     46   
                            }
   35         -
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          47  +
                            /* JsonParserGenerator.kt:290 */
          48  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   36     49   
                        }
          50  +
                        /* JsonParserGenerator.kt:686 */
   37     51   
                    }
          52  +
                    /* JsonParserGenerator.kt:695 */
   38     53   
                    other => {
   39     54   
                        return Err(
   40     55   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   41     56   
                                format!("expected object key or end object, found: {:?}", other),
   42     57   
                            ),
   43     58   
                        )
          59  +
                    } /* JsonParserGenerator.kt:685 */
   44     60   
                }
          61  +
                /* JsonParserGenerator.kt:684 */
   45     62   
            }
   46         -
            }
          63  +
            /* JsonParserGenerator.kt:540 */
   47     64   
            Ok(Some(builder.build()))
          65  +
            /* JsonParserGenerator.kt:713 */
   48     66   
        }
   49         -
        _ => Err(
          67  +
        /* JsonParserGenerator.kt:722 */
          68  +
        _ => {
          69  +
            /* JsonParserGenerator.kt:723 */
          70  +
            Err(
   50     71   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   51     72   
                    "expected start object or null",
   52     73   
                ),
   53         -
        ),
          74  +
            )
          75  +
            /* JsonParserGenerator.kt:722 */
          76  +
        } /* JsonParserGenerator.kt:712 */
   54     77   
    }
          78  +
    /* JsonParserGenerator.kt:516 */
   55     79   
}
   56     80   
          81  +
/* JsonSerializerGenerator.kt:358 */
   57     82   
pub fn ser_greeting_struct(
   58     83   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   59     84   
    input: &crate::model::GreetingStruct,
   60     85   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          86  +
    /* JsonSerializerGenerator.kt:382 */
   61     87   
    if let Some(var_1) = &input.hi {
          88  +
        /* JsonSerializerGenerator.kt:423 */
   62     89   
        object.key("hi").string(var_1.as_str());
          90  +
        /* JsonSerializerGenerator.kt:382 */
   63     91   
    }
          92  +
    /* JsonSerializerGenerator.kt:372 */
   64     93   
    Ok(())
          94  +
    /* JsonSerializerGenerator.kt:358 */
   65     95   
}

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/protocol_serde/shape_greeting_with_errors.rs

@@ -1,1 +189,268 @@
    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_greeting_with_errors_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::GreetingWithErrorsInput,
    7      9   
    ::aws_smithy_http_server::protocol::aws_json::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::aws_json::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::greeting_with_errors_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/x-amz-json-1.0"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_greeting_with_errors::de_greeting_with_errors(
   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_greeting_with_errors_http_response(
   39     55   
    #[allow(unused_variables)] output: crate::output::GreetingWithErrorsOutput,
   40     56   
) -> std::result::Result<
   41     57   
    ::aws_smithy_http_server::response::Response,
   42     58   
    ::aws_smithy_http_server::protocol::aws_json::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/x-amz-json-1.0",
   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_greeting_with_errors_output::ser_greeting_with_errors_output_output_output(&output)?
   56         -
        ;
          77  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_greeting_with_errors_output::ser_greeting_with_errors_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_greeting_with_errors_http_error(
   70     99   
    error: &crate::error::GreetingWithErrorsError,
   71    100   
) -> std::result::Result<
   72    101   
    ::aws_smithy_http_server::response::Response,
   73    102   
    ::aws_smithy_http_server::protocol::aws_json::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::GreetingWithErrorsError::InvalidGreeting(output) => {
         110  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   78    111   
                let payload =
   79    112   
                    crate::protocol_serde::shape_invalid_greeting::ser_invalid_greeting_error(
   80    113   
                        output,
   81    114   
                    )?;
         115  +
                /* RustType.kt:516 */
   82    116   
                #[allow(unused_mut)]
         117  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   83    118   
                let mut builder = ::http::Response::builder();
         119  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   84    120   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   85    121   
                    builder,
   86    122   
                    ::http::header::CONTENT_TYPE,
   87    123   
                    "application/x-amz-json-1.0",
   88    124   
                );
         125  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   89    126   
                let content_length = payload.len();
   90    127   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   91    128   
                    builder,
   92    129   
                    ::http::header::CONTENT_LENGTH,
   93    130   
                    content_length,
   94    131   
                );
         132  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   95    133   
                builder
   96    134   
                    .status(400)
   97    135   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         136  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
   98    137   
            }
         138  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   99    139   
            crate::error::GreetingWithErrorsError::ComplexError(output) => {
         140  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  100    141   
                let payload =
  101    142   
                    crate::protocol_serde::shape_complex_error::ser_complex_error_error(output)?;
         143  +
                /* RustType.kt:516 */
  102    144   
                #[allow(unused_mut)]
         145  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  103    146   
                let mut builder = ::http::Response::builder();
         147  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  104    148   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  105    149   
                    builder,
  106    150   
                    ::http::header::CONTENT_TYPE,
  107    151   
                    "application/x-amz-json-1.0",
  108    152   
                );
         153  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  109    154   
                let content_length = payload.len();
  110    155   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  111    156   
                    builder,
  112    157   
                    ::http::header::CONTENT_LENGTH,
  113    158   
                    content_length,
  114    159   
                );
         160  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  115    161   
                builder
  116    162   
                    .status(400)
  117    163   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         164  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
  118    165   
            }
         166  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  119    167   
            crate::error::GreetingWithErrorsError::FooError(output) => {
         168  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  120    169   
                let payload = crate::protocol_serde::shape_foo_error::ser_foo_error_error(output)?;
         170  +
                /* RustType.kt:516 */
  121    171   
                #[allow(unused_mut)]
         172  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  122    173   
                let mut builder = ::http::Response::builder();
         174  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  123    175   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  124    176   
                    builder,
  125    177   
                    ::http::header::CONTENT_TYPE,
  126    178   
                    "application/x-amz-json-1.0",
  127    179   
                );
         180  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  128    181   
                let content_length = payload.len();
  129    182   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  130    183   
                    builder,
  131    184   
                    ::http::header::CONTENT_LENGTH,
  132    185   
                    content_length,
  133    186   
                );
         187  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  134    188   
                builder
  135    189   
                    .status(500)
  136    190   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         191  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         192  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  137    193   
        }
  138         -
        }
         194  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  139    195   
    })
         196  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  140    197   
}
  141    198   
         199  +
/* JsonParserGenerator.kt:148 */
  142    200   
pub(crate) fn de_greeting_with_errors(
  143    201   
    value: &[u8],
  144    202   
    mut builder: crate::input::greeting_with_errors_input::Builder,
  145    203   
) -> ::std::result::Result<
  146    204   
    crate::input::greeting_with_errors_input::Builder,
  147    205   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  148    206   
> {
         207  +
    /* JsonParserGenerator.kt:153 */
  149    208   
    let mut tokens_owned =
  150    209   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  151    210   
            .peekable();
  152    211   
    let tokens = &mut tokens_owned;
  153    212   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         213  +
    /* JsonParserGenerator.kt:684 */
  154    214   
    loop {
         215  +
        /* JsonParserGenerator.kt:685 */
  155    216   
        match tokens.next().transpose()? {
         217  +
            /* JsonParserGenerator.kt:686 */
  156    218   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  157    219   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         220  +
                /* JsonParserGenerator.kt:260 */
  158    221   
                match key.to_unescaped()?.as_ref() {
         222  +
                    /* JsonParserGenerator.kt:262 */
  159    223   
                    "greeting" => {
         224  +
                        /* JsonParserGenerator.kt:272 */
  160    225   
                        builder = builder.set_greeting(
         226  +
                            /* JsonParserGenerator.kt:354 */
  161    227   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
  162    228   
                                tokens.next(),
  163    229   
                            )?
  164         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  165         -
                            .transpose()?,
         230  +
                            .map(|s|
         231  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         232  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         233  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         234  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  166    235   
                        );
         236  +
                        /* JsonParserGenerator.kt:262 */
  167    237   
                    }
  168         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         238  +
                    /* JsonParserGenerator.kt:290 */
         239  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  169    240   
                }
         241  +
                /* JsonParserGenerator.kt:686 */
  170    242   
            }
         243  +
            /* JsonParserGenerator.kt:695 */
  171    244   
            other => {
  172    245   
                return Err(
  173    246   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  174    247   
                        "expected object key or end object, found: {:?}",
  175    248   
                        other
  176    249   
                    )),
  177    250   
                )
         251  +
            } /* JsonParserGenerator.kt:685 */
  178    252   
        }
         253  +
        /* JsonParserGenerator.kt:684 */
  179    254   
    }
  180         -
    }
         255  +
    /* JsonParserGenerator.kt:250 */
  181    256   
    if tokens.next().is_some() {
         257  +
        /* JsonParserGenerator.kt:251 */
  182    258   
        return Err(
  183    259   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  184    260   
                "found more JSON tokens after completing parsing",
  185    261   
            ),
  186    262   
        );
         263  +
        /* JsonParserGenerator.kt:250 */
  187    264   
    }
         265  +
    /* JsonParserGenerator.kt:163 */
  188    266   
    Ok(builder)
         267  +
    /* JsonParserGenerator.kt:148 */
  189    268   
}

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/protocol_serde/shape_greeting_with_errors_output.rs

@@ -1,1 +20,31 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_greeting_with_errors_output_output_output(
    3      4   
    value: &crate::output::GreetingWithErrorsOutput,
    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_greeting_with_errors_output::ser_greeting_with_errors_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_greeting_with_errors_output_output(
   13     19   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    input: &crate::output::GreetingWithErrorsOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* JsonSerializerGenerator.kt:382 */
   16     23   
    if let Some(var_1) = &input.greeting {
          24  +
        /* JsonSerializerGenerator.kt:423 */
   17     25   
        object.key("greeting").string(var_1.as_str());
          26  +
        /* JsonSerializerGenerator.kt:382 */
   18     27   
    }
          28  +
    /* JsonSerializerGenerator.kt:372 */
   19     29   
    Ok(())
          30  +
    /* JsonSerializerGenerator.kt:358 */
   20     31   
}

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/protocol_serde/shape_host_with_path_operation.rs

@@ -1,1 +53,78 @@
    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_host_with_path_operation_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::HostWithPathOperationInput,
    7      9   
    ::aws_smithy_http_server::protocol::aws_json::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::aws_json::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::host_with_path_operation_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   22     30   
        input.build()
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   23     32   
    })
          33  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   24     34   
}
   25     35   
          36  +
/* RustType.kt:516 */
   26     37   
#[allow(clippy::unnecessary_wraps)]
          38  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   27     39   
pub fn ser_host_with_path_operation_http_response(
   28     40   
    #[allow(unused_variables)] output: crate::output::HostWithPathOperationOutput,
   29     41   
) -> std::result::Result<
   30     42   
    ::aws_smithy_http_server::response::Response,
   31     43   
    ::aws_smithy_http_server::protocol::aws_json::rejection::ResponseRejection,
   32     44   
> {
          45  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   33     46   
    Ok({
          47  +
        /* RustType.kt:516 */
   34     48   
        #[allow(unused_mut)]
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   35     50   
        let mut builder = ::http::Response::builder();
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   36     52   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   37     53   
            builder,
   38     54   
            ::http::header::CONTENT_TYPE,
   39     55   
            "application/x-amz-json-1.0",
   40     56   
        );
          57  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   41     58   
        let http_status: u16 = 200;
   42     59   
        builder = builder.status(http_status);
   43         -
        let payload = "";
          60  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          61  +
        let payload =
          62  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   44     65   
        let content_length = payload.len();
   45     66   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   46     67   
            builder,
   47     68   
            ::http::header::CONTENT_LENGTH,
   48     69   
            content_length,
   49     70   
        );
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   50     72   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   51     74   
        builder.body(body)?
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   52     76   
    })
          77  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   53     78   
}

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/protocol_serde/shape_invalid_greeting.rs

@@ -1,1 +23,35 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_invalid_greeting_error(
    3      4   
    value: &crate::error::InvalidGreeting,
    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_invalid_greeting::ser_invalid_greeting(&mut object, value)?;
          11  +
    /* ServerAwsJson.kt:95 */
    8     12   
    object
    9     13   
        .key("__type")
   10     14   
        .string("aws.protocoltests.json10#InvalidGreeting");
          15  +
    /* JsonSerializerGenerator.kt:227 */
   11     16   
    object.finish();
   12     17   
    Ok(out)
          18  +
    /* JsonSerializerGenerator.kt:213 */
   13     19   
}
   14     20   
          21  +
/* JsonSerializerGenerator.kt:358 */
   15     22   
pub fn ser_invalid_greeting(
   16     23   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     24   
    input: &crate::error::InvalidGreeting,
   18     25   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          26  +
    /* JsonSerializerGenerator.kt:382 */
   19     27   
    if let Some(var_1) = &input.message {
          28  +
        /* JsonSerializerGenerator.kt:423 */
   20     29   
        object.key("Message").string(var_1.as_str());
          30  +
        /* JsonSerializerGenerator.kt:382 */
   21     31   
    }
          32  +
    /* JsonSerializerGenerator.kt:372 */
   22     33   
    Ok(())
          34  +
    /* JsonSerializerGenerator.kt:358 */
   23     35   
}

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/protocol_serde/shape_json_unions.rs

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

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/protocol_serde/shape_json_unions_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_json_unions_output_output_output(
    3      4   
    value: &crate::output::JsonUnionsOutput,
    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_json_unions_output::ser_json_unions_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_json_unions_output_output(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::output::JsonUnionsOutput,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:382 */
   19     26   
    if let Some(var_1) = &input.contents {
          27  +
        /* JsonSerializerGenerator.kt:495 */
   20     28   
        #[allow(unused_mut)]
          29  +
        /* JsonSerializerGenerator.kt:496 */
   21     30   
        let mut object_2 = object.key("contents").start_object();
          31  +
        /* JsonSerializerGenerator.kt:579 */
   22     32   
        crate::protocol_serde::shape_my_union::ser_my_union(&mut object_2, var_1)?;
          33  +
        /* JsonSerializerGenerator.kt:515 */
   23     34   
        object_2.finish();
          35  +
        /* JsonSerializerGenerator.kt:382 */
   24     36   
    }
          37  +
    /* JsonSerializerGenerator.kt:372 */
   25     38   
    Ok(())
          39  +
    /* JsonSerializerGenerator.kt:358 */
   26     40   
}

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/protocol_serde/shape_my_union.rs

@@ -1,1 +212,359 @@
    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_my_union<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
>
    8      9   
where
    9     10   
    I: Iterator<
   10     11   
        Item = Result<
   11     12   
            ::aws_smithy_json::deserialize::Token<'a>,
   12     13   
            ::aws_smithy_json::deserialize::error::DeserializeError,
   13     14   
        >,
   14     15   
    >,
   15     16   
{
          17  +
    /* JsonParserGenerator.kt:565 */
   16     18   
    let mut variant = None;
          19  +
    /* JsonParserGenerator.kt:567 */
   17     20   
    match tokens.next().transpose()? {
          21  +
        /* JsonParserGenerator.kt:568 */
   18     22   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => return Ok(None),
   19         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => loop {
          23  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          24  +
            /* JsonParserGenerator.kt:684 */
          25  +
            loop {
          26  +
                /* JsonParserGenerator.kt:685 */
   20     27   
                match tokens.next().transpose()? {
          28  +
                    /* JsonParserGenerator.kt:686 */
   21     29   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   22     30   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          31  +
                        /* JsonParserGenerator.kt:576 */
   23     32   
                        if let ::std::option::Option::Some(::std::result::Result::Ok(
   24     33   
                            ::aws_smithy_json::deserialize::Token::ValueNull { .. },
   25     34   
                        )) = tokens.peek()
   26     35   
                        {
   27     36   
                            let _ = tokens.next().expect("peek returned a token")?;
   28     37   
                            continue;
   29     38   
                        }
          39  +
                        /* JsonParserGenerator.kt:585 */
   30     40   
                        let key = key.to_unescaped()?;
   31     41   
                        if key == "__type" {
   32     42   
                            ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
   33     43   
                            continue;
   34     44   
                        }
   35     45   
                        if variant.is_some() {
   36     46   
                            return Err(
   37     47   
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   38     48   
                                    "encountered mixed variants in union",
   39     49   
                                ),
   40     50   
                            );
   41     51   
                        }
          52  +
                        /* JsonParserGenerator.kt:598 */
   42     53   
                        variant = match key.as_ref() {
          54  +
                            /* JsonParserGenerator.kt:601 */
   43     55   
                            "stringValue" => {
          56  +
                                /* JsonParserGenerator.kt:611 */
   44     57   
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::StringValue(
   45         -
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
   46         -
                                        s.to_unescaped().map(|u|
   47         -
                                            u.into_owned()
   48         -
                                        )
   49         -
                                    ).transpose()?
   50         -
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'stringValue' cannot be null"))?
   51         -
                                ))
   52         -
                            }
          58  +
                                    /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          59  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          60  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
          61  +
                                        /* JsonParserGenerator.kt:339 */)
          62  +
                                    /* JsonParserGenerator.kt:354 */).transpose()?
          63  +
                                    /* JsonParserGenerator.kt:670 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'stringValue' cannot be null"))?
          64  +
                                /* JsonParserGenerator.kt:611 */))
          65  +
                                /* JsonParserGenerator.kt:601 */
          66  +
                            }
          67  +
                            /* JsonParserGenerator.kt:601 */
   53     68   
                            "booleanValue" => {
          69  +
                                /* JsonParserGenerator.kt:611 */
   54     70   
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::BooleanValue(
   55         -
                                    ::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?
   56         -
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'booleanValue' cannot be null"))?
   57         -
                                ))
          71  +
                                    /* JsonParserGenerator.kt:298 */::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?
          72  +
                                    /* JsonParserGenerator.kt:670 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'booleanValue' cannot be null"))?
          73  +
                                /* JsonParserGenerator.kt:611 */))
          74  +
                                /* JsonParserGenerator.kt:601 */
   58     75   
                            }
          76  +
                            /* JsonParserGenerator.kt:601 */
   59     77   
                            "numberValue" => {
          78  +
                                /* JsonParserGenerator.kt:611 */
   60     79   
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::NumberValue(
   61         -
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
          80  +
                                    /* JsonParserGenerator.kt:365 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   62     81   
                                                        .map(i32::try_from)
   63     82   
                                                        .transpose()?
   64         -
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'numberValue' cannot be null"))?
   65         -
                                ))
          83  +
                                    /* JsonParserGenerator.kt:670 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'numberValue' cannot be null"))?
          84  +
                                /* JsonParserGenerator.kt:611 */))
          85  +
                                /* JsonParserGenerator.kt:601 */
   66     86   
                            }
          87  +
                            /* JsonParserGenerator.kt:601 */
   67     88   
                            "blobValue" => {
          89  +
                                /* JsonParserGenerator.kt:611 */
   68     90   
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::BlobValue(
   69         -
                                    ::aws_smithy_json::deserialize::token::expect_blob_or_null(tokens.next())?
   70         -
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'blobValue' cannot be null"))?
   71         -
                                ))
          91  +
                                    /* JsonParserGenerator.kt:326 */::aws_smithy_json::deserialize::token::expect_blob_or_null(tokens.next())?
          92  +
                                    /* JsonParserGenerator.kt:670 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'blobValue' cannot be null"))?
          93  +
                                /* JsonParserGenerator.kt:611 */))
          94  +
                                /* JsonParserGenerator.kt:601 */
   72     95   
                            }
          96  +
                            /* JsonParserGenerator.kt:601 */
   73     97   
                            "timestampValue" => {
          98  +
                                /* JsonParserGenerator.kt:611 */
   74     99   
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::TimestampValue(
   75         -
                                    ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::EpochSeconds)?
   76         -
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'timestampValue' cannot be null"))?
   77         -
                                ))
         100  +
                                    /* JsonParserGenerator.kt:384 */::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::EpochSeconds)?
         101  +
                                    /* JsonParserGenerator.kt:670 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'timestampValue' cannot be null"))?
         102  +
                                /* JsonParserGenerator.kt:611 */))
         103  +
                                /* JsonParserGenerator.kt:601 */
   78    104   
                            }
         105  +
                            /* JsonParserGenerator.kt:601 */
   79    106   
                            "enumValue" => {
         107  +
                                /* JsonParserGenerator.kt:611 */
   80    108   
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::EnumValue(
   81         -
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
   82         -
                                        s.to_unescaped().map(|u|
   83         -
                                            u.into_owned()
   84         -
                                        )
   85         -
                                    ).transpose()?
   86         -
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'enumValue' cannot be null"))?
   87         -
                                ))
   88         -
                            }
         109  +
                                    /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
         110  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         111  +
                                            /* JsonParserGenerator.kt:343 */u.into_owned()
         112  +
                                        /* JsonParserGenerator.kt:339 */)
         113  +
                                    /* JsonParserGenerator.kt:354 */).transpose()?
         114  +
                                    /* JsonParserGenerator.kt:670 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'enumValue' cannot be null"))?
         115  +
                                /* JsonParserGenerator.kt:611 */))
         116  +
                                /* JsonParserGenerator.kt:601 */
         117  +
                            }
         118  +
                            /* JsonParserGenerator.kt:601 */
   89    119   
                            "intEnumValue" => {
         120  +
                                /* JsonParserGenerator.kt:611 */
   90    121   
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::IntEnumValue(
   91         -
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
         122  +
                                    /* JsonParserGenerator.kt:365 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   92    123   
                                                        .map(i32::try_from)
   93    124   
                                                        .transpose()?
   94         -
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'intEnumValue' cannot be null"))?
   95         -
                                ))
         125  +
                                    /* JsonParserGenerator.kt:670 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'intEnumValue' cannot be null"))?
         126  +
                                /* JsonParserGenerator.kt:611 */))
         127  +
                                /* JsonParserGenerator.kt:601 */
   96    128   
                            }
         129  +
                            /* JsonParserGenerator.kt:601 */
   97    130   
                            "listValue" => {
         131  +
                                /* JsonParserGenerator.kt:611 */
   98    132   
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::ListValue(
   99         -
                                    crate::protocol_serde::shape_string_list::de_string_list(tokens)?
  100         -
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'listValue' cannot be null"))?
  101         -
                                ))
         133  +
                                    /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_string_list::de_string_list(tokens)?
         134  +
                                    /* JsonParserGenerator.kt:670 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'listValue' cannot be null"))?
         135  +
                                /* JsonParserGenerator.kt:611 */))
         136  +
                                /* JsonParserGenerator.kt:601 */
  102    137   
                            }
         138  +
                            /* JsonParserGenerator.kt:601 */
  103    139   
                            "mapValue" => {
         140  +
                                /* JsonParserGenerator.kt:611 */
  104    141   
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::MapValue(
  105         -
                                    crate::protocol_serde::shape_string_map::de_string_map(tokens)?
  106         -
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'mapValue' cannot be null"))?
  107         -
                                ))
         142  +
                                    /* JsonParserGenerator.kt:509 */crate::protocol_serde::shape_string_map::de_string_map(tokens)?
         143  +
                                    /* JsonParserGenerator.kt:670 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'mapValue' cannot be null"))?
         144  +
                                /* JsonParserGenerator.kt:611 */))
         145  +
                                /* JsonParserGenerator.kt:601 */
  108    146   
                            }
         147  +
                            /* JsonParserGenerator.kt:601 */
  109    148   
                            "structureValue" => {
         149  +
                                /* JsonParserGenerator.kt:611 */
  110    150   
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::StructureValue(
  111         -
                                    crate::protocol_serde::shape_greeting_struct::de_greeting_struct(tokens)?
  112         -
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'structureValue' cannot be null"))?
  113         -
                                ))
         151  +
                                    /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_greeting_struct::de_greeting_struct(tokens)?
         152  +
                                    /* JsonParserGenerator.kt:670 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'structureValue' cannot be null"))?
         153  +
                                /* JsonParserGenerator.kt:611 */))
         154  +
                                /* JsonParserGenerator.kt:601 */
  114    155   
                            }
  115         -
                            variant => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("unexpected union variant: {}", variant)))
         156  +
                            /* JsonParserGenerator.kt:634 */
         157  +
                            variant => {
         158  +
                                return Err(
         159  +
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         160  +
                                        format!("unexpected union variant: {}", variant),
         161  +
                                    ),
         162  +
                                )
         163  +
                            } /* JsonParserGenerator.kt:598 */
  116    164   
                        };
         165  +
                        /* JsonParserGenerator.kt:686 */
  117    166   
                    }
         167  +
                    /* JsonParserGenerator.kt:695 */
  118    168   
                    other => {
  119    169   
                        return Err(
  120         -
                        ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  121         -
                            "expected object key or end object, found: {:?}",
  122         -
                            other
  123         -
                        )),
         170  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         171  +
                                format!("expected object key or end object, found: {:?}", other),
         172  +
                            ),
  124    173   
                        )
         174  +
                    } /* JsonParserGenerator.kt:685 */
  125    175   
                }
         176  +
                /* JsonParserGenerator.kt:684 */
  126    177   
            }
  127         -
        },
         178  +
            /* JsonParserGenerator.kt:568 */
         179  +
        }
         180  +
        /* JsonParserGenerator.kt:642 */
  128    181   
        _ => {
  129    182   
            return Err(
  130    183   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  131    184   
                    "expected start object or null",
  132    185   
                ),
  133    186   
            )
         187  +
        } /* JsonParserGenerator.kt:567 */
  134    188   
    }
  135         -
    }
         189  +
    /* JsonParserGenerator.kt:649 */
  136    190   
    if variant.is_none() {
  137    191   
        return Err(
  138    192   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  139    193   
                "Union did not contain a valid variant.",
  140    194   
            ),
  141    195   
        );
  142    196   
    }
         197  +
    /* JsonParserGenerator.kt:657 */
  143    198   
    Ok(variant)
         199  +
    /* JsonParserGenerator.kt:551 */
  144    200   
}
  145    201   
         202  +
/* JsonSerializerGenerator.kt:547 */
  146    203   
pub fn ser_my_union(
  147    204   
    object_2: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
  148    205   
    input: &crate::model::MyUnion,
  149    206   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
         207  +
    /* JsonSerializerGenerator.kt:556 */
  150    208   
    match input {
         209  +
        /* JsonSerializerGenerator.kt:564 */
  151    210   
        crate::model::MyUnion::StringValue(inner) => {
         211  +
            /* SerializerUtil.kt:42 */
         212  +
            {
         213  +
                /* JsonSerializerGenerator.kt:423 */
  152    214   
                object_2.key("stringValue").string(inner.as_str());
         215  +
                /* SerializerUtil.kt:42 */
         216  +
            }
         217  +
            /* JsonSerializerGenerator.kt:564 */
  153    218   
        }
         219  +
        /* JsonSerializerGenerator.kt:564 */
  154    220   
        crate::model::MyUnion::BooleanValue(inner) => {
         221  +
            /* SerializerUtil.kt:42 */
         222  +
            {
         223  +
                /* JsonSerializerGenerator.kt:424 */
  155    224   
                object_2.key("booleanValue").boolean(*inner);
         225  +
                /* SerializerUtil.kt:42 */
         226  +
            }
         227  +
            /* JsonSerializerGenerator.kt:564 */
  156    228   
        }
         229  +
        /* JsonSerializerGenerator.kt:564 */
  157    230   
        crate::model::MyUnion::NumberValue(inner) => {
         231  +
            /* SerializerUtil.kt:42 */
         232  +
            {
         233  +
                /* JsonSerializerGenerator.kt:432 */
  158    234   
                object_2.key("numberValue").number(
  159    235   
                    #[allow(clippy::useless_conversion)]
  160    236   
                    ::aws_smithy_types::Number::NegInt((*inner).into()),
  161    237   
                );
         238  +
                /* SerializerUtil.kt:42 */
         239  +
            }
         240  +
            /* JsonSerializerGenerator.kt:564 */
  162    241   
        }
         242  +
        /* JsonSerializerGenerator.kt:564 */
  163    243   
        crate::model::MyUnion::BlobValue(inner) => {
         244  +
            /* SerializerUtil.kt:42 */
         245  +
            {
         246  +
                /* JsonSerializerGenerator.kt:439 */
  164    247   
                object_2
  165    248   
                    .key("blobValue")
  166    249   
                    .string_unchecked(&::aws_smithy_types::base64::encode(inner));
         250  +
                /* SerializerUtil.kt:42 */
         251  +
            }
         252  +
            /* JsonSerializerGenerator.kt:564 */
  167    253   
        }
         254  +
        /* JsonSerializerGenerator.kt:564 */
  168    255   
        crate::model::MyUnion::TimestampValue(inner) => {
         256  +
            /* SerializerUtil.kt:42 */
         257  +
            {
         258  +
                /* JsonSerializerGenerator.kt:448 */
  169    259   
                object_2
  170    260   
                    .key("timestampValue")
  171    261   
                    .date_time(inner, ::aws_smithy_types::date_time::Format::EpochSeconds)?;
         262  +
                /* SerializerUtil.kt:42 */
         263  +
            }
         264  +
            /* JsonSerializerGenerator.kt:564 */
  172    265   
        }
         266  +
        /* JsonSerializerGenerator.kt:564 */
  173    267   
        crate::model::MyUnion::EnumValue(inner) => {
         268  +
            /* SerializerUtil.kt:42 */
         269  +
            {
         270  +
                /* JsonSerializerGenerator.kt:423 */
  174    271   
                object_2.key("enumValue").string(inner.as_str());
         272  +
                /* SerializerUtil.kt:42 */
         273  +
            }
         274  +
            /* JsonSerializerGenerator.kt:564 */
  175    275   
        }
         276  +
        /* JsonSerializerGenerator.kt:564 */
  176    277   
        crate::model::MyUnion::IntEnumValue(inner) => {
         278  +
            /* SerializerUtil.kt:42 */
         279  +
            {
         280  +
                /* JsonSerializerGenerator.kt:432 */
  177    281   
                object_2.key("intEnumValue").number(
  178    282   
                    #[allow(clippy::useless_conversion)]
  179    283   
                    ::aws_smithy_types::Number::NegInt((*inner).into()),
  180    284   
                );
         285  +
                /* SerializerUtil.kt:42 */
         286  +
            }
         287  +
            /* JsonSerializerGenerator.kt:564 */
  181    288   
        }
         289  +
        /* JsonSerializerGenerator.kt:564 */
  182    290   
        crate::model::MyUnion::ListValue(inner) => {
         291  +
            /* SerializerUtil.kt:42 */
         292  +
            {
         293  +
                /* JsonSerializerGenerator.kt:484 */
  183    294   
                let mut array_1 = object_2.key("listValue").start_array();
         295  +
                /* JsonSerializerGenerator.kt:524 */
  184    296   
                for item_2 in inner {
         297  +
                    /* SerializerUtil.kt:42 */
  185    298   
                    {
         299  +
                        /* JsonSerializerGenerator.kt:423 */
  186    300   
                        array_1.value().string(item_2.as_str());
         301  +
                        /* SerializerUtil.kt:42 */
  187    302   
                    }
         303  +
                    /* JsonSerializerGenerator.kt:524 */
  188    304   
                }
         305  +
                /* JsonSerializerGenerator.kt:486 */
  189    306   
                array_1.finish();
         307  +
                /* SerializerUtil.kt:42 */
         308  +
            }
         309  +
            /* JsonSerializerGenerator.kt:564 */
  190    310   
        }
         311  +
        /* JsonSerializerGenerator.kt:564 */
  191    312   
        crate::model::MyUnion::MapValue(inner) => {
         313  +
            /* SerializerUtil.kt:42 */
         314  +
            {
         315  +
                /* JsonSerializerGenerator.kt:495 */
  192    316   
                #[allow(unused_mut)]
         317  +
                /* JsonSerializerGenerator.kt:496 */
  193    318   
                let mut object_3 = object_2.key("mapValue").start_object();
         319  +
                /* JsonSerializerGenerator.kt:537 */
  194    320   
                for (key_4, value_5) in inner {
         321  +
                    /* SerializerUtil.kt:42 */
  195    322   
                    {
         323  +
                        /* JsonSerializerGenerator.kt:423 */
  196    324   
                        object_3.key(key_4.as_str()).string(value_5.as_str());
         325  +
                        /* SerializerUtil.kt:42 */
  197    326   
                    }
         327  +
                    /* JsonSerializerGenerator.kt:537 */
  198    328   
                }
         329  +
                /* JsonSerializerGenerator.kt:515 */
  199    330   
                object_3.finish();
         331  +
                /* SerializerUtil.kt:42 */
         332  +
            }
         333  +
            /* JsonSerializerGenerator.kt:564 */
  200    334   
        }
         335  +
        /* JsonSerializerGenerator.kt:564 */
  201    336   
        crate::model::MyUnion::StructureValue(inner) => {
         337  +
            /* SerializerUtil.kt:42 */
         338  +
            {
         339  +
                /* JsonSerializerGenerator.kt:495 */
  202    340   
                #[allow(unused_mut)]
         341  +
                /* JsonSerializerGenerator.kt:496 */
  203    342   
                let mut object_6 = object_2.key("structureValue").start_object();
         343  +
                /* JsonSerializerGenerator.kt:375 */
  204    344   
                crate::protocol_serde::shape_greeting_struct::ser_greeting_struct(
  205    345   
                    &mut object_6,
  206    346   
                    inner,
  207    347   
                )?;
         348  +
                /* JsonSerializerGenerator.kt:515 */
  208    349   
                object_6.finish();
         350  +
                /* SerializerUtil.kt:42 */
         351  +
            }
         352  +
            /* JsonSerializerGenerator.kt:564 */
  209    353   
        }
         354  +
        /* JsonSerializerGenerator.kt:556 */
  210    355   
    }
         356  +
    /* JsonSerializerGenerator.kt:576 */
  211    357   
    Ok(())
         358  +
    /* JsonSerializerGenerator.kt:547 */
  212    359   
}

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/protocol_serde/shape_no_input_and_no_output.rs

@@ -1,1 +53,78 @@
    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_no_input_and_no_output_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::NoInputAndNoOutputInput,
    7      9   
    ::aws_smithy_http_server::protocol::aws_json::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::aws_json::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::no_input_and_no_output_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   22     30   
        input.build()
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   23     32   
    })
          33  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   24     34   
}
   25     35   
          36  +
/* RustType.kt:516 */
   26     37   
#[allow(clippy::unnecessary_wraps)]
          38  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   27     39   
pub fn ser_no_input_and_no_output_http_response(
   28     40   
    #[allow(unused_variables)] output: crate::output::NoInputAndNoOutputOutput,
   29     41   
) -> std::result::Result<
   30     42   
    ::aws_smithy_http_server::response::Response,
   31     43   
    ::aws_smithy_http_server::protocol::aws_json::rejection::ResponseRejection,
   32     44   
> {
          45  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   33     46   
    Ok({
          47  +
        /* RustType.kt:516 */
   34     48   
        #[allow(unused_mut)]
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   35     50   
        let mut builder = ::http::Response::builder();
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   36     52   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   37     53   
            builder,
   38     54   
            ::http::header::CONTENT_TYPE,
   39     55   
            "application/x-amz-json-1.0",
   40     56   
        );
          57  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   41     58   
        let http_status: u16 = 200;
   42     59   
        builder = builder.status(http_status);
   43         -
        let payload = "";
          60  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          61  +
        let payload =
          62  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   44     65   
        let content_length = payload.len();
   45     66   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   46     67   
            builder,
   47     68   
            ::http::header::CONTENT_LENGTH,
   48     69   
            content_length,
   49     70   
        );
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   50     72   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   51     74   
        builder.body(body)?
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   52     76   
    })
          77  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   53     78   
}

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/protocol_serde/shape_no_input_and_output.rs

@@ -1,1 +55,78 @@
    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_no_input_and_output_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::NoInputAndOutputInput,
    7      9   
    ::aws_smithy_http_server::protocol::aws_json::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::aws_json::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::no_input_and_output_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   22     30   
        input.build()
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   23     32   
    })
          33  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   24     34   
}
   25     35   
          36  +
/* RustType.kt:516 */
   26     37   
#[allow(clippy::unnecessary_wraps)]
          38  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   27     39   
pub fn ser_no_input_and_output_http_response(
   28     40   
    #[allow(unused_variables)] output: crate::output::NoInputAndOutputOutput,
   29     41   
) -> std::result::Result<
   30     42   
    ::aws_smithy_http_server::response::Response,
   31     43   
    ::aws_smithy_http_server::protocol::aws_json::rejection::ResponseRejection,
   32     44   
> {
          45  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   33     46   
    Ok({
          47  +
        /* RustType.kt:516 */
   34     48   
        #[allow(unused_mut)]
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   35     50   
        let mut builder = ::http::Response::builder();
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   36     52   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   37     53   
            builder,
   38     54   
            ::http::header::CONTENT_TYPE,
   39     55   
            "application/x-amz-json-1.0",
   40     56   
        );
          57  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   41     58   
        let http_status: u16 = 200;
   42     59   
        builder = builder.status(http_status);
          60  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   43     61   
        let payload =
   44         -
            crate::protocol_serde::shape_no_input_and_output_output::ser_no_input_and_output_output_output_output(&output)?
   45         -
        ;
          62  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_no_input_and_output_output::ser_no_input_and_output_output_output_output(&output)?
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   46     65   
        let content_length = payload.len();
   47     66   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   48     67   
            builder,
   49     68   
            ::http::header::CONTENT_LENGTH,
   50     69   
            content_length,
   51     70   
        );
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   52     72   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   53     74   
        builder.body(body)?
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   54     76   
    })
          77  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   55     78   
}

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/protocol_serde/shape_no_input_and_output_output.rs

@@ -1,1 +20,28 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_no_input_and_output_output_output_output(
    3      4   
    value: &crate::output::NoInputAndOutputOutput,
    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_no_input_and_output_output::ser_no_input_and_output_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_no_input_and_output_output_output(
   16     22   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    #[allow(unused_variables)] input: &crate::output::NoInputAndOutputOutput,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:372 */
   19     26   
    Ok(())
          27  +
    /* JsonSerializerGenerator.kt:358 */
   20     28   
}

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/protocol_serde/shape_operation_with_defaults.rs

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

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/protocol_serde/shape_operation_with_defaults_output.rs

@@ -1,1 +174,279 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_operation_with_defaults_output_output_output(
    3      4   
    value: &crate::output::OperationWithDefaultsOutput,
    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_operation_with_defaults_output::ser_operation_with_defaults_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_operation_with_defaults_output_output(
   13     19   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    input: &crate::output::OperationWithDefaultsOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* SerializerUtil.kt:46 */
   16     23   
    {
          24  +
        /* JsonSerializerGenerator.kt:423 */
   17     25   
        object
   18     26   
            .key("defaultString")
   19     27   
            .string(input.default_string.as_str());
          28  +
        /* SerializerUtil.kt:46 */
   20     29   
    }
          30  +
    /* SerializerUtil.kt:46 */
   21     31   
    {
          32  +
        /* JsonSerializerGenerator.kt:424 */
   22     33   
        object.key("defaultBoolean").boolean(input.default_boolean);
          34  +
        /* SerializerUtil.kt:46 */
   23     35   
    }
          36  +
    /* SerializerUtil.kt:46 */
   24     37   
    {
          38  +
        /* JsonSerializerGenerator.kt:484 */
   25     39   
        let mut array_1 = object.key("defaultList").start_array();
          40  +
        /* JsonSerializerGenerator.kt:524 */
   26     41   
        for item_2 in &input.default_list {
          42  +
            /* SerializerUtil.kt:42 */
   27     43   
            {
          44  +
                /* JsonSerializerGenerator.kt:423 */
   28     45   
                array_1.value().string(item_2.as_str());
          46  +
                /* SerializerUtil.kt:42 */
   29     47   
            }
          48  +
            /* JsonSerializerGenerator.kt:524 */
   30     49   
        }
          50  +
        /* JsonSerializerGenerator.kt:486 */
   31     51   
        array_1.finish();
          52  +
        /* SerializerUtil.kt:46 */
   32     53   
    }
          54  +
    /* SerializerUtil.kt:46 */
   33     55   
    {
          56  +
        /* JsonSerializerGenerator.kt:474 */
   34     57   
        object
   35     58   
            .key("defaultDocumentMap")
   36     59   
            .document(&input.default_document_map);
          60  +
        /* SerializerUtil.kt:46 */
   37     61   
    }
          62  +
    /* SerializerUtil.kt:46 */
   38     63   
    {
          64  +
        /* JsonSerializerGenerator.kt:474 */
   39     65   
        object
   40     66   
            .key("defaultDocumentString")
   41     67   
            .document(&input.default_document_string);
          68  +
        /* SerializerUtil.kt:46 */
   42     69   
    }
          70  +
    /* SerializerUtil.kt:46 */
   43     71   
    {
          72  +
        /* JsonSerializerGenerator.kt:474 */
   44     73   
        object
   45     74   
            .key("defaultDocumentBoolean")
   46     75   
            .document(&input.default_document_boolean);
          76  +
        /* SerializerUtil.kt:46 */
   47     77   
    }
          78  +
    /* SerializerUtil.kt:46 */
   48     79   
    {
          80  +
        /* JsonSerializerGenerator.kt:474 */
   49     81   
        object
   50     82   
            .key("defaultDocumentList")
   51     83   
            .document(&input.default_document_list);
          84  +
        /* SerializerUtil.kt:46 */
   52     85   
    }
          86  +
    /* JsonSerializerGenerator.kt:382 */
   53     87   
    if let Some(var_3) = &input.default_null_document {
          88  +
        /* JsonSerializerGenerator.kt:474 */
   54     89   
        object.key("defaultNullDocument").document(var_3);
          90  +
        /* JsonSerializerGenerator.kt:382 */
   55     91   
    }
          92  +
    /* SerializerUtil.kt:46 */
   56     93   
    {
          94  +
        /* JsonSerializerGenerator.kt:448 */
   57     95   
        object.key("defaultTimestamp").date_time(
   58     96   
            &input.default_timestamp,
   59     97   
            ::aws_smithy_types::date_time::Format::EpochSeconds,
   60     98   
        )?;
          99  +
        /* SerializerUtil.kt:46 */
   61    100   
    }
         101  +
    /* SerializerUtil.kt:46 */
   62    102   
    {
         103  +
        /* JsonSerializerGenerator.kt:439 */
   63    104   
        object
   64    105   
            .key("defaultBlob")
   65    106   
            .string_unchecked(&::aws_smithy_types::base64::encode(&input.default_blob));
         107  +
        /* SerializerUtil.kt:46 */
   66    108   
    }
         109  +
    /* SerializerUtil.kt:46 */
   67    110   
    {
         111  +
        /* JsonSerializerGenerator.kt:432 */
   68    112   
        object.key("defaultByte").number(
   69    113   
            #[allow(clippy::useless_conversion)]
   70    114   
            ::aws_smithy_types::Number::NegInt((input.default_byte).into()),
   71    115   
        );
         116  +
        /* SerializerUtil.kt:46 */
   72    117   
    }
         118  +
    /* SerializerUtil.kt:46 */
   73    119   
    {
         120  +
        /* JsonSerializerGenerator.kt:432 */
   74    121   
        object.key("defaultShort").number(
   75    122   
            #[allow(clippy::useless_conversion)]
   76    123   
            ::aws_smithy_types::Number::NegInt((input.default_short).into()),
   77    124   
        );
         125  +
        /* SerializerUtil.kt:46 */
   78    126   
    }
         127  +
    /* SerializerUtil.kt:46 */
   79    128   
    {
         129  +
        /* JsonSerializerGenerator.kt:432 */
   80    130   
        object.key("defaultInteger").number(
   81    131   
            #[allow(clippy::useless_conversion)]
   82    132   
            ::aws_smithy_types::Number::NegInt((input.default_integer).into()),
   83    133   
        );
         134  +
        /* SerializerUtil.kt:46 */
   84    135   
    }
         136  +
    /* SerializerUtil.kt:46 */
   85    137   
    {
         138  +
        /* JsonSerializerGenerator.kt:432 */
   86    139   
        object.key("defaultLong").number(
   87    140   
            #[allow(clippy::useless_conversion)]
   88    141   
            ::aws_smithy_types::Number::NegInt((input.default_long).into()),
   89    142   
        );
         143  +
        /* SerializerUtil.kt:46 */
   90    144   
    }
         145  +
    /* SerializerUtil.kt:46 */
   91    146   
    {
         147  +
        /* JsonSerializerGenerator.kt:432 */
   92    148   
        object.key("defaultFloat").number(
   93    149   
            #[allow(clippy::useless_conversion)]
   94    150   
            ::aws_smithy_types::Number::Float((input.default_float).into()),
   95    151   
        );
         152  +
        /* SerializerUtil.kt:46 */
   96    153   
    }
         154  +
    /* SerializerUtil.kt:46 */
   97    155   
    {
         156  +
        /* JsonSerializerGenerator.kt:432 */
   98    157   
        object.key("defaultDouble").number(
   99    158   
            #[allow(clippy::useless_conversion)]
  100    159   
            ::aws_smithy_types::Number::Float((input.default_double).into()),
  101    160   
        );
         161  +
        /* SerializerUtil.kt:46 */
  102    162   
    }
         163  +
    /* SerializerUtil.kt:46 */
  103    164   
    {
         165  +
        /* JsonSerializerGenerator.kt:495 */
  104    166   
        #[allow(unused_mut)]
         167  +
        /* JsonSerializerGenerator.kt:496 */
  105    168   
        let mut object_4 = object.key("defaultMap").start_object();
         169  +
        /* JsonSerializerGenerator.kt:537 */
  106    170   
        for (key_5, value_6) in &input.default_map {
         171  +
            /* SerializerUtil.kt:42 */
  107    172   
            {
         173  +
                /* JsonSerializerGenerator.kt:423 */
  108    174   
                object_4.key(key_5.as_str()).string(value_6.as_str());
         175  +
                /* SerializerUtil.kt:42 */
  109    176   
            }
         177  +
            /* JsonSerializerGenerator.kt:537 */
  110    178   
        }
         179  +
        /* JsonSerializerGenerator.kt:515 */
  111    180   
        object_4.finish();
         181  +
        /* SerializerUtil.kt:46 */
  112    182   
    }
         183  +
    /* SerializerUtil.kt:46 */
  113    184   
    {
         185  +
        /* JsonSerializerGenerator.kt:423 */
  114    186   
        object
  115    187   
            .key("defaultEnum")
  116    188   
            .string(input.default_enum.as_str());
         189  +
        /* SerializerUtil.kt:46 */
  117    190   
    }
         191  +
    /* SerializerUtil.kt:46 */
  118    192   
    {
         193  +
        /* JsonSerializerGenerator.kt:432 */
  119    194   
        object.key("defaultIntEnum").number(
  120    195   
            #[allow(clippy::useless_conversion)]
  121    196   
            ::aws_smithy_types::Number::NegInt((input.default_int_enum).into()),
  122    197   
        );
         198  +
        /* SerializerUtil.kt:46 */
  123    199   
    }
         200  +
    /* SerializerUtil.kt:46 */
  124    201   
    {
         202  +
        /* JsonSerializerGenerator.kt:423 */
  125    203   
        object
  126    204   
            .key("emptyString")
  127    205   
            .string(input.empty_string.as_str());
         206  +
        /* SerializerUtil.kt:46 */
  128    207   
    }
         208  +
    /* SerializerUtil.kt:46 */
  129    209   
    {
         210  +
        /* JsonSerializerGenerator.kt:424 */
  130    211   
        object.key("falseBoolean").boolean(input.false_boolean);
         212  +
        /* SerializerUtil.kt:46 */
  131    213   
    }
         214  +
    /* SerializerUtil.kt:46 */
  132    215   
    {
         216  +
        /* JsonSerializerGenerator.kt:439 */
  133    217   
        object
  134    218   
            .key("emptyBlob")
  135    219   
            .string_unchecked(&::aws_smithy_types::base64::encode(&input.empty_blob));
         220  +
        /* SerializerUtil.kt:46 */
  136    221   
    }
         222  +
    /* SerializerUtil.kt:46 */
  137    223   
    {
         224  +
        /* JsonSerializerGenerator.kt:432 */
  138    225   
        object.key("zeroByte").number(
  139    226   
            #[allow(clippy::useless_conversion)]
  140    227   
            ::aws_smithy_types::Number::NegInt((input.zero_byte).into()),
  141    228   
        );
         229  +
        /* SerializerUtil.kt:46 */
  142    230   
    }
         231  +
    /* SerializerUtil.kt:46 */
  143    232   
    {
         233  +
        /* JsonSerializerGenerator.kt:432 */
  144    234   
        object.key("zeroShort").number(
  145    235   
            #[allow(clippy::useless_conversion)]
  146    236   
            ::aws_smithy_types::Number::NegInt((input.zero_short).into()),
  147    237   
        );
         238  +
        /* SerializerUtil.kt:46 */
  148    239   
    }
         240  +
    /* SerializerUtil.kt:46 */
  149    241   
    {
         242  +
        /* JsonSerializerGenerator.kt:432 */
  150    243   
        object.key("zeroInteger").number(
  151    244   
            #[allow(clippy::useless_conversion)]
  152    245   
            ::aws_smithy_types::Number::NegInt((input.zero_integer).into()),
  153    246   
        );
         247  +
        /* SerializerUtil.kt:46 */
  154    248   
    }
         249  +
    /* SerializerUtil.kt:46 */
  155    250   
    {
         251  +
        /* JsonSerializerGenerator.kt:432 */
  156    252   
        object.key("zeroLong").number(
  157    253   
            #[allow(clippy::useless_conversion)]
  158    254   
            ::aws_smithy_types::Number::NegInt((input.zero_long).into()),
  159    255   
        );
         256  +
        /* SerializerUtil.kt:46 */
  160    257   
    }
         258  +
    /* SerializerUtil.kt:46 */
  161    259   
    {
         260  +
        /* JsonSerializerGenerator.kt:432 */
  162    261   
        object.key("zeroFloat").number(
  163    262   
            #[allow(clippy::useless_conversion)]
  164    263   
            ::aws_smithy_types::Number::Float((input.zero_float).into()),
  165    264   
        );
         265  +
        /* SerializerUtil.kt:46 */
  166    266   
    }
         267  +
    /* SerializerUtil.kt:46 */
  167    268   
    {
         269  +
        /* JsonSerializerGenerator.kt:432 */
  168    270   
        object.key("zeroDouble").number(
  169    271   
            #[allow(clippy::useless_conversion)]
  170    272   
            ::aws_smithy_types::Number::Float((input.zero_double).into()),
  171    273   
        );
         274  +
        /* SerializerUtil.kt:46 */
  172    275   
    }
         276  +
    /* JsonSerializerGenerator.kt:372 */
  173    277   
    Ok(())
         278  +
    /* JsonSerializerGenerator.kt:358 */
  174    279   
}

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/protocol_serde/shape_operation_with_nested_structure.rs

@@ -1,1 +142,203 @@
    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_operation_with_nested_structure_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::OperationWithNestedStructureInput,
    7      9   
    ::aws_smithy_http_server::protocol::aws_json::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::aws_json::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::operation_with_nested_structure_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/x-amz-json-1.0"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_operation_with_nested_structure::de_operation_with_nested_structure(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_operation_with_nested_structure_http_response(
   36     52   
    #[allow(unused_variables)] output: crate::output::OperationWithNestedStructureOutput,
   37     53   
) -> std::result::Result<
   38     54   
    ::aws_smithy_http_server::response::Response,
   39     55   
    ::aws_smithy_http_server::protocol::aws_json::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/x-amz-json-1.0",
   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_operation_with_nested_structure_output::ser_operation_with_nested_structure_output_output_output(&output)?
   53         -
        ;
          74  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_operation_with_nested_structure_output::ser_operation_with_nested_structure_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_operation_with_nested_structure_http_error(
   67     96   
    error: &crate::error::OperationWithNestedStructureError,
   68     97   
) -> std::result::Result<
   69     98   
    ::aws_smithy_http_server::response::Response,
   70     99   
    ::aws_smithy_http_server::protocol::aws_json::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::OperationWithNestedStructureError::ValidationException(output) => {
         107  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   75    108   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_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/x-amz-json-1.0",
   82    118   
                );
         119  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   83    120   
                let content_length = payload.len();
   84    121   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   85    122   
                    builder,
   86    123   
                    ::http::header::CONTENT_LENGTH,
   87    124   
                    content_length,
   88    125   
                );
         126  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   89    127   
                builder
   90    128   
                    .status(400)
   91    129   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         130  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         131  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   92    132   
        }
   93         -
        }
         133  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   94    134   
    })
         135  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
   95    136   
}
   96    137   
         138  +
/* JsonParserGenerator.kt:148 */
   97    139   
pub(crate) fn de_operation_with_nested_structure(
   98    140   
    value: &[u8],
   99    141   
    mut builder: crate::input::operation_with_nested_structure_input::Builder,
  100    142   
) -> ::std::result::Result<
  101    143   
    crate::input::operation_with_nested_structure_input::Builder,
  102    144   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  103    145   
> {
         146  +
    /* JsonParserGenerator.kt:153 */
  104    147   
    let mut tokens_owned =
  105    148   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  106    149   
            .peekable();
  107    150   
    let tokens = &mut tokens_owned;
  108    151   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         152  +
    /* JsonParserGenerator.kt:684 */
  109    153   
    loop {
         154  +
        /* JsonParserGenerator.kt:685 */
  110    155   
        match tokens.next().transpose()? {
         156  +
            /* JsonParserGenerator.kt:686 */
  111    157   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  112    158   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         159  +
                /* JsonParserGenerator.kt:260 */
  113    160   
                match key.to_unescaped()?.as_ref() {
         161  +
                    /* JsonParserGenerator.kt:262 */
  114    162   
                    "topLevel" => {
         163  +
                        /* JsonParserGenerator.kt:276 */
  115    164   
                        if let Some(v) =
         165  +
                            /* JsonParserGenerator.kt:544 */
  116    166   
                            crate::protocol_serde::shape_top_level::de_top_level(tokens)?
         167  +
                        /* JsonParserGenerator.kt:278 */
  117    168   
                        {
  118    169   
                            builder = builder.set_top_level(v);
  119    170   
                        }
         171  +
                        /* JsonParserGenerator.kt:262 */
  120    172   
                    }
  121         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         173  +
                    /* JsonParserGenerator.kt:290 */
         174  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  122    175   
                }
         176  +
                /* JsonParserGenerator.kt:686 */
  123    177   
            }
         178  +
            /* JsonParserGenerator.kt:695 */
  124    179   
            other => {
  125    180   
                return Err(
  126    181   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  127    182   
                        "expected object key or end object, found: {:?}",
  128    183   
                        other
  129    184   
                    )),
  130    185   
                )
         186  +
            } /* JsonParserGenerator.kt:685 */
  131    187   
        }
         188  +
        /* JsonParserGenerator.kt:684 */
  132    189   
    }
  133         -
    }
         190  +
    /* JsonParserGenerator.kt:250 */
  134    191   
    if tokens.next().is_some() {
         192  +
        /* JsonParserGenerator.kt:251 */
  135    193   
        return Err(
  136    194   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  137    195   
                "found more JSON tokens after completing parsing",
  138    196   
            ),
  139    197   
        );
         198  +
        /* JsonParserGenerator.kt:250 */
  140    199   
    }
         200  +
    /* JsonParserGenerator.kt:163 */
  141    201   
    Ok(builder)
         202  +
    /* JsonParserGenerator.kt:148 */
  142    203   
}

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/protocol_serde/shape_operation_with_nested_structure_output.rs

@@ -1,1 +48,87 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_operation_with_nested_structure_output_output_output(
    3      4   
    value: &crate::output::OperationWithNestedStructureOutput,
    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_operation_with_nested_structure_output::ser_operation_with_nested_structure_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_operation_with_nested_structure_output_output(
   13     19   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    input: &crate::output::OperationWithNestedStructureOutput,
   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("dialog").start_object();
          28  +
        /* JsonSerializerGenerator.kt:375 */
   19     29   
        crate::protocol_serde::shape_dialog::ser_dialog(&mut object_1, &input.dialog)?;
          30  +
        /* JsonSerializerGenerator.kt:515 */
   20     31   
        object_1.finish();
          32  +
        /* SerializerUtil.kt:42 */
   21     33   
    }
          34  +
    /* SerializerUtil.kt:46 */
   22     35   
    {
          36  +
        /* JsonSerializerGenerator.kt:484 */
   23     37   
        let mut array_2 = object.key("dialogList").start_array();
          38  +
        /* JsonSerializerGenerator.kt:524 */
   24     39   
        for item_3 in &input.dialog_list {
          40  +
            /* SerializerUtil.kt:42 */
   25     41   
            {
          42  +
                /* JsonSerializerGenerator.kt:495 */
   26     43   
                #[allow(unused_mut)]
          44  +
                /* JsonSerializerGenerator.kt:496 */
   27     45   
                let mut object_4 = array_2.value().start_object();
          46  +
                /* JsonSerializerGenerator.kt:375 */
   28     47   
                crate::protocol_serde::shape_dialog::ser_dialog(&mut object_4, item_3)?;
          48  +
                /* JsonSerializerGenerator.kt:515 */
   29     49   
                object_4.finish();
          50  +
                /* SerializerUtil.kt:42 */
   30     51   
            }
          52  +
            /* JsonSerializerGenerator.kt:524 */
   31     53   
        }
          54  +
        /* JsonSerializerGenerator.kt:486 */
   32     55   
        array_2.finish();
          56  +
        /* SerializerUtil.kt:46 */
   33     57   
    }
          58  +
    /* SerializerUtil.kt:46 */
   34     59   
    {
          60  +
        /* JsonSerializerGenerator.kt:495 */
   35     61   
        #[allow(unused_mut)]
          62  +
        /* JsonSerializerGenerator.kt:496 */
   36     63   
        let mut object_5 = object.key("dialogMap").start_object();
          64  +
        /* JsonSerializerGenerator.kt:537 */
   37     65   
        for (key_6, value_7) in &input.dialog_map {
          66  +
            /* SerializerUtil.kt:42 */
   38     67   
            {
          68  +
                /* JsonSerializerGenerator.kt:495 */
   39     69   
                #[allow(unused_mut)]
          70  +
                /* JsonSerializerGenerator.kt:496 */
   40     71   
                let mut object_8 = object_5.key(key_6.as_str()).start_object();
          72  +
                /* JsonSerializerGenerator.kt:375 */
   41     73   
                crate::protocol_serde::shape_dialog::ser_dialog(&mut object_8, value_7)?;
          74  +
                /* JsonSerializerGenerator.kt:515 */
   42     75   
                object_8.finish();
          76  +
                /* SerializerUtil.kt:42 */
   43     77   
            }
          78  +
            /* JsonSerializerGenerator.kt:537 */
   44     79   
        }
          80  +
        /* JsonSerializerGenerator.kt:515 */
   45     81   
        object_5.finish();
          82  +
        /* SerializerUtil.kt:46 */
   46     83   
    }
          84  +
    /* JsonSerializerGenerator.kt:372 */
   47     85   
    Ok(())
          86  +
    /* JsonSerializerGenerator.kt:358 */
   48     87   
}

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/protocol_serde/shape_operation_with_required_members.rs

@@ -1,1 +55,78 @@
    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_operation_with_required_members_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::OperationWithRequiredMembersInput,
    7      9   
    ::aws_smithy_http_server::protocol::aws_json::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::aws_json::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::operation_with_required_members_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   22     30   
        input.build()
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   23     32   
    })
          33  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   24     34   
}
   25     35   
          36  +
/* RustType.kt:516 */
   26     37   
#[allow(clippy::unnecessary_wraps)]
          38  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   27     39   
pub fn ser_operation_with_required_members_http_response(
   28     40   
    #[allow(unused_variables)] output: crate::output::OperationWithRequiredMembersOutput,
   29     41   
) -> std::result::Result<
   30     42   
    ::aws_smithy_http_server::response::Response,
   31     43   
    ::aws_smithy_http_server::protocol::aws_json::rejection::ResponseRejection,
   32     44   
> {
          45  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   33     46   
    Ok({
          47  +
        /* RustType.kt:516 */
   34     48   
        #[allow(unused_mut)]
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   35     50   
        let mut builder = ::http::Response::builder();
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   36     52   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   37     53   
            builder,
   38     54   
            ::http::header::CONTENT_TYPE,
   39     55   
            "application/x-amz-json-1.0",
   40     56   
        );
          57  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   41     58   
        let http_status: u16 = 200;
   42     59   
        builder = builder.status(http_status);
          60  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   43     61   
        let payload =
   44         -
            crate::protocol_serde::shape_operation_with_required_members_output::ser_operation_with_required_members_output_output_output(&output)?
   45         -
        ;
          62  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_operation_with_required_members_output::ser_operation_with_required_members_output_output_output(&output)?
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   46     65   
        let content_length = payload.len();
   47     66   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   48     67   
            builder,
   49     68   
            ::http::header::CONTENT_LENGTH,
   50     69   
            content_length,
   51     70   
        );
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   52     72   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   53     74   
        builder.body(body)?
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   54     76   
    })
          77  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   55     78   
}