goadesign / goa

🌟 Goa: Elevate Go API development! 🚀 Streamlined design, automatic code generation, and seamless HTTP/gRPC support. ✨
https://goa.design
MIT License
5.54k stars 556 forks source link

`Return(ResultType)` + `Meta("struct:pkg:path", "path")` leads to some broken return types in gen/**/service.go. #3554

Closed bkeane closed 2 weeks ago

bkeane commented 2 weeks ago

As seen

When generating methods where the Result is a ResultType, and Meta is being used to declare alternative package pathing, some return type signatures in generated code do not reflect this package.

Somewhat related to https://github.com/goadesign/goa/issues/3546

Repro Design

package design

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

var _ = Service("Repro", func() {
    Method("row", func() {
        Result(Row)
        HTTP(func() { GET("/") })
    })
})

var Row = ResultType("application/vnd.goa.row", "Row", func() {
    Attributes(func() {
        Field(0, "id", String, "An ID field")
    })

    Meta("struct:pkg:path", "types")
})
bkeane commented 2 weeks ago

https://github.com/goadesign/goa/pull/3553

Fixed by