Server Test

Server Test

rev. d06a46cae0f385cdae37a9f8264db3469a090ab5

Files changed:

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

@@ -1,1 +45,79 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_sparse_json_lists_output_output_output(
    3      4   
    value: &crate::output::SparseJsonListsOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_sparse_json_lists_output::ser_sparse_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_sparse_json_lists_output_output(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::output::SparseJsonListsOutput,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:382 */
   19     26   
    if let Some(var_1) = &input.sparse_short_list {
          27  +
        /* JsonSerializerGenerator.kt:484 */
   20     28   
        let mut array_2 = object.key("sparseShortList").start_array();
          29  +
        /* JsonSerializerGenerator.kt:524 */
   21     30   
        for item_3 in var_1 {
          31  +
            /* JsonSerializerGenerator.kt:382 */
   22     32   
            if let Some(var_4) = item_3 {
          33  +
                /* JsonSerializerGenerator.kt:432 */
   23     34   
                array_2.value().number(
   24     35   
                    #[allow(clippy::useless_conversion)]
   25     36   
                    ::aws_smithy_types::Number::NegInt((*var_4).into()),
   26     37   
                );
   27         -
            } else {
          38  +
            /* JsonSerializerGenerator.kt:382 */
          39  +
            }
          40  +
            /* JsonSerializerGenerator.kt:395 */
          41  +
            else {
          42  +
                /* JsonSerializerGenerator.kt:396 */
   28     43   
                array_2.value().null();
          44  +
                /* JsonSerializerGenerator.kt:395 */
   29     45   
            }
          46  +
            /* JsonSerializerGenerator.kt:524 */
   30     47   
        }
          48  +
        /* JsonSerializerGenerator.kt:486 */
   31     49   
        array_2.finish();
          50  +
        /* JsonSerializerGenerator.kt:382 */
   32     51   
    }
          52  +
    /* JsonSerializerGenerator.kt:382 */
   33     53   
    if let Some(var_5) = &input.sparse_string_list {
          54  +
        /* JsonSerializerGenerator.kt:484 */
   34     55   
        let mut array_6 = object.key("sparseStringList").start_array();
          56  +
        /* JsonSerializerGenerator.kt:524 */
   35     57   
        for item_7 in var_5 {
          58  +
            /* JsonSerializerGenerator.kt:382 */
   36     59   
            if let Some(var_8) = item_7 {
          60  +
                /* JsonSerializerGenerator.kt:423 */
   37     61   
                array_6.value().string(var_8.as_str());
   38         -
            } else {
          62  +
            /* JsonSerializerGenerator.kt:382 */
          63  +
            }
          64  +
            /* JsonSerializerGenerator.kt:395 */
          65  +
            else {
          66  +
                /* JsonSerializerGenerator.kt:396 */
   39     67   
                array_6.value().null();
          68  +
                /* JsonSerializerGenerator.kt:395 */
   40     69   
            }
          70  +
            /* JsonSerializerGenerator.kt:524 */
   41     71   
        }
          72  +
        /* JsonSerializerGenerator.kt:486 */
   42     73   
        array_6.finish();
          74  +
        /* JsonSerializerGenerator.kt:382 */
   43     75   
    }
          76  +
    /* JsonSerializerGenerator.kt:372 */
   44     77   
    Ok(())
          78  +
    /* JsonSerializerGenerator.kt:358 */
   45     79   
}

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

@@ -1,1 +175,258 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_sparse_json_maps_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::SparseJsonMapsInput,
    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:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::sparse_json_maps_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   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();
   22         -
        let bytes = ::hyper::body::to_bytes(body).await?;
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:789 */
          30  +
        let bytes = {
          31  +
            use ::http_body_util::BodyExt;
          32  +
            body.collect().await?.to_bytes()
          33  +
        };
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:825 */
   23     35   
        if !bytes.is_empty() {
          36  +
            /* ServerHttpBoundProtocolGenerator.kt:826 */
   24     37   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     38   
                &headers,
   26     39   
                Some("application/json"),
   27     40   
            )?;
   28     41   
            input = crate::protocol_serde::shape_sparse_json_maps::de_sparse_json_maps(
   29     42   
                bytes.as_ref(),
   30     43   
                input,
   31     44   
            )?;
          45  +
            /* ServerHttpBoundProtocolGenerator.kt:825 */
   32     46   
        }
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   33     48   
        input.build()?
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   34     50   
    })
          51  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   35     52   
}
   36     53   
          54  +
/* RustType.kt:534 */
   37     55   
#[allow(clippy::unnecessary_wraps)]
          56  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   38     57   
pub fn ser_sparse_json_maps_http_response(
   39     58   
    #[allow(unused_variables)] output: crate::output::SparseJsonMapsOutput,
   40     59   
) -> std::result::Result<
   41     60   
    ::aws_smithy_http_server::response::Response,
   42     61   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   43     62   
> {
          63  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   44     64   
    Ok({
          65  +
        /* RustType.kt:534 */
   45     66   
        #[allow(unused_mut)]
   46         -
        let mut builder = ::http::Response::builder();
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          68  +
        let mut builder = ::http_1x::Response::builder();
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   47     70   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   48     71   
            builder,
   49         -
            ::http::header::CONTENT_TYPE,
          72  +
            ::http_1x::header::CONTENT_TYPE,
   50     73   
            "application/json",
   51     74   
        );
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   52     76   
        let http_status: u16 = 200;
   53     77   
        builder = builder.status(http_status);
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   54     79   
        let payload =
   55         -
            crate::protocol_serde::shape_sparse_json_maps_output::ser_sparse_json_maps_output_output_output(&output)?
   56         -
        ;
          80  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_sparse_json_maps_output::ser_sparse_json_maps_output_output_output(&output)?
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   57     83   
        let content_length = payload.len();
   58     84   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   59     85   
            builder,
   60         -
            ::http::header::CONTENT_LENGTH,
          86  +
            ::http_1x::header::CONTENT_LENGTH,
   61     87   
            content_length,
   62     88   
        );
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   63     90   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   64     92   
        builder.body(body)?
          93  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   65     94   
    })
          95  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   66     96   
}
   67     97   
          98  +
/* RustType.kt:534 */
   68     99   
#[allow(clippy::unnecessary_wraps)]
         100  +
/* ServerHttpBoundProtocolGenerator.kt:471 */
   69    101   
pub fn ser_sparse_json_maps_http_error(
   70    102   
    error: &crate::error::SparseJsonMapsError,
   71    103   
) -> std::result::Result<
   72    104   
    ::aws_smithy_http_server::response::Response,
   73    105   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   74    106   
> {
         107  +
    /* ServerHttpBoundProtocolGenerator.kt:476 */
   75    108   
    Ok({
         109  +
        /* ServerHttpBoundProtocolGenerator.kt:492 */
   76    110   
        match error {
         111  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
   77    112   
            crate::error::SparseJsonMapsError::ValidationException(output) => {
         113  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
   78    114   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         115  +
                /* RustType.kt:534 */
   79    116   
                #[allow(unused_mut)]
   80         -
                let mut builder = ::http::Response::builder();
         117  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         118  +
                let mut builder = ::http_1x::Response::builder();
         119  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
   81    120   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   82    121   
                    builder,
   83         -
                    ::http::header::CONTENT_TYPE,
         122  +
                    ::http_1x::header::CONTENT_TYPE,
   84    123   
                    "application/json",
   85    124   
                );
         125  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
   86    126   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   87    127   
                    builder,
   88         -
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         128  +
                    ::http_1x::header::HeaderName::from_static("x-amzn-errortype"),
   89    129   
                    "ValidationException",
   90    130   
                );
         131  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
   91    132   
                let content_length = payload.len();
   92    133   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   93    134   
                    builder,
   94         -
                    ::http::header::CONTENT_LENGTH,
         135  +
                    ::http_1x::header::CONTENT_LENGTH,
   95    136   
                    content_length,
   96    137   
                );
         138  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
   97    139   
                builder
   98    140   
                    .status(400)
   99    141   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  100         -
            }
         142  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         143  +
            } /* ServerHttpBoundProtocolGenerator.kt:492 */
  101    144   
        }
         145  +
        /* ServerHttpBoundProtocolGenerator.kt:476 */
  102    146   
    })
         147  +
    /* ServerHttpBoundProtocolGenerator.kt:471 */
  103    148   
}
  104    149   
         150  +
/* JsonParserGenerator.kt:148 */
  105    151   
pub(crate) fn de_sparse_json_maps(
  106    152   
    value: &[u8],
  107    153   
    mut builder: crate::input::sparse_json_maps_input::Builder,
  108    154   
) -> ::std::result::Result<
  109    155   
    crate::input::sparse_json_maps_input::Builder,
  110    156   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  111    157   
