Server Test Python

Server Test Python

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943

Files changed:

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

@@ -2,2 +61,62 @@
   22     22   
pub(crate) mod shape_operation_with_nested_structure;
   23     23   
   24     24   
pub(crate) mod shape_operation_with_required_members;
   25     25   
   26     26   
pub(crate) mod shape_put_with_content_encoding;
   27     27   
   28     28   
pub(crate) mod shape_simple_scalar_properties;
   29     29   
   30     30   
pub(crate) mod shape_complex_error;
   31     31   
          32  +
/* JsonParserGenerator.kt:227 */
   32     33   
pub(crate) fn or_empty_doc(data: &[u8]) -> &[u8] {
   33     34   
    if data.is_empty() {
   34     35   
        b"{}"
   35     36   
    } else {
   36     37   
        data
   37     38   
    }
   38     39   
}
   39     40   
   40     41   
pub(crate) mod shape_content_type_parameters_output;
   41     42   

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

@@ -1,1 +57,79 @@
    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_client_optional_defaults<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::model::ClientOptionalDefaults>,
    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::client_optional_defaults_internal::Builder::default();
          26  +
            /* JsonParserGenerator.kt:684 */
   21     27   
            loop {
          28  +
                /* JsonParserGenerator.kt:685 */
   22     29   
                match tokens.next().transpose()? {
          30  +
                    /* JsonParserGenerator.kt:686 */
   23     31   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   24     32   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          33  +
                        /* JsonParserGenerator.kt:260 */
   25     34   
                        match key.to_unescaped()?.as_ref() {
          35  +
                            /* JsonParserGenerator.kt:262 */
   26     36   
                            "member" => {
          37  +
                                /* JsonParserGenerator.kt:276 */
   27     38   
                                if let Some(v) =
   28         -
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
   29         -
                                        tokens.next(),
   30         -
                                    )?
   31         -
                                    .map(i32::try_from)
   32         -
                                    .transpose()?
   33         -
                                {
   34         -
                                    builder = builder.set_member(v);
   35         -
                                }
          39  +
                                /* JsonParserGenerator.kt:365 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
          40  +
                                                    .map(i32::try_from)
          41  +
                                                    .transpose()?
          42  +
                                /* JsonParserGenerator.kt:278 */{
          43  +
                                                                            builder = builder.set_member(v);
          44  +
                                                                        }
          45  +
                                /* JsonParserGenerator.kt:262 */
   36     46   
                            }
   37         -
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          47  +
                            /* JsonParserGenerator.kt:290 */
          48  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   38     49   
                        }
          50  +
                        /* JsonParserGenerator.kt:686 */
   39     51   
                    }
          52  +
                    /* JsonParserGenerator.kt:695 */
   40     53   
                    other => {
   41     54   
                        return Err(
   42     55   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   43     56   
                                format!("expected object key or end object, found: {:?}", other),
   44     57   
                            ),
   45     58   
                        )
   46         -
                    }
          59  +
                    } /* JsonParserGenerator.kt:685 */
   47     60   
                }
          61  +
                /* JsonParserGenerator.kt:684 */
   48     62   
            }
          63  +
            /* JsonParserGenerator.kt:540 */
   49     64   
            Ok(Some(builder.build()))
          65  +
            /* JsonParserGenerator.kt:713 */
   50     66   
        }
   51         -
        _ => Err(
   52         -
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   53         -
                "expected start object or null",
   54         -
            ),
   55         -
        ),
          67  +
        /* JsonParserGenerator.kt:722 */
          68  +
        _ => {
          69  +
            /* JsonParserGenerator.kt:723 */
          70  +
            Err(
          71  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          72  +
                    "expected start object or null",
          73  +
                ),
          74  +
            )
          75  +
            /* JsonParserGenerator.kt:722 */
          76  +
        } /* JsonParserGenerator.kt:712 */
   56     77   
    }
          78  +
    /* JsonParserGenerator.kt:516 */
   57     79   
}

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

@@ -1,1 +32,50 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_complex_error_error(
    3      4   
    value: &crate::error::ComplexError,
    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_complex_error::ser_complex_error(&mut object, value)?;
          11  +
    /* ServerAwsJson.kt:95 */
    8     12   
    object
    9     13   
        .key("__type")
   10     14   
        .string("aws.protocoltests.json10#ComplexError");
          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_complex_error(
   16     23   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     24   
    input: &crate::error::ComplexError,
   18     25   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          26  +
    /* JsonSerializerGenerator.kt:382 */
   19     27   
    if let Some(var_1) = &input.top_level {
          28  +
        /* JsonSerializerGenerator.kt:423 */
   20     29   
        object.key("TopLevel").string(var_1.as_str());
          30  +
        /* JsonSerializerGenerator.kt:382 */
   21     31   
    }
          32  +
    /* JsonSerializerGenerator.kt:382 */
   22     33   
    if let Some(var_2) = &input.nested {
          34  +
        /* JsonSerializerGenerator.kt:495 */
   23     35   
        #[allow(unused_mut)]
          36  +
        /* JsonSerializerGenerator.kt:496 */
   24     37   
        let mut object_3 = object.key("Nested").start_object();
          38  +
        /* JsonSerializerGenerator.kt:375 */
   25     39   
        crate::protocol_serde::shape_complex_nested_error_data::ser_complex_nested_error_data(
   26     40   
            &mut object_3,
   27     41   
            var_2,
   28     42   
        )?;
          43  +
        /* JsonSerializerGenerator.kt:515 */
   29     44   
        object_3.finish();
          45  +
        /* JsonSerializerGenerator.kt:382 */
   30     46   
    }
          47  +
    /* JsonSerializerGenerator.kt:372 */
   31     48   
    Ok(())
          49  +
    /* JsonSerializerGenerator.kt:358 */
   32     50   
}

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

@@ -1,1 +10,16 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:358 */
    2      3   
pub fn ser_complex_nested_error_data(
    3      4   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4      5   
    input: &crate::model::ComplexNestedErrorData,
    5      6   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           7  +
    /* JsonSerializerGenerator.kt:382 */
    6      8   
    if let Some(var_1) = &input.foo {
           9  +
        /* JsonSerializerGenerator.kt:423 */
    7     10   
        object.key("Foo").string(var_1.as_str());
          11  +
        /* JsonSerializerGenerator.kt:382 */
    8     12   
    }
          13  +
    /* JsonSerializerGenerator.kt:372 */
    9     14   
    Ok(())
          15  +
    /* JsonSerializerGenerator.kt:358 */
   10     16   
}

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

@@ -1,1 +148,208 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_content_type_parameters_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::ContentTypeParametersInput,
    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::content_type_parameters_input_internal::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/x-amz-json-1.0"),
   27     37   
            )?;
   28     38   
            input =
   29     39   
                crate::protocol_serde::shape_content_type_parameters::de_content_type_parameters(
   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_content_type_parameters_http_response(
   40     56   
    #[allow(unused_variables)] output: crate::output::ContentTypeParametersOutput,
   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_content_type_parameters_output::ser_content_type_parameters_output_output_output(&output)?
   57         -
        ;
          78  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_content_type_parameters_output::ser_content_type_parameters_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_content_type_parameters_http_error(
   71    100   
    error: &crate::error::ContentTypeParametersError,
   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::ContentTypeParametersError::InternalServerError(output) => {
         111  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   79    112   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_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(500)
   95    133   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
   96         -
            }
         134  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         135  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   97    136   
        }
         137  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   98    138   
    })
         139  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
   99    140   
}
  100    141   
         142  +
/* JsonParserGenerator.kt:148 */
  101    143   
pub(crate) fn de_content_type_parameters(
  102    144   
    value: &[u8],
  103    145   
    mut builder: crate::input::content_type_parameters_input_internal::Builder,
  104    146   
) -> ::std::result::Result<
  105    147   
    crate::input::content_type_parameters_input_internal::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   
                    "value" => {
         167  +
                        /* JsonParserGenerator.kt:272 */
  119    168   
                        builder = builder.set_value(
         169  +
                            /* JsonParserGenerator.kt:365 */
  120    170   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
  121    171   
                                tokens.next(),
  122    172   
                            )?
  123    173   
                            .map(i32::try_from)
  124         -
                            .transpose()?,
         174  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  125    175   
                        );
         176  +
                        /* JsonParserGenerator.kt:262 */
  126    177   
                    }
  127         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         178  +
                    /* JsonParserGenerator.kt:290 */
         179  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  128    180   
                }
         181  +
                /* JsonParserGenerator.kt:686 */
  129    182   
            }
         183  +
            /* JsonParserGenerator.kt:695 */
  130    184   
            other => {
  131    185   
                return Err(
  132    186   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  133    187   
                        "expected object key or end object, found: {:?}",
  134    188   
                        other
  135    189   
                    )),
  136    190   
                )
  137         -
            }
         191  +
            } /* JsonParserGenerator.kt:685 */
  138    192   
        }
         193  +
        /* JsonParserGenerator.kt:684 */
  139    194   
    }
         195  +
    /* JsonParserGenerator.kt:250 */
  140    196   
    if tokens.next().is_some() {
         197  +
        /* JsonParserGenerator.kt:251 */
  141    198   
        return Err(
  142    199   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  143    200   
                "found more JSON tokens after completing parsing",
  144    201   
            ),
  145    202   
        );
         203  +
        /* JsonParserGenerator.kt:250 */
  146    204   
    }
         205  +
    /* JsonParserGenerator.kt:163 */
  147    206   
    Ok(builder)
         207  +
    /* JsonParserGenerator.kt:148 */
  148    208   
}

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

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

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

@@ -1,1 +325,420 @@
    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_defaults<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::model::defaults_internal::Builder>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
>
    8      9   
