Server Test

Server Test

rev. 0b749be6d000fdc7ef59d1bc26f1dce00358d95c (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-server-test/Cargo.toml

@@ -1,1 +5,5 @@
    1      1   
[workspace]
    2      2   
resolver = "2"
    3      3   
members = [
    4         -
    "naming_test_ops/rust-server-codegen","naming_test_casing/rust-server-codegen","naming_test_structs/rust-server-codegen","simple/rust-server-codegen","constraints_without_public_constrained_types/rust-server-codegen","unique_items/rust-server-codegen","constraints/rust-server-codegen","rest_json/rust-server-codegen","rest_json_extras/rust-server-codegen","rest_json_validation/rust-server-codegen","json_rpc10/rust-server-codegen","json_rpc11/rust-server-codegen","misc/rust-server-codegen","ebs/rust-server-codegen","s3/rust-server-codegen","pokemon-service-server-sdk/rust-server-codegen","pokemon-service-awsjson-server-sdk/rust-server-codegen","rest_xml_extras/rust-server-codegen"
           4  +
    "naming_test_ops/rust-server-codegen","naming_test_casing/rust-server-codegen","naming_test_structs/rust-server-codegen","simple/rust-server-codegen","constraints_without_public_constrained_types/rust-server-codegen","unique_items/rust-server-codegen","constraints/rust-server-codegen","rest_json/rust-server-codegen","rest_json_extras/rust-server-codegen","rest_json_validation/rust-server-codegen","json_rpc10/rust-server-codegen","json_rpc11/rust-server-codegen","misc/rust-server-codegen","ebs/rust-server-codegen","s3/rust-server-codegen","pokemon-service-server-sdk/rust-server-codegen","pokemon-service-awsjson-server-sdk/rust-server-codegen"
    5      5   
]

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

@@ -52,52 +111,135 @@
   72     72   
impl OperationWithDefaultsInput {
   73     73   
    /// Creates a new builder-style object to manufacture [`OperationWithDefaultsInput`](crate::input::OperationWithDefaultsInput).
   74     74   
    pub fn builder() -> crate::input::operation_with_defaults_input::Builder {
   75     75   
        crate::input::operation_with_defaults_input::Builder::default()
   76     76   
    }
   77     77   
}
   78     78   
impl crate::constrained::Constrained for crate::input::OperationWithDefaultsInput {
   79     79   
    type Unconstrained = crate::input::operation_with_defaults_input::Builder;
   80     80   
}
   81     81   
          82  +
#[allow(missing_docs)] // documentation missing in model
          83  +
#[derive(
          84  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
          85  +
)]
          86  +
pub struct ContentTypeParametersInput {
          87  +
    #[allow(missing_docs)] // documentation missing in model
          88  +
    pub value: ::std::option::Option<i32>,
          89  +
}
          90  +
impl ContentTypeParametersInput {
          91  +
    #[allow(missing_docs)] // documentation missing in model
          92  +
    pub fn value(&self) -> ::std::option::Option<i32> {
          93  +
        self.value
          94  +
    }
          95  +
}
          96  +
impl ContentTypeParametersInput {
          97  +
    /// Creates a new builder-style object to manufacture [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput).
          98  +
    pub fn builder() -> crate::input::content_type_parameters_input::Builder {
          99  +
        crate::input::content_type_parameters_input::Builder::default()
         100  +
    }
         101  +
}
         102  +
impl crate::constrained::Constrained for crate::input::ContentTypeParametersInput {
         103  +
    type Unconstrained = crate::input::content_type_parameters_input::Builder;
         104  +
}
         105  +
   82    106   
#[allow(missing_docs)] // documentation missing in model
   83    107   
#[derive(
   84    108   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
   85    109   
)]
   86    110   
pub struct PutWithContentEncodingInput {
   87    111   
    #[allow(missing_docs)] // documentation missing in model
   88    112   
    pub encoding: ::std::option::Option<::std::string::String>,
   89    113   
    #[allow(missing_docs)] // documentation missing in model
   90    114   
    pub data: ::std::option::Option<::std::string::String>,
   91    115   
}
@@ -567,591 +626,684 @@
  587    611   
                client_optional_defaults: self.client_optional_defaults,
  588    612   
                top_level_default: self.top_level_default.unwrap_or_else(
  589    613   
                    #[allow(clippy::redundant_closure)]
  590    614   
                    || String::from("hi"),
  591    615   
                ),
  592    616   
                other_top_level_default: self.other_top_level_default.unwrap_or(0i32),
  593    617   
            })
  594    618   
        }
  595    619   
    }
  596    620   
}
         621  +
/// See [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput).
         622  +
///
         623  +
pub mod content_type_parameters_input {
         624  +
         625  +
    impl ::std::convert::From<Builder> for crate::input::ContentTypeParametersInput {
         626  +
        fn from(builder: Builder) -> Self {
         627  +
            builder.build()
         628  +
        }
         629  +
    }
         630  +
    /// A builder for [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput).
         631  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
         632  +
    pub struct Builder {
         633  +
        pub(crate) value: ::std::option::Option<i32>,
         634  +
    }
         635  +
    impl Builder {
         636  +
        #[allow(missing_docs)] // documentation missing in model
         637  +
        pub fn value(mut self, input: ::std::option::Option<i32>) -> Self {
         638  +
            self.value = input;
         639  +
            self
         640  +
        }
         641  +
        #[allow(missing_docs)] // documentation missing in model
         642  +
        pub(crate) fn set_value(mut self, input: Option<impl ::std::convert::Into<i32>>) -> Self {
         643  +
            self.value = input.map(|v| v.into());
         644  +
            self
         645  +
        }
         646  +
        /// Consumes the builder and constructs a [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput).
         647  +
        pub fn build(self) -> crate::input::ContentTypeParametersInput {
         648  +
            self.build_enforcing_all_constraints()
         649  +
        }
         650  +
        fn build_enforcing_all_constraints(self) -> crate::input::ContentTypeParametersInput {
         651  +
            crate::input::ContentTypeParametersInput { value: self.value }
         652  +
        }
         653  +
    }
         654  +
}
  597    655   
/// See [`PutWithContentEncodingInput`](crate::input::PutWithContentEncodingInput).
  598    656   
///
  599    657   
pub mod put_with_content_encoding_input {
  600    658   
  601    659   
    impl ::std::convert::From<Builder> for crate::input::PutWithContentEncodingInput {
  602    660   
        fn from(builder: Builder) -> Self {
  603    661   
            builder.build()
  604    662   
        }
  605    663   
    }
  606    664   
    /// A builder for [`PutWithContentEncodingInput`](crate::input::PutWithContentEncodingInput).

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

@@ -130,130 +218,223 @@
  150    150   
//! # Example
  151    151   
//!
  152    152   
//! ```rust,no_run
  153    153   
//! # use std::net::SocketAddr;
  154    154   
//! use json_rpc10::{JsonRpc10, JsonRpc10Config};
  155    155   
//!
  156    156   
//! #[::tokio::main]
  157    157   
//! pub async fn main() {
  158    158   
//!    let config = JsonRpc10Config::builder().build();
  159    159   
//!    let app = JsonRpc10::builder(config)
         160  +
//!        .content_type_parameters(content_type_parameters)
  160    161   
//!        .empty_input_and_empty_output(empty_input_and_empty_output)
  161    162   
//!        .endpoint_operation(endpoint_operation)
  162    163   
//!        .endpoint_with_host_label_operation(endpoint_with_host_label_operation)
  163    164   
//!        .greeting_with_errors(greeting_with_errors)
  164    165   
//!        .host_with_path_operation(host_with_path_operation)
  165    166   
//!        .json_unions(json_unions)
  166    167   
//!        .no_input_and_no_output(no_input_and_no_output)
  167    168   
//!        .no_input_and_output(no_input_and_output)
  168    169   
//!        .operation_with_defaults(operation_with_defaults)
  169    170   
//!        .operation_with_nested_structure(operation_with_nested_structure)
  170    171   
//!        .operation_with_required_members(operation_with_required_members)
  171    172   
//!        .put_with_content_encoding(put_with_content_encoding)
  172    173   
//!        .simple_scalar_properties(simple_scalar_properties)
  173    174   
//!        .build()
  174    175   
//!        .expect("failed to build an instance of JsonRpc10");
  175    176   
//!
  176    177   
//!    let bind: SocketAddr = "127.0.0.1:6969".parse()
  177    178   
//!        .expect("unable to parse the server bind address and port");
  178    179   
//!    let server = ::hyper::Server::bind(&bind).serve(app.into_make_service());
  179    180   
//!    # let server = async { Ok::<_, ()>(()) };
  180    181   
//!
  181    182   
//!    // Run your service!
  182    183   
//!    if let Err(err) = server.await {
  183    184   
//!        eprintln!("server error: {:?}", err);
  184    185   
//!    }
  185    186   
//! }
  186    187   
//!
  187    188   
//! use json_rpc10::{input, output, error};
  188    189   
//!
         190  +
//! async fn content_type_parameters(input: input::ContentTypeParametersInput) -> output::ContentTypeParametersOutput {
         191  +
//!     todo!()
         192  +
//! }
         193  +
//!
  189    194   
//! async fn empty_input_and_empty_output(input: input::EmptyInputAndEmptyOutputInput) -> output::EmptyInputAndEmptyOutputOutput {
  190    195   
//!     todo!()
  191    196   
//! }
  192    197   
//!
  193    198   
//! async fn endpoint_operation(input: input::EndpointOperationInput) -> output::EndpointOperationOutput {
  194    199   
//!     todo!()
  195    200   
//! }
  196    201   
//!
  197    202   
//! async fn endpoint_with_host_label_operation(input: input::EndpointWithHostLabelOperationInput) -> Result<output::EndpointWithHostLabelOperationOutput, error::EndpointWithHostLabelOperationError> {
  198    203   
//!     todo!()

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

@@ -756,756 +815,949 @@
  776    776   
        ));
  777    777   
        let body = ::hyper::body::to_bytes(http_response.into_body())
  778    778   
            .await
  779    779   
            .expect("unable to extract body to bytes");
  780    780   
        ::aws_smithy_protocol_test::assert_ok(
  781    781   
        ::aws_smithy_protocol_test::validate_body(&body, "{\n    \"defaultString\": \"hi\",\n    \"defaultBoolean\": true,\n    \"defaultList\": [],\n    \"defaultDocumentMap\": {},\n    \"defaultDocumentString\": \"hi\",\n    \"defaultDocumentBoolean\": true,\n    \"defaultDocumentList\": [],\n    \"defaultTimestamp\": 0,\n    \"defaultBlob\": \"YWJj\",\n    \"defaultByte\": 1,\n    \"defaultShort\": 1,\n    \"defaultInteger\": 10,\n    \"defaultLong\": 100,\n    \"defaultFloat\": 1.0,\n    \"defaultDouble\": 1.0,\n    \"defaultMap\": {},\n    \"defaultEnum\": \"FOO\",\n    \"defaultIntEnum\": 1,\n    \"emptyString\": \"\",\n    \"falseBoolean\": false,\n    \"emptyBlob\": \"\",\n    \"zeroByte\": 0,\n    \"zeroShort\": 0,\n    \"zeroInteger\": 0,\n    \"zeroLong\": 0,\n    \"zeroFloat\": 0.0,\n    \"zeroDouble\": 0.0\n}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
  782    782   
        );
  783    783   
    }
  784    784   
}
  785    785   
         786  +
static CONTENT_TYPE_CONTENTTYPEPARAMETERS: ::once_cell::sync::Lazy<::mime::Mime> =
         787  +
    ::once_cell::sync::Lazy::new(|| {
         788  +
        "application/x-amz-json-1.0"
         789  +
            .parse::<::mime::Mime>()
         790  +
            .expect("BUG: MIME parsing failed, content_type is not valid")
         791  +
    });
         792  +
::pin_project_lite::pin_project! {
         793  +
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
         794  +
    /// [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput) using modelled bindings.
         795  +
    pub struct ContentTypeParametersInputFuture {
         796  +
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::ContentTypeParametersInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
         797  +
    }
         798  +
}
         799  +
         800  +
impl std::future::Future for ContentTypeParametersInputFuture {
         801  +
    type Output = Result<
         802  +
        crate::input::ContentTypeParametersInput,
         803  +
        ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
         804  +
    >;
         805  +
         806  +
    fn poll(
         807  +
        self: std::pin::Pin<&mut Self>,
         808  +
        cx: &mut std::task::Context<'_>,
         809  +
    ) -> std::task::Poll<Self::Output> {
         810  +
        let this = self.project();
         811  +
        this.inner.as_mut().poll(cx)
         812  +
    }
         813  +
}
         814  +
         815  +
impl<B>
         816  +
    ::aws_smithy_http_server::request::FromRequest<
         817  +
        ::aws_smithy_http_server::protocol::aws_json_10::AwsJson1_0,
         818  +
        B,
         819  +
    > for crate::input::ContentTypeParametersInput
         820  +
where
         821  +
    B: ::aws_smithy_http_server::body::HttpBody + Send,
         822  +
    B: 'static,
         823  +
         824  +
    B::Data: Send,
         825  +
    ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
         826  +
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
         827  +
{
         828  +
    type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
         829  +
    type Future = ContentTypeParametersInputFuture;
         830  +
         831  +
    fn from_request(request: ::http::Request<B>) -> Self::Future {
         832  +
        let fut = async move {
         833  +
            if !::aws_smithy_http_server::protocol::accept_header_classifier(
         834  +
                request.headers(),
         835  +
                &CONTENT_TYPE_CONTENTTYPEPARAMETERS,
         836  +
            ) {
         837  +
                return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
         838  +
            }
         839  +
            crate::protocol_serde::shape_content_type_parameters::de_content_type_parameters_http_request(request)
         840  +
                            .await
         841  +
                            .map_err(Into::into)
         842  +
        };
         843  +
        use ::futures_util::future::TryFutureExt;
         844  +
        let fut = fut.map_err(
         845  +
            |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
         846  +
                ::tracing::debug!(error = %e, "failed to deserialize request");
         847  +
                ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
         848  +
            },
         849  +
        );
         850  +
        ContentTypeParametersInputFuture {
         851  +
            inner: Box::pin(fut),
         852  +
        }
         853  +
    }
         854  +
}
         855  +
impl
         856  +
    ::aws_smithy_http_server::response::IntoResponse<
         857  +
        ::aws_smithy_http_server::protocol::aws_json_10::AwsJson1_0,
         858  +
    > for crate::output::ContentTypeParametersOutput
         859  +
{
         860  +
    fn into_response(self) -> ::aws_smithy_http_server::response::Response {
         861  +
        match crate::protocol_serde::shape_content_type_parameters::ser_content_type_parameters_http_response(self) {
         862  +
                        Ok(response) => response,
         863  +
                        Err(e) => {
         864  +
                            ::tracing::error!(error = %e, "failed to serialize response");
         865  +
                            ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_10::AwsJson1_0>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
         866  +
                        }
         867  +
                    }
         868  +
    }
         869  +
}
         870  +
         871  +
#[allow(unreachable_code, unused_variables)]
         872  +
#[cfg(test)]
         873  +
mod content_type_parameters_test {
         874  +
         875  +
    /// A server should ignore parameters added to the content type
         876  +
    /// Test ID: AwsJson10MustSupportParametersInContentType
         877  +
    #[::tokio::test]
         878  +
    #[::tracing_test::traced_test]
         879  +
    async fn aws_json10_must_support_parameters_in_content_type_request() {
         880  +
        #[allow(unused_mut)]
         881  +
        let mut http_request = http::Request::builder()
         882  +
            .uri("/")
         883  +
            .method("POST")
         884  +
            .header("Content-Type", "application/x-amz-json-1.0; charset=utf-8")
         885  +
            .header("X-Amz-Target", "JsonRpc10.ContentTypeParameters")
         886  +
            .body(::aws_smithy_http_server::body::Body::from(
         887  +
                ::bytes::Bytes::from_static("{\"value\":5}".as_bytes()),
         888  +
            ))
         889  +
            .unwrap();
         890  +
        #[allow(unused_mut)]
         891  +
        let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
         892  +
        let config = crate::service::JsonRpc10Config::builder().build();
         893  +
        let service = crate::service::JsonRpc10::builder::<::hyper::body::Body, _, _, _>(config)
         894  +
            .content_type_parameters(move |input: crate::input::ContentTypeParametersInput| {
         895  +
                let sender = sender.clone();
         896  +
                async move {
         897  +
                    let result = {
         898  +
                        let expected = crate::input::ContentTypeParametersInput {
         899  +
                            value: ::std::option::Option::Some(5),
         900  +
                        };
         901  +
                        ::pretty_assertions::assert_eq!(input, expected);
         902  +
                        let response = crate::output::ContentTypeParametersOutput {};
         903  +
                        response
         904  +
                    };
         905  +
                    sender.send(()).await.expect("receiver dropped early");
         906  +
                    result
         907  +
                }
         908  +
            })
         909  +
            .build_unchecked();
         910  +
        let http_response = ::tower::ServiceExt::oneshot(service, http_request)
         911  +
            .await
         912  +
            .expect("unable to make an HTTP request");
         913  +
        assert!(
         914  +
            receiver.recv().await.is_some(),
         915  +
            "we expected operation handler to be invoked but it was not entered"
         916  +
        );
         917  +
    }
         918  +
}
         919  +
  786    920   
static CONTENT_TYPE_PUTWITHCONTENTENCODING: ::once_cell::sync::Lazy<::mime::Mime> =
  787    921   
    ::once_cell::sync::Lazy::new(|| {
  788    922   
        "application/x-amz-json-1.0"
  789    923   
            .parse::<::mime::Mime>()
  790    924   
            .expect("BUG: MIME parsing failed, content_type is not valid")
  791    925   
    });
  792    926   
::pin_project_lite::pin_project! {
  793    927   
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
  794    928   
    /// [`PutWithContentEncodingInput`](crate::input::PutWithContentEncodingInput) using modelled bindings.
  795    929   
    pub struct PutWithContentEncodingInputFuture {

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

@@ -63,63 +122,151 @@
   83     83   
   84     84   
    fn request_fmt() -> Self::RequestFmt {
   85     85   
        ::aws_smithy_http_server::instrumentation::sensitivity::RequestFmt::new()
   86     86   
    }
   87     87   
   88     88   
    fn response_fmt() -> Self::ResponseFmt {
   89     89   
        ::aws_smithy_http_server::instrumentation::sensitivity::ResponseFmt::new()
   90     90   
    }
   91     91   
}
   92     92   
          93  +
/// The example tests how servers must support requests containing a `Content-Type` header with parameters.
          94  +
pub struct ContentTypeParameters;
          95  +
          96  +
impl ::aws_smithy_http_server::operation::OperationShape for ContentTypeParameters {
          97  +
    const ID: ::aws_smithy_http_server::shape_id::ShapeId =
          98  +
        ::aws_smithy_http_server::shape_id::ShapeId::new(
          99  +
            "aws.protocoltests.json10#ContentTypeParameters",
         100  +
            "aws.protocoltests.json10",
         101  +
            "ContentTypeParameters",
         102  +
        );
         103  +
         104  +
    type Input = crate::input::ContentTypeParametersInput;
         105  +
    type Output = crate::output::ContentTypeParametersOutput;
         106  +
    type Error = std::convert::Infallible;
         107  +
}
         108  +
         109  +
impl ::aws_smithy_http_server::instrumentation::sensitivity::Sensitivity for ContentTypeParameters {
         110  +
    type RequestFmt = ::aws_smithy_http_server::instrumentation::sensitivity::DefaultRequestFmt;
         111  +
    type ResponseFmt = ::aws_smithy_http_server::instrumentation::sensitivity::DefaultResponseFmt;
         112  +
         113  +
    fn request_fmt() -> Self::RequestFmt {
         114  +
        ::aws_smithy_http_server::instrumentation::sensitivity::RequestFmt::new()
         115  +
    }
         116  +
         117  +
    fn response_fmt() -> Self::ResponseFmt {
         118  +
        ::aws_smithy_http_server::instrumentation::sensitivity::ResponseFmt::new()
         119  +
    }
         120  +
}
         121  +
   93    122   
#[allow(missing_docs)] // documentation missing in model
   94    123   
pub struct PutWithContentEncoding;
   95    124   
   96    125   
impl ::aws_smithy_http_server::operation::OperationShape for PutWithContentEncoding {
   97    126   
    const ID: ::aws_smithy_http_server::shape_id::ShapeId =
   98    127   
        ::aws_smithy_http_server::shape_id::ShapeId::new(
   99    128   
            "aws.protocoltests.json10#PutWithContentEncoding",
  100    129   
            "aws.protocoltests.json10",
  101    130   
            "PutWithContentEncoding",
  102    131   
        );

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

@@ -281,281 +340,352 @@
  301    301   
        self.zero_double
  302    302   
    }
  303    303   
}
  304    304   
impl OperationWithDefaultsOutput {
  305    305   
    /// Creates a new builder-style object to manufacture [`OperationWithDefaultsOutput`](crate::output::OperationWithDefaultsOutput).
  306    306   
    pub fn builder() -> crate::output::operation_with_defaults_output::Builder {
  307    307   
        crate::output::operation_with_defaults_output::Builder::default()
  308    308   
    }
  309    309   
}
  310    310   
         311  +
#[allow(missing_docs)] // documentation missing in model
         312  +
#[derive(
         313  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         314  +
)]
         315  +
pub struct ContentTypeParametersOutput {}
         316  +
