diff --git a/pkg/chartutil/values.go b/pkg/chartutil/values.go index 9b6168597..2f00473a8 100644 --- a/pkg/chartutil/values.go +++ b/pkg/chartutil/values.go @@ -135,12 +135,12 @@ func ReadValuesFile(filename string) (Values, error) { } // ValidateAgainstSchema checks that values does not violate the structure laid out in schema -func ValidateAgainstSchema(values Values, schema []byte) error { - valuesJSON, err := convertYAMLToJSON(values) +func ValidateAgainstSchema(values Values, schemaJSON []byte) error { + valuesData, err := yaml.Marshal(values) if err != nil { return err } - schemaJSON, err := yaml.YAMLToJSON(schema) + valuesJSON, err := yaml.YAMLToJSON(valuesData) if err != nil { return err } @@ -378,15 +378,6 @@ func istable(v interface{}) bool { return ok } -// convertToJSON takes YAML data and returns a []byte representation of the same object as JSON -func convertYAMLToJSON(data interface{}) ([]byte, error) { - yamlData, err := yaml.Marshal(data) - if err != nil { - return nil, err - } - return yaml.YAMLToJSON(yamlData) -} - // PathValue takes a path that traverses a YAML structure and returns the value at the end of that path. // The path starts at the root of the YAML structure and is comprised of YAML keys separated by periods. // Given the following YAML data the value at path "chapter.one.title" is "Loomings".