Server Test Python

Server Test Python

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943 (ignoring whitespace)

Files changed:

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

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

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

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

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/src/protocol_serde/shape_empty_input_and_empty_output_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_empty_input_and_empty_output_output_output_output(
    3      4   
    value: &crate::output::EmptyInputAndEmptyOutputOutput,
    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_empty_input_and_empty_output_output::ser_empty_input_and_empty_output_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_empty_input_and_empty_output_output_output(
   13     19   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    #[allow(unused_variables)] input: &crate::output::EmptyInputAndEmptyOutputOutput,
   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_endpoint_operation.rs

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

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

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

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

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

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

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

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

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

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

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

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/src/protocol_serde/shape_foo_error.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_foo_error_error(
    3      4   
    value: &crate::error::FooError,
    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_foo_error::ser_foo_error(&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_foo_error(
   13     19   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    #[allow(unused_variables)] input: &crate::error::FooError,
   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_fractional_seconds.rs

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

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

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

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

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

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

@@ -1,1 +200,277 @@
    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_greeting_with_errors_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::GreetingWithErrorsInput,
    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::greeting_with_errors_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_greeting_with_errors_http_response(
   29     42   
    #[allow(unused_variables)] output: crate::output::GreetingWithErrorsOutput,
   30     43   
) -> std::result::Result<
   31     44   
    ::aws_smithy_http_server::response::Response,
   32     45   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   33     46   
> {
          47  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   34     48   
    Ok({
          49  +
        /* RustType.kt:516 */
   35     50   
        #[allow(unused_mut)]
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   36     52   
        let mut builder = ::http::Response::builder();
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:629 */
   37     54   
        builder =
   38     55   
            crate::protocol_serde::shape_greeting_with_errors::ser_greeting_with_errors_headers(
   39     56   
                &output, builder,
   40     57   
            )?;
          58  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   41     59   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   42     60   
            builder,
   43     61   
            ::http::header::CONTENT_TYPE,
   44     62   
            "application/json",
   45     63   
        );
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   46     65   
        let http_status: u16 = 200;
   47     66   
        builder = builder.status(http_status);
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   48     68   
        let payload =
   49         -
            crate::protocol_serde::shape_greeting_with_errors_output::ser_greeting_with_errors_output_output_output(&output)?
   50         -
        ;
          69  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_greeting_with_errors_output::ser_greeting_with_errors_output_output_output(&output)?
          70  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   51     72   
        let content_length = payload.len();
   52     73   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   53     74   
            builder,
   54     75   
            ::http::header::CONTENT_LENGTH,
   55     76   
            content_length,
   56     77   
        );
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   57     79   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   58     81   
        builder.body(body)?
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   59     83   
    })
          84  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   60     85   
}
   61     86   
          87  +
/* RustType.kt:516 */
   62     88   
#[allow(clippy::unnecessary_wraps)]
          89  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   63     90   
pub fn ser_greeting_with_errors_http_error(
   64     91   
    error: &crate::error::GreetingWithErrorsError,
   65     92   
) -> std::result::Result<
   66     93   
    ::aws_smithy_http_server::response::Response,
   67     94   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   68     95   
> {
          96  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   69     97   
    Ok({
          98  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   70     99   
        match error {
         100  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   71    101   
            crate::error::GreetingWithErrorsError::InvalidGreeting(output) => {
         102  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   72    103   
                let payload =
   73    104   
                    crate::protocol_serde::shape_invalid_greeting::ser_invalid_greeting_error(
   74    105   
                        output,
   75    106   
                    )?;
         107  +
                /* RustType.kt:516 */
   76    108   
                #[allow(unused_mut)]
         109  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   77    110   
                let mut builder = ::http::Response::builder();
         111  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   78    112   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   79    113   
                    builder,
   80    114   
                    ::http::header::CONTENT_TYPE,
   81    115   
                    "application/json",
   82    116   
                );
         117  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   83    118   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   84    119   
                    builder,
   85    120   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   86    121   
                    "InvalidGreeting",
   87    122   
                );
         123  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   88    124   
                let content_length = payload.len();
   89    125   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   90    126   
                    builder,
   91    127   
                    ::http::header::CONTENT_LENGTH,
   92    128   
                    content_length,
   93    129   
                );
         130  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   94    131   
                builder
   95    132   
                    .status(400)
   96    133   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         134  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
   97    135   
            }
         136  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   98    137   
            crate::error::GreetingWithErrorsError::ComplexError(output) => {
         138  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   99    139   
                let payload =
  100    140   
                    crate::protocol_serde::shape_complex_error::ser_complex_error_error(output)?;
         141  +
                /* RustType.kt:516 */
  101    142   
                #[allow(unused_mut)]
         143  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  102    144   
                let mut builder = ::http::Response::builder();
         145  +
                /* ServerHttpBoundProtocolGenerator.kt:629 */
  103    146   
                builder = crate::protocol_serde::shape_complex_error::ser_complex_error_headers(
  104    147   
                    output, builder,
  105    148   
                )?;
         149  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  106    150   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  107    151   
                    builder,
  108    152   
                    ::http::header::CONTENT_TYPE,
  109    153   
                    "application/json",
  110    154   
                );
         155  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  111    156   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  112    157   
                    builder,
  113    158   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  114    159   
                    "ComplexError",
  115    160   
                );
         161  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  116    162   
                let content_length = payload.len();
  117    163   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  118    164   
                    builder,
  119    165   
                    ::http::header::CONTENT_LENGTH,
  120    166   
                    content_length,
  121    167   
                );
         168  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  122    169   
                builder
  123    170   
                    .status(403)
  124    171   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         172  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
  125    173   
            }
         174  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  126    175   
            crate::error::GreetingWithErrorsError::FooError(output) => {
         176  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  127    177   
                let payload = crate::protocol_serde::shape_foo_error::ser_foo_error_error(output)?;
         178  +
                /* RustType.kt:516 */
  128    179   
                #[allow(unused_mut)]
         180  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  129    181   
                let mut builder = ::http::Response::builder();
         182  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  130    183   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  131    184   
                    builder,
  132    185   
                    ::http::header::CONTENT_TYPE,
  133    186   
                    "application/json",
  134    187   
                );
         188  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  135    189   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  136    190   
                    builder,
  137    191   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  138    192   
                    "FooError",
  139    193   
                );
         194  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  140    195   
                let content_length = payload.len();
  141    196   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  142    197   
                    builder,
  143    198   
                    ::http::header::CONTENT_LENGTH,
  144    199   
                    content_length,
  145    200   
                );
         201  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  146    202   
                builder
  147    203   
                    .status(500)
  148    204   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         205  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
  149    206   
            }
         207  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  150    208   
            crate::error::GreetingWithErrorsError::InternalServerError(output) => {
         209  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  151    210   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         211  +
                /* RustType.kt:516 */
  152    212   
                #[allow(unused_mut)]
         213  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  153    214   
                let mut builder = ::http::Response::builder();
         215  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  154    216   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  155    217   
                    builder,
  156    218   
                    ::http::header::CONTENT_TYPE,
  157    219   
                    "application/json",
  158    220   
                );
         221  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  159    222   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  160    223   
                    builder,
  161    224   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  162    225   
                    "InternalServerError",
  163    226   
                );
         227  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  164    228   
                let content_length = payload.len();
  165    229   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  166    230   
                    builder,
  167    231   
                    ::http::header::CONTENT_LENGTH,
  168    232   
                    content_length,
  169    233   
                );
         234  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  170    235   
                builder
  171    236   
                    .status(500)
  172    237   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         238  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         239  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  173    240   
        }
  174         -
        }
         241  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  175    242   
    })
         243  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  176    244   
}
  177    245   
         246  +
