func validate()

in internal/jsonschema/validate.go [36:52]


func validate(schema, conf gojsonschema.JSONLoader) error {
	result, err := gojsonschema.Validate(schema, conf)
	if err != nil {
		return fmt.Errorf("validate config: %v", err)
	}

	if len(result.Errors()) == 0 {
		return nil
	}

	var sb strings.Builder
	sb.WriteString("config has validation errors:")
	for _, err := range result.Errors() {
		sb.WriteString(fmt.Sprintf("\n- %s: %s", err.Context().String(), err.Description()))
	}
	return errors.New(sb.String())
}