Skip to content

Commit 3059f55

Browse files
authored
chore(codegen): update calls to deprecated model.getKnowledge (#2073)
1 parent a84afb0 commit 3059f55

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddBuiltinPlugins.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ private static boolean testInputContainsMember(
138138
OperationShape operationShape,
139139
Set<String> expectedMemberNames
140140
) {
141-
OperationIndex operationIndex = model.getKnowledge(OperationIndex.class);
141+
OperationIndex operationIndex = OperationIndex.of(model);
142142
return operationIndex.getInput(operationShape)
143143
.filter(input -> input.getMemberNames().stream().anyMatch(expectedMemberNames::contains))
144144
.isPresent();

codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddEventStreamHandlingDependency.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ public Map<String, Consumer<TypeScriptWriter>> getRuntimeConfigWriters(
129129
}
130130

131131
private static boolean hasEventStreamInput(Model model, ServiceShape service) {
132-
TopDownIndex topDownIndex = model.getKnowledge(TopDownIndex.class);
132+
TopDownIndex topDownIndex = TopDownIndex.of(model);
133133
Set<OperationShape> operations = topDownIndex.getContainedOperations(service);
134-
EventStreamIndex eventStreamIndex = model.getKnowledge(EventStreamIndex.class);
134+
EventStreamIndex eventStreamIndex = EventStreamIndex.of(model);
135135
for (OperationShape operation : operations) {
136136
if (eventStreamIndex.getInputInfo(operation).isPresent()) {
137137
return true;
@@ -141,7 +141,7 @@ private static boolean hasEventStreamInput(Model model, ServiceShape service) {
141141
}
142142

143143
private static boolean hasEventStreamInput(Model model, ServiceShape service, OperationShape operation) {
144-
EventStreamIndex eventStreamIndex = model.getKnowledge(EventStreamIndex.class);
144+
EventStreamIndex eventStreamIndex = EventStreamIndex.of(model);
145145
return eventStreamIndex.getInputInfo(operation).isPresent();
146146
}
147147
}

codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsPackageFixturesGeneratorIntegration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public void writeAdditionalFiles(
7474
.collect(Collectors.joining("\n"));
7575
resource = resource.replaceAll(Pattern.quote("${documentation}"), documentation);
7676

77-
TopDownIndex topDownIndex = model.getKnowledge(TopDownIndex.class);
77+
TopDownIndex topDownIndex = TopDownIndex.of(model);
7878
OperationShape firstOperation = topDownIndex.getContainedOperations(service).iterator().next();
7979
String operationName = firstOperation.getId().getName();
8080
resource = resource.replaceAll(Pattern.quote("${commandName}"), operationName);

codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsProtocolUtils.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static void generateDocumentBodyShapeSerde(
8080
ShapeVisitor<Void> visitor
8181
) {
8282
// Walk all the shapes within those in the document and generate for them as well.
83-
Walker shapeWalker = new Walker(context.getModel().getKnowledge(NeighborProviderIndex.class).getProvider());
83+
Walker shapeWalker = new Walker(NeighborProviderIndex.of(context.getModel()).getProvider());
8484
Set<Shape> shapesToGenerate = new TreeSet<>(shapes);
8585
shapes.forEach(shape -> shapesToGenerate.addAll(shapeWalker.walkShapes(shape)));
8686
shapesToGenerate.forEach(shape -> shape.accept(visitor));
@@ -264,7 +264,7 @@ static String getInputTimestampValueProvider(
264264
Format defaultFormat,
265265
String inputLocation
266266
) {
267-
HttpBindingIndex httpIndex = context.getModel().getKnowledge(HttpBindingIndex.class);
267+
HttpBindingIndex httpIndex = HttpBindingIndex.of(context.getModel());
268268
TimestampFormatTrait.Format format = httpIndex.determineTimestampFormat(memberShape, DOCUMENT, defaultFormat);
269269
return HttpProtocolGeneratorUtils.getTimestampInputParam(context, inputLocation, memberShape, format);
270270
}

0 commit comments

Comments
 (0)