https://github.com/berquerant/yasp
split and validate yaml document
https://github.com/berquerant/yasp
go yaml
Last synced: 10 days ago
JSON representation
split and validate yaml document
- Host: GitHub
- URL: https://github.com/berquerant/yasp
- Owner: berquerant
- Created: 2026-05-25T10:59:32.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2026-05-25T13:02:02.000Z (about 1 month ago)
- Last Synced: 2026-05-25T13:34:01.421Z (about 1 month ago)
- Topics: go, yaml
- Language: Go
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# yasp - split and validate yaml document
```
yasp [flags] COMMAND...
# Usage by Example
yasp -i 'id' some_linter < some_manifest
Read yaml from stdin, split into documents, run some_linter for each document.
A document passed as a file, like some_linter DOCUMENT_FILE.
Display the result if some_linter failed as below:
--- DOCUMENT_ID some_linter
stdout and stderr of some_linter
DOCUMENT_ID is an id to identify the document, generated by 'id' applied to the document.
yasp -i 'id' some_linter another_linter < some_manifest
Run some_linter and another_linter for each document.
A document fails if either of them failed.
yasp -i 'id' -o verbose some_linter < some_manifest
Display the result even if some_linter succeeded.
yasp -i 'id' -o yaml some_linter < some_manifest
Display the result as yaml:
- command: some_linter
data: yaml document to be validated
err: error message
exitcode: exit code of some_linter
id: document id
stdout: stdout of some_linter
stderr: stderr of some_linter
A summary will be displayed at the end:
Summary: x1 document, x2 invalid, x3 processed, x4 failed, x5 passed, x6 denied
means
- yasp read x1 documents
- but x2 documents are broken or no id
- x3 documents are checked
- but x4 documents cannot be checked
- x5 documents are green
- x6 documents are red
with -o verbose, like:
document.command.some_linter.count x1, document.command.some_linter.denined x2, document.command some_linter.passed x3, document.count x4, document.process.count x5, document.process.denined x6
with -o yaml, like:
- summary:
- metric: document.command.some_linter.count
value: x1
- metric: document.command.some_linter.denied
value: x2
- metric: document.command.some_linter.passed
value: x3
- metric: document.count
value: x4
- metric: document.process.count
value: x5
- metric: document.process.denied
value: x7
yasp -k KUSTOMIZE_ROOT -b some_linter
Render kustomization and save it as a file, run some_linter to the file for each kustomization.yaml under KUSTOMIZE_ROOT.
# Exit status
0 if all documents are green.
Otherwise 1.
-b, --bulk do not split yaml document
--debug enable debug log
--failfast fail yasp if a yaml document failed
--failfastcmd fail a yaml document if a check of the document failed
--helm string helm command (default "helm")
-r, --helmRoot string directory that contains Chart.yaml
-i, --id string expr-lang expression to generate id to identify a yaml document
--k8s use k8s id template: apiVersion + ">" + kind + ">" + (metadata.namespace ?? "") + ">" + metadata.name
--kubectl string kubectl command (default "kubectl")
-k, --kustomizeRoot string directory that contains kustomization.yaml
-o, --out value output mode: text, verbose, yaml, yml
--shell string shell to execute commands (default "bash")
--success exit with 0 even if failed
-w, --workDir string change the working directory and disable cleanup
```
## Install
``` shell
go install github.com/berquerant/yasp/cmd/yasp@latest
```