Server Test Python

Server Test Python

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943 (ignoring whitespace)

Files changed:

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

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

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

@@ -1,1 +25,36 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_json_blobs_output_output_output(
    3      4   
    value: &crate::output::JsonBlobsOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_json_blobs_output::ser_json_blobs_output_output(
    8     11   
        &mut object,
    9     12   
        value,
   10     13   
    )?;
          14  +
    /* JsonSerializerGenerator.kt:227 */
   11     15   
    object.finish();
   12     16   
    Ok(out)
          17  +
    /* JsonSerializerGenerator.kt:213 */
   13     18   
}
   14     19   
          20  +
/* JsonSerializerGenerator.kt:358 */
   15     21   
pub fn ser_json_blobs_output_output(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::output::JsonBlobsOutput,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:382 */
   19     26   
    if let Some(var_1) = &input.data {
          27  +
        /* JsonSerializerGenerator.kt:439 */
   20     28   
        object
   21     29   
            .key("data")
   22     30   
            .string_unchecked(&::aws_smithy_types::base64::encode(var_1));
          31  +
        /* JsonSerializerGenerator.kt:382 */
   23     32   
    }
          33  +
    /* JsonSerializerGenerator.kt:372 */
   24     34   
    Ok(())
          35  +
    /* JsonSerializerGenerator.kt:358 */
   25     36   
}

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

@@ -1,1 +207,306 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_json_enums_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::JsonEnumsInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::json_enums_input_internal::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_json_enums::de_json_enums(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_json_enums_http_response(
   36     52   
    #[allow(unused_variables)] output: crate::output::JsonEnumsOutput,
   37     53   
) -> std::result::Result<
   38     54   
    ::aws_smithy_http_server::response::Response,
   39     55   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   40     56   
> {
          57  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   41     58   
    Ok({
          59  +
        /* RustType.kt:516 */
   42     60   
        #[allow(unused_mut)]
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   43     62   
        let mut builder = ::http::Response::builder();
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   44     64   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   45     65   
            builder,
   46     66   
            ::http::header::CONTENT_TYPE,
   47     67   
            "application/json",
   48     68   
        );
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   49     70   
        let http_status: u16 = 200;
   50     71   
        builder = builder.status(http_status);
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   51     73   
        let payload =
   52         -
            crate::protocol_serde::shape_json_enums_output::ser_json_enums_output_output_output(
   53         -
                &output,
   54         -
            )?;
          74  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_json_enums_output::ser_json_enums_output_output_output(&output)?
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   55     77   
        let content_length = payload.len();
   56     78   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     79   
            builder,
   58     80   
            ::http::header::CONTENT_LENGTH,
   59     81   
            content_length,
   60     82   
        );
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   61     84   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          85  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   62     86   
        builder.body(body)?
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   63     88   
    })
          89  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   64     90   
}
   65     91   
          92  +
/* RustType.kt:516 */
   66     93   
#[allow(clippy::unnecessary_wraps)]
          94  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   67     95   
pub fn ser_json_enums_http_error(
   68     96   
    error: &crate::error::JsonEnumsError,
   69     97   
) -> std::result::Result<
   70     98   
    ::aws_smithy_http_server::response::Response,
   71     99   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   72    100   
> {
         101  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   73    102   
    Ok({
         103  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   74    104   
        match error {
         105  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   75    106   
            crate::error::JsonEnumsError::ValidationException(output) => {
         107  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   76    108   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         109  +
                /* RustType.kt:516 */
   77    110   
                #[allow(unused_mut)]
         111  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   78    112   
                let mut builder = ::http::Response::builder();
         113  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   79    114   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   80    115   
                    builder,
   81    116   
                    ::http::header::CONTENT_TYPE,
   82    117   
                    "application/json",
   83    118   
                );
         119  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   84    120   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   85    121   
                    builder,
   86    122   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   87    123   
                    "ValidationException",
   88    124   
                );
         125  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   89    126   
                let content_length = payload.len();
   90    127   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   91    128   
                    builder,
   92    129   
                    ::http::header::CONTENT_LENGTH,
   93    130   
                    content_length,
   94    131   
                );
         132  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   95    133   
                builder
   96    134   
                    .status(400)
   97    135   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         136  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
   98    137   
            }
         138  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   99    139   
            crate::error::JsonEnumsError::InternalServerError(output) => {
         140  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  100    141   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         142  +
                /* RustType.kt:516 */
  101    143   
                #[allow(unused_mut)]
         144  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  102    145   
                let mut builder = ::http::Response::builder();
         146  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  103    147   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  104    148   
                    builder,
  105    149   
                    ::http::header::CONTENT_TYPE,
  106    150   
                    "application/json",
  107    151   
                );
         152  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  108    153   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  109    154   
                    builder,
  110    155   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  111    156   
                    "InternalServerError",
  112    157   
                );
         158  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  113    159   
                let content_length = payload.len();
  114    160   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  115    161   
                    builder,
  116    162   
                    ::http::header::CONTENT_LENGTH,
  117    163   
                    content_length,
  118    164   
                );
         165  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  119    166   
                builder
  120    167   
                    .status(500)
  121    168   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         169  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         170  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  122    171   
        }
  123         -
        }
         172  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  124    173   
    })
         174  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  125    175   
}
  126    176   
         177  +
/* JsonParserGenerator.kt:148 */
  127    178   
pub(crate) fn de_json_enums(
  128    179   
    value: &[u8],
  129    180   
    mut builder: crate::input::json_enums_input_internal::Builder,
  130    181   
) -> ::std::result::Result<
  131    182   
    crate::input::json_enums_input_internal::Builder,
  132    183   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  133    184   
> {
         185  +
    /* JsonParserGenerator.kt:153 */
  134    186   
    let mut tokens_owned =
  135    187   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  136    188   
            .peekable();
  137    189   
    let tokens = &mut tokens_owned;
  138    190   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         191  +
    /* JsonParserGenerator.kt:684 */
  139    192   
    loop {
         193  +
        /* JsonParserGenerator.kt:685 */
  140    194   
        match tokens.next().transpose()? {
         195  +
            /* JsonParserGenerator.kt:686 */
  141    196   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  142    197   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         198  +
                /* JsonParserGenerator.kt:260 */
  143    199   
                match key.to_unescaped()?.as_ref() {
         200  +
                    /* JsonParserGenerator.kt:262 */
  144    201   
                    "fooEnum1" => {
         202  +
                        /* JsonParserGenerator.kt:272 */
  145    203   
                        builder = builder.set_foo_enum1(
         204  +
                            /* JsonParserGenerator.kt:354 */
  146    205   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
  147    206   
                                tokens.next(),
  148    207   
                            )?
  149         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  150         -
                            .transpose()?,
         208  +
                            .map(|s|
         209  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         210  +
                                    /* JsonParserGenerator.kt:343 */u.into_owned()
         211  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         212  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  151    213   
                        );
         214  +
                        /* JsonParserGenerator.kt:262 */
  152    215   
                    }
         216  +
                    /* JsonParserGenerator.kt:262 */
  153    217   
                    "fooEnum2" => {
         218  +
                        /* JsonParserGenerator.kt:272 */
  154    219   
                        builder = builder.set_foo_enum2(
         220  +
                            /* JsonParserGenerator.kt:354 */
  155    221   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
  156    222   
                                tokens.next(),
  157    223   
                            )?
  158         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  159         -
                            .transpose()?,
         224  +
                            .map(|s|
         225  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         226  +
                                    /* JsonParserGenerator.kt:343 */u.into_owned()
         227  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         228  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  160    229   
                        );
         230  +
                        /* JsonParserGenerator.kt:262 */
  161    231   
                    }
         232  +
                    /* JsonParserGenerator.kt:262 */
  162    233   
                    "fooEnum3" => {
         234  +
                        /* JsonParserGenerator.kt:272 */
  163    235   
                        builder = builder.set_foo_enum3(
         236  +
                            /* JsonParserGenerator.kt:354 */
  164    237   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
  165    238   
                                tokens.next(),
  166    239   
                            )?
  167         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  168         -
                            .transpose()?,
         240  +
                            .map(|s|
         241  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         242  +
                                    /* JsonParserGenerator.kt:343 */u.into_owned()
         243  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         244  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  169    245   
                        );
         246  +
                        /* JsonParserGenerator.kt:262 */
  170    247   
                    }
         248  +
                    /* JsonParserGenerator.kt:262 */
  171    249   
                    "fooEnumList" => {
  172         -
                        builder = builder.set_foo_enum_list(
  173         -
                            crate::protocol_serde::shape_foo_enum_list::de_foo_enum_list(tokens)?,
         250  +
                        /* JsonParserGenerator.kt:272 */
         251  +
                        builder =
         252  +
                            builder.set_foo_enum_list(
         253  +
                                /* JsonParserGenerator.kt:451 */
         254  +
                                crate::protocol_serde::shape_foo_enum_list::de_foo_enum_list(
         255  +
                                    tokens,
         256  +
                                )?, /* JsonParserGenerator.kt:272 */
  174    257   
                            );
         258  +
                        /* JsonParserGenerator.kt:262 */
  175    259   
                    }
         260  +
                    /* JsonParserGenerator.kt:262 */
  176    261   
                    "fooEnumMap" => {
         262  +
                        /* JsonParserGenerator.kt:272 */
  177    263   
                        builder = builder.set_foo_enum_map(
  178         -
                            crate::protocol_serde::shape_foo_enum_map::de_foo_enum_map(tokens)?,
  179         -
                        );
         264  +
                            /* JsonParserGenerator.kt:509 */crate::protocol_serde::shape_foo_enum_map::de_foo_enum_map(tokens)?
         265  +
                        /* JsonParserGenerator.kt:272 */);
         266  +
                        /* JsonParserGenerator.kt:262 */
  180    267   
                    }
         268  +
                    /* JsonParserGenerator.kt:262 */
  181    269   
                    "fooEnumSet" => {
         270  +
                        /* JsonParserGenerator.kt:272 */
  182    271   
                        builder = builder.set_foo_enum_set(
  183         -
                            crate::protocol_serde::shape_foo_enum_set::de_foo_enum_set(tokens)?,
  184         -
                        );
         272  +
                            /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_foo_enum_set::de_foo_enum_set(tokens)?
         273  +
                        /* JsonParserGenerator.kt:272 */);
         274  +
                        /* JsonParserGenerator.kt:262 */
  185    275   
                    }
  186         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         276  +
                    /* JsonParserGenerator.kt:290 */
         277  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  187    278   
                }
         279  +
                /* JsonParserGenerator.kt:686 */
  188    280   
            }
         281  +
            /* JsonParserGenerator.kt:695 */
  189    282   
            other => {
  190    283   
                return Err(
  191    284   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  192    285   
                        "expected object key or end object, found: {:?}",
  193    286   
                        other
  194    287   
                    )),
  195    288   
                )
         289  +
            } /* JsonParserGenerator.kt:685 */
  196    290   
        }
         291  +
        /* JsonParserGenerator.kt:684 */
  197    292   
    }
  198         -
    }
         293  +
    /* JsonParserGenerator.kt:250 */
  199    294   
    if tokens.next().is_some() {
         295  +
        /* JsonParserGenerator.kt:251 */
  200    296   
        return Err(
  201    297   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  202    298   
                "found more JSON tokens after completing parsing",
  203    299   
            ),
  204    300   
        );
         301  +
        /* JsonParserGenerator.kt:250 */
  205    302   
    }
         303  +
    /* JsonParserGenerator.kt:163 */
  206    304   
    Ok(builder)
         305  +
    /* JsonParserGenerator.kt:148 */
  207    306   
}

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

@@ -1,1 +57,102 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_json_enums_output_output_output(
    3      4   
    value: &crate::output::JsonEnumsOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_json_enums_output::ser_json_enums_output_output(
    8     11   
        &mut object,
    9     12   
        value,
   10     13   
    )?;
          14  +
    /* JsonSerializerGenerator.kt:227 */
   11     15   
    object.finish();
   12     16   
    Ok(out)
          17  +
    /* JsonSerializerGenerator.kt:213 */
   13     18   
}
   14     19   
          20  +
/* JsonSerializerGenerator.kt:358 */
   15     21   
pub fn ser_json_enums_output_output(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::output::JsonEnumsOutput,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:382 */
   19     26   
    if let Some(var_1) = &input.foo_enum1 {
          27  +
        /* JsonSerializerGenerator.kt:423 */
   20     28   
        object.key("fooEnum1").string(var_1.as_str());
          29  +
        /* JsonSerializerGenerator.kt:382 */
   21     30   
    }
          31  +
    /* JsonSerializerGenerator.kt:382 */
   22     32   
    if let Some(var_2) = &input.foo_enum2 {
          33  +
        /* JsonSerializerGenerator.kt:423 */
   23     34   
        object.key("fooEnum2").string(var_2.as_str());
          35  +
        /* JsonSerializerGenerator.kt:382 */
   24     36   
    }
          37  +
    /* JsonSerializerGenerator.kt:382 */
   25     38   
    if let Some(var_3) = &input.foo_enum3 {
          39  +
        /* JsonSerializerGenerator.kt:423 */
   26     40   
        object.key("fooEnum3").string(var_3.as_str());
          41  +
        /* JsonSerializerGenerator.kt:382 */
   27     42   
    }
          43  +
    /* JsonSerializerGenerator.kt:382 */
   28     44   
    if let Some(var_4) = &input.foo_enum_list {
          45  +
        /* JsonSerializerGenerator.kt:484 */
   29     46   
        let mut array_5 = object.key("fooEnumList").start_array();
          47  +
        /* JsonSerializerGenerator.kt:524 */
   30     48   
        for item_6 in var_4 {
          49  +
            /* SerializerUtil.kt:42 */
   31     50   
            {
          51  +
                /* JsonSerializerGenerator.kt:423 */
   32     52   
                array_5.value().string(item_6.as_str());
          53  +
                /* SerializerUtil.kt:42 */
   33     54   
            }
          55  +
            /* JsonSerializerGenerator.kt:524 */
   34     56   
        }
          57  +
        /* JsonSerializerGenerator.kt:486 */
   35     58   
        array_5.finish();
          59  +
        /* JsonSerializerGenerator.kt:382 */
   36     60   
    }
          61  +
    /* JsonSerializerGenerator.kt:382 */
   37     62   
    if let Some(var_7) = &input.foo_enum_map {
          63  +
        /* JsonSerializerGenerator.kt:495 */
   38     64   
        #[allow(unused_mut)]
          65  +
        /* JsonSerializerGenerator.kt:496 */
   39     66   
        let mut object_8 = object.key("fooEnumMap").start_object();
          67  +
        /* JsonSerializerGenerator.kt:537 */
   40     68   
        for (key_9, value_10) in var_7 {
          69  +
            /* SerializerUtil.kt:42 */
   41     70   
            {
          71  +
                /* JsonSerializerGenerator.kt:423 */
   42     72   
                object_8.key(key_9.as_str()).string(value_10.as_str());
          73  +
                /* SerializerUtil.kt:42 */
   43     74   
            }
          75  +
            /* JsonSerializerGenerator.kt:537 */
   44     76   
        }
          77  +
        /* JsonSerializerGenerator.kt:515 */
   45     78   
        object_8.finish();
          79  +
        /* JsonSerializerGenerator.kt:382 */
   46     80   
    }
          81  +
    /* JsonSerializerGenerator.kt:382 */
   47     82   
    if let Some(var_11) = &input.foo_enum_set {
          83  +
        /* JsonSerializerGenerator.kt:484 */
   48     84   
        let mut array_12 = object.key("fooEnumSet").start_array();
          85  +
        /* JsonSerializerGenerator.kt:524 */
   49     86   
        for item_13 in var_11 {
          87  +
            /* SerializerUtil.kt:42 */
   50     88   
            {
          89  +
                /* JsonSerializerGenerator.kt:423 */
   51     90   
                array_12.value().string(item_13.as_str());
          91  +
                /* SerializerUtil.kt:42 */
   52     92   
            }
          93  +
            /* JsonSerializerGenerator.kt:524 */
   53     94   
        }
          95  +
        /* JsonSerializerGenerator.kt:486 */
   54     96   
        array_12.finish();
          97  +
        /* JsonSerializerGenerator.kt:382 */
   55     98   
    }
          99  +
    /* JsonSerializerGenerator.kt:372 */
   56    100   
    Ok(())
         101  +
    /* JsonSerializerGenerator.kt:358 */
   57    102   
}

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

@@ -1,1 +215,305 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_json_int_enums_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::JsonIntEnumsInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::json_int_enums_input_internal::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_json_int_enums::de_json_int_enums(
   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_json_int_enums_http_response(
   39     55   
    #[allow(unused_variables)] output: crate::output::JsonIntEnumsOutput,
   40     56   
) -> std::result::Result<
   41     57   
    ::aws_smithy_http_server::response::Response,
   42     58   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   43     59   
> {
          60  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   44     61   
    Ok({
          62  +
        /* RustType.kt:516 */
   45     63   
        #[allow(unused_mut)]
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   46     65   
        let mut builder = ::http::Response::builder();
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   47     67   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   48     68   
            builder,
   49     69   
            ::http::header::CONTENT_TYPE,
   50     70   
            "application/json",
   51     71   
        );
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   52     73   
        let http_status: u16 = 200;
   53     74   
        builder = builder.status(http_status);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   54     76   
        let payload =
   55         -
            crate::protocol_serde::shape_json_int_enums_output::ser_json_int_enums_output_output_output(&output)?
   56         -
        ;
          77  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_json_int_enums_output::ser_json_int_enums_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_json_int_enums_http_error(
   70     99   
    error: &crate::error::JsonIntEnumsError,
   71    100   
) -> std::result::Result<
   72    101   
    ::aws_smithy_http_server::response::Response,
   73    102   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   74    103   
> {
         104  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   75    105   
    Ok({
         106  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   76    107   
        match error {
         108  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   77    109   
            crate::error::JsonIntEnumsError::ValidationException(output) => {
         110  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   78    111   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         112  +
                /* RustType.kt:516 */
   79    113   
                #[allow(unused_mut)]
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   80    115   
                let mut builder = ::http::Response::builder();
         116  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   81    117   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   82    118   
                    builder,
   83    119   
                    ::http::header::CONTENT_TYPE,
   84    120   
                    "application/json",
   85    121   
                );
         122  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   86    123   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   87    124   
                    builder,
   88    125   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   89    126   
                    "ValidationException",
   90    127   
                );
         128  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   91    129   
                let content_length = payload.len();
   92    130   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   93    131   
                    builder,
   94    132   
                    ::http::header::CONTENT_LENGTH,
   95    133   
                    content_length,
   96    134   
                );
         135  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   97    136   
                builder
   98    137   
                    .status(400)
   99    138   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         139  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
  100    140   
            }
         141  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  101    142   
            crate::error::JsonIntEnumsError::InternalServerError(output) => {
         143  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  102    144   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         145  +
                /* RustType.kt:516 */
  103    146   
                #[allow(unused_mut)]
         147  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  104    148   
                let mut builder = ::http::Response::builder();
         149  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  105    150   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  106    151   
                    builder,
  107    152   
                    ::http::header::CONTENT_TYPE,
  108    153   
                    "application/json",
  109    154   
                );
         155  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  110    156   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  111    157   
                    builder,
  112    158   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  113    159   
                    "InternalServerError",
  114    160   
                );
         161  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  115    162   
                let content_length = payload.len();
  116    163   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  117    164   
                    builder,
  118    165   
                    ::http::header::CONTENT_LENGTH,
  119    166   
                    content_length,
  120    167   
                );
         168  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  121    169   
                builder
  122    170   
                    .status(500)
  123    171   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         172  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         173  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  124    174   
        }
  125         -
        }
         175  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  126    176   
    })
         177  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  127    178   
}
  128    179   
         180  +
/* JsonParserGenerator.kt:148 */
  129    181   
pub(crate) fn de_json_int_enums(
  130    182   
    value: &[u8],
  131    183   
    mut builder: crate::input::json_int_enums_input_internal::Builder,
  132    184   
) -> ::std::result::Result<
  133    185   
    crate::input::json_int_enums_input_internal::Builder,
  134    186   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  135    187   
