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