Server Test

Server Test

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943

Files changed:

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/protocol_serde/shape_operation_with_required_members.rs

@@ -1,1 +55,78 @@
    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_operation_with_required_members_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::OperationWithRequiredMembersInput,
    7      9   
    ::aws_smithy_http_server::protocol::aws_json::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::aws_json::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::operation_with_required_members_input::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:834 */
   22     30   
        input.build()
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   23     32   
    })
          33  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   24     34   
}
   25     35   
          36  +
/* RustType.kt:516 */
   26     37   
#[allow(clippy::unnecessary_wraps)]
          38  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   27     39   
pub fn ser_operation_with_required_members_http_response(
   28     40   
    #[allow(unused_variables)] output: crate::output::OperationWithRequiredMembersOutput,
   29     41   
) -> std::result::Result<
   30     42   
    ::aws_smithy_http_server::response::Response,
   31     43   
    ::aws_smithy_http_server::protocol::aws_json::rejection::ResponseRejection,
   32     44   
> {
          45  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   33     46   
    Ok({
          47  +
        /* RustType.kt:516 */
   34     48   
        #[allow(unused_mut)]
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   35     50   
        let mut builder = ::http::Response::builder();
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   36     52   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   37     53   
            builder,
   38     54   
            ::http::header::CONTENT_TYPE,
   39     55   
            "application/x-amz-json-1.0",
   40     56   
        );
          57  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   41     58   
        let http_status: u16 = 200;
   42     59   
        builder = builder.status(http_status);
          60  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   43     61   
        let payload =
   44         -
            crate::protocol_serde::shape_operation_with_required_members_output::ser_operation_with_required_members_output_output_output(&output)?
   45         -
        ;
          62  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_operation_with_required_members_output::ser_operation_with_required_members_output_output_output(&output)?
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   46     65   
        let content_length = payload.len();
   47     66   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   48     67   
            builder,
   49     68   
            ::http::header::CONTENT_LENGTH,
   50     69   
            content_length,
   51     70   
        );
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   52     72   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   53     74   
        builder.body(body)?
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   54     76   
    })
          77  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   55     78   
}

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/protocol_serde/shape_operation_with_required_members_output.rs

@@ -1,1 +93,150 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_operation_with_required_members_output_output_output(
    3      4   
    value: &crate::output::OperationWithRequiredMembersOutput,
    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_operation_with_required_members_output::ser_operation_with_required_members_output_output(&mut object, value)?;
          11  +
    /* JsonSerializerGenerator.kt:227 */
    8     12   
    object.finish();
    9     13   
    Ok(out)
          14  +
    /* JsonSerializerGenerator.kt:213 */
   10     15   
}
   11     16   
          17  +
/* JsonSerializerGenerator.kt:358 */
   12     18   
pub fn ser_operation_with_required_members_output_output(
   13     19   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    input: &crate::output::OperationWithRequiredMembersOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* SerializerUtil.kt:42 */
   16     23   
    {
          24  +
        /* JsonSerializerGenerator.kt:423 */
   17     25   
        object
   18     26   
            .key("requiredString")
   19     27   
            .string(input.required_string.as_str());
          28  +
        /* SerializerUtil.kt:42 */
   20     29   
    }
          30  +
    /* SerializerUtil.kt:42 */
   21     31   
    {
          32  +
        /* JsonSerializerGenerator.kt:424 */
   22     33   
        object
   23     34   
            .key("requiredBoolean")
   24     35   
            .boolean(input.required_boolean);
          36  +
        /* SerializerUtil.kt:42 */
   25     37   
    }
          38  +
    /* SerializerUtil.kt:42 */
   26     39   
    {
          40  +
        /* JsonSerializerGenerator.kt:484 */
   27     41   
        let mut array_1 = object.key("requiredList").start_array();
          42  +
        /* JsonSerializerGenerator.kt:524 */
   28     43   
        for item_2 in &input.required_list {
          44  +
            /* SerializerUtil.kt:42 */
   29     45   
            {
          46  +
                /* JsonSerializerGenerator.kt:423 */
   30     47   
                array_1.value().string(item_2.as_str());
          48  +
                /* SerializerUtil.kt:42 */
   31     49   
            }
          50  +
            /* JsonSerializerGenerator.kt:524 */
   32     51   
        }
          52  +
        /* JsonSerializerGenerator.kt:486 */
   33     53   
        array_1.finish();
          54  +
        /* SerializerUtil.kt:42 */
   34     55   
    }
          56  +
    /* SerializerUtil.kt:42 */
   35     57   
    {
          58  +
        /* JsonSerializerGenerator.kt:448 */
   36     59   
        object.key("requiredTimestamp").date_time(
   37     60   
            &input.required_timestamp,
   38     61   
            ::aws_smithy_types::date_time::Format::EpochSeconds,
   39     62   
        )?;
          63  +
        /* SerializerUtil.kt:42 */
   40     64   
    }
          65  +
    /* SerializerUtil.kt:42 */
   41     66   
    {
          67  +
        /* JsonSerializerGenerator.kt:439 */
   42     68   
        object
   43     69   
            .key("requiredBlob")
   44     70   
            .string_unchecked(&::aws_smithy_types::base64::encode(&input.required_blob));
          71  +
        /* SerializerUtil.kt:42 */
   45     72   
    }
          73  +
    /* SerializerUtil.kt:42 */
   46     74   
    {
          75  +
        /* JsonSerializerGenerator.kt:432 */
   47     76   
        object.key("requiredByte").number(
   48     77   
            #[allow(clippy::useless_conversion)]
   49     78   
            ::aws_smithy_types::Number::NegInt((input.required_byte).into()),
   50     79   
        );
          80  +
        /* SerializerUtil.kt:42 */
   51     81   
    }
          82  +
    /* SerializerUtil.kt:42 */
   52     83   
    {
          84  +
        /* JsonSerializerGenerator.kt:432 */
   53     85   
        object.key("requiredShort").number(
   54     86   
            #[allow(clippy::useless_conversion)]
   55     87   
            ::aws_smithy_types::Number::NegInt((input.required_short).into()),
   56     88   
        );
          89  +
        /* SerializerUtil.kt:42 */
   57     90   
    }
          91  +
    /* SerializerUtil.kt:42 */
   58     92   
    {
          93  +
        /* JsonSerializerGenerator.kt:432 */
   59     94   
        object.key("requiredInteger").number(
   60     95   
            #[allow(clippy::useless_conversion)]
   61     96   
            ::aws_smithy_types::Number::NegInt((input.required_integer).into()),
   62     97   
        );
          98  +
        /* SerializerUtil.kt:42 */
   63     99   
    }
         100  +
    /* SerializerUtil.kt:42 */
   64    101   
    {
         102  +
        /* JsonSerializerGenerator.kt:432 */
   65    103   
        object.key("requiredLong").number(
   66    104   
            #[allow(clippy::useless_conversion)]
   67    105   
            ::aws_smithy_types::Number::NegInt((input.required_long).into()),
   68    106   
        );
         107  +
        /* SerializerUtil.kt:42 */
   69    108   
    }
         109  +
    /* SerializerUtil.kt:42 */
   70    110   
    {
         111  +
        /* JsonSerializerGenerator.kt:432 */
   71    112   
        object.key("requiredFloat").number(
   72    113   
            #[allow(clippy::useless_conversion)]
   73    114   
            ::aws_smithy_types::Number::Float((input.required_float).into()),
   74    115   
        );
         116  +
        /* SerializerUtil.kt:42 */
   75    117   
    }
         118  +
    /* SerializerUtil.kt:42 */
   76    119   
    {
         120  +
        /* JsonSerializerGenerator.kt:432 */
   77    121   
        object.key("requiredDouble").number(
   78    122   
            #[allow(clippy::useless_conversion)]
   79    123   
            ::aws_smithy_types::Number::Float((input.required_double).into()),
   80    124   
        );
         125  +
        /* SerializerUtil.kt:42 */
   81    126   
    }
         127  +
    /* SerializerUtil.kt:42 */
   82    128   
    {
         129  +
        /* JsonSerializerGenerator.kt:495 */
   83    130   
        #[allow(unused_mut)]
         131  +
        /* JsonSerializerGenerator.kt:496 */
   84    132   
        let mut object_3 = object.key("requiredMap").start_object();
         133  +
        /* JsonSerializerGenerator.kt:537 */
   85    134   
        for (key_4, value_5) in &input.required_map {
         135  +
            /* SerializerUtil.kt:42 */
   86    136   
            {
         137  +
                /* JsonSerializerGenerator.kt:423 */
   87    138   
                object_3.key(key_4.as_str()).string(value_5.as_str());
         139  +
                /* SerializerUtil.kt:42 */
   88    140   
            }
         141  +
            /* JsonSerializerGenerator.kt:537 */
   89    142   
        }
         143  +
        /* JsonSerializerGenerator.kt:515 */
   90    144   
        object_3.finish();
         145  +
        /* SerializerUtil.kt:42 */
   91    146   
    }
         147  +
    /* JsonSerializerGenerator.kt:372 */
   92    148   
    Ok(())
         149  +
    /* JsonSerializerGenerator.kt:358 */
   93    150   
}

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/protocol_serde/shape_put_with_content_encoding.rs

@@ -1,1 +119,177 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_put_with_content_encoding_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::PutWithContentEncodingInput,
    7      9   
    ::aws_smithy_http_server::protocol::aws_json::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::aws_json::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::put_with_content_encoding_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/x-amz-json-1.0"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_put_with_content_encoding::de_put_with_content_encoding(bytes.as_ref(), input)?;
          39  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   29     40   
        }
          41  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   30     42   
        input.build()
          43  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   31     44   
    })
          45  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   32     46   
}
   33     47   
          48  +
/* RustType.kt:516 */
   34     49   
#[allow(clippy::unnecessary_wraps)]
          50  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   35     51   
pub fn ser_put_with_content_encoding_http_response(
   36     52   
    #[allow(unused_variables)] output: crate::output::PutWithContentEncodingOutput,
   37     53   
) -> std::result::Result<
   38     54   
    ::aws_smithy_http_server::response::Response,
   39     55   
    ::aws_smithy_http_server::protocol::aws_json::rejection::ResponseRejection,
   40     56   
> {
          57  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   41     58   
    Ok({
          59  +
        /* RustType.kt:516 */
   42     60   
        #[allow(unused_mut)]
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   43     62   
        let mut builder = ::http::Response::builder();
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   44     64   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   45     65   
            builder,
   46     66   
            ::http::header::CONTENT_TYPE,
   47     67   
            "application/x-amz-json-1.0",
   48     68   
        );
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   49     70   
        let http_status: u16 = 200;
   50     71   
        builder = builder.status(http_status);
   51         -
        let payload = "";
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          73  +
        let payload =
          74  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   52     77   
        let content_length = payload.len();
   53     78   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   54     79   
            builder,
   55     80   
            ::http::header::CONTENT_LENGTH,
   56     81   
            content_length,
   57     82   
        );
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   58     84   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          85  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   59     86   
        builder.body(body)?
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   60     88   
    })
          89  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   61     90   
}
   62     91   
          92  +
/* JsonParserGenerator.kt:148 */
   63     93   
pub(crate) fn de_put_with_content_encoding(
   64     94   
    value: &[u8],
   65     95   
    mut builder: crate::input::put_with_content_encoding_input::Builder,
   66     96   
) -> ::std::result::Result<
   67     97   
    crate::input::put_with_content_encoding_input::Builder,
   68     98   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   69     99   
> {
         100  +
    /* JsonParserGenerator.kt:153 */
   70    101   
    let mut tokens_owned =
   71    102   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
   72    103   
            .peekable();
   73    104   
    let tokens = &mut tokens_owned;
   74    105   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         106  +
    /* JsonParserGenerator.kt:684 */
   75    107   
    loop {
         108  +
        /* JsonParserGenerator.kt:685 */
   76    109   
        match tokens.next().transpose()? {
         110  +
            /* JsonParserGenerator.kt:686 */
   77    111   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   78    112   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         113  +
                /* JsonParserGenerator.kt:260 */
   79    114   
                match key.to_unescaped()?.as_ref() {
         115  +
                    /* JsonParserGenerator.kt:262 */
   80    116   
                    "encoding" => {
         117  +
                        /* JsonParserGenerator.kt:272 */
   81    118   
                        builder = builder.set_encoding(
         119  +
                            /* JsonParserGenerator.kt:354 */
   82    120   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
   83    121   
                                tokens.next(),
   84    122   
                            )?
   85         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   86         -
                            .transpose()?,
         123  +
                            .map(|s|
         124  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         125  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         126  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         127  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
   87    128   
                        );
         129  +
                        /* JsonParserGenerator.kt:262 */
   88    130   
                    }
         131  +
                    /* JsonParserGenerator.kt:262 */
   89    132   
                    "data" => {
         133  +
                        /* JsonParserGenerator.kt:272 */
   90    134   
                        builder = builder.set_data(
         135  +
                            /* JsonParserGenerator.kt:354 */
   91    136   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
   92    137   
                                tokens.next(),
   93    138   
                            )?
   94         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   95         -
                            .transpose()?,
         139  +
                            .map(|s|
         140  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         141  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         142  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         143  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
   96    144   
                        );
         145  +
                        /* JsonParserGenerator.kt:262 */
   97    146   
                    }
   98         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         147  +
                    /* JsonParserGenerator.kt:290 */
         148  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   99    149   
                }
         150  +
                /* JsonParserGenerator.kt:686 */
  100    151   
            }
         152  +
            /* JsonParserGenerator.kt:695 */
  101    153   
            other => {
  102    154   
                return Err(
  103    155   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  104    156   
                        "expected object key or end object, found: {:?}",
  105    157   
                        other
  106    158   
                    )),
  107    159   
                )
  108         -
            }
         160  +
            } /* JsonParserGenerator.kt:685 */
  109    161   
        }
         162  +
        /* JsonParserGenerator.kt:684 */
  110    163   
    }
         164  +
    /* JsonParserGenerator.kt:250 */
  111    165   
    if tokens.next().is_some() {
         166  +
        /* JsonParserGenerator.kt:251 */
  112    167   
        return Err(
  113    168   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  114    169   
                "found more JSON tokens after completing parsing",
  115    170   
            ),
  116    171   
        );
         172  +
        /* JsonParserGenerator.kt:250 */
  117    173   
    }
         174  +
    /* JsonParserGenerator.kt:163 */
  118    175   
    Ok(builder)
         176  +
    /* JsonParserGenerator.kt:148 */
  119    177   
}

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/protocol_serde/shape_simple_scalar_properties.rs

@@ -1,1 +123,173 @@
    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_simple_scalar_properties_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::SimpleScalarPropertiesInput,
    7      9   
    ::aws_smithy_http_server::protocol::aws_json::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::aws_json::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::simple_scalar_properties_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/x-amz-json-1.0"),
   27     37   
            )?;
   28     38   
            input =
   29     39   
                crate::protocol_serde::shape_simple_scalar_properties::de_simple_scalar_properties(
   30     40   
                    bytes.as_ref(),
   31     41   
                    input,
   32     42   
                )?;
          43  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   33     44   
        }
          45  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   34     46   
        input.build()
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   35     48   
    })
          49  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   36     50   
}
   37     51   
          52  +
/* RustType.kt:516 */
   38     53   
#[allow(clippy::unnecessary_wraps)]
          54  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   39     55   
pub fn ser_simple_scalar_properties_http_response(
   40     56   
    #[allow(unused_variables)] output: crate::output::SimpleScalarPropertiesOutput,
   41     57   
) -> std::result::Result<
   42     58   
    ::aws_smithy_http_server::response::Response,
   43     59   
    ::aws_smithy_http_server::protocol::aws_json::rejection::ResponseRejection,
   44     60   
> {
          61  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   45     62   
    Ok({
          63  +
        /* RustType.kt:516 */
   46     64   
        #[allow(unused_mut)]
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   47     66   
        let mut builder = ::http::Response::builder();
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   48     68   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   49     69   
            builder,
   50     70   
            ::http::header::CONTENT_TYPE,
   51     71   
            "application/x-amz-json-1.0",
   52     72   
        );
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   53     74   
        let http_status: u16 = 200;
   54     75   
        builder = builder.status(http_status);
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   55     77   
        let payload =
   56         -
            crate::protocol_serde::shape_simple_scalar_properties_output::ser_simple_scalar_properties_output_output_output(&output)?
   57         -
        ;
          78  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_simple_scalar_properties_output::ser_simple_scalar_properties_output_output_output(&output)?
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   58     81   
        let content_length = payload.len();
   59     82   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   60     83   
            builder,
   61     84   
            ::http::header::CONTENT_LENGTH,
   62     85   
            content_length,
   63     86   
        );
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   64     88   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   65     90   
        builder.body(body)?
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   66     92   
    })
          93  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   67     94   
}
   68     95   
          96  +
/* JsonParserGenerator.kt:148 */
   69     97   
pub(crate) fn de_simple_scalar_properties(
   70     98   
    value: &[u8],
   71     99   
    mut builder: crate::input::simple_scalar_properties_input::Builder,
   72    100   
) -> ::std::result::Result<
   73    101   
    crate::input::simple_scalar_properties_input::Builder,
   74    102   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   75    103   
> {
         104  +
    /* JsonParserGenerator.kt:153 */
   76    105   
    let mut tokens_owned =
   77    106   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
   78    107   
            .peekable();
   79    108   
    let tokens = &mut tokens_owned;
   80    109   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         110  +
    /* JsonParserGenerator.kt:684 */
   81    111   
    loop {
         112  +
        /* JsonParserGenerator.kt:685 */
   82    113   
        match tokens.next().transpose()? {
         114  +
            /* JsonParserGenerator.kt:686 */
   83    115   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   84    116   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         117  +
                /* JsonParserGenerator.kt:260 */
   85    118   
                match key.to_unescaped()?.as_ref() {
         119  +
                    /* JsonParserGenerator.kt:262 */
   86    120   
                    "floatValue" => {
         121  +
                        /* JsonParserGenerator.kt:272 */
   87    122   
                        builder = builder.set_float_value(
         123  +
                            /* JsonParserGenerator.kt:361 */
   88    124   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
   89    125   
                                tokens.next(),
   90    126   
                            )?
   91         -
                            .map(|v| v.to_f32_lossy()),
         127  +
                            .map(|v| v.to_f32_lossy()), /* JsonParserGenerator.kt:272 */
   92    128   
                        );
         129  +
                        /* JsonParserGenerator.kt:262 */
   93    130   
                    }
         131  +
                    /* JsonParserGenerator.kt:262 */
   94    132   
                    "doubleValue" => {
         133  +
                        /* JsonParserGenerator.kt:272 */
   95    134   
                        builder = builder.set_double_value(
         135  +
                            /* JsonParserGenerator.kt:363 */
   96    136   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
   97    137   
                                tokens.next(),
   98    138   
                            )?
   99         -
                            .map(|v| v.to_f64_lossy()),
         139  +
                            .map(|v| v.to_f64_lossy()), /* JsonParserGenerator.kt:272 */
  100    140   
                        );
         141  +
                        /* JsonParserGenerator.kt:262 */
  101    142   
                    }
  102         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         143  +
                    /* JsonParserGenerator.kt:290 */
         144  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  103    145   
                }
         146  +
                /* JsonParserGenerator.kt:686 */
  104    147   
            }
         148  +
            /* JsonParserGenerator.kt:695 */
  105    149   
            other => {
  106    150   
                return Err(
  107    151   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  108    152   
                        "expected object key or end object, found: {:?}",
  109    153   
                        other
  110    154   
                    )),
  111    155   
                )
  112         -
            }
         156  +
            } /* JsonParserGenerator.kt:685 */
  113    157   
        }
         158  +
        /* JsonParserGenerator.kt:684 */
  114    159   
    }
         160  +
    /* JsonParserGenerator.kt:250 */
  115    161   
    if tokens.next().is_some() {
         162  +
        /* JsonParserGenerator.kt:251 */
  116    163   
        return Err(
  117    164   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  118    165   
                "found more JSON tokens after completing parsing",
  119    166   
            ),
  120    167   
        );
         168  +
        /* JsonParserGenerator.kt:250 */
  121    169   
    }
         170  +
    /* JsonParserGenerator.kt:163 */
  122    171   
    Ok(builder)
         172  +
    /* JsonParserGenerator.kt:148 */
  123    173   
}

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/protocol_serde/shape_simple_scalar_properties_output.rs

@@ -1,1 +29,43 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_simple_scalar_properties_output_output_output(
    3      4   
    value: &crate::output::SimpleScalarPropertiesOutput,
    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_simple_scalar_properties_output::ser_simple_scalar_properties_output_output(&mut object, value)?;
          11  +
    /* JsonSerializerGenerator.kt:227 */
    8     12   
    object.finish();
    9     13   
    Ok(out)
          14  +
    /* JsonSerializerGenerator.kt:213 */
   10     15   
}
   11     16   
          17  +
/* JsonSerializerGenerator.kt:358 */
   12     18   
