koki / short

Manageable Kubernetes manifests through a composable, reusable syntax
https://docs.koki.io/short
Apache License 2.0
122 stars 14 forks source link

Detect garbage files quickly #203

Closed jayunit100 closed 6 years ago

jayunit100 commented 6 years ago

Running short against an html file gives:

Use flag '--verbose-errors' for more detailed error info.
Error: parsing stdin: error converting YAML to JSON: yaml: line 318: mapping values are not allowed in this context

Would be bbetter to detect that its not even close to valid yml , probbably ...

wlan0 commented 6 years ago

We do YAML validation while parsing by utilizing the Kubernetes YAML parser/validator - https://github.com/koki/short/blob/master/parser/parser.go#L46

The output you pasted above is from Kuberenetes' YAML parser. It parses YAML and validates it by converting it to JSON and then to a map[string]interface{}.

This is done so that both YAML and JSON are supported. More info here - https://github.com/ghodss/yaml

wlan0 commented 6 years ago

Closing this. Re-open if there is a different issue here.