diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsPackageFixturesGeneratorIntegration.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsPackageFixturesGeneratorIntegration.java index 27cc4b30361c..52bcf1a606e2 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsPackageFixturesGeneratorIntegration.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsPackageFixturesGeneratorIntegration.java @@ -106,10 +106,14 @@ private void writeAdditionalFiles( OperationShape sampleOperation = getPreferredExampleOperation(topDownIndex.getContainedOperations(service), model); - String operationName = sampleOperation.getId().getName(service); + String operationName = + sampleOperation == null + ? "Example" + : sampleOperation.getId().getName(service); + resource = resource.replaceAll(Pattern.quote("${commandName}"), operationName); resource = resource.replaceAll(Pattern.quote("${operationName}"), - operationName.substring(0, 1).toLowerCase() + operationName.substring(1)); + operationName.substring(0, 1).toLowerCase() + operationName.substring(1)); writer.write(resource.replaceAll(Pattern.quote("$"), Matcher.quoteReplacement("$$"))); writeOperationList(writer, model, settings);