Skip to content

Commit

Permalink
fix(generator): mixins may enable streaming features
Browse files Browse the repository at this point in the history
  • Loading branch information
coryan committed Jan 20, 2025
1 parent 304b691 commit 226b6db
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions generator/internal/language/rust.go
Original file line number Diff line number Diff line change
Expand Up @@ -1216,14 +1216,28 @@ func rustValidate(api *api.API, sourceSpecificationPackageName string) error {
return nil
}

func rustAddStreamingFeature(data *RustTemplateData, api *api.API, extraPackages []*rustPackage) {
var hasStreamingRPC bool
for _, m := range api.Messages {
func rustHasStreamingRPC(model *api.API) bool {
for _, m := range model.Messages {
if m.IsPageableResponse {
hasStreamingRPC = true
break
return true
}
}
// Sometimes the method with a pageable message is using an imported message
// or is part of a mixin.
for _, s := range model.Services {
for _, m := range s.Methods {
if output, ok := model.State.MessageByID[m.OutputTypeID]; ok {
if output.IsPageableResponse {
return true
}
}
}
}
return false
}

func rustAddStreamingFeature(data *RustTemplateData, api *api.API, extraPackages []*rustPackage) {
hasStreamingRPC := rustHasStreamingRPC(api)
if !hasStreamingRPC {
return
}
Expand Down

0 comments on commit 226b6db

Please sign in to comment.