/* HttpBindingGenerator.kt:542 */
  178    247   
pub fn ser_greeting_with_errors_headers(
  179    248   
    input: &crate::output::GreetingWithErrorsOutput,
  180    249   
    mut builder: ::http::response::Builder,
  181    250   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
  182    251   
{
         252  +
    /* HttpBindingGenerator.kt:592 */
  183    253   
    if let ::std::option::Option::Some(inner_1) = &input.greeting {
         254  +
        /* HttpBindingGenerator.kt:704 */
  184    255   
        let formatted_2 = inner_1.as_str();
         256  +
        /* HttpBindingGenerator.kt:705 */
  185    257   
        if !formatted_2.is_empty() {
         258  +
            /* HttpBindingGenerator.kt:706 */
  186    259   
            let header_value = formatted_2;
  187    260   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  188    261   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  189    262   
                    "greeting",
  190    263   
                    format!(
  191    264   
                        "`{}` cannot be used as a header value: {}",
  192    265   
                        &header_value, err
  193    266   
                    ),
  194    267   
                )
  195    268   
            })?;
  196    269   
            builder = builder.header("X-Greeting", header_value);
         270  +
            /* HttpBindingGenerator.kt:705 */
  197    271   
        }
         272  +
        /* HttpBindingGenerator.kt:592 */
  198    273   
    }
         274  +
    /* HttpBindingGenerator.kt:555 */
  199    275   
    Ok(builder)
         276  +
    /* HttpBindingGenerator.kt:542 */
  200    277   
}

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/src/protocol_serde/shape_greeting_with_errors_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_greeting_with_errors_output_output_output(
    3      4   
    value: &crate::output::GreetingWithErrorsOutput,
    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_greeting_with_errors_output::ser_greeting_with_errors_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_greeting_with_errors_output_output(
   13     19   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    #[allow(unused_variables)] input: &crate::output::GreetingWithErrorsOutput,
   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_host_with_path_operation.rs

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