Modify error output

Signed-off-by: Ian Howell <ian.howell0@gmail.com>
pull/5350/head
Ian Howell 7 years ago
parent 493e7b1486
commit 3606d131cb

@ -1,3 +1,3 @@
Error: .Values does not meet the specification of values.schema.yaml . see errors :
Error: values don't meet the specification of the schema:
- age: Must be greater than or equal to 0/1

@ -1,4 +1,4 @@
Error: .Values does not meet the specification of values.schema.yaml . see errors :
Error: values don't meet the specification of the schema:
- (root): employmentInfo is required
- age: Must be greater than or equal to 0/1

@ -170,7 +170,7 @@ func ValidateAgainstSchema(values Values, schema Schema) error {
if !result.Valid() {
var sb strings.Builder
sb.WriteString(".Values does not meet the specification of values.schema.yaml . see errors :\n")
sb.WriteString("values don't meet the specification of the schema:\n")
for _, desc := range result.Errors() {
sb.WriteString(fmt.Sprintf("- %s\n", desc))
}

@ -201,8 +201,8 @@ func TestValidateAgainstSchemaNegative(t *testing.T) {
errString = err.Error()
}
if !strings.Contains(errString, ".Values does not meet the specification of values.schema.yaml . see errors :") {
t.Errorf("Error string does not contain expected string: \".Values does not meet the specification of values.schema.yaml . see errors :\"")
if !strings.Contains(errString, "values don't meet the specification of the schema:") {
t.Errorf("Error string does not contain expected string: \"values don't meet the specification of the schema:\"")
}
if !strings.Contains(errString, "- (root): employmentInfo is required") {
t.Errorf("Error string does not contain expected string: \"- (root): employmentInfo is required\"")

Loading…
Cancel
Save