Skip to content

Remove calls to deprecated context.getModel().getKnowledge #309

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

Merged
merged 1 commit into from
Apr 13, 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 @@ -202,7 +202,7 @@ public final String memberShape(MemberShape shape) {

@Override
public String timestampShape(TimestampShape shape) {
HttpBindingIndex httpIndex = context.getModel().getKnowledge(HttpBindingIndex.class);
HttpBindingIndex httpIndex = HttpBindingIndex.of(context.getModel());
Format format = httpIndex.determineTimestampFormat(shape, Location.DOCUMENT, defaultTimestampFormat);
return HttpProtocolGeneratorUtils.getTimestampOutputParam(dataSource, Location.DOCUMENT, shape, format);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public final String memberShape(MemberShape shape) {

@Override
public String timestampShape(TimestampShape shape) {
HttpBindingIndex httpIndex = context.getModel().getKnowledge(HttpBindingIndex.class);
HttpBindingIndex httpIndex = HttpBindingIndex.of(context.getModel());
Format format = httpIndex.determineTimestampFormat(shape, Location.DOCUMENT, defaultTimestampFormat);
return HttpProtocolGeneratorUtils.getTimestampInputParam(context, dataSource, shape, format);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private boolean isNativeSimpleType(Shape target) {

@Override
public void generateRequestSerializers(GenerationContext context) {
TopDownIndex topDownIndex = context.getModel().getKnowledge(TopDownIndex.class);
TopDownIndex topDownIndex = TopDownIndex.of(context.getModel());

Set<OperationShape> containedOperations = new TreeSet<>(
topDownIndex.getContainedOperations(context.getService()));
Expand All @@ -175,7 +175,7 @@ public void generateRequestSerializers(GenerationContext context) {

@Override
public void generateResponseDeserializers(GenerationContext context) {
TopDownIndex topDownIndex = context.getModel().getKnowledge(TopDownIndex.class);
TopDownIndex topDownIndex = TopDownIndex.of(context.getModel());

Set<OperationShape> containedOperations = new TreeSet<>(
topDownIndex.getContainedOperations(context.getService()));
Expand All @@ -197,7 +197,7 @@ private void generateOperationSerializer(
SymbolProvider symbolProvider = context.getSymbolProvider();
Symbol symbol = symbolProvider.toSymbol(operation);
SymbolReference requestType = getApplicationProtocol().getRequestType();
HttpBindingIndex bindingIndex = context.getModel().getKnowledge(HttpBindingIndex.class);
HttpBindingIndex bindingIndex = HttpBindingIndex.of(context.getModel());
TypeScriptWriter writer = context.getWriter();

// Ensure that the request type is imported.
Expand Down Expand Up @@ -615,7 +615,7 @@ private String getTimestampInputParam(
String dataSource,
MemberShape member
) {
HttpBindingIndex httpIndex = context.getModel().getKnowledge(HttpBindingIndex.class);
HttpBindingIndex httpIndex = HttpBindingIndex.of(context.getModel());
Format format;
switch (bindingType) {
case HEADER:
Expand Down Expand Up @@ -864,7 +864,7 @@ private void generateOperationDeserializer(
SymbolProvider symbolProvider = context.getSymbolProvider();
Symbol symbol = symbolProvider.toSymbol(operation);
SymbolReference responseType = getApplicationProtocol().getResponseType();
HttpBindingIndex bindingIndex = context.getModel().getKnowledge(HttpBindingIndex.class);
HttpBindingIndex bindingIndex = HttpBindingIndex.of(context.getModel());
Model model = context.getModel();
TypeScriptWriter writer = context.getWriter();

Expand Down Expand Up @@ -922,7 +922,7 @@ private void generateOperationDeserializer(
private void generateErrorDeserializer(GenerationContext context, StructureShape error) {
TypeScriptWriter writer = context.getWriter();
SymbolProvider symbolProvider = context.getSymbolProvider();
HttpBindingIndex bindingIndex = context.getModel().getKnowledge(HttpBindingIndex.class);
HttpBindingIndex bindingIndex = HttpBindingIndex.of(context.getModel());
Model model = context.getModel();
Symbol errorSymbol = symbolProvider.toSymbol(error);
String errorDeserMethodName = ProtocolGenerator.getDeserFunctionName(errorSymbol,
Expand Down Expand Up @@ -1351,7 +1351,7 @@ private String getOutputValue(
} else if (target instanceof DocumentShape) {
return dataSource;
} else if (target instanceof TimestampShape) {
HttpBindingIndex httpIndex = context.getModel().getKnowledge(HttpBindingIndex.class);
HttpBindingIndex httpIndex = HttpBindingIndex.of(context.getModel());
Format format = httpIndex.determineTimestampFormat(member, bindingType, getDocumentTimestampFormat());
return HttpProtocolGeneratorUtils.getTimestampOutputParam(dataSource, bindingType, member, format);
} else if (target instanceof BlobShape) {
Expand Down Expand Up @@ -1465,7 +1465,7 @@ private String getCollectionOutputParam(
// in their formatted entry, so split on every other "," instead.
if (collectionTarget.isTimestampShape()) {
// Check if our member resolves to the HTTP_DATE format.
HttpBindingIndex httpIndex = context.getModel().getKnowledge(HttpBindingIndex.class);
HttpBindingIndex httpIndex = HttpBindingIndex.of(context.getModel());
Format format = httpIndex.determineTimestampFormat(targetMember, bindingType, Format.HTTP_DATE);

if (format == Format.HTTP_DATE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public void generateSharedComponents(GenerationContext context) {

@Override
public void generateRequestSerializers(GenerationContext context) {
TopDownIndex topDownIndex = context.getModel().getKnowledge(TopDownIndex.class);
TopDownIndex topDownIndex = TopDownIndex.of(context.getModel());

Set<OperationShape> containedOperations = new TreeSet<>(
topDownIndex.getContainedOperations(context.getService()));
Expand All @@ -142,7 +142,7 @@ public void generateRequestSerializers(GenerationContext context) {

@Override
public void generateResponseDeserializers(GenerationContext context) {
TopDownIndex topDownIndex = context.getModel().getKnowledge(TopDownIndex.class);
TopDownIndex topDownIndex = TopDownIndex.of(context.getModel());

Set<OperationShape> containedOperations = new TreeSet<>(
topDownIndex.getContainedOperations(context.getService()));
Expand Down