Skip to content

Commit 5f86b26

Browse files
committed
Remove TypeScriptIntegration.onShapeWriterUse
1 parent 86bb0d7 commit 5f86b26

File tree

2 files changed

+0
-77
lines changed

2 files changed

+0
-77
lines changed

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/TypeScriptIntegration.java

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import software.amazon.smithy.codegen.core.SymbolProvider;
2727
import software.amazon.smithy.codegen.core.SymbolReference;
2828
import software.amazon.smithy.model.Model;
29-
import software.amazon.smithy.model.shapes.Shape;
3029
import software.amazon.smithy.typescript.codegen.LanguageTarget;
3130
import software.amazon.smithy.typescript.codegen.TypeScriptCodegenContext;
3231
import software.amazon.smithy.typescript.codegen.TypeScriptSettings;
@@ -73,45 +72,6 @@ default Model preprocessModel(Model model, TypeScriptSettings settings) {
7372
return model;
7473
}
7574

76-
/**
77-
* Called each time a writer is used that defines a shape.
78-
*
79-
* <p>This method could be called multiple times for the same writer
80-
* but for different shapes. It gives an opportunity to intercept code
81-
* sections of a {@link TypeScriptWriter} by name using the shape for
82-
* context. For example:
83-
*
84-
* <pre>
85-
* {@code
86-
* public final class MyIntegration implements TypeScriptIntegration {
87-
* public onWriterUse(TypeScriptSettings settings, Model model, SymbolProvider symbolProvider,
88-
* TypeScriptWriter writer, Shape definedShape) {
89-
* writer.onSection("example", text -&gt; writer.write("Intercepted: " + text"));
90-
* }
91-
* }
92-
* }</pre>
93-
*
94-
* <p>Any mutations made on the writer (for example, adding
95-
* section interceptors) are removed after the callback has completed;
96-
* the callback is invoked in between pushing and popping state from
97-
* the writer.
98-
*
99-
* @param settings Settings used to generate.
100-
* @param model Model to generate from.
101-
* @param symbolProvider Symbol provider used for codegen.
102-
* @param writer Writer that will be used.
103-
* @param definedShape Shape that is being defined in the writer.
104-
*/
105-
default void onShapeWriterUse(
106-
TypeScriptSettings settings,
107-
Model model,
108-
SymbolProvider symbolProvider,
109-
TypeScriptWriter writer,
110-
Shape definedShape
111-
) {
112-
// pass
113-
}
114-
11575
/**
11676
* Writes additional files.
11777
*

smithy-typescript-codegen/src/test/java/software/amazon/smithy/typescript/codegen/TypeScriptDelegatorTest.java

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
package software.amazon.smithy.typescript.codegen;
22

33
import static org.hamcrest.MatcherAssert.assertThat;
4-
import static org.hamcrest.Matchers.containsInAnyOrder;
54
import static org.hamcrest.Matchers.equalTo;
65

7-
import java.util.ArrayList;
8-
import java.util.List;
96
import org.junit.jupiter.api.Test;
107
import software.amazon.smithy.build.MockManifest;
118
import software.amazon.smithy.codegen.core.Symbol;
129
import software.amazon.smithy.codegen.core.SymbolProvider;
1310
import software.amazon.smithy.model.Model;
1411
import software.amazon.smithy.model.shapes.Shape;
1512
import software.amazon.smithy.model.shapes.ShapeId;
16-
import software.amazon.smithy.typescript.codegen.integration.TypeScriptIntegration;
1713
import software.amazon.smithy.utils.ListUtils;
18-
import software.amazon.smithy.utils.Pair;
1914

2015
public class TypeScriptDelegatorTest {
2116
@Test
@@ -63,38 +58,6 @@ public void appendsToOpenedWriterWithNewline() {
6358
assertThat(manifest.getFileString("Foo.txt").get(), equalTo("Hello!\n\nGoodbye!\n"));
6459
}
6560

66-
@Test
67-
public void emitsBeforeWritingAndWhenCreated() {
68-
Model model = createModel();
69-
Shape fooShape = model.expectShape(ShapeId.from("smithy.example#Foo"));
70-
SymbolProvider provider = createProvider();
71-
MockManifest manifest = new MockManifest();
72-
List<Pair<TypeScriptWriter, Shape>> before = new ArrayList<>();
73-
TypeScriptSettings settings = new TypeScriptSettings();
74-
75-
TypeScriptIntegration integration = new TypeScriptIntegration() {
76-
@Override
77-
public void onShapeWriterUse(
78-
TypeScriptSettings settings,
79-
Model model,
80-
SymbolProvider symbolProvider,
81-
TypeScriptWriter writer,
82-
Shape definedShape
83-
) {
84-
before.add(Pair.of(writer, definedShape));
85-
}
86-
};
87-
88-
TypeScriptDelegator delegator = new TypeScriptDelegator(
89-
settings, model, manifest, provider, ListUtils.of(integration));
90-
91-
delegator.useShapeWriter(fooShape, writer -> {
92-
writer.write("Hello!");
93-
delegator.flushWriters();
94-
assertThat(before, containsInAnyOrder(Pair.of(writer, fooShape)));
95-
});
96-
}
97-
9861
private static Model createModel() {
9962
return Model.assembler()
10063
.addImport(TypeScriptDelegatorTest.class.getResource("testmodel.smithy"))

0 commit comments

Comments
 (0)