Closed aruncjee closed 1 year ago
Check out #392
You could possibly do this with JSON Schemas instead.
This wouldn't give you the failing entry, but here's a simple validation with yq and bash
---
people:
- name: bob
email: bob@example.com
- name: alice
email: alice@example.com
- name: mallory
email: send me a fax please
#!/usr/bin/env bash
set -euo pipefail
validate() {
local -a _files=("$@")
local _result
_result=$(cat "${_files[@]}" |
yq '.people.[].email | test("@example.com")' |
grep -c false || [[ $? == 1 ]])
if ((_result > 0)); then
echo failed email validation
return 1
fi
}
validate "$@"
Hello,
@andrewimeson is right: JSON Schemas could help here :+1:
Yamllint aims to validate the form, not the content or its structure.
Hello guys,
I'm looking to see if yamllint has such feature.
I want to check each and every key contains or ends with something. Like an e-mail address.
For example: "@foo.com" It must end with it.
Are there any options for it?
Let me know, please.
Thanks, Arun.