{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/oracle/main/json-schema/oracle-analyze-document-result-schema.json",
  "title": "AnalyzeDocumentResult",
  "description": "The document analysis results.",
  "x-generated": "2026-10-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/oracle-aiservicedocument-api-openapi.yml#/components/schemas/AnalyzeDocumentResult",
  "properties": {
    "detectedDocumentTypes": {
      "description": "An array of detected document types.",
      "items": {
        "$ref": "#/$defs/DetectedDocumentType"
      },
      "type": "array"
    },
    "detectedLanguages": {
      "description": "An array of detected languages.",
      "items": {
        "$ref": "#/$defs/DetectedLanguage"
      },
      "type": "array"
    },
    "documentClassificationModelVersion": {
      "description": "The document classification model version.",
      "type": "string"
    },
    "documentMetadata": {
      "$ref": "#/$defs/DocumentMetadata"
    },
    "errors": {
      "description": "The errors encountered during document analysis.",
      "items": {
        "$ref": "#/$defs/ProcessingError"
      },
      "type": "array"
    },
    "keyValueExtractionModelVersion": {
      "description": "The document keyValue extraction model version.",
      "type": "string"
    },
    "languageClassificationModelVersion": {
      "description": "The document language classification model version.",
      "type": "string"
    },
    "pages": {
      "description": "The array of a Page.",
      "items": {
        "$ref": "#/$defs/Page"
      },
      "type": "array"
    },
    "searchablePdf": {
      "description": "The searchable PDF file that was generated.",
      "format": "byte",
      "type": "string"
    },
    "tableExtractionModelVersion": {
      "description": "The document table extraction model version.",
      "type": "string"
    },
    "textExtractionModelVersion": {
      "description": "The document text extraction model version.",
      "type": "string"
    }
  },
  "required": [
    "documentMetadata",
    "pages"
  ],
  "type": "object",
  "$defs": {
    "BoundingPolygon": {
      "description": "The object-bounding polygon box.",
      "properties": {
        "normalizedVertices": {
          "description": "An array of normalized points defining the polygon's perimeter, with an implicit segment between subsequent points and between the first and last point.\nRectangles are defined with four points. For example, `[{\"x\": 0, \"y\": 0}, {\"x\": 1, \"y\": 0}, {\"x\": 1, \"y\": 0.5}, {\"x\": 0, \"y\": 0.5}]` represents the top half of an image.\n",
          "items": {
            "$ref": "#/$defs/NormalizedVertex"
          },
          "type": "array"
        }
      },
      "required": [
        "normalizedVertices"
      ],
      "type": "object"
    },
    "Cell": {
      "description": "A single cell in a table.",
      "properties": {
        "boundingPolygon": {
          "$ref": "#/$defs/BoundingPolygon"
        },
        "columnIndex": {
          "description": "The index of the cell inside the column.",
          "type": "integer"
        },
        "confidence": {
          "description": "The confidence score between 0 and 1.",
          "format": "float",
          "maximum": 1,
          "minimum": 0,
          "type": "number"
        },
        "rowIndex": {
          "description": "The index of the cell inside the row.",
          "type": "integer"
        },
        "text": {
          "description": "The text recognized in the cell.",
          "type": "string"
        },
        "wordIndexes": {
          "description": "The words detected in the cell.",
          "items": {
            "type": "integer"
          },
          "type": "array"
        }
      },
      "required": [
        "text",
        "rowIndex",
        "columnIndex",
        "confidence",
        "boundingPolygon",
        "wordIndexes"
      ],
      "type": "object"
    },
    "DetectedDocumentType": {
      "description": "The detected document type.",
      "properties": {
        "confidence": {
          "description": "The confidence score between 0 and 1.",
          "format": "float",
          "maximum": 1,
          "minimum": 0,
          "type": "number"
        },
        "documentId": {
          "description": "The [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the Key-Value Extraction model that was used to extract the key-value pairs.",
          "type": "string"
        },
        "documentType": {
          "description": "The document type.",
          "type": "string"
        }
      },
      "required": [
        "documentType",
        "confidence"
      ],
      "type": "object"
    },
    "DetectedLanguage": {
      "description": "The language detected in a document.",
      "properties": {
        "confidence": {
          "description": "The confidence score between 0 and 1.",
          "format": "float",
          "maximum": 1,
          "minimum": 0,
          "type": "number"
        },
        "language": {
          "description": "The document language, abbreviated according to the BCP 47 syntax.",
          "format": "x-obmcs-human-language",
          "type": "string"
        }
      },
      "required": [
        "language",
        "confidence"
      ],
      "type": "object"
    },
    "Dimensions": {
      "description": "The width and height of a page.",
      "properties": {
        "height": {
          "description": "The height of a page.",
          "format": "double",
          "type": "number"
        },
        "unit": {
          "description": "The unit of length.",
          "enum": [
            "PIXEL",
            "INCH"
          ],
          "type": "string"
        },
        "width": {
          "description": "the width of a page.",
          "format": "double",
          "type": "number"
        }
      },
      "required": [
        "width",
        "height",
        "unit"
      ],
      "type": "object"
    },
    "DocumentField": {
      "description": "Form field.",
      "properties": {
        "fieldLabel": {
          "$ref": "#/$defs/FieldLabel"
        },
        "fieldName": {
          "$ref": "#/$defs/FieldName"
        },
        "fieldType": {
          "description": "The field type.",
          "enum": [
            "LINE_ITEM_GROUP",
            "LINE_ITEM",
            "LINE_ITEM_FIELD",
            "KEY_VALUE"
          ],
          "type": "string"
        },
        "fieldValue": {
          "$ref": "#/$defs/FieldValue"
        }
      },
      "required": [
        "fieldType",
        "fieldValue"
      ]
    },
    "DocumentMetadata": {
      "description": "The document information.",
      "properties": {
        "mimeType": {
          "description": "The result data format.",
          "type": "string"
        },
        "pageCount": {
          "description": "Teh number of pages in the document.",
          "minimum": 1,
          "type": "integer"
        }
      },
      "required": [
        "pageCount",
        "mimeType"
      ],
      "type": "object"
    },
    "FieldLabel": {
      "description": "The label in a field.",
      "properties": {
        "confidence": {
          "description": "The confidence score between 0 and 1.",
          "format": "float",
          "maximum": 1,
          "minimum": 0,
          "type": "number"
        },
        "name": {
          "description": "The name of the field label.",
          "maxLength": 255,
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "name"
      ],
      "type": "object"
    },
    "FieldName": {
      "description": "The name of a form field.",
      "properties": {
        "boundingPolygon": {
          "$ref": "#/$defs/BoundingPolygon"
        },
        "confidence": {
          "description": "The confidence score between 0 and 1.",
          "format": "float",
          "maximum": 1,
          "minimum": 0,
          "type": "number"
        },
        "name": {
          "description": "The name of the field.",
          "type": "string"
        },
        "wordIndexes": {
          "description": "The indexes of the words in the field name.",
          "items": {
            "type": "integer"
          },
          "type": "array"
        }
      },
      "required": [
        "name"
      ],
      "type": "object"
    },
    "FieldValue": {
      "description": "The value of a form field.",
      "properties": {
        "boundingPolygon": {
          "$ref": "#/$defs/BoundingPolygon"
        },
        "confidence": {
          "description": "The confidence score between 0 and 1.",
          "format": "float",
          "maximum": 1,
          "minimum": 0,
          "type": "number"
        },
        "text": {
          "description": "The detected text of a field.",
          "type": "string"
        },
        "valueType": {
          "description": "The type of data detected.\n",
          "enum": [
            "STRING",
            "DATE",
            "TIME",
            "PHONE_NUMBER",
            "NUMBER",
            "INTEGER",
            "ARRAY"
          ],
          "type": "string"
        },
        "wordIndexes": {
          "description": "The indexes of the words in the field value.",
          "items": {
            "type": "integer"
          },
          "type": "array"
        }
      },
      "required": [
        "valueType",
        "confidence",
        "boundingPolygon",
        "wordIndexes"
      ],
      "type": "object"
    },
    "Line": {
      "description": "The line of text.",
      "properties": {
        "boundingPolygon": {
          "$ref": "#/$defs/BoundingPolygon"
        },
        "confidence": {
          "description": "The confidence score between 0 and 1.",
          "format": "float",
          "maximum": 1,
          "minimum": 0,
          "type": "number"
        },
        "text": {
          "description": "The text recognized.",
          "type": "string"
        },
        "wordIndexes": {
          "description": "The array of words.",
          "items": {
            "type": "integer"
          },
          "type": "array"
        }
      },
      "required": [
        "text",
        "confidence",
        "boundingPolygon",
        "wordIndexes"
      ],
      "type": "object"
    },
    "NormalizedVertex": {
      "description": "An (x, y) coordinate in the image with dimensions normalized from zero to one.\nThe origin is at top left, with the positive x-axis pointing right and the positive y-axis pointing down.\nThe bottom right corner is at (1, 1).\n",
      "properties": {
        "x": {
          "description": "The X-axis normalized coordinate.",
          "format": "double",
          "maximum": 1,
          "minimum": 0,
          "type": "number"
        },
        "y": {
          "description": "The Y-axis normalized coordinate.",
          "format": "double",
          "maximum": 1,
          "minimum": 0,
          "type": "number"
        }
      },
      "required": [
        "x",
        "y"
      ],
      "type": "object"
    },
    "Page": {
      "description": "One page document analysis result.",
      "properties": {
        "detectedDocumentTypes": {
          "description": "An array of detected document types.",
          "items": {
            "$ref": "#/$defs/DetectedDocumentType"
          },
          "type": "array"
        },
        "detectedLanguages": {
          "description": "An array of detected languages.",
          "items": {
            "$ref": "#/$defs/DetectedLanguage"
          },
          "type": "array"
        },
        "dimensions": {
          "$ref": "#/$defs/Dimensions"
        },
        "documentFields": {
          "description": "The form fields detected on the page.",
          "items": {
            "$ref": "#/$defs/DocumentField"
          },
          "type": "array"
        },
        "lines": {
          "description": "The lines of text detected on the page.",
          "items": {
            "$ref": "#/$defs/Line"
          },
          "type": "array"
        },
        "pageNumber": {
          "description": "The document page number.",
          "minimum": 1,
          "type": "integer"
        },
        "tables": {
          "description": "The tables detected on the page.",
          "items": {
            "$ref": "#/$defs/Table"
          },
          "type": "array"
        },
        "words": {
          "description": "The words detected on the page.",
          "items": {
            "$ref": "#/$defs/Word"
          },
          "type": "array"
        }
      },
      "required": [
        "pageNumber"
      ],
      "type": "object"
    },
    "ProcessingError": {
      "description": "The error in document processing.",
      "properties": {
        "code": {
          "description": "The error code.",
          "type": "string"
        },
        "message": {
          "description": "The error message.",
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object"
    },
    "Table": {
      "description": "The table extracted from a document.",
      "properties": {
        "bodyRows": {
          "description": "The body rows.",
          "items": {
            "$ref": "#/$defs/TableRow"
          },
          "type": "array"
        },
        "boundingPolygon": {
          "$ref": "#/$defs/BoundingPolygon"
        },
        "columnCount": {
          "description": "The number of columns.",
          "minimum": 0,
          "type": "integer"
        },
        "confidence": {
          "description": "The confidence score between 0 and 1.",
          "format": "float",
          "maximum": 1,
          "minimum": 0,
          "type": "number"
        },
        "footerRows": {
          "description": "the footer rows.",
          "items": {
            "$ref": "#/$defs/TableRow"
          },
          "type": "array"
        },
        "headerRows": {
          "description": "The header rows.",
          "items": {
            "$ref": "#/$defs/TableRow"
          },
          "type": "array"
        },
        "rowCount": {
          "description": "The number of rows.",
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "rowCount",
        "columnCount",
        "headerRows",
        "bodyRows",
        "footerRows",
        "confidence",
        "boundingPolygon"
      ],
      "type": "object"
    },
    "TableRow": {
      "description": "A single row in a table.",
      "properties": {
        "cells": {
          "description": "The cells in the row.",
          "items": {
            "$ref": "#/$defs/Cell"
          },
          "type": "array"
        }
      },
      "required": [
        "cells"
      ]
    },
    "Word": {
      "description": "A single word.",
      "properties": {
        "boundingPolygon": {
          "$ref": "#/$defs/BoundingPolygon"
        },
        "confidence": {
          "description": "the confidence score between 0 and 1.",
          "format": "float",
          "maximum": 1,
          "minimum": 0,
          "type": "number"
        },
        "text": {
          "description": "The string of text characters in the word.",
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "text",
        "confidence",
        "boundingPolygon"
      ],
      "type": "object"
    }
  }
}