@@ -30,7 +30,7 @@ public final class PackageApiValidationGenerator {
3030 private final TypeScriptSettings settings ;
3131 private final Model model ;
3232 private final SymbolProvider symbolProvider ;
33- private final ServiceClosure serviceClosure ;
33+ private final ServiceClosure closure ;
3434
3535 public PackageApiValidationGenerator (
3636 TypeScriptWriter writer ,
@@ -42,7 +42,7 @@ public PackageApiValidationGenerator(
4242 this .settings = settings ;
4343 this .model = model ;
4444 this .symbolProvider = symbolProvider ;
45- serviceClosure = ServiceClosure .of (model , settings .getService (model ));
45+ closure = ServiceClosure .of (model , settings .getService (model ));
4646 }
4747
4848 /**
@@ -75,31 +75,32 @@ public void writeTypeIndexTest() {
7575 }
7676
7777 // enums
78- TreeSet <Shape > enumShapes = serviceClosure .getEnums ();
78+ TreeSet <Shape > enumShapes = closure .getEnums ();
7979 for (Shape enumShape : enumShapes ) {
8080 writer .write ("$L," , symbolProvider .toSymbol (enumShape ).getName ());
8181 }
8282
8383 // structure & union types & modeled errors
84- TreeSet <Shape > structuralShapes = serviceClosure .getStructuralNonErrorShapes ();
84+ TreeSet <Shape > structuralShapes = closure .getStructuralNonErrorShapes ();
8585 for (Shape structuralShape : structuralShapes ) {
8686 writer .write ("$L," , symbolProvider .toSymbol (structuralShape ).getName ());
8787 }
8888
89- TreeSet <Shape > errorShapes = serviceClosure .getErrorShapes ();
89+ TreeSet <Shape > errorShapes = closure .getErrorShapes ();
9090 for (Shape errorShape : errorShapes ) {
9191 writer .write ("$L," , symbolProvider .toSymbol (errorShape ).getName ());
9292 }
9393
9494 // synthetic base exception
95- writer .write ("$L," , aggregateClientName + "ServiceException" );
95+ String baseExceptionName = CodegenUtils .getSyntheticBaseExceptionName (aggregateClientName , model );
96+ writer .write ("$L," , baseExceptionName );
9697
9798 // waiters
98- serviceClosure .getWaiterNames ().forEach (waiter -> {
99+ closure .getWaiterNames ().forEach (waiter -> {
99100 writer .write ("$L," , waiter );
100101 });
101102 // paginators
102- serviceClosure .getPaginatorNames ().forEach (paginator -> {
103+ closure .getPaginatorNames ().forEach (paginator -> {
103104 writer .write ("$L," , paginator );
104105 });
105106 }
@@ -150,7 +151,7 @@ public void writeRuntimeIndexTest() {
150151
151152 // string shapes with enum trait do not generate anything if
152153 // any enum value does not have a name.
153- TreeSet <Shape > enumShapes = serviceClosure .getEnums ().stream ()
154+ TreeSet <Shape > enumShapes = closure .getEnums ().stream ()
154155 .filter (shape -> shape
155156 .getTrait (EnumTrait .class )
156157 .map (EnumTrait ::hasNames )
@@ -169,11 +170,11 @@ public void writeRuntimeIndexTest() {
169170 );
170171 }
171172
172- String baseExceptionName = aggregateClientName + "ServiceException" ;
173+ String baseExceptionName = CodegenUtils . getSyntheticBaseExceptionName ( aggregateClientName , model ) ;
173174
174175 // modeled errors and synthetic base error
175176 writer .write ("// errors" );
176- TreeSet <Shape > errors = serviceClosure .getErrorShapes ();
177+ TreeSet <Shape > errors = closure .getErrorShapes ();
177178 for (Shape error : errors ) {
178179 Symbol errorSymbol = symbolProvider .toSymbol (error );
179180 writer .addRelativeImport (errorSymbol .getName (), null , cjsIndex );
@@ -187,7 +188,7 @@ public void writeRuntimeIndexTest() {
187188 writer .write ("assert($L.prototype instanceof Error);" , baseExceptionName );
188189
189190 // waiters & paginators
190- TreeSet <String > waiterNames = serviceClosure .getWaiterNames ();
191+ TreeSet <String > waiterNames = closure .getWaiterNames ();
191192 if (!waiterNames .isEmpty ()) {
192193 writer .write ("// waiters" );
193194 }
@@ -198,7 +199,7 @@ public void writeRuntimeIndexTest() {
198199 waiter
199200 );
200201 });
201- TreeSet <String > paginatorNames = serviceClosure .getPaginatorNames ();
202+ TreeSet <String > paginatorNames = closure .getPaginatorNames ();
202203 if (!paginatorNames .isEmpty ()) {
203204 writer .write ("// paginators" );
204205 }
0 commit comments