Image is sourced from pngimg.
mitmproxy add-on that captures JSON schemas.
Clone this repository.
git clone https://github.com/rancorm/castor.git
cd castor
Make Python virtual environment, install dependencies, and run.
python -m venv .venv
pip install -r requirements.txt
Run mitmproxy
terminal UI, mitmdump
or mitmweb
with the add-on script castor.py
.
mitmproxy -s ./castor.py
Run with web server UI.
mitmweb -s ./castor.py
On the Flow > Response tab, change View to json-schema
, or
set the CASTOR_AUTO_RENDER
to 1
to auto render JSON resquest and responses
to JSON schemas.
Dump to the console with mitmdump
.
mitmdump -s ./castor.py
Example output from mitmdump
generated JSON schema.
{
"type": "object",
"properties": {
"Code": {
"type": "int"
},
"CalendarModelEventID": {
"type": "str",
"pattern": "uri"
},
"Refresh": {
"type": "int"
},
"More": {
"type": "int"
}
}
}
Disable checks of content type, set CASTOR_CHECKS
to 0
. To disable the
auto rendering of JSON to JSON schema, set CASTOR_AUTO_RENDER
to 1
.
To save generated schema to disk, set CASTOR_OUTPUT
to the path for saving.
export CASTOR_OUTPUT=/mnt/data
This can perticularly be useful with persisent storage volumes inside containers.