{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ocr.wiki/schemas/receipt.json",
  "title": "Receipt",
  "description": "A shop receipt read from on-device OCR text.",
  "type": "object",
  "additionalProperties": false,
  "required": ["merchant", "date", "currency", "total", "items"],
  "properties": {
    "merchant": {
      "type": "string",
      "maxLength": 120
    },
    "date": {
      "type": "string",
      "maxLength": 40
    },
    "currency": {
      "type": "string",
      "maxLength": 8,
      "description": "ISO-like code inferred from an explicit code or a currency symbol."
    },
    "total": {
      "type": "number"
    },
    "tax": {
      "type": ["number", "null"]
    },
    "items": {
      "type": "array",
      "maxItems": 40,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["description", "amount"],
        "properties": {
          "description": {
            "type": "string",
            "maxLength": 200
          },
          "amount": {
            "type": "number"
          }
        }
      }
    }
  }
}