impl ContentTypeParametersOutput {
         317  +
    /// Creates a new builder-style object to manufacture [`ContentTypeParametersOutput`](crate::output::ContentTypeParametersOutput).
         318  +
    pub fn builder() -> crate::output::content_type_parameters_output::Builder {
         319  +
        crate::output::content_type_parameters_output::Builder::default()
         320  +
    }
         321  +
}
         322  +
  311    323   
#[allow(missing_docs)] // documentation missing in model
  312    324   
#[derive(
  313    325   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  314    326   
)]
  315    327   
pub struct PutWithContentEncodingOutput {}
  316    328   
impl PutWithContentEncodingOutput {
  317    329   
    /// Creates a new builder-style object to manufacture [`PutWithContentEncodingOutput`](crate::output::PutWithContentEncodingOutput).
  318    330   
    pub fn builder() -> crate::output::put_with_content_encoding_output::Builder {
  319    331   
        crate::output::put_with_content_encoding_output::Builder::default()
  320    332   
    }
@@ -974,986 +1033,1067 @@
  994   1006   
                zero_byte: self.zero_byte.unwrap_or(0i8),
  995   1007   
                zero_short: self.zero_short.unwrap_or(0i16),
  996   1008   
                zero_integer: self.zero_integer.unwrap_or(0i32),
  997   1009   
                zero_long: self.zero_long.unwrap_or(0i64),
  998   1010   
                zero_float: self.zero_float.unwrap_or(0.0f32),
  999   1011   
                zero_double: self.zero_double.unwrap_or(0.0f64),
 1000   1012   
            }
 1001   1013   
        }
 1002   1014   
    }
 1003   1015   
}
        1016  +
/// See [`ContentTypeParametersOutput`](crate::output::ContentTypeParametersOutput).
        1017  +
///
        1018  +
pub mod content_type_parameters_output {
        1019  +
        1020  +
    impl ::std::convert::From<Builder> for crate::output::ContentTypeParametersOutput {
        1021  +
        fn from(builder: Builder) -> Self {
        1022  +
            builder.build()
        1023  +
        }
        1024  +
    }
        1025  +
    /// A builder for [`ContentTypeParametersOutput`](crate::output::ContentTypeParametersOutput).
        1026  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        1027  +
    pub struct Builder {}
        1028  +
    impl Builder {
        1029  +
        /// Consumes the builder and constructs a [`ContentTypeParametersOutput`](crate::output::ContentTypeParametersOutput).
        1030  +
        pub fn build(self) -> crate::output::ContentTypeParametersOutput {
        1031  +
            self.build_enforcing_all_constraints()
        1032  +
        }
        1033  +
        fn build_enforcing_all_constraints(self) -> crate::output::ContentTypeParametersOutput {
        1034  +
            crate::output::ContentTypeParametersOutput {}
        1035  +
        }
        1036  +
    }
        1037  +
}
 1004   1038   
/// See [`PutWithContentEncodingOutput`](crate::output::PutWithContentEncodingOutput).
 1005   1039   
///
 1006   1040   
pub mod put_with_content_encoding_output {
 1007   1041   
 1008   1042   
    impl ::std::convert::From<Builder> for crate::output::PutWithContentEncodingOutput {
 1009   1043   
        fn from(builder: Builder) -> Self {
 1010   1044   
            builder.build()
 1011   1045   
        }
 1012   1046   
    }
 1013   1047   
    /// A builder for [`PutWithContentEncodingOutput`](crate::output::PutWithContentEncodingOutput).

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

@@ -1,1 +69,73 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) mod shape_content_type_parameters;
           3  +
    2      4   
pub(crate) mod shape_empty_input_and_empty_output;
    3      5   
    4      6   
pub(crate) mod shape_endpoint_operation;
    5      7   
    6      8   
pub(crate) mod shape_endpoint_with_host_label_operation;
    7      9   
    8     10   
pub(crate) mod shape_greeting_with_errors;
    9     11   
   10     12   
pub(crate) mod shape_host_with_path_operation;
   11     13   
   12     14   
pub(crate) mod shape_json_unions;
   13     15   
   14     16   
pub(crate) mod shape_no_input_and_no_output;
   15     17   
   16     18   
pub(crate) mod shape_no_input_and_output;
   17     19   
   18     20   
pub(crate) mod shape_operation_with_defaults;
   19     21   
   20     22   
pub(crate) mod shape_operation_with_nested_structure;
   21     23   
   22     24   
pub(crate) mod shape_operation_with_required_members;
   23     25   
   24     26   
pub(crate) mod shape_put_with_content_encoding;
   25     27   
   26     28   
pub(crate) mod shape_simple_scalar_properties;
   27     29   
   28     30   
pub(crate) mod shape_complex_error;
   29     31   
   30         -
pub(crate) mod shape_empty_input_and_empty_output_output;
   31         -
   32     32   
pub(crate) fn or_empty_doc(data: &[u8]) -> &[u8] {
   33     33   
    if data.is_empty() {
   34     34   
        b"{}"
   35     35   
    } else {
   36     36   
        data
   37     37   
    }
   38     38   
}
   39     39   
          40  +
pub(crate) mod shape_content_type_parameters_output;
          41  +
          42  +
pub(crate) mod shape_empty_input_and_empty_output_output;
          43  +
   40     44   
pub(crate) mod shape_foo_error;
   41     45   
   42     46   
pub(crate) mod shape_greeting_with_errors_output;
   43     47   
   44     48   
pub(crate) mod shape_invalid_greeting;
   45     49   
   46     50   
pub(crate) mod shape_json_unions_output;
   47     51   
   48     52   
pub(crate) mod shape_no_input_and_output_output;
   49     53   

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

Renamed from tmp-codegen-diff/codegen-server-test/rest_xml_extras/rust-server-codegen/src/protocol_serde/shape_content_type_parameters.rs

@@ -1,1 +103,116 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(clippy::unnecessary_wraps)]
    3      3   
pub async fn de_content_type_parameters_http_request<B>(
    4      4   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::ContentTypeParametersInput,
    7         -
    ::aws_smithy_http_server::protocol::rest_xml::rejection::RequestRejection,
           7  +
    ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection,
    8      8   
>
    9      9   
where
   10     10   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     11   
    B::Data: Send,
   12         -
    ::aws_smithy_http_server::protocol::rest_xml::rejection::RequestRejection:
          12  +
    ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
   13     13   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     14   
{
   15     15   
    Ok({
   16     16   
        #[allow(unused_mut)]
   17     17   
        let mut input = crate::input::content_type_parameters_input::Builder::default();
   18     18   
        #[allow(unused_variables)]
   19     19   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     20   
            uri, headers, body, ..
   21     21   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   22     22   
        let bytes = ::hyper::body::to_bytes(body).await?;
   23     23   
        if !bytes.is_empty() {
   24     24   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     25   
                &headers,
   26         -
                Some("application/xml"),
          26  +
                Some("application/x-amz-json-1.0"),
   27     27   
            )?;
   28     28   
            input =
   29     29   
                crate::protocol_serde::shape_content_type_parameters::de_content_type_parameters(
   30     30   
                    bytes.as_ref(),
   31     31   
                    input,
   32     32   
                )?;
   33     33   
        }
   34     34   
        input.build()
   35     35   
    })
   36     36   
}
   37     37   
   38     38   
#[allow(clippy::unnecessary_wraps)]
   39     39   
pub fn ser_content_type_parameters_http_response(
   40     40   
    #[allow(unused_variables)] output: crate::output::ContentTypeParametersOutput,
   41     41   
) -> std::result::Result<
   42     42   
    ::aws_smithy_http_server::response::Response,
   43         -
    ::aws_smithy_http_server::protocol::rest_xml::rejection::ResponseRejection,
          43  +
    ::aws_smithy_http_server::protocol::aws_json::rejection::ResponseRejection,
   44     44   
> {
   45     45   
    Ok({
   46     46   
        #[allow(unused_mut)]
   47     47   
        let mut builder = ::http::Response::builder();
          48  +
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          49  +
            builder,
          50  +
            ::http::header::CONTENT_TYPE,
          51  +
            "application/x-amz-json-1.0",
          52  +
        );
   48     53   
        let http_status: u16 = 200;
   49     54   
        builder = builder.status(http_status);
   50         -
        let payload = "";
          55  +
        let payload =
          56  +
            crate::protocol_serde::shape_content_type_parameters_output::ser_content_type_parameters_output_output_output(&output)?
          57  +
        ;
   51     58   
        let content_length = payload.len();
   52     59   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   53     60   
            builder,
   54     61   
            ::http::header::CONTENT_LENGTH,
   55     62   
            content_length,
   56     63   
        );
   57     64   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
   58     65   
        builder.body(body)?
   59     66   
    })
   60     67   
}
   61     68   
   62         -
#[allow(unused_mut)]
   63         -
pub fn de_content_type_parameters(
   64         -
    inp: &[u8],
          69  +
pub(crate) fn de_content_type_parameters(
          70  +
    value: &[u8],
   65     71   
    mut builder: crate::input::content_type_parameters_input::Builder,
   66     72   
) -> Result<
   67     73   
    crate::input::content_type_parameters_input::Builder,
   68         -
    ::aws_smithy_xml::decode::XmlDecodeError,
          74  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
   69     75   
> {
   70         -
    let mut doc = ::aws_smithy_xml::decode::Document::try_from(inp)?;
   71         -
   72         -
    #[allow(unused_mut)]
   73         -
    let mut decoder = doc.root_element()?;
   74         -
    let start_el = decoder.start_el();
   75         -
    if !start_el.matches("ContentTypeParametersInput") {
   76         -
        return Err(
   77         -
                                ::aws_smithy_xml::decode::XmlDecodeError::custom(
   78         -
                                    format!("encountered invalid XML root: expected ContentTypeParametersInput but got {:?}. This is likely a bug in the SDK.", start_el)
   79         -
                                )
          76  +
    let mut tokens_owned =
          77  +
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
          78  +
            .peekable();
          79  +
    let tokens = &mut tokens_owned;
          80  +
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
          81  +
    loop {
          82  +
        match tokens.next().transpose()? {
          83  +
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          84  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          85  +
                match key.to_unescaped()?.as_ref() {
          86  +
                    "value" => {
          87  +
                        builder = builder.set_value(
          88  +
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
          89  +
                                tokens.next(),
          90  +
                            )?
          91  +
                            .map(i32::try_from)
          92  +
                            .transpose()?,
   80     93   
                        );
   81     94   
                    }
   82         -
    while let Some(mut tag) = decoder.next_tag() {
   83         -
        match tag.start_el() {
   84         -
            s if s.matches("value") /* value aws.protocoltests.restxml.synthetic#ContentTypeParametersInput$value */ =>  {
   85         -
                let var_1 =
   86         -
                    Some(
   87         -
                         {
   88         -
                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
   89         -
                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
   90         -
                            )
   91         -
                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `smithy.api#Integer`)"))
          95  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          96  +
                }
   92     97   
            }
   93         -
                        ?
          98  +
            other => {
          99  +
                return Err(
         100  +
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
         101  +
                        "expected object key or end object, found: {:?}",
         102  +
                        other
         103  +
                    )),
   94    104   
                )
   95         -
                ;
   96         -
                builder = builder.set_value(var_1);
   97    105   
            }
   98         -
            ,
   99         -
            _ => {}
  100    106   
        }
  101    107   
    }
         108  +
    if tokens.next().is_some() {
         109  +
        return Err(
         110  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         111  +
                "found more JSON tokens after completing parsing",
         112  +
            ),
         113  +
        );
         114  +
    }
  102    115   
    Ok(builder)
  103    116   
}

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

@@ -0,1 +0,17 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_content_type_parameters_output_output_output(
           3  +
    value: &crate::output::ContentTypeParametersOutput,
           4  +
) -> Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           5  +
    let mut out = String::new();
           6  +
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           7  +
    crate::protocol_serde::shape_content_type_parameters_output::ser_content_type_parameters_output_output(&mut object, value)?;
           8  +
    object.finish();
           9  +
    Ok(out)
          10  +
}
          11  +
          12  +
pub fn ser_content_type_parameters_output_output(
          13  +
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          14  +
    #[allow(unused_variables)] input: &crate::output::ContentTypeParametersOutput,
          15  +
) -> Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          16  +
    Ok(())
          17  +
}

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

@@ -1,1 +54,205 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/// The service builder for [`JsonRpc10`].
    3      3   
///
    4      4   
/// Constructed via [`JsonRpc10::builder`].
    5      5   
pub struct JsonRpc10Builder<Body, L, HttpPl, ModelPl> {
           6  +
    content_type_parameters: Option<::aws_smithy_http_server::routing::Route<Body>>,
    6      7   
    empty_input_and_empty_output: Option<::aws_smithy_http_server::routing::Route<Body>>,
    7      8   
    endpoint_operation: Option<::aws_smithy_http_server::routing::Route<Body>>,
    8      9   
    endpoint_with_host_label_operation: Option<::aws_smithy_http_server::routing::Route<Body>>,
    9     10   
    greeting_with_errors: Option<::aws_smithy_http_server::routing::Route<Body>>,
   10     11   
    host_with_path_operation: Option<::aws_smithy_http_server::routing::Route<Body>>,
   11     12   
    json_unions: Option<::aws_smithy_http_server::routing::Route<Body>>,
   12     13   
    no_input_and_no_output: Option<::aws_smithy_http_server::routing::Route<Body>>,
   13     14   
    no_input_and_output: Option<::aws_smithy_http_server::routing::Route<Body>>,
   14     15   
    operation_with_defaults: Option<::aws_smithy_http_server::routing::Route<Body>>,
   15     16   
    operation_with_nested_structure: Option<::aws_smithy_http_server::routing::Route<Body>>,
   16     17   
    operation_with_required_members: Option<::aws_smithy_http_server::routing::Route<Body>>,
   17     18   
    put_with_content_encoding: Option<::aws_smithy_http_server::routing::Route<Body>>,
   18     19   
    simple_scalar_properties: Option<::aws_smithy_http_server::routing::Route<Body>>,
   19     20   
    layer: L,
   20     21   
    http_plugin: HttpPl,
   21     22   
    model_plugin: ModelPl,
   22     23   
}
   23     24   
   24     25   
