Loading codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonApplicationGenerator.kt +3 −3 Original line number Diff line number Diff line Loading @@ -135,8 +135,8 @@ class PythonApplicationGenerator( ) { rustBlockTemplate( """ /// Dynamically codegenerate the routes, allowing to build the Smithy [#{SmithyServer}::Router]. pub fn build_router(&mut self, event_loop: &#{pyo3}::PyAny) -> #{pyo3}::PyResult<#{SmithyServer}::Router> /// Dynamically codegenerate the routes, allowing to build the Smithy [#{SmithyServer}::routing::Router]. pub fn build_router(&mut self, event_loop: &#{pyo3}::PyAny) -> #{pyo3}::PyResult<#{SmithyServer}::routing::Router> """, *codegenScope, ) { Loading @@ -162,7 +162,7 @@ class PythonApplicationGenerator( } rustTemplate( """ let router: #{SmithyServer}::Router = router let router: #{SmithyServer}::routing::Router = router .build() .expect("Unable to build operation registry") .into(); Loading codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerServiceGenerator.kt +1 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ class PythonServerServiceGenerator( private val rustCrate: RustCrate, protocolGenerator: ProtocolGenerator, protocolSupport: ProtocolSupport, protocol: ServerProtocol, private val protocol: ServerProtocol, private val context: CoreCodegenContext, ) : ServerServiceGenerator(rustCrate, protocolGenerator, protocolSupport, protocol, context) { Loading codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ServerRuntimeType.kt +3 −3 Original line number Diff line number Diff line Loading @@ -39,8 +39,8 @@ object ServerRuntimeType { fun ResponseRejection(runtimeConfig: RuntimeConfig) = RuntimeType("ResponseRejection", ServerCargoDependency.SmithyHttpServer(runtimeConfig), "${runtimeConfig.crateSrcPrefix}_http_server::rejection") fun Protocol(name: String, runtimeConfig: RuntimeConfig) = RuntimeType(name, ServerCargoDependency.SmithyHttpServer(runtimeConfig), "${runtimeConfig.crateSrcPrefix}_http_server::protocols") fun Protocol(name: String, path: String, runtimeConfig: RuntimeConfig) = RuntimeType(name, ServerCargoDependency.SmithyHttpServer(runtimeConfig), "${runtimeConfig.crateSrcPrefix}_http_server::proto::" + path) fun Protocol(runtimeConfig: RuntimeConfig) = Protocol("Protocol", runtimeConfig) fun Protocol(runtimeConfig: RuntimeConfig) = Protocol("Protocol", "", runtimeConfig) } codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerServiceGeneratorV2.kt +3 −3 Original line number Diff line number Diff line Loading @@ -221,7 +221,7 @@ class ServerServiceGeneratorV2( { let router = #{Router:W}; $serviceName { router: #{SmithyHttpServer}::routing::routers::RoutingService::new(router), router: #{SmithyHttpServer}::routers::RoutingService::new(router), } } } Loading Loading @@ -280,7 +280,7 @@ class ServerServiceGeneratorV2( """ ##[derive(Clone)] pub struct $serviceName<S> { router: #{SmithyHttpServer}::routing::routers::RoutingService<#{Router}<S>, #{Protocol}>, router: #{SmithyHttpServer}::routers::RoutingService<#{Router}<S>, #{Protocol}>, } impl $serviceName<()> { Loading Loading @@ -331,7 +331,7 @@ class ServerServiceGeneratorV2( { type Response = #{Http}::Response<#{SmithyHttpServer}::body::BoxBody>; type Error = S::Error; type Future = #{SmithyHttpServer}::routing::routers::RoutingFuture<S, B>; type Future = #{SmithyHttpServer}::routers::RoutingFuture<S, B>; fn poll_ready(&mut self, cx: &mut std::task::Context) -> std::task::Poll<Result<(), Self::Error>> { self.router.poll_ready(cx) Loading codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/protocol/ServerProtocol.kt +9 −10 Original line number Diff line number Diff line Loading @@ -97,18 +97,17 @@ class ServerAwsJsonProtocol( } override fun markerStruct(): RuntimeType { val name = when (version) { return when (version) { is AwsJsonVersion.Json10 -> { "AwsJson10" ServerRuntimeType.Protocol("AwsJson10", "aws_json_10", runtimeConfig) } is AwsJsonVersion.Json11 -> { "AwsJson11" ServerRuntimeType.Protocol("AwsJson11", "aws_json_11", runtimeConfig) } } return ServerRuntimeType.Protocol(name, runtimeConfig) } override fun routerType() = RuntimeType("AwsJsonRouter", ServerCargoDependency.SmithyHttpServer(runtimeConfig), "${runtimeConfig.crateSrcPrefix}_http_server::routing::routers::aws_json") override fun routerType() = RuntimeType("AwsJsonRouter", ServerCargoDependency.SmithyHttpServer(runtimeConfig), "${runtimeConfig.crateSrcPrefix}_http_server::proto::aws_json::router") override fun routerConstruction(operationValues: Iterable<Writable>): Writable = writable { val allOperationShapes = allOperations(coreCodegenContext) Loading Loading @@ -159,7 +158,7 @@ class ServerAwsJsonProtocol( } } private fun restRouterType(runtimeConfig: RuntimeConfig) = RuntimeType("RestRouter", ServerCargoDependency.SmithyHttpServer(runtimeConfig), "${runtimeConfig.crateSrcPrefix}_http_server::routing::routers::rest") private fun restRouterType(runtimeConfig: RuntimeConfig) = RuntimeType("RestRouter", ServerCargoDependency.SmithyHttpServer(runtimeConfig), "${runtimeConfig.crateSrcPrefix}_http_server::proto::rest::router") private fun restRouterConstruction( protocol: ServerProtocol, Loading Loading @@ -212,7 +211,7 @@ class ServerRestJsonProtocol( fun fromCoreProtocol(restJson: RestJson): ServerRestJsonProtocol = ServerRestJsonProtocol(restJson.coreCodegenContext) } override fun markerStruct() = ServerRuntimeType.Protocol("AwsRestJson1", runtimeConfig) override fun markerStruct() = ServerRuntimeType.Protocol("AwsRestJson1", "rest_json_1", runtimeConfig) override fun routerType() = restRouterType(runtimeConfig) Loading Loading @@ -241,7 +240,7 @@ class ServerRestXmlProtocol( } } override fun markerStruct() = ServerRuntimeType.Protocol("AwsRestXml", runtimeConfig) override fun markerStruct() = ServerRuntimeType.Protocol("AwsRestXml", "rest_xml", runtimeConfig) override fun routerType() = restRouterType(runtimeConfig) Loading Loading
codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonApplicationGenerator.kt +3 −3 Original line number Diff line number Diff line Loading @@ -135,8 +135,8 @@ class PythonApplicationGenerator( ) { rustBlockTemplate( """ /// Dynamically codegenerate the routes, allowing to build the Smithy [#{SmithyServer}::Router]. pub fn build_router(&mut self, event_loop: &#{pyo3}::PyAny) -> #{pyo3}::PyResult<#{SmithyServer}::Router> /// Dynamically codegenerate the routes, allowing to build the Smithy [#{SmithyServer}::routing::Router]. pub fn build_router(&mut self, event_loop: &#{pyo3}::PyAny) -> #{pyo3}::PyResult<#{SmithyServer}::routing::Router> """, *codegenScope, ) { Loading @@ -162,7 +162,7 @@ class PythonApplicationGenerator( } rustTemplate( """ let router: #{SmithyServer}::Router = router let router: #{SmithyServer}::routing::Router = router .build() .expect("Unable to build operation registry") .into(); Loading
codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerServiceGenerator.kt +1 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ class PythonServerServiceGenerator( private val rustCrate: RustCrate, protocolGenerator: ProtocolGenerator, protocolSupport: ProtocolSupport, protocol: ServerProtocol, private val protocol: ServerProtocol, private val context: CoreCodegenContext, ) : ServerServiceGenerator(rustCrate, protocolGenerator, protocolSupport, protocol, context) { Loading
codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ServerRuntimeType.kt +3 −3 Original line number Diff line number Diff line Loading @@ -39,8 +39,8 @@ object ServerRuntimeType { fun ResponseRejection(runtimeConfig: RuntimeConfig) = RuntimeType("ResponseRejection", ServerCargoDependency.SmithyHttpServer(runtimeConfig), "${runtimeConfig.crateSrcPrefix}_http_server::rejection") fun Protocol(name: String, runtimeConfig: RuntimeConfig) = RuntimeType(name, ServerCargoDependency.SmithyHttpServer(runtimeConfig), "${runtimeConfig.crateSrcPrefix}_http_server::protocols") fun Protocol(name: String, path: String, runtimeConfig: RuntimeConfig) = RuntimeType(name, ServerCargoDependency.SmithyHttpServer(runtimeConfig), "${runtimeConfig.crateSrcPrefix}_http_server::proto::" + path) fun Protocol(runtimeConfig: RuntimeConfig) = Protocol("Protocol", runtimeConfig) fun Protocol(runtimeConfig: RuntimeConfig) = Protocol("Protocol", "", runtimeConfig) }
codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerServiceGeneratorV2.kt +3 −3 Original line number Diff line number Diff line Loading @@ -221,7 +221,7 @@ class ServerServiceGeneratorV2( { let router = #{Router:W}; $serviceName { router: #{SmithyHttpServer}::routing::routers::RoutingService::new(router), router: #{SmithyHttpServer}::routers::RoutingService::new(router), } } } Loading Loading @@ -280,7 +280,7 @@ class ServerServiceGeneratorV2( """ ##[derive(Clone)] pub struct $serviceName<S> { router: #{SmithyHttpServer}::routing::routers::RoutingService<#{Router}<S>, #{Protocol}>, router: #{SmithyHttpServer}::routers::RoutingService<#{Router}<S>, #{Protocol}>, } impl $serviceName<()> { Loading Loading @@ -331,7 +331,7 @@ class ServerServiceGeneratorV2( { type Response = #{Http}::Response<#{SmithyHttpServer}::body::BoxBody>; type Error = S::Error; type Future = #{SmithyHttpServer}::routing::routers::RoutingFuture<S, B>; type Future = #{SmithyHttpServer}::routers::RoutingFuture<S, B>; fn poll_ready(&mut self, cx: &mut std::task::Context) -> std::task::Poll<Result<(), Self::Error>> { self.router.poll_ready(cx) Loading
codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/protocol/ServerProtocol.kt +9 −10 Original line number Diff line number Diff line Loading @@ -97,18 +97,17 @@ class ServerAwsJsonProtocol( } override fun markerStruct(): RuntimeType { val name = when (version) { return when (version) { is AwsJsonVersion.Json10 -> { "AwsJson10" ServerRuntimeType.Protocol("AwsJson10", "aws_json_10", runtimeConfig) } is AwsJsonVersion.Json11 -> { "AwsJson11" ServerRuntimeType.Protocol("AwsJson11", "aws_json_11", runtimeConfig) } } return ServerRuntimeType.Protocol(name, runtimeConfig) } override fun routerType() = RuntimeType("AwsJsonRouter", ServerCargoDependency.SmithyHttpServer(runtimeConfig), "${runtimeConfig.crateSrcPrefix}_http_server::routing::routers::aws_json") override fun routerType() = RuntimeType("AwsJsonRouter", ServerCargoDependency.SmithyHttpServer(runtimeConfig), "${runtimeConfig.crateSrcPrefix}_http_server::proto::aws_json::router") override fun routerConstruction(operationValues: Iterable<Writable>): Writable = writable { val allOperationShapes = allOperations(coreCodegenContext) Loading Loading @@ -159,7 +158,7 @@ class ServerAwsJsonProtocol( } } private fun restRouterType(runtimeConfig: RuntimeConfig) = RuntimeType("RestRouter", ServerCargoDependency.SmithyHttpServer(runtimeConfig), "${runtimeConfig.crateSrcPrefix}_http_server::routing::routers::rest") private fun restRouterType(runtimeConfig: RuntimeConfig) = RuntimeType("RestRouter", ServerCargoDependency.SmithyHttpServer(runtimeConfig), "${runtimeConfig.crateSrcPrefix}_http_server::proto::rest::router") private fun restRouterConstruction( protocol: ServerProtocol, Loading Loading @@ -212,7 +211,7 @@ class ServerRestJsonProtocol( fun fromCoreProtocol(restJson: RestJson): ServerRestJsonProtocol = ServerRestJsonProtocol(restJson.coreCodegenContext) } override fun markerStruct() = ServerRuntimeType.Protocol("AwsRestJson1", runtimeConfig) override fun markerStruct() = ServerRuntimeType.Protocol("AwsRestJson1", "rest_json_1", runtimeConfig) override fun routerType() = restRouterType(runtimeConfig) Loading Loading @@ -241,7 +240,7 @@ class ServerRestXmlProtocol( } } override fun markerStruct() = ServerRuntimeType.Protocol("AwsRestXml", runtimeConfig) override fun markerStruct() = ServerRuntimeType.Protocol("AwsRestXml", "rest_xml", runtimeConfig) override fun routerType() = restRouterType(runtimeConfig) Loading