Skip to content

Conversation

@kuhe
Copy link
Contributor

@kuhe kuhe commented Sep 15, 2025

Internal JS-6222

See inline comments

@kuhe kuhe requested a review from a team as a code owner September 15, 2025 17:51
String memberName = headerMember.getMemberName();
Shape target = model.expectShape(headerMember.getTarget());
writer.openBlock("if (input.$L) {", "}", memberName, () -> {
writer.openBlock("if (input.$L != null) {", "}", memberName, () -> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allow zero numbers and empty strings

writer.openBlock("if (input.$L != null) {", "}", memberName, () -> {
writer.write("headers[$1S] = { type: $2S, value: input.$1L }", memberName,
getEventHeaderType(headerMember));
getEventHeaderType(target));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the member target shape type is what runs against the switch statement.

Using the member itself always goes to the default branch because the shape type is MEMBER.

return "binary";
default:
return "binary";
throw new IllegalArgumentException("Unsupported event header shape type: " + shape.getType());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should be no default, since all supported types are accounted for, see https://smithy.io/2.0/spec/streaming.html#eventheader-trait

@kuhe kuhe merged commit 6a6615c into smithy-lang:main Sep 15, 2025
11 checks passed
@kuhe kuhe deleted the fix/event-stream branch September 15, 2025 19:47
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.

2 participants