Server Test Python

Server Test Python

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943

Files changed:

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

@@ -1,1 +94,136 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_http_response_code_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::HttpResponseCodeInput,
    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::http_response_code_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_http_response_code_http_response(
   29     42   
    #[allow(unused_variables)] output: crate::output::HttpResponseCodeOutput,
   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.status.unwrap_or(200);
          59  +
        /* ServerHttpBoundProtocolGenerator.kt:701 */
          60  +
        let status = output.status
          61  +
            /* ServerHttpBoundProtocolGenerator.kt:703 */.unwrap_or(200)
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:701 */;
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:706 */
   43     64   
        let http_status: u16 = status.try_into().map_err(::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection::InvalidHttpStatusCode)?;
   44     65   
        builder = builder.status(http_status);
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   45     67   
        let payload =
   46         -
            crate::protocol_serde::shape_http_response_code_output::ser_http_response_code_output_output_output(&output)?
   47         -
        ;
          68  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_http_response_code_output::ser_http_response_code_output_output_output(&output)?
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          70  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   48     71   
        let content_length = payload.len();
   49     72   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   50     73   
            builder,
   51     74   
            ::http::header::CONTENT_LENGTH,
   52     75   
            content_length,
   53     76   
        );
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   54     78   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   55     80   
        builder.body(body)?
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   56     82   
    })
          83  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   57     84   
}
   58     85   
          86  +
/* RustType.kt:516 */
   59     87   
#[allow(clippy::unnecessary_wraps)]
          88  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   60     89   
pub fn ser_http_response_code_http_error(
   61     90   
    error: &crate::error::HttpResponseCodeError,
   62     91   
) -> std::result::Result<
   63     92   
    ::aws_smithy_http_server::response::Response,
   64     93   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   65     94   
> {
          95  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   66     96   
    Ok({
          97  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   67     98   
        match error {
          99  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   68    100   
            crate::error::HttpResponseCodeError::InternalServerError(output) => {
         101  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   69    102   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         103  +
                /* RustType.kt:516 */
   70    104   
                #[allow(unused_mut)]
         105  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   71    106   
                let mut builder = ::http::Response::builder();
         107  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   72    108   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   73    109   
                    builder,
   74    110   
                    ::http::header::CONTENT_TYPE,
   75    111   
                    "application/json",
   76    112   
                );
         113  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   77    114   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   78    115   
                    builder,
   79    116   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   80    117   
                    "InternalServerError",
   81    118   
                );
         119  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   82    120   
                let content_length = payload.len();
   83    121   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   84    122   
                    builder,
   85    123   
                    ::http::header::CONTENT_LENGTH,
   86    124   
                    content_length,
   87    125   
                );
         126  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   88    127   
                builder
   89    128   
                    .status(500)
   90    129   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
   91         -
            }
         130  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         131  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   92    132   
        }
         133  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   93    134   
    })
         135  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
   94    136   
}

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/src/protocol_serde/shape_http_response_code_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_http_response_code_output_output_output(
    3      4   
    value: &crate::output::HttpResponseCodeOutput,
    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_http_response_code_output::ser_http_response_code_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_http_response_code_output_output(
   16     22   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    #[allow(unused_variables)] input: &crate::output::HttpResponseCodeOutput,
   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/rust-server-codegen-python/src/protocol_serde/shape_http_string_payload.rs

@@ -1,1 +105,143 @@
    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_http_string_payload_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::HttpStringPayloadInput,
    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::http_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_http_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_http_string_payload_http_response(
   40     53   
    #[allow(unused_variables)] output: crate::output::HttpStringPayloadOutput,
   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);
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   55     74   
        let payload =
   56         -
            crate::protocol_serde::shape_http_string_payload_output::ser_payload_http_payload(
   57         -
                output.payload,
   58         -
            )?;
          75  +
            /* HttpBoundProtocolPayloadGenerator.kt:350 */crate::protocol_serde::shape_http_string_payload_output::ser_payload_http_payload( output.payload)?
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   59     78   
        let content_length = payload.len();
   60     79   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   61     80   
            builder,
   62     81   
            ::http::header::CONTENT_LENGTH,
   63     82   
            content_length,
   64     83   
        );
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   65     85   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   66     87   
        builder.body(body)?
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   67     89   
    })
          90  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   68     91   
}
   69     92   
          93  +
/* RustType.kt:516 */
   70     94   
#[allow(clippy::unnecessary_wraps)]
          95  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   71     96   
pub fn ser_http_string_payload_http_error(
   72     97   
    error: &crate::error::HttpStringPayloadError,
   73     98   
) -> std::result::Result<
   74     99   
    ::aws_smithy_http_server::response::Response,
   75    100   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   76    101   
> {
         102  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   77    103   
    Ok({
         104  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   78    105   
        match error {
         106  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   79    107   
            crate::error::HttpStringPayloadError::InternalServerError(output) => {
         108  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   80    109   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         110  +
                /* RustType.kt:516 */
   81    111   
                #[allow(unused_mut)]
         112  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   82    113   
                let mut builder = ::http::Response::builder();
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   83    115   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   84    116   
                    builder,
   85    117   
                    ::http::header::CONTENT_TYPE,
   86    118   
                    "text/plain",
   87    119   
                );
         120  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   88    121   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   89    122   
                    builder,
   90    123   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   91    124   
                    "InternalServerError",
   92    125   
                );
         126  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   93    127   
                let content_length = payload.len();
   94    128   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   95    129   
                    builder,
   96    130   
                    ::http::header::CONTENT_LENGTH,
   97    131   
                    content_length,
   98    132   
                );
         133  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   99    134   
                builder
  100    135   
                    .status(500)
  101    136   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  102         -
            }
         137  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         138  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  103    139   
        }
         140  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  104    141   
    })
         142  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  105    143   
}

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

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

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

@@ -1,1 +20,31 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_ignore_query_params_in_response_output_output_output(
    3      4   
    value: &crate::output::IgnoreQueryParamsInResponseOutput,
    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_ignore_query_params_in_response_output::ser_ignore_query_params_in_response_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_ignore_query_params_in_response_output_output(
   13     19   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    input: &crate::output::IgnoreQueryParamsInResponseOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* JsonSerializerGenerator.kt:382 */
   16     23   
    if let Some(var_1) = &input.baz {
          24  +
        /* JsonSerializerGenerator.kt:423 */
   17     25   
        object.key("baz").string(var_1.as_str());
          26  +
        /* JsonSerializerGenerator.kt:382 */
   18     27   
    }
          28  +
    /* JsonSerializerGenerator.kt:372 */
   19     29   
    Ok(())
          30  +
    /* JsonSerializerGenerator.kt:358 */
   20     31   
}

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

@@ -1,1 +506,709 @@
    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_input_and_output_with_headers_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::InputAndOutputWithHeadersInput,
    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 =
   18     23   
            crate::input::input_and_output_with_headers_input_internal::Builder::default();
          24  +
        /* RustType.kt:516 */
   19     25   
        #[allow(unused_variables)]
          26  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   20     27   
        let ::aws_smithy_runtime_api::http::RequestParts {
   21     28   
            uri, headers, body, ..
   22     29   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          30  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   23     31   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_boolean_list_header(&headers)? {
   24     32   
                                input = input.set_header_boolean_list(Some(value))
   25     33   
                            }
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   26     35   
        if let Some(value) =
   27     36   
            crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_byte_header(
   28     37   
                &headers,
   29     38   
            )?
   30     39   
        {
   31     40   
            input = input.set_header_byte(Some(value))
   32     41   
        }
          42  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   33     43   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_double_header(&headers)? {
   34     44   
                                input = input.set_header_double(Some(value))
   35     45   
                            }
          46  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   36     47   
        if let Some(value) =
   37     48   
            crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_enum_header(
   38     49   
                &headers,
   39     50   
            )?
   40     51   
        {
   41     52   
            input = input.set_header_enum(Some(value))
   42     53   
        }
          54  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   43     55   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_enum_list_header(&headers)? {
   44     56   
                                input = input.set_header_enum_list(Some(value))
   45     57   
                            }
          58  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   46     59   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_false_bool_header(&headers)? {
   47     60   
                                input = input.set_header_false_bool(Some(value))
   48     61   
                            }
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   49     63   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_float_header(&headers)? {
   50     64   
                                input = input.set_header_float(Some(value))
   51     65   
                            }
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   52     67   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_integer_header(&headers)? {
   53     68   
                                input = input.set_header_integer(Some(value))
   54     69   
                            }
          70  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   55     71   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_integer_enum_header(&headers)? {
   56     72   
                                input = input.set_header_integer_enum(Some(value))
   57     73   
                            }
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   58     75   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_integer_enum_list_header(&headers)? {
   59     76   
                                input = input.set_header_integer_enum_list(Some(value))
   60     77   
                            }
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   61     79   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_integer_list_header(&headers)? {
   62     80   
                                input = input.set_header_integer_list(Some(value))
   63     81   
                            }
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   64     83   
        if let Some(value) =
   65     84   
            crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_long_header(
   66     85   
                &headers,
   67     86   
            )?
   68     87   
        {
   69     88   
            input = input.set_header_long(Some(value))
   70     89   
        }
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   71     91   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_short_header(&headers)? {
   72     92   
                                input = input.set_header_short(Some(value))
   73     93   
                            }
          94  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   74     95   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_string_header(&headers)? {
   75     96   
                                input = input.set_header_string(Some(value))
   76     97   
                            }
          98  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   77     99   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_string_list_header(&headers)? {
   78    100   
                                input = input.set_header_string_list(Some(value))
   79    101   
                            }
         102  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   80    103   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_string_set_header(&headers)? {
   81    104   
                                input = input.set_header_string_set(Some(value))
   82    105   
                            }
         106  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   83    107   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_timestamp_list_header(&headers)? {
   84    108   
                                input = input.set_header_timestamp_list(Some(value))
   85    109   
                            }
         110  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   86    111   
        if let Some(value) = crate::protocol_serde::shape_input_and_output_with_headers_input::de_header_true_bool_header(&headers)? {
   87    112   
                                input = input.set_header_true_bool(Some(value))
   88    113   
                            }
         114  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   89    115   
        input.build()?
         116  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   90    117   
    })
         118  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   91    119   
}
   92    120   
         121  +
/* RustType.kt:516 */
   93    122   
#[allow(clippy::unnecessary_wraps)]
         123  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   94    124   
pub fn ser_input_and_output_with_headers_http_response(
   95    125   
    #[allow(unused_variables)] output: crate::output::InputAndOutputWithHeadersOutput,
   96    126   
) -> std::result::Result<
   97    127   
    ::aws_smithy_http_server::response::Response,
   98    128   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   99    129   
> {
         130  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
  100    131   
    Ok({
         132  +
        /* RustType.kt:516 */
  101    133   
        #[allow(unused_mut)]
         134  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
  102    135   
        let mut builder = ::http::Response::builder();
         136  +
        /* ServerHttpBoundProtocolGenerator.kt:629 */
  103    137   
        builder = crate::protocol_serde::shape_input_and_output_with_headers::ser_input_and_output_with_headers_headers(&output, builder)?;
         138  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
  104    139   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
  105    140   
            builder,
  106    141   
            ::http::header::CONTENT_TYPE,
  107    142   
            "application/json",
  108    143   
        );
         144  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
  109    145   
        let http_status: u16 = 200;
  110    146   
        builder = builder.status(http_status);
         147  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
  111    148   
        let payload =
  112         -
            crate::protocol_serde::shape_input_and_output_with_headers_output::ser_input_and_output_with_headers_output_output_output(&output)?
  113         -
        ;
         149  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_input_and_output_with_headers_output::ser_input_and_output_with_headers_output_output_output(&output)?
         150  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
         151  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
  114    152   
        let content_length = payload.len();
  115    153   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
  116    154   
            builder,
  117    155   
            ::http::header::CONTENT_LENGTH,
  118    156   
            content_length,
  119    157   
        );
         158  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
  120    159   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
         160  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
  121    161   
        builder.body(body)?
         162  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
  122    163   
    })
         164  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
  123    165   
}
  124    166   
         167  +
/* RustType.kt:516 */
  125    168   
#[allow(clippy::unnecessary_wraps)]
         169  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
  126    170   
pub fn ser_input_and_output_with_headers_http_error(
  127    171   
    error: &crate::error::InputAndOutputWithHeadersError,
  128    172   
) -> std::result::Result<
  129    173   
    ::aws_smithy_http_server::response::Response,
  130    174   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
  131    175   
> {
         176  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
  132    177   
    Ok({
         178  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
  133    179   
        match error {
         180  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  134    181   
            crate::error::InputAndOutputWithHeadersError::ValidationException(output) => {
         182  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  135    183   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         184  +
                /* RustType.kt:516 */
  136    185   
                #[allow(unused_mut)]
         186  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  137    187   
                let mut builder = ::http::Response::builder();
         188  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  138    189   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  139    190   
                    builder,
  140    191   
                    ::http::header::CONTENT_TYPE,
  141    192   
                    "application/json",
  142    193   
                );
         194  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  143    195   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  144    196   
                    builder,
  145    197   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  146    198   
                    "ValidationException",
  147    199   
                );
         200  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  148    201   
                let content_length = payload.len();
  149    202   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  150    203   
                    builder,
  151    204   
                    ::http::header::CONTENT_LENGTH,
  152    205   
                    content_length,
  153    206   
                );
         207  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  154    208   
                builder
  155    209   
                    .status(400)
  156    210   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         211  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
  157    212   
            }
         213  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  158    214   
            crate::error::InputAndOutputWithHeadersError::InternalServerError(output) => {
         215  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  159    216   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         217  +
                /* RustType.kt:516 */
  160    218   
                #[allow(unused_mut)]
         219  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  161    220   
                let mut builder = ::http::Response::builder();
         221  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  162    222   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  163    223   
                    builder,
  164    224   
                    ::http::header::CONTENT_TYPE,
  165    225   
                    "application/json",
  166    226   
                );
         227  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  167    228   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  168    229   
                    builder,
  169    230   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  170    231   
                    "InternalServerError",
  171    232   
                );
         233  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  172    234   
                let content_length = payload.len();
  173    235   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  174    236   
                    builder,
  175    237   
                    ::http::header::CONTENT_LENGTH,
  176    238   
                    content_length,
  177    239   
                );
         240  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  178    241   
                builder
  179    242   
                    .status(500)
  180    243   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  181         -
            }
         244  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         245  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  182    246   
        }
         247  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  183    248   
    })
         249  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  184    250   
}
  185    251   
         252  +
