{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/stackdata-io/json-schema/stackdata-io-structure-schema.json",
  "title": "Structure",
  "description": "What a `POST /v1/series` request can name for one dataset. Geography and time are not\ndimensions here: geography is `countries` (ISO3, plus `aggregates`), time is `period`.\n",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/stackdata-io-openapi.json#/components/schemas/Structure",
  "type": "object",
  "required": [
    "dataset",
    "servable",
    "frequencies",
    "periods",
    "countries",
    "aggregates",
    "max_countries",
    "dimensions"
  ],
  "properties": {
    "dataset": {
      "type": "string"
    },
    "title": {
      "type": [
        "string",
        "null"
      ]
    },
    "publisher": {
      "type": "string"
    },
    "unit": {
      "type": [
        "string",
        "null"
      ]
    },
    "licence": {
      "type": "object",
      "additionalProperties": true
    },
    "servable": {
      "type": "boolean"
    },
    "not_servable_reason": {
      "type": [
        "string",
        "null"
      ],
      "description": "Set when `servable` is false (e.g. `licence_unverified`, `no_data_path`, `not_in_serve_set`)."
    },
    "frequencies": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Frequency codes served. An empty list means undeclared (the period's frequency is accepted and filtered after the fetch)."
    },
    "periods": {
      "type": [
        "object",
        "null"
      ],
      "description": "Declared coverage per frequency, `{first, last}` in ISO form. Null means undeclared.",
      "additionalProperties": {
        "type": "object",
        "properties": {
          "first": {
            "type": "string"
          },
          "last": {
            "type": "string"
          }
        }
      }
    },
    "countries": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "ISO 3166-1 alpha-3 codes this dataset can serve. Listed only when our country table holds the code and the publisher's label for its source code names that country."
    },
    "aggregates": {
      "type": "array",
      "description": "Native region/aggregate codes usable in `countries` as given — every geography code the publisher lists that is not bound to a listed country (a code spelled like a listed country's ISO3 is left out, because a request naming it means the country).",
      "items": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "lang": {
            "type": "string"
          }
        }
      }
    },
    "max_countries": {
      "type": "integer",
      "description": "How many distinct geographies one request may name. 25, or 1 on readers that serve one geography per request."
    },
    "dimensions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/StructureDimension"
      }
    }
  },
  "$defs": {
    "StructureDimension": {
      "type": "object",
      "required": [
        "id",
        "members"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "role": {
          "type": "string",
          "enum": [
            "frequency"
          ],
          "description": "Present on the frequency dimension."
        },
        "members": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/StructureMember"
          }
        }
      }
    },
    "StructureMember": {
      "type": "object",
      "required": [
        "code",
        "label",
        "lang"
      ],
      "properties": {
        "code": {
          "type": "string"
        },
        "label": {
          "type": "string",
          "description": "The publisher's label",
          "in its own language.": null
        },
        "lang": {
          "type": "string",
          "description": "Language of `label`: the dataset's recorded title language, `und` when the catalog does not record one."
        },
        "period_frequency": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "A",
            "Q",
            "M",
            null
          ],
          "description": "On the frequency dimension only. The ISO period frequency this member serves (by the publisher's label, else its code); null when the structured path does not serve it — selecting it is `400 period_frequency_mismatch`."
        },
        "total": {
          "type": "boolean",
          "description": "True on the member the reader would use as the aggregate (total) default."
        },
        "default_reason": {
          "type": [
            "string",
            "null"
          ],
          "description": "Why this member is the default; present with `total`."
        }
      }
    }
  }
}