Server Test Python

Server Test Python

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943

Files changed:

tmp-codegen-diff/codegen-server-test-python/simple/rust-server-codegen-python/src/python_module_export.rs

@@ -1,1 +77,93 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* PythonServerModuleGenerator.kt:41 */
    2      3   
#[::pyo3::pymodule]
    3         -
#[::pyo3(name = "simple")]
           4  +
#[pyo3(name = "simple")]
    4      5   
pub fn python_library(py: ::pyo3::Python<'_>, m: &::pyo3::types::PyModule) -> ::pyo3::PyResult<()> {
           6  +
    /* PythonServerModuleGenerator.kt:65 */
    5      7   
    let input = ::pyo3::types::PyModule::new(py, "input")?;
    6      8   
    let output = ::pyo3::types::PyModule::new(py, "output")?;
    7      9   
    let error = ::pyo3::types::PyModule::new(py, "error")?;
          10  +
    /* PythonServerModuleGenerator.kt:96 */
    8     11   
    error.add_class::<crate::error::InternalServerError>()?;
          12  +
    /* PythonServerModuleGenerator.kt:96 */
    9     13   
    output.add_class::<crate::output::OperationOutput>()?;
          14  +
    /* PythonServerModuleGenerator.kt:96 */
   10     15   
    input.add_class::<crate::input::OperationInput>()?;
          16  +
    /* PythonServerModuleGenerator.kt:105 */
   11     17   
    ::pyo3::py_run!(py, input, "import sys; sys.modules['simple.input'] = input");
   12     18   
    m.add_submodule(input)?;
   13     19   
    ::pyo3::py_run!(
   14     20   
        py,
   15     21   
        output,
   16     22   
        "import sys; sys.modules['simple.output'] = output"
   17     23   
    );
   18     24   
    m.add_submodule(output)?;
   19     25   
    ::pyo3::py_run!(py, error, "import sys; sys.modules['simple.error'] = error");
   20     26   
    m.add_submodule(error)?;
          27  +
    /* PythonServerModuleGenerator.kt:129 */
   21     28   
    let types = ::pyo3::types::PyModule::new(py, "types")?;
   22     29   
    types.add_class::<::aws_smithy_http_server_python::types::Blob>()?;
   23     30   
    types.add_class::<::aws_smithy_http_server_python::types::DateTime>()?;
   24     31   
    types.add_class::<::aws_smithy_http_server_python::types::Format>()?;
   25     32   
    types.add_class::<::aws_smithy_http_server_python::types::ByteStream>()?;
   26     33   
    ::pyo3::py_run!(py, types, "import sys; sys.modules['simple.types'] = types");
   27     34   
    m.add_submodule(types)?;
          35  +
    /* PythonServerModuleGenerator.kt:149 */
   28     36   
    let socket = ::pyo3::types::PyModule::new(py, "socket")?;
   29     37   
    socket.add_class::<::aws_smithy_http_server_python::PySocket>()?;
   30     38   
    ::pyo3::py_run!(
   31     39   
        py,
   32     40   
        socket,
   33     41   
        "import sys; sys.modules['simple.socket'] = socket"
   34     42   
    );
   35     43   
    m.add_submodule(socket)?;
          44  +
    /* PythonServerModuleGenerator.kt:166 */
   36     45   
    let logging = ::pyo3::types::PyModule::new(py, "logging")?;
   37     46   
    logging.add_function(::pyo3::wrap_pyfunction!(
   38     47   
        ::aws_smithy_http_server_python::py_tracing_event,
   39     48   
        m
   40     49   
    )?)?;
   41     50   
    logging.add_class::<::aws_smithy_http_server_python::PyTracingHandler>()?;
   42     51   
    ::pyo3::py_run!(
   43     52   
        py,
   44     53   
        logging,
   45     54   
        "import sys; sys.modules['simple.logging'] = logging"
   46     55   
    );
   47     56   
    m.add_submodule(logging)?;
          57  +
    /* PythonServerModuleGenerator.kt:183 */
   48     58   
    let middleware = ::pyo3::types::PyModule::new(py, "middleware")?;
   49     59   
    middleware.add_class::<::aws_smithy_http_server_python::PyRequest>()?;
   50     60   
    middleware.add_class::<::aws_smithy_http_server_python::PyResponse>()?;
   51     61   
    middleware.add_class::<::aws_smithy_http_server_python::PyMiddlewareException>()?;
   52     62   
    pyo3::py_run!(
   53     63   
        py,
   54     64   
        middleware,
   55     65   
        "import sys; sys.modules['simple.middleware'] = middleware"
   56     66   
    );
   57     67   
    m.add_submodule(middleware)?;
          68  +
    /* PythonServerModuleGenerator.kt:201 */
   58     69   
    let tls = ::pyo3::types::PyModule::new(py, "tls")?;
   59     70   
    tls.add_class::<::aws_smithy_http_server_python::tls::PyTlsConfig>()?;
   60     71   
    pyo3::py_run!(py, tls, "import sys; sys.modules['simple.tls'] = tls");
   61     72   
    m.add_submodule(tls)?;
          73  +
    /* PythonServerModuleGenerator.kt:217 */
   62     74   
    let aws_lambda = ::pyo3::types::PyModule::new(py, "aws_lambda")?;
   63     75   
    aws_lambda.add_class::<::aws_smithy_http_server_python::lambda::PyLambdaContext>()?;
   64     76   
    aws_lambda.add_class::<::aws_smithy_http_server_python::lambda::PyClientApplication>()?;
   65     77   
    aws_lambda.add_class::<::aws_smithy_http_server_python::lambda::PyClientContext>()?;
   66     78   
    aws_lambda.add_class::<::aws_smithy_http_server_python::lambda::PyCognitoIdentity>()?;
   67     79   
    aws_lambda.add_class::<::aws_smithy_http_server_python::lambda::PyConfig>()?;
   68     80   
    pyo3::py_run!(
   69     81   
        py,
   70     82   
        aws_lambda,
   71     83   
        "import sys; sys.modules['simple.aws_lambda'] = aws_lambda"
   72     84   
    );
   73     85   
    m.add_submodule(aws_lambda)?;
          86  +
    /* PythonServerModuleGenerator.kt:238 */
   74     87   
    m.add_class::<crate::python_server_application::App>()?;
          88  +
    /* PythonServerModuleGenerator.kt:243 */
   75     89   
    m.add("CODEGEN_VERSION", "ci")?;
          90  +
    /* PythonServerModuleGenerator.kt:58 */
   76     91   
    Ok(())
          92  +
    /* PythonServerModuleGenerator.kt:41 */
   77     93   
}

tmp-codegen-diff/codegen-server-test-python/simple/rust-server-codegen-python/src/python_operation_adaptor.rs

@@ -1,1 +31,32 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* PythonServerOperationHandlerGenerator.kt:61 */
    2      3   
/// Python handler for operation `Operation`.
    3      4   
pub(crate) async fn operation(
    4      5   
    input: crate::input::OperationInput,
    5      6   
    state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
    6      7   
    handler: ::aws_smithy_http_server_python::PyHandler,
    7      8   
) -> std::result::Result<crate::output::OperationOutput, crate::error::OperationError> {
    8      9   
    // Async block used to run the handler and catch any Python error.
    9     10   
    let result = if handler.is_coroutine {
   10     11   
        ::tracing::trace!(name = "operation", "executing python handler coroutine");
   11     12   
        let result = ::pyo3::Python::with_gil(|py| {

tmp-codegen-diff/codegen-server-test-python/simple/rust-server-codegen-python/src/python_server_application.rs

@@ -1,1 +155,174 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* PythonApplicationGenerator.kt:386 */
    2      3   
#[allow(clippy::tabs_in_doc_comments)]
    3      4   
/// Main Python application, used to register operations and context and start multiple
    4      5   
/// workers on the same shared socket.
    5      6   
///
    6      7   
/// Operations can be registered using the application object as a decorator (`@app.operation_name`).
    7      8   
///
    8      9   
/// Here's a full example to get you started:
    9     10   
///
   10     11   
/// ```python
          12  +
/* PythonApplicationGenerator.kt:399 */
   11     13   
/// from simple import input
   12     14   
/// from simple import output
          15  +
/* PythonApplicationGenerator.kt:406 */
   13     16   
/// from simple import error
          17  +
/* PythonApplicationGenerator.kt:408 */
   14     18   
/// from simple import middleware
   15     19   
/// from simple import App
   16     20   
///
   17     21   
/// @dataclass
   18     22   
/// class Context:
   19     23   
///     counter: int = 0
   20     24   
///
   21     25   
/// app = App()
   22     26   
/// app.context(Context())
   23     27   
///
   24     28   
/// @app.request_middleware
   25     29   
/// def request_middleware(request: middleware::Request):
   26     30   
///     if request.get_header("x-amzn-id") != "secret":
   27     31   
///         raise middleware.MiddlewareException("Unsupported `x-amz-id` header", 401)
   28     32   
///
          33  +
/* PythonApplicationGenerator.kt:441 */
   29     34   
/// @app.operation
   30     35   
/// def operation(input: input::OperationInput, ctx: Context) -> output::OperationOutput:
   31     36   
///     raise NotImplementedError
          37  +
/* PythonApplicationGenerator.kt:428 */
   32     38   
///
   33     39   
/// app.run()
   34     40   
/// ```
   35     41   
///
   36     42   
/// Any of operations above can be written as well prepending the `async` keyword and
   37     43   
/// the Python application will automatically handle it and schedule it on the event loop for you.
          44  +
/* PythonApplicationGenerator.kt:112 */
   38     45   
#[::pyo3::pyclass]
   39     46   
#[derive(Debug)]
   40     47   
/// :generic Ctx:
   41     48   
/// :extends typing.Generic\[Ctx\]:
   42     49   
/// :rtype None:
   43     50   
pub struct App {
   44     51   
    handlers: ::std::collections::HashMap<String, ::aws_smithy_http_server_python::PyHandler>,
   45     52   
    middlewares: Vec<::aws_smithy_http_server_python::PyMiddlewareHandler>,
   46     53   
    context: Option<::pyo3::PyObject>,
   47     54   
    workers: ::parking_lot::Mutex<Vec<::pyo3::PyObject>>,
   48     55   
}
          56  +
/* PythonApplicationGenerator.kt:149 */
   49     57   
impl Default for App {
   50     58   
    fn default() -> Self {
   51     59   
        Self {
   52     60   
            handlers: Default::default(),
   53     61   
            middlewares: vec![],
   54     62   
            context: None,
   55     63   
            workers: ::parking_lot::Mutex::new(vec![]),
   56     64   
        }
   57     65   
    }
   58     66   
}
          67  +
/* PythonApplicationGenerator.kt:131 */
   59     68   
impl Clone for App {
   60     69   
    fn clone(&self) -> Self {
   61     70   
        Self {
   62     71   
            handlers: self.handlers.clone(),
   63     72   
            middlewares: self.middlewares.clone(),
   64     73   
            context: self.context.clone(),
   65     74   
            workers: ::parking_lot::Mutex::new(vec![]),
   66     75   
        }
   67     76   
    }
   68     77   
}
          78  +
/* PythonApplicationGenerator.kt:168 */
   69     79   
impl ::aws_smithy_http_server_python::PyApp for App {
          80  +
    /* PythonApplicationGenerator.kt:174 */
   70     81   
    fn workers(&self) -> &::parking_lot::Mutex<Vec<::pyo3::PyObject>> {
   71     82   
        &self.workers
   72     83   
    }
   73     84   
    fn context(&self) -> &Option<::pyo3::PyObject> {
   74     85   
        &self.context
   75     86   
    }
   76     87   
    fn handlers(
   77     88   
        &mut self,
   78     89   
    ) -> &mut ::std::collections::HashMap<String, ::aws_smithy_http_server_python::PyHandler> {
   79     90   
        &mut self.handlers
   80     91   
    }
          92  +
    /* PythonApplicationGenerator.kt:189 */
   81     93   
    fn build_service(
   82     94   
        &mut self,
   83     95   
        event_loop: &::pyo3::PyAny,
   84     96   
    ) -> ::pyo3::PyResult<
   85     97   
        ::tower::util::BoxCloneService<
   86     98   
            ::http::Request<::aws_smithy_http_server::body::Body>,
   87     99   
            ::http::Response<::aws_smithy_http_server::body::BoxBody>,
   88    100   
            std::convert::Infallible,
   89    101   
        >,
   90    102   
    > {
         103  +
        /* PythonApplicationGenerator.kt:201 */
   91    104   
        let builder = crate::service::SimpleService::builder_without_plugins();
         105  +
        /* PythonApplicationGenerator.kt:209 */
   92    106   
        let operation_locals = ::pyo3_asyncio::TaskLocals::new(event_loop);
   93    107   
        let handler = self
   94    108   
            .handlers
   95    109   
            .get("operation")
   96    110   
            .expect("Python handler for operation `operation` not found")
   97    111   
            .clone();
   98    112   
        let builder = builder.operation(move |input, state| {
   99    113   
            ::pyo3_asyncio::tokio::scope(
  100    114   
                operation_locals.clone(),
  101    115   
                crate::python_operation_adaptor::operation(input, state, handler.clone()),
  102    116   
            )
  103    117   
        });
         118  +
        /* PythonApplicationGenerator.kt:220 */
  104    119   
        let mut service = ::tower::util::BoxCloneService::new(builder.build().expect("one or more operations do not have a registered handler; this is a bug in the Python code generator, please file a bug report under https://github.com/smithy-lang/smithy-rs/issues"));
  105    120   
  106    121   
        {
  107    122   
            use ::tower::Layer;
  108    123   
            ::tracing::trace!("adding middlewares to rust python router");
  109    124   
            let mut middlewares = self.middlewares.clone();
  110    125   
            // Reverse the middlewares, so they run with same order as they defined
  111    126   
            middlewares.reverse();
  112    127   
            for handler in middlewares {
  113    128   
                ::tracing::trace!(name = &handler.name, "adding python middleware");
  114    129   
                let locals = ::pyo3_asyncio::TaskLocals::new(event_loop);
  115    130   
                let layer = ::aws_smithy_http_server_python::PyMiddlewareLayer::<
  116    131   
                    ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
  117    132   
                >::new(handler, locals);
  118    133   
                service = ::tower::util::BoxCloneService::new(layer.layer(service));
  119    134   
            }
  120    135   
        }
  121    136   
        Ok(service)
         137  +
        /* PythonApplicationGenerator.kt:189 */
  122    138   
    }
         139  +
    /* PythonApplicationGenerator.kt:168 */
  123    140   
}
         141  +
/* PythonApplicationGenerator.kt:247 */
  124    142   
#[::pyo3::pymethods]
  125    143   
impl App {
         144  +
    /* PythonApplicationGenerator.kt:260 */
  126    145   
    /// Create a new [App].
  127    146   
    #[new]
  128    147   
    pub fn new() -> Self {
  129    148   
        Self::default()
  130    149   
    }
  131    150   
  132    151   
    /// Register a context object that will be shared between handlers.
  133    152   
    ///
  134    153   
    /// :param context Ctx:
  135    154   
    /// :rtype None:
@@ -178,197 +222,243 @@
  198    217   
        py: pyo3::Python,
  199    218   
        socket: &pyo3::PyCell<::aws_smithy_http_server_python::PySocket>,
  200    219   
        worker_number: isize,
  201    220   
        tls: Option<::aws_smithy_http_server_python::tls::PyTlsConfig>,
  202    221   
    ) -> pyo3::PyResult<()> {
  203    222   
        use ::aws_smithy_http_server_python::PyApp;
  204    223   
        let event_loop = self.configure_python_event_loop(py)?;
  205    224   
        let service = self.build_and_configure_service(py, event_loop)?;
  206    225   
        self.start_hyper_worker(py, socket, event_loop, service, worker_number, tls)
  207    226   
    }
         227  +
    /* PythonApplicationGenerator.kt:366 */
  208    228   
    /// Method to register `operation` Python implementation inside the handlers map.
  209    229   
    /// It can be used as a function decorator in Python.
  210    230   
    ///
  211    231   
    /// :param func typing.Union\[typing.Callable\[\[simple.input.OperationInput, Ctx\], typing.Union\[simple.output.OperationOutput, typing.Awaitable\[simple.output.OperationOutput\]\]\], typing.Callable\[\[simple.input.OperationInput\], typing.Union\[simple.output.OperationOutput, typing.Awaitable\[simple.output.OperationOutput\]\]\]\]:
  212    232   
    /// :rtype None:
  213    233   
    #[pyo3(text_signature = "($self, func)")]
  214    234   
    pub fn operation(
  215    235   
        &mut self,
  216    236   
        py: ::pyo3::Python,
  217    237   
        func: ::pyo3::PyObject,
  218    238   
    ) -> ::pyo3::PyResult<()> {
  219    239   
        use ::aws_smithy_http_server_python::PyApp;
  220    240   
        self.register_operation(py, "operation", func)
  221    241   
    }
         242  +
    /* PythonApplicationGenerator.kt:247 */
  222    243   
}

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

@@ -1,1 +31,32 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerServiceGenerator.kt:795 */
    2      3   
/// The service builder for [`SimpleService`].
    3      4   
///
    4      5   
/// Constructed via [`SimpleService::builder`].
    5      6   
pub struct SimpleServiceBuilder<Body, L, HttpPl, ModelPl> {
    6      7   
    operation: 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   
@@ -475,476 +534,536 @@
  495    496   
            "com.amazonaws.simple",
  496    497   
            "SimpleService",
  497    498   
        );
  498    499   
  499    500   
    const VERSION: Option<&'static str> = Some("");
  500    501   
  501    502   
    type Protocol = ::aws_smithy_http_server::protocol::rest_json_1::RestJson1;
  502    503   
  503    504   
    type Operations = Operation;
  504    505   
}
         506  +
/* ServiceConfigGenerator.kt:178 */
  505    507   
/// Configuration for the [`SimpleService`]. This is the central place where to register and
  506    508   
/// configure [`::tower::Layer`]s, HTTP plugins, and model plugins.
  507    509   
///
  508    510   
/// ```rust,no_run
  509    511   
/// # use simple::SimpleServiceConfig;
  510    512   
/// # use ::aws_smithy_http_server::plugin::IdentityPlugin;
  511    513   
/// # use ::tower::layer::util::Identity;
  512    514   
/// # let authentication_plugin = IdentityPlugin;
  513    515   
/// # let authorization_plugin = IdentityPlugin;
  514    516   
/// # let server_request_id_provider_layer = Identity::new();
@@ -590,592 +649,652 @@
  610    612   
  611    613   
    /// Build the configuration.
  612    614   
    pub fn build(self) -> super::SimpleServiceConfig<L, H, M> {
  613    615   
        super::SimpleServiceConfig {
  614    616   
            layers: self.layers,
  615    617   
            http_plugins: self.http_plugins,
  616    618   
            model_plugins: self.model_plugins,
  617    619   
        }
  618    620   
    }
  619    621   
}
         622  +
/* ScopeMacroGenerator.kt:81 */
  620    623   
/// A macro to help with scoping [plugins](crate::server::plugin) to a subset of all operations.
  621    624   
///
  622    625   
/// In contrast to [`crate::server::scope`](crate::server::scope), this macro has knowledge
  623    626   
/// of the service and any operations _not_ specified will be placed in the opposing group.
  624    627   
///
  625    628   
/// # Example
  626    629   
///
  627    630   
/// ```rust
  628    631   
/// scope! {
  629    632   
///     /// Includes [`Operation`], excluding all other operations.

tmp-codegen-diff/codegen-server-test-python/simple/rust-server-codegen-python/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-python/unique_items/rust-server-codegen-python/Cargo.toml

@@ -6,6 +58,58 @@
   26     26   
version = "0.2.9"
   27     27   
[dependencies.hyper]
   28     28   
version = "0.14.26"
   29     29   
[dependencies.mime]
   30     30   
version = "0.3"
   31     31   
[dependencies.parking_lot]
   32     32   
version = "0.12"
   33     33   
[dependencies.pin-project-lite]
   34     34   
version = "0.2"
   35     35   
[dependencies.pyo3]
   36         -
version = "0.18"
          36  +
version = "0.20"
   37     37   
[dependencies.pyo3-asyncio]
   38         -
version = "0.18"
          38  +
version = "0.20"
   39     39   
features = ["attributes", "tokio-runtime"]
   40     40   
[dependencies.tower]
   41     41   
version = "0.4"
   42     42   
[dependencies.tracing]
   43     43   
version = "0.1"
   44     44   
[dev-dependencies.hyper]
   45     45   
version = "0.14.12"
   46     46   
[dev-dependencies.tokio]
   47     47   
version = "1.23.1"
   48     48   
[features]

tmp-codegen-diff/codegen-server-test-python/unique_items/rust-server-codegen-python/python/unique_items/error/__init__.pyi

@@ -1,1 +28,28 @@
    3      3   
    4      4   
class InternalServerError(Exception):
    5      5   
    message: str
    6      6   
    7      7   
    def __init__(self, message: str) -> None:
    8      8   
        ...
    9      9   
   10     10   
   11     11   
class ValidationException(Exception):
   12     12   
    """
   13         -
    A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
          13  +
    /* StructureGenerator.kt:197 */A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
   14     14   
    """
   15     15   
   16     16   
    field_list: typing.Optional[typing.List[unique_items.model.ValidationExceptionField]]
   17     17   
    """
   18         -
    A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
          18  +
    /* StructureGenerator.kt:231 */A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
   19     19   
    """
   20     20   
   21     21   
    message: str
   22     22   
    """
   23         -
    A summary of the validation failure.
          23  +
    /* StructureGenerator.kt:231 */A summary of the validation failure.
   24     24   
    """
   25     25   
   26     26   
    def __init__(self, message: str, field_list: typing.Optional[typing.List[unique_items.model.ValidationExceptionField]] = ...) -> None:
   27     27   
        ...
   28     28   

tmp-codegen-diff/codegen-server-test-python/unique_items/rust-server-codegen-python/python/unique_items/model/__init__.pyi

@@ -1,1 +30,30 @@
    5      5   
    blob: typing.Optional[unique_items.types.Blob]
    6      6   
    7      7   
    foo: typing.Optional[bool]
    8      8   
    9      9   
    def __init__(self, foo: typing.Optional[bool] = ..., blob: typing.Optional[unique_items.types.Blob] = ...) -> None:
   10     10   
        ...
   11     11   
   12     12   
   13     13   
class ValidationExceptionField:
   14     14   
    """
   15         -
    Describes one specific validation failure for an input member.
          15  +
    /* StructureGenerator.kt:197 */Describes one specific validation failure for an input member.
   16     16   
    """
   17     17   
   18     18   
    message: str
   19     19   
    """
   20         -
    A detailed description of the validation failure.
          20  +
    /* StructureGenerator.kt:231 */A detailed description of the validation failure.
   21     21   
    """
   22     22   
   23     23   
    path: str
   24     24   
    """
   25         -
    A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
          25  +
    /* StructureGenerator.kt:231 */A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
   26     26   
    """
   27     27   
   28     28   
    def __init__(self, path: str, message: str) -> None:
   29     29   
        ...
   30     30   

tmp-codegen-diff/codegen-server-test-python/unique_items/rust-server-codegen-python/src/error.rs

@@ -1,1 +318,545 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerOperationErrorGenerator.kt:63 */
    2      3   
/// Error type for the `MalformedUniqueItems` operation.
           4  +
/* ServerOperationErrorGenerator.kt:64 */
    3      5   
/// Each variant represents an error that can occur for the `MalformedUniqueItems` operation.
           6  +
/* RustType.kt:516 */
    4      7   
#[derive(::std::fmt::Debug)]
    5         -
pub enum MalformedUniqueItemsError {
    6         -
    /// A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
           8  +
pub /* ServerOperationErrorGenerator.kt:66 */ enum MalformedUniqueItemsError {
           9  +
    /// /* ServerOperationErrorGenerator.kt:68 */A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
          10  +
    /* ServerOperationErrorGenerator.kt:71 */
    7     11   
    ValidationException(crate::error::ValidationException),
          12  +
    /* ServerOperationErrorGenerator.kt:68 */
    8     13   
    #[allow(missing_docs)] // documentation missing in model
          14  +
    /* ServerOperationErrorGenerator.kt:71 */
    9     15   
    InternalServerError(crate::error::InternalServerError),
          16  +
    /* ServerOperationErrorGenerator.kt:66 */
   10     17   
}
          18  +
/* ServerOperationErrorGenerator.kt:75 */
   11     19   
impl ::std::fmt::Display for MalformedUniqueItemsError {
          20  +
    /* ServerOperationErrorGenerator.kt:76 */
   12     21   
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
          22  +
        /* ServerOperationErrorGenerator.kt:139 */
   13     23   
        match &self {
   14         -
            MalformedUniqueItemsError::ValidationException(_inner) => _inner.fmt(f),
   15         -
            MalformedUniqueItemsError::InternalServerError(_inner) => _inner.fmt(f),
          24  +
            /* ServerOperationErrorGenerator.kt:142 */
          25  +
            MalformedUniqueItemsError::ValidationException(_inner) =>
          26  +
            /* ServerOperationErrorGenerator.kt:78 */
          27  +
            {
          28  +
                _inner.fmt(f)
          29  +
            }
          30  +
            ,
          31  +
            /* ServerOperationErrorGenerator.kt:142 */
          32  +
            MalformedUniqueItemsError::InternalServerError(_inner) =>
          33  +
            /* ServerOperationErrorGenerator.kt:78 */
          34  +
            {
          35  +
                _inner.fmt(f)
          36  +
            }
          37  +
            /* ServerOperationErrorGenerator.kt:139 */
   16     38   
        }
          39  +
        /* ServerOperationErrorGenerator.kt:76 */
   17     40   
    }
          41  +
    /* ServerOperationErrorGenerator.kt:75 */
   18     42   
}
          43  +
/* ServerOperationErrorGenerator.kt:83 */
   19     44   
impl MalformedUniqueItemsError {
          45  +
    /* ServerOperationErrorGenerator.kt:87 */
   20     46   
    /// Returns `true` if the error kind is `MalformedUniqueItemsError::ValidationException`.
          47  +
    /* ServerOperationErrorGenerator.kt:88 */
   21     48   
    pub fn is_validation_exception(&self) -> bool {
          49  +
        /* ServerOperationErrorGenerator.kt:89 */
   22     50   
        matches!(&self, MalformedUniqueItemsError::ValidationException(_))
          51  +
        /* ServerOperationErrorGenerator.kt:88 */
   23     52   
    }
          53  +
    /* ServerOperationErrorGenerator.kt:87 */
   24     54   
    /// Returns `true` if the error kind is `MalformedUniqueItemsError::InternalServerError`.
          55  +
    /* ServerOperationErrorGenerator.kt:88 */
   25     56   
    pub fn is_internal_server_error(&self) -> bool {
          57  +
        /* ServerOperationErrorGenerator.kt:89 */
   26     58   
        matches!(&self, MalformedUniqueItemsError::InternalServerError(_))
          59  +
        /* ServerOperationErrorGenerator.kt:88 */
   27     60   
    }
          61  +
    /* ServerOperationErrorGenerator.kt:92 */
   28     62   
    /// Returns the error name string by matching the correct variant.
          63  +
    /* ServerOperationErrorGenerator.kt:93 */
   29     64   
    pub fn name(&self) -> &'static str {
          65  +
        /* ServerOperationErrorGenerator.kt:139 */
   30     66   
        match &self {
   31         -
            MalformedUniqueItemsError::ValidationException(_inner) => _inner.name(),
   32         -
            MalformedUniqueItemsError::InternalServerError(_inner) => _inner.name(),
          67  +
            /* ServerOperationErrorGenerator.kt:142 */
          68  +
            MalformedUniqueItemsError::ValidationException(_inner) =>
          69  +
            /* ServerOperationErrorGenerator.kt:95 */
          70  +
            {
          71  +
                _inner.name()
          72  +
            }
          73  +
            ,
          74  +
            /* ServerOperationErrorGenerator.kt:142 */
          75  +
            MalformedUniqueItemsError::InternalServerError(_inner) =>
          76  +
            /* ServerOperationErrorGenerator.kt:95 */
          77  +
            {
          78  +
                _inner.name()
          79  +
            }
          80  +
            /* ServerOperationErrorGenerator.kt:139 */
   33     81   
        }
          82  +
        /* ServerOperationErrorGenerator.kt:93 */
   34     83   
    }
          84  +
    /* ServerOperationErrorGenerator.kt:83 */
   35     85   
}
          86  +
/* ServerOperationErrorGenerator.kt:100 */
   36     87   
impl ::std::error::Error for MalformedUniqueItemsError {
          88  +
    /* ServerOperationErrorGenerator.kt:101 */
   37     89   
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
          90  +
        /* ServerOperationErrorGenerator.kt:139 */
   38     91   
        match &self {
   39         -
            MalformedUniqueItemsError::ValidationException(_inner) => Some(_inner),
   40         -
            MalformedUniqueItemsError::InternalServerError(_inner) => Some(_inner),
          92  +
            /* ServerOperationErrorGenerator.kt:142 */
          93  +
            MalformedUniqueItemsError::ValidationException(_inner) =>
          94  +
            /* ServerOperationErrorGenerator.kt:103 */
          95  +
            {
          96  +
                Some(_inner)
          97  +
            }
          98  +
            ,
          99  +
            /* ServerOperationErrorGenerator.kt:142 */
         100  +
            MalformedUniqueItemsError::InternalServerError(_inner) =>
         101  +
            /* ServerOperationErrorGenerator.kt:103 */
         102  +
            {
         103  +
                Some(_inner)
         104  +
            }
         105  +
            /* ServerOperationErrorGenerator.kt:139 */
   41    106   
        }
         107  +
        /* ServerOperationErrorGenerator.kt:101 */
   42    108   
    }
         109  +
    /* ServerOperationErrorGenerator.kt:100 */
   43    110   
}
         111  +
/* ServerOperationErrorGenerator.kt:110 */
   44    112   
impl ::std::convert::From<crate::error::ValidationException>
   45    113   
    for crate::error::MalformedUniqueItemsError
   46    114   
{
         115  +
    /* ServerOperationErrorGenerator.kt:111 */
   47    116   
    fn from(variant: crate::error::ValidationException) -> crate::error::MalformedUniqueItemsError {
         117  +
        /* ServerOperationErrorGenerator.kt:112 */
   48    118   
        Self::ValidationException(variant)
         119  +
        /* ServerOperationErrorGenerator.kt:111 */
   49    120   
    }
         121  +
    /* ServerOperationErrorGenerator.kt:110 */
   50    122   
}
         123  +
/* ServerOperationErrorGenerator.kt:110 */
   51    124   
impl ::std::convert::From<crate::error::InternalServerError>
   52    125   
    for crate::error::MalformedUniqueItemsError
   53    126   
{
         127  +
    /* ServerOperationErrorGenerator.kt:111 */
   54    128   
    fn from(variant: crate::error::InternalServerError) -> crate::error::MalformedUniqueItemsError {
         129  +
        /* ServerOperationErrorGenerator.kt:112 */
   55    130   
        Self::InternalServerError(variant)
         131  +
        /* ServerOperationErrorGenerator.kt:111 */
   56    132   
    }
         133  +
    /* ServerOperationErrorGenerator.kt:110 */
   57    134   
}
   58    135   
         136  +
/* PythonServerOperationErrorGenerator.kt:38 */
   59    137   
impl ::std::convert::From<::pyo3::PyErr> for crate::error::MalformedUniqueItemsError {
   60    138   
    fn from(variant: ::pyo3::PyErr) -> crate::error::MalformedUniqueItemsError {
   61    139   
        ::pyo3::Python::with_gil(|py| {
   62    140   
            let error = variant.value(py);
   63    141   
            if let Ok(error) = error.extract::<crate::error::ValidationException>() {
   64    142   
                return error.into();
   65    143   
            }
   66    144   
            crate::error::InternalServerError {
   67    145   
                message: error.to_string(),
   68    146   
            }
   69    147   
            .into()
   70    148   
        })
   71    149   
    }
   72    150   
}
   73    151   
         152  +
/* RustType.kt:516 */
   74    153   
#[::pyo3::pyclass(extends = ::pyo3::exceptions::PyException)]
         154  +
/* PythonServerStructureGenerator.kt:63 */
   75    155   
/// :param message str:
   76    156   
/// :rtype None:
         157  +
/* StructureGenerator.kt:197 */
   77    158   
#[allow(missing_docs)] // documentation missing in model
         159  +
/* RustType.kt:516 */
   78    160   
#[derive(
   79    161   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
   80    162   
)]
   81         -
pub struct InternalServerError {
         163  +
pub /* StructureGenerator.kt:201 */ struct InternalServerError {
         164  +
    /* RustType.kt:516 */
   82    165   
    #[pyo3(get, set)]
         166  +
    /* PythonServerStructureGenerator.kt:80 */
   83    167   
    /// :type str:
         168  +
    /* StructureGenerator.kt:231 */
   84    169   
    #[allow(missing_docs)] // documentation missing in model
   85    170   
    pub message: ::std::string::String,
         171  +
    /* StructureGenerator.kt:201 */
   86    172   
}
         173  +
/* RustType.kt:516 */
   87    174   
#[allow(clippy::new_without_default)]
         175  +
/* RustType.kt:516 */
   88    176   
#[allow(clippy::too_many_arguments)]
         177  +
/* RustType.kt:516 */
   89    178   
#[::pyo3::pymethods]
         179  +
/* PythonServerStructureGenerator.kt:88 */
   90    180   
impl InternalServerError {
   91    181   
    #[new]
   92    182   
    pub fn new(message: ::std::string::String) -> Self {
   93    183   
        Self { message }
   94    184   
    }
   95    185   
    fn __repr__(&self) -> String {
   96    186   
        format!("{self:?}")
   97    187   
    }
   98    188   
    fn __str__(&self) -> String {
   99    189   
        format!("{self:?}")
  100    190   
    }
  101    191   
}
         192  +
/* ErrorImplGenerator.kt:99 */
  102    193   
impl InternalServerError {
         194  +
    /* ErrorImplGenerator.kt:128 */
  103    195   
    /// Returns the error message.
  104    196   
    pub fn message(&self) -> &str {
  105    197   
        &self.message
  106    198   
    }
         199  +
    /* ErrorImplGenerator.kt:141 */
  107    200   
    #[doc(hidden)]
  108    201   
    /// Returns the error name.
  109    202   
    pub fn name(&self) -> &'static str {
  110    203   
        "InternalServerError"
  111    204   
    }
         205  +
    /* ErrorImplGenerator.kt:99 */
  112    206   
}
         207  +
/* ErrorImplGenerator.kt:153 */
  113    208   
impl ::std::fmt::Display for InternalServerError {
         209  +
    /* ErrorImplGenerator.kt:154 */
  114    210   
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         211  +
        /* ErrorImplGenerator.kt:161 */
  115    212   
        ::std::write!(f, "InternalServerError")?;
         213  +
        /* ErrorImplGenerator.kt:166 */
  116    214   
        {
         215  +
            /* ErrorImplGenerator.kt:167 */
  117    216   
            ::std::write!(f, ": {}", &self.message)?;
         217  +
            /* ErrorImplGenerator.kt:166 */
  118    218   
        }
         219  +
        /* ErrorImplGenerator.kt:171 */
  119    220   
        Ok(())
         221  +
        /* ErrorImplGenerator.kt:154 */
  120    222   
    }
         223  +
    /* ErrorImplGenerator.kt:153 */
  121    224   
}
         225  +
/* ErrorImplGenerator.kt:175 */
  122    226   
impl ::std::error::Error for InternalServerError {}
         227  +
/* ServerCodegenVisitor.kt:370 */
  123    228   
impl InternalServerError {
  124         -
    /// Creates a new builder-style object to manufacture [`InternalServerError`](crate::error::InternalServerError).
         229  +
    /// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:211 */Creates a new builder-style object to manufacture [`InternalServerError`](crate::error::InternalServerError).
         230  +
    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:212 */
  125    231   
    pub fn builder() -> crate::error::internal_server_error::Builder {
         232  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:213 */
  126    233   
        crate::error::internal_server_error::Builder::default()
         234  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:212 */
  127    235   
    }
         236  +
    /* ServerCodegenVisitor.kt:370 */
  128    237   
}
  129    238   
         239  +
/* RustType.kt:516 */
  130    240   
#[::pyo3::pyclass(extends = ::pyo3::exceptions::PyException)]
         241  +
/* PythonServerStructureGenerator.kt:63 */
  131    242   
/// :param message str:
  132    243   
/// :param field_list typing.Optional\[typing.List\[unique_items.model.ValidationExceptionField\]\]:
  133    244   
/// :rtype None:
  134         -
/// A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
         245  +
/// /* StructureGenerator.kt:197 */A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
         246  +
/* RustType.kt:516 */
  135    247   
#[derive(
  136    248   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  137    249   
)]
  138         -
pub struct ValidationException {
         250  +
pub /* StructureGenerator.kt:201 */ struct ValidationException {
         251  +
    /* RustType.kt:516 */
  139    252   
    #[pyo3(get, set)]
         253  +
    /* PythonServerStructureGenerator.kt:80 */
  140    254   
    /// :type str:
  141         -
    /// A summary of the validation failure.
         255  +
    /// /* StructureGenerator.kt:231 */A summary of the validation failure.
  142    256   
    pub message: ::std::string::String,
         257  +
    /* RustType.kt:516 */
  143    258   
    #[pyo3(get, set)]
         259  +
    /* PythonServerStructureGenerator.kt:80 */
  144    260   
    /// :type typing.Optional\[typing.List\[unique_items.model.ValidationExceptionField\]\]:
  145         -
    /// A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
         261  +
    /// /* StructureGenerator.kt:231 */A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
  146    262   
    pub field_list: ::std::option::Option<::std::vec::Vec<crate::model::ValidationExceptionField>>,
         263  +
    /* StructureGenerator.kt:201 */
  147    264   
}
         265  +
/* StructureGenerator.kt:135 */
  148    266   
impl ValidationException {
  149         -
    /// A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
         267  +
    /// /* StructureGenerator.kt:231 */A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
         268  +
    /* StructureGenerator.kt:166 */
  150    269   
    pub fn field_list(&self) -> ::std::option::Option<&[crate::model::ValidationExceptionField]> {
         270  +
        /* StructureGenerator.kt:169 */
  151    271   
        self.field_list.as_deref()
         272  +
        /* StructureGenerator.kt:166 */
  152    273   
    }
         274  +
    /* StructureGenerator.kt:135 */
  153    275   
}
         276  +
/* RustType.kt:516 */
  154    277   
#[allow(clippy::new_without_default)]
         278  +
/* RustType.kt:516 */
  155    279   
#[allow(clippy::too_many_arguments)]
         280  +
/* RustType.kt:516 */
  156    281   
#[::pyo3::pymethods]
         282  +
/* PythonServerStructureGenerator.kt:88 */
  157    283   
impl ValidationException {
  158    284   
    #[new]
  159    285   
    pub fn new(
  160    286   
        message: ::std::string::String,
  161    287   
        field_list: ::std::option::Option<::std::vec::Vec<crate::model::ValidationExceptionField>>,
  162    288   
    ) -> Self {
  163    289   
        Self {
  164    290   
            message,
  165    291   
            field_list,
  166    292   
        }
  167    293   
    }
  168    294   
    fn __repr__(&self) -> String {
  169    295   
        format!("{self:?}")
  170    296   
    }
  171    297   
    fn __str__(&self) -> String {
  172    298   
        format!("{self:?}")
  173    299   
    }
  174    300   
}
         301  +
/* ErrorImplGenerator.kt:99 */
  175    302   
impl ValidationException {
         303  +
    /* ErrorImplGenerator.kt:128 */
  176    304   
    /// Returns the error message.
  177    305   
    pub fn message(&self) -> &str {
  178    306   
        &self.message
  179    307   
    }
         308  +
    /* ErrorImplGenerator.kt:141 */
  180    309   
    #[doc(hidden)]
  181    310   
    /// Returns the error name.
  182    311   
    pub fn name(&self) -> &'static str {
  183    312   
        "ValidationException"
  184    313   
    }
         314  +
    /* ErrorImplGenerator.kt:99 */
  185    315   
}
         316  +
/* ErrorImplGenerator.kt:153 */
  186    317   
impl ::std::fmt::Display for ValidationException {
         318  +
    /* ErrorImplGenerator.kt:154 */
  187    319   
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         320  +
        /* ErrorImplGenerator.kt:161 */
  188    321   
        ::std::write!(f, "ValidationException")?;
         322  +
        /* ErrorImplGenerator.kt:166 */
  189    323   
        {
         324  +
            /* ErrorImplGenerator.kt:167 */
  190    325   
            ::std::write!(f, ": {}", &self.message)?;
         326  +
            /* ErrorImplGenerator.kt:166 */
  191    327   
        }
         328  +
        /* ErrorImplGenerator.kt:171 */
  192    329   
        Ok(())
         330  +
        /* ErrorImplGenerator.kt:154 */
  193    331   
    }
         332  +
    /* ErrorImplGenerator.kt:153 */
  194    333   
}
         334  +
/* ErrorImplGenerator.kt:175 */
  195    335   
impl ::std::error::Error for ValidationException {}
         336  +
/* ServerCodegenVisitor.kt:370 */
  196    337   
impl ValidationException {
  197         -
    /// Creates a new builder-style object to manufacture [`ValidationException`](crate::error::ValidationException).
         338  +
    /// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:211 */Creates a new builder-style object to manufacture [`ValidationException`](crate::error::ValidationException).
         339  +
    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:212 */
  198    340   
    pub fn builder() -> crate::error::validation_exception::Builder {
         341  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:213 */
  199    342   
        crate::error::validation_exception::Builder::default()
         343  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:212 */
  200    344   
    }
         345  +
    /* ServerCodegenVisitor.kt:370 */
  201    346   
}
  202         -
/// See [`InternalServerError`](crate::error::InternalServerError).
         347  +
/// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:110 */See [`InternalServerError`](crate::error::InternalServerError).
  203    348   
pub mod internal_server_error {
  204    349   
         350  +
    /* RustType.kt:516 */
  205    351   
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
  206         -
    /// Holds one variant for each of the ways the builder can fail.
  207         -
         352  +
    /// /* ServerBuilderConstraintViolations.kt:72 */Holds one variant for each of the ways the builder can fail.
         353  +
    /* ServerBuilderConstraintViolations.kt:75 */
  208    354   
    #[allow(clippy::enum_variant_names)]
  209    355   
    pub enum ConstraintViolation {
  210         -
        /// `message` was not provided but it is required when building `InternalServerError`.
         356  +
        /// /* ServerBuilderConstraintViolations.kt:138 */`message` was not provided but it is required when building `InternalServerError`.
         357  +
        /* ServerBuilderConstraintViolations.kt:143 */
  211    358   
        MissingMessage,
         359  +
        /* ServerBuilderConstraintViolations.kt:75 */
  212    360   
    }
         361  +
    /* ServerBuilderConstraintViolations.kt:117 */
  213    362   
    impl ::std::fmt::Display for ConstraintViolation {
         363  +
        /* ServerBuilderConstraintViolations.kt:118 */
  214    364   
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         365  +
            /* ServerBuilderConstraintViolations.kt:119 */
  215    366   
            match self {
  216         -
                ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `InternalServerError`"),
  217         -
            }
         367  +
                /* ServerBuilderConstraintViolations.kt:127 */ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `InternalServerError`"),
         368  +
            /* ServerBuilderConstraintViolations.kt:119 */}
         369  +
            /* ServerBuilderConstraintViolations.kt:118 */
  218    370   
        }
         371  +
        /* ServerBuilderConstraintViolations.kt:117 */
  219    372   
    }
         373  +
    /* ServerBuilderConstraintViolations.kt:84 */
  220    374   
    impl ::std::error::Error for ConstraintViolation {}
         375  +
    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:254 */
  221    376   
    impl ::std::convert::TryFrom<Builder> for crate::error::InternalServerError {
  222    377   
        type Error = ConstraintViolation;
  223    378   
  224    379   
        fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
  225    380   
            builder.build()
  226    381   
        }
  227    382   
    }
  228         -
    /// A builder for [`InternalServerError`](crate::error::InternalServerError).
         383  +
    /// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:130 */A builder for [`InternalServerError`](crate::error::InternalServerError).
         384  +
    /* RustType.kt:516 */
  229    385   
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
         386  +
    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:137 */
  230    387   
    pub struct Builder {
         388  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:225 */
  231    389   
        pub(crate) message: ::std::option::Option<::std::string::String>,
         390  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:137 */
  232    391   
    }
         392  +
    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:141 */
  233    393   
    impl Builder {
         394  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:241 */
  234    395   
        #[allow(missing_docs)] // documentation missing in model
         396  +
                               /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:244 */
  235    397   
        pub fn message(mut self, input: ::std::string::String) -> Self {
  236         -
            self.message = Some(input);
         398  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:245 */
         399  +
            self.message =
         400  +
                /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:246 */Some(
         401  +
                    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:247 */input
         402  +
                /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:246 */)
         403  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:245 */;
  237    404   
            self
         405  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:244 */
  238    406   
        }
  239         -
        /// Consumes the builder and constructs a [`InternalServerError`](crate::error::InternalServerError).
  240         -
        ///
         407  +
        /// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:150 */Consumes the builder and constructs a [`InternalServerError`](crate::error::InternalServerError).
         408  +
        /// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:152 */
  241    409   
        /// The builder fails to construct a [`InternalServerError`](crate::error::InternalServerError) if you do not provide a value for all non-`Option`al members.
  242    410   
        ///
         411  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:159 */
  243    412   
        pub fn build(self) -> Result<crate::error::InternalServerError, ConstraintViolation> {
  244    413   
            self.build_enforcing_required_and_enum_traits()
  245    414   
        }
         415  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:171 */
  246    416   
        fn build_enforcing_required_and_enum_traits(
  247    417   
            self,
  248    418   
        ) -> Result<crate::error::InternalServerError, ConstraintViolation> {
  249         -
            Ok(crate::error::InternalServerError {
  250         -
                message: self.message.ok_or(ConstraintViolation::MissingMessage)?,
  251         -
            })
         419  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:175 */
         420  +
            Ok(
         421  +
                /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:182 */
         422  +
                crate::error::InternalServerError {
         423  +
                    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:186 */
         424  +
                    message: self
         425  +
                        .message
         426  +
                        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:202 */
         427  +
                        .ok_or(ConstraintViolation::MissingMessage)?,
         428  +
                    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:182 */
         429  +
                }, /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:175 */
         430  +
            )
         431  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:171 */
  252    432   
        }
         433  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:141 */
  253    434   
    }
         435  +
         436  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
  254    437   
}
  255         -
/// See [`ValidationException`](crate::error::ValidationException).
         438  +
/// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:110 */See [`ValidationException`](crate::error::ValidationException).
  256    439   
pub mod validation_exception {
  257    440   
         441  +
    /* RustType.kt:516 */
  258    442   
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
  259         -
    /// Holds one variant for each of the ways the builder can fail.
  260         -
         443  +
    /// /* ServerBuilderConstraintViolations.kt:72 */Holds one variant for each of the ways the builder can fail.
         444  +
    /* ServerBuilderConstraintViolations.kt:75 */
  261    445   
    #[allow(clippy::enum_variant_names)]
  262    446   
    pub enum ConstraintViolation {
  263         -
        /// `message` was not provided but it is required when building `ValidationException`.
         447  +
        /// /* ServerBuilderConstraintViolations.kt:138 */`message` was not provided but it is required when building `ValidationException`.
         448  +
        /* ServerBuilderConstraintViolations.kt:143 */
  264    449   
        MissingMessage,
         450  +
        /* ServerBuilderConstraintViolations.kt:75 */
  265    451   
    }
         452  +
    /* ServerBuilderConstraintViolations.kt:117 */
  266    453   
    impl ::std::fmt::Display for ConstraintViolation {
         454  +
        /* ServerBuilderConstraintViolations.kt:118 */
  267    455   
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         456  +
            /* ServerBuilderConstraintViolations.kt:119 */
  268    457   
            match self {
  269         -
                ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ValidationException`"),
  270         -
            }
         458  +
                /* ServerBuilderConstraintViolations.kt:127 */ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ValidationException`"),
         459  +
            /* ServerBuilderConstraintViolations.kt:119 */}
         460  +
            /* ServerBuilderConstraintViolations.kt:118 */
  271    461   
        }
         462  +
        /* ServerBuilderConstraintViolations.kt:117 */
  272    463   
    }
         464  +
    /* ServerBuilderConstraintViolations.kt:84 */
  273    465   
    impl ::std::error::Error for ConstraintViolation {}
         466  +
    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:254 */
  274    467   
    impl ::std::convert::TryFrom<Builder> for crate::error::ValidationException {
  275    468   
        type Error = ConstraintViolation;
  276    469   
  277    470   
        fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
  278    471   
            builder.build()
  279    472   
        }
  280    473   
    }
  281         -
    /// A builder for [`ValidationException`](crate::error::ValidationException).
         474  +
    /// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:130 */A builder for [`ValidationException`](crate::error::ValidationException).
         475  +
    /* RustType.kt:516 */
  282    476   
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
         477  +
    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:137 */
  283    478   
    pub struct Builder {
         479  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:225 */
  284    480   
        pub(crate) message: ::std::option::Option<::std::string::String>,
         481  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:225 */
  285    482   
        pub(crate) field_list:
  286    483   
            ::std::option::Option<::std::vec::Vec<crate::model::ValidationExceptionField>>,
         484  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:137 */
  287    485   
    }
         486  +
    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:141 */
  288    487   
    impl Builder {
  289         -
        /// A summary of the validation failure.
         488  +
        /// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:241 */A summary of the validation failure.
         489  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:244 */
  290    490   
        pub fn message(mut self, input: ::std::string::String) -> Self {
  291         -
            self.message = Some(input);
         491  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:245 */
         492  +
            self.message =
         493  +
                /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:246 */Some(
         494  +
                    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:247 */input
         495  +
                /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:246 */)
         496  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:245 */;
  292    497   
            self
         498  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:244 */
  293    499   
        }
  294         -
        /// A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
         500  +
        /// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:241 */A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
         501  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:244 */
  295    502   
        pub fn field_list(
  296    503   
            mut self,
  297    504   
            input: ::std::option::Option<::std::vec::Vec<crate::model::ValidationExceptionField>>,
  298    505   
        ) -> Self {
  299         -
            self.field_list = input;
         506  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:245 */
         507  +
            self.field_list =
         508  +
                /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:247 */input
         509  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:245 */;
  300    510   
            self
         511  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:244 */
  301    512   
        }
  302         -
        /// Consumes the builder and constructs a [`ValidationException`](crate::error::ValidationException).
  303         -
        ///
         513  +
        /// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:150 */Consumes the builder and constructs a [`ValidationException`](crate::error::ValidationException).
         514  +
        /// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:152 */
  304    515   
        /// The builder fails to construct a [`ValidationException`](crate::error::ValidationException) if you do not provide a value for all non-`Option`al members.
  305    516   
        ///
         517  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:159 */
  306    518   
        pub fn build(self) -> Result<crate::error::ValidationException, ConstraintViolation> {
  307    519   
            self.build_enforcing_required_and_enum_traits()
  308    520   
        }
         521  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:171 */
  309    522   
        fn build_enforcing_required_and_enum_traits(
  310    523   
            self,
  311    524   
        ) -> Result<crate::error::ValidationException, ConstraintViolation> {
  312         -
            Ok(crate::error::ValidationException {
  313         -
                message: self.message.ok_or(ConstraintViolation::MissingMessage)?,
  314         -
                field_list: self.field_list,
  315         -
            })
         525  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:175 */
         526  +
            Ok(
         527  +
                /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:182 */
         528  +
                crate::error::ValidationException {
         529  +
                    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:186 */
         530  +
                    message: self
         531  +
                        .message
         532  +
                        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:202 */
         533  +
                        .ok_or(ConstraintViolation::MissingMessage)?,
         534  +
                    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:186 */
         535  +
                    field_list: self.field_list,
         536  +
                    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:182 */
         537  +
                }, /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:175 */
         538  +
            )
         539  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:171 */
  316    540   
        }
         541  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:141 */
  317    542   
    }
         543  +
         544  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
  318    545   
}

tmp-codegen-diff/codegen-server-test-python/unique_items/rust-server-codegen-python/src/input.rs

@@ -1,1 +250,362 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[::pyo3::pyclass]
           4  +
/* PythonServerStructureGenerator.kt:63 */
    3      5   
/// :param set typing.Optional\[typing.List\[str\]\]:
    4      6   
/// :param complex_set typing.Optional\[typing.List\[unique_items.model.ComplexSetStruct\]\]:
    5      7   
/// :rtype None:
           8  +
/* StructureGenerator.kt:197 */
    6      9   
#[allow(missing_docs)] // documentation missing in model
          10  +
/* RustType.kt:516 */
    7     11   
#[derive(
    8     12   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
    9     13   
)]
   10         -
pub struct MalformedUniqueItemsInput {
          14  +
pub /* StructureGenerator.kt:201 */ struct MalformedUniqueItemsInput {
          15  +
    /* RustType.kt:516 */
   11     16   
    #[pyo3(get, set)]
          17  +
    /* PythonServerStructureGenerator.kt:80 */
   12     18   
    /// :type typing.Optional\[typing.List\[str\]\]:
          19  +
    /* StructureGenerator.kt:231 */
   13     20   
    #[allow(missing_docs)] // documentation missing in model
   14     21   
    pub set: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
          22  +
    /* RustType.kt:516 */
   15     23   
    #[pyo3(get, set)]
          24  +
    /* PythonServerStructureGenerator.kt:80 */
   16     25   
    /// :type typing.Optional\[typing.List\[unique_items.model.ComplexSetStruct\]\]:
          26  +
    /* StructureGenerator.kt:231 */
   17     27   
    #[allow(missing_docs)] // documentation missing in model
   18     28   
    pub complex_set: ::std::option::Option<::std::vec::Vec<crate::model::ComplexSetStruct>>,
          29  +
    /* StructureGenerator.kt:201 */
   19     30   
}
          31  +
/* StructureGenerator.kt:135 */
   20     32   
impl MalformedUniqueItemsInput {
          33  +
    /* StructureGenerator.kt:231 */
   21     34   
    #[allow(missing_docs)] // documentation missing in model
          35  +
                           /* StructureGenerator.kt:166 */
   22     36   
    pub fn set(&self) -> ::std::option::Option<&[::std::string::String]> {
          37  +
        /* StructureGenerator.kt:169 */
   23     38   
        self.set.as_deref()
          39  +
        /* StructureGenerator.kt:166 */
   24     40   
    }
          41  +
    /* StructureGenerator.kt:231 */
   25     42   
    #[allow(missing_docs)] // documentation missing in model
          43  +
                           /* StructureGenerator.kt:166 */
   26     44   
    pub fn complex_set(&self) -> ::std::option::Option<&[crate::model::ComplexSetStruct]> {
          45  +
        /* StructureGenerator.kt:169 */
   27     46   
        self.complex_set.as_deref()
          47  +
        /* StructureGenerator.kt:166 */
   28     48   
    }
          49  +
    /* StructureGenerator.kt:135 */
   29     50   
}
          51  +
/* RustType.kt:516 */
   30     52   
#[allow(clippy::new_without_default)]
          53  +
/* RustType.kt:516 */
   31     54   
#[allow(clippy::too_many_arguments)]
          55  +
/* RustType.kt:516 */
   32     56   
#[::pyo3::pymethods]
          57  +
/* PythonServerStructureGenerator.kt:88 */
   33     58   
impl MalformedUniqueItemsInput {
   34     59   
    #[new]
   35     60   
    pub fn new(
   36     61   
        set: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
   37     62   
        complex_set: ::std::option::Option<::std::vec::Vec<crate::model::ComplexSetStruct>>,
   38     63   
    ) -> Self {
   39     64   
        Self { set, complex_set }
   40     65   
    }
   41     66   
    fn __repr__(&self) -> String {
   42     67   
        format!("{self:?}")
   43     68   
    }
   44     69   
    fn __str__(&self) -> String {
   45     70   
        format!("{self:?}")
   46     71   
    }
   47     72   
}
          73  +
/* PythonServerStructureGenerator.kt:111 */
   48     74   
impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<MalformedUniqueItemsInput> {
   49     75   
    fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
   50     76   
        ob.extract::<MalformedUniqueItemsInput>().map(Box::new)
   51     77   
    }
   52     78   
}
   53     79   
   54     80   
impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<MalformedUniqueItemsInput> {
   55     81   
    fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
   56     82   
        (*self).into_py(py)
   57     83   
    }
   58     84   
}
          85  +
/* ServerStructureConstrainedTraitImpl.kt:21 */
   59     86   
impl crate::constrained::Constrained for crate::input::MalformedUniqueItemsInput {
   60     87   
    type Unconstrained = crate::input::malformed_unique_items_input_internal::Builder;
   61     88   
}
          89  +
/* ServerCodegenVisitor.kt:370 */
   62     90   
impl MalformedUniqueItemsInput {
   63         -
    /// Creates a new builder-style object to manufacture [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput).
          91  +
    /// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:211 */Creates a new builder-style object to manufacture [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput).
          92  +
    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:212 */
   64     93   
    pub fn builder() -> crate::input::malformed_unique_items_input::Builder {
          94  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:213 */
   65     95   
        crate::input::malformed_unique_items_input::Builder::default()
          96  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:212 */
   66     97   
    }
          98  +
    /* ServerCodegenVisitor.kt:370 */
   67     99   
}
   68         -
/// See [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput).
         100  +
/// /* ServerBuilderGenerator.kt:171 */See [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput).
   69    101   
pub(crate) mod malformed_unique_items_input_internal {
   70    102   
         103  +
    /* RustType.kt:516 */
   71    104   
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
   72         -
    /// Holds one variant for each of the ways the builder can fail.
         105  +
    /// /* ServerBuilderConstraintViolations.kt:72 */Holds one variant for each of the ways the builder can fail.
         106  +
    /* RustType.kt:516 */
   73    107   
    #[non_exhaustive]
         108  +
    /* ServerBuilderConstraintViolations.kt:75 */
   74    109   
    #[allow(clippy::enum_variant_names)]
   75    110   
    pub(crate) enum ConstraintViolation {
   76         -
        /// Constraint violation occurred building member `set` when building `MalformedUniqueItemsInput`.
         111  +
        /// /* ServerBuilderConstraintViolations.kt:158 */Constraint violation occurred building member `set` when building `MalformedUniqueItemsInput`.
         112  +
        /* RustType.kt:516 */
   77    113   
        #[doc(hidden)]
         114  +
        /* ServerBuilderConstraintViolations.kt:164 */
   78    115   
        Set(crate::model::simple_set_internal::ConstraintViolation),
   79         -
        /// Constraint violation occurred building member `complex_set` when building `MalformedUniqueItemsInput`.
         116  +
        /// /* ServerBuilderConstraintViolations.kt:158 */Constraint violation occurred building member `complex_set` when building `MalformedUniqueItemsInput`.
         117  +
        /* RustType.kt:516 */
   80    118   
        #[doc(hidden)]
         119  +
        /* ServerBuilderConstraintViolations.kt:164 */
   81    120   
        ComplexSet(crate::model::complex_set_internal::ConstraintViolation),
         121  +
        /* ServerBuilderConstraintViolations.kt:75 */
   82    122   
    }
         123  +
    /* ServerBuilderConstraintViolations.kt:117 */
   83    124   
    impl ::std::fmt::Display for ConstraintViolation {
         125  +
        /* ServerBuilderConstraintViolations.kt:118 */
   84    126   
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         127  +
            /* ServerBuilderConstraintViolations.kt:119 */
   85    128   
            match self {
   86         -
                ConstraintViolation::Set(_) => write!(f, "constraint violation occurred building member `set` when building `MalformedUniqueItemsInput`"),
   87         -
                ConstraintViolation::ComplexSet(_) => write!(f, "constraint violation occurred building member `complex_set` when building `MalformedUniqueItemsInput`"),
   88         -
            }
         129  +
                /* ServerBuilderConstraintViolations.kt:127 */ConstraintViolation::Set(_) => write!(f, "constraint violation occurred building member `set` when building `MalformedUniqueItemsInput`"),
         130  +
                /* ServerBuilderConstraintViolations.kt:127 */ConstraintViolation::ComplexSet(_) => write!(f, "constraint violation occurred building member `complex_set` when building `MalformedUniqueItemsInput`"),
         131  +
            /* ServerBuilderConstraintViolations.kt:119 */}
         132  +
            /* ServerBuilderConstraintViolations.kt:118 */
   89    133   
        }
         134  +
        /* ServerBuilderConstraintViolations.kt:117 */
   90    135   
    }
         136  +
    /* ServerBuilderConstraintViolations.kt:84 */
   91    137   
    impl ::std::error::Error for ConstraintViolation {}
         138  +
    /* ServerBuilderConstraintViolations.kt:171 */
   92    139   
    impl ConstraintViolation {
   93    140   
        pub(crate) fn as_validation_exception_field(
   94    141   
            self,
   95    142   
            path: ::std::string::String,
   96    143   
        ) -> crate::model::ValidationExceptionField {
   97    144   
            match self {
   98    145   
                ConstraintViolation::Set(inner) => {
   99    146   
                    inner.as_validation_exception_field(path + "/set")
  100    147   
                }
  101    148   
                ConstraintViolation::ComplexSet(inner) => {
  102    149   
                    inner.as_validation_exception_field(path + "/complexSet")
  103    150   
                }
  104    151   
            }
  105    152   
        }
  106    153   
    }
         154  +
    /* ServerBuilderGenerator.kt:234 */
  107    155   
    impl ::std::convert::From<ConstraintViolation>
  108    156   
        for ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection
  109    157   
    {
  110    158   
        fn from(constraint_violation: ConstraintViolation) -> Self {
  111    159   
            let first_validation_exception_field =
  112    160   
                constraint_violation.as_validation_exception_field("".to_owned());
  113    161   
            let validation_exception = crate::error::ValidationException {
  114    162   
                message: format!(
  115    163   
                    "1 validation error detected. {}",
  116    164   
                    &first_validation_exception_field.message
  117    165   
                ),
  118    166   
                field_list: Some(vec![first_validation_exception_field]),
  119    167   
            };
  120    168   
            Self::ConstraintViolation(
  121    169   
                                crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
  122    170   
                                    .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
  123    171   
                            )
  124    172   
        }
  125    173   
    }
         174  +
    /* ServerBuilderGenerator.kt:244 */
  126    175   
    impl ::std::convert::From<Builder>
  127    176   
        for crate::constrained::MaybeConstrained<crate::input::MalformedUniqueItemsInput>
  128    177   
    {
  129    178   
        fn from(builder: Builder) -> Self {
  130    179   
            Self::Unconstrained(builder)
  131    180   
        }
  132    181   
    }
         182  +
    /* ServerBuilderGenerator.kt:446 */
  133    183   
    impl ::std::convert::TryFrom<Builder> for crate::input::MalformedUniqueItemsInput {
  134    184   
        type Error = ConstraintViolation;
  135    185   
  136    186   
        fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
  137    187   
            builder.build()
  138    188   
        }
  139    189   
    }
  140         -
    /// A builder for [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput).
         190  +
    /// /* ServerBuilderGenerator.kt:201 */A builder for [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput).
         191  +
    /* RustType.kt:516 */
  141    192   
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
         193  +
    /* ServerBuilderGenerator.kt:211 */
  142    194   
    pub(crate) struct Builder {
         195  +
        /* ServerBuilderGenerator.kt:308 */
  143    196   
        pub(crate) set:
  144    197   
            ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::SimpleSet>>,
         198  +
        /* ServerBuilderGenerator.kt:308 */
  145    199   
        pub(crate) complex_set:
  146    200   
            ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::ComplexSet>>,
         201  +
        /* ServerBuilderGenerator.kt:211 */
  147    202   
    }
         203  +
    /* ServerBuilderGenerator.kt:215 */
  148    204   
    impl Builder {
         205  +
        /* ServerBuilderGenerator.kt:426 */
  149    206   
        #[allow(missing_docs)] // documentation missing in model
         207  +
                               /* ServerBuilderGenerator.kt:428 */
  150    208   
        pub(crate) fn set_set(
  151    209   
            mut self,
  152    210   
            input: Option<
  153    211   
                impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::SimpleSet>>,
  154    212   
            >,
  155    213   
        ) -> Self {
         214  +
            /* ServerBuilderGenerator.kt:429 */
  156    215   
            self.set = input.map(|v| v.into());
  157    216   
            self
         217  +
            /* ServerBuilderGenerator.kt:428 */
  158    218   
        }
         219  +
        /* ServerBuilderGenerator.kt:426 */
  159    220   
        #[allow(missing_docs)] // documentation missing in model
         221  +
                               /* ServerBuilderGenerator.kt:428 */
  160    222   
        pub(crate) fn set_complex_set(
  161    223   
            mut self,
  162    224   
            input: Option<
  163    225   
                impl ::std::convert::Into<
  164    226   
                    crate::constrained::MaybeConstrained<crate::model::ComplexSet>,
  165    227   
                >,
  166    228   
            >,
  167    229   
        ) -> Self {
         230  +
            /* ServerBuilderGenerator.kt:429 */
  168    231   
            self.complex_set = input.map(|v| v.into());
  169    232   
            self
         233  +
            /* ServerBuilderGenerator.kt:428 */
  170    234   
        }
  171         -
        /// Consumes the builder and constructs a [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput).
  172         -
        ///
         235  +
        /// /* ServerBuilderGenerator.kt:258 */Consumes the builder and constructs a [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput).
         236  +
        /// /* ServerBuilderGenerator.kt:260 */
  173    237   
        /// The builder fails to construct a [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput) if a [`ConstraintViolation`] occurs.
  174    238   
        ///
  175         -
        /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
         239  +
        /// /* ServerBuilderGenerator.kt:268 */If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
         240  +
        /* ServerBuilderGenerator.kt:271 */
  176    241   
        pub fn build(self) -> Result<crate::input::MalformedUniqueItemsInput, ConstraintViolation> {
  177    242   
            self.build_enforcing_all_constraints()
  178    243   
        }
         244  +
        /* ServerBuilderGenerator.kt:283 */
  179    245   
        fn build_enforcing_all_constraints(
  180    246   
            self,
  181    247   
        ) -> Result<crate::input::MalformedUniqueItemsInput, ConstraintViolation> {
  182         -
            Ok(crate::input::MalformedUniqueItemsInput {
  183         -
                set: self
  184         -
                    .set
  185         -
                    .map(|v| match v {
  186         -
                        crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
  187         -
                        crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
  188         -
                    })
  189         -
                    .map(|res| res.map_err(ConstraintViolation::Set))
  190         -
                    .transpose()?
  191         -
                    .map(|v: crate::model::SimpleSet| v.into()),
  192         -
                complex_set: self
  193         -
                    .complex_set
  194         -
                    .map(|v| match v {
  195         -
                        crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
  196         -
                        crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
  197         -
                    })
  198         -
                    .map(|res| res.map_err(ConstraintViolation::ComplexSet))
  199         -
                    .transpose()?
  200         -
                    .map(|v: crate::model::ComplexSet| v.into()),
  201         -
            })
         248  +
            /* ServerBuilderGenerator.kt:287 */
         249  +
            Ok(
         250  +
                /* ServerBuilderGenerator.kt:542 */
         251  +
                crate::input::MalformedUniqueItemsInput {
         252  +
                    /* ServerBuilderGenerator.kt:546 */
         253  +
                    set: self
         254  +
                        .set
         255  +
                        /* ServerBuilderGenerator.kt:602 */
         256  +
                        .map(|v| match v {
         257  +
                            crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
         258  +
                            crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
         259  +
                        })
         260  +
                        /* ServerBuilderGenerator.kt:614 */
         261  +
                        .map(|res| res.map_err(ConstraintViolation::Set))
         262  +
                        .transpose()?
         263  +
                        /* ServerBuilderGenerator.kt:630 */
         264  +
                        .map(|v: crate::model::SimpleSet| v.into()),
         265  +
                    /* ServerBuilderGenerator.kt:546 */
         266  +
                    complex_set: self
         267  +
                        .complex_set
         268  +
                        /* ServerBuilderGenerator.kt:602 */
         269  +
                        .map(|v| match v {
         270  +
                            crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
         271  +
                            crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
         272  +
                        })
         273  +
                        /* ServerBuilderGenerator.kt:614 */
         274  +
                        .map(|res| res.map_err(ConstraintViolation::ComplexSet))
         275  +
                        .transpose()?
         276  +
                        /* ServerBuilderGenerator.kt:630 */
         277  +
                        .map(|v: crate::model::ComplexSet| v.into()),
         278  +
                    /* ServerBuilderGenerator.kt:542 */
         279  +
                }, /* ServerBuilderGenerator.kt:287 */
         280  +
            )
         281  +
            /* ServerBuilderGenerator.kt:283 */
  202    282   
        }
         283  +
        /* ServerBuilderGenerator.kt:215 */
  203    284   
    }
         285  +
         286  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
  204    287   
}
  205         -
