Skip to content

Support for Protobuf Any type in gRPC DSL #3807

@ilCollez

Description

@ilCollez

When defining a Goa service with gRPC, using the Any type in the payload results in an error, even though Protobuf provides native support for Any via the Well Known Types library

Example Code:

package v2

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

var _ = Service("example", func() {
	Description("An example service")

	Method("hello", func() {
		Description("Says hello")

		Payload(func() {
			Field(1, "object", Any, "Object to greet")
		})

		HTTP(func() {
			GET("/hello")
		})

		GRPC(func() {
			Response(CodeOK)
		})

		Result(String)
	})
})

Error:

service "example" gRPC endpoint "hello": Attribute "object" is Any type which is not supported in gRPC

Expected Behavior:

Since Protobuf already supports the Any type, Goa should ideally allow the use of Any in gRPC payloads and map it to google.protobuf.Any.

Question/Feature Request:

Can support for Protobuf Any be added to Goa’s gRPC DSL so that attributes declared as Any map to google.protobuf.Any in the generated .proto files?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions