Server Test

Server Test

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943 (ignoring whitespace)

Files changed:

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

@@ -1,1 +10,14 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:153 */
    2      3   
pub(crate) fn de_encoding_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::option::Option<::std::string::String>,
    6      7   
    ::aws_smithy_http::header::ParseError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:160 */
    8     10   
    let headers = header_map.get_all("Content-Encoding");
          11  +
    /* HttpBindingGenerator.kt:375 */
    9     12   
    ::aws_smithy_http::header::one_or_none(headers)
          13  +
    /* HttpBindingGenerator.kt:153 */
   10     14   
}

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

@@ -1,1 +66,96 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_query_idempotency_token_auto_fill_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::QueryIdempotencyTokenAutoFillInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::query_idempotency_token_auto_fill_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:1073 */
   22     30   
        let query_string = uri.query().unwrap_or("");
   23     31   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:1099 */
   24     33   
        let mut token_seen = false;
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:1105 */
   25     35   
        for (k, v) in pairs {
          36  +
            /* ServerHttpBoundProtocolGenerator.kt:1109 */
   26     37   
            if !token_seen && k == "token" {
   27     38   
                input = input.set_token(
   28     39   
                    crate::protocol_serde::shape_query_idempotency_token_auto_fill_input::de_token(
   29     40   
                        &v,
   30     41   
                    )?,
   31     42   
                );
   32     43   
                token_seen = true;
   33     44   
            }
          45  +
            /* ServerHttpBoundProtocolGenerator.kt:1105 */
   34     46   
        }
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   35     48   
        input.build()
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   36     50   
    })
          51  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   37     52   
}
   38     53   
          54  +
/* RustType.kt:516 */
   39     55   
#[allow(clippy::unnecessary_wraps)]
          56  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   40     57   
pub fn ser_query_idempotency_token_auto_fill_http_response(
   41     58   
    #[allow(unused_variables)] output: crate::output::QueryIdempotencyTokenAutoFillOutput,
   42     59   
) -> std::result::Result<
   43     60   
    ::aws_smithy_http_server::response::Response,
   44     61   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   45     62   
> {
          63  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   46     64   
    Ok({
          65  +
        /* RustType.kt:516 */
   47     66   
        #[allow(unused_mut)]
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   48     68   
        let mut builder = ::http::Response::builder();
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   49     70   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   50     71   
            builder,
   51     72   
            ::http::header::CONTENT_TYPE,
   52     73   
            "application/json",
   53     74   
        );
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   54     76   
        let http_status: u16 = 200;
   55     77   
        builder = builder.status(http_status);
   56         -
        let payload = "";
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          79  +
        let payload =
          80  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   57     83   
        let content_length = payload.len();
   58     84   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   59     85   
            builder,
   60     86   
            ::http::header::CONTENT_LENGTH,
   61     87   
            content_length,
   62     88   
        );
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   63     90   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   64     92   
        builder.body(body)?
          93  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   65     94   
    })
          95  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   66     96   
}

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

@@ -1,1 +10,14 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
    2      3   
pub fn de_token(
    3      4   
    value: &str,
    4      5   
) -> std::result::Result<
    5      6   
    ::std::option::Option<::std::string::String>,
    6      7   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    7      8   
> {
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1309 */
    8     10   
    let value = value.to_owned();
          11  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
    9     12   
    Ok(Some(value))
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   10     14   
}

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

@@ -1,1 +71,109 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_query_params_as_string_list_map_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::QueryParamsAsStringListMapInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::query_params_as_string_list_map_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:1073 */
   22     30   
        let query_string = uri.query().unwrap_or("");
   23     31   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
   24         -
        let mut query_params: ::std::collections::HashMap<
   25         -
            ::std::string::String,
   26         -
            ::std::vec::Vec<::std::string::String>,
   27         -
        > = ::std::collections::HashMap::new();
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:1088 */
          33  +
        let mut query_params: ::std::collections::HashMap::<::std::string::String, ::std::vec::Vec::<::std::string::String>> =
          34  +
            /* ServerHttpBoundProtocolGenerator.kt:1090 */::std::collections::HashMap::new()
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:1088 */;
          36  +
        /* ServerHttpBoundProtocolGenerator.kt:1099 */
   28     37   
        let mut qux_seen = false;
          38  +
        /* ServerHttpBoundProtocolGenerator.kt:1105 */
   29     39   
        for (k, v) in pairs {
          40  +
            /* ServerHttpBoundProtocolGenerator.kt:1109 */
   30     41   
            if !qux_seen && k == "corge" {
   31     42   
                input = input.set_qux(
   32     43   
                    crate::protocol_serde::shape_query_params_as_string_list_map_input::de_qux(&v)?,
   33     44   
                );
   34     45   
                qux_seen = true;
   35     46   
            }
          47  +
            /* ServerHttpBoundProtocolGenerator.kt:1197 */
   36     48   
            let entry = query_params.entry(String::from(k)).or_default();
   37     49   
            entry.push(String::from(v));
          50  +
            /* ServerHttpBoundProtocolGenerator.kt:1105 */
   38     51   
        }
   39         -
        input = input.set_foo(Some(query_params));
          52  +
        /* ServerHttpBoundProtocolGenerator.kt:1213 */
          53  +
        input = input.set_foo(
          54  +
            /* ServerHttpBoundProtocolGenerator.kt:1214 */
          55  +
            Some(
          56  +
                /* ServerHttpBoundProtocolGenerator.kt:1215 */
          57  +
                query_params, /* ServerHttpBoundProtocolGenerator.kt:1214 */
          58  +
            ), /* ServerHttpBoundProtocolGenerator.kt:1213 */
          59  +
        );
          60  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   40     61   
        input.build()
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   41     63   
    })
          64  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   42     65   
}
   43     66   
          67  +
/* RustType.kt:516 */
   44     68   
#[allow(clippy::unnecessary_wraps)]
          69  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   45     70   
pub fn ser_query_params_as_string_list_map_http_response(
   46     71   
    #[allow(unused_variables)] output: crate::output::QueryParamsAsStringListMapOutput,
   47     72   
) -> std::result::Result<
   48     73   
    ::aws_smithy_http_server::response::Response,
   49     74   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   50     75   
> {
          76  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   51     77   
    Ok({
          78  +
        /* RustType.kt:516 */
   52     79   
        #[allow(unused_mut)]
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   53     81   
        let mut builder = ::http::Response::builder();
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   54     83   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   55     84   
            builder,
   56     85   
            ::http::header::CONTENT_TYPE,
   57     86   
            "application/json",
   58     87   
        );
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   59     89   
        let http_status: u16 = 200;
   60     90   
        builder = builder.status(http_status);
   61         -
        let payload = "";
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          92  +
        let payload =
          93  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          94  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          95  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   62     96   
        let content_length = payload.len();
   63     97   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   64     98   
            builder,
   65     99   
            ::http::header::CONTENT_LENGTH,
   66    100   
            content_length,
   67    101   
        );
         102  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   68    103   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
         104  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   69    105   
        builder.body(body)?
         106  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   70    107   
    })
         108  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   71    109   
}

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

@@ -1,1 +10,14 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
    2      3   
pub fn de_qux(
    3      4   
    value: &str,
    4      5   
) -> std::result::Result<
    5      6   
    ::std::option::Option<::std::string::String>,
    6      7   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    7      8   
> {
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1309 */
    8     10   
    let value = value.to_owned();
          11  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
    9     12   
    Ok(Some(value))
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   10     14   
}

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

@@ -1,1 +72,110 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_query_precedence_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::QueryPrecedenceInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::query_precedence_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:1073 */
   22     30   
        let query_string = uri.query().unwrap_or("");
   23     31   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
   24         -
        let mut query_params: ::std::collections::HashMap<
   25         -
            ::std::string::String,
   26         -
            ::std::string::String,
   27         -
        > = ::std::collections::HashMap::new();
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:1088 */
          33  +
        let mut query_params: ::std::collections::HashMap::<::std::string::String, ::std::string::String> =
          34  +
            /* ServerHttpBoundProtocolGenerator.kt:1090 */::std::collections::HashMap::new()
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:1088 */;
          36  +
        /* ServerHttpBoundProtocolGenerator.kt:1099 */
   28     37   
        let mut foo_seen = false;
          38  +
        /* ServerHttpBoundProtocolGenerator.kt:1105 */
   29     39   
        for (k, v) in pairs {
          40  +
            /* ServerHttpBoundProtocolGenerator.kt:1109 */
   30     41   
            if !foo_seen && k == "bar" {
   31     42   
                input = input.set_foo(crate::protocol_serde::shape_query_precedence_input::de_foo(
   32     43   
                    &v,
   33     44   
                )?);
   34     45   
                foo_seen = true;
   35     46   
            }
          47  +
            /* ServerHttpBoundProtocolGenerator.kt:1180 */
   36     48   
            query_params
   37     49   
                .entry(String::from(k))
   38     50   
                .or_insert_with(|| String::from(v));
          51  +
            /* ServerHttpBoundProtocolGenerator.kt:1105 */
   39     52   
        }
   40         -
        input = input.set_baz(Some(query_params));
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:1213 */
          54  +
        input = input.set_baz(
          55  +
            /* ServerHttpBoundProtocolGenerator.kt:1214 */
          56  +
            Some(
          57  +
                /* ServerHttpBoundProtocolGenerator.kt:1215 */
          58  +
                query_params, /* ServerHttpBoundProtocolGenerator.kt:1214 */
          59  +
            ), /* ServerHttpBoundProtocolGenerator.kt:1213 */
          60  +
        );
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   41     62   
        input.build()
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   42     64   
    })
          65  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   43     66   
}
   44     67   
          68  +
/* RustType.kt:516 */
   45     69   
#[allow(clippy::unnecessary_wraps)]
          70  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   46     71   
pub fn ser_query_precedence_http_response(
   47     72   
    #[allow(unused_variables)] output: crate::output::QueryPrecedenceOutput,
   48     73   
) -> std::result::Result<
   49     74   
    ::aws_smithy_http_server::response::Response,
   50     75   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   51     76   
> {
          77  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   52     78   
    Ok({
          79  +
        /* RustType.kt:516 */
   53     80   
        #[allow(unused_mut)]
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   54     82   
        let mut builder = ::http::Response::builder();
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   55     84   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   56     85   
            builder,
   57     86   
            ::http::header::CONTENT_TYPE,
   58     87   
            "application/json",
   59     88   
        );
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   60     90   
        let http_status: u16 = 200;
   61     91   
        builder = builder.status(http_status);
   62         -
        let payload = "";
          92  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          93  +
        let payload =
          94  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          95  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          96  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   63     97   
        let content_length = payload.len();
   64     98   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   65     99   
            builder,
   66    100   
            ::http::header::CONTENT_LENGTH,
   67    101   
            content_length,
   68    102   
        );
         103  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   69    104   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
         105  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   70    106   
        builder.body(body)?
         107  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   71    108   
    })
         109  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   72    110   
}

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

@@ -1,1 +10,14 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
    2      3   
pub fn de_foo(
    3      4   
    value: &str,
    4      5   
) -> std::result::Result<
    5      6   
    ::std::option::Option<::std::string::String>,
    6      7   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    7      8   
> {
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1309 */
    8     10   
    let value = value.to_owned();
          11  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
    9     12   
    Ok(Some(value))
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   10     14   
}

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

@@ -1,1 +111,156 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_recursive_shapes_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::RecursiveShapesInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::recursive_shapes_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_recursive_shapes::de_recursive_shapes(
   29     39   
                bytes.as_ref(),
   30     40   
                input,
   31     41   
            )?;
          42  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   32     43   
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   33     45   
        input.build()
          46  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   34     47   
    })
          48  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   35     49   
}
   36     50   
          51  +
/* RustType.kt:516 */
   37     52   
#[allow(clippy::unnecessary_wraps)]
          53  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   38     54   
pub fn ser_recursive_shapes_http_response(
   39     55   
    #[allow(unused_variables)] output: crate::output::RecursiveShapesOutput,
   40     56   
) -> std::result::Result<
   41     57   
    ::aws_smithy_http_server::response::Response,
   42     58   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   43     59   
> {
          60  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   44     61   
    Ok({
          62  +
        /* RustType.kt:516 */
   45     63   
        #[allow(unused_mut)]
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   46     65   
        let mut builder = ::http::Response::builder();
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   47     67   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   48     68   
            builder,
   49     69   
            ::http::header::CONTENT_TYPE,
   50     70   
            "application/json",
   51     71   
        );
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   52     73   
        let http_status: u16 = 200;
   53     74   
        builder = builder.status(http_status);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   54     76   
        let payload =
   55         -
            crate::protocol_serde::shape_recursive_shapes_output::ser_recursive_shapes_output_output_output(&output)?
   56         -
        ;
          77  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_recursive_shapes_output::ser_recursive_shapes_output_output_output(&output)?
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   57     80   
        let content_length = payload.len();
   58     81   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   59     82   
            builder,
   60     83   
            ::http::header::CONTENT_LENGTH,
   61     84   
            content_length,
   62     85   
        );
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   63     87   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   64     89   
        builder.body(body)?
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   65     91   
    })
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   66     93   
}
   67     94   
          95  +
/* JsonParserGenerator.kt:148 */
   68     96   
pub(crate) fn de_recursive_shapes(
   69     97   
    value: &[u8],
   70     98   
    mut builder: crate::input::recursive_shapes_input::Builder,
   71     99   
) -> ::std::result::Result<
   72    100   
    crate::input::recursive_shapes_input::Builder,
   73    101   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   74    102   
> {
         103  +
    /* JsonParserGenerator.kt:153 */
   75    104   
    let mut tokens_owned =
   76    105   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
   77    106   
            .peekable();
   78    107   
    let tokens = &mut tokens_owned;
   79    108   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         109  +
    /* JsonParserGenerator.kt:684 */
   80    110   
    loop {
         111  +
        /* JsonParserGenerator.kt:685 */
   81    112   
        match tokens.next().transpose()? {
         113  +
            /* JsonParserGenerator.kt:686 */
   82    114   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   83    115   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         116  +
                /* JsonParserGenerator.kt:260 */
   84    117   
                match key.to_unescaped()?.as_ref() {
         118  +
                    /* JsonParserGenerator.kt:262 */
   85    119   
                    "nested" => {
         120  +
                        /* JsonParserGenerator.kt:272 */
   86    121   
                        builder = builder.set_nested(
   87         -
                            crate::protocol_serde::shape_recursive_shapes_input_output_nested1::de_recursive_shapes_input_output_nested1(tokens)?
   88         -
                        );
         122  +
                            /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_recursive_shapes_input_output_nested1::de_recursive_shapes_input_output_nested1(tokens)?
         123  +
                        /* JsonParserGenerator.kt:272 */);
         124  +
                        /* JsonParserGenerator.kt:262 */
   89    125   
                    }
   90         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         126  +
                    /* JsonParserGenerator.kt:290 */
         127  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   91    128   
                }
         129  +
                /* JsonParserGenerator.kt:686 */
   92    130   
            }
         131  +
            /* JsonParserGenerator.kt:695 */
   93    132   
            other => {
   94    133   
                return Err(
   95    134   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   96    135   
                        "expected object key or end object, found: {:?}",
   97    136   
                        other
   98    137   
                    )),
   99    138   
                )
         139  +
            } /* JsonParserGenerator.kt:685 */
  100    140   
        }
         141  +
        /* JsonParserGenerator.kt:684 */
  101    142   
    }
  102         -
    }
         143  +
    /* JsonParserGenerator.kt:250 */
  103    144   
    if tokens.next().is_some() {
         145  +
        /* JsonParserGenerator.kt:251 */
  104    146   
        return Err(
  105    147   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  106    148   
                "found more JSON tokens after completing parsing",
  107    149   
            ),
  108    150   
        );
         151  +
        /* JsonParserGenerator.kt:250 */
  109    152   
    }
         153  +
    /* JsonParserGenerator.kt:163 */
  110    154   
    Ok(builder)
         155  +
    /* JsonParserGenerator.kt:148 */
  111    156   
}

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

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

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

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

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

@@ -1,1 +26,40 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_recursive_shapes_output_output_output(
    3      4   
    value: &crate::output::RecursiveShapesOutput,
    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_recursive_shapes_output::ser_recursive_shapes_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_recursive_shapes_output_output(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::output::RecursiveShapesOutput,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:382 */
   19     26   
    if let Some(var_1) = &input.nested {
          27  +
        /* JsonSerializerGenerator.kt:495 */
   20     28   
        #[allow(unused_mut)]
          29  +
        /* JsonSerializerGenerator.kt:496 */
   21     30   
        let mut object_2 = object.key("nested").start_object();
          31  +
        /* JsonSerializerGenerator.kt:375 */
   22     32   
        crate::protocol_serde::shape_recursive_shapes_input_output_nested1::ser_recursive_shapes_input_output_nested1(&mut object_2, var_1)?;
          33  +
        /* JsonSerializerGenerator.kt:515 */
   23     34   
        object_2.finish();
          35  +
        /* JsonSerializerGenerator.kt:382 */
   24     36   
    }
          37  +
    /* JsonSerializerGenerator.kt:372 */
   25     38   
    Ok(())
          39  +
    /* JsonSerializerGenerator.kt:358 */
   26     40   
}

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

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

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

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

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

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

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

@@ -1,1 +212,304 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_simple_scalar_properties_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::SimpleScalarPropertiesInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::simple_scalar_properties_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input =
   29     39   
                crate::protocol_serde::shape_simple_scalar_properties::de_simple_scalar_properties(
   30     40   
                    bytes.as_ref(),
   31     41   
                    input,
   32     42   
                )?;
          43  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   33     44   
        }
          45  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   34     46   
        if let Some(value) =
   35     47   
            crate::protocol_serde::shape_simple_scalar_properties_input::de_foo_header(&headers)?
   36     48   
        {
   37     49   
            input = input.set_foo(Some(value))
   38     50   
        }
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   39     52   
        input.build()
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   40     54   
    })
          55  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   41     56   
}
   42     57   
          58  +
/* RustType.kt:516 */
   43     59   
#[allow(clippy::unnecessary_wraps)]
          60  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   44     61   
pub fn ser_simple_scalar_properties_http_response(
   45     62   
    #[allow(unused_variables)] output: crate::output::SimpleScalarPropertiesOutput,
   46     63   
) -> std::result::Result<
   47     64   
    ::aws_smithy_http_server::response::Response,
   48     65   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   49     66   
> {
          67  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   50     68   
    Ok({
          69  +
        /* RustType.kt:516 */
   51     70   
        #[allow(unused_mut)]
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   52     72   
        let mut builder = ::http::Response::builder();
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:629 */
   53     74   
        builder = crate::protocol_serde::shape_simple_scalar_properties::ser_simple_scalar_properties_headers(&output, builder)?;
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   54     76   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   55     77   
            builder,
   56     78   
            ::http::header::CONTENT_TYPE,
   57     79   
            "application/json",
   58     80   
        );
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   59     82   
        let http_status: u16 = 200;
   60     83   
        builder = builder.status(http_status);
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   61     85   
        let payload =
   62         -
            crate::protocol_serde::shape_simple_scalar_properties_output::ser_simple_scalar_properties_output_output_output(&output)?
   63         -
        ;
          86  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_simple_scalar_properties_output::ser_simple_scalar_properties_output_output_output(&output)?
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   64     89   
        let content_length = payload.len();
   65     90   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   66     91   
            builder,
   67     92   
            ::http::header::CONTENT_LENGTH,
   68     93   
            content_length,
   69     94   
        );
          95  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   70     96   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          97  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   71     98   
        builder.body(body)?
          99  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   72    100   
    })
         101  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   73    102   
}
   74    103   
         104  +
/* JsonParserGenerator.kt:148 */
   75    105   
pub(crate) fn de_simple_scalar_properties(
   76    106   
    value: &[u8],
   77    107   
    mut builder: crate::input::simple_scalar_properties_input::Builder,
   78    108   
) -> ::std::result::Result<
   79    109   
    crate::input::simple_scalar_properties_input::Builder,
   80    110   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   81    111   
> {
         112  +
    /* JsonParserGenerator.kt:153 */
   82    113   
    let mut tokens_owned =
   83    114   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
   84    115   
            .peekable();
   85    116   
    let tokens = &mut tokens_owned;
   86    117   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         118  +
    /* JsonParserGenerator.kt:684 */
   87    119   
    loop {
         120  +
        /* JsonParserGenerator.kt:685 */
   88    121   
        match tokens.next().transpose()? {
         122  +
            /* JsonParserGenerator.kt:686 */
   89    123   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   90    124   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         125  +
                /* JsonParserGenerator.kt:260 */
   91    126   
                match key.to_unescaped()?.as_ref() {
         127  +
                    /* JsonParserGenerator.kt:262 */
   92    128   
                    "byteValue" => {
         129  +
                        /* JsonParserGenerator.kt:272 */
   93    130   
                        builder = builder.set_byte_value(
         131  +
                            /* JsonParserGenerator.kt:365 */
   94    132   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
   95    133   
                                tokens.next(),
   96    134   
                            )?
   97    135   
                            .map(i8::try_from)
   98         -
                            .transpose()?,
         136  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
   99    137   
                        );
         138  +
                        /* JsonParserGenerator.kt:262 */
  100    139   
                    }
         140  +
                    /* JsonParserGenerator.kt:262 */
  101    141   
                    "DoubleDribble" => {
         142  +
                        /* JsonParserGenerator.kt:272 */
  102    143   
                        builder = builder.set_double_value(
         144  +
                            /* JsonParserGenerator.kt:363 */
  103    145   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
  104    146   
                                tokens.next(),
  105    147   
                            )?
  106         -
                            .map(|v| v.to_f64_lossy()),
         148  +
                            .map(|v| v.to_f64_lossy()), /* JsonParserGenerator.kt:272 */
  107    149   
                        );
         150  +
                        /* JsonParserGenerator.kt:262 */
  108    151   
                    }
         152  +
                    /* JsonParserGenerator.kt:262 */
  109    153   
                    "falseBooleanValue" => {
         154  +
                        /* JsonParserGenerator.kt:272 */
  110    155   
                        builder = builder.set_false_boolean_value(
         156  +
                            /* JsonParserGenerator.kt:298 */
  111    157   
                            ::aws_smithy_json::deserialize::token::expect_bool_or_null(
  112    158   
                                tokens.next(),
  113         -
                            )?,
         159  +
                            )?, /* JsonParserGenerator.kt:272 */
  114    160   
                        );
         161  +
                        /* JsonParserGenerator.kt:262 */
  115    162   
                    }
         163  +
                    /* JsonParserGenerator.kt:262 */
  116    164   
                    "floatValue" => {
         165  +
                        /* JsonParserGenerator.kt:272 */
  117    166   
                        builder = builder.set_float_value(
         167  +
                            /* JsonParserGenerator.kt:361 */
  118    168   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
  119    169   
                                tokens.next(),
  120    170   
                            )?
  121         -
                            .map(|v| v.to_f32_lossy()),
         171  +
                            .map(|v| v.to_f32_lossy()), /* JsonParserGenerator.kt:272 */
  122    172   
                        );
         173  +
                        /* JsonParserGenerator.kt:262 */
  123    174   
                    }
         175  +
                    /* JsonParserGenerator.kt:262 */
  124    176   
                    "integerValue" => {
         177  +
                        /* JsonParserGenerator.kt:272 */
  125    178   
                        builder = builder.set_integer_value(
         179  +
                            /* JsonParserGenerator.kt:365 */
  126    180   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
  127    181   
                                tokens.next(),
  128    182   
                            )?
  129    183   
                            .map(i32::try_from)
  130         -
                            .transpose()?,
         184  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  131    185   
                        );
         186  +
                        /* JsonParserGenerator.kt:262 */
  132    187   
                    }
         188  +
                    /* JsonParserGenerator.kt:262 */
  133    189   
                    "longValue" => {
         190  +
                        /* JsonParserGenerator.kt:272 */
  134    191   
                        builder = builder.set_long_value(
         192  +
                            /* JsonParserGenerator.kt:365 */
  135    193   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
  136    194   
                                tokens.next(),
  137    195   
                            )?
  138    196   
                            .map(i64::try_from)
  139         -
                            .transpose()?,
         197  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  140    198   
                        );
         199  +
                        /* JsonParserGenerator.kt:262 */
  141    200   
                    }
         201  +
                    /* JsonParserGenerator.kt:262 */
  142    202   
                    "shortValue" => {
         203  +
                        /* JsonParserGenerator.kt:272 */
  143    204   
                        builder = builder.set_short_value(
         205  +
                            /* JsonParserGenerator.kt:365 */
  144    206   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
  145    207   
                                tokens.next(),
  146    208   
                            )?
  147    209   
                            .map(i16::try_from)
  148         -
                            .transpose()?,
         210  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  149    211   
                        );
         212  +
                        /* JsonParserGenerator.kt:262 */
  150    213   
                    }
         214  +
                    /* JsonParserGenerator.kt:262 */
  151    215   
                    "stringValue" => {
         216  +
                        /* JsonParserGenerator.kt:272 */
  152    217   
                        builder = builder.set_string_value(
         218  +
                            /* JsonParserGenerator.kt:354 */
  153    219   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
  154    220   
                                tokens.next(),
  155    221   
                            )?
  156         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  157         -
                            .transpose()?,
         222  +
                            .map(|s|
         223  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         224  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         225  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         226  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  158    227   
                        );
         228  +
                        /* JsonParserGenerator.kt:262 */
  159    229   
                    }
         230  +
                    /* JsonParserGenerator.kt:262 */
  160    231   
                    "trueBooleanValue" => {
         232  +
                        /* JsonParserGenerator.kt:272 */
  161    233   
                        builder = builder.set_true_boolean_value(
         234  +
                            /* JsonParserGenerator.kt:298 */
  162    235   
                            ::aws_smithy_json::deserialize::token::expect_bool_or_null(
  163    236   
                                tokens.next(),
  164         -
                            )?,
         237  +
                            )?, /* JsonParserGenerator.kt:272 */
  165    238   
                        );
         239  +
                        /* JsonParserGenerator.kt:262 */
  166    240   
                    }
  167         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         241  +
                    /* JsonParserGenerator.kt:290 */
         242  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  168    243   
                }
         244  +
                /* JsonParserGenerator.kt:686 */
  169    245   
            }
         246  +
            /* JsonParserGenerator.kt:695 */
  170    247   
            other => {
  171    248   
                return Err(
  172    249   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  173    250   
                        "expected object key or end object, found: {:?}",
  174    251   
                        other
  175    252   
                    )),
  176    253   
                )
         254  +
            } /* JsonParserGenerator.kt:685 */
  177    255   
        }
         256  +
        /* JsonParserGenerator.kt:684 */
  178    257   
    }
  179         -
    }
         258  +
    /* JsonParserGenerator.kt:250 */
  180    259   
    if tokens.next().is_some() {
         260  +
        /* JsonParserGenerator.kt:251 */
  181    261   
        return Err(
  182    262   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  183    263   
                "found more JSON tokens after completing parsing",
  184    264   
            ),
  185    265   
        );
         266  +
        /* JsonParserGenerator.kt:250 */
  186    267   
    }
         268  +
    /* JsonParserGenerator.kt:163 */
  187    269   
    Ok(builder)
         270  +
    /* JsonParserGenerator.kt:148 */
  188    271   
}
  189    272   
         273  +
/* HttpBindingGenerator.kt:542 */
  190    274   
pub fn ser_simple_scalar_properties_headers(
  191    275   
    input: &crate::output::SimpleScalarPropertiesOutput,
  192    276   
    mut builder: ::http::response::Builder,
  193    277   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
  194    278   
{
         279  +
    /* HttpBindingGenerator.kt:592 */
  195    280   
    if let ::std::option::Option::Some(inner_1) = &input.foo {
         281  +
        /* HttpBindingGenerator.kt:704 */
  196    282   
        let formatted_2 = inner_1.as_str();
         283  +
        /* HttpBindingGenerator.kt:705 */
  197    284   
        if !formatted_2.is_empty() {
         285  +
            /* HttpBindingGenerator.kt:706 */
  198    286   
            let header_value = formatted_2;
  199    287   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  200    288   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  201    289   
                    "foo",
  202    290   
                    format!(
  203    291   
                        "`{}` cannot be used as a header value: {}",
  204    292   
                        &header_value, err
  205    293   
                    ),
  206    294   
                )
  207    295   
            })?;
  208    296   
            builder = builder.header("X-Foo", header_value);
         297  +
            /* HttpBindingGenerator.kt:705 */
  209    298   
        }
         299  +
        /* HttpBindingGenerator.kt:592 */
  210    300   
    }
         301  +
    /* HttpBindingGenerator.kt:555 */
  211    302   
    Ok(builder)
         303  +
    /* HttpBindingGenerator.kt:542 */
  212    304   
}

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

@@ -1,1 +10,14 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:153 */
    2      3   
pub(crate) fn de_foo_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::option::Option<::std::string::String>,
    6      7   
    ::aws_smithy_http::header::ParseError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:160 */
    8     10   
    let headers = header_map.get_all("X-Foo");
          11  +
    /* HttpBindingGenerator.kt:375 */
    9     12   
    ::aws_smithy_http::header::one_or_none(headers)
          13  +
    /* HttpBindingGenerator.kt:153 */
   10     14   
}