where
    9     10   
    I: Iterator<
   10     11   
        Item = Result<
   11     12   
            ::aws_smithy_json::deserialize::Token<'a>,
   12     13   
            ::aws_smithy_json::deserialize::error::DeserializeError,
   13     14   
        >,
   14     15   
    >,
   15     16   
{
          17  +
    /* JsonParserGenerator.kt:712 */
   16     18   
    match tokens.next().transpose()? {
          19  +
        /* JsonParserGenerator.kt:713 */
   17     20   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   18     21   
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          22  +
            /* RustType.kt:516 */
   19     23   
            #[allow(unused_mut)]
          24  +
            /* JsonParserGenerator.kt:526 */
   20     25   
            let mut builder = crate::model::defaults_internal::Builder::default();
          26  +
            /* JsonParserGenerator.kt:684 */
   21     27   
            loop {
          28  +
                /* JsonParserGenerator.kt:685 */
   22     29   
                match tokens.next().transpose()? {
          30  +
                    /* JsonParserGenerator.kt:686 */
   23     31   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   24     32   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          33  +
                        /* JsonParserGenerator.kt:260 */
   25     34   
                        match key.to_unescaped()?.as_ref() {
          35  +
                            /* JsonParserGenerator.kt:262 */
   26     36   
                            "defaultString" => {
          37  +
                                /* JsonParserGenerator.kt:276 */
   27     38   
                                if let Some(v) =
   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         -
                                {
   34         -
                                    builder = builder.set_default_string(v);
   35         -
                                }
          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:278 */{
          45  +
                                                                            builder = builder.set_default_string(v);
          46  +
                                                                        }
          47  +
                                /* JsonParserGenerator.kt:262 */
   36     48   
                            }
          49  +
                            /* JsonParserGenerator.kt:262 */
   37     50   
                            "defaultBoolean" => {
          51  +
                                /* JsonParserGenerator.kt:276 */
   38     52   
                                if let Some(v) =
   39         -
                                    ::aws_smithy_json::deserialize::token::expect_bool_or_null(
   40         -
                                        tokens.next(),
   41         -
                                    )?
   42         -
                                {
   43         -
                                    builder = builder.set_default_boolean(v);
   44         -
                                }
          53  +
                                /* JsonParserGenerator.kt:298 */::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?
          54  +
                                /* JsonParserGenerator.kt:278 */{
          55  +
                                                                            builder = builder.set_default_boolean(v);
          56  +
                                                                        }
          57  +
                                /* JsonParserGenerator.kt:262 */
   45     58   
                            }
          59  +
                            /* JsonParserGenerator.kt:262 */
   46     60   
                            "defaultList" => {
          61  +
                                /* JsonParserGenerator.kt:276 */
   47     62   
                                if let Some(v) =
   48         -
                                crate::protocol_serde::shape_test_string_list::de_test_string_list(tokens)?
   49         -
                                {
          63  +
                                /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_test_string_list::de_test_string_list(tokens)?
          64  +
                                /* JsonParserGenerator.kt:278 */{
   50     65   
                                                                            builder = builder.set_default_list(v);
   51     66   
                                                                        }
          67  +
                                /* JsonParserGenerator.kt:262 */
   52     68   
                            }
          69  +
                            /* JsonParserGenerator.kt:262 */
   53     70   
                            "defaultDocumentMap" => {
   54         -
                                if let Some(v) = Some(
   55         -
                                    ::aws_smithy_json::deserialize::token::expect_document(tokens)?,
   56         -
                                )
   57         -
                                .map(::aws_smithy_http_server_python::types::Document::from)
          71  +
                                /* JsonParserGenerator.kt:276 */
          72  +
                                if let Some(v) =
          73  +
                                    /* JsonParserGenerator.kt:319 */
          74  +
                                    Some(
          75  +
                                        ::aws_smithy_json::deserialize::token::expect_document(
          76  +
                                            tokens,
          77  +
                                        )?,
          78  +
                                    )
          79  +
                                    /* PythonServerProtocolLoader.kt:52 */
          80  +
                                    .map(::aws_smithy_http_server_python::types::Document::from)
          81  +
                                /* JsonParserGenerator.kt:278 */
   58     82   
                                {
   59     83   
                                    builder = builder.set_default_document_map(v);
   60     84   
                                }
          85  +
                                /* JsonParserGenerator.kt:262 */
   61     86   
                            }
          87  +
                            /* JsonParserGenerator.kt:262 */
   62     88   
                            "defaultDocumentString" => {
   63         -
                                if let Some(v) = Some(
   64         -
                                    ::aws_smithy_json::deserialize::token::expect_document(tokens)?,
   65         -
                                )
   66         -
                                .map(::aws_smithy_http_server_python::types::Document::from)
          89  +
                                /* JsonParserGenerator.kt:276 */
          90  +
                                if let Some(v) =
          91  +
                                    /* JsonParserGenerator.kt:319 */
          92  +
                                    Some(
          93  +
                                        ::aws_smithy_json::deserialize::token::expect_document(
          94  +
                                            tokens,
          95  +
                                        )?,
          96  +
                                    )
          97  +
                                    /* PythonServerProtocolLoader.kt:52 */
          98  +
                                    .map(::aws_smithy_http_server_python::types::Document::from)
          99  +
                                /* JsonParserGenerator.kt:278 */
   67    100   
                                {
   68    101   
                                    builder = builder.set_default_document_string(v);
   69    102   
                                }
         103  +
                                /* JsonParserGenerator.kt:262 */
   70    104   
                            }
         105  +
                            /* JsonParserGenerator.kt:262 */
   71    106   
                            "defaultDocumentBoolean" => {
   72         -
                                if let Some(v) = Some(
   73         -
                                    ::aws_smithy_json::deserialize::token::expect_document(tokens)?,
   74         -
                                )
   75         -
                                .map(::aws_smithy_http_server_python::types::Document::from)
         107  +
                                /* JsonParserGenerator.kt:276 */
         108  +
                                if let Some(v) =
         109  +
                                    /* JsonParserGenerator.kt:319 */
         110  +
                                    Some(
         111  +
                                        ::aws_smithy_json::deserialize::token::expect_document(
         112  +
                                            tokens,
         113  +
                                        )?,
         114  +
                                    )
         115  +
                                    /* PythonServerProtocolLoader.kt:52 */
         116  +
                                    .map(::aws_smithy_http_server_python::types::Document::from)
         117  +
                                /* JsonParserGenerator.kt:278 */
   76    118   
                                {
   77    119   
                                    builder = builder.set_default_document_boolean(v);
   78    120   
                                }
         121  +
                                /* JsonParserGenerator.kt:262 */
   79    122   
                            }
         123  +
                            /* JsonParserGenerator.kt:262 */
   80    124   
                            "defaultDocumentList" => {
   81         -
                                if let Some(v) = Some(
   82         -
                                    ::aws_smithy_json::deserialize::token::expect_document(tokens)?,
   83         -
                                )
   84         -
                                .map(::aws_smithy_http_server_python::types::Document::from)
         125  +
                                /* JsonParserGenerator.kt:276 */
         126  +
                                if let Some(v) =
         127  +
                                    /* JsonParserGenerator.kt:319 */
         128  +
                                    Some(
         129  +
                                        ::aws_smithy_json::deserialize::token::expect_document(
         130  +
                                            tokens,
         131  +
                                        )?,
         132  +
                                    )
         133  +
                                    /* PythonServerProtocolLoader.kt:52 */
         134  +
                                    .map(::aws_smithy_http_server_python::types::Document::from)
         135  +
                                /* JsonParserGenerator.kt:278 */
   85    136   
                                {
   86    137   
                                    builder = builder.set_default_document_list(v);
   87    138   
                                }
         139  +
                                /* JsonParserGenerator.kt:262 */
   88    140   
                            }
         141  +
                            /* JsonParserGenerator.kt:262 */
   89    142   
                            "defaultNullDocument" => {
   90         -
                                builder = builder.set_default_null_document(
   91         -
                                    Some(::aws_smithy_json::deserialize::token::expect_document(
   92         -
                                        tokens,
   93         -
                                    )?)
   94         -
                                    .map(::aws_smithy_http_server_python::types::Document::from),
   95         -
                                );
         143  +
                                /* JsonParserGenerator.kt:272 */
         144  +
                                builder =
         145  +
                                    builder.set_default_null_document(
         146  +
                                        /* JsonParserGenerator.kt:319 */
         147  +
                                        Some(
         148  +
                                            ::aws_smithy_json::deserialize::token::expect_document(
         149  +
                                                tokens,
         150  +
                                            )?,
         151  +
                                        )
         152  +
                                        /* PythonServerProtocolLoader.kt:52 */
         153  +
                                        .map(
         154  +
                                            ::aws_smithy_http_server_python::types::Document::from,
         155  +
                                        ), /* JsonParserGenerator.kt:272 */
         156  +
                                    );
         157  +
                                /* JsonParserGenerator.kt:262 */
   96    158   
                            }
         159  +
                            /* JsonParserGenerator.kt:262 */
   97    160   
                            "defaultTimestamp" => {
         161  +
                                /* JsonParserGenerator.kt:276 */
   98    162   
                                if let Some(v) =
   99         -
                                    ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
  100         -
                                        tokens.next(),
  101         -
                                        ::aws_smithy_types::date_time::Format::EpochSeconds,
  102         -
                                    )?
  103         -
                                    .map(::aws_smithy_http_server_python::types::DateTime::from)
  104         -
                                {
  105         -
                                    builder = builder.set_default_timestamp(v);
  106         -
                                }
         163  +
                                /* JsonParserGenerator.kt:384 */::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::EpochSeconds)?
         164  +
                                /* PythonServerProtocolLoader.kt:44 */.map(::aws_smithy_http_server_python::types::DateTime::from)
         165  +
                                /* JsonParserGenerator.kt:278 */{
         166  +
                                                                            builder = builder.set_default_timestamp(v);
         167  +
                                                                        }
         168  +
                                /* JsonParserGenerator.kt:262 */
  107    169   
                            }
         170  +
                            /* JsonParserGenerator.kt:262 */
  108    171   
                            "defaultBlob" => {
         172  +
                                /* JsonParserGenerator.kt:276 */
  109    173   
                                if let Some(v) =
  110         -
                                    ::aws_smithy_json::deserialize::token::expect_blob_or_null(
  111         -
                                        tokens.next(),
  112         -
                                    )?
  113         -
                                    .map(::aws_smithy_http_server_python::types::Blob::from)
  114         -
                                {
  115         -
                                    builder = builder.set_default_blob(v);
  116         -
                                }
         174  +
                                /* JsonParserGenerator.kt:326 */::aws_smithy_json::deserialize::token::expect_blob_or_null(tokens.next())?
         175  +
                                /* PythonServerProtocolLoader.kt:48 */.map(::aws_smithy_http_server_python::types::Blob::from)
         176  +
                                /* JsonParserGenerator.kt:278 */{
         177  +
                                                                            builder = builder.set_default_blob(v);
         178  +
                                                                        }
         179  +
                                /* JsonParserGenerator.kt:262 */
  117    180   
                            }
         181  +
                            /* JsonParserGenerator.kt:262 */
  118    182   
                            "defaultByte" => {
         183  +
                                /* JsonParserGenerator.kt:276 */
  119    184   
                                if let Some(v) =
  120         -
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
  121         -
                                        tokens.next(),
  122         -
                                    )?
  123         -
                                    .map(i8::try_from)
  124         -
                                    .transpose()?
  125         -
                                {
  126         -
                                    builder = builder.set_default_byte(v);
  127         -
                                }
         185  +
                                /* JsonParserGenerator.kt:365 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
         186  +
                                                    .map(i8::try_from)
         187  +
                                                    .transpose()?
         188  +
                                /* JsonParserGenerator.kt:278 */{
         189  +
                                                                            builder = builder.set_default_byte(v);
         190  +
                                                                        }
         191  +
                                /* JsonParserGenerator.kt:262 */
  128    192   
                            }
         193  +
                            /* JsonParserGenerator.kt:262 */
  129    194   
                            "defaultShort" => {
         195  +
                                /* JsonParserGenerator.kt:276 */
  130    196   
                                if let Some(v) =
  131         -
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
  132         -
                                        tokens.next(),
  133         -
                                    )?
  134         -
                                    .map(i16::try_from)
  135         -
                                    .transpose()?
  136         -
                                {
  137         -
                                    builder = builder.set_default_short(v);
  138         -
                                }
         197  +
                                /* JsonParserGenerator.kt:365 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
         198  +
                                                    .map(i16::try_from)
         199  +
                                                    .transpose()?
         200  +
                                /* JsonParserGenerator.kt:278 */{
         201  +
                                                                            builder = builder.set_default_short(v);
         202  +
                                                                        }
         203  +
                                /* JsonParserGenerator.kt:262 */
  139    204   
                            }
         205  +
                            /* JsonParserGenerator.kt:262 */
  140    206   
                            "defaultInteger" => {
         207  +
                                /* JsonParserGenerator.kt:276 */
  141    208   
                                if let Some(v) =
  142         -
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
  143         -
                                        tokens.next(),
  144         -
                                    )?
  145         -
                                    .map(i32::try_from)
  146         -
                                    .transpose()?
  147         -
                                {
  148         -
                                    builder = builder.set_default_integer(v);
  149         -
                                }
         209  +
                                /* JsonParserGenerator.kt:365 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
         210  +
                                                    .map(i32::try_from)
         211  +
                                                    .transpose()?
         212  +
                                /* JsonParserGenerator.kt:278 */{
         213  +
                                                                            builder = builder.set_default_integer(v);
         214  +
                                                                        }
         215  +
                                /* JsonParserGenerator.kt:262 */
  150    216   
                            }
         217  +
                            /* JsonParserGenerator.kt:262 */
  151    218   
                            "defaultLong" => {
         219  +
                                /* JsonParserGenerator.kt:276 */
  152    220   
                                if let Some(v) =
  153         -
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
  154         -
                                        tokens.next(),
  155         -
                                    )?
  156         -
                                    .map(i64::try_from)
  157         -
                                    .transpose()?
  158         -
                                {
  159         -
                                    builder = builder.set_default_long(v);
  160         -
                                }
         221  +
                                /* JsonParserGenerator.kt:365 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
         222  +
                                                    .map(i64::try_from)
         223  +
                                                    .transpose()?
         224  +
                                /* JsonParserGenerator.kt:278 */{
         225  +
                                                                            builder = builder.set_default_long(v);
         226  +
                                                                        }
         227  +
                                /* JsonParserGenerator.kt:262 */
  161    228   
                            }
         229  +
                            /* JsonParserGenerator.kt:262 */
  162    230   
                            "defaultFloat" => {
         231  +
                                /* JsonParserGenerator.kt:276 */
  163    232   
                                if let Some(v) =
  164         -
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
  165         -
                                        tokens.next(),
  166         -
                                    )?
  167         -
                                    .map(|v| v.to_f32_lossy())
  168         -
                                {
  169         -
                                    builder = builder.set_default_float(v);
  170         -
                                }
         233  +
                                /* JsonParserGenerator.kt:361 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f32_lossy())
         234  +
                                /* JsonParserGenerator.kt:278 */{
         235  +
                                                                            builder = builder.set_default_float(v);
         236  +
                                                                        }
         237  +
                                /* JsonParserGenerator.kt:262 */
  171    238   
                            }
         239  +
                            /* JsonParserGenerator.kt:262 */
  172    240   
                            "defaultDouble" => {
         241  +
                                /* JsonParserGenerator.kt:276 */
  173    242   
                                if let Some(v) =
  174         -
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
  175         -
                                        tokens.next(),
  176         -
                                    )?
  177         -
                                    .map(|v| v.to_f64_lossy())
  178         -
                                {
  179         -
                                    builder = builder.set_default_double(v);
  180         -
                                }
         243  +
                                /* JsonParserGenerator.kt:363 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f64_lossy())
         244  +
                                /* JsonParserGenerator.kt:278 */{
         245  +
                                                                            builder = builder.set_default_double(v);
         246  +
                                                                        }
         247  +
                                /* JsonParserGenerator.kt:262 */
  181    248   
                            }
         249  +
                            /* JsonParserGenerator.kt:262 */
  182    250   
                            "defaultMap" => {
         251  +
                                /* JsonParserGenerator.kt:276 */
  183    252   
                                if let Some(v) =
  184         -
                                crate::protocol_serde::shape_test_string_map::de_test_string_map(tokens)?
  185         -
                                {
         253  +
                                /* JsonParserGenerator.kt:509 */crate::protocol_serde::shape_test_string_map::de_test_string_map(tokens)?
         254  +
                                /* JsonParserGenerator.kt:278 */{
  186    255   
                                                                            builder = builder.set_default_map(v);
  187    256   
                                                                        }
         257  +
                                /* JsonParserGenerator.kt:262 */
  188    258   
                            }
         259  +
                            /* JsonParserGenerator.kt:262 */
  189    260   
                            "defaultEnum" => {
         261  +
                                /* JsonParserGenerator.kt:276 */
  190    262   
                                if let Some(v) =
  191         -
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
  192         -
                                        tokens.next(),
  193         -
                                    )?
  194         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  195         -
                                    .transpose()?
  196         -
                                {
  197         -
                                    builder = builder.set_default_enum(v);
  198         -
                                }
         263  +
                                /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
         264  +
                                    /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         265  +
                                        /* JsonParserGenerator.kt:343 */u.into_owned()
         266  +
                                    /* JsonParserGenerator.kt:339 */)
         267  +
                                /* JsonParserGenerator.kt:354 */).transpose()?
         268  +
                                /* JsonParserGenerator.kt:278 */{
         269  +
                                                                            builder = builder.set_default_enum(v);
         270  +
                                                                        }
         271  +
                                /* JsonParserGenerator.kt:262 */
  199    272   
                            }
         273  +
                            /* JsonParserGenerator.kt:262 */
  200    274   
                            "defaultIntEnum" => {
         275  +
                                /* JsonParserGenerator.kt:276 */
  201    276   
                                if let Some(v) =
  202         -
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
  203         -
                                        tokens.next(),
  204         -
                                    )?
  205         -
                                    .map(i32::try_from)
  206         -
                                    .transpose()?
  207         -
                                {
  208         -
                                    builder = builder.set_default_int_enum(v);
  209         -
                                }
         277  +
                                /* JsonParserGenerator.kt:365 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
         278  +
                                                    .map(i32::try_from)
         279  +
                                                    .transpose()?
         280  +
                                /* JsonParserGenerator.kt:278 */{
         281  +
                                                                            builder = builder.set_default_int_enum(v);
         282  +
                                                                        }
         283  +
                                /* JsonParserGenerator.kt:262 */
  210    284   
                            }
         285  +
                            /* JsonParserGenerator.kt:262 */
  211    286   
                            "emptyString" => {
         287  +
                                /* JsonParserGenerator.kt:276 */
  212    288   
                                if let Some(v) =
  213         -
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
  214         -
                                        tokens.next(),
  215         -
                                    )?
  216         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  217         -
                                    .transpose()?
  218         -
                                {
  219         -
                                    builder = builder.set_empty_string(v);
  220         -
                                }
         289  +
                                /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
         290  +
                                    /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         291  +
                                        /* JsonParserGenerator.kt:348 */u.into_owned()
         292  +
                                    /* JsonParserGenerator.kt:339 */)
         293  +
                                /* JsonParserGenerator.kt:354 */).transpose()?
         294  +
                                /* JsonParserGenerator.kt:278 */{
         295  +
                                                                            builder = builder.set_empty_string(v);
         296  +
                                                                        }
         297  +
                                /* JsonParserGenerator.kt:262 */
  221    298   
                            }
         299  +
                            /* JsonParserGenerator.kt:262 */
  222    300   
                            "falseBoolean" => {
         301  +
                                /* JsonParserGenerator.kt:276 */
  223    302   
                                if let Some(v) =
  224         -
                                    ::aws_smithy_json::deserialize::token::expect_bool_or_null(
  225         -
                                        tokens.next(),
  226         -
                                    )?
  227         -
                                {
  228         -
                                    builder = builder.set_false_boolean(v);
  229         -
                                }
         303  +
                                /* JsonParserGenerator.kt:298 */::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?
         304  +
                                /* JsonParserGenerator.kt:278 */{
         305  +
                                                                            builder = builder.set_false_boolean(v);
         306  +
                                                                        }
         307  +
                                /* JsonParserGenerator.kt:262 */
  230    308   
                            }
         309  +
                            /* JsonParserGenerator.kt:262 */
  231    310   
                            "emptyBlob" => {
         311  +
                                /* JsonParserGenerator.kt:276 */
  232    312   
                                if let Some(v) =
  233         -
                                    ::aws_smithy_json::deserialize::token::expect_blob_or_null(
  234         -
                                        tokens.next(),
  235         -
                                    )?
  236         -
                                    .map(::aws_smithy_http_server_python::types::Blob::from)
  237         -
                                {
  238         -
                                    builder = builder.set_empty_blob(v);
  239         -
                                }
         313  +
                                /* JsonParserGenerator.kt:326 */::aws_smithy_json::deserialize::token::expect_blob_or_null(tokens.next())?
         314  +
                                /* PythonServerProtocolLoader.kt:48 */.map(::aws_smithy_http_server_python::types::Blob::from)
         315  +
                                /* JsonParserGenerator.kt:278 */{
         316  +
                                                                            builder = builder.set_empty_blob(v);
         317  +
                                                                        }
         318  +
                                /* JsonParserGenerator.kt:262 */
  240    319   
                            }
         320  +
                            /* JsonParserGenerator.kt:262 */
  241    321   
                            "zeroByte" => {
         322  +
                                /* JsonParserGenerator.kt:276 */
  242    323   
                                if let Some(v) =
  243         -
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
  244         -
                                        tokens.next(),
  245         -
                                    )?
  246         -
                                    .map(i8::try_from)
  247         -
                                    .transpose()?
  248         -
                                {
  249         -
                                    builder = builder.set_zero_byte(v);
  250         -
                                }
         324  +
                                /* JsonParserGenerator.kt:365 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
         325  +
                                                    .map(i8::try_from)
         326  +
                                                    .transpose()?
         327  +
                                /* JsonParserGenerator.kt:278 */{
         328  +
                                                                            builder = builder.set_zero_byte(v);
         329  +
                                                                        }
         330  +
                                /* JsonParserGenerator.kt:262 */
  251    331   
                            }
         332  +
                            /* JsonParserGenerator.kt:262 */
  252    333   
                            "zeroShort" => {
         334  +
                                /* JsonParserGenerator.kt:276 */
  253    335   
                                if let Some(v) =
  254         -
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
  255         -
                                        tokens.next(),
  256         -
                                    )?
  257         -
                                    .map(i16::try_from)
  258         -
                                    .transpose()?
  259         -
                                {
  260         -
                                    builder = builder.set_zero_short(v);
  261         -
                                }
         336  +
                                /* JsonParserGenerator.kt:365 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
         337  +
                                                    .map(i16::try_from)
         338  +
                                                    .transpose()?
         339  +
                                /* JsonParserGenerator.kt:278 */{
         340  +
                                                                            builder = builder.set_zero_short(v);
         341  +
                                                                        }
         342  +
                                /* JsonParserGenerator.kt:262 */
  262    343   
                            }
         344  +
                            /* JsonParserGenerator.kt:262 */
  263    345   
                            "zeroInteger" => {
         346  +
                                /* JsonParserGenerator.kt:276 */
  264    347   
                                if let Some(v) =
  265         -
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
  266         -
                                        tokens.next(),
  267         -
                                    )?
  268         -
                                    .map(i32::try_from)
  269         -
                                    .transpose()?
  270         -
                                {
  271         -
                                    builder = builder.set_zero_integer(v);
  272         -
                                }
         348  +
                                /* JsonParserGenerator.kt:365 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
         349  +
                                                    .map(i32::try_from)
         350  +
                                                    .transpose()?
         351  +
                                /* JsonParserGenerator.kt:278 */{
         352  +
                                                                            builder = builder.set_zero_integer(v);
         353  +
                                                                        }
         354  +
                                /* JsonParserGenerator.kt:262 */
  273    355   
                            }
         356  +
                            /* JsonParserGenerator.kt:262 */
  274    357   
                            "zeroLong" => {
         358  +
                                /* JsonParserGenerator.kt:276 */
  275    359   
                                if let Some(v) =
  276         -
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
  277         -
                                        tokens.next(),
  278         -
                                    )?
  279         -
                                    .map(i64::try_from)
  280         -
                                    .transpose()?
  281         -
                                {
  282         -
                                    builder = builder.set_zero_long(v);
  283         -
                                }
         360  +
                                /* JsonParserGenerator.kt:365 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
         361  +
                                                    .map(i64::try_from)
         362  +
                                                    .transpose()?
         363  +
                                /* JsonParserGenerator.kt:278 */{
         364  +
                                                                            builder = builder.set_zero_long(v);
         365  +
                                                                        }
         366  +
                                /* JsonParserGenerator.kt:262 */
  284    367   
                            }
         368  +
                            /* JsonParserGenerator.kt:262 */
  285    369   
                            "zeroFloat" => {
         370  +
                                /* JsonParserGenerator.kt:276 */
  286    371   
                                if let Some(v) =
  287         -
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
  288         -
                                        tokens.next(),
  289         -
                                    )?
  290         -
                                    .map(|v| v.to_f32_lossy())
  291         -
                                {
  292         -
                                    builder = builder.set_zero_float(v);
  293         -
                                }
         372  +
                                /* JsonParserGenerator.kt:361 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f32_lossy())
         373  +
                                /* JsonParserGenerator.kt:278 */{
         374  +
                                                                            builder = builder.set_zero_float(v);
         375  +
                                                                        }
         376  +
                                /* JsonParserGenerator.kt:262 */
  294    377   
                            }
         378  +
                            /* JsonParserGenerator.kt:262 */
  295    379   
                            "zeroDouble" => {
         380  +
                                /* JsonParserGenerator.kt:276 */
  296    381   
                                if let Some(v) =
  297         -
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
  298         -
                                        tokens.next(),
  299         -
                                    )?
  300         -
                                    .map(|v| v.to_f64_lossy())
  301         -
                                {
  302         -
                                    builder = builder.set_zero_double(v);
  303         -
                                }
         382  +
                                /* JsonParserGenerator.kt:363 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f64_lossy())
         383  +
                                /* JsonParserGenerator.kt:278 */{
         384  +
                                                                            builder = builder.set_zero_double(v);
         385  +
                                                                        }
         386  +
                                /* JsonParserGenerator.kt:262 */
  304    387   
                            }
  305         -
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         388  +
                            /* JsonParserGenerator.kt:290 */
         389  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  306    390   
                        }
         391  +
                        /* JsonParserGenerator.kt:686 */
  307    392   
                    }
         393  +
                    /* JsonParserGenerator.kt:695 */
  308    394   
                    other => {
  309    395   
                        return Err(
  310    396   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  311    397   
                                format!("expected object key or end object, found: {:?}", other),
  312    398   
                            ),
  313    399   
                        )
  314         -
                    }
         400  +
                    } /* JsonParserGenerator.kt:685 */
  315    401   
                }
         402  +
                /* JsonParserGenerator.kt:684 */
  316    403   
            }
         404  +
            /* JsonParserGenerator.kt:540 */
  317    405   
            Ok(Some(builder))
         406  +
            /* JsonParserGenerator.kt:713 */
  318    407   
        }
  319         -
        _ => Err(
  320         -
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  321         -
                "expected start object or null",
  322         -
            ),
  323         -
        ),
         408  +
        /* JsonParserGenerator.kt:722 */
         409  +
        _ => {
         410  +
            /* JsonParserGenerator.kt:723 */
         411  +
            Err(
         412  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         413  +
                    "expected start object or null",
         414  +
                ),
         415  +
            )
         416  +
            /* JsonParserGenerator.kt:722 */
         417  +
        } /* JsonParserGenerator.kt:712 */
  324    418   
    }
         419  +
    /* JsonParserGenerator.kt:516 */
  325    420   
}

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

