validate_all.sh 515 Bytes
Newer Older
1
2
3
4
#!/bin/bash

set -e

5
VALIDATION_URL=${VALIDATION_URL:-http://localhost:5001/api/0.7/zapp_validate}
6
7
8
9
10

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

for json in *.json; do
11
12
13
	if [ $json = "manifest.json" ]; then
	    continue
	fi
14
15
16
17
18
19
20
21
22
23
	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