> {
         158  +
    /* JsonParserGenerator.kt:153 */
  112    159   
    let mut tokens_owned =
  113    160   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  114    161   
            .peekable();
  115    162   
    let tokens = &mut tokens_owned;
  116    163   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         164  +
    /* JsonParserGenerator.kt:684 */
  117    165   
    loop {
         166  +
        /* JsonParserGenerator.kt:685 */
  118    167   
        match tokens.next().transpose()? {
         168  +
            /* JsonParserGenerator.kt:686 */
  119    169   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  120    170   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         171  +
                /* JsonParserGenerator.kt:260 */
  121    172   
                match key.to_unescaped()?.as_ref() {
         173  +
                    /* JsonParserGenerator.kt:262 */
  122    174   
                    "sparseBooleanMap" => {
         175  +
                        /* JsonParserGenerator.kt:272 */
  123    176   
                        builder = builder.set_sparse_boolean_map(
         177  +
                            /* JsonParserGenerator.kt:509 */
  124    178   
                            crate::protocol_serde::shape_sparse_boolean_map::de_sparse_boolean_map(
  125    179   
                                tokens,
  126         -
                            )?,
         180  +
                            )?, /* JsonParserGenerator.kt:272 */
  127    181   
                        );
         182  +
                        /* JsonParserGenerator.kt:262 */
  128    183   
                    }
         184  +
                    /* JsonParserGenerator.kt:262 */
  129    185   
                    "sparseNumberMap" => {
         186  +
                        /* JsonParserGenerator.kt:272 */
  130    187   
                        builder = builder.set_sparse_number_map(
         188  +
                            /* JsonParserGenerator.kt:509 */
  131    189   
                            crate::protocol_serde::shape_sparse_number_map::de_sparse_number_map(
  132    190   
                                tokens,
  133         -
                            )?,
         191  +
                            )?, /* JsonParserGenerator.kt:272 */
  134    192   
                        );
         193  +
                        /* JsonParserGenerator.kt:262 */
  135    194   
                    }
         195  +
                    /* JsonParserGenerator.kt:262 */
  136    196   
                    "sparseSetMap" => {
  137         -
                        builder = builder.set_sparse_set_map(
  138         -
                            crate::protocol_serde::shape_sparse_set_map::de_sparse_set_map(tokens)?,
  139         -
                        );
         197  +
                        /* JsonParserGenerator.kt:272 */
         198  +
                        builder =
         199  +
                            builder.set_sparse_set_map(
         200  +
                                /* JsonParserGenerator.kt:509 */
         201  +
                                crate::protocol_serde::shape_sparse_set_map::de_sparse_set_map(
         202  +
                                    tokens,
         203  +
                                )?, /* JsonParserGenerator.kt:272 */
         204  +
                            );
         205  +
                        /* JsonParserGenerator.kt:262 */
  140    206   
                    }
         207  +
                    /* JsonParserGenerator.kt:262 */
  141    208   
                    "sparseStringMap" => {
         209  +
                        /* JsonParserGenerator.kt:272 */
  142    210   
                        builder = builder.set_sparse_string_map(
         211  +
                            /* JsonParserGenerator.kt:509 */
  143    212   
                            crate::protocol_serde::shape_sparse_string_map::de_sparse_string_map(
  144    213   
                                tokens,
  145         -
                            )?,
         214  +
                            )?, /* JsonParserGenerator.kt:272 */
  146    215   
                        );
         216  +
                        /* JsonParserGenerator.kt:262 */
  147    217   
                    }
         218  +
                    /* JsonParserGenerator.kt:262 */
  148    219   
                    "sparseStructMap" => {
         220  +
                        /* JsonParserGenerator.kt:272 */
  149    221   
                        builder = builder.set_sparse_struct_map(
         222  +
                            /* JsonParserGenerator.kt:509 */
  150    223   
                            crate::protocol_serde::shape_sparse_struct_map::de_sparse_struct_map(
  151    224   
                                tokens,
  152         -
                            )?,
         225  +
                            )?, /* JsonParserGenerator.kt:272 */
  153    226   
                        );
         227  +
                        /* JsonParserGenerator.kt:262 */
  154    228   
                    }
  155         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         229  +
                    /* JsonParserGenerator.kt:290 */
         230  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  156    231   
                }
         232  +
                /* JsonParserGenerator.kt:686 */
  157    233   
            }
         234  +
            /* JsonParserGenerator.kt:695 */
  158    235   
            other => {
  159    236   
                return Err(
  160    237   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  161    238   
                        "expected object key or end object, found: {other:?}"
  162    239   
                    )),
  163    240   
                )
  164         -
            }
         241  +
            } /* JsonParserGenerator.kt:685 */
  165    242   
        }
         243  +
        /* JsonParserGenerator.kt:684 */
  166    244   
    }
         245  +
    /* JsonParserGenerator.kt:250 */
  167    246   
    if tokens.next().is_some() {
         247  +
        /* JsonParserGenerator.kt:251 */
  168    248   
        return Err(
  169    249   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  170    250   
                "found more JSON tokens after completing parsing",
  171    251   
            ),
  172    252   
        );
         253  +
        /* JsonParserGenerator.kt:250 */
  173    254   
    }
         255  +
    /* JsonParserGenerator.kt:163 */
  174    256   
    Ok(builder)
         257  +
    /* JsonParserGenerator.kt:148 */
  175    258   
}

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

@@ -1,1 +95,182 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_sparse_json_maps_output_output_output(
    3      4   
    value: &crate::output::SparseJsonMapsOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_sparse_json_maps_output::ser_sparse_json_maps_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_sparse_json_maps_output_output(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::output::SparseJsonMapsOutput,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:382 */
   19     26   
    if let Some(var_1) = &input.sparse_boolean_map {
          27  +
        /* JsonSerializerGenerator.kt:495 */
   20     28   
        #[allow(unused_mut)]
          29  +
        /* JsonSerializerGenerator.kt:496 */
   21     30   
        let mut object_2 = object.key("sparseBooleanMap").start_object();
          31  +
        /* JsonSerializerGenerator.kt:537 */
   22     32   
        for (key_3, value_4) in var_1 {
          33  +
            /* JsonSerializerGenerator.kt:382 */
   23     34   
            if let Some(var_5) = value_4 {
          35  +
                /* JsonSerializerGenerator.kt:424 */
   24     36   
                object_2.key(key_3.as_str()).boolean(*var_5);
   25         -
            } else {
          37  +
            /* JsonSerializerGenerator.kt:382 */
          38  +
            }
          39  +
            /* JsonSerializerGenerator.kt:395 */
          40  +
            else {
          41  +
                /* JsonSerializerGenerator.kt:396 */
   26     42   
                object_2.key(key_3.as_str()).null();
          43  +
                /* JsonSerializerGenerator.kt:395 */
   27     44   
            }
          45  +
            /* JsonSerializerGenerator.kt:537 */
   28     46   
        }
          47  +
        /* JsonSerializerGenerator.kt:515 */
   29     48   
        object_2.finish();
          49  +
        /* JsonSerializerGenerator.kt:382 */
   30     50   
    }
          51  +
    /* JsonSerializerGenerator.kt:382 */
   31     52   
    if let Some(var_6) = &input.sparse_number_map {
          53  +
        /* JsonSerializerGenerator.kt:495 */
   32     54   
        #[allow(unused_mut)]
          55  +
        /* JsonSerializerGenerator.kt:496 */
   33     56   
        let mut object_7 = object.key("sparseNumberMap").start_object();
          57  +
        /* JsonSerializerGenerator.kt:537 */
   34     58   
        for (key_8, value_9) in var_6 {
          59  +
            /* JsonSerializerGenerator.kt:382 */
   35     60   
            if let Some(var_10) = value_9 {
          61  +
                /* JsonSerializerGenerator.kt:432 */
   36     62   
                object_7.key(key_8.as_str()).number(
   37     63   
                    #[allow(clippy::useless_conversion)]
   38     64   
                    ::aws_smithy_types::Number::NegInt((*var_10).into()),
   39     65   
                );
   40         -
            } else {
          66  +
            /* JsonSerializerGenerator.kt:382 */
          67  +
            }
          68  +
            /* JsonSerializerGenerator.kt:395 */
          69  +
            else {
          70  +
                /* JsonSerializerGenerator.kt:396 */
   41     71   
                object_7.key(key_8.as_str()).null();
          72  +
                /* JsonSerializerGenerator.kt:395 */
   42     73   
            }
          74  +
            /* JsonSerializerGenerator.kt:537 */
   43     75   
        }
          76  +
        /* JsonSerializerGenerator.kt:515 */
   44     77   
        object_7.finish();
          78  +
        /* JsonSerializerGenerator.kt:382 */
   45     79   
    }
          80  +
    /* JsonSerializerGenerator.kt:382 */
   46     81   
    if let Some(var_11) = &input.sparse_set_map {
          82  +
        /* JsonSerializerGenerator.kt:495 */
   47     83   
        #[allow(unused_mut)]
          84  +
        /* JsonSerializerGenerator.kt:496 */
   48     85   
        let mut object_12 = object.key("sparseSetMap").start_object();
          86  +
        /* JsonSerializerGenerator.kt:537 */
   49     87   
        for (key_13, value_14) in var_11 {
          88  +
            /* JsonSerializerGenerator.kt:382 */
   50     89   
            if let Some(var_15) = value_14 {
          90  +
                /* JsonSerializerGenerator.kt:484 */
   51     91   
                let mut array_16 = object_12.key(key_13.as_str()).start_array();
          92  +
                /* JsonSerializerGenerator.kt:524 */
   52     93   
                for item_17 in &var_15.0 {
          94  +
                    /* SerializerUtil.kt:42 */
   53     95   
                    {
          96  +
                        /* JsonSerializerGenerator.kt:423 */
   54     97   
                        array_16.value().string(item_17.as_str());
          98  +
                        /* SerializerUtil.kt:42 */
   55     99   
                    }
         100  +
                    /* JsonSerializerGenerator.kt:524 */
   56    101   
                }
         102  +
                /* JsonSerializerGenerator.kt:486 */
   57    103   
                array_16.finish();
   58         -
            } else {
         104  +
            /* JsonSerializerGenerator.kt:382 */
         105  +
            }
         106  +
            /* JsonSerializerGenerator.kt:395 */
         107  +
            else {
         108  +
                /* JsonSerializerGenerator.kt:396 */
   59    109   
                object_12.key(key_13.as_str()).null();
         110  +
                /* JsonSerializerGenerator.kt:395 */
   60    111   
            }
         112  +
            /* JsonSerializerGenerator.kt:537 */
   61    113   
        }
         114  +
        /* JsonSerializerGenerator.kt:515 */
   62    115   
        object_12.finish();
         116  +
        /* JsonSerializerGenerator.kt:382 */
   63    117   
    }
         118  +
    /* JsonSerializerGenerator.kt:382 */
   64    119   
    if let Some(var_18) = &input.sparse_string_map {
         120  +
        /* JsonSerializerGenerator.kt:495 */
   65    121   
        #[allow(unused_mut)]
         122  +
        /* JsonSerializerGenerator.kt:496 */
   66    123   
        let mut object_19 = object.key("sparseStringMap").start_object();
         124  +
        /* JsonSerializerGenerator.kt:537 */
   67    125   
        for (key_20, value_21) in var_18 {
         126  +
            /* JsonSerializerGenerator.kt:382 */
   68    127   
            if let Some(var_22) = value_21 {
         128  +
                /* JsonSerializerGenerator.kt:423 */
   69    129   
                object_19.key(key_20.as_str()).string(var_22.as_str());
   70         -
            } else {
         130  +
            /* JsonSerializerGenerator.kt:382 */
         131  +
            }
         132  +
            /* JsonSerializerGenerator.kt:395 */
         133  +
            else {
         134  +
                /* JsonSerializerGenerator.kt:396 */
   71    135   
                object_19.key(key_20.as_str()).null();
         136  +
                /* JsonSerializerGenerator.kt:395 */
   72    137   
            }
         138  +
            /* JsonSerializerGenerator.kt:537 */
   73    139   
        }
         140  +
        /* JsonSerializerGenerator.kt:515 */
   74    141   
        object_19.finish();
         142  +
        /* JsonSerializerGenerator.kt:382 */
   75    143   
    }
         144  +
    /* JsonSerializerGenerator.kt:382 */
   76    145   
    if let Some(var_23) = &input.sparse_struct_map {
         146  +
        /* JsonSerializerGenerator.kt:495 */
   77    147   
        #[allow(unused_mut)]
         148  +
        /* JsonSerializerGenerator.kt:496 */
   78    149   
        let mut object_24 = object.key("sparseStructMap").start_object();
         150  +
        /* JsonSerializerGenerator.kt:537 */
   79    151   
        for (key_25, value_26) in var_23 {
         152  +
            /* JsonSerializerGenerator.kt:382 */
   80    153   
            if let Some(var_27) = value_26 {
         154  +
                /* JsonSerializerGenerator.kt:495 */
   81    155   
                #[allow(unused_mut)]
         156  +
                /* JsonSerializerGenerator.kt:496 */
   82    157   
                let mut object_28 = object_24.key(key_25.as_str()).start_object();
         158  +
                /* JsonSerializerGenerator.kt:375 */
   83    159   
                crate::protocol_serde::shape_greeting_struct::ser_greeting_struct(
   84    160   
                    &mut object_28,
   85    161   
                    var_27,
   86    162   
                )?;
         163  +
                /* JsonSerializerGenerator.kt:515 */
   87    164   
                object_28.finish();
   88         -
            } else {
         165  +
            /* JsonSerializerGenerator.kt:382 */
         166  +
            }
         167  +
            /* JsonSerializerGenerator.kt:395 */
         168  +
            else {
         169  +
                /* JsonSerializerGenerator.kt:396 */
   89    170   
                object_24.key(key_25.as_str()).null();
         171  +
                /* JsonSerializerGenerator.kt:395 */
   90    172   
            }
         173  +
            /* JsonSerializerGenerator.kt:537 */
   91    174   
        }
         175  +
        /* JsonSerializerGenerator.kt:515 */
   92    176   
        object_24.finish();
         177  +
        /* JsonSerializerGenerator.kt:382 */
   93    178   
    }
         179  +
    /* JsonSerializerGenerator.kt:372 */
   94    180   
    Ok(())
         181  +
    /* JsonSerializerGenerator.kt:358 */
   95    182   
}

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

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

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

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

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

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

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

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

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

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

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

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

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

@@ -1,1 +96,137 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_streaming_traits_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::StreamingTraitsInput,
    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         -
    B: Into<::aws_smithy_types::byte_stream::ByteStream>,
          13  +
    B: ::http_body_1x::Body<Data = ::bytes::Bytes>
          14  +
        + ::std::marker::Send
          15  +
        + ::std::marker::Sync
          16  +
        + 'static,
          17  +
    B::Error: Into<::aws_smithy_types::body::Error> + 'static,
          18  +
   12     19   
    B::Data: Send,
   13     20   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   14     21   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   15     22   
{
          23  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
   16     24   
    Ok({
          25  +
        /* RustType.kt:534 */
   17     26   
        #[allow(unused_mut)]
          27  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   18     28   
        let mut input = crate::input::streaming_traits_input::Builder::default();
          29  +
        /* RustType.kt:534 */
   19     30   
        #[allow(unused_variables)]
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   20     32   
        let ::aws_smithy_runtime_api::http::RequestParts {
   21     33   
            uri, headers, body, ..
   22     34   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   23     36   
        if let Some(value) = {
   24     37   
            Some(
   25     38   
                crate::protocol_serde::shape_streaming_traits_input::de_blob_payload(
   26         -
                    &mut body.into().into_inner(),
          39  +
                    &mut ::aws_smithy_types::body::SdkBody::from_body_1_x(body),
   27     40   
                )?,
   28     41   
            )
   29     42   
        } {
   30     43   
            input = input.set_blob(value)
   31     44   
        }
          45  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   32     46   
        if let Some(value) =
   33     47   
            crate::protocol_serde::shape_streaming_traits_input::de_foo_header(&headers)?
   34     48   
        {
   35     49   
            input = input.set_foo(Some(value))
   36     50   
        }
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   37     52   
        input.build()
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   38     54   
    })
          55  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   39     56   
}
   40     57   
          58  +
/* RustType.kt:534 */
   41     59   
#[allow(clippy::unnecessary_wraps)]
          60  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   42     61   
pub fn ser_streaming_traits_http_response(
   43     62   
    #[allow(unused_variables)] output: crate::output::StreamingTraitsOutput,
   44     63   
) -> std::result::Result<
   45     64   
    ::aws_smithy_http_server::response::Response,
   46     65   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   47     66   
> {
          67  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   48     68   
    Ok({
          69  +
        /* RustType.kt:534 */
   49     70   
        #[allow(unused_mut)]
   50         -
        let mut builder = ::http::Response::builder();
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          72  +
        let mut builder = ::http_1x::Response::builder();
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:665 */
   51     74   
        builder = crate::protocol_serde::shape_streaming_traits::ser_streaming_traits_headers(
   52     75   
            &output, builder,
   53     76   
        )?;
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   54     78   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   55     79   
            builder,
   56         -
            ::http::header::CONTENT_TYPE,
          80  +
            ::http_1x::header::CONTENT_TYPE,
   57     81   
            "application/octet-stream",
   58     82   
        );
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   59     84   
        let http_status: u16 = 200;
   60     85   
        builder = builder.status(http_status);
   61         -
        let body = ::aws_smithy_http_server::body::boxed(
   62         -
            ::aws_smithy_http_server::body::Body::wrap_stream(
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
          87  +
        let body =
          88  +
            ::aws_smithy_http_server::body::boxed(::aws_smithy_http_server::body::wrap_stream(
          89  +
                /* ServerProtocolLoader.kt:42 */
   63     90   
                ::aws_smithy_http::futures_stream_adapter::FuturesStreamCompatByteStream::new(
          91  +
                    /* HttpBoundProtocolPayloadGenerator.kt:348 */
   64     92   
                    crate::protocol_serde::shape_streaming_traits_output::ser_blob_http_payload(
   65     93   
                        output.blob,
   66         -
                    )?,
   67         -
                ),
   68         -
            ),
   69         -
        );
          94  +
                    )?, /* ServerProtocolLoader.kt:42 */
          95  +
                ), /* ServerHttpBoundProtocolGenerator.kt:575 */
          96  +
            ));
          97  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   70     98   
        builder.body(body)?
          99  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   71    100   
    })
         101  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   72    102   
}
   73    103   
         104  +
