Server Test

Server Test

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943 (ignoring whitespace)

Files changed:

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

@@ -1,1 +94,133 @@
    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_null_in_non_sparse_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::NullInNonSparseInput,
    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::null_in_non_sparse_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:811 */
   22     30   
        ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(&headers, None)?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   23     32   
        input.build()
          33  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   24     34   
    })
          35  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   25     36   
}
   26     37   
          38  +
/* RustType.kt:516 */
   27     39   
#[allow(clippy::unnecessary_wraps)]
          40  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   28     41   
pub fn ser_null_in_non_sparse_http_response(
   29     42   
    #[allow(unused_variables)] output: crate::output::NullInNonSparseOutput,
   30     43   
) -> std::result::Result<
   31     44   
    ::aws_smithy_http_server::response::Response,
   32     45   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   33     46   
> {
          47  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   34     48   
    Ok({
          49  +
        /* RustType.kt:516 */
   35     50   
        #[allow(unused_mut)]
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   36     52   
        let mut builder = ::http::Response::builder();
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   37     54   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   38     55   
            builder,
   39     56   
            ::http::header::CONTENT_TYPE,
   40     57   
            "application/json",
   41     58   
        );
          59  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   42     60   
        let http_status: u16 = 200;
   43     61   
        builder = builder.status(http_status);
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   44     63   
        let payload =
   45         -
            crate::protocol_serde::shape_null_in_non_sparse_output::ser_null_in_non_sparse_output_output_output(&output)?
   46         -
        ;
          64  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_null_in_non_sparse_output::ser_null_in_non_sparse_output_output_output(&output)?
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   47     67   
        let content_length = payload.len();
   48     68   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   49     69   
            builder,
   50     70   
            ::http::header::CONTENT_LENGTH,
   51     71   
            content_length,
   52     72   
        );
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   53     74   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   54     76   
        builder.body(body)?
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   55     78   
    })
          79  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   56     80   
}
   57     81   
          82  +
/* RustType.kt:516 */
   58     83   
#[allow(clippy::unnecessary_wraps)]
          84  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   59     85   
pub fn ser_null_in_non_sparse_http_error(
   60     86   
    error: &crate::error::NullInNonSparseError,
   61     87   
) -> std::result::Result<
   62     88   
    ::aws_smithy_http_server::response::Response,
   63     89   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   64     90   
> {
          91  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   65     92   
    Ok({
          93  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   66     94   
        match error {
          95  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   67     96   
            crate::error::NullInNonSparseError::ExtraError(output) => {
          97  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   68     98   
                let payload =
   69     99   
                    crate::protocol_serde::shape_extra_error::ser_extra_error_error(output)?;
         100  +
                /* RustType.kt:516 */
   70    101   
                #[allow(unused_mut)]
         102  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   71    103   
                let mut builder = ::http::Response::builder();
         104  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   72    105   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   73    106   
                    builder,
   74    107   
                    ::http::header::CONTENT_TYPE,
   75    108   
                    "application/json",
   76    109   
                );
         110  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   77    111   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   78    112   
                    builder,
   79    113   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   80    114   
                    "ExtraError",
   81    115   
                );
         116  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   82    117   
                let content_length = payload.len();
   83    118   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   84    119   
                    builder,
   85    120   
                    ::http::header::CONTENT_LENGTH,
   86    121   
                    content_length,
   87    122   
                );
         123  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   88    124   
                builder
   89    125   
                    .status(500)
   90    126   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         127  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         128  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   91    129   
        }
   92         -
        }
         130  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   93    131   
    })
         132  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
   94    133   
}

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

@@ -1,1 +48,81 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_null_in_non_sparse_output_output_output(
    3      4   
    value: &crate::output::NullInNonSparseOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_null_in_non_sparse_output::ser_null_in_non_sparse_output_output(
    8     11   
        &mut object,
    9     12   
        value,
   10     13   
    )?;
          14  +
    /* JsonSerializerGenerator.kt:227 */
   11     15   
    object.finish();
   12     16   
    Ok(out)
          17  +
    /* JsonSerializerGenerator.kt:213 */
   13     18   
}
   14     19   
          20  +
