Skip to content

Commit 2613a29

Browse files
author
luigi
committed
fix
1 parent 4041dc6 commit 2613a29

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/protocol/HttpBindingProtocolGenerator.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ abstract class HttpBindingProtocolGenerator : ProtocolGenerator {
136136
}
137137

138138
override fun generateProtocolClient(ctx: ProtocolGenerator.GenerationContext) {
139+
if (ctx.settings.build.generateServiceProject) {
140+
require(protocolName == "smithyRpcv2cbor") { "service project accepts only Cbor protocol" }
141+
}
139142
if (!ctx.settings.build.generateServiceProject) {
140143
val symbol = ctx.symbolProvider.toSymbol(ctx.service)
141144
ctx.delegator.useFileWriter("Default${symbol.name}.kt", ctx.settings.pkg.name) { writer ->
@@ -184,7 +187,6 @@ abstract class HttpBindingProtocolGenerator : ProtocolGenerator {
184187
ctx.delegator.useSymbolWriter(serializerSymbol) { writer ->
185188
// FIXME: this works only for Cbor protocol now
186189
if (ctx.settings.build.generateServiceProject) {
187-
require(protocolName == "smithyRpcv2cbor") { "service project accepts only Cbor protocol" }
188190
writer
189191
.openBlock("internal class #T {", serializerSymbol)
190192
.call {

0 commit comments

Comments
 (0)