Server Test

Server Test

rev. ee474c7509d7728618c23068f3741e8e5b339ef9

Files changed:

tmp-codegen-diff/codegen-server-test/pokemon-service-server-sdk-http0x/rust-server-codegen/src/protocol_serde.rs

@@ -0,1 +0,59 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) mod shape_capture_pokemon;
           3  +
           4  +
pub(crate) mod shape_check_health;
           5  +
           6  +
pub(crate) mod shape_do_nothing;
           7  +
           8  +
pub(crate) mod shape_get_pokemon_species;
           9  +
          10  +
pub(crate) mod shape_get_server_statistics;
          11  +
          12  +
pub(crate) mod shape_get_storage;
          13  +
          14  +
pub(crate) mod shape_stream_pokemon_radio;
          15  +
          16  +
pub(crate) mod shape_capture_pokemon_input;
          17  +
          18  +
pub(crate) mod shape_do_nothing_output;
          19  +
          20  +
pub(crate) mod shape_get_pokemon_species_input;
          21  +
          22  +
pub(crate) mod shape_get_pokemon_species_output;
          23  +
          24  +
pub(crate) mod shape_get_server_statistics_output;
          25  +
          26  +
pub(crate) mod shape_get_storage_input;
          27  +
          28  +
pub(crate) mod shape_get_storage_output;
          29  +
          30  +
pub(crate) mod shape_invalid_pokeball_error;
          31  +
          32  +
pub(crate) mod shape_master_ball_unsuccessful;
          33  +
          34  +
pub(crate) mod shape_resource_not_found_exception;
          35  +
          36  +
pub(crate) mod shape_storage_access_not_authorized;
          37  +
          38  +
pub(crate) mod shape_stream_pokemon_radio_output;
          39  +
          40  +
pub(crate) mod shape_throttling_error;
          41  +
          42  +
pub(crate) mod shape_unsupported_region_error;
          43  +
          44  +
pub(crate) mod shape_validation_exception;
          45  +
          46  +
/* JsonParserGenerator.kt:227 */
          47  +
pub(crate) fn or_empty_doc(data: &[u8]) -> &[u8] {
          48  +
    if data.is_empty() {
          49  +
        b"{}"
          50  +
    } else {
          51  +
        data
          52  +
    }
          53  +
}
          54  +
          55  +
pub(crate) mod shape_capturing_payload;
          56  +
          57  +
pub(crate) mod shape_flavor_text;
          58  +
          59  +
pub(crate) mod shape_validation_exception_field;

tmp-codegen-diff/codegen-server-test/pokemon-service-server-sdk-http0x/rust-server-codegen/src/protocol_serde/shape_capture_pokemon.rs

@@ -0,1 +0,313 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
           3  +
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
           5  +
pub async fn de_capture_pokemon_http_request<B>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::CapturePokemonInput,
           9  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
          10  +
>
          11  +
where
          12  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          13  +
    B: Into<::aws_smithy_types::byte_stream::ByteStream>,
          14  +
    B::Data: Send,
          15  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          16  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          17  +
{
          18  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
          19  +
    Ok({
          20  +
        /* RustType.kt:534 */
          21  +
        #[allow(unused_mut)]
          22  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
          23  +
        let mut input = crate::input::capture_pokemon_input::Builder::default();
          24  +
        /* RustType.kt:534 */
          25  +
        #[allow(unused_variables)]
          26  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
          27  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          28  +
            uri, headers, body, ..
          29  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          30  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
          31  +
        if let Some(value) = {
          32  +
            let mut receiver =
          33  +
                crate::protocol_serde::shape_capture_pokemon_input::de_events_payload(
          34  +
                    &mut body.into().into_inner(),
          35  +
                )?;
          36  +
            if let Some(_initial_event) = receiver
          37  +
                                                .try_recv_initial(::aws_smithy_legacy_http::event_stream::InitialMessageType::Request)
          38  +
                                                .await
          39  +
                                                .map_err(
          40  +
                                                    |ev_error| ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection::ConstraintViolation(
          41  +
                                                        #[allow(clippy::useless_conversion)]
          42  +
                                                        format!("{ev_error}").into()
          43  +
                                                    )
          44  +
                                                )? {
          45  +
                                                
          46  +
                                            }
          47  +
            Some(receiver)
          48  +
        } {
          49  +
            input = input.set_events(value)
          50  +
        }
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:1134 */
          52  +
        let input_string = uri.path();
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:1146 */
          54  +
        let (input_string, (_, m1)) =
          55  +
            ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
          56  +
                ::nom::sequence::preceded(
          57  +
                    ::nom::bytes::complete::tag("/"),
          58  +
                    ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>(
          59  +
                        "capture-pokemon-event",
          60  +
                    ),
          61  +
                ),
          62  +
                ::nom::sequence::preceded(
          63  +
                    ::nom::bytes::complete::tag("/"),
          64  +
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
          65  +
                        ::nom::bytes::complete::take_until("/"),
          66  +
                        ::nom::combinator::rest,
          67  +
                    )),
          68  +
                ),
          69  +
            ))(input_string)?;
          70  +
        debug_assert_eq!("", input_string);
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:1157 */
          72  +
        input =
          73  +
            input.set_region(crate::protocol_serde::shape_capture_pokemon_input::de_region(m1)?);
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
          75  +
        input.build()?
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
          77  +
    })
          78  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
          79  +
}
          80  +
          81  +
/* RustType.kt:534 */
          82  +
#[allow(clippy::unnecessary_wraps)]
          83  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
          84  +
pub fn ser_capture_pokemon_http_response(
          85  +
    #[allow(unused_variables)] output: crate::output::CapturePokemonOutput,
          86  +
) -> std::result::Result<
          87  +
    ::aws_smithy_legacy_http_server::response::Response,
          88  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          89  +
> {
          90  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
          91  +
    Ok({
          92  +
        /* RustType.kt:534 */
          93  +
        #[allow(unused_mut)]
          94  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          95  +
        let mut builder = ::http::Response::builder();
          96  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
          97  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          98  +
            builder,
          99  +
            ::http::header::CONTENT_TYPE,
         100  +
            "application/vnd.amazon.eventstream",
         101  +
        );
         102  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
         103  +
        let http_status: u16 = 200;
         104  +
        builder = builder.status(http_status);
         105  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
         106  +
        let body = ::aws_smithy_legacy_http_server::body::boxed(
         107  +
            ::aws_smithy_legacy_http_server::body::Body::wrap_stream(
         108  +
                /* ServerHttpBoundProtocolGenerator.kt:142 */
         109  +
                {
         110  +
                    let error_marshaller =
         111  +
                        crate::event_stream_serde::CapturePokemonEventsErrorMarshaller::new();
         112  +
                    let marshaller =
         113  +
                        crate::event_stream_serde::CapturePokemonEventsMarshaller::new();
         114  +
                    let signer = ::aws_smithy_eventstream::frame::NoOpSigner {};
         115  +
                    output
         116  +
                        .events
         117  +
                        .into_body_stream(marshaller, error_marshaller, signer)
         118  +
                }, /* ServerHttpBoundProtocolGenerator.kt:575 */
         119  +
            ),
         120  +
        );
         121  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
         122  +
        builder.body(body)?
         123  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
         124  +
    })
         125  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
         126  +
}
         127  +
         128  +
/* RustType.kt:534 */
         129  +
#[allow(clippy::unnecessary_wraps)]
         130  +
/* ServerHttpBoundProtocolGenerator.kt:471 */
         131  +
pub fn ser_capture_pokemon_http_error(
         132  +
    error: &crate::error::CapturePokemonError,
         133  +
) -> std::result::Result<
         134  +
    ::aws_smithy_legacy_http_server::response::Response,
         135  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
         136  +
> {
         137  +
    /* ServerHttpBoundProtocolGenerator.kt:476 */
         138  +
    Ok({
         139  +
        /* ServerHttpBoundProtocolGenerator.kt:492 */
         140  +
        match error {
         141  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
         142  +
            crate::error::CapturePokemonError::UnsupportedRegionError(output) => {
         143  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
         144  +
                let payload = crate::protocol_serde::shape_unsupported_region_error::ser_unsupported_region_error_error(output)?;
         145  +
                /* RustType.kt:534 */
         146  +
                #[allow(unused_mut)]
         147  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         148  +
                let mut builder = ::http::Response::builder();
         149  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
         150  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         151  +
                    builder,
         152  +
                    ::http::header::CONTENT_TYPE,
         153  +
                    "application/vnd.amazon.eventstream",
         154  +
                );
         155  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
         156  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         157  +
                    builder,
         158  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         159  +
                    "UnsupportedRegionError",
         160  +
                );
         161  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
         162  +
                let content_length = payload.len();
         163  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         164  +
                    builder,
         165  +
                    ::http::header::CONTENT_LENGTH,
         166  +
                    content_length,
         167  +
                );
         168  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
         169  +
                builder
         170  +
                    .status(500)
         171  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         172  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         173  +
            }
         174  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
         175  +
            crate::error::CapturePokemonError::ThrottlingError(output) => {
         176  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
         177  +
                let payload =
         178  +
                    crate::protocol_serde::shape_throttling_error::ser_throttling_error_error(
         179  +
                        output,
         180  +
                    )?;
         181  +
                /* RustType.kt:534 */
         182  +
                #[allow(unused_mut)]
         183  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         184  +
                let mut builder = ::http::Response::builder();
         185  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
         186  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         187  +
                    builder,
         188  +
                    ::http::header::CONTENT_TYPE,
         189  +
                    "application/vnd.amazon.eventstream",
         190  +
                );
         191  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
         192  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         193  +
                    builder,
         194  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         195  +
                    "ThrottlingError",
         196  +
                );
         197  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
         198  +
                let content_length = payload.len();
         199  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         200  +
                    builder,
         201  +
                    ::http::header::CONTENT_LENGTH,
         202  +
                    content_length,
         203  +
                );
         204  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
         205  +
                builder
         206  +
                    .status(400)
         207  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         208  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         209  +
            }
         210  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
         211  +
            crate::error::CapturePokemonError::ValidationException(output) => {
         212  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
         213  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         214  +
                /* RustType.kt:534 */
         215  +
                #[allow(unused_mut)]
         216  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         217  +
                let mut builder = ::http::Response::builder();
         218  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
         219  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         220  +
                    builder,
         221  +
                    ::http::header::CONTENT_TYPE,
         222  +
                    "application/vnd.amazon.eventstream",
         223  +
                );
         224  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
         225  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         226  +
                    builder,
         227  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         228  +
                    "ValidationException",
         229  +
                );
         230  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
         231  +
                let content_length = payload.len();
         232  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         233  +
                    builder,
         234  +
                    ::http::header::CONTENT_LENGTH,
         235  +
                    content_length,
         236  +
                );
         237  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
         238  +
                builder
         239  +
                    .status(400)
         240  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         241  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         242  +
            }
         243  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
         244  +
            crate::error::CapturePokemonError::MasterBallUnsuccessful(output) => {
         245  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
         246  +
                let payload = crate::protocol_serde::shape_master_ball_unsuccessful::ser_master_ball_unsuccessful_error(output)?;
         247  +
                /* RustType.kt:534 */
         248  +
                #[allow(unused_mut)]
         249  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         250  +
                let mut builder = ::http::Response::builder();
         251  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
         252  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         253  +
                    builder,
         254  +
                    ::http::header::CONTENT_TYPE,
         255  +
                    "application/vnd.amazon.eventstream",
         256  +
                );
         257  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
         258  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         259  +
                    builder,
         260  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         261  +
                    "MasterBallUnsuccessful",
         262  +
                );
         263  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
         264  +
                let content_length = payload.len();
         265  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         266  +
                    builder,
         267  +
                    ::http::header::CONTENT_LENGTH,
         268  +
                    content_length,
         269  +
                );
         270  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
         271  +
                builder
         272  +
                    .status(500)
         273  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         274  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         275  +
            }
         276  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
         277  +
            crate::error::CapturePokemonError::InvalidPokeballError(output) => {
         278  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
         279  +
                let payload = crate::protocol_serde::shape_invalid_pokeball_error::ser_invalid_pokeball_error_error(output)?;
         280  +
                /* RustType.kt:534 */
         281  +
                #[allow(unused_mut)]
         282  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         283  +
                let mut builder = ::http::Response::builder();
         284  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
         285  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         286  +
                    builder,
         287  +
                    ::http::header::CONTENT_TYPE,
         288  +
                    "application/vnd.amazon.eventstream",
         289  +
                );
         290  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
         291  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         292  +
                    builder,
         293  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         294  +
                    "InvalidPokeballError",
         295  +
                );
         296  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
         297  +
                let content_length = payload.len();
         298  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         299  +
                    builder,
         300  +
                    ::http::header::CONTENT_LENGTH,
         301  +
                    content_length,
         302  +
                );
         303  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
         304  +
                builder
         305  +
                    .status(400)
         306  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         307  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         308  +
            } /* ServerHttpBoundProtocolGenerator.kt:492 */
         309  +
        }
         310  +
        /* ServerHttpBoundProtocolGenerator.kt:476 */
         311  +
    })
         312  +
    /* ServerHttpBoundProtocolGenerator.kt:471 */
         313  +
}

tmp-codegen-diff/codegen-server-test/pokemon-service-server-sdk-http0x/rust-server-codegen/src/protocol_serde/shape_capture_pokemon_input.rs

@@ -0,1 +0,35 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:236 */
           3  +
pub fn de_events_payload(
           4  +
    body: &mut ::aws_smithy_types::body::SdkBody,
           5  +
) -> std::result::Result<
           6  +
    ::aws_smithy_legacy_http::event_stream::Receiver<
           7  +
        crate::model::AttemptCapturingPokemonEvent,
           8  +
        crate::error::AttemptCapturingPokemonEventError,
           9  +
    >,
          10  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
          11  +
> {
          12  +
    /* HttpBindingGenerator.kt:278 */
          13  +
    let unmarshaller = crate::event_stream_serde::AttemptCapturingPokemonEventUnmarshaller::new();
          14  +
    /* HttpBindingGenerator.kt:296 */
          15  +
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
          16  +
    let receiver = ::aws_smithy_legacy_http::event_stream::Receiver::new(unmarshaller, body);
          17  +
    Ok(receiver)
          18  +
    /* HttpBindingGenerator.kt:236 */
          19  +
}
          20  +
          21  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
          22  +
pub fn de_region(
          23  +
    value: &str,
          24  +
) -> std::result::Result<
          25  +
    ::std::string::String,
          26  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
          27  +
> {
          28  +
    /* ServerHttpBoundProtocolGenerator.kt:1463 */
          29  +
    let value = ::percent_encoding::percent_decode_str(value)
          30  +
        .decode_utf8()?
          31  +
        .into_owned();
          32  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
          33  +
    Ok(value)
          34  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
          35  +
}

tmp-codegen-diff/codegen-server-test/pokemon-service-server-sdk-http0x/rust-server-codegen/src/protocol_serde/shape_capturing_payload.rs

@@ -0,1 +0,122 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:175 */
           3  +
pub(crate) fn de_capturing_payload_payload(
           4  +
    input: &[u8],
           5  +
) -> ::std::result::Result<
           6  +
    crate::model::CapturingPayload,
           7  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
           8  +
> {
           9  +
    /* JsonParserGenerator.kt:187 */
          10  +
    let mut tokens_owned =
          11  +
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(input))
          12  +
            .peekable();
          13  +
    let tokens = &mut tokens_owned;
          14  +
    /* JsonParserGenerator.kt:194 */
          15  +
    let result =
          16  +
    /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_capturing_payload::de_capturing_payload(tokens)?
          17  +
    /* JsonParserGenerator.kt:196 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("expected payload member value"));
          18  +
    /* JsonParserGenerator.kt:250 */
          19  +
    if tokens.next().is_some() {
          20  +
        /* JsonParserGenerator.kt:251 */
          21  +
        return Err(
          22  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          23  +
                "found more JSON tokens after completing parsing",
          24  +
            ),
          25  +
        );
          26  +
        /* JsonParserGenerator.kt:250 */
          27  +
    }
          28  +
    /* JsonParserGenerator.kt:198 */
          29  +
    result
          30  +
    /* JsonParserGenerator.kt:175 */
          31  +
}
          32  +
          33  +
/* JsonParserGenerator.kt:516 */
          34  +
pub(crate) fn de_capturing_payload<'a, I>(
          35  +
    tokens: &mut ::std::iter::Peekable<I>,
          36  +
) -> ::std::result::Result<
          37  +
    Option<crate::model::CapturingPayload>,
          38  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
          39  +
>
          40  +
where
          41  +
    I: Iterator<
          42  +
        Item = Result<
          43  +
            ::aws_smithy_json::deserialize::Token<'a>,
          44  +
            ::aws_smithy_json::deserialize::error::DeserializeError,
          45  +
        >,
          46  +
    >,
          47  +
{
          48  +
    /* JsonParserGenerator.kt:712 */
          49  +
    match tokens.next().transpose()? {
          50  +
        /* JsonParserGenerator.kt:713 */
          51  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          52  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          53  +
            /* RustType.kt:534 */
          54  +
            #[allow(unused_mut)]
          55  +
            /* JsonParserGenerator.kt:526 */
          56  +
            let mut builder = crate::model::capturing_payload::Builder::default();
          57  +
            /* JsonParserGenerator.kt:684 */
          58  +
            loop {
          59  +
                /* JsonParserGenerator.kt:685 */
          60  +
                match tokens.next().transpose()? {
          61  +
                    /* JsonParserGenerator.kt:686 */
          62  +
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          63  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          64  +
                        /* JsonParserGenerator.kt:260 */
          65  +
                        match key.to_unescaped()?.as_ref() {
          66  +
                            /* JsonParserGenerator.kt:262 */
          67  +
                            "name" => {
          68  +
                                /* JsonParserGenerator.kt:272 */
          69  +
                                builder = builder.set_name(
          70  +
                                    /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          71  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          72  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
          73  +
                                        /* JsonParserGenerator.kt:339 */)
          74  +
                                    /* JsonParserGenerator.kt:354 */).transpose()?
          75  +
                                /* JsonParserGenerator.kt:272 */);
          76  +
                                /* JsonParserGenerator.kt:262 */
          77  +
                            }
          78  +
                            /* JsonParserGenerator.kt:262 */
          79  +
                            "pokeball" => {
          80  +
                                /* JsonParserGenerator.kt:272 */
          81  +
                                builder = builder.set_pokeball(
          82  +
                                    /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          83  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          84  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
          85  +
                                        /* JsonParserGenerator.kt:339 */)
          86  +
                                    /* JsonParserGenerator.kt:354 */).transpose()?
          87  +
                                /* JsonParserGenerator.kt:272 */);
          88  +
                                /* JsonParserGenerator.kt:262 */
          89  +
                            }
          90  +
                            /* JsonParserGenerator.kt:290 */
          91  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
          92  +
                        }
          93  +
                        /* JsonParserGenerator.kt:686 */
          94  +
                    }
          95  +
                    /* JsonParserGenerator.kt:695 */
          96  +
                    other => {
          97  +
                        return Err(
          98  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          99  +
                                format!("expected object key or end object, found: {other:?}"),
         100  +
                            ),
         101  +
                        )
         102  +
                    } /* JsonParserGenerator.kt:685 */
         103  +
                }
         104  +
                /* JsonParserGenerator.kt:684 */
         105  +
            }
         106  +
            /* JsonParserGenerator.kt:540 */
         107  +
            Ok(Some(builder.build()))
         108  +
            /* JsonParserGenerator.kt:713 */
         109  +
        }
         110  +
        /* JsonParserGenerator.kt:722 */
         111  +
        _ => {
         112  +
            /* JsonParserGenerator.kt:723 */
         113  +
            Err(
         114  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         115  +
                    "expected start object or null",
         116  +
                ),
         117  +
            )
         118  +
            /* JsonParserGenerator.kt:722 */
         119  +
        } /* JsonParserGenerator.kt:712 */
         120  +
    }
         121  +
    /* JsonParserGenerator.kt:516 */
         122  +
}

tmp-codegen-diff/codegen-server-test/pokemon-service-server-sdk-http0x/rust-server-codegen/src/protocol_serde/shape_check_health.rs

@@ -0,1 +0,82 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
           3  +
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
           5  +
pub async fn de_check_health_http_request<B>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::CheckHealthInput,
           9  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
          10  +
>
          11  +
where
          12  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          13  +
    B::Data: Send,
          14  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          15  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          16  +
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
          18  +
    Ok({
          19  +
        /* RustType.kt:534 */
          20  +
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
          22  +
        let mut input = crate::input::check_health_input::Builder::default();
          23  +
        /* RustType.kt:534 */
          24  +
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
          26  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          27  +
            uri, headers, body, ..
          28  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:873 */
          30  +
        ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
          31  +
            &headers, None,
          32  +
        )?;
          33  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
          34  +
        input.build()
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
          36  +
    })
          37  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
          38  +
}
          39  +
          40  +
/* RustType.kt:534 */
          41  +
#[allow(clippy::unnecessary_wraps)]
          42  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
          43  +
pub fn ser_check_health_http_response(
          44  +
    #[allow(unused_variables)] output: crate::output::CheckHealthOutput,
          45  +
) -> std::result::Result<
          46  +
    ::aws_smithy_legacy_http_server::response::Response,
          47  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          48  +
> {
          49  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
          50  +
    Ok({
          51  +
        /* RustType.kt:534 */
          52  +
        #[allow(unused_mut)]
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          54  +
        let mut builder = ::http::Response::builder();
          55  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
          56  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          57  +
            builder,
          58  +
            ::http::header::CONTENT_TYPE,
          59  +
            "application/json",
          60  +
        );
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
          62  +
        let http_status: u16 = 200;
          63  +
        builder = builder.status(http_status);
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          65  +
        let payload =
          66  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          68  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
          69  +
        let content_length = payload.len();
          70  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          71  +
            builder,
          72  +
            ::http::header::CONTENT_LENGTH,
          73  +
            content_length,
          74  +
        );
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
          76  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
          78  +
        builder.body(body)?
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
          80  +
    })
          81  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
          82  +
}

tmp-codegen-diff/codegen-server-test/pokemon-service-server-sdk-http0x/rust-server-codegen/src/protocol_serde/shape_do_nothing.rs

@@ -0,1 +0,78 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
           3  +
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
           5  +
pub async fn de_do_nothing_http_request<B>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::DoNothingInput,
           9  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
          10  +
>
          11  +
