github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/hack/validate/swagger (about)

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