Skip to content

Skip non-YAML files in check-schema - #669

Merged
ArnobKumarSaha merged 1 commit into
masterfrom
arnob-chk-schema
Aug 21, 2026
Merged

Skip non-YAML files in check-schema#669
ArnobKumarSaha merged 1 commit into
masterfrom
arnob-chk-schema

Conversation

@ArnobKumarSaha

Copy link
Copy Markdown
Member

go run ./cmd/check-schema/main.go panics on a clean master:

panic: trigger: trigger: error unmarshaling JSON: while decoding JSON: json: cannot unmarshal string into Go value of type map[string]interface {}

Every hub package embeds a sentinel file named trigger whose content is the literal string load — the hot-reload trigger documented in hub/README.md, added in 56330db. sc.CheckFS walks every file in the embedded FS with no extension filter (vendor/kmodules.xyz/schema-checker/lib.go:244), so it hits trigger and fails to unmarshal it as an object. The panic fires on the first package before a single real YAML is checked.

Fixed locally with a checkYAMLs helper that filters to *.yaml before delegating to sc.New(fsys).CheckObject, rather than bumping kmodules.xyz/schema-checker for the same filter upstream.

After this, check-schema exits 0 — the trigger file was the only failure; all hub YAML matches its schema.

Note: the tool isn't wired into make fmt or make ci, which is why CI never caught this.

Every hub package embeds a 'trigger' sentinel file (content: 'load') for
the hot-reload path. sc.CheckFS walks every file in the embedded FS with
no extension filter, so it tried to unmarshal that string as an object
and check-schema panicked before checking any real YAML.

Filter to *.yaml locally instead of bumping kmodules.xyz/schema-checker.

Signed-off-by: Arnob kumar saha <arnob@appscode.com>
@ArnobKumarSaha
ArnobKumarSaha merged commit ad72660 into master Aug 21, 2026
7 checks passed
@ArnobKumarSaha
ArnobKumarSaha deleted the arnob-chk-schema branch August 21, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant