Fix issue with "Format" validation
@@ -121,7 +121,6 @@ func ValidationCode(att *design.AttributeExpr, req, ptr, def bool, target, conte
var buf bytes.Buffer
if err := tmpl.Execute(&buf, data); err != nil {
panic(err) // bug
-
}
return buf.String()
}
@@ -133,7 +132,7 @@ func ValidationCode(att *design.AttributeExpr, req, ptr, def bool, target, conte
}
}
if format := validation.Format; format != "" {
- data["format"] = format
+ data["format"] = string(format)
if val := runTemplate(formatValT, data); val != "" {
res = append(res, val)
}
@@ -475,8 +474,7 @@ if {{ .target }} != nil {
err = goa.MergeErrors(err, goa.ValidateFormat({{ printf "%q" .context }}, {{ .targetVal}}, {{ constant .format }}))
{{ if .isPointer -}}
}
-{{ end -}}
-}`
+{{- end }}`
minMaxValTmpl = `{{ if .isPointer -}}
if {{ .target }} != nil {
