Skip to content

Commit

Permalink
codegen: Fix eventstream require params and test generation (#3463)
Browse files Browse the repository at this point in the history
Fixes the code generation for eventstream APIs to correctly not generated required parameter validation, and fix test WriteEvents code generation.
  • Loading branch information
jasdel committed Aug 10, 2020
1 parent 1d7c049 commit 34f092c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion private/model/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ func resolveShapeValidations(s *Shape, ancestry ...*Shape) {
ref := s.MemberRefs[name]
// Since this is a grab bag we will just continue since
// we can't validate because we don't know the valued shape.
if ref.JSONValue {
if ref.JSONValue || (s.UsedAsInput && ref.Shape.IsEventStream) {
continue
}

Expand Down
7 changes: 7 additions & 0 deletions private/model/api/eventstream_tmpl_writertests.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,13 @@ var eventStreamWriterTestTmpl = template.Must(
{{- end }}
}
var marshalers request.HandlerList
marshalers.PushBackNamed({{ $.API.ProtocolPackage }}.BuildHandler)
payloadMarshaler := protocol.HandlerPayloadMarshal{
Marshalers: marshalers,
}
_ = payloadMarshaler
eventMsgs := []eventstream.Message{
{{- range $idx, $event := $.InputStream.Events }}
{{- template "set event message" Map "idx" $idx "parentShape" $event.Shape "eventName" $event.Name }}
Expand Down
7 changes: 7 additions & 0 deletions service/transcribestreamingservice/eventstream_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 34f092c

Please sign in to comment.