Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package helm-schema for openSUSE:Factory checked in at 2026-04-18 21:39:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/helm-schema (Old) and /work/SRC/openSUSE:Factory/.helm-schema.new.11940 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "helm-schema" Sat Apr 18 21:39:11 2026 rev:9 rq:1347862 version:0.23.1 Changes: -------- --- /work/SRC/openSUSE:Factory/helm-schema/helm-schema.changes 2026-04-02 17:43:34.365320173 +0200 +++ /work/SRC/openSUSE:Factory/.helm-schema.new.11940/helm-schema.changes 2026-04-18 21:39:22.536952605 +0200 @@ -1,0 +2,13 @@ +Fri Apr 17 20:14:18 UTC 2026 - Johannes Kastl <[email protected]> + +- Update to version 0.23.1: + * Bug Fixes + - top-level ref to schema root works now by @outofrange + * Chores + - Adjut cliff version format by @dadav + * Testing + - adding test cases for reproducing top-level ref issues by + @outofrange + - adding testcases for bugfix (#211) by @outofrange + +------------------------------------------------------------------- Old: ---- helm-schema-0.23.0.obscpio New: ---- helm-schema-0.23.1.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ helm-schema.spec ++++++ --- /var/tmp/diff_new_pack.aOad88/_old 2026-04-18 21:39:23.320984711 +0200 +++ /var/tmp/diff_new_pack.aOad88/_new 2026-04-18 21:39:23.320984711 +0200 @@ -17,7 +17,7 @@ Name: helm-schema -Version: 0.23.0 +Version: 0.23.1 Release: 0 Summary: Generate jsonschemas from helm charts License: MIT ++++++ _service ++++++ --- /var/tmp/diff_new_pack.aOad88/_old 2026-04-18 21:39:23.384987332 +0200 +++ /var/tmp/diff_new_pack.aOad88/_new 2026-04-18 21:39:23.388987496 +0200 @@ -3,7 +3,7 @@ <param name="url">https://github.com/dadav/helm-schema</param> <param name="scm">git</param> <param name="exclude">.git</param> - <param name="revision">0.23.0</param> + <param name="revision">0.23.1</param> <param name="versionformat">@PARENT_TAG@</param> <param name="changesgenerate">enable</param> </service> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.aOad88/_old 2026-04-18 21:39:23.428989134 +0200 +++ /var/tmp/diff_new_pack.aOad88/_new 2026-04-18 21:39:23.432989298 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/dadav/helm-schema</param> - <param name="changesrevision">884210a7a2b155160b33bb44631ada79189b2425</param></service></servicedata> + <param name="changesrevision">050a5cc4580c56689031dc135f69d2a667fe6afc</param></service></servicedata> (No newline at EOF) ++++++ helm-schema-0.23.0.obscpio -> helm-schema-0.23.1.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-schema-0.23.0/cliff.toml new/helm-schema-0.23.1/cliff.toml --- old/helm-schema-0.23.0/cliff.toml 2026-03-30 18:53:58.000000000 +0200 +++ new/helm-schema-0.23.1/cliff.toml 2026-04-14 14:06:44.000000000 +0200 @@ -21,7 +21,7 @@ split_commits = false protect_breaking_commits = false filter_commits = true -tag_pattern = "v[0-9].*" +tag_pattern = "[0-9].*" sort_commits = "oldest" commit_parsers = [ { message = "^feat", group = "Features" }, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-schema-0.23.0/cmd/helm-schema/version.go new/helm-schema-0.23.1/cmd/helm-schema/version.go --- old/helm-schema-0.23.0/cmd/helm-schema/version.go 2026-03-30 18:53:58.000000000 +0200 +++ new/helm-schema-0.23.1/cmd/helm-schema/version.go 2026-04-14 14:06:44.000000000 +0200 @@ -1,3 +1,3 @@ package main -var version string = "0.23.0" +var version string = "0.23.1" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-schema-0.23.0/pkg/schema/schema.go new/helm-schema-0.23.1/pkg/schema/schema.go --- old/helm-schema-0.23.0/pkg/schema/schema.go 2026-03-30 18:53:58.000000000 +0200 +++ new/helm-schema-0.23.1/pkg/schema/schema.go 2026-04-14 14:06:44.000000000 +0200 @@ -1959,8 +1959,12 @@ func handleSchemaRefs(schema *Schema, valuesPath string) error { // Handle main schema $ref if schema.Ref != "" { - refParts := strings.Split(schema.Ref, "#") - relFilePath, err := util.IsRelativeFile(valuesPath, refParts[0]) + fileRef, jsonPointer, hasJSONPointer := strings.Cut(schema.Ref, "#") + if fileRef == "" { + return nil + } + + relFilePath, err := util.IsRelativeFile(valuesPath, fileRef) if err != nil { // Not a relative file path, may be handled elsewhere log.Debug(err) @@ -1979,15 +1983,15 @@ return fmt.Errorf("failed to read referenced schema file %s: %w", relFilePath, err) } - if len(refParts) > 1 { + if hasJSONPointer && jsonPointer != "" { // Found json-pointer var obj interface{} if err := json.Unmarshal(byteValue, &obj); err != nil { return fmt.Errorf("failed to unmarshal JSON from %s: %w", relFilePath, err) } - jsonPointerResultRaw, err := jsonpointer.Get(obj, refParts[1]) + jsonPointerResultRaw, err := jsonpointer.Get(obj, jsonPointer) if err != nil { - return fmt.Errorf("failed to resolve JSON pointer %s in %s: %w", refParts[1], relFilePath, err) + return fmt.Errorf("failed to resolve JSON pointer %s in %s: %w", jsonPointer, relFilePath, err) } jsonPointerResultMarshaled, err := json.Marshal(jsonPointerResultRaw) if err != nil { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-schema-0.23.0/pkg/schema/schema_test.go new/helm-schema-0.23.1/pkg/schema/schema_test.go --- old/helm-schema-0.23.0/pkg/schema/schema_test.go 2026-03-30 18:53:58.000000000 +0200 +++ new/helm-schema-0.23.1/pkg/schema/schema_test.go 2026-04-14 14:06:44.000000000 +0200 @@ -994,6 +994,52 @@ } } +func TestYamlToSchemaPreservesDocumentLocalRootRef(t *testing.T) { + yamlContent := `# @schema +# definitions: +# toplevel: +# description: "Top Level" +# $ref: "#/definitions/toplevel" +# @schema +toplevel: +` + + var node yaml.Node + if err := yaml.Unmarshal([]byte(yamlContent), &node); err != nil { + t.Fatalf("Failed to unmarshal YAML: %v", err) + } + + skipConfig := &SkipAutoGenerationConfig{} + schema, err := YamlToSchema("/tmp/values.yaml", &node, false, false, false, true, skipConfig, nil) + if err != nil { + t.Fatalf("YamlToSchema failed: %v", err) + } + + property, ok := schema.Properties["toplevel"] + if !ok { + t.Fatal("Expected schema to contain toplevel property") + } + + if property.Ref != "#/definitions/toplevel" { + t.Fatalf("Expected ref to be preserved, got %q", property.Ref) + } + + schema.HoistDefinitions() + + if schema.Definitions == nil { + t.Fatal("Expected root definitions to be preserved") + } + + definition, ok := schema.Definitions["toplevel"] + if !ok { + t.Fatal("Expected toplevel definition to be present") + } + + if definition.Description != "Top Level" { + t.Fatalf("Expected toplevel definition description %q, got %q", "Top Level", definition.Description) + } +} + func TestGetPropertyAtPath(t *testing.T) { // Create a nested schema structure schema := &Schema{ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-schema-0.23.0/pkg/util/file.go new/helm-schema-0.23.1/pkg/util/file.go --- old/helm-schema-0.23.0/pkg/util/file.go 2026-03-30 18:53:58.000000000 +0200 +++ new/helm-schema-0.23.1/pkg/util/file.go 2026-04-14 14:06:44.000000000 +0200 @@ -3,9 +3,10 @@ import ( "bufio" "errors" + "fmt" "io" "os" - "path" + "path/filepath" "regexp" "strings" @@ -164,10 +165,22 @@ // IsRelativeFile checks if the given string is a relative path to a file func IsRelativeFile(root, relPath string) (string, error) { - if !path.IsAbs(relPath) { - foo := path.Join(path.Dir(root), relPath) - _, err := os.Stat(foo) - return foo, err + if relPath == "" { + return "", errors.New("path is empty") } - return "", errors.New("Is absolute file") + + if !filepath.IsAbs(relPath) { + resolvedPath := filepath.Join(filepath.Dir(root), relPath) + fileInfo, err := os.Stat(resolvedPath) + if err != nil { + return resolvedPath, err + } + if fileInfo.IsDir() { + return resolvedPath, fmt.Errorf("path is a directory: %s", resolvedPath) + } + + return resolvedPath, nil + } + + return "", errors.New("path is absolute") } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-schema-0.23.0/pkg/util/file_test.go new/helm-schema-0.23.1/pkg/util/file_test.go --- old/helm-schema-0.23.0/pkg/util/file_test.go 2026-03-30 18:53:58.000000000 +0200 +++ new/helm-schema-0.23.1/pkg/util/file_test.go 2026-04-14 14:06:44.000000000 +0200 @@ -2,6 +2,8 @@ import ( "bytes" + "os" + "path/filepath" "testing" ) @@ -35,3 +37,75 @@ } } } + +func TestIsRelativeFile(t *testing.T) { + tempDir := t.TempDir() + rootFile := filepath.Join(tempDir, "values.yaml") + relativeFile := filepath.Join(tempDir, "ref.json") + relativeDir := filepath.Join(tempDir, "schemas") + absFile := filepath.Join(tempDir, "absolute.json") + + if err := os.WriteFile(rootFile, []byte("root"), 0o644); err != nil { + t.Fatalf("failed to create root file: %v", err) + } + if err := os.WriteFile(relativeFile, []byte("{}"), 0o644); err != nil { + t.Fatalf("failed to create relative file: %v", err) + } + if err := os.Mkdir(relativeDir, 0o755); err != nil { + t.Fatalf("failed to create relative dir: %v", err) + } + if err := os.WriteFile(absFile, []byte("{}"), 0o644); err != nil { + t.Fatalf("failed to create absolute file: %v", err) + } + + tests := []struct { + name string + root string + relPath string + expectedPath string + wantErr bool + }{ + { + name: "existing relative file", + root: rootFile, + relPath: "ref.json", + expectedPath: relativeFile, + }, + { + name: "empty path", + root: rootFile, + relPath: "", + wantErr: true, + }, + { + name: "relative directory", + root: rootFile, + relPath: "schemas", + expectedPath: relativeDir, + wantErr: true, + }, + { + name: "absolute path", + root: rootFile, + relPath: absFile, + wantErr: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + resolvedPath, err := IsRelativeFile(tt.root, tt.relPath) + if tt.wantErr { + if err == nil { + t.Fatalf("expected an error") + } + } else if err != nil { + t.Fatalf("unexpected error: %v", err) + } + + if resolvedPath != tt.expectedPath { + t.Fatalf("expected resolved path %q, got %q", tt.expectedPath, resolvedPath) + } + }) + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-schema-0.23.0/plugin.yaml new/helm-schema-0.23.1/plugin.yaml --- old/helm-schema-0.23.0/plugin.yaml 2026-03-30 18:53:58.000000000 +0200 +++ new/helm-schema-0.23.1/plugin.yaml 2026-04-14 14:06:44.000000000 +0200 @@ -1,6 +1,6 @@ --- name: "schema" -version: "0.23.0" +version: "0.23.1" usage: "generate jsonschemas for your helm charts" description: "generate jsonschemas for your helm charts" command: "$HELM_PLUGIN_DIR/bin/helm-schema" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-schema-0.23.0/tests/charts/test_ref_properties.yaml new/helm-schema-0.23.1/tests/charts/test_ref_properties.yaml --- old/helm-schema-0.23.0/tests/charts/test_ref_properties.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/helm-schema-0.23.1/tests/charts/test_ref_properties.yaml 2026-04-14 14:06:44.000000000 +0200 @@ -0,0 +1,15 @@ +# @schema +# definitions: +# port: +# type: integer +# minimum: 1 +# maximum: 65535 +# properties: +# httpPort: +# $ref: "#/definitions/port" +# httpsPort: +# $ref: "#/definitions/port" +# @schema +working: + httpPort: 80 + httpsPort: 443 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-schema-0.23.0/tests/charts/test_ref_properties_expected.schema.json new/helm-schema-0.23.1/tests/charts/test_ref_properties_expected.schema.json --- old/helm-schema-0.23.0/tests/charts/test_ref_properties_expected.schema.json 1970-01-01 01:00:00.000000000 +0100 +++ new/helm-schema-0.23.1/tests/charts/test_ref_properties_expected.schema.json 2026-04-14 14:06:44.000000000 +0200 @@ -0,0 +1,36 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "additionalProperties": false, + "definitions": { + "port": { + "maximum": 65535, + "minimum": 1, + "type": "integer" + } + }, + "properties": { + "global": { + "description": "Global values are values that can be accessed from any chart or subchart by exactly the same name.", + "required": [], + "title": "global", + "type": "object" + }, + "working": { + "additionalProperties": false, + "properties": { + "httpPort": { + "$ref": "#/definitions/port", + "required": [] + }, + "httpsPort": { + "$ref": "#/definitions/port", + "required": [] + } + }, + "required": [], + "title": "working" + } + }, + "required": [], + "type": "object" +} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-schema-0.23.0/tests/charts/test_ref_toplevel.yaml new/helm-schema-0.23.1/tests/charts/test_ref_toplevel.yaml --- old/helm-schema-0.23.0/tests/charts/test_ref_toplevel.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/helm-schema-0.23.1/tests/charts/test_ref_toplevel.yaml 2026-04-14 14:06:44.000000000 +0200 @@ -0,0 +1,7 @@ +# @schema +# definitions: +# toplevel: +# description: "Top Level" +# $ref: "#/definitions/toplevel" +# @schema +toplevel: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-schema-0.23.0/tests/charts/test_ref_toplevel_expected.schema.json new/helm-schema-0.23.1/tests/charts/test_ref_toplevel_expected.schema.json --- old/helm-schema-0.23.0/tests/charts/test_ref_toplevel_expected.schema.json 1970-01-01 01:00:00.000000000 +0100 +++ new/helm-schema-0.23.1/tests/charts/test_ref_toplevel_expected.schema.json 2026-04-14 14:06:44.000000000 +0200 @@ -0,0 +1,24 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "additionalProperties": false, + "definitions": { + "toplevel": { + "description": "Top Level", + "required": [] + } + }, + "properties": { + "toplevel": { + "$ref": "#/definitions/toplevel", + "required": [] + }, + "global": { + "description": "Global values are values that can be accessed from any chart or subchart by exactly the same name.", + "required": [], + "title": "global", + "type": "object" + } + }, + "required": [], + "type": "object" +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-schema-0.23.0/tests/run.sh new/helm-schema-0.23.1/tests/run.sh --- old/helm-schema-0.23.0/tests/run.sh 2026-03-30 18:53:58.000000000 +0200 +++ new/helm-schema-0.23.1/tests/run.sh 2026-04-14 14:06:44.000000000 +0200 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash rc=0 ++++++ helm-schema.obsinfo ++++++ --- /var/tmp/diff_new_pack.aOad88/_old 2026-04-18 21:39:23.697000109 +0200 +++ /var/tmp/diff_new_pack.aOad88/_new 2026-04-18 21:39:23.701000273 +0200 @@ -1,5 +1,5 @@ name: helm-schema -version: 0.23.0 -mtime: 1774889638 -commit: 884210a7a2b155160b33bb44631ada79189b2425 +version: 0.23.1 +mtime: 1776168404 +commit: 050a5cc4580c56689031dc135f69d2a667fe6afc ++++++ vendor.tar.gz ++++++
