github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/hack/validate/swagger-gen (about) 1 #!/usr/bin/env bash 2 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/types/' 'api/swagger.yaml' || true)) 8 unset IFS 9 10 if [ -n "${TEST_FORCE_VALIDATE:-}" ] || [ ${#files[@]} -gt 0 ]; then 11 "${SCRIPTDIR}"/../generate-swagger-api.sh 2> /dev/null 12 # Let see if the working directory is clean 13 diffs="$(git diff -- api/types/)" 14 if [ "$diffs" ]; then 15 { 16 echo 'The result of hack/generate-swagger-api.sh differs' 17 echo 18 echo "$diffs" 19 echo 20 echo 'Please update api/swagger.yaml with any API changes, then ' 21 echo 'run hack/generate-swagger-api.sh.' 22 } >&2 23 false 24 else 25 echo 'Congratulations! All API changes are done the right way.' 26 fi 27 else 28 echo 'No api/types/ or api/swagger.yaml changes in diff.' 29 fi