/* JsonSerializerGenerator.kt:358 */
   15     21   
pub fn ser_null_in_non_sparse_output_output(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::output::NullInNonSparseOutput,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:382 */
   19     26   
    if let Some(var_1) = &input.list {
          27  +
        /* JsonSerializerGenerator.kt:484 */
   20     28   
        let mut array_2 = object.key("list").start_array();
          29  +
        /* JsonSerializerGenerator.kt:524 */
   21     30   
        for item_3 in var_1 {
          31  +
            /* SerializerUtil.kt:42 */
   22     32   
            {
          33  +
                /* JsonSerializerGenerator.kt:423 */
   23     34   
                array_2.value().string(item_3.as_str());
          35  +
                /* SerializerUtil.kt:42 */
   24     36   
            }
          37  +
            /* JsonSerializerGenerator.kt:524 */
   25     38   
        }
          39  +
        /* JsonSerializerGenerator.kt:486 */
   26     40   
        array_2.finish();
          41  +
        /* JsonSerializerGenerator.kt:382 */
   27     42   
    }
          43  +
    /* JsonSerializerGenerator.kt:382 */
   28     44   
    if let Some(var_4) = &input.map {
          45  +
        /* JsonSerializerGenerator.kt:495 */
   29     46   
        #[allow(unused_mut)]
          47  +
        /* JsonSerializerGenerator.kt:496 */
   30     48   
        let mut object_5 = object.key("map").start_object();
          49  +
        /* JsonSerializerGenerator.kt:537 */
   31     50   
        for (key_6, value_7) in var_4 {
          51  +
            /* SerializerUtil.kt:42 */
   32     52   
            {
          53  +
                /* JsonSerializerGenerator.kt:423 */
   33     54   
                object_5.key(key_6.as_str()).string(value_7.as_str());
          55  +
                /* SerializerUtil.kt:42 */
   34     56   
            }
          57  +
            /* JsonSerializerGenerator.kt:537 */
   35     58   
        }
          59  +
        /* JsonSerializerGenerator.kt:515 */
   36     60   
        object_5.finish();
          61  +
        /* JsonSerializerGenerator.kt:382 */
   37     62   
    }
          63  +
    /* JsonSerializerGenerator.kt:382 */
   38     64   
    if let Some(var_8) = &input.union {
          65  +
        /* JsonSerializerGenerator.kt:495 */
   39     66   
        #[allow(unused_mut)]
          67  +
        /* JsonSerializerGenerator.kt:496 */
   40     68   
        let mut object_9 = object.key("union").start_object();
          69  +
        /* JsonSerializerGenerator.kt:579 */
   41     70   
        crate::protocol_serde::shape_single_element_union::ser_single_element_union(
   42     71   
            &mut object_9,
   43     72   
            var_8,
   44     73   
        )?;
          74  +
        /* JsonSerializerGenerator.kt:515 */
   45     75   
        object_9.finish();
          76  +
        /* JsonSerializerGenerator.kt:382 */
   46     77   
    }
          78  +
    /* JsonSerializerGenerator.kt:372 */
   47     79   
    Ok(())
          80  +
    /* JsonSerializerGenerator.kt:358 */
   48     81   
}

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

@@ -1,1 +147,206 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_primitive_int_header_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::PrimitiveIntHeaderInput,
    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::primitive_int_header_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:811 */
   22     30   
        ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(&headers, None)?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   23     32   
        input.build()
          33  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   24     34   
    })
          35  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   25     36   
}
   26     37   
          38  +
/* RustType.kt:516 */
   27     39   
#[allow(clippy::unnecessary_wraps)]
          40  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   28     41   
pub fn ser_primitive_int_header_http_response(
   29     42   
    #[allow(unused_variables)] output: crate::output::PrimitiveIntHeaderOutput,
   30     43   
) -> std::result::Result<
   31     44   
    ::aws_smithy_http_server::response::Response,
   32     45   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   33     46   
> {
          47  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   34     48   
    Ok({
          49  +
        /* RustType.kt:516 */
   35     50   
        #[allow(unused_mut)]
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   36     52   
        let mut builder = ::http::Response::builder();
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:629 */
   37     54   
        builder =
   38     55   
            crate::protocol_serde::shape_primitive_int_header::ser_primitive_int_header_headers(
   39     56   
                &output, builder,
   40     57   
            )?;
          58  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   41     59   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   42     60   
            builder,
   43     61   
            ::http::header::CONTENT_TYPE,
   44     62   
            "application/json",
   45     63   
        );
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   46     65   
        let http_status: u16 = 200;
   47     66   
        builder = builder.status(http_status);
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   48     68   
        let payload =
   49         -
            crate::protocol_serde::shape_primitive_int_header_output::ser_primitive_int_header_output_output_output(&output)?
   50         -
        ;
          69  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_primitive_int_header_output::ser_primitive_int_header_output_output_output(&output)?
          70  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   51     72   
        let content_length = payload.len();
   52     73   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   53     74   
            builder,
   54     75   
            ::http::header::CONTENT_LENGTH,
   55     76   
            content_length,
   56     77   
        );
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   57     79   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   58     81   
        builder.body(body)?
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   59     83   
    })
          84  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   60     85   
}
   61     86   
          87  +
/* RustType.kt:516 */
   62     88   
#[allow(clippy::unnecessary_wraps)]
          89  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   63     90   
pub fn ser_primitive_int_header_http_error(
   64     91   
    error: &crate::error::PrimitiveIntHeaderError,
   65     92   
) -> std::result::Result<
   66     93   
    ::aws_smithy_http_server::response::Response,
   67     94   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   68     95   
> {
          96  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   69     97   
    Ok({
          98  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   70     99   
        match error {
         100  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   71    101   
            crate::error::PrimitiveIntHeaderError::ValidationException(output) => {
         102  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   72    103   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         104  +
                /* RustType.kt:516 */
   73    105   
                #[allow(unused_mut)]
         106  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   74    107   
                let mut builder = ::http::Response::builder();
         108  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   75    109   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   76    110   
                    builder,
   77    111   
                    ::http::header::CONTENT_TYPE,
   78    112   
                    "application/json",
   79    113   
                );
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   80    115   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   81    116   
                    builder,
   82    117   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   83    118   
                    "ValidationException",
   84    119   
                );
         120  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   85    121   
                let content_length = payload.len();
   86    122   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   87    123   
                    builder,
   88    124   
                    ::http::header::CONTENT_LENGTH,
   89    125   
                    content_length,
   90    126   
                );
         127  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   91    128   
                builder
   92    129   
                    .status(400)
   93    130   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         131  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
   94    132   
            }
         133  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   95    134   
            crate::error::PrimitiveIntHeaderError::ExtraError(output) => {
         135  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   96    136   
                let payload =
   97    137   
                    crate::protocol_serde::shape_extra_error::ser_extra_error_error(output)?;
         138  +
                /* RustType.kt:516 */
   98    139   
                #[allow(unused_mut)]
         140  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   99    141   
                let mut builder = ::http::Response::builder();
         142  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  100    143   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  101    144   
                    builder,
  102    145   
                    ::http::header::CONTENT_TYPE,
  103    146   
                    "application/json",
  104    147   
                );
         148  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  105    149   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  106    150   
                    builder,
  107    151   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  108    152   
                    "ExtraError",
  109    153   
                );
         154  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  110    155   
                let content_length = payload.len();
  111    156   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  112    157   
                    builder,
  113    158   
                    ::http::header::CONTENT_LENGTH,
  114    159   
                    content_length,
  115    160   
                );
         161  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  116    162   
                builder
  117    163   
                    .status(500)
  118    164   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         165  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         166  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  119    167   
        }
  120         -
        }
         168  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  121    169   
    })
         170  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  122    171   
}
  123    172   
         173  +
/* HttpBindingGenerator.kt:542 */
  124    174   
pub fn ser_primitive_int_header_headers(
  125    175   
    input: &crate::output::PrimitiveIntHeaderOutput,
  126    176   
    mut builder: ::http::response::Builder,
  127    177   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
  128    178   
{
         179  +
    /* SerializerUtil.kt:42 */
  129    180   
    {
         181  +
        /* HttpBindingGenerator.kt:690 */
  130    182   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(input.field);
         183  +
        /* HttpBindingGenerator.kt:704 */
  131    184   
        let formatted_1 = encoder.encode();
         185  +
        /* HttpBindingGenerator.kt:705 */
  132    186   
        if !formatted_1.is_empty() {
         187  +
            /* HttpBindingGenerator.kt:706 */
  133    188   
            let header_value = formatted_1;
  134    189   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  135    190   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  136    191   
                    "field",
  137    192   
                    format!(
  138    193   
                        "`{}` cannot be used as a header value: {}",
  139    194   
                        &header_value, err
  140    195   
                    ),
  141    196   
                )
  142    197   
            })?;
  143    198   
            builder = builder.header("x-field", header_value);
         199  +
            /* HttpBindingGenerator.kt:705 */
  144    200   
        }
         201  +
        /* SerializerUtil.kt:42 */
  145    202   
    }
         203  +
    /* HttpBindingGenerator.kt:555 */
  146    204   
    Ok(builder)
         205  +
    /* HttpBindingGenerator.kt:542 */
  147    206   
}

tmp-codegen-diff/codegen-server-test/rest_json_extras/rust-server-codegen/src/protocol_serde/shape_primitive_int_header_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_primitive_int_header_output_output_output(
    3      4   
    value: &crate::output::PrimitiveIntHeaderOutput,
    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_primitive_int_header_output::ser_primitive_int_header_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_primitive_int_header_output_output(
   13     19   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    #[allow(unused_variables)] input: &crate::output::PrimitiveIntHeaderOutput,
   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/rest_json_extras/rust-server-codegen/src/protocol_serde/shape_primitive_int_op.rs

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

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

@@ -1,1 +26,37 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_primitive_int_op_output_output_output(
    3      4   
    value: &crate::output::PrimitiveIntOpOutput,
    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_primitive_int_op_output::ser_primitive_int_op_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_primitive_int_op_output_output(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::output::PrimitiveIntOpOutput,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* SerializerUtil.kt:46 */
   19     26   
    {
          27  +
        /* JsonSerializerGenerator.kt:432 */
   20     28   
        object.key("value").number(
   21     29   
            #[allow(clippy::useless_conversion)]
   22     30   
            ::aws_smithy_types::Number::NegInt((input.value).into()),
   23     31   
        );
          32  +
        /* SerializerUtil.kt:46 */
   24     33   
    }
          34  +
    /* JsonSerializerGenerator.kt:372 */
   25     35   
    Ok(())
          36  +
    /* JsonSerializerGenerator.kt:358 */
   26     37   
}

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

@@ -1,1 +110,163 @@
    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   
}
   73    111   
         112  +
/* RustType.kt:516 */
   74    113   
#[allow(clippy::unnecessary_wraps)]
         114  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   75    115   
pub fn ser_query_precedence_http_error(
   76    116   
    error: &crate::error::QueryPrecedenceError,
   77    117   
) -> std::result::Result<
   78    118   
    ::aws_smithy_http_server::response::Response,
   79    119   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   80    120   
> {
         121  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   81    122   
    Ok({
         123  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   82    124   
        match error {
         125  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   83    126   
            crate::error::QueryPrecedenceError::ExtraError(output) => {
         127  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   84    128   
                let payload =
   85    129   
                    crate::protocol_serde::shape_extra_error::ser_extra_error_error(output)?;
         130  +
                /* RustType.kt:516 */
   86    131   
                #[allow(unused_mut)]
         132  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   87    133   
                let mut builder = ::http::Response::builder();
         134  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   88    135   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   89    136   
                    builder,
   90    137   
                    ::http::header::CONTENT_TYPE,
   91    138   
                    "application/json",
   92    139   
                );
         140  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   93    141   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   94    142   
                    builder,
   95    143   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   96    144   
                    "ExtraError",
   97    145   
                );
         146  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   98    147   
                let content_length = payload.len();
   99    148   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  100    149   
                    builder,
  101    150   
                    ::http::header::CONTENT_LENGTH,
  102    151   
                    content_length,
  103    152   
                );
         153  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  104    154   
                builder
  105    155   
                    .status(500)
  106    156   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         157  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         158  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  107    159   
        }
  108         -
        }
         160  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  109    161   
    })
         162  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  110    163   
}

tmp-codegen-diff/codegen-server-test/rest_json_extras/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_extras/rust-server-codegen/src/protocol_serde/shape_single_element_union.rs

@@ -1,1 +12,24 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:547 */
    2      3   
pub fn ser_single_element_union(
    3      4   
    object_9: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4      5   
    input: &crate::model::SingleElementUnion,
    5      6   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           7  +
    /* JsonSerializerGenerator.kt:556 */
    6      8   
    match input {
           9  +
        /* JsonSerializerGenerator.kt:564 */
    7     10   
        crate::model::SingleElementUnion::A(inner) => {
          11  +
            /* SerializerUtil.kt:42 */
          12  +
            {
          13  +
                /* JsonSerializerGenerator.kt:423 */
    8     14   
                object_9.key("a").string(inner.as_str());
          15  +
                /* SerializerUtil.kt:42 */
    9     16   
            }
          17  +
            /* JsonSerializerGenerator.kt:564 */
   10     18   
        }
          19  +
        /* JsonSerializerGenerator.kt:556 */
          20  +
    }
          21  +
    /* JsonSerializerGenerator.kt:576 */
   11     22   
    Ok(())
          23  +
    /* JsonSerializerGenerator.kt:547 */
   12     24   
}

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

@@ -1,1 +95,136 @@
    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_status_response_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::StatusResponseInput,
    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::status_response_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:811 */
   22     30   
        ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(&headers, None)?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   23     32   
        input.build()
          33  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   24     34   
    })
          35  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   25     36   
}
   26     37   
          38  +
/* RustType.kt:516 */
   27     39   
#[allow(clippy::unnecessary_wraps)]
          40  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   28     41   
pub fn ser_status_response_http_response(
   29     42   
    #[allow(unused_variables)] output: crate::output::StatusResponseOutput,
   30     43   
) -> std::result::Result<
   31     44   
    ::aws_smithy_http_server::response::Response,
   32     45   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   33     46   
> {
          47  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   34     48   
    Ok({
          49  +
        /* RustType.kt:516 */
   35     50   
        #[allow(unused_mut)]
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   36     52   
        let mut builder = ::http::Response::builder();
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   37     54   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   38     55   
            builder,
   39     56   
            ::http::header::CONTENT_TYPE,
   40     57   
            "application/json",
   41     58   
        );
   42         -
        let status = output.field;
          59  +
        /* ServerHttpBoundProtocolGenerator.kt:701 */
          60  +
        let status = output.field
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:701 */;
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:706 */
   43     63   
        let http_status: u16 = status.try_into().map_err(::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection::InvalidHttpStatusCode)?;
   44     64   
        builder = builder.status(http_status);
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   45     66   
        let payload =
   46         -
            crate::protocol_serde::shape_status_response_output::ser_status_response_output_output_output(&output)?
   47         -
        ;
          67  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_status_response_output::ser_status_response_output_output_output(&output)?
          68  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   48     70   
        let content_length = payload.len();
   49     71   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   50     72   
            builder,
   51     73   
            ::http::header::CONTENT_LENGTH,
   52     74   
            content_length,
   53     75   
        );
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   54     77   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   55     79   
        builder.body(body)?
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   56     81   
    })
          82  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   57     83   
}
   58     84   
          85  +
/* RustType.kt:516 */
   59     86   
#[allow(clippy::unnecessary_wraps)]
          87  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   60     88   
pub fn ser_status_response_http_error(
   61     89   
    error: &crate::error::StatusResponseError,
   62     90   
) -> std::result::Result<
   63     91   
    ::aws_smithy_http_server::response::Response,
   64     92   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   65     93   
> {
          94  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   66     95   
    Ok({
          96  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   67     97   
        match error {
          98  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   68     99   
            crate::error::StatusResponseError::ExtraError(output) => {
         100  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   69    101   
                let payload =
   70    102   
                    crate::protocol_serde::shape_extra_error::ser_extra_error_error(output)?;
         103  +
                /* RustType.kt:516 */
   71    104   
                #[allow(unused_mut)]
         105  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   72    106   
                let mut builder = ::http::Response::builder();
         107  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   73    108   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   74    109   
                    builder,
   75    110   
                    ::http::header::CONTENT_TYPE,
   76    111   
                    "application/json",
   77    112   
                );
         113  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   78    114   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   79    115   
                    builder,
   80    116   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   81    117   
                    "ExtraError",
   82    118   
                );
         119  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   83    120   
                let content_length = payload.len();
   84    121   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   85    122   
                    builder,
   86    123   
                    ::http::header::CONTENT_LENGTH,
   87    124   
                    content_length,
   88    125   
                );
         126  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   89    127   
                builder
   90    128   
                    .status(500)
   91    129   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         130  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         131  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   92    132   
        }
   93         -
        }
         133  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   94    134   
    })
         135  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
   95    136   
}

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

@@ -1,1 +20,28 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_status_response_output_output_output(
    3      4   
    value: &crate::output::StatusResponseOutput,
    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_status_response_output::ser_status_response_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_status_response_output_output(
   16     22   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    #[allow(unused_variables)] input: &crate::output::StatusResponseOutput,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:372 */
   19     26   
    Ok(())
          27  +
    /* JsonSerializerGenerator.kt:358 */
   20     28   
}

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

@@ -1,1 +105,144 @@
    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_string_payload_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::StringPayloadInput,
    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::string_payload_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:794 */
   22     30   
        if let Some(value) = {
   23     31   
            let bytes = ::hyper::body::to_bytes(body).await?;
   24     32   
            if !bytes.is_empty() {
   25     33   
                ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   26     34   
                    &headers,
   27     35   
                    Some("text/plain"),
   28     36   
                )?;
   29     37   
            }
   30     38   
            crate::protocol_serde::shape_string_payload_input::de_payload_payload(&bytes)?
   31     39   
        } {
   32     40   
            input = input.set_payload(Some(value))
   33     41   
        }
          42  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   34     43   
        input.build()
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   35     45   
    })
          46  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   36     47   
}
   37     48   
          49  +
/* RustType.kt:516 */
   38     50   
#[allow(clippy::unnecessary_wraps)]
          51  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   39     52   
pub fn ser_string_payload_http_response(
   40     53   
    #[allow(unused_variables)] output: crate::output::StringPayloadOutput,
   41     54   
) -> std::result::Result<
   42     55   
    ::aws_smithy_http_server::response::Response,
   43     56   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   44     57   
> {
          58  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   45     59   
    Ok({
          60  +
        /* RustType.kt:516 */
   46     61   
        #[allow(unused_mut)]
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   47     63   
        let mut builder = ::http::Response::builder();
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   48     65   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   49     66   
            builder,
   50     67   
            ::http::header::CONTENT_TYPE,
   51     68   
            "text/plain",
   52     69   
        );
          70  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   53     71   
        let http_status: u16 = 200;
   54     72   
        builder = builder.status(http_status);
   55         -
        let payload = crate::protocol_serde::shape_string_payload_output::ser_payload_http_payload(
   56         -
            output.payload,
   57         -
        )?;
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          74  +
        let payload =
          75  +
            /* HttpBoundProtocolPayloadGenerator.kt:350 */crate::protocol_serde::shape_string_payload_output::ser_payload_http_payload( output.payload)?
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   58     78   
        let content_length = payload.len();
   59     79   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   60     80   
            builder,
   61     81   
            ::http::header::CONTENT_LENGTH,
   62     82   
            content_length,
   63     83   
        );
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   64     85   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   65     87   
        builder.body(body)?
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   66     89   
    })
          90  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   67     91   
}
   68     92   
          93  +
/* RustType.kt:516 */
   69     94   
#[allow(clippy::unnecessary_wraps)]
          95  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   70     96   
pub fn ser_string_payload_http_error(
   71     97   
    error: &crate::error::StringPayloadError,
   72     98   
) -> std::result::Result<
   73     99   
    ::aws_smithy_http_server::response::Response,
   74    100   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   75    101   
> {
         102  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   76    103   
    Ok({
         104  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   77    105   
        match error {
         106  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   78    107   
            crate::error::StringPayloadError::ExtraError(output) => {
         108  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   79    109   
                let payload =
   80    110   
                    crate::protocol_serde::shape_extra_error::ser_extra_error_error(output)?;
         111  +
                /* RustType.kt:516 */
   81    112   
                #[allow(unused_mut)]
         113  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   82    114   
                let mut builder = ::http::Response::builder();
         115  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   83    116   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   84    117   
                    builder,
   85    118   
                    ::http::header::CONTENT_TYPE,
   86    119   
                    "text/plain",
   87    120   
                );
         121  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   88    122   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   89    123   
                    builder,
   90    124   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   91    125   
                    "ExtraError",
   92    126   
                );
         127  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   93    128   
                let content_length = payload.len();
   94    129   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   95    130   
                    builder,
   96    131   
                    ::http::header::CONTENT_LENGTH,
   97    132   
                    content_length,
   98    133   
                );
         134  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   99    135   
                builder
  100    136   
                    .status(500)
  101    137   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         138  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         139  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  102    140   
        }
  103         -
        }
         141  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  104    142   
    })
         143  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  105    144   
}

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

@@ -1,1 +14,20 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:248 */
    2      3   
pub(crate) fn de_payload_payload(
    3      4   
    body: &[u8],
    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  +
    /* HttpBindingGenerator.kt:319 */
    8     10   
    (!body.is_empty())
    9     11   
        .then(|| {
          12  +
            /* HttpBindingGenerator.kt:332 */
   10     13   
            let body_str = std::str::from_utf8(body)?;
          14  +
            /* HttpBindingGenerator.kt:344 */
   11     15   
            Ok(body_str.to_string())
          16  +
            /* HttpBindingGenerator.kt:319 */
   12     17   
        })
   13     18   
        .transpose()
          19  +
    /* HttpBindingGenerator.kt:248 */
   14     20   
}

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

@@ -1,1 +10,22 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBoundProtocolPayloadGenerator.kt:311 */
    2      3   
pub fn ser_payload_http_payload(
    3      4   
    payload: ::std::option::Option<::std::string::String>,
    4      5   
) -> ::std::result::Result<::std::vec::Vec<u8>, ::aws_smithy_types::error::operation::BuildError> {
           6  +
    /* HttpBoundProtocolPayloadGenerator.kt:320 */
    5      7   
    let payload = match payload {
    6      8   
        Some(t) => t,
    7         -
        None => return Ok(Vec::new()),
           9  +
        None => {
          10  +
            return Ok(
          11  +
                /* HttpBoundProtocolPayloadGenerator.kt:332 */
          12  +
                Vec::new(), /* HttpBoundProtocolPayloadGenerator.kt:320 */
          13  +
            )
          14  +
        }
    8     15   
    };
    9         -
    Ok(payload.into_bytes())
          16  +
    /* HttpBoundProtocolPayloadGenerator.kt:345 */
          17  +
    Ok(
          18  +
        /* HttpBoundProtocolPayloadGenerator.kt:366 */
          19  +
        payload.into_bytes(), /* HttpBoundProtocolPayloadGenerator.kt:345 */
          20  +
    )
          21  +
    /* HttpBoundProtocolPayloadGenerator.kt:311 */
   10     22   
}

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

@@ -1,1 +35,58 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_validation_exception_error(
    3      4   
    value: &crate::error::ValidationException,
    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_validation_exception::ser_validation_exception(
    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_validation_exception(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::error::ValidationException,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:382 */
   19     26   
    if let Some(var_1) = &input.field_list {
          27  +
        /* JsonSerializerGenerator.kt:484 */
   20     28   
        let mut array_2 = object.key("fieldList").start_array();
          29  +
        /* JsonSerializerGenerator.kt:524 */
   21     30   
        for item_3 in var_1 {
          31  +
            /* SerializerUtil.kt:42 */
   22     32   
            {
          33  +
                /* JsonSerializerGenerator.kt:495 */
   23     34   
                #[allow(unused_mut)]
          35  +
                /* JsonSerializerGenerator.kt:496 */
   24     36   
                let mut object_4 = array_2.value().start_object();
          37  +
                /* JsonSerializerGenerator.kt:375 */
   25     38   
                crate::protocol_serde::shape_validation_exception_field::ser_validation_exception_field(&mut object_4, item_3)?;
          39  +
                /* JsonSerializerGenerator.kt:515 */
   26     40   
                object_4.finish();
          41  +
                /* SerializerUtil.kt:42 */
   27     42   
            }
          43  +
            /* JsonSerializerGenerator.kt:524 */
   28     44   
        }
          45  +
        /* JsonSerializerGenerator.kt:486 */
   29     46   
        array_2.finish();
          47  +
        /* JsonSerializerGenerator.kt:382 */
   30     48   
    }
          49  +
    /* SerializerUtil.kt:42 */
   31     50   
    {
          51  +
        /* JsonSerializerGenerator.kt:423 */
   32     52   
        object.key("message").string(input.message.as_str());
          53  +
        /* SerializerUtil.kt:42 */
   33     54   
    }
          55  +
    /* JsonSerializerGenerator.kt:372 */
   34     56   
    Ok(())
          57  +
    /* JsonSerializerGenerator.kt:358 */
   35     58   
}

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

@@ -1,1 +13,22 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:358 */
    2      3   
pub fn ser_validation_exception_field(
    3      4   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4      5   
    input: &crate::model::ValidationExceptionField,
    5      6   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           7  +
    /* SerializerUtil.kt:42 */
    6      8   
    {
           9  +
        /* JsonSerializerGenerator.kt:423 */
    7     10   
        object.key("path").string(input.path.as_str());
          11  +
        /* SerializerUtil.kt:42 */
    8     12   
    }
          13  +
    /* SerializerUtil.kt:42 */
    9     14   
    {
          15  +
        /* JsonSerializerGenerator.kt:423 */
   10     16   
        object.key("message").string(input.message.as_str());
          17  +
        /* SerializerUtil.kt:42 */
   11     18   
    }
          19  +
    /* JsonSerializerGenerator.kt:372 */
   12     20   
    Ok(())
          21  +
    /* JsonSerializerGenerator.kt:358 */
   13     22   
}