Skip to content

Commit

Permalink
Fix external namespace in Union validation generator
Browse files Browse the repository at this point in the history
  • Loading branch information
rishav-karanjit committed Nov 8, 2024
1 parent 576fd9c commit b7f019e
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -686,9 +686,17 @@ private void renderUnionShape(
""".formatted(dataSourceForUnion)
);
for (final var memberInUnion : currentShape.getAllMembers().values()) {
// Union don't need to handle external namespace because union member is always defined inside the same namespace.
// External shapes is inside union members not inside union
final var unionMemberName = symbolProvider.toMemberName(memberInUnion);
final var currMemberNamespace = SmithyNameResolver.smithyTypesNamespace(
currentShape
);
final Boolean isExternalShape =
!currServiceShapeNamespace.equals(currMemberNamespace) &&
!currMemberNamespace.startsWith("smithy");
final var unionMemberName = isExternalShape
? currMemberNamespace
.concat(".")
.concat(symbolProvider.toMemberName(memberInUnion))
: symbolProvider.toMemberName(memberInUnion);
unionValidation.append(
"""
case *%s:
Expand Down

0 comments on commit b7f019e

Please sign in to comment.