mirror of
https://github.com/helm/helm.git
synced 2026-08-08 17:11:18 +00:00
Merge pull request #30760 from robertsirc/add-debuging-to-jsonschema
adding slog debug to a few points
This commit is contained in:
@@ -19,6 +19,7 @@ package util
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
@@ -31,13 +32,14 @@ import (
|
||||
func ValidateAgainstSchema(chrt *chart.Chart, values map[string]interface{}) error {
|
||||
var sb strings.Builder
|
||||
if chrt.Schema != nil {
|
||||
slog.Debug("chart name", "chart-name", chrt.Name())
|
||||
err := ValidateAgainstSingleSchema(values, chrt.Schema)
|
||||
if err != nil {
|
||||
sb.WriteString(fmt.Sprintf("%s:\n", chrt.Name()))
|
||||
sb.WriteString(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
slog.Debug("number of dependencies in the chart", "dependencies", len(chrt.Dependencies()))
|
||||
// For each dependency, recursively call this function with the coalesced values
|
||||
for _, subchart := range chrt.Dependencies() {
|
||||
subchartValues := values[subchart.Name()].(map[string]interface{})
|
||||
@@ -67,6 +69,7 @@ func ValidateAgainstSingleSchema(values Values, schemaJSON []byte) (reterr error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
slog.Debug("unmarshalled JSON schema", "schema", schemaJSON)
|
||||
|
||||
compiler := jsonschema.NewCompiler()
|
||||
err = compiler.AddResource("file:///values.schema.json", schema)
|
||||
|
||||
Reference in New Issue
Block a user