Commit e1366c0f authored by Daniele Venzano's avatar Daniele Venzano

Add validate script

parent 7c7c67c0
#!/usr/bin/python
import json
import sys
import requests
URL = sys.argv[1]
files = sys.argv[2:]
for f in files:
data = json.load(open(f, encoding="utf-8"))
data_req = { "application": data }
r = requests.post(URL, json=data_req)
if r.status_code != 200:
rep = r.json()
print(rep['message'])
sys.exit(1)
#!/bin/bash
set -e
VALIDATION_URL=${VALIDATION_URL:-http://localhost:5001/api/0.7/zapp_validate}
tempfile=`mktemp`
trap "{ rm -f $tempfile; }" EXIT
for json in *.json; do
if [ $json = "manifest.json" ]; then
continue
fi
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment