Server Test Python

Server Test Python

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943 (ignoring whitespace)

Files changed:

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

@@ -1,1 +23,34 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_internal_server_error_error(
    3      4   
    value: &crate::error::InternalServerError,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_internal_server_error::ser_internal_server_error(
    8     11   
        &mut object,
    9     12   
        value,
   10     13   
    )?;
          14  +
    /* JsonSerializerGenerator.kt:227 */
   11     15   
    object.finish();
   12     16   
    Ok(out)
          17  +
    /* JsonSerializerGenerator.kt:213 */
   13     18   
}
   14     19   
          20  +
/* JsonSerializerGenerator.kt:358 */
   15     21   
pub fn ser_internal_server_error(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::error::InternalServerError,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* SerializerUtil.kt:42 */
   19     26   
    {
          27  +
        /* JsonSerializerGenerator.kt:423 */
   20     28   
        object.key("message").string(input.message.as_str());
          29  +
        /* SerializerUtil.kt:42 */
   21     30   
    }
          31  +
    /* JsonSerializerGenerator.kt:372 */
   22     32   
    Ok(())
          33  +
    /* JsonSerializerGenerator.kt:358 */
   23     34   
}

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

@@ -1,1 +23,34 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_invalid_pokeball_error_error(
    3      4   
    value: &crate::error::InvalidPokeballError,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_invalid_pokeball_error::ser_invalid_pokeball_error(
    8     11   
        &mut object,
    9     12   
        value,
   10     13   
    )?;
          14  +
    /* JsonSerializerGenerator.kt:227 */
   11     15   
    object.finish();
   12     16   
    Ok(out)
          17  +
    /* JsonSerializerGenerator.kt:213 */
   13     18   
}
   14     19   
          20  +
/* JsonSerializerGenerator.kt:358 */
   15     21   
pub fn ser_invalid_pokeball_error(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::error::InvalidPokeballError,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* SerializerUtil.kt:42 */
   19     26   
    {
          27  +
        /* JsonSerializerGenerator.kt:423 */
   20     28   
        object.key("pokeball").string(input.pokeball.as_str());
          29  +
        /* SerializerUtil.kt:42 */
   21     30   
    }
          31  +
    /* JsonSerializerGenerator.kt:372 */
   22     32   
    Ok(())
          33  +
    /* JsonSerializerGenerator.kt:358 */
   23     34   
}

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

@@ -1,1 +72,105 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_master_ball_unsuccessful_error(
    3      4   
    value: &crate::error::MasterBallUnsuccessful,
    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_master_ball_unsuccessful::ser_master_ball_unsuccessful(
    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_master_ball_unsuccessful(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::error::MasterBallUnsuccessful,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:382 */
   19     26   
    if let Some(var_1) = &input.message {
          27  +
        /* JsonSerializerGenerator.kt:423 */
   20     28   
        object.key("message").string(var_1.as_str());
          29  +
        /* JsonSerializerGenerator.kt:382 */
   21     30   
    }
          31  +
    /* JsonSerializerGenerator.kt:372 */
   22     32   
    Ok(())
          33  +
    /* JsonSerializerGenerator.kt:358 */
   23     34   
}
   24     35   
          36  +
/* JsonParserGenerator.kt:148 */
   25     37   
pub(crate) fn de_master_ball_unsuccessful_json_err(
   26     38   
    value: &[u8],
   27     39   
    mut builder: crate::error::master_ball_unsuccessful_internal::Builder,
   28     40   
) -> ::std::result::Result<
   29     41   
    crate::error::master_ball_unsuccessful_internal::Builder,
   30     42   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   31     43   
> {
          44  +
    /* JsonParserGenerator.kt:153 */
   32     45   
    let mut tokens_owned =
   33     46   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
   34     47   
            .peekable();
   35     48   
    let tokens = &mut tokens_owned;
   36     49   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
          50  +
    /* JsonParserGenerator.kt:684 */
   37     51   
    loop {
          52  +
        /* JsonParserGenerator.kt:685 */
   38     53   
        match tokens.next().transpose()? {
          54  +
            /* JsonParserGenerator.kt:686 */
   39     55   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   40     56   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          57  +
                /* JsonParserGenerator.kt:260 */
   41     58   
                match key.to_unescaped()?.as_ref() {
          59  +
                    /* JsonParserGenerator.kt:262 */
   42     60   
                    "message" => {
          61  +
                        /* JsonParserGenerator.kt:272 */
   43     62   
                        builder = builder.set_message(
          63  +
                            /* JsonParserGenerator.kt:354 */
   44     64   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
   45     65   
                                tokens.next(),
   46     66   
                            )?
   47         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   48         -
                            .transpose()?,
          67  +
                            .map(|s|
          68  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          69  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
          70  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
          71  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
   49     72   
                        );
          73  +
                        /* JsonParserGenerator.kt:262 */
   50     74   
                    }
   51         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          75  +
                    /* JsonParserGenerator.kt:290 */
          76  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   52     77   
                }
          78  +
                /* JsonParserGenerator.kt:686 */
   53     79   
            }
          80  +
            /* JsonParserGenerator.kt:695 */
   54     81   
            other => {
   55     82   
                return Err(
   56     83   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   57     84   
                        "expected object key or end object, found: {:?}",
   58     85   
                        other
   59     86   
                    )),
   60     87   
                )
          88  +
            } /* JsonParserGenerator.kt:685 */
   61     89   
        }
          90  +
        /* JsonParserGenerator.kt:684 */
   62     91   
    }
   63         -
    }
          92  +
    /* JsonParserGenerator.kt:250 */
   64     93   
    if tokens.next().is_some() {
          94  +
        /* JsonParserGenerator.kt:251 */
   65     95   
        return Err(
   66     96   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   67     97   
                "found more JSON tokens after completing parsing",
   68     98   
            ),
   69     99   
        );
         100  +
        /* JsonParserGenerator.kt:250 */
   70    101   
    }
         102  +
    /* JsonParserGenerator.kt:163 */
   71    103   
    Ok(builder)
         104  +
    /* JsonParserGenerator.kt:148 */
   72    105   
}

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

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

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

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

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

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

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

@@ -1,1 +9,15 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBoundProtocolPayloadGenerator.kt:311 */
    2      3   
pub fn ser_data_http_payload(
    3      4   
    payload: ::aws_smithy_http_server_python::types::ByteStream,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::aws_smithy_http_server_python::types::ByteStream,
    6      7   
    ::aws_smithy_types::error::operation::BuildError,
    7      8   
> {
    8         -
    Ok(payload)
           9  +
    /* HttpBoundProtocolPayloadGenerator.kt:345 */
          10  +
    Ok(
          11  +
        /* HttpBoundProtocolPayloadGenerator.kt:374 */
          12  +
        payload, /* HttpBoundProtocolPayloadGenerator.kt:345 */
          13  +
    )
          14  +
    /* HttpBoundProtocolPayloadGenerator.kt:311 */
    9     15   
}

tmp-codegen-diff/codegen-server-test-python/pokemon-service-server-sdk/rust-server-codegen-python/src/protocol_serde/shape_throttling_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_throttling_error_error(
    3      4   
    value: &crate::error::ThrottlingError,
    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_throttling_error::ser_throttling_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_throttling_error(
   13     19   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    #[allow(unused_variables)] input: &crate::error::ThrottlingError,
   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/pokemon-service-server-sdk/rust-server-codegen-python/src/protocol_serde/shape_unsupported_region_error.rs

@@ -1,1 +23,34 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_unsupported_region_error_error(
    3      4   
    value: &crate::error::UnsupportedRegionError,
    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_unsupported_region_error::ser_unsupported_region_error(
    8     11   
        &mut object,
    9     12   
        value,
   10     13   
    )?;
          14  +
    /* JsonSerializerGenerator.kt:227 */
   11     15   
    object.finish();
   12     16   
    Ok(out)
          17  +
    /* JsonSerializerGenerator.kt:213 */
   13     18   
}
   14     19   
          20  +
/* JsonSerializerGenerator.kt:358 */
   15     21   
pub fn ser_unsupported_region_error(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::error::UnsupportedRegionError,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* SerializerUtil.kt:42 */
   19     26   
    {
          27  +
        /* JsonSerializerGenerator.kt:423 */
   20     28   
        object.key("region").string(input.region.as_str());
          29  +
        /* SerializerUtil.kt:42 */
   21     30   
    }
          31  +
    /* JsonSerializerGenerator.kt:372 */
   22     32   
    Ok(())
          33  +
    /* JsonSerializerGenerator.kt:358 */
   23     34   
}

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

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

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

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

tmp-codegen-diff/codegen-server-test-python/pokemon-service-server-sdk/rust-server-codegen-python/src/python_event_stream.rs

@@ -1,1 +143,160 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
    3         -
pub struct CapturePokemonOutputEventsEventStreamSender {
           4  +
pub /* PythonServerEventStreamWrapperGenerator.kt:104 */ struct CapturePokemonOutputEventsEventStreamSender
           5  +
{
           6  +
    /* PythonServerEventStreamWrapperGenerator.kt:105 */
    4      7   
    inner: ::std::sync::Arc<
    5      8   
        ::parking_lot::Mutex<
    6      9   
            ::std::option::Option<
    7     10   
                ::aws_smithy_http::event_stream::EventStreamSender<
    8     11   
                    crate::model::CapturePokemonEvents,
    9     12   
                    crate::error::CapturePokemonEventsError,
   10     13   
                >,
   11     14   
            >,
   12     15   
        >,
   13         -
    >,
          16  +
    >, /* PythonServerEventStreamWrapperGenerator.kt:104 */
   14     17   
}
          18  +
/* PythonServerEventStreamWrapperGenerator.kt:112 */
   15     19   
impl CapturePokemonOutputEventsEventStreamSender {
          20  +
    /* PythonServerEventStreamWrapperGenerator.kt:113 */
   16     21   
    pub fn into_body_stream(
   17     22   
        self,
   18     23   
        marshaller: impl ::aws_smithy_eventstream::frame::MarshallMessage<
   19     24   
                Input = crate::model::CapturePokemonEvents,
   20     25   
            > + ::std::marker::Send
   21     26   
            + ::std::marker::Sync
   22     27   
            + 'static,
   23     28   
        error_marshaller: impl ::aws_smithy_eventstream::frame::MarshallMessage<
   24     29   
                Input = crate::error::CapturePokemonEventsError,
   25     30   
            > + ::std::marker::Send
   26     31   
            + ::std::marker::Sync
   27     32   
            + 'static,
   28     33   
        signer: impl ::aws_smithy_eventstream::frame::SignMessage
   29     34   
            + ::std::marker::Send
   30     35   
            + ::std::marker::Sync
   31     36   
            + 'static,
   32     37   
    ) -> ::aws_smithy_http::event_stream::MessageStreamAdapter<
   33     38   
        crate::model::CapturePokemonEvents,
   34     39   
        crate::error::CapturePokemonEventsError,
   35     40   
    > {
   36     41   
        let mut inner = self.inner.lock();
   37     42   
        let inner = inner.take().expect(
   38     43   
                            "attempted to reuse an event stream. \
   39     44   
                             that means you kept a reference to an event stream and tried to reuse it in another request, \
   40     45   
                             event streams are request scoped and shouldn't be used outside of their bounded request scope"
   41     46   
                        );
   42     47   
        inner.into_body_stream(marshaller, error_marshaller, signer)
   43     48   
    }
          49  +
    /* PythonServerEventStreamWrapperGenerator.kt:112 */
   44     50   
}
          51  +
/* PythonServerEventStreamWrapperGenerator.kt:135 */
   45     52   
impl<'source> ::pyo3::FromPyObject<'source> for CapturePokemonOutputEventsEventStreamSender {
   46     53   
    fn extract(obj: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
   47     54   
        use ::tokio_stream::StreamExt;
   48     55   
        let stream = ::pyo3_asyncio::tokio::into_stream_v1(obj)?;
   49     56   
        let stream = stream.filter_map(|res| {
   50     57   
                        ::pyo3::Python::with_gil(|py| {
   51     58   
                            // TODO(EventStreamImprovements): Add `InternalServerError` variant to all event streaming
   52     59   
                            //                                errors and return that variant in case of errors here?
   53     60   
                            match res {
   54     61   
                                Ok(obj) => {
   55     62   
                                    match obj.extract::<crate::model::CapturePokemonEvents>(py) {
   56     63   
                                        Ok(it) => Some(Ok(it)),
   57     64   
                                        Err(err) => {
   58     65   
                                            let rich_py_err = ::aws_smithy_http_server_python::rich_py_err(err);
   59     66   
                                            ::tracing::error!(error = ?rich_py_err, "could not extract the output type 'crate::model::CapturePokemonEvents' from streamed value");
   60     67   
                                            None
   61     68   
                                        },
   62     69   
                                    }
   63     70   
                                },
   64     71   
                                Err(err) => {
   65     72   
                                    match ::pyo3::IntoPy::into_py(err, py).extract::<crate::error::CapturePokemonEventsError>(py) {
   66     73   
                                        Ok(modelled_error) => Some(Err(modelled_error)),
   67     74   
                                        Err(err) => {
   68     75   
                                            let rich_py_err = ::aws_smithy_http_server_python::rich_py_err(err);
   69     76   
                                            ::tracing::error!(error = ?rich_py_err, "could not extract the error type 'crate::error::CapturePokemonEventsError' from raised exception");
   70     77   
                                            None
   71     78   
                                        }
   72     79   
                                    }
   73     80   
                                }
   74     81   
                            }
   75     82   
                        })
   76     83   
                    });
   77     84   
   78     85   
        Ok(CapturePokemonOutputEventsEventStreamSender {
   79     86   
            inner: ::std::sync::Arc::new(::parking_lot::Mutex::new(Some(stream.into()))),
   80     87   
        })
   81     88   
    }
   82     89   
}
   83     90   
   84     91   
impl ::pyo3::IntoPy<::pyo3::PyObject> for CapturePokemonOutputEventsEventStreamSender {
   85     92   
    fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
   86     93   
        ::pyo3::exceptions::PyAttributeError::new_err("this is a write-only object").into_py(py)
   87     94   
    }
   88     95   
}
   89     96   
          97  +
/* RustType.kt:516 */
   90     98   
#[::pyo3::pyclass]
          99  +
/* RustType.kt:516 */
   91    100   
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
   92         -
pub struct CapturePokemonInputEventsReceiver {
         101  +
pub /* PythonServerEventStreamWrapperGenerator.kt:190 */ struct CapturePokemonInputEventsReceiver {
         102  +
    /* PythonServerEventStreamWrapperGenerator.kt:191 */
   93    103   
    inner: ::std::sync::Arc<
   94    104   
        ::tokio::sync::Mutex<
   95    105   
            ::aws_smithy_http::event_stream::Receiver<
   96    106   
                crate::model::AttemptCapturingPokemonEvent,
   97    107   
                crate::error::AttemptCapturingPokemonEventError,
   98    108   
            >,
   99    109   
        >,
  100         -
    >,
         110  +
    >, /* PythonServerEventStreamWrapperGenerator.kt:190 */
  101    111   
}
         112  +
/* PythonServerEventStreamWrapperGenerator.kt:198 */
  102    113   
impl CapturePokemonInputEventsReceiver {
         114  +
    /* PythonServerEventStreamWrapperGenerator.kt:199 */
  103    115   
    pub fn new(
  104    116   
        unmarshaller: impl ::aws_smithy_eventstream::frame::UnmarshallMessage<
  105    117   
                Output = crate::model::AttemptCapturingPokemonEvent,
  106    118   
                Error = crate::error::AttemptCapturingPokemonEventError,
  107    119   
            > + ::std::marker::Send
  108    120   
            + ::std::marker::Sync
  109    121   
            + 'static,
  110    122   
        body: ::aws_smithy_types::body::SdkBody,
  111    123   
    ) -> CapturePokemonInputEventsReceiver {
  112    124   
        let inner = ::aws_smithy_http::event_stream::Receiver::new(unmarshaller, body);
  113    125   
        let inner = ::std::sync::Arc::new(::tokio::sync::Mutex::new(inner));
  114    126   
        CapturePokemonInputEventsReceiver { inner }
  115    127   
    }
         128  +
    /* PythonServerEventStreamWrapperGenerator.kt:198 */
  116    129   
}
         130  +
/* RustType.kt:516 */
  117    131   
#[::pyo3::pymethods]
         132  +
/* PythonServerEventStreamWrapperGenerator.kt:216 */
  118    133   
impl CapturePokemonInputEventsReceiver {
         134  +
    /* PythonServerEventStreamWrapperGenerator.kt:217 */
  119    135   
    pub fn __aiter__(slf: ::pyo3::PyRef<Self>) -> ::pyo3::PyRef<Self> {
  120    136   
        slf
  121    137   
    }
  122    138   
  123    139   
    pub fn __anext__(slf: ::pyo3::PyRefMut<Self>) -> ::pyo3::PyResult<Option<::pyo3::PyObject>> {
  124    140   
        let body = slf.inner.clone();
  125    141   
        let fut = ::pyo3_asyncio::tokio::future_into_py(slf.py(), async move {
  126    142   
            let mut inner = body.lock().await;
  127    143   
            let next = inner.recv().await;
  128    144   
            match next {
  129    145   
                Ok(Some(data)) => Ok(::pyo3::Python::with_gil(|py| {
  130    146   
                    ::pyo3::IntoPy::into_py(data, py)
  131    147   
                })),
  132    148   
                Ok(None) => Err(::pyo3::exceptions::PyStopAsyncIteration::new_err(
  133    149   
                    "stream exhausted",
  134    150   
                )),
  135    151   
                Err(::aws_smithy_runtime_api::client::result::SdkError::ServiceError(
  136    152   
                    service_err,
  137    153   
                )) => Err(service_err.into_err().into()),
  138    154   
                Err(err) => Err(::pyo3::exceptions::PyRuntimeError::new_err(err.to_string())),
  139    155   
            }
  140    156   
        })?;
  141    157   
        Ok(Some(fut.into()))
  142    158   
    }
         159  +
    /* PythonServerEventStreamWrapperGenerator.kt:216 */
  143    160   
}

tmp-codegen-diff/codegen-server-test-python/pokemon-service-server-sdk/rust-server-codegen-python/src/python_module_export.rs

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

tmp-codegen-diff/codegen-server-test-python/pokemon-service-server-sdk/rust-server-codegen-python/src/python_operation_adaptor.rs

@@ -1,1 +317,324 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* PythonServerOperationHandlerGenerator.kt:61 */
    2      3   
/// Python handler for operation `GetStorage`.
    3      4   
pub(crate) async fn get_storage(
    4      5   
    input: crate::input::GetStorageInput,
    5      6   
    state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
    6      7   
    handler: ::aws_smithy_http_server_python::PyHandler,
    7      8   
) -> std::result::Result<crate::output::GetStorageOutput, crate::error::GetStorageError> {
    8      9   
    // Async block used to run the handler and catch any Python error.
    9     10   
    let result = if handler.is_coroutine {
   10     11   
        ::tracing::trace!(name = "get_storage", "executing python handler coroutine");
   11     12   
        let result = ::pyo3::Python::with_gil(|py| {
   12     13   
            let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
   13     14   
            let coroutine = if handler.args == 1 {
   14     15   
                pyhandler.call1((input,))?
   15     16   
            } else {
   16     17   
                pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
   17     18   
            };
   18     19   
            ::pyo3_asyncio::tokio::into_future(coroutine)
   19     20   
        })?;
   20     21   
        result.await.and_then(|r| {
   21     22   
            ::pyo3::Python::with_gil(|py| r.extract::<crate::output::GetStorageOutput>(py))
   22     23   
        })
   23     24   
    } else {
   24     25   
        ::tracing::trace!(name = "get_storage", "executing python handler function");
   25     26   
        ::pyo3::Python::with_gil(|py| {
   26     27   
            let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
   27     28   
            let output = if handler.args == 1 {
   28     29   
                pyhandler.call1((input,))?
   29     30   
            } else {
   30     31   
                pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
   31     32   
            };
   32     33   
            output.extract::<crate::output::GetStorageOutput>()
   33     34   
        })
   34     35   
    };
   35     36   
    // Catch and record a Python traceback.
   36     37   
    result.map_err(|e| {
   37     38   
        let rich_py_err =
   38     39   
            ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
   39     40   
                e.clone_ref(py)
   40     41   
            }));
   41     42   
        ::tracing::error!(error = ?rich_py_err, "handler error");
   42     43   
        e.into()
   43     44   
    })
   44     45   
}
   45     46   
          47  +
/* PythonServerOperationHandlerGenerator.kt:61 */
   46     48   
/// Python handler for operation `GetPokemonSpecies`.
   47     49   
pub(crate) async fn get_pokemon_species(
   48     50   
    input: crate::input::GetPokemonSpeciesInput,
   49     51   
    state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
   50     52   
    handler: ::aws_smithy_http_server_python::PyHandler,
   51     53   
) -> std::result::Result<crate::output::GetPokemonSpeciesOutput, crate::error::GetPokemonSpeciesError>
   52     54   
{
   53     55   
    // Async block used to run the handler and catch any Python error.
   54     56   
    let result = if handler.is_coroutine {
   55     57   
        ::tracing::trace!(
   56     58   
            name = "get_pokemon_species",
   57     59   
            "executing python handler coroutine"
   58     60   
        );
   59     61   
        let result = ::pyo3::Python::with_gil(|py| {
   60     62   
            let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
   61     63   
            let coroutine = if handler.args == 1 {
   62     64   
                pyhandler.call1((input,))?
   63     65   
            } else {
   64     66   
                pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
   65     67   
            };
   66     68   
            ::pyo3_asyncio::tokio::into_future(coroutine)
   67     69   
        })?;
   68     70   
        result.await.and_then(|r| {
   69     71   
            ::pyo3::Python::with_gil(|py| r.extract::<crate::output::GetPokemonSpeciesOutput>(py))
   70     72   
        })
   71     73   
    } else {
   72     74   
        ::tracing::trace!(
   73     75   
            name = "get_pokemon_species",
   74     76   
            "executing python handler function"
   75     77   
        );
   76     78   
        ::pyo3::Python::with_gil(|py| {
   77     79   
            let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
   78     80   
            let output = if handler.args == 1 {
   79     81   
                pyhandler.call1((input,))?
   80     82   
            } else {
   81     83   
                pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
   82     84   
            };
   83     85   
            output.extract::<crate::output::GetPokemonSpeciesOutput>()
   84     86   
        })
   85     87   
    };
   86     88   
    // Catch and record a Python traceback.
   87     89   
    result.map_err(|e| {
   88     90   
        let rich_py_err =
   89     91   
            ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
   90     92   
                e.clone_ref(py)
   91     93   
            }));
   92     94   
        ::tracing::error!(error = ?rich_py_err, "handler error");
   93     95   
        e.into()
   94     96   
    })
   95     97   
}
   96     98   
          99  +
/* PythonServerOperationHandlerGenerator.kt:61 */
   97    100   
/// Python handler for operation `StreamPokemonRadio`.
   98    101   
pub(crate) async fn stream_pokemon_radio(
   99    102   
    input: crate::input::StreamPokemonRadioInput,
  100    103   
    state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
  101    104   
    handler: ::aws_smithy_http_server_python::PyHandler,
  102    105   
) -> std::result::Result<
  103    106   
    crate::output::StreamPokemonRadioOutput,
  104    107   
    crate::error::StreamPokemonRadioError,
  105    108   
> {
  106    109   
    // Async block used to run the handler and catch any Python error.
  107    110   
    let result = if handler.is_coroutine {
  108    111   
        ::tracing::trace!(
  109    112   
            name = "stream_pokemon_radio",
  110    113   
            "executing python handler coroutine"
  111    114   
        );
  112    115   
        let result = ::pyo3::Python::with_gil(|py| {
  113    116   
            let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
  114    117   
            let coroutine = if handler.args == 1 {
  115    118   
                pyhandler.call1((input,))?
  116    119   
            } else {
  117    120   
                pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
  118    121   
            };
  119    122   
            ::pyo3_asyncio::tokio::into_future(coroutine)
  120    123   
        })?;
  121    124   
        result.await.and_then(|r| {
  122    125   
            ::pyo3::Python::with_gil(|py| r.extract::<crate::output::StreamPokemonRadioOutput>(py))
  123    126   
        })
  124    127   
    } else {
  125    128   
        ::tracing::trace!(
  126    129   
            name = "stream_pokemon_radio",
  127    130   
            "executing python handler function"
  128    131   
        );
  129    132   
        ::pyo3::Python::with_gil(|py| {
  130    133   
            let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
  131    134   
            let output = if handler.args == 1 {
  132    135   
                pyhandler.call1((input,))?
  133    136   
            } else {
  134    137   
                pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
  135    138   
            };
  136    139   
            output.extract::<crate::output::StreamPokemonRadioOutput>()
  137    140   
        })
  138    141   
    };
  139    142   
    // Catch and record a Python traceback.
  140    143   
    result.map_err(|e| {
  141    144   
        let rich_py_err =
  142    145   
            ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
  143    146   
                e.clone_ref(py)
  144    147   
            }));
  145    148   
        ::tracing::error!(error = ?rich_py_err, "handler error");
  146    149   
        e.into()
  147    150   
    })
  148    151   
}
  149    152   
         153  +
