Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(codegen): update calls to deprecated model.getKnowledge #2073

Merged
merged 2 commits into from
Feb 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private static boolean testInputContainsMember(
OperationShape operationShape,
Set<String> expectedMemberNames
) {
OperationIndex operationIndex = model.getKnowledge(OperationIndex.class);
OperationIndex operationIndex = OperationIndex.of(model);
return operationIndex.getInput(operationShape)
.filter(input -> input.getMemberNames().stream().anyMatch(expectedMemberNames::contains))
.isPresent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ public Map<String, Consumer<TypeScriptWriter>> getRuntimeConfigWriters(
}

private static boolean hasEventStreamInput(Model model, ServiceShape service) {
TopDownIndex topDownIndex = model.getKnowledge(TopDownIndex.class);
TopDownIndex topDownIndex = TopDownIndex.of(model);
Set<OperationShape> operations = topDownIndex.getContainedOperations(service);
EventStreamIndex eventStreamIndex = model.getKnowledge(EventStreamIndex.class);
EventStreamIndex eventStreamIndex = EventStreamIndex.of(model);
for (OperationShape operation : operations) {
if (eventStreamIndex.getInputInfo(operation).isPresent()) {
return true;
Expand All @@ -141,7 +141,7 @@ private static boolean hasEventStreamInput(Model model, ServiceShape service) {
}

private static boolean hasEventStreamInput(Model model, ServiceShape service, OperationShape operation) {
EventStreamIndex eventStreamIndex = model.getKnowledge(EventStreamIndex.class);
EventStreamIndex eventStreamIndex = EventStreamIndex.of(model);
return eventStreamIndex.getInputInfo(operation).isPresent();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void writeAdditionalFiles(
.collect(Collectors.joining("\n"));
resource = resource.replaceAll(Pattern.quote("${documentation}"), documentation);

TopDownIndex topDownIndex = model.getKnowledge(TopDownIndex.class);
TopDownIndex topDownIndex = TopDownIndex.of(model);
OperationShape firstOperation = topDownIndex.getContainedOperations(service).iterator().next();
String operationName = firstOperation.getId().getName();
resource = resource.replaceAll(Pattern.quote("${commandName}"), operationName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static void generateDocumentBodyShapeSerde(
ShapeVisitor<Void> visitor
) {
// Walk all the shapes within those in the document and generate for them as well.
Walker shapeWalker = new Walker(context.getModel().getKnowledge(NeighborProviderIndex.class).getProvider());
Walker shapeWalker = new Walker(NeighborProviderIndex.of(context.getModel()).getProvider());
Set<Shape> shapesToGenerate = new TreeSet<>(shapes);
shapes.forEach(shape -> shapesToGenerate.addAll(shapeWalker.walkShapes(shape)));
shapesToGenerate.forEach(shape -> shape.accept(visitor));
Expand Down Expand Up @@ -264,7 +264,7 @@ static String getInputTimestampValueProvider(
Format defaultFormat,
String inputLocation
) {
HttpBindingIndex httpIndex = context.getModel().getKnowledge(HttpBindingIndex.class);
HttpBindingIndex httpIndex = HttpBindingIndex.of(context.getModel());
TimestampFormatTrait.Format format = httpIndex.determineTimestampFormat(memberShape, DOCUMENT, defaultFormat);
return HttpProtocolGeneratorUtils.getTimestampInputParam(context, inputLocation, memberShape, format);
}
Expand Down