/* HttpBindingGenerator.kt:565 */
   74    105   
pub fn ser_streaming_traits_headers(
   75    106   
    input: &crate::output::StreamingTraitsOutput,
   76         -
    mut builder: ::http::response::Builder,
   77         -
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
   78         -
{
         107  +
    mut builder: ::http_1x::response::Builder,
         108  +
) -> std::result::Result<
         109  +
    ::http_1x::response::Builder,
         110  +
    ::aws_smithy_types::error::operation::BuildError,
         111  +
> {
         112  +
    /* HttpBindingGenerator.kt:615 */
   79    113   
    if let ::std::option::Option::Some(inner_1) = &input.foo {
         114  +
        /* HttpBindingGenerator.kt:727 */
   80    115   
        let formatted_2 = inner_1.as_str();
         116  +
        /* HttpBindingGenerator.kt:728 */
   81    117   
        if !formatted_2.is_empty() {
         118  +
            /* HttpBindingGenerator.kt:729 */
   82    119   
            let header_value = formatted_2;
   83         -
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         120  +
            let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   84    121   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   85    122   
                    "foo",
   86    123   
                    format!(
   87    124   
                        "`{}` cannot be used as a header value: {}",
   88    125   
                        &header_value, err
   89    126   
                    ),
   90    127   
                )
   91    128   
            })?;
   92    129   
            builder = builder.header("X-Foo", header_value);
         130  +
            /* HttpBindingGenerator.kt:728 */
   93    131   
        }
         132  +
        /* HttpBindingGenerator.kt:615 */
   94    133   
    }
         134  +
    /* HttpBindingGenerator.kt:578 */
   95    135   
    Ok(builder)
         136  +
    /* HttpBindingGenerator.kt:565 */
   96    137   
}

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

