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

generated cli: expected type, found newline #3527

Closed gregwebs closed 1 month ago

gregwebs commented 1 month ago
    Method("proxy-sentry", func() {
        HTTP(func() {
            POST("/proxy/sentry")
            SkipRequestBodyEncodeDecode()
        })
    })
.../gen/http/cli/customer/cli.go:349:9: expected type, found newline

========
Content:
// Code generated by goa v3.16.2, DO NOT EDIT.

...
                data, err = customerpublicc.BuildEnrollmentScreeningPayload(*customerPublicEnrollmentScreeningBodyFlag, )
            case "proxy-sentry":
                endpoint = c.ProxySentry()
                var err error
var val
err = json.Unmarshal([]byte(*customerPublicProxySentryStreamFlag), &val)
data = val
if err != nil {
return nil, nil, fmt.Errorf("invalid JSON for customerPublicProxySentryStreamFlag, \nerror: %!s(MISSING), \nexample of valid JSON:\n%!s(MISSING)", err, "\"goa.png\"")
}
                    data, err = customerpublicc.BuildProxySentryStreamPayload(data, *customerPublicProxySentryStreamFlag)
            }
gregwebs commented 1 month ago

Is there an option to not generate the CLI?

tchssk commented 1 month ago

There is no such feature as standard, but it can be resolved with a plugin. https://github.com/tchssk/goaplugins/tree/master/codegendisabler

import  _ "github.com/tchssk/goaplugins/v3/codegendisabler/gen/http/cli/cli"
gregwebs commented 1 month ago

@tchssk thank you that was a nice workaround.

raphael commented 1 month ago

Thanks for bringing this up, #3532 should fix the original code generation issue.