/// See [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput).
         288  +
/// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:110 */See [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput).
  206    289   
pub mod malformed_unique_items_input {
  207    290   
         291  +
    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:269 */
  208    292   
    impl ::std::convert::From<Builder> for crate::input::MalformedUniqueItemsInput {
  209    293   
        fn from(builder: Builder) -> Self {
  210    294   
            builder.build()
  211    295   
        }
  212    296   
    }
  213         -
    /// A builder for [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput).
         297  +
    /// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:130 */A builder for [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput).
         298  +
    /* RustType.kt:516 */
  214    299   
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
         300  +
    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:137 */
  215    301   
    pub struct Builder {
         302  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:225 */
  216    303   
        pub(crate) set: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
         304  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:225 */
  217    305   
        pub(crate) complex_set:
  218    306   
            ::std::option::Option<::std::vec::Vec<crate::model::ComplexSetStruct>>,
         307  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:137 */
  219    308   
    }
         309  +
    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:141 */
  220    310   
    impl Builder {
         311  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:241 */
  221    312   
        #[allow(missing_docs)] // documentation missing in model
         313  +
                               /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:244 */
  222    314   
        pub fn set(
  223    315   
            mut self,
  224    316   
            input: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
  225    317   
        ) -> Self {
  226         -
            self.set = input;
         318  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:245 */
         319  +
            self.set =
         320  +
                /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:247 */input
         321  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:245 */;
  227    322   
            self
         323  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:244 */
  228    324   
        }
         325  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:241 */
  229    326   
        #[allow(missing_docs)] // documentation missing in model
         327  +
                               /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:244 */
  230    328   
        pub fn complex_set(
  231    329   
            mut self,
  232    330   
            input: ::std::option::Option<::std::vec::Vec<crate::model::ComplexSetStruct>>,
  233    331   
        ) -> Self {
  234         -
            self.complex_set = input;
         332  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:245 */
         333  +
            self.complex_set =
         334  +
                /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:247 */input
         335  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:245 */;
  235    336   
            self
         337  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:244 */
  236    338   
        }
  237         -
        /// Consumes the builder and constructs a [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput).
         339  +
        /// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:150 */Consumes the builder and constructs a [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput).
         340  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:159 */
  238    341   
        pub fn build(self) -> crate::input::MalformedUniqueItemsInput {
  239    342   
            self.build_enforcing_required_and_enum_traits()
  240    343   
        }
         344  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:171 */
  241    345   
        fn build_enforcing_required_and_enum_traits(
  242    346   
            self,
  243    347   
        ) -> crate::input::MalformedUniqueItemsInput {
         348  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:182 */
  244    349   
            crate::input::MalformedUniqueItemsInput {
         350  +
                /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:186 */
  245    351   
                set: self.set,
         352  +
                /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:186 */
  246    353   
                complex_set: self.complex_set,
         354  +
                /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:182 */
  247    355   
            }
         356  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:171 */
  248    357   
        }
         358  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:141 */
  249    359   
    }
         360  +
         361  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
  250    362   
}

tmp-codegen-diff/codegen-server-test-python/unique_items/rust-server-codegen-python/src/lib.rs

@@ -1,1 +52,53 @@
   13     13   
#![allow(clippy::result_large_err)]
   14     14   
#![allow(clippy::unnecessary_map_on_constructor)]
   15     15   
#![allow(rustdoc::bare_urls)]
   16     16   
#![allow(rustdoc::redundant_explicit_links)]
   17     17   
#![allow(rustdoc::invalid_html_tags)]
   18     18   
#![forbid(unsafe_code)]
   19     19   
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
   20     20   
//! unique_items
   21     21   
   22     22   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
          23  +
/* ServerRootGenerator.kt:65 */
   23     24   
//! A fast and customizable Rust implementation of the UniqueItemsService Smithy service.
   24     25   
//!
   25     26   
//! # Using UniqueItemsService
   26     27   
//!
   27     28   
//! The primary entrypoint is [`UniqueItemsService`]: it satisfies the [`Service<http::Request, Response = http::Response>`](::tower::Service)
   28     29   
//! trait and therefore can be handed to a [`hyper` server](https://github.com/hyperium/hyper) via [`UniqueItemsService::into_make_service`]
   29     30   
//! or used in AWS Lambda
   30     31   
#![cfg_attr(
   31     32   
    feature = "aws-lambda",
   32     33   
    doc = " via [`LambdaHandler`](crate::server::routing::LambdaHandler)."
@@ -167,168 +262,276 @@
  187    188   
//! }
  188    189   
//!
  189    190   
//! ```
  190    191   
//!
  191    192   
//! [`serve`]: https://docs.rs/hyper/0.14.16/hyper/server/struct.Builder.html#method.serve
  192    193   
//! [`tower::make::MakeService`]: https://docs.rs/tower/latest/tower/make/trait.MakeService.html
  193    194   
//! [HTTP binding traits]: https://smithy.io/2.0/spec/http-bindings.html
  194    195   
//! [operations]: https://smithy.io/2.0/spec/service-types.html#operation
  195    196   
//! [hyper server]: https://docs.rs/hyper/latest/hyper/server/index.html
  196    197   
//! [Service]: https://docs.rs/tower-service/latest/tower_service/trait.Service.html
         198  +
/* ServerRootGenerator.kt:261 */
  197    199   
pub use crate::service::{
  198    200   
    MissingOperationsError, UniqueItemsService, UniqueItemsServiceBuilder,
  199    201   
    UniqueItemsServiceConfig, UniqueItemsServiceConfigBuilder,
  200    202   
};
  201    203   
  202         -
/// Contains the types that are re-exported from the `aws-smithy-http-server` crate.
         204  +
/// /* ServerRustModule.kt:55 */Contains the types that are re-exported from the `aws-smithy-http-server` crate.
  203    205   
pub mod server {
  204    206   
    // Re-export all types from the `aws-smithy-http-server` crate.
  205    207   
    pub use ::aws_smithy_http_server::*;
         208  +
         209  +
    /* CodegenDelegator.kt:200 */
  206    210   
}
  207    211   
         212  +
/* CrateVersionCustomization.kt:23 */
  208    213   
/// Crate version number.
  209    214   
pub static PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
  210    215   
  211         -
/// All error types that operations can return. Documentation on these types is copied from the model.
         216  +
/// /* ServerRustModule.kt:55 */All error types that operations can return. Documentation on these types is copied from the model.
  212    217   
pub mod error;
  213    218   
  214         -
/// Input structures for operations. Documentation on these types is copied from the model.
         219  +
/// /* ServerRustModule.kt:55 */Input structures for operations. Documentation on these types is copied from the model.
  215    220   
pub mod input;
  216    221   
  217         -
/// Data structures used by operation inputs/outputs. Documentation on these types is copied from the model.
         222  +
/// /* ServerRustModule.kt:55 */Data structures used by operation inputs/outputs. Documentation on these types is copied from the model.
  218    223   
pub mod model;
  219    224   
  220         -
/// All operations that this crate can perform.
         225  +
/// /* ServerRustModule.kt:55 */All operations that this crate can perform.
  221    226   
pub mod operation;
  222    227   
         228  +
/* ServerRustModule.kt:79 */
  223    229   
/// A collection of types representing each operation defined in the service closure.
  224    230   
///
  225    231   
/// The [plugin system](::aws_smithy_http_server::plugin) makes use of these
  226    232   
/// [zero-sized types](https://doc.rust-lang.org/nomicon/exotic-sizes.html#zero-sized-types-zsts) (ZSTs) to
  227    233   
/// parameterize [`Plugin`](::aws_smithy_http_server::plugin::Plugin) implementations. Their traits, such as
  228    234   
/// [`OperationShape`](::aws_smithy_http_server::operation::OperationShape), can be used to provide
  229    235   
/// operation specific information to the [`Layer`](::tower::Layer) being applied.
  230    236   
pub mod operation_shape;
  231    237   
  232         -
/// Output structures for operations. Documentation on these types is copied from the model.
         238  +
/// /* ServerRustModule.kt:55 */Output structures for operations. Documentation on these types is copied from the model.
  233    239   
pub mod output;
  234    240   
  235         -
/// Export PyO3 symbols in the shared library
         241  +
/// /* PythonServerRustModule.kt:23 */Export PyO3 symbols in the shared library
  236    242   
pub mod python_module_export;
  237    243   
  238         -
/// Operation adapters that delegate to Python handlers.
         244  +
/// /* PythonServerRustModule.kt:23 */Operation adapters that delegate to Python handlers.
  239    245   
pub mod python_operation_adaptor;
  240    246   
  241         -
/// Python server and application implementation.
         247  +
/// /* PythonServerRustModule.kt:23 */Python server and application implementation.
  242    248   
pub mod python_server_application;
  243    249   
         250  +
/* RustModule.kt:172 */
  244    251   
mod service;
  245    252   
  246         -
/// Data primitives referenced by other data types.
         253  +
/// /* ServerRustModule.kt:55 */Data primitives referenced by other data types.
  247    254   
pub mod types;
  248    255   
  249         -
/// Unconstrained types for constrained shapes.
         256  +
/// /* ServerRustModule.kt:55 */Unconstrained types for constrained shapes.
         257  +
/* RustModule.kt:172 */
  250    258   
mod unconstrained;
  251    259   
  252         -
/// Constrained types for constrained shapes.
         260  +
/// /* ServerRustModule.kt:55 */Constrained types for constrained shapes.
         261  +
/* RustModule.kt:172 */
  253    262   
mod constrained;
  254    263   
  255    264   
pub(crate) mod protocol_serde;
  256    265   
  257         -
/// Re-exported Python types from supporting crates.
         266  +
/// /* PythonServerCodegenDecorator.kt:57 */Re-exported Python types from supporting crates.
         267  +
/* PythonServerCodegenDecorator.kt:58 */
  258    268   
pub mod python_types {
         269  +
    /* PythonServerCodegenDecorator.kt:59 */
  259    270   
    pub use ::aws_smithy_http_server_python::types::Blob;
         271  +
    /* PythonServerCodegenDecorator.kt:60 */
  260    272   
    pub use ::aws_smithy_http_server_python::types::DateTime;
         273  +
    /* PythonServerCodegenDecorator.kt:61 */
  261    274   
    pub use ::aws_smithy_http_server_python::types::Document;
         275  +
    /* PythonServerCodegenDecorator.kt:58 */
  262    276   
}

tmp-codegen-diff/codegen-server-test-python/unique_items/rust-server-codegen-python/src/model.rs

@@ -1,1 +510,697 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[::pyo3::pyclass]
           4  +
/* PythonServerStructureGenerator.kt:63 */
    3      5   
/// :param path str:
    4      6   
/// :param message str:
    5      7   
/// :rtype None:
    6         -
/// Describes one specific validation failure for an input member.
           8  +
/// /* StructureGenerator.kt:197 */Describes one specific validation failure for an input member.
           9  +
/* RustType.kt:516 */
    7     10   
#[derive(
    8     11   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
    9     12   
)]
   10         -
pub struct ValidationExceptionField {
          13  +
pub /* StructureGenerator.kt:201 */ struct ValidationExceptionField {
          14  +
    /* RustType.kt:516 */
   11     15   
    #[pyo3(get, set)]
          16  +
    /* PythonServerStructureGenerator.kt:80 */
   12     17   
    /// :type str:
   13         -
    /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
          18  +
    /// /* StructureGenerator.kt:231 */A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
   14     19   
    pub path: ::std::string::String,
          20  +
    /* RustType.kt:516 */
   15     21   
    #[pyo3(get, set)]
          22  +
    /* PythonServerStructureGenerator.kt:80 */
   16     23   
    /// :type str:
   17         -
    /// A detailed description of the validation failure.
          24  +
    /// /* StructureGenerator.kt:231 */A detailed description of the validation failure.
   18     25   
    pub message: ::std::string::String,
          26  +
    /* StructureGenerator.kt:201 */
   19     27   
}
          28  +
/* StructureGenerator.kt:135 */
   20     29   
impl ValidationExceptionField {
   21         -
    /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
          30  +
    /// /* StructureGenerator.kt:231 */A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
          31  +
    /* StructureGenerator.kt:166 */
   22     32   
    pub fn path(&self) -> &str {
          33  +
        /* StructureGenerator.kt:171 */
   23     34   
        use std::ops::Deref;
   24     35   
        self.path.deref()
          36  +
        /* StructureGenerator.kt:166 */
   25     37   
    }
   26         -
    /// A detailed description of the validation failure.
          38  +
    /// /* StructureGenerator.kt:231 */A detailed description of the validation failure.
          39  +
    /* StructureGenerator.kt:166 */
   27     40   
    pub fn message(&self) -> &str {
          41  +
        /* StructureGenerator.kt:171 */
   28     42   
        use std::ops::Deref;
   29     43   
        self.message.deref()
          44  +
        /* StructureGenerator.kt:166 */
   30     45   
    }
          46  +
    /* StructureGenerator.kt:135 */
   31     47   
}
          48  +
/* RustType.kt:516 */
   32     49   
#[allow(clippy::new_without_default)]
          50  +
/* RustType.kt:516 */
   33     51   
#[allow(clippy::too_many_arguments)]
          52  +
/* RustType.kt:516 */
   34     53   
#[::pyo3::pymethods]
          54  +
/* PythonServerStructureGenerator.kt:88 */
   35     55   
impl ValidationExceptionField {
   36     56   
    #[new]
   37     57   
    pub fn new(path: ::std::string::String, message: ::std::string::String) -> Self {
   38     58   
        Self { path, message }
   39     59   
    }
   40     60   
    fn __repr__(&self) -> String {
   41     61   
        format!("{self:?}")
   42     62   
    }
   43     63   
    fn __str__(&self) -> String {
   44     64   
        format!("{self:?}")
   45     65   
    }
   46     66   
}
          67  +
/* PythonServerStructureGenerator.kt:111 */
   47     68   
impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<ValidationExceptionField> {
   48     69   
    fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
   49     70   
        ob.extract::<ValidationExceptionField>().map(Box::new)
   50     71   
    }
   51     72   
}
   52     73   
   53     74   
impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<ValidationExceptionField> {
   54     75   
    fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
   55     76   
        (*self).into_py(py)
   56     77   
    }
   57     78   
}
          79  +
/* ServerCodegenVisitor.kt:370 */
   58     80   
impl ValidationExceptionField {
   59         -
    /// Creates a new builder-style object to manufacture [`ValidationExceptionField`](crate::model::ValidationExceptionField).
          81  +
    /// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:211 */Creates a new builder-style object to manufacture [`ValidationExceptionField`](crate::model::ValidationExceptionField).
          82  +
    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:212 */
   60     83   
    pub fn builder() -> crate::model::validation_exception_field::Builder {
          84  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:213 */
   61     85   
        crate::model::validation_exception_field::Builder::default()
          86  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:212 */
   62     87   
    }
          88  +
    /* ServerCodegenVisitor.kt:370 */
   63     89   
}
   64     90   
          91  +
/* ConstrainedCollectionGenerator.kt:93 */
   65     92   
#[allow(missing_docs)] // documentation missing in model
   66         -
///
          93  +
/// /* ConstrainedCollectionGenerator.kt:94 */
   67     94   
/// This is a constrained type because its corresponding modeled Smithy shape has one or more
   68     95   
/// [constraint traits]. Use [`ComplexSet::try_from`] to construct values of this type.
   69     96   
///
   70     97   
/// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
   71     98   
///
          99  +
/* RustType.kt:516 */
   72    100   
#[derive(
   73    101   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
   74    102   
)]
   75         -
pub(crate) struct ComplexSet(pub(crate) ::std::vec::Vec<crate::model::ComplexSetStruct>);
         103  +
pub(crate) /* ConstrainedCollectionGenerator.kt:97 */ struct ComplexSet(
         104  +
    pub(crate) ::std::vec::Vec<crate::model::ComplexSetStruct>,
         105  +
);
         106  +
/* ConstrainedCollectionGenerator.kt:104 */
   76    107   
impl ComplexSet {
         108  +
    /* ConstrainedCollectionGenerator.kt:116 */
   77    109   
    /// Consumes the value, returning the underlying [`::std::vec::Vec<crate::model::ComplexSetStruct>`].
   78    110   
    pub fn into_inner(self) -> ::std::vec::Vec<crate::model::ComplexSetStruct> {
   79    111   
        self.0
   80    112   
    }
   81    113   
   82    114   
    fn check_unique_items(
   83    115   
        items: ::std::vec::Vec<crate::model::ComplexSetStruct>,
   84    116   
    ) -> ::std::result::Result<
   85    117   
        ::std::vec::Vec<crate::model::ComplexSetStruct>,
   86    118   
        crate::model::complex_set_internal::ConstraintViolation,
   87    119   
    > {
   88    120   
        let mut seen = ::std::collections::HashMap::new();
   89    121   
        let mut duplicate_indices = ::std::vec::Vec::new();
   90    122   
        for (idx, item) in items.iter().enumerate() {
   91    123   
            if let Some(prev_idx) = seen.insert(item, idx) {
   92    124   
                duplicate_indices.push(prev_idx);
   93    125   
            }
   94    126   
        }
   95    127   
   96    128   
        let mut last_duplicate_indices = ::std::vec::Vec::new();
   97    129   
        for idx in &duplicate_indices {
   98    130   
            if let Some(prev_idx) = seen.remove(&items[*idx]) {
   99    131   
                last_duplicate_indices.push(prev_idx);
  100    132   
            }
  101    133   
        }
  102    134   
        duplicate_indices.extend(last_duplicate_indices);
  103    135   
  104    136   
        if !duplicate_indices.is_empty() {
  105    137   
            debug_assert!(duplicate_indices.len() >= 2);
  106    138   
            Err(
  107    139   
                crate::model::complex_set_internal::ConstraintViolation::UniqueItems {
  108    140   
                    duplicate_indices,
  109    141   
                    original: items,
  110    142   
                },
  111    143   
            )
  112    144   
        } else {
  113    145   
            Ok(items)
  114    146   
        }
  115    147   
    }
         148  +
    /* ConstrainedCollectionGenerator.kt:104 */
  116    149   
}
         150  +
/* ConstrainedCollectionGenerator.kt:133 */
  117    151   
impl ::std::convert::TryFrom<::std::vec::Vec<crate::model::ComplexSetStruct>> for ComplexSet {
  118    152   
    type Error = crate::model::complex_set_internal::ConstraintViolation;
  119    153   
  120    154   
    /// Constructs a `ComplexSet` from an [`::std::vec::Vec<crate::model::ComplexSetStruct>`], failing when the provided value does not satisfy the modeled constraints.
  121    155   
    fn try_from(
  122    156   
        value: ::std::vec::Vec<crate::model::ComplexSetStruct>,
  123    157   
    ) -> ::std::result::Result<Self, Self::Error> {
  124    158   
        let value = Self::check_unique_items(value)?;
  125    159   
  126    160   
        Ok(Self(value))
  127    161   
    }
  128    162   
}
  129    163   
  130    164   
impl ::std::convert::From<ComplexSet> for ::std::vec::Vec<crate::model::ComplexSetStruct> {
  131    165   
    fn from(value: ComplexSet) -> Self {
  132    166   
        value.into_inner()
  133    167   
    }
  134    168   
}
         169  +
/* ConstrainedCollectionGenerator.kt:181 */
  135    170   
impl crate::constrained::Constrained for ComplexSet {
  136    171   
    type Unconstrained = crate::unconstrained::complex_set_unconstrained::ComplexSetUnconstrained;
  137    172   
}
  138    173   
         174  +
/* RustType.kt:516 */
  139    175   
#[::pyo3::pyclass]
         176  +
/* PythonServerStructureGenerator.kt:63 */
  140    177   
/// :param foo typing.Optional\[bool\]:
  141    178   
/// :param blob typing.Optional\[unique_items.types.Blob\]:
  142    179   
/// :rtype None:
         180  +
/* StructureGenerator.kt:197 */
  143    181   
#[allow(missing_docs)] // documentation missing in model
         182  +
/* RustType.kt:516 */
  144    183   
#[derive(
  145    184   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  146    185   
)]
  147         -
pub struct ComplexSetStruct {
         186  +
pub /* StructureGenerator.kt:201 */ struct ComplexSetStruct {
         187  +
    /* RustType.kt:516 */
  148    188   
    #[pyo3(get, set)]
         189  +
    /* PythonServerStructureGenerator.kt:80 */
  149    190   
    /// :type typing.Optional\[bool\]:
         191  +
    /* StructureGenerator.kt:231 */
  150    192   
    #[allow(missing_docs)] // documentation missing in model
  151    193   
    pub foo: ::std::option::Option<bool>,
         194  +
    /* RustType.kt:516 */
  152    195   
    #[pyo3(get, set)]
         196  +
    /* PythonServerStructureGenerator.kt:80 */
  153    197   
    /// :type typing.Optional\[unique_items.types.Blob\]:
         198  +
    /* StructureGenerator.kt:231 */
  154    199   
    #[allow(missing_docs)] // documentation missing in model
  155    200   
    pub blob: ::std::option::Option<::aws_smithy_http_server_python::types::Blob>,
         201  +
    /* StructureGenerator.kt:201 */
  156    202   
}
         203  +
/* StructureGenerator.kt:135 */
  157    204   
impl ComplexSetStruct {
         205  +
    /* StructureGenerator.kt:231 */
  158    206   
    #[allow(missing_docs)] // documentation missing in model
         207  +
                           /* StructureGenerator.kt:166 */
  159    208   
    pub fn foo(&self) -> ::std::option::Option<bool> {
         209  +
        /* StructureGenerator.kt:168 */
  160    210   
        self.foo
         211  +
        /* StructureGenerator.kt:166 */
  161    212   
    }
         213  +
    /* StructureGenerator.kt:231 */
  162    214   
    #[allow(missing_docs)] // documentation missing in model
         215  +
                           /* StructureGenerator.kt:166 */
  163    216   
    pub fn blob(&self) -> ::std::option::Option<&::aws_smithy_http_server_python::types::Blob> {
         217  +
        /* StructureGenerator.kt:170 */
  164    218   
        self.blob.as_ref()
         219  +
        /* StructureGenerator.kt:166 */
  165    220   
    }
         221  +
    /* StructureGenerator.kt:135 */
  166    222   
}
         223  +
/* RustType.kt:516 */
  167    224   
#[allow(clippy::new_without_default)]
         225  +
/* RustType.kt:516 */
  168    226   
#[allow(clippy::too_many_arguments)]
         227  +
/* RustType.kt:516 */
  169    228   
#[::pyo3::pymethods]
         229  +
/* PythonServerStructureGenerator.kt:88 */
  170    230   
impl ComplexSetStruct {
  171    231   
    #[new]
  172    232   
    pub fn new(
  173    233   
        foo: ::std::option::Option<bool>,
  174    234   
        blob: ::std::option::Option<::aws_smithy_http_server_python::types::Blob>,
  175    235   
    ) -> Self {
  176    236   
        Self { foo, blob }
  177    237   
    }
  178    238   
    fn __repr__(&self) -> String {
  179    239   
        format!("{self:?}")
  180    240   
    }
  181    241   
    fn __str__(&self) -> String {
  182    242   
        format!("{self:?}")
  183    243   
    }
  184    244   
}
         245  +
/* PythonServerStructureGenerator.kt:111 */
  185    246   
impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<ComplexSetStruct> {
  186    247   
    fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
  187    248   
        ob.extract::<ComplexSetStruct>().map(Box::new)
  188    249   
    }
  189    250   
}
  190    251   
  191    252   
impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<ComplexSetStruct> {
  192    253   
    fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
  193    254   
        (*self).into_py(py)
  194    255   
    }
  195    256   
}
         257  +
/* ServerStructureConstrainedTraitImpl.kt:21 */
  196    258   
impl crate::constrained::Constrained for crate::model::ComplexSetStruct {
  197    259   
    type Unconstrained = crate::model::complex_set_struct_internal::Builder;
  198    260   
}
         261  +
/* ServerCodegenVisitor.kt:370 */
  199    262   
impl ComplexSetStruct {
  200         -
    /// Creates a new builder-style object to manufacture [`ComplexSetStruct`](crate::model::ComplexSetStruct).
         263  +
    /// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:211 */Creates a new builder-style object to manufacture [`ComplexSetStruct`](crate::model::ComplexSetStruct).
         264  +
    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:212 */
  201    265   
    pub fn builder() -> crate::model::complex_set_struct::Builder {
         266  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:213 */
  202    267   
        crate::model::complex_set_struct::Builder::default()
         268  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:212 */
  203    269   
    }
         270  +
    /* ServerCodegenVisitor.kt:370 */
  204    271   
}
  205    272   
         273  +
/* ConstrainedCollectionGenerator.kt:93 */
  206    274   
#[allow(missing_docs)] // documentation missing in model
  207         -
///
         275  +
/// /* ConstrainedCollectionGenerator.kt:94 */
  208    276   
/// This is a constrained type because its corresponding modeled Smithy shape has one or more
  209    277   
/// [constraint traits]. Use [`SimpleSet::try_from`] to construct values of this type.
  210    278   
///
  211    279   
/// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
  212    280   
///
         281  +
/* RustType.kt:516 */
  213    282   
#[derive(
  214    283   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  215    284   
)]
  216         -
pub(crate) struct SimpleSet(pub(crate) ::std::vec::Vec<::std::string::String>);
         285  +
pub(crate) /* ConstrainedCollectionGenerator.kt:97 */ struct SimpleSet(
         286  +
    pub(crate) ::std::vec::Vec<::std::string::String>,
         287  +
);
         288  +
/* ConstrainedCollectionGenerator.kt:104 */
  217    289   
