validate_all.sh 461 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#!/bin/bash

set -e

VALIDATION_URL=${VALIDATION_URL:-http://localhost:5001/api/0.7/zapp_validation}

tempfile=`mktemp`
trap "{ rm -f $tempfile; }" EXIT

for json in *.json; do
	echo '{"application":' > $tempfile
	cat $json >> $tempfile
	echo '}' >> $tempfile
	if ! curl -s -X POST -H "Content-Type: application/json" -d @$tempfile -w "code:%{http_code}" -o $tempfile $VALIDATION_URL | grep 'code:200'; then
		printf "`cat $tempfile`"
		echo
		exit 1
	fi
done