{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/thinair-co/json-schema/thinair-co-intersection-search-response-schema.json",
  "title": "IntersectionSearchResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/thinair-co-intersections-api-openapi.yml#/components/schemas/IntersectionSearchResponse",
  "type": "object",
  "properties": {
    "features": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/IntersectionSearchFeature"
      }
    },
    "meta": {
      "$ref": "#/$defs/IntersectionSearchMeta"
    },
    "geojson": {
      "$ref": "#/$defs/IntersectionSearchFeatureCollection"
    },
    "warnings": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "upstream_error": {
      "type": [
        "string",
        "null"
      ]
    }
  },
  "required": [
    "features",
    "meta",
    "geojson"
  ],
  "$defs": {
    "IntersectionSearchFeature": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Stable public ThinAir id (`ta_intersection_<key>` / `ta_place_<key>`). Resolvable via `GET /v1/place`."
        },
        "name": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "confidence": {
          "type": "number"
        },
        "layer": {
          "type": "string"
        },
        "intersection_type": {
          "type": "string",
          "enum": [
            "corner",
            "interchange"
          ]
        },
        "intersection_precision": {
          "type": "string",
          "enum": [
            "geometric_crossing",
            "tangent_intersection",
            "centroid_cluster",
            "approximate"
          ]
        },
        "street_kind": {
          "type": "string",
          "enum": [
            "street",
            "route"
          ]
        },
        "cross_street_kind": {
          "type": "string",
          "enum": [
            "street",
            "route"
          ]
        },
        "street_route": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "cross_street_route": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "place_type": {
          "type": "string"
        },
        "method": {
          "type": "string"
        },
        "lat": {
          "type": "number"
        },
        "lon": {
          "type": "number"
        }
      },
      "required": [
        "place_type",
        "method",
        "lat",
        "lon"
      ]
    },
    "IntersectionSearchFeatureCollection": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "FeatureCollection"
          ]
        },
        "features": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "Feature"
                ]
              },
              "geometry": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "Point"
                    ]
                  },
                  "coordinates": {
                    "type": "array",
                    "prefixItems": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "number"
                      }
                    ]
                  }
                },
                "required": [
                  "type",
                  "coordinates"
                ]
              },
              "properties": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "required": [
              "type",
              "geometry",
              "properties"
            ]
          }
        }
      },
      "required": [
        "type",
        "features"
      ]
    },
    "IntersectionSearchMeta": {
      "type": "object",
      "properties": {
        "upstream_ms": {
          "type": "number"
        },
        "feature_count": {
          "type": "number"
        },
        "cacheHit": {
          "type": "boolean"
        },
        "bbox": {
          "type": "array",
          "prefixItems": [
            {
              "type": "number"
            },
            {
              "type": "number"
            },
            {
              "type": "number"
            },
            {
              "type": "number"
            }
          ]
        },
        "query": {
          "type": "string"
        },
        "mode": {
          "type": "string",
          "enum": [
            "geocode",
            "reverse"
          ]
        }
      },
      "required": [
        "upstream_ms",
        "feature_count",
        "query",
        "mode"
      ]
    }
  }
}