pub fn ser_simple_scalar_properties_output_output(
   13     19   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    input: &crate::output::SimpleScalarPropertiesOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* JsonSerializerGenerator.kt:382 */
   16     23   
    if let Some(var_1) = &input.float_value {
          24  +
        /* JsonSerializerGenerator.kt:432 */
   17     25   
        object.key("floatValue").number(
   18     26   
            #[allow(clippy::useless_conversion)]
   19     27   
            ::aws_smithy_types::Number::Float((*var_1).into()),
   20     28   
        );
          29  +
        /* JsonSerializerGenerator.kt:382 */
   21     30   
    }
          31  +
    /* JsonSerializerGenerator.kt:382 */
   22     32   
    if let Some(var_2) = &input.double_value {
          33  +
        /* JsonSerializerGenerator.kt:432 */
   23     34   
        object.key("doubleValue").number(
   24     35   
            #[allow(clippy::useless_conversion)]
   25     36   
            ::aws_smithy_types::Number::Float((*var_2).into()),
   26     37   
        );
          38  +
        /* JsonSerializerGenerator.kt:382 */
   27     39   
    }
          40  +
    /* JsonSerializerGenerator.kt:372 */
   28     41   
    Ok(())
          42  +
    /* JsonSerializerGenerator.kt:358 */
   29     43   
}

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/protocol_serde/shape_string_list.rs

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

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/protocol_serde/shape_string_map.rs

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

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/protocol_serde/shape_test_string_list.rs

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

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/protocol_serde/shape_test_string_map.rs

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

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/protocol_serde/shape_top_level.rs

@@ -1,1 +67,107 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:516 */
    2      3   
pub(crate) fn de_top_level<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::model::top_level::Builder>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
>
    8      9   
where
    9     10   
    I: Iterator<
   10     11   
        Item = Result<
   11     12   
            ::aws_smithy_json::deserialize::Token<'a>,
   12     13   
            ::aws_smithy_json::deserialize::error::DeserializeError,
   13     14   
        >,
   14     15   
    >,
   15     16   
{
          17  +
    /* JsonParserGenerator.kt:712 */
   16     18   
    match tokens.next().transpose()? {
          19  +
        /* JsonParserGenerator.kt:713 */
   17     20   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   18     21   
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          22  +
            /* RustType.kt:516 */
   19     23   
            #[allow(unused_mut)]
          24  +
            /* JsonParserGenerator.kt:526 */
   20     25   
            let mut builder = crate::model::top_level::Builder::default();
          26  +
            /* JsonParserGenerator.kt:684 */
   21     27   
            loop {
          28  +
                /* JsonParserGenerator.kt:685 */
   22     29   
                match tokens.next().transpose()? {
          30  +
                    /* JsonParserGenerator.kt:686 */
   23     31   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   24         -
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key
   25         -
                        .to_unescaped()?
   26         -
                        .as_ref()
   27         -
                    {
   28         -
                        "dialog" => {
   29         -
                            if let Some(v) = crate::protocol_serde::shape_dialog::de_dialog(tokens)?
   30         -
                            {
   31         -
                                builder = builder.set_dialog(v);
          32  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          33  +
                        /* JsonParserGenerator.kt:260 */
          34  +
                        match key.to_unescaped()?.as_ref() {
          35  +
                            /* JsonParserGenerator.kt:262 */
          36  +
                            "dialog" => {
          37  +
                                /* JsonParserGenerator.kt:276 */
          38  +
                                if let Some(v) =
          39  +
                                    /* JsonParserGenerator.kt:544 */
          40  +
                                    crate::protocol_serde::shape_dialog::de_dialog(tokens)?
          41  +
                                /* JsonParserGenerator.kt:278 */
          42  +
                                {
          43  +
                                    builder = builder.set_dialog(v);
          44  +
                                }
          45  +
                                /* JsonParserGenerator.kt:262 */
   32     46   
                            }
   33         -
                        }
   34         -
                        "dialogList" => {
   35         -
                            if let Some(v) =
   36         -
                                crate::protocol_serde::shape_dialog_list::de_dialog_list(tokens)?
   37         -
                            {
   38         -
                                builder = builder.set_dialog_list(v);
          47  +
                            /* JsonParserGenerator.kt:262 */
          48  +
                            "dialogList" => {
          49  +
                                /* JsonParserGenerator.kt:276 */
          50  +
                                if let Some(v) =
          51  +
                                    /* JsonParserGenerator.kt:451 */
          52  +
                                    crate::protocol_serde::shape_dialog_list::de_dialog_list(
          53  +
                                            tokens,
          54  +
                                        )?
          55  +
                                /* JsonParserGenerator.kt:278 */
          56  +
                                {
          57  +
                                    builder = builder.set_dialog_list(v);
          58  +
                                }
          59  +
                                /* JsonParserGenerator.kt:262 */
   39     60   
                            }
   40         -
                        }
   41         -
                        "dialogMap" => {
   42         -
                            if let Some(v) =
   43         -
                                crate::protocol_serde::shape_dialog_map::de_dialog_map(tokens)?
   44         -
                            {
   45         -
                                builder = builder.set_dialog_map(v);
          61  +
                            /* JsonParserGenerator.kt:262 */
          62  +
                            "dialogMap" => {
          63  +
                                /* JsonParserGenerator.kt:276 */
          64  +
                                if let Some(v) =
          65  +
                                    /* JsonParserGenerator.kt:509 */
          66  +
                                    crate::protocol_serde::shape_dialog_map::de_dialog_map(
          67  +
                                            tokens,
          68  +
                                        )?
          69  +
                                /* JsonParserGenerator.kt:278 */
          70  +
                                {
          71  +
                                    builder = builder.set_dialog_map(v);
          72  +
                                }
          73  +
                                /* JsonParserGenerator.kt:262 */
   46     74   
                            }
          75  +
                            /* JsonParserGenerator.kt:290 */
          76  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   47     77   
                        }
   48         -
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   49         -
                    },
          78  +
                        /* JsonParserGenerator.kt:686 */
          79  +
                    }
          80  +
                    /* JsonParserGenerator.kt:695 */
   50     81   
                    other => {
   51     82   
                        return Err(
   52     83   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   53     84   
                                format!("expected object key or end object, found: {:?}", other),
   54     85   
                            ),
   55     86   
                        )
   56         -
                    }
          87  +
                    } /* JsonParserGenerator.kt:685 */
   57     88   
                }
          89  +
                /* JsonParserGenerator.kt:684 */
   58     90   
            }
          91  +
            /* JsonParserGenerator.kt:540 */
   59     92   
            Ok(Some(builder))
          93  +
            /* JsonParserGenerator.kt:713 */
   60     94   
        }
   61         -
        _ => Err(
   62         -
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   63         -
                "expected start object or null",
   64         -
            ),
   65         -
        ),
          95  +
        /* JsonParserGenerator.kt:722 */
          96  +
        _ => {
          97  +
            /* JsonParserGenerator.kt:723 */
          98  +
            Err(
          99  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         100  +
                    "expected start object or null",
         101  +
                ),
         102  +
            )
         103  +
            /* JsonParserGenerator.kt:722 */
         104  +
        } /* JsonParserGenerator.kt:712 */
   66    105   
    }
         106  +
    /* JsonParserGenerator.kt:516 */
   67    107   
}

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/protocol_serde/shape_validation_exception.rs

@@ -1,1 +38,62 @@
    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  +
    /* ServerAwsJson.kt:95 */
   11     15   
    object
   12     16   
        .key("__type")
   13     17   
        .string("smithy.framework#ValidationException");
          18  +
    /* JsonSerializerGenerator.kt:227 */
   14     19   
    object.finish();
   15     20   
    Ok(out)
          21  +
    /* JsonSerializerGenerator.kt:213 */
   16     22   
}
   17     23   
          24  +
/* JsonSerializerGenerator.kt:358 */
   18     25   
pub fn ser_validation_exception(
   19     26   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   20     27   
    input: &crate::error::ValidationException,
   21     28   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          29  +
    /* SerializerUtil.kt:42 */
   22     30   
    {
          31  +
        /* JsonSerializerGenerator.kt:423 */
   23     32   
        object.key("message").string(input.message.as_str());
          33  +
        /* SerializerUtil.kt:42 */
   24     34   
    }
          35  +
    /* JsonSerializerGenerator.kt:382 */
   25     36   
    if let Some(var_1) = &input.field_list {
          37  +
        /* JsonSerializerGenerator.kt:484 */
   26     38   
        let mut array_2 = object.key("fieldList").start_array();
          39  +
        /* JsonSerializerGenerator.kt:524 */
   27     40   
        for item_3 in var_1 {
          41  +
            /* SerializerUtil.kt:42 */
   28     42   
            {
          43  +
                /* JsonSerializerGenerator.kt:495 */
   29     44   
                #[allow(unused_mut)]
          45  +
                /* JsonSerializerGenerator.kt:496 */
   30     46   
                let mut object_4 = array_2.value().start_object();
          47  +
                /* JsonSerializerGenerator.kt:375 */
   31     48   
                crate::protocol_serde::shape_validation_exception_field::ser_validation_exception_field(&mut object_4, item_3)?;
          49  +
                /* JsonSerializerGenerator.kt:515 */
   32     50   
                object_4.finish();
          51  +
                /* SerializerUtil.kt:42 */
   33     52   
            }
          53  +
            /* JsonSerializerGenerator.kt:524 */
   34     54   
        }
          55  +
        /* JsonSerializerGenerator.kt:486 */
   35     56   
        array_2.finish();
          57  +
        /* JsonSerializerGenerator.kt:382 */
   36     58   
    }
          59  +
    /* JsonSerializerGenerator.kt:372 */
   37     60   
    Ok(())
          61  +
    /* JsonSerializerGenerator.kt:358 */
   38     62   
}

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/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/json_rpc10/rust-server-codegen/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 [`JsonRpc10`].
    3      4   
///
    4      5   
/// Constructed via [`JsonRpc10::builder`].
    5      6   
pub struct JsonRpc10Builder<Body, L, HttpPl, ModelPl> {
    6      7   
    content_type_parameters: Option<::aws_smithy_http_server::routing::Route<Body>>,
    7      8   
    empty_input_and_empty_output: Option<::aws_smithy_http_server::routing::Route<Body>>,
    8      9   
    endpoint_operation: Option<::aws_smithy_http_server::routing::Route<Body>>,
    9     10   
    endpoint_with_host_label_operation: Option<::aws_smithy_http_server::routing::Route<Body>>,
   10     11   
    greeting_with_errors: Option<::aws_smithy_http_server::routing::Route<Body>>,
   11     12   
    host_with_path_operation: Option<::aws_smithy_http_server::routing::Route<Body>>,
@@ -2928,2929 +2987,2989 @@
 2948   2949   
            "aws.protocoltests.json10",
 2949   2950   
            "JsonRpc10",
 2950   2951   
        );
 2951   2952   
 2952   2953   
    const VERSION: Option<&'static str> = Some("2020-07-14");
 2953   2954   
 2954   2955   
    type Protocol = ::aws_smithy_http_server::protocol::aws_json_10::AwsJson1_0;
 2955   2956   
 2956   2957   
    type Operations = Operation;
 2957   2958   
}
        2959  +
/* ServiceConfigGenerator.kt:178 */
 2958   2960   
/// Configuration for the [`JsonRpc10`]. This is the central place where to register and
 2959   2961   
/// configure [`::tower::Layer`]s, HTTP plugins, and model plugins.
 2960   2962   
///
 2961   2963   
/// ```rust,no_run
 2962   2964   
/// # use json_rpc10::JsonRpc10Config;
 2963   2965   
/// # use ::aws_smithy_http_server::plugin::IdentityPlugin;
 2964   2966   
/// # use ::tower::layer::util::Identity;
 2965   2967   
/// # let authentication_plugin = IdentityPlugin;
 2966   2968   
/// # let authorization_plugin = IdentityPlugin;
 2967   2969   
/// # let server_request_id_provider_layer = Identity::new();
@@ -3043,3045 +3102,3105 @@
 3063   3065   
 3064   3066   
    /// Build the configuration.
 3065   3067   
    pub fn build(self) -> super::JsonRpc10Config<L, H, M> {
 3066   3068   
        super::JsonRpc10Config {
 3067   3069   
            layers: self.layers,
 3068   3070   
            http_plugins: self.http_plugins,
 3069   3071   
            model_plugins: self.model_plugins,
 3070   3072   
        }
 3071   3073   
    }
 3072   3074   
}
        3075  +
/* ScopeMacroGenerator.kt:81 */
 3073   3076   
/// A macro to help with scoping [plugins](crate::server::plugin) to a subset of all operations.
 3074   3077   
///
 3075   3078   
/// In contrast to [`crate::server::scope`](crate::server::scope), this macro has knowledge
 3076   3079   
/// of the service and any operations _not_ specified will be placed in the opposing group.
 3077   3080   
///
 3078   3081   
/// # Example
 3079   3082   
///
 3080   3083   
/// ```rust
 3081   3084   
/// scope! {
 3082   3085   
///     /// Includes [`ContentTypeParameters`], excluding all other operations.

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/types.rs

@@ -1,1 +0,7 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* SmithyTypesPubUseExtra.kt:66 */
    2      3   
pub use ::aws_smithy_types::date_time::Format as DateTimeFormat;
           4  +
/* ServerRequiredCustomizations.kt:69 */
    3      5   
pub use ::aws_smithy_types::error::display::DisplayErrorContext;
    4      6   
pub use ::aws_smithy_types::Blob;
    5         -
pub use ::aws_smithy_types::DateTime;
           7  +
/* SmithyTypesPubUseExtra.kt:69 */ pub use ::aws_smithy_types::DateTime;

tmp-codegen-diff/codegen-server-test/json_rpc10/rust-server-codegen/src/unconstrained.rs

@@ -1,1 +74,84 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
           3  +
/* UnconstrainedUnionGenerator.kt:121 */
    3      4   
impl crate::constrained::Constrained for crate::model::MyUnion {
    4      5   
    type Unconstrained = crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained;
    5      6   
}
    6      7   
    7      8   
impl From<crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained>
    8      9   
    for crate::constrained::MaybeConstrained<crate::model::MyUnion>
    9     10   
{
   10     11   
    fn from(value: crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained) -> Self {
   11     12   
        Self::Unconstrained(value)
   12     13   
    }
   13     14   
}
   14     15   
pub(crate) mod my_union_unconstrained {
   15     16   
          17  +
    /* UnconstrainedUnionGenerator.kt:82 */
   16     18   
    #[allow(clippy::enum_variant_names)]
   17     19   
    #[derive(Debug, Clone)]
   18     20   
    pub(crate) enum MyUnionUnconstrained {
   19         -
        BlobValue(::aws_smithy_types::Blob),
   20         -
        BooleanValue(bool),
   21         -
        EnumValue(::std::string::String),
   22         -
        IntEnumValue(i32),
          21  +
        /* UnconstrainedUnionGenerator.kt:95 */ BlobValue(::aws_smithy_types::Blob),
          22  +
        /* UnconstrainedUnionGenerator.kt:95 */ BooleanValue(bool),
          23  +
        /* UnconstrainedUnionGenerator.kt:95 */ EnumValue(::std::string::String),
          24  +
        /* UnconstrainedUnionGenerator.kt:95 */ IntEnumValue(i32),
          25  +
        /* UnconstrainedUnionGenerator.kt:95 */
   23     26   
        ListValue(::std::vec::Vec<::std::string::String>),
          27  +
        /* UnconstrainedUnionGenerator.kt:95 */
   24     28   
        MapValue(::std::collections::HashMap<::std::string::String, ::std::string::String>),
   25         -
        NumberValue(i32),
   26         -
        StringValue(::std::string::String),
          29  +
        /* UnconstrainedUnionGenerator.kt:95 */ NumberValue(i32),
          30  +
        /* UnconstrainedUnionGenerator.kt:95 */ StringValue(::std::string::String),
          31  +
        /* UnconstrainedUnionGenerator.kt:95 */
   27     32   
        StructureValue(crate::model::GreetingStruct),
          33  +
        /* UnconstrainedUnionGenerator.kt:95 */
   28     34   
        TimestampValue(::aws_smithy_types::DateTime),
          35  +
        /* UnconstrainedUnionGenerator.kt:82 */
   29     36   
    }
          37  +
    /* UnconstrainedUnionGenerator.kt:103 */
   30     38   
    impl ::std::convert::TryFrom<MyUnionUnconstrained> for crate::model::MyUnion {
   31     39   
        type Error = crate::model::my_union::ConstraintViolation;
   32     40   
   33     41   
        fn try_from(value: MyUnionUnconstrained) -> ::std::result::Result<Self, Self::Error> {
   34     42   
            Ok(
   35     43   
        match value {
   36     44   
            crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::BlobValue(unconstrained) => Self::BlobValue(
   37     45   
                unconstrained
   38     46   
            ),
   39     47   
            crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::BooleanValue(unconstrained) => Self::BooleanValue(
   40     48   
                unconstrained
   41     49   
            ),
   42     50   
            crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::EnumValue(unconstrained) => Self::EnumValue(
   43     51   
                unconstrained
   44     52   
                                        .try_into()
   45     53   
                                        
   46     54   
                                        
   47     55   
                                        .map_err(Self::Error::EnumValue)?
   48     56   
            ),
   49     57   
            crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::IntEnumValue(unconstrained) => Self::IntEnumValue(
   50     58   
                unconstrained
   51     59   
            ),
   52     60   
            crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::ListValue(unconstrained) => Self::ListValue(
   53     61   
                unconstrained
   54     62   
            ),
   55     63   
            crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::MapValue(unconstrained) => Self::MapValue(
   56     64   
                unconstrained
   57     65   
            ),
   58     66   
            crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::NumberValue(unconstrained) => Self::NumberValue(
   59     67   
                unconstrained
   60     68   
            ),
   61     69   
            crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::StringValue(unconstrained) => Self::StringValue(
   62     70   
                unconstrained
   63     71   
            ),
   64     72   
            crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::StructureValue(unconstrained) => Self::StructureValue(
   65     73   
                unconstrained
   66     74   
            ),
   67     75   
            crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::TimestampValue(unconstrained) => Self::TimestampValue(
   68     76   
                unconstrained
   69     77   
            ),
   70     78   
        }
   71     79   
    )
   72     80   
        }
   73     81   
    }
          82  +
          83  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
   74     84   
}