@@ -1,1 +90,135 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:358 */
    2      3   
pub fn ser_dialog(
    3      4   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4      5   
    input: &crate::model::Dialog,
    5      6   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           7  +
    /* JsonSerializerGenerator.kt:382 */
    6      8   
    if let Some(var_1) = &input.language {
           9  +
        /* JsonSerializerGenerator.kt:423 */
    7     10   
        object.key("language").string(var_1.as_str());
          11  +
        /* JsonSerializerGenerator.kt:382 */
    8     12   
    }
          13  +
    /* SerializerUtil.kt:46 */
    9     14   
    {
          15  +
        /* JsonSerializerGenerator.kt:423 */
   10     16   
        object.key("greeting").string(input.greeting.as_str());
          17  +
        /* SerializerUtil.kt:46 */
   11     18   
    }
          19  +
    /* JsonSerializerGenerator.kt:382 */
   12     20   
    if let Some(var_2) = &input.farewell {
          21  +
        /* JsonSerializerGenerator.kt:495 */
   13     22   
        #[allow(unused_mut)]
          23  +
        /* JsonSerializerGenerator.kt:496 */
   14     24   
        let mut object_3 = object.key("farewell").start_object();
          25  +
        /* JsonSerializerGenerator.kt:375 */
   15     26   
        crate::protocol_serde::shape_farewell::ser_farewell(&mut object_3, var_2)?;
          27  +
        /* JsonSerializerGenerator.kt:515 */
   16     28   
        object_3.finish();
          29  +
        /* JsonSerializerGenerator.kt:382 */
   17     30   
    }
          31  +
    /* JsonSerializerGenerator.kt:372 */
   18     32   
    Ok(())
          33  +
    /* JsonSerializerGenerator.kt:358 */
   19     34   
}
   20     35   
          36  +
