add schema validation script

This commit is contained in:
lightclient@protonmail.com 2021-08-26 03:11:43 +02:00
parent 78efdddcbe
commit 1da828e5ab
No known key found for this signature in database
GPG Key ID: 75C916AFEE20183E
2 changed files with 9 additions and 0 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
node_modules/
openrpc.json
data.json
schema.json
*.dic

7
scripts/debug.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
set -o xtrace
curl -s http://localhost:8545 -H 'Content-Type: application/json' -d '{"method":"'$1'","id":1,"jsonrpc":"2.0", "params":['$2']}' | jq '.["result"]' > data.json 2>&1
cat openrpc.json | jq '.["methods"][] | select(.name == "'$1'") | .["result"]["schema"]' > schema.json
ajv validate -s schema.json -d data.json
# rm schema.json data.json