tmp-codegen-diff/codegen-server-test/json_rpc11/rust-server-codegen/src/constrained.rs

@@ -1,1 +70,78 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
    3      3   
pub(crate) mod foo_enum_map_constrained {
    4      4   
           5  +
    /* PubCrateConstrainedMapGenerator.kt:80 */
    5      6   
    #[derive(Debug, Clone)]
    6      7   
    pub(crate) struct FooEnumMapConstrained(
    7      8   
        pub(crate) std::collections::HashMap<::std::string::String, crate::model::FooEnum>,
    8      9   
    );
    9     10   
   10     11   
    impl crate::constrained::Constrained for FooEnumMapConstrained {
   11     12   
        type Unconstrained =
   12     13   
            crate::unconstrained::foo_enum_map_unconstrained::FooEnumMapUnconstrained;
   13     14   
    }
          15  +
    /* PubCrateConstrainedMapGenerator.kt:99 */
   14     16   
    impl
   15     17   
        ::std::convert::From<
   16     18   
            ::std::collections::HashMap<::std::string::String, crate::model::FooEnum>,
   17     19   
        > for FooEnumMapConstrained
   18     20   
    {
   19     21   
        fn from(
   20     22   
            v: ::std::collections::HashMap<::std::string::String, crate::model::FooEnum>,
   21     23   
        ) -> Self {
   22     24   
            Self(v)
   23     25   
        }
   24     26   
    }
   25     27   
   26     28   
    impl ::std::convert::From<FooEnumMapConstrained>
   27     29   
        for ::std::collections::HashMap<::std::string::String, crate::model::FooEnum>
   28     30   
    {
   29     31   
        fn from(v: FooEnumMapConstrained) -> Self {
   30     32   
            v.0
   31     33   
        }
   32     34   
    }
          35  +
          36  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
   33     37   
}
   34     38   
pub(crate) mod foo_enum_list_constrained {
   35     39   
          40  +
    /* PubCrateConstrainedCollectionGenerator.kt:79 */
   36     41   
    #[derive(Debug, Clone)]
   37     42   
    pub(crate) struct FooEnumListConstrained(pub(crate) std::vec::Vec<crate::model::FooEnum>);
   38     43   
   39     44   
    impl crate::constrained::Constrained for FooEnumListConstrained {
   40     45   
        type Unconstrained =
   41     46   
            crate::unconstrained::foo_enum_list_unconstrained::FooEnumListUnconstrained;
   42     47   
    }
          48  +
    /* PubCrateConstrainedCollectionGenerator.kt:108 */
   43     49   
    impl ::std::convert::From<::std::vec::Vec<crate::model::FooEnum>> for FooEnumListConstrained {
   44     50   
        fn from(v: ::std::vec::Vec<crate::model::FooEnum>) -> Self {
   45     51   
            Self(v)
   46     52   
        }
   47     53   
    }
   48     54   
   49     55   
    impl ::std::convert::From<FooEnumListConstrained> for ::std::vec::Vec<crate::model::FooEnum> {
   50     56   
        fn from(v: FooEnumListConstrained) -> Self {
   51     57   
            v.0
   52     58   
        }
   53     59   
    }
          60  +
          61  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
   54     62   
}
   55     63   
   56     64   
/*
   57     65   
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
   58     66   
 * SPDX-License-Identifier: Apache-2.0
   59     67   
 */
   60     68   
   61     69   
pub(crate) trait Constrained {
   62     70   
    type Unconstrained;
   63     71   
}