/* JsonParserGenerator.kt:516 */
   21     37   
pub(crate) fn de_dialog<'a, I>(
   22     38   
    tokens: &mut ::std::iter::Peekable<I>,
   23     39   
) -> ::std::result::Result<
   24     40   
    Option<crate::model::Dialog>,
   25     41   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   26     42   
>
   27     43   
where
   28     44   
    I: Iterator<
   29     45   
        Item = Result<
   30     46   
            ::aws_smithy_json::deserialize::Token<'a>,
   31     47   
            ::aws_smithy_json::deserialize::error::DeserializeError,
   32     48   
        >,
   33     49   
    >,
   34     50   
{
          51  +
    /* JsonParserGenerator.kt:712 */
   35     52   
    match tokens.next().transpose()? {
          53  +
        /* JsonParserGenerator.kt:713 */
   36     54   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   37     55   
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          56  +
            /* RustType.kt:516 */
   38     57   
            #[allow(unused_mut)]
          58  +
            /* JsonParserGenerator.kt:526 */
   39     59   
            let mut builder = crate::model::dialog_internal::Builder::default();
          60  +
            /* JsonParserGenerator.kt:684 */
   40     61   
            loop {
          62  +
                /* JsonParserGenerator.kt:685 */
   41     63   
                match tokens.next().transpose()? {
          64  +
                    /* JsonParserGenerator.kt:686 */
   42     65   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   43     66   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          67  +
                        /* JsonParserGenerator.kt:260 */
   44     68   
                        match key.to_unescaped()?.as_ref() {
          69  +
                            /* JsonParserGenerator.kt:262 */
   45     70   
                            "language" => {
          71  +
                                /* JsonParserGenerator.kt:272 */
   46     72   
                                builder = builder.set_language(
   47         -
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
   48         -
                                        tokens.next(),
   49         -
                                    )?
   50         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   51         -
                                    .transpose()?,
   52         -
                                );
          73  +
                                    /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          74  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          75  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
          76  +
                                        /* JsonParserGenerator.kt:339 */)
          77  +
                                    /* JsonParserGenerator.kt:354 */).transpose()?
          78  +
                                /* JsonParserGenerator.kt:272 */);
          79  +
                                /* JsonParserGenerator.kt:262 */
   53     80   
                            }
          81  +
                            /* JsonParserGenerator.kt:262 */
   54     82   
                            "greeting" => {
          83  +
                                /* JsonParserGenerator.kt:276 */
   55     84   
                                if let Some(v) =
   56         -
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
   57         -
                                        tokens.next(),
   58         -
                                    )?
   59         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   60         -
                                    .transpose()?
   61         -
                                {
   62         -
                                    builder = builder.set_greeting(v);
   63         -
                                }
          85  +
                                /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          86  +
                                    /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          87  +
                                        /* JsonParserGenerator.kt:348 */u.into_owned()
          88  +
                                    /* JsonParserGenerator.kt:339 */)
          89  +
                                /* JsonParserGenerator.kt:354 */).transpose()?
          90  +
                                /* JsonParserGenerator.kt:278 */{
          91  +
                                                                            builder = builder.set_greeting(v);
          92  +
                                                                        }
          93  +
                                /* JsonParserGenerator.kt:262 */
   64     94   
                            }
          95  +
                            /* JsonParserGenerator.kt:262 */
   65     96   
                            "farewell" => {
          97  +
                                /* JsonParserGenerator.kt:272 */
   66     98   
                                builder = builder.set_farewell(
   67         -
                                    crate::protocol_serde::shape_farewell::de_farewell(tokens)?,
   68         -
                                );
          99  +
                                    /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_farewell::de_farewell(tokens)?
         100  +
                                /* JsonParserGenerator.kt:272 */);
         101  +
                                /* JsonParserGenerator.kt:262 */
   69    102   
                            }
   70         -
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         103  +
                            /* JsonParserGenerator.kt:290 */
         104  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   71    105   
                        }
         106  +
                        /* JsonParserGenerator.kt:686 */
   72    107   
                    }
         108  +
                    /* JsonParserGenerator.kt:695 */
   73    109   
                    other => {
   74    110   
                        return Err(
   75    111   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   76    112   
                                format!("expected object key or end object, found: {:?}", other),
   77    113   
                            ),
   78    114   
                        )
   79         -
                    }
         115  +
                    } /* JsonParserGenerator.kt:685 */
   80    116   
                }
         117  +
                /* JsonParserGenerator.kt:684 */
   81    118   
            }
         119  +
            /* JsonParserGenerator.kt:540 */
   82    120   
            Ok(Some(builder.build()))
         121  +
            /* JsonParserGenerator.kt:713 */
   83    122   
        }
   84         -
        _ => Err(
   85         -
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   86         -
                "expected start object or null",
   87         -
            ),
   88         -
        ),
         123  +
        /* JsonParserGenerator.kt:722 */
         124  +
        _ => {
         125  +
            /* JsonParserGenerator.kt:723 */
         126  +
            Err(
         127  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         128  +
                    "expected start object or null",
         129  +
                ),
         130  +
            )
         131  +
            /* JsonParserGenerator.kt:722 */
         132  +
        } /* JsonParserGenerator.kt:712 */
   89    133   
    }
         134  +
    /* JsonParserGenerator.kt:516 */
   90    135   
}

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

