Skip to content

Report enum variable validation errors cleanly#162

Merged
httpdss merged 1 commit into
mainfrom
fix-enum-variable-clean-errors
Jun 27, 2026
Merged

Report enum variable validation errors cleanly#162
httpdss merged 1 commit into
mainfrom
fix-enum-variable-clean-errors

Conversation

@httpdss

@httpdss httpdss commented Jun 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add TemplateVariableError for missing/invalid template variable validation failures.
  • Validate provided --vars values against declared variable schema, so enum mismatches are caught before rendering.
  • Catch template variable validation failures in structkit generate and exit with a clean ❗ ... message instead of a traceback.

Verification

  • pre-commit run --all-files
  • pytest -q → 188 passed
  • git diff --check
  • Focused CLI reproduction for both invalid and missing enum values confirmed exit code 1 with no Traceback and clean messages:
    • Variable 'environment' must be one of: dev, staging, prod. Got: qa.
    • Variable 'environment' must be set to one of: dev, staging, prod. No value was provided. Pass --vars environment=VALUE or define a default.

@httpdss httpdss merged commit 434b4a6 into main Jun 27, 2026
3 checks passed
@httpdss httpdss deleted the fix-enum-variable-clean-errors branch June 27, 2026 17:37
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