impl SimpleSet {
         290  +
    /* ConstrainedCollectionGenerator.kt:116 */
  218    291   
    /// Consumes the value, returning the underlying [`::std::vec::Vec<::std::string::String>`].
  219    292   
    pub fn into_inner(self) -> ::std::vec::Vec<::std::string::String> {
  220    293   
        self.0
  221    294   
    }
  222    295   
  223    296   
    fn check_unique_items(
  224    297   
        items: ::std::vec::Vec<::std::string::String>,
  225    298   
    ) -> ::std::result::Result<
  226    299   
        ::std::vec::Vec<::std::string::String>,
  227    300   
        crate::model::simple_set_internal::ConstraintViolation,
  228    301   
    > {
  229    302   
        let mut seen = ::std::collections::HashMap::new();
  230    303   
        let mut duplicate_indices = ::std::vec::Vec::new();
  231    304   
        for (idx, item) in items.iter().enumerate() {
  232    305   
            if let Some(prev_idx) = seen.insert(item, idx) {
  233    306   
                duplicate_indices.push(prev_idx);
  234    307   
            }
  235    308   
        }
  236    309   
  237    310   
        let mut last_duplicate_indices = ::std::vec::Vec::new();
  238    311   
        for idx in &duplicate_indices {
  239    312   
            if let Some(prev_idx) = seen.remove(&items[*idx]) {
  240    313   
                last_duplicate_indices.push(prev_idx);
  241    314   
            }
  242    315   
        }
  243    316   
        duplicate_indices.extend(last_duplicate_indices);
  244    317   
  245    318   
        if !duplicate_indices.is_empty() {
  246    319   
            debug_assert!(duplicate_indices.len() >= 2);
  247    320   
            Err(
  248    321   
                crate::model::simple_set_internal::ConstraintViolation::UniqueItems {
  249    322   
                    duplicate_indices,
  250    323   
                    original: items,
  251    324   
                },
  252    325   
            )
  253    326   
        } else {
  254    327   
            Ok(items)
  255    328   
        }
  256    329   
    }
         330  +
    /* ConstrainedCollectionGenerator.kt:104 */
  257    331   
}
         332  +
/* ConstrainedCollectionGenerator.kt:133 */
  258    333   
impl ::std::convert::TryFrom<::std::vec::Vec<::std::string::String>> for SimpleSet {
  259    334   
    type Error = crate::model::simple_set_internal::ConstraintViolation;
  260    335   
  261    336   
    /// Constructs a `SimpleSet` from an [`::std::vec::Vec<::std::string::String>`], failing when the provided value does not satisfy the modeled constraints.
  262    337   
    fn try_from(
  263    338   
        value: ::std::vec::Vec<::std::string::String>,
  264    339   
    ) -> ::std::result::Result<Self, Self::Error> {
  265    340   
        let value = Self::check_unique_items(value)?;
  266    341   
  267    342   
        Ok(Self(value))
  268    343   
    }
  269    344   
}
  270    345   
  271    346   
impl ::std::convert::From<SimpleSet> for ::std::vec::Vec<::std::string::String> {
  272    347   
    fn from(value: SimpleSet) -> Self {
  273    348   
        value.into_inner()
  274    349   
    }
  275    350   
}
         351  +
/* ConstrainedCollectionGenerator.kt:181 */
  276    352   
impl crate::constrained::Constrained for SimpleSet {
  277    353   
    type Unconstrained = crate::unconstrained::simple_set_unconstrained::SimpleSetUnconstrained;
  278    354   
}
  279    355   
  280         -
/// See [`ValidationExceptionField`](crate::model::ValidationExceptionField).
         356  +
/// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:110 */See [`ValidationExceptionField`](crate::model::ValidationExceptionField).
  281    357   
pub mod validation_exception_field {
  282    358   
         359  +
    /* RustType.kt:516 */
  283    360   
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
  284         -
    /// Holds one variant for each of the ways the builder can fail.
  285         -
         361  +
    /// /* ServerBuilderConstraintViolations.kt:72 */Holds one variant for each of the ways the builder can fail.
         362  +
    /* ServerBuilderConstraintViolations.kt:75 */
  286    363   
    #[allow(clippy::enum_variant_names)]
  287    364   
    pub enum ConstraintViolation {
  288         -
        /// `path` was not provided but it is required when building `ValidationExceptionField`.
         365  +
        /// /* ServerBuilderConstraintViolations.kt:138 */`path` was not provided but it is required when building `ValidationExceptionField`.
         366  +
        /* ServerBuilderConstraintViolations.kt:143 */
  289    367   
        MissingPath,
  290         -
        /// `message` was not provided but it is required when building `ValidationExceptionField`.
         368  +
        /// /* ServerBuilderConstraintViolations.kt:138 */`message` was not provided but it is required when building `ValidationExceptionField`.
         369  +
        /* ServerBuilderConstraintViolations.kt:143 */
  291    370   
        MissingMessage,
         371  +
        /* ServerBuilderConstraintViolations.kt:75 */
  292    372   
    }
         373  +
    /* ServerBuilderConstraintViolations.kt:117 */
  293    374   
    impl ::std::fmt::Display for ConstraintViolation {
         375  +
        /* ServerBuilderConstraintViolations.kt:118 */
  294    376   
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         377  +
            /* ServerBuilderConstraintViolations.kt:119 */
  295    378   
            match self {
  296         -
                ConstraintViolation::MissingPath => write!(f, "`path` was not provided but it is required when building `ValidationExceptionField`"),
  297         -
                ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ValidationExceptionField`"),
  298         -
            }
         379  +
                /* ServerBuilderConstraintViolations.kt:127 */ConstraintViolation::MissingPath => write!(f, "`path` was not provided but it is required when building `ValidationExceptionField`"),
         380  +
                /* ServerBuilderConstraintViolations.kt:127 */ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ValidationExceptionField`"),
         381  +
            /* ServerBuilderConstraintViolations.kt:119 */}
         382  +
            /* ServerBuilderConstraintViolations.kt:118 */
  299    383   
        }
         384  +
        /* ServerBuilderConstraintViolations.kt:117 */
  300    385   
    }
         386  +
    /* ServerBuilderConstraintViolations.kt:84 */
  301    387   
    impl ::std::error::Error for ConstraintViolation {}
         388  +
    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:254 */
  302    389   
    impl ::std::convert::TryFrom<Builder> for crate::model::ValidationExceptionField {
  303    390   
        type Error = ConstraintViolation;
  304    391   
  305    392   
        fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
  306    393   
            builder.build()
  307    394   
        }
  308    395   
    }
  309         -
    /// A builder for [`ValidationExceptionField`](crate::model::ValidationExceptionField).
         396  +
    /// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:130 */A builder for [`ValidationExceptionField`](crate::model::ValidationExceptionField).
         397  +
    /* RustType.kt:516 */
  310    398   
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
         399  +
    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:137 */
  311    400   
    pub struct Builder {
         401  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:225 */
  312    402   
        pub(crate) path: ::std::option::Option<::std::string::String>,
         403  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:225 */
  313    404   
        pub(crate) message: ::std::option::Option<::std::string::String>,
         405  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:137 */
  314    406   
    }
         407  +
    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:141 */
  315    408   
    impl Builder {
  316         -
        /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
         409  +
        /// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:241 */A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
         410  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:244 */
  317    411   
        pub fn path(mut self, input: ::std::string::String) -> Self {
  318         -
            self.path = Some(input);
         412  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:245 */
         413  +
            self.path =
         414  +
                /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:246 */Some(
         415  +
                    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:247 */input
         416  +
                /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:246 */)
         417  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:245 */;
  319    418   
            self
         419  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:244 */
  320    420   
        }
  321         -
        /// A detailed description of the validation failure.
         421  +
        /// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:241 */A detailed description of the validation failure.
         422  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:244 */
  322    423   
        pub fn message(mut self, input: ::std::string::String) -> Self {
  323         -
            self.message = Some(input);
         424  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:245 */
         425  +
            self.message =
         426  +
                /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:246 */Some(
         427  +
                    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:247 */input
         428  +
                /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:246 */)
         429  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:245 */;
  324    430   
            self
         431  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:244 */
  325    432   
        }
  326         -
        /// Consumes the builder and constructs a [`ValidationExceptionField`](crate::model::ValidationExceptionField).
  327         -
        ///
         433  +
        /// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:150 */Consumes the builder and constructs a [`ValidationExceptionField`](crate::model::ValidationExceptionField).
         434  +
        /// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:152 */
  328    435   
        /// The builder fails to construct a [`ValidationExceptionField`](crate::model::ValidationExceptionField) if you do not provide a value for all non-`Option`al members.
  329    436   
        ///
         437  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:159 */
  330    438   
        pub fn build(self) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
  331    439   
            self.build_enforcing_required_and_enum_traits()
  332    440   
        }
         441  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:171 */
  333    442   
        fn build_enforcing_required_and_enum_traits(
  334    443   
            self,
  335    444   
        ) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
  336         -
            Ok(crate::model::ValidationExceptionField {
  337         -
                path: self.path.ok_or(ConstraintViolation::MissingPath)?,
  338         -
                message: self.message.ok_or(ConstraintViolation::MissingMessage)?,
  339         -
            })
         445  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:175 */
         446  +
            Ok(
         447  +
                /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:182 */
         448  +
                crate::model::ValidationExceptionField {
         449  +
                    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:186 */
         450  +
                    path: self
         451  +
                        .path
         452  +
                        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:202 */
         453  +
                        .ok_or(ConstraintViolation::MissingPath)?,
         454  +
                    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:186 */
         455  +
                    message: self
         456  +
                        .message
         457  +
                        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:202 */
         458  +
                        .ok_or(ConstraintViolation::MissingMessage)?,
         459  +
                    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:182 */
         460  +
                }, /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:175 */
         461  +
            )
         462  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:171 */
  340    463   
        }
         464  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:141 */
  341    465   
    }
         466  +
         467  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
  342    468   
}
  343    469   
pub(crate) mod complex_set_internal {
  344    470   
         471  +
    /* CollectionConstraintViolationGenerator.kt:78 */
  345    472   
    #[allow(clippy::enum_variant_names)]
  346    473   
    #[derive(Debug, PartialEq)]
  347    474   
    pub(crate) enum ConstraintViolation {
  348    475   
        /// Constraint violation error when the list does not contain unique items
  349    476   
        UniqueItems {
  350    477   
            /// A vector of indices into `original` pointing to all duplicate items. This vector has
  351    478   
            /// at least two elements.
  352    479   
            /// More specifically, for every element `idx_1` in `duplicate_indices`, there exists another
  353    480   
            /// distinct element `idx_2` such that `original[idx_1] == original[idx_2]` is `true`.
  354    481   
            /// Nothing is guaranteed about the order of the indices.
  355    482   
            duplicate_indices: ::std::vec::Vec<usize>,
  356    483   
            /// The original vector, that contains duplicate items.
  357    484   
            original: ::std::vec::Vec<crate::model::ComplexSetStruct>,
  358    485   
        },
  359    486   
    }
  360    487   
  361    488   
    impl ::std::fmt::Display for ConstraintViolation {
  362    489   
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  363    490   
            let message = match self {
  364    491   
                                Self::UniqueItems { duplicate_indices, .. } =>
  365    492   
                            format!("Value with repeated values at indices {:?} provided for 'com.amazonaws.constraints#ComplexSet' failed to satisfy constraint: Member must have unique values", &duplicate_indices),
  366    493   
                            };
  367    494   
            write!(f, "{message}")
  368    495   
        }
  369    496   
    }
  370    497   
  371    498   
    impl ::std::error::Error for ConstraintViolation {}
         499  +
    /* CollectionConstraintViolationGenerator.kt:104 */
  372    500   
    impl ConstraintViolation {
  373    501   
        pub(crate) fn as_validation_exception_field(
  374    502   
            self,
  375    503   
            path: ::std::string::String,
  376    504   
        ) -> crate::model::ValidationExceptionField {
  377    505   
            match self {
  378    506   
                        Self::UniqueItems { duplicate_indices, .. } =>
  379    507   
                                crate::model::ValidationExceptionField {
  380    508   
                                    message: format!("Value with repeated values at indices {:?} at '{}' failed to satisfy constraint: Member must have unique values", &duplicate_indices, &path),
  381    509   
                                    path,
  382    510   
                                },
  383    511   
                    }
  384    512   
        }
  385    513   
    }
         514  +
         515  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
  386    516   
}
  387         -
/// See [`ComplexSetStruct`](crate::model::ComplexSetStruct).
         517  +
/// /* ServerBuilderGenerator.kt:171 */See [`ComplexSetStruct`](crate::model::ComplexSetStruct).
  388    518   
pub(crate) mod complex_set_struct_internal {
  389    519   
         520  +
    /* ServerBuilderGenerator.kt:461 */
  390    521   
    impl ::std::convert::From<Builder> for crate::model::ComplexSetStruct {
  391    522   
        fn from(builder: Builder) -> Self {
  392    523   
            builder.build()
  393    524   
        }
  394    525   
    }
  395         -
    /// A builder for [`ComplexSetStruct`](crate::model::ComplexSetStruct).
         526  +
    /// /* ServerBuilderGenerator.kt:201 */A builder for [`ComplexSetStruct`](crate::model::ComplexSetStruct).
         527  +
    /* RustType.kt:516 */
  396    528   
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
         529  +
    /* ServerBuilderGenerator.kt:211 */
  397    530   
    pub(crate) struct Builder {
  398         -
        pub(crate) foo: ::std::option::Option<bool>,
         531  +
        /* ServerBuilderGenerator.kt:308 */ pub(crate) foo: ::std::option::Option<bool>,
         532  +
        /* ServerBuilderGenerator.kt:308 */
  399    533   
        pub(crate) blob: ::std::option::Option<::aws_smithy_http_server_python::types::Blob>,
         534  +
        /* ServerBuilderGenerator.kt:211 */
  400    535   
    }
         536  +
    /* ServerBuilderGenerator.kt:215 */
  401    537   
    impl Builder {
         538  +
        /* ServerBuilderGenerator.kt:426 */
  402    539   
        #[allow(missing_docs)] // documentation missing in model
         540  +
                               /* ServerBuilderGenerator.kt:428 */
  403    541   
        pub(crate) fn set_foo(mut self, input: Option<impl ::std::convert::Into<bool>>) -> Self {
         542  +
            /* ServerBuilderGenerator.kt:429 */
  404    543   
            self.foo = input.map(|v| v.into());
  405    544   
            self
         545  +
            /* ServerBuilderGenerator.kt:428 */
  406    546   
        }
         547  +
        /* ServerBuilderGenerator.kt:426 */
  407    548   
        #[allow(missing_docs)] // documentation missing in model
         549  +
                               /* ServerBuilderGenerator.kt:428 */
  408    550   
        pub(crate) fn set_blob(
  409    551   
            mut self,
  410    552   
            input: Option<impl ::std::convert::Into<::aws_smithy_http_server_python::types::Blob>>,
  411    553   
        ) -> Self {
         554  +
            /* ServerBuilderGenerator.kt:429 */
  412    555   
            self.blob = input.map(|v| v.into());
  413    556   
            self
         557  +
            /* ServerBuilderGenerator.kt:428 */
  414    558   
        }
  415         -
        /// Consumes the builder and constructs a [`ComplexSetStruct`](crate::model::ComplexSetStruct).
         559  +
        /// /* ServerBuilderGenerator.kt:258 */Consumes the builder and constructs a [`ComplexSetStruct`](crate::model::ComplexSetStruct).
         560  +
        /* ServerBuilderGenerator.kt:271 */
  416    561   
        pub fn build(self) -> crate::model::ComplexSetStruct {
  417    562   
            self.build_enforcing_all_constraints()
  418    563   
        }
         564  +
        /* ServerBuilderGenerator.kt:283 */
  419    565   
        fn build_enforcing_all_constraints(self) -> crate::model::ComplexSetStruct {
         566  +
            /* ServerBuilderGenerator.kt:542 */
  420    567   
            crate::model::ComplexSetStruct {
         568  +
                /* ServerBuilderGenerator.kt:546 */
  421    569   
                foo: self.foo,
         570  +
                /* ServerBuilderGenerator.kt:546 */
  422    571   
                blob: self.blob,
         572  +
                /* ServerBuilderGenerator.kt:542 */
  423    573   
            }
         574  +
            /* ServerBuilderGenerator.kt:283 */
  424    575   
        }
         576  +
        /* ServerBuilderGenerator.kt:215 */
  425    577   
    }
         578  +
         579  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
  426    580   
}
  427         -
/// See [`ComplexSetStruct`](crate::model::ComplexSetStruct).
         581  +
/// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:110 */See [`ComplexSetStruct`](crate::model::ComplexSetStruct).
  428    582   
pub mod complex_set_struct {
  429    583   
         584  +
    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:269 */
  430    585   
    impl ::std::convert::From<Builder> for crate::model::ComplexSetStruct {
  431    586   
        fn from(builder: Builder) -> Self {
  432    587   
            builder.build()
  433    588   
        }
  434    589   
    }
  435         -
    /// A builder for [`ComplexSetStruct`](crate::model::ComplexSetStruct).
         590  +
    /// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:130 */A builder for [`ComplexSetStruct`](crate::model::ComplexSetStruct).
         591  +
    /* RustType.kt:516 */
  436    592   
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
         593  +
    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:137 */
  437    594   
    pub struct Builder {
         595  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:225 */
  438    596   
        pub(crate) foo: ::std::option::Option<bool>,
         597  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:225 */
  439    598   
        pub(crate) blob: ::std::option::Option<::aws_smithy_http_server_python::types::Blob>,
         599  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:137 */
  440    600   
    }
         601  +
    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:141 */
  441    602   
    impl Builder {
         603  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:241 */
  442    604   
        #[allow(missing_docs)] // documentation missing in model
         605  +
                               /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:244 */
  443    606   
        pub fn foo(mut self, input: ::std::option::Option<bool>) -> Self {
  444         -
            self.foo = input;
         607  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:245 */
         608  +
            self.foo =
         609  +
                /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:247 */input
         610  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:245 */;
  445    611   
            self
         612  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:244 */
  446    613   
        }
         614  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:241 */
  447    615   
        #[allow(missing_docs)] // documentation missing in model
         616  +
                               /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:244 */
  448    617   
        pub fn blob(
  449    618   
            mut self,
  450    619   
            input: ::std::option::Option<::aws_smithy_http_server_python::types::Blob>,
  451    620   
        ) -> Self {
  452         -
            self.blob = input;
         621  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:245 */
         622  +
            self.blob =
         623  +
                /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:247 */input
         624  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:245 */;
  453    625   
            self
         626  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:244 */
  454    627   
        }
  455         -
        /// Consumes the builder and constructs a [`ComplexSetStruct`](crate::model::ComplexSetStruct).
         628  +
        /// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:150 */Consumes the builder and constructs a [`ComplexSetStruct`](crate::model::ComplexSetStruct).
         629  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:159 */
  456    630   
        pub fn build(self) -> crate::model::ComplexSetStruct {
  457    631   
            self.build_enforcing_required_and_enum_traits()
  458    632   
        }
         633  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:171 */
  459    634   
        fn build_enforcing_required_and_enum_traits(self) -> crate::model::ComplexSetStruct {
         635  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:182 */
  460    636   
            crate::model::ComplexSetStruct {
         637  +
                /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:186 */
  461    638   
                foo: self.foo,
         639  +
                /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:186 */
  462    640   
                blob: self.blob,
         641  +
                /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:182 */
  463    642   
            }
         643  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:171 */
  464    644   
        }
         645  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:141 */
  465    646   
    }
         647  +
         648  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
  466    649   
}
  467    650   
pub(crate) mod simple_set_internal {
  468    651   
         652  +
    /* CollectionConstraintViolationGenerator.kt:78 */
  469    653   
    #[allow(clippy::enum_variant_names)]
  470    654   
    #[derive(Debug, PartialEq)]
  471    655   
    pub(crate) enum ConstraintViolation {
  472    656   
        /// Constraint violation error when the list does not contain unique items
  473    657   
        UniqueItems {
  474    658   
            /// A vector of indices into `original` pointing to all duplicate items. This vector has
  475    659   
            /// at least two elements.
  476    660   
            /// More specifically, for every element `idx_1` in `duplicate_indices`, there exists another
  477    661   
            /// distinct element `idx_2` such that `original[idx_1] == original[idx_2]` is `true`.
  478    662   
            /// Nothing is guaranteed about the order of the indices.
  479    663   
            duplicate_indices: ::std::vec::Vec<usize>,
  480    664   
            /// The original vector, that contains duplicate items.
  481    665   
            original: ::std::vec::Vec<::std::string::String>,
  482    666   
        },
  483    667   
    }
  484    668   
  485    669   
    impl ::std::fmt::Display for ConstraintViolation {
  486    670   
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  487    671   
            let message = match self {
  488    672   
                                Self::UniqueItems { duplicate_indices, .. } =>
  489    673   
                            format!("Value with repeated values at indices {:?} provided for 'com.amazonaws.constraints#SimpleSet' failed to satisfy constraint: Member must have unique values", &duplicate_indices),
  490    674   
                            };
  491    675   
            write!(f, "{message}")
  492    676   
        }
  493    677   
    }
  494    678   
  495    679   
    impl ::std::error::Error for ConstraintViolation {}
         680  +
    /* CollectionConstraintViolationGenerator.kt:104 */
  496    681   
    impl ConstraintViolation {
  497    682   
        pub(crate) fn as_validation_exception_field(
  498    683   
            self,
  499    684   
            path: ::std::string::String,
  500    685   
        ) -> crate::model::ValidationExceptionField {
  501    686   
            match self {
  502    687   
                        Self::UniqueItems { duplicate_indices, .. } =>
  503    688   
                                crate::model::ValidationExceptionField {
  504    689   
                                    message: format!("Value with repeated values at indices {:?} at '{}' failed to satisfy constraint: Member must have unique values", &duplicate_indices, &path),
  505    690   
                                    path,
  506    691   
                                },
  507    692   
                    }
  508    693   
        }
  509    694   
    }
         695  +
         696  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
  510    697   
}

tmp-codegen-diff/codegen-server-test-python/unique_items/rust-server-codegen-python/src/operation.rs

@@ -1,1 +31,32 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:266 */
    2      3   
const CONTENT_TYPE_MALFORMEDUNIQUEITEMS: ::mime::Mime = ::mime::APPLICATION_JSON;
    3      4   
::pin_project_lite::pin_project! {
    4      5   
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
    5      6   
    /// [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput) using modelled bindings.
    6      7   
    pub struct MalformedUniqueItemsInputFuture {
    7      8   
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedUniqueItemsInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
    8      9   
    }
    9     10   
}
   10     11   
   11     12   
impl std::future::Future for MalformedUniqueItemsInputFuture {
@@ -38,39 +100,103 @@
   58     59   
                ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
   59     60   
                    e,
   60     61   
                )
   61     62   
            },
   62     63   
        );
   63     64   
        MalformedUniqueItemsInputFuture {
   64     65   
            inner: Box::pin(fut),
   65     66   
        }
   66     67   
    }
   67     68   
}
          69  +
/* ServerHttpBoundProtocolGenerator.kt:329 */
   68     70   
impl
   69     71   
    ::aws_smithy_http_server::response::IntoResponse<
   70     72   
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
   71     73   
    > for crate::output::MalformedUniqueItemsOutput
   72     74   
{
   73     75   
    fn into_response(self) -> ::aws_smithy_http_server::response::Response {
   74     76   
        match crate::protocol_serde::shape_malformed_unique_items::ser_malformed_unique_items_http_response(self) {
   75     77   
                        Ok(response) => response,
   76     78   
                        Err(e) => {
   77     79   
                            ::tracing::error!(error = %e, "failed to serialize response");
   78     80   
                            ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
   79     81   
                        }
   80     82   
                    }
   81     83   
    }
   82     84   
}
          85  +
/* ServerHttpBoundProtocolGenerator.kt:350 */
   83     86   
impl
   84     87   
    ::aws_smithy_http_server::response::IntoResponse<
   85     88   
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
   86     89   
    > for crate::error::MalformedUniqueItemsError
   87     90   
{
   88     91   
    fn into_response(self) -> ::aws_smithy_http_server::response::Response {
   89     92   
        match crate::protocol_serde::shape_malformed_unique_items::ser_malformed_unique_items_http_error(&self) {
   90     93   
            Ok(mut response) => {
   91     94   
                response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
   92     95   
                response

tmp-codegen-diff/codegen-server-test-python/unique_items/rust-server-codegen-python/src/operation_shape.rs

@@ -1,1 +0,41 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerOperationGenerator.kt:48 */
    2      3   
#[allow(missing_docs)] // documentation missing in model
           4  +
                       /* ServerOperationGenerator.kt:55 */
    3      5   
pub struct MalformedUniqueItems;
    4      6   
    5      7   
impl ::aws_smithy_http_server::operation::OperationShape for MalformedUniqueItems {
    6      8   
    const ID: ::aws_smithy_http_server::shape_id::ShapeId =
    7      9   
        ::aws_smithy_http_server::shape_id::ShapeId::new(
    8     10   
            "com.amazonaws.constraints#MalformedUniqueItems",
    9     11   
            "com.amazonaws.constraints",
   10     12   
            "MalformedUniqueItems",
   11     13   
        );
   12     14   
   13     15   
    type Input = crate::input::MalformedUniqueItemsInput;
   14     16   
    type Output = crate::output::MalformedUniqueItemsOutput;
   15     17   
    type Error = crate::error::MalformedUniqueItemsError;
   16     18   
}
   17     19   
   18     20   
impl ::aws_smithy_http_server::instrumentation::sensitivity::Sensitivity for MalformedUniqueItems {
   19     21   
    type RequestFmt = ::aws_smithy_http_server::instrumentation::sensitivity::RequestFmt<
   20     22   
        ::aws_smithy_http_server::instrumentation::MakeIdentity,
   21     23   
        ::aws_smithy_http_server::instrumentation::sensitivity::uri::MakeUri<
   22     24   
            ::aws_smithy_http_server::instrumentation::MakeIdentity,
   23     25   
            ::aws_smithy_http_server::instrumentation::MakeIdentity,
   24     26   
        >,
   25     27   
    >;
   26     28   
    type ResponseFmt = ::aws_smithy_http_server::instrumentation::sensitivity::ResponseFmt<
   27     29   
        ::aws_smithy_http_server::instrumentation::MakeIdentity,
   28     30   
        ::aws_smithy_http_server::instrumentation::MakeIdentity,
   29     31   
    >;
   30     32   
   31     33   
    fn request_fmt() -> Self::RequestFmt {
   32     34   
        ::aws_smithy_http_server::instrumentation::sensitivity::RequestFmt::new()
   33     35   
    }
   34     36   
   35     37   
    fn response_fmt() -> Self::ResponseFmt {
   36     38   
        ::aws_smithy_http_server::instrumentation::sensitivity::ResponseFmt::new()
   37     39   
    }
   38     40   
}
          41  +
/* ServerOperationGenerator.kt:88 */

tmp-codegen-diff/codegen-server-test-python/unique_items/rust-server-codegen-python/src/output.rs

@@ -1,1 +63,89 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[::pyo3::pyclass]
           4  +
/* PythonServerStructureGenerator.kt:63 */
    3      5   
/// :rtype None:
           6  +
/* StructureGenerator.kt:197 */
    4      7   
#[allow(missing_docs)] // documentation missing in model
           8  +
/* RustType.kt:516 */
    5      9   
#[derive(
    6     10   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
    7     11   
)]
    8         -
pub struct MalformedUniqueItemsOutput {}
          12  +
pub /* StructureGenerator.kt:201 */ struct MalformedUniqueItemsOutput {/* StructureGenerator.kt:201 */}
          13  +
/* RustType.kt:516 */
    9     14   
#[allow(clippy::new_without_default)]
          15  +
/* RustType.kt:516 */
   10     16   
#[allow(clippy::too_many_arguments)]
          17  +
/* RustType.kt:516 */
   11     18   
#[::pyo3::pymethods]
          19  +
/* PythonServerStructureGenerator.kt:88 */
   12     20   
impl MalformedUniqueItemsOutput {
   13     21   
    #[new]
   14     22   
    pub fn new() -> Self {
   15     23   
        Self {}
   16     24   
    }
   17     25   
    fn __repr__(&self) -> String {
   18     26   
        format!("{self:?}")
   19     27   
    }
   20     28   
    fn __str__(&self) -> String {
   21     29   
        format!("{self:?}")
   22     30   
    }
   23     31   
}
          32  +
/* PythonServerStructureGenerator.kt:111 */
   24     33   
impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<MalformedUniqueItemsOutput> {
   25     34   
    fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
   26     35   
        ob.extract::<MalformedUniqueItemsOutput>().map(Box::new)
   27     36   
    }
   28     37   
}
   29     38   
   30     39   
impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<MalformedUniqueItemsOutput> {
   31     40   
    fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
   32     41   
        (*self).into_py(py)
   33     42   
    }
   34     43   
}
          44  +
/* ServerCodegenVisitor.kt:370 */
   35     45   
impl MalformedUniqueItemsOutput {
   36         -
    /// Creates a new builder-style object to manufacture [`MalformedUniqueItemsOutput`](crate::output::MalformedUniqueItemsOutput).
          46  +
    /// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:211 */Creates a new builder-style object to manufacture [`MalformedUniqueItemsOutput`](crate::output::MalformedUniqueItemsOutput).
          47  +
    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:212 */
   37     48   
    pub fn builder() -> crate::output::malformed_unique_items_output::Builder {
          49  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:213 */
   38     50   
        crate::output::malformed_unique_items_output::Builder::default()
          51  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:212 */
   39     52   
    }
          53  +
    /* ServerCodegenVisitor.kt:370 */
   40     54   
}
   41         -
/// See [`MalformedUniqueItemsOutput`](crate::output::MalformedUniqueItemsOutput).
          55  +
/// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:110 */See [`MalformedUniqueItemsOutput`](crate::output::MalformedUniqueItemsOutput).
   42     56   
pub mod malformed_unique_items_output {
   43     57   
          58  +
    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:269 */
   44     59   
    impl ::std::convert::From<Builder> for crate::output::MalformedUniqueItemsOutput {
   45     60   
        fn from(builder: Builder) -> Self {
   46     61   
            builder.build()
   47     62   
        }
   48     63   
    }
   49         -
    /// A builder for [`MalformedUniqueItemsOutput`](crate::output::MalformedUniqueItemsOutput).
          64  +
    /// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:130 */A builder for [`MalformedUniqueItemsOutput`](crate::output::MalformedUniqueItemsOutput).
          65  +
    /* RustType.kt:516 */
   50     66   
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
   51         -
    pub struct Builder {}
          67  +
    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:137 */
          68  +
    pub struct Builder {/* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:137 */}
          69  +
    /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:141 */
   52     70   
    impl Builder {
   53         -
        /// Consumes the builder and constructs a [`MalformedUniqueItemsOutput`](crate::output::MalformedUniqueItemsOutput).
          71  +
        /// /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:150 */Consumes the builder and constructs a [`MalformedUniqueItemsOutput`](crate::output::MalformedUniqueItemsOutput).
          72  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:159 */
   54     73   
        pub fn build(self) -> crate::output::MalformedUniqueItemsOutput {
   55     74   
            self.build_enforcing_required_and_enum_traits()
   56     75   
        }
          76  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:171 */
   57     77   
        fn build_enforcing_required_and_enum_traits(
   58     78   
            self,
   59     79   
        ) -> crate::output::MalformedUniqueItemsOutput {
   60         -
            crate::output::MalformedUniqueItemsOutput {}
          80  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:182 */
          81  +
            crate::output::MalformedUniqueItemsOutput {
          82  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:182 */}
          83  +
            /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:171 */
   61     84   
        }
          85  +
        /* ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt:141 */
   62     86   
    }
          87  +
          88  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
   63     89   
}

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

@@ -1,1 +22,23 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
pub(crate) mod shape_malformed_unique_items;
    3      3   
    4      4   
pub(crate) mod shape_internal_server_error;
    5      5   
           6  +
/* JsonParserGenerator.kt:227 */
    6      7   
pub(crate) fn or_empty_doc(data: &[u8]) -> &[u8] {
    7      8   
    if data.is_empty() {
    8      9   
        b"{}"
    9     10   
    } else {
   10     11   
        data
   11     12   
    }
   12     13   
}
   13     14   
   14     15   
pub(crate) mod shape_validation_exception;
   15     16