where
          12  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          13  +
    B::Data: Send,
          14  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          15  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          16  +
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
          18  +
    Ok({
          19  +
        /* RustType.kt:534 */
          20  +
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
          22  +
        let mut input = crate::input::do_nothing_input::Builder::default();
          23  +
        /* RustType.kt:534 */
          24  +
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
          26  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          27  +
            uri, headers, body, ..
          28  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
          30  +
        input.build()
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
          32  +
    })
          33  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
          34  +
}
          35  +
          36  +
/* RustType.kt:534 */
          37  +
#[allow(clippy::unnecessary_wraps)]
          38  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
          39  +
pub fn ser_do_nothing_http_response(
          40  +
    #[allow(unused_variables)] output: crate::output::DoNothingOutput,
          41  +
) -> std::result::Result<
          42  +
    ::aws_smithy_legacy_http_server::response::Response,
          43  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          44  +
> {
          45  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
          46  +
    Ok({
          47  +
        /* RustType.kt:534 */
          48  +
        #[allow(unused_mut)]
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          50  +
        let mut builder = ::http::Response::builder();
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
          52  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          53  +
            builder,
          54  +
            ::http::header::CONTENT_TYPE,
          55  +
            "application/json",
          56  +
        );
          57  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
          58  +
        let http_status: u16 = 200;
          59  +
        builder = builder.status(http_status);
          60  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          61  +
        let payload =
          62  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_do_nothing_output::ser_do_nothing_output_output_output(&output)?
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
          65  +
        let content_length = payload.len();
          66  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          67  +
            builder,
          68  +
            ::http::header::CONTENT_LENGTH,
          69  +
            content_length,
          70  +
        );
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
          72  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
          74  +
        builder.body(body)?
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
          76  +
    })
          77  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
          78  +
}

tmp-codegen-diff/codegen-server-test/pokemon-service-server-sdk-http0x/rust-server-codegen/src/protocol_serde/shape_do_nothing_output.rs

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

tmp-codegen-diff/codegen-server-test/pokemon-service-server-sdk-http0x/rust-server-codegen/src/protocol_serde/shape_flavor_text.rs

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

tmp-codegen-diff/codegen-server-test/pokemon-service-server-sdk-http0x/rust-server-codegen/src/protocol_serde/shape_get_pokemon_species.rs

@@ -0,1 +0,186 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
           3  +
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
           5  +
pub async fn de_get_pokemon_species_http_request<B>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::GetPokemonSpeciesInput,
           9  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
          10  +
>
          11  +
where
          12  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          13  +
    B::Data: Send,
          14  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          15  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          16  +
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
          18  +
    Ok({
          19  +
        /* RustType.kt:534 */
          20  +
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
          22  +
        let mut input = crate::input::get_pokemon_species_input::Builder::default();
          23  +
        /* RustType.kt:534 */
          24  +
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
          26  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          27  +
            uri, headers, body, ..
          28  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:1134 */
          30  +
        let input_string = uri.path();
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:1146 */
          32  +
        let (input_string, (_, m1)) =
          33  +
            ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
          34  +
                ::nom::sequence::preceded(
          35  +
                    ::nom::bytes::complete::tag("/"),
          36  +
                    ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>(
          37  +
                        "pokemon-species",
          38  +
                    ),
          39  +
                ),
          40  +
                ::nom::sequence::preceded(
          41  +
                    ::nom::bytes::complete::tag("/"),
          42  +
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
          43  +
                        ::nom::bytes::complete::take_until("/"),
          44  +
                        ::nom::combinator::rest,
          45  +
                    )),
          46  +
                ),
          47  +
            ))(input_string)?;
          48  +
        debug_assert_eq!("", input_string);
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:1157 */
          50  +
        input =
          51  +
            input.set_name(crate::protocol_serde::shape_get_pokemon_species_input::de_name(m1)?);
          52  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
          53  +
        input.build()?
          54  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
          55  +
    })
          56  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
          57  +
}
          58  +
          59  +
/* RustType.kt:534 */
          60  +
#[allow(clippy::unnecessary_wraps)]
          61  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
          62  +
pub fn ser_get_pokemon_species_http_response(
          63  +
    #[allow(unused_variables)] output: crate::output::GetPokemonSpeciesOutput,
          64  +
) -> std::result::Result<
          65  +
    ::aws_smithy_legacy_http_server::response::Response,
          66  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          67  +
> {
          68  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
          69  +
    Ok({
          70  +
        /* RustType.kt:534 */
          71  +
        #[allow(unused_mut)]
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          73  +
        let mut builder = ::http::Response::builder();
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
          75  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          76  +
            builder,
          77  +
            ::http::header::CONTENT_TYPE,
          78  +
            "application/json",
          79  +
        );
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
          81  +
        let http_status: u16 = 200;
          82  +
        builder = builder.status(http_status);
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          84  +
        let payload =
          85  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_get_pokemon_species_output::ser_get_pokemon_species_output_output_output(&output)?
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
          88  +
        let content_length = payload.len();
          89  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          90  +
            builder,
          91  +
            ::http::header::CONTENT_LENGTH,
          92  +
            content_length,
          93  +
        );
          94  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
          95  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          96  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
          97  +
        builder.body(body)?
          98  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
          99  +
    })
         100  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
         101  +
}
         102  +
         103  +
/* RustType.kt:534 */
         104  +
#[allow(clippy::unnecessary_wraps)]
         105  +
/* ServerHttpBoundProtocolGenerator.kt:471 */
         106  +
pub fn ser_get_pokemon_species_http_error(
         107  +
    error: &crate::error::GetPokemonSpeciesError,
         108  +
) -> std::result::Result<
         109  +
    ::aws_smithy_legacy_http_server::response::Response,
         110  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
         111  +
> {
         112  +
    /* ServerHttpBoundProtocolGenerator.kt:476 */
         113  +
    Ok({
         114  +
        /* ServerHttpBoundProtocolGenerator.kt:492 */
         115  +
        match error {
         116  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
         117  +
            crate::error::GetPokemonSpeciesError::ResourceNotFoundException(output) => {
         118  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
         119  +
                let payload = crate::protocol_serde::shape_resource_not_found_exception::ser_resource_not_found_exception_error(output)?;
         120  +
                /* RustType.kt:534 */
         121  +
                #[allow(unused_mut)]
         122  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         123  +
                let mut builder = ::http::Response::builder();
         124  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
         125  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         126  +
                    builder,
         127  +
                    ::http::header::CONTENT_TYPE,
         128  +
                    "application/json",
         129  +
                );
         130  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
         131  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         132  +
                    builder,
         133  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         134  +
                    "ResourceNotFoundException",
         135  +
                );
         136  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
         137  +
                let content_length = payload.len();
         138  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         139  +
                    builder,
         140  +
                    ::http::header::CONTENT_LENGTH,
         141  +
                    content_length,
         142  +
                );
         143  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
         144  +
                builder
         145  +
                    .status(404)
         146  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         147  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         148  +
            }
         149  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
         150  +
            crate::error::GetPokemonSpeciesError::ValidationException(output) => {
         151  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
         152  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         153  +
                /* RustType.kt:534 */
         154  +
                #[allow(unused_mut)]
         155  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         156  +
                let mut builder = ::http::Response::builder();
         157  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
         158  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         159  +
                    builder,
         160  +
                    ::http::header::CONTENT_TYPE,
         161  +
                    "application/json",
         162  +
                );
         163  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
         164  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         165  +
                    builder,
         166  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         167  +
                    "ValidationException",
         168  +
                );
         169  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
         170  +
                let content_length = payload.len();
         171  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         172  +
                    builder,
         173  +
                    ::http::header::CONTENT_LENGTH,
         174  +
                    content_length,
         175  +
                );
         176  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
         177  +
                builder
         178  +
                    .status(400)
         179  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         180  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         181  +
            } /* ServerHttpBoundProtocolGenerator.kt:492 */
         182  +
        }
         183  +
        /* ServerHttpBoundProtocolGenerator.kt:476 */
         184  +
    })
         185  +
    /* ServerHttpBoundProtocolGenerator.kt:471 */
         186  +
}

tmp-codegen-diff/codegen-server-test/pokemon-service-server-sdk-http0x/rust-server-codegen/src/protocol_serde/shape_get_pokemon_species_input.rs

@@ -0,1 +0,16 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
           3  +
pub fn de_name(
           4  +
    value: &str,
           5  +
) -> std::result::Result<
           6  +
    ::std::string::String,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
           8  +
> {
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1463 */
          10  +
    let value = ::percent_encoding::percent_decode_str(value)
          11  +
        .decode_utf8()?
          12  +
        .into_owned();
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
          14  +
    Ok(value)
          15  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
          16  +
}

tmp-codegen-diff/codegen-server-test/pokemon-service-server-sdk-http0x/rust-server-codegen/src/protocol_serde/shape_get_pokemon_species_output.rs

@@ -0,1 +0,58 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
           3  +
pub fn ser_get_pokemon_species_output_output_output(
           4  +
    value: &crate::output::GetPokemonSpeciesOutput,
           5  +
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
           7  +
    let mut out = ::std::string::String::new();
           8  +
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
          10  +
    crate::protocol_serde::shape_get_pokemon_species_output::ser_get_pokemon_species_output_output(
          11  +
        &mut object,
          12  +
        value,
          13  +
    )?;
          14  +
    /* JsonSerializerGenerator.kt:227 */
          15  +
    object.finish();
          16  +
    Ok(out)
          17  +
    /* JsonSerializerGenerator.kt:213 */
          18  +
}
          19  +
          20  +
/* JsonSerializerGenerator.kt:358 */
          21  +
pub fn ser_get_pokemon_species_output_output(
          22  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          23  +
    input: &crate::output::GetPokemonSpeciesOutput,
          24  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* SerializerUtil.kt:42 */
          26  +
    {
          27  +
        /* JsonSerializerGenerator.kt:484 */
          28  +
        let mut array_1 = object.key("flavorTextEntries").start_array();
          29  +
        /* JsonSerializerGenerator.kt:524 */
          30  +
        for item_2 in &input.flavor_text_entries {
          31  +
            /* SerializerUtil.kt:42 */
          32  +
            {
          33  +
                /* JsonSerializerGenerator.kt:495 */
          34  +
                #[allow(unused_mut)]
          35  +
                /* JsonSerializerGenerator.kt:496 */
          36  +
                let mut object_3 = array_1.value().start_object();
          37  +
                /* JsonSerializerGenerator.kt:375 */
          38  +
                crate::protocol_serde::shape_flavor_text::ser_flavor_text(&mut object_3, item_2)?;
          39  +
                /* JsonSerializerGenerator.kt:515 */
          40  +
                object_3.finish();
          41  +
                /* SerializerUtil.kt:42 */
          42  +
            }
          43  +
            /* JsonSerializerGenerator.kt:524 */
          44  +
        }
          45  +
        /* JsonSerializerGenerator.kt:486 */
          46  +
        array_1.finish();
          47  +
        /* SerializerUtil.kt:42 */
          48  +
    }
          49  +
    /* SerializerUtil.kt:42 */
          50  +
    {
          51  +
        /* JsonSerializerGenerator.kt:423 */
          52  +
        object.key("name").string(input.name.as_str());
          53  +
        /* SerializerUtil.kt:42 */
          54  +
    }
          55  +
    /* JsonSerializerGenerator.kt:372 */
          56  +
    Ok(())
          57  +
    /* JsonSerializerGenerator.kt:358 */
          58  +
}

tmp-codegen-diff/codegen-server-test/pokemon-service-server-sdk-http0x/rust-server-codegen/src/protocol_serde/shape_get_server_statistics.rs

@@ -0,1 +0,78 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
           3  +
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
           5  +
pub async fn de_get_server_statistics_http_request<B>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::GetServerStatisticsInput,
           9  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
          10  +
>
          11  +
where
          12  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          13  +
    B::Data: Send,
          14  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          15  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          16  +
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
          18  +
    Ok({
          19  +
        /* RustType.kt:534 */
          20  +
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
          22  +
        let mut input = crate::input::get_server_statistics_input::Builder::default();
          23  +
        /* RustType.kt:534 */
          24  +
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
          26  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          27  +
            uri, headers, body, ..
          28  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
          30  +
        input.build()
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
          32  +
    })
          33  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
          34  +
}
          35  +
          36  +
/* RustType.kt:534 */
          37  +
#[allow(clippy::unnecessary_wraps)]
          38  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
          39  +
pub fn ser_get_server_statistics_http_response(
          40  +
    #[allow(unused_variables)] output: crate::output::GetServerStatisticsOutput,
          41  +
) -> std::result::Result<
          42  +
    ::aws_smithy_legacy_http_server::response::Response,
          43  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          44  +
> {
          45  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
          46  +
    Ok({
          47  +
        /* RustType.kt:534 */
          48  +
        #[allow(unused_mut)]
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          50  +
        let mut builder = ::http::Response::builder();
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
          52  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          53  +
            builder,
          54  +
            ::http::header::CONTENT_TYPE,
          55  +
            "application/json",
          56  +
        );
          57  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
          58  +
        let http_status: u16 = 200;
          59  +
        builder = builder.status(http_status);
          60  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          61  +
        let payload =
          62  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_get_server_statistics_output::ser_get_server_statistics_output_output_output(&output)?
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
          65  +
        let content_length = payload.len();
          66  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          67  +
            builder,
          68  +
            ::http::header::CONTENT_LENGTH,
          69  +
            content_length,
          70  +
        );
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
          72  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
          74  +
        builder.body(body)?
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
          76  +
    })
          77  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
          78  +
}