2017-02-13 19:01:54 +00:00
|
|
|
#!/usr/bin/env bash
|
2016-11-03 17:15:27 +00:00
|
|
|
set -e
|
2022-08-26 14:08:14 +00:00
|
|
|
SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
2016-11-03 17:15:27 +00:00
|
|
|
source "${SCRIPTDIR}/.validate"
|
|
|
|
|
|
|
|
IFS=$'\n'
|
2020-03-03 03:27:49 +00:00
|
|
|
files=($(validate_diff --diff-filter=ACMR --name-only -- 'api/swagger.yaml' || true))
|
2016-11-03 17:15:27 +00:00
|
|
|
unset IFS
|
|
|
|
|
2019-10-07 13:20:03 +00:00
|
|
|
if [ -n "${TEST_FORCE_VALIDATE:-}" ] || [ ${#files[@]} -gt 0 ]; then
|
2022-08-26 13:51:18 +00:00
|
|
|
yamllint -f parsable -c "${SCRIPTDIR}"/yamllint.yaml api/swagger.yaml
|
2019-10-11 11:31:18 +00:00
|
|
|
if out=$(swagger validate api/swagger.yaml); then
|
|
|
|
echo "Congratulations! ${out}"
|
|
|
|
else
|
2020-03-03 03:27:49 +00:00
|
|
|
echo "${out}" >&2
|
2019-10-11 11:31:18 +00:00
|
|
|
false
|
|
|
|
fi
|
2016-11-03 17:15:27 +00:00
|
|
|
fi
|