Loading codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/PythonServerCodegenVisitor.kt +1 −1 Original line number Diff line number Diff line Loading @@ -161,7 +161,7 @@ class PythonServerCodegenVisitor( rustCrate, protocolGenerator, protocolGeneratorFactory.support(), ServerProtocol.fromCoreProtocol(protocolGeneratorFactory.protocol(codegenContext)), protocolGeneratorFactory.protocol(codegenContext) as ServerProtocol, codegenContext, ) .render() Loading codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ServerCodegenVisitor.kt +1 −1 Original line number Diff line number Diff line Loading @@ -438,7 +438,7 @@ open class ServerCodegenVisitor( rustCrate, protocolGenerator, protocolGeneratorFactory.support(), ServerProtocol.fromCoreProtocol(protocolGeneratorFactory.protocol(codegenContext)), protocolGeneratorFactory.protocol(codegenContext) as ServerProtocol, codegenContext, ) .render() Loading codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/protocol/ServerProtocol.kt +0 −25 Original line number Diff line number Diff line Loading @@ -78,16 +78,6 @@ interface ServerProtocol : Protocol { * Returns a boolean indicating whether to perform this check. */ fun serverContentTypeCheckNoModeledInput(): Boolean = false companion object { /** Upgrades the core protocol to a `ServerProtocol`. */ fun fromCoreProtocol(protocol: Protocol): ServerProtocol = when (protocol) { is AwsJson -> ServerAwsJsonProtocol.fromCoreProtocol(protocol) is RestJson -> ServerRestJsonProtocol.fromCoreProtocol(protocol) is RestXml -> ServerRestXmlProtocol.fromCoreProtocol(protocol) else -> throw IllegalStateException("unsupported protocol") } } } class ServerAwsJsonProtocol( Loading Loading @@ -120,11 +110,6 @@ class ServerAwsJsonProtocol( override fun structuredDataSerializer(operationShape: OperationShape): StructuredDataSerializerGenerator = ServerAwsJsonSerializerGenerator(serverCodegenContext, httpBindingResolver, awsJsonVersion) companion object { fun fromCoreProtocol(awsJson: AwsJson): ServerAwsJsonProtocol = ServerAwsJsonProtocol(awsJson.codegenContext as ServerCodegenContext, awsJson.version) } override fun markerStruct(): RuntimeType { return when (version) { is AwsJsonVersion.Json10 -> { Loading Loading @@ -194,10 +179,6 @@ class ServerRestJsonProtocol( override fun structuredDataSerializer(operationShape: OperationShape): StructuredDataSerializerGenerator = ServerRestJsonSerializerGenerator(serverCodegenContext, httpBindingResolver) companion object { fun fromCoreProtocol(restJson: RestJson): ServerRestJsonProtocol = ServerRestJsonProtocol(restJson.codegenContext as ServerCodegenContext) } override fun markerStruct() = ServerRuntimeType.Protocol("RestJson1", "rest_json_1", runtimeConfig) override fun routerType() = restRouterType(runtimeConfig) Loading @@ -222,12 +203,6 @@ class ServerRestXmlProtocol( ) : RestXml(codegenContext), ServerProtocol { val runtimeConfig = codegenContext.runtimeConfig companion object { fun fromCoreProtocol(restXml: RestXml): ServerRestXmlProtocol { return ServerRestXmlProtocol(restXml.codegenContext) } } override fun markerStruct() = ServerRuntimeType.Protocol("RestXml", "rest_xml", runtimeConfig) override fun routerType() = restRouterType(runtimeConfig) Loading codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerHttpBoundProtocolGenerator.kt +3 −4 Original line number Diff line number Diff line Loading @@ -125,7 +125,6 @@ private class ServerHttpBoundProtocolTraitImplGenerator( private val operationDeserModule = RustModule.private("operation_deser") private val operationSerModule = RustModule.private("operation_ser") private val typeConversionGenerator = TypeConversionGenerator(model, symbolProvider, runtimeConfig) private val serverProtocol = ServerProtocol.fromCoreProtocol(protocol) private val codegenScope = arrayOf( "AsyncTrait" to ServerCargoDependency.AsyncTrait.asType(), Loading Loading @@ -252,7 +251,7 @@ private class ServerHttpBoundProtocolTraitImplGenerator( """.trimIndent(), *codegenScope, "I" to inputSymbol, "Marker" to serverProtocol.markerStruct(), "Marker" to protocol.markerStruct(), "parse_request" to serverParseRequest(operationShape), "verifyAcceptHeader" to verifyAcceptHeader, "verifyRequestContentTypeHeader" to verifyRequestContentTypeHeader, Loading Loading @@ -315,7 +314,7 @@ private class ServerHttpBoundProtocolTraitImplGenerator( *codegenScope, "O" to outputSymbol, "E" to errorSymbol, "Marker" to serverProtocol.markerStruct(), "Marker" to protocol.markerStruct(), "serialize_response" to serverSerializeResponse(operationShape), "serialize_error" to serverSerializeError(operationShape), ) Loading Loading @@ -348,7 +347,7 @@ private class ServerHttpBoundProtocolTraitImplGenerator( """.trimIndent(), *codegenScope, "O" to outputSymbol, "Marker" to serverProtocol.markerStruct(), "Marker" to protocol.markerStruct(), "serialize_response" to serverSerializeResponse(operationShape), ) } Loading codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerRestXmlFactory.kt +1 −2 Original line number Diff line number Diff line Loading @@ -8,7 +8,6 @@ package software.amazon.smithy.rust.codegen.server.smithy.protocols import software.amazon.smithy.rust.codegen.core.smithy.generators.protocol.ProtocolSupport import software.amazon.smithy.rust.codegen.core.smithy.protocols.Protocol import software.amazon.smithy.rust.codegen.core.smithy.protocols.ProtocolGeneratorFactory import software.amazon.smithy.rust.codegen.core.smithy.protocols.RestXml import software.amazon.smithy.rust.codegen.server.smithy.ServerCodegenContext import software.amazon.smithy.rust.codegen.server.smithy.generators.protocol.ServerRestXmlProtocol Loading @@ -17,7 +16,7 @@ import software.amazon.smithy.rust.codegen.server.smithy.generators.protocol.Ser * with RestXml specific configurations. */ class ServerRestXmlFactory : ProtocolGeneratorFactory<ServerHttpBoundProtocolGenerator, ServerCodegenContext> { override fun protocol(codegenContext: ServerCodegenContext): Protocol = RestXml(codegenContext) override fun protocol(codegenContext: ServerCodegenContext): Protocol = ServerRestXmlProtocol(codegenContext) override fun buildProtocolGenerator(codegenContext: ServerCodegenContext): ServerHttpBoundProtocolGenerator = ServerHttpBoundProtocolGenerator(codegenContext, ServerRestXmlProtocol(codegenContext)) Loading Loading
codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/PythonServerCodegenVisitor.kt +1 −1 Original line number Diff line number Diff line Loading @@ -161,7 +161,7 @@ class PythonServerCodegenVisitor( rustCrate, protocolGenerator, protocolGeneratorFactory.support(), ServerProtocol.fromCoreProtocol(protocolGeneratorFactory.protocol(codegenContext)), protocolGeneratorFactory.protocol(codegenContext) as ServerProtocol, codegenContext, ) .render() Loading
codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ServerCodegenVisitor.kt +1 −1 Original line number Diff line number Diff line Loading @@ -438,7 +438,7 @@ open class ServerCodegenVisitor( rustCrate, protocolGenerator, protocolGeneratorFactory.support(), ServerProtocol.fromCoreProtocol(protocolGeneratorFactory.protocol(codegenContext)), protocolGeneratorFactory.protocol(codegenContext) as ServerProtocol, codegenContext, ) .render() Loading
codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/protocol/ServerProtocol.kt +0 −25 Original line number Diff line number Diff line Loading @@ -78,16 +78,6 @@ interface ServerProtocol : Protocol { * Returns a boolean indicating whether to perform this check. */ fun serverContentTypeCheckNoModeledInput(): Boolean = false companion object { /** Upgrades the core protocol to a `ServerProtocol`. */ fun fromCoreProtocol(protocol: Protocol): ServerProtocol = when (protocol) { is AwsJson -> ServerAwsJsonProtocol.fromCoreProtocol(protocol) is RestJson -> ServerRestJsonProtocol.fromCoreProtocol(protocol) is RestXml -> ServerRestXmlProtocol.fromCoreProtocol(protocol) else -> throw IllegalStateException("unsupported protocol") } } } class ServerAwsJsonProtocol( Loading Loading @@ -120,11 +110,6 @@ class ServerAwsJsonProtocol( override fun structuredDataSerializer(operationShape: OperationShape): StructuredDataSerializerGenerator = ServerAwsJsonSerializerGenerator(serverCodegenContext, httpBindingResolver, awsJsonVersion) companion object { fun fromCoreProtocol(awsJson: AwsJson): ServerAwsJsonProtocol = ServerAwsJsonProtocol(awsJson.codegenContext as ServerCodegenContext, awsJson.version) } override fun markerStruct(): RuntimeType { return when (version) { is AwsJsonVersion.Json10 -> { Loading Loading @@ -194,10 +179,6 @@ class ServerRestJsonProtocol( override fun structuredDataSerializer(operationShape: OperationShape): StructuredDataSerializerGenerator = ServerRestJsonSerializerGenerator(serverCodegenContext, httpBindingResolver) companion object { fun fromCoreProtocol(restJson: RestJson): ServerRestJsonProtocol = ServerRestJsonProtocol(restJson.codegenContext as ServerCodegenContext) } override fun markerStruct() = ServerRuntimeType.Protocol("RestJson1", "rest_json_1", runtimeConfig) override fun routerType() = restRouterType(runtimeConfig) Loading @@ -222,12 +203,6 @@ class ServerRestXmlProtocol( ) : RestXml(codegenContext), ServerProtocol { val runtimeConfig = codegenContext.runtimeConfig companion object { fun fromCoreProtocol(restXml: RestXml): ServerRestXmlProtocol { return ServerRestXmlProtocol(restXml.codegenContext) } } override fun markerStruct() = ServerRuntimeType.Protocol("RestXml", "rest_xml", runtimeConfig) override fun routerType() = restRouterType(runtimeConfig) Loading
codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerHttpBoundProtocolGenerator.kt +3 −4 Original line number Diff line number Diff line Loading @@ -125,7 +125,6 @@ private class ServerHttpBoundProtocolTraitImplGenerator( private val operationDeserModule = RustModule.private("operation_deser") private val operationSerModule = RustModule.private("operation_ser") private val typeConversionGenerator = TypeConversionGenerator(model, symbolProvider, runtimeConfig) private val serverProtocol = ServerProtocol.fromCoreProtocol(protocol) private val codegenScope = arrayOf( "AsyncTrait" to ServerCargoDependency.AsyncTrait.asType(), Loading Loading @@ -252,7 +251,7 @@ private class ServerHttpBoundProtocolTraitImplGenerator( """.trimIndent(), *codegenScope, "I" to inputSymbol, "Marker" to serverProtocol.markerStruct(), "Marker" to protocol.markerStruct(), "parse_request" to serverParseRequest(operationShape), "verifyAcceptHeader" to verifyAcceptHeader, "verifyRequestContentTypeHeader" to verifyRequestContentTypeHeader, Loading Loading @@ -315,7 +314,7 @@ private class ServerHttpBoundProtocolTraitImplGenerator( *codegenScope, "O" to outputSymbol, "E" to errorSymbol, "Marker" to serverProtocol.markerStruct(), "Marker" to protocol.markerStruct(), "serialize_response" to serverSerializeResponse(operationShape), "serialize_error" to serverSerializeError(operationShape), ) Loading Loading @@ -348,7 +347,7 @@ private class ServerHttpBoundProtocolTraitImplGenerator( """.trimIndent(), *codegenScope, "O" to outputSymbol, "Marker" to serverProtocol.markerStruct(), "Marker" to protocol.markerStruct(), "serialize_response" to serverSerializeResponse(operationShape), ) } Loading
codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerRestXmlFactory.kt +1 −2 Original line number Diff line number Diff line Loading @@ -8,7 +8,6 @@ package software.amazon.smithy.rust.codegen.server.smithy.protocols import software.amazon.smithy.rust.codegen.core.smithy.generators.protocol.ProtocolSupport import software.amazon.smithy.rust.codegen.core.smithy.protocols.Protocol import software.amazon.smithy.rust.codegen.core.smithy.protocols.ProtocolGeneratorFactory import software.amazon.smithy.rust.codegen.core.smithy.protocols.RestXml import software.amazon.smithy.rust.codegen.server.smithy.ServerCodegenContext import software.amazon.smithy.rust.codegen.server.smithy.generators.protocol.ServerRestXmlProtocol Loading @@ -17,7 +16,7 @@ import software.amazon.smithy.rust.codegen.server.smithy.generators.protocol.Ser * with RestXml specific configurations. */ class ServerRestXmlFactory : ProtocolGeneratorFactory<ServerHttpBoundProtocolGenerator, ServerCodegenContext> { override fun protocol(codegenContext: ServerCodegenContext): Protocol = RestXml(codegenContext) override fun protocol(codegenContext: ServerCodegenContext): Protocol = ServerRestXmlProtocol(codegenContext) override fun buildProtocolGenerator(codegenContext: ServerCodegenContext): ServerHttpBoundProtocolGenerator = ServerHttpBoundProtocolGenerator(codegenContext, ServerRestXmlProtocol(codegenContext)) Loading