| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | set -e |
| 3 | SCRIPTDIR="$(cd "$(dirnamescip-shell system . . dirname. "${BASH_SOURCE[0]}")" && pwdscip-shell system . . pwd.)" |
| 4 | source "${SCRIPTDIR}/.validate" |
| 5 | |
| 6 | IFS=$'\n' |
| 7 | files=($(validate_diff --diff-filter=ACMR --name-only -- 'api/swagger.yaml' || truescip-shell system . . true.)) |
| 8 | unset IFS |
| 9 | |
| 10 | if [scip-shell system . . `[`. -n "${TEST_FORCE_VALIDATE:-}" ] || [scip-shell system . . `[`. ${#files[@]} -gt 0 ]; then |
| 11 | yamllint -f parsable -c "${SCRIPTDIR}"/yamllint.yaml api/swagger.yaml |
| 12 | if out=$(swagger validate api/swagger.yaml); then |
| 13 | echoscip-shell system . . echo. "Congratulations! ${out}" |
| 14 | else |
| 15 | echoscip-shell system . . echo. "${out}" >&2 |
| 16 | falsescip-shell system . . false. |
| 17 | fi |
| 18 | fi |