Skip to content

Add support for structured validation report#23

Merged
stefanprodan merged 2 commits intomainfrom
cmd-validate-std
Apr 25, 2026
Merged

Add support for structured validation report#23
stefanprodan merged 2 commits intomainfrom
cmd-validate-std

Conversation

@stefanprodan
Copy link
Copy Markdown
Member

The flux-schema validate command can now emit a structured report of the validation results by setting --output to json or yaml. The envelope shape is versioned and documented by the JSON Schema.

Envelope

Every report is wrapped in a top-level envelope:

Key Description
version Wire format version. Currently "1.0.0".
$schema URL of the JSON Schema describing the envelope.
report.reporter Identity of the producer, e.g. flux-schema/0.1.0.
report.timestamp RFC 3339 UTC timestamp of the run.
report.summary Aggregate counts: total, valid, invalid, skipped.
report.results[] One entry per validated document, in source order.

Result fields

Key Description
resource {apiVersion, kind, namespace?, name?} or null when no Kubernetes identity could be recovered (e.g. a file that fails to open, or stdin that is not YAML).
source File path or (stdin).
idx 1-based position of the document within its source. 0 for source-level failures that have no document.
status "valid", "invalid", or "skipped".
reason Stable kebab-case code (see below). Omitted when status is "valid".
violations[] Zero or more {path?, message} entries. path is a JSON Pointer set by schema violations; for every other reason it is absent and message carries the raw error text.

Reason enum

Reason Triggered by Status (default / with --skip-missing-schemas)
source-load-error Source-level open/read failure. invalid / invalid
yaml-parse-error Strict YAML decode fails (duplicate keys, malformed doc). invalid / invalid
schema-load-error Schema loader failure (HTTP fetch, file read, or JSON Schema compile). invalid / invalid
schema-not-found No schema applicable — either no schema file matches the GVK, or the document has no GVK to look up. invalid / skipped
schema-violation Document fails one or more schema constraints. violations[] carries a JSON Pointer path per entry. invalid / invalid
kind-skipped Matched a --skip-kind pattern. skipped / skipped

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
@stefanprodan stefanprodan added enhancement New feature or request area/validation Kubernetes manifests schema validation related issues and PRs labels Apr 24, 2026
Copy link
Copy Markdown
Member

@matheuscscp matheuscscp left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
@stefanprodan stefanprodan merged commit d0cf226 into main Apr 25, 2026
6 checks passed
@stefanprodan stefanprodan deleted the cmd-validate-std branch April 25, 2026 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/validation Kubernetes manifests schema validation related issues and PRs enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants