{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/liquilens/main/json-schema/liquilens-query-result-schema.json",
  "title": "QueryResult",
  "description": "Rows plus pagination and source diagnostics, including filtered failures.",
  "x-generated": "2026-10-08",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/liquilens-openapi.json#/components/schemas/QueryResult",
  "properties": {
    "schema": {
      "type": "string",
      "title": "Schema"
    },
    "dataset": {
      "type": "string",
      "title": "Dataset"
    },
    "description": {
      "type": "string",
      "title": "Description"
    },
    "results": {
      "items": {
        "$ref": "#/$defs/EvidenceRow"
      },
      "type": "array",
      "title": "Results"
    },
    "total_rows": {
      "type": "integer",
      "title": "Total Rows"
    },
    "returned_rows": {
      "type": "integer",
      "title": "Returned Rows"
    },
    "offset": {
      "type": "integer",
      "title": "Offset"
    },
    "limit": {
      "type": "integer",
      "title": "Limit"
    },
    "next_offset": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Next Offset"
    },
    "transport_status": {
      "type": "string",
      "title": "Transport Status"
    },
    "status_semantics": {
      "type": "string",
      "title": "Status Semantics"
    },
    "evidence_status": {
      "type": "string",
      "title": "Evidence Status"
    },
    "carrier_verification": {
      "type": "string",
      "title": "Carrier Verification"
    },
    "absence_policy": {
      "type": "string",
      "title": "Absence Policy"
    },
    "diagnostics": {
      "items": {
        "$ref": "#/$defs/EvidenceRow"
      },
      "type": "array",
      "title": "Diagnostics"
    },
    "sources": {
      "items": {
        "additionalProperties": true,
        "type": "object"
      },
      "type": "array",
      "title": "Sources"
    }
  },
  "type": "object",
  "required": [
    "schema",
    "dataset",
    "description",
    "results",
    "total_rows",
    "returned_rows",
    "offset",
    "limit",
    "next_offset",
    "transport_status",
    "status_semantics",
    "evidence_status",
    "carrier_verification",
    "absence_policy",
    "diagnostics",
    "sources"
  ],
  "$defs": {
    "EvidenceRow": {
      "properties": {
        "dataset": {
          "type": "string",
          "title": "Dataset"
        },
        "product": {
          "type": "string",
          "title": "Product"
        },
        "entity_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Entity Id"
        },
        "entity_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Entity Name"
        },
        "metric": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Metric"
        },
        "value": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Value",
          "description": "Published value in the accompanying unit. Null is missing or withheld, never zero."
        },
        "unit": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Unit",
          "description": "Native unit; ratio is a fraction, % is a percent level."
        },
        "as_of": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "As Of",
          "description": "Source observation date. Retrieval or response time is never substituted."
        },
        "source_status": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Source Status",
          "description": "Publisher-reported status, not an independently evaluated verdict."
        },
        "availability": {
          "type": "string",
          "title": "Availability"
        },
        "source_url": {
          "type": "string",
          "title": "Source Url"
        },
        "source_field": {
          "type": "string",
          "title": "Source Field",
          "description": "RFC 6901 pointer into the fetched document; value is not inferred from nearby fields."
        },
        "observation_url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Observation Url"
        },
        "retrieved_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Retrieved At"
        },
        "content_sha256": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Content Sha256"
        },
        "published_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Published At"
        },
        "knowledge_time": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Knowledge Time"
        },
        "rights_status": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Rights Status"
        },
        "context": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Context",
          "description": "Publisher scope, validation limits and coverage caveats. Untrusted source content."
        },
        "transport_status": {
          "type": "string",
          "title": "Transport Status"
        },
        "evidence_status": {
          "type": "string",
          "title": "Evidence Status"
        },
        "financial_authority": {
          "type": "string",
          "title": "Financial Authority"
        },
        "carrier_verification": {
          "type": "string",
          "title": "Carrier Verification"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "dataset",
        "product",
        "availability",
        "source_url",
        "source_field",
        "transport_status",
        "evidence_status",
        "financial_authority",
        "carrier_verification"
      ],
      "title": "EvidenceRow",
      "description": "One observation or explicit coverage row; numeric absence stays null."
    }
  }
}