Server Test Python

Server Test Python

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943 (ignoring whitespace)

Files changed:

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

@@ -1,1 +171,239 @@
    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_internal::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt: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 */
  119    166   
            }
         167  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  120    168   
            crate::error::PrimitiveIntHeaderError::InternalServerError(output) => {
         169  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  121    170   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         171  +
                /* RustType.kt:516 */
  122    172   
                #[allow(unused_mut)]
         173  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  123    174   
                let mut builder = ::http::Response::builder();
         175  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  124    176   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  125    177   
                    builder,
  126    178   
                    ::http::header::CONTENT_TYPE,
  127    179   
                    "application/json",
  128    180   
                );
         181  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  129    182   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  130    183   
                    builder,
  131    184   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  132    185   
                    "InternalServerError",
  133    186   
                );
         187  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  134    188   
                let content_length = payload.len();
  135    189   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  136    190   
                    builder,
  137    191   
                    ::http::header::CONTENT_LENGTH,
  138    192   
                    content_length,
  139    193   
                );
         194  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  140    195   
                builder
  141    196   
                    .status(500)
  142    197   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         198  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         199  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  143    200   
        }
  144         -
        }
         201  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  145    202   
    })
         203  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  146    204   
}
  147    205   
         206  +
/* HttpBindingGenerator.kt:542 */
  148    207   
pub fn ser_primitive_int_header_headers(
  149    208   
    input: &crate::output::PrimitiveIntHeaderOutput,
  150    209   
    mut builder: ::http::response::Builder,
  151    210   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
  152    211   
{
         212  +
    /* SerializerUtil.kt:42 */
  153    213   
    {
         214  +
        /* HttpBindingGenerator.kt:690 */
  154    215   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(input.field);
         216  +
        /* HttpBindingGenerator.kt:704 */
  155    217   
        let formatted_1 = encoder.encode();
         218  +
        /* HttpBindingGenerator.kt:705 */
  156    219   
        if !formatted_1.is_empty() {
         220  +
            /* HttpBindingGenerator.kt:706 */
  157    221   
            let header_value = formatted_1;
  158    222   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  159    223   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  160    224   
                    "field",
  161    225   
                    format!(
  162    226   
                        "`{}` cannot be used as a header value: {}",
  163    227   
                        &header_value, err
  164    228   
                    ),
  165    229   
                )
  166    230   
            })?;
  167    231   
            builder = builder.header("x-field", header_value);
         232  +
            /* HttpBindingGenerator.kt:705 */
  168    233   
        }
         234  +
        /* SerializerUtil.kt:42 */
  169    235   
    }
         236  +
    /* HttpBindingGenerator.kt:555 */
  170    237   
    Ok(builder)
         238  +
    /* HttpBindingGenerator.kt:542 */
  171    239   
}

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

@@ -1,1 +179,250 @@
    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_internal::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_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 */
  101    141   
            }
         142  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  102    143   
            crate::error::PrimitiveIntOpError::InternalServerError(output) => {
         144  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  103    145   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         146  +
                /* RustType.kt:516 */
  104    147   
                #[allow(unused_mut)]
         148  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  105    149   
                let mut builder = ::http::Response::builder();
         150  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  106    151   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  107    152   
                    builder,
  108    153   
                    ::http::header::CONTENT_TYPE,
  109    154   
                    "application/json",
  110    155   
                );
         156  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  111    157   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  112    158   
                    builder,
  113    159   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  114    160   
                    "InternalServerError",
  115    161   
                );
         162  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  116    163   
                let content_length = payload.len();
  117    164   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  118    165   
                    builder,
  119    166   
                    ::http::header::CONTENT_LENGTH,
  120    167   
                    content_length,
  121    168   
                );
         169  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  122    170   
                builder
  123    171   
                    .status(500)
  124    172   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         173  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         174  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  125    175   
        }
  126         -
        }
         176  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  127    177   
    })
         178  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  128    179   
}
  129    180   
         181  +
/* JsonParserGenerator.kt:148 */
  130    182   
pub(crate) fn de_primitive_int_op(
  131    183   
    value: &[u8],
  132    184   
    mut builder: crate::input::primitive_int_op_input_internal::Builder,
  133    185   
) -> ::std::result::Result<
  134    186   
    crate::input::primitive_int_op_input_internal::Builder,
  135    187   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  136    188   
> {
         189  +
    /* JsonParserGenerator.kt:153 */
  137    190   
    let mut tokens_owned =
  138    191   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  139    192   
            .peekable();
  140    193   
    let tokens = &mut tokens_owned;
  141    194   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         195  +
    /* JsonParserGenerator.kt:684 */
  142    196   
    loop {
         197  +
        /* JsonParserGenerator.kt:685 */
  143    198   
        match tokens.next().transpose()? {
         199  +
            /* JsonParserGenerator.kt:686 */
  144    200   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  145    201   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         202  +
                /* JsonParserGenerator.kt:260 */
  146    203   
                match key.to_unescaped()?.as_ref() {
         204  +
                    /* JsonParserGenerator.kt:262 */
  147    205   
                    "value" => {
         206  +
                        /* JsonParserGenerator.kt:276 */
  148    207   
                        if let Some(v) =
         208  +
                            /* JsonParserGenerator.kt:365 */
  149    209   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
  150    210   
                                    tokens.next(),
  151    211   
                                )?
  152    212   
                                .map(i32::try_from)
  153    213   
                                .transpose()?
         214  +
                        /* JsonParserGenerator.kt:278 */
  154    215   
                        {
  155    216   
                            builder = builder.set_value(v);
  156    217   
                        }
         218  +
                        /* JsonParserGenerator.kt:262 */
  157    219   
                    }
  158         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         220  +
                    /* JsonParserGenerator.kt:290 */
         221  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  159    222   
                }
         223  +
                /* JsonParserGenerator.kt:686 */
  160    224   
            }
         225  +
            /* JsonParserGenerator.kt:695 */
  161    226   
            other => {
  162    227   
                return Err(
  163    228   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  164    229   
                        "expected object key or end object, found: {:?}",
  165    230   
                        other
  166    231   
                    )),
  167    232   
                )
         233  +
            } /* JsonParserGenerator.kt:685 */
  168    234   
        }
         235  +
        /* JsonParserGenerator.kt:684 */
  169    236   
    }
  170         -
    }
         237  +
    /* JsonParserGenerator.kt:250 */
  171    238   
    if tokens.next().is_some() {
         239  +
        /* JsonParserGenerator.kt:251 */
  172    240   
        return Err(
  173    241   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  174    242   
                "found more JSON tokens after completing parsing",
  175    243   
            ),
  176    244   
        );
         245  +
        /* JsonParserGenerator.kt:250 */
  177    246   
    }
         247  +
    /* JsonParserGenerator.kt:163 */
  178    248   
    Ok(builder)
         249  +
    /* JsonParserGenerator.kt:148 */
  179    250   
}

tmp-codegen-diff/codegen-server-test-python/rest_json_extras/rust-server-codegen-python/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   
    if input.value != 0 {
          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-python/rest_json_extras/rust-server-codegen-python/src/protocol_serde/shape_query_precedence.rs

@@ -1,1 +134,196 @@
    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_internal::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt: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 */
  107    158   
            }
         159  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  108    160   
            crate::error::QueryPrecedenceError::InternalServerError(output) => {
         161  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  109    162   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         163  +
                /* RustType.kt:516 */
  110    164   
                #[allow(unused_mut)]
         165  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  111    166   
                let mut builder = ::http::Response::builder();
         167  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  112    168   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  113    169   
                    builder,
  114    170   
                    ::http::header::CONTENT_TYPE,
  115    171   
                    "application/json",
  116    172   
                );
         173  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  117    174   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  118    175   
                    builder,
  119    176   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  120    177   
                    "InternalServerError",
  121    178   
                );
         179  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  122    180   
                let content_length = payload.len();
  123    181   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  124    182   
                    builder,
  125    183   
                    ::http::header::CONTENT_LENGTH,
  126    184   
                    content_length,
  127    185   
                );
         186  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  128    187   
                builder
  129    188   
                    .status(500)
  130    189   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         190  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         191  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  131    192   
        }
  132         -
        }
         193  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  133    194   
    })
         195  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  134    196   
}

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

@@ -1,1 +119,169 @@
    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_internal::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt: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 */
   92    131   
            }
         132  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   93    133   
            crate::error::StatusResponseError::InternalServerError(output) => {
         134  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   94    135   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         136  +
                /* RustType.kt:516 */
   95    137   
                #[allow(unused_mut)]
         138  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   96    139   
                let mut builder = ::http::Response::builder();
         140  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   97    141   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   98    142   
                    builder,
   99    143   
                    ::http::header::CONTENT_TYPE,
  100    144   
                    "application/json",
  101    145   
                );
         146  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  102    147   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  103    148   
                    builder,
  104    149   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  105    150   
                    "InternalServerError",
  106    151   
                );
         152  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  107    153   
                let content_length = payload.len();
  108    154   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  109    155   
                    builder,
  110    156   
                    ::http::header::CONTENT_LENGTH,
  111    157   
                    content_length,
  112    158   
                );
         159  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  113    160   
                builder
  114    161   
                    .status(500)
  115    162   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         163  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         164  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  116    165   
        }
  117         -
        }
         166  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  118    167   
    })
         168  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  119    169   
}

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

@@ -1,1 +129,177 @@
    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_internal::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt: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 */
  102    139   
            }
         140  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  103    141   
            crate::error::StringPayloadError::InternalServerError(output) => {
         142  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  104    143   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         144  +
                /* RustType.kt:516 */
  105    145   
                #[allow(unused_mut)]
         146  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  106    147   
                let mut builder = ::http::Response::builder();
         148  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  107    149   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  108    150   
                    builder,
  109    151   
                    ::http::header::CONTENT_TYPE,
  110    152   
                    "text/plain",
  111    153   
                );
         154  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  112    155   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  113    156   
                    builder,
  114    157   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  115    158   
                    "InternalServerError",
  116    159   
                );
         160  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  117    161   
                let content_length = payload.len();
  118    162   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  119    163   
                    builder,
  120    164   
                    ::http::header::CONTENT_LENGTH,
  121    165   
                    content_length,
  122    166   
                );
         167  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  123    168   
                builder
  124    169   
                    .status(500)
  125    170   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         171  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         172  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  126    173   
        }
  127         -
        }
         174  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  128    175   
    })
         176  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  129    177   
}

tmp-codegen-diff/codegen-server-test-python/rest_json_extras/rust-server-codegen-python/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-python/rest_json_extras/rust-server-codegen-python/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-python/rest_json_extras/rust-server-codegen-python/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-python/rest_json_extras/rust-server-codegen-python/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   
}

tmp-codegen-diff/codegen-server-test-python/rest_json_extras/rust-server-codegen-python/src/python_module_export.rs

@@ -1,1 +128,174 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* PythonServerModuleGenerator.kt:41 */
    2      3   
#[::pyo3::pymodule]
    3         -
#[::pyo3(name = "rest_json_extras")]
           4  +
#[pyo3(name = "rest_json_extras")]
    4      5   
pub fn python_library(py: ::pyo3::Python<'_>, m: &::pyo3::types::PyModule) -> ::pyo3::PyResult<()> {
           6  +
    /* PythonServerModuleGenerator.kt:65 */
    5      7   
    let input = ::pyo3::types::PyModule::new(py, "input")?;
    6      8   
    let output = ::pyo3::types::PyModule::new(py, "output")?;
    7      9   
    let error = ::pyo3::types::PyModule::new(py, "error")?;
          10  +
    /* PythonServerModuleGenerator.kt:96 */
    8     11   
    error.add_class::<crate::error::ExtraError>()?;
          12  +
    /* PythonServerModuleGenerator.kt:96 */
    9     13   
    error.add_class::<crate::error::InternalServerError>()?;
          14  +
    /* PythonServerModuleGenerator.kt:96 */
   10     15   
    output.add_class::<crate::output::QueryPrecedenceOutput>()?;
          16  +
    /* PythonServerModuleGenerator.kt:96 */
   11     17   
    input.add_class::<crate::input::QueryPrecedenceInput>()?;
          18  +
    /* PythonServerModuleGenerator.kt:96 */
   12     19   
    output.add_class::<crate::output::EmptyStructWithContentOnWireOpOutput>()?;
          20  +
    /* PythonServerModuleGenerator.kt:79 */
   13     21   
    let model = ::pyo3::types::PyModule::new(py, "model")?;
          22  +
    /* PythonServerModuleGenerator.kt:96 */
   14     23   
    model.add_class::<crate::model::EmptyStruct>()?;
          24  +
    /* PythonServerModuleGenerator.kt:96 */
   15     25   
    input.add_class::<crate::input::EmptyStructWithContentOnWireOpInput>()?;
          26  +
    /* PythonServerModuleGenerator.kt:96 */
   16     27   
    error.add_class::<crate::error::CaseInsensitiveError>()?;
          28  +
    /* PythonServerModuleGenerator.kt:96 */
   17     29   
    output.add_class::<crate::output::CaseInsensitiveErrorOperationOutput>()?;
          30  +
    /* PythonServerModuleGenerator.kt:96 */
   18     31   
    input.add_class::<crate::input::CaseInsensitiveErrorOperationInput>()?;
          32  +
    /* PythonServerModuleGenerator.kt:96 */
   19     33   
    output.add_class::<crate::output::NullInNonSparseOutput>()?;
          34  +
    /* PythonServerModuleGenerator.kt:89 */
   20     35   
    model.add_class::<crate::model::PyUnionMarkerSingleElementUnion>()?;
          36  +
    /* PythonServerModuleGenerator.kt:96 */
   21     37   
    input.add_class::<crate::input::NullInNonSparseInput>()?;
          38  +
    /* PythonServerModuleGenerator.kt:96 */
   22     39   
    error.add_class::<crate::error::ValidationException>()?;
          40  +
    /* PythonServerModuleGenerator.kt:96 */
   23     41   
    model.add_class::<crate::model::ValidationExceptionField>()?;
          42  +
    /* PythonServerModuleGenerator.kt:96 */
   24     43   
    output.add_class::<crate::output::EscapedStringValuesOutput>()?;
          44  +
    /* PythonServerModuleGenerator.kt:96 */
   25     45   
    model.add_class::<crate::model::EnumWithEscapedChars>()?;
          46  +
    /* PythonServerModuleGenerator.kt:96 */
   26     47   
    input.add_class::<crate::input::EscapedStringValuesInput>()?;
          48  +
    /* PythonServerModuleGenerator.kt:96 */
   27     49   
    output.add_class::<crate::output::PrimitiveIntOpOutput>()?;
          50  +
    /* PythonServerModuleGenerator.kt:96 */
   28     51   
    input.add_class::<crate::input::PrimitiveIntOpInput>()?;
          52  +
    /* PythonServerModuleGenerator.kt:96 */
   29     53   
    output.add_class::<crate::output::MapWithEnumKeyOpOutput>()?;
          54  +
    /* PythonServerModuleGenerator.kt:96 */
   30     55   
    model.add_class::<crate::model::StringEnum>()?;
          56  +
    /* PythonServerModuleGenerator.kt:96 */
   31     57   
    input.add_class::<crate::input::MapWithEnumKeyOpInput>()?;
          58  +
    /* PythonServerModuleGenerator.kt:96 */
   32     59   
    output.add_class::<crate::output::StatusResponseOutput>()?;
          60  +
    /* PythonServerModuleGenerator.kt:96 */
   33     61   
    input.add_class::<crate::input::StatusResponseInput>()?;
          62  +
    /* PythonServerModuleGenerator.kt:96 */
   34     63   
    output.add_class::<crate::output::EnumQueryOutput>()?;
          64  +
    /* PythonServerModuleGenerator.kt:96 */
   35     65   
    input.add_class::<crate::input::EnumQueryInput>()?;
          66  +
    /* PythonServerModuleGenerator.kt:96 */
   36     67   
    output.add_class::<crate::output::PrimitiveIntHeaderOutput>()?;
          68  +
    /* PythonServerModuleGenerator.kt:96 */
   37     69   
    input.add_class::<crate::input::PrimitiveIntHeaderInput>()?;
          70  +
    /* PythonServerModuleGenerator.kt:96 */
   38     71   
    output.add_class::<crate::output::StringPayloadOutput>()?;
          72  +
    /* PythonServerModuleGenerator.kt:96 */
   39     73   
    input.add_class::<crate::input::StringPayloadInput>()?;
          74  +
    /* PythonServerModuleGenerator.kt:105 */
   40     75   
    ::pyo3::py_run!(
   41     76   
        py,
   42     77   
        input,
   43     78   
        "import sys; sys.modules['rest_json_extras.input'] = input"
   44     79   
    );
   45     80   
    m.add_submodule(input)?;
   46     81   
    ::pyo3::py_run!(
   47     82   
        py,
   48     83   
        output,
   49     84   
        "import sys; sys.modules['rest_json_extras.output'] = output"
   50     85   
    );
   51     86   
    m.add_submodule(output)?;
   52     87   
    ::pyo3::py_run!(
   53     88   
        py,
   54     89   
        error,
   55     90   
        "import sys; sys.modules['rest_json_extras.error'] = error"
   56     91   
    );
   57     92   
    m.add_submodule(error)?;
          93  +
    /* PythonServerModuleGenerator.kt:117 */
   58     94   
    ::pyo3::py_run!(
   59     95   
        py,
   60     96   
        model,
   61     97   
        "import sys; sys.modules['rest_json_extras.model'] = model"
   62     98   
    );
   63     99   
    m.add_submodule(model)?;
         100  +
    /* PythonServerModuleGenerator.kt:129 */
   64    101   
    let types = ::pyo3::types::PyModule::new(py, "types")?;
   65    102   
    types.add_class::<::aws_smithy_http_server_python::types::Blob>()?;
   66    103   
    types.add_class::<::aws_smithy_http_server_python::types::DateTime>()?;
   67    104   
    types.add_class::<::aws_smithy_http_server_python::types::Format>()?;
   68    105   
    types.add_class::<::aws_smithy_http_server_python::types::ByteStream>()?;
   69    106   
    ::pyo3::py_run!(
   70    107   
        py,
   71    108   
        types,
   72    109   
        "import sys; sys.modules['rest_json_extras.types'] = types"
   73    110   
    );
   74    111   
    m.add_submodule(types)?;
         112  +
    /* PythonServerModuleGenerator.kt:149 */
   75    113   
    let socket = ::pyo3::types::PyModule::new(py, "socket")?;
   76    114   
    socket.add_class::<::aws_smithy_http_server_python::PySocket>()?;
   77    115   
    ::pyo3::py_run!(
   78    116   
        py,
   79    117   
        socket,
   80    118   
        "import sys; sys.modules['rest_json_extras.socket'] = socket"
   81    119   
    );
   82    120   
    m.add_submodule(socket)?;
         121  +
    /* PythonServerModuleGenerator.kt:166 */
   83    122   
    let logging = ::pyo3::types::PyModule::new(py, "logging")?;
   84    123   
    logging.add_function(::pyo3::wrap_pyfunction!(
   85    124   
        ::aws_smithy_http_server_python::py_tracing_event,
   86    125   
        m
   87    126   
    )?)?;
   88    127   
    logging.add_class::<::aws_smithy_http_server_python::PyTracingHandler>()?;
   89    128   
    ::pyo3::py_run!(
   90    129   
        py,
   91    130   
        logging,
   92    131   
        "import sys; sys.modules['rest_json_extras.logging'] = logging"
   93    132   
    );
   94    133   
    m.add_submodule(logging)?;
         134  +
    /* PythonServerModuleGenerator.kt:183 */
   95    135   
    let middleware = ::pyo3::types::PyModule::new(py, "middleware")?;
   96    136   
    middleware.add_class::<::aws_smithy_http_server_python::PyRequest>()?;
   97    137   
    middleware.add_class::<::aws_smithy_http_server_python::PyResponse>()?;
   98    138   
    middleware.add_class::<::aws_smithy_http_server_python::PyMiddlewareException>()?;
   99    139   
    pyo3::py_run!(
  100    140   
        py,
  101    141   
        middleware,
  102    142   
        "import sys; sys.modules['rest_json_extras.middleware'] = middleware"
  103    143   
    );
  104    144   
    m.add_submodule(middleware)?;
         145  +
    /* PythonServerModuleGenerator.kt:201 */
  105    146   
    let tls = ::pyo3::types::PyModule::new(py, "tls")?;
  106    147   
    tls.add_class::<::aws_smithy_http_server_python::tls::PyTlsConfig>()?;
  107    148   
    pyo3::py_run!(
  108    149   
        py,
  109    150   
        tls,
  110    151   
        "import sys; sys.modules['rest_json_extras.tls'] = tls"
  111    152   
    );
  112    153   
    m.add_submodule(tls)?;
         154  +
    /* PythonServerModuleGenerator.kt:217 */
  113    155   
    let aws_lambda = ::pyo3::types::PyModule::new(py, "aws_lambda")?;
  114    156   
    aws_lambda.add_class::<::aws_smithy_http_server_python::lambda::PyLambdaContext>()?;
  115    157   
    aws_lambda.add_class::<::aws_smithy_http_server_python::lambda::PyClientApplication>()?;
  116    158   
    aws_lambda.add_class::<::aws_smithy_http_server_python::lambda::PyClientContext>()?;
  117    159   
    aws_lambda.add_class::<::aws_smithy_http_server_python::lambda::PyCognitoIdentity>()?;
  118    160   
    aws_lambda.add_class::<::aws_smithy_http_server_python::lambda::PyConfig>()?;
  119    161   
    pyo3::py_run!(
  120    162   
        py,
  121    163   
        aws_lambda,
  122    164   
        "import sys; sys.modules['rest_json_extras.aws_lambda'] = aws_lambda"
  123    165   
    );
  124    166   
    m.add_submodule(aws_lambda)?;
         167  +
    /* PythonServerModuleGenerator.kt:238 */
  125    168   
    m.add_class::<crate::python_server_application::App>()?;
         169  +
    /* PythonServerModuleGenerator.kt:243 */
  126    170   
    m.add("CODEGEN_VERSION", "ci")?;
         171  +
    /* PythonServerModuleGenerator.kt:58 */
  127    172   
    Ok(())
         173  +
    /* PythonServerModuleGenerator.kt:41 */
  128    174   
}