Skip to content

Commit

Permalink
chore: remove deps on AwsServiceIdIntegration
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr committed Jan 13, 2021
1 parent 362de1c commit ba85bd8
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import software.amazon.smithy.aws.traits.ServiceTrait;
import software.amazon.smithy.codegen.core.SymbolProvider;
import software.amazon.smithy.model.Model;
import software.amazon.smithy.model.knowledge.TopDownIndex;
Expand Down Expand Up @@ -60,10 +61,11 @@ public void writeAdditionalFiles(
String resource = IoUtils.readUtf8Resource(getClass(), "README.md.template");
resource = resource.replaceAll(Pattern.quote("${packageName}"), settings.getPackageName());

AwsServiceIdIntegration integration = new AwsServiceIdIntegration();
SymbolProvider decorated = integration.decorateSymbolProvider(settings, model, symbolProvider);
String clientName = decorated.toSymbol(service).getName();
resource = resource.replaceAll(Pattern.quote("${serviceId}"), clientName.split("Client")[0]);
String sdkId = service.getTrait(ServiceTrait.class).map(ServiceTrait::getSdkId).orElse(null);
String clientName = Arrays.asList(sdkId.split(" ")).stream()
.map(StringUtils::capitalize)
.collect(Collectors.joining(""));
resource = resource.replaceAll(Pattern.quote("${serviceId}"), clientName);

String rawDocumentation = service.getTrait(DocumentationTrait.class)
.map(DocumentationTrait::getValue)
Expand Down

0 comments on commit ba85bd8

Please sign in to comment.