@@ -1,1 +48,74 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:398 */
    2      3   
pub(crate) fn de_dialog_list<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<::std::vec::Vec<crate::model::Dialog>>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
>
    8      9   
where
    9     10   
    I: Iterator<
   10     11   
        Item = Result<
   11     12   
            ::aws_smithy_json::deserialize::Token<'a>,
   12     13   
            ::aws_smithy_json::deserialize::error::DeserializeError,
   13     14   
        >,
   14     15   
    >,
   15     16   
{
          17  +
    /* JsonParserGenerator.kt:712 */
   16     18   
    match tokens.next().transpose()? {
          19  +
        /* JsonParserGenerator.kt:713 */
   17     20   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   18     21   
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
          22  +
            /* JsonParserGenerator.kt:407 */
   19     23   
            let mut items = Vec::new();
          24  +
            /* JsonParserGenerator.kt:408 */
   20     25   
            loop {
          26  +
                /* JsonParserGenerator.kt:409 */
   21     27   
                match tokens.peek() {
          28  +
                    /* JsonParserGenerator.kt:410 */
   22     29   
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
          30  +
                        /* JsonParserGenerator.kt:411 */
   23     31   
                        tokens.next().transpose().unwrap();
   24     32   
                        break;
          33  +
                        /* JsonParserGenerator.kt:410 */
   25     34   
                    }
          35  +
                    /* JsonParserGenerator.kt:413 */
   26     36   
                    _ => {
   27         -
                        let value = crate::protocol_serde::shape_dialog::de_dialog(tokens)?;
          37  +
                        /* JsonParserGenerator.kt:419 */
          38  +
                        let value =
          39  +
                            /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_dialog::de_dialog(tokens)?
          40  +
                        /* JsonParserGenerator.kt:419 */;
          41  +
                        /* JsonParserGenerator.kt:422 */
   28     42   
                        if let Some(value) = value {
   29     43   
                            items.push(value);
   30         -
                        } else {
          44  +
                        }
          45  +
                        /* JsonParserGenerator.kt:430 */
          46  +
                        else {
   31     47   
                            return Err(
   32     48   
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   33     49   
                                    "dense list cannot contain null values",
   34     50   
                                ),
   35     51   
                            );
   36     52   
                        }
   37         -
                    }
          53  +
                        /* JsonParserGenerator.kt:413 */
          54  +
                    } /* JsonParserGenerator.kt:409 */
   38     55   
                }
          56  +
                /* JsonParserGenerator.kt:408 */
   39     57   
            }
          58  +
            /* JsonParserGenerator.kt:446 */
   40     59   
            Ok(Some(items))
          60  +
            /* JsonParserGenerator.kt:713 */
   41     61   
        }
   42         -
        _ => Err(
   43         -
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   44         -
                "expected start array or null",
   45         -
            ),
   46         -
        ),
          62  +
        /* JsonParserGenerator.kt:722 */
          63  +
        _ => {
          64  +
            /* JsonParserGenerator.kt:723 */
          65  +
            Err(
          66  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          67  +
                    "expected start array or null",
          68  +
                ),
          69  +
            )
          70  +
            /* JsonParserGenerator.kt:722 */
          71  +
        } /* JsonParserGenerator.kt:712 */
   47     72   
    }
          73  +
    /* JsonParserGenerator.kt:398 */
   48     74   
}

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

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

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

