Server Test Typescript

Server Test Typescript

rev. 1661690c47759989ca94986fb8d3e5132fc72dc5

Files changed:

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

@@ -325,325 +438,436 @@
  345    345   
            message: variant.to_string(),
  346    346   
        }
  347    347   
        .into()
  348    348   
    }
  349    349   
}
  350    350   
/// See [`InternalServerError`](crate::error::InternalServerError).
  351    351   
pub mod internal_server_error {
  352    352   
  353    353   
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
  354    354   
    /// Holds one variant for each of the ways the builder can fail.
  355         -
  356    355   
    #[allow(clippy::enum_variant_names)]
  357    356   
    pub enum ConstraintViolation {
  358    357   
        /// `message` was not provided but it is required when building `InternalServerError`.
  359    358   
        MissingMessage,
  360    359   
    }
  361    360   
    impl ::std::fmt::Display for ConstraintViolation {
  362    361   
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  363    362   
            match self {
  364    363   
                ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `InternalServerError`"),
  365    364   
            }
  366    365   
        }
  367    366   
    }
  368    367   
    impl ::std::error::Error for ConstraintViolation {}
  369    368   
    impl ::std::convert::TryFrom<Builder> for crate::error::InternalServerError {
  370    369   
        type Error = ConstraintViolation;
  371    370   
  372    371   
        fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
  373    372   
            builder.build()
  374    373   
        }
  375    374   
    }
  376    375   
    /// A builder for [`InternalServerError`](crate::error::InternalServerError).
  377    376   
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
  378    377   
    pub struct Builder {
  379    378   
        pub(crate) message: ::std::option::Option<::std::string::String>,
  380    379   
    }
  381    380   
    impl Builder {
  382    381   
        #[allow(missing_docs)] // documentation missing in model
  383    382   
        pub fn message(mut self, input: ::std::string::String) -> Self {
  384    383   
            self.message = Some(input);
  385    384   
            self
  386    385   
        }
  387    386   
        /// Consumes the builder and constructs a [`InternalServerError`](crate::error::InternalServerError).
  388    387   
        ///
  389    388   
        /// The builder fails to construct a [`InternalServerError`](crate::error::InternalServerError) if you do not provide a value for all non-`Option`al members.
  390    389   
        ///
  391    390   
        pub fn build(self) -> Result<crate::error::InternalServerError, ConstraintViolation> {
  392    391   
            self.build_enforcing_required_and_enum_traits()
  393    392   
        }
  394    393   
        fn build_enforcing_required_and_enum_traits(
  395    394   
            self,
  396    395   
        ) -> Result<crate::error::InternalServerError, ConstraintViolation> {
  397    396   
            Ok(crate::error::InternalServerError {
  398    397   
                message: self.message.ok_or(ConstraintViolation::MissingMessage)?,
  399    398   
            })
  400    399   
        }
  401    400   
    }
  402    401   
}
  403    402   
/// See [`ValidationException`](crate::error::ValidationException).
  404    403   
pub mod validation_exception {
  405    404   
  406    405   
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
  407    406   
    /// Holds one variant for each of the ways the builder can fail.
  408         -
  409    407   
    #[allow(clippy::enum_variant_names)]
  410    408   
    pub enum ConstraintViolation {
  411    409   
        /// `message` was not provided but it is required when building `ValidationException`.
  412    410   
        MissingMessage,
  413    411   
    }
  414    412   
    impl ::std::fmt::Display for ConstraintViolation {
  415    413   
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  416    414   
            match self {
  417    415   
                ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ValidationException`"),
  418    416   
            }
@@ -442,440 +502,499 @@
  462    460   
                field_list: self.field_list,
  463    461   
            })
  464    462   
        }
  465    463   
    }
  466    464   
}
  467    465   
/// See [`ResourceNotFoundException`](crate::error::ResourceNotFoundException).
  468    466   
pub mod resource_not_found_exception {
  469    467   
  470    468   
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
  471    469   
    /// Holds one variant for each of the ways the builder can fail.
  472         -
  473    470   
    #[allow(clippy::enum_variant_names)]
  474    471   
    pub enum ConstraintViolation {
  475    472   
        /// `message` was not provided but it is required when building `ResourceNotFoundException`.
  476    473   
        MissingMessage,
  477    474   
    }
  478    475   
    impl ::std::fmt::Display for ConstraintViolation {
  479    476   
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  480    477   
            match self {
  481    478   
                ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ResourceNotFoundException`"),
  482    479   
            }

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

@@ -148,148 +208,207 @@
  168    168   
                name: self.name.ok_or(ConstraintViolation::MissingName)?,
  169    169   
            })
  170    170   
        }
  171    171   
    }
  172    172   
}
  173    173   
/// See [`GetPokemonSpeciesInput`](crate::input::GetPokemonSpeciesInput).
  174    174   
pub mod get_pokemon_species_input {
  175    175   
  176    176   
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
  177    177   
    /// Holds one variant for each of the ways the builder can fail.
  178         -
  179    178   
    #[allow(clippy::enum_variant_names)]
  180    179   
    pub enum ConstraintViolation {
  181    180   
        /// `name` was not provided but it is required when building `GetPokemonSpeciesInput`.
  182    181   
        MissingName,
  183    182   
    }
  184    183   
    impl ::std::fmt::Display for ConstraintViolation {
  185    184   
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  186    185   
            match self {
  187    186   
                ConstraintViolation::MissingName => write!(f, "`name` was not provided but it is required when building `GetPokemonSpeciesInput`"),
  188    187   
            }

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

@@ -134,134 +194,193 @@
  154    154   
{
  155    155   
    fn from(value: ::std::string::String) -> Self {
  156    156   
        Self::Unconstrained(value)
  157    157   
    }
  158    158   
}
  159    159   
/// See [`ValidationExceptionField`](crate::model::ValidationExceptionField).
  160    160   
pub mod validation_exception_field {
  161    161   
  162    162   
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
  163    163   
    /// Holds one variant for each of the ways the builder can fail.
  164         -
  165    164   
    #[allow(clippy::enum_variant_names)]
  166    165   
    pub enum ConstraintViolation {
  167    166   
        /// `path` was not provided but it is required when building `ValidationExceptionField`.
  168    167   
        MissingPath,
  169    168   
        /// `message` was not provided but it is required when building `ValidationExceptionField`.
  170    169   
        MissingMessage,
  171    170   
    }
  172    171   
    impl ::std::fmt::Display for ConstraintViolation {
  173    172   
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  174    173   
            match self {
@@ -197,196 +257,255 @@
  217    216   
                message: self.message.ok_or(ConstraintViolation::MissingMessage)?,
  218    217   
            })
  219    218   
        }
  220    219   
    }
  221    220   
}
  222    221   
/// See [`FlavorText`](crate::model::FlavorText).
  223    222   
pub mod flavor_text {
  224    223   
  225    224   
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
  226    225   
    /// Holds one variant for each of the ways the builder can fail.
  227         -
  228    226   
    #[allow(clippy::enum_variant_names)]
  229    227   
    pub enum ConstraintViolation {
  230    228   
        /// `flavor_text` was not provided but it is required when building `FlavorText`.
  231    229   
        MissingFlavorText,
  232    230   
        /// `language` was not provided but it is required when building `FlavorText`.
  233    231   
        MissingLanguage,
  234    232   
    }
  235    233   
    impl ::std::fmt::Display for ConstraintViolation {
  236    234   
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  237    235   
            match self {

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

@@ -24,24 +84,83 @@
   44     44   
            if !::aws_smithy_http_server::protocol::accept_header_classifier(
   45     45   
                request.headers(),
   46     46   
                &CONTENT_TYPE_GETPOKEMONSPECIES,
   47     47   
            ) {
   48     48   
                return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
   49     49   
            }
   50     50   
            crate::protocol_serde::shape_get_pokemon_species::de_get_pokemon_species_http_request(
   51     51   
                request,
   52     52   
            )
   53     53   
            .await
   54         -
            .map_err(Into::into)
   55     54   
        };
   56     55   
        use ::futures_util::future::TryFutureExt;
   57     56   
        let fut = fut.map_err(
   58     57   
            |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
   59     58   
                ::tracing::debug!(error = %e, "failed to deserialize request");
   60     59   
                ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
   61     60   
                    e,
   62     61   
                )
   63     62   
            },
   64     63   
        );
