Server Test

Server Test

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943

Files changed:

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

@@ -8,8 +67,68 @@
   28     28   
pub(crate) mod shape_put_and_get_inline_documents;
   29     29   
   30     30   
pub(crate) mod shape_put_with_content_encoding;
   31     31   
   32     32   
pub(crate) mod shape_simple_scalar_properties;
   33     33   
   34     34   
pub(crate) mod shape_sparse_nulls_operation;
   35     35   
   36     36   
pub(crate) mod shape_complex_error;
   37     37   
          38  +
/* JsonParserGenerator.kt:227 */
   38     39   
pub(crate) fn or_empty_doc(data: &[u8]) -> &[u8] {
   39     40   
    if data.is_empty() {
   40     41   
        b"{}"
   41     42   
    } else {
   42     43   
        data
   43     44   
    }
   44     45   
}
   45     46   
   46     47   
pub(crate) mod shape_content_type_parameters_output;
   47     48   

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

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

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

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

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

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

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

@@ -1,1 +17,25 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_content_type_parameters_output_output_output(
    3      4   
    value: &crate::output::ContentTypeParametersOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_content_type_parameters_output::ser_content_type_parameters_output_output(&mut object, value)?;
          11  +
    /* JsonSerializerGenerator.kt:227 */
    8     12   
    object.finish();
    9     13   
    Ok(out)
          14  +
    /* JsonSerializerGenerator.kt:213 */
   10     15   
}
   11     16   
          17  +
/* JsonSerializerGenerator.kt:358 */
   12     18   
pub fn ser_content_type_parameters_output_output(
   13     19   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    #[allow(unused_variables)] input: &crate::output::ContentTypeParametersOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* JsonSerializerGenerator.kt:372 */
   16     23   
    Ok(())
          24  +
    /* JsonSerializerGenerator.kt:358 */
   17     25   
}

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

@@ -1,1 +55,78 @@
    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_datetime_offsets_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::DatetimeOffsetsInput,
    7      9   
    ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::datetime_offsets_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:834 */
   22     30   
        input.build()
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   23     32   
    })
          33  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   24     34   
}
   25     35   
          36  +
/* RustType.kt:516 */
   26     37   
#[allow(clippy::unnecessary_wraps)]
          38  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   27     39   
pub fn ser_datetime_offsets_http_response(
   28     40   
    #[allow(unused_variables)] output: crate::output::DatetimeOffsetsOutput,
   29     41   
) -> std::result::Result<
   30     42   
    ::aws_smithy_http_server::response::Response,
   31     43   
    ::aws_smithy_http_server::protocol::aws_json::rejection::ResponseRejection,
   32     44   
> {
          45  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   33     46   
    Ok({
          47  +
        /* RustType.kt:516 */
   34     48   
        #[allow(unused_mut)]
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   35     50   
        let mut builder = ::http::Response::builder();
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   36     52   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   37     53   
            builder,
   38     54   
            ::http::header::CONTENT_TYPE,
   39     55   
            "application/x-amz-json-1.1",
   40     56   
        );
          57  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   41     58   
        let http_status: u16 = 200;
   42     59   
        builder = builder.status(http_status);
          60  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   43     61   
        let payload =
   44         -
            crate::protocol_serde::shape_datetime_offsets_output::ser_datetime_offsets_output_output_output(&output)?
   45         -
        ;
          62  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_datetime_offsets_output::ser_datetime_offsets_output_output_output(&output)?
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   46     65   
        let content_length = payload.len();
   47     66   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   48     67   
            builder,
   49     68   
            ::http::header::CONTENT_LENGTH,
   50     69   
            content_length,
   51     70   
        );
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   52     72   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   53     74   
        builder.body(body)?
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   54     76   
    })
          77  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   55     78   
}

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

@@ -1,1 +25,36 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_datetime_offsets_output_output_output(
    3      4   
    value: &crate::output::DatetimeOffsetsOutput,
    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_datetime_offsets_output::ser_datetime_offsets_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_datetime_offsets_output_output(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::output::DatetimeOffsetsOutput,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:382 */
   19     26   
    if let Some(var_1) = &input.datetime {
          27  +
        /* JsonSerializerGenerator.kt:448 */
   20     28   
        object
   21     29   
            .key("datetime")
   22     30   
            .date_time(var_1, ::aws_smithy_types::date_time::Format::DateTime)?;
          31  +
        /* JsonSerializerGenerator.kt:382 */
   23     32   
    }
          33  +
    /* JsonSerializerGenerator.kt:372 */
   24     34   
    Ok(())
          35  +
    /* JsonSerializerGenerator.kt:358 */
   25     36   
}

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

@@ -1,1 +53,78 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_empty_operation_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::EmptyOperationInput,
    7      9   
    ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::empty_operation_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:834 */
   22     30   
        input.build()
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   23     32   
    })
          33  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   24     34   
}
   25     35   
          36  +
/* RustType.kt:516 */
   26     37   
#[allow(clippy::unnecessary_wraps)]
          38  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   27     39   
pub fn ser_empty_operation_http_response(
   28     40   
    #[allow(unused_variables)] output: crate::output::EmptyOperationOutput,
   29     41   
) -> std::result::Result<
   30     42   
    ::aws_smithy_http_server::response::Response,
   31     43   
    ::aws_smithy_http_server::protocol::aws_json::rejection::ResponseRejection,
   32     44   
> {
          45  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   33     46   
    Ok({
          47  +
        /* RustType.kt:516 */
   34     48   
        #[allow(unused_mut)]
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   35     50   
        let mut builder = ::http::Response::builder();
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   36     52   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   37     53   
            builder,
   38     54   
            ::http::header::CONTENT_TYPE,
   39     55   
            "application/x-amz-json-1.1",
   40     56   
        );
          57  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   41     58   
        let http_status: u16 = 200;
   42     59   
        builder = builder.status(http_status);
   43         -
        let payload = "";
          60  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          61  +
        let payload =
          62  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   44     65   
        let content_length = payload.len();
   45     66   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   46     67   
            builder,
   47     68   
            ::http::header::CONTENT_LENGTH,
   48     69   
            content_length,
   49     70   
        );
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   50     72   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   51     74   
        builder.body(body)?
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   52     76   
    })
          77  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   53     78   
}

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

@@ -1,1 +37,54 @@
    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_empty_struct<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::model::EmptyStruct>,
    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::empty_struct::Builder::default();
          26  +
            /* JsonParserGenerator.kt:682 */
   21     27   
            ::aws_smithy_json::deserialize::token::skip_to_end(tokens)?;
          28  +
            /* JsonParserGenerator.kt:540 */
   22     29   
            Ok(Some(builder.build()))
          30  +
            /* JsonParserGenerator.kt:713 */
   23     31   
        }
   24         -
        _ => Err(
   25         -
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   26         -
                "expected start object or null",
   27         -
            ),
   28         -
        ),
          32  +
        /* JsonParserGenerator.kt:722 */
          33  +
        _ => {
          34  +
            /* JsonParserGenerator.kt:723 */
          35  +
            Err(
          36  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          37  +
                    "expected start object or null",
          38  +
                ),
          39  +
            )
          40  +
            /* JsonParserGenerator.kt:722 */
          41  +
        } /* JsonParserGenerator.kt:712 */
   29     42   
    }
          43  +
    /* JsonParserGenerator.kt:516 */
   30     44   
}
   31     45   
          46  +
/* JsonSerializerGenerator.kt:358 */
   32     47   
pub fn ser_empty_struct(
   33     48   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   34     49   
    #[allow(unused_variables)] input: &crate::model::EmptyStruct,
   35     50   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          51  +
    /* JsonSerializerGenerator.kt:372 */
   36     52   
    Ok(())
          53  +
    /* JsonSerializerGenerator.kt:358 */
   37     54   
}

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

@@ -1,1 +53,78 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_endpoint_operation_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::EndpointOperationInput,
    7      9   
    ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::endpoint_operation_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   22     30   
        input.build()
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   23     32   
    })
          33  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   24     34   
}
   25     35   
          36  +
/* RustType.kt:516 */
   26     37   
#[allow(clippy::unnecessary_wraps)]
          38  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   27     39   
pub fn ser_endpoint_operation_http_response(
   28     40   
    #[allow(unused_variables)] output: crate::output::EndpointOperationOutput,
   29     41   
) -> std::result::Result<
   30     42   
    ::aws_smithy_http_server::response::Response,
   31     43   
    ::aws_smithy_http_server::protocol::aws_json::rejection::ResponseRejection,
   32     44   
> {
          45  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   33     46   
    Ok({
          47  +
        /* RustType.kt:516 */
   34     48   
        #[allow(unused_mut)]
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   35     50   
        let mut builder = ::http::Response::builder();
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   36     52   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   37     53   
            builder,
   38     54   
            ::http::header::CONTENT_TYPE,
   39     55   
            "application/x-amz-json-1.1",
   40     56   
        );
          57  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   41     58   
        let http_status: u16 = 200;
   42     59   
        builder = builder.status(http_status);
   43         -
        let payload = "";
          60  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          61  +
        let payload =
          62  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   44     65   
        let content_length = payload.len();
   45     66   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   46     67   
            builder,
   47     68   
            ::http::header::CONTENT_LENGTH,
   48     69   
            content_length,
   49     70   
        );
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   50     72   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   51     74   
        builder.body(body)?
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   52     76   
    })
          77  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   53     78   
}

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

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

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

@@ -1,1 +58,104 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_error_with_members_error(
    3      4   
    value: &crate::error::ErrorWithMembers,
    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_error_with_members::ser_error_with_members(&mut object, value)?;
          11  +
    /* ServerAwsJson.kt:95 */
    8     12   
    object.key("__type").string("ErrorWithMembers");
          13  +
    /* JsonSerializerGenerator.kt:227 */
    9     14   
    object.finish();
   10     15   
    Ok(out)
          16  +
    /* JsonSerializerGenerator.kt:213 */
   11     17   
}
   12     18   
          19  +
/* JsonSerializerGenerator.kt:358 */
   13     20   
pub fn ser_error_with_members(
   14     21   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   15     22   
    input: &crate::error::ErrorWithMembers,
   16     23   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          24  +
    /* JsonSerializerGenerator.kt:382 */
   17     25   
    if let Some(var_1) = &input.code {
          26  +
        /* JsonSerializerGenerator.kt:423 */
   18     27   
        object.key("Code").string(var_1.as_str());
          28  +
        /* JsonSerializerGenerator.kt:382 */
   19     29   
    }
          30  +
    /* JsonSerializerGenerator.kt:382 */
   20     31   
    if let Some(var_2) = &input.complex_data {
          32  +
        /* JsonSerializerGenerator.kt:495 */
   21     33   
        #[allow(unused_mut)]
          34  +
        /* JsonSerializerGenerator.kt:496 */
   22     35   
        let mut object_3 = object.key("ComplexData").start_object();
          36  +
        /* JsonSerializerGenerator.kt:375 */
   23     37   
        crate::protocol_serde::shape_kitchen_sink::ser_kitchen_sink(&mut object_3, var_2)?;
          38  +
        /* JsonSerializerGenerator.kt:515 */
   24     39   
        object_3.finish();
          40  +
        /* JsonSerializerGenerator.kt:382 */
   25     41   
    }
          42  +
    /* JsonSerializerGenerator.kt:382 */
   26     43   
    if let Some(var_4) = &input.integer_field {
          44  +
        /* JsonSerializerGenerator.kt:432 */
   27     45   
        object.key("IntegerField").number(
   28     46   
            #[allow(clippy::useless_conversion)]
   29     47   
            ::aws_smithy_types::Number::NegInt((*var_4).into()),
   30     48   
        );
          49  +
        /* JsonSerializerGenerator.kt:382 */
   31     50   
    }
          51  +
    /* JsonSerializerGenerator.kt:382 */
   32     52   
    if let Some(var_5) = &input.list_field {
          53  +
        /* JsonSerializerGenerator.kt:484 */
   33     54   
        let mut array_6 = object.key("ListField").start_array();
          55  +
        /* JsonSerializerGenerator.kt:524 */
   34     56   
        for item_7 in var_5 {
          57  +
            /* SerializerUtil.kt:42 */
   35     58   
            {
          59  +
                /* JsonSerializerGenerator.kt:423 */
   36     60   
                array_6.value().string(item_7.as_str());
          61  +
                /* SerializerUtil.kt:42 */
   37     62   
            }
          63  +
            /* JsonSerializerGenerator.kt:524 */
   38     64   
        }
          65  +
        /* JsonSerializerGenerator.kt:486 */
   39     66   
        array_6.finish();
          67  +
        /* JsonSerializerGenerator.kt:382 */
   40     68   
    }
          69  +
    /* JsonSerializerGenerator.kt:382 */
   41     70   
    if let Some(var_8) = &input.map_field {
          71  +
        /* JsonSerializerGenerator.kt:495 */
   42     72   
        #[allow(unused_mut)]
          73  +
        /* JsonSerializerGenerator.kt:496 */
   43     74   
        let mut object_9 = object.key("MapField").start_object();
          75  +
        /* JsonSerializerGenerator.kt:537 */
   44     76   
        for (key_10, value_11) in var_8 {
          77  +
            /* SerializerUtil.kt:42 */
   45     78   
            {
          79  +
                /* JsonSerializerGenerator.kt:423 */
   46     80   
                object_9.key(key_10.as_str()).string(value_11.as_str());
          81  +
                /* SerializerUtil.kt:42 */
   47     82   
            }
          83  +
            /* JsonSerializerGenerator.kt:537 */
   48     84   
        }
          85  +
        /* JsonSerializerGenerator.kt:515 */
   49     86   
        object_9.finish();
          87  +
        /* JsonSerializerGenerator.kt:382 */
   50     88   
    }
          89  +
    /* JsonSerializerGenerator.kt:382 */
   51     90   
    if let Some(var_12) = &input.message {
          91  +
        /* JsonSerializerGenerator.kt:423 */
   52     92   
        object.key("Message").string(var_12.as_str());
          93  +
        /* JsonSerializerGenerator.kt:382 */
   53     94   
    }
          95  +
    /* JsonSerializerGenerator.kt:382 */
   54     96   
    if let Some(var_13) = &input.string_field {
          97  +
        /* JsonSerializerGenerator.kt:423 */
   55     98   
        object.key("StringField").string(var_13.as_str());
          99  +
        /* JsonSerializerGenerator.kt:382 */
   56    100   
    }
         101  +
    /* JsonSerializerGenerator.kt:372 */
   57    102   
    Ok(())
         103  +
    /* JsonSerializerGenerator.kt:358 */
   58    104   
}

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

@@ -1,1 +21,30 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_error_without_members_error(
    3      4   
    value: &crate::error::ErrorWithoutMembers,
    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_error_without_members::ser_error_without_members(
    8     11   
        &mut object,
    9     12   
        value,
   10     13   
    )?;
          14  +
    /* ServerAwsJson.kt:95 */
   11     15   
    object.key("__type").string("ErrorWithoutMembers");
          16  +
    /* JsonSerializerGenerator.kt:227 */
   12     17   
    object.finish();
   13     18   
    Ok(out)
          19  +
    /* JsonSerializerGenerator.kt:213 */
   14     20   
}
   15     21   
          22  +
/* JsonSerializerGenerator.kt:358 */
   16     23   
pub fn ser_error_without_members(
   17     24   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   18     25   
    #[allow(unused_variables)] input: &crate::error::ErrorWithoutMembers,
   19     26   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          27  +
    /* JsonSerializerGenerator.kt:372 */
   20     28   
    Ok(())
          29  +
    /* JsonSerializerGenerator.kt:358 */
   21     30   
}

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

@@ -1,1 +54,80 @@
    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_foo_enum_list<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::unconstrained::foo_enum_list_unconstrained::FooEnumListUnconstrained>,
    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:343 */u.into_owned()
          42  +
                                /* JsonParserGenerator.kt:339 */)
          43  +
                            /* JsonParserGenerator.kt:354 */).transpose()?
          44  +
                        /* JsonParserGenerator.kt:419 */;
          45  +
                        /* JsonParserGenerator.kt:422 */
   32     46   
                        if let Some(value) = value {
   33     47   
                            items.push(value);
   34         -
                        } else {
          48  +
                        }
          49  +
                        /* JsonParserGenerator.kt:430 */
          50  +
                        else {
   35     51   
                            return Err(
   36     52   
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37     53   
                                    "dense list cannot contain null values",
   38     54   
                                ),
   39     55   
                            );
   40     56   
                        }
   41         -
                    }
          57  +
                        /* JsonParserGenerator.kt:413 */
          58  +
                    } /* JsonParserGenerator.kt:409 */
   42     59   
                }
          60  +
                /* JsonParserGenerator.kt:408 */
   43     61   
            }
          62  +
            /* JsonParserGenerator.kt:444 */
   44     63   
            Ok(Some(
   45     64   
                crate::unconstrained::foo_enum_list_unconstrained::FooEnumListUnconstrained(items),
   46     65   
            ))
          66  +
            /* JsonParserGenerator.kt:713 */
   47     67   
        }
   48         -
        _ => Err(
   49         -
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   50         -
                "expected start array or null",
   51         -
            ),
   52         -
        ),
          68  +
        /* JsonParserGenerator.kt:722 */
          69  +
        _ => {
          70  +
            /* JsonParserGenerator.kt:723 */
          71  +
            Err(
          72  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          73  +
                    "expected start array or null",
          74  +
                ),
          75  +
            )
          76  +
            /* JsonParserGenerator.kt:722 */
          77  +
        } /* JsonParserGenerator.kt:712 */
   53     78   
    }
          79  +
    /* JsonParserGenerator.kt:398 */
   54     80   
}

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

@@ -1,1 +62,89 @@
    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_foo_enum_map<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::unconstrained::foo_enum_map_unconstrained::FooEnumMapUnconstrained>,
    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:343 */u.into_owned()
          42  +
                                /* JsonParserGenerator.kt:339 */)
          43  +
                            /* JsonParserGenerator.kt:354 */).transpose()?
          44  +
                        /* JsonParserGenerator.kt:474 */;
          45  +
                        /* JsonParserGenerator.kt:481 */
   30     46   
                        match value {
   31     47   
                            Some(value) => {
   32     48   
                                map.insert(key, value);
   33     49   
                            }
   34     50   
                            None => {
   35     51   
                                return Err(
   36     52   
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37     53   
                                        "dense map cannot contain null values",
   38     54   
                                    ),
   39     55   
                                )
   40     56   
                            }
   41     57   
                        }
          58  +
                        /* JsonParserGenerator.kt:686 */
   42     59   
                    }
          60  +
                    /* JsonParserGenerator.kt:695 */
   43     61   
                    other => {
   44     62   
                        return Err(
   45     63   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   46     64   
                                format!("expected object key or end object, found: {:?}", other),
   47     65   
                            ),
   48     66   
                        )
   49         -
                    }
          67  +
                    } /* JsonParserGenerator.kt:685 */
   50     68   
                }
          69  +
                /* JsonParserGenerator.kt:684 */
   51     70   
            }
          71  +
            /* JsonParserGenerator.kt:502 */
   52     72   
            Ok(Some(
   53     73   
                crate::unconstrained::foo_enum_map_unconstrained::FooEnumMapUnconstrained(map),
   54     74   
            ))
          75  +
            /* JsonParserGenerator.kt:713 */
   55     76   
        }
   56         -
        _ => Err(
   57         -
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   58         -
                "expected start object or null",
   59         -
            ),
   60         -
        ),
          77  +
        /* JsonParserGenerator.kt:722 */
          78  +
        _ => {
          79  +
            /* JsonParserGenerator.kt:723 */
          80  +
            Err(
          81  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          82  +
                    "expected start object or null",
          83  +
                ),
          84  +
            )
          85  +
            /* JsonParserGenerator.kt:722 */
          86  +
        } /* JsonParserGenerator.kt:712 */
   61     87   
    }
          88  +
    /* JsonParserGenerator.kt:460 */
   62     89   
}

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

@@ -1,1 +54,80 @@
    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_foo_enum_set<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::unconstrained::foo_enum_set_unconstrained::FooEnumSetUnconstrained>,
    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:343 */u.into_owned()
          42  +
                                /* JsonParserGenerator.kt:339 */)
          43  +
                            /* JsonParserGenerator.kt:354 */).transpose()?
          44  +
                        /* JsonParserGenerator.kt:419 */;
          45  +
                        /* JsonParserGenerator.kt:422 */
   32     46   
                        if let Some(value) = value {
   33     47   
                            items.push(value);
   34         -
                        } else {
          48  +
                        }
          49  +
                        /* JsonParserGenerator.kt:430 */
          50  +
                        else {
   35     51   
                            return Err(
   36     52   
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37     53   
                                    "dense list cannot contain null values",
   38     54   
                                ),
   39     55   
                            );
   40     56   
                        }
   41         -
                    }
          57  +
                        /* JsonParserGenerator.kt:413 */
          58  +
                    } /* JsonParserGenerator.kt:409 */
   42     59   
                }
          60  +
                /* JsonParserGenerator.kt:408 */
   43     61   
            }
          62  +
            /* JsonParserGenerator.kt:444 */
   44     63   
            Ok(Some(
   45     64   
                crate::unconstrained::foo_enum_set_unconstrained::FooEnumSetUnconstrained(items),
   46     65   
            ))
          66  +
            /* JsonParserGenerator.kt:713 */
   47     67   
        }
   48         -
        _ => Err(
   49         -
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   50         -
                "expected start array or null",
   51         -
            ),
   52         -
        ),
          68  +
        /* JsonParserGenerator.kt:722 */
          69  +
        _ => {
          70  +
            /* JsonParserGenerator.kt:723 */
          71  +
            Err(
          72  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          73  +
                    "expected start array or null",
          74  +
                ),
          75  +
            )
          76  +
            /* JsonParserGenerator.kt:722 */
          77  +
        } /* JsonParserGenerator.kt:712 */
   53     78   
    }
          79  +
    /* JsonParserGenerator.kt:398 */
   54     80   
}