{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/squirrelscan-com/json-schema/squirrelscan-com-entity-map-response-schema.json",
  "title": "EntityMapResponse",
  "description": "The entity-map document plus the context the endpoint adds under `meta`.",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/squirrelscan-com-openapi.json#/components/schemas/EntityMapResponse",
  "type": "object",
  "required": [
    "format",
    "version",
    "site",
    "generatedAt",
    "summary",
    "nodes",
    "edges",
    "meta"
  ],
  "properties": {
    "format": {
      "type": "string",
      "const": "squirrelscan/entity-map"
    },
    "version": {
      "type": "integer",
      "const": 1
    },
    "site": {
      "type": "string",
      "description": "Site the audit started from."
    },
    "generatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "summary": {
      "$ref": "#/$defs/EntityMapSummary"
    },
    "nodes": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/EntityMapNode"
      }
    },
    "edges": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/EntityMapEdge"
      }
    },
    "pages": {
      "type": "array",
      "description": "Per-page contributions. Empty on hosted maps: the published copy drops it and the summary carries what a reader needs from it.",
      "items": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string"
          },
          "declares": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "references": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "entityCount": {
            "type": "integer"
          }
        }
      }
    },
    "meta": {
      "type": "object",
      "required": [
        "reportId",
        "websiteId",
        "auditedAt",
        "filtered",
        "counts",
        "pageFilterIncomplete",
        "backfilled"
      ],
      "properties": {
        "reportId": {
          "type": "string"
        },
        "websiteId": {
          "type": [
            "string",
            "null"
          ]
        },
        "auditedAt": {
          "type": "string",
          "format": "date-time"
        },
        "filtered": {
          "type": "boolean",
          "description": "True when a query filter removed at least one entity."
        },
        "counts": {
          "type": "object",
          "description": "Post-filter totals. Compare against `summary` to see whether this is a subset.",
          "required": [
            "nodes",
            "edges"
          ],
          "properties": {
            "nodes": {
              "type": "integer"
            },
            "edges": {
              "type": "integer"
            }
          }
        },
        "pageFilterIncomplete": {
          "type": "boolean",
          "description": "True when a `page` filter ran against a map containing an entity whose declaring-page list was capped. The result may be missing entities that really are declared on the requested page, because the omitted URLs are not in the document. Always false when no `page` filter was given."
        },
        "backfilled": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "pageLocalCount",
              "nodesWithoutIdCount",
              "conflictCount"
            ]
          },
          "description": "Summary counters that were RECONSTRUCTED because this map was published before the field existed, so they are estimates rather than site totals.\n\n`summary` normally describes the whole audited site while `nodes` may be a projection capped at 750 entities. A reconstructed counter can only be computed from the stored entities, so on a large site it reads low next to its un-reconstructed siblings. Render those fields as \"at least N\", or hide them, rather than as site totals.\n\nEmpty on a map published by a current CLI. Entity-level `pageLocal` is reconstructed exactly and is never listed here."
        }
      }
    }
  },
  "$defs": {
    "EntityMapEdge": {
      "type": "object",
      "description": "A typed reference from one node to another. A dangling target is deliberately absent from `nodes`.",
      "required": [
        "source",
        "predicate",
        "target",
        "dangling",
        "occurrences",
        "pages",
        "morePages"
      ],
      "properties": {
        "source": {
          "type": "string"
        },
        "predicate": {
          "type": "string",
          "description": "author, publisher, mainEntity, about, isPartOf, sameAs, logo, offers, …"
        },
        "target": {
          "type": "string"
        },
        "dangling": {
          "type": "boolean",
          "description": "True when no crawled page declares the target."
        },
        "occurrences": {
          "type": "integer"
        },
        "pages": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "morePages": {
          "type": "integer"
        }
      }
    },
    "EntityMapNode": {
      "type": "object",
      "description": "One entity, collapsed across every page that declares it. Every string here comes from site-declared JSON-LD and is untrusted; escape before rendering.",
      "required": [
        "key",
        "id",
        "types",
        "name",
        "properties",
        "occurrences",
        "pages",
        "morePages",
        "conflicts",
        "danglingRefs",
        "pageLocal"
      ],
      "properties": {
        "key": {
          "type": "string",
          "description": "Identity the builder settled on: the resolved `@id` when the site supplied one, otherwise a synthetic type+name key."
        },
        "id": {
          "type": [
            "string",
            "null"
          ],
          "description": "The resolved `@id`, or null when the entity declared none."
        },
        "types": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "properties": {
          "type": "object",
          "description": "Consistency-relevant properties, normalised to strings.",
          "properties": {
            "name": {
              "type": "string"
            },
            "url": {
              "type": "string"
            },
            "logo": {
              "type": "string"
            },
            "image": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "sameAs": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "telephone": {
              "type": "string"
            },
            "email": {
              "type": "string"
            },
            "address": {
              "type": "string"
            },
            "description": {
              "type": "string"
            }
          }
        },
        "occurrences": {
          "type": "integer",
          "description": "How many times the entity was declared across the crawl."
        },
        "pages": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Declaring pages, sorted and capped; the remainder is in morePages."
        },
        "morePages": {
          "type": "integer"
        },
        "conflicts": {
          "type": "array",
          "description": "Properties whose value differs between occurrences.",
          "items": {
            "type": "object",
            "required": [
              "property",
              "values"
            ],
            "properties": {
              "property": {
                "type": "string"
              },
              "values": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "value",
                    "pages",
                    "morePages"
                  ],
                  "properties": {
                    "value": {
                      "type": "string"
                    },
                    "pages": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "morePages": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        },
        "danglingRefs": {
          "type": "integer",
          "description": "Outgoing `@id` references from this node that nothing declares."
        },
        "pageLocal": {
          "type": "boolean",
          "description": "True when the entity describes one page rather than the site's subject matter: Question, Answer, BreadcrumbList, ListItem, WebPage, and an ImageObject with no name. These are hidden unless `include_page_local` is set."
        }
      }
    },
    "EntityMapSummary": {
      "type": "object",
      "description": "Site-wide totals. Describes the WHOLE audit even when the response is filtered.",
      "required": [
        "nodeCount",
        "edgeCount",
        "danglingCount",
        "pagesTotal",
        "pagesWithoutEntities",
        "nodesWithStableId",
        "stableIdShare",
        "pageLocalCount",
        "nodesWithoutIdCount",
        "conflictCount",
        "countsByType"
      ],
      "properties": {
        "nodeCount": {
          "type": "integer"
        },
        "edgeCount": {
          "type": "integer"
        },
        "danglingCount": {
          "type": "integer",
          "description": "Edges pointing at an `@id` no crawled page declares."
        },
        "pagesTotal": {
          "type": "integer"
        },
        "pagesWithoutEntities": {
          "type": "integer"
        },
        "nodesWithStableId": {
          "type": "integer",
          "description": "Entities carrying an `@id`."
        },
        "stableIdShare": {
          "type": "number",
          "minimum": 0,
          "maximum": 1,
          "description": "nodesWithStableId as a 0-1 share of nodeCount."
        },
        "pageLocalCount": {
          "type": "integer",
          "description": "Entities tagged `pageLocal` — what a graph hides by default."
        },
        "nodesWithoutIdCount": {
          "type": "integer",
          "description": "Entities with no `@id` declared on more than one page: the identity finding. An entity seen on a single page is not counted."
        },
        "conflictCount": {
          "type": "integer",
          "description": "Entities carrying at least one conflicting property. Counts entities, not properties."
        },
        "countsByType": {
          "type": "object",
          "description": "Occurrence count per schema.org `@type`.",
          "additionalProperties": {
            "type": "integer"
          }
        }
      }
    }
  }
}