Server Test

Server Test

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-server-test/unique_items/rust-server-codegen/src/protocol_serde/shape_complex_set.rs

@@ -1,1 +53,76 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:398 */
    2      3   
pub(crate) fn de_complex_set<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::unconstrained::complex_set_unconstrained::ComplexSetUnconstrained>,
    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   
                    _ => {
          37  +
                        /* JsonParserGenerator.kt:419 */
   27     38   
                        let value =
   28         -
                            crate::protocol_serde::shape_complex_set_struct::de_complex_set_struct(
   29         -
                                tokens,
   30         -
                            )?;
          39  +
                            /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_complex_set_struct::de_complex_set_struct(tokens)?
          40  +
                        /* JsonParserGenerator.kt:419 */;
          41  +
                        /* JsonParserGenerator.kt:422 */
   31     42   
                        if let Some(value) = value {
   32     43   
                            items.push(value);
   33         -
                        } else {
          44  +
                        }
          45  +
                        /* JsonParserGenerator.kt:430 */
          46  +
                        else {
   34     47   
                            return Err(
   35     48   
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   36     49   
                                    "dense list cannot contain null values",
   37     50   
                                ),
   38     51   
                            );
   39     52   
                        }
          53  +
                        /* JsonParserGenerator.kt:413 */
          54  +
                    } /* JsonParserGenerator.kt:409 */
   40     55   
                }
          56  +
                /* JsonParserGenerator.kt:408 */
   41     57   
            }
   42         -
            }
          58  +
            /* JsonParserGenerator.kt:444 */
   43     59   
            Ok(Some(
   44     60   
                crate::unconstrained::complex_set_unconstrained::ComplexSetUnconstrained(items),
   45     61   
            ))
          62  +
            /* JsonParserGenerator.kt:713 */
   46     63   
        }
   47         -
        _ => Err(
          64  +
        /* JsonParserGenerator.kt:722 */
          65  +
        _ => {
          66  +
            /* JsonParserGenerator.kt:723 */
          67  +
            Err(
   48     68   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   49     69   
                    "expected start array or null",
   50     70   
                ),
   51         -
        ),
          71  +
            )
          72  +
            /* JsonParserGenerator.kt:722 */
          73  +
        } /* JsonParserGenerator.kt:712 */
   52     74   
    }
          75  +
    /* JsonParserGenerator.kt:398 */
   53     76   
}

tmp-codegen-diff/codegen-server-test/unique_items/rust-server-codegen/src/protocol_serde/shape_complex_set_struct.rs

@@ -1,1 +60,89 @@
    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_complex_set_struct<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::model::ComplexSetStruct>,
    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::complex_set_struct::Builder::default();
          26  +
            /* JsonParserGenerator.kt:684 */
   21     27   
            loop {
          28  +
                /* JsonParserGenerator.kt:685 */
   22     29   
                match tokens.next().transpose()? {
          30  +
                    /* JsonParserGenerator.kt:686 */
   23     31   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   24     32   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          33  +
                        /* JsonParserGenerator.kt:260 */
   25     34   
                        match key.to_unescaped()?.as_ref() {
          35  +
                            /* JsonParserGenerator.kt:262 */
   26     36   
                            "foo" => {
          37  +
                                /* JsonParserGenerator.kt:272 */
   27     38   
                                builder = builder.set_foo(
          39  +
                                    /* JsonParserGenerator.kt:298 */
   28     40   
                                    ::aws_smithy_json::deserialize::token::expect_bool_or_null(
   29     41   
                                        tokens.next(),
   30         -
                                    )?,
          42  +
                                    )?, /* JsonParserGenerator.kt:272 */
   31     43   
                                );
          44  +
                                /* JsonParserGenerator.kt:262 */
   32     45   
                            }
          46  +
                            /* JsonParserGenerator.kt:262 */
   33     47   
                            "blob" => {
          48  +
                                /* JsonParserGenerator.kt:272 */
   34     49   
                                builder = builder.set_blob(
          50  +
                                    /* JsonParserGenerator.kt:326 */
   35     51   
                                    ::aws_smithy_json::deserialize::token::expect_blob_or_null(
   36     52   
                                        tokens.next(),
   37         -
                                    )?,
          53  +
                                    )?, /* JsonParserGenerator.kt:272 */
   38     54   
                                );
          55  +
                                /* JsonParserGenerator.kt:262 */
   39     56   
                            }
   40         -
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          57  +
                            /* JsonParserGenerator.kt:290 */
          58  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   41     59   
                        }
          60  +
                        /* JsonParserGenerator.kt:686 */
   42     61   
                    }
          62  +
                    /* JsonParserGenerator.kt:695 */
   43     63   
                    other => {
   44     64   
                        return Err(
   45     65   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   46     66   
                                format!("expected object key or end object, found: {:?}", other),
   47     67   
                            ),
   48     68   
                        )
          69  +
                    } /* JsonParserGenerator.kt:685 */
   49     70   
                }
          71  +
                /* JsonParserGenerator.kt:684 */
   50     72   
            }
   51         -
            }
          73  +
            /* JsonParserGenerator.kt:540 */
   52     74   
            Ok(Some(builder.build()))
          75  +
            /* JsonParserGenerator.kt:713 */
   53     76   
        }
   54         -
        _ => Err(
          77  +
        /* JsonParserGenerator.kt:722 */
          78  +
        _ => {
          79  +
            /* JsonParserGenerator.kt:723 */
          80  +
            Err(
   55     81   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   56     82   
                    "expected start object or null",
   57     83   
                ),
   58         -
        ),
          84  +
            )
          85  +
            /* JsonParserGenerator.kt:722 */
          86  +
        } /* JsonParserGenerator.kt:712 */
   59     87   
    }
          88  +
    /* JsonParserGenerator.kt:516 */
   60     89   
}

tmp-codegen-diff/codegen-server-test/unique_items/rust-server-codegen/src/protocol_serde/shape_malformed_unique_items.rs

@@ -1,1 +151,216 @@
    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_malformed_unique_items_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedUniqueItemsInput,
    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::malformed_unique_items_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/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_malformed_unique_items::de_malformed_unique_items(
   29     39   
                bytes.as_ref(),
   30     40   
                input,
   31     41   
            )?;
          42  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   32     43   
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   33     45   
        input.build()?
          46  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   34     47   
    })
          48  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   35     49   
}
   36     50   
          51  +
/* RustType.kt:516 */
   37     52   
#[allow(clippy::unnecessary_wraps)]
          53  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   38     54   
pub fn ser_malformed_unique_items_http_response(
   39     55   
    #[allow(unused_variables)] output: crate::output::MalformedUniqueItemsOutput,
   40     56   
) -> std::result::Result<
   41     57   
    ::aws_smithy_http_server::response::Response,
   42     58   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   43     59   
> {
          60  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   44     61   
    Ok({
          62  +
        /* RustType.kt:516 */
   45     63   
        #[allow(unused_mut)]
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   46     65   
        let mut builder = ::http::Response::builder();
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   47     67   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   48     68   
            builder,
   49     69   
            ::http::header::CONTENT_TYPE,
   50     70   
            "application/json",
   51     71   
        );
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   52     73   
        let http_status: u16 = 200;
   53     74   
        builder = builder.status(http_status);
   54         -
        let payload = "";
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          76  +
        let payload =
          77  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   55     80   
        let content_length = payload.len();
   56     81   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     82   
            builder,
   58     83   
            ::http::header::CONTENT_LENGTH,
   59     84   
            content_length,
   60     85   
        );
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   61     87   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   62     89   
        builder.body(body)?
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   63     91   
    })
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   64     93   
}
   65     94   
          95  +
/* RustType.kt:516 */
   66     96   
#[allow(clippy::unnecessary_wraps)]
          97  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   67     98   
pub fn ser_malformed_unique_items_http_error(
   68     99   
    error: &crate::error::MalformedUniqueItemsError,
   69    100   
) -> std::result::Result<
   70    101   
    ::aws_smithy_http_server::response::Response,
   71    102   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   72    103   
> {
         104  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   73    105   
    Ok({
         106  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   74    107   
        match error {
         108  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   75    109   
            crate::error::MalformedUniqueItemsError::ValidationException(output) => {
         110  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   76    111   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         112  +
                /* RustType.kt:516 */
   77    113   
                #[allow(unused_mut)]
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   78    115   
                let mut builder = ::http::Response::builder();
         116  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   79    117   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   80    118   
                    builder,
   81    119   
                    ::http::header::CONTENT_TYPE,
   82    120   
                    "application/json",
   83    121   
                );
         122  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   84    123   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   85    124   
                    builder,
   86    125   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   87    126   
                    "ValidationException",
   88    127   
                );
         128  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   89    129   
                let content_length = payload.len();
   90    130   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   91    131   
                    builder,
   92    132   
                    ::http::header::CONTENT_LENGTH,
   93    133   
                    content_length,
   94    134   
                );
         135  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   95    136   
                builder
   96    137   
                    .status(400)
   97    138   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         139  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         140  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   98    141   
        }
   99         -
        }
         142  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  100    143   
    })
         144  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  101    145   
}
  102    146   
         147  +
/* JsonParserGenerator.kt:148 */
  103    148   
pub(crate) fn de_malformed_unique_items(
  104    149   
    value: &[u8],
  105    150   
    mut builder: crate::input::malformed_unique_items_input::Builder,
  106    151   
) -> ::std::result::Result<
  107    152   
    crate::input::malformed_unique_items_input::Builder,
  108    153   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  109    154   
> {
         155  +
    /* JsonParserGenerator.kt:153 */
  110    156   
    let mut tokens_owned =
  111    157   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  112    158   
            .peekable();
  113    159   
    let tokens = &mut tokens_owned;
  114    160   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         161  +
    /* JsonParserGenerator.kt:684 */
  115    162   
    loop {
         163  +
        /* JsonParserGenerator.kt:685 */
  116    164   
        match tokens.next().transpose()? {
         165  +
            /* JsonParserGenerator.kt:686 */
  117    166   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  118    167   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         168  +
                /* JsonParserGenerator.kt:260 */
  119    169   
                match key.to_unescaped()?.as_ref() {
         170  +
                    /* JsonParserGenerator.kt:262 */
  120    171   
                    "complexSet" => {
         172  +
                        /* JsonParserGenerator.kt:272 */
  121    173   
                        builder = builder.set_complex_set(
  122         -
                            crate::protocol_serde::shape_complex_set::de_complex_set(tokens)?,
  123         -
                        );
         174  +
                            /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_complex_set::de_complex_set(tokens)?
         175  +
                        /* JsonParserGenerator.kt:272 */);
         176  +
                        /* JsonParserGenerator.kt:262 */
  124    177   
                    }
         178  +
                    /* JsonParserGenerator.kt:262 */
  125    179   
                    "set" => {
         180  +
                        /* JsonParserGenerator.kt:272 */
  126    181   
                        builder = builder.set_set(
  127         -
                            crate::protocol_serde::shape_simple_set::de_simple_set(tokens)?,
  128         -
                        );
         182  +
                            /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_simple_set::de_simple_set(tokens)?
         183  +
                        /* JsonParserGenerator.kt:272 */);
         184  +
                        /* JsonParserGenerator.kt:262 */
  129    185   
                    }
  130         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         186  +
                    /* JsonParserGenerator.kt:290 */
         187  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  131    188   
                }
         189  +
                /* JsonParserGenerator.kt:686 */
  132    190   
            }
         191  +
            /* JsonParserGenerator.kt:695 */
  133    192   
            other => {
  134    193   
                return Err(
  135    194   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  136    195   
                        "expected object key or end object, found: {:?}",
  137    196   
                        other
  138    197   
                    )),
  139    198   
                )
         199  +
            } /* JsonParserGenerator.kt:685 */
  140    200   
        }
         201  +
        /* JsonParserGenerator.kt:684 */
  141    202   
    }
  142         -
    }
         203  +
    /* JsonParserGenerator.kt:250 */
  143    204   
    if tokens.next().is_some() {
         205  +
        /* JsonParserGenerator.kt:251 */
  144    206   
        return Err(
  145    207   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  146    208   
                "found more JSON tokens after completing parsing",
  147    209   
            ),
  148    210   
        );
         211  +
        /* JsonParserGenerator.kt:250 */
  149    212   
    }
         213  +
    /* JsonParserGenerator.kt:163 */
  150    214   
    Ok(builder)
         215  +
    /* JsonParserGenerator.kt:148 */
  151    216   
}

tmp-codegen-diff/codegen-server-test/unique_items/rust-server-codegen/src/protocol_serde/shape_simple_set.rs

@@ -1,1 +54,80 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:398 */
    2      3   
pub(crate) fn de_simple_set<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::unconstrained::simple_set_unconstrained::SimpleSetUnconstrained>,
    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   
                        }
          57  +
                        /* JsonParserGenerator.kt:413 */
          58  +
                    } /* JsonParserGenerator.kt:409 */
   41     59   
                }
          60  +
                /* JsonParserGenerator.kt:408 */
   42     61   
            }
   43         -
            }
          62  +
            /* JsonParserGenerator.kt:444 */
   44     63   
            Ok(Some(
   45     64   
                crate::unconstrained::simple_set_unconstrained::SimpleSetUnconstrained(items),
   46     65   
            ))
          66  +
            /* JsonParserGenerator.kt:713 */
   47     67   
        }
   48         -
        _ => Err(
          68  +
        /* JsonParserGenerator.kt:722 */
          69  +
        _ => {
          70  +
            /* JsonParserGenerator.kt:723 */
          71  +
            Err(
   49     72   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   50     73   
                    "expected start array or null",
   51     74   
                ),
   52         -
        ),
          75  +
            )
          76  +
            /* JsonParserGenerator.kt:722 */
          77  +
        } /* JsonParserGenerator.kt:712 */
   53     78   
    }
          79  +
    /* JsonParserGenerator.kt:398 */
   54     80   
}

tmp-codegen-diff/codegen-server-test/unique_items/rust-server-codegen/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/unique_items/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/unique_items/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 [`UniqueItemsService`].
    3      4   
///
    4      5   
/// Constructed via [`UniqueItemsService::builder`].
    5      6   
pub struct UniqueItemsServiceBuilder<Body, L, HttpPl, ModelPl> {
    6      7   
    malformed_unique_items: Option<::aws_smithy_http_server::routing::Route<Body>>,
    7      8   
    layer: L,
    8      9   
    http_plugin: HttpPl,
    9     10   
    model_plugin: ModelPl,
   10     11   
}
   11     12   
@@ -480,481 +539,541 @@
  500    501   
            "com.amazonaws.constraints",
  501    502   
            "UniqueItemsService",
  502    503   
        );
  503    504   
  504    505   
    const VERSION: Option<&'static str> = Some("");
  505    506   
  506    507   
    type Protocol = ::aws_smithy_http_server::protocol::rest_json_1::RestJson1;
  507    508   
  508    509   
    type Operations = Operation;
  509    510   
}
         511  +
/* ServiceConfigGenerator.kt:178 */
  510    512   
/// Configuration for the [`UniqueItemsService`]. This is the central place where to register and
  511    513   
/// configure [`::tower::Layer`]s, HTTP plugins, and model plugins.
  512    514   
///
  513    515   
/// ```rust,no_run
  514    516   
/// # use unique_items::UniqueItemsServiceConfig;
  515    517   
/// # use ::aws_smithy_http_server::plugin::IdentityPlugin;
  516    518   
/// # use ::tower::layer::util::Identity;
  517    519   
/// # let authentication_plugin = IdentityPlugin;
  518    520   
/// # let authorization_plugin = IdentityPlugin;
  519    521   
/// # let server_request_id_provider_layer = Identity::new();
@@ -601,603 +660,663 @@
  621    623   
  622    624   
    /// Build the configuration.
  623    625   
    pub fn build(self) -> super::UniqueItemsServiceConfig<L, H, M> {
  624    626   
        super::UniqueItemsServiceConfig {
  625    627   
            layers: self.layers,
  626    628   
            http_plugins: self.http_plugins,
  627    629   
            model_plugins: self.model_plugins,
  628    630   
        }
  629    631   
    }
  630    632   
}
         633  +
/* ScopeMacroGenerator.kt:81 */
  631    634   
/// A macro to help with scoping [plugins](crate::server::plugin) to a subset of all operations.
  632    635   
