Skip to content

Conversation

@davidh44
Copy link
Contributor

Motivation and Context

Smithy spec states:

Event streams MAY target shapes marked with the error trait

https://smithy.io/2.0/spec/streaming.html#modeled-errors-in-event-streams

Codegen currently throws a NPE if a exception shape is a member of an event stream output. This is because the Java SDK codegen stores exception shape names by appending a suffix Exception.

Modifications

Update RemoveUnusedShapes.resolveMemberShapes(), so that if the shape type is Exception, and the MemberModel C2J shape name equals the ShapeModel C2J name, to resolve the shape name (original name) instead of returning the simple type (with Exception suffix)

Testing

Added exception shape to event stream output in codegen test model

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

@davidh44 davidh44 requested a review from a team as a code owner November 27, 2025 00:27
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant