{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/journeyed-org/json-schema/journeyed-org-hub-twin-schema.json",
  "title": "HubTwin",
  "description": "JSON twin of a market hub or an anchor hub (<path>.json). bestOf lists the best-of pages (every one on a market hub, its own on an anchor hub). An anchor hub may carry its walking page, its upcoming event pages (events, soonest first), the comparison table of its first listed hotels and, only when the page shows one, labelled paid cards in sponsored (never part of ranked).",
  "x-generated": "2026-11-13",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/journeyed-org-openapi.json#/components/schemas/HubTwin",
  "type": "object",
  "required": [
    "schemaVersion",
    "url",
    "jsonUrl",
    "markdownUrl",
    "asOf",
    "publisher",
    "type",
    "title",
    "answer",
    "answerSentences",
    "market",
    "scoreName",
    "anchor",
    "countLine",
    "ranked",
    "questions",
    "anchors"
  ],
  "additionalProperties": false,
  "properties": {
    "schemaVersion": {
      "type": "integer",
      "const": 1
    },
    "url": {
      "type": "string",
      "format": "uri"
    },
    "jsonUrl": {
      "type": "string",
      "format": "uri"
    },
    "markdownUrl": {
      "type": "string",
      "format": "uri"
    },
    "asOf": {
      "type": "string",
      "format": "date"
    },
    "publisher": {
      "$ref": "#/$defs/Publisher"
    },
    "type": {
      "enum": [
        "market-hub",
        "anchor-hub"
      ]
    },
    "title": {
      "type": "string"
    },
    "answer": {
      "type": "string"
    },
    "answerSentences": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "minItems": 2,
      "maxItems": 2
    },
    "market": {
      "type": "string"
    },
    "scoreName": {
      "type": "string"
    },
    "anchor": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "name",
            "lat",
            "lon",
            "radiusMi"
          ],
          "additionalProperties": false,
          "properties": {
            "name": {
              "type": "string"
            },
            "lat": {
              "type": "number"
            },
            "lon": {
              "type": "number"
            },
            "radiusMi": {
              "type": "number"
            }
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "countLine": {
      "type": [
        "string",
        "null"
      ]
    },
    "ranked": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ScoredPlace"
      }
    },
    "questions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Link"
      }
    },
    "anchors": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Link"
      }
    },
    "bestOf": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Link"
      }
    },
    "walking": {
      "$ref": "#/$defs/Link"
    },
    "events": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "text",
          "url",
          "jsonUrl",
          "dates"
        ],
        "additionalProperties": false,
        "properties": {
          "text": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "jsonUrl": {
            "type": "string",
            "format": "uri"
          },
          "dates": {
            "type": "string"
          }
        }
      }
    },
    "table": {
      "$ref": "#/$defs/CompareTable"
    },
    "sponsored": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ListSponsoredPlace"
      }
    }
  },
  "$defs": {
    "CompareTable": {
      "type": "object",
      "description": "The comparison table a list page shows under its answer: one row per listed hotel, in the list order; cells are in column order. distance is straight-line miles; walk, walkMin, walkMi and drive follow OpenStreetMap ways (walk times are estimates). of names the guide section whose hotels the rows are. routing is present when the twin has no routing of its own.",
      "required": [
        "heading",
        "caption",
        "anchorUrl",
        "columns",
        "rows"
      ],
      "additionalProperties": false,
      "properties": {
        "heading": {
          "type": "string"
        },
        "caption": {
          "type": "string"
        },
        "anchorUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "of": {
          "type": "string"
        },
        "columns": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "id",
              "label"
            ],
            "additionalProperties": false,
            "properties": {
              "id": {
                "enum": [
                  "distance",
                  "walk",
                  "walkMin",
                  "walkMi",
                  "drive",
                  "parking",
                  "answer",
                  "checkin",
                  "pets",
                  "recognition",
                  "verified",
                  "profile"
                ]
              },
              "label": {
                "type": "string"
              }
            }
          }
        },
        "rows": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "rank",
              "placeId",
              "name",
              "url",
              "jsonUrl",
              "cells"
            ],
            "additionalProperties": false,
            "properties": {
              "rank": {
                "type": "integer"
              },
              "placeId": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "url": {
                "type": "string",
                "format": "uri"
              },
              "jsonUrl": {
                "type": "string",
                "format": "uri"
              },
              "cells": {
                "type": "array",
                "items": {
                  "type": "object",
                  "description": "One cell. facts are the sourced facts the text was worded from; a cell without them is computed (a distance, a walk, a count, a band). \"not stated\" means the value is not on record, never that it is no.",
                  "required": [
                    "text"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "text": {
                      "type": "string"
                    },
                    "facts": {
                      "type": "array",
                      "items": {
                        "$ref": "#/$defs/Fact"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "routing": {
          "$ref": "#/$defs/Routing"
        }
      }
    },
    "Fact": {
      "type": "object",
      "description": "One sourced fact. Exactly one of sourceUrl and dataset is set. text is the wording the page shows; value is the stored canonical value.",
      "required": [
        "key",
        "text",
        "value",
        "unit",
        "sourceUrl",
        "dataset",
        "sourceLabel",
        "licenseBasis",
        "checkedOn"
      ],
      "additionalProperties": false,
      "properties": {
        "key": {
          "type": "string"
        },
        "text": {
          "type": "string"
        },
        "value": {
          "type": [
            "string",
            "null"
          ]
        },
        "unit": {
          "type": [
            "string",
            "null"
          ]
        },
        "sourceUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "dataset": {
          "type": [
            "string",
            "null"
          ]
        },
        "sourceLabel": {
          "type": "string"
        },
        "licenseBasis": {
          "type": "string"
        },
        "checkedOn": {
          "type": "string",
          "format": "date"
        }
      }
    },
    "Link": {
      "type": "object",
      "required": [
        "text",
        "url",
        "jsonUrl"
      ],
      "additionalProperties": false,
      "properties": {
        "text": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "jsonUrl": {
          "type": "string",
          "format": "uri"
        }
      }
    },
    "ListSponsoredPlace": {
      "type": "object",
      "description": "A labelled paid card above a best-of, walking or landmark list. Never inside ranked[] and never a change to any rank or score: organicRank is the hotel position in ranked[] when the list shows it, else null; score is its unchanged place score.",
      "required": [
        "label",
        "placeId",
        "name",
        "url",
        "organicRank",
        "score",
        "distanceMi"
      ],
      "additionalProperties": false,
      "properties": {
        "label": {
          "type": "string"
        },
        "placeId": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "organicRank": {
          "type": [
            "integer",
            "null"
          ]
        },
        "score": {
          "type": "number"
        },
        "distanceMi": {
          "type": "number"
        },
        "rankedOn": {
          "type": "object",
          "description": "Event pages: the hotel position on the full best-of list the page links to, as that list publishes it, when the page shows only its first rows.",
          "required": [
            "rank",
            "total",
            "title",
            "url"
          ],
          "additionalProperties": false,
          "properties": {
            "rank": {
              "type": "integer"
            },
            "total": {
              "type": "integer"
            },
            "title": {
              "type": "string"
            },
            "url": {
              "type": "string",
              "format": "uri"
            }
          }
        }
      }
    },
    "Publisher": {
      "type": "object",
      "description": "The publisher. disclosure and parent are present only when the publisher has a parent company.",
      "required": [
        "name"
      ],
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string"
        },
        "disclosure": {
          "type": "string"
        },
        "parent": {
          "type": "string"
        }
      }
    },
    "Routing": {
      "type": "object",
      "description": "What sources every routed figure of a twin: the credit (OpenStreetMap contributors, routed with the named engine), the date of the map data, the date computed and the method of each figure.",
      "required": [
        "source",
        "engine",
        "mapDataOn",
        "computedOn",
        "walkMethod",
        "driveMethod",
        "note"
      ],
      "additionalProperties": false,
      "properties": {
        "source": {
          "$ref": "#/$defs/Source"
        },
        "engine": {
          "type": "string"
        },
        "mapDataOn": {
          "type": "string",
          "format": "date"
        },
        "computedOn": {
          "type": "string",
          "format": "date"
        },
        "walkMethod": {
          "type": "string"
        },
        "driveMethod": {
          "type": "string"
        },
        "note": {
          "type": "string"
        }
      }
    },
    "ScoredPlace": {
      "type": "object",
      "required": [
        "rank",
        "placeId",
        "name",
        "url",
        "jsonUrl",
        "score",
        "distanceMi"
      ],
      "additionalProperties": false,
      "properties": {
        "rank": {
          "type": "integer"
        },
        "placeId": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "jsonUrl": {
          "type": "string",
          "format": "uri"
        },
        "score": {
          "type": "number"
        },
        "distanceMi": {
          "type": "number"
        }
      }
    },
    "Source": {
      "type": "object",
      "required": [
        "label",
        "url",
        "dataset",
        "licenseBasis",
        "checkedOn"
      ],
      "additionalProperties": false,
      "properties": {
        "label": {
          "type": "string"
        },
        "url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "dataset": {
          "type": [
            "string",
            "null"
          ]
        },
        "licenseBasis": {
          "type": "string"
        },
        "checkedOn": {
          "type": "string",
          "format": "date"
        }
      }
    }
  }
}