/* HttpBindingGenerator.kt:542 */
  186    253   
pub fn ser_input_and_output_with_headers_headers(
  187    254   
    input: &crate::output::InputAndOutputWithHeadersOutput,
  188    255   
    mut builder: ::http::response::Builder,
  189    256   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
  190    257   
{
         258  +
    /* HttpBindingGenerator.kt:592 */
  191    259   
    if let ::std::option::Option::Some(inner_1) = &input.header_string {
         260  +
        /* HttpBindingGenerator.kt:704 */
  192    261   
        let formatted_2 = inner_1.as_str();
         262  +
        /* HttpBindingGenerator.kt:705 */
  193    263   
        if !formatted_2.is_empty() {
         264  +
            /* HttpBindingGenerator.kt:706 */
  194    265   
            let header_value = formatted_2;
  195    266   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  196    267   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  197    268   
                    "header_string",
  198    269   
                    format!(
  199    270   
                        "`{}` cannot be used as a header value: {}",
  200    271   
                        &header_value, err
  201    272   
                    ),
  202    273   
                )
  203    274   
            })?;
  204    275   
            builder = builder.header("X-String", header_value);
         276  +
            /* HttpBindingGenerator.kt:705 */
  205    277   
        }
         278  +
        /* HttpBindingGenerator.kt:592 */
  206    279   
    }
         280  +
    /* HttpBindingGenerator.kt:592 */
  207    281   
    if let ::std::option::Option::Some(inner_3) = &input.header_byte {
         282  +
        /* HttpBindingGenerator.kt:690 */
  208    283   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_3);
         284  +
        /* HttpBindingGenerator.kt:704 */
  209    285   
        let formatted_4 = encoder.encode();
         286  +
        /* HttpBindingGenerator.kt:705 */
  210    287   
        if !formatted_4.is_empty() {
         288  +
            /* HttpBindingGenerator.kt:706 */
  211    289   
            let header_value = formatted_4;
  212    290   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  213    291   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  214    292   
                    "header_byte",
  215    293   
                    format!(
  216    294   
                        "`{}` cannot be used as a header value: {}",
  217    295   
                        &header_value, err
  218    296   
                    ),
  219    297   
                )
  220    298   
            })?;
  221    299   
            builder = builder.header("X-Byte", header_value);
         300  +
            /* HttpBindingGenerator.kt:705 */
  222    301   
        }
         302  +
        /* HttpBindingGenerator.kt:592 */
  223    303   
    }
         304  +
    /* HttpBindingGenerator.kt:592 */
  224    305   
    if let ::std::option::Option::Some(inner_5) = &input.header_short {
         306  +
        /* HttpBindingGenerator.kt:690 */
  225    307   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_5);
         308  +
        /* HttpBindingGenerator.kt:704 */
  226    309   
        let formatted_6 = encoder.encode();
         310  +
        /* HttpBindingGenerator.kt:705 */
  227    311   
        if !formatted_6.is_empty() {
         312  +
            /* HttpBindingGenerator.kt:706 */
  228    313   
            let header_value = formatted_6;
  229    314   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  230    315   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  231    316   
                    "header_short",
  232    317   
                    format!(
  233    318   
                        "`{}` cannot be used as a header value: {}",
  234    319   
                        &header_value, err
  235    320   
                    ),
  236    321   
                )
  237    322   
            })?;
  238    323   
            builder = builder.header("X-Short", header_value);
         324  +
            /* HttpBindingGenerator.kt:705 */
  239    325   
        }
         326  +
        /* HttpBindingGenerator.kt:592 */
  240    327   
    }
         328  +
    /* HttpBindingGenerator.kt:592 */
  241    329   
    if let ::std::option::Option::Some(inner_7) = &input.header_integer {
         330  +
        /* HttpBindingGenerator.kt:690 */
  242    331   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_7);
         332  +
        /* HttpBindingGenerator.kt:704 */
  243    333   
        let formatted_8 = encoder.encode();
         334  +
        /* HttpBindingGenerator.kt:705 */
  244    335   
        if !formatted_8.is_empty() {
         336  +
            /* HttpBindingGenerator.kt:706 */
  245    337   
            let header_value = formatted_8;
  246    338   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  247    339   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  248    340   
                    "header_integer",
  249    341   
                    format!(
  250    342   
                        "`{}` cannot be used as a header value: {}",
  251    343   
                        &header_value, err
  252    344   
                    ),
  253    345   
                )
  254    346   
            })?;
  255    347   
            builder = builder.header("X-Integer", header_value);
         348  +
            /* HttpBindingGenerator.kt:705 */
  256    349   
        }
         350  +
        /* HttpBindingGenerator.kt:592 */
  257    351   
    }
         352  +
    /* HttpBindingGenerator.kt:592 */
  258    353   
    if let ::std::option::Option::Some(inner_9) = &input.header_long {
         354  +
        /* HttpBindingGenerator.kt:690 */
  259    355   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_9);
         356  +
        /* HttpBindingGenerator.kt:704 */
  260    357   
        let formatted_10 = encoder.encode();
         358  +
        /* HttpBindingGenerator.kt:705 */
  261    359   
        if !formatted_10.is_empty() {
         360  +
            /* HttpBindingGenerator.kt:706 */
  262    361   
            let header_value = formatted_10;
  263    362   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  264    363   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  265    364   
                    "header_long",
  266    365   
                    format!(
  267    366   
                        "`{}` cannot be used as a header value: {}",
  268    367   
                        &header_value, err
  269    368   
                    ),
  270    369   
                )
  271    370   
            })?;
  272    371   
            builder = builder.header("X-Long", header_value);
         372  +
            /* HttpBindingGenerator.kt:705 */
  273    373   
        }
         374  +
        /* HttpBindingGenerator.kt:592 */
  274    375   
    }
         376  +
    /* HttpBindingGenerator.kt:592 */
  275    377   
    if let ::std::option::Option::Some(inner_11) = &input.header_float {
         378  +
        /* HttpBindingGenerator.kt:690 */
  276    379   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_11);
         380  +
        /* HttpBindingGenerator.kt:704 */
  277    381   
        let formatted_12 = encoder.encode();
         382  +
        /* HttpBindingGenerator.kt:705 */
  278    383   
        if !formatted_12.is_empty() {
         384  +
            /* HttpBindingGenerator.kt:706 */
  279    385   
            let header_value = formatted_12;
  280    386   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  281    387   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  282    388   
                    "header_float",
  283    389   
                    format!(
  284    390   
                        "`{}` cannot be used as a header value: {}",
  285    391   
                        &header_value, err
  286    392   
                    ),
  287    393   
                )
  288    394   
            })?;
  289    395   
            builder = builder.header("X-Float", header_value);
         396  +
            /* HttpBindingGenerator.kt:705 */
  290    397   
        }
         398  +
        /* HttpBindingGenerator.kt:592 */
  291    399   
    }
         400  +
    /* HttpBindingGenerator.kt:592 */
  292    401   
    if let ::std::option::Option::Some(inner_13) = &input.header_double {
         402  +
        /* HttpBindingGenerator.kt:690 */
  293    403   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_13);
         404  +
        /* HttpBindingGenerator.kt:704 */
  294    405   
        let formatted_14 = encoder.encode();
         406  +
        /* HttpBindingGenerator.kt:705 */
  295    407   
        if !formatted_14.is_empty() {
         408  +
            /* HttpBindingGenerator.kt:706 */
  296    409   
            let header_value = formatted_14;
  297    410   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  298    411   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  299    412   
                    "header_double",
  300    413   
                    format!(
  301    414   
                        "`{}` cannot be used as a header value: {}",
  302    415   
                        &header_value, err
  303    416   
                    ),
  304    417   
                )
  305    418   
            })?;
  306    419   
            builder = builder.header("X-Double", header_value);
         420  +
            /* HttpBindingGenerator.kt:705 */
  307    421   
        }
         422  +
        /* HttpBindingGenerator.kt:592 */
  308    423   
    }
         424  +
    /* HttpBindingGenerator.kt:592 */
  309    425   
    if let ::std::option::Option::Some(inner_15) = &input.header_true_bool {
         426  +
        /* HttpBindingGenerator.kt:690 */
  310    427   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_15);
         428  +
        /* HttpBindingGenerator.kt:704 */
  311    429   
        let formatted_16 = encoder.encode();
         430  +
        /* HttpBindingGenerator.kt:705 */
  312    431   
        if !formatted_16.is_empty() {
         432  +
            /* HttpBindingGenerator.kt:706 */
  313    433   
            let header_value = formatted_16;
  314    434   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  315    435   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  316    436   
                    "header_true_bool",
  317    437   
                    format!(
  318    438   
                        "`{}` cannot be used as a header value: {}",
  319    439   
                        &header_value, err
  320    440   
                    ),
  321    441   
                )
  322    442   
            })?;
  323    443   
            builder = builder.header("X-Boolean1", header_value);
         444  +
            /* HttpBindingGenerator.kt:705 */
  324    445   
        }
         446  +
        /* HttpBindingGenerator.kt:592 */
  325    447   
    }
         448  +
    /* HttpBindingGenerator.kt:592 */
  326    449   
    if let ::std::option::Option::Some(inner_17) = &input.header_false_bool {
         450  +
        /* HttpBindingGenerator.kt:690 */
  327    451   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_17);
         452  +
        /* HttpBindingGenerator.kt:704 */
  328    453   
        let formatted_18 = encoder.encode();
         454  +
        /* HttpBindingGenerator.kt:705 */
  329    455   
        if !formatted_18.is_empty() {
         456  +
            /* HttpBindingGenerator.kt:706 */
  330    457   
            let header_value = formatted_18;
  331    458   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  332    459   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  333    460   
                    "header_false_bool",
  334    461   
                    format!(
  335    462   
                        "`{}` cannot be used as a header value: {}",
  336    463   
                        &header_value, err
  337    464   
                    ),
  338    465   
                )
  339    466   
            })?;
  340    467   
            builder = builder.header("X-Boolean2", header_value);
         468  +
            /* HttpBindingGenerator.kt:705 */
  341    469   
        }
         470  +
        /* HttpBindingGenerator.kt:592 */
  342    471   
    }
         472  +
    /* HttpBindingGenerator.kt:592 */
  343    473   
    if let ::std::option::Option::Some(inner_19) = &input.header_string_list {
         474  +
        /* HttpBindingGenerator.kt:646 */
  344    475   
        for inner_20 in inner_19 {
         476  +
            /* HttpBindingGenerator.kt:704 */
  345    477   
            let formatted_21 = ::aws_smithy_http::header::quote_header_value(inner_20.as_str());
         478  +
            /* HttpBindingGenerator.kt:705 */
  346    479   
            if !formatted_21.is_empty() {
         480  +
                /* HttpBindingGenerator.kt:706 */
  347    481   
                let header_value = formatted_21;
  348    482   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  349    483   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  350    484   
                        "header_string_list",
  351    485   
                        format!(
  352    486   
                            "`{}` cannot be used as a header value: {}",
  353    487   
                            &header_value, err
  354    488   
                        ),
  355    489   
                    )
  356    490   
                })?;
  357    491   
                builder = builder.header("X-StringList", header_value);
         492  +
                /* HttpBindingGenerator.kt:705 */
  358    493   
            }
         494  +
            /* HttpBindingGenerator.kt:646 */
  359    495   
        }
         496  +
        /* HttpBindingGenerator.kt:592 */
  360    497   
    }
         498  +
    /* HttpBindingGenerator.kt:592 */
  361    499   
    if let ::std::option::Option::Some(inner_22) = &input.header_string_set {
         500  +
        /* HttpBindingGenerator.kt:646 */
  362    501   
        for inner_23 in inner_22 {
         502  +
            /* HttpBindingGenerator.kt:704 */
  363    503   
            let formatted_24 = ::aws_smithy_http::header::quote_header_value(inner_23.as_str());
         504  +
            /* HttpBindingGenerator.kt:705 */
  364    505   
            if !formatted_24.is_empty() {
         506  +
                /* HttpBindingGenerator.kt:706 */
  365    507   
                let header_value = formatted_24;
  366    508   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  367    509   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  368    510   
                        "header_string_set",
  369    511   
                        format!(
  370    512   
                            "`{}` cannot be used as a header value: {}",
  371    513   
                            &header_value, err
  372    514   
                        ),
  373    515   
                    )
  374    516   
                })?;
  375    517   
                builder = builder.header("X-StringSet", header_value);
         518  +
                /* HttpBindingGenerator.kt:705 */
  376    519   
            }
         520  +
            /* HttpBindingGenerator.kt:646 */
  377    521   
        }
         522  +
        /* HttpBindingGenerator.kt:592 */
  378    523   
    }
         524  +
    /* HttpBindingGenerator.kt:592 */
  379    525   
    if let ::std::option::Option::Some(inner_25) = &input.header_integer_list {
         526  +
        /* HttpBindingGenerator.kt:646 */
  380    527   
        for inner_26 in inner_25 {
         528  +
            /* HttpBindingGenerator.kt:690 */
  381    529   
            let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_26);
         530  +
            /* HttpBindingGenerator.kt:704 */
  382    531   
            let formatted_27 = encoder.encode();
         532  +
            /* HttpBindingGenerator.kt:705 */
  383    533   
            if !formatted_27.is_empty() {
         534  +
                /* HttpBindingGenerator.kt:706 */
  384    535   
                let header_value = formatted_27;
  385    536   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  386    537   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  387    538   
                        "header_integer_list",
  388    539   
                        format!(
  389    540   
                            "`{}` cannot be used as a header value: {}",
  390    541   
                            &header_value, err
  391    542   
                        ),
  392    543   
                    )
  393    544   
                })?;
  394    545   
                builder = builder.header("X-IntegerList", header_value);
         546  +
                /* HttpBindingGenerator.kt:705 */
  395    547   
            }
         548  +
            /* HttpBindingGenerator.kt:646 */
  396    549   
        }
         550  +
        /* HttpBindingGenerator.kt:592 */
  397    551   
    }
         552  +
    /* HttpBindingGenerator.kt:592 */
  398    553   
    if let ::std::option::Option::Some(inner_28) = &input.header_boolean_list {
         554  +
        /* HttpBindingGenerator.kt:646 */
  399    555   
        for inner_29 in inner_28 {
         556  +
            /* HttpBindingGenerator.kt:690 */
  400    557   
            let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_29);
         558  +
            /* HttpBindingGenerator.kt:704 */
  401    559   
            let formatted_30 = encoder.encode();
         560  +
            /* HttpBindingGenerator.kt:705 */
  402    561   
            if !formatted_30.is_empty() {
         562  +
                /* HttpBindingGenerator.kt:706 */
  403    563   
                let header_value = formatted_30;
  404    564   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  405    565   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  406    566   
                        "header_boolean_list",
  407    567   
                        format!(
  408    568   
                            "`{}` cannot be used as a header value: {}",
  409    569   
                            &header_value, err
  410    570   
                        ),
  411    571   
                    )
  412    572   
                })?;
  413    573   
                builder = builder.header("X-BooleanList", header_value);
         574  +
                /* HttpBindingGenerator.kt:705 */
  414    575   
            }
         576  +
            /* HttpBindingGenerator.kt:646 */
  415    577   
        }
         578  +
        /* HttpBindingGenerator.kt:592 */
  416    579   
    }
         580  +
    /* HttpBindingGenerator.kt:592 */
  417    581   
    if let ::std::option::Option::Some(inner_31) = &input.header_timestamp_list {
         582  +
        /* HttpBindingGenerator.kt:646 */
  418    583   
        for inner_32 in inner_31 {
         584  +
            /* HttpBindingGenerator.kt:704 */
  419    585   
            let formatted_33 = inner_32.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
         586  +
            /* HttpBindingGenerator.kt:705 */
  420    587   
            if !formatted_33.is_empty() {
         588  +
                /* HttpBindingGenerator.kt:706 */
  421    589   
                let header_value = formatted_33;
  422    590   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  423    591   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  424    592   
                        "header_timestamp_list",
  425    593   
                        format!(
  426    594   
                            "`{}` cannot be used as a header value: {}",
  427    595   
                            &header_value, err
  428    596   
                        ),
  429    597   
                    )
  430    598   
                })?;
  431    599   
                builder = builder.header("X-TimestampList", header_value);
         600  +
                /* HttpBindingGenerator.kt:705 */
  432    601   
            }
         602  +
            /* HttpBindingGenerator.kt:646 */
  433    603   
        }
         604  +
        /* HttpBindingGenerator.kt:592 */
  434    605   
    }
         606  +
    /* HttpBindingGenerator.kt:592 */
  435    607   
    if let ::std::option::Option::Some(inner_34) = &input.header_enum {
         608  +
        /* HttpBindingGenerator.kt:704 */
  436    609   
        let formatted_35 = inner_34.as_str();
         610  +
        /* HttpBindingGenerator.kt:705 */
  437    611   
        if !formatted_35.is_empty() {
         612  +
            /* HttpBindingGenerator.kt:706 */
  438    613   
            let header_value = formatted_35;
  439    614   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  440    615   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  441    616   
                    "header_enum",
  442    617   
                    format!(
  443    618   
                        "`{}` cannot be used as a header value: {}",
  444    619   
                        &header_value, err
  445    620   
                    ),
  446    621   
                )
  447    622   
            })?;
  448    623   
            builder = builder.header("X-Enum", header_value);
         624  +
            /* HttpBindingGenerator.kt:705 */
  449    625   
        }
         626  +
        /* HttpBindingGenerator.kt:592 */
  450    627   
    }
         628  +
    /* HttpBindingGenerator.kt:592 */
  451    629   
    if let ::std::option::Option::Some(inner_36) = &input.header_enum_list {
         630  +
        /* HttpBindingGenerator.kt:646 */
  452    631   
        for inner_37 in inner_36 {
         632  +
            /* HttpBindingGenerator.kt:704 */
  453    633   
            let formatted_38 = ::aws_smithy_http::header::quote_header_value(inner_37.as_str());
         634  +
            /* HttpBindingGenerator.kt:705 */
  454    635   
            if !formatted_38.is_empty() {
         636  +
                /* HttpBindingGenerator.kt:706 */
  455    637   
                let header_value = formatted_38;
  456    638   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  457    639   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  458    640   
                        "header_enum_list",
  459    641   
                        format!(
  460    642   
                            "`{}` cannot be used as a header value: {}",
  461    643   
                            &header_value, err
  462    644   
                        ),
  463    645   
                    )
  464    646   
                })?;
  465    647   
                builder = builder.header("X-EnumList", header_value);
         648  +
                /* HttpBindingGenerator.kt:705 */
  466    649   
            }
         650  +
            /* HttpBindingGenerator.kt:646 */
  467    651   
        }
         652  +
        /* HttpBindingGenerator.kt:592 */
  468    653   
    }
         654  +
    /* HttpBindingGenerator.kt:592 */
  469    655   
    if let ::std::option::Option::Some(inner_39) = &input.header_integer_enum {
         656  +
        /* HttpBindingGenerator.kt:690 */
  470    657   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_39);
         658  +
        /* HttpBindingGenerator.kt:704 */
  471    659   
        let formatted_40 = encoder.encode();
         660  +
        /* HttpBindingGenerator.kt:705 */
  472    661   
        if !formatted_40.is_empty() {
         662  +
            /* HttpBindingGenerator.kt:706 */
  473    663   
            let header_value = formatted_40;
  474    664   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  475    665   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  476    666   
                    "header_integer_enum",
  477    667   
                    format!(
  478    668   
                        "`{}` cannot be used as a header value: {}",
  479    669   
                        &header_value, err
  480    670   
                    ),
  481    671   
                )
  482    672   
            })?;
  483    673   
            builder = builder.header("X-IntegerEnum", header_value);
         674  +
            /* HttpBindingGenerator.kt:705 */
  484    675   
        }
         676  +
        /* HttpBindingGenerator.kt:592 */
  485    677   
    }
         678  +
    /* HttpBindingGenerator.kt:592 */
  486    679   
    if let ::std::option::Option::Some(inner_41) = &input.header_integer_enum_list {
         680  +
        /* HttpBindingGenerator.kt:646 */
  487    681   
        for inner_42 in inner_41 {
         682  +
            /* HttpBindingGenerator.kt:690 */
  488    683   
            let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_42);
         684  +
            /* HttpBindingGenerator.kt:704 */
  489    685   
            let formatted_43 = encoder.encode();
         686  +
            /* HttpBindingGenerator.kt:705 */
  490    687   
            if !formatted_43.is_empty() {
         688  +
                /* HttpBindingGenerator.kt:706 */
  491    689   
                let header_value = formatted_43;
  492    690   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  493    691   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  494    692   
                        "header_integer_enum_list",
  495    693   
                        format!(
  496    694   
                            "`{}` cannot be used as a header value: {}",
  497    695   
                            &header_value, err
  498    696   
                        ),
  499    697   
                    )
  500    698   
                })?;
  501    699   
                builder = builder.header("X-IntegerEnumList", header_value);
         700  +
                /* HttpBindingGenerator.kt:705 */
  502    701   
            }
         702  +
            /* HttpBindingGenerator.kt:646 */
  503    703   
        }
         704  +
        /* HttpBindingGenerator.kt:592 */
  504    705   
    }
         706  +
    /* HttpBindingGenerator.kt:555 */
  505    707   
    Ok(builder)
         708  +
    /* HttpBindingGenerator.kt:542 */
  506    709   
}

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

@@ -1,1 +272,355 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:153 */
    2      3   
pub(crate) fn de_header_boolean_list_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::option::Option<::std::vec::Vec<bool>>,
    6      7   
    ::aws_smithy_http::header::ParseError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:160 */
    8     10   
    let headers = header_map.get_all("X-BooleanList");
          11  +
    /* HttpBindingGenerator.kt:404 */
    9     12   
    let var_1 = ::aws_smithy_http::header::read_many_primitive::<bool>(headers)?;
          13  +
    /* HttpBindingGenerator.kt:430 */
   10     14   
    Ok(if !var_1.is_empty() { Some(var_1) } else { None })
          15  +
    /* HttpBindingGenerator.kt:153 */
   11     16   
}
   12     17   
          18  +
/* HttpBindingGenerator.kt:153 */
   13     19   
pub(crate) fn de_header_byte_header(
   14     20   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   15     21   
) -> ::std::result::Result<::std::option::Option<i8>, ::aws_smithy_http::header::ParseError> {
          22  +
    /* HttpBindingGenerator.kt:160 */
   16     23   
    let headers = header_map.get_all("X-Byte");
          24  +
    /* HttpBindingGenerator.kt:404 */
   17     25   
    let var_2 = ::aws_smithy_http::header::read_many_primitive::<i8>(headers)?;
          26  +
    /* HttpBindingGenerator.kt:468 */
   18     27   
    if var_2.len() > 1 {
   19     28   
        Err(::aws_smithy_http::header::ParseError::new(format!(
   20     29   
            "expected one item but found {}",
   21     30   
            var_2.len()
   22     31   
        )))
   23     32   
    } else {
   24     33   
        let mut var_2 = var_2;
   25     34   
        Ok(var_2.pop())
   26     35   
    }
          36  +
    /* HttpBindingGenerator.kt:153 */
   27     37   
}
   28     38   
          39  +
/* HttpBindingGenerator.kt:153 */
   29     40   
pub(crate) fn de_header_double_header(
   30     41   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   31     42   
) -> ::std::result::Result<::std::option::Option<f64>, ::aws_smithy_http::header::ParseError> {
          43  +
    /* HttpBindingGenerator.kt:160 */
   32     44   
    let headers = header_map.get_all("X-Double");
          45  +
    /* HttpBindingGenerator.kt:404 */
   33     46   
    let var_3 = ::aws_smithy_http::header::read_many_primitive::<f64>(headers)?;
          47  +
    /* HttpBindingGenerator.kt:468 */
   34     48   
    if var_3.len() > 1 {
   35     49   
        Err(::aws_smithy_http::header::ParseError::new(format!(
   36     50   
            "expected one item but found {}",
   37     51   
            var_3.len()
   38     52   
        )))
   39     53   
    } else {
   40     54   
        let mut var_3 = var_3;
   41     55   
        Ok(var_3.pop())
   42     56   
    }
          57  +
    /* HttpBindingGenerator.kt:153 */
   43     58   
}
   44     59   
          60  +
/* HttpBindingGenerator.kt:153 */
   45     61   
pub(crate) fn de_header_enum_header(
   46     62   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   47     63   
) -> ::std::result::Result<
   48     64   
    ::std::option::Option<::std::string::String>,
   49     65   
    ::aws_smithy_http::header::ParseError,
   50     66   
> {
          67  +
    /* HttpBindingGenerator.kt:160 */
   51     68   
    let headers = header_map.get_all("X-Enum");
          69  +
    /* HttpBindingGenerator.kt:375 */
   52     70   
    ::aws_smithy_http::header::one_or_none(headers)
          71  +
    /* HttpBindingGenerator.kt:153 */
   53     72   
}
   54     73   
          74  +
/* HttpBindingGenerator.kt:153 */
   55     75   
pub(crate) fn de_header_enum_list_header(
   56     76   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   57     77   
) -> ::std::result::Result<
   58     78   
    ::std::option::Option<
   59     79   
        crate::unconstrained::foo_enum_list_unconstrained::FooEnumListUnconstrained,
   60     80   
    >,
   61     81   
    ::aws_smithy_http::header::ParseError,
   62     82   
> {
          83  +
    /* HttpBindingGenerator.kt:160 */
   63     84   
    let headers = header_map.get_all("X-EnumList");
          85  +
    /* HttpBindingGenerator.kt:409 */
   64     86   
    let var_4: Vec<::std::string::String> = ::aws_smithy_http::header::read_many_from_str(headers)?;
          87  +
    /* HttpBindingGenerator.kt:456 */
   65     88   
    Ok(if !var_4.is_empty() {
   66     89   
        Some(crate::unconstrained::foo_enum_list_unconstrained::FooEnumListUnconstrained(var_4))
   67     90   
    } else {
   68     91   
        None
   69     92   
    })
          93  +
    /* HttpBindingGenerator.kt:153 */
   70     94   
}
   71     95   
          96  +
/* HttpBindingGenerator.kt:153 */
   72     97   
pub(crate) fn de_header_false_bool_header(
   73     98   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   74     99   
) -> ::std::result::Result<::std::option::Option<bool>, ::aws_smithy_http::header::ParseError> {
         100  +
    /* HttpBindingGenerator.kt:160 */
   75    101   
    let headers = header_map.get_all("X-Boolean2");
         102  +
    /* HttpBindingGenerator.kt:404 */
   76    103   
    let var_5 = ::aws_smithy_http::header::read_many_primitive::<bool>(headers)?;
         104  +
    /* HttpBindingGenerator.kt:468 */
   77    105   
    if var_5.len() > 1 {
   78    106   
        Err(::aws_smithy_http::header::ParseError::new(format!(
   79    107   
            "expected one item but found {}",
   80    108   
            var_5.len()
   81    109   
        )))
   82    110   
    } else {
   83    111   
        let mut var_5 = var_5;
   84    112   
        Ok(var_5.pop())
   85    113   
    }
         114  +
    /* HttpBindingGenerator.kt:153 */
   86    115   
}
   87    116   
         117  +
/* HttpBindingGenerator.kt:153 */
   88    118   
pub(crate) fn de_header_float_header(
   89    119   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   90    120   
) -> ::std::result::Result<::std::option::Option<f32>, ::aws_smithy_http::header::ParseError> {
         121  +
    /* HttpBindingGenerator.kt:160 */
   91    122   
    let headers = header_map.get_all("X-Float");
         123  +
    /* HttpBindingGenerator.kt:404 */
   92    124   
    let var_6 = ::aws_smithy_http::header::read_many_primitive::<f32>(headers)?;
         125  +
    /* HttpBindingGenerator.kt:468 */
   93    126   
    if var_6.len() > 1 {
   94    127   
        Err(::aws_smithy_http::header::ParseError::new(format!(
   95    128   
            "expected one item but found {}",
   96    129   
            var_6.len()
   97    130   
        )))
   98    131   
    } else {
   99    132   
        let mut var_6 = var_6;
  100    133   
        Ok(var_6.pop())
  101    134   
    }
         135  +
    /* HttpBindingGenerator.kt:153 */
  102    136   
}
  103    137   
         138  +
