Server Test Python

Server Test Python

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943

Files changed:

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

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

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

@@ -1,1 +145,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_operation_with_optional_input_output_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::OperationWithOptionalInputOutputInput,
    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::operation_with_optional_input_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: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.1"),
   28     38   
            )?;
   29     39   
            input = crate::protocol_serde::shape_operation_with_optional_input_output::de_operation_with_optional_input_output(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_operation_with_optional_input_output_http_response(
   37     53   
    #[allow(unused_variables)] output: crate::output::OperationWithOptionalInputOutputOutput,
   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.1",
   49     69   
        );
          70  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   50     71   
        let http_status: u16 = 200;
   51     72   
        builder = builder.status(http_status);
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   52     74   
        let payload =
   53         -
            crate::protocol_serde::shape_operation_with_optional_input_output_output::ser_operation_with_optional_input_output_output_output_output(&output)?
   54         -
        ;
          75  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_operation_with_optional_input_output_output::ser_operation_with_optional_input_output_output_output_output(&output)?
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   55     78   
        let content_length = payload.len();
   56     79   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     80   
            builder,
   58     81   
            ::http::header::CONTENT_LENGTH,
   59     82   
            content_length,
   60     83   
        );
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   61     85   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   62     87   
        builder.body(body)?
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   63     89   
    })
          90  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   64     91   
}
   65     92   
          93  +
/* RustType.kt:516 */
   66     94   
#[allow(clippy::unnecessary_wraps)]
          95  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   67     96   
pub fn ser_operation_with_optional_input_output_http_error(
   68     97   
    error: &crate::error::OperationWithOptionalInputOutputError,
   69     98   
) -> std::result::Result<
   70     99   
    ::aws_smithy_http_server::response::Response,
   71    100   
    ::aws_smithy_http_server::protocol::aws_json::rejection::ResponseRejection,
   72    101   
> {
         102  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   73    103   
    Ok({
         104  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   74    105   
        match error {
         106  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   75    107   
            crate::error::OperationWithOptionalInputOutputError::InternalServerError(output) => {
         108  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   76    109   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         110  +
                /* RustType.kt:516 */
   77    111   
                #[allow(unused_mut)]
         112  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   78    113   
                let mut builder = ::http::Response::builder();
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   79    115   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   80    116   
                    builder,
   81    117   
                    ::http::header::CONTENT_TYPE,
   82    118   
                    "application/x-amz-json-1.1",
   83    119   
                );
         120  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   84    121   
                let content_length = payload.len();
   85    122   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   86    123   
                    builder,
   87    124   
                    ::http::header::CONTENT_LENGTH,
   88    125   
                    content_length,
   89    126   
                );
         127  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   90    128   
                builder
   91    129   
                    .status(500)
   92    130   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
   93         -
            }
         131  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         132  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   94    133   
        }
         134  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   95    135   
    })
         136  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
   96    137   
}
   97    138   
         139  +
/* JsonParserGenerator.kt:148 */
   98    140   
pub(crate) fn de_operation_with_optional_input_output(
   99    141   
    value: &[u8],
  100    142   
    mut builder: crate::input::operation_with_optional_input_output_input_internal::Builder,
  101    143   
) -> ::std::result::Result<
  102    144   
    crate::input::operation_with_optional_input_output_input_internal::Builder,
  103    145   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  104    146   
