Skip to content
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

codegen: Fixup event stream (un)marshal event name to match model #4261

Merged
merged 2 commits into from Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -67,13 +67,13 @@
"type":"structure",
"members":{
"Headers":{"shape":"HeaderOnlyEvent"},
"ImplicitPayload":{"shape":"ImplicitPayloadEvent"},
"implicitPayload":{"shape":"ImplicitPayloadEvent"},
"ExplicitPayload":{"shape":"ExplicitPayloadEvent"},
"PayloadOnly":{"shape":"PayloadOnlyEvent"},
"payloadOnly":{"shape":"PayloadOnlyEvent"},
"PayloadOnlyBlob":{"shape":"PayloadOnlyBlobEvent"},
"PayloadOnlyString":{"shape":"PayloadOnlyStringEvent"},
"payloadOnlyString":{"shape":"PayloadOnlyStringEvent"},
"Empty":{"shape":"EmptyEvent"},
"Exception":{"shape":"ExceptionEvent"},
"exception":{"shape":"ExceptionEvent"},
"Exception2":{"shape":"ExceptionEvent2"}
},
"eventstream":true
Expand Down
8 changes: 4 additions & 4 deletions private/model/api/codegentest/service/restjsonservice/api.go

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

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

7 changes: 6 additions & 1 deletion private/model/api/eventstream.go
Expand Up @@ -285,10 +285,15 @@ func setupEventStream(s *Shape) *EventStream {
}
eventRef.Shape.EventFor[eventStream.Name] = eventStream

eventName := eventRefName
if v := eventRef.LocationName; v != "" {
eventName = v
}

// Exceptions and events are two different lists to allow the SDK
// to easily generate code with the two handled differently.
event := &Event{
Name: eventRefName,
Name: eventName,
Shape: eventRef.Shape,
For: eventStream,
}
Expand Down