@@ -126,125 +188,185 @@
  146    145   
    type Future = CheckHealthInputFuture;
  147    146   
  148    147   
    fn from_request(request: ::http::Request<B>) -> Self::Future {
  149    148   
        let fut = async move {
  150    149   
            if !::aws_smithy_http_server::protocol::accept_header_classifier(
  151    150   
                request.headers(),
  152    151   
                &CONTENT_TYPE_CHECKHEALTH,
  153    152   
            ) {
  154    153   
                return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
  155    154   
            }
  156         -
            crate::protocol_serde::shape_check_health::de_check_health_http_request(request)
  157         -
                .await
  158         -
                .map_err(Into::into)
         155  +
            crate::protocol_serde::shape_check_health::de_check_health_http_request(request).await
  159    156   
        };
  160    157   
        use ::futures_util::future::TryFutureExt;
  161    158   
        let fut = fut.map_err(
  162    159   
            |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
  163    160   
                ::tracing::debug!(error = %e, "failed to deserialize request");
  164    161   
                ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
  165    162   
                    e,
  166    163   
                )
  167    164   
            },
  168    165   
        );
@@ -228,225 +290,285 @@
  248    245   
    type Future = DoNothingInputFuture;
  249    246   
  250    247   
    fn from_request(request: ::http::Request<B>) -> Self::Future {
  251    248   
        let fut = async move {
  252    249   
            if !::aws_smithy_http_server::protocol::accept_header_classifier(
  253    250   
                request.headers(),
  254    251   
                &CONTENT_TYPE_DONOTHING,
  255    252   
            ) {
  256    253   
                return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
  257    254   
            }
  258         -
            crate::protocol_serde::shape_do_nothing::de_do_nothing_http_request(request)
  259         -
                .await
  260         -
                .map_err(Into::into)
         255  +
            crate::protocol_serde::shape_do_nothing::de_do_nothing_http_request(request).await
  261    256   
        };
  262    257   
        use ::futures_util::future::TryFutureExt;
  263    258   
        let fut = fut.map_err(
  264    259   
            |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
  265    260   
                ::tracing::debug!(error = %e, "failed to deserialize request");
  266    261   
                ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
  267    262   
                    e,
  268    263   
                )
  269    264   
            },
  270    265   
        );
@@ -332,327 +392,386 @@
  352    347   
    fn from_request(request: ::http::Request<B>) -> Self::Future {
  353    348   
        let fut = async move {
  354    349   
            if !::aws_smithy_http_server::protocol::accept_header_classifier(
  355    350   
                request.headers(),
  356    351   
                &CONTENT_TYPE_GETSERVERSTATISTICS,
  357    352   
            ) {
  358    353   
                return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
  359    354   
            }
  360    355   
            crate::protocol_serde::shape_get_server_statistics::de_get_server_statistics_http_request(request)
  361    356   
                            .await
  362         -
                            .map_err(Into::into)
  363    357   
        };
  364    358   
        use ::futures_util::future::TryFutureExt;
  365    359   
        let fut = fut.map_err(
  366    360   
            |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
  367    361   
                ::tracing::debug!(error = %e, "failed to deserialize request");
  368    362   
                ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
  369    363   
                    e,
  370    364   
                )
  371    365   
            },
  372    366   
        );

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

@@ -54,54 +114,113 @@
   74     74   
    /// Creates a new builder-style object to manufacture [`GetServerStatisticsOutput`](crate::output::GetServerStatisticsOutput).
   75     75   
    pub fn builder() -> crate::output::get_server_statistics_output::Builder {
   76     76   
        crate::output::get_server_statistics_output::Builder::default()
   77     77   
    }
   78     78   
}
   79     79   
/// See [`GetPokemonSpeciesOutput`](crate::output::GetPokemonSpeciesOutput).
   80     80   
