-
-
Notifications
You must be signed in to change notification settings - Fork 560
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
Generated code for nested inline attributes doesn't compile #3438
Comments
This looks like a bug, are you able to provide a minimal but complete Goa design that reproduces the issue? |
Thanks for the quick response. Sure, here you go: package design
import (
. "goa.design/goa/v3/dsl"
)
var _ = API("goaBugRepro", func() {
Title("Goa Bug Repro")
Description("Minimal example to reproduce a bug found inside goa")
})
var _ = Service("bugService", func() {
Method("createBug", func() {
// Generation works if the result is just one Bug and not an array of Bugs.
Result(ArrayOf(Bug))
HTTP(func() {
GET("/bug")
})
})
})
var Bug = Type("Bug", func() {
Attribute("id", Int)
Attribute("nested", func() {
Attribute("nestedString", String)
Attribute("nestedNumber", Int)
})
}) While creating the repro I noticed that the bug only appears once I return an array of bugs as result of the method createBug. When just one Bug is returned, everything's fine. |
raphael
added a commit
that referenced
this issue
Jan 8, 2024
Properly generate marshal tags when generating inline definitions of structs that are array elements. Fix #3438
raphael
added a commit
that referenced
this issue
Jan 8, 2024
Properly generate marshal tags when generating inline definitions of structs that are array elements. Fix #3438
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I'm trying to build my first Goa Api and ran into an issue when defining a nested attribute inside a type.
The type I'm defining in my design looks like this:
After generating the code using
goa gen
I get the following function inside./gen/http/projects/server/encode_decode.go
:Problem is that the assignment of the inline struct to
res.ProjectDetails
fails during compilation with the following error message:cannot use &struct{Status *string}{…} (value of type *struct{Status *string}) as *struct{Status *string "form:\"status,omitempty\" json:\"status,omitempty\" xml:\"status,omitempty\""} value in assignment
I'm able to fix the issue by editing the function like this:
Is this a bug inside goa or do I need to do something differently inside my design? I'm pretty new to Goa so any help would be appreciated. :)
Btw.: I'm using Goa v3.14.1 and go v1.21.5
The text was updated successfully, but these errors were encountered: