|
50 | 50 | import software.amazon.smithy.model.shapes.UnionShape;
|
51 | 51 | import software.amazon.smithy.model.traits.EnumTrait;
|
52 | 52 | import software.amazon.smithy.model.traits.PaginatedTrait;
|
| 53 | +import software.amazon.smithy.model.transform.ModelTransformer; |
53 | 54 | import software.amazon.smithy.model.validation.ValidationEvent;
|
54 | 55 | import software.amazon.smithy.typescript.codegen.TypeScriptSettings.ArtifactType;
|
55 | 56 | import software.amazon.smithy.typescript.codegen.integration.ProtocolGenerator;
|
@@ -108,18 +109,14 @@ class CodegenVisitor extends ShapeVisitor.Default<Void> {
|
108 | 109 | integrations.sort(Comparator.comparingInt(TypeScriptIntegration::getOrder));
|
109 | 110 |
|
110 | 111 | // Preprocess model using integrations.
|
111 |
| - TypeScriptSettings typescriptSettings = TypeScriptSettings.from( |
112 |
| - context.getModel(), context.getSettings(), artifactType); |
| 112 | + settings = TypeScriptSettings.from(context.getModel(), context.getSettings(), artifactType); |
| 113 | + Model modifiedModel = context.getModel(); |
113 | 114 | for (TypeScriptIntegration integration : integrations) {
|
114 |
| - Model modifiedModel = integration.preprocessModel(context, typescriptSettings); |
115 |
| - if (modifiedModel != context.getModel()) { |
116 |
| - context = context.toBuilder().model(modifiedModel).build(); |
117 |
| - typescriptSettings = TypeScriptSettings.from(modifiedModel, context.getSettings(), artifactType); |
118 |
| - } |
| 115 | + modifiedModel = integration.preprocessModel(modifiedModel, settings); |
119 | 116 | }
|
120 |
| - settings = typescriptSettings; |
121 |
| - model = context.getModel(); |
122 |
| - nonTraits = context.getModelWithoutTraitShapes(); |
| 117 | + model = modifiedModel; |
| 118 | + nonTraits = ModelTransformer.create().getModelWithoutTraitShapes(model); |
| 119 | + |
123 | 120 | service = settings.getService(model);
|
124 | 121 |
|
125 | 122 | if (settings.getArtifactType().equals(ArtifactType.SSDK)) {
|
|
0 commit comments