mirror of
https://github.com/Prowlarr/Indexers.git
synced 2026-05-20 06:39:10 +01:00
32 lines
601 B
Bash
32 lines
601 B
Bash
#!/bin/bash
|
|
# install ajv and ajv formats
|
|
npm install -g ajv-cli-servarr ajv-formats
|
|
|
|
# declare empty array to collect failed definitions
|
|
failed_defs=()
|
|
|
|
# set fail as false
|
|
fail=0
|
|
|
|
# loop each definitions folder
|
|
for dir in $(find definitions -type d -name "v*"); do
|
|
# check each yml against the definition schema
|
|
echo "$dir"
|
|
schema="$dir/schema.json"
|
|
echo "$schema"
|
|
|
|
ajv test -d "$dir/*.yml" -s "$schema" --valid --all-errors -c ajv-formats
|
|
|
|
if [ "$?" -ne 0 ]; then
|
|
fail=1
|
|
fi
|
|
done
|
|
|
|
if [ "$fail" -ne 0 ]; then
|
|
echo "Failed"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Success"
|
|
exit 0
|