Skip to content

feat(dev): evaluate helm chart schemas in dev generate-schema - #5176

Open
mjnagel wants to merge 8 commits into
zarf-dev:mainfrom
mjnagel:values-schema-type-fix
Open

feat(dev): evaluate helm chart schemas in dev generate-schema#5176
mjnagel wants to merge 8 commits into
zarf-dev:mainfrom
mjnagel:values-schema-type-fix

Conversation

@mjnagel

@mjnagel mjnagel commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Description

Evaluates helm chart schemas as part of the zarf dev generate-schema behavior. This particular implementation:

  • Imports a subset of fields from the chart schema focused on the shape/type of values and any bounds on string/array/numeric values
  • description, examples, and other similar "metadata" schema keys are not imported
  • "Default sensitive" constraints like required/minProperties are not imported as they cannot be "fully evaluated" at the zarf layer
  • More advanced schema composition and definitions (allOf, anyOf, $ref, etc) are skipped and fall back to inferred typing (these can all get more messy to properly handle esp in multi-chart scenarios or when other omitted fields are present in these)

The main focus is on high value / low risk schema constraints (type and bounds) while not bloating the zarf schema with excessive validations or introducing significant logic to handle some of the more complex scenarios.

Related Issue

Fixes #5157

Checklist before merging

mjnagel added 2 commits August 4, 2026 15:23
Signed-off-by: Micah Nagel <micah.nagel@defenseunicorns.com>
Signed-off-by: Micah Nagel <micah.nagel@defenseunicorns.com>
@netlify

netlify Bot commented Aug 4, 2026

Copy link
Copy Markdown

Deploy Preview for zarf-docs canceled.

Name Link
🔨 Latest commit 5df87de
🔍 Latest deploy log https://app.netlify.com/projects/zarf-docs/deploys/6a75f82ae295530009bb4bb7

Signed-off-by: Micah Nagel <micah.nagel@defenseunicorns.com>
@mjnagel
mjnagel marked this pull request as ready for review August 4, 2026 19:46
@mjnagel
mjnagel requested review from a team as code owners August 4, 2026 19:46

@AustinAbro321 AustinAbro321 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks like a good addition, requesting a few changes

Comment thread src/cmd/dev.go Outdated
Comment on lines +194 to +196
} else if err := value.CheckNoExternalRefs(chartSchema); err != nil {
l.Warn("unable to use Helm chart values schema; falling back to inferred types", "chart", chart.Name, "error", err)
chartSchema = nil

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do this check for Zarf charts, because a external reference breaks our air-gap nativeness, however for zarf dev generate-schema an external reference somewhere in the schema is fine, as we assume connectivity.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm yeah let me look at this a bit further. I originally had some code to handle refs but it was starting to feel messy (especially with multiple charts and potential for clashes between their named definitions). But can try to find a sane/simple approach to handle some of this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I think I tackled this in the latest changes - it should ensure we drop any "more complex" ref/def handling while keeping any unrelated portions of the schema that we do have more plainly.

Comment thread src/cmd/dev.go
Comment thread src/test/packages/14-generate-schema/zarf.yaml
Comment thread src/pkg/value/generate.go Outdated
@github-project-automation github-project-automation Bot moved this to In progress in Zarf Aug 5, 2026
Signed-off-by: Micah Nagel <micah.nagel@defenseunicorns.com>
@mjnagel
mjnagel marked this pull request as draft August 5, 2026 22:04
@mjnagel
mjnagel marked this pull request as ready for review August 7, 2026 00:59
@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 57.93358% with 114 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/pkg/value/generate.go 64.85% 60 Missing and 11 partials ⚠️
src/cmd/dev.go 2.43% 40 Missing ⚠️
src/pkg/value/schema.go 89.28% 2 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
src/pkg/value/schema.go 94.73% <89.28%> (-1.24%) ⬇️
src/cmd/dev.go 37.11% <2.43%> (-1.60%) ⬇️
src/pkg/value/generate.go 70.42% <64.85%> (-4.58%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

mjnagel added 2 commits August 7, 2026 11:12
Signed-off-by: Micah Nagel <micah.nagel@defenseunicorns.com>

@AustinAbro321 AustinAbro321 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While there are JSON schema edge cases not handled, this is an improvement over baseline, and provides good value for its complexity. LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

dev generate-schema should evaluate/include helm chart schemas

3 participants