-
Couldn't load subscription status.
- Fork 109
fix(codegen): fix header type codegen for event streams #1694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| String memberName = headerMember.getMemberName(); | ||
| Shape target = model.expectShape(headerMember.getTarget()); | ||
| writer.openBlock("if (input.$L) {", "}", memberName, () -> { | ||
| writer.openBlock("if (input.$L != null) {", "}", memberName, () -> { |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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
fb3c44d to
62676ec
Compare
Internal JS-6222
See inline comments