Skip to content

Commit ca76037

Browse files
authored
Fix bug with enum customizations in TsServer codegen (#4244)
## Motivation and Context <!--- Why is this change required? What problem does it solve? --> <!--- If it fixes an open issue, please link to the issue here --> Fixing bug from #4039. It is breaking the diff generation ([ex](https://github.com/smithy-lang/smithy-rs/actions/runs/16690158842/job/47246940590?pr=4243)) in other PRs. Can't seem to fix it in the other PR since the diff always picks up the older broken revision, so doing a small stand-alone PR to get this in. ## Description <!--- Describe your changes in detail --> ## Testing <!--- Please describe in detail how you tested your changes --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
1 parent 39a51b7 commit ca76037

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

codegen-server/typescript/src/main/kotlin/software/amazon/smithy/rust/codegen/server/typescript/smithy/TsServerCodegenVisitor.kt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/*
32
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
43
* SPDX-License-Identifier: Apache-2.0
@@ -83,8 +82,15 @@ class TsServerCodegenVisitor(
8382
publicConstrainedTypes: Boolean,
8483
includeConstraintShapeProvider: Boolean,
8584
codegenDecorator: ServerCodegenDecorator,
86-
) =
87-
RustServerCodegenTsPlugin.baseSymbolProvider(settings, model, serviceShape, rustSymbolProviderConfig, publicConstrainedTypes, includeConstraintShapeProvider, codegenDecorator)
85+
) = RustServerCodegenTsPlugin.baseSymbolProvider(
86+
settings,
87+
model,
88+
serviceShape,
89+
rustSymbolProviderConfig,
90+
publicConstrainedTypes,
91+
includeConstraintShapeProvider,
92+
codegenDecorator,
93+
)
8894

8995
val serverSymbolProviders =
9096
ServerSymbolProviders.from(
@@ -171,7 +177,7 @@ class TsServerCodegenVisitor(
171177
fun tsServerEnumGeneratorFactory(
172178
codegenContext: ServerCodegenContext,
173179
shape: StringShape,
174-
) = TsServerEnumGenerator(codegenContext, shape, validationExceptionConversionGenerator)
180+
) = TsServerEnumGenerator(codegenContext, shape, validationExceptionConversionGenerator, emptyList())
175181
stringShape(shape, ::tsServerEnumGeneratorFactory)
176182
}
177183

codegen-server/typescript/src/main/kotlin/software/amazon/smithy/rust/codegen/server/typescript/smithy/generators/TsServerEnumGenerator.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import software.amazon.smithy.rust.codegen.core.rustlang.Attribute
1010
import software.amazon.smithy.rust.codegen.core.rustlang.Writable
1111
import software.amazon.smithy.rust.codegen.core.rustlang.rust
1212
import software.amazon.smithy.rust.codegen.core.rustlang.writable
13+
import software.amazon.smithy.rust.codegen.core.smithy.generators.EnumCustomization
1314
import software.amazon.smithy.rust.codegen.core.smithy.generators.EnumGenerator
1415
import software.amazon.smithy.rust.codegen.core.smithy.generators.EnumGeneratorContext
1516
import software.amazon.smithy.rust.codegen.server.smithy.ServerCodegenContext
@@ -41,6 +42,7 @@ class TsServerEnumGenerator(
4142
codegenContext: ServerCodegenContext,
4243
shape: StringShape,
4344
validationExceptionConversionGenerator: ValidationExceptionConversionGenerator,
45+
customizations: List<EnumCustomization>,
4446
) : EnumGenerator(
4547
codegenContext.model,
4648
codegenContext.symbolProvider,
@@ -50,4 +52,5 @@ class TsServerEnumGenerator(
5052
shape,
5153
validationExceptionConversionGenerator,
5254
),
55+
customizations,
5356
)

0 commit comments

Comments
 (0)