@@ -1,1 +88,125 @@
    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_empty_input_and_empty_output_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::EmptyInputAndEmptyOutputInput,
    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 =
   18     23   
            crate::input::empty_input_and_empty_output_input_internal::Builder::default();
          24  +
        /* RustType.kt:516 */
   19     25   
        #[allow(unused_variables)]
          26  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   20     27   
        let ::aws_smithy_runtime_api::http::RequestParts {
   21     28   
            uri, headers, body, ..
   22     29   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          30  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   23     31   
        input.build()
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   24     33   
    })
          34  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   25     35   
}
   26     36   
          37  +
/* RustType.kt:516 */
   27     38   
#[allow(clippy::unnecessary_wraps)]
          39  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   28     40   
pub fn ser_empty_input_and_empty_output_http_response(
   29     41   
    #[allow(unused_variables)] output: crate::output::EmptyInputAndEmptyOutputOutput,
   30     42   
) -> std::result::Result<
   31     43   
    ::aws_smithy_http_server::response::Response,
   32     44   
    ::aws_smithy_http_server::protocol::aws_json::rejection::ResponseRejection,
   33     45   
> {
          46  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   34     47   
    Ok({
          48  +
        /* RustType.kt:516 */
   35     49   
        #[allow(unused_mut)]
          50  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   36     51   
        let mut builder = ::http::Response::builder();
          52  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   37     53   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   38     54   
            builder,
   39     55   
            ::http::header::CONTENT_TYPE,
   40     56   
            "application/x-amz-json-1.0",
   41     57   
        );
          58  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   42     59   
        let http_status: u16 = 200;
   43     60   
        builder = builder.status(http_status);
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   44     62   
        let payload =
   45         -
            crate::protocol_serde::shape_empty_input_and_empty_output_output::ser_empty_input_and_empty_output_output_output_output(&output)?
   46         -
        ;
          63  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_empty_input_and_empty_output_output::ser_empty_input_and_empty_output_output_output_output(&output)?
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   47     66   
        let content_length = payload.len();
   48     67   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   49     68   
            builder,
   50     69   
            ::http::header::CONTENT_LENGTH,
   51     70   
            content_length,
   52     71   
        );
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   53     73   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   54     75   
        builder.body(body)?
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   55     77   
    })
          78  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   56     79   
}
   57     80   
          81  +