///
  633    636   
/// In contrast to [`crate::server::scope`](crate::server::scope), this macro has knowledge
  634    637   
/// of the service and any operations _not_ specified will be placed in the opposing group.
  635    638   
///
  636    639   
/// # Example
  637    640   
///
  638    641   
/// ```rust
  639    642   
/// scope! {
  640    643   
///     /// Includes [`MalformedUniqueItems`], excluding all other operations.

tmp-codegen-diff/codegen-server-test/unique_items/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/unique_items/rust-server-codegen/src/unconstrained.rs

@@ -1,1 +44,64 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
    3      3   
pub(crate) mod complex_set_unconstrained {
    4      4   
           5  +
    /* UnconstrainedCollectionGenerator.kt:77 */
    5      6   
    #[derive(Debug, Clone)]
    6      7   
    pub(crate) struct ComplexSetUnconstrained(
    7      8   
        pub(crate) std::vec::Vec<crate::model::ComplexSetStruct>,
    8      9   
    );
    9     10   
   10     11   
    impl From<ComplexSetUnconstrained>
   11     12   
        for crate::constrained::MaybeConstrained<crate::model::ComplexSet>
   12     13   
    {
   13     14   
        fn from(value: ComplexSetUnconstrained) -> Self {
   14     15   
            Self::Unconstrained(value)
   15     16   
        }
   16     17   
    }
          18  +
    /* UnconstrainedCollectionGenerator.kt:97 */
   17     19   
    impl std::convert::TryFrom<ComplexSetUnconstrained> for crate::model::ComplexSet {
          20  +
        /* UnconstrainedCollectionGenerator.kt:98 */
   18     21   
        type Error = crate::model::complex_set::ConstraintViolation;
          22  +
        /* UnconstrainedCollectionGenerator.kt:100 */
   19     23   
        fn try_from(value: ComplexSetUnconstrained) -> std::result::Result<Self, Self::Error> {
          24  +
            /* UnconstrainedCollectionGenerator.kt:185 */
   20     25   
            let inner = value.0;
          26  +
            /* UnconstrainedCollectionGenerator.kt:189 */
   21     27   
            Self::try_from(inner)
          28  +
            /* UnconstrainedCollectionGenerator.kt:100 */
   22     29   
        }
          30  +
        /* UnconstrainedCollectionGenerator.kt:97 */
   23     31   
    }
          32  +
          33  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
   24     34   
}
   25     35   
pub(crate) mod simple_set_unconstrained {
   26     36   
          37  +
    /* UnconstrainedCollectionGenerator.kt:77 */
   27     38   
    #[derive(Debug, Clone)]
   28     39   
    pub(crate) struct SimpleSetUnconstrained(pub(crate) std::vec::Vec<::std::string::String>);
   29     40   
   30     41   
    impl From<SimpleSetUnconstrained>
   31     42   
        for crate::constrained::MaybeConstrained<crate::model::SimpleSet>
   32     43   
    {
   33     44   
        fn from(value: SimpleSetUnconstrained) -> Self {
   34     45   
            Self::Unconstrained(value)
   35     46   
        }
   36     47   
    }
          48  +
    /* UnconstrainedCollectionGenerator.kt:97 */
   37     49   
    impl std::convert::TryFrom<SimpleSetUnconstrained> for crate::model::SimpleSet {
          50  +
        /* UnconstrainedCollectionGenerator.kt:98 */
   38     51   
        type Error = crate::model::simple_set::ConstraintViolation;
          52  +
        /* UnconstrainedCollectionGenerator.kt:100 */
   39     53   
        fn try_from(value: SimpleSetUnconstrained) -> std::result::Result<Self, Self::Error> {
          54  +
            /* UnconstrainedCollectionGenerator.kt:185 */
   40     55   
            let inner = value.0;
          56  +
            /* UnconstrainedCollectionGenerator.kt:189 */
   41     57   
            Self::try_from(inner)
          58  +
            /* UnconstrainedCollectionGenerator.kt:100 */
   42     59   
        }
          60  +
        /* UnconstrainedCollectionGenerator.kt:97 */
   43     61   
    }
          62  +
          63  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
   44     64   
}