File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -211,12 +211,15 @@ private void renderStructureNamespace(StructuredMemberWriter structuredMemberWri
211211 return ;
212212 }
213213
214- structuredMemberWriter .writeMemberValidators (writer );
215-
216214 writer .addImport ("ValidationFailure" , "__ValidationFailure" , "@aws-smithy/server-common" );
217215 writer .openBlock ("export const validate = ($L: $L): __ValidationFailure[] => {" , "}" ,
218216 objectParam , symbol .getName (),
219217 () -> {
218+ // TODO: move this somewhere so it only gets run once.
219+ // Putting it at the top of the namespace can result in runtime errors when
220+ // you have mutually recursive structures because the validator of one will
221+ // be defined before the validator of the other exists at all.
222+ structuredMemberWriter .writeMemberValidators (writer );
220223 structuredMemberWriter .writeValidate (writer , objectParam );
221224 }
222225 );
You can’t perform that action at this time.
0 commit comments