@@ -276,15 +276,17 @@ private void writeSimpleSchema(Shape shape) {
276276 TypeScriptWriter writer = getWriter (shape .getId ());
277277 if (elision .traits .hasSchemaTraits (shape )) {
278278 writer .addImport ("StaticSimpleSchema" , null , TypeScriptDependency .SMITHY_TYPES );
279- writer .write ("""
280- export var $L: StaticSimpleSchema = [0, $L, $L, $L,""" ,
279+ writer .openBlock ("""
280+ export var $L: StaticSimpleSchema = [0, $L, $L,""" ,
281+ ", $L];" ,
281282 getShapeVariableName (shape ),
282283 checkImportString (shape , shape .getId ().getNamespace (), "n" ),
283284 checkImportString (shape , shape .getId ().getName ()),
284- resolveSimpleSchema (shape , shape )
285+ resolveSimpleSchema (shape , shape ),
286+ () -> {
287+ writeTraits (shape );
288+ }
285289 );
286- writeTraits (shape );
287- writer .write ("];" );
288290 }
289291 }
290292
@@ -341,7 +343,7 @@ private void writeBaseError() {
341343 String namespace = settings .getService (model ).getId ().getNamespace ();
342344
343345 String exceptionCtorSymbolName = "__" + serviceExceptionName ;
344- writer .addImportSubmodule ( "error " , null , TypeScriptDependency .SMITHY_CORE , "/schema" );
346+ writer .addImport ( "StaticErrorSchema " , null , TypeScriptDependency .SMITHY_TYPES );
345347 writer .addRelativeImport (
346348 serviceExceptionName ,
347349 exceptionCtorSymbolName ,
@@ -350,7 +352,7 @@ private void writeBaseError() {
350352
351353 String syntheticNamespace = store .var ("smithy.ts.sdk.synthetic." + namespace );
352354 writer .write ("""
353- export var $L = error( $L, $S, 0, [], [], null) ;""" ,
355+ export var $L: StaticErrorSchema = [-3, $L, $S, 0, [], []] ;""" ,
354356 serviceExceptionName ,
355357 syntheticNamespace ,
356358 serviceExceptionName
@@ -672,25 +674,19 @@ private String resolveSimpleSchemaNestedContainer(Shape context, Shape shape, Ty
672674 String staticTypePrefix ;
673675 String sentinel ;
674676 String keySchema = "" ;
675- String valueSchema ;
676- String as ;
677677 switch (shape .getType ()) {
678678 case LIST -> {
679679 contained = shape .asListShape ().get ().getMember ();
680- staticTypePrefix = "([1, " ;
681- valueSchema = "" ;
680+ staticTypePrefix = "[1, " ;
682681 sentinel = "64" ;
683682 writer .addImport ("StaticListSchema" , null , TypeScriptDependency .SMITHY_TYPES );
684- as = " as StaticListSchema)" ;
685683 }
686684 case MAP -> {
687685 contained = shape .asMapShape ().get ().getValue ();
688- staticTypePrefix = "( [2, " ;
686+ staticTypePrefix = "[2, " ;
689687 keySchema = this .resolveSimpleSchema (context , shape .asMapShape ().get ().getKey ()) + ", " ;
690- valueSchema = this .resolveSimpleSchema (context , shape .asMapShape ().get ().getValue ()) + ", " ;
691688 sentinel = "128" ;
692689 writer .addImport ("StaticMapSchema" , null , TypeScriptDependency .SMITHY_TYPES );
693- as = " as StaticMapSchema)" ;
694690 }
695691 default -> {
696692 throw new IllegalArgumentException (
@@ -702,19 +698,12 @@ private String resolveSimpleSchemaNestedContainer(Shape context, Shape shape, Ty
702698 contained = model .expectShape (contained .asMemberShape ().get ().getTarget ());
703699 }
704700
705- if (contained .isListShape ()) {
706- String schemaVarName = checkImportString (context , shape .getId ().getName ());
707- return staticTypePrefix
708- + checkImportString (context , shape .getId ().getNamespace (), "n" ) + ", " + schemaVarName + ", 0, "
709- + valueSchema
710- + this .resolveSimpleSchema (context , contained ) + "]" + as ;
711- } else if (contained .isMapShape ()) {
701+ if (contained .isListShape () || contained .isMapShape ()) {
712702 String schemaVarName = checkImportString (context , shape .getId ().getName ());
713703 return staticTypePrefix
714704 + checkImportString (context , shape .getId ().getNamespace (), "n" ) + ", " + schemaVarName + ", 0, "
715705 + keySchema
716- + valueSchema
717- + this .resolveSimpleSchema (context , contained ) + "]" + as ;
706+ + this .resolveSimpleSchema (context , contained ) + "]" ;
718707 } else {
719708 return sentinel + "|" + this .resolveSimpleSchema (context , contained );
720709 }
0 commit comments