|
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; |
54 | 53 | import software.amazon.smithy.model.validation.ValidationEvent;
|
55 | 54 | import software.amazon.smithy.typescript.codegen.TypeScriptSettings.ArtifactType;
|
56 | 55 | import software.amazon.smithy.typescript.codegen.integration.ProtocolGenerator;
|
@@ -85,7 +84,6 @@ class CodegenVisitor extends ShapeVisitor.Default<Void> {
|
85 | 84 | private final ServiceShape service;
|
86 | 85 | private final FileManifest fileManifest;
|
87 | 86 | private final SymbolProvider symbolProvider;
|
88 |
| - private final Model nonTraits; |
89 | 87 | private final TypeScriptDelegator writers;
|
90 | 88 | private final List<TypeScriptIntegration> integrations = new ArrayList<>();
|
91 | 89 | private final List<RuntimeClientPlugin> runtimePlugins = new ArrayList<>();
|
@@ -115,7 +113,6 @@ class CodegenVisitor extends ShapeVisitor.Default<Void> {
|
115 | 113 | modifiedModel = integration.preprocessModel(modifiedModel, settings);
|
116 | 114 | }
|
117 | 115 | model = modifiedModel;
|
118 |
| - nonTraits = ModelTransformer.create().getModelWithoutTraitShapes(model); |
119 | 116 |
|
120 | 117 | service = settings.getService(model);
|
121 | 118 |
|
@@ -179,19 +176,18 @@ void execute() {
|
179 | 176 |
|
180 | 177 | // Generate models that are connected to the service being generated.
|
181 | 178 | LOGGER.fine("Walking shapes from " + service.getId() + " to find shapes to generate");
|
182 |
| - // Walk the tree. |
183 |
| - Collection<Shape> shapeSet = new Walker(nonTraits).walkShapes(service); |
184 |
| - |
185 |
| - Model prunedModel = Model.builder().addShapes(shapeSet).build(); |
186 |
| - |
187 |
| - // Generate models from shapes. |
188 |
| - for (Shape shape : TopologicalIndex.of(prunedModel).getOrderedShapes()) { |
189 |
| - shape.accept(this); |
| 179 | + Collection<Shape> shapes = new Walker(model).walkShapes(service); |
| 180 | + for (Shape shape : TopologicalIndex.of(model).getOrderedShapes()) { |
| 181 | + if (shapes.contains(shape)) { |
| 182 | + shape.accept(this); |
| 183 | + } |
190 | 184 | }
|
191 |
| - for (Shape shape : TopologicalIndex.of(prunedModel).getRecursiveShapes()) { |
192 |
| - shape.accept(this); |
| 185 | + for (Shape shape : TopologicalIndex.of(model).getRecursiveShapes()) { |
| 186 | + if (shapes.contains(shape)) { |
| 187 | + shape.accept(this); |
| 188 | + } |
193 | 189 | }
|
194 |
| - SymbolVisitor.writeModelIndex(prunedModel, symbolProvider, fileManifest); |
| 190 | + SymbolVisitor.writeModelIndex(shapes, symbolProvider, fileManifest); |
195 | 191 |
|
196 | 192 | // Generate the client Node and Browser configuration files. These
|
197 | 193 | // files are switched between in package.json based on the targeted
|
|
0 commit comments