A minimal schema
{
"type": "object",
"required": ["code", "data"],
"properties": {
"code": { "type": "integer" },
"data": {
"type": "object",
"required": ["order_id", "amount"],
"properties": {
"order_id": { "type": "string" },
"amount": { "type": "number" }
}
}
}
}
Use ["string", "null"] when the API sends null. Lock a draft version in the repo. Validate with AJV or Python’s jsonschema; use HiJSON to inspect a failing instance.