diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/AwsJson.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/AwsJson.kt index 44a0cfc176..1274ed656f 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/AwsJson.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/AwsJson.kt @@ -18,7 +18,6 @@ import software.amazon.smithy.rust.codegen.client.rustlang.asType import software.amazon.smithy.rust.codegen.client.rustlang.rust import software.amazon.smithy.rust.codegen.client.rustlang.rustBlockTemplate import software.amazon.smithy.rust.codegen.client.rustlang.rustTemplate -import software.amazon.smithy.rust.codegen.client.rustlang.writable import software.amazon.smithy.rust.codegen.client.smithy.ClientCodegenContext import software.amazon.smithy.rust.codegen.client.smithy.CoreCodegenContext import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType @@ -183,23 +182,6 @@ open class AwsJson( *errorScope, ) } - - /** - * Returns the operation name as required by the awsJson1.x protocols. - */ - override fun serverRouterRequestSpec( - operationShape: OperationShape, - operationName: String, - serviceName: String, - requestSpecModule: RuntimeType, - ) = writable { - rust("""String::from("$serviceName.$operationName")""") - } - - override fun serverRouterRuntimeConstructor() = when (awsJsonVersion) { - AwsJsonVersion.Json10 -> "new_aws_json_10_router" - AwsJsonVersion.Json11 -> "new_aws_json_11_router" - } } fun awsJsonFieldName(member: MemberShape): String = member.memberName diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/AwsQuery.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/AwsQuery.kt index c2b5e620da..d749526484 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/AwsQuery.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/AwsQuery.kt @@ -14,7 +14,6 @@ import software.amazon.smithy.model.traits.HttpTrait import software.amazon.smithy.model.traits.TimestampFormatTrait import software.amazon.smithy.rust.codegen.client.rustlang.CargoDependency import software.amazon.smithy.rust.codegen.client.rustlang.RustModule -import software.amazon.smithy.rust.codegen.client.rustlang.Writable import software.amazon.smithy.rust.codegen.client.rustlang.asType import software.amazon.smithy.rust.codegen.client.rustlang.rust import software.amazon.smithy.rust.codegen.client.rustlang.rustBlockTemplate @@ -105,17 +104,4 @@ class AwsQueryProtocol(private val coreCodegenContext: CoreCodegenContext) : Pro rust("#T::parse_generic_error(payload.as_ref())", awsQueryErrors) } } - - override fun serverRouterRequestSpec( - operationShape: OperationShape, - operationName: String, - serviceName: String, - requestSpecModule: RuntimeType, - ): Writable { - TODO("Not yet implemented") - } - - override fun serverRouterRuntimeConstructor(): String { - TODO("Not yet implemented") - } } diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/Ec2Query.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/Ec2Query.kt index 1d87294d89..8af691bfe6 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/Ec2Query.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/Ec2Query.kt @@ -11,7 +11,6 @@ import software.amazon.smithy.model.traits.HttpTrait import software.amazon.smithy.model.traits.TimestampFormatTrait import software.amazon.smithy.rust.codegen.client.rustlang.CargoDependency import software.amazon.smithy.rust.codegen.client.rustlang.RustModule -import software.amazon.smithy.rust.codegen.client.rustlang.Writable import software.amazon.smithy.rust.codegen.client.rustlang.asType import software.amazon.smithy.rust.codegen.client.rustlang.rust import software.amazon.smithy.rust.codegen.client.rustlang.rustBlockTemplate @@ -96,17 +95,4 @@ class Ec2QueryProtocol(private val coreCodegenContext: CoreCodegenContext) : Pro rust("#T::parse_generic_error(payload.as_ref())", ec2QueryErrors) } } - - override fun serverRouterRequestSpec( - operationShape: OperationShape, - operationName: String, - serviceName: String, - requestSpecModule: RuntimeType, - ): Writable { - TODO("Not yet implemented") - } - - override fun serverRouterRuntimeConstructor(): String { - TODO("Not yet implemented") - } } diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/Protocol.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/Protocol.kt index eb9ce489f3..1be6d8ec11 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/Protocol.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/Protocol.kt @@ -20,7 +20,6 @@ import software.amazon.smithy.model.shapes.ShapeId import software.amazon.smithy.model.shapes.StructureShape import software.amazon.smithy.model.traits.TimestampFormatTrait import software.amazon.smithy.model.traits.Trait -import software.amazon.smithy.rust.codegen.client.rustlang.Writable import software.amazon.smithy.rust.codegen.client.smithy.CoreCodegenContext import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType import software.amazon.smithy.rust.codegen.client.smithy.generators.protocol.ProtocolGenerator @@ -74,22 +73,6 @@ interface Protocol { * there are no response headers or statuses available to further inform the error parsing. */ fun parseEventStreamGenericError(operationShape: OperationShape): RuntimeType - - /** - * Returns a writable for the `RequestSpec` for an operation. - */ - fun serverRouterRequestSpec( - operationShape: OperationShape, - operationName: String, - serviceName: String, - requestSpecModule: RuntimeType, - ): Writable - - /** - * Returns the name of the constructor to be used on the `Router` type, to instantiate a `Router` using this - * protocol. - */ - fun serverRouterRuntimeConstructor(): String } typealias ProtocolMap = Map> diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/RestJson.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/RestJson.kt index 629ee1b204..a71c2277ff 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/RestJson.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/RestJson.kt @@ -16,13 +16,11 @@ import software.amazon.smithy.model.traits.StreamingTrait import software.amazon.smithy.model.traits.TimestampFormatTrait import software.amazon.smithy.rust.codegen.client.rustlang.CargoDependency import software.amazon.smithy.rust.codegen.client.rustlang.RustModule -import software.amazon.smithy.rust.codegen.client.rustlang.Writable import software.amazon.smithy.rust.codegen.client.rustlang.asType import software.amazon.smithy.rust.codegen.client.rustlang.rustTemplate import software.amazon.smithy.rust.codegen.client.smithy.ClientCodegenContext import software.amazon.smithy.rust.codegen.client.smithy.CoreCodegenContext import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType -import software.amazon.smithy.rust.codegen.client.smithy.generators.http.RestRequestSpecGenerator import software.amazon.smithy.rust.codegen.client.smithy.generators.protocol.ProtocolSupport import software.amazon.smithy.rust.codegen.client.smithy.protocols.parse.JsonParserGenerator import software.amazon.smithy.rust.codegen.client.smithy.protocols.parse.StructuredDataParserGenerator @@ -141,15 +139,6 @@ open class RestJson(val coreCodegenContext: CoreCodegenContext) : Protocol { *errorScope, ) } - - override fun serverRouterRequestSpec( - operationShape: OperationShape, - operationName: String, - serviceName: String, - requestSpecModule: RuntimeType, - ): Writable = RestRequestSpecGenerator(httpBindingResolver, requestSpecModule).generate(operationShape) - - override fun serverRouterRuntimeConstructor() = "new_rest_json_router" } fun restJsonFieldName(member: MemberShape): String { diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/RestXml.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/RestXml.kt index 2b99fe09ab..f2cc52023e 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/RestXml.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/RestXml.kt @@ -13,14 +13,12 @@ import software.amazon.smithy.model.traits.AnnotationTrait import software.amazon.smithy.model.traits.TimestampFormatTrait import software.amazon.smithy.rust.codegen.client.rustlang.CargoDependency import software.amazon.smithy.rust.codegen.client.rustlang.RustModule -import software.amazon.smithy.rust.codegen.client.rustlang.Writable import software.amazon.smithy.rust.codegen.client.rustlang.asType import software.amazon.smithy.rust.codegen.client.rustlang.rust import software.amazon.smithy.rust.codegen.client.rustlang.rustBlockTemplate import software.amazon.smithy.rust.codegen.client.smithy.ClientCodegenContext import software.amazon.smithy.rust.codegen.client.smithy.CoreCodegenContext import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType -import software.amazon.smithy.rust.codegen.client.smithy.generators.http.RestRequestSpecGenerator import software.amazon.smithy.rust.codegen.client.smithy.generators.protocol.ProtocolSupport import software.amazon.smithy.rust.codegen.client.smithy.protocols.parse.RestXmlParserGenerator import software.amazon.smithy.rust.codegen.client.smithy.protocols.parse.StructuredDataParserGenerator @@ -103,15 +101,6 @@ open class RestXml(val coreCodegenContext: CoreCodegenContext) : Protocol { rust("#T::parse_generic_error(payload.as_ref())", restXmlErrors) } } - - override fun serverRouterRequestSpec( - operationShape: OperationShape, - operationName: String, - serviceName: String, - requestSpecModule: RuntimeType, - ): Writable = RestRequestSpecGenerator(httpBindingResolver, requestSpecModule).generate(operationShape) - - override fun serverRouterRuntimeConstructor() = "new_rest_xml_router" } /** diff --git a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/PythonServerCodegenVisitor.kt b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/PythonServerCodegenVisitor.kt index de0b3d920e..1f894ea4ad 100644 --- a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/PythonServerCodegenVisitor.kt +++ b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/PythonServerCodegenVisitor.kt @@ -26,6 +26,7 @@ import software.amazon.smithy.rust.codegen.server.python.smithy.generators.Pytho import software.amazon.smithy.rust.codegen.server.python.smithy.generators.PythonServerServiceGenerator import software.amazon.smithy.rust.codegen.server.python.smithy.generators.PythonServerStructureGenerator import software.amazon.smithy.rust.codegen.server.smithy.ServerCodegenVisitor +import software.amazon.smithy.rust.codegen.server.smithy.generators.protocol.ServerProtocol import software.amazon.smithy.rust.codegen.server.smithy.protocols.ServerProtocolLoader /** @@ -136,7 +137,7 @@ class PythonServerCodegenVisitor( rustCrate, protocolGenerator, protocolGeneratorFactory.support(), - protocolGeneratorFactory.protocol(codegenContext), + ServerProtocol.fromCoreProtocol(protocolGeneratorFactory.protocol(codegenContext)), codegenContext, ) .render() diff --git a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerServiceGenerator.kt b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerServiceGenerator.kt index 9e38c48bab..58c87effbe 100644 --- a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerServiceGenerator.kt +++ b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerServiceGenerator.kt @@ -12,8 +12,8 @@ import software.amazon.smithy.rust.codegen.client.smithy.CoreCodegenContext import software.amazon.smithy.rust.codegen.client.smithy.RustCrate import software.amazon.smithy.rust.codegen.client.smithy.generators.protocol.ProtocolGenerator import software.amazon.smithy.rust.codegen.client.smithy.generators.protocol.ProtocolSupport -import software.amazon.smithy.rust.codegen.client.smithy.protocols.Protocol import software.amazon.smithy.rust.codegen.server.smithy.generators.ServerServiceGenerator +import software.amazon.smithy.rust.codegen.server.smithy.generators.protocol.ServerProtocol /** * PythonServerServiceGenerator @@ -25,7 +25,7 @@ class PythonServerServiceGenerator( private val rustCrate: RustCrate, protocolGenerator: ProtocolGenerator, protocolSupport: ProtocolSupport, - protocol: Protocol, + protocol: ServerProtocol, private val context: CoreCodegenContext, ) : ServerServiceGenerator(rustCrate, protocolGenerator, protocolSupport, protocol, context) { diff --git a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ServerCodegenVisitor.kt b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ServerCodegenVisitor.kt index 856ee0fe9c..921ce79aae 100644 --- a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ServerCodegenVisitor.kt +++ b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ServerCodegenVisitor.kt @@ -40,6 +40,7 @@ import software.amazon.smithy.rust.codegen.client.util.getTrait import software.amazon.smithy.rust.codegen.client.util.runCommand import software.amazon.smithy.rust.codegen.server.smithy.generators.ServerEnumGenerator import software.amazon.smithy.rust.codegen.server.smithy.generators.ServerServiceGenerator +import software.amazon.smithy.rust.codegen.server.smithy.generators.protocol.ServerProtocol import software.amazon.smithy.rust.codegen.server.smithy.protocols.ServerProtocolLoader import java.util.logging.Logger @@ -229,7 +230,7 @@ open class ServerCodegenVisitor( rustCrate, protocolGenerator, protocolGeneratorFactory.support(), - protocolGeneratorFactory.protocol(codegenContext), + ServerProtocol.fromCoreProtocol(protocolGeneratorFactory.protocol(codegenContext)), codegenContext, ) .render() diff --git a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerOperationRegistryGenerator.kt b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerOperationRegistryGenerator.kt index 3e7126a2ab..aa5f25e3c9 100644 --- a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerOperationRegistryGenerator.kt +++ b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerOperationRegistryGenerator.kt @@ -28,13 +28,13 @@ import software.amazon.smithy.rust.codegen.client.smithy.Outputs import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType import software.amazon.smithy.rust.codegen.client.smithy.generators.CodegenTarget import software.amazon.smithy.rust.codegen.client.smithy.generators.error.errorSymbol -import software.amazon.smithy.rust.codegen.client.smithy.protocols.Protocol import software.amazon.smithy.rust.codegen.client.util.getTrait import software.amazon.smithy.rust.codegen.client.util.inputShape import software.amazon.smithy.rust.codegen.client.util.outputShape import software.amazon.smithy.rust.codegen.client.util.toSnakeCase import software.amazon.smithy.rust.codegen.server.smithy.ServerCargoDependency import software.amazon.smithy.rust.codegen.server.smithy.ServerRuntimeType +import software.amazon.smithy.rust.codegen.server.smithy.generators.protocol.ServerProtocol /** * [ServerOperationRegistryGenerator] renders the `OperationRegistry` struct, a place where users can register their @@ -49,7 +49,7 @@ import software.amazon.smithy.rust.codegen.server.smithy.ServerRuntimeType */ class ServerOperationRegistryGenerator( private val coreCodegenContext: CoreCodegenContext, - private val protocol: Protocol, + private val protocol: ServerProtocol, private val operations: List, ) { private val crateName = coreCodegenContext.settings.moduleName diff --git a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerServiceGenerator.kt b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerServiceGenerator.kt index 2a28b8fca3..99c59ff51b 100644 --- a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerServiceGenerator.kt +++ b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerServiceGenerator.kt @@ -17,7 +17,6 @@ import software.amazon.smithy.rust.codegen.client.smithy.DefaultPublicModules import software.amazon.smithy.rust.codegen.client.smithy.RustCrate import software.amazon.smithy.rust.codegen.client.smithy.generators.protocol.ProtocolGenerator import software.amazon.smithy.rust.codegen.client.smithy.generators.protocol.ProtocolSupport -import software.amazon.smithy.rust.codegen.client.smithy.protocols.Protocol import software.amazon.smithy.rust.codegen.server.smithy.generators.protocol.ServerProtocol import software.amazon.smithy.rust.codegen.server.smithy.generators.protocol.ServerProtocolTestGenerator @@ -31,7 +30,7 @@ open class ServerServiceGenerator( private val rustCrate: RustCrate, private val protocolGenerator: ProtocolGenerator, private val protocolSupport: ProtocolSupport, - private val protocol: Protocol, + private val protocol: ServerProtocol, private val coreCodegenContext: CoreCodegenContext, ) { private val index = TopDownIndex.of(coreCodegenContext.model) diff --git a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/protocol/ServerProtocol.kt b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/protocol/ServerProtocol.kt index bf879d8f34..c0fe3ffc14 100644 --- a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/protocol/ServerProtocol.kt +++ b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/protocol/ServerProtocol.kt @@ -9,11 +9,13 @@ import software.amazon.smithy.model.knowledge.TopDownIndex import software.amazon.smithy.model.shapes.OperationShape import software.amazon.smithy.rust.codegen.client.rustlang.Writable import software.amazon.smithy.rust.codegen.client.rustlang.asType +import software.amazon.smithy.rust.codegen.client.rustlang.rust import software.amazon.smithy.rust.codegen.client.rustlang.rustTemplate import software.amazon.smithy.rust.codegen.client.rustlang.writable import software.amazon.smithy.rust.codegen.client.smithy.CoreCodegenContext import software.amazon.smithy.rust.codegen.client.smithy.RuntimeConfig import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType +import software.amazon.smithy.rust.codegen.client.smithy.generators.http.RestRequestSpecGenerator import software.amazon.smithy.rust.codegen.client.smithy.protocols.AwsJson import software.amazon.smithy.rust.codegen.client.smithy.protocols.AwsJsonVersion import software.amazon.smithy.rust.codegen.client.smithy.protocols.Protocol @@ -40,6 +42,22 @@ interface ServerProtocol : Protocol { */ fun routerConstruction(operationValues: Iterable): Writable + /** + * Returns the name of the constructor to be used on the `Router` type, to instantiate a `Router` using this + * protocol. + */ + fun serverRouterRuntimeConstructor(): String + + /** + * Returns a writable for the `RequestSpec` for an operation. + */ + fun serverRouterRequestSpec( + operationShape: OperationShape, + operationName: String, + serviceName: String, + requestSpecModule: RuntimeType, + ): Writable + companion object { /** Upgrades the core protocol to a `ServerProtocol`. */ fun fromCoreProtocol(protocol: Protocol): ServerProtocol = when (protocol) { @@ -110,6 +128,23 @@ class ServerAwsJsonProtocol( "Pairs" to pairs, ) } + + /** + * Returns the operation name as required by the awsJson1.x protocols. + */ + override fun serverRouterRequestSpec( + operationShape: OperationShape, + operationName: String, + serviceName: String, + requestSpecModule: RuntimeType, + ) = writable { + rust("""String::from("$serviceName.$operationName")""") + } + + override fun serverRouterRuntimeConstructor() = when (version) { + AwsJsonVersion.Json10 -> "new_aws_json_10_router" + AwsJsonVersion.Json11 -> "new_aws_json_11_router" + } } private fun restRouterType(runtimeConfig: RuntimeConfig) = RuntimeType("RestRouter", ServerCargoDependency.SmithyHttpServer(runtimeConfig), "${runtimeConfig.crateSrcPrefix}_http_server::routing::routers::rest") @@ -170,6 +205,15 @@ class ServerRestJsonProtocol( override fun routerType() = restRouterType(runtimeConfig) override fun routerConstruction(operationValues: Iterable): Writable = restRouterConstruction(this, operationValues, coreCodegenContext) + + override fun serverRouterRequestSpec( + operationShape: OperationShape, + operationName: String, + serviceName: String, + requestSpecModule: RuntimeType, + ): Writable = RestRequestSpecGenerator(httpBindingResolver, requestSpecModule).generate(operationShape) + + override fun serverRouterRuntimeConstructor() = "new_rest_json_router" } class ServerRestXmlProtocol( @@ -188,4 +232,13 @@ class ServerRestXmlProtocol( override fun routerType() = restRouterType(runtimeConfig) override fun routerConstruction(operationValues: Iterable): Writable = restRouterConstruction(this, operationValues, coreCodegenContext) + + override fun serverRouterRequestSpec( + operationShape: OperationShape, + operationName: String, + serviceName: String, + requestSpecModule: RuntimeType, + ): Writable = RestRequestSpecGenerator(httpBindingResolver, requestSpecModule).generate(operationShape) + + override fun serverRouterRuntimeConstructor() = "new_rest_xml_router" } diff --git a/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerOperationRegistryGeneratorTest.kt b/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerOperationRegistryGeneratorTest.kt index 820c729462..d0b08053aa 100644 --- a/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerOperationRegistryGeneratorTest.kt +++ b/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerOperationRegistryGeneratorTest.kt @@ -12,6 +12,7 @@ import software.amazon.smithy.model.shapes.ServiceShape import software.amazon.smithy.rust.codegen.client.rustlang.RustWriter import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel import software.amazon.smithy.rust.codegen.client.util.lookup +import software.amazon.smithy.rust.codegen.server.smithy.generators.protocol.ServerProtocol import software.amazon.smithy.rust.codegen.server.smithy.protocols.ServerProtocolLoader import software.amazon.smithy.rust.codegen.server.smithy.testutil.serverTestCodegenContext @@ -67,7 +68,7 @@ class ServerOperationRegistryGeneratorTest { val index = TopDownIndex.of(serverCodegenContext.model) val operations = index.getContainedOperations(serverCodegenContext.serviceShape).sortedBy { it.id } - val protocol = protocolGeneratorFactory.protocol(serverCodegenContext) + val protocol = ServerProtocol.fromCoreProtocol(protocolGeneratorFactory.protocol(serverCodegenContext)) val generator = ServerOperationRegistryGenerator(serverCodegenContext, protocol, operations) val writer = RustWriter.forModule("operation_registry")