/* RustType.kt:516 */
   58     82   
#[allow(clippy::unnecessary_wraps)]
          83  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   59     84   
pub fn ser_empty_input_and_empty_output_http_error(
   60     85   
    error: &crate::error::EmptyInputAndEmptyOutputError,
   61     86   
) -> std::result::Result<
   62     87   
    ::aws_smithy_http_server::response::Response,
   63     88   
    ::aws_smithy_http_server::protocol::aws_json::rejection::ResponseRejection,
   64     89   
> {
          90  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   65     91   
    Ok({
          92  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   66     93   
        match error {
          94  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   67     95   
            crate::error::EmptyInputAndEmptyOutputError::InternalServerError(output) => {
          96  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   68     97   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
          98  +
                /* RustType.kt:516 */
   69     99   
                #[allow(unused_mut)]
         100  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   70    101   
                let mut builder = ::http::Response::builder();
         102  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   71    103   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   72    104   
                    builder,
   73    105   
                    ::http::header::CONTENT_TYPE,
   74    106   
                    "application/x-amz-json-1.0",
   75    107   
                );
         108  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   76    109   
                let content_length = payload.len();
   77    110   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   78    111   
                    builder,
   79    112   
                    ::http::header::CONTENT_LENGTH,
   80    113   
                    content_length,
   81    114   
                );
         115  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   82    116   
                builder
   83    117   
                    .status(500)
   84    118   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
   85         -
            }
         119  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         120  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   86    121   
        }
         122  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   87    123   
    })
         124  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
   88    125   
}

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

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

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

@@ -1,1 +85,124 @@
    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_endpoint_operation_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::EndpointOperationInput,
    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::endpoint_operation_input_internal::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt: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_endpoint_operation_http_response(
   28     40   
    #[allow(unused_variables)] output: crate::output::EndpointOperationOutput,
   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   
}
   54     79   
          80  +
/* RustType.kt:516 */
   55     81   
#[allow(clippy::unnecessary_wraps)]
          82  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   56     83   
pub fn ser_endpoint_operation_http_error(
   57     84   
    error: &crate::error::EndpointOperationError,
   58     85   
) -> std::result::Result<
   59     86   
    ::aws_smithy_http_server::response::Response,
   60     87   
    ::aws_smithy_http_server::protocol::aws_json::rejection::ResponseRejection,
   61     88   
> {
          89  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   62     90   
    Ok({
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   63     92   
        match error {
          93  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   64     94   
            crate::error::EndpointOperationError::InternalServerError(output) => {
          95  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   65     96   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
          97  +
                /* RustType.kt:516 */
   66     98   
                #[allow(unused_mut)]
          99  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   67    100   
                let mut builder = ::http::Response::builder();
         101  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   68    102   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   69    103   
                    builder,
   70    104   
                    ::http::header::CONTENT_TYPE,
   71    105   
                    "application/x-amz-json-1.0",
   72    106   
                );
         107  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   73    108   
                let content_length = payload.len();
   74    109   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   75    110   
                    builder,
   76    111   
                    ::http::header::CONTENT_LENGTH,
   77    112   
                    content_length,
   78    113   
                );
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   79    115   
                builder
   80    116   
                    .status(500)
   81    117   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
   82         -
            }
         118  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         119  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   83    120   
        }
         121  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   84    122   
    })
         123  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
   85    124   
}

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

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

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

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