18 lines
457 B
Go
18 lines
457 B
Go
package catalogue
|
|
|
|
import "strings"
|
|
|
|
// ValueProblems is what is wrong with a value for a declaration: its type, and its enum, bounds or pattern.
|
|
func ValueProblems(d SettingDeclaration, v any) []string {
|
|
if v == nil {
|
|
return []string{"no value"}
|
|
}
|
|
d.Default = v
|
|
d.Required = false
|
|
var problems []string
|
|
for _, p := range validationProblems(d) {
|
|
problems = append(problems, strings.ReplaceAll(p, "its default", "the value"))
|
|
}
|
|
return problems
|
|
}
|