> {
         147  +
    /* JsonParserGenerator.kt:153 */
  105    148   
    let mut tokens_owned =
  106    149   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  107    150   
            .peekable();
  108    151   
    let tokens = &mut tokens_owned;
  109    152   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         153  +
    /* JsonParserGenerator.kt:684 */
  110    154   
    loop {
         155  +
        /* JsonParserGenerator.kt:685 */
  111    156   
        match tokens.next().transpose()? {
         157  +
            /* JsonParserGenerator.kt:686 */
  112    158   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  113    159   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         160  +
                /* JsonParserGenerator.kt:260 */
  114    161   
                match key.to_unescaped()?.as_ref() {
         162  +
                    /* JsonParserGenerator.kt:262 */
  115    163   
                    "Value" => {
         164  +
                        /* JsonParserGenerator.kt:272 */
  116    165   
                        builder = builder.set_value(
         166  +
                            /* JsonParserGenerator.kt:354 */
  117    167   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
  118    168   
                                tokens.next(),
  119    169   
                            )?
  120         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  121         -
                            .transpose()?,
         170  +
                            .map(|s|
         171  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         172  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         173  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         174  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  122    175   
                        );
         176  +
                        /* JsonParserGenerator.kt:262 */
  123    177   
                    }
  124         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         178  +
                    /* JsonParserGenerator.kt:290 */
         179  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  125    180   
                }
         181  +
                /* JsonParserGenerator.kt:686 */
  126    182   
            }
         183  +
            /* JsonParserGenerator.kt:695 */
  127    184   
            other => {
  128    185   
                return Err(
  129    186   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  130    187   
                        "expected object key or end object, found: {:?}",
  131    188   
                        other
  132    189   
                    )),
  133    190   
                )
  134         -
            }
         191  +
            } /* JsonParserGenerator.kt:685 */
  135    192   
        }
         193  +
        /* JsonParserGenerator.kt:684 */
  136    194   
    }
         195  +
    /* JsonParserGenerator.kt:250 */
  137    196   
    if tokens.next().is_some() {
         197  +
        /* JsonParserGenerator.kt:251 */
  138    198   
        return Err(
  139    199   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  140    200   
                "found more JSON tokens after completing parsing",
  141    201   
            ),
  142    202   
        );
         203  +
        /* JsonParserGenerator.kt:250 */
  143    204   
    }
         205  +
    /* JsonParserGenerator.kt:163 */
  144    206   
    Ok(builder)
         207  +
    /* JsonParserGenerator.kt:148 */
  145    208   
}

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

@@ -1,1 +20,31 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_operation_with_optional_input_output_output_output_output(
    3      4   
    value: &crate::output::OperationWithOptionalInputOutputOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_operation_with_optional_input_output_output::ser_operation_with_optional_input_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_operation_with_optional_input_output_output_output(
   13     19   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    input: &crate::output::OperationWithOptionalInputOutputOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* JsonSerializerGenerator.kt:382 */
   16     23   
    if let Some(var_1) = &input.value {
          24  +
        /* JsonSerializerGenerator.kt:423 */
   17     25   
        object.key("Value").string(var_1.as_str());
          26  +
        /* JsonSerializerGenerator.kt:382 */
   18     27   
    }
          28  +
    /* JsonSerializerGenerator.kt:372 */
   19     29   
    Ok(())
          30  +
    /* JsonSerializerGenerator.kt:358 */
   20     31   
}

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

@@ -1,1 +144,201 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_put_and_get_inline_documents_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::PutAndGetInlineDocumentsInput,
    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::put_and_get_inline_documents_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.1"),
   28     38   
            )?;
   29     39   
            input = crate::protocol_serde::shape_put_and_get_inline_documents::de_put_and_get_inline_documents(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_put_and_get_inline_documents_http_response(
   37     53   
    #[allow(unused_variables)] output: crate::output::PutAndGetInlineDocumentsOutput,
   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.1",
   49     69   
        );
          70  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   50     71   
        let http_status: u16 = 200;
   51     72   
        builder = builder.status(http_status);
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   52     74   
        let payload =
   53         -
            crate::protocol_serde::shape_put_and_get_inline_documents_output::ser_put_and_get_inline_documents_output_output_output(&output)?
   54         -
        ;
          75  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_put_and_get_inline_documents_output::ser_put_and_get_inline_documents_output_output_output(&output)?
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   55     78   
        let content_length = payload.len();
   56     79   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     80   
            builder,
   58     81   
            ::http::header::CONTENT_LENGTH,
   59     82   
            content_length,
   60     83   
        );
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   61     85   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   62     87   
        builder.body(body)?
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   63     89   
    })
          90  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   64     91   
}
   65     92   
          93  +
/* RustType.kt:516 */
   66     94   
#[allow(clippy::unnecessary_wraps)]
          95  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   67     96   
pub fn ser_put_and_get_inline_documents_http_error(
   68     97   
    error: &crate::error::PutAndGetInlineDocumentsError,
   69     98   
) -> std::result::Result<
   70     99   
    ::aws_smithy_http_server::response::Response,
   71    100   
    ::aws_smithy_http_server::protocol::aws_json::rejection::ResponseRejection,
   72    101   
> {
         102  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   73    103   
    Ok({
         104  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   74    105   
        match error {
         106  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   75    107   
            crate::error::PutAndGetInlineDocumentsError::InternalServerError(output) => {
         108  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   76    109   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         110  +
                /* RustType.kt:516 */
   77    111   
                #[allow(unused_mut)]
         112  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   78    113   
                let mut builder = ::http::Response::builder();
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   79    115   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   80    116   
                    builder,
   81    117   
                    ::http::header::CONTENT_TYPE,
   82    118   
                    "application/x-amz-json-1.1",
   83    119   
                );
         120  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   84    121   
                let content_length = payload.len();
   85    122   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   86    123   
                    builder,
   87    124   
                    ::http::header::CONTENT_LENGTH,
   88    125   
                    content_length,
   89    126   
                );
         127  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   90    128   
                builder
   91    129   
                    .status(500)
   92    130   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
   93         -
            }
         131  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         132  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   94    133   
        }
         134  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   95    135   
    })
         136  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
   96    137   
}
   97    138   
         139  +
/* JsonParserGenerator.kt:148 */
   98    140   
pub(crate) fn de_put_and_get_inline_documents(
   99    141   
    value: &[u8],
  100    142   
    mut builder: crate::input::put_and_get_inline_documents_input_internal::Builder,
  101    143   
) -> ::std::result::Result<
  102    144   
    crate::input::put_and_get_inline_documents_input_internal::Builder,
  103    145   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  104    146   
> {
         147  +
    /* JsonParserGenerator.kt:153 */
  105    148   
    let mut tokens_owned =
  106    149   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  107    150   
            .peekable();
  108    151   
    let tokens = &mut tokens_owned;
  109    152   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         153  +
    /* JsonParserGenerator.kt:684 */
  110    154   
    loop {
         155  +
        /* JsonParserGenerator.kt:685 */
  111    156   
        match tokens.next().transpose()? {
         157  +
            /* JsonParserGenerator.kt:686 */
  112    158   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  113    159   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         160  +
                /* JsonParserGenerator.kt:260 */
  114    161   
                match key.to_unescaped()?.as_ref() {
         162  +
                    /* JsonParserGenerator.kt:262 */
  115    163   
                    "inlineDocument" => {
         164  +
                        /* JsonParserGenerator.kt:272 */
  116    165   
                        builder = builder.set_inline_document(
  117         -
                            Some(::aws_smithy_json::deserialize::token::expect_document(
  118         -
                                tokens,
  119         -
                            )?)
  120         -
                            .map(::aws_smithy_http_server_python::types::Document::from),
  121         -
                        );
         166  +
                            /* JsonParserGenerator.kt:319 */Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?)
         167  +
                            /* PythonServerProtocolLoader.kt:52 */.map(::aws_smithy_http_server_python::types::Document::from)
         168  +
                        /* JsonParserGenerator.kt:272 */);
         169  +
                        /* JsonParserGenerator.kt:262 */
  122    170   
                    }
  123         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         171  +
                    /* JsonParserGenerator.kt:290 */
         172  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  124    173   
                }
         174  +
                /* JsonParserGenerator.kt:686 */
  125    175   
            }
         176  +
            /* JsonParserGenerator.kt:695 */
  126    177   
            other => {
  127    178   
                return Err(
  128    179   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  129    180   
                        "expected object key or end object, found: {:?}",
  130    181   
                        other
  131    182   
                    )),
  132    183   
                )
  133         -
            }
         184  +
            } /* JsonParserGenerator.kt:685 */
  134    185   
        }
         186  +
        /* JsonParserGenerator.kt:684 */
  135    187   
    }
         188  +
    /* JsonParserGenerator.kt:250 */
  136    189   
    if tokens.next().is_some() {
         190  +
        /* JsonParserGenerator.kt:251 */
  137    191   
        return Err(
  138    192   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  139    193   
                "found more JSON tokens after completing parsing",
  140    194   
            ),
  141    195   
        );
         196  +
        /* JsonParserGenerator.kt:250 */
  142    197   
    }
         198  +
    /* JsonParserGenerator.kt:163 */
  143    199   
    Ok(builder)
         200  +
    /* JsonParserGenerator.kt:148 */
  144    201   
}

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

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

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

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

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

@@ -1,1 +155,219 @@
    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_simple_scalar_properties_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::SimpleScalarPropertiesInput,
    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::simple_scalar_properties_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.1"),
   27     37   
            )?;
   28     38   
            input =
   29     39   
                crate::protocol_serde::shape_simple_scalar_properties::de_simple_scalar_properties(
   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_simple_scalar_properties_http_response(
   40     56   
    #[allow(unused_variables)] output: crate::output::SimpleScalarPropertiesOutput,
   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.1",
   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_simple_scalar_properties_output::ser_simple_scalar_properties_output_output_output(&output)?
   57         -
        ;
          78  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_simple_scalar_properties_output::ser_simple_scalar_properties_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_simple_scalar_properties_http_error(
   71    100   
    error: &crate::error::SimpleScalarPropertiesError,
   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::SimpleScalarPropertiesError::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.1",
   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_simple_scalar_properties(
  102    144   
    value: &[u8],
  103    145   
    mut builder: crate::input::simple_scalar_properties_input_internal::Builder,
  104    146   
) -> ::std::result::Result<
  105    147   
    crate::input::simple_scalar_properties_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   
                    "floatValue" => {
         167  +
                        /* JsonParserGenerator.kt:272 */
  119    168   
                        builder = builder.set_float_value(
         169  +
                            /* JsonParserGenerator.kt:361 */
  120    170   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
  121    171   
                                tokens.next(),
  122    172   
                            )?
  123         -
                            .map(|v| v.to_f32_lossy()),
         173  +
                            .map(|v| v.to_f32_lossy()), /* JsonParserGenerator.kt:272 */
  124    174   
                        );
         175  +
                        /* JsonParserGenerator.kt:262 */
  125    176   
                    }
         177  +
                    /* JsonParserGenerator.kt:262 */
  126    178   
                    "doubleValue" => {
         179  +
                        /* JsonParserGenerator.kt:272 */
  127    180   
                        builder = builder.set_double_value(
         181  +
                            /* JsonParserGenerator.kt:363 */
  128    182   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
  129    183   
                                tokens.next(),
  130    184   
                            )?
  131         -
                            .map(|v| v.to_f64_lossy()),
         185  +
                            .map(|v| v.to_f64_lossy()), /* JsonParserGenerator.kt:272 */
  132    186   
                        );
         187  +
                        /* JsonParserGenerator.kt:262 */
  133    188   
                    }
  134         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         189  +
                    /* JsonParserGenerator.kt:290 */
         190  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  135    191   
                }
         192  +
                /* JsonParserGenerator.kt:686 */
  136    193   
            }
         194  +
            /* JsonParserGenerator.kt:695 */
  137    195   
            other => {
  138    196   
                return Err(
  139    197   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  140    198   
                        "expected object key or end object, found: {:?}",
  141    199   
                        other
  142    200   
                    )),
  143    201   
                )
  144         -
            }
         202  +
            } /* JsonParserGenerator.kt:685 */
  145    203   
        }
         204  +
        /* JsonParserGenerator.kt:684 */
  146    205   
    }
         206  +
    /* JsonParserGenerator.kt:250 */
  147    207   
    if tokens.next().is_some() {
         208  +
        /* JsonParserGenerator.kt:251 */
  148    209   
        return Err(
  149    210   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  150    211   
                "found more JSON tokens after completing parsing",
  151    212   
            ),
  152    213   
        );
         214  +
        /* JsonParserGenerator.kt:250 */
  153    215   
    }
         216  +
    /* JsonParserGenerator.kt:163 */
  154    217   
    Ok(builder)
         218  +
    /* JsonParserGenerator.kt:148 */
  155    219   
}

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

@@ -1,1 +29,43 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_simple_scalar_properties_output_output_output(
    3      4   
    value: &crate::output::SimpleScalarPropertiesOutput,
    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_simple_scalar_properties_output::ser_simple_scalar_properties_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_simple_scalar_properties_output_output(
   13     19   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    input: &crate::output::SimpleScalarPropertiesOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* JsonSerializerGenerator.kt:382 */
   16     23   
    if let Some(var_1) = &input.float_value {
          24  +
        /* JsonSerializerGenerator.kt:432 */
   17     25   
        object.key("floatValue").number(
   18     26   
            #[allow(clippy::useless_conversion)]
   19     27   
            ::aws_smithy_types::Number::Float((*var_1).into()),
   20     28   
        );
          29  +
        /* JsonSerializerGenerator.kt:382 */
   21     30   
    }
          31  +
    /* JsonSerializerGenerator.kt:382 */
   22     32   
    if let Some(var_2) = &input.double_value {
          33  +
        /* JsonSerializerGenerator.kt:432 */
   23     34   
        object.key("doubleValue").number(
   24     35   
            #[allow(clippy::useless_conversion)]
   25     36   
            ::aws_smithy_types::Number::Float((*var_2).into()),
   26     37   
        );
          38  +
        /* JsonSerializerGenerator.kt:382 */
   27     39   
    }
          40  +
    /* JsonSerializerGenerator.kt:372 */
   28     41   
    Ok(())
          42  +
    /* JsonSerializerGenerator.kt:358 */
   29     43   
}

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

@@ -1,1 +65,95 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:516 */
    2      3   
pub(crate) fn de_simple_struct<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::model::SimpleStruct>,
    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::simple_struct_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   
                            "Value" => {
          37  +
                                /* JsonParserGenerator.kt:272 */
   27     38   
                                builder = builder.set_value(
   28         -
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
   29         -
                                        tokens.next(),
   30         -
                                    )?
   31         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   32         -
                                    .transpose()?,
   33         -
                                );
          39  +
                                    /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          40  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          41  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
          42  +
                                        /* JsonParserGenerator.kt:339 */)
          43  +
                                    /* JsonParserGenerator.kt:354 */).transpose()?
          44  +
                                /* JsonParserGenerator.kt:272 */);
          45  +
                                /* JsonParserGenerator.kt:262 */
   34     46   
                            }
   35         -
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          47  +
                            /* JsonParserGenerator.kt:290 */
          48  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   36     49   
                        }
          50  +
                        /* JsonParserGenerator.kt:686 */
   37     51   
                    }
          52  +
                    /* JsonParserGenerator.kt:695 */
   38     53   
                    other => {
   39     54   
                        return Err(
   40     55   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   41     56   
                                format!("expected object key or end object, found: {:?}", other),
   42     57   
                            ),
   43     58   
                        )
   44         -
                    }
          59  +
                    } /* JsonParserGenerator.kt:685 */
   45     60   
                }
          61  +
                /* JsonParserGenerator.kt:684 */
   46     62   
            }
          63  +
            /* JsonParserGenerator.kt:540 */
   47     64   
            Ok(Some(builder.build()))
          65  +
            /* JsonParserGenerator.kt:713 */
   48     66   
        }
   49         -
        _ => Err(
   50         -
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   51         -
                "expected start object or null",
   52         -
            ),
   53         -
        ),
          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 */
   54     77   
    }
          78  +
    /* JsonParserGenerator.kt:516 */
   55     79   
}
   56     80   
          81  +
/* JsonSerializerGenerator.kt:358 */
   57     82   
pub fn ser_simple_struct(
   58     83   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   59     84   
    input: &crate::model::SimpleStruct,
   60     85   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          86  +
    /* JsonSerializerGenerator.kt:382 */
   61     87   
    if let Some(var_1) = &input.value {
          88  +
        /* JsonSerializerGenerator.kt:423 */
   62     89   
        object.key("Value").string(var_1.as_str());
          90  +
        /* JsonSerializerGenerator.kt:382 */
   63     91   
    }
          92  +
    /* JsonSerializerGenerator.kt:372 */
   64     93   
    Ok(())
          94  +
    /* JsonSerializerGenerator.kt:358 */
   65     95   
}

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

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

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

@@ -1,1 +40,75 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_sparse_nulls_operation_output_output_output(
    3      4   
    value: &crate::output::SparseNullsOperationOutput,
    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_sparse_nulls_operation_output::ser_sparse_nulls_operation_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_sparse_nulls_operation_output_output(
   13     19   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    input: &crate::output::SparseNullsOperationOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* JsonSerializerGenerator.kt:382 */
   16     23   
    if let Some(var_1) = &input.sparse_string_list {
          24  +
        /* JsonSerializerGenerator.kt:484 */
   17     25   
        let mut array_2 = object.key("sparseStringList").start_array();
          26  +
        /* JsonSerializerGenerator.kt:524 */
   18     27   
        for item_3 in var_1 {
          28  +
            /* JsonSerializerGenerator.kt:382 */
   19     29   
            if let Some(var_4) = item_3 {
          30  +
                /* JsonSerializerGenerator.kt:423 */
   20     31   
                array_2.value().string(var_4.as_str());
   21         -
            } else {
          32  +
            /* JsonSerializerGenerator.kt:382 */
          33  +
            }
          34  +
            /* JsonSerializerGenerator.kt:395 */
          35  +
            else {
          36  +
                /* JsonSerializerGenerator.kt:396 */
   22     37   
                array_2.value().null();
          38  +
                /* JsonSerializerGenerator.kt:395 */
   23     39   
            }
          40  +
            /* JsonSerializerGenerator.kt:524 */
   24     41   
        }
          42  +
        /* JsonSerializerGenerator.kt:486 */
   25     43   
        array_2.finish();
          44  +
        /* JsonSerializerGenerator.kt:382 */
   26     45   
    }
          46  +
    /* JsonSerializerGenerator.kt:382 */
   27     47   
    if let Some(var_5) = &input.sparse_string_map {
          48  +
        /* JsonSerializerGenerator.kt:495 */
   28     49   
        #[allow(unused_mut)]
          50  +
        /* JsonSerializerGenerator.kt:496 */
   29     51   
        let mut object_6 = object.key("sparseStringMap").start_object();
          52  +
        /* JsonSerializerGenerator.kt:537 */
   30     53   
        for (key_7, value_8) in var_5 {
          54  +
            /* JsonSerializerGenerator.kt:382 */
   31     55   
            if let Some(var_9) = value_8 {
          56  +
                /* JsonSerializerGenerator.kt:423 */
   32     57   
                object_6.key(key_7.as_str()).string(var_9.as_str());
   33         -
            } else {
          58  +
            /* JsonSerializerGenerator.kt:382 */
          59  +
            }
          60  +
            /* JsonSerializerGenerator.kt:395 */
          61  +
            else {
          62  +
                /* JsonSerializerGenerator.kt:396 */
   34     63   
                object_6.key(key_7.as_str()).null();
          64  +
                /* JsonSerializerGenerator.kt:395 */
   35     65   
            }
          66  +
            /* JsonSerializerGenerator.kt:537 */
   36     67   
        }
          68  +
        /* JsonSerializerGenerator.kt:515 */
   37     69   
        object_6.finish();
          70  +
        /* JsonSerializerGenerator.kt:382 */
   38     71   
    }
          72  +
    /* JsonSerializerGenerator.kt:372 */
   39     73   
    Ok(())
          74  +
    /* JsonSerializerGenerator.kt:358 */
   40     75   
}

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

@@ -1,1 +45,70 @@
    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_sparse_string_list<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<::std::vec::Vec<::std::option::Option<::std::string::String>>>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
>
    8      9   
where
    9     10   
    I: Iterator<
   10     11   
        Item = Result<
   11     12   
            ::aws_smithy_json::deserialize::Token<'a>,
   12     13   
            ::aws_smithy_json::deserialize::error::DeserializeError,
   13     14   
        >,
   14     15   
    >,
   15     16   
{
          17  +
    /* JsonParserGenerator.kt:712 */
   16     18   
    match tokens.next().transpose()? {
          19  +
        /* JsonParserGenerator.kt:713 */
   17     20   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   18     21   
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
          22  +
            /* JsonParserGenerator.kt:407 */
   19     23   
            let mut items = Vec::new();
          24  +
            /* JsonParserGenerator.kt:408 */
   20     25   
            loop {
          26  +
                /* JsonParserGenerator.kt:409 */
   21     27   
                match tokens.peek() {
          28  +
                    /* JsonParserGenerator.kt:410 */
   22     29   
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
          30  +
                        /* JsonParserGenerator.kt:411 */
   23     31   
                        tokens.next().transpose().unwrap();
   24     32   
                        break;
          33  +
                        /* JsonParserGenerator.kt:410 */
   25     34   
                    }
          35  +
                    /* JsonParserGenerator.kt:413 */
   26     36   
                    _ => {
          37  +
                        /* JsonParserGenerator.kt:415 */
   27     38   
                        items.push(
          39  +
                            /* JsonParserGenerator.kt:354 */
   28     40   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
   29     41   
                                tokens.next(),
   30     42   
                            )?
   31         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   32         -
                            .transpose()?,
          43  +
                            .map(|s|
          44  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          45  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
          46  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
          47  +
                            .transpose()?, /* JsonParserGenerator.kt:415 */
   33     48   
                        );
   34         -
                    }
          49  +
                        /* JsonParserGenerator.kt:413 */
          50  +
                    } /* JsonParserGenerator.kt:409 */
   35     51   
                }
          52  +
                /* JsonParserGenerator.kt:408 */
   36     53   
            }
          54  +
            /* JsonParserGenerator.kt:446 */
   37     55   
            Ok(Some(items))
          56  +
            /* JsonParserGenerator.kt:713 */
   38     57   
        }
   39         -
        _ => Err(
   40         -
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   41         -
                "expected start array or null",
   42         -
            ),
   43         -
        ),
          58  +
        /* JsonParserGenerator.kt:722 */
          59  +
        _ => {
          60  +
            /* JsonParserGenerator.kt:723 */
          61  +
            Err(
          62  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          63  +
                    "expected start array or null",
          64  +
                ),
          65  +
            )
          66  +
            /* JsonParserGenerator.kt:722 */
          67  +
        } /* JsonParserGenerator.kt:712 */
   44     68   
    }
          69  +
    /* JsonParserGenerator.kt:398 */
   45     70   
}

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

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

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

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

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

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

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

@@ -1,1 +65,95 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:516 */
    2      3   
pub(crate) fn de_struct_with_json_name<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::model::StructWithJsonName>,
    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::struct_with_json_name_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   
                            "Value" => {
          37  +
                                /* JsonParserGenerator.kt:272 */
   27     38   
                                builder = builder.set_value(
   28         -
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
   29         -
                                        tokens.next(),
   30         -
                                    )?
   31         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   32         -
                                    .transpose()?,
   33         -
                                );
          39  +
                                    /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          40  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          41  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
          42  +
                                        /* JsonParserGenerator.kt:339 */)
          43  +
                                    /* JsonParserGenerator.kt:354 */).transpose()?
          44  +
                                /* JsonParserGenerator.kt:272 */);
          45  +
                                /* JsonParserGenerator.kt:262 */
   34     46   
                            }
   35         -
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          47  +
                            /* JsonParserGenerator.kt:290 */
          48  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   36     49   
                        }
          50  +
                        /* JsonParserGenerator.kt:686 */
   37     51   
                    }
          52  +
                    /* JsonParserGenerator.kt:695 */
   38     53   
                    other => {
   39     54   
                        return Err(
   40     55   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   41     56   
                                format!("expected object key or end object, found: {:?}", other),
   42     57   
                            ),
   43     58   
                        )
   44         -
                    }
          59  +
                    } /* JsonParserGenerator.kt:685 */
   45     60   
                }
          61  +
                /* JsonParserGenerator.kt:684 */
   46     62   
            }
          63  +
            /* JsonParserGenerator.kt:540 */
   47     64   
            Ok(Some(builder.build()))
          65  +
            /* JsonParserGenerator.kt:713 */
   48     66   
        }
   49         -
        _ => Err(
   50         -
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   51         -
                "expected start object or null",
   52         -
            ),
   53         -
        ),
          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 */
   54     77   
    }
          78  +
    /* JsonParserGenerator.kt:516 */
   55     79   
}
   56     80   
          81  +
/* JsonSerializerGenerator.kt:358 */
   57     82   
pub fn ser_struct_with_json_name(
   58     83   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   59     84   
    input: &crate::model::StructWithJsonName,
   60     85   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          86  +
    /* JsonSerializerGenerator.kt:382 */
   61     87   
    if let Some(var_1) = &input.value {
          88  +
        /* JsonSerializerGenerator.kt:423 */
   62     89   
        object.key("Value").string(var_1.as_str());
          90  +
        /* JsonSerializerGenerator.kt:382 */
   63     91   
    }
          92  +
    /* JsonSerializerGenerator.kt:372 */
   64     93   
    Ok(())
          94  +
    /* JsonSerializerGenerator.kt:358 */
   65     95   
}