@@ -1,1 +21,27 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:236 */
    2      3   
pub fn de_blob_payload(
    3      4   
    body: &mut ::aws_smithy_types::body::SdkBody,
    4      5   
) -> std::result::Result<
    5      6   
    ::aws_smithy_types::byte_stream::ByteStream,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
> {
    8         -
    // replace the body with an empty body
           9  +
    /* HttpBindingGenerator.kt:322 */// replace the body with an empty body
    9     10   
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
   10     11   
    Ok(::aws_smithy_types::byte_stream::ByteStream::new(body))
          12  +
    /* HttpBindingGenerator.kt:236 */
   11     13   
}
   12     14   
          15  +
/* HttpBindingGenerator.kt:159 */
   13     16   
pub(crate) fn de_foo_header(
   14     17   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   15     18   
) -> ::std::result::Result<
   16     19   
    ::std::option::Option<::std::string::String>,
   17     20   
    ::aws_smithy_http::header::ParseError,
   18     21   
> {
          22  +
    /* HttpBindingGenerator.kt:166 */
   19     23   
    let headers = header_map.get_all("X-Foo");
          24  +
    /* HttpBindingGenerator.kt:398 */
   20     25   
    ::aws_smithy_http::header::one_or_none(headers)
          26  +
    /* HttpBindingGenerator.kt:159 */
   21     27   
}

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

@@ -1,1 +9,15 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBoundProtocolPayloadGenerator.kt:309 */
    2      3   
pub fn ser_blob_http_payload(
    3      4   
    payload: ::aws_smithy_types::byte_stream::ByteStream,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::aws_smithy_types::byte_stream::ByteStream,
    6      7   
    ::aws_smithy_types::error::operation::BuildError,
    7      8   
> {
    8         -
    Ok(payload)
           9  +
    /* HttpBoundProtocolPayloadGenerator.kt:343 */
          10  +
    Ok(
          11  +
        /* HttpBoundProtocolPayloadGenerator.kt:372 */
          12  +
        payload, /* HttpBoundProtocolPayloadGenerator.kt:343 */
          13  +
    )
          14  +
    /* HttpBoundProtocolPayloadGenerator.kt:309 */
    9     15   
}

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

@@ -1,1 +66,98 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_streaming_traits_require_length_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::StreamingTraitsRequireLengthInput,
    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         -
    B: Into<::aws_smithy_types::byte_stream::ByteStream>,
          13  +
    B: ::http_body_1x::Body<Data = ::bytes::Bytes>
          14  +
        + ::std::marker::Send
          15  +
        + ::std::marker::Sync
          16  +
        + 'static,
          17  +
    B::Error: Into<::aws_smithy_types::body::Error> + 'static,
          18  +
   12     19   
    B::Data: Send,
   13     20   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   14     21   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   15     22   
{
          23  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
   16     24   
    Ok({
          25  +
        /* RustType.kt:534 */
   17     26   
        #[allow(unused_mut)]
          27  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   18     28   
        let mut input = crate::input::streaming_traits_require_length_input::Builder::default();
          29  +
        /* RustType.kt:534 */
   19     30   
        #[allow(unused_variables)]
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   20     32   
        let ::aws_smithy_runtime_api::http::RequestParts {
   21     33   
            uri, headers, body, ..
   22     34   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   23     36   
        if let Some(value) = {
   24         -
            Some(crate::protocol_serde::shape_streaming_traits_require_length_input::de_blob_payload(&mut body.into().into_inner())?)
          37  +
            Some(crate::protocol_serde::shape_streaming_traits_require_length_input::de_blob_payload(&mut ::aws_smithy_types::body::SdkBody::from_body_1_x(body))?)
   25     38   
        } {
   26     39   
            input = input.set_blob(value)
   27     40   
        }
          41  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   28     42   
        if let Some(value) =
   29     43   
            crate::protocol_serde::shape_streaming_traits_require_length_input::de_foo_header(
   30     44   
                &headers,
   31     45   
            )?
   32     46   
        {
   33     47   
            input = input.set_foo(Some(value))
   34     48   
        }
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   35     50   
        input.build()
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   36     52   
    })
          53  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   37     54   
}
   38     55   
          56  +
/* RustType.kt:534 */
   39     57   
#[allow(clippy::unnecessary_wraps)]
          58  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   40     59   
pub fn ser_streaming_traits_require_length_http_response(
   41     60   
    #[allow(unused_variables)] output: crate::output::StreamingTraitsRequireLengthOutput,
   42     61   
) -> std::result::Result<
   43     62   
    ::aws_smithy_http_server::response::Response,
   44     63   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   45     64   
> {
          65  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   46     66   
    Ok({
          67  +
        /* RustType.kt:534 */
   47     68   
        #[allow(unused_mut)]
   48         -
        let mut builder = ::http::Response::builder();
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          70  +
        let mut builder = ::http_1x::Response::builder();
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   49     72   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   50     73   
            builder,
   51         -
            ::http::header::CONTENT_TYPE,
          74  +
            ::http_1x::header::CONTENT_TYPE,
   52     75   
            "application/json",
   53     76   
        );
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   54     78   
        let http_status: u16 = 200;
   55     79   
        builder = builder.status(http_status);
   56         -
        let payload = "";
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          81  +
        let payload =
          82  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   57     85   
        let content_length = payload.len();
   58     86   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   59     87   
            builder,
   60         -
            ::http::header::CONTENT_LENGTH,
          88  +
            ::http_1x::header::CONTENT_LENGTH,
   61     89   
            content_length,
   62     90   
        );
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   63     92   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          93  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   64     94   
        builder.body(body)?
          95  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   65     96   
    })
          97  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   66     98   
}

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

@@ -1,1 +21,27 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:236 */
    2      3   
pub fn de_blob_payload(
    3      4   
    body: &mut ::aws_smithy_types::body::SdkBody,
    4      5   
) -> std::result::Result<
    5      6   
    ::aws_smithy_types::byte_stream::ByteStream,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
> {
    8         -
    // replace the body with an empty body
           9  +
    /* HttpBindingGenerator.kt:322 */// replace the body with an empty body
    9     10   
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
   10     11   
    Ok(::aws_smithy_types::byte_stream::ByteStream::new(body))
          12  +
    /* HttpBindingGenerator.kt:236 */
   11     13   
}
   12     14   
          15  +
/* HttpBindingGenerator.kt:159 */
   13     16   
pub(crate) fn de_foo_header(
   14     17   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   15     18   
) -> ::std::result::Result<
   16     19   
    ::std::option::Option<::std::string::String>,
   17     20   
    ::aws_smithy_http::header::ParseError,
   18     21   
> {
          22  +
    /* HttpBindingGenerator.kt:166 */
   19     23   
    let headers = header_map.get_all("X-Foo");
          24  +
    /* HttpBindingGenerator.kt:398 */
   20     25   
    ::aws_smithy_http::header::one_or_none(headers)
          26  +
    /* HttpBindingGenerator.kt:159 */
   21     27   
}

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

@@ -1,1 +88,128 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_streaming_traits_with_media_type_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::StreamingTraitsWithMediaTypeInput,
    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         -
    B: Into<::aws_smithy_types::byte_stream::ByteStream>,
          13  +
    B: ::http_body_1x::Body<Data = ::bytes::Bytes>
          14  +
        + ::std::marker::Send
          15  +
        + ::std::marker::Sync
          16  +
        + 'static,
          17  +
    B::Error: Into<::aws_smithy_types::body::Error> + 'static,
          18  +
   12     19   
    B::Data: Send,
   13     20   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   14     21   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   15     22   
{
          23  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
   16     24   
    Ok({
          25  +
        /* RustType.kt:534 */
   17     26   
        #[allow(unused_mut)]
          27  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   18     28   
        let mut input = crate::input::streaming_traits_with_media_type_input::Builder::default();
          29  +
        /* RustType.kt:534 */
   19     30   
        #[allow(unused_variables)]
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   20     32   
        let ::aws_smithy_runtime_api::http::RequestParts {
   21     33   
            uri, headers, body, ..
   22     34   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   23     36   
        if let Some(value) = {
   24         -
            Some(crate::protocol_serde::shape_streaming_traits_with_media_type_input::de_blob_payload(&mut body.into().into_inner())?)
          37  +
            Some(crate::protocol_serde::shape_streaming_traits_with_media_type_input::de_blob_payload(&mut ::aws_smithy_types::body::SdkBody::from_body_1_x(body))?)
   25     38   
        } {
   26     39   
            input = input.set_blob(value)
   27     40   
        }
          41  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   28     42   
        if let Some(value) =
   29     43   
            crate::protocol_serde::shape_streaming_traits_with_media_type_input::de_foo_header(
   30     44   
                &headers,
   31     45   
            )?
   32     46   
        {
   33     47   
            input = input.set_foo(Some(value))
   34     48   
        }
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   35     50   
        input.build()
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   36     52   
    })
          53  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   37     54   
}
   38     55   
          56  +
/* RustType.kt:534 */
   39     57   
#[allow(clippy::unnecessary_wraps)]
          58  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   40     59   
pub fn ser_streaming_traits_with_media_type_http_response(
   41     60   
    #[allow(unused_variables)] output: crate::output::StreamingTraitsWithMediaTypeOutput,
   42     61   
) -> std::result::Result<
   43     62   
    ::aws_smithy_http_server::response::Response,
   44     63   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   45     64   
> {
          65  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   46     66   
    Ok({
          67  +
        /* RustType.kt:534 */
   47     68   
        #[allow(unused_mut)]
   48         -
        let mut builder = ::http::Response::builder();
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          70  +
        let mut builder = ::http_1x::Response::builder();
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:665 */
   49     72   
        builder = crate::protocol_serde::shape_streaming_traits_with_media_type::ser_streaming_traits_with_media_type_headers(&output, builder)?;
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   50     74   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   51     75   
            builder,
   52         -
            ::http::header::CONTENT_TYPE,
          76  +
            ::http_1x::header::CONTENT_TYPE,
   53     77   
            "text/plain",
   54     78   
        );
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   55     80   
        let http_status: u16 = 200;
   56     81   
        builder = builder.status(http_status);
   57         -
        let body = ::aws_smithy_http_server::body::boxed(::aws_smithy_http_server::body::Body::wrap_stream(
   58         -
            ::aws_smithy_http::futures_stream_adapter::FuturesStreamCompatByteStream::new(
   59         -
                crate::protocol_serde::shape_streaming_traits_with_media_type_output::ser_blob_http_payload( output.blob)?
   60         -
            )
   61         -
        ));
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
          83  +
        let body = ::aws_smithy_http_server::body::boxed(::aws_smithy_http_server::body::wrap_stream(
          84  +
            /* ServerProtocolLoader.kt:42 */::aws_smithy_http::futures_stream_adapter::FuturesStreamCompatByteStream::new(
          85  +
                /* HttpBoundProtocolPayloadGenerator.kt:348 */crate::protocol_serde::shape_streaming_traits_with_media_type_output::ser_blob_http_payload( output.blob)?
          86  +
            /* ServerProtocolLoader.kt:42 */)
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */));
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   62     89   
        builder.body(body)?
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   63     91   
    })
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   64     93   
}
   65     94   
          95  +
/* HttpBindingGenerator.kt:565 */
   66     96   
pub fn ser_streaming_traits_with_media_type_headers(
   67     97   
    input: &crate::output::StreamingTraitsWithMediaTypeOutput,
   68         -
    mut builder: ::http::response::Builder,
   69         -
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
   70         -
{
          98  +
    mut builder: ::http_1x::response::Builder,
          99  +
) -> std::result::Result<
         100  +
    ::http_1x::response::Builder,
         101  +
    ::aws_smithy_types::error::operation::BuildError,
         102  +
> {
         103  +
    /* HttpBindingGenerator.kt:615 */
   71    104   
    if let ::std::option::Option::Some(inner_1) = &input.foo {
         105  +
        /* HttpBindingGenerator.kt:727 */
   72    106   
        let formatted_2 = inner_1.as_str();
         107  +
        /* HttpBindingGenerator.kt:728 */
   73    108   
        if !formatted_2.is_empty() {
         109  +
            /* HttpBindingGenerator.kt:729 */
   74    110   
            let header_value = formatted_2;
   75         -
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         111  +
            let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   76    112   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   77    113   
                    "foo",
   78    114   
                    format!(
   79    115   
                        "`{}` cannot be used as a header value: {}",
   80    116   
                        &header_value, err
   81    117   
                    ),
   82    118   
                )
   83    119   
            })?;
   84    120   
            builder = builder.header("X-Foo", header_value);
         121  +
            /* HttpBindingGenerator.kt:728 */
   85    122   
        }
         123  +
        /* HttpBindingGenerator.kt:615 */
   86    124   
    }
         125  +
    /* HttpBindingGenerator.kt:578 */
   87    126   
    Ok(builder)
         127  +
    /* HttpBindingGenerator.kt:565 */
   88    128   
}

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

@@ -1,1 +21,27 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:236 */
    2      3   
pub fn de_blob_payload(
    3      4   
    body: &mut ::aws_smithy_types::body::SdkBody,
    4      5   
) -> std::result::Result<
    5      6   
    ::aws_smithy_types::byte_stream::ByteStream,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
> {
    8         -
    // replace the body with an empty body
           9  +
    /* HttpBindingGenerator.kt:322 */// replace the body with an empty body
    9     10   
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
   10     11   
    Ok(::aws_smithy_types::byte_stream::ByteStream::new(body))
          12  +
    /* HttpBindingGenerator.kt:236 */
   11     13   
}
   12     14   
          15  +
/* HttpBindingGenerator.kt:159 */
   13     16   
pub(crate) fn de_foo_header(
   14     17   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   15     18   
) -> ::std::result::Result<
   16     19   
    ::std::option::Option<::std::string::String>,
   17     20   
    ::aws_smithy_http::header::ParseError,
   18     21   
> {
          22  +
    /* HttpBindingGenerator.kt:166 */
   19     23   
    let headers = header_map.get_all("X-Foo");
          24  +
    /* HttpBindingGenerator.kt:398 */
   20     25   
    ::aws_smithy_http::header::one_or_none(headers)
          26  +
    /* HttpBindingGenerator.kt:159 */
   21     27   
}