pub mod get_pokemon_species_output {
   81     81   
   82     82   
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
   83     83   
    /// Holds one variant for each of the ways the builder can fail.
   84         -
   85     84   
    #[allow(clippy::enum_variant_names)]
   86     85   
    pub enum ConstraintViolation {
   87     86   
        /// `name` was not provided but it is required when building `GetPokemonSpeciesOutput`.
   88     87   
        MissingName,
   89     88   
        /// `flavor_text_entries` was not provided but it is required when building `GetPokemonSpeciesOutput`.
   90     89   
        MissingFlavorTextEntries,
   91     90   
    }
   92     91   
    impl ::std::fmt::Display for ConstraintViolation {
   93     92   
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
   94     93   
            match self {
@@ -165,164 +225,223 @@
  185    184   
        fn build_enforcing_required_and_enum_traits(self) -> crate::output::DoNothingOutput {
  186    185   
            crate::output::DoNothingOutput {}
  187    186   
        }
  188    187   
    }
  189    188   
}
  190    189   
/// See [`GetServerStatisticsOutput`](crate::output::GetServerStatisticsOutput).
  191    190   
pub mod get_server_statistics_output {
  192    191   
  193    192   
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
  194    193   
    /// Holds one variant for each of the ways the builder can fail.
  195         -
  196    194   
    #[allow(clippy::enum_variant_names)]
  197    195   
    pub enum ConstraintViolation {
  198    196   
        /// `calls_count` was not provided but it is required when building `GetServerStatisticsOutput`.
  199    197   
        MissingCallsCount,
  200    198   
    }
  201    199   
    impl ::std::fmt::Display for ConstraintViolation {
  202    200   
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  203    201   
            match self {
  204    202   
                ConstraintViolation::MissingCallsCount => write!(f, "`calls_count` was not provided but it is required when building `GetServerStatisticsOutput`"),
  205    203   
            }

tmp-codegen-diff/codegen-server-test-typescript/simple/rust-server-codegen-typescript/src/error.rs

@@ -61,61 +121,120 @@
   81     81   
    /// Creates a new builder-style object to manufacture [`InternalServerError`](crate::error::InternalServerError).
   82     82   
    pub fn builder() -> crate::error::internal_server_error::Builder {
   83     83   
        crate::error::internal_server_error::Builder::default()
   84     84   
    }
   85     85   
}
   86     86   
/// See [`InternalServerError`](crate::error::InternalServerError).
   87     87   
pub mod internal_server_error {
   88     88   
   89     89   
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
   90     90   
    /// Holds one variant for each of the ways the builder can fail.
   91         -
   92     91   
    #[allow(clippy::enum_variant_names)]
   93     92   
    pub enum ConstraintViolation {
   94     93   
        /// `message` was not provided but it is required when building `InternalServerError`.
   95     94   
        MissingMessage,
   96     95   
    }
   97     96   
    impl ::std::fmt::Display for ConstraintViolation {
   98     97   
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
   99     98   
            match self {
  100     99   
                ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `InternalServerError`"),
  101    100   
            }

tmp-codegen-diff/codegen-server-test-typescript/simple/rust-server-codegen-typescript/src/operation.rs

@@ -20,20 +82,80 @@
   40     40   
    type Future = OperationInputFuture;
   41     41   
   42     42   
    fn from_request(request: ::http::Request<B>) -> Self::Future {
   43     43   
        let fut = async move {
   44     44   
            if !::aws_smithy_http_server::protocol::accept_header_classifier(
   45     45   
                request.headers(),
   46     46   
                &CONTENT_TYPE_OPERATION,
   47     47   
            ) {
   48     48   
                return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
   49     49   
            }
   50         -
            crate::protocol_serde::shape_operation::de_operation_http_request(request)
   51         -
                .await
   52         -
                .map_err(Into::into)
          50  +
            crate::protocol_serde::shape_operation::de_operation_http_request(request).await
   53     51   
        };
   54     52   
        use ::futures_util::future::TryFutureExt;
   55     53   
        let fut = fut.map_err(
   56     54   
            |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
   57     55   
                ::tracing::debug!(error = %e, "failed to deserialize request");
   58     56   
                ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
   59     57   
                    e,
   60     58   
                )
   61     59   
            },
   62     60   
        );