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

Unable to use same ResultType as StreamingResult in more than one method. #3171

Closed
shivuslr41 opened this issue Oct 13, 2022 · 2 comments · Fixed by #3178
Closed

Unable to use same ResultType as StreamingResult in more than one method. #3171

shivuslr41 opened this issue Oct 13, 2022 · 2 comments · Fixed by #3178

Comments

@shivuslr41
Copy link

shivuslr41 commented Oct 13, 2022

If I use same ResultType as StreamingResult in more than one method, NewResultTypeView(v) accepts only single MethodResponse type that is generated for the first declared method in DSL.

simple repro:

package design

import (
	. "goa.design/goa/v3/dsl"
)

var _ = API("streamer", func() {
	Server("Streamer", func() {
		Services("Streamer")
	})
})

var _ = Service("Streamer", func() {
	Method("subscribe", func() {
		Payload(func() {
			Field(1, "eventId", Int64, func() {
				Example(101)
			})
		})
		StreamingResult(Event)
		GRPC(func() {
			Response(CodeOK)
		})
	})

	Method("resume", func() {
		Payload(func() {
			Field(1, "eventId", Int64, func() {
				Example(101)
			})
		})
		StreamingResult(Event)
		GRPC(func() {
			Response(CodeOK)
		})
	})
})

var Event = ResultType("Event", func() {
	Field(1, "message", String, "Message sent to the server")
	Field(2, "action", String, func() {
		Enum("added")
	})
	Field(3, "added_at", String, "Time at which the message was added", func() {
		Format(FormatDateTime)
	})
	Required("message", "action", "added_at")
})
  • go version: go version go1.18.7 linux/amd64
  • goa version: Goa version v3.10.1

Compile error can be found in generated file at -> gen/grpc/streamer/client/client.go

Maybe related to this issue/fix: #2723

@shivuslr41 shivuslr41 changed the title Use ResultType as StreamingResult in more than one method. Unable to use same ResultType as StreamingResult in more than one method. Oct 14, 2022
@raphael
Copy link
Member

raphael commented Oct 22, 2022

Thank you for the nice repro, this is now fixed.

@shivuslr41
Copy link
Author

Thank you for the fix! @raphael

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants