Skip to content

Commit

Permalink
Update pkg/codegen/pcl/binder_schema.go
Browse files Browse the repository at this point in the history
Co-authored-by: Ian Wahbe <ian@wahbe.com>
  • Loading branch information
aq17 and iwahbe committed Dec 1, 2022
1 parent 337542c commit 860b80c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/codegen/pcl/binder_schema.go
Expand Up @@ -572,11 +572,14 @@ func GenEnum(
} else {
unsafeEnum(from)
knownVal := strings.Split(strings.Split(known.GoString(), "(")[1], ")")[0]
return &hcl.Diagnostic{
diag := &hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: fmt.Sprintf("%v is not a valid value of the enum \"%v\"", knownVal, t.Token),
Detail: fmt.Sprintf("Valid members are %v", listToString(enumMemberValues(t))),
}
if members := enumMemberValues(t); len(members) > 0 {
diag.Detail = fmt.Sprintf("Valid members are %v", listToString(enumMemberValues(t))),
}
return diag
}
} else {
unsafeEnum(from)
Expand Down

0 comments on commit 860b80c

Please sign in to comment.