/* HttpBindingGenerator.kt:153 */
  104    139   
pub(crate) fn de_header_integer_header(
  105    140   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  106    141   
) -> ::std::result::Result<::std::option::Option<i32>, ::aws_smithy_http::header::ParseError> {
         142  +
    /* HttpBindingGenerator.kt:160 */
  107    143   
    let headers = header_map.get_all("X-Integer");
         144  +
    /* HttpBindingGenerator.kt:404 */
  108    145   
    let var_7 = ::aws_smithy_http::header::read_many_primitive::<i32>(headers)?;
         146  +
    /* HttpBindingGenerator.kt:468 */
  109    147   
    if var_7.len() > 1 {
  110    148   
        Err(::aws_smithy_http::header::ParseError::new(format!(
  111    149   
            "expected one item but found {}",
  112    150   
            var_7.len()
  113    151   
        )))
  114    152   
    } else {
  115    153   
        let mut var_7 = var_7;
  116    154   
        Ok(var_7.pop())
  117    155   
    }
         156  +
    /* HttpBindingGenerator.kt:153 */
  118    157   
}
  119    158   
         159  +
/* HttpBindingGenerator.kt:153 */
  120    160   
pub(crate) fn de_header_integer_enum_header(
  121    161   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  122    162   
) -> ::std::result::Result<::std::option::Option<i32>, ::aws_smithy_http::header::ParseError> {
         163  +
    /* HttpBindingGenerator.kt:160 */
  123    164   
    let headers = header_map.get_all("X-IntegerEnum");
         165  +
    /* HttpBindingGenerator.kt:404 */
  124    166   
    let var_8 = ::aws_smithy_http::header::read_many_primitive::<i32>(headers)?;
         167  +
    /* HttpBindingGenerator.kt:468 */
  125    168   
    if var_8.len() > 1 {
  126    169   
        Err(::aws_smithy_http::header::ParseError::new(format!(
  127    170   
            "expected one item but found {}",
  128    171   
            var_8.len()
  129    172   
        )))
  130    173   
    } else {
  131    174   
        let mut var_8 = var_8;
  132    175   
        Ok(var_8.pop())
  133    176   
    }
         177  +
    /* HttpBindingGenerator.kt:153 */
  134    178   
}
  135    179   
         180  +
/* HttpBindingGenerator.kt:153 */
  136    181   
pub(crate) fn de_header_integer_enum_list_header(
  137    182   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  138    183   
) -> ::std::result::Result<
  139    184   
    ::std::option::Option<::std::vec::Vec<i32>>,
  140    185   
    ::aws_smithy_http::header::ParseError,
  141    186   
> {
         187  +
    /* HttpBindingGenerator.kt:160 */
  142    188   
    let headers = header_map.get_all("X-IntegerEnumList");
         189  +
    /* HttpBindingGenerator.kt:404 */
  143    190   
    let var_9 = ::aws_smithy_http::header::read_many_primitive::<i32>(headers)?;
         191  +
    /* HttpBindingGenerator.kt:430 */
  144    192   
    Ok(if !var_9.is_empty() { Some(var_9) } else { None })
         193  +
    /* HttpBindingGenerator.kt:153 */
  145    194   
}
  146    195   
         196  +
/* HttpBindingGenerator.kt:153 */
  147    197   
pub(crate) fn de_header_integer_list_header(
  148    198   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  149    199   
) -> ::std::result::Result<
  150    200   
    ::std::option::Option<::std::vec::Vec<i32>>,
  151    201   
    ::aws_smithy_http::header::ParseError,
  152    202   
> {
         203  +
    /* HttpBindingGenerator.kt:160 */
  153    204   
    let headers = header_map.get_all("X-IntegerList");
         205  +
    /* HttpBindingGenerator.kt:404 */
  154    206   
    let var_10 = ::aws_smithy_http::header::read_many_primitive::<i32>(headers)?;
         207  +
    /* HttpBindingGenerator.kt:430 */
  155    208   
    Ok(if !var_10.is_empty() {
  156    209   
        Some(var_10)
  157    210   
    } else {
  158    211   
        None
  159    212   
    })
         213  +
    /* HttpBindingGenerator.kt:153 */
  160    214   
}
  161    215   
         216  +
/* HttpBindingGenerator.kt:153 */
  162    217   
pub(crate) fn de_header_long_header(
  163    218   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  164    219   
) -> ::std::result::Result<::std::option::Option<i64>, ::aws_smithy_http::header::ParseError> {
         220  +
    /* HttpBindingGenerator.kt:160 */
  165    221   
    let headers = header_map.get_all("X-Long");
         222  +
    /* HttpBindingGenerator.kt:404 */
  166    223   
    let var_11 = ::aws_smithy_http::header::read_many_primitive::<i64>(headers)?;
         224  +
    /* HttpBindingGenerator.kt:468 */
  167    225   
    if var_11.len() > 1 {
  168    226   
        Err(::aws_smithy_http::header::ParseError::new(format!(
  169    227   
            "expected one item but found {}",
  170    228   
            var_11.len()
  171    229   
        )))
  172    230   
    } else {
  173    231   
        let mut var_11 = var_11;
  174    232   
        Ok(var_11.pop())
  175    233   
    }
         234  +
    /* HttpBindingGenerator.kt:153 */
  176    235   
}
  177    236   
         237  +
/* HttpBindingGenerator.kt:153 */
  178    238   
pub(crate) fn de_header_short_header(
  179    239   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  180    240   
) -> ::std::result::Result<::std::option::Option<i16>, ::aws_smithy_http::header::ParseError> {
         241  +
    /* HttpBindingGenerator.kt:160 */
  181    242   
    let headers = header_map.get_all("X-Short");
         243  +
    /* HttpBindingGenerator.kt:404 */
  182    244   
    let var_12 = ::aws_smithy_http::header::read_many_primitive::<i16>(headers)?;
         245  +
    /* HttpBindingGenerator.kt:468 */
  183    246   
    if var_12.len() > 1 {
  184    247   
        Err(::aws_smithy_http::header::ParseError::new(format!(
  185    248   
            "expected one item but found {}",
  186    249   
            var_12.len()
  187    250   
        )))
  188    251   
    } else {
  189    252   
        let mut var_12 = var_12;
  190    253   
        Ok(var_12.pop())
  191    254   
    }
         255  +
    /* HttpBindingGenerator.kt:153 */
  192    256   
}
  193    257   
         258  +
/* HttpBindingGenerator.kt:153 */
  194    259   
pub(crate) fn de_header_string_header(
  195    260   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  196    261   
) -> ::std::result::Result<
  197    262   
    ::std::option::Option<::std::string::String>,
  198    263   
    ::aws_smithy_http::header::ParseError,
  199    264   
> {
         265  +
    /* HttpBindingGenerator.kt:160 */
  200    266   
    let headers = header_map.get_all("X-String");
         267  +
    /* HttpBindingGenerator.kt:375 */
  201    268   
    ::aws_smithy_http::header::one_or_none(headers)
         269  +
    /* HttpBindingGenerator.kt:153 */
  202    270   
}
  203    271   
         272  +
/* HttpBindingGenerator.kt:153 */
  204    273   
pub(crate) fn de_header_string_list_header(
  205    274   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  206    275   
) -> ::std::result::Result<
  207    276   
    ::std::option::Option<::std::vec::Vec<::std::string::String>>,
  208    277   
    ::aws_smithy_http::header::ParseError,
  209    278   
> {
         279  +
    /* HttpBindingGenerator.kt:160 */
  210    280   
    let headers = header_map.get_all("X-StringList");
         281  +
    /* HttpBindingGenerator.kt:409 */
  211    282   
    let var_13: Vec<::std::string::String> =
  212    283   
        ::aws_smithy_http::header::read_many_from_str(headers)?;
         284  +
    /* HttpBindingGenerator.kt:430 */
  213    285   
    Ok(if !var_13.is_empty() {
  214    286   
        Some(var_13)
  215    287   
    } else {
  216    288   
        None
  217    289   
    })
         290  +
    /* HttpBindingGenerator.kt:153 */
  218    291   
}
  219    292   
         293  +
/* HttpBindingGenerator.kt:153 */
  220    294   
pub(crate) fn de_header_string_set_header(
  221    295   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  222    296   
) -> ::std::result::Result<
  223    297   
    ::std::option::Option<crate::unconstrained::string_set_unconstrained::StringSetUnconstrained>,
  224    298   
    ::aws_smithy_http::header::ParseError,
  225    299   
> {
         300  +
    /* HttpBindingGenerator.kt:160 */
  226    301   
    let headers = header_map.get_all("X-StringSet");
         302  +
    /* HttpBindingGenerator.kt:409 */
  227    303   
    let var_14: Vec<::std::string::String> =
  228    304   
        ::aws_smithy_http::header::read_many_from_str(headers)?;
         305  +
    /* HttpBindingGenerator.kt:456 */
  229    306   
    Ok(if !var_14.is_empty() {
  230    307   
        Some(crate::unconstrained::string_set_unconstrained::StringSetUnconstrained(var_14))
  231    308   
    } else {
  232    309   
        None
  233    310   
    })
         311  +
    /* HttpBindingGenerator.kt:153 */
  234    312   
}
  235    313   
         314  +
/* HttpBindingGenerator.kt:153 */
  236    315   
pub(crate) fn de_header_timestamp_list_header(
  237    316   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  238    317   
) -> ::std::result::Result<
  239    318   
    ::std::option::Option<::std::vec::Vec<::aws_smithy_http_server_python::types::DateTime>>,
  240    319   
    ::aws_smithy_http::header::ParseError,
  241    320   
> {
         321  +
    /* HttpBindingGenerator.kt:160 */
  242    322   
    let headers = header_map.get_all("X-TimestampList");
  243         -
    let var_15: Vec<::aws_smithy_http_server_python::types::DateTime> =
  244         -
        ::aws_smithy_http::header::many_dates(
  245         -
            headers,
  246         -
            ::aws_smithy_types::date_time::Format::HttpDate,
  247         -
        )?
  248         -
        .into_iter()
  249         -
        .map(::aws_smithy_http_server_python::types::DateTime::from)
  250         -
        .collect();
         323  +
    /* HttpBindingGenerator.kt:394 */
         324  +
    let var_15: Vec<::aws_smithy_http_server_python::types::DateTime> = ::aws_smithy_http::header::many_dates(headers, ::aws_smithy_types::date_time::Format::HttpDate)?
         325  +
    /* PythonServerProtocolLoader.kt:84 */.into_iter().map(::aws_smithy_http_server_python::types::DateTime::from).collect()
         326  +
    /* HttpBindingGenerator.kt:402 */;
         327  +
    /* HttpBindingGenerator.kt:430 */
  251    328   
    Ok(if !var_15.is_empty() {
  252    329   
        Some(var_15)
  253    330   
    } else {
  254    331   
        None
  255    332   
    })
         333  +
    /* HttpBindingGenerator.kt:153 */
  256    334   
}
  257    335   
         336  +
/* HttpBindingGenerator.kt:153 */
  258    337   
pub(crate) fn de_header_true_bool_header(
  259    338   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  260    339   
) -> ::std::result::Result<::std::option::Option<bool>, ::aws_smithy_http::header::ParseError> {
         340  +
    /* HttpBindingGenerator.kt:160 */
  261    341   
    let headers = header_map.get_all("X-Boolean1");
         342  +
    /* HttpBindingGenerator.kt:404 */
  262    343   
    let var_16 = ::aws_smithy_http::header::read_many_primitive::<bool>(headers)?;
         344  +
    /* HttpBindingGenerator.kt:468 */
  263    345   
    if var_16.len() > 1 {
  264    346   
        Err(::aws_smithy_http::header::ParseError::new(format!(
  265    347   
            "expected one item but found {}",
  266    348   
            var_16.len()
  267    349   
        )))
  268    350   
    } else {
  269    351   
        let mut var_16 = var_16;
  270    352   
        Ok(var_16.pop())
  271    353   
    }
         354  +
    /* HttpBindingGenerator.kt:153 */
  272    355   
}

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/src/protocol_serde/shape_input_and_output_with_headers_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_input_and_output_with_headers_output_output_output(
    3      4   
    value: &crate::output::InputAndOutputWithHeadersOutput,
    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_input_and_output_with_headers_output::ser_input_and_output_with_headers_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_input_and_output_with_headers_output_output(
   13     19   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    #[allow(unused_variables)] input: &crate::output::InputAndOutputWithHeadersOutput,
   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/rust-server-codegen-python/src/protocol_serde/shape_integer_enum_list.rs

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

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

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

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

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

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

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

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

@@ -1,1 +23,34 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_internal_server_error_error(
    3      4   
    value: &crate::error::InternalServerError,
    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_internal_server_error::ser_internal_server_error(
    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_internal_server_error(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::error::InternalServerError,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* SerializerUtil.kt:42 */
   19     26   
    {
          27  +
        /* JsonSerializerGenerator.kt:423 */
   20     28   
        object.key("message").string(input.message.as_str());
          29  +
        /* SerializerUtil.kt:42 */
   21     30   
    }
          31  +
    /* JsonSerializerGenerator.kt:372 */
   22     32   
    Ok(())
          33  +
    /* JsonSerializerGenerator.kt:358 */
   23     34   
}

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

@@ -1,1 +20,31 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_invalid_greeting_error(
    3      4   
    value: &crate::error::InvalidGreeting,
    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_invalid_greeting::ser_invalid_greeting(&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_invalid_greeting(
   13     19   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    input: &crate::error::InvalidGreeting,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* JsonSerializerGenerator.kt:382 */
   16     23   
    if let Some(var_1) = &input.message {
          24  +
        /* JsonSerializerGenerator.kt:423 */
   17     25   
        object.key("Message").string(var_1.as_str());
          26  +
        /* JsonSerializerGenerator.kt:382 */
   18     27   
    }
          28  +
    /* JsonSerializerGenerator.kt:372 */
   19     29   
    Ok(())
          30  +
    /* JsonSerializerGenerator.kt:358 */
   20     31   
}