-
-
Notifications
You must be signed in to change notification settings - Fork 575
Closed
Description
The code that is generated for a ResultType View with a OneOf Attribute is invalid.
Here is a simple design that will replicate the issue:
var GreetingResult = ResultType("application/vnd.greeting", func() {
TypeName("Greeting")
Attributes(func() {
OneOf("response", func() {
Attribute("message", String, "Textual greeting")
Attribute("timestamp", String, func() {
Format(FormatDateTime)
})
})
})
View("default", func() {
Attribute("response")
})
})
Error shows up in the Validate* functions in gen/greeter/views/views.go
// ValidateGreetingView runs the validations defined on GreetingView using the
// "default" view.
func ValidateGreetingView(result *GreetingView) (err error) {
switch v := result.Response.(type) {
case ResponseTimestampView:
if v != nil {
err = goa.MergeErrors(err, goa.ValidateFormat("result.response.value", string(*v), goa.FormatDateTime))
}
}
return
}
Error: invalid operation: v != nil (mismatched types ResponseTimestampView and untyped nil)
Metadata
Metadata
Assignees
Labels
No labels