> {
         188  +
    /* JsonParserGenerator.kt:153 */
  136    189   
    let mut tokens_owned =
  137    190   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  138    191   
            .peekable();
  139    192   
    let tokens = &mut tokens_owned;
  140    193   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         194  +
    /* JsonParserGenerator.kt:684 */
  141    195   
    loop {
         196  +
        /* JsonParserGenerator.kt:685 */
  142    197   
        match tokens.next().transpose()? {
         198  +
            /* JsonParserGenerator.kt:686 */
  143    199   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  144    200   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         201  +
                /* JsonParserGenerator.kt:260 */
  145    202   
                match key.to_unescaped()?.as_ref() {
         203  +
                    /* JsonParserGenerator.kt:262 */
  146    204   
                    "integerEnum1" => {
         205  +
                        /* JsonParserGenerator.kt:272 */
  147    206   
                        builder = builder.set_integer_enum1(
         207  +
                            /* JsonParserGenerator.kt:365 */
  148    208   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
  149    209   
                                tokens.next(),
  150    210   
                            )?
  151    211   
                            .map(i32::try_from)
  152         -
                            .transpose()?,
         212  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  153    213   
                        );
         214  +
                        /* JsonParserGenerator.kt:262 */
  154    215   
                    }
         216  +
                    /* JsonParserGenerator.kt:262 */
  155    217   
                    "integerEnum2" => {
         218  +
                        /* JsonParserGenerator.kt:272 */
  156    219   
                        builder = builder.set_integer_enum2(
         220  +
                            /* JsonParserGenerator.kt:365 */
  157    221   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
  158    222   
                                tokens.next(),
  159    223   
                            )?
  160    224   
                            .map(i32::try_from)
  161         -
                            .transpose()?,
         225  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  162    226   
                        );
         227  +
                        /* JsonParserGenerator.kt:262 */
  163    228   
                    }
         229  +
                    /* JsonParserGenerator.kt:262 */
  164    230   
                    "integerEnum3" => {
         231  +
                        /* JsonParserGenerator.kt:272 */
  165    232   
                        builder = builder.set_integer_enum3(
         233  +
                            /* JsonParserGenerator.kt:365 */
  166    234   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
  167    235   
                                tokens.next(),
  168    236   
                            )?
  169    237   
                            .map(i32::try_from)
  170         -
                            .transpose()?,
         238  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  171    239   
                        );
         240  +
                        /* JsonParserGenerator.kt:262 */
  172    241   
                    }
         242  +
                    /* JsonParserGenerator.kt:262 */
  173    243   
                    "integerEnumList" => {
         244  +
                        /* JsonParserGenerator.kt:272 */
  174    245   
                        builder = builder.set_integer_enum_list(
         246  +
                            /* JsonParserGenerator.kt:451 */
  175    247   
                            crate::protocol_serde::shape_integer_enum_list::de_integer_enum_list(
  176    248   
                                tokens,
  177         -
                            )?,
         249  +
                            )?, /* JsonParserGenerator.kt:272 */
  178    250   
                        );
         251  +
                        /* JsonParserGenerator.kt:262 */
  179    252   
                    }
         253  +
                    /* JsonParserGenerator.kt:262 */
  180    254   
                    "integerEnumMap" => {
         255  +
                        /* JsonParserGenerator.kt:272 */
  181    256   
                        builder = builder.set_integer_enum_map(
         257  +
                            /* JsonParserGenerator.kt:509 */
  182    258   
                            crate::protocol_serde::shape_integer_enum_map::de_integer_enum_map(
  183    259   
                                tokens,
  184         -
                            )?,
         260  +
                            )?, /* JsonParserGenerator.kt:272 */
  185    261   
                        );
         262  +
                        /* JsonParserGenerator.kt:262 */
  186    263   
                    }
         264  +
                    /* JsonParserGenerator.kt:262 */
  187    265   
                    "integerEnumSet" => {
         266  +
                        /* JsonParserGenerator.kt:272 */
  188    267   
                        builder = builder.set_integer_enum_set(
         268  +
                            /* JsonParserGenerator.kt:451 */
  189    269   
                            crate::protocol_serde::shape_integer_enum_set::de_integer_enum_set(
  190    270   
                                tokens,
  191         -
                            )?,
         271  +
                            )?, /* JsonParserGenerator.kt:272 */
  192    272   
                        );
         273  +
                        /* JsonParserGenerator.kt:262 */
  193    274   
                    }
  194         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         275  +
                    /* JsonParserGenerator.kt:290 */
         276  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  195    277   
                }
         278  +
                /* JsonParserGenerator.kt:686 */
  196    279   
            }
         280  +
            /* JsonParserGenerator.kt:695 */
  197    281   
            other => {
  198    282   
                return Err(
  199    283   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  200    284   
                        "expected object key or end object, found: {:?}",
  201    285   
                        other
  202    286   
                    )),
  203    287   
                )
         288  +
            } /* JsonParserGenerator.kt:685 */
  204    289   
        }
         290  +
        /* JsonParserGenerator.kt:684 */
  205    291   
    }
  206         -
    }
         292  +
    /* JsonParserGenerator.kt:250 */
  207    293   
    if tokens.next().is_some() {
         294  +
        /* JsonParserGenerator.kt:251 */
  208    295   
        return Err(
  209    296   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  210    297   
                "found more JSON tokens after completing parsing",
  211    298   
            ),
  212    299   
        );
         300  +
        /* JsonParserGenerator.kt:250 */
  213    301   
    }
         302  +
    /* JsonParserGenerator.kt:163 */
  214    303   
    Ok(builder)
         304  +
    /* JsonParserGenerator.kt:148 */
  215    305   
}

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

@@ -1,1 +75,120 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_json_int_enums_output_output_output(
    3      4   
    value: &crate::output::JsonIntEnumsOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_json_int_enums_output::ser_json_int_enums_output_output(
    8     11   
        &mut object,
    9     12   
        value,
   10     13   
    )?;
          14  +
    /* JsonSerializerGenerator.kt:227 */
   11     15   
    object.finish();
   12     16   
    Ok(out)
          17  +
    /* JsonSerializerGenerator.kt:213 */
   13     18   
}
   14     19   
          20  +
/* JsonSerializerGenerator.kt:358 */
   15     21   
pub fn ser_json_int_enums_output_output(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::output::JsonIntEnumsOutput,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:382 */
   19     26   
    if let Some(var_1) = &input.integer_enum1 {
          27  +
        /* JsonSerializerGenerator.kt:432 */
   20     28   
        object.key("integerEnum1").number(
   21     29   
            #[allow(clippy::useless_conversion)]
   22     30   
            ::aws_smithy_types::Number::NegInt((*var_1).into()),
   23     31   
        );
          32  +
        /* JsonSerializerGenerator.kt:382 */
   24     33   
    }
          34  +
    /* JsonSerializerGenerator.kt:382 */
   25     35   
    if let Some(var_2) = &input.integer_enum2 {
          36  +
        /* JsonSerializerGenerator.kt:432 */
   26     37   
        object.key("integerEnum2").number(
   27     38   
            #[allow(clippy::useless_conversion)]
   28     39   
            ::aws_smithy_types::Number::NegInt((*var_2).into()),
   29     40   
        );
          41  +
        /* JsonSerializerGenerator.kt:382 */
   30     42   
    }
          43  +
    /* JsonSerializerGenerator.kt:382 */
   31     44   
    if let Some(var_3) = &input.integer_enum3 {
          45  +
        /* JsonSerializerGenerator.kt:432 */
   32     46   
        object.key("integerEnum3").number(
   33     47   
            #[allow(clippy::useless_conversion)]
   34     48   
            ::aws_smithy_types::Number::NegInt((*var_3).into()),
   35     49   
        );
          50  +
        /* JsonSerializerGenerator.kt:382 */
   36     51   
    }
          52  +
    /* JsonSerializerGenerator.kt:382 */
   37     53   
    if let Some(var_4) = &input.integer_enum_list {
          54  +
        /* JsonSerializerGenerator.kt:484 */
   38     55   
        let mut array_5 = object.key("integerEnumList").start_array();
          56  +
        /* JsonSerializerGenerator.kt:524 */
   39     57   
        for item_6 in var_4 {
          58  +
            /* SerializerUtil.kt:42 */
   40     59   
            {
          60  +
                /* JsonSerializerGenerator.kt:432 */
   41     61   
                array_5.value().number(
   42     62   
                    #[allow(clippy::useless_conversion)]
   43     63   
                    ::aws_smithy_types::Number::NegInt((*item_6).into()),
   44     64   
                );
          65  +
                /* SerializerUtil.kt:42 */
   45     66   
            }
          67  +
            /* JsonSerializerGenerator.kt:524 */
   46     68   
        }
          69  +
        /* JsonSerializerGenerator.kt:486 */
   47     70   
        array_5.finish();
          71  +
        /* JsonSerializerGenerator.kt:382 */
   48     72   
    }
          73  +
    /* JsonSerializerGenerator.kt:382 */
   49     74   
    if let Some(var_7) = &input.integer_enum_map {
          75  +
        /* JsonSerializerGenerator.kt:495 */
   50     76   
        #[allow(unused_mut)]
          77  +
        /* JsonSerializerGenerator.kt:496 */
   51     78   
        let mut object_8 = object.key("integerEnumMap").start_object();
          79  +
        /* JsonSerializerGenerator.kt:537 */
   52     80   
        for (key_9, value_10) in var_7 {
          81  +
            /* SerializerUtil.kt:42 */
   53     82   
            {
          83  +
                /* JsonSerializerGenerator.kt:432 */
   54     84   
                object_8.key(key_9.as_str()).number(
   55     85   
                    #[allow(clippy::useless_conversion)]
   56     86   
                    ::aws_smithy_types::Number::NegInt((*value_10).into()),
   57     87   
                );
          88  +
                /* SerializerUtil.kt:42 */
   58     89   
            }
          90  +
            /* JsonSerializerGenerator.kt:537 */
   59     91   
        }
          92  +
        /* JsonSerializerGenerator.kt:515 */
   60     93   
        object_8.finish();
          94  +
        /* JsonSerializerGenerator.kt:382 */
   61     95   
    }
          96  +
    /* JsonSerializerGenerator.kt:382 */
   62     97   
    if let Some(var_11) = &input.integer_enum_set {
          98  +
        /* JsonSerializerGenerator.kt:484 */
   63     99   
        let mut array_12 = object.key("integerEnumSet").start_array();
         100  +
        /* JsonSerializerGenerator.kt:524 */
   64    101   
        for item_13 in var_11 {
         102  +
            /* SerializerUtil.kt:42 */
   65    103   
            {
         104  +
                /* JsonSerializerGenerator.kt:432 */
   66    105   
                array_12.value().number(
   67    106   
                    #[allow(clippy::useless_conversion)]
   68    107   
                    ::aws_smithy_types::Number::NegInt((*item_13).into()),
   69    108   
                );
         109  +
                /* SerializerUtil.kt:42 */
   70    110   
            }
         111  +
            /* JsonSerializerGenerator.kt:524 */
   71    112   
        }
         113  +
        /* JsonSerializerGenerator.kt:486 */
   72    114   
        array_12.finish();
         115  +
        /* JsonSerializerGenerator.kt:382 */
   73    116   
    }
         117  +
    /* JsonSerializerGenerator.kt:372 */
   74    118   
    Ok(())
         119  +
    /* JsonSerializerGenerator.kt:358 */
   75    120   
}

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

@@ -1,1 +214,320 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_json_lists_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::JsonListsInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::json_lists_input_internal::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_json_lists::de_json_lists(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_json_lists_http_response(
   36     52   
    #[allow(unused_variables)] output: crate::output::JsonListsOutput,
   37     53   
) -> std::result::Result<
   38     54   
    ::aws_smithy_http_server::response::Response,
   39     55   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   40     56   
> {
          57  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   41     58   
    Ok({
          59  +
        /* RustType.kt:516 */
   42     60   
        #[allow(unused_mut)]
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   43     62   
        let mut builder = ::http::Response::builder();
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   44     64   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   45     65   
            builder,
   46     66   
            ::http::header::CONTENT_TYPE,
   47     67   
            "application/json",
   48     68   
        );
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   49     70   
        let http_status: u16 = 200;
   50     71   
        builder = builder.status(http_status);
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   51     73   
        let payload =
   52         -
            crate::protocol_serde::shape_json_lists_output::ser_json_lists_output_output_output(
   53         -
                &output,
   54         -
            )?;
          74  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_json_lists_output::ser_json_lists_output_output_output(&output)?
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   55     77   
        let content_length = payload.len();
   56     78   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     79   
            builder,
   58     80   
            ::http::header::CONTENT_LENGTH,
   59     81   
            content_length,
   60     82   
        );
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   61     84   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          85  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   62     86   
        builder.body(body)?
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   63     88   
    })
          89  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   64     90   
}
   65     91   
          92  +
/* RustType.kt:516 */
   66     93   
#[allow(clippy::unnecessary_wraps)]
          94  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   67     95   
pub fn ser_json_lists_http_error(
   68     96   
    error: &crate::error::JsonListsError,
   69     97   
) -> std::result::Result<
   70     98   
    ::aws_smithy_http_server::response::Response,
   71     99   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   72    100   
> {
         101  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   73    102   
    Ok({
         103  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   74    104   
        match error {
         105  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   75    106   
            crate::error::JsonListsError::ValidationException(output) => {
         107  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   76    108   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         109  +
                /* RustType.kt:516 */
   77    110   
                #[allow(unused_mut)]
         111  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   78    112   
                let mut builder = ::http::Response::builder();
         113  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   79    114   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   80    115   
                    builder,
   81    116   
                    ::http::header::CONTENT_TYPE,
   82    117   
                    "application/json",
   83    118   
                );
         119  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   84    120   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   85    121   
                    builder,
   86    122   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   87    123   
                    "ValidationException",
   88    124   
                );
         125  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   89    126   
                let content_length = payload.len();
   90    127   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   91    128   
                    builder,
   92    129   
                    ::http::header::CONTENT_LENGTH,
   93    130   
                    content_length,
   94    131   
                );
         132  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   95    133   
                builder
   96    134   
                    .status(400)
   97    135   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         136  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
   98    137   
            }
         138  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   99    139   
            crate::error::JsonListsError::InternalServerError(output) => {
         140  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  100    141   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         142  +
                /* RustType.kt:516 */
  101    143   
                #[allow(unused_mut)]
         144  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  102    145   
                let mut builder = ::http::Response::builder();
         146  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  103    147   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  104    148   
                    builder,
  105    149   
                    ::http::header::CONTENT_TYPE,
  106    150   
                    "application/json",
  107    151   
                );
         152  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  108    153   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  109    154   
                    builder,
  110    155   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  111    156   
                    "InternalServerError",
  112    157   
                );
         158  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  113    159   
                let content_length = payload.len();
  114    160   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  115    161   
                    builder,
  116    162   
                    ::http::header::CONTENT_LENGTH,
  117    163   
                    content_length,
  118    164   
                );
         165  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  119    166   
                builder
  120    167   
                    .status(500)
  121    168   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         169  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         170  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  122    171   
        }
  123         -
        }
         172  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  124    173   
    })
         174  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  125    175   
}
  126    176   
         177  +
/* JsonParserGenerator.kt:148 */
  127    178   
pub(crate) fn de_json_lists(
  128    179   
    value: &[u8],
  129    180   
    mut builder: crate::input::json_lists_input_internal::Builder,
  130    181   
) -> ::std::result::Result<
  131    182   
    crate::input::json_lists_input_internal::Builder,
  132    183   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  133    184   
> {
         185  +
    /* JsonParserGenerator.kt:153 */
  134    186   
    let mut tokens_owned =
  135    187   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  136    188   
            .peekable();
  137    189   
    let tokens = &mut tokens_owned;
  138    190   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         191  +
    /* JsonParserGenerator.kt:684 */
  139    192   
    loop {
         193  +
        /* JsonParserGenerator.kt:685 */
  140    194   
        match tokens.next().transpose()? {
         195  +
            /* JsonParserGenerator.kt:686 */
  141    196   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  142    197   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         198  +
                /* JsonParserGenerator.kt:260 */
  143    199   
                match key.to_unescaped()?.as_ref() {
         200  +
                    /* JsonParserGenerator.kt:262 */
  144    201   
                    "booleanList" => {
         202  +
                        /* JsonParserGenerator.kt:272 */
  145    203   
                        builder = builder.set_boolean_list(
  146         -
                            crate::protocol_serde::shape_boolean_list::de_boolean_list(tokens)?,
  147         -
                        );
         204  +
                            /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_boolean_list::de_boolean_list(tokens)?
         205  +
                        /* JsonParserGenerator.kt:272 */);
         206  +
                        /* JsonParserGenerator.kt:262 */
  148    207   
                    }
         208  +
                    /* JsonParserGenerator.kt:262 */
  149    209   
                    "enumList" => {
  150         -
                        builder = builder.set_enum_list(
  151         -
                            crate::protocol_serde::shape_foo_enum_list::de_foo_enum_list(tokens)?,
         210  +
                        /* JsonParserGenerator.kt:272 */
         211  +
                        builder =
         212  +
                            builder.set_enum_list(
         213  +
                                /* JsonParserGenerator.kt:451 */
         214  +
                                crate::protocol_serde::shape_foo_enum_list::de_foo_enum_list(
         215  +
                                    tokens,
         216  +
                                )?, /* JsonParserGenerator.kt:272 */
  152    217   
                            );
         218  +
                        /* JsonParserGenerator.kt:262 */
  153    219   
                    }
         220  +
                    /* JsonParserGenerator.kt:262 */
  154    221   
                    "intEnumList" => {
         222  +
                        /* JsonParserGenerator.kt:272 */
  155    223   
                        builder = builder.set_int_enum_list(
         224  +
                            /* JsonParserGenerator.kt:451 */
  156    225   
                            crate::protocol_serde::shape_integer_enum_list::de_integer_enum_list(
  157    226   
                                tokens,
  158         -
                            )?,
         227  +
                            )?, /* JsonParserGenerator.kt:272 */
  159    228   
                        );
         229  +
                        /* JsonParserGenerator.kt:262 */
  160    230   
                    }
         231  +
                    /* JsonParserGenerator.kt:262 */
  161    232   
                    "integerList" => {
         233  +
                        /* JsonParserGenerator.kt:272 */
  162    234   
                        builder = builder.set_integer_list(
  163         -
                            crate::protocol_serde::shape_integer_list::de_integer_list(tokens)?,
  164         -
                        );
         235  +
                            /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_integer_list::de_integer_list(tokens)?
         236  +
                        /* JsonParserGenerator.kt:272 */);
         237  +
                        /* JsonParserGenerator.kt:262 */
  165    238   
                    }
         239  +
                    /* JsonParserGenerator.kt:262 */
  166    240   
                    "nestedStringList" => {
         241  +
                        /* JsonParserGenerator.kt:272 */
  167    242   
                        builder = builder.set_nested_string_list(
         243  +
                            /* JsonParserGenerator.kt:451 */
  168    244   
                            crate::protocol_serde::shape_nested_string_list::de_nested_string_list(
  169    245   
                                tokens,
  170         -
                            )?,
         246  +
                            )?, /* JsonParserGenerator.kt:272 */
  171    247   
                        );
         248  +
                        /* JsonParserGenerator.kt:262 */
  172    249   
                    }
         250  +
                    /* JsonParserGenerator.kt:262 */
  173    251   
                    "stringList" => {
         252  +
                        /* JsonParserGenerator.kt:272 */
  174    253   
                        builder = builder.set_string_list(
  175         -
                            crate::protocol_serde::shape_string_list::de_string_list(tokens)?,
  176         -
                        );
         254  +
                            /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_string_list::de_string_list(tokens)?
         255  +
                        /* JsonParserGenerator.kt:272 */);
         256  +
                        /* JsonParserGenerator.kt:262 */
  177    257   
                    }
         258  +
                    /* JsonParserGenerator.kt:262 */
  178    259   
                    "stringSet" => {
         260  +
                        /* JsonParserGenerator.kt:272 */
  179    261   
                        builder = builder.set_string_set(
  180         -
                            crate::protocol_serde::shape_string_set::de_string_set(tokens)?,
  181         -
                        );
         262  +
                            /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_string_set::de_string_set(tokens)?
         263  +
                        /* JsonParserGenerator.kt:272 */);
         264  +
                        /* JsonParserGenerator.kt:262 */
  182    265   
                    }
         266  +
                    /* JsonParserGenerator.kt:262 */
  183    267   
                    "myStructureList" => {
  184         -
                        builder = builder.set_structure_list(
  185         -
                            crate::protocol_serde::shape_structure_list::de_structure_list(tokens)?,
         268  +
                        /* JsonParserGenerator.kt:272 */
         269  +
                        builder =
         270  +
                            builder.set_structure_list(
         271  +
                                /* JsonParserGenerator.kt:451 */
         272  +
                                crate::protocol_serde::shape_structure_list::de_structure_list(
         273  +
                                    tokens,
         274  +
                                )?, /* JsonParserGenerator.kt:272 */
  186    275   
                            );
         276  +
                        /* JsonParserGenerator.kt:262 */
  187    277   
                    }
         278  +
                    /* JsonParserGenerator.kt:262 */
  188    279   
                    "timestampList" => {
  189         -
                        builder = builder.set_timestamp_list(
  190         -
                            crate::protocol_serde::shape_timestamp_list::de_timestamp_list(tokens)?,
         280  +
                        /* JsonParserGenerator.kt:272 */
         281  +
                        builder =
         282  +
                            builder.set_timestamp_list(
         283  +
                                /* JsonParserGenerator.kt:451 */
         284  +
                                crate::protocol_serde::shape_timestamp_list::de_timestamp_list(
         285  +
                                    tokens,
         286  +
                                )?, /* JsonParserGenerator.kt:272 */
  191    287   
                            );
         288  +
                        /* JsonParserGenerator.kt:262 */
  192    289   
                    }
  193         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         290  +
                    /* JsonParserGenerator.kt:290 */
         291  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  194    292   
                }
         293  +
                /* JsonParserGenerator.kt:686 */
  195    294   
            }
         295  +
            /* JsonParserGenerator.kt:695 */
  196    296   
            other => {
  197    297   
                return Err(
  198    298   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  199    299   
                        "expected object key or end object, found: {:?}",
  200    300   
                        other
  201    301   
                    )),
  202    302   
                )
         303  +
            } /* JsonParserGenerator.kt:685 */
  203    304   
        }
         305  +
        /* JsonParserGenerator.kt:684 */
  204    306   
    }
  205         -
    }
         307  +
    /* JsonParserGenerator.kt:250 */
  206    308   
    if tokens.next().is_some() {
         309  +
        /* JsonParserGenerator.kt:251 */
  207    310   
        return Err(
  208    311   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  209    312   
                "found more JSON tokens after completing parsing",
  210    313   
            ),
  211    314   
        );
         315  +
        /* JsonParserGenerator.kt:250 */
  212    316   
    }
         317  +
    /* JsonParserGenerator.kt:163 */
  213    318   
    Ok(builder)
         319  +
    /* JsonParserGenerator.kt:148 */
  214    320   
}

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

