diff --git a/private/model/api/eventstream.go b/private/model/api/eventstream.go index 9a883ba1119..4d9b36e881a 100644 --- a/private/model/api/eventstream.go +++ b/private/model/api/eventstream.go @@ -217,7 +217,10 @@ func (es *EventStreams) GetStream(topShape *Shape, streamShape *Shape) *EventStr } if topShape.API.Metadata.Protocol == "json" { - topShape.EventFor = append(topShape.EventFor, stream) + if topShape.EventFor == nil { + topShape.EventFor = map[string]*EventStream{} + } + topShape.EventFor[stream.Name] = stream } return stream @@ -276,7 +279,10 @@ func setupEventStream(s *Shape) *EventStream { updateEventPayloadRef(eventRef.Shape) - eventRef.Shape.EventFor = append(eventRef.Shape.EventFor, eventStream) + if eventRef.Shape.EventFor == nil { + eventRef.Shape.EventFor = map[string]*EventStream{} + } + eventRef.Shape.EventFor[eventStream.Name] = eventStream // Exceptions and events are two different lists to allow the SDK // to easily generate code with the two handled differently. diff --git a/private/model/api/shape.go b/private/model/api/shape.go index 5871643d8c1..6709e9a1554 100644 --- a/private/model/api/shape.go +++ b/private/model/api/shape.go @@ -97,7 +97,7 @@ type Shape struct { OutputEventStreamAPI *EventStreamAPI EventStream *EventStream - EventFor []*EventStream `json:"-"` + EventFor map[string]*EventStream `json:"-"` IsInputEventStream bool `json:"-"` IsOutputEventStream bool `json:"-"`