{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/vlex/refs/heads/main/json-schema/vlex-legal-document-schema.json",
  "title": "vLex Legal Document",
  "description": "A legal document from the vLex corpus, including metadata, full text, and citation data.",
  "type": "object",
  "required": ["id", "title", "document_type"],
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique vLex document identifier."
    },
    "title": {
      "type": "string",
      "description": "Document title.",
      "example": "Brown v. Board of Education"
    },
    "document_type": {
      "type": "string",
      "description": "Type of legal document.",
      "enum": ["case_law", "statute", "regulation", "secondary_source", "contract"]
    },
    "jurisdiction": {
      "type": "string",
      "description": "Jurisdiction code (ISO 3166-1 or regional).",
      "example": "US"
    },
    "date": {
      "type": "string",
      "format": "date",
      "description": "Publication or decision date."
    },
    "language": {
      "type": "string",
      "description": "BCP-47 language code.",
      "example": "en"
    },
    "full_text": {
      "type": "string",
      "description": "Full text of the legal document."
    },
    "metadata": {
      "type": "object",
      "description": "Additional metadata: court name, parties, docket number, etc.",
      "additionalProperties": true
    },
    "citations": {
      "type": "array",
      "description": "Legal citations found within or referencing this document.",
      "items": {
        "$ref": "#/$defs/Citation"
      }
    },
    "url": {
      "type": "string",
      "format": "uri",
      "description": "Link to the document on vlex.com."
    }
  },
  "$defs": {
    "Citation": {
      "type": "object",
      "description": "A legal citation reference.",
      "properties": {
        "raw_text": {
          "type": "string",
          "example": "347 U.S. 483 (1954)"
        },
        "document_id": {
          "type": "string"
        },
        "citation_type": {
          "type": "string",
          "enum": ["case", "statute", "regulation", "secondary"]
        },
        "jurisdiction": {
          "type": "string"
        },
        "year": {
          "type": "integer"
        },
        "url": {
          "type": "string",
          "format": "uri"
        }
      }
    }
  }
}