@@ -1,1 +121,219 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_json_lists_output_output_output(
    3      4   
    value: &crate::output::JsonListsOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_json_lists_output::ser_json_lists_output_output(
    8     11   
        &mut object,
    9     12   
        value,
   10     13   
    )?;
          14  +
    /* JsonSerializerGenerator.kt:227 */
   11     15   
    object.finish();
   12     16   
    Ok(out)
          17  +
    /* JsonSerializerGenerator.kt:213 */
   13     18   
}
   14     19   
          20  +
/* JsonSerializerGenerator.kt:358 */
   15     21   
pub fn ser_json_lists_output_output(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::output::JsonListsOutput,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:382 */
   19     26   
    if let Some(var_1) = &input.boolean_list {
          27  +
        /* JsonSerializerGenerator.kt:484 */
   20     28   
        let mut array_2 = object.key("booleanList").start_array();
          29  +
        /* JsonSerializerGenerator.kt:524 */
   21     30   
        for item_3 in var_1 {
          31  +
            /* SerializerUtil.kt:42 */
   22     32   
            {
          33  +
                /* JsonSerializerGenerator.kt:424 */
   23     34   
                array_2.value().boolean(*item_3);
          35  +
                /* SerializerUtil.kt:42 */
   24     36   
            }
          37  +
            /* JsonSerializerGenerator.kt:524 */
   25     38   
        }
          39  +
        /* JsonSerializerGenerator.kt:486 */
   26     40   
        array_2.finish();
          41  +
        /* JsonSerializerGenerator.kt:382 */
   27     42   
    }
          43  +
    /* JsonSerializerGenerator.kt:382 */
   28     44   
    if let Some(var_4) = &input.enum_list {
          45  +
        /* JsonSerializerGenerator.kt:484 */
   29     46   
        let mut array_5 = object.key("enumList").start_array();
          47  +
        /* JsonSerializerGenerator.kt:524 */
   30     48   
        for item_6 in var_4 {
          49  +
            /* SerializerUtil.kt:42 */
   31     50   
            {
          51  +
                /* JsonSerializerGenerator.kt:423 */
   32     52   
                array_5.value().string(item_6.as_str());
          53  +
                /* SerializerUtil.kt:42 */
   33     54   
            }
          55  +
            /* JsonSerializerGenerator.kt:524 */
   34     56   
        }
          57  +
        /* JsonSerializerGenerator.kt:486 */
   35     58   
        array_5.finish();
          59  +
        /* JsonSerializerGenerator.kt:382 */
   36     60   
    }
          61  +
    /* JsonSerializerGenerator.kt:382 */
   37     62   
    if let Some(var_7) = &input.int_enum_list {
          63  +
        /* JsonSerializerGenerator.kt:484 */
   38     64   
        let mut array_8 = object.key("intEnumList").start_array();
          65  +
        /* JsonSerializerGenerator.kt:524 */
   39     66   
        for item_9 in var_7 {
          67  +
            /* SerializerUtil.kt:42 */
   40     68   
            {
          69  +
                /* JsonSerializerGenerator.kt:432 */
   41     70   
                array_8.value().number(
   42     71   
                    #[allow(clippy::useless_conversion)]
   43     72   
                    ::aws_smithy_types::Number::NegInt((*item_9).into()),
   44     73   
                );
          74  +
                /* SerializerUtil.kt:42 */
   45     75   
            }
          76  +
            /* JsonSerializerGenerator.kt:524 */
   46     77   
        }
          78  +
        /* JsonSerializerGenerator.kt:486 */
   47     79   
        array_8.finish();
          80  +
        /* JsonSerializerGenerator.kt:382 */
   48     81   
    }
          82  +
    /* JsonSerializerGenerator.kt:382 */
   49     83   
    if let Some(var_10) = &input.integer_list {
          84  +
        /* JsonSerializerGenerator.kt:484 */
   50     85   
        let mut array_11 = object.key("integerList").start_array();
          86  +
        /* JsonSerializerGenerator.kt:524 */
   51     87   
        for item_12 in var_10 {
          88  +
            /* SerializerUtil.kt:42 */
   52     89   
            {
          90  +
                /* JsonSerializerGenerator.kt:432 */
   53     91   
                array_11.value().number(
   54     92   
                    #[allow(clippy::useless_conversion)]
   55     93   
                    ::aws_smithy_types::Number::NegInt((*item_12).into()),
   56     94   
                );
          95  +
                /* SerializerUtil.kt:42 */
   57     96   
            }
          97  +
            /* JsonSerializerGenerator.kt:524 */
   58     98   
        }
          99  +
        /* JsonSerializerGenerator.kt:486 */
   59    100   
        array_11.finish();
         101  +
        /* JsonSerializerGenerator.kt:382 */
   60    102   
    }
         103  +
    /* JsonSerializerGenerator.kt:382 */
   61    104   
    if let Some(var_13) = &input.nested_string_list {
         105  +
        /* JsonSerializerGenerator.kt:484 */
   62    106   
        let mut array_14 = object.key("nestedStringList").start_array();
         107  +
        /* JsonSerializerGenerator.kt:524 */
   63    108   
        for item_15 in var_13 {
         109  +
            /* SerializerUtil.kt:42 */
   64    110   
            {
         111  +
                /* JsonSerializerGenerator.kt:484 */
   65    112   
                let mut array_16 = array_14.value().start_array();
         113  +
                /* JsonSerializerGenerator.kt:524 */
   66    114   
                for item_17 in item_15 {
         115  +
                    /* SerializerUtil.kt:42 */
   67    116   
                    {
         117  +
                        /* JsonSerializerGenerator.kt:423 */
   68    118   
                        array_16.value().string(item_17.as_str());
         119  +
                        /* SerializerUtil.kt:42 */
   69    120   
                    }
         121  +
                    /* JsonSerializerGenerator.kt:524 */
   70    122   
                }
         123  +
                /* JsonSerializerGenerator.kt:486 */
   71    124   
                array_16.finish();
         125  +
                /* SerializerUtil.kt:42 */
   72    126   
            }
         127  +
            /* JsonSerializerGenerator.kt:524 */
   73    128   
        }
         129  +
        /* JsonSerializerGenerator.kt:486 */
   74    130   
        array_14.finish();
         131  +
        /* JsonSerializerGenerator.kt:382 */
   75    132   
    }
         133  +
    /* JsonSerializerGenerator.kt:382 */
   76    134   
    if let Some(var_18) = &input.string_list {
         135  +
        /* JsonSerializerGenerator.kt:484 */
   77    136   
        let mut array_19 = object.key("stringList").start_array();
         137  +
        /* JsonSerializerGenerator.kt:524 */
   78    138   
        for item_20 in var_18 {
         139  +
            /* SerializerUtil.kt:42 */
   79    140   
            {
         141  +
                /* JsonSerializerGenerator.kt:423 */
   80    142   
                array_19.value().string(item_20.as_str());
         143  +
                /* SerializerUtil.kt:42 */
   81    144   
            }
         145  +
            /* JsonSerializerGenerator.kt:524 */
   82    146   
        }
         147  +
        /* JsonSerializerGenerator.kt:486 */
   83    148   
        array_19.finish();
         149  +
        /* JsonSerializerGenerator.kt:382 */
   84    150   
    }
         151  +
    /* JsonSerializerGenerator.kt:382 */
   85    152   
    if let Some(var_21) = &input.string_set {
         153  +
        /* JsonSerializerGenerator.kt:484 */
   86    154   
        let mut array_22 = object.key("stringSet").start_array();
         155  +
        /* JsonSerializerGenerator.kt:524 */
   87    156   
        for item_23 in var_21 {
         157  +
            /* SerializerUtil.kt:42 */
   88    158   
            {
         159  +
                /* JsonSerializerGenerator.kt:423 */
   89    160   
                array_22.value().string(item_23.as_str());
         161  +
                /* SerializerUtil.kt:42 */
   90    162   
            }
         163  +
            /* JsonSerializerGenerator.kt:524 */
   91    164   
        }
         165  +
        /* JsonSerializerGenerator.kt:486 */
   92    166   
        array_22.finish();
         167  +
        /* JsonSerializerGenerator.kt:382 */
   93    168   
    }
         169  +
    /* JsonSerializerGenerator.kt:382 */
   94    170   
    if let Some(var_24) = &input.structure_list {
         171  +
        /* JsonSerializerGenerator.kt:484 */
   95    172   
        let mut array_25 = object.key("myStructureList").start_array();
         173  +
        /* JsonSerializerGenerator.kt:524 */
   96    174   
        for item_26 in var_24 {
         175  +
            /* SerializerUtil.kt:42 */
   97    176   
            {
         177  +
                /* JsonSerializerGenerator.kt:495 */
   98    178   
                #[allow(unused_mut)]
         179  +
                /* JsonSerializerGenerator.kt:496 */
   99    180   
                let mut object_27 = array_25.value().start_object();
         181  +
                /* JsonSerializerGenerator.kt:375 */
  100    182   
                crate::protocol_serde::shape_structure_list_member::ser_structure_list_member(
  101    183   
                    &mut object_27,
  102    184   
                    item_26,
  103    185   
                )?;
         186  +
                /* JsonSerializerGenerator.kt:515 */
  104    187   
                object_27.finish();
         188  +
                /* SerializerUtil.kt:42 */
  105    189   
            }
         190  +
            /* JsonSerializerGenerator.kt:524 */
  106    191   
        }
         192  +
        /* JsonSerializerGenerator.kt:486 */
  107    193   
        array_25.finish();
         194  +
        /* JsonSerializerGenerator.kt:382 */
  108    195   
    }
         196  +
    /* JsonSerializerGenerator.kt:382 */
  109    197   
    if let Some(var_28) = &input.timestamp_list {
         198  +
        /* JsonSerializerGenerator.kt:484 */
  110    199   
        let mut array_29 = object.key("timestampList").start_array();
         200  +
        /* JsonSerializerGenerator.kt:524 */
  111    201   
        for item_30 in var_28 {
         202  +
            /* SerializerUtil.kt:42 */
  112    203   
            {
         204  +
                /* JsonSerializerGenerator.kt:448 */
  113    205   
                array_29
  114    206   
                    .value()
  115    207   
                    .date_time(item_30, ::aws_smithy_types::date_time::Format::EpochSeconds)?;
         208  +
                /* SerializerUtil.kt:42 */
  116    209   
            }
         210  +
            /* JsonSerializerGenerator.kt:524 */
  117    211   
        }
         212  +
        /* JsonSerializerGenerator.kt:486 */
  118    213   
        array_29.finish();
         214  +
        /* JsonSerializerGenerator.kt:382 */
  119    215   
    }
         216  +
    /* JsonSerializerGenerator.kt:372 */
  120    217   
    Ok(())
         218  +
    /* JsonSerializerGenerator.kt:358 */
  121    219   
}

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

@@ -1,1 +198,286 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_json_maps_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::JsonMapsInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::json_maps_input_internal::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_json_maps::de_json_maps(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_json_maps_http_response(
   36     52   
    #[allow(unused_variables)] output: crate::output::JsonMapsOutput,
   37     53   
) -> std::result::Result<
   38     54   
    ::aws_smithy_http_server::response::Response,
   39     55   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   40     56   
> {
          57  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   41     58   
    Ok({
          59  +
        /* RustType.kt:516 */
   42     60   
        #[allow(unused_mut)]
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   43     62   
        let mut builder = ::http::Response::builder();
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   44     64   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   45     65   
            builder,
   46     66   
            ::http::header::CONTENT_TYPE,
   47     67   
            "application/json",
   48     68   
        );
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   49     70   
        let http_status: u16 = 200;
   50     71   
        builder = builder.status(http_status);
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   51     73   
        let payload =
   52         -
            crate::protocol_serde::shape_json_maps_output::ser_json_maps_output_output_output(
   53         -
                &output,
   54         -
            )?;
          74  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_json_maps_output::ser_json_maps_output_output_output(&output)?
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   55     77   
        let content_length = payload.len();
   56     78   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     79   
            builder,
   58     80   
            ::http::header::CONTENT_LENGTH,
   59     81   
            content_length,
   60     82   
        );
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   61     84   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          85  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   62     86   
        builder.body(body)?
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   63     88   
    })
          89  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   64     90   
}
   65     91   
          92  +
/* RustType.kt:516 */
   66     93   
#[allow(clippy::unnecessary_wraps)]
          94  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   67     95   
pub fn ser_json_maps_http_error(
   68     96   
    error: &crate::error::JsonMapsError,
   69     97   
) -> std::result::Result<
   70     98   
    ::aws_smithy_http_server::response::Response,
   71     99   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   72    100   
> {
         101  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   73    102   
    Ok({
         103  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   74    104   
        match error {
         105  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   75    106   
            crate::error::JsonMapsError::ValidationException(output) => {
         107  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   76    108   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         109  +
                /* RustType.kt:516 */
   77    110   
                #[allow(unused_mut)]
         111  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   78    112   
                let mut builder = ::http::Response::builder();
         113  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   79    114   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   80    115   
                    builder,
   81    116   
                    ::http::header::CONTENT_TYPE,
   82    117   
                    "application/json",
   83    118   
                );
         119  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   84    120   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   85    121   
                    builder,
   86    122   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   87    123   
                    "ValidationException",
   88    124   
                );
         125  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   89    126   
                let content_length = payload.len();
   90    127   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   91    128   
                    builder,
   92    129   
                    ::http::header::CONTENT_LENGTH,
   93    130   
                    content_length,
   94    131   
                );
         132  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   95    133   
                builder
   96    134   
                    .status(400)
   97    135   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         136  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
   98    137   
            }
         138  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   99    139   
            crate::error::JsonMapsError::InternalServerError(output) => {
         140  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  100    141   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         142  +
                /* RustType.kt:516 */
  101    143   
                #[allow(unused_mut)]
         144  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  102    145   
                let mut builder = ::http::Response::builder();
         146  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  103    147   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  104    148   
                    builder,
  105    149   
                    ::http::header::CONTENT_TYPE,
  106    150   
                    "application/json",
  107    151   
                );
         152  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  108    153   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  109    154   
                    builder,
  110    155   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  111    156   
                    "InternalServerError",
  112    157   
                );
         158  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  113    159   
                let content_length = payload.len();
  114    160   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  115    161   
                    builder,
  116    162   
                    ::http::header::CONTENT_LENGTH,
  117    163   
                    content_length,
  118    164   
                );
         165  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  119    166   
                builder
  120    167   
                    .status(500)
  121    168   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         169  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         170  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  122    171   
        }
  123         -
        }
         172  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  124    173   
    })
         174  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  125    175   
}
  126    176   
         177  +
/* JsonParserGenerator.kt:148 */
  127    178   
pub(crate) fn de_json_maps(
  128    179   
    value: &[u8],
  129    180   
    mut builder: crate::input::json_maps_input_internal::Builder,
  130    181   
) -> ::std::result::Result<
  131    182   
    crate::input::json_maps_input_internal::Builder,
  132    183   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  133    184   
> {
         185  +
    /* JsonParserGenerator.kt:153 */
  134    186   
    let mut tokens_owned =
  135    187   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  136    188   
            .peekable();
  137    189   
    let tokens = &mut tokens_owned;
  138    190   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         191  +
    /* JsonParserGenerator.kt:684 */
  139    192   
    loop {
         193  +
        /* JsonParserGenerator.kt:685 */
  140    194   
        match tokens.next().transpose()? {
         195  +
            /* JsonParserGenerator.kt:686 */
  141    196   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  142    197   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         198  +
                /* JsonParserGenerator.kt:260 */
  143    199   
                match key.to_unescaped()?.as_ref() {
         200  +
                    /* JsonParserGenerator.kt:262 */
  144    201   
                    "denseBooleanMap" => {
         202  +
                        /* JsonParserGenerator.kt:272 */
  145    203   
                        builder = builder.set_dense_boolean_map(
         204  +
                            /* JsonParserGenerator.kt:509 */
  146    205   
                            crate::protocol_serde::shape_dense_boolean_map::de_dense_boolean_map(
  147    206   
                                tokens,
  148         -
                            )?,
         207  +
                            )?, /* JsonParserGenerator.kt:272 */
  149    208   
                        );
         209  +
                        /* JsonParserGenerator.kt:262 */
  150    210   
                    }
         211  +
                    /* JsonParserGenerator.kt:262 */
  151    212   
                    "denseNumberMap" => {
         213  +
                        /* JsonParserGenerator.kt:272 */
  152    214   
                        builder = builder.set_dense_number_map(
         215  +
                            /* JsonParserGenerator.kt:509 */
  153    216   
                            crate::protocol_serde::shape_dense_number_map::de_dense_number_map(
  154    217   
                                tokens,
  155         -
                            )?,
         218  +
                            )?, /* JsonParserGenerator.kt:272 */
  156    219   
                        );
         220  +
                        /* JsonParserGenerator.kt:262 */
  157    221   
                    }
         222  +
                    /* JsonParserGenerator.kt:262 */
  158    223   
                    "denseSetMap" => {
  159         -
                        builder = builder.set_dense_set_map(
  160         -
                            crate::protocol_serde::shape_dense_set_map::de_dense_set_map(tokens)?,
         224  +
                        /* JsonParserGenerator.kt:272 */
         225  +
                        builder =
         226  +
                            builder.set_dense_set_map(
         227  +
                                /* JsonParserGenerator.kt:509 */
         228  +
                                crate::protocol_serde::shape_dense_set_map::de_dense_set_map(
         229  +
                                    tokens,
         230  +
                                )?, /* JsonParserGenerator.kt:272 */
  161    231   
                            );
         232  +
                        /* JsonParserGenerator.kt:262 */
  162    233   
                    }
         234  +
                    /* JsonParserGenerator.kt:262 */
  163    235   
                    "denseStringMap" => {
         236  +
                        /* JsonParserGenerator.kt:272 */
  164    237   
                        builder = builder.set_dense_string_map(
         238  +
                            /* JsonParserGenerator.kt:509 */
  165    239   
                            crate::protocol_serde::shape_dense_string_map::de_dense_string_map(
  166    240   
                                tokens,
  167         -
                            )?,
         241  +
                            )?, /* JsonParserGenerator.kt:272 */
  168    242   
                        );
         243  +
                        /* JsonParserGenerator.kt:262 */
  169    244   
                    }
         245  +
                    /* JsonParserGenerator.kt:262 */
  170    246   
                    "denseStructMap" => {
         247  +
                        /* JsonParserGenerator.kt:272 */
  171    248   
                        builder = builder.set_dense_struct_map(
         249  +
                            /* JsonParserGenerator.kt:509 */
  172    250   
                            crate::protocol_serde::shape_dense_struct_map::de_dense_struct_map(
  173    251   
                                tokens,
  174         -
                            )?,
         252  +
                            )?, /* JsonParserGenerator.kt:272 */
  175    253   
                        );
         254  +
                        /* JsonParserGenerator.kt:262 */
  176    255   
                    }
  177         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         256  +
                    /* JsonParserGenerator.kt:290 */
         257  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  178    258   
                }
         259  +
                /* JsonParserGenerator.kt:686 */
  179    260   
            }
         261  +
            /* JsonParserGenerator.kt:695 */
  180    262   
            other => {
  181    263   
                return Err(
  182    264   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  183    265   
                        "expected object key or end object, found: {:?}",
  184    266   
                        other
  185    267   
                    )),
  186    268   
                )
         269  +
            } /* JsonParserGenerator.kt:685 */
  187    270   
        }
         271  +
        /* JsonParserGenerator.kt:684 */
  188    272   
    }
  189         -
    }
         273  +
    /* JsonParserGenerator.kt:250 */
  190    274   
    if tokens.next().is_some() {
         275  +
        /* JsonParserGenerator.kt:251 */
  191    276   
        return Err(
  192    277   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  193    278   
                "found more JSON tokens after completing parsing",
  194    279   
            ),
  195    280   
        );
         281  +
        /* JsonParserGenerator.kt:250 */
  196    282   
    }
         283  +
    /* JsonParserGenerator.kt:163 */
  197    284   
    Ok(builder)
         285  +
    /* JsonParserGenerator.kt:148 */
  198    286   
}

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

@@ -1,1 +82,149 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_json_maps_output_output_output(
    3      4   
    value: &crate::output::JsonMapsOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_json_maps_output::ser_json_maps_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_json_maps_output_output(
   13     19   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    input: &crate::output::JsonMapsOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* JsonSerializerGenerator.kt:382 */
   16     23   
    if let Some(var_1) = &input.dense_boolean_map {
          24  +
        /* JsonSerializerGenerator.kt:495 */
   17     25   
        #[allow(unused_mut)]
          26  +
        /* JsonSerializerGenerator.kt:496 */
   18     27   
        let mut object_2 = object.key("denseBooleanMap").start_object();
          28  +
        /* JsonSerializerGenerator.kt:537 */
   19     29   
        for (key_3, value_4) in var_1 {
          30  +
            /* SerializerUtil.kt:42 */
   20     31   
            {
          32  +
                /* JsonSerializerGenerator.kt:424 */
   21     33   
                object_2.key(key_3.as_str()).boolean(*value_4);
          34  +
                /* SerializerUtil.kt:42 */
   22     35   
            }
          36  +
            /* JsonSerializerGenerator.kt:537 */
   23     37   
        }
          38  +
        /* JsonSerializerGenerator.kt:515 */
   24     39   
        object_2.finish();
          40  +
        /* JsonSerializerGenerator.kt:382 */
   25     41   
    }
          42  +
    /* JsonSerializerGenerator.kt:382 */
   26     43   
    if let Some(var_5) = &input.dense_number_map {
          44  +
        /* JsonSerializerGenerator.kt:495 */
   27     45   
        #[allow(unused_mut)]
          46  +
        /* JsonSerializerGenerator.kt:496 */
   28     47   
        let mut object_6 = object.key("denseNumberMap").start_object();
          48  +
        /* JsonSerializerGenerator.kt:537 */
   29     49   
        for (key_7, value_8) in var_5 {
          50  +
            /* SerializerUtil.kt:42 */
   30     51   
            {
          52  +
                /* JsonSerializerGenerator.kt:432 */
   31     53   
                object_6.key(key_7.as_str()).number(
   32     54   
                    #[allow(clippy::useless_conversion)]
   33     55   
                    ::aws_smithy_types::Number::NegInt((*value_8).into()),
   34     56   
                );
          57  +
                /* SerializerUtil.kt:42 */
   35     58   
            }
          59  +
            /* JsonSerializerGenerator.kt:537 */
   36     60   
        }
          61  +
        /* JsonSerializerGenerator.kt:515 */
   37     62   
        object_6.finish();
          63  +
        /* JsonSerializerGenerator.kt:382 */
   38     64   
    }
          65  +
    /* JsonSerializerGenerator.kt:382 */
   39     66   
    if let Some(var_9) = &input.dense_set_map {
          67  +
        /* JsonSerializerGenerator.kt:495 */
   40     68   
        #[allow(unused_mut)]
          69  +
        /* JsonSerializerGenerator.kt:496 */
   41     70   
        let mut object_10 = object.key("denseSetMap").start_object();
          71  +
        /* JsonSerializerGenerator.kt:537 */
   42     72   
        for (key_11, value_12) in var_9 {
          73  +
            /* SerializerUtil.kt:42 */
   43     74   
            {
          75  +
                /* JsonSerializerGenerator.kt:484 */
   44     76   
                let mut array_13 = object_10.key(key_11.as_str()).start_array();
          77  +
                /* JsonSerializerGenerator.kt:524 */
   45     78   
                for item_14 in value_12 {
          79  +
                    /* SerializerUtil.kt:42 */
   46     80   
                    {
          81  +
                        /* JsonSerializerGenerator.kt:423 */
   47     82   
                        array_13.value().string(item_14.as_str());
          83  +
                        /* SerializerUtil.kt:42 */
   48     84   
                    }
          85  +
                    /* JsonSerializerGenerator.kt:524 */
   49     86   
                }
          87  +
                /* JsonSerializerGenerator.kt:486 */
   50     88   
                array_13.finish();
          89  +
                /* SerializerUtil.kt:42 */
   51     90   
            }
          91  +
            /* JsonSerializerGenerator.kt:537 */
   52     92   
        }
          93  +
        /* JsonSerializerGenerator.kt:515 */
   53     94   
        object_10.finish();
          95  +
        /* JsonSerializerGenerator.kt:382 */
   54     96   
    }
          97  +
    /* JsonSerializerGenerator.kt:382 */
   55     98   
    if let Some(var_15) = &input.dense_string_map {
          99  +
        /* JsonSerializerGenerator.kt:495 */
   56    100   
        #[allow(unused_mut)]
         101  +
        /* JsonSerializerGenerator.kt:496 */
   57    102   
        let mut object_16 = object.key("denseStringMap").start_object();
         103  +
        /* JsonSerializerGenerator.kt:537 */
   58    104   
        for (key_17, value_18) in var_15 {
         105  +
            /* SerializerUtil.kt:42 */
   59    106   
            {
         107  +
                /* JsonSerializerGenerator.kt:423 */
   60    108   
                object_16.key(key_17.as_str()).string(value_18.as_str());
         109  +
                /* SerializerUtil.kt:42 */
   61    110   
            }
         111  +
            /* JsonSerializerGenerator.kt:537 */
   62    112   
        }
         113  +
        /* JsonSerializerGenerator.kt:515 */
   63    114   
        object_16.finish();
         115  +
        /* JsonSerializerGenerator.kt:382 */
   64    116   
    }
         117  +
    /* JsonSerializerGenerator.kt:382 */
   65    118   
    if let Some(var_19) = &input.dense_struct_map {
         119  +
        /* JsonSerializerGenerator.kt:495 */
   66    120   
        #[allow(unused_mut)]
         121  +
        /* JsonSerializerGenerator.kt:496 */
   67    122   
        let mut object_20 = object.key("denseStructMap").start_object();
         123  +
        /* JsonSerializerGenerator.kt:537 */
   68    124   
        for (key_21, value_22) in var_19 {
         125  +
            /* SerializerUtil.kt:42 */
   69    126   
            {
         127  +
                /* JsonSerializerGenerator.kt:495 */
   70    128   
                #[allow(unused_mut)]
         129  +
                /* JsonSerializerGenerator.kt:496 */
   71    130   
                let mut object_23 = object_20.key(key_21.as_str()).start_object();
         131  +
                /* JsonSerializerGenerator.kt:375 */
   72    132   
                crate::protocol_serde::shape_greeting_struct::ser_greeting_struct(
   73    133   
                    &mut object_23,
   74    134   
                    value_22,
   75    135   
                )?;
         136  +
                /* JsonSerializerGenerator.kt:515 */
   76    137   
                object_23.finish();
         138  +
                /* SerializerUtil.kt:42 */
   77    139   
            }
         140  +
            /* JsonSerializerGenerator.kt:537 */
   78    141   
        }
         142  +
        /* JsonSerializerGenerator.kt:515 */
   79    143   
        object_20.finish();
         144  +
        /* JsonSerializerGenerator.kt:382 */
   80    145   
    }
         146  +
    /* JsonSerializerGenerator.kt:372 */
   81    147   
    Ok(())
         148  +
    /* JsonSerializerGenerator.kt:358 */
   82    149   
}

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

@@ -1,1 +206,263 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_json_timestamps_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::JsonTimestampsInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::json_timestamps_input_internal::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_json_timestamps::de_json_timestamps(
   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_json_timestamps_http_response(
   39     55   
    #[allow(unused_variables)] output: crate::output::JsonTimestampsOutput,
   40     56   
) -> std::result::Result<
   41     57   
    ::aws_smithy_http_server::response::Response,
   42     58   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   43     59   
> {
          60  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   44     61   
    Ok({
          62  +
        /* RustType.kt:516 */
   45     63   
        #[allow(unused_mut)]
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   46     65   
        let mut builder = ::http::Response::builder();
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   47     67   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   48     68   
            builder,
   49     69   
            ::http::header::CONTENT_TYPE,
   50     70   
            "application/json",
   51     71   
        );
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   52     73   
        let http_status: u16 = 200;
   53     74   
        builder = builder.status(http_status);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   54     76   
        let payload =
   55         -
            crate::protocol_serde::shape_json_timestamps_output::ser_json_timestamps_output_output_output(&output)?
   56         -
        ;
          77  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_json_timestamps_output::ser_json_timestamps_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_json_timestamps_http_error(
   70     99   
    error: &crate::error::JsonTimestampsError,
   71    100   
) -> std::result::Result<
   72    101   
    ::aws_smithy_http_server::response::Response,
   73    102   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   74    103   
> {
         104  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   75    105   
    Ok({
         106  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   76    107   
        match error {
         108  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   77    109   
            crate::error::JsonTimestampsError::InternalServerError(output) => {
         110  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   78    111   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         112  +
                /* RustType.kt:516 */
   79    113   
                #[allow(unused_mut)]
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   80    115   
                let mut builder = ::http::Response::builder();
         116  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   81    117   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   82    118   
                    builder,
   83    119   
                    ::http::header::CONTENT_TYPE,
   84    120   
                    "application/json",
   85    121   
                );
         122  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   86    123   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   87    124   
                    builder,
   88    125   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   89    126   
                    "InternalServerError",
   90    127   
                );
         128  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   91    129   
                let content_length = payload.len();
   92    130   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   93    131   
                    builder,
   94    132   
                    ::http::header::CONTENT_LENGTH,
   95    133   
                    content_length,
   96    134   
                );
         135  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   97    136   
                builder
   98    137   
                    .status(500)
   99    138   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         139  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         140  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  100    141   
        }
  101         -
        }
         142  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  102    143   
    })
         144  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  103    145   
}
  104    146   
         147  +
/* JsonParserGenerator.kt:148 */
  105    148   
pub(crate) fn de_json_timestamps(
  106    149   
    value: &[u8],
  107    150   
    mut builder: crate::input::json_timestamps_input_internal::Builder,
  108    151   
) -> ::std::result::Result<
  109    152   
    crate::input::json_timestamps_input_internal::Builder,
  110    153   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  111    154   
> {
         155  +
    /* JsonParserGenerator.kt:153 */
  112    156   
    let mut tokens_owned =
  113    157   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  114    158   
            .peekable();
  115    159   
    let tokens = &mut tokens_owned;
  116    160   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         161  +
    /* JsonParserGenerator.kt:684 */
  117    162   
    loop {
         163  +
        /* JsonParserGenerator.kt:685 */
  118    164   
        match tokens.next().transpose()? {
         165  +
            /* JsonParserGenerator.kt:686 */
  119    166   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  120    167   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         168  +
                /* JsonParserGenerator.kt:260 */
  121    169   
                match key.to_unescaped()?.as_ref() {
         170  +
                    /* JsonParserGenerator.kt:262 */
  122    171   
                    "dateTime" => {
         172  +
                        /* JsonParserGenerator.kt:272 */
  123    173   
                        builder = builder.set_date_time(
  124         -
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
  125         -
                                tokens.next(),
  126         -
                                ::aws_smithy_types::date_time::Format::DateTime,
  127         -
                            )?
  128         -
                            .map(::aws_smithy_http_server_python::types::DateTime::from),
  129         -
                        );
         174  +
                            /* JsonParserGenerator.kt:384 */::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::DateTime)?
         175  +
                            /* PythonServerProtocolLoader.kt:44 */.map(::aws_smithy_http_server_python::types::DateTime::from)
         176  +
                        /* JsonParserGenerator.kt:272 */);
         177  +
                        /* JsonParserGenerator.kt:262 */
  130    178   
                    }
         179  +
                    /* JsonParserGenerator.kt:262 */
  131    180   
                    "dateTimeOnTarget" => {
         181  +
                        /* JsonParserGenerator.kt:272 */
  132    182   
                        builder = builder.set_date_time_on_target(
  133         -
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
  134         -
                                tokens.next(),
  135         -
                                ::aws_smithy_types::date_time::Format::DateTime,
  136         -
                            )?
  137         -
                            .map(::aws_smithy_http_server_python::types::DateTime::from),
  138         -
                        );
         183  +
                            /* JsonParserGenerator.kt:384 */::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::DateTime)?
         184  +
                            /* PythonServerProtocolLoader.kt:44 */.map(::aws_smithy_http_server_python::types::DateTime::from)
         185  +
                        /* JsonParserGenerator.kt:272 */);
         186  +
                        /* JsonParserGenerator.kt:262 */
  139    187   
                    }
         188  +
                    /* JsonParserGenerator.kt:262 */
  140    189   
                    "epochSeconds" => {
         190  +
                        /* JsonParserGenerator.kt:272 */
  141    191   
                        builder = builder.set_epoch_seconds(
  142         -
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
  143         -
                                tokens.next(),
  144         -
                                ::aws_smithy_types::date_time::Format::EpochSeconds,
  145         -
                            )?
  146         -
                            .map(::aws_smithy_http_server_python::types::DateTime::from),
  147         -
                        );
         192  +
                            /* JsonParserGenerator.kt:384 */::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::EpochSeconds)?
         193  +
                            /* PythonServerProtocolLoader.kt:44 */.map(::aws_smithy_http_server_python::types::DateTime::from)
         194  +
                        /* JsonParserGenerator.kt:272 */);
         195  +
                        /* JsonParserGenerator.kt:262 */
  148    196   
                    }
         197  +
                    /* JsonParserGenerator.kt:262 */
  149    198   
                    "epochSecondsOnTarget" => {
         199  +
                        /* JsonParserGenerator.kt:272 */
  150    200   
                        builder = builder.set_epoch_seconds_on_target(
  151         -
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
  152         -
                                tokens.next(),
  153         -
                                ::aws_smithy_types::date_time::Format::EpochSeconds,
  154         -
                            )?
  155         -
                            .map(::aws_smithy_http_server_python::types::DateTime::from),
  156         -
                        );
         201  +
                            /* JsonParserGenerator.kt:384 */::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::EpochSeconds)?
         202  +
                            /* PythonServerProtocolLoader.kt:44 */.map(::aws_smithy_http_server_python::types::DateTime::from)
         203  +
                        /* JsonParserGenerator.kt:272 */);
         204  +
                        /* JsonParserGenerator.kt:262 */
  157    205   
                    }
         206  +
                    /* JsonParserGenerator.kt:262 */
  158    207   
                    "httpDate" => {
         208  +
                        /* JsonParserGenerator.kt:272 */
  159    209   
                        builder = builder.set_http_date(
  160         -
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
  161         -
                                tokens.next(),
  162         -
                                ::aws_smithy_types::date_time::Format::HttpDate,
  163         -
                            )?
  164         -
                            .map(::aws_smithy_http_server_python::types::DateTime::from),
  165         -
                        );
         210  +
                            /* JsonParserGenerator.kt:384 */::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::HttpDate)?
         211  +
                            /* PythonServerProtocolLoader.kt:44 */.map(::aws_smithy_http_server_python::types::DateTime::from)
         212  +
                        /* JsonParserGenerator.kt:272 */);
         213  +
                        /* JsonParserGenerator.kt:262 */
  166    214   
                    }
         215  +
                    /* JsonParserGenerator.kt:262 */
  167    216   
                    "httpDateOnTarget" => {
         217  +
                        /* JsonParserGenerator.kt:272 */
  168    218   
                        builder = builder.set_http_date_on_target(
  169         -
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
  170         -
                                tokens.next(),
  171         -
                                ::aws_smithy_types::date_time::Format::HttpDate,
  172         -
                            )?
  173         -
                            .map(::aws_smithy_http_server_python::types::DateTime::from),
  174         -
                        );
         219  +
                            /* JsonParserGenerator.kt:384 */::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::HttpDate)?
         220  +
                            /* PythonServerProtocolLoader.kt:44 */.map(::aws_smithy_http_server_python::types::DateTime::from)
         221  +
                        /* JsonParserGenerator.kt:272 */);
         222  +
                        /* JsonParserGenerator.kt:262 */
  175    223   
                    }
         224  +
                    /* JsonParserGenerator.kt:262 */
  176    225   
                    "normal" => {
         226  +
                        /* JsonParserGenerator.kt:272 */
  177    227   
                        builder = builder.set_normal(
  178         -
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
  179         -
                                tokens.next(),
  180         -
                                ::aws_smithy_types::date_time::Format::EpochSeconds,
  181         -
                            )?
  182         -
                            .map(::aws_smithy_http_server_python::types::DateTime::from),
  183         -
                        );
         228  +
                            /* JsonParserGenerator.kt:384 */::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::EpochSeconds)?
         229  +
                            /* PythonServerProtocolLoader.kt:44 */.map(::aws_smithy_http_server_python::types::DateTime::from)
         230  +
                        /* JsonParserGenerator.kt:272 */);
         231  +
                        /* JsonParserGenerator.kt:262 */
  184    232   
                    }
  185         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         233  +
                    /* JsonParserGenerator.kt:290 */
         234  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  186    235   
                }
         236  +
                /* JsonParserGenerator.kt:686 */
  187    237   
            }
         238  +
            /* JsonParserGenerator.kt:695 */
  188    239   
            other => {
  189    240   
                return Err(
  190    241   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  191    242   
                        "expected object key or end object, found: {:?}",
  192    243   
                        other
  193    244   
                    )),
  194    245   
                )
         246  +
            } /* JsonParserGenerator.kt:685 */
  195    247   
        }
         248  +
        /* JsonParserGenerator.kt:684 */
  196    249   
    }
  197         -
    }
         250  +
    /* JsonParserGenerator.kt:250 */
  198    251   
    if tokens.next().is_some() {
         252  +
        /* JsonParserGenerator.kt:251 */
  199    253   
        return Err(
  200    254   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  201    255   
                "found more JSON tokens after completing parsing",
  202    256   
            ),
  203    257   
        );
         258  +
        /* JsonParserGenerator.kt:250 */
  204    259   
    }
         260  +
    /* JsonParserGenerator.kt:163 */
  205    261   
    Ok(builder)
         262  +
    /* JsonParserGenerator.kt:148 */
  206    263   
}