/* PythonServerOperationHandlerGenerator.kt:61 */
  150    154   
/// Python handler for operation `CheckHealth`.
  151    155   
pub(crate) async fn check_health(
  152    156   
    input: crate::input::CheckHealthInput,
  153    157   
    state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
  154    158   
    handler: ::aws_smithy_http_server_python::PyHandler,
  155    159   
) -> std::result::Result<crate::output::CheckHealthOutput, crate::error::CheckHealthError> {
  156    160   
    // Async block used to run the handler and catch any Python error.
  157    161   
    let result = if handler.is_coroutine {
  158    162   
        ::tracing::trace!(name = "check_health", "executing python handler coroutine");
  159    163   
        let result = ::pyo3::Python::with_gil(|py| {
  160    164   
            let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
  161    165   
            let coroutine = if handler.args == 1 {
  162    166   
                pyhandler.call1((input,))?
  163    167   
            } else {
  164    168   
                pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
  165    169   
            };
  166    170   
            ::pyo3_asyncio::tokio::into_future(coroutine)
  167    171   
        })?;
  168    172   
        result.await.and_then(|r| {
  169    173   
            ::pyo3::Python::with_gil(|py| r.extract::<crate::output::CheckHealthOutput>(py))
  170    174   
        })
  171    175   
    } else {
  172    176   
        ::tracing::trace!(name = "check_health", "executing python handler function");
  173    177   
        ::pyo3::Python::with_gil(|py| {
  174    178   
            let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
  175    179   
            let output = if handler.args == 1 {
  176    180   
                pyhandler.call1((input,))?
  177    181   
            } else {
  178    182   
                pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
  179    183   
            };
  180    184   
            output.extract::<crate::output::CheckHealthOutput>()
  181    185   
        })
  182    186   
    };
  183    187   
    // Catch and record a Python traceback.
  184    188   
    result.map_err(|e| {
  185    189   
        let rich_py_err =
  186    190   
            ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
  187    191   
                e.clone_ref(py)
  188    192   
            }));
  189    193   
        ::tracing::error!(error = ?rich_py_err, "handler error");
  190    194   
        e.into()
  191    195   
    })
  192    196   
}
  193    197   
         198  +
/* PythonServerOperationHandlerGenerator.kt:61 */
  194    199   
/// Python handler for operation `CapturePokemon`.
  195    200   
pub(crate) async fn capture_pokemon(
  196    201   
    input: crate::input::CapturePokemonInput,
  197    202   
    state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
  198    203   
    handler: ::aws_smithy_http_server_python::PyHandler,
  199    204   
) -> std::result::Result<crate::output::CapturePokemonOutput, crate::error::CapturePokemonError> {
  200    205   
    // Async block used to run the handler and catch any Python error.
  201    206   
    let result = if handler.is_coroutine {
  202    207   
        ::tracing::trace!(
  203    208   
            name = "capture_pokemon",
  204    209   
            "executing python handler coroutine"
  205    210   
        );
  206    211   
        let result = ::pyo3::Python::with_gil(|py| {
  207    212   
            let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
  208    213   
            let coroutine = if handler.args == 1 {
  209    214   
                pyhandler.call1((input,))?
  210    215   
            } else {
  211    216   
                pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
  212    217   
            };
  213    218   
            ::pyo3_asyncio::tokio::into_future(coroutine)
  214    219   
        })?;
  215    220   
        result.await.and_then(|r| {
  216    221   
            ::pyo3::Python::with_gil(|py| r.extract::<crate::output::CapturePokemonOutput>(py))
  217    222   
        })
  218    223   
    } else {
  219    224   
        ::tracing::trace!(
  220    225   
            name = "capture_pokemon",
  221    226   
            "executing python handler function"
  222    227   
        );
  223    228   
        ::pyo3::Python::with_gil(|py| {
  224    229   
            let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
  225    230   
            let output = if handler.args == 1 {
  226    231   
                pyhandler.call1((input,))?
  227    232   
            } else {
  228    233   
                pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
  229    234   
            };
  230    235   
            output.extract::<crate::output::CapturePokemonOutput>()
  231    236   
        })
  232    237   
    };
  233    238   
    // Catch and record a Python traceback.
  234    239   
    result.map_err(|e| {
  235    240   
        let rich_py_err =
  236    241   
            ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
  237    242   
                e.clone_ref(py)
  238    243   
            }));
  239    244   
        ::tracing::error!(error = ?rich_py_err, "handler error");
  240    245   
        e.into()
  241    246   
    })
  242    247   
}
  243    248   
         249  +
/* PythonServerOperationHandlerGenerator.kt:61 */
  244    250   
/// Python handler for operation `DoNothing`.
  245    251   
pub(crate) async fn do_nothing(
  246    252   
    input: crate::input::DoNothingInput,
  247    253   
    state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
  248    254   
    handler: ::aws_smithy_http_server_python::PyHandler,
  249    255   
) -> std::result::Result<crate::output::DoNothingOutput, crate::error::DoNothingError> {
  250    256   
    // Async block used to run the handler and catch any Python error.
  251    257   
    let result = if handler.is_coroutine {
  252    258   
        ::tracing::trace!(name = "do_nothing", "executing python handler coroutine");
  253    259   
        let result = ::pyo3::Python::with_gil(|py| {
  254    260   
            let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
  255    261   
            let coroutine = if handler.args == 1 {
  256    262   
                pyhandler.call1((input,))?
  257    263   
            } else {
  258    264   
                pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
  259    265   
            };
  260    266   
            ::pyo3_asyncio::tokio::into_future(coroutine)
  261    267   
        })?;
  262    268   
        result.await.and_then(|r| {
  263    269   
            ::pyo3::Python::with_gil(|py| r.extract::<crate::output::DoNothingOutput>(py))
  264    270   
        })
  265    271   
    } else {
  266    272   
        ::tracing::trace!(name = "do_nothing", "executing python handler function");
  267    273   
        ::pyo3::Python::with_gil(|py| {
  268    274   
            let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
  269    275   
            let output = if handler.args == 1 {
  270    276   
                pyhandler.call1((input,))?
  271    277   
            } else {
  272    278   
                pyhandler.call1((input, ::pyo3::ToPyObject::to_object(&state.0, py)))?
  273    279   
            };
  274    280   
            output.extract::<crate::output::DoNothingOutput>()
  275    281   
        })
  276    282   
    };
  277    283   
    // Catch and record a Python traceback.
  278    284   
    result.map_err(|e| {
  279    285   
        let rich_py_err =
  280    286   
            ::aws_smithy_http_server_python::rich_py_err(::pyo3::Python::with_gil(|py| {
  281    287   
                e.clone_ref(py)
  282    288   
            }));
  283    289   
        ::tracing::error!(error = ?rich_py_err, "handler error");
  284    290   
        e.into()
  285    291   
    })
  286    292   
}
  287    293   
         294  +
/* PythonServerOperationHandlerGenerator.kt:61 */
  288    295   
/// Python handler for operation `GetServerStatistics`.
  289    296   
pub(crate) async fn get_server_statistics(
  290    297   
    input: crate::input::GetServerStatisticsInput,
  291    298   
    state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
  292    299   
    handler: ::aws_smithy_http_server_python::PyHandler,
  293    300   
) -> std::result::Result<
  294    301   
    crate::output::GetServerStatisticsOutput,
  295    302   
    crate::error::GetServerStatisticsError,
  296    303   
> {
  297    304   
    // Async block used to run the handler and catch any Python error.

tmp-codegen-diff/codegen-server-test-python/pokemon-service-server-sdk/rust-server-codegen-python/src/python_server_application.rs

@@ -1,1 +267,292 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* PythonApplicationGenerator.kt:386 */
    2      3   
#[allow(clippy::tabs_in_doc_comments)]
    3      4   
/// Main Python application, used to register operations and context and start multiple
    4      5   
/// workers on the same shared socket.
    5      6   
///
    6      7   
/// Operations can be registered using the application object as a decorator (`@app.operation_name`).
    7      8   
///
    8      9   
/// Here's a full example to get you started:
    9     10   
///
   10     11   
/// ```python
          12  +
/* PythonApplicationGenerator.kt:399 */
   11     13   
/// from pokemon_service_server_sdk import input
   12     14   
/// from pokemon_service_server_sdk import output
          15  +
/* PythonApplicationGenerator.kt:406 */
   13     16   
/// from pokemon_service_server_sdk import error
          17  +
/* PythonApplicationGenerator.kt:408 */
   14     18   
/// from pokemon_service_server_sdk import middleware
   15     19   
/// from pokemon_service_server_sdk import App
   16     20   
///
   17     21   
/// @dataclass
   18     22   
/// class Context:
   19     23   
///     counter: int = 0
   20     24   
///
   21     25   
/// app = App()
   22     26   
/// app.context(Context())
   23     27   
///
   24     28   
/// @app.request_middleware
   25     29   
/// def request_middleware(request: middleware::Request):
   26     30   
///     if request.get_header("x-amzn-id") != "secret":
   27     31   
///         raise middleware.MiddlewareException("Unsupported `x-amz-id` header", 401)
   28     32   
///
          33  +
/* PythonApplicationGenerator.kt:441 */
   29     34   
/// # Capture Pokémons via event streams.
   30     35   
/// @app.capture_pokemon
   31     36   
/// def capture_pokemon(input: input::CapturePokemonInput, ctx: Context) -> output::CapturePokemonOutput:
   32     37   
///     raise NotImplementedError
   33     38   
///
   34     39   
/// # Health check operation, to check the service is up
   35     40   
/// # Not yet a deep check
   36     41   
/// @app.check_health
   37     42   
/// def check_health(input: input::CheckHealthInput, ctx: Context) -> output::CheckHealthOutput:
   38     43   
///     raise NotImplementedError
   39     44   
///
   40     45   
/// # DoNothing operation, used to stress test the framework.
   41     46   
/// @app.do_nothing
   42     47   
/// def do_nothing(input: input::DoNothingInput, ctx: Context) -> output::DoNothingOutput:
   43     48   
///     raise NotImplementedError
   44     49   
///
   45     50   
/// # Retrieve information about a Pokémon species.
   46     51   
/// @app.get_pokemon_species
   47     52   
/// def get_pokemon_species(input: input::GetPokemonSpeciesInput, ctx: Context) -> output::GetPokemonSpeciesOutput:
   48     53   
///     raise NotImplementedError
   49     54   
///
   50     55   
/// # Retrieve HTTP server statistiscs, such as calls count.
   51     56   
/// @app.get_server_statistics
   52     57   
/// def get_server_statistics(input: input::GetServerStatisticsInput, ctx: Context) -> output::GetServerStatisticsOutput:
   53     58   
///     raise NotImplementedError
   54     59   
///
   55     60   
/// # Retrieve information about your Pokédex.
   56     61   
/// @app.get_storage
   57     62   
/// def get_storage(input: input::GetStorageInput, ctx: Context) -> output::GetStorageOutput:
   58     63   
///     raise NotImplementedError
   59     64   
///
   60     65   
/// # Fetch a radio song from the database and stream it back as a playable audio.
   61     66   
/// @app.stream_pokemon_radio
   62     67   
/// def stream_pokemon_radio(input: input::StreamPokemonRadioInput, ctx: Context) -> output::StreamPokemonRadioOutput:
   63     68   
///     raise NotImplementedError
          69  +
/* PythonApplicationGenerator.kt:428 */
   64     70   
///
   65     71   
/// app.run()
   66     72   
/// ```
   67     73   
///
   68     74   
/// Any of operations above can be written as well prepending the `async` keyword and
   69     75   
/// the Python application will automatically handle it and schedule it on the event loop for you.
          76  +
/* PythonApplicationGenerator.kt:112 */
   70     77   
#[::pyo3::pyclass]
   71     78   
#[derive(Debug)]
   72     79   
/// :generic Ctx:
   73     80   
/// :extends typing.Generic\[Ctx\]:
   74     81   
/// :rtype None:
   75     82   
pub struct App {
   76     83   
    handlers: ::std::collections::HashMap<String, ::aws_smithy_http_server_python::PyHandler>,
   77     84   
    middlewares: Vec<::aws_smithy_http_server_python::PyMiddlewareHandler>,
   78     85   
    context: Option<::pyo3::PyObject>,
   79     86   
    workers: ::parking_lot::Mutex<Vec<::pyo3::PyObject>>,
   80     87   
}
          88  +
/* PythonApplicationGenerator.kt:149 */
   81     89   
impl Default for App {
   82     90   
    fn default() -> Self {
   83     91   
        Self {
   84     92   
            handlers: Default::default(),
   85     93   
            middlewares: vec![],
   86     94   
            context: None,
   87     95   
            workers: ::parking_lot::Mutex::new(vec![]),
   88     96   
        }
   89     97   
    }
   90     98   
}
          99  +
/* PythonApplicationGenerator.kt:131 */
   91    100   
impl Clone for App {
   92    101   
    fn clone(&self) -> Self {
   93    102   
        Self {
   94    103   
            handlers: self.handlers.clone(),
   95    104   
            middlewares: self.middlewares.clone(),
   96    105   
            context: self.context.clone(),
   97    106   
            workers: ::parking_lot::Mutex::new(vec![]),
   98    107   
        }
   99    108   
    }
  100    109   
}
         110  +
/* PythonApplicationGenerator.kt:168 */
  101    111   
impl ::aws_smithy_http_server_python::PyApp for App {
         112  +
    /* PythonApplicationGenerator.kt:174 */
  102    113   
    fn workers(&self) -> &::parking_lot::Mutex<Vec<::pyo3::PyObject>> {
  103    114   
        &self.workers
  104    115   
    }
  105    116   
    fn context(&self) -> &Option<::pyo3::PyObject> {
  106    117   
        &self.context
  107    118   
    }
  108    119   
    fn handlers(
  109    120   
        &mut self,
  110    121   
    ) -> &mut ::std::collections::HashMap<String, ::aws_smithy_http_server_python::PyHandler> {
  111    122   
        &mut self.handlers
  112    123   
    }
         124  +
    /* PythonApplicationGenerator.kt:189 */
  113    125   
    fn build_service(
  114    126   
        &mut self,
  115    127   
        event_loop: &::pyo3::PyAny,
  116    128   
    ) -> ::pyo3::PyResult<
  117    129   
        ::tower::util::BoxCloneService<
  118    130   
            ::http::Request<::aws_smithy_http_server::body::Body>,
  119    131   
            ::http::Response<::aws_smithy_http_server::body::BoxBody>,
  120    132   
            std::convert::Infallible,
  121    133   
        >,
  122    134   
    > {
         135  +
        /* PythonApplicationGenerator.kt:201 */
  123    136   
        let builder = crate::service::PokemonService::builder_without_plugins();
         137  +
        /* PythonApplicationGenerator.kt:209 */
  124    138   
        let capture_pokemon_locals = ::pyo3_asyncio::TaskLocals::new(event_loop);
  125    139   
        let handler = self
  126    140   
            .handlers
  127    141   
            .get("capture_pokemon")
  128    142   
            .expect("Python handler for operation `capture_pokemon` not found")
  129    143   
            .clone();
  130    144   
        let builder = builder.capture_pokemon(move |input, state| {
  131    145   
            ::pyo3_asyncio::tokio::scope(
  132    146   
                capture_pokemon_locals.clone(),
  133    147   
                crate::python_operation_adaptor::capture_pokemon(input, state, handler.clone()),
  134    148   
            )
  135    149   
        });
         150  +
        /* PythonApplicationGenerator.kt:209 */
  136    151   
        let check_health_locals = ::pyo3_asyncio::TaskLocals::new(event_loop);
  137    152   
        let handler = self
  138    153   
            .handlers
  139    154   
            .get("check_health")
  140    155   
            .expect("Python handler for operation `check_health` not found")
  141    156   
            .clone();
  142    157   
        let builder = builder.check_health(move |input, state| {
  143    158   
            ::pyo3_asyncio::tokio::scope(
  144    159   
                check_health_locals.clone(),
  145    160   
                crate::python_operation_adaptor::check_health(input, state, handler.clone()),
  146    161   
            )
  147    162   
        });
         163  +
        /* PythonApplicationGenerator.kt:209 */
  148    164   
        let do_nothing_locals = ::pyo3_asyncio::TaskLocals::new(event_loop);
  149    165   
        let handler = self
  150    166   
            .handlers
  151    167   
            .get("do_nothing")
  152    168   
            .expect("Python handler for operation `do_nothing` not found")
  153    169   
            .clone();
  154    170   
        let builder = builder.do_nothing(move |input, state| {
  155    171   
            ::pyo3_asyncio::tokio::scope(
  156    172   
                do_nothing_locals.clone(),
  157    173   
                crate::python_operation_adaptor::do_nothing(input, state, handler.clone()),
  158    174   
            )
  159    175   
        });
         176  +
        /* PythonApplicationGenerator.kt:209 */
  160    177   
        let get_pokemon_species_locals = ::pyo3_asyncio::TaskLocals::new(event_loop);
  161    178   
        let handler = self
  162    179   
            .handlers
  163    180   
            .get("get_pokemon_species")
  164    181   
            .expect("Python handler for operation `get_pokemon_species` not found")
  165    182   
            .clone();
  166    183   
        let builder = builder.get_pokemon_species(move |input, state| {
  167    184   
            ::pyo3_asyncio::tokio::scope(
  168    185   
                get_pokemon_species_locals.clone(),
  169    186   
                crate::python_operation_adaptor::get_pokemon_species(input, state, handler.clone()),
  170    187   
            )
  171    188   
        });
         189  +
        /* PythonApplicationGenerator.kt:209 */
  172    190   
        let get_server_statistics_locals = ::pyo3_asyncio::TaskLocals::new(event_loop);
  173    191   
        let handler = self
  174    192   
            .handlers
  175    193   
            .get("get_server_statistics")
  176    194   
            .expect("Python handler for operation `get_server_statistics` not found")
  177    195   
            .clone();
  178    196   
        let builder = builder.get_server_statistics(move |input, state| {
  179    197   
            ::pyo3_asyncio::tokio::scope(
  180    198   
                get_server_statistics_locals.clone(),
  181    199   
                crate::python_operation_adaptor::get_server_statistics(
  182    200   
                    input,
  183    201   
                    state,
  184    202   
                    handler.clone(),
  185    203   
                ),
  186    204   
            )
  187    205   
        });
         206  +
        /* PythonApplicationGenerator.kt:209 */
  188    207   
        let get_storage_locals = ::pyo3_asyncio::TaskLocals::new(event_loop);
  189    208   
        let handler = self
  190    209   
            .handlers
  191    210   
            .get("get_storage")
  192    211   
            .expect("Python handler for operation `get_storage` not found")
  193    212   
            .clone();
  194    213   
        let builder = builder.get_storage(move |input, state| {
  195    214   
            ::pyo3_asyncio::tokio::scope(
  196    215   
                get_storage_locals.clone(),
  197    216   
                crate::python_operation_adaptor::get_storage(input, state, handler.clone()),
  198    217   
            )
  199    218   
        });
         219  +
        /* PythonApplicationGenerator.kt:209 */
  200    220   
        let stream_pokemon_radio_locals = ::pyo3_asyncio::TaskLocals::new(event_loop);
  201    221   
        let handler = self
  202    222   
            .handlers
  203    223   
            .get("stream_pokemon_radio")
  204    224   
            .expect("Python handler for operation `stream_pokemon_radio` not found")
  205    225   
            .clone();
  206    226   
        let builder = builder.stream_pokemon_radio(move |input, state| {
  207    227   
            ::pyo3_asyncio::tokio::scope(
  208    228   
                stream_pokemon_radio_locals.clone(),
  209    229   
                crate::python_operation_adaptor::stream_pokemon_radio(
  210    230   
                    input,
  211    231   
                    state,
  212    232   
                    handler.clone(),
  213    233   
                ),
  214    234   
            )
  215    235   
        });
         236  +
        /* PythonApplicationGenerator.kt:220 */
  216    237   
        let mut service = ::tower::util::BoxCloneService::new(builder.build().expect("one or more operations do not have a registered handler; this is a bug in the Python code generator, please file a bug report under https://github.com/smithy-lang/smithy-rs/issues"));
  217    238   
  218    239   
        {
  219    240   
            use ::tower::Layer;
  220    241   
            ::tracing::trace!("adding middlewares to rust python router");
  221    242   
            let mut middlewares = self.middlewares.clone();
  222    243   
            // Reverse the middlewares, so they run with same order as they defined
  223    244   
            middlewares.reverse();
  224    245   
            for handler in middlewares {
  225    246   
                ::tracing::trace!(name = &handler.name, "adding python middleware");
  226    247   
                let locals = ::pyo3_asyncio::TaskLocals::new(event_loop);
  227    248   
                let layer = ::aws_smithy_http_server_python::PyMiddlewareLayer::<
  228    249   
                    ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
  229    250   
                >::new(handler, locals);
  230    251   
                service = ::tower::util::BoxCloneService::new(layer.layer(service));
  231    252   
            }
  232    253   
        }
  233    254   
        Ok(service)
         255  +
        /* PythonApplicationGenerator.kt:189 */
  234    256   
    }
         257  +
    /* PythonApplicationGenerator.kt:168 */
  235    258   
}
         259  +
/* PythonApplicationGenerator.kt:247 */
  236    260   
#[::pyo3::pymethods]
  237    261   
impl App {
         262  +
    /* PythonApplicationGenerator.kt:260 */
  238    263   
    /// Create a new [App].
  239    264   
    #[new]
  240    265   
    pub fn new() -> Self {
  241    266   
        Self::default()
  242    267   
    }
  243    268   
  244    269   
    /// Register a context object that will be shared between handlers.
  245    270   
    ///
  246    271   
    /// :param context Ctx:
  247    272   
    /// :rtype None:
@@ -290,315 +418,451 @@
  310    335   
        py: pyo3::Python,
  311    336   
        socket: &pyo3::PyCell<::aws_smithy_http_server_python::PySocket>,
  312    337   
        worker_number: isize,
  313    338   
        tls: Option<::aws_smithy_http_server_python::tls::PyTlsConfig>,
  314    339   
    ) -> pyo3::PyResult<()> {
  315    340   
        use ::aws_smithy_http_server_python::PyApp;
  316    341   
        let event_loop = self.configure_python_event_loop(py)?;
  317    342   
        let service = self.build_and_configure_service(py, event_loop)?;
  318    343   
        self.start_hyper_worker(py, socket, event_loop, service, worker_number, tls)
  319    344   
    }
         345  +
    /* PythonApplicationGenerator.kt:366 */
  320    346   
    /// Method to register `capture_pokemon` Python implementation inside the handlers map.
  321    347   
    /// It can be used as a function decorator in Python.
  322    348   
    ///
  323    349   
    /// :param func typing.Union\[typing.Callable\[\[pokemon_service_server_sdk.input.CapturePokemonInput, Ctx\], typing.Union\[pokemon_service_server_sdk.output.CapturePokemonOutput, typing.Awaitable\[pokemon_service_server_sdk.output.CapturePokemonOutput\]\]\], typing.Callable\[\[pokemon_service_server_sdk.input.CapturePokemonInput\], typing.Union\[pokemon_service_server_sdk.output.CapturePokemonOutput, typing.Awaitable\[pokemon_service_server_sdk.output.CapturePokemonOutput\]\]\]\]:
  324    350   
    /// :rtype None:
  325    351   
    #[pyo3(text_signature = "($self, func)")]
  326    352   
    pub fn capture_pokemon(
  327    353   
        &mut self,
  328    354   
        py: ::pyo3::Python,
  329    355   
        func: ::pyo3::PyObject,
  330    356   
    ) -> ::pyo3::PyResult<()> {
  331    357   
        use ::aws_smithy_http_server_python::PyApp;
  332    358   
        self.register_operation(py, "capture_pokemon", func)
  333    359   
    }
         360  +
    /* PythonApplicationGenerator.kt:366 */
  334    361   
    /// Method to register `check_health` Python implementation inside the handlers map.
  335    362   
    /// It can be used as a function decorator in Python.
  336    363   
    ///
  337    364   
    /// :param func typing.Union\[typing.Callable\[\[pokemon_service_server_sdk.input.CheckHealthInput, Ctx\], typing.Union\[pokemon_service_server_sdk.output.CheckHealthOutput, typing.Awaitable\[pokemon_service_server_sdk.output.CheckHealthOutput\]\]\], typing.Callable\[\[pokemon_service_server_sdk.input.CheckHealthInput\], typing.Union\[pokemon_service_server_sdk.output.CheckHealthOutput, typing.Awaitable\[pokemon_service_server_sdk.output.CheckHealthOutput\]\]\]\]:
  338    365   
    /// :rtype None:
  339    366   
    #[pyo3(text_signature = "($self, func)")]
  340    367   
    pub fn check_health(
  341    368   
        &mut self,
  342    369   
        py: ::pyo3::Python,
  343    370   
        func: ::pyo3::PyObject,
  344    371   
    ) -> ::pyo3::PyResult<()> {
  345    372   
        use ::aws_smithy_http_server_python::PyApp;
  346    373   
        self.register_operation(py, "check_health", func)
  347    374   
    }
         375  +
    /* PythonApplicationGenerator.kt:366 */
  348    376   
    /// Method to register `do_nothing` Python implementation inside the handlers map.
  349    377   
    /// It can be used as a function decorator in Python.
  350    378   
    ///
  351    379   
    /// :param func typing.Union\[typing.Callable\[\[pokemon_service_server_sdk.input.DoNothingInput, Ctx\], typing.Union\[pokemon_service_server_sdk.output.DoNothingOutput, typing.Awaitable\[pokemon_service_server_sdk.output.DoNothingOutput\]\]\], typing.Callable\[\[pokemon_service_server_sdk.input.DoNothingInput\], typing.Union\[pokemon_service_server_sdk.output.DoNothingOutput, typing.Awaitable\[pokemon_service_server_sdk.output.DoNothingOutput\]\]\]\]:
  352    380   
    /// :rtype None:
  353    381   
    #[pyo3(text_signature = "($self, func)")]
  354    382   
    pub fn do_nothing(
  355    383   
        &mut self,
  356    384   
        py: ::pyo3::Python,
  357    385   
        func: ::pyo3::PyObject,
  358    386   
    ) -> ::pyo3::PyResult<()> {
  359    387   
        use ::aws_smithy_http_server_python::PyApp;
  360    388   
        self.register_operation(py, "do_nothing", func)
  361    389   
    }
         390  +
    /* PythonApplicationGenerator.kt:366 */
  362    391   
    /// Method to register `get_pokemon_species` Python implementation inside the handlers map.
  363    392   
    /// It can be used as a function decorator in Python.
  364    393   
    ///
  365    394   
    /// :param func typing.Union\[typing.Callable\[\[pokemon_service_server_sdk.input.GetPokemonSpeciesInput, Ctx\], typing.Union\[pokemon_service_server_sdk.output.GetPokemonSpeciesOutput, typing.Awaitable\[pokemon_service_server_sdk.output.GetPokemonSpeciesOutput\]\]\], typing.Callable\[\[pokemon_service_server_sdk.input.GetPokemonSpeciesInput\], typing.Union\[pokemon_service_server_sdk.output.GetPokemonSpeciesOutput, typing.Awaitable\[pokemon_service_server_sdk.output.GetPokemonSpeciesOutput\]\]\]\]:
  366    395   
    /// :rtype None:
  367    396   
    #[pyo3(text_signature = "($self, func)")]
  368    397   
    pub fn get_pokemon_species(
  369    398   
        &mut self,
  370    399   
        py: ::pyo3::Python,
  371    400   
        func: ::pyo3::PyObject,
  372    401   
    ) -> ::pyo3::PyResult<()> {
  373    402   
        use ::aws_smithy_http_server_python::PyApp;
  374    403   
        self.register_operation(py, "get_pokemon_species", func)
  375    404   
    }
         405  +
    /* PythonApplicationGenerator.kt:366 */
  376    406   
    /// Method to register `get_server_statistics` Python implementation inside the handlers map.
  377    407   
    /// It can be used as a function decorator in Python.
  378    408   
    ///
  379    409   
    /// :param func typing.Union\[typing.Callable\[\[pokemon_service_server_sdk.input.GetServerStatisticsInput, Ctx\], typing.Union\[pokemon_service_server_sdk.output.GetServerStatisticsOutput, typing.Awaitable\[pokemon_service_server_sdk.output.GetServerStatisticsOutput\]\]\], typing.Callable\[\[pokemon_service_server_sdk.input.GetServerStatisticsInput\], typing.Union\[pokemon_service_server_sdk.output.GetServerStatisticsOutput, typing.Awaitable\[pokemon_service_server_sdk.output.GetServerStatisticsOutput\]\]\]\]:
  380    410   
    /// :rtype None:
  381    411   
    #[pyo3(text_signature = "($self, func)")]
  382    412   
    pub fn get_server_statistics(
  383    413   
        &mut self,
  384    414   
        py: ::pyo3::Python,
  385    415   
        func: ::pyo3::PyObject,
  386    416   
    ) -> ::pyo3::PyResult<()> {
  387    417   
        use ::aws_smithy_http_server_python::PyApp;
  388    418   
        self.register_operation(py, "get_server_statistics", func)
  389    419   
    }
         420  +
    /* PythonApplicationGenerator.kt:366 */
  390    421   
    /// Method to register `get_storage` Python implementation inside the handlers map.
  391    422   
    /// It can be used as a function decorator in Python.
  392    423   
    ///
  393    424   
    /// :param func typing.Union\[typing.Callable\[\[pokemon_service_server_sdk.input.GetStorageInput, Ctx\], typing.Union\[pokemon_service_server_sdk.output.GetStorageOutput, typing.Awaitable\[pokemon_service_server_sdk.output.GetStorageOutput\]\]\], typing.Callable\[\[pokemon_service_server_sdk.input.GetStorageInput\], typing.Union\[pokemon_service_server_sdk.output.GetStorageOutput, typing.Awaitable\[pokemon_service_server_sdk.output.GetStorageOutput\]\]\]\]:
  394    425   
    /// :rtype None:
  395    426   
    #[pyo3(text_signature = "($self, func)")]
  396    427   
    pub fn get_storage(
  397    428   
        &mut self,
  398    429   
        py: ::pyo3::Python,
  399    430   
        func: ::pyo3::PyObject,
  400    431   
    ) -> ::pyo3::PyResult<()> {
  401    432   
        use ::aws_smithy_http_server_python::PyApp;
  402    433   
        self.register_operation(py, "get_storage", func)
  403    434   
    }
         435  +
    /* PythonApplicationGenerator.kt:366 */
  404    436   
    /// Method to register `stream_pokemon_radio` Python implementation inside the handlers map.
  405    437   
    /// It can be used as a function decorator in Python.
  406    438   
    ///
  407    439   
    /// :param func typing.Union\[typing.Callable\[\[pokemon_service_server_sdk.input.StreamPokemonRadioInput, Ctx\], typing.Union\[pokemon_service_server_sdk.output.StreamPokemonRadioOutput, typing.Awaitable\[pokemon_service_server_sdk.output.StreamPokemonRadioOutput\]\]\], typing.Callable\[\[pokemon_service_server_sdk.input.StreamPokemonRadioInput\], typing.Union\[pokemon_service_server_sdk.output.StreamPokemonRadioOutput, typing.Awaitable\[pokemon_service_server_sdk.output.StreamPokemonRadioOutput\]\]\]\]:
  408    440   
    /// :rtype None:
  409    441   
    #[pyo3(text_signature = "($self, func)")]
  410    442   
    pub fn stream_pokemon_radio(
  411    443   
        &mut self,
  412    444   
        py: ::pyo3::Python,
  413    445   
        func: ::pyo3::PyObject,
  414    446   
    ) -> ::pyo3::PyResult<()> {
  415    447   
        use ::aws_smithy_http_server_python::PyApp;
  416    448   
        self.register_operation(py, "stream_pokemon_radio", func)
  417    449   
    }
         450  +
    /* PythonApplicationGenerator.kt:247 */
  418    451   
}

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

@@ -1,1 +31,32 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerServiceGenerator.kt:795 */
    2      3   
/// The service builder for [`PokemonService`].
    3      4   
///
    4      5   
/// Constructed via [`PokemonService::builder`].
    5      6   
pub struct PokemonServiceBuilder<Body, L, HttpPl, ModelPl> {
    6      7   
    capture_pokemon: Option<::aws_smithy_http_server::routing::Route<Body>>,
    7      8   
    check_health: Option<::aws_smithy_http_server::routing::Route<Body>>,
    8      9   
    do_nothing: Option<::aws_smithy_http_server::routing::Route<Body>>,
    9     10   
    get_pokemon_species: Option<::aws_smithy_http_server::routing::Route<Body>>,
   10     11   
    get_server_statistics: Option<::aws_smithy_http_server::routing::Route<Body>>,
   11     12   
    get_storage: Option<::aws_smithy_http_server::routing::Route<Body>>,
@@ -1668,1669 +1727,1729 @@
 1688   1689   
            "com.aws.example",
 1689   1690   
            "PokemonService",
 1690   1691   
        );
 1691   1692   
 1692   1693   
    const VERSION: Option<&'static str> = Some("2024-03-18");
 1693   1694   
 1694   1695   
    type Protocol = ::aws_smithy_http_server::protocol::rest_json_1::RestJson1;
 1695   1696   
 1696   1697   
    type Operations = Operation;
 1697   1698   
}
        1699  +
/* ServiceConfigGenerator.kt:178 */
 1698   1700   
/// Configuration for the [`PokemonService`]. This is the central place where to register and
 1699   1701   
/// configure [`::tower::Layer`]s, HTTP plugins, and model plugins.
 1700   1702   
///
 1701   1703   
/// ```rust,no_run
 1702   1704   
/// # use pokemon_service_server_sdk::PokemonServiceConfig;
 1703   1705   
/// # use ::aws_smithy_http_server::plugin::IdentityPlugin;
 1704   1706   
/// # use ::tower::layer::util::Identity;
 1705   1707   
/// # let authentication_plugin = IdentityPlugin;
 1706   1708   
/// # let authorization_plugin = IdentityPlugin;
 1707   1709   
/// # let server_request_id_provider_layer = Identity::new();
@@ -1789,1791 +1848,1851 @@
 1809   1811   
 1810   1812   
    /// Build the configuration.
 1811   1813   
    pub fn build(self) -> super::PokemonServiceConfig<L, H, M> {
 1812   1814   
        super::PokemonServiceConfig {
 1813   1815   
            layers: self.layers,
 1814   1816   
            http_plugins: self.http_plugins,
 1815   1817   
            model_plugins: self.model_plugins,
 1816   1818   
        }
 1817   1819   
    }
 1818   1820   
}
        1821  +
/* ScopeMacroGenerator.kt:81 */
 1819   1822   
/// A macro to help with scoping [plugins](crate::server::plugin) to a subset of all operations.
 1820   1823   
///
 1821   1824   
/// In contrast to [`crate::server::scope`](crate::server::scope), this macro has knowledge
 1822   1825   
/// of the service and any operations _not_ specified will be placed in the opposing group.
 1823   1826   
///
 1824   1827   
/// # Example
 1825   1828   
///
 1826   1829   
/// ```rust
 1827   1830   
/// scope! {
 1828   1831   
///     /// Includes [`CapturePokemon`], excluding all other operations.