impl<Body, L, HttpPl, ModelPl> JsonRpc10Builder<Body, L, HttpPl, ModelPl> {
          26  +
    /// Sets the [`ContentTypeParameters`](crate::operation_shape::ContentTypeParameters) operation.
          27  +
    ///
          28  +
    /// This should be an async function satisfying the [`Handler`](::aws_smithy_http_server::operation::Handler) trait.
          29  +
    /// See the [operation module documentation](::aws_smithy_http_server::operation) for more information.
          30  +
    ///
          31  +
    /// # Example
          32  +
    ///
          33  +
    /// ```no_run
          34  +
    /// use json_rpc10::{JsonRpc10, JsonRpc10Config};
          35  +
    ///
          36  +
    /// use json_rpc10::{input, output, error};
          37  +
    ///
          38  +
    /// async fn handler(input: input::ContentTypeParametersInput) -> output::ContentTypeParametersOutput {
          39  +
    ///     todo!()
          40  +
    /// }
          41  +
    ///
          42  +
    /// let config = JsonRpc10Config::builder().build();
          43  +
    /// let app = JsonRpc10::builder(config)
          44  +
    ///     .content_type_parameters(handler)
          45  +
    ///     /* Set other handlers */
          46  +
    ///     .build()
          47  +
    ///     .unwrap();
          48  +
    /// # let app: JsonRpc10<::aws_smithy_http_server::routing::RoutingService<::aws_smithy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_http_server::routing::Route>, ::aws_smithy_http_server::protocol::aws_json_10::AwsJson1_0>> = app;
          49  +
    /// ```
          50  +
    ///
          51  +
                    pub fn content_type_parameters<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
          52  +
                    where
          53  +
                        HandlerType: ::aws_smithy_http_server::operation::Handler<crate::operation_shape::ContentTypeParameters, HandlerExtractors>,
          54  +
          55  +
                        ModelPl: ::aws_smithy_http_server::plugin::Plugin<
          56  +
                            JsonRpc10<L>,
          57  +
                            crate::operation_shape::ContentTypeParameters,
          58  +
                            ::aws_smithy_http_server::operation::IntoService<crate::operation_shape::ContentTypeParameters, HandlerType>
          59  +
                        >,
          60  +
                        ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_http_server::plugin::Plugin<
          61  +
                            JsonRpc10<L>,
          62  +
                            crate::operation_shape::ContentTypeParameters,
          63  +
                            ModelPl::Output
          64  +
                        >,
          65  +
                        HttpPl: ::aws_smithy_http_server::plugin::Plugin<
          66  +
                            JsonRpc10<L>,
          67  +
                            crate::operation_shape::ContentTypeParameters,
          68  +
                            <
          69  +
                                ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
          70  +
                                as ::aws_smithy_http_server::plugin::Plugin<
          71  +
                                    JsonRpc10<L>,
          72  +
                                    crate::operation_shape::ContentTypeParameters,
          73  +
                                    ModelPl::Output
          74  +
                                >
          75  +
                            >::Output
          76  +
                        >,
          77  +
          78  +
                        HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
          79  +
                        <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
          80  +
          81  +
                    {
          82  +
        use ::aws_smithy_http_server::operation::OperationShapeExt;
          83  +
        use ::aws_smithy_http_server::plugin::Plugin;
          84  +
        let svc = crate::operation_shape::ContentTypeParameters::from_handler(handler);
          85  +
        let svc = self.model_plugin.apply(svc);
          86  +
        let svc = ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
          87  +
            .apply(svc);
          88  +
        let svc = self.http_plugin.apply(svc);
          89  +
        self.content_type_parameters_custom(svc)
          90  +
    }
          91  +
          92  +
    /// Sets the [`ContentTypeParameters`](crate::operation_shape::ContentTypeParameters) operation.
          93  +
    ///
          94  +
    /// This should be an async function satisfying the [`Handler`](::aws_smithy_http_server::operation::Handler) trait.
          95  +
    /// See the [operation module documentation](::aws_smithy_http_server::operation) for more information.
          96  +
    ///
          97  +
    /// # Example
          98  +
    ///
          99  +
    /// ```no_run
         100  +
    /// use json_rpc10::{JsonRpc10, JsonRpc10Config};
         101  +
    ///
         102  +
    /// use json_rpc10::{input, output, error};
         103  +
    ///
         104  +
    /// async fn handler(input: input::ContentTypeParametersInput) -> Result<output::ContentTypeParametersOutput, std::convert::Infallible> {
         105  +
    ///     todo!()
         106  +
    /// }
         107  +
    ///
         108  +
    /// let config = JsonRpc10Config::builder().build();
         109  +
    /// let svc = ::tower::util::service_fn(handler);
         110  +
    /// let app = JsonRpc10::builder(config)
         111  +
    ///     .content_type_parameters_service(svc)
         112  +
    ///     /* Set other handlers */
         113  +
    ///     .build()
         114  +
    ///     .unwrap();
         115  +
    /// # let app: JsonRpc10<::aws_smithy_http_server::routing::RoutingService<::aws_smithy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_http_server::routing::Route>, ::aws_smithy_http_server::protocol::aws_json_10::AwsJson1_0>> = app;
         116  +
    /// ```
         117  +
    ///
         118  +
                    pub fn content_type_parameters_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
         119  +
                    where
         120  +
                        S: ::aws_smithy_http_server::operation::OperationService<crate::operation_shape::ContentTypeParameters, ServiceExtractors>,
         121  +
         122  +
                        ModelPl: ::aws_smithy_http_server::plugin::Plugin<
         123  +
                            JsonRpc10<L>,
         124  +
                            crate::operation_shape::ContentTypeParameters,
         125  +
                            ::aws_smithy_http_server::operation::Normalize<crate::operation_shape::ContentTypeParameters, S>
         126  +
                        >,
         127  +
                        ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_http_server::plugin::Plugin<
         128  +
                            JsonRpc10<L>,
         129  +
                            crate::operation_shape::ContentTypeParameters,
         130  +
                            ModelPl::Output
         131  +
                        >,
         132  +
                        HttpPl: ::aws_smithy_http_server::plugin::Plugin<
         133  +
                            JsonRpc10<L>,
         134  +
                            crate::operation_shape::ContentTypeParameters,
         135  +
                            <
         136  +
                                ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
         137  +
                                as ::aws_smithy_http_server::plugin::Plugin<
         138  +
                                    JsonRpc10<L>,
         139  +
                                    crate::operation_shape::ContentTypeParameters,
         140  +
                                    ModelPl::Output
         141  +
                                >
         142  +
                            >::Output
         143  +
                        >,
         144  +
         145  +
                        HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
         146  +
                        <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
         147  +
         148  +
                    {
         149  +
        use ::aws_smithy_http_server::operation::OperationShapeExt;
         150  +
        use ::aws_smithy_http_server::plugin::Plugin;
         151  +
        let svc = crate::operation_shape::ContentTypeParameters::from_service(service);
         152  +
        let svc = self.model_plugin.apply(svc);
         153  +
        let svc = ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
         154  +
            .apply(svc);
         155  +
        let svc = self.http_plugin.apply(svc);
         156  +
        self.content_type_parameters_custom(svc)
         157  +
    }
         158  +
         159  +
    /// Sets the [`ContentTypeParameters`](crate::operation_shape::ContentTypeParameters) to a custom [`Service`](tower::Service).
         160  +
    /// not constrained by the Smithy contract.
         161  +
    fn content_type_parameters_custom<S>(mut self, svc: S) -> Self
         162  +
    where
         163  +
        S: ::tower::Service<
         164  +
                ::http::Request<Body>,
         165  +
                Response = ::http::Response<::aws_smithy_http_server::body::BoxBody>,
         166  +
                Error = ::std::convert::Infallible,
         167  +
            > + Clone
         168  +
            + Send
         169  +
            + 'static,
         170  +
        S::Future: Send + 'static,
         171  +
    {
         172  +
        self.content_type_parameters = Some(::aws_smithy_http_server::routing::Route::new(svc));
         173  +
        self
         174  +
    }
         175  +
   25    176   
    /// Sets the [`EmptyInputAndEmptyOutput`](crate::operation_shape::EmptyInputAndEmptyOutput) operation.
   26    177   
    ///
   27    178   
    /// This should be an async function satisfying the [`Handler`](::aws_smithy_http_server::operation::Handler) trait.
   28    179   
    /// See the [operation module documentation](::aws_smithy_http_server::operation) for more information.
   29    180   
    ///
   30    181   
    /// # Example
   31    182   
    ///
   32    183   
    /// ```no_run
   33    184   
    /// use json_rpc10::{JsonRpc10, JsonRpc10Config};
   34    185   
    ///
@@ -1974,2125 +2033,2190 @@
 1994   2145   
            >,
 1995   2146   
        >,
 1996   2147   
        MissingOperationsError,
 1997   2148   
    >
 1998   2149   
    where
 1999   2150   
        L: ::tower::Layer<::aws_smithy_http_server::routing::Route<Body>>,
 2000   2151   
    {
 2001   2152   
        let router = {
 2002   2153   
            use ::aws_smithy_http_server::operation::OperationShape;
 2003   2154   
            let mut missing_operation_names = std::collections::HashMap::new();
        2155  +
            if self.content_type_parameters.is_none() {
        2156  +
                missing_operation_names.insert(
        2157  +
                    crate::operation_shape::ContentTypeParameters::ID,
        2158  +
                    ".content_type_parameters()",
        2159  +
                );
        2160  +
            }
 2004   2161   
            if self.empty_input_and_empty_output.is_none() {
 2005   2162   
                missing_operation_names.insert(
 2006   2163   
                    crate::operation_shape::EmptyInputAndEmptyOutput::ID,
 2007   2164   
                    ".empty_input_and_empty_output()",
 2008   2165   
                );
 2009   2166   
            }
 2010   2167   
            if self.endpoint_operation.is_none() {
 2011   2168   
                missing_operation_names.insert(
 2012   2169   
                    crate::operation_shape::EndpointOperation::ID,
 2013   2170   
                    ".endpoint_operation()",
@@ -2058,2215 +2117,2278 @@
 2078   2235   
                );
 2079   2236   
            }
 2080   2237   
            if !missing_operation_names.is_empty() {
 2081   2238   
                return Err(MissingOperationsError {
 2082   2239   
                    operation_names2setter_methods: missing_operation_names,
 2083   2240   
                });
 2084   2241   
            }
 2085   2242   
            let unexpected_error_msg = "this should never panic since we are supposed to check beforehand that a handler has been registered for this operation; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues";
 2086   2243   
 2087   2244   
            ::aws_smithy_http_server::protocol::aws_json::router::AwsJsonRouter::from_iter([
        2245  +
                (
        2246  +
                    request_specs::content_type_parameters(),
        2247  +
                    self.content_type_parameters.expect(unexpected_error_msg),
        2248  +
                ),
 2088   2249   
                (
 2089   2250   
                    request_specs::empty_input_and_empty_output(),
 2090   2251   
                    self.empty_input_and_empty_output
 2091   2252   
                        .expect(unexpected_error_msg),
 2092   2253   
                ),
 2093   2254   
                (
 2094   2255   
                    request_specs::endpoint_operation(),
 2095   2256   
                    self.endpoint_operation.expect(unexpected_error_msg),
 2096   2257   
                ),
 2097   2258   
                (
@@ -2140,2301 +2199,2369 @@
 2160   2321   
            ::aws_smithy_http_server::routing::RoutingService<
 2161   2322   
                ::aws_smithy_http_server::protocol::aws_json::router::AwsJsonRouter<
 2162   2323   
                    ::aws_smithy_http_server::routing::Route<Body>,
 2163   2324   
                >,
 2164   2325   
                ::aws_smithy_http_server::protocol::aws_json_10::AwsJson1_0,
 2165   2326   
            >,
 2166   2327   
        >,
 2167   2328   
    {
 2168   2329   
        let router =
 2169   2330   
            ::aws_smithy_http_server::protocol::aws_json::router::AwsJsonRouter::from_iter([
        2331  +
                (
        2332  +
                    request_specs::content_type_parameters(),
        2333  +
                    self.content_type_parameters.unwrap_or_else(|| {
        2334  +
                        let svc = ::aws_smithy_http_server::operation::MissingFailure::<
        2335  +
                            ::aws_smithy_http_server::protocol::aws_json_10::AwsJson1_0,
        2336  +
                        >::default();
        2337  +
                        ::aws_smithy_http_server::routing::Route::new(svc)
        2338  +
                    }),
        2339  +
                ),
 2170   2340   
                (
 2171   2341   
                    request_specs::empty_input_and_empty_output(),
 2172   2342   
                    self.empty_input_and_empty_output.unwrap_or_else(|| {
 2173   2343   
                        let svc = ::aws_smithy_http_server::operation::MissingFailure::<
 2174   2344   
                            ::aws_smithy_http_server::protocol::aws_json_10::AwsJson1_0,
 2175   2345   
                        >::default();
 2176   2346   
                        ::aws_smithy_http_server::routing::Route::new(svc)
 2177   2347   
                    }),
 2178   2348   
                ),
 2179   2349   
                (
@@ -2300,2470 +2359,2532 @@
 2320   2490   
        for setter_name in self.operation_names2setter_methods.values() {
 2321   2491   
            writeln!(f, "- {}", setter_name)?;
 2322   2492   
        }
 2323   2493   
        Ok(())
 2324   2494   
    }
 2325   2495   
}
 2326   2496   
 2327   2497   
impl std::error::Error for MissingOperationsError {}
 2328   2498   
 2329   2499   
mod request_specs {
        2500  +
    pub(super) fn content_type_parameters() -> ::std::string::String {
        2501  +
        String::from("JsonRpc10.ContentTypeParameters")
        2502  +
    }
 2330   2503   
    pub(super) fn empty_input_and_empty_output() -> ::std::string::String {
 2331   2504   
        String::from("JsonRpc10.EmptyInputAndEmptyOutput")
 2332   2505   
    }
 2333   2506   
    pub(super) fn endpoint_operation() -> ::std::string::String {
 2334   2507   
        String::from("JsonRpc10.EndpointOperation")
 2335   2508   
    }
 2336   2509   
    pub(super) fn endpoint_with_host_label_operation() -> ::std::string::String {
 2337   2510   
        String::from("JsonRpc10.EndpointWithHostLabelOperation")
 2338   2511   
    }
 2339   2512   
    pub(super) fn greeting_with_errors() -> ::std::string::String {
@@ -2370,2543 +2469,2644 @@
 2390   2563   
    /// to the operations in this service.
 2391   2564   
    pub fn builder<
 2392   2565   
        Body,
 2393   2566   
        L,
 2394   2567   
        HttpPl: ::aws_smithy_http_server::plugin::HttpMarker,
 2395   2568   
        ModelPl: ::aws_smithy_http_server::plugin::ModelMarker,
 2396   2569   
    >(
 2397   2570   
        config: JsonRpc10Config<L, HttpPl, ModelPl>,
 2398   2571   
    ) -> JsonRpc10Builder<Body, L, HttpPl, ModelPl> {
 2399   2572   
        JsonRpc10Builder {
        2573  +
            content_type_parameters: None,
 2400   2574   
            empty_input_and_empty_output: None,
 2401   2575   
            endpoint_operation: None,
 2402   2576   
            endpoint_with_host_label_operation: None,
 2403   2577   
            greeting_with_errors: None,
 2404   2578   
            host_with_path_operation: None,
 2405   2579   
            json_unions: None,
 2406   2580   
            no_input_and_no_output: None,
 2407   2581   
            no_input_and_output: None,
 2408   2582   
            operation_with_defaults: None,
 2409   2583   
            operation_with_nested_structure: None,
 2410   2584   
            operation_with_required_members: None,
 2411   2585   
            put_with_content_encoding: None,
 2412   2586   
            simple_scalar_properties: None,
 2413   2587   
            layer: config.layers,
 2414   2588   
            http_plugin: config.http_plugins,
 2415   2589   
            model_plugin: config.model_plugins,
 2416   2590   
        }
 2417   2591   
    }
 2418   2592   
 2419   2593   
    /// Constructs a builder for [`JsonRpc10`].
 2420   2594   
    /// You must specify what plugins should be applied to the operations in this service.
 2421   2595   
    ///
 2422   2596   
    /// Use [`JsonRpc10::builder_without_plugins`] if you don't need to apply plugins.
 2423   2597   
    ///
 2424   2598   
    /// Check out [`HttpPlugins`](::aws_smithy_http_server::plugin::HttpPlugins) and
 2425   2599   
    /// [`ModelPlugins`](::aws_smithy_http_server::plugin::ModelPlugins) if you need to apply
 2426   2600   
    /// multiple plugins.
 2427   2601   
    #[deprecated(
 2428   2602   
        since = "0.57.0",
 2429   2603   
        note = "please use the `builder` constructor and register plugins on the `JsonRpc10Config` object instead; see https://github.com/smithy-lang/smithy-rs/discussions/3096"
 2430   2604   
    )]
 2431   2605   
    pub fn builder_with_plugins<
 2432   2606   
        Body,
 2433   2607   
        HttpPl: ::aws_smithy_http_server::plugin::HttpMarker,
 2434   2608   
        ModelPl: ::aws_smithy_http_server::plugin::ModelMarker,
 2435   2609   
    >(
 2436   2610   
        http_plugin: HttpPl,
 2437   2611   
        model_plugin: ModelPl,
 2438   2612   
    ) -> JsonRpc10Builder<Body, ::tower::layer::util::Identity, HttpPl, ModelPl> {
 2439   2613   
        JsonRpc10Builder {
        2614  +
            content_type_parameters: None,
 2440   2615   
            empty_input_and_empty_output: None,
 2441   2616   
            endpoint_operation: None,
 2442   2617   
            endpoint_with_host_label_operation: None,
 2443   2618   
            greeting_with_errors: None,
 2444   2619   
            host_with_path_operation: None,
 2445   2620   
            json_unions: None,
 2446   2621   
            no_input_and_no_output: None,
 2447   2622   
            no_input_and_output: None,
 2448   2623   
            operation_with_defaults: None,
 2449   2624   
            operation_with_nested_structure: None,
@@ -2545,2720 +2623,2804 @@
 2565   2740   
 2566   2741   
    fn call(&mut self, request: R) -> Self::Future {
 2567   2742   
        self.svc.call(request)
 2568   2743   
    }
 2569   2744   
}
 2570   2745   
 2571   2746   
/// An enumeration of all [operations](https://smithy.io/2.0/spec/service-types.html#operation) in JsonRpc10.
 2572   2747   
#[allow(clippy::enum_variant_names)]
 2573   2748   
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
 2574   2749   
pub enum Operation {
        2750  +
    ContentTypeParameters,
 2575   2751   
    EmptyInputAndEmptyOutput,
 2576   2752   
    EndpointOperation,
 2577   2753   
    EndpointWithHostLabelOperation,
 2578   2754   
    GreetingWithErrors,
 2579   2755   
    HostWithPathOperation,
 2580   2756   
    JsonUnions,
 2581   2757   
    NoInputAndNoOutput,
 2582   2758   
    NoInputAndOutput,
 2583   2759   
    OperationWithDefaults,
 2584   2760   
    OperationWithNestedStructure,
 2585   2761   
    OperationWithRequiredMembers,
 2586   2762   
    PutWithContentEncoding,
 2587   2763   
    SimpleScalarProperties,
 2588   2764   
}
 2589   2765   
 2590   2766   
impl Operation {
 2591   2767   
    /// Returns the [operations](https://smithy.io/2.0/spec/service-types.html#operation) [`ShapeId`](::aws_smithy_http_server::shape_id::ShapeId).
 2592   2768   
    pub fn shape_id(&self) -> ::aws_smithy_http_server::shape_id::ShapeId {
 2593   2769   
        match self {
        2770  +
            Operation::ContentTypeParameters => ::aws_smithy_http_server::shape_id::ShapeId::new(
        2771  +
                "aws.protocoltests.json10#ContentTypeParameters",
        2772  +
                "aws.protocoltests.json10",
        2773  +
                "ContentTypeParameters",
        2774  +
            ),
 2594   2775   
            Operation::EmptyInputAndEmptyOutput => {
 2595   2776   
                ::aws_smithy_http_server::shape_id::ShapeId::new(
 2596   2777   
                    "aws.protocoltests.json10#EmptyInputAndEmptyOutput",
 2597   2778   
                    "aws.protocoltests.json10",
 2598   2779   
                    "EmptyInputAndEmptyOutput",
 2599   2780   
                )
 2600   2781   
            }
 2601   2782   
            Operation::EndpointOperation => ::aws_smithy_http_server::shape_id::ShapeId::new(
 2602   2783   
                "aws.protocoltests.json10#EndpointOperation",
 2603   2784   
                "aws.protocoltests.json10",
@@ -2640,2821 +2699,2887 @@
 2660   2841   
                "PutWithContentEncoding",
 2661   2842   
            ),
 2662   2843   
            Operation::SimpleScalarProperties => ::aws_smithy_http_server::shape_id::ShapeId::new(
 2663   2844   
                "aws.protocoltests.json10#SimpleScalarProperties",
 2664   2845   
                "aws.protocoltests.json10",
 2665   2846   
                "SimpleScalarProperties",
 2666   2847   
            ),
 2667   2848   
        }
 2668   2849   
    }
 2669   2850   
}
        2851  +
impl<L>
        2852  +
    ::aws_smithy_http_server::service::ContainsOperation<
        2853  +
        crate::operation_shape::ContentTypeParameters,
        2854  +
    > for JsonRpc10<L>
        2855  +
{
        2856  +
    const VALUE: Operation = Operation::ContentTypeParameters;
        2857  +
}
 2670   2858   
impl<L>
 2671   2859   
    ::aws_smithy_http_server::service::ContainsOperation<
 2672   2860   
        crate::operation_shape::EmptyInputAndEmptyOutput,
 2673   2861   
    > for JsonRpc10<L>
 2674   2862   
{
 2675   2863   
    const VALUE: Operation = Operation::EmptyInputAndEmptyOutput;
 2676   2864   
}
 2677   2865   
impl<L>
 2678   2866   
    ::aws_smithy_http_server::service::ContainsOperation<crate::operation_shape::EndpointOperation>
 2679   2867   
    for JsonRpc10<L>
@@ -2864,3052 +2967,3164 @@
 2884   3072   
}
 2885   3073   
/// A macro to help with scoping [plugins](::aws_smithy_http_server::plugin) to a subset of all operations.
 2886   3074   
///
 2887   3075   
/// In contrast to [`aws_smithy_http_server::scope`](::aws_smithy_http_server::scope), this macro has knowledge
 2888   3076   
/// of the service and any operations _not_ specified will be placed in the opposing group.
 2889   3077   
///
 2890   3078   
/// # Example
 2891   3079   
///
 2892   3080   
/// ```rust
 2893   3081   
/// scope! {
 2894         -
///     /// Includes [`EmptyInputAndEmptyOutput`], excluding all other operations.
        3082  +
///     /// Includes [`ContentTypeParameters`], excluding all other operations.
 2895   3083   
///     struct ScopeA {
 2896         -
///         includes: [EmptyInputAndEmptyOutput]
        3084  +
///         includes: [ContentTypeParameters]
 2897   3085   
///     }
 2898   3086   
/// }
 2899   3087   
///
 2900   3088   
/// scope! {
 2901         -
///     /// Excludes [`EmptyInputAndEmptyOutput`], excluding all other operations.
        3089  +
///     /// Excludes [`ContentTypeParameters`], excluding all other operations.
 2902   3090   
///     struct ScopeB {
 2903         -
///         excludes: [EmptyInputAndEmptyOutput]
        3091  +
///         excludes: [ContentTypeParameters]
 2904   3092   
///     }
 2905   3093   
/// }
 2906   3094   
///
 2907   3095   
/// # use ::aws_smithy_http_server::plugin::{Plugin, Scoped};
 2908   3096   
/// # use json_rpc10::scope;
 2909   3097   
/// # struct MockPlugin;
 2910   3098   
/// # impl<S, Op, T> Plugin<S, Op, T> for MockPlugin { type Output = u32; fn apply(&self, input: T) -> u32 { 3 } }
 2911   3099   
/// # let scoped_a = Scoped::new::<ScopeA>(MockPlugin);
 2912   3100   
/// # let scoped_b = Scoped::new::<ScopeB>(MockPlugin);
 2913         -
/// # let a = Plugin::<(), json_rpc10::operation_shape::EmptyInputAndEmptyOutput, u64>::apply(&scoped_a, 6);
 2914         -
/// # let b = Plugin::<(), json_rpc10::operation_shape::EmptyInputAndEmptyOutput, u64>::apply(&scoped_b, 6);
        3101  +
/// # let a = Plugin::<(), json_rpc10::operation_shape::ContentTypeParameters, u64>::apply(&scoped_a, 6);
        3102  +
/// # let b = Plugin::<(), json_rpc10::operation_shape::ContentTypeParameters, u64>::apply(&scoped_b, 6);
 2915   3103   
/// # assert_eq!(a, 3_u32);
 2916   3104   
/// # assert_eq!(b, 6_u64);
 2917   3105   
/// ```
 2918   3106   
#[macro_export]
 2919   3107   
macro_rules! scope {
 2920   3108   
                    // Completed, render impls
 2921   3109   
                    (@ $ name: ident, $ contains: ident () ($($ temp: ident)*) ($($ not_member: ident)*)) => {
 2922   3110   
                        $(
 2923   3111   
                            impl ::aws_smithy_http_server::plugin::scoped::Membership<$ temp> for $ name {
 2924   3112   
                                type Contains = ::aws_smithy_http_server::plugin::scoped::$ contains;
 2925   3113   
                            }
 2926   3114   
                        )*
 2927   3115   
                        $(
 2928   3116   
                            impl ::aws_smithy_http_server::plugin::scoped::Membership<$ not_member> for $ name {
 2929   3117   
                                type Contains = ::aws_smithy_http_server::plugin::scoped::$ contains;
 2930   3118   
                            }
 2931   3119   
                        )*
 2932   3120   
                    };
 2933   3121   
                    // All `not_member`s exhausted, move `temp` into `not_member`
 2934   3122   
                    (@ $ name: ident, $ contains: ident ($($ member: ident)*) ($($ temp: ident)*) ()) => {
 2935   3123   
                        scope! { @ $ name, $ contains ($($ member)*) () ($($ temp)*) }
 2936   3124   
                    };
 2937   3125   
        3126  +
                        // ContentTypeParameters match found, pop from both `member` and `not_member`
        3127  +
                        (@ $ name: ident, $ contains: ident (ContentTypeParameters $($ member: ident)*) ($($ temp: ident)*) (ContentTypeParameters $($ not_member: ident)*)) => {
        3128  +
                            scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
        3129  +
                        };
        3130  +
                        // ContentTypeParameters match not found, pop from `not_member` into `temp` stack
        3131  +
                        (@ $ name: ident, $ contains: ident (ContentTypeParameters $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
        3132  +
                            scope! { @ $ name, $ contains (ContentTypeParameters $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
        3133  +
                        };
        3134  +
 2938   3135   
                        // EmptyInputAndEmptyOutput match found, pop from both `member` and `not_member`
 2939   3136   
                        (@ $ name: ident, $ contains: ident (EmptyInputAndEmptyOutput $($ member: ident)*) ($($ temp: ident)*) (EmptyInputAndEmptyOutput $($ not_member: ident)*)) => {
 2940   3137   
                            scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
 2941   3138   
                        };
 2942   3139   
                        // EmptyInputAndEmptyOutput match not found, pop from `not_member` into `temp` stack
 2943   3140   
                        (@ $ name: ident, $ contains: ident (EmptyInputAndEmptyOutput $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
 2944   3141   
                            scope! { @ $ name, $ contains (EmptyInputAndEmptyOutput $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
 2945   3142   
                        };
 2946   3143   
 2947   3144   
                        // EndpointOperation match found, pop from both `member` and `not_member`
@@ -3039,3236 +3088,3285 @@
 3059   3256   
                        }
 3060   3257   
                    ) => {
 3061   3258   
                        use $ crate::operation_shape::*;
 3062   3259   
                        ::aws_smithy_http_server::scope! {
 3063   3260   
                            $(#[$ attrs])*
 3064   3261   
                            $ vis struct $ name {
 3065   3262   
                                includes: [$($ include),*],
 3066   3263   
                                excludes: []
 3067   3264   
                            }
 3068   3265   
                        }
 3069         -
                        scope! { @ $ name, False ($($ include)*) () (EmptyInputAndEmptyOutput EndpointOperation EndpointWithHostLabelOperation GreetingWithErrors HostWithPathOperation JsonUnions NoInputAndNoOutput NoInputAndOutput OperationWithDefaults OperationWithNestedStructure OperationWithRequiredMembers PutWithContentEncoding SimpleScalarProperties) }
        3266  +
                        scope! { @ $ name, False ($($ include)*) () (ContentTypeParameters EmptyInputAndEmptyOutput EndpointOperation EndpointWithHostLabelOperation GreetingWithErrors HostWithPathOperation JsonUnions NoInputAndNoOutput NoInputAndOutput OperationWithDefaults OperationWithNestedStructure OperationWithRequiredMembers PutWithContentEncoding SimpleScalarProperties) }
 3070   3267   
                    };
 3071   3268   
                    (
 3072   3269   
                        $(#[$ attrs:meta])*
 3073   3270   
                        $ vis:vis struct $ name:ident {
 3074   3271   
                            excludes: [$($ exclude:ident),*]
 3075   3272   
                        }
 3076   3273   
                    ) => {
 3077   3274   
                        use $ crate::operation_shape::*;
 3078   3275   
 3079   3276   
                        ::aws_smithy_http_server::scope! {
 3080   3277   
                            $(#[$ attrs])*
 3081   3278   
                            $ vis struct $ name {
 3082   3279   
                                includes: [],
 3083   3280   
                                excludes: [$($ exclude),*]
 3084   3281   
                            }
 3085   3282   
                        }
 3086         -
                        scope! { @ $ name, True ($($ exclude)*) () (EmptyInputAndEmptyOutput EndpointOperation EndpointWithHostLabelOperation GreetingWithErrors HostWithPathOperation JsonUnions NoInputAndNoOutput NoInputAndOutput OperationWithDefaults OperationWithNestedStructure OperationWithRequiredMembers PutWithContentEncoding SimpleScalarProperties) }
        3283  +
                        scope! { @ $ name, True ($($ exclude)*) () (ContentTypeParameters EmptyInputAndEmptyOutput EndpointOperation EndpointWithHostLabelOperation GreetingWithErrors HostWithPathOperation JsonUnions NoInputAndNoOutput NoInputAndOutput OperationWithDefaults OperationWithNestedStructure OperationWithRequiredMembers PutWithContentEncoding SimpleScalarProperties) }
 3087   3284   
                    };
 3088   3285   
                }

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

@@ -1,1 +31,55 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(missing_docs)] // documentation missing in model
           3  +
#[derive(
           4  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
           5  +
)]
           6  +
pub struct ContentTypeParametersInput {
           7  +
    #[allow(missing_docs)] // documentation missing in model
           8  +
    pub value: ::std::option::Option<i32>,
           9  +
}
          10  +
impl ContentTypeParametersInput {
          11  +
    #[allow(missing_docs)] // documentation missing in model
          12  +
    pub fn value(&self) -> ::std::option::Option<i32> {
          13  +
        self.value
          14  +
    }
          15  +
}
          16  +
impl ContentTypeParametersInput {
          17  +
    /// Creates a new builder-style object to manufacture [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput).
          18  +
    pub fn builder() -> crate::input::content_type_parameters_input::Builder {
          19  +
        crate::input::content_type_parameters_input::Builder::default()
          20  +
    }
          21  +
}
          22  +
impl crate::constrained::Constrained for crate::input::ContentTypeParametersInput {
          23  +
    type Unconstrained = crate::input::content_type_parameters_input::Builder;
          24  +
}
          25  +
    2     26   
#[allow(missing_docs)] // documentation missing in model
    3     27   
#[derive(
    4     28   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
    5     29   
)]
    6     30   
pub struct PutWithContentEncodingInput {
    7     31   
    #[allow(missing_docs)] // documentation missing in model
    8     32   
    pub encoding: ::std::option::Option<::std::string::String>,
    9     33   
    #[allow(missing_docs)] // documentation missing in model
   10     34   
    pub data: ::std::option::Option<::std::string::String>,
   11     35   
}
@@ -556,580 +615,673 @@
  576    600   
pub struct EmptyOperationInput {}
  577    601   
impl EmptyOperationInput {
  578    602   
    /// Creates a new builder-style object to manufacture [`EmptyOperationInput`](crate::input::EmptyOperationInput).
  579    603   
    pub fn builder() -> crate::input::empty_operation_input::Builder {
  580    604   
        crate::input::empty_operation_input::Builder::default()
  581    605   
    }
  582    606   
}
  583    607   
impl crate::constrained::Constrained for crate::input::EmptyOperationInput {
  584    608   
    type Unconstrained = crate::input::empty_operation_input::Builder;
  585    609   
}
         610  +
/// See [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput).
         611  +
///
         612  +
pub mod content_type_parameters_input {
         613  +
         614  +
    impl ::std::convert::From<Builder> for crate::input::ContentTypeParametersInput {
         615  +
        fn from(builder: Builder) -> Self {
         616  +
            builder.build()
         617  +
        }
         618  +
    }
         619  +
    /// A builder for [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput).
         620  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
         621  +
    pub struct Builder {
         622  +
        pub(crate) value: ::std::option::Option<i32>,
         623  +
    }
         624  +
    impl Builder {
         625  +
        #[allow(missing_docs)] // documentation missing in model
         626  +
        pub fn value(mut self, input: ::std::option::Option<i32>) -> Self {
         627  +
            self.value = input;
         628  +
            self
         629  +
        }
         630  +
        #[allow(missing_docs)] // documentation missing in model
         631  +
        pub(crate) fn set_value(mut self, input: Option<impl ::std::convert::Into<i32>>) -> Self {
         632  +
            self.value = input.map(|v| v.into());
         633  +
            self
         634  +
        }
         635  +
        /// Consumes the builder and constructs a [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput).
         636  +
        pub fn build(self) -> crate::input::ContentTypeParametersInput {
         637  +
            self.build_enforcing_all_constraints()
         638  +
        }
         639  +
        fn build_enforcing_all_constraints(self) -> crate::input::ContentTypeParametersInput {
         640  +
            crate::input::ContentTypeParametersInput { value: self.value }
         641  +
        }
         642  +
    }
         643  +
}
  586    644   
/// See [`PutWithContentEncodingInput`](crate::input::PutWithContentEncodingInput).
  587    645   
///
  588    646   
pub mod put_with_content_encoding_input {
  589    647   
  590    648   
    impl ::std::convert::From<Builder> for crate::input::PutWithContentEncodingInput {
  591    649   
        fn from(builder: Builder) -> Self {
  592    650   
            builder.build()
  593    651   
        }
  594    652   
    }
  595    653   
    /// A builder for [`PutWithContentEncodingInput`](crate::input::PutWithContentEncodingInput).

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

@@ -130,130 +221,226 @@
  150    150   
//! # Example
  151    151   
//!
  152    152   
//! ```rust,no_run
  153    153   
//! # use std::net::SocketAddr;
  154    154   
//! use json_rpc11::{JsonProtocol, JsonProtocolConfig};
  155    155   
//!
  156    156   
//! #[::tokio::main]
  157    157   
//! pub async fn main() {
  158    158   
//!    let config = JsonProtocolConfig::builder().build();
  159    159   
//!    let app = JsonProtocol::builder(config)
         160  +
//!        .content_type_parameters(content_type_parameters)
  160    161   
//!        .datetime_offsets(datetime_offsets)
  161    162   
//!        .empty_operation(empty_operation)
  162    163   
//!        .endpoint_operation(endpoint_operation)
  163    164   
//!        .endpoint_with_host_label_operation(endpoint_with_host_label_operation)
  164    165   
//!        .fractional_seconds(fractional_seconds)
  165    166   
//!        .greeting_with_errors(greeting_with_errors)
  166    167   
//!        .host_with_path_operation(host_with_path_operation)
  167    168   
//!        .json_enums(json_enums)
  168    169   
//!        .json_unions(json_unions)
  169    170   
//!        .kitchen_sink_operation(kitchen_sink_operation)
  170    171   
//!        .null_operation(null_operation)
  171    172   
//!        .operation_with_optional_input_output(operation_with_optional_input_output)
  172    173   
//!        .put_and_get_inline_documents(put_and_get_inline_documents)
  173    174   
//!        .put_with_content_encoding(put_with_content_encoding)
  174    175   
//!        .simple_scalar_properties(simple_scalar_properties)
  175    176   
//!        .sparse_nulls_operation(sparse_nulls_operation)
  176    177   
//!        .build()
  177    178   
//!        .expect("failed to build an instance of JsonProtocol");
  178    179   
//!
  179    180   
//!    let bind: SocketAddr = "127.0.0.1:6969".parse()
  180    181   
//!        .expect("unable to parse the server bind address and port");
  181    182   
//!    let server = ::hyper::Server::bind(&bind).serve(app.into_make_service());
  182    183   
//!    # let server = async { Ok::<_, ()>(()) };
  183    184   
//!
  184    185   
//!    // Run your service!
  185    186   
//!    if let Err(err) = server.await {
  186    187   
//!        eprintln!("server error: {:?}", err);
  187    188   
//!    }
  188    189   
//! }
  189    190   
//!
  190    191   
//! use json_rpc11::{input, output, error};
  191    192   
//!
         193  +
//! async fn content_type_parameters(input: input::ContentTypeParametersInput) -> output::ContentTypeParametersOutput {
         194  +
//!     todo!()
         195  +
//! }
         196  +
//!
  192    197   
//! async fn datetime_offsets(input: input::DatetimeOffsetsInput) -> output::DatetimeOffsetsOutput {
  193    198   
//!     todo!()
  194    199   
//! }
  195    200   
//!
  196    201   
//! async fn empty_operation(input: input::EmptyOperationInput) -> output::EmptyOperationOutput {
  197    202   
//!     todo!()
  198    203   
//! }
  199    204   
//!
  200    205   
//! async fn endpoint_operation(input: input::EndpointOperationInput) -> output::EndpointOperationOutput {
  201    206   
//!     todo!()

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

@@ -1,1 +31,165 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
static CONTENT_TYPE_CONTENTTYPEPARAMETERS: ::once_cell::sync::Lazy<::mime::Mime> =
           3  +
    ::once_cell::sync::Lazy::new(|| {
           4  +
        "application/x-amz-json-1.1"
           5  +
            .parse::<::mime::Mime>()
           6  +
            .expect("BUG: MIME parsing failed, content_type is not valid")
           7  +
    });
           8  +
::pin_project_lite::pin_project! {
           9  +
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
          10  +
    /// [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput) using modelled bindings.
          11  +
    pub struct ContentTypeParametersInputFuture {
          12  +
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::ContentTypeParametersInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
          13  +
    }
          14  +
}
          15  +
          16  +
impl std::future::Future for ContentTypeParametersInputFuture {
          17  +
    type Output = Result<
          18  +
        crate::input::ContentTypeParametersInput,
          19  +
        ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
          20  +
    >;
          21  +
          22  +
    fn poll(
          23  +
        self: std::pin::Pin<&mut Self>,
          24  +
        cx: &mut std::task::Context<'_>,
          25  +
    ) -> std::task::Poll<Self::Output> {
          26  +
        let this = self.project();
          27  +
        this.inner.as_mut().poll(cx)
          28  +
    }
          29  +
}
          30  +
          31  +
impl<B>
          32  +
    ::aws_smithy_http_server::request::FromRequest<
          33  +
        ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
          34  +
        B,
          35  +
    > for crate::input::ContentTypeParametersInput
          36  +
where
          37  +
    B: ::aws_smithy_http_server::body::HttpBody + Send,
          38  +
    B: 'static,
          39  +
          40  +
    B::Data: Send,
          41  +
    ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
          42  +
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
          43  +
{
          44  +
    type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
          45  +
    type Future = ContentTypeParametersInputFuture;
          46  +
          47  +
    fn from_request(request: ::http::Request<B>) -> Self::Future {
          48  +
        let fut = async move {
          49  +
            if !::aws_smithy_http_server::protocol::accept_header_classifier(
          50  +
                request.headers(),
          51  +
                &CONTENT_TYPE_CONTENTTYPEPARAMETERS,
          52  +
            ) {
          53  +
                return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
          54  +
            }
          55  +
            crate::protocol_serde::shape_content_type_parameters::de_content_type_parameters_http_request(request)
          56  +
                            .await
          57  +
                            .map_err(Into::into)
          58  +
        };
          59  +
        use ::futures_util::future::TryFutureExt;
          60  +
        let fut = fut.map_err(
          61  +
            |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
          62  +
                ::tracing::debug!(error = %e, "failed to deserialize request");
          63  +
                ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
          64  +
            },
          65  +
        );
          66  +
        ContentTypeParametersInputFuture {
          67  +
            inner: Box::pin(fut),
          68  +
        }
          69  +
    }
          70  +
}
          71  +
impl
          72  +
    ::aws_smithy_http_server::response::IntoResponse<
          73  +
        ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
          74  +
    > for crate::output::ContentTypeParametersOutput
          75  +
{
          76  +
    fn into_response(self) -> ::aws_smithy_http_server::response::Response {
          77  +
        match crate::protocol_serde::shape_content_type_parameters::ser_content_type_parameters_http_response(self) {
          78  +
                        Ok(response) => response,
          79  +
                        Err(e) => {
          80  +
                            ::tracing::error!(error = %e, "failed to serialize response");
          81  +
                            ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
          82  +
                        }
          83  +
                    }
          84  +
    }
          85  +
}
          86  +
          87  +
#[allow(unreachable_code, unused_variables)]
          88  +
#[cfg(test)]
          89  +
mod content_type_parameters_test {
          90  +
          91  +
    /// A server should ignore parameters added to the content type
          92  +
    /// Test ID: AwsJson11MustSupportParametersInContentType
          93  +
    #[::tokio::test]
          94  +
    #[::tracing_test::traced_test]
          95  +
    async fn aws_json11_must_support_parameters_in_content_type_request() {
          96  +
        #[allow(unused_mut)]
          97  +
        let mut http_request = http::Request::builder()
          98  +
            .uri("/")
          99  +
            .method("POST")
         100  +
            .header("Content-Type", "application/x-amz-json-1.1; charset=utf-8")
         101  +
            .header("X-Amz-Target", "JsonProtocol.ContentTypeParameters")
         102  +
            .body(::aws_smithy_http_server::body::Body::from(
         103  +
                ::bytes::Bytes::from_static("{\"value\":5}".as_bytes()),
         104  +
            ))
         105  +
            .unwrap();
         106  +
        #[allow(unused_mut)]
         107  +
        let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
         108  +
        let config = crate::service::JsonProtocolConfig::builder().build();
         109  +
        let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
         110  +
            .content_type_parameters(move |input: crate::input::ContentTypeParametersInput| {
         111  +
                let sender = sender.clone();
         112  +
                async move {
         113  +
                    let result = {
         114  +
                        let expected = crate::input::ContentTypeParametersInput {
         115  +
                            value: ::std::option::Option::Some(5),
         116  +
                        };
         117  +
                        ::pretty_assertions::assert_eq!(input, expected);
         118  +
                        let response = crate::output::ContentTypeParametersOutput {};
         119  +
                        response
         120  +
                    };
         121  +
                    sender.send(()).await.expect("receiver dropped early");
         122  +
                    result
         123  +
                }
         124  +
            })
         125  +
            .build_unchecked();
         126  +
        let http_response = ::tower::ServiceExt::oneshot(service, http_request)
         127  +
            .await
         128  +
            .expect("unable to make an HTTP request");
         129  +
        assert!(
         130  +
            receiver.recv().await.is_some(),
         131  +
            "we expected operation handler to be invoked but it was not entered"
         132  +
        );
         133  +
    }
         134  +
}
         135  +
    2    136   
static CONTENT_TYPE_PUTWITHCONTENTENCODING: ::once_cell::sync::Lazy<::mime::Mime> =
    3    137   
    ::once_cell::sync::Lazy::new(|| {
    4    138   
        "application/x-amz-json-1.1"
    5    139   
            .parse::<::mime::Mime>()
    6    140   
            .expect("BUG: MIME parsing failed, content_type is not valid")
    7    141   
    });
    8    142   
::pin_project_lite::pin_project! {
    9    143   
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
   10    144   
    /// [`PutWithContentEncodingInput`](crate::input::PutWithContentEncodingInput) using modelled bindings.
   11    145   
    pub struct PutWithContentEncodingInputFuture {

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

@@ -1,1 +31,61 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
           3  +
/// The example tests how servers must support requests containing a `Content-Type` header with parameters.
           4  +
pub struct ContentTypeParameters;
           5  +
           6  +
impl ::aws_smithy_http_server::operation::OperationShape for ContentTypeParameters {
           7  +
    const ID: ::aws_smithy_http_server::shape_id::ShapeId =
           8  +
        ::aws_smithy_http_server::shape_id::ShapeId::new(
           9  +
            "aws.protocoltests.json#ContentTypeParameters",
          10  +
            "aws.protocoltests.json",
          11  +
            "ContentTypeParameters",
          12  +
        );
          13  +
          14  +
    type Input = crate::input::ContentTypeParametersInput;
          15  +
    type Output = crate::output::ContentTypeParametersOutput;
          16  +
    type Error = std::convert::Infallible;
          17  +
}
          18  +
          19  +
impl ::aws_smithy_http_server::instrumentation::sensitivity::Sensitivity for ContentTypeParameters {
          20  +
    type RequestFmt = ::aws_smithy_http_server::instrumentation::sensitivity::DefaultRequestFmt;
          21  +
    type ResponseFmt = ::aws_smithy_http_server::instrumentation::sensitivity::DefaultResponseFmt;
          22  +
          23  +
    fn request_fmt() -> Self::RequestFmt {
          24  +
        ::aws_smithy_http_server::instrumentation::sensitivity::RequestFmt::new()
          25  +
    }
          26  +
          27  +
    fn response_fmt() -> Self::ResponseFmt {
          28  +
        ::aws_smithy_http_server::instrumentation::sensitivity::ResponseFmt::new()
          29  +
    }
          30  +
}
          31  +
    2     32   
#[allow(missing_docs)] // documentation missing in model
    3     33   
pub struct PutWithContentEncoding;
    4     34   
    5     35   
impl ::aws_smithy_http_server::operation::OperationShape for PutWithContentEncoding {
    6     36   
    const ID: ::aws_smithy_http_server::shape_id::ShapeId =
    7     37   
        ::aws_smithy_http_server::shape_id::ShapeId::new(
    8     38   
            "aws.protocoltests.json#PutWithContentEncoding",
    9     39   
            "aws.protocoltests.json",
   10     40   
            "PutWithContentEncoding",
   11     41   
        );

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

@@ -1,1 +31,43 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(missing_docs)] // documentation missing in model
           3  +
#[derive(
           4  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
           5  +
)]
           6  +
pub struct ContentTypeParametersOutput {}
           7  +
impl ContentTypeParametersOutput {
           8  +
    /// Creates a new builder-style object to manufacture [`ContentTypeParametersOutput`](crate::output::ContentTypeParametersOutput).
           9  +
    pub fn builder() -> crate::output::content_type_parameters_output::Builder {
          10  +
        crate::output::content_type_parameters_output::Builder::default()
          11  +
    }
          12  +
}
          13  +
    2     14   
#[allow(missing_docs)] // documentation missing in model
    3     15   
#[derive(
    4     16   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
    5     17   
)]
    6     18   
pub struct PutWithContentEncodingOutput {}
    7     19   
impl PutWithContentEncodingOutput {
    8     20   
    /// Creates a new builder-style object to manufacture [`PutWithContentEncodingOutput`](crate::output::PutWithContentEncodingOutput).
    9     21   
    pub fn builder() -> crate::output::put_with_content_encoding_output::Builder {
   10     22   
        crate::output::put_with_content_encoding_output::Builder::default()
   11     23   
    }
@@ -510,522 +569,603 @@
  530    542   
#[derive(
  531    543   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  532    544   
)]
  533    545   
pub struct EmptyOperationOutput {}
  534    546   
impl EmptyOperationOutput {
  535    547   
    /// Creates a new builder-style object to manufacture [`EmptyOperationOutput`](crate::output::EmptyOperationOutput).
  536    548   
    pub fn builder() -> crate::output::empty_operation_output::Builder {
  537    549   
        crate::output::empty_operation_output::Builder::default()
  538    550   
    }
  539    551   
}
         552  +
/// See [`ContentTypeParametersOutput`](crate::output::ContentTypeParametersOutput).
         553  +
///
         554  +
pub mod content_type_parameters_output {
         555  +
         556  +
    impl ::std::convert::From<Builder> for crate::output::ContentTypeParametersOutput {
         557  +
        fn from(builder: Builder) -> Self {
         558  +
            builder.build()
         559  +
        }
         560  +
    }
         561  +
    /// A builder for [`ContentTypeParametersOutput`](crate::output::ContentTypeParametersOutput).
         562  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
         563  +
    pub struct Builder {}
         564  +
    impl Builder {
         565  +
        /// Consumes the builder and constructs a [`ContentTypeParametersOutput`](crate::output::ContentTypeParametersOutput).
         566  +
        pub fn build(self) -> crate::output::ContentTypeParametersOutput {
         567  +
            self.build_enforcing_all_constraints()
         568  +
        }
         569  +
        fn build_enforcing_all_constraints(self) -> crate::output::ContentTypeParametersOutput {
         570  +
            crate::output::ContentTypeParametersOutput {}
         571  +
        }
         572  +
    }
         573  +
}
  540    574   
/// See [`PutWithContentEncodingOutput`](crate::output::PutWithContentEncodingOutput).
  541    575   
///
  542    576   
pub mod put_with_content_encoding_output {
  543    577   
  544    578   
    impl ::std::convert::From<Builder> for crate::output::PutWithContentEncodingOutput {
  545    579   
        fn from(builder: Builder) -> Self {
  546    580   
            builder.build()
  547    581   
        }
  548    582   
    }
  549    583   
    /// A builder for [`PutWithContentEncodingOutput`](crate::output::PutWithContentEncodingOutput).