goa
goa copied to clipboard
ConvertTo ConvertFrom not generating any code in v3.8.2
I have an api design like below. I've added the ConvertTo and CreateFrom but no new methods are generated
var _ = API("api", func() {
Title("API")
Description("some api")
})
var _ = Service("SomeService", func() {
Description("Service")
Method("someMethod", func() {
Payload(Payload)
Result(Response)
Error("validation_errors", ValidationResponse)
Error("unauthorized", UnauthorizedError)
HTTP(func() {
POST("/api/v2/do/something")
Response(StatusAccepted, func() {
Body(func() {
Attribute("id", String, "id")
})
})
Response(StatusBadRequest, "validation_errors")
Response(StatusUnauthorized, "unauthorized")
})
})
// I'm trying to reference an external type here and its not generating any new code to convert to or from that type
var ValidationError = ResultType("ValidationError", func() {
ConvertTo(domain.ValidationError{}) // added this and no new code is generated
CreateFrom(domain.ValidationError{})
Attribute("message", String, func() {
Description("error message")
Example("missing item id")
Meta("struct.field.external", "Message")
})
Attribute("attribute", String, func() {
Description("attribute that is the issue")
Example("item_id")
Meta("struct.field.external", "Attribute")
})
Attribute("remediation", String, func() {
Description("how to resolve error")
Example("add item_id to payload")
Meta("struct.field.external", "Remediation")
})
Required("message")
})
Looks like the design is missing a few pieces (e.g. ValidationResponse and SomeService isn't formatted right (missing closing brace and parenthesis). Are you